{"version":3,"sources":["../../../src/Promise.ts","../../../src/Object.assign.ts","../../../src/requestAnimationFrame.ts","../../../src/Math.sign.ts","../../../src/Number.isInteger.ts","../../../src/index.ts","../../../src/accessibleTarget.ts","../../../src/AccessibilityManager.ts","../../../src/InteractionData.ts","../../../../../node_modules/tslib/tslib.es6.js","../../../src/InteractionEvent.ts","../../../src/InteractionTrackingData.ts","../../../src/TreeSearch.ts","../../../src/interactiveTarget.ts","../../../src/InteractionManager.ts","../../../src/Application.ts","../../../src/ResizePlugin.ts","../../../src/Extract.ts","../../../src/const.ts","../../../src/resources/BlobResource.ts","../../../src/resources/CompressedTextureResource.ts","../../../src/loaders/CompressedTextureLoader.ts","../../../src/loaders/registerCompressedTextures.ts","../../../src/loaders/DDSLoader.ts","../../../src/loaders/KTXLoader.ts","../../../src/ParticleContainer.ts","../../../src/ParticleBuffer.ts","../../../src/ParticleRenderer.ts","../../../src/TextStyle.ts","../../../src/TextMetrics.ts","../../../src/Text.ts","../../../src/settings.ts","../../../src/CountLimiter.ts","../../../src/BasePrepare.ts","../../../src/Prepare.ts","../../../src/TimeLimiter.ts","../../../src/Spritesheet.ts","../../../src/SpritesheetLoader.ts","../../../src/TilingSprite.ts","../../../src/TilingSpriteRenderer.ts","../../../src/BitmapFontData.ts","../../../src/formats/TextFormat.ts","../../../src/formats/XMLFormat.ts","../../../src/formats/XMLStringFormat.ts","../../../src/formats/index.ts","../../../src/utils/drawGlyph.ts","../../../src/utils/generateFillStyle.ts","../../../src/utils/splitTextToCharacters.ts","../../../src/utils/extractCharCode.ts","../../../src/BitmapFont.ts","../../../src/utils/resolveCharacters.ts","../../../src/BitmapText.ts","../../../src/BitmapFontLoader.ts","../../../../../../node_modules/tslib/tslib.es6.js","../../../src/AlphaFilter.ts","../../../src/generateBlurFragSource.ts","../../../../../constants/dist/esm/constants.js","../../../src/BlurFilterPass.ts","../../../src/generateBlurVertSource.ts","../../../src/BlurFilter.ts","../../../src/ColorMatrixFilter.ts","../../../src/DisplacementFilter.ts","../../../src/FXAAFilter.ts","../../../../constants/dist/esm/constants.js","../../../src/NoiseFilter.ts","../../../src/AnimatedSprite.ts","../../../src/Graphics.ts","../../../src/utils/PolygonUtils.ts","../../../src/CanvasGraphicsRenderer.ts","../../../src/CanvasSpriteRenderer.ts","../../../src/Sprite.ts","../../../src/CanvasExtract.ts","../../../src/CanvasPrepare.ts","../../../src/Container.ts","../../../src/DisplayObject.ts","../../../src/utils/CanvasMaskManager.ts","../../../src/utils/canUseNewCanvasBlendModes.ts","../../../src/CanvasRenderer.ts","../../../src/utils/mapCanvasBlendModesToPixi.ts","../../../src/canvasUtils.ts","../../../src/Renderer.ts","../../../src/BaseTexture.ts","../node_modules/@pixi/canvas-mesh/dist/esm/canvas-mesh.js","../node_modules/promise-polyfill/src/index.js","../node_modules/timers-browserify/main.js","../node_modules/setimmediate/setImmediate.js","../node_modules/promise-polyfill/src/finally.js","../node_modules/promise-polyfill/src/allSettled.js"],"names":["self","Promise","Object","assign","Date","now","prototype","getTime","performance","lastTime","vendors","length","requestAnimationFrame","p","cancelAnimationFrame","callback","TypeError","currentTime","delay","setTimeout","id","clearTimeout","Math","sign","x","Number","isNaN","isInteger","value","isFinite","floor","accessibleTarget","accessible","accessibleTitle","accessibleHint","tabIndex","_accessibleActive","_accessibleDiv","accessibleType","accessiblePointerEvents","accessibleChildren","renderId","mixin","renderer","debug","_isActive","_isMobileAccessibility","pool","children","androidUpdateCount","androidUpdateFrequency","this","_hookDiv","tablet","phone","createTouchHook","div","document","createElement","style","width","DIV_TOUCH_SIZE","height","position","top","DIV_TOUCH_POS_X","left","DIV_TOUCH_POS_Y","zIndex","toString","_onKeyDown","bind","_onMouseMove","addEventListener","hookDiv","DIV_HOOK_SIZE","DIV_HOOK_POS_X","DIV_HOOK_POS_Y","backgroundColor","title","activate","destroyTouchHook","body","appendChild","removeChild","removeEventListener","on","update","view","parentNode","deactivate","off","updateAccessibleObjects","displayObject","visible","interactive","addChild","i","android","device","renderingToScreen","_lastObjectRendered","getBoundingClientRect","viewWidth","viewHeight","resolution","sx","sy","child","push","hitArea","wt","worldTransform","tx","a","ty","y","d","getBounds","capHitArea","getAttribute","setAttribute","updateDebugHTML","innerHTML","type","pop","borderStyle","navigator","userAgent","toLowerCase","indexOf","match","_onClick","_onFocus","_onFocusOut","pointerEvents","e","interactionManager","plugins","interaction","target","eventData","dispatchEvent","keyCode","movementX","movementY","destroy","pressure","rotationAngle","twist","tangentialPressure","global","originalEvent","identifier","isPrimary","button","buttons","tiltX","tiltY","pointerType","getLocalPosition","point","globalPos","applyInverse","copyEvent","event","which","reset","b","setPrototypeOf","__proto__","Array","hasOwnProperty","stopped","stopsPropagatingAt","stopPropagationHint","currentTarget","data","stopPropagation","pointerId","_pointerId","_flags","InteractionTrackingData","FLAGS","NONE","_doSet","flag","yn","flags","OVER","RIGHT_DOWN","LEFT_DOWN","freeze","_tempPoint","recursiveFindHit","interactionEvent","func","hitTest","hit","interactiveParent","hitTestChildren","contains","_mask","containsPoint","interactiveChildren","childHit","parent","findHit","interactiveTarget","cursor","undefined","_trackedPointers","hitTestEvent","options","autoPreventDefault","interactionFrequency","mouse","set","activeInteractionData","interactionDataPool","InteractionEvent","interactionDOMElement","moveWhenInside","eventsAdded","tickerAdded","mouseOverRenderer","supportsTouchEvents","supportsPointerEvents","PointerEvent","onPointerUp","processPointerUp","onPointerCancel","processPointerCancel","onPointerDown","processPointerDown","onPointerMove","processPointerMove","onPointerOut","processPointerOverOut","onPointerOver","cursorStyles","default","pointer","currentCursorMode","delayedEvents","search","_tempDisplayObject","_eventListenerOptions","capture","passive","_useSystemTicker","useSystemTicker","setTargetElement","__","constructor","create","addTickerListener","removeTickerListener","globalPoint","root","lastObjectRendered","processInteractive","element","removeEvents","addEvents","system","add","tickerUpdate","INTERACTION","remove","msPointerEnabled","msContentZooming","msTouchAction","touchAction","deltaTime","_deltaTime","_didMove","k","interactionData","configureInteractionEventForDOMEvent","setCursorMode","mode","applyStyles","OffscreenCanvas","call","eventString","emit","delayDispatchEvent","mapPositionToPoint","rect","parentElement","resolutionMultiplier","delayedLen","events","normalizeToPointerData","isNormalized","cancelable","preventDefault","eventLen","getInteractionDataForPointerId","isRightButton","trackedPointers","rightDown","leftDown","onPointerComplete","cancelled","eventAppend","releaseInteractionDataForPointerId","trackingData","isTouch","isMouse","isMouseTap","test","isDown","over","none","pointerEvent","clientX","clientY","globalX","globalY","normalizedEvents","TouchEvent","li","changedTouches","touch","touches","radiusX","radiusY","force","layerX","offsetX","layerY","offsetY","MouseEvent","tempEvent","removeAllListeners","stage","forceCanvas","Application","_plugins","forEach","plugin","init","registerPlugin","render","screen","removeView","stageOptions","slice","reverse","defineProperty","dom","queueResize","_resizeTo","resize","get","cancelResize","_resizeId","innerWidth","innerHeight","resizeTo","TEMP_RECT","image","format","quality","Image","src","base64","canvas","toDataURL","frame","renderTexture","flipY","generated","generateTexture","baseTexture","canvasBuffer","webglPixels","Uint8Array","gl","readPixels","RGBA","UNSIGNED_BYTE","canvasData","context","getImageData","Extract","arrayPostDivide","putImageData","scale","drawImage","pixels","out","alpha","round","min","__generator","thisArg","f","t","g","_","label","sent","trys","ops","next","verb","Symbol","iterator","n","v","op","done","step","source","autoLoad","origin","buffer","load","loaded","onBlobLoaded","rawBinaryData","_data","_arguments","generator","fetch","blob","arrayBuffer","Uint32Array","P","resolve","reject","fulfilled","rejected","result","then","apply","levels","_width","_height","_extension","CompressedTextureResource","_formatToExtension","levelBuffers","_levelBuffers","_createLevelBuffers","uint8View","upload","_texture","_glTexture","extensions","Error","j","levelID","levelWidth","levelHeight","levelBuffer","compressedTexImage2D","TEXTURE_2D","blockWidth","blockHeight","imageWidth","imageHeight","buffers","offset","byteOffset","alignedLevelWidth","alignedLevelHeight","levelSize","INTERNAL_FORMAT_TO_BYTES_PER_PIXEL","use","resource","TYPE","JSON","cacheID","textures","textureURL","fallbackURL","texture","CompressedTextureLoader","textureFormats","url","loadOptions","crossOrigin","metadata","imageMetadata","parentResource","resourcePath","replace","baseUrl","resourceName","res","error","getContext","s3tc","getExtension","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","extensionName","textureExtensions","extension","getPrototypeOf","console","warn","registerCompressedTextures","resources","map","mipmap","OFF","alphaMode","NO_PREMULTIPLIED_ALPHA","addToCache","setExtensionXhrType","XHR_RESPONSE_TYPE","BUFFER","DXGI_FORMAT","D3D10_RESOURCE_DIMENSION","DDS_HEADER_SIZE","DDS_FIELDS","DDS_PF_FIELDS","DDS_DX10_FIELDS","FOURCC_TO_FORMAT","INTERNAL_FORMATS","COMPRESSED_RGBA_S3TC_DXT1_EXT","_a","COMPRESSED_RGBA_S3TC_DXT3_EXT","COMPRESSED_RGBA_S3TC_DXT5_EXT","DXGI_TO_FORMAT","DXGI_FORMAT_BC1_TYPELESS","DXGI_FORMAT_BC1_UNORM","DXGI_FORMAT_BC2_TYPELESS","DXGI_FORMAT_BC2_UNORM","DXGI_FORMAT_BC3_TYPELESS","DXGI_FORMAT_BC3_UNORM","DXGI_FORMAT_BC1_UNORM_SRGB","COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT","DXGI_FORMAT_BC2_UNORM_SRGB","COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT","DXGI_FORMAT_BC3_UNORM_SRGB","COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT","name","DDSLoader","parse","err","header","BYTES_PER_ELEMENT","mipmapCount","pixelFormat","formatFlags","fourCC","texData","DDS_MAGIC_SIZE","dx10Header","dxgiFormat","resourceDimension","miscFlag","arraySize","DDS_DIMENSION_TEXTURE3D","imageBuffers","pixelSize","imageSize","max","imageOffset","FILE_IDENTIFIER","KTX_FIELDS","TYPES_TO_BYTES_PER_COMPONENT","UNSIGNED_SHORT","FLOAT","HALF_FLOAT","FORMATS_TO_COMPONENTS","_b","RGB","LUMINANCE","LUMINANCE_ALPHA","ALPHA","TYPES_TO_BYTES_PER_PIXEL","UNSIGNED_SHORT_4_4_4_4","UNSIGNED_SHORT_5_5_5_1","UNSIGNED_SHORT_5_6_5","KTXLoader","dataView","DataView","validate","littleEndian","getUint32","glType","glFormat","glInternalFormat","pixelWidth","pixelHeight","pixelDepth","numberOfArrayElements","numberOfFaces","numberOfMipmapLevels","bytesOfKeyValueData","imagePixelByteSize","alignedWidth","alignedHeight","imagePixels","mipByteSize","mipWidth","mipHeight","alignedMipWidth","alignedMipHeight","mipmapLevel","elementOffset","arrayElement","mips","getUint8","TEXT_GRADIENT","properties","dynamicPropertyFlags","size","geometry","indexBuffer","dynamicProperties","staticProperties","property","attributeName","uploadFunction","staticStride","staticBuffer","staticData","staticDataUint32","dynamicStride","dynamicBuffer","dynamicData","dynamicDataUint32","_updateID","initBuffers","dynamicOffset","addIndex","dynBuffer","ArrayBuffer","Float32Array","staticOffset","statBuffer","addAttribute","uploadDynamic","startIndex","amount","uploadStatic","shader","tempMatrix","uploadVertices","uploadPosition","uploadRotation","uploadUvs","uploadTint","from","state","for2d","container","maxSize","_maxSize","batchSize","_batchSize","totalChildren","autoResize","_buffers","generateBuffers","blendMode","m","copyTo","prepend","globalUniforms","uniforms","projectionMatrix","translationMatrix","toArray","uColor","tintRgb","worldAlpha","uSampler","updateStatic","_generateOneMoreBuffer","bid","_bufferUpdateIDs","drawElements","TRIANGLES","_properties","array","stride","w0","w1","h0","h1","sprite","trim","orig","anchor","spritePosition","spriteRotation","rotation","textureUvs","_uvs","x0","y0","x1","y1","x2","y2","x3","y3","premultiplied","argb","_tintRGB","defaultStyle","align","breakWords","dropShadow","dropShadowAlpha","dropShadowAngle","PI","dropShadowBlur","dropShadowColor","dropShadowDistance","fill","fillGradientType","LINEAR_VERTICAL","fillGradientStops","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","letterSpacing","lineHeight","lineJoin","miterLimit","padding","stroke","strokeThickness","textBaseline","whiteSpace","wordWrap","wordWrapWidth","leading","genericFontFamilies","styleID","deepCopyProperties","clone","clonedProperties","TextStyle","_align","_breakWords","_dropShadow","_dropShadowAlpha","_dropShadowAngle","_dropShadowBlur","_dropShadowColor","outputColor","getColor","_dropShadowDistance","_fill","_fillGradientType","_fillGradientStops","array1","array2","isArray","areArraysEqual","_fontFamily","_fontSize","_fontStyle","_fontVariant","_fontWeight","_letterSpacing","_lineHeight","_leading","_lineJoin","_miterLimit","_padding","_stroke","_strokeThickness","_textBaseline","_trim","_whiteSpace","_wordWrap","_wordWrapWidth","toFontString","fontSizeString","fontFamilies","split","join","getSingleColor","color","propertyObj","prop","text","lines","lineWidths","maxLineWidth","fontProperties","measureText","TextMetrics","_canvas","font","measureFont","ascent","lineWidth","line","cache","collapseSpaces","collapseNewlines","canPrependSpaces","tokens","tokenize","token","isNewline","addLine","currIsBreakingSpace","isBreakingSpace","lastIsBreakingSpace","tokenWidth","getFromCache","canBreakWords","characters","wordWrapSplit","char","nextChar","lastChar","canBreakChars","characterWidth","isLastToken","newLine","trimRight","key","spacing","_newlines","charCodeAt","_nextChar","_breakingSpaces","_token","_char","_index","_fonts","descent","_context","metricsString","METRICS_STRING","BASELINE_SYMBOL","ceil","baseline","HEIGHT_MULTIPLIER","BASELINE_MULTIPLIER","fillStyle","fillRect","fillText","imagedata","idx","stop","clearMetrics","c","ex","settings","UPLOADS_PER_FRAME","maxItemsPerFrame","itemsLeft","beginFrame","allowedToUpload","findMultipleBaseTextures","item","queue","_textures","findBaseTexture","findTexture","drawText","_helper","updateText","calculateTextStyle","findText","findTextStyle","limiter","CountLimiter","uploadHookHelper","addHooks","uploadHooks","completes","ticking","delayedTick","prepareItems","registerFindHook","registerUploadHook","addOnce","tick","UTILITY","uploaded","_destroyed","len","shift","addHook","uploadHook","uploadBaseTextures","_glTextures","CONTEXT_UID","uploadGraphics","finishPoly","updateBatches","batches","batchable","_resolveDirectShader","findGraphics","maxMilliseconds","frameStart","resolutionFilename","animations","_updateResolution","_frames","frames","_frameKeys","keys","_batchIndex","_callback","meta","parseFloat","setResolution","Spritesheet","BATCH_SIZE","_processFrames","_processAnimations","_parseComplete","_nextBatch","initialFrameIndex","frameIndex","maxFrames","sourceSize","trimmed","w","h","rotated","spriteSourceSize","animName","frameName","destroyBase","loader","imageResourceName","multiPacks","related_multi_packs","itemName","itemUrl","values","some","r","loadType","LOAD_TYPE","XHR","xhrType","SpritesheetLoader","getResourcePath","spritesheet","isDataUrl","tempMat","runners","contextChange","quad","globals","simpleShader","gl1VertexSrc","webGLVersion","ts","vertices","anchorX","uvRespectAnchor","anchorY","uvs","invalidate","tex","baseTex","lt","tileTransform","localTransform","uv","uvMatrix","isSimple","isPowerOfTwo","wrapMode","CLAMP","REPEAT","W","H","invert","mapCoord","uMapCoord","uClampFrame","uClampOffset","uTransform","tint","transform","draw","info","common","page","kerning","distanceField","txt","items","rawData","chars","kernings","attributeList","itemData","strValue","floatValue","BitmapFontData","face","parseInt","file","xoffset","yoffset","xadvance","first","second","df","distanceRange","fieldType","XMLDocument","getElementsByTagName","xml","letter","DOMParser","parseFromString","XMLFormat","xmlTxt","formats","TextFormat","XMLStringFormat","autoDetectFormat","drawGlyph","metrics","translate","gradient","dropShadowCorrection","lengthPlus1","unshift","createLinearGradient","lastIterationStop","gradStopLineHeight","thisLineTop","globalStop","clampedStop","addColorStop","totalIterations","currentIteration","generateFillStyle","strokeStyle","rgb","shadowColor","shadowBlur","shadowOffsetX","cos","shadowOffsetY","sin","strokeText","setTransform","splitTextToCharacters","extractCharCode","str","codePointAt","ownsTextures","pageTextures","_ownsTextures","xOffset","yOffset","xAdvance","distanceFieldRange","distanceFieldType","install","fontData","BitmapFont","available","uninstall","textStyle","defaultOptions","textureWidth","textureHeight","charsList","startCode","endCode","String","fromCharCode","resolveCharacters","positionX","positionY","maxCharHeight","textureGlyphWidth","c1","c2","NUMERIC","ALPHANUMERIC","ASCII","pageMeshDataDefaultPageMeshData","pageMeshDataMSDFPageMeshData","charRenderDataPool","_tint","BitmapText","styleDefaults","maxWidth","fontName","_activePagesMeshData","_textWidth","_textHeight","_fontName","_text","_maxWidth","_maxLineHeight","_anchor","dirty","_roundPixels","ROUND_PIXELS","_textureCache","pos","lineSpaces","charsInput","pageMeshDataPool","prevCharCode","lastLineWidth","lastBreakPos","lastBreakWidth","spacesRemoved","maxLineHeight","spaceCount","charCode","charData","charRenderData","EMPTY","prevSpaces","lineAlignOffsets","alignOffset","lenChars","pagesMeshData","newPagesMeshData","activePagesMeshData","baseTextureUid","uid","pageMeshData","material","meshBlendMode","NORMAL","program","uFWidth","NORMAL_NPM","mesh","index","indexCount","vertexCount","uvsCount","total","indices","BATCHABLE_SIZE","Uint16Array","xPos","yPos","pageMesh","textureFrame","anchorOffsetX","anchorOffsetY","vertexBuffer","getBuffer","textureBuffer","getIndex","updateTransform","containerUpdateTransform","_render","dx","sqrt","dy","worldScale","abs","fontScale","getLocalBounds","copyFrom","TEXT","BitmapFontLoader","getBaseUrl","completed","pageFile","bitmapFont","exists","bitmapResource","onAfterMiddleware","IMAGE","resUrl","dirname","charAt","dir","uAlpha","ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","TYPES","SAMPLER_TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","MSAA_QUALITY","BUFFER_TYPE","GAUSSIAN_VALUES","fragTemplate","horizontal","strength","kernelSize","FILTER_RESOLUTION","vertSrc","template","halfLength","vertSource","blurLoop","blur","generateBlurVertSource","fragSrc","kernel","fragSource","generateBlurFragSource","_quality","filterManager","input","output","clearMode","passes","applyFilter","renderTarget","getFilterTexture","flip","flop","blend","CLEAR","bindAndClear","BLIT","temp","returnFilterTexture","blurXFilter","blurYFilter","repeatEdgePixels","xStrength","yStrength","updatePadding","_repeatEdgePixels","_loadMatrix","matrix","multiply","newMatrix","_multiply","_colorMatrix","brightness","greyscale","blackAndWhite","hue","cosR","sinR","sqrW","contrast","o","saturate","desaturate","negative","sepia","technicolor","polaroid","toBGR","kodachrome","browni","vintage","colorTone","desaturation","toned","lightColor","darkColor","lR","lG","lB","dR","dG","dB","night","intensity","predator","lsd","grayscale","maskMatrix","renderable","mapSampler","filterMatrix","maskSprite","calculateSpriteMatrix","lenX","lenY","noise","seed","random","uNoise","uSeed","autoUpdate","_durations","_autoUpdate","_isConnectedToTicker","animationSpeed","loop","updateAnchor","onComplete","onFrameChange","onLoop","_currentTime","_playing","_previousFrame","shared","play","HIGH","gotoAndStop","frameNumber","previousFrame","currentFrame","updateTexture","gotoAndPlay","elapsed","lag","_textureID","_textureTrimmedID","_cachedTint","uvsFloat32","defaultAnchor","fromFrames","AnimatedSprite","fromImages","images","time","canvasRenderer","offsetPolygon","points","offsetPoints","PolygonUtils","isPolygonClockwise","v1x","v1y","norm1x","norm1y","pij1","pij2","v2x","v2y","norm2x","norm2y","pjk1","pjk2","intersectPoint","findIntersection","x4","y4","denominator","numeratorA","uA","polygon","sum","_svgMatrix","_tempMatrix","_calcCanvasStyle","WHITE","valid","getTintedPattern","setPatternTransform","IDENTITY","substr","graphics","setContextTransform","setBlendMode","contextFillStyle","contextStrokeStyle","graphicsData","tintR","tintG","tintB","shape","lineStyle","fillColor","lineColor","append","fillTint","lineTint","lineCap","cap","POLY","beginPath","tempShape","holes","outerArea","innerArea","px","py","holesDirection","moveTo","lineTo","closeStroke","closePath","globalAlpha","paintPolygonStroke","RECT","alignmentOffset","alignment","strokeRect","CIRC","arc","radius","ELIP","drawShapeOverStroke","paintEllipse","kappa","sW","sH","sX","sY","sOx","sOy","sXe","sYe","sXm","sYm","bezierCurveTo","RREC","paintRoundedRectangle","sRx","sRy","sWidth","sHeight","radiusOffset","sRadius","sMaxRadius","quadraticCurveTo","ox","oy","xe","ye","xm","ym","clip","rx","ry","maxRadius","pattern","svg","createElementNS","createSVGMatrix","inverse","generateCanvasTexture","scaleMode","bounds","updateLocalTransform","clear","_canvasRenderTarget","cachedGraphicsData","_renderCanvas","isMask","canvasRenderWorldTransform","_frame","getDrawableSource","smoothingEnabled","LINEAR","smoothProperty","rotate","matrixAppendRotationInv","roundPixels","outerBlend","_outerBlend","save","_tintedCanvas","tintId","getTintedCanvas","restore","rootContext","prepare","tempPrepare","ctx","worldMatrix","patternMatrix","patternRect","baseTextureResolution","tempCanvas","_canvasPattern","createPattern","identity","lx","ly","renderCanvas","isRotated","finalWidth","finalHeight","displayObjectUpdateTransform","childTransform","_renderer","maskManager","pushMask","popMask","_autoResolution","_resolution","CanvasPrepare","_foundShapes","maskData","maskObject","foundShapes","recursiveFindShapes","renderGraphicsShape","invalidateBlendMode","createColoredCanvas","canUseNewCanvasBlendModes","magenta","yellow","globalCompositeOperation","imageData","CANVAS","refresh","CanvasMaskManager","blendModes","ADD","MULTIPLY","SCREEN","OVERLAY","DARKEN","LIGHTEN","COLOR_DODGE","COLOR_BURN","HARD_LIGHT","SOFT_LIGHT","DIFFERENCE","EXCLUSION","HUE","SATURATION","COLOR","LUMINOSITY","ADD_NPM","SCREEN_NPM","SRC_IN","SRC_OUT","SRC_ATOP","DST_OVER","DST_IN","DST_OUT","DST_ATOP","XOR","SUBTRACT","_activeBlendMode","_projTransform","useContextAlpha","imageSmoothingEnabled","rc","webkitImageSmoothingEnabled","mozImageSmoothingEnabled","oImageSmoothingEnabled","msImageSmoothingEnabled","initPlugins","CanvasRenderer","__plugins","skipUpdateTransform","arguments","rootResolution","castToBaseTexture","cacheParent","enableTempParent","disableTempParent","clearBeforeRender","clearRect","backgroundAlpha","_backgroundColorString","clearColor","realWidth","realHeight","tempContext","localResolution","mat","proj","readyForOuterBlend","desiredScreenWidth","desiredScreenHeight","SCALE_MODE","pluginName","ctor","canvasUtils","stringColor","roundColor","tintCache","cachedCanvas","tintMethod","convertTintToImage","tintImage","patternCache","tintWithMultiply","crop","tintWithOverlay","tintWithPerPixel","rgbValues","pixelData","cacheStepsPerColorChannel","canUseMultiply","parentCreate","bitmap","commonjsGlobal","globalThis","window","createCommonjsModule","fn","basedir","module","path","exports","require","base","commonjsRequire","eventemitter3","has","prefix","Events","EE","once","addListener","emitter","listener","evt","_events","_eventsCount","clearEvent","EventEmitter","eventNames","names","getOwnPropertySymbols","concat","listeners","handlers","l","ee","listenerCount","a1","a2","a3","a4","a5","arguments$1","args","removeListener","prefixed","punycode","freeExports","nodeType","freeModule","freeGlobal","maxInt","regexPunycode","regexNonASCII","regexSeparators","errors","stringFromCharCode","RangeError","mapDomain","string","parts","ucs2decode","extra","counter","ucs2encode","digitToBasic","digit","adapt","delta","numPoints","firstTime","baseMinusTMin","decode","basic","oldi","baseMinusT","codePoint","inputLength","bias","lastIndexOf","splice","encode","handledCPCount","basicLength","q","currentValue","handledCPCountPlusOne","qMinusT","util","arg","obj","qs","sep","eq","regexp","maxKeys","kstr","vstr","decodeURIComponent","stringifyPrimitive","ks","encodeURIComponent","querystring","stringify","urlParse","relative","Url","protocol","slashes","auth","host","port","hostname","hash","query","pathname","href","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","unsafeProtocol","hostlessProtocol","slashedProtocol","parseQueryString","slashesDenoteHost","u","queryIndex","splitter","uSplit","rest","simplePath","exec","proto","lowerProto","atSign","hostEnd","hec","parseHost","ipv6Hostname","hostparts","part","newpart","validParts","notHost","bit","toASCII","ae","esc","escape","qm","s","resolveObject","rel","tkeys","tk","tkey","rkeys","rk","rkey","relPath","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","authInHost","last","hasTrailingSlash","up","isAbsolute","RETINA_PREFIX","FAIL_IF_MAJOR_PERFORMANCE_CAVEAT","supported","saidHello","premultiplyBlendMode","pm","npm","mapPremultipliedBlendModes","getBufferType","nextPow2","isPow2","log2","nextUid","warnings","deprecation","version","message","ignoreDepth","stack","groupCollapsed","groupEnd","tempAnchor","ProgramCache","TextureCache","BaseTextureCache","CanvasRenderTarget","RESOLUTION","desiredWidth","desiredHeight","val","enumerable","configurable","determineCrossOrigin","url$1","loc","location","parsedUrl","samePort","getResolutionOfUrl","defaultValue","UPDATE_PRIORITY","Runner","_name","_aliasCount","a0","a6","a7","ensureNonAliasedItems","removeAll","defineProperties","dispatch","run","TARGET_FPMS","SHAPES","TickerListener","priority","previous","redirect","connect","hard","Ticker","_this","autoStart","speed","started","_requestId","_maxElapsedMS","_minElapsedMS","_protected","_lastFrame","_head","Infinity","deltaMS","elapsedMS","_tick","_requestIfNeeded","_cancelIfNeeded","_startIfPossible","start","_addListener","current","count","head","fps","minFPS","maxFPS","minFPMS","_shared","_system","PI_2","Rectangle","rectangle","pad","paddingX","paddingY","fit","eps","enlarge","Point","equals","ObservablePoint","cb","scope","_x","_y","Matrix","fromArray","transpose","newPos","angle","tx1","b1","d1","pivotX","pivotY","scaleX","scaleY","skewX","skewY","decompose","pivot","atan2","skew","ux","uy","vx","vy","rotationCayley","rotationMatrices","signum","row","_ux","_uy","_vx","_vy","groupD8","E","SE","S","SW","NW","N","NE","MIRROR_VERTICAL","MAIN_DIAGONAL","MIRROR_HORIZONTAL","REVERSE_DIAGONAL","uX","ind","uY","vX","vY","inv","rotationSecond","rotationFirst","sub","rotate180","isVertical","byDirection","Transform","onChange","updateSkew","_rotation","_cx","_sx","_cy","_sy","_localID","_currentLocalID","_worldID","_parentID","parentTransform","pt","setFromMatrix","PREFER_ENV","isMobile","any","WEBGL","WEBGL2","STRICT_TEXTURE_CACHE","INSTALLED","autoDetectResource","ResourcePlugin","extendStatics","__extends","__assign","Resource","destroyed","internal","onResize","onUpdate","onError","unbind","_baseTexture","dispose","_source","BufferResource","_super","glTexture","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","UNPACK","texSubImage2D","texImage2D","internalFormat","defaultBufferOptions","NEAREST","NPM","BaseTexture","anisotropicLevel","resourceOptions","_mipmap","MIPMAP_TEXTURES","ANISOTROPIC_LEVEL","_wrapMode","WRAP_MODE","_scaleMode","touched","_refreshPOT","dirtyId","dirtyStyleId","cacheId","textureCacheIds","_batchEnabled","_batchLocation","parentTextureArray","setResource","setStyle","setSize","setRealSize","oldResolution","removeFromCache","strict","isFrame","_pixiId","pixiIdPrefix","fromBuffer","baseTextureFromCache","_globalBatch","AbstractMultiResource","itemDirtyIds","partTexture","_load","initFromArray","addBaseTextureAt","addResourceAt","promises","filter","all","ArrayResource","urls","TEXTURE_2D_ARRAY","texImage3D","texSubImage3D","BaseImageResource","sourceAny","naturalWidth","videoWidth","naturalHeight","videoHeight","noSubImage","crossorigin","CanvasResource","HTMLCanvasElement","CubeResource","linkBaseTexture","SIDES","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_CUBE_MAP","side","ImageResource","HTMLImageElement","imageElement","complete","_process","preserveBitmap","createBitmap","CREATE_IMAGE_BITMAP","createImageBitmap","onload","onerror","process","cors","premultiplyAlpha","glTextures","otherTex","close","SVGResource","sourceBase64","_overrideWidth","_overrideHeight","_resolve","_crossorigin","SVG_XML","btoa","unescape","_loadSvg","tempImage","svgWidth","svgHeight","getSize","svgString","sizeMatch","SVG_SIZE","VideoResource","HTMLVideoElement","videoElement","firstSrc","sourceElement","mime","baseSrc","ext","MIME_TYPES","_updateFPS","updateFPS","_msToNextUpdate","autoPlay","_onCanPlay","_onError","playbackRate","readyState","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","_onPlayStart","_onPlayStop","_isSourceReady","_isSourcePlaying","paused","ended","pause","ogv","mov","m4v","ImageBitmapResource","ImageBitmap","_resources","DepthResource","Framebuffer","stencil","depth","dirtyFormat","dirtySize","depthTexture","colorTextures","glFramebuffers","disposeRunner","multisample","addColorTexture","addDepthTexture","DEPTH_COMPONENT","enableDepth","enableStencil","destroyDepthTexture","BaseRenderTexture","framebuffer","maskStack","filterStack","TextureUvs","baseFrame","tw","th","w2","h2","cX","cY","DEFAULT_UVS","Texture","noFrame","_rotate","onBaseTextureUpdated","updateUvs","clonedFrame","clonedOrig","clonedTexture","fromURL","fromLoader","imageUrl","textureFromCache","xNotFit","yNotFit","relationship","errorX","errorY","removeAllHandlers","createWhiteTexture","RenderTexture","baseRenderTexture","filterFrame","filterPoolKey","resizeBaseTexture","_i","RenderTexturePool","textureOptions","texturePool","enableFullScreen","_pixelsWidth","_pixelsHeight","createTexture","getOptimalTexture","minWidth","minHeight","filterTexture","returnTexture","destroyTextures","setScreenSize","SCREEN_KEY","Attribute","normalized","instance","UID","Buffer","_static","_glBuffers","static","ELEMENT_ARRAY_BUFFER","ARRAY_BUFFER","Int32Array","byteSizeMap","UID$1","map$1","Geometry","attributes","glVertexArrayObjects","instanced","instanceCount","refCount","ids","bufferIndex","interleave","arrays","sizes","interleavedBuffer","attribute","outSize","views","littleOffset","interleaveTypedArrays","attrib","merge","geometries","geometryOut","offsets","offset2","bufferIndexToCount","indexBufferData","Quad","QuadUv","uvBuffer","targetTextureFrame","destinationFrame","UID$2","UniformGroup","isStatic","isUbo","group","syncUniforms","ubo","UNIFORM_BUFFER","autoManage","_ubo","uboFrom","FilterState","legacy","sourceFrame","bindingSourceFrame","bindingDestinationFrame","filters","tempPoints","FilterSystem","defaultFilterStack","statePool","quadUv","tempRect","activeState","outputFrame","inputSize","inputPixel","inputClamp","filterArea","filterClamp","forceClear","useMaxPadding","renderTextureSystem","autoFit","sourceFrameProjected","projection","transformAABB","roundFrame","getOptimalFilterTexture","lastState","blit","BLEND","stateSystem","autoClear","stateId","filterGlobals","attributeData","aTextureCoord","TRIANGLE_STRIP","outputMatrix","mappedMatrix","TEMP_MATRIX","swap","emptyPool","lb","rt","rb","bottom","right","ObjectRenderer","flush","_object","BatchSystem","emptyRenderer","currentRenderer","setObjectRenderer","objectRenderer","copyBoundTextures","arr","maxTextures","boundTextures","boundArray","texArray","batchId","elements","bound","CONTEXT_UID_COUNTER","ContextSystem","supports","uint32Indices","handleContextLost","handleContextRestored","isContextLost","restoreContext","initFromContext","validateContext","initFromOptions","createContext","getExtensions","anisotropicFiltering","floatTextureLinear","drawBuffers","loseContext","vertexArrayObject","uint32ElementIndex","floatTexture","textureHalfFloat","textureHalfFloatLinear","colorBufferFloat","useProgram","postrender","getContextAttributes","isWebGl2","WebGL2RenderingContext","hasuint32","GLFramebuffer","msaaBuffer","blitFramebuffer","mipLevel","tempRectangle","FramebufferSystem","managedFramebuffers","unknownFramebuffer","msaaSamples","viewport","hasMRT","writeDepthTexture","disposeAll","nativeDrawBuffersExtension_1","nativeDepthTextureExtension","WEBGL_LEGACY","activeTextures","drawBuffersWEBGL","getInternalformatParameter","RENDERBUFFER","RGBA8","SAMPLES","fbo","initFramebuffer","bindFramebuffer","FRAMEBUFFER","updateFramebuffer","resizeFramebuffer","setViewport","mask","DEPTH","createFramebuffer","detectSamples","bindRenderbuffer","renderbufferStorageMultisample","DEPTH24_STENCIL8","renderbufferStorage","DEPTH_STENCIL","parentTexture","canMultisampleFramebuffer","createRenderbuffer","framebufferRenderbuffer","COLOR_ATTACHMENT0","deleteRenderbuffer","framebufferTexture2D","DEPTH_ATTACHMENT","DEPTH_STENCIL_ATTACHMENT","samples","sourcePixels","destPixels","colorTexture","sameSize","READ_FRAMEBUFFER","COLOR_BUFFER_BIT","disposeFramebuffer","contextLost","deleteFramebuffer","list","forceStencil","byteSizeMap$1","GeometrySystem","_activeGeometry","_activeVao","hasVao","hasInstance","canUseUInt32ElementIndex","managedGeometries","nativeVaoExtension_1","createVertexArray","createVertexArrayOES","bindVertexArray","vao","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","instanceExt_1","vertexAttribDivisor","vertexAttribDivisorANGLE","drawElementsInstanced","drawElementsInstancedANGLE","drawArraysInstanced","drawArraysInstancedANGLE","vaos","incRefCount","initGeometryVao","activateVao","updateBuffers","bufferSystem","checkCompatibility","geometryAttributes","shaderAttributes","getSignature","attribs","strings","glPrograms","generateProgram","signature","vaoObjectHash","tempStride","tempStart","attribSize","disposeGeometry","buf","vaoId","lastBuffer","glBuffer","enableVertexAttribArray","vertexAttribPointer","byteSize","UNSIGNED_INT","drawArrays","MaskData","autoDetect","pooled","isMaskData","FILTER_MULTISAMPLE","enabled","_filters","_stencilCounter","_scissorCounter","_scissorRect","_scissorRectLocal","_target","copyCountersOrReset","maskAbove","compileShader","createShader","shaderSource","logPrettyShaderError","shaderSrc","getShaderSource","shaderLog","getShaderInfoLog","splitShader","dedupe","lineNumbers","logArgs","number","fragmentSourceToLog","booleanArray","maxFragmentPrecision","unknownContext","getMaxFragmentPrecision","MEDIUM","getTestContext","getShaderPrecisionFormat","shaderFragment","FRAGMENT_SHADER","HIGH_FLOAT","precision","setPrecision","requestedPrecision","maxSupportedPrecision","substring","GLSL_TO_SIZE","float","vec2","vec3","vec4","int","ivec2","ivec3","ivec4","uint","uvec2","uvec3","uvec4","bool","bvec2","bvec3","bvec4","mat2","mat3","mat4","sampler2D","mapSize","GL_TABLE","GL_TO_GLSL_TYPES","FLOAT_VEC2","FLOAT_VEC3","FLOAT_VEC4","INT","INT_VEC2","INT_VEC3","INT_VEC4","UNSIGNED_INT_VEC2","UNSIGNED_INT_VEC3","UNSIGNED_INT_VEC4","BOOL","BOOL_VEC2","BOOL_VEC3","BOOL_VEC4","FLOAT_MAT2","FLOAT_MAT3","FLOAT_MAT4","SAMPLER_2D","INT_SAMPLER_2D","UNSIGNED_INT_SAMPLER_2D","SAMPLER_CUBE","INT_SAMPLER_CUBE","UNSIGNED_INT_SAMPLER_CUBE","SAMPLER_2D_ARRAY","INT_SAMPLER_2D_ARRAY","UNSIGNED_INT_SAMPLER_2D_ARRAY","mapType","typeNames","tn","uniformParsers","code","uniform","codeUbo","GLSL_TO_SINGLE_SETTERS_CACHED","samplerCube","sampler2DArray","GLSL_TO_ARRAY_SETTERS","unsafeEval","generateIfTestSrc","maxIfs","UID$3","nameCache","Program","vertexSrc","fragmentSrc","defaultVertexSrc","defaultFragmentSrc","PRECISION_VERTEX","PRECISION_FRAGMENT","Shader","uniformBindCount","uniformGroup","checkUniformExists","State","polygonOffset","depthMask","_blendMode","_polygonOffset","clockwiseFrontFace","culling","depthTest","Filter","_currentState","TextureMatrix","clampMargin","clampOffset","multiplyUvs","forceUpdate","texBase","margin","SpriteMaskFilter","_maskSprite","npmAlpha","otherMatrix","maskClamp","MaskSystem","enableScissor","alphaMaskPool","maskDataPool","alphaMaskIndex","setMaskStack","scissor","maskDataOrTarget","detect","SPRITE","SCISSOR","STENCIL","pushSpriteMask","popSpriteMask","maskCurrent","isSprite","testScissor","alphaMaskFilter","stashFilterArea","AbstractMaskSystem","glConst","getStackLength","curStackLen","newStackLen","disable","enable","_useCurrent","tempMatrix$1","ScissorSystem","WebGLRenderingContext","SCISSOR_TEST","calcScissorRect","prevData","roundFrameToPixels","isMatrixRotated","isFastRect","StencilSystem","STENCIL_TEST","prevMaskCount","clearStencil","STENCIL_BUFFER_BIT","colorMask","stencilFunc","EQUAL","stencilOp","KEEP","INCR","batch","DECR","ProjectionSystem","defaultFrame","calculateProjection","syncUniformGroup","_destinationFrame","_matrix","tempRect2","RenderTextureSystem","_backgroundColorRgba","defaultMaskStack","viewportFrame","clearMask","uboUpdate","_ud","_uv","_syncData","UBO_TO_SINGLE_SETTERS","GLSL_TO_STD40_SIZE","generateUniformBufferSync","uniformData","syncFunc","uboElements","dataLen","chunkSize","uboElement","lineUpValue","createUBOElements","usedUniformDatas","sort","getUBOData","funcFragments","parsed","uniformParser","size_1","rowSize","elementSize","remainder","Function","GLProgram","uniformGroups","uniformDirtyGroups","uniformBufferBindings","glVertShader","VERTEX_SHADER","glFragShader","webGLProgram","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","vertexShader","fragmentShader","getShaderParameter","COMPILE_STATUS","getProgramInfoLog","logProgramError","totalAttributes","ACTIVE_ATTRIBUTES","attribData","getActiveAttrib","getAttribLocation","getAttributeData","totalUniforms","ACTIVE_UNIFORMS","getActiveUniform","getUniformData","bindAttribLocation","deleteShader","getUniformLocation","UID$4","defaultSyncData","textureCount","uboCount","ShaderSystem","systemCheck","_uboCache","unsafeEvalSupported","dontSync","glProgram","setUniforms","syncData","getGlProgram","createSyncGroups","generateUniformsSync","syncUniformBufferGroup","createSyncBufferGroup","bindBufferBase","uniformBlockIndex","getUniformBlockIndex","uniformBlockBinding","uboData","preFix","StateSystem","_blendEq","setBlend","setOffset","setCullFace","setDepthTest","setFrontFace","setDepthMask","checks","defaultState","ONE","ONE_MINUS_SRC_ALPHA","DST_COLOR","ONE_MINUS_SRC_COLOR","SRC_ALPHA","DST_ALPHA","ZERO","ONE_MINUS_DST_ALPHA","FUNC_REVERSE_SUBTRACT","FUNC_ADD","mapWebGLBlendModesToPixi","diff","forceState","updateCheck","checkBlendMode","checkPolygonOffset","POLYGON_OFFSET_FILL","DEPTH_TEST","CULL_FACE","frontFace","blendFunc","blendFuncSeparate","blendEquationSeparate","setPolygonOffset","UNPACK_FLIP_Y_WEBGL","TextureGCSystem","checkCount","maxIdle","GC_MAX_IDLE","checkCountMax","GC_MAX_CHECK_COUNT","GC_MODE","MANUAL","tm","managedTextures","wasRemoved","destroyTexture","unload","GLTexture","samplerType","TextureSystem","currentLocation","_unknownBoundTextures","unknownTexture","hasIntegerTextures","internalFormats","_c","_d","_e","_f","_g","_h","_j","_k","_l","_m","_o","_p","_q","_r","_s","_t","_u","_v","_w","table","RGB8","RG","RG8","RED","R8","RGBA_INTEGER","RGBA8UI","RGB_INTEGER","RGB8UI","RG_INTEGER","RG8UI","RED_INTEGER","R8UI","BYTE","RGBA8_SNORM","RGB8_SNORM","RG8_SNORM","R8_SNORM","RGBA8I","RGB8I","RG8I","R8I","RGBA16UI","RGB16UI","RG16UI","R16UI","DEPTH_COMPONENT16","SHORT","RGBA16I","RGB16I","RG16I","R16I","RGBA32UI","RGB32UI","RG32UI","R32UI","DEPTH_COMPONENT24","RGBA32I","RGB32I","RG32I","R32I","RGBA32F","RGB32F","RG32F","R32F","DEPTH_COMPONENT32F","RGBA16F","RGB16F","RG16F","R16F","RGB565","RGBA4","RGB5_A1","UNSIGNED_INT_2_10_10_10_REV","RGB10_A2","RGB10_A2UI","UNSIGNED_INT_10F_11F_11F_REV","R11F_G11F_B10F","UNSIGNED_INT_5_9_9_9_REV","RGB9_E5","UNSIGNED_INT_24_8","FLOAT_32_UNSIGNED_INT_24_8_REV","DEPTH32F_STENCIL8","mapTypeAndFormatToInternalFormat","getParameter","MAX_TEXTURE_IMAGE_UNITS","emptyTextures","emptyTexture2D","bindTexture","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","textureGC","initTexture","activeTexture","TEXTURE0","ensureSamplerType","initTextureType","updateTextureStyle","skipRemove","deleteTexture","startIdx","removeCount","removeItems","POW2","ON_MANUAL","generateMipmap","TEXTURE_WRAP_S","TEXTURE_WRAP_T","LINEAR_MIPMAP_LINEAR","NEAREST_MIPMAP_NEAREST","anisotropicExt","level","MAX_TEXTURE_MAX_ANISOTROPY_EXT","texParameterf","TEXTURE_MAX_ANISOTROPY_EXT","_systems","tempMatrix$2","AbstractRenderer","UNKNOWN","RENDER_OPTIONS","autoDensity","preserveDrawingBuffer","_backgroundColor","transparent","staticMap","screenWidth","screenHeight","region","manualRegion","__rest","thisAny","_tempDisplayObjectParent","hex","hexString","hex2string","GLBuffer","updateID","byteLength","BufferSystem","managedBuffers","boundBufferBases","createGLBuffer","bindBuffer","bindBufferRange","bufferSubData","drawType","STATIC_DRAW","DYNAMIC_DRAW","bufferData","deleteBuffer","createBuffer","BatchDrawCall","Renderer","prerender","addSystem","antialias","premultipliedAlpha","powerPreference","log","sayHello","contextOptions","failIfMajorPerformanceCaveat","success","FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER","LOW","ClassRef","isLost","extract","BatchTextureArray","ViewableBuffer","sizeOrBuffer","uint32View","float32View","_int8View","Int8Array","_uint8View","_int16View","Int16Array","_uint16View","_int32View","sizeOf","AbstractBatchRenderer","shaderGenerator","geometryClass","vertexSize","SPRITE_BATCH_SIZE","_vertexCount","_indexCount","_bufferedElements","_bufferedTextures","_bufferSize","_shader","_packedGeometries","_packedGeometryPoolSize","_flushId","_aBuffers","_iBuffers","MAX_TEXTURES","onPrerender","_dcIndex","_aIndex","_iIndex","_attributeBuffer","_indexBuffer","_tempBoundTextures","SPRITE_MAX_TEXTURES","checkMaxIfStatementsInShader","generateShader","initFlushBuffers","_drawCallPool","_textureArrayPool","MAX_SPRITES","MAX_TA","vertexData","buildTexturesAndDrawCalls","textureArrays","TICK","countTexArrays","buildDrawCalls","finish","drawCalls","dcIndex","aIndex","iIndex","drawCall","spriteBlendMode","packInterleavedGeometry","bindAndClearTexArray","textureSystem","updateGeometry","packedGeometries","attributeBuffer","CAN_UPLOAD_SAME_BUFFER","_buffer","drawBatches","dcCount","curTexArray","getAttributeBuffer","getIndexBuffer","roundedP2","roundedSizeIndex","roundedSize","packedVertices","indicies","textureId","R","G","B","premultiplyTint","BatchShaderGenerator","programCache","defaultGroupCache","sampleValues","uSamplers","generateSampleSrc","BatchGeometry","defaultVertex$3","defaultFragment$2","BatchPluginFactory","vertex","fragment","BatchPlugin","_loop_1","systems","_loop_2","CanvasMeshRenderer","drawMode","_renderTriangleMesh","_renderTriangles","_renderDrawTriangle","index0","index1","index2","isTinted","_cachedTexture","textureSource","u0","u1","u2","v0","v1","v2","screenPadding","canvasPadding","centerX","centerY","normX","normY","screenX","screenY","screenDist","paddingFactor","deltaA","deltaB","deltaC","deltaD","deltaE","deltaF","renderMeshFlat","MESH_CANVAS_PADDING","MeshMaterial","NineSlicePlane","_canvasUvs","_leftWidth","_rightWidth","_topHeight","_bottomHeight","col","sw","sh","dw","dh","warned","Mesh","calculateUvs","_canvasPadding","SimpleMesh","SimpleRope","setTimeoutFunc","setImmediateFunc","setImmediate","Boolean","noop","_state","_handled","_value","_deferreds","doResolve","handle","deferred","_immediateFn","onFulfilled","onRejected","ret","promise","newValue","finale","_unhandledRejectionFn","Handler","reason","prom","promiseFinally","remaining","allSettled","race","Timeout","clearFn","_id","_clearFn","setInterval","clearInterval","timeout","unref","ref","enroll","msecs","_idleTimeoutId","_idleTimeout","unenroll","_unrefActive","active","_onTimeout","clearImmediate","registerImmediate","nextHandle","tasksByHandle","currentlyRunningATask","doc","attachTo","nextTick","runIfPresent","postMessage","importScripts","postMessageIsAsynchronous","oldOnMessage","onmessage","canUsePostMessage","messagePrefix","onGlobalMessage","attachEvent","installPostMessageImplementation","MessageChannel","channel","port1","port2","installMessageChannelImplementation","html","documentElement","script","onreadystatechange","installReadyStateChangeImplementation","task","finallyConstructor","status"],"mappings":";m9RAGKA,KAAKC,UAEND,KAAKC,QAAU,KCCdC,OAAOC,SAERD,OAAOC,OAAS,KCepB,GATMC,KAAKC,KAAOD,KAAKE,UAAUC,UAE7BH,KAAKC,IAAM,WAEP,OAAO,IAAID,MAAOG,aAKpBP,KAAKQ,cAAeR,KAAKQ,YAAYH,IAC3C,CACI,IAAM,EAAYD,KAAKC,MAElBL,KAAKQ,cAELR,KAAaQ,YAAc,IAGhCR,KAAKQ,YAAYH,IAAM,WAAc,OAAAD,KAAKC,MAAQ,GAOtD,IAHA,IAAII,EAAWL,KAAKC,MACdK,EAAU,CAAC,KAAM,MAAO,SAAU,KAE/B,EAAI,EAAG,EAAIA,EAAQC,SAAWX,KAAKY,wBAAyB,EACrE,CACI,IAAMC,EAAIH,EAAQ,GAElBV,KAAKY,sBAAyBZ,KAAgBa,EAAC,yBAC/Cb,KAAKc,qBAAwBd,KAAgBa,EAAC,yBACtCb,KAAgBa,EAAC,+BAGxBb,KAAKY,wBAENZ,KAAKY,sBAAwB,SAACG,GAE1B,GAAwB,oBAAbA,EAEP,MAAM,IAAIC,UAAaD,EAAQ,qBAGnC,IAAME,EAAcb,KAAKC,MACrBa,EA/CW,GA+CcT,EAAWQ,EASxC,OAPIC,EAAQ,IAERA,EAAQ,GAGZT,EAAWQ,EAEJjB,KAAKmB,YAAW,WAEnBV,EAAWL,KAAKC,MAChBU,EAASP,YAAYH,SACtBa,KAINlB,KAAKc,uBAENd,KAAKc,qBAAuB,SAACM,GAAqB,OAAAC,aAAaD,KC1E9DE,KAAKC,OAEND,KAAKC,KAAO,SAAkBC,GAI1B,OAAU,KAFVA,EAAIC,OAAOD,KAEIE,MAAMF,GAEVA,EAGJA,EAAI,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C,GACA,SAASA,GACPtyC,EAAI5Y,EAAGkrD,MAET,SAAS3oD,GACPw+C,EAAK/gD,GAAK,CAAE+gG,OAAQ,WAAYtD,OAAQl7F,GACpB,MAAdq7F,GACJ7oF,EAAQgsC,MAOlBA,EAAK/gD,GAAK,CAAE+gG,OAAQ,YAAaplG,MAAOuvD,GACpB,MAAd0yC,GACJ7oF,EAAQgsC,GAIZ,IAAK,IAAI/gD,EAAI,EAAGA,EAAI+gD,EAAKrmD,OAAQsF,IAC/B4Y,EAAI5Y,EAAG+gD,EAAK/gD","file":"static/js/71.69f2d4a7.chunk.js","sourcesContent":["import Polyfill from 'promise-polyfill';\n\n// Support for IE 9 - 11 which does not include Promises\nif (!self.Promise)\n{\n self.Promise = Polyfill;\n}\n","// References:\n// https://github.com/sindresorhus/object-assign\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n\nimport objectAssign from 'object-assign';\n\nif (!Object.assign)\n{\n Object.assign = objectAssign;\n}\n","// References:\n// http://paulirish.com/2011/requestanimationframe-for-smart-animating/\n// https://gist.github.com/1579671\n// http://updates.html5rocks.com/2012/05/requestAnimationFrame-API-now-with-sub-millisecond-precision\n// https://gist.github.com/timhall/4078614\n// https://github.com/Financial-Times/polyfill-service/tree/master/polyfills/requestAnimationFrame\n\n// Expected to be used with Browserfiy\n// Browserify automatically detects the use of `global` and passes the\n// correct reference of `global`, `self`, and finally `window`\n\nconst ONE_FRAME_TIME = 16;\n\n// Date.now\nif (!(Date.now && Date.prototype.getTime))\n{\n Date.now = function now(): number\n {\n return new Date().getTime();\n };\n}\n\n// performance.now\nif (!(self.performance && self.performance.now))\n{\n const startTime = Date.now();\n\n if (!self.performance)\n {\n (self as any).performance = {};\n }\n\n self.performance.now = (): number => Date.now() - startTime;\n}\n\n// requestAnimationFrame\nlet lastTime = Date.now();\nconst vendors = ['ms', 'moz', 'webkit', 'o'];\n\nfor (let x = 0; x < vendors.length && !self.requestAnimationFrame; ++x)\n{\n const p = vendors[x];\n\n self.requestAnimationFrame = (self as any)[`${p}RequestAnimationFrame`];\n self.cancelAnimationFrame = (self as any)[`${p}CancelAnimationFrame`]\n || (self as any)[`${p}CancelRequestAnimationFrame`];\n}\n\nif (!self.requestAnimationFrame)\n{\n self.requestAnimationFrame = (callback: (...parms: any[]) => void): number =>\n {\n if (typeof callback !== 'function')\n {\n throw new TypeError(`${callback}is not a function`);\n }\n\n const currentTime = Date.now();\n let delay = ONE_FRAME_TIME + lastTime - currentTime;\n\n if (delay < 0)\n {\n delay = 0;\n }\n\n lastTime = currentTime;\n\n return self.setTimeout(() =>\n {\n lastTime = Date.now();\n callback(performance.now());\n }, delay);\n };\n}\n\nif (!self.cancelAnimationFrame)\n{\n self.cancelAnimationFrame = (id: number): void => clearTimeout(id);\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign\n\nif (!Math.sign)\n{\n Math.sign = function mathSign(x): number\n {\n x = Number(x);\n\n if (x === 0 || isNaN(x))\n {\n return x;\n }\n\n return x > 0 ? 1 : -1;\n };\n}\n","// References:\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger\n\nif (!Number.isInteger)\n{\n Number.isInteger = function numberIsInteger(value): boolean\n {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n}\n","import { AccessibilityManager, InteractionManager } from 'pixi.js';\nimport { CanvasRenderer, canvasUtils } from '@pixi/canvas-renderer';\nimport { CanvasMeshRenderer } from '@pixi/canvas-mesh';\nimport { CanvasGraphicsRenderer } from '@pixi/canvas-graphics';\nimport { CanvasSpriteRenderer } from '@pixi/canvas-sprite';\nimport { CanvasExtract } from '@pixi/canvas-extract';\nimport { CanvasPrepare } from '@pixi/canvas-prepare';\nimport '@pixi/canvas-sprite-tiling';\nimport '@pixi/canvas-particle-container';\nimport '@pixi/canvas-display';\nimport '@pixi/canvas-text';\n\nCanvasRenderer.registerPlugin('accessibility', AccessibilityManager);\nCanvasRenderer.registerPlugin('extract', CanvasExtract);\nCanvasRenderer.registerPlugin('graphics', CanvasGraphicsRenderer);\nCanvasRenderer.registerPlugin('interaction', InteractionManager);\nCanvasRenderer.registerPlugin('mesh', CanvasMeshRenderer);\nCanvasRenderer.registerPlugin('prepare', CanvasPrepare);\nCanvasRenderer.registerPlugin('sprite', CanvasSpriteRenderer);\n\n// Export ES for those importing specifically by name,\n// e.g., `import {autoDetectRenderer} from 'pixi.js-legacy'`\nexport * from 'pixi.js';\nexport {\n CanvasRenderer,\n CanvasGraphicsRenderer,\n CanvasMeshRenderer,\n CanvasSpriteRenderer,\n CanvasExtract,\n CanvasPrepare,\n canvasUtils,\n};\n","import type { DisplayObject } from '@pixi/display';\n\nexport type PointerEvents = 'auto'\n| 'none'\n| 'visiblePainted'\n| 'visibleFill'\n| 'visibleStroke'\n| 'visible'\n| 'painted'\n| 'fill'\n| 'stroke'\n| 'all'\n| 'inherit';\n\nexport interface IAccessibleTarget {\n accessible: boolean;\n accessibleTitle: string;\n accessibleHint: string;\n tabIndex: number;\n _accessibleActive: boolean;\n _accessibleDiv: IAccessibleHTMLElement;\n accessibleType: string;\n accessiblePointerEvents: PointerEvents;\n accessibleChildren: boolean;\n renderId: number;\n}\n\nexport interface IAccessibleHTMLElement extends HTMLElement {\n type?: string;\n displayObject?: DisplayObject;\n}\n\n/**\n * Default property values of accessible objects\n * used by {@link PIXI.AccessibilityManager}.\n *\n * @private\n * @function accessibleTarget\n * @memberof PIXI\n * @type {Object}\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * MyObject.prototype,\n * PIXI.accessibleTarget\n * );\n */\nexport const accessibleTarget: IAccessibleTarget = {\n /**\n * Flag for if the object is accessible. If true AccessibilityManager will overlay a\n * shadow div with attributes set\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n accessible: false,\n\n /**\n * Sets the title attribute of the shadow div\n * If accessibleTitle AND accessibleHint has not been this will default to 'displayObject [tabIndex]'\n *\n * @member {?string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleTitle: null,\n\n /**\n * Sets the aria-label attribute of the shadow div\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n accessibleHint: null,\n\n /**\n * @member {number}\n * @memberof PIXI.DisplayObject#\n * @private\n * @todo Needs docs.\n */\n tabIndex: 0,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleActive: false,\n\n /**\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @todo Needs docs.\n */\n _accessibleDiv: null,\n\n /**\n * Specify the type of div the accessible layer is. Screen readers treat the element differently\n * depending on this type. Defaults to button.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'button'\n */\n accessibleType: 'button',\n\n /**\n * Specify the pointer-events the accessible div will use\n * Defaults to auto.\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n * @default 'auto'\n */\n accessiblePointerEvents: 'auto',\n\n /**\n * Setting to false will prevent any children inside this container to\n * be accessible. Defaults to true.\n *\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n * @default true\n */\n accessibleChildren: true,\n\n renderId: -1,\n};\n","import { DisplayObject } from '@pixi/display';\nimport { isMobile, removeItems } from '@pixi/utils';\nimport { accessibleTarget } from './accessibleTarget';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Container } from '@pixi/display';\nimport type { Renderer, AbstractRenderer } from '@pixi/core';\nimport type { IAccessibleHTMLElement } from './accessibleTarget';\n\n// add some extra variables to the container..\nDisplayObject.mixin(accessibleTarget);\n\nconst KEY_CODE_TAB = 9;\n\nconst DIV_TOUCH_SIZE = 100;\nconst DIV_TOUCH_POS_X = 0;\nconst DIV_TOUCH_POS_Y = 0;\nconst DIV_TOUCH_ZINDEX = 2;\n\nconst DIV_HOOK_SIZE = 1;\nconst DIV_HOOK_POS_X = -1000;\nconst DIV_HOOK_POS_Y = -1000;\nconst DIV_HOOK_ZINDEX = 2;\n\n/**\n * The Accessibility manager recreates the ability to tab and have content read by screen readers.\n * This is very important as it can possibly help people with disabilities access PixiJS content.\n *\n * A DisplayObject can be made accessible just like it can be made interactive. This manager will map the\n * events as if the mouse was being used, minimizing the effort required to implement.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.accessibility`\n *\n * @class\n * @memberof PIXI\n */\nexport class AccessibilityManager\n{\n /** Setting this to true will visually show the divs. */\n public debug = false;\n\n /**\n * The renderer this accessibility manager works for.\n *\n * @type {PIXI.CanvasRenderer|PIXI.Renderer}\n */\n public renderer: AbstractRenderer|Renderer;\n\n /** Internal variable, see isActive getter. */\n private _isActive = false;\n\n /** Internal variable, see isMobileAccessibility getter. */\n private _isMobileAccessibility = false;\n\n /** Button element for handling touch hooks. */\n private _hookDiv: HTMLElement;\n\n /** This is the dom element that will sit over the PixiJS element. This is where the div overlays will go. */\n private div: HTMLElement;\n\n /** A simple pool for storing divs. */\n private pool: IAccessibleHTMLElement[] = [];\n\n /** This is a tick used to check if an object is no longer being rendered. */\n private renderId = 0;\n\n /** The array of currently active accessible items. */\n private children: DisplayObject[] = [];\n\n /** Count to throttle div updates on android devices. */\n private androidUpdateCount = 0;\n\n /** The frequency to update the div elements. */\n private androidUpdateFrequency = 500; // 2fps\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer|Renderer)\n {\n this._hookDiv = null;\n\n if (isMobile.tablet || isMobile.phone)\n {\n this.createTouchHook();\n }\n\n // first we create a div that will sit over the PixiJS element. This is where the div overlays will go.\n const div = document.createElement('div');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.position = 'absolute';\n div.style.top = `${DIV_TOUCH_POS_X}px`;\n div.style.left = `${DIV_TOUCH_POS_Y}px`;\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n\n this.div = div;\n this.renderer = renderer;\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onKeyDown = this._onKeyDown.bind(this);\n\n /**\n * pre-bind the functions\n *\n * @type {Function}\n * @private\n */\n this._onMouseMove = this._onMouseMove.bind(this);\n\n // let listen for tab.. once pressed we can fire up and show the accessibility layer\n self.addEventListener('keydown', this._onKeyDown, false);\n }\n\n /**\n * Value of `true` if accessibility is currently active and accessibility layers are showing.\n * @member {boolean}\n * @readonly\n */\n get isActive(): boolean\n {\n return this._isActive;\n }\n\n /**\n * Value of `true` if accessibility is enabled for touch devices.\n * @member {boolean}\n * @readonly\n */\n get isMobileAccessibility(): boolean\n {\n return this._isMobileAccessibility;\n }\n\n /**\n * Creates the touch hooks.\n *\n * @private\n */\n private createTouchHook(): void\n {\n const hookDiv = document.createElement('button');\n\n hookDiv.style.width = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.height = `${DIV_HOOK_SIZE}px`;\n hookDiv.style.position = 'absolute';\n hookDiv.style.top = `${DIV_HOOK_POS_X}px`;\n hookDiv.style.left = `${DIV_HOOK_POS_Y}px`;\n hookDiv.style.zIndex = DIV_HOOK_ZINDEX.toString();\n hookDiv.style.backgroundColor = '#FF0000';\n hookDiv.title = 'select to enable accessibility for this content';\n\n hookDiv.addEventListener('focus', () =>\n {\n this._isMobileAccessibility = true;\n this.activate();\n this.destroyTouchHook();\n });\n\n document.body.appendChild(hookDiv);\n this._hookDiv = hookDiv;\n }\n\n /**\n * Destroys the touch hooks.\n *\n * @private\n */\n private destroyTouchHook(): void\n {\n if (!this._hookDiv)\n {\n return;\n }\n document.body.removeChild(this._hookDiv);\n this._hookDiv = null;\n }\n\n /**\n * Activating will cause the Accessibility layer to be shown.\n * This is called when a user presses the tab key.\n *\n * @private\n */\n private activate(): void\n {\n if (this._isActive)\n {\n return;\n }\n\n this._isActive = true;\n\n self.document.addEventListener('mousemove', this._onMouseMove, true);\n self.removeEventListener('keydown', this._onKeyDown, false);\n\n this.renderer.on('postrender', this.update, this);\n this.renderer.view.parentNode?.appendChild(this.div);\n }\n\n /**\n * Deactivating will cause the Accessibility layer to be hidden.\n * This is called when a user moves the mouse.\n *\n * @private\n */\n private deactivate(): void\n {\n if (!this._isActive || this._isMobileAccessibility)\n {\n return;\n }\n\n this._isActive = false;\n\n self.document.removeEventListener('mousemove', this._onMouseMove, true);\n self.addEventListener('keydown', this._onKeyDown, false);\n\n this.renderer.off('postrender', this.update);\n this.div.parentNode?.removeChild(this.div);\n }\n\n /**\n * This recursive function will run through the scene graph and add any new accessible objects to the DOM layer.\n *\n * @private\n * @param {PIXI.Container} displayObject - The DisplayObject to check.\n */\n private updateAccessibleObjects(displayObject: Container): void\n {\n if (!displayObject.visible || !displayObject.accessibleChildren)\n {\n return;\n }\n\n if (displayObject.accessible && displayObject.interactive)\n {\n if (!displayObject._accessibleActive)\n {\n this.addChild(displayObject);\n }\n\n displayObject.renderId = this.renderId;\n }\n\n const children = displayObject.children;\n\n if (children)\n {\n for (let i = 0; i < children.length; i++)\n {\n this.updateAccessibleObjects(children[i] as Container);\n }\n }\n }\n\n /**\n * Before each render this function will ensure that all divs are mapped correctly to their DisplayObjects.\n *\n * @private\n */\n private update(): void\n {\n /* On Android default web browser, tab order seems to be calculated by position rather than tabIndex,\n * moving buttons can cause focus to flicker between two buttons making it hard/impossible to navigate,\n * so I am just running update every half a second, seems to fix it.\n */\n const now = performance.now();\n\n if (isMobile.android.device && now < this.androidUpdateCount)\n {\n return;\n }\n\n this.androidUpdateCount = now + this.androidUpdateFrequency;\n\n if (!(this.renderer as Renderer).renderingToScreen)\n {\n return;\n }\n\n // update children...\n if (this.renderer._lastObjectRendered)\n {\n this.updateAccessibleObjects(this.renderer._lastObjectRendered as Container);\n }\n\n const { left, top, width, height } = this.renderer.view.getBoundingClientRect();\n const { width: viewWidth, height: viewHeight, resolution } = this.renderer;\n\n const sx = (width / viewWidth) * resolution;\n const sy = (height / viewHeight) * resolution;\n\n let div = this.div;\n\n div.style.left = `${left}px`;\n div.style.top = `${top}px`;\n div.style.width = `${viewWidth}px`;\n div.style.height = `${viewHeight}px`;\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (child.renderId !== this.renderId)\n {\n child._accessibleActive = false;\n\n removeItems(this.children, i, 1);\n this.div.removeChild(child._accessibleDiv);\n this.pool.push(child._accessibleDiv);\n child._accessibleDiv = null;\n\n i--;\n }\n else\n {\n // map div to display..\n div = child._accessibleDiv;\n let hitArea = child.hitArea as Rectangle;\n const wt = child.worldTransform;\n\n if (child.hitArea)\n {\n div.style.left = `${(wt.tx + (hitArea.x * wt.a)) * sx}px`;\n div.style.top = `${(wt.ty + (hitArea.y * wt.d)) * sy}px`;\n\n div.style.width = `${hitArea.width * wt.a * sx}px`;\n div.style.height = `${hitArea.height * wt.d * sy}px`;\n }\n else\n {\n hitArea = child.getBounds();\n\n this.capHitArea(hitArea);\n\n div.style.left = `${hitArea.x * sx}px`;\n div.style.top = `${hitArea.y * sy}px`;\n\n div.style.width = `${hitArea.width * sx}px`;\n div.style.height = `${hitArea.height * sy}px`;\n\n // update button titles and hints if they exist and they've changed\n if (div.title !== child.accessibleTitle && child.accessibleTitle !== null)\n {\n div.title = child.accessibleTitle;\n }\n if (div.getAttribute('aria-label') !== child.accessibleHint\n && child.accessibleHint !== null)\n {\n div.setAttribute('aria-label', child.accessibleHint);\n }\n }\n\n // the title or index may have changed, if so lets update it!\n if (child.accessibleTitle !== div.title || child.tabIndex !== div.tabIndex)\n {\n div.title = child.accessibleTitle;\n div.tabIndex = child.tabIndex;\n if (this.debug) this.updateDebugHTML(div);\n }\n }\n }\n\n // increment the render id..\n this.renderId++;\n }\n\n /**\n * private function that will visually add the information to the\n * accessability div\n *\n * @param {HTMLElement} div\n */\n public updateDebugHTML(div: IAccessibleHTMLElement): void\n {\n div.innerHTML = `type: ${div.type}
title : ${div.title}
tabIndex: ${div.tabIndex}`;\n }\n\n /**\n * Adjust the hit area based on the bounds of a display object\n *\n * @param {PIXI.Rectangle} hitArea - Bounds of the child\n */\n public capHitArea(hitArea: Rectangle): void\n {\n if (hitArea.x < 0)\n {\n hitArea.width += hitArea.x;\n hitArea.x = 0;\n }\n\n if (hitArea.y < 0)\n {\n hitArea.height += hitArea.y;\n hitArea.y = 0;\n }\n\n const { width: viewWidth, height: viewHeight } = this.renderer;\n\n if (hitArea.x + hitArea.width > viewWidth)\n {\n hitArea.width = viewWidth - hitArea.x;\n }\n\n if (hitArea.y + hitArea.height > viewHeight)\n {\n hitArea.height = viewHeight - hitArea.y;\n }\n }\n\n /**\n * Adds a DisplayObject to the accessibility manager\n *\n * @private\n * @param {PIXI.DisplayObject} displayObject - The child to make accessible.\n */\n private addChild(displayObject: T): void\n {\n // this.activate();\n\n let div = this.pool.pop();\n\n if (!div)\n {\n div = document.createElement('button');\n\n div.style.width = `${DIV_TOUCH_SIZE}px`;\n div.style.height = `${DIV_TOUCH_SIZE}px`;\n div.style.backgroundColor = this.debug ? 'rgba(255,255,255,0.5)' : 'transparent';\n div.style.position = 'absolute';\n div.style.zIndex = DIV_TOUCH_ZINDEX.toString();\n div.style.borderStyle = 'none';\n\n // ARIA attributes ensure that button title and hint updates are announced properly\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n // Chrome doesn't need aria-live to work as intended; in fact it just gets more confused.\n div.setAttribute('aria-live', 'off');\n }\n else\n {\n div.setAttribute('aria-live', 'polite');\n }\n\n if (navigator.userAgent.match(/rv:.*Gecko\\//))\n {\n // FireFox needs this to announce only the new button name\n div.setAttribute('aria-relevant', 'additions');\n }\n else\n {\n // required by IE, other browsers don't much care\n div.setAttribute('aria-relevant', 'text');\n }\n\n div.addEventListener('click', this._onClick.bind(this));\n div.addEventListener('focus', this._onFocus.bind(this));\n div.addEventListener('focusout', this._onFocusOut.bind(this));\n }\n\n // set pointer events\n div.style.pointerEvents = displayObject.accessiblePointerEvents;\n // set the type, this defaults to button!\n div.type = displayObject.accessibleType;\n\n if (displayObject.accessibleTitle && displayObject.accessibleTitle !== null)\n {\n div.title = displayObject.accessibleTitle;\n }\n else if (!displayObject.accessibleHint\n || displayObject.accessibleHint === null)\n {\n div.title = `displayObject ${displayObject.tabIndex}`;\n }\n\n if (displayObject.accessibleHint\n && displayObject.accessibleHint !== null)\n {\n div.setAttribute('aria-label', displayObject.accessibleHint);\n }\n\n if (this.debug) this.updateDebugHTML(div);\n\n displayObject._accessibleActive = true;\n displayObject._accessibleDiv = div;\n div.displayObject = displayObject;\n\n this.children.push(displayObject);\n this.div.appendChild(displayObject._accessibleDiv);\n displayObject._accessibleDiv.tabIndex = displayObject.tabIndex;\n }\n\n /**\n * Maps the div button press to pixi's InteractionManager (click)\n *\n * @private\n * @param {MouseEvent} e - The click event.\n */\n private _onClick(e: MouseEvent): void\n {\n const interactionManager = this.renderer.plugins.interaction;\n const { displayObject } = e.target as IAccessibleHTMLElement;\n const { eventData } = interactionManager;\n\n interactionManager.dispatchEvent(displayObject, 'click', eventData);\n interactionManager.dispatchEvent(displayObject, 'pointertap', eventData);\n interactionManager.dispatchEvent(displayObject, 'tap', eventData);\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseover)\n *\n * @private\n * @param {FocusEvent} e - The focus event.\n */\n private _onFocus(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'assertive');\n }\n\n const interactionManager = this.renderer.plugins.interaction;\n const { displayObject } = e.target as IAccessibleHTMLElement;\n const { eventData } = interactionManager;\n\n interactionManager.dispatchEvent(displayObject, 'mouseover', eventData);\n }\n\n /**\n * Maps the div focus events to pixi's InteractionManager (mouseout)\n *\n * @private\n * @param {FocusEvent} e - The focusout event.\n */\n private _onFocusOut(e: FocusEvent): void\n {\n if (!(e.target as Element).getAttribute('aria-live'))\n {\n (e.target as Element).setAttribute('aria-live', 'polite');\n }\n\n const interactionManager = this.renderer.plugins.interaction;\n const { displayObject } = e.target as IAccessibleHTMLElement;\n const { eventData } = interactionManager;\n\n interactionManager.dispatchEvent(displayObject, 'mouseout', eventData);\n }\n\n /**\n * Is called when a key is pressed\n *\n * @private\n * @param {KeyboardEvent} e - The keydown event.\n */\n private _onKeyDown(e: KeyboardEvent): void\n {\n if (e.keyCode !== KEY_CODE_TAB)\n {\n return;\n }\n\n this.activate();\n }\n\n /**\n * Is called when the mouse moves across the renderer element\n *\n * @private\n * @param {MouseEvent} e - The mouse event.\n */\n private _onMouseMove(e: MouseEvent): void\n {\n if (e.movementX === 0 && e.movementY === 0)\n {\n return;\n }\n\n this.deactivate();\n }\n\n /**\n * Destroys the accessibility manager\n *\n */\n public destroy(): void\n {\n this.destroyTouchHook();\n this.div = null;\n\n self.document.removeEventListener('mousemove', this._onMouseMove, true);\n self.removeEventListener('keydown', this._onKeyDown);\n\n this.pool = null;\n this.children = null;\n this.renderer = null;\n }\n}\n","import { Point, IPointData } from '@pixi/math';\n\nimport type { DisplayObject } from '@pixi/display';\n\nexport type InteractivePointerEvent = PointerEvent | TouchEvent | MouseEvent;\n\n/**\n * Holds all information related to an Interaction event\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionData\n{\n public global: Point;\n public target: DisplayObject;\n public originalEvent: InteractivePointerEvent;\n public identifier: number;\n public isPrimary: boolean;\n public button: number;\n public buttons: number;\n public width: number;\n public height: number;\n public tiltX: number;\n public tiltY: number;\n public pointerType: string;\n public pressure = 0;\n public rotationAngle = 0;\n public twist = 0;\n public tangentialPressure = 0;\n\n constructor()\n {\n /**\n * This point stores the global coords of where the touch/mouse event happened\n *\n * @member {PIXI.Point}\n */\n this.global = new Point();\n\n /**\n * The target Sprite that was interacted with\n *\n * @member {PIXI.Sprite}\n */\n this.target = null;\n\n /**\n * When passed to an event handler, this will be the original DOM Event that was captured\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent\n * @member {MouseEvent|TouchEvent|PointerEvent}\n */\n this.originalEvent = null;\n\n /**\n * Unique identifier for this interaction\n *\n * @member {number}\n */\n this.identifier = null;\n\n /**\n * Indicates whether or not the pointer device that created the event is the primary pointer.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary\n * @type {Boolean}\n */\n this.isPrimary = false;\n\n /**\n * Indicates which button was pressed on the mouse or pointer device to trigger the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button\n * @type {number}\n */\n this.button = 0;\n\n /**\n * Indicates which buttons are pressed on the mouse or pointer device when the event is triggered.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons\n * @type {number}\n */\n this.buttons = 0;\n\n /**\n * The width of the pointer's contact along the x-axis, measured in CSS pixels.\n * radiusX of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width\n * @type {number}\n */\n this.width = 0;\n\n /**\n * The height of the pointer's contact along the y-axis, measured in CSS pixels.\n * radiusY of TouchEvents will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height\n * @type {number}\n */\n this.height = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX\n * @type {number}\n */\n this.tiltX = 0;\n\n /**\n * The angle, in degrees, between the pointer device and the screen.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY\n * @type {number}\n */\n this.tiltY = 0;\n\n /**\n * The type of pointer that triggered the event.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType\n * @type {string}\n */\n this.pointerType = null;\n\n /**\n * Pressure applied by the pointing device during the event. A Touch's force property\n * will be represented by this value.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure\n * @type {number}\n */\n this.pressure = 0;\n\n /**\n * From TouchEvents (not PointerEvents triggered by touches), the rotationAngle of the Touch.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Touch/rotationAngle\n * @type {number}\n */\n this.rotationAngle = 0;\n\n /**\n * Twist of a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.twist = 0;\n\n /**\n * Barrel pressure on a stylus pointer.\n * @see https://w3c.github.io/pointerevents/#pointerevent-interface\n * @type {number}\n */\n this.tangentialPressure = 0;\n }\n\n /**\n * The unique identifier of the pointer. It will be the same as `identifier`.\n * @readonly\n * @member {number}\n * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId\n */\n get pointerId(): number\n {\n return this.identifier;\n }\n\n /**\n * This will return the local coordinates of the specified displayObject for this InteractionData\n *\n * @param {PIXI.DisplayObject} displayObject - The DisplayObject that you would like the local\n * coords off\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional (otherwise\n * will create a new point)\n * @param {PIXI.Point} [globalPos] - A Point object containing your custom global coords, optional\n * (otherwise will use the current global coords)\n * @return {PIXI.Point} A point containing the coordinates of the InteractionData position relative\n * to the DisplayObject\n */\n public getLocalPosition

(displayObject: DisplayObject, point?: P, globalPos?: IPointData): P\n {\n return displayObject.worldTransform.applyInverse

(globalPos || this.global, point);\n }\n\n /**\n * Copies properties from normalized event data.\n *\n * @param {Touch|MouseEvent|PointerEvent} event - The normalized event data\n */\n public copyEvent(event: Touch | InteractivePointerEvent): void\n {\n // isPrimary should only change on touchstart/pointerdown, so we don't want to overwrite\n // it with \"false\" on later events when our shim for it on touch events might not be\n // accurate\n if ('isPrimary' in event && event.isPrimary)\n {\n this.isPrimary = true;\n }\n this.button = 'button' in event && event.button;\n // event.buttons is not available in all browsers (ie. Safari), but it does have a non-standard\n // event.which property instead, which conveys the same information.\n const buttons = 'buttons' in event && event.buttons;\n\n this.buttons = Number.isInteger(buttons) ? buttons : 'which' in event && event.which;\n this.width = 'width' in event && event.width;\n this.height = 'height' in event && event.height;\n this.tiltX = 'tiltX' in event && event.tiltX;\n this.tiltY = 'tiltY' in event && event.tiltY;\n this.pointerType = 'pointerType' in event && event.pointerType;\n this.pressure = 'pressure' in event && event.pressure;\n this.rotationAngle = 'rotationAngle' in event && event.rotationAngle;\n this.twist = ('twist' in event && event.twist) || 0;\n this.tangentialPressure = ('tangentialPressure' in event && event.tangentialPressure) || 0;\n }\n\n /**\n * Resets the data for pooling.\n */\n public reset(): void\n {\n // isPrimary is the only property that we really need to reset - everything else is\n // guaranteed to be overwritten\n this.isPrimary = false;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import type { DisplayObject } from '@pixi/display';\nimport type { InteractionData } from './InteractionData';\n\nexport type InteractionCallback = (interactionEvent: InteractionEvent, displayObject: DisplayObject, hit?: boolean) => void;\n\n/**\n * Event class that mimics native DOM events.\n *\n * @class\n * @memberof PIXI\n */\nexport class InteractionEvent\n{\n public stopped: boolean;\n public stopsPropagatingAt: DisplayObject;\n public stopPropagationHint: boolean;\n public target: DisplayObject;\n public currentTarget: DisplayObject;\n public type: string;\n public data: InteractionData;\n\n constructor()\n {\n /**\n * Whether this event will continue propagating in the tree.\n *\n * Remaining events for the {@link stopsPropagatingAt} object\n * will still be dispatched.\n *\n * @member {boolean}\n */\n this.stopped = false;\n\n /**\n * At which object this event stops propagating.\n *\n * @private\n * @member {PIXI.DisplayObject}\n */\n this.stopsPropagatingAt = null;\n\n /**\n * Whether we already reached the element we want to\n * stop propagating at. This is important for delayed events,\n * where we start over deeper in the tree again.\n *\n * @private\n * @member {boolean}\n */\n this.stopPropagationHint = false;\n\n /**\n * The object which caused this event to be dispatched.\n * For listener callback see {@link PIXI.InteractionEvent.currentTarget}.\n *\n * @member {PIXI.DisplayObject}\n */\n this.target = null;\n\n /**\n * The object whose event listener’s callback is currently being invoked.\n *\n * @member {PIXI.DisplayObject}\n */\n this.currentTarget = null;\n\n /**\n * Type of the event\n *\n * @member {string}\n */\n this.type = null;\n\n /**\n * InteractionData related to this event\n *\n * @member {PIXI.InteractionData}\n */\n this.data = null;\n }\n\n /**\n * Prevents event from reaching any objects other than the current object.\n *\n */\n public stopPropagation(): void\n {\n this.stopped = true;\n this.stopPropagationHint = true;\n this.stopsPropagatingAt = this.currentTarget;\n }\n\n /**\n * Resets the event.\n */\n public reset(): void\n {\n this.stopped = false;\n this.stopsPropagatingAt = null;\n this.stopPropagationHint = false;\n this.currentTarget = null;\n this.target = null;\n }\n}\n","export interface InteractionTrackingFlags\n{\n OVER: number;\n LEFT_DOWN: number;\n RIGHT_DOWN: number;\n NONE: number;\n}\n\n/**\n * DisplayObjects with the {@link PIXI.interactiveTarget} mixin use this class to track interactions\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class InteractionTrackingData\n{\n public static FLAGS: Readonly = Object.freeze({\n NONE: 0,\n OVER: 1 << 0,\n LEFT_DOWN: 1 << 1,\n RIGHT_DOWN: 1 << 2,\n });\n\n private readonly _pointerId: number;\n private _flags: number;\n\n /**\n * @param {number} pointerId - Unique pointer id of the event\n * @private\n */\n constructor(pointerId: number)\n {\n this._pointerId = pointerId;\n this._flags = InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n *\n * @private\n * @param {number} flag - The interaction flag to set\n * @param {boolean} yn - Should the flag be set or unset\n */\n private _doSet(flag: number, yn: boolean): void\n {\n if (yn)\n {\n this._flags = this._flags | flag;\n }\n else\n {\n this._flags = this._flags & (~flag);\n }\n }\n\n /**\n * Unique pointer id of the event\n *\n * @readonly\n * @private\n * @member {number}\n */\n get pointerId(): number\n {\n return this._pointerId;\n }\n\n /**\n * State of the tracking data, expressed as bit flags\n *\n * @private\n * @member {number}\n */\n get flags(): number\n {\n return this._flags;\n }\n\n set flags(flags: number)\n {\n this._flags = flags;\n }\n\n /**\n * Is the tracked event inactive (not over or down)?\n *\n * @private\n * @member {number}\n */\n get none(): boolean\n {\n return this._flags === InteractionTrackingData.FLAGS.NONE;\n }\n\n /**\n * Is the tracked event over the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get over(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.OVER) !== 0;\n }\n\n set over(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.OVER, yn);\n }\n\n /**\n * Did the right mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get rightDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.RIGHT_DOWN) !== 0;\n }\n\n set rightDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.RIGHT_DOWN, yn);\n }\n\n /**\n * Did the left mouse button come down in the DisplayObject?\n *\n * @private\n * @member {boolean}\n */\n get leftDown(): boolean\n {\n return (this._flags & InteractionTrackingData.FLAGS.LEFT_DOWN) !== 0;\n }\n\n set leftDown(yn: boolean)\n {\n this._doSet(InteractionTrackingData.FLAGS.LEFT_DOWN, yn);\n }\n}\n","import { Point } from '@pixi/math';\n\nimport type { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport type { Container, DisplayObject } from '@pixi/display';\n\n/**\n * Strategy how to search through stage tree for interactive objects\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TreeSearch\n{\n private readonly _tempPoint: Point;\n\n constructor()\n {\n this._tempPoint = new Point();\n }\n\n /**\n * Recursive implementation for findHit\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @param {boolean} [interactive] - Whether the displayObject is interactive\n * @return {boolean} returns true if the displayObject hit the point\n */\n public recursiveFindHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean, interactive?: boolean\n ): boolean\n {\n if (!displayObject || !displayObject.visible)\n {\n return false;\n }\n\n const point = interactionEvent.data.global;\n\n // Took a little while to rework this function correctly! But now it is done and nice and optimized! ^_^\n //\n // This function will now loop through all objects and then only hit test the objects it HAS\n // to, not all of them. MUCH faster..\n // An object will be hit test if the following is true:\n //\n // 1: It is interactive.\n // 2: It belongs to a parent that is interactive AND one of the parents children have not already been hit.\n //\n // As another little optimization once an interactive object has been hit we can carry on\n // through the scenegraph, but we know that there will be no more hits! So we can avoid extra hit tests\n // A final optimization is that an object is not hit test directly if a child has already been hit.\n\n interactive = displayObject.interactive || interactive;\n\n let hit = false;\n let interactiveParent = interactive;\n\n // Flag here can set to false if the event is outside the parents hitArea or mask\n let hitTestChildren = true;\n\n // If there is a hitArea, no need to test against anything else if the pointer is not within the hitArea\n // There is also no longer a need to hitTest children.\n if (displayObject.hitArea)\n {\n if (hitTest)\n {\n displayObject.worldTransform.applyInverse(point, this._tempPoint);\n if (!displayObject.hitArea.contains(this._tempPoint.x, this._tempPoint.y))\n {\n hitTest = false;\n hitTestChildren = false;\n }\n else\n {\n hit = true;\n }\n }\n interactiveParent = false;\n }\n // If there is a mask, no need to hitTest against anything else if the pointer is not within the mask.\n // We still want to hitTestChildren, however, to ensure a mouseout can still be generated.\n // https://github.com/pixijs/pixi.js/issues/5135\n else if (displayObject._mask)\n {\n if (hitTest)\n {\n if (!((displayObject._mask as any).containsPoint && (displayObject._mask as any).containsPoint(point)))\n {\n hitTest = false;\n }\n }\n }\n\n // ** FREE TIP **! If an object is not interactive or has no buttons in it\n // (such as a game scene!) set interactiveChildren to false for that displayObject.\n // This will allow PixiJS to completely ignore and bypass checking the displayObjects children.\n if (hitTestChildren && displayObject.interactiveChildren && (displayObject as Container).children)\n {\n const children = (displayObject as Container).children;\n\n for (let i = children.length - 1; i >= 0; i--)\n {\n const child = children[i];\n\n // time to get recursive.. if this function will return if something is hit..\n const childHit = this.recursiveFindHit(interactionEvent, child, func, hitTest, interactiveParent);\n\n if (childHit)\n {\n // its a good idea to check if a child has lost its parent.\n // this means it has been removed whilst looping so its best\n if (!child.parent)\n {\n continue;\n }\n\n // we no longer need to hit test any more objects in this container as we we\n // now know the parent has been hit\n interactiveParent = false;\n\n // If the child is interactive , that means that the object hit was actually\n // interactive and not just the child of an interactive object.\n // This means we no longer need to hit test anything else. We still need to run\n // through all objects, but we don't need to perform any hit tests.\n\n if (childHit)\n {\n if (interactionEvent.target)\n {\n hitTest = false;\n }\n hit = true;\n }\n }\n }\n }\n\n // no point running this if the item is not interactive or does not have an interactive parent.\n if (interactive)\n {\n // if we are hit testing (as in we have no hit any objects yet)\n // We also don't need to worry about hit testing if once of the displayObjects children\n // has already been hit - but only if it was interactive, otherwise we need to keep\n // looking for an interactive child, just in case we hit one\n if (hitTest && !interactionEvent.target)\n {\n // already tested against hitArea if it is defined\n if (!displayObject.hitArea && (displayObject as any).containsPoint)\n {\n if ((displayObject as any).containsPoint(point))\n {\n hit = true;\n }\n }\n }\n\n if (displayObject.interactive)\n {\n if (hit && !interactionEvent.target)\n {\n interactionEvent.target = displayObject;\n }\n\n if (func)\n {\n func(interactionEvent, displayObject, !!hit);\n }\n }\n }\n\n return hit;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - this indicates if the objects inside should be hit test against the point\n * @return {boolean} returns true if the displayObject hit the point\n */\n public findHit(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n this.recursiveFindHit(interactionEvent, displayObject, func, hitTest, false);\n }\n}\n","import type { InteractionTrackingData } from './InteractionTrackingData';\n\ntype Cursor = 'auto'\n | 'default'\n | 'none'\n | 'context-menu'\n | 'help'\n | 'pointer'\n | 'progress'\n | 'wait'\n | 'cell'\n | 'crosshair'\n | 'text'\n | 'vertical-text'\n | 'alias'\n | 'copy'\n | 'move'\n | 'no-drop'\n | 'not-allowed'\n | 'e-resize'\n | 'n-resize'\n | 'ne-resize'\n | 'nw-resize'\n | 's-resize'\n | 'se-resize'\n | 'sw-resize'\n | 'w-resize'\n | 'ns-resize'\n | 'ew-resize'\n | 'nesw-resize'\n | 'col-resize'\n | 'nwse-resize'\n | 'row-resize'\n | 'all-scroll'\n | 'zoom-in'\n | 'zoom-out'\n | 'grab'\n | 'grabbing';\n\nexport interface IHitArea {\n contains(x: number, y: number): boolean;\n}\n\nexport interface InteractiveTarget {\n interactive: boolean;\n interactiveChildren: boolean;\n hitArea: IHitArea;\n cursor: Cursor | string;\n buttonMode: boolean;\n trackedPointers: {[x: number]: InteractionTrackingData};\n _trackedPointers: {[x: number]: InteractionTrackingData};\n}\n\n/**\n * Interface for classes that represent a hit area.\n *\n * It is implemented by the following classes:\n * - {@link PIXI.Circle}\n * - {@link PIXI.Ellipse}\n * - {@link PIXI.Polygon}\n * - {@link PIXI.RoundedRectangle}\n *\n * @interface IHitArea\n * @memberof PIXI\n */\n\n/**\n * Checks whether the x and y coordinates given are contained within this area\n *\n * @method\n * @name contains\n * @memberof PIXI.IHitArea#\n * @param {number} x - The X coordinate of the point to test\n * @param {number} y - The Y coordinate of the point to test\n * @return {boolean} Whether the x/y coordinates are within this area\n */\n\n/**\n * Default property values of interactive objects\n * Used by {@link PIXI.InteractionManager} to automatically give all DisplayObjects these properties\n *\n * @private\n * @name interactiveTarget\n * @type {Object}\n * @memberof PIXI\n * @example\n * function MyObject() {}\n *\n * Object.assign(\n * DisplayObject.prototype,\n * PIXI.interactiveTarget\n * );\n */\nexport const interactiveTarget: InteractiveTarget = {\n interactive: false,\n interactiveChildren: true,\n hitArea: null,\n\n /**\n * If enabled, the mouse cursor use the pointer behavior when hovered over the displayObject if it is interactive\n * Setting this changes the 'cursor' property to `'pointer'`.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.buttonMode = true;\n * @member {boolean}\n * @memberof PIXI.DisplayObject#\n */\n get buttonMode(): boolean\n {\n return this.cursor === 'pointer';\n },\n set buttonMode(value: boolean)\n {\n if (value)\n {\n this.cursor = 'pointer';\n }\n else if (this.cursor === 'pointer')\n {\n this.cursor = null;\n }\n },\n\n /**\n * This defines what cursor mode is used when the mouse cursor\n * is hovered over the displayObject.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.interactive = true;\n * sprite.cursor = 'wait';\n * @see https://developer.mozilla.org/en/docs/Web/CSS/cursor\n *\n * @member {string}\n * @memberof PIXI.DisplayObject#\n */\n cursor: null,\n\n /**\n * Internal set of all active pointers, by identifier\n *\n * @member {Map}\n * @memberof PIXI.DisplayObject#\n * @private\n */\n get trackedPointers()\n {\n if (this._trackedPointers === undefined) this._trackedPointers = {};\n\n return this._trackedPointers;\n },\n\n /**\n * Map of all tracked pointers, by identifier. Use trackedPointers to access.\n *\n * @private\n * @type {Map}\n */\n _trackedPointers: undefined,\n};\n","import { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { DisplayObject, TemporaryDisplayObject } from '@pixi/display';\nimport { InteractionData, InteractivePointerEvent } from './InteractionData';\nimport { InteractionEvent, InteractionCallback } from './InteractionEvent';\nimport { InteractionTrackingData } from './InteractionTrackingData';\nimport { TreeSearch } from './TreeSearch';\nimport { EventEmitter } from '@pixi/utils';\nimport { interactiveTarget } from './interactiveTarget';\n\nimport type { AbstractRenderer } from '@pixi/core';\nimport type { Point, IPointData } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\n// Mix interactiveTarget into DisplayObject.prototype\nDisplayObject.mixin(interactiveTarget);\n\nconst MOUSE_POINTER_ID = 1;\n\n// Mock interface for hitTestEvent - only used inside hitTest()\ninterface TestInteractionEvent\n{\n target: DisplayObject;\n data: {global: Point};\n}\n\n// helpers for hitTest() - only used inside hitTest()\nconst hitTestEvent: TestInteractionEvent = {\n target: null,\n data: {\n global: null,\n },\n};\n\nexport interface InteractionManagerOptions {\n autoPreventDefault?: boolean;\n interactionFrequency?: number;\n useSystemTicker?: boolean;\n}\n\nexport interface DelayedEvent {\n displayObject: DisplayObject;\n eventString: string;\n eventData: InteractionEvent;\n}\n\ninterface CrossCSSStyleDeclaration extends CSSStyleDeclaration\n{\n msContentZooming: string;\n msTouchAction: string;\n}\n\n/**\n * The interaction manager deals with mouse, touch and pointer events.\n *\n * Any DisplayObject can be interactive if its `interactive` property is set to true.\n *\n * This manager also supports multitouch.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.interaction`\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport class InteractionManager extends EventEmitter\n{\n public readonly activeInteractionData: { [key: number]: InteractionData };\n public readonly supportsTouchEvents: boolean;\n public readonly supportsPointerEvents: boolean;\n public interactionDataPool: InteractionData[];\n public cursor: string;\n public delayedEvents: DelayedEvent[];\n public search: TreeSearch;\n public renderer: AbstractRenderer;\n public autoPreventDefault: boolean;\n public interactionFrequency: number;\n public mouse: InteractionData;\n public eventData: InteractionEvent;\n public moveWhenInside: boolean;\n public cursorStyles: Dict void) | CSSStyleDeclaration>;\n public currentCursorMode: string;\n public resolution: number;\n\n protected interactionDOMElement: HTMLElement;\n protected eventsAdded: boolean;\n protected tickerAdded: boolean;\n protected mouseOverRenderer: boolean;\n\n private _useSystemTicker: boolean;\n private _deltaTime: number;\n private _didMove: boolean;\n private _tempDisplayObject: DisplayObject;\n private readonly _eventListenerOptions: { capture: true, passive: false };\n\n /**\n * @param {PIXI.CanvasRenderer|PIXI.Renderer} renderer - A reference to the current renderer\n * @param {object} [options] - The options for the manager.\n * @param {boolean} [options.autoPreventDefault=true] - Should the manager automatically prevent default browser actions.\n * @param {number} [options.interactionFrequency=10] - Maximum frequency (ms) at pointer over/out states will be checked.\n * @param {number} [options.useSystemTicker=true] - Whether to add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n */\n constructor(renderer: AbstractRenderer, options?: InteractionManagerOptions)\n {\n super();\n\n options = options || {};\n\n /**\n * The renderer this interaction manager works for.\n *\n * @member {PIXI.AbstractRenderer}\n */\n this.renderer = renderer;\n\n /**\n * Should default browser actions automatically be prevented.\n * Does not apply to pointer events for backwards compatibility\n * preventDefault on pointer events stops mouse events from firing\n * Thus, for every pointer event, there will always be either a mouse of touch event alongside it.\n *\n * @member {boolean}\n * @default true\n */\n this.autoPreventDefault = options.autoPreventDefault !== undefined ? options.autoPreventDefault : true;\n\n /**\n * Maximum frequency in milliseconds at which pointer over/out states will be checked by {@link tickerUpdate}.\n *\n * @member {number}\n * @default 10\n */\n this.interactionFrequency = options.interactionFrequency || 10;\n\n /**\n * The mouse data\n *\n * @member {PIXI.InteractionData}\n */\n this.mouse = new InteractionData();\n this.mouse.identifier = MOUSE_POINTER_ID;\n\n // setting the mouse to start off far off screen will mean that mouse over does\n // not get called before we even move the mouse.\n this.mouse.global.set(-999999);\n\n /**\n * Actively tracked InteractionData\n *\n * @private\n * @member {Object.}\n */\n this.activeInteractionData = {};\n this.activeInteractionData[MOUSE_POINTER_ID] = this.mouse;\n\n /**\n * Pool of unused InteractionData\n *\n * @private\n * @member {PIXI.InteractionData[]}\n */\n this.interactionDataPool = [];\n\n /**\n * An event data object to handle all the event tracking/dispatching\n *\n * @member {object}\n */\n this.eventData = new InteractionEvent();\n\n /**\n * The DOM element to bind to.\n *\n * @protected\n * @member {HTMLElement}\n */\n this.interactionDOMElement = null;\n\n /**\n * This property determines if mousemove and touchmove events are fired only when the cursor\n * is over the object.\n * Setting to true will make things work more in line with how the DOM version works.\n * Setting to false can make things easier for things like dragging\n * It is currently set to false as this is how PixiJS used to work. This will be set to true in\n * future versions of pixi.\n *\n * @member {boolean}\n * @default false\n */\n this.moveWhenInside = false;\n\n /**\n * Have events been attached to the dom element?\n *\n * @protected\n * @member {boolean}\n */\n this.eventsAdded = false;\n\n /**\n * Has the system ticker been added?\n *\n * @protected\n * @member {boolean}\n */\n this.tickerAdded = false;\n\n /**\n * Is the mouse hovering over the renderer? If working in worker mouse considered to be over renderer by default.\n *\n * @protected\n * @member {boolean}\n */\n this.mouseOverRenderer = !('PointerEvent' in self);\n\n /**\n * Does the device support touch events\n * https://www.w3.org/TR/touch-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsTouchEvents = 'ontouchstart' in self;\n\n /**\n * Does the device support pointer events\n * https://www.w3.org/Submission/pointer-events/\n *\n * @readonly\n * @member {boolean}\n */\n this.supportsPointerEvents = !!self.PointerEvent;\n\n // this will make it so that you don't have to call bind all the time\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerUp = this.onPointerUp.bind(this);\n this.processPointerUp = this.processPointerUp.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerCancel = this.onPointerCancel.bind(this);\n this.processPointerCancel = this.processPointerCancel.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerDown = this.onPointerDown.bind(this);\n this.processPointerDown = this.processPointerDown.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerMove = this.onPointerMove.bind(this);\n this.processPointerMove = this.processPointerMove.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOut = this.onPointerOut.bind(this);\n this.processPointerOverOut = this.processPointerOverOut.bind(this);\n\n /**\n * @private\n * @member {Function}\n */\n this.onPointerOver = this.onPointerOver.bind(this);\n\n /**\n * Dictionary of how different cursor modes are handled. Strings are handled as CSS cursor\n * values, objects are handled as dictionaries of CSS values for interactionDOMElement,\n * and functions are called instead of changing the CSS.\n * Default CSS cursor values are provided for 'default' and 'pointer' modes.\n * @member {Object.}\n */\n this.cursorStyles = {\n default: 'inherit',\n pointer: 'pointer',\n };\n\n /**\n * The mode of the cursor that is being used.\n * The value of this is a key from the cursorStyles dictionary.\n *\n * @member {string}\n */\n this.currentCursorMode = null;\n\n /**\n * Internal cached let.\n *\n * @private\n * @member {string}\n */\n this.cursor = null;\n\n /**\n * The current resolution / device pixel ratio.\n *\n * @member {number}\n * @default 1\n */\n this.resolution = 1;\n\n /**\n * Delayed pointer events. Used to guarantee correct ordering of over/out events.\n *\n * @private\n * @member {Array}\n */\n this.delayedEvents = [];\n\n /**\n * TreeSearch component that is used to hitTest stage tree\n *\n * @private\n * @member {PIXI.TreeSearch}\n */\n this.search = new TreeSearch();\n\n /**\n * Used as a last rendered object in case renderer doesnt have _lastObjectRendered\n * @member {DisplayObject}\n * @private\n */\n this._tempDisplayObject = new TemporaryDisplayObject();\n\n /**\n * An options object specifies characteristics about the event listener.\n * @private\n * @readonly\n * @member {Object.}\n */\n this._eventListenerOptions = { capture: true, passive: false };\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display\n * object.\n *\n * @event PIXI.InteractionManager#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object.\n *\n * @event PIXI.InteractionManager#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object.\n *\n * @event PIXI.InteractionManager#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object.\n *\n * @event PIXI.InteractionManager#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object.\n *\n * @event PIXI.InteractionManager#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object.\n *\n * @event PIXI.InteractionManager#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.InteractionManager#event:mousedown}.\n *\n * @event PIXI.InteractionManager#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.InteractionManager#event:rightdown}.\n *\n * @event PIXI.InteractionManager#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object\n *\n * @event PIXI.InteractionManager#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object\n *\n * @event PIXI.InteractionManager#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object\n *\n * @event PIXI.InteractionManager#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n *\n * @event PIXI.InteractionManager#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * Not always fired when some buttons are held down while others are released. In those cases,\n * use [mousedown]{@link PIXI.InteractionManager#event:mousedown} and\n * [mouseup]{@link PIXI.InteractionManager#event:mouseup} instead.\n *\n * @event PIXI.InteractionManager#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event\n *\n * @event PIXI.InteractionManager#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n *\n * @event PIXI.InteractionManager#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.InteractionManager#event:pointerdown}.\n *\n * @event PIXI.InteractionManager#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object\n *\n * @event PIXI.InteractionManager#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object\n *\n * @event PIXI.InteractionManager#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object\n *\n * @event PIXI.InteractionManager#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n *\n * @event PIXI.InteractionManager#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n *\n * @event PIXI.InteractionManager#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch\n *\n * @event PIXI.InteractionManager#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n *\n * @event PIXI.InteractionManager#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.InteractionManager#event:touchstart}.\n *\n * @event PIXI.InteractionManager#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n *\n * @event PIXI.InteractionManager#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed on the display.\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#mousedown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#rightdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released over the display\n * object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#mouseup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * over the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#rightup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is pressed and released on\n * the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#click\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is pressed\n * and released on the display object. DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#rightclick\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button (usually a mouse left-button) is released outside the\n * display object that initially registered a\n * [mousedown]{@link PIXI.DisplayObject#event:mousedown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#mouseupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device secondary button (usually a mouse right-button) is released\n * outside the display object that initially registered a\n * [rightdown]{@link PIXI.DisplayObject#event:rightdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#rightupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#mousemove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#mouseover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device (usually a mouse) is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#mouseout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#pointerdown\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#pointerup\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a pointer event.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#pointercancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is pressed and released on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#pointertap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device button is released outside the display object that initially\n * registered a [pointerdown]{@link PIXI.DisplayObject#event:pointerdown}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#pointerupoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved while over the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#pointermove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved onto the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#pointerover\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a pointer device is moved off the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#pointerout\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed on the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#touchstart\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#touchend\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when the operating system cancels a touch.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#touchcancel\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is placed and removed from the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#tap\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is removed outside of the display object that initially\n * registered a [touchstart]{@link PIXI.DisplayObject#event:touchstart}.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#touchendoutside\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n /**\n * Fired when a touch point is moved along the display object.\n * DisplayObject's `interactive` property must be set to `true` to fire event.\n *\n * This comes from the @pixi/interaction package.\n *\n * @event PIXI.DisplayObject#touchmove\n * @param {PIXI.InteractionEvent} event - Interaction event\n */\n\n this._useSystemTicker = options.useSystemTicker !== undefined ? options.useSystemTicker : true;\n\n this.setTargetElement(this.renderer.view, this.renderer.resolution);\n }\n\n /**\n * Should the InteractionManager automatically add {@link tickerUpdate} to {@link PIXI.Ticker.system}.\n *\n * @member {boolean}\n * @default true\n */\n get useSystemTicker(): boolean\n {\n return this._useSystemTicker;\n }\n set useSystemTicker(useSystemTicker: boolean)\n {\n this._useSystemTicker = useSystemTicker;\n\n if (useSystemTicker)\n {\n this.addTickerListener();\n }\n else\n {\n this.removeTickerListener();\n }\n }\n\n /**\n * Last rendered object or temp object\n * @readonly\n * @protected\n * @member {PIXI.DisplayObject}\n */\n get lastObjectRendered(): DisplayObject\n {\n return (this.renderer._lastObjectRendered as DisplayObject) || this._tempDisplayObject;\n }\n\n /**\n * Hit tests a point against the display tree, returning the first interactive object that is hit.\n *\n * @param {PIXI.Point} globalPoint - A point to hit test with, in global space.\n * @param {PIXI.Container} [root] - The root display object to start from. If omitted, defaults\n * to the last rendered root of the associated renderer.\n * @return {PIXI.DisplayObject} The hit display object, if any.\n */\n public hitTest(globalPoint: Point, root?: DisplayObject): DisplayObject\n {\n // clear the target for our hit test\n hitTestEvent.target = null;\n // assign the global point\n hitTestEvent.data.global = globalPoint;\n // ensure safety of the root\n if (!root)\n {\n root = this.lastObjectRendered;\n }\n // run the hit test\n this.processInteractive(hitTestEvent as InteractionEvent, root, null, true);\n // return our found object - it'll be null if we didn't hit anything\n\n return hitTestEvent.target;\n }\n\n /**\n * Sets the DOM element which will receive mouse/touch events. This is useful for when you have\n * other DOM elements on top of the renderers Canvas element. With this you'll be bale to delegate\n * another DOM element to receive those events.\n *\n * @param {HTMLElement} element - the DOM element which will receive mouse and touch events.\n * @param {number} [resolution=1] - The resolution / device pixel ratio of the new element (relative to the canvas).\n */\n public setTargetElement(element: HTMLElement, resolution = 1): void\n {\n this.removeTickerListener();\n\n this.removeEvents();\n\n this.interactionDOMElement = element;\n\n this.resolution = resolution;\n\n this.addEvents();\n\n this.addTickerListener();\n }\n\n /**\n * Add the ticker listener\n *\n * @private\n */\n private addTickerListener(): void\n {\n if (this.tickerAdded || !this.interactionDOMElement || !this._useSystemTicker)\n {\n return;\n }\n\n Ticker.system.add(this.tickerUpdate, this, UPDATE_PRIORITY.INTERACTION);\n\n this.tickerAdded = true;\n }\n\n /**\n * Remove the ticker listener\n *\n * @private\n */\n private removeTickerListener(): void\n {\n if (!this.tickerAdded)\n {\n return;\n }\n\n Ticker.system.remove(this.tickerUpdate, this);\n\n this.tickerAdded = false;\n }\n\n /**\n * Registers all the DOM events\n *\n * @private\n */\n private addEvents(): void\n {\n if (this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (self.navigator.msPointerEnabled)\n {\n style.msContentZooming = 'none';\n style.msTouchAction = 'none';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = 'none';\n }\n\n /*\n * These events are added first, so that if pointer events are normalized, they are fired\n * in the same order as non-normalized events. ie. pointer event 1st, mouse / touch 2nd\n */\n if (this.supportsPointerEvents)\n {\n self.document.addEventListener('pointermove', this.onPointerMove, this._eventListenerOptions);\n this.interactionDOMElement.addEventListener('pointerdown', this.onPointerDown, this._eventListenerOptions);\n // pointerout is fired in addition to pointerup (for touch events) and pointercancel\n // we already handle those, so for the purposes of what we do in onPointerOut, we only\n // care about the pointerleave event\n this.interactionDOMElement.addEventListener('pointerleave', this.onPointerOut, this._eventListenerOptions);\n this.interactionDOMElement.addEventListener('pointerover', this.onPointerOver, this._eventListenerOptions);\n self.addEventListener('pointercancel', this.onPointerCancel, this._eventListenerOptions);\n self.addEventListener('pointerup', this.onPointerUp, this._eventListenerOptions);\n }\n else\n {\n self.document.addEventListener('mousemove', this.onPointerMove, this._eventListenerOptions);\n this.interactionDOMElement.addEventListener('mousedown', this.onPointerDown, this._eventListenerOptions);\n this.interactionDOMElement.addEventListener('mouseout', this.onPointerOut, this._eventListenerOptions);\n this.interactionDOMElement.addEventListener('mouseover', this.onPointerOver, this._eventListenerOptions);\n self.addEventListener('mouseup', this.onPointerUp, this._eventListenerOptions);\n }\n\n // always look directly for touch events so that we can provide original data\n // In a future version we should change this to being just a fallback and rely solely on\n // PointerEvents whenever available\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.addEventListener('touchstart', this.onPointerDown, this._eventListenerOptions);\n this.interactionDOMElement.addEventListener('touchcancel', this.onPointerCancel, this._eventListenerOptions);\n this.interactionDOMElement.addEventListener('touchend', this.onPointerUp, this._eventListenerOptions);\n this.interactionDOMElement.addEventListener('touchmove', this.onPointerMove, this._eventListenerOptions);\n }\n\n this.eventsAdded = true;\n }\n\n /**\n * Removes all the DOM events that were previously registered\n *\n * @private\n */\n private removeEvents(): void\n {\n if (!this.eventsAdded || !this.interactionDOMElement)\n {\n return;\n }\n\n const style = this.interactionDOMElement.style as CrossCSSStyleDeclaration;\n\n if (self.navigator.msPointerEnabled)\n {\n style.msContentZooming = '';\n style.msTouchAction = '';\n }\n else if (this.supportsPointerEvents)\n {\n style.touchAction = '';\n }\n\n if (this.supportsPointerEvents)\n {\n self.document.removeEventListener('pointermove', this.onPointerMove, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('pointerdown', this.onPointerDown, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('pointerleave', this.onPointerOut, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('pointerover', this.onPointerOver, this._eventListenerOptions);\n self.removeEventListener('pointercancel', this.onPointerCancel, this._eventListenerOptions);\n self.removeEventListener('pointerup', this.onPointerUp, this._eventListenerOptions);\n }\n else\n {\n self.document.removeEventListener('mousemove', this.onPointerMove, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('mousedown', this.onPointerDown, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('mouseout', this.onPointerOut, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('mouseover', this.onPointerOver, this._eventListenerOptions);\n self.removeEventListener('mouseup', this.onPointerUp, this._eventListenerOptions);\n }\n\n if (this.supportsTouchEvents)\n {\n this.interactionDOMElement.removeEventListener('touchstart', this.onPointerDown, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('touchcancel', this.onPointerCancel, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('touchend', this.onPointerUp, this._eventListenerOptions);\n this.interactionDOMElement.removeEventListener('touchmove', this.onPointerMove, this._eventListenerOptions);\n }\n\n this.interactionDOMElement = null;\n\n this.eventsAdded = false;\n }\n\n /**\n * Updates the state of interactive objects if at least {@link interactionFrequency}\n * milliseconds have passed since the last invocation.\n *\n * Invoked by a throttled ticker update from {@link PIXI.Ticker.system}.\n *\n * @param {number} deltaTime - time delta since the last call\n */\n public tickerUpdate(deltaTime: number): void\n {\n this._deltaTime += deltaTime;\n\n if (this._deltaTime < this.interactionFrequency)\n {\n return;\n }\n\n this._deltaTime = 0;\n\n this.update();\n }\n\n /**\n * Updates the state of interactive objects.\n */\n public update(): void\n {\n if (!this.interactionDOMElement)\n {\n return;\n }\n\n // if the user move the mouse this check has already been done using the mouse move!\n if (this._didMove)\n {\n this._didMove = false;\n\n return;\n }\n\n this.cursor = null;\n\n // Resets the flag as set by a stopPropagation call. This flag is usually reset by a user interaction of any kind,\n // but there was a scenario of a display object moving under a static mouse cursor.\n // In this case, mouseover and mouseevents would not pass the flag test in dispatchEvent function\n for (const k in this.activeInteractionData)\n {\n // eslint-disable-next-line no-prototype-builtins\n if (this.activeInteractionData.hasOwnProperty(k))\n {\n const interactionData = this.activeInteractionData[k];\n\n if (interactionData.originalEvent && interactionData.pointerType !== 'touch')\n {\n const interactionEvent = this.configureInteractionEventForDOMEvent(\n this.eventData,\n interactionData.originalEvent as PointerEvent,\n interactionData\n );\n\n this.processInteractive(\n interactionEvent,\n this.lastObjectRendered,\n this.processPointerOverOut,\n true\n );\n }\n }\n }\n\n this.setCursorMode(this.cursor);\n }\n\n /**\n * Sets the current cursor mode, handling any callbacks or CSS style changes.\n *\n * @param {string} mode - cursor mode, a key from the cursorStyles dictionary\n */\n public setCursorMode(mode: string): void\n {\n mode = mode || 'default';\n let applyStyles = true;\n\n // offscreen canvas does not support setting styles, but cursor modes can be functions,\n // in order to handle pixi rendered cursors, so we can't bail\n if (self.OffscreenCanvas && this.interactionDOMElement instanceof OffscreenCanvas)\n {\n applyStyles = false;\n }\n // if the mode didn't actually change, bail early\n if (this.currentCursorMode === mode)\n {\n return;\n }\n this.currentCursorMode = mode;\n const style = this.cursorStyles[mode];\n\n // only do things if there is a cursor style for it\n if (style)\n {\n switch (typeof style)\n {\n case 'string':\n // string styles are handled as cursor CSS\n if (applyStyles)\n {\n this.interactionDOMElement.style.cursor = style;\n }\n break;\n case 'function':\n // functions are just called, and passed the cursor mode\n style(mode);\n break;\n case 'object':\n // if it is an object, assume that it is a dictionary of CSS styles,\n // apply it to the interactionDOMElement\n if (applyStyles)\n {\n Object.assign(this.interactionDOMElement.style, style);\n }\n break;\n }\n }\n else if (applyStyles && typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode))\n {\n // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry\n // for the mode, then assume that the dev wants it to be CSS for the cursor.\n this.interactionDOMElement.style.cursor = mode;\n }\n }\n\n /**\n * Dispatches an event on the display object that was interacted with\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {PIXI.InteractionEvent} eventData - the event data object\n * @private\n */\n private dispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n // Even if the event was stopped, at least dispatch any remaining events\n // for the same display object.\n if (!eventData.stopPropagationHint || displayObject === eventData.stopsPropagatingAt)\n {\n eventData.currentTarget = displayObject;\n eventData.type = eventString;\n\n displayObject.emit(eventString, eventData);\n\n if ((displayObject as any)[eventString])\n {\n (displayObject as any)[eventString](eventData);\n }\n }\n }\n\n /**\n * Puts a event on a queue to be dispatched later. This is used to guarantee correct\n * ordering of over/out events.\n *\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the display object in question\n * @param {string} eventString - the name of the event (e.g, mousedown)\n * @param {object} eventData - the event data object\n * @private\n */\n private delayDispatchEvent(displayObject: DisplayObject, eventString: string, eventData: InteractionEvent): void\n {\n this.delayedEvents.push({ displayObject, eventString, eventData });\n }\n\n /**\n * Maps x and y coords from a DOM object and maps them correctly to the PixiJS view. The\n * resulting value is stored in the point. This takes into account the fact that the DOM\n * element could be scaled and positioned anywhere on the screen.\n *\n * @param {PIXI.IPointData} point - the point that the result will be stored in\n * @param {number} x - the x coord of the position to map\n * @param {number} y - the y coord of the position to map\n */\n public mapPositionToPoint(point: IPointData, x: number, y: number): void\n {\n let rect;\n\n // IE 11 fix\n if (!this.interactionDOMElement.parentElement)\n {\n rect = {\n x: 0,\n y: 0,\n width: (this.interactionDOMElement as any).width,\n height: (this.interactionDOMElement as any).height,\n left: 0,\n top: 0\n };\n }\n else\n {\n rect = this.interactionDOMElement.getBoundingClientRect();\n }\n\n const resolutionMultiplier = 1.0 / this.resolution;\n\n point.x = ((x - rect.left) * ((this.interactionDOMElement as any).width / rect.width)) * resolutionMultiplier;\n point.y = ((y - rect.top) * ((this.interactionDOMElement as any).height / rect.height)) * resolutionMultiplier;\n }\n\n /**\n * This function is provides a neat way of crawling through the scene graph and running a\n * specified function on all interactive objects it finds. It will also take care of hit\n * testing the interactive objects and passes the hit across in the function.\n *\n * @protected\n * @param {PIXI.InteractionEvent} interactionEvent - event containing the point that\n * is tested for collision\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - the displayObject\n * that will be hit test (recursively crawls its children)\n * @param {Function} [func] - the function that will be called on each interactive object. The\n * interactionEvent, displayObject and hit will be passed to the function\n * @param {boolean} [hitTest] - indicates whether we want to calculate hits\n * or just iterate through all interactive objects\n */\n public processInteractive(interactionEvent: InteractionEvent, displayObject: DisplayObject,\n func?: InteractionCallback, hitTest?: boolean\n ): void\n {\n const hit = this.search.findHit(interactionEvent, displayObject, func, hitTest);\n\n const delayedEvents = this.delayedEvents;\n\n if (!delayedEvents.length)\n {\n return hit;\n }\n // Reset the propagation hint, because we start deeper in the tree again.\n interactionEvent.stopPropagationHint = false;\n\n const delayedLen = delayedEvents.length;\n\n this.delayedEvents = [];\n\n for (let i = 0; i < delayedLen; i++)\n {\n const { displayObject, eventString, eventData } = delayedEvents[i];\n\n // When we reach the object we wanted to stop propagating at,\n // set the propagation hint.\n if (eventData.stopsPropagatingAt === displayObject)\n {\n eventData.stopPropagationHint = true;\n }\n\n this.dispatchEvent(displayObject, eventString, eventData);\n }\n\n return hit;\n }\n\n /**\n * Is called when the pointer button is pressed down on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being pressed down\n */\n private onPointerDown(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n /*\n * No need to prevent default on natural pointer events, as there are no side effects\n * Normalized events, however, may have the double mousedown/touchstart issue on the native android browser,\n * so still need to be prevented.\n */\n\n // Guaranteed that there will be at least one event in events, and all events must have the same pointer type\n\n if (this.autoPreventDefault && (events[0] as any).isNormalized)\n {\n const cancelable = originalEvent.cancelable || !('cancelable' in originalEvent);\n\n if (cancelable)\n {\n originalEvent.preventDefault();\n }\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerDown, true);\n\n this.emit('pointerdown', interactionEvent);\n if (event.pointerType === 'touch')\n {\n this.emit('touchstart', interactionEvent);\n }\n // emit a mouse event for \"pen\" pointers, the way a browser would emit a fallback event\n else if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? 'rightdown' : 'mousedown', this.eventData);\n }\n }\n }\n\n /**\n * Processes the result of the pointer down check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerDown(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n const id = interactionEvent.data.identifier;\n\n if (hit)\n {\n if (!displayObject.trackedPointers[id])\n {\n displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n this.dispatchEvent(displayObject, 'pointerdown', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchstart', interactionEvent);\n }\n else if (data.pointerType === 'mouse' || data.pointerType === 'pen')\n {\n const isRightButton = data.button === 2;\n\n if (isRightButton)\n {\n displayObject.trackedPointers[id].rightDown = true;\n }\n else\n {\n displayObject.trackedPointers[id].leftDown = true;\n }\n\n this.dispatchEvent(displayObject, isRightButton ? 'rightdown' : 'mousedown', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being released\n * @param {boolean} cancelled - true if the pointer is cancelled\n * @param {Function} func - Function passed to {@link processInteractive}\n */\n private onPointerComplete(originalEvent: InteractivePointerEvent, cancelled: boolean, func: InteractionCallback): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n const eventLen = events.length;\n\n // if the event wasn't targeting our canvas, then consider it to be pointerupoutside\n // in all cases (unless it was a pointercancel)\n const eventAppend = originalEvent.target !== this.interactionDOMElement ? 'outside' : '';\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n // perform hit testing for events targeting our canvas or cancel events\n this.processInteractive(interactionEvent, this.lastObjectRendered, func, cancelled || !eventAppend);\n\n this.emit(cancelled ? 'pointercancel' : `pointerup${eventAppend}`, interactionEvent);\n\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n const isRightButton = event.button === 2;\n\n this.emit(isRightButton ? `rightup${eventAppend}` : `mouseup${eventAppend}`, interactionEvent);\n }\n else if (event.pointerType === 'touch')\n {\n this.emit(cancelled ? 'touchcancel' : `touchend${eventAppend}`, interactionEvent);\n this.releaseInteractionDataForPointerId(event.pointerId);\n }\n }\n }\n\n /**\n * Is called when the pointer button is cancelled\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerCancel(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, true, this.processPointerCancel);\n }\n\n /**\n * Processes the result of the pointer cancel check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n */\n private processPointerCancel(interactionEvent: InteractionEvent, displayObject: DisplayObject): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n if (displayObject.trackedPointers[id] !== undefined)\n {\n delete displayObject.trackedPointers[id];\n this.dispatchEvent(displayObject, 'pointercancel', interactionEvent);\n\n if (data.pointerType === 'touch')\n {\n this.dispatchEvent(displayObject, 'touchcancel', interactionEvent);\n }\n }\n }\n\n /**\n * Is called when the pointer button is released on the renderer element\n *\n * @private\n * @param {PointerEvent} event - The DOM event of a pointer button being released\n */\n private onPointerUp(event: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (event as PointerEvent).pointerType === 'touch') return;\n\n this.onPointerComplete(event, false, this.processPointerUp);\n }\n\n /**\n * Processes the result of the pointer up check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerUp(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const trackingData = displayObject.trackedPointers[id];\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n // need to track mouse down status in the mouse block so that we can emit\n // event in a later block\n let isMouseTap = false;\n\n // Mouse only\n if (isMouse)\n {\n const isRightButton = data.button === 2;\n\n const flags = InteractionTrackingData.FLAGS;\n\n const test = isRightButton ? flags.RIGHT_DOWN : flags.LEFT_DOWN;\n\n const isDown = trackingData !== undefined && (trackingData.flags & test);\n\n if (hit)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightup' : 'mouseup', interactionEvent);\n\n if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightclick' : 'click', interactionEvent);\n // because we can confirm that the mousedown happened on this object, flag for later emit of pointertap\n isMouseTap = true;\n }\n }\n else if (isDown)\n {\n this.dispatchEvent(displayObject, isRightButton ? 'rightupoutside' : 'mouseupoutside', interactionEvent);\n }\n // update the down state of the tracking data\n if (trackingData)\n {\n if (isRightButton)\n {\n trackingData.rightDown = false;\n }\n else\n {\n trackingData.leftDown = false;\n }\n }\n }\n\n // Pointers and Touches, and Mouse\n if (hit)\n {\n this.dispatchEvent(displayObject, 'pointerup', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchend', interactionEvent);\n\n if (trackingData)\n {\n // emit pointertap if not a mouse, or if the mouse block decided it was a tap\n if (!isMouse || isMouseTap)\n {\n this.dispatchEvent(displayObject, 'pointertap', interactionEvent);\n }\n if (isTouch)\n {\n this.dispatchEvent(displayObject, 'tap', interactionEvent);\n // touches are no longer over (if they ever were) when we get the touchend\n // so we should ensure that we don't keep pretending that they are\n trackingData.over = false;\n }\n }\n }\n else if (trackingData)\n {\n this.dispatchEvent(displayObject, 'pointerupoutside', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchendoutside', interactionEvent);\n }\n // Only remove the tracking data if there is no over/down state still associated with it\n if (trackingData && trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n\n /**\n * Is called when the pointer moves across the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer moving\n */\n private onPointerMove(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n if (events[0].pointerType === 'mouse' || events[0].pointerType === 'pen')\n {\n this._didMove = true;\n\n this.cursor = null;\n }\n\n const eventLen = events.length;\n\n for (let i = 0; i < eventLen; i++)\n {\n const event = events[i];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = originalEvent;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerMove, true);\n\n this.emit('pointermove', interactionEvent);\n if (event.pointerType === 'touch') this.emit('touchmove', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen') this.emit('mousemove', interactionEvent);\n }\n\n if (events[0].pointerType === 'mouse')\n {\n this.setCursorMode(this.cursor);\n\n // TODO BUG for parents interactive object (border order issue)\n }\n }\n\n /**\n * Processes the result of the pointer move check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerMove(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const isTouch = data.pointerType === 'touch';\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n if (isMouse)\n {\n this.processPointerOverOut(interactionEvent, displayObject, hit);\n }\n\n if (!this.moveWhenInside || hit)\n {\n this.dispatchEvent(displayObject, 'pointermove', interactionEvent);\n if (isTouch) this.dispatchEvent(displayObject, 'touchmove', interactionEvent);\n if (isMouse) this.dispatchEvent(displayObject, 'mousemove', interactionEvent);\n }\n }\n\n /**\n * Is called when the pointer is moved out of the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer being moved out\n */\n private onPointerOut(originalEvent: InteractivePointerEvent): void\n {\n // if we support touch events, then only use those for touch events, not pointer events\n if (this.supportsTouchEvents && (originalEvent as PointerEvent).pointerType === 'touch') return;\n\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOut, so events will always be length 1\n const event = events[0];\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = false;\n this.setCursorMode(null);\n }\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n this.processInteractive(interactionEvent, this.lastObjectRendered, this.processPointerOverOut, false);\n\n this.emit('pointerout', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseout', interactionEvent);\n }\n else\n {\n // we can get touchleave events after touchend, so we want to make sure we don't\n // introduce memory leaks\n this.releaseInteractionDataForPointerId(interactionData.identifier);\n }\n }\n\n /**\n * Processes the result of the pointer over/out check and dispatches the event if need be\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The interaction event wrapping the DOM event\n * @param {PIXI.Container|PIXI.Sprite|PIXI.TilingSprite} displayObject - The display object that was tested\n * @param {boolean} hit - the result of the hit test on the display object\n */\n private processPointerOverOut(interactionEvent: InteractionEvent, displayObject: DisplayObject, hit: boolean): void\n {\n const data = interactionEvent.data;\n\n const id = interactionEvent.data.identifier;\n\n const isMouse = (data.pointerType === 'mouse' || data.pointerType === 'pen');\n\n let trackingData = displayObject.trackedPointers[id];\n\n // if we just moused over the display object, then we need to track that state\n if (hit && !trackingData)\n {\n trackingData = displayObject.trackedPointers[id] = new InteractionTrackingData(id);\n }\n\n if (trackingData === undefined) return;\n\n if (hit && this.mouseOverRenderer)\n {\n if (!trackingData.over)\n {\n trackingData.over = true;\n this.delayDispatchEvent(displayObject, 'pointerover', interactionEvent);\n if (isMouse)\n {\n this.delayDispatchEvent(displayObject, 'mouseover', interactionEvent);\n }\n }\n\n // only change the cursor if it has not already been changed (by something deeper in the\n // display tree)\n if (isMouse && this.cursor === null)\n {\n this.cursor = displayObject.cursor;\n }\n }\n else if (trackingData.over)\n {\n trackingData.over = false;\n this.dispatchEvent(displayObject, 'pointerout', this.eventData);\n if (isMouse)\n {\n this.dispatchEvent(displayObject, 'mouseout', interactionEvent);\n }\n // if there is no mouse down information for the pointer, then it is safe to delete\n if (trackingData.none)\n {\n delete displayObject.trackedPointers[id];\n }\n }\n }\n\n /**\n * Is called when the pointer is moved into the renderer element\n *\n * @private\n * @param {PointerEvent} originalEvent - The DOM event of a pointer button being moved into the renderer view\n */\n private onPointerOver(originalEvent: InteractivePointerEvent): void\n {\n const events = this.normalizeToPointerData(originalEvent);\n\n // Only mouse and pointer can call onPointerOver, so events will always be length 1\n const event = events[0];\n\n const interactionData = this.getInteractionDataForPointerId(event);\n\n const interactionEvent = this.configureInteractionEventForDOMEvent(this.eventData, event, interactionData);\n\n interactionEvent.data.originalEvent = event;\n\n if (event.pointerType === 'mouse')\n {\n this.mouseOverRenderer = true;\n }\n\n this.emit('pointerover', interactionEvent);\n if (event.pointerType === 'mouse' || event.pointerType === 'pen')\n {\n this.emit('mouseover', interactionEvent);\n }\n }\n\n /**\n * Get InteractionData for a given pointerId. Store that data as well\n *\n * @private\n * @param {PointerEvent} event - Normalized pointer event, output from normalizeToPointerData\n * @return {PIXI.InteractionData} - Interaction data for the given pointer identifier\n */\n private getInteractionDataForPointerId(event: PointerEvent): InteractionData\n {\n const pointerId = event.pointerId;\n\n let interactionData;\n\n if (pointerId === MOUSE_POINTER_ID || event.pointerType === 'mouse')\n {\n interactionData = this.mouse;\n }\n else if (this.activeInteractionData[pointerId])\n {\n interactionData = this.activeInteractionData[pointerId];\n }\n else\n {\n interactionData = this.interactionDataPool.pop() || new InteractionData();\n interactionData.identifier = pointerId;\n this.activeInteractionData[pointerId] = interactionData;\n }\n // copy properties from the event, so that we can make sure that touch/pointer specific\n // data is available\n interactionData.copyEvent(event);\n\n return interactionData;\n }\n\n /**\n * Return unused InteractionData to the pool, for a given pointerId\n *\n * @private\n * @param {number} pointerId - Identifier from a pointer event\n */\n private releaseInteractionDataForPointerId(pointerId: number): void\n {\n const interactionData = this.activeInteractionData[pointerId];\n\n if (interactionData)\n {\n delete this.activeInteractionData[pointerId];\n interactionData.reset();\n this.interactionDataPool.push(interactionData);\n }\n }\n\n /**\n * Configure an InteractionEvent to wrap a DOM PointerEvent and InteractionData\n *\n * @private\n * @param {PIXI.InteractionEvent} interactionEvent - The event to be configured\n * @param {PointerEvent} pointerEvent - The DOM event that will be paired with the InteractionEvent\n * @param {PIXI.InteractionData} interactionData - The InteractionData that will be paired\n * with the InteractionEvent\n * @return {PIXI.InteractionEvent} the interaction event that was passed in\n */\n private configureInteractionEventForDOMEvent(interactionEvent: InteractionEvent, pointerEvent: PointerEvent,\n interactionData: InteractionData\n ): InteractionEvent\n {\n interactionEvent.data = interactionData;\n\n this.mapPositionToPoint(interactionData.global, pointerEvent.clientX, pointerEvent.clientY);\n\n // Not really sure why this is happening, but it's how a previous version handled things\n if (pointerEvent.pointerType === 'touch')\n {\n (pointerEvent as any).globalX = interactionData.global.x;\n (pointerEvent as any).globalY = interactionData.global.y;\n }\n\n interactionData.originalEvent = pointerEvent;\n interactionEvent.reset();\n\n return interactionEvent;\n }\n\n /**\n * Ensures that the original event object contains all data that a regular pointer event would have\n *\n * @private\n * @param {TouchEvent|MouseEvent|PointerEvent} event - The original event data from a touch or mouse event\n * @return {PointerEvent[]} An array containing a single normalized pointer event, in the case of a pointer\n * or mouse event, or a multiple normalized pointer events if there are multiple changed touches\n */\n private normalizeToPointerData(event: InteractivePointerEvent): PointerEvent[]\n {\n const normalizedEvents = [];\n\n if (this.supportsTouchEvents && event instanceof TouchEvent)\n {\n for (let i = 0, li = event.changedTouches.length; i < li; i++)\n {\n const touch = event.changedTouches[i] as PixiTouch;\n\n if (typeof touch.button === 'undefined') touch.button = event.touches.length ? 1 : 0;\n if (typeof touch.buttons === 'undefined') touch.buttons = event.touches.length ? 1 : 0;\n if (typeof touch.isPrimary === 'undefined')\n {\n touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';\n }\n if (typeof touch.width === 'undefined') touch.width = touch.radiusX || 1;\n if (typeof touch.height === 'undefined') touch.height = touch.radiusY || 1;\n if (typeof touch.tiltX === 'undefined') touch.tiltX = 0;\n if (typeof touch.tiltY === 'undefined') touch.tiltY = 0;\n if (typeof touch.pointerType === 'undefined') touch.pointerType = 'touch';\n if (typeof touch.pointerId === 'undefined') touch.pointerId = touch.identifier || 0;\n if (typeof touch.pressure === 'undefined') touch.pressure = touch.force || 0.5;\n if (typeof touch.twist === 'undefined') touch.twist = 0;\n if (typeof touch.tangentialPressure === 'undefined') touch.tangentialPressure = 0;\n // TODO: Remove these, as layerX/Y is not a standard, is deprecated, has uneven\n // support, and the fill ins are not quite the same\n // offsetX/Y might be okay, but is not the same as clientX/Y when the canvas's top\n // left is not 0,0 on the page\n if (typeof touch.layerX === 'undefined') touch.layerX = touch.offsetX = touch.clientX;\n if (typeof touch.layerY === 'undefined') touch.layerY = touch.offsetY = touch.clientY;\n\n // mark the touch as normalized, just so that we know we did it\n touch.isNormalized = true;\n\n normalizedEvents.push(touch);\n }\n }\n // apparently PointerEvent subclasses MouseEvent, so yay\n else if (!self.MouseEvent\n || (event instanceof MouseEvent && (!this.supportsPointerEvents || !(event instanceof self.PointerEvent))))\n {\n const tempEvent = event as PixiPointerEvent;\n\n if (typeof tempEvent.isPrimary === 'undefined') tempEvent.isPrimary = true;\n if (typeof tempEvent.width === 'undefined') tempEvent.width = 1;\n if (typeof tempEvent.height === 'undefined') tempEvent.height = 1;\n if (typeof tempEvent.tiltX === 'undefined') tempEvent.tiltX = 0;\n if (typeof tempEvent.tiltY === 'undefined') tempEvent.tiltY = 0;\n if (typeof tempEvent.pointerType === 'undefined') tempEvent.pointerType = 'mouse';\n if (typeof tempEvent.pointerId === 'undefined') tempEvent.pointerId = MOUSE_POINTER_ID;\n if (typeof tempEvent.pressure === 'undefined') tempEvent.pressure = 0.5;\n if (typeof tempEvent.twist === 'undefined') tempEvent.twist = 0;\n if (typeof tempEvent.tangentialPressure === 'undefined') tempEvent.tangentialPressure = 0;\n\n // mark the mouse event as normalized, just so that we know we did it\n tempEvent.isNormalized = true;\n\n normalizedEvents.push(tempEvent);\n }\n else\n {\n normalizedEvents.push(event);\n }\n\n return normalizedEvents as PointerEvent[];\n }\n\n /**\n * Destroys the interaction manager\n *\n */\n public destroy(): void\n {\n this.removeEvents();\n\n this.removeTickerListener();\n\n this.removeAllListeners();\n\n this.renderer = null;\n\n this.mouse = null;\n\n this.eventData = null;\n\n this.interactionDOMElement = null;\n\n this.onPointerDown = null;\n this.processPointerDown = null;\n\n this.onPointerUp = null;\n this.processPointerUp = null;\n\n this.onPointerCancel = null;\n this.processPointerCancel = null;\n\n this.onPointerMove = null;\n this.processPointerMove = null;\n\n this.onPointerOut = null;\n this.processPointerOverOut = null;\n\n this.onPointerOver = null;\n\n this.search = null;\n }\n}\n\ninterface PixiPointerEvent extends PointerEvent\n{\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n isNormalized: boolean;\n}\n\ninterface PixiTouch extends Touch\n{\n button: number;\n buttons: number;\n isPrimary: boolean;\n width: number;\n height: number;\n tiltX: number;\n tiltY: number;\n pointerType: string;\n pointerId: number;\n pressure: number;\n twist: number;\n tangentialPressure: number;\n layerX: number;\n layerY: number;\n offsetX: number;\n offsetY: number;\n isNormalized: boolean;\n}\n","import { Container } from '@pixi/display';\nimport { autoDetectRenderer } from '@pixi/core';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer, IRendererOptionsAuto, AbstractRenderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * Any plugin that's usable for Application should contain these methods.\n * @memberof PIXI\n * @see {@link PIXI.Application.registerPlugin}\n */\nexport interface IApplicationPlugin {\n /**\n * Called when Application is constructed, scoped to Application instance.\n * Passes in `options` as the only argument, which are Application constructor options.\n * @param {object} options - Application options.\n */\n init(options: IApplicationOptions): void;\n /**\n * Called when destroying Application, scoped to Application instance.\n */\n destroy(): void;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IApplicationOptions extends IRendererOptionsAuto, GlobalMixins.IApplicationOptions {}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Application extends GlobalMixins.Application {}\n\n/**\n * Convenience class to create a new PIXI application.\n *\n * This class automatically creates the renderer, ticker and root container.\n *\n * @example\n * // Create the application\n * const app = new PIXI.Application();\n *\n * // Add the view to the DOM\n * document.body.appendChild(app.view);\n *\n * // ex, add display objects\n * app.stage.addChild(PIXI.Sprite.from('something.png'));\n *\n * @class\n * @memberof PIXI\n */\nexport class Application\n{\n /** Collection of installed plugins. */\n private static _plugins: IApplicationPlugin[] = [];\n\n /**\n * The root display container that's rendered.\n * @member {PIXI.Container}\n */\n public stage: Container = new Container();\n\n /**\n * WebGL renderer if available, otherwise CanvasRenderer.\n * @member {PIXI.Renderer|PIXI.CanvasRenderer}\n */\n public renderer: Renderer|AbstractRenderer;\n\n /**\n * @param {object} [options] - The optional renderer parameters.\n * @param {boolean} [options.autoStart=true] - Automatically starts the rendering after the construction.\n * **Note**: Setting this parameter to false does NOT stop the shared ticker even if you set\n * options.sharedTicker to true in case that it is already started. Stop it by your own.\n * @param {number} [options.width=800] - The width of the renderers view.\n * @param {number} [options.height=600] - The height of the renderers view.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.useContextAlpha=true] - Pass-through value for canvas' context `alpha` property.\n * If you want to set transparency, please use `backgroundAlpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation, enable this if you\n * need to call toDataUrl on the WebGL context.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.forceCanvas=false] - prevents selection of WebGL renderer, even if such is present, this\n * option only is available when using **pixi.js-legacy** or **@pixi/canvas-renderer** modules, otherwise\n * it is ignored.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {number} [options.backgroundAlpha=1] - Value from 0 (fully transparent) to 1 (fully opaque).\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card. **(WebGL only)**.\n * @param {boolean} [options.sharedTicker=false] - `true` to use PIXI.Ticker.shared, `false` to create new ticker.\n * If set to false, you cannot register a handler to occur before anything that runs on the shared ticker.\n * The system ticker will always run before both the shared ticker and the app ticker.\n * @param {boolean} [options.sharedLoader=false] - `true` to use PIXI.Loader.shared, `false` to create new Loader.\n * @param {Window|HTMLElement} [options.resizeTo] - Element to automatically resize stage to.\n */\n constructor(options?: IApplicationOptions)\n {\n // The default options\n options = Object.assign({\n forceCanvas: false,\n }, options);\n\n this.renderer = autoDetectRenderer(options);\n\n // install plugins here\n Application._plugins.forEach((plugin) =>\n {\n plugin.init.call(this, options);\n });\n }\n\n /**\n * Register a middleware plugin for the application\n * @static\n * @param {PIXI.IApplicationPlugin} plugin - Plugin being installed\n */\n static registerPlugin(plugin: IApplicationPlugin): void\n {\n Application._plugins.push(plugin);\n }\n\n /**\n * Render the current stage.\n */\n public render(): void\n {\n this.renderer.render(this.stage);\n }\n\n /**\n * Reference to the renderer's canvas element.\n * @member {HTMLCanvasElement}\n * @readonly\n */\n get view(): HTMLCanvasElement\n {\n return this.renderer.view;\n }\n\n /**\n * Reference to the renderer's screen rectangle. Its safe to use as `filterArea` or `hitArea` for the whole screen.\n * @member {PIXI.Rectangle}\n * @readonly\n */\n get screen(): Rectangle\n {\n return this.renderer.screen;\n }\n\n /**\n * Destroy and don't use after this.\n * @param {Boolean} [removeView=false] - Automatically remove canvas from DOM.\n * @param {object|boolean} [stageOptions] - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param {boolean} [stageOptions.children=false] - if set to true, all the children will have their destroy\n * method called as well. 'stageOptions' will be passed on to those calls.\n * @param {boolean} [stageOptions.texture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the texture of the child sprite\n * @param {boolean} [stageOptions.baseTexture=false] - Only used for child Sprites if stageOptions.children is set\n * to true. Should it destroy the base texture of the child sprite\n */\n public destroy(removeView?: boolean, stageOptions?: IDestroyOptions|boolean): void\n {\n // Destroy plugins in the opposite order\n // which they were constructed\n const plugins = Application._plugins.slice(0);\n\n plugins.reverse();\n plugins.forEach((plugin) =>\n {\n plugin.destroy.call(this);\n });\n\n this.stage.destroy(stageOptions);\n this.stage = null;\n\n this.renderer.destroy(removeView);\n this.renderer = null;\n }\n}\n","import type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Renderer } from '@pixi/core';\nimport type { IApplicationOptions } from './Application';\n\n/**\n * Middleware for for Application's resize functionality\n * @private\n * @class\n */\nexport class ResizePlugin\n{\n public static resizeTo: Window|HTMLElement;\n public static resize: () => void;\n public static renderer: Renderer|CanvasRenderer;\n public static queueResize: () => void;\n private static _resizeId: number;\n private static _resizeTo: Window|HTMLElement;\n private static cancelResize: () => void;\n\n /**\n * Initialize the plugin with scope of application instance\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: IApplicationOptions): void\n {\n Object.defineProperty(this, 'resizeTo',\n /**\n * The HTML element or window to automatically resize the\n * renderer's view element to match width and height.\n * @member {Window|HTMLElement}\n * @name resizeTo\n * @memberof PIXI.Application#\n */\n {\n set(dom: Window|HTMLElement)\n {\n self.removeEventListener('resize', this.queueResize);\n this._resizeTo = dom;\n if (dom)\n {\n self.addEventListener('resize', this.queueResize);\n this.resize();\n }\n },\n get()\n {\n return this._resizeTo;\n },\n });\n\n /**\n * Resize is throttled, so it's safe to call this multiple times per frame and it'll\n * only be called once.\n *\n * @memberof PIXI.Application#\n * @method queueResize\n * @private\n */\n this.queueResize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n this.cancelResize();\n\n // // Throttle resize events per raf\n this._resizeId = requestAnimationFrame(() => this.resize());\n };\n\n /**\n * Cancel the resize queue.\n *\n * @memberof PIXI.Application#\n * @method cancelResize\n * @private\n */\n this.cancelResize = (): void =>\n {\n if (this._resizeId)\n {\n cancelAnimationFrame(this._resizeId);\n this._resizeId = null;\n }\n };\n\n /**\n * Execute an immediate resize on the renderer, this is not\n * throttled and can be expensive to call many times in a row.\n * Will resize only if `resizeTo` property is set.\n *\n * @memberof PIXI.Application#\n * @method resize\n */\n this.resize = (): void =>\n {\n if (!this._resizeTo)\n {\n return;\n }\n\n // clear queue resize\n this.cancelResize();\n\n let width: number;\n let height: number;\n\n // Resize to the window\n if (this._resizeTo === self)\n {\n width = self.innerWidth;\n height = self.innerHeight;\n }\n // Resize to other HTML entities\n else\n {\n const { clientWidth, clientHeight } = this._resizeTo as HTMLElement;\n\n width = clientWidth;\n height = clientHeight;\n }\n\n this.renderer.resize(width, height);\n };\n\n // On resize\n this._resizeId = null;\n this._resizeTo = null;\n this.resizeTo = options.resizeTo || null;\n }\n\n /**\n * Clean up the ticker, scoped to application\n *\n * @static\n * @private\n */\n static destroy(): void\n {\n self.removeEventListener('resize', this.queueResize);\n this.cancelResize();\n this.cancelResize = null;\n this.queueResize = null;\n this.resizeTo = null;\n this.resize = null;\n }\n}\n","import { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { RenderTexture } from '@pixi/core';\n\nimport type { Renderer, IRendererPlugin } from '@pixi/core';\nimport type { DisplayObject } from '@pixi/display';\n\nconst TEMP_RECT = new Rectangle();\nconst BYTES_PER_PIXEL = 4;\n\n/**\n * This class provides renderer-specific plugins for exporting content from a renderer.\n * For instance, these plugins can be used for saving an Image, Canvas element or for exporting the raw image data (pixels).\n *\n * Do not instantiate these plugins directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new app (will auto-add extract plugin to renderer)\n * const app = new PIXI.Application();\n *\n * // Draw a red circle\n * const graphics = new PIXI.Graphics()\n * .beginFill(0xFF0000)\n * .drawCircle(0, 0, 50);\n *\n * // Render the graphics as an HTMLImageElement\n * const image = app.renderer.plugins.extract.image(graphics);\n * document.body.appendChild(image);\n * @class\n * @memberof PIXI\n */\nexport class Extract implements IRendererPlugin\n{\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {HTMLImageElement} HTML Image of the target\n */\n public image(target: DisplayObject|RenderTexture, format?: string, quality?: number): HTMLImageElement\n {\n const image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `Extract.getCanvas` and then running toDataURL on that.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param {string} [format] - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param {number} [quality] - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return {string} A base64 encoded string of the texture.\n */\n public base64(target: DisplayObject|RenderTexture, format?: string, quality?: number): string\n {\n return this.canvas(target).toDataURL(format, quality);\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {HTMLCanvasElement} A Canvas element with the texture rendered on.\n */\n public canvas(target: DisplayObject|RenderTexture): HTMLCanvasElement\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let flipY = false;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n flipY = false;\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = this.renderer.resolution;\n\n flipY = true;\n\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = Math.floor((frame.width * resolution) + 1e-4);\n const height = Math.floor((frame.height * resolution) + 1e-4);\n\n let canvasBuffer = new CanvasRenderTarget(width, height, 1);\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n // add the pixels to the canvas\n const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);\n\n Extract.arrayPostDivide(webglPixels, canvasData.data);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // pulling pixels\n if (flipY)\n {\n const target = new CanvasRenderTarget(canvasBuffer.width, canvasBuffer.height, 1);\n\n target.context.scale(1, -1);\n\n // we can't render to itself because we should be empty before render.\n target.context.drawImage(canvasBuffer.canvas, 0, -height);\n\n canvasBuffer.destroy();\n canvasBuffer = target;\n }\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param {PIXI.DisplayObject|PIXI.RenderTexture} target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return {Uint8Array} One-dimensional array containing the pixel data of the entire texture\n */\n public pixels(target?: DisplayObject|RenderTexture): Uint8Array\n {\n const renderer = this.renderer;\n let resolution;\n let frame;\n let renderTexture;\n let generated = false;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = this.renderer.generateTexture(target);\n generated = true;\n }\n }\n\n if (renderTexture)\n {\n resolution = renderTexture.baseTexture.resolution;\n frame = renderTexture.frame;\n\n // bind the buffer\n renderer.renderTexture.bind(renderTexture);\n }\n else\n {\n resolution = renderer.resolution;\n\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n\n renderer.renderTexture.bind(null);\n }\n\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n const webglPixels = new Uint8Array(BYTES_PER_PIXEL * width * height);\n\n // read pixels to the array\n const gl = renderer.gl;\n\n gl.readPixels(\n frame.x * resolution,\n frame.y * resolution,\n width,\n height,\n gl.RGBA,\n gl.UNSIGNED_BYTE,\n webglPixels\n );\n\n if (generated)\n {\n renderTexture.destroy(true);\n }\n\n Extract.arrayPostDivide(webglPixels, webglPixels);\n\n return webglPixels;\n }\n\n /**\n * Destroys the extract\n *\n */\n public destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Takes premultiplied pixel data and produces regular pixel data\n *\n * @private\n * @param {number[] | Uint8Array | Uint8ClampedArray} pixels - array of pixel data\n * @param {number[] | Uint8Array | Uint8ClampedArray} out - output array\n */\n static arrayPostDivide(\n pixels: number[] | Uint8Array | Uint8ClampedArray, out: number[] | Uint8Array | Uint8ClampedArray\n ): void\n {\n for (let i = 0; i < pixels.length; i += 4)\n {\n const alpha = out[i + 3] = pixels[i + 3];\n\n if (alpha !== 0)\n {\n out[i] = Math.round(Math.min(pixels[i] * 255.0 / alpha, 255.0));\n out[i + 1] = Math.round(Math.min(pixels[i + 1] * 255.0 / alpha, 255.0));\n out[i + 2] = Math.round(Math.min(pixels[i + 2] * 255.0 / alpha, 255.0));\n }\n else\n {\n out[i] = pixels[i];\n out[i + 1] = pixels[i + 1];\n out[i + 2] = pixels[i + 2];\n }\n }\n }\n}\n","/**\n * Constants that define the type of gradient on text.\n *\n * @static\n * @constant\n * @name TEXT_GRADIENT\n * @memberof PIXI\n * @type {object}\n * @property {number} LINEAR_VERTICAL Vertical gradient\n * @property {number} LINEAR_HORIZONTAL Linear gradient\n */\nexport enum TEXT_GRADIENT {\n LINEAR_VERTICAL = 0,\n LINEAR_HORIZONTAL = 1\n}\n","import { Resource, ViewableBuffer, BufferResource } from '@pixi/core';\n\ninterface IBlobOptions\n{\n autoLoad?: boolean;\n width: number;\n height: number;\n}\n\n/**\n * Resource that fetches texture data over the network and stores it in a buffer.\n *\n * @class\n * @extends PIXI.Resource\n * @memberof PIXI\n */\nexport abstract class BlobResource extends BufferResource\n{\n protected origin: string;\n protected buffer: ViewableBuffer;\n protected loaded: boolean;\n\n /**\n * @param {string} url - the URL of the texture file\n * @param {boolean}[autoLoad] - whether to fetch the data immediately;\n * you can fetch it later via {@link BlobResource#load}\n */\n constructor(source: string | Uint8Array | Uint32Array | Float32Array,\n options: IBlobOptions = { width: 1, height: 1, autoLoad: true })\n {\n let origin: string;\n let data: Uint8Array | Uint32Array | Float32Array;\n\n if (typeof source === 'string')\n {\n origin = source;\n data = new Uint8Array();\n }\n else\n {\n origin = null;\n data = source;\n }\n\n super(data, options);\n\n /**\n * The URL of the texture file\n * @member {string}\n */\n this.origin = origin;\n\n /**\n * The viewable buffer on the data\n * @member {ViewableBuffer}\n */\n // HINT: BlobResource allows \"null\" sources, assuming the child class provides an alternative\n this.buffer = data ? new ViewableBuffer(data) : null;\n\n // Allow autoLoad = \"undefined\" still load the resource by default\n if (this.origin && options.autoLoad !== false)\n {\n this.load();\n }\n if (data && data.length)\n {\n this.loaded = true;\n this.onBlobLoaded(this.buffer.rawBinaryData);\n }\n }\n\n protected onBlobLoaded(_data: ArrayBuffer): void\n {\n // TODO: Override this method\n }\n\n /**\n * Loads the blob\n */\n async load(): Promise\n {\n const response = await fetch(this.origin);\n const blob = await response.blob();\n const arrayBuffer = await blob.arrayBuffer();\n\n this.data = new Uint32Array(arrayBuffer);\n this.buffer = new ViewableBuffer(arrayBuffer);\n this.loaded = true;\n\n this.onBlobLoaded(arrayBuffer);\n this.update();\n\n return this;\n }\n}\n","import { BlobResource } from './BlobResource';\nimport { INTERNAL_FORMAT_TO_BYTES_PER_PIXEL } from '../const';\nimport { Renderer, BaseTexture, GLTexture } from '@pixi/core';\n\nimport type { INTERNAL_FORMATS } from '../const';\n\n/**\n * @ignore\n */\n// Used in PIXI.KTXLoader\nexport type CompressedLevelBuffer = {\n levelID: number,\n levelWidth: number,\n levelHeight: number,\n levelBuffer: Uint8Array\n};\n\n/**\n * @ignore\n */\nexport interface ICompressedTextureResourceOptions\n{\n format: INTERNAL_FORMATS;\n width: number;\n height: number;\n levels?: number;\n levelBuffers?: CompressedLevelBuffer[];\n}\n\n/**\n * Resource for compressed texture formats, as follows: S3TC/DXTn (& their sRGB formats), ATC, ASTC, ETC 1/2, PVRTC.\n *\n * Compressed textures improve performance when rendering is texture-bound. The texture data stays compressed in\n * graphics memory, increasing memory locality and speeding up texture fetches. These formats can also be used to store\n * more detail in the same amount of memory.\n *\n * For most developers, container file formats are a better abstraction instead of directly handling raw texture\n * data. PixiJS provides native support for the following texture file formats (via {@link PIXI.Loader}):\n *\n * * **.dds** - the DirectDraw Surface file format stores DXTn (DXT-1,3,5) data. See {@link PIXI.DDSLoader}\n * * **.ktx** - the Khronos Texture Container file format supports storing all the supported WebGL compression formats.\n * See {@link PIXI.KTXLoader}.\n * * **.basis** - the BASIS supercompressed file format stores texture data in an internal format that is transcoded\n * to the compression format supported on the device at _runtime_. It also supports transcoding into a uncompressed\n * format as a fallback; you must install the `@pixi/basis-loader`, `@pixi/basis-transcoder` packages separately to\n * use these files. See {@link PIXI.BasisLoader}.\n *\n * The loaders for the aforementioned formats use `CompressedTextureResource` internally. It is strongly suggested that\n * they be used instead.\n *\n * ## Working directly with CompressedTextureResource\n *\n * Since `CompressedTextureResource` inherits `BlobResource`, you can provide it a URL pointing to a file containing\n * the raw texture data (with no file headers!):\n *\n * ```js\n * // The resource backing the texture data for your textures.\n * // NOTE: You can also provide a ArrayBufferView instead of a URL. This is used when loading data from a container file\n * // format such as KTX, DDS, or BASIS.\n * const compressedResource = new PIXI.CompressedTextureResource(\"bunny.dxt5\", {\n * format: PIXI.INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,\n * width: 256,\n * height: 256\n * });\n *\n * // You can create a base-texture to the cache, so that future `Texture`s can be created using the `Texture.from` API.\n * const baseTexture = new PIXI.BaseTexture(compressedResource, { pmaMode: PIXI.ALPHA_MODES.NPM });\n *\n * // Create a Texture to add to the TextureCache\n * const texture = new PIXI.Texture(baseTexture);\n *\n * // Add baseTexture & texture to the global texture cache\n * PIXI.BaseTexture.addToCache(baseTexture, \"bunny.dxt5\");\n * PIXI.Texture.addToCache(texture, \"bunny.dxt5\");\n * ```\n *\n * @memberof PIXI\n */\nexport class CompressedTextureResource extends BlobResource\n{\n /** The compression format */\n public format: INTERNAL_FORMATS;\n /**\n * The number of mipmap levels stored in the resource buffer.\n * @default 1\n */\n public levels: number;\n\n // Easy access to the WebGL extension providing support for the compression format via ContextSystem\n private _extension: 's3tc' | 's3tc_sRGB' | 'atc' | 'astc' | 'etc' | 'etc1' | 'pvrtc';\n // Buffer views for each mipmap level in the main buffer\n private _levelBuffers: CompressedLevelBuffer[];\n\n /**\n * @param source - the buffer/URL holding the compressed texture data\n * @param options\n * @param {PIXI.INTERNAL_FORMATS} options.format - the compression format\n * @param {number} options.width - the image width in pixels.\n * @param {number} options.height - the image height in pixels.\n * @param {number} [options.level=1] - the mipmap levels stored in the compressed texture, including level 0.\n * @param {number} [options.levelBuffers] - the buffers for each mipmap level. `CompressedTextureResource` can allows you\n * to pass `null` for `source`, for cases where each level is stored in non-contiguous memory.\n */\n constructor(source: string | Uint8Array | Uint32Array, options: ICompressedTextureResourceOptions)\n {\n super(source, options);\n\n this.format = options.format;\n this.levels = options.levels || 1;\n\n this._width = options.width;\n this._height = options.height;\n\n this._extension = CompressedTextureResource._formatToExtension(this.format);\n\n if (options.levelBuffers || this.buffer)\n {\n // ViewableBuffer doesn't support byteOffset :-( so allow source to be Uint8Array\n this._levelBuffers = options.levelBuffers\n || CompressedTextureResource._createLevelBuffers(\n source instanceof Uint8Array ? source : this.buffer.uint8View,\n this.format,\n this.levels,\n 4, 4, // PVRTC has 8x4 blocks in 2bpp mode\n this.width,\n this.height);\n }\n }\n\n /**\n * @override\n * @param renderer - A reference to the current renderer\n * @param _texture - the texture\n * @param _glTexture - texture instance for this webgl context\n */\n upload(renderer: Renderer, _texture: BaseTexture, _glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n const extension = renderer.context.extensions[this._extension];\n\n if (!extension)\n {\n throw new Error(`${this._extension} textures are not supported on the current machine`);\n }\n if (!this._levelBuffers)\n {\n // Do not try to upload data before BlobResource loads, unless the levelBuffers were provided directly!\n return false;\n }\n\n for (let i = 0, j = this.levels; i < j; i++)\n {\n const { levelID, levelWidth, levelHeight, levelBuffer } = this._levelBuffers[i];\n\n gl.compressedTexImage2D(gl.TEXTURE_2D, levelID, this.format, levelWidth, levelHeight, 0, levelBuffer);\n }\n\n return true;\n }\n\n /** @protected */\n protected onBlobLoaded(): void\n {\n this._levelBuffers = CompressedTextureResource._createLevelBuffers(\n this.buffer.uint8View,\n this.format,\n this.levels,\n 4, 4, // PVRTC has 8x4 blocks in 2bpp mode\n this.width,\n this.height);\n }\n\n /**\n * Returns the key (to ContextSystem#extensions) for the WebGL extension supporting the compression format\n *\n * @private\n * @param format - the compression format to get the extension for.\n */\n private static _formatToExtension(format: INTERNAL_FORMATS):\n 's3tc' | 's3tc_sRGB' | 'atc' |\n 'astc' | 'etc' | 'etc1' | 'pvrtc'\n {\n if (format >= 0x83F0 && format <= 0x83F3)\n {\n return 's3tc';\n }\n else if (format >= 0x9270 && format <= 0x9279)\n {\n return 'etc';\n }\n else if (format >= 0x8C00 && format <= 0x8C03)\n {\n return 'pvrtc';\n }\n else if (format >= 0x8D64)\n {\n return 'etc1';\n }\n else if (format >= 0x8C92 && format <= 0x87EE)\n {\n return 'atc';\n }\n\n throw new Error('Invalid (compressed) texture format given!');\n }\n\n /**\n * Pre-creates buffer views for each mipmap level\n *\n * @private\n * @param buffer -\n * @param format - compression formats\n * @param levels - mipmap levels\n * @param blockWidth -\n * @param blockHeight -\n * @param imageWidth - width of the image in pixels\n * @param imageHeight - height of the image in pixels\n */\n private static _createLevelBuffers(\n buffer: Uint8Array,\n format: INTERNAL_FORMATS,\n levels: number,\n blockWidth: number,\n blockHeight: number,\n imageWidth: number,\n imageHeight: number\n ): CompressedLevelBuffer[]\n {\n // The byte-size of the first level buffer\n const buffers = new Array(levels);\n\n let offset = buffer.byteOffset;\n\n let levelWidth = imageWidth;\n let levelHeight = imageHeight;\n let alignedLevelWidth = (levelWidth + blockWidth - 1) & ~(blockWidth - 1);\n let alignedLevelHeight = (levelHeight + blockHeight - 1) & ~(blockHeight - 1);\n\n let levelSize = alignedLevelWidth * alignedLevelHeight * INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[format];\n\n for (let i = 0; i < levels; i++)\n {\n buffers[i] = {\n levelID: i,\n levelWidth: levels > 1 ? levelWidth : alignedLevelWidth,\n levelHeight: levels > 1 ? levelHeight : alignedLevelHeight,\n levelBuffer: new Uint8Array(buffer.buffer, offset, levelSize)\n };\n\n offset += levelSize;\n\n // Calculate levelBuffer dimensions for next iteration\n levelWidth = (levelWidth >> 1) || 1;\n levelHeight = (levelHeight >> 1) || 1;\n alignedLevelWidth = (levelWidth + blockWidth - 1) & ~(blockWidth - 1);\n alignedLevelHeight = (levelHeight + blockHeight - 1) & ~(blockHeight - 1);\n levelSize = alignedLevelWidth * alignedLevelHeight * INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[format];\n }\n\n return buffers;\n }\n}\n","import { LoaderResource } from '@pixi/loaders';\nimport { url } from '@pixi/utils';\n\nimport type { Loader } from '@pixi/loaders';\nimport type { INTERNAL_FORMATS } from '../const';\n\n/**\n * Schema for compressed-texture manifests\n *\n * @ignore\n * @see PIXI.CompressedTextureLoader\n */\nexport type CompressedTextureManifest = {\n textures: Array<{ src: string, format?: keyof INTERNAL_FORMATS}>,\n cacheID: string;\n};\n\n// Missing typings? - https://github.com/microsoft/TypeScript/issues/39655\n/**\n * Compressed texture extensions\n */\n/* eslint-disable camelcase */\nexport type CompressedTextureExtensions = {\n s3tc?: WEBGL_compressed_texture_s3tc,\n s3tc_sRGB: WEBGL_compressed_texture_s3tc_srgb,\n etc: any,\n etc1: any,\n pvrtc: any,\n atc: any,\n astc: WEBGL_compressed_texture_astc\n};\nexport type CompressedTextureExtensionRef = keyof CompressedTextureExtensions;\n/* eslint-enable camelcase */\n\n/**\n * Loader plugin for handling compressed textures for all platforms.\n *\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class CompressedTextureLoader\n{\n /** Map of available texture extensions. */\n static textureExtensions: Partial;\n\n /** Map of available texture formats. */\n static textureFormats: { [P in keyof INTERNAL_FORMATS]?: number };\n\n /**\n * Called after a compressed-textures manifest is loaded.\n *\n * This will then load the correct compression format for the device. Your manifest should adhere\n * to the following schema:\n *\n * ```js\n * import { INTERNAL_FORMATS } from '@pixi/constants';\n *\n * type CompressedTextureManifest = {\n * textures: Array<{ src: string, format?: keyof INTERNAL_FORMATS}>,\n * cacheID: string;\n * };\n * ```\n *\n * This is an example of a .json manifest file\n *\n * ```json\n * {\n * \"cacheID\":\"asset\",\n * \"textures\":[\n * { \"src\":\"asset.fallback.png\" },\n * { \"format\":\"COMPRESSED_RGBA_S3TC_DXT5_EXT\", \"src\":\"asset.s3tc.ktx\" },\n * { \"format\":\"COMPRESSED_RGBA8_ETC2_EAC\", \"src\":\"asset.etc.ktx\" },\n * { \"format\":\"RGBA_PVRTC_4BPPV1_IMG\", \"src\":\"asset.pvrtc.ktx\" }\n * ]\n * }\n * ```\n */\n static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n const data: CompressedTextureManifest = resource.data;\n const loader = this as unknown as Loader;\n\n if (resource.type === LoaderResource.TYPE.JSON\n && data\n && data.cacheID\n && data.textures)\n {\n const textures = data.textures;\n\n let textureURL: string;\n let fallbackURL: string;\n\n // Search for an extension that holds one the formats\n for (let i = 0, j = textures.length; i < j; i++)\n {\n const texture = textures[i];\n const url = texture.src;\n const format = texture.format;\n\n if (!format)\n {\n fallbackURL = url;\n }\n if (CompressedTextureLoader.textureFormats[format])\n {\n textureURL = url;\n break;\n }\n }\n\n textureURL = textureURL || fallbackURL;\n\n // Make sure we have a URL\n if (!textureURL)\n {\n next(new Error(`Cannot load compressed-textures in ${resource.url}, make sure you provide a fallback`));\n\n return;\n }\n if (textureURL === resource.url)\n {\n // Prevent infinite loops\n next(new Error('URL of compressed texture cannot be the same as the manifest\\'s URL'));\n\n return;\n }\n\n const loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource\n };\n\n const resourcePath = url.resolve(resource.url.replace(loader.baseUrl, ''), textureURL);\n const resourceName = data.cacheID;\n\n // The appropriate loader should register the texture\n loader.add(resourceName, resourcePath, loadOptions, (res: LoaderResource) =>\n {\n if (res.error)\n {\n next(res.error);\n\n return;\n }\n\n const { texture = null, textures = {} } = res;\n\n // Make sure texture/textures is assigned to parent resource\n Object.assign(resource, { texture, textures });\n\n // Pass along any error\n next();\n });\n }\n else\n {\n next();\n }\n }\n\n /**\n * Detects the available compressed texture extensions on the device.\n * @ignore\n */\n static add(): void\n {\n // Auto-detect WebGL compressed-texture extensions\n const canvas = document.createElement('canvas');\n const gl = canvas.getContext('webgl');\n\n if (!gl)\n {\n // #if _DEBUG\n console.warn('WebGL not available for compressed textures. Silently failing.');\n // #endif\n\n return;\n }\n\n const extensions = {\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'), /* eslint-disable-line camelcase */\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n\n CompressedTextureLoader.textureExtensions = extensions;\n CompressedTextureLoader.textureFormats = {};\n\n // Assign all available compressed-texture formats\n for (const extensionName in extensions)\n {\n const extension = extensions[extensionName as CompressedTextureExtensionRef];\n\n if (!extension)\n {\n continue;\n }\n\n Object.assign(\n CompressedTextureLoader.textureFormats,\n Object.getPrototypeOf(extension));\n }\n }\n}\n","import { MIPMAP_MODES, ALPHA_MODES } from '@pixi/constants';\nimport { BaseTexture, Texture } from '@pixi/core';\n\nimport type { LoaderResource, IResourceMetadata } from '@pixi/loaders';\nimport type { CompressedTextureResource } from '../resources/CompressedTextureResource';\n\n/**\n * Result when calling registerCompressedTextures.\n * @ignore\n */\ntype CompressedTexturesResult = Pick;\n\n/**\n * Creates base-textures and textures for each compressed-texture resource and adds them into the global\n * texture cache. The first texture has two IDs - `${url}`, `${url}-1`; while the rest have an ID of the\n * form `${url}-i`.\n *\n * @param url - the original address of the resources\n * @param resources - the resources backing texture data\n * @ignore\n */\nexport function registerCompressedTextures(url: string,\n resources: CompressedTextureResource[],\n metadata: IResourceMetadata): CompressedTexturesResult\n{\n const result: CompressedTexturesResult = {\n textures: {},\n texture: null,\n };\n\n if (!resources)\n {\n return result;\n }\n\n const textures = resources.map((resource) =>\n (\n new Texture(new BaseTexture(resource, Object.assign({\n mipmap: MIPMAP_MODES.OFF,\n alphaMode: ALPHA_MODES.NO_PREMULTIPLIED_ALPHA\n }, metadata)))\n ));\n\n textures.forEach((texture, i) =>\n {\n const { baseTexture } = texture;\n const cacheID = `${url}-${i + 1}`;\n\n BaseTexture.addToCache(baseTexture, cacheID);\n Texture.addToCache(texture, cacheID);\n\n if (i === 0)\n {\n BaseTexture.addToCache(baseTexture, url);\n Texture.addToCache(texture, url);\n result.texture = texture;\n }\n\n result.textures[cacheID] = texture;\n });\n\n return result;\n}\n","import { CompressedTextureResource } from '../resources';\nimport { INTERNAL_FORMATS, INTERNAL_FORMAT_TO_BYTES_PER_PIXEL } from '../const';\nimport { LoaderResource } from '@pixi/loaders';\nimport { registerCompressedTextures } from './registerCompressedTextures';\n\n// Set DDS files to be loaded as an ArrayBuffer\nLoaderResource.setExtensionXhrType('dds', LoaderResource.XHR_RESPONSE_TYPE.BUFFER);\n\nconst DDS_MAGIC_SIZE = 4;\nconst DDS_HEADER_SIZE = 124;\nconst DDS_HEADER_PF_SIZE = 32;\nconst DDS_HEADER_DX10_SIZE = 20;\n\n// DDS file format magic word\nconst DDS_MAGIC = 0x20534444;\n\n/**\n * DWORD offsets of the DDS file header fields (relative to file start).\n *\n * @ignore\n */\nconst DDS_FIELDS = {\n SIZE: 1,\n FLAGS: 2,\n HEIGHT: 3,\n WIDTH: 4,\n MIPMAP_COUNT: 7,\n PIXEL_FORMAT: 19,\n};\n\n/**\n * DWORD offsets of the DDS PIXEL_FORMAT fields.\n *\n * @ignore\n */\nconst DDS_PF_FIELDS = {\n SIZE: 0,\n FLAGS: 1,\n FOURCC: 2,\n RGB_BITCOUNT: 3,\n R_BIT_MASK: 4,\n G_BIT_MASK: 5,\n B_BIT_MASK: 6,\n A_BIT_MASK: 7\n};\n\n/**\n * DWORD offsets of the DDS_HEADER_DX10 fields.\n *\n * @ignore\n */\nconst DDS_DX10_FIELDS = {\n DXGI_FORMAT: 0,\n RESOURCE_DIMENSION: 1,\n MISC_FLAG: 2,\n ARRAY_SIZE: 3,\n MISC_FLAGS2: 4\n};\n\n/**\n * @see https://docs.microsoft.com/en-us/windows/win32/api/dxgiformat/ne-dxgiformat-dxgi_format\n * @ignore\n */\n// This is way over-blown for us! Lend us a hand, and remove the ones that aren't used (but set the remaining\n// ones to their correct value)\nenum DXGI_FORMAT {\n DXGI_FORMAT_UNKNOWN,\n DXGI_FORMAT_R32G32B32A32_TYPELESS,\n DXGI_FORMAT_R32G32B32A32_FLOAT,\n DXGI_FORMAT_R32G32B32A32_UINT,\n DXGI_FORMAT_R32G32B32A32_SINT,\n DXGI_FORMAT_R32G32B32_TYPELESS,\n DXGI_FORMAT_R32G32B32_FLOAT,\n DXGI_FORMAT_R32G32B32_UINT,\n DXGI_FORMAT_R32G32B32_SINT,\n DXGI_FORMAT_R16G16B16A16_TYPELESS,\n DXGI_FORMAT_R16G16B16A16_FLOAT,\n DXGI_FORMAT_R16G16B16A16_UNORM,\n DXGI_FORMAT_R16G16B16A16_UINT,\n DXGI_FORMAT_R16G16B16A16_SNORM,\n DXGI_FORMAT_R16G16B16A16_SINT,\n DXGI_FORMAT_R32G32_TYPELESS,\n DXGI_FORMAT_R32G32_FLOAT,\n DXGI_FORMAT_R32G32_UINT,\n DXGI_FORMAT_R32G32_SINT,\n DXGI_FORMAT_R32G8X24_TYPELESS,\n DXGI_FORMAT_D32_FLOAT_S8X24_UINT,\n DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,\n DXGI_FORMAT_X32_TYPELESS_G8X24_UINT,\n DXGI_FORMAT_R10G10B10A2_TYPELESS,\n DXGI_FORMAT_R10G10B10A2_UNORM,\n DXGI_FORMAT_R10G10B10A2_UINT,\n DXGI_FORMAT_R11G11B10_FLOAT,\n DXGI_FORMAT_R8G8B8A8_TYPELESS,\n DXGI_FORMAT_R8G8B8A8_UNORM,\n DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,\n DXGI_FORMAT_R8G8B8A8_UINT,\n DXGI_FORMAT_R8G8B8A8_SNORM,\n DXGI_FORMAT_R8G8B8A8_SINT,\n DXGI_FORMAT_R16G16_TYPELESS,\n DXGI_FORMAT_R16G16_FLOAT,\n DXGI_FORMAT_R16G16_UNORM,\n DXGI_FORMAT_R16G16_UINT,\n DXGI_FORMAT_R16G16_SNORM,\n DXGI_FORMAT_R16G16_SINT,\n DXGI_FORMAT_R32_TYPELESS,\n DXGI_FORMAT_D32_FLOAT,\n DXGI_FORMAT_R32_FLOAT,\n DXGI_FORMAT_R32_UINT,\n DXGI_FORMAT_R32_SINT,\n DXGI_FORMAT_R24G8_TYPELESS,\n DXGI_FORMAT_D24_UNORM_S8_UINT,\n DXGI_FORMAT_R24_UNORM_X8_TYPELESS,\n DXGI_FORMAT_X24_TYPELESS_G8_UINT,\n DXGI_FORMAT_R8G8_TYPELESS,\n DXGI_FORMAT_R8G8_UNORM,\n DXGI_FORMAT_R8G8_UINT,\n DXGI_FORMAT_R8G8_SNORM,\n DXGI_FORMAT_R8G8_SINT,\n DXGI_FORMAT_R16_TYPELESS,\n DXGI_FORMAT_R16_FLOAT,\n DXGI_FORMAT_D16_UNORM,\n DXGI_FORMAT_R16_UNORM,\n DXGI_FORMAT_R16_UINT,\n DXGI_FORMAT_R16_SNORM,\n DXGI_FORMAT_R16_SINT,\n DXGI_FORMAT_R8_TYPELESS,\n DXGI_FORMAT_R8_UNORM,\n DXGI_FORMAT_R8_UINT,\n DXGI_FORMAT_R8_SNORM,\n DXGI_FORMAT_R8_SINT,\n DXGI_FORMAT_A8_UNORM,\n DXGI_FORMAT_R1_UNORM,\n DXGI_FORMAT_R9G9B9E5_SHAREDEXP,\n DXGI_FORMAT_R8G8_B8G8_UNORM,\n DXGI_FORMAT_G8R8_G8B8_UNORM,\n DXGI_FORMAT_BC1_TYPELESS,\n DXGI_FORMAT_BC1_UNORM,\n DXGI_FORMAT_BC1_UNORM_SRGB,\n DXGI_FORMAT_BC2_TYPELESS,\n DXGI_FORMAT_BC2_UNORM,\n DXGI_FORMAT_BC2_UNORM_SRGB,\n DXGI_FORMAT_BC3_TYPELESS,\n DXGI_FORMAT_BC3_UNORM,\n DXGI_FORMAT_BC3_UNORM_SRGB,\n DXGI_FORMAT_BC4_TYPELESS,\n DXGI_FORMAT_BC4_UNORM,\n DXGI_FORMAT_BC4_SNORM,\n DXGI_FORMAT_BC5_TYPELESS,\n DXGI_FORMAT_BC5_UNORM,\n DXGI_FORMAT_BC5_SNORM,\n DXGI_FORMAT_B5G6R5_UNORM,\n DXGI_FORMAT_B5G5R5A1_UNORM,\n DXGI_FORMAT_B8G8R8A8_UNORM,\n DXGI_FORMAT_B8G8R8X8_UNORM,\n DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM,\n DXGI_FORMAT_B8G8R8A8_TYPELESS,\n DXGI_FORMAT_B8G8R8A8_UNORM_SRGB,\n DXGI_FORMAT_B8G8R8X8_TYPELESS,\n DXGI_FORMAT_B8G8R8X8_UNORM_SRGB,\n DXGI_FORMAT_BC6H_TYPELESS,\n DXGI_FORMAT_BC6H_UF16,\n DXGI_FORMAT_BC6H_SF16,\n DXGI_FORMAT_BC7_TYPELESS,\n DXGI_FORMAT_BC7_UNORM,\n DXGI_FORMAT_BC7_UNORM_SRGB,\n DXGI_FORMAT_AYUV,\n DXGI_FORMAT_Y410,\n DXGI_FORMAT_Y416,\n DXGI_FORMAT_NV12,\n DXGI_FORMAT_P010,\n DXGI_FORMAT_P016,\n DXGI_FORMAT_420_OPAQUE,\n DXGI_FORMAT_YUY2,\n DXGI_FORMAT_Y210,\n DXGI_FORMAT_Y216,\n DXGI_FORMAT_NV11,\n DXGI_FORMAT_AI44,\n DXGI_FORMAT_IA44,\n DXGI_FORMAT_P8,\n DXGI_FORMAT_A8P8,\n DXGI_FORMAT_B4G4R4A4_UNORM,\n DXGI_FORMAT_P208,\n DXGI_FORMAT_V208,\n DXGI_FORMAT_V408,\n DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE,\n DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE,\n DXGI_FORMAT_FORCE_UINT\n}\n\n/**\n * Possible values of the field {@link DDS_DX10_FIELDS.RESOURCE_DIMENSION}\n *\n * @ignore\n */\nenum D3D10_RESOURCE_DIMENSION {\n DDS_DIMENSION_TEXTURE1D = 2,\n DDS_DIMENSION_TEXTURE2D = 3,\n DDS_DIMENSION_TEXTURE3D = 6\n}\n\nconst PF_FLAGS = 1;\n\n// PIXEL_FORMAT flags\nconst DDPF_ALPHA = 0x2;\nconst DDPF_FOURCC = 0x4;\nconst DDPF_RGB = 0x40;\nconst DDPF_YUV = 0x200;\nconst DDPF_LUMINANCE = 0x20000;\n\n// Four character codes for DXTn formats\nconst FOURCC_DXT1 = 0x31545844;\nconst FOURCC_DXT3 = 0x33545844;\nconst FOURCC_DXT5 = 0x35545844;\nconst FOURCC_DX10 = 0x30315844;\n\n// Cubemap texture flag (for DDS_DX10_FIELDS.MISC_FLAG)\nconst DDS_RESOURCE_MISC_TEXTURECUBE = 0x4;\n\n/**\n * Maps `FOURCC_*` formats to internal formats (see {@link PIXI.INTERNAL_FORMATS}).\n *\n * @ignore\n */\nconst FOURCC_TO_FORMAT: { [id: number]: number } = {\n [FOURCC_DXT1]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,\n [FOURCC_DXT3]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,\n [FOURCC_DXT5]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT\n};\n\n/**\n * Maps {@link DXGI_FORMAT} to types/internal-formats (see {@link PIXI.TYPES}, {@link PIXI.INTERNAL_FORMATS})\n *\n * @ignore\n */\nconst DXGI_TO_FORMAT: { [id: number]: number } = {\n // WEBGL_compressed_texture_s3tc\n [DXGI_FORMAT.DXGI_FORMAT_BC1_TYPELESS]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,\n [DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT1_EXT,\n [DXGI_FORMAT.DXGI_FORMAT_BC2_TYPELESS]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,\n [DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT3_EXT,\n [DXGI_FORMAT.DXGI_FORMAT_BC3_TYPELESS]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,\n [DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM]: INTERNAL_FORMATS.COMPRESSED_RGBA_S3TC_DXT5_EXT,\n\n // WEBGL_compressed_texture_s3tc_srgb\n [DXGI_FORMAT.DXGI_FORMAT_BC1_UNORM_SRGB]: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,\n [DXGI_FORMAT.DXGI_FORMAT_BC2_UNORM_SRGB]: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,\n [DXGI_FORMAT.DXGI_FORMAT_BC3_UNORM_SRGB]: INTERNAL_FORMATS.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT\n};\n\n/**\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n * @see https://docs.microsoft.com/en-us/windows/win32/direct3ddds/dx-graphics-dds-pguide\n */\nexport class DDSLoader\n{\n /**\n * Registers a DDS compressed texture\n * @see PIXI.Loader.loaderMiddleware\n * @param resource - loader resource that is checked to see if it is a DDS file\n * @param next - callback Function to call when done\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n if (resource.extension === 'dds' && resource.data)\n {\n try\n {\n Object.assign(resource, registerCompressedTextures(\n resource.name || resource.url,\n DDSLoader.parse(resource.data),\n resource.metadata,\n ));\n }\n catch (err)\n {\n next(err);\n\n return;\n }\n }\n\n next();\n }\n\n /** Parses the DDS file header, generates base-textures, and puts them into the texture cache. */\n private static parse(arrayBuffer: ArrayBuffer): CompressedTextureResource[]\n {\n const data = new Uint32Array(arrayBuffer);\n const magicWord = data[0];\n\n if (magicWord !== DDS_MAGIC)\n {\n throw new Error('Invalid DDS file magic word');\n }\n\n const header = new Uint32Array(arrayBuffer, 0, DDS_HEADER_SIZE / Uint32Array.BYTES_PER_ELEMENT);\n\n // DDS header fields\n const height = header[DDS_FIELDS.HEIGHT];\n const width = header[DDS_FIELDS.WIDTH];\n const mipmapCount = header[DDS_FIELDS.MIPMAP_COUNT];\n\n // PIXEL_FORMAT fields\n const pixelFormat = new Uint32Array(\n arrayBuffer,\n DDS_FIELDS.PIXEL_FORMAT * Uint32Array.BYTES_PER_ELEMENT,\n DDS_HEADER_PF_SIZE / Uint32Array.BYTES_PER_ELEMENT);\n const formatFlags = pixelFormat[PF_FLAGS];\n\n // File contains compressed texture(s)\n if (formatFlags & DDPF_FOURCC)\n {\n const fourCC = pixelFormat[DDS_PF_FIELDS.FOURCC];\n\n // File contains one DXTn compressed texture\n if (fourCC !== FOURCC_DX10)\n {\n const internalFormat = FOURCC_TO_FORMAT[fourCC];\n\n const dataOffset = DDS_MAGIC_SIZE + DDS_HEADER_SIZE;\n const texData = new Uint8Array(arrayBuffer, dataOffset);\n\n const resource = new CompressedTextureResource(texData, {\n format: internalFormat,\n width,\n height,\n levels: mipmapCount // CompressedTextureResource will separate the levelBuffers for us!\n });\n\n return [resource];\n }\n\n // FOURCC_DX10 indicates there is a 20-byte DDS_HEADER_DX10 after DDS_HEADER\n const dx10Offset = DDS_MAGIC_SIZE + DDS_HEADER_SIZE;\n const dx10Header = new Uint32Array(\n data.buffer,\n dx10Offset,\n DDS_HEADER_DX10_SIZE / Uint32Array.BYTES_PER_ELEMENT);\n const dxgiFormat = dx10Header[DDS_DX10_FIELDS.DXGI_FORMAT];\n const resourceDimension = dx10Header[DDS_DX10_FIELDS.RESOURCE_DIMENSION];\n const miscFlag = dx10Header[DDS_DX10_FIELDS.MISC_FLAG];\n const arraySize = dx10Header[DDS_DX10_FIELDS.ARRAY_SIZE];\n\n // Map dxgiFormat to PIXI.INTERNAL_FORMATS\n const internalFormat = DXGI_TO_FORMAT[dxgiFormat];\n\n if (internalFormat === undefined)\n {\n throw new Error(`DDSLoader cannot parse texture data with DXGI format ${dxgiFormat}`);\n }\n if (miscFlag === DDS_RESOURCE_MISC_TEXTURECUBE)\n {\n // FIXME: Anybody excited about cubemap compressed textures?\n throw new Error('DDSLoader does not support cubemap textures');\n }\n if (resourceDimension === D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)\n {\n // FIXME: Anybody excited about 3D compressed textures?\n throw new Error('DDSLoader does not supported 3D texture data');\n }\n\n // Uint8Array buffers of image data, including all mipmap levels in each image\n const imageBuffers = new Array();\n const dataOffset = DDS_MAGIC_SIZE\n + DDS_HEADER_SIZE\n + DDS_HEADER_DX10_SIZE;\n\n if (arraySize === 1)\n {\n // No need bothering with the imageSize calculation!\n imageBuffers.push(new Uint8Array(arrayBuffer, dataOffset));\n }\n else\n {\n // Calculate imageSize for each texture, and then locate each image's texture data\n\n const pixelSize = INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[internalFormat];\n let imageSize = 0;\n let levelWidth = width;\n let levelHeight = height;\n\n for (let i = 0; i < mipmapCount; i++)\n {\n const alignedLevelWidth = Math.max(1, (levelWidth + 3) & ~3);\n const alignedLevelHeight = Math.max(1, (levelHeight + 3) & ~3);\n\n const levelSize = alignedLevelWidth * alignedLevelHeight * pixelSize;\n\n imageSize += levelSize;\n\n levelWidth = levelWidth >>> 1;\n levelHeight = levelHeight >>> 1;\n }\n\n let imageOffset = dataOffset;\n\n // NOTE: Cubemaps have 6-images per texture (but they aren't supported so ^_^)\n for (let i = 0; i < arraySize; i++)\n {\n imageBuffers.push(new Uint8Array(arrayBuffer, imageOffset, imageSize));\n imageOffset += imageSize;\n }\n }\n\n // Uint8Array -> CompressedTextureResource, and we're done!\n return imageBuffers.map((buffer) => new CompressedTextureResource(buffer, {\n format: internalFormat,\n width,\n height,\n levels: mipmapCount\n }));\n }\n if (formatFlags & DDPF_RGB)\n {\n // FIXME: We might want to allow uncompressed *.dds files?\n throw new Error('DDSLoader does not support uncompressed texture data.');\n }\n if (formatFlags & DDPF_YUV)\n {\n // FIXME: Does anybody need this feature?\n throw new Error('DDSLoader does not supported YUV uncompressed texture data.');\n }\n if (formatFlags & DDPF_LUMINANCE)\n {\n // FIXME: Microsoft says older DDS filers use this feature! Probably not worth the effort!\n throw new Error('DDSLoader does not support single-channel (lumninance) texture data!');\n }\n if (formatFlags & DDPF_ALPHA)\n {\n // FIXME: I'm tired! See above =)\n throw new Error('DDSLoader does not support single-channel (alpha) texture data!');\n }\n\n throw new Error('DDSLoader failed to load a texture file due to an unknown reason!');\n }\n}\n","import { TYPES, FORMATS } from '@pixi/constants';\nimport { INTERNAL_FORMAT_TO_BYTES_PER_PIXEL } from '../const';\nimport { CompressedTextureResource, CompressedLevelBuffer } from '../resources/CompressedTextureResource';\nimport { LoaderResource } from '@pixi/loaders';\nimport { registerCompressedTextures } from './registerCompressedTextures';\n\n// Set KTX files to be loaded as an ArrayBuffer\nLoaderResource.setExtensionXhrType('ktx', LoaderResource.XHR_RESPONSE_TYPE.BUFFER);\n\n/**\n * The 12-byte KTX file identifier\n *\n * @see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#2.1\n * @ignore\n */\nconst FILE_IDENTIFIER = [0xAB, 0x4B, 0x54, 0x58, 0x20, 0x31, 0x31, 0xBB, 0x0D, 0x0A, 0x1A, 0x0A];\n\n/**\n * The value stored in the \"endianness\" field.\n *\n * @see https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#2.2\n * @ignore\n */\nconst ENDIANNESS = 0x04030201;\n\n/**\n * Byte offsets of the KTX file header fields\n *\n * @ignore\n */\nconst KTX_FIELDS = {\n FILE_IDENTIFIER: 0,\n ENDIANNESS: 12,\n GL_TYPE: 16,\n GL_TYPE_SIZE: 20,\n GL_FORMAT: 24,\n GL_INTERNAL_FORMAT: 28,\n GL_BASE_INTERNAL_FORMAT: 32,\n PIXEL_WIDTH: 36,\n PIXEL_HEIGHT: 40,\n PIXEL_DEPTH: 44,\n NUMBER_OF_ARRAY_ELEMENTS: 48,\n NUMBER_OF_FACES: 52,\n NUMBER_OF_MIPMAP_LEVELS: 56,\n BYTES_OF_KEY_VALUE_DATA: 60\n};\n\n/**\n * Byte size of the file header fields in {@code KTX_FIELDS}\n *\n * @ignore\n */\nconst FILE_HEADER_SIZE = 64;\n\n/**\n * Maps {@link PIXI.TYPES} to the bytes taken per component, excluding those ones that are bit-fields.\n *\n * @ignore\n */\nexport const TYPES_TO_BYTES_PER_COMPONENT: { [id: number]: number } = {\n [TYPES.UNSIGNED_BYTE]: 1,\n [TYPES.UNSIGNED_SHORT]: 2,\n [TYPES.FLOAT]: 4,\n [TYPES.HALF_FLOAT]: 8\n};\n\n/**\n * Number of components in each {@link PIXI.FORMATS}\n *\n * @ignore\n */\nexport const FORMATS_TO_COMPONENTS: { [id: number]: number } = {\n [FORMATS.RGBA]: 4,\n [FORMATS.RGB]: 3,\n [FORMATS.LUMINANCE]: 1,\n [FORMATS.LUMINANCE_ALPHA]: 2,\n [FORMATS.ALPHA]: 1\n};\n\n/**\n * Number of bytes per pixel in bit-field types in {@link PIXI.TYPES}\n *\n * @ignore\n */\nexport const TYPES_TO_BYTES_PER_PIXEL: { [id: number]: number } = {\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: 2,\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: 2,\n [TYPES.UNSIGNED_SHORT_5_6_5]: 2\n};\n\n/**\n * Loader plugin for handling KTX texture container files.\n *\n * This KTX loader does not currently support the following features:\n * * cube textures\n * * 3D textures\n * * vendor-specific key/value data parsing\n * * endianness conversion for big-endian machines\n * * embedded *.basis files\n *\n * It does supports the following features:\n * * multiple textures per file\n * * mipmapping\n *\n * @class\n * @memberof PIXI\n * @implements PIXI.ILoaderPlugin\n */\nexport class KTXLoader\n{\n /**\n * Called after a KTX file is loaded.\n *\n * This will parse the KTX file header and add a {@code BaseTexture} to the texture\n * cache.\n *\n * @see PIXI.Loader.loaderMiddleware\n * @param resource - loader resource that is checked to see if it is a KTX file\n * @param next - callback Function to call when done\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n if (resource.extension === 'ktx' && resource.data)\n {\n try\n {\n const url = resource.name || resource.url;\n\n Object.assign(resource, registerCompressedTextures(\n url,\n KTXLoader.parse(url, resource.data),\n resource.metadata,\n ));\n }\n catch (err)\n {\n next(err);\n\n return;\n }\n }\n\n next();\n }\n\n /** Parses the KTX file header, generates base-textures, and puts them into the texture cache. */\n private static parse(url: string, arrayBuffer: ArrayBuffer): CompressedTextureResource[] | null\n {\n const dataView = new DataView(arrayBuffer);\n\n if (!KTXLoader.validate(url, dataView))\n {\n return null;\n }\n\n const littleEndian = dataView.getUint32(KTX_FIELDS.ENDIANNESS, true) === ENDIANNESS;\n const glType = dataView.getUint32(KTX_FIELDS.GL_TYPE, littleEndian);\n // const glTypeSize = dataView.getUint32(KTX_FIELDS.GL_TYPE_SIZE, littleEndian);\n const glFormat = dataView.getUint32(KTX_FIELDS.GL_FORMAT, littleEndian);\n const glInternalFormat = dataView.getUint32(KTX_FIELDS.GL_INTERNAL_FORMAT, littleEndian);\n const pixelWidth = dataView.getUint32(KTX_FIELDS.PIXEL_WIDTH, littleEndian);\n const pixelHeight = dataView.getUint32(KTX_FIELDS.PIXEL_HEIGHT, littleEndian) || 1;// \"pixelHeight = 0\" -> \"1\"\n const pixelDepth = dataView.getUint32(KTX_FIELDS.PIXEL_DEPTH, littleEndian) || 1;// ^^\n const numberOfArrayElements = dataView.getUint32(KTX_FIELDS.NUMBER_OF_ARRAY_ELEMENTS, littleEndian) || 1;// ^^\n const numberOfFaces = dataView.getUint32(KTX_FIELDS.NUMBER_OF_FACES, littleEndian);\n const numberOfMipmapLevels = dataView.getUint32(KTX_FIELDS.NUMBER_OF_MIPMAP_LEVELS, littleEndian);\n const bytesOfKeyValueData = dataView.getUint32(KTX_FIELDS.BYTES_OF_KEY_VALUE_DATA, littleEndian);\n\n // Whether the platform architecture is little endian. If littleEndian !== platformLittleEndian, then the\n // file contents must be endian-converted!\n // TODO: Endianness conversion\n // const platformLittleEndian = new Uint8Array((new Uint32Array([ENDIANNESS])).buffer)[0] === 0x01;\n\n if (pixelHeight === 0 || pixelDepth !== 1)\n {\n throw new Error('Only 2D textures are supported');\n }\n if (numberOfFaces !== 1)\n {\n throw new Error('CubeTextures are not supported by KTXLoader yet!');\n }\n if (numberOfArrayElements !== 1)\n {\n // TODO: Support splitting array-textures into multiple BaseTextures\n throw new Error('WebGL does not support array textures');\n }\n\n // TODO: 8x4 blocks for 2bpp pvrtc\n const blockWidth = 4;\n const blockHeight = 4;\n\n const alignedWidth = (pixelWidth + 3) & ~3;\n const alignedHeight = (pixelHeight + 3) & ~3;\n const imageBuffers = new Array(numberOfArrayElements);\n let imagePixels = pixelWidth * pixelHeight;\n\n if (glType === 0)\n {\n // Align to 16 pixels (4x4 blocks)\n imagePixels = alignedWidth * alignedHeight;\n }\n\n let imagePixelByteSize: number;\n\n if (glType !== 0)\n {\n // Uncompressed texture format\n if (TYPES_TO_BYTES_PER_COMPONENT[glType])\n {\n imagePixelByteSize = TYPES_TO_BYTES_PER_COMPONENT[glType] * FORMATS_TO_COMPONENTS[glFormat];\n }\n else\n {\n imagePixelByteSize = TYPES_TO_BYTES_PER_PIXEL[glType];\n }\n }\n else\n {\n imagePixelByteSize = INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[glInternalFormat];\n }\n\n if (imagePixelByteSize === undefined)\n {\n throw new Error('Unable to resolve the pixel format stored in the *.ktx file!');\n }\n\n const imageByteSize = imagePixels * imagePixelByteSize;\n let mipByteSize = imageByteSize;\n let mipWidth = pixelWidth;\n let mipHeight = pixelHeight;\n let alignedMipWidth = alignedWidth;\n let alignedMipHeight = alignedHeight;\n let imageOffset = FILE_HEADER_SIZE + bytesOfKeyValueData;\n\n for (let mipmapLevel = 0; mipmapLevel < numberOfMipmapLevels; mipmapLevel++)\n {\n const imageSize = dataView.getUint32(imageOffset, littleEndian);\n let elementOffset = imageOffset + 4;\n\n for (let arrayElement = 0; arrayElement < numberOfArrayElements; arrayElement++)\n {\n // TODO: Maybe support 3D textures? :-)\n // for (let zSlice = 0; zSlice < pixelDepth; zSlice)\n\n let mips = imageBuffers[arrayElement];\n\n if (!mips)\n {\n mips = imageBuffers[arrayElement] = new Array(numberOfMipmapLevels);\n }\n\n mips[mipmapLevel] = {\n levelID: mipmapLevel,\n levelWidth: numberOfMipmapLevels > 1 ? mipWidth : alignedMipWidth,\n levelHeight: numberOfMipmapLevels > 1 ? mipHeight : alignedMipHeight,\n levelBuffer: new Uint8Array(arrayBuffer, elementOffset, mipByteSize)\n };\n elementOffset += mipByteSize;\n }\n\n // HINT: Aligns to 4-byte boundary after jumping imageSize (in lieu of mipPadding)\n imageOffset += imageSize + 4;// (+4 to jump the imageSize field itself)\n imageOffset = imageOffset % 4 !== 0 ? imageOffset + 4 - (imageOffset % 4) : imageOffset;\n\n // Calculate mipWidth, mipHeight for _next_ iteration\n mipWidth = (mipWidth >> 1) || 1;\n mipHeight = (mipHeight >> 1) || 1;\n alignedMipWidth = (mipWidth + blockWidth - 1) & ~(blockWidth - 1);\n alignedMipHeight = (mipHeight + blockHeight - 1) & ~(blockHeight - 1);\n\n // Each mipmap level is 4-times smaller?\n mipByteSize = alignedMipWidth * alignedMipHeight * imagePixelByteSize;\n }\n\n // We use the levelBuffers feature of CompressedTextureResource b/c texture data is image-major, not level-major.\n if (glType !== 0)\n {\n throw new Error('TODO: Uncompressed');\n }\n\n return imageBuffers.map((levelBuffers) => new CompressedTextureResource(null, {\n format: glInternalFormat,\n width: pixelWidth,\n height: pixelHeight,\n levels: numberOfMipmapLevels,\n levelBuffers,\n }));\n }\n\n /** Checks whether the arrayBuffer contains a valid *.ktx file. */\n private static validate(url: string, dataView: DataView): boolean\n {\n // NOTE: Do not optimize this into 3 32-bit integer comparison because the endianness\n // of the data is not specified.\n for (let i = 0; i < FILE_IDENTIFIER.length; i++)\n {\n if (dataView.getUint8(i) !== FILE_IDENTIFIER[i])\n {\n // #if _DEBUG\n console.error(`${url} is not a valid *.ktx file!`);\n // #endif\n\n return false;\n }\n }\n\n return true;\n }\n}\n","import { ParticleContainer } from '@pixi/particle-container';\nimport type { Sprite } from '@pixi/sprite';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.ParticleContainer#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer\n */\nParticleContainer.prototype.renderCanvas = function renderCanvas(renderer: CanvasRenderer): void\n{\n if (!this.visible || this.worldAlpha <= 0 || !this.children.length || !this.renderable)\n {\n return;\n }\n\n const context = renderer.context;\n const transform = this.worldTransform;\n let isRotated = true;\n\n let positionX = 0;\n let positionY = 0;\n\n let finalWidth = 0;\n let finalHeight = 0;\n\n renderer.setBlendMode(this.blendMode);\n\n context.globalAlpha = this.worldAlpha;\n\n this.displayObjectUpdateTransform();\n\n for (let i = 0; i < this.children.length; ++i)\n {\n const child = this.children[i] as Sprite;\n\n if (!child.visible)\n {\n continue;\n }\n\n if (!child._texture.valid)\n {\n continue;\n }\n\n const frame = child._texture.frame;\n\n context.globalAlpha = this.worldAlpha * child.alpha;\n\n if (child.rotation % (Math.PI * 2) === 0)\n {\n // this is the fastest way to optimise! - if rotation is 0 then we can avoid any kind of setTransform call\n if (isRotated)\n {\n renderer.setContextTransform(transform, false, 1);\n isRotated = false;\n }\n\n positionX = ((child.anchor.x) * (-frame.width * child.scale.x)) + child.position.x + 0.5;\n positionY = ((child.anchor.y) * (-frame.height * child.scale.y)) + child.position.y + 0.5;\n\n finalWidth = frame.width * child.scale.x;\n finalHeight = frame.height * child.scale.y;\n }\n else\n {\n if (!isRotated)\n {\n isRotated = true;\n }\n\n child.displayObjectUpdateTransform();\n\n const childTransform = child.worldTransform;\n\n renderer.setContextTransform(childTransform, this.roundPixels, 1);\n\n positionX = ((child.anchor.x) * (-frame.width)) + 0.5;\n positionY = ((child.anchor.y) * (-frame.height)) + 0.5;\n\n finalWidth = frame.width;\n finalHeight = frame.height;\n }\n\n const resolution = child._texture.baseTexture.resolution;\n\n context.drawImage(\n child._texture.baseTexture.getDrawableSource(),\n frame.x * resolution,\n frame.y * resolution,\n frame.width * resolution,\n frame.height * resolution,\n positionX * renderer.resolution,\n positionY * renderer.resolution,\n finalWidth * renderer.resolution,\n finalHeight * renderer.resolution\n );\n }\n};\n","import { createIndicesForQuads } from '@pixi/utils';\nimport { Geometry, Buffer } from '@pixi/core';\nimport { TYPES } from '@pixi/constants';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { IParticleRendererProperty } from './ParticleRenderer';\n\n/*\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that\n * they now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleBuffer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleBuffer.java\n */\n\n/**\n * The particle buffer manages the static and dynamic buffers for a particle container.\n *\n * @class\n * @private\n * @memberof PIXI\n */\nexport class ParticleBuffer\n{\n public geometry: Geometry;\n public staticStride: number;\n public staticBuffer: Buffer;\n public staticData: Float32Array;\n public staticDataUint32: Uint32Array;\n public dynamicStride: number;\n public dynamicBuffer: Buffer;\n public dynamicData: Float32Array;\n public dynamicDataUint32: Uint32Array;\n public _updateID: number;\n\n indexBuffer: Buffer;\n private size: number;\n private dynamicProperties: IParticleRendererProperty[];\n private staticProperties: IParticleRendererProperty[];\n\n /**\n * @private\n * @param {object} properties - The properties to upload.\n * @param {boolean[]} dynamicPropertyFlags - Flags for which properties are dynamic.\n * @param {number} size - The size of the batch.\n */\n constructor(properties: IParticleRendererProperty[], dynamicPropertyFlags: boolean[], size: number)\n {\n this.geometry = new Geometry();\n\n this.indexBuffer = null;\n\n /**\n * The number of particles the buffer can hold\n *\n * @private\n * @member {number}\n */\n this.size = size;\n\n /**\n * A list of the properties that are dynamic.\n *\n * @private\n * @member {object[]}\n */\n this.dynamicProperties = [];\n\n /**\n * A list of the properties that are static.\n *\n * @private\n * @member {object[]}\n */\n this.staticProperties = [];\n\n for (let i = 0; i < properties.length; ++i)\n {\n let property = properties[i];\n\n // Make copy of properties object so that when we edit the offset it doesn't\n // change all other instances of the object literal\n property = {\n attributeName: property.attributeName,\n size: property.size,\n uploadFunction: property.uploadFunction,\n type: property.type || TYPES.FLOAT,\n offset: property.offset,\n };\n\n if (dynamicPropertyFlags[i])\n {\n this.dynamicProperties.push(property);\n }\n else\n {\n this.staticProperties.push(property);\n }\n }\n\n this.staticStride = 0;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n\n this.dynamicStride = 0;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this._updateID = 0;\n\n this.initBuffers();\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n *\n * @private\n */\n private initBuffers(): void\n {\n const geometry = this.geometry;\n\n let dynamicOffset = 0;\n\n /**\n * Holds the indices of the geometry (quads) to draw\n *\n * @member {Uint16Array}\n * @private\n */\n this.indexBuffer = new Buffer(createIndicesForQuads(this.size), true, true);\n geometry.addIndex(this.indexBuffer);\n\n this.dynamicStride = 0;\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n property.offset = dynamicOffset;\n dynamicOffset += property.size;\n this.dynamicStride += property.size;\n }\n\n const dynBuffer = new ArrayBuffer(this.size * this.dynamicStride * 4 * 4);\n\n this.dynamicData = new Float32Array(dynBuffer);\n this.dynamicDataUint32 = new Uint32Array(dynBuffer);\n this.dynamicBuffer = new Buffer(this.dynamicData, false, false);\n\n // static //\n let staticOffset = 0;\n\n this.staticStride = 0;\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n property.offset = staticOffset;\n staticOffset += property.size;\n this.staticStride += property.size;\n }\n\n const statBuffer = new ArrayBuffer(this.size * this.staticStride * 4 * 4);\n\n this.staticData = new Float32Array(statBuffer);\n this.staticDataUint32 = new Uint32Array(statBuffer);\n this.staticBuffer = new Buffer(this.staticData, true, false);\n\n for (let i = 0; i < this.dynamicProperties.length; ++i)\n {\n const property = this.dynamicProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.dynamicBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.dynamicStride * 4,\n property.offset * 4\n );\n }\n\n for (let i = 0; i < this.staticProperties.length; ++i)\n {\n const property = this.staticProperties[i];\n\n geometry.addAttribute(\n property.attributeName,\n this.staticBuffer,\n 0,\n property.type === TYPES.UNSIGNED_BYTE,\n property.type,\n this.staticStride * 4,\n property.offset * 4\n );\n }\n }\n\n /**\n * Uploads the dynamic properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadDynamic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.dynamicProperties.length; i++)\n {\n const property = this.dynamicProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.dynamicDataUint32 : this.dynamicData,\n this.dynamicStride, property.offset);\n }\n\n this.dynamicBuffer._updateID++;\n }\n\n /**\n * Uploads the static properties.\n *\n * @private\n * @param {PIXI.DisplayObject[]} children - The children to upload.\n * @param {number} startIndex - The index to start at.\n * @param {number} amount - The number to upload.\n */\n uploadStatic(children: DisplayObject[], startIndex: number, amount: number): void\n {\n for (let i = 0; i < this.staticProperties.length; i++)\n {\n const property = this.staticProperties[i];\n\n property.uploadFunction(children, startIndex, amount,\n property.type === TYPES.UNSIGNED_BYTE ? this.staticDataUint32 : this.staticData,\n this.staticStride, property.offset);\n }\n\n this.staticBuffer._updateID++;\n }\n\n /**\n * Destroys the ParticleBuffer.\n *\n * @private\n */\n destroy(): void\n {\n this.indexBuffer = null;\n\n this.dynamicProperties = null;\n this.dynamicBuffer = null;\n this.dynamicData = null;\n this.dynamicDataUint32 = null;\n\n this.staticProperties = null;\n this.staticBuffer = null;\n this.staticData = null;\n this.staticDataUint32 = null;\n // all buffers are destroyed inside geometry\n this.geometry.destroy();\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { ObjectRenderer, Shader, State } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { correctBlendMode, premultiplyRgba, premultiplyTint } from '@pixi/utils';\nimport { ParticleBuffer } from './ParticleBuffer';\nimport fragment from './particles.frag';\nimport vertex from './particles.vert';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type { ParticleContainer } from './ParticleContainer';\nimport type { Renderer } from '@pixi/core';\n\nexport interface IParticleRendererProperty {\n attributeName: string;\n size: number;\n type?: TYPES;\n uploadFunction: (...params: any[]) => any;\n offset: number;\n}\n\n/*\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's ParticleRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/ParticleRenderer.java\n */\n\n/**\n * Renderer for Particles that is designer for speed over feature set.\n *\n * @class\n * @memberof PIXI\n */\nexport class ParticleRenderer extends ObjectRenderer\n{\n public readonly state: State;\n public shader: Shader;\n public tempMatrix: Matrix;\n public properties: IParticleRendererProperty[];\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this sprite batch works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // 65535 is max vertex index in the index buffer (see ParticleRenderer)\n // so max number of particles is 65536 / 4 = 16384\n // and max number of element in the index buffer is 16384 * 6 = 98304\n // Creating a full index buffer, overhead is 98304 * 2 = 196Ko\n // let numIndices = 98304;\n\n /**\n * The default shader that is used if a sprite doesn't have a more specific one.\n *\n * @member {PIXI.Shader}\n */\n this.shader = null;\n\n this.properties = null;\n\n this.tempMatrix = new Matrix();\n\n this.properties = [\n // verticesData\n {\n attributeName: 'aVertexPosition',\n size: 2,\n uploadFunction: this.uploadVertices,\n offset: 0,\n },\n // positionData\n {\n attributeName: 'aPositionCoord',\n size: 2,\n uploadFunction: this.uploadPosition,\n offset: 0,\n },\n // rotationData\n {\n attributeName: 'aRotation',\n size: 1,\n uploadFunction: this.uploadRotation,\n offset: 0,\n },\n // uvsData\n {\n attributeName: 'aTextureCoord',\n size: 2,\n uploadFunction: this.uploadUvs,\n offset: 0,\n },\n // tintData\n {\n attributeName: 'aColor',\n size: 1,\n type: TYPES.UNSIGNED_BYTE,\n uploadFunction: this.uploadTint,\n offset: 0,\n },\n ];\n\n this.shader = Shader.from(vertex, fragment, {});\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n * Renders the particle container object.\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n */\n public render(container: ParticleContainer): void\n {\n const children = container.children;\n const maxSize = container._maxSize;\n const batchSize = container._batchSize;\n const renderer = this.renderer;\n let totalChildren = children.length;\n\n if (totalChildren === 0)\n {\n return;\n }\n else if (totalChildren > maxSize && !container.autoResize)\n {\n totalChildren = maxSize;\n }\n\n let buffers = container._buffers;\n\n if (!buffers)\n {\n buffers = container._buffers = this.generateBuffers(container);\n }\n\n const baseTexture = (children[0] as any)._texture.baseTexture;\n\n // if the uvs have not updated then no point rendering just yet!\n this.state.blendMode = correctBlendMode(container.blendMode, baseTexture.alphaMode);\n renderer.state.set(this.state);\n\n const gl = renderer.gl;\n\n const m = container.worldTransform.copyTo(this.tempMatrix);\n\n m.prepend(renderer.globalUniforms.uniforms.projectionMatrix);\n\n this.shader.uniforms.translationMatrix = m.toArray(true);\n\n this.shader.uniforms.uColor = premultiplyRgba(container.tintRgb,\n container.worldAlpha, this.shader.uniforms.uColor, baseTexture.alphaMode);\n\n this.shader.uniforms.uSampler = baseTexture;\n\n this.renderer.shader.bind(this.shader);\n\n let updateStatic = false;\n\n // now lets upload and render the buffers..\n for (let i = 0, j = 0; i < totalChildren; i += batchSize, j += 1)\n {\n let amount = (totalChildren - i);\n\n if (amount > batchSize)\n {\n amount = batchSize;\n }\n\n if (j >= buffers.length)\n {\n buffers.push(this._generateOneMoreBuffer(container));\n }\n\n const buffer = buffers[j];\n\n // we always upload the dynamic\n buffer.uploadDynamic(children, i, amount);\n\n const bid = container._bufferUpdateIDs[j] || 0;\n\n updateStatic = updateStatic || (buffer._updateID < bid);\n // we only upload the static content when we have to!\n if (updateStatic)\n {\n buffer._updateID = container._updateID;\n buffer.uploadStatic(children, i, amount);\n }\n\n // bind the buffer\n renderer.geometry.bind(buffer.geometry);\n gl.drawElements(gl.TRIANGLES, amount * 6, gl.UNSIGNED_SHORT, 0);\n }\n }\n\n /**\n * Creates one particle buffer for each child in the container we want to render and updates internal properties\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer[]} The buffers\n * @private\n */\n private generateBuffers(container: ParticleContainer): ParticleBuffer[]\n {\n const buffers = [];\n const size = container._maxSize;\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n for (let i = 0; i < size; i += batchSize)\n {\n buffers.push(new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize));\n }\n\n return buffers;\n }\n\n /**\n * Creates one more particle buffer, because container has autoResize feature\n *\n * @param {PIXI.ParticleContainer} container - The container to render using this ParticleRenderer\n * @return {PIXI.ParticleBuffer} generated buffer\n * @private\n */\n private _generateOneMoreBuffer(container: ParticleContainer): ParticleBuffer\n {\n const batchSize = container._batchSize;\n const dynamicPropertyFlags = container._properties;\n\n return new ParticleBuffer(this.properties, dynamicPropertyFlags, batchSize);\n }\n\n /**\n * Uploads the vertices.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their vertices uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadVertices(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const texture = sprite._texture;\n const sx = sprite.scale.x;\n const sy = sprite.scale.y;\n const trim = texture.trim;\n const orig = texture.orig;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the\n // extra space before transforming the sprite coords..\n w1 = trim.x - (sprite.anchor.x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (sprite.anchor.y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w0 = (orig.width) * (1 - sprite.anchor.x);\n w1 = (orig.width) * -sprite.anchor.x;\n\n h0 = orig.height * (1 - sprite.anchor.y);\n h1 = orig.height * -sprite.anchor.y;\n }\n\n array[offset] = w1 * sx;\n array[offset + 1] = h1 * sy;\n\n array[offset + stride] = w0 * sx;\n array[offset + stride + 1] = h1 * sy;\n\n array[offset + (stride * 2)] = w0 * sx;\n array[offset + (stride * 2) + 1] = h0 * sy;\n\n array[offset + (stride * 3)] = w1 * sx;\n array[offset + (stride * 3) + 1] = h0 * sy;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the position.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their positions uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadPosition(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spritePosition = children[startIndex + i].position;\n\n array[offset] = spritePosition.x;\n array[offset + 1] = spritePosition.y;\n\n array[offset + stride] = spritePosition.x;\n array[offset + stride + 1] = spritePosition.y;\n\n array[offset + (stride * 2)] = spritePosition.x;\n array[offset + (stride * 2) + 1] = spritePosition.y;\n\n array[offset + (stride * 3)] = spritePosition.x;\n array[offset + (stride * 3) + 1] = spritePosition.y;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the rotation.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadRotation(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; i++)\n {\n const spriteRotation = children[startIndex + i].rotation;\n\n array[offset] = spriteRotation;\n array[offset + stride] = spriteRotation;\n array[offset + (stride * 2)] = spriteRotation;\n array[offset + (stride * 3)] = spriteRotation;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Uploads the Uvs\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadUvs(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const textureUvs = (children[startIndex + i] as any)._texture._uvs;\n\n if (textureUvs)\n {\n array[offset] = textureUvs.x0;\n array[offset + 1] = textureUvs.y0;\n\n array[offset + stride] = textureUvs.x1;\n array[offset + stride + 1] = textureUvs.y1;\n\n array[offset + (stride * 2)] = textureUvs.x2;\n array[offset + (stride * 2) + 1] = textureUvs.y2;\n\n array[offset + (stride * 3)] = textureUvs.x3;\n array[offset + (stride * 3) + 1] = textureUvs.y3;\n\n offset += stride * 4;\n }\n else\n {\n // TODO you know this can be easier!\n array[offset] = 0;\n array[offset + 1] = 0;\n\n array[offset + stride] = 0;\n array[offset + stride + 1] = 0;\n\n array[offset + (stride * 2)] = 0;\n array[offset + (stride * 2) + 1] = 0;\n\n array[offset + (stride * 3)] = 0;\n array[offset + (stride * 3) + 1] = 0;\n\n offset += stride * 4;\n }\n }\n }\n\n /**\n * Uploads the tint.\n *\n * @param {PIXI.DisplayObject[]} children - the array of display objects to render\n * @param {number} startIndex - the index to start from in the children array\n * @param {number} amount - the amount of children that will have their rotation uploaded\n * @param {number[]} array - The vertices to upload.\n * @param {number} stride - Stride to use for iteration.\n * @param {number} offset - Offset to start at.\n */\n public uploadTint(\n children: DisplayObject[], startIndex: number, amount: number,\n array: number[], stride: number, offset: number\n ): void\n {\n for (let i = 0; i < amount; ++i)\n {\n const sprite: any = children[startIndex + i];\n const premultiplied = sprite._texture.baseTexture.alphaMode > 0;\n const alpha = sprite.alpha;\n\n // we dont call extra function if alpha is 1.0, that's faster\n const argb = alpha < 1.0 && premultiplied\n ? premultiplyTint(sprite._tintRGB, alpha) : sprite._tintRGB + (alpha * 255 << 24);\n\n array[offset] = argb;\n array[offset + stride] = argb;\n array[offset + (stride * 2)] = argb;\n array[offset + (stride * 3)] = argb;\n\n offset += stride * 4;\n }\n }\n\n /**\n * Destroys the ParticleRenderer.\n */\n public destroy(): void\n {\n super.destroy();\n\n if (this.shader)\n {\n this.shader.destroy();\n this.shader = null;\n }\n\n this.tempMatrix = null;\n }\n}\n","// disabling eslint for now, going to rewrite this in v5\n/* eslint-disable */\n\nimport { TEXT_GRADIENT } from './const';\nimport { hex2string } from '@pixi/utils';\n\nexport type TextStyleAlign = 'left'|'center'|'right'|'justify';\nexport type TextStyleFill = string|string[]|number|number[]|CanvasGradient|CanvasPattern;\nexport type TextStyleFontStyle = 'normal'|'italic'|'oblique';\nexport type TextStyleFontVariant = 'normal'|'small-caps';\nexport type TextStyleFontWeight = 'normal'|'bold'|'bolder'|'lighter'|'100'|'200'|'300'|'400'|'500'|'600'|'700'|'800'|'900';\nexport type TextStyleLineJoin = 'miter'|'round'|'bevel';\nexport type TextStyleTextBaseline = 'alphabetic'|'top'|'hanging'|'middle'|'ideographic'|'bottom';\nexport type TextStyleWhiteSpace = 'normal'|'pre'|'pre-line';\n\nexport interface ITextStyle {\n align: TextStyleAlign;\n breakWords: boolean;\n dropShadow: boolean;\n dropShadowAlpha: number;\n dropShadowAngle: number;\n dropShadowBlur: number;\n dropShadowColor: string|number;\n dropShadowDistance: number;\n fill: TextStyleFill;\n fillGradientType: TEXT_GRADIENT;\n fillGradientStops: number[];\n fontFamily: string | string[];\n fontSize: number | string;\n fontStyle: TextStyleFontStyle;\n fontVariant: TextStyleFontVariant;\n fontWeight: TextStyleFontWeight;\n letterSpacing: number;\n lineHeight: number;\n lineJoin: TextStyleLineJoin;\n miterLimit: number;\n padding: number;\n stroke: string|number;\n strokeThickness: number;\n textBaseline: TextStyleTextBaseline;\n trim: boolean;\n whiteSpace: TextStyleWhiteSpace;\n wordWrap: boolean;\n wordWrapWidth: number;\n leading: number;\n}\n\nconst defaultStyle: ITextStyle = {\n align: 'left',\n breakWords: false,\n dropShadow: false,\n dropShadowAlpha: 1,\n dropShadowAngle: Math.PI / 6,\n dropShadowBlur: 0,\n dropShadowColor: 'black',\n dropShadowDistance: 5,\n fill: 'black',\n fillGradientType: TEXT_GRADIENT.LINEAR_VERTICAL,\n fillGradientStops: [],\n fontFamily: 'Arial',\n fontSize: 26,\n fontStyle: 'normal',\n fontVariant: 'normal',\n fontWeight: 'normal',\n letterSpacing: 0,\n lineHeight: 0,\n lineJoin: 'miter',\n miterLimit: 10,\n padding: 0,\n stroke: 'black',\n strokeThickness: 0,\n textBaseline: 'alphabetic',\n trim: false,\n whiteSpace: 'pre',\n wordWrap: false,\n wordWrapWidth: 100,\n leading: 0,\n};\n\nconst genericFontFamilies = [\n 'serif',\n 'sans-serif',\n 'monospace',\n 'cursive',\n 'fantasy',\n 'system-ui',\n];\n\n/**\n * A TextStyle Object contains information to decorate a Text objects.\n *\n * An instance can be shared between multiple Text objects; then changing the style will update all text objects using it.\n *\n * A tool can be used to generate a text style [here](https://pixijs.io/pixi-text-style).\n *\n * @memberof PIXI\n */\nexport class TextStyle implements ITextStyle\n{\n public styleID: number;\n\n protected _align: TextStyleAlign;\n protected _breakWords: boolean;\n protected _dropShadow: boolean;\n protected _dropShadowAlpha: number;\n protected _dropShadowAngle: number;\n protected _dropShadowBlur: number;\n protected _dropShadowColor: string|number;\n protected _dropShadowDistance: number;\n protected _fill: TextStyleFill;\n protected _fillGradientType: TEXT_GRADIENT;\n protected _fillGradientStops: number[];\n protected _fontFamily: string|string[];\n protected _fontSize: number|string;\n protected _fontStyle: TextStyleFontStyle;\n protected _fontVariant: TextStyleFontVariant;\n protected _fontWeight: TextStyleFontWeight;\n protected _letterSpacing: number;\n protected _lineHeight: number;\n protected _lineJoin: TextStyleLineJoin;\n protected _miterLimit: number;\n protected _padding: number;\n protected _stroke: string|number;\n protected _strokeThickness: number;\n protected _textBaseline: TextStyleTextBaseline;\n protected _trim: boolean;\n protected _whiteSpace: TextStyleWhiteSpace;\n protected _wordWrap: boolean;\n protected _wordWrapWidth: number;\n protected _leading: number;\n\n /**\n * @param {object} [style] - The style parameters\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center' or 'right'),\n * does not affect single line text\n * @param {boolean} [style.breakWords=false] - Indicates if lines can be wrapped within words, it\n * needs wordWrap to be set to true\n * @param {boolean} [style.dropShadow=false] - Set a drop shadow for the text\n * @param {number} [style.dropShadowAlpha=1] - Set alpha for the drop shadow\n * @param {number} [style.dropShadowAngle=Math.PI/6] - Set a angle of the drop shadow\n * @param {number} [style.dropShadowBlur=0] - Set a shadow blur radius\n * @param {string|number} [style.dropShadowColor='black'] - A fill style to be used on the dropshadow e.g 'red', '#00FF00'\n * @param {number} [style.dropShadowDistance=5] - Set a distance of the drop shadow\n * @param {string|string[]|number|number[]|CanvasGradient|CanvasPattern} [style.fill='black'] - A canvas\n * fillstyle that will be used on the text e.g 'red', '#00FF00'. Can be an array to create a gradient\n * eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n * @param {number} [style.fillGradientType=PIXI.TEXT_GRADIENT.LINEAR_VERTICAL] - If fill is an array of colours\n * to create a gradient, this can change the type/direction of the gradient. See {@link PIXI.TEXT_GRADIENT}\n * @param {number[]} [style.fillGradientStops] - If fill is an array of colours to create a gradient, this array can set\n * the stop points (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n * @param {string|string[]} [style.fontFamily='Arial'] - The font family\n * @param {number|string} [style.fontSize=26] - The font size (as a number it converts to px, but as a string,\n * equivalents are '26px','20pt','160%' or '1.6em')\n * @param {string} [style.fontStyle='normal'] - The font style ('normal', 'italic' or 'oblique')\n * @param {string} [style.fontVariant='normal'] - The font variant ('normal' or 'small-caps')\n * @param {string} [style.fontWeight='normal'] - The font weight ('normal', 'bold', 'bolder', 'lighter' and '100',\n * '200', '300', '400', '500', '600', '700', '800' or '900')\n * @param {number} [style.leading=0] - The space between lines\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters, default is 0\n * @param {number} [style.lineHeight] - The line height, a number that represents the vertical space that a letter uses\n * @param {string} [style.lineJoin='miter'] - The lineJoin property sets the type of corner created, it can resolve\n * spiked text issues. Possible values \"miter\" (creates a sharp corner), \"round\" (creates a round corner) or \"bevel\"\n * (creates a squared corner).\n * @param {number} [style.miterLimit=10] - The miter limit to use when using the 'miter' lineJoin mode. This can reduce\n * or increase the spikiness of rendered text.\n * @param {number} [style.padding=0] - Occasionally some fonts are cropped. Adding some padding will prevent this from\n * happening by adding padding to all sides of the text.\n * @param {string|number} [style.stroke='black'] - A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n * @param {number} [style.strokeThickness=0] - A number that represents the thickness of the stroke.\n * Default is 0 (no stroke)\n * @param {boolean} [style.trim=false] - Trim transparent borders\n * @param {string} [style.textBaseline='alphabetic'] - The baseline of the text that is rendered.\n * @param {string} [style.whiteSpace='pre'] - Determines whether newlines & spaces are collapsed or preserved \"normal\"\n * (collapse, collapse), \"pre\" (preserve, preserve) | \"pre-line\" (preserve, collapse). It needs wordWrap to be set to true\n * @param {boolean} [style.wordWrap=false] - Indicates if word wrap should be used\n * @param {number} [style.wordWrapWidth=100] - The width at which text will wrap, it needs wordWrap to be set to true\n */\n constructor(style?: Partial)\n {\n this.styleID = 0;\n\n this.reset();\n\n deepCopyProperties(this, style, style);\n }\n\n /**\n * Creates a new TextStyle object with the same values as this one.\n * Note that the only the properties of the object are cloned.\n *\n * @return New cloned TextStyle object\n */\n public clone(): TextStyle\n {\n const clonedProperties: Partial = {};\n\n deepCopyProperties(clonedProperties, this, defaultStyle);\n\n return new TextStyle(clonedProperties);\n }\n\n /** Resets all properties to the defaults specified in TextStyle.prototype._default */\n public reset(): void\n {\n deepCopyProperties(this, defaultStyle, defaultStyle);\n }\n\n /**\n * Alignment for multiline text ('left', 'center' or 'right'), does not affect single line text\n *\n * @member {string}\n */\n get align(): TextStyleAlign\n {\n return this._align;\n }\n set align(align: TextStyleAlign)\n {\n if (this._align !== align)\n {\n this._align = align;\n this.styleID++;\n }\n }\n\n /** Indicates if lines can be wrapped within words, it needs wordWrap to be set to true. */\n get breakWords(): boolean\n {\n return this._breakWords;\n }\n set breakWords(breakWords: boolean)\n {\n if (this._breakWords !== breakWords)\n {\n this._breakWords = breakWords;\n this.styleID++;\n }\n }\n\n /** Set a drop shadow for the text. */\n get dropShadow(): boolean\n {\n return this._dropShadow;\n }\n set dropShadow(dropShadow: boolean)\n {\n if (this._dropShadow !== dropShadow)\n {\n this._dropShadow = dropShadow;\n this.styleID++;\n }\n }\n\n /** Set alpha for the drop shadow. */\n get dropShadowAlpha(): number\n {\n return this._dropShadowAlpha;\n }\n set dropShadowAlpha(dropShadowAlpha: number)\n {\n if (this._dropShadowAlpha !== dropShadowAlpha)\n {\n this._dropShadowAlpha = dropShadowAlpha;\n this.styleID++;\n }\n }\n\n /** Set a angle of the drop shadow. */\n get dropShadowAngle(): number\n {\n return this._dropShadowAngle;\n }\n set dropShadowAngle(dropShadowAngle: number)\n {\n if (this._dropShadowAngle !== dropShadowAngle)\n {\n this._dropShadowAngle = dropShadowAngle;\n this.styleID++;\n }\n }\n\n /** Set a shadow blur radius. */\n get dropShadowBlur(): number\n {\n return this._dropShadowBlur;\n }\n set dropShadowBlur(dropShadowBlur: number)\n {\n if (this._dropShadowBlur !== dropShadowBlur)\n {\n this._dropShadowBlur = dropShadowBlur;\n this.styleID++;\n }\n }\n\n /** A fill style to be used on the dropshadow e.g 'red', '#00FF00'. */\n get dropShadowColor(): number | string\n {\n return this._dropShadowColor;\n }\n set dropShadowColor(dropShadowColor: number | string)\n {\n const outputColor = getColor(dropShadowColor);\n if (this._dropShadowColor !== outputColor)\n {\n this._dropShadowColor = outputColor;\n this.styleID++;\n }\n }\n\n /** Set a distance of the drop shadow. */\n get dropShadowDistance(): number\n {\n return this._dropShadowDistance;\n }\n set dropShadowDistance(dropShadowDistance: number)\n {\n if (this._dropShadowDistance !== dropShadowDistance)\n {\n this._dropShadowDistance = dropShadowDistance;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text e.g 'red', '#00FF00'.\n *\n * Can be an array to create a gradient eg ['#000000','#FFFFFF']\n * {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle|MDN}\n *\n * @member {string|string[]|number|number[]|CanvasGradient|CanvasPattern}\n */\n get fill(): TextStyleFill\n {\n return this._fill;\n }\n set fill(fill: TextStyleFill)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n // TODO: Not sure if getColor works properly with CanvasGradient and/or CanvasPattern, can't pass in\n // without casting here.\n const outputColor = getColor(fill as any);\n if (this._fill !== outputColor)\n {\n this._fill = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this can change the type/direction of the gradient.\n *\n * @see PIXI.TEXT_GRADIENT\n */\n get fillGradientType(): TEXT_GRADIENT\n {\n return this._fillGradientType;\n }\n set fillGradientType(fillGradientType: TEXT_GRADIENT)\n {\n if (this._fillGradientType !== fillGradientType)\n {\n this._fillGradientType = fillGradientType;\n this.styleID++;\n }\n }\n\n /**\n * If fill is an array of colours to create a gradient, this array can set the stop points\n * (numbers between 0 and 1) for the color, overriding the default behaviour of evenly spacing them.\n */\n get fillGradientStops(): number[]\n {\n return this._fillGradientStops;\n }\n set fillGradientStops(fillGradientStops: number[])\n {\n if (!areArraysEqual(this._fillGradientStops,fillGradientStops))\n {\n this._fillGradientStops = fillGradientStops;\n this.styleID++;\n }\n }\n\n /** The font family. */\n get fontFamily(): string | string[]\n {\n return this._fontFamily;\n }\n set fontFamily(fontFamily: string | string[])\n {\n if (this.fontFamily !== fontFamily)\n {\n this._fontFamily = fontFamily;\n this.styleID++;\n }\n }\n\n /**\n * The font size\n * (as a number it converts to px, but as a string, equivalents are '26px','20pt','160%' or '1.6em')\n */\n get fontSize(): number | string\n {\n return this._fontSize;\n }\n set fontSize(fontSize: number | string)\n {\n if (this._fontSize !== fontSize)\n {\n this._fontSize = fontSize;\n this.styleID++;\n }\n }\n\n /**\n * The font style\n * ('normal', 'italic' or 'oblique')\n *\n * @member {string}\n */\n get fontStyle(): TextStyleFontStyle\n {\n return this._fontStyle;\n }\n set fontStyle(fontStyle: TextStyleFontStyle)\n {\n if (this._fontStyle !== fontStyle)\n {\n this._fontStyle = fontStyle;\n this.styleID++;\n }\n }\n\n /**\n * The font variant\n * ('normal' or 'small-caps')\n *\n * @member {string}\n */\n get fontVariant(): TextStyleFontVariant\n {\n return this._fontVariant;\n }\n set fontVariant(fontVariant: TextStyleFontVariant)\n {\n if (this._fontVariant !== fontVariant)\n {\n this._fontVariant = fontVariant;\n this.styleID++;\n }\n }\n\n /**\n * The font weight\n * ('normal', 'bold', 'bolder', 'lighter' and '100', '200', '300', '400', '500', '600', '700', 800' or '900')\n *\n * @member {string}\n */\n get fontWeight(): TextStyleFontWeight\n {\n return this._fontWeight;\n }\n set fontWeight(fontWeight: TextStyleFontWeight)\n {\n if (this._fontWeight !== fontWeight)\n {\n this._fontWeight = fontWeight;\n this.styleID++;\n }\n }\n\n /** The amount of spacing between letters, default is 0. */\n get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n set letterSpacing(letterSpacing: number)\n {\n if (this._letterSpacing !== letterSpacing)\n {\n this._letterSpacing = letterSpacing;\n this.styleID++;\n }\n }\n\n /** The line height, a number that represents the vertical space that a letter uses. */\n get lineHeight(): number\n {\n return this._lineHeight;\n }\n set lineHeight(lineHeight: number)\n {\n if (this._lineHeight !== lineHeight)\n {\n this._lineHeight = lineHeight;\n this.styleID++;\n }\n }\n\n /** The space between lines. */\n get leading(): number\n {\n return this._leading;\n }\n set leading(leading: number)\n {\n if (this._leading !== leading)\n {\n this._leading = leading;\n this.styleID++;\n }\n }\n\n /**\n * The lineJoin property sets the type of corner created, it can resolve spiked text issues.\n * Default is 'miter' (creates a sharp corner).\n *\n * @member {string}\n */\n get lineJoin(): TextStyleLineJoin\n {\n return this._lineJoin;\n }\n set lineJoin(lineJoin: TextStyleLineJoin)\n {\n if (this._lineJoin !== lineJoin)\n {\n this._lineJoin = lineJoin;\n this.styleID++;\n }\n }\n\n /**\n * The miter limit to use when using the 'miter' lineJoin mode.\n *\n * This can reduce or increase the spikiness of rendered text.\n */\n get miterLimit(): number\n {\n return this._miterLimit;\n }\n set miterLimit(miterLimit: number)\n {\n if (this._miterLimit !== miterLimit)\n {\n this._miterLimit = miterLimit;\n this.styleID++;\n }\n }\n\n /**\n * Occasionally some fonts are cropped. Adding some padding will prevent this from happening\n * by adding padding to all sides of the text.\n */\n get padding(): number\n {\n return this._padding;\n }\n set padding(padding: number)\n {\n if (this._padding !== padding)\n {\n this._padding = padding;\n this.styleID++;\n }\n }\n\n /**\n * A canvas fillstyle that will be used on the text stroke\n * e.g 'blue', '#FCFF00'\n */\n get stroke(): string | number\n {\n return this._stroke;\n }\n set stroke(stroke: string | number)\n {\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const outputColor = getColor(stroke);\n if (this._stroke !== outputColor)\n {\n this._stroke = outputColor;\n this.styleID++;\n }\n }\n\n /**\n * A number that represents the thickness of the stroke.\n *\n * @default 0\n */\n get strokeThickness(): number\n {\n return this._strokeThickness;\n }\n set strokeThickness(strokeThickness: number)\n {\n if (this._strokeThickness !== strokeThickness)\n {\n this._strokeThickness = strokeThickness;\n this.styleID++;\n }\n }\n\n /**\n * The baseline of the text that is rendered.\n *\n * @member {string}\n */\n get textBaseline(): TextStyleTextBaseline\n {\n return this._textBaseline;\n }\n set textBaseline(textBaseline: TextStyleTextBaseline)\n {\n if (this._textBaseline !== textBaseline)\n {\n this._textBaseline = textBaseline;\n this.styleID++;\n }\n }\n\n /** Trim transparent borders. */\n get trim(): boolean\n {\n return this._trim;\n }\n set trim(trim: boolean)\n {\n if (this._trim !== trim)\n {\n this._trim = trim;\n this.styleID++;\n }\n }\n\n /**\n * How newlines and spaces should be handled.\n * Default is 'pre' (preserve, preserve).\n *\n * value | New lines | Spaces\n * --- | --- | ---\n * 'normal' | Collapse | Collapse\n * 'pre' | Preserve | Preserve\n * 'pre-line' | Preserve | Collapse\n *\n * @member {string}\n */\n get whiteSpace(): TextStyleWhiteSpace\n {\n return this._whiteSpace;\n }\n set whiteSpace(whiteSpace: TextStyleWhiteSpace)\n {\n if (this._whiteSpace !== whiteSpace)\n {\n this._whiteSpace = whiteSpace;\n this.styleID++;\n }\n }\n\n /** Indicates if word wrap should be used. */\n get wordWrap(): boolean\n {\n return this._wordWrap;\n }\n set wordWrap(wordWrap: boolean)\n {\n if (this._wordWrap !== wordWrap)\n {\n this._wordWrap = wordWrap;\n this.styleID++;\n }\n }\n\n /** The width at which text will wrap, it needs wordWrap to be set to true. */\n get wordWrapWidth(): number\n {\n return this._wordWrapWidth;\n }\n set wordWrapWidth(wordWrapWidth: number)\n {\n if (this._wordWrapWidth !== wordWrapWidth)\n {\n this._wordWrapWidth = wordWrapWidth;\n this.styleID++;\n }\n }\n\n /**\n * Generates a font style string to use for `TextMetrics.measureFont()`.\n *\n * @return Font style string, for passing to `TextMetrics.measureFont()`\n */\n public toFontString(): string\n {\n // build canvas api font setting from individual components. Convert a numeric this.fontSize to px\n const fontSizeString = (typeof this.fontSize === 'number') ? `${this.fontSize}px` : this.fontSize;\n\n // Clean-up fontFamily property by quoting each font name\n // this will support font names with spaces\n let fontFamilies: string|string[] = this.fontFamily;\n\n if (!Array.isArray(this.fontFamily))\n {\n fontFamilies = this.fontFamily.split(',');\n }\n\n for (let i = fontFamilies.length - 1; i >= 0; i--)\n {\n // Trim any extra white-space\n let fontFamily = fontFamilies[i].trim();\n\n // Check if font already contains strings\n if (!(/([\\\"\\'])[^\\'\\\"]+\\1/).test(fontFamily) && genericFontFamilies.indexOf(fontFamily) < 0)\n {\n fontFamily = `\"${fontFamily}\"`;\n }\n (fontFamilies as string[])[i] = fontFamily;\n }\n\n return `${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${fontSizeString} ${(fontFamilies as string[]).join(',')}`;\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * @private\n * @param color\n * @return The color as a string.\n */\nfunction getSingleColor(color: string|number): string\n{\n if (typeof color === 'number')\n {\n return hex2string(color);\n }\n else if (typeof color === 'string')\n {\n if ( color.indexOf('0x') === 0 )\n {\n color = color.replace('0x', '#');\n }\n }\n\n return color;\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param color\n * @return The color as a string.\n */\nfunction getColor(color: (string|number)[]): string[];\nfunction getColor(color: string|number): string;\nfunction getColor(color: string|number|(string|number)[]): string|string[]\n{\n if (!Array.isArray(color))\n {\n return getSingleColor(color);\n }\n else\n {\n for (let i = 0; i < color.length; ++i)\n {\n color[i] = getSingleColor(color[i]);\n }\n\n return color as string[];\n }\n}\n\n/**\n * Utility function to convert hexadecimal colors to strings, and simply return the color if it's a string.\n * This version can also convert array of colors\n * @private\n * @param array1 - First array to compare\n * @param array2 - Second array to compare\n * @return Do the arrays contain the same values in the same order\n */\nfunction areArraysEqual(array1: T[], array2: T[]): boolean\n{\n if (!Array.isArray(array1) || !Array.isArray(array2))\n {\n return false;\n }\n\n if (array1.length !== array2.length)\n {\n return false;\n }\n\n for (let i = 0; i < array1.length; ++i)\n {\n if (array1[i] !== array2[i])\n {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Utility function to ensure that object properties are copied by value, and not by reference\n * @private\n * @param target - Target object to copy properties into\n * @param source - Source object for the properties to copy\n * @param propertyObj - Object containing properties names we want to loop over\n */\nfunction deepCopyProperties(target: Record, source: Record, propertyObj: Record): void {\n for (const prop in propertyObj) {\n if (Array.isArray(source[prop])) {\n target[prop] = source[prop].slice();\n } else {\n target[prop] = source[prop];\n }\n }\n}\n","import { TextStyle, TextStyleWhiteSpace } from './TextStyle';\n\ninterface IFontMetrics {\n ascent: number;\n descent: number;\n fontSize: number;\n}\n\ntype CharacterWidthCache = { [key: string]: number };\n\n/**\n * The TextMetrics object represents the measurement of a block of text with a specified style.\n *\n * ```js\n * let style = new PIXI.TextStyle({fontFamily : 'Arial', fontSize: 24, fill : 0xff1010, align : 'center'})\n * let textMetrics = PIXI.TextMetrics.measureText('Your text', style)\n * ```\n *\n * @memberof PIXI\n */\nexport class TextMetrics\n{\n /** The text that was measured. */\n public text: string;\n\n /** The style that was measured. */\n public style: TextStyle;\n\n /** The measured width of the text. */\n public width: number;\n\n /** The measured height of the text. */\n public height: number;\n\n /** An array of lines of the text broken by new lines and wrapping is specified in style. */\n public lines: string[];\n\n /** An array of the line widths for each line matched to `lines`. */\n public lineWidths: number[];\n\n /** The measured line height for this style. */\n public lineHeight: number;\n\n /** The maximum line width for all measured lines. */\n public maxLineWidth: number;\n\n /**\n * The font properties object from TextMetrics.measureFont.\n *\n * @type {PIXI.IFontMetrics}\n */\n public fontProperties: IFontMetrics;\n\n public static METRICS_STRING: string;\n public static BASELINE_SYMBOL: string;\n public static BASELINE_MULTIPLIER: number;\n public static HEIGHT_MULTIPLIER: number;\n\n // TODO: These should be protected but they're initialized outside of the class.\n public static _canvas: HTMLCanvasElement|OffscreenCanvas;\n public static _context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D;\n public static _fonts: { [font: string]: IFontMetrics };\n public static _newlines: number[];\n public static _breakingSpaces: number[];\n\n /**\n * @param text - the text that was measured\n * @param style - the style that was measured\n * @param width - the measured width of the text\n * @param height - the measured height of the text\n * @param lines - an array of the lines of text broken by new lines and wrapping if specified in style\n * @param lineWidths - an array of the line widths for each line matched to `lines`\n * @param lineHeight - the measured line height for this style\n * @param maxLineWidth - the maximum line width for all measured lines\n * @param {PIXI.IFontMetrics} fontProperties - the font properties object from TextMetrics.measureFont\n */\n constructor(text: string, style: TextStyle, width: number, height: number, lines: string[], lineWidths: number[],\n lineHeight: number, maxLineWidth: number, fontProperties: IFontMetrics)\n {\n this.text = text;\n this.style = style;\n this.width = width;\n this.height = height;\n this.lines = lines;\n this.lineWidths = lineWidths;\n this.lineHeight = lineHeight;\n this.maxLineWidth = maxLineWidth;\n this.fontProperties = fontProperties;\n }\n\n /**\n * Measures the supplied string of text and returns a Rectangle.\n *\n * @param text - The text to measure.\n * @param style - The text style to use for measuring\n * @param wordWrap - Override for if word-wrap should be applied to the text.\n * @param canvas - optional specification of the canvas to use for measuring.\n * @return Measured width and height of the text.\n */\n public static measureText(\n text: string,\n style: TextStyle,\n wordWrap?: boolean,\n canvas: HTMLCanvasElement | OffscreenCanvas = TextMetrics._canvas\n ): TextMetrics\n {\n wordWrap = (wordWrap === undefined || wordWrap === null) ? style.wordWrap : wordWrap;\n const font = style.toFontString();\n const fontProperties = TextMetrics.measureFont(font);\n\n // fallback in case UA disallow canvas data extraction\n // (toDataURI, getImageData functions)\n if (fontProperties.fontSize === 0)\n {\n fontProperties.fontSize = style.fontSize as number;\n fontProperties.ascent = style.fontSize as number;\n }\n\n const context = canvas.getContext('2d');\n\n context.font = font;\n\n const outputText = wordWrap ? TextMetrics.wordWrap(text, style, canvas) : text;\n const lines = outputText.split(/(?:\\r\\n|\\r|\\n)/);\n const lineWidths = new Array(lines.length);\n let maxLineWidth = 0;\n\n for (let i = 0; i < lines.length; i++)\n {\n const lineWidth = context.measureText(lines[i]).width + ((lines[i].length - 1) * style.letterSpacing);\n\n lineWidths[i] = lineWidth;\n maxLineWidth = Math.max(maxLineWidth, lineWidth);\n }\n let width = maxLineWidth + style.strokeThickness;\n\n if (style.dropShadow)\n {\n width += style.dropShadowDistance;\n }\n\n const lineHeight = style.lineHeight || fontProperties.fontSize + style.strokeThickness;\n let height = Math.max(lineHeight, fontProperties.fontSize + style.strokeThickness)\n + ((lines.length - 1) * (lineHeight + style.leading));\n\n if (style.dropShadow)\n {\n height += style.dropShadowDistance;\n }\n\n return new TextMetrics(\n text,\n style,\n width,\n height,\n lines,\n lineWidths,\n lineHeight + style.leading,\n maxLineWidth,\n fontProperties\n );\n }\n\n /**\n * Applies newlines to a string to have it optimally fit into the horizontal\n * bounds set by the Text object's wordWrapWidth property.\n *\n * @param text - String to apply word wrapping to\n * @param style - the style to use when wrapping\n * @param canvas - optional specification of the canvas to use for measuring.\n * @return New string with new lines applied where required\n */\n private static wordWrap(\n text: string,\n style: TextStyle,\n canvas: HTMLCanvasElement | OffscreenCanvas = TextMetrics._canvas\n ): string\n {\n const context = canvas.getContext('2d');\n\n let width = 0;\n let line = '';\n let lines = '';\n\n const cache: CharacterWidthCache = Object.create(null);\n const { letterSpacing, whiteSpace } = style;\n\n // How to handle whitespaces\n const collapseSpaces = TextMetrics.collapseSpaces(whiteSpace);\n const collapseNewlines = TextMetrics.collapseNewlines(whiteSpace);\n\n // whether or not spaces may be added to the beginning of lines\n let canPrependSpaces = !collapseSpaces;\n\n // There is letterSpacing after every char except the last one\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!\n // so for convenience the above needs to be compared to width + 1 extra letterSpace\n // t_h_i_s_' '_i_s_' '_a_n_' '_e_x_a_m_p_l_e_' '_!_\n // ________________________________________________\n // And then the final space is simply no appended to each line\n const wordWrapWidth = style.wordWrapWidth + letterSpacing;\n\n // break text into words, spaces and newline chars\n const tokens = TextMetrics.tokenize(text);\n\n for (let i = 0; i < tokens.length; i++)\n {\n // get the word, space or newlineChar\n let token = tokens[i];\n\n // if word is a new line\n if (TextMetrics.isNewline(token))\n {\n // keep the new line\n if (!collapseNewlines)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = !collapseSpaces;\n line = '';\n width = 0;\n continue;\n }\n\n // if we should collapse new lines\n // we simply convert it into a space\n token = ' ';\n }\n\n // if we should collapse repeated whitespaces\n if (collapseSpaces)\n {\n // check both this and the last tokens for spaces\n const currIsBreakingSpace = TextMetrics.isBreakingSpace(token);\n const lastIsBreakingSpace = TextMetrics.isBreakingSpace(line[line.length - 1]);\n\n if (currIsBreakingSpace && lastIsBreakingSpace)\n {\n continue;\n }\n }\n\n // get word width from cache if possible\n const tokenWidth = TextMetrics.getFromCache(token, letterSpacing, cache, context);\n\n // word is longer than desired bounds\n if (tokenWidth > wordWrapWidth)\n {\n // if we are not already at the beginning of a line\n if (line !== '')\n {\n // start newlines for overflow words\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n // break large word over multiple lines\n if (TextMetrics.canBreakWords(token, style.breakWords))\n {\n // break word into characters\n const characters = TextMetrics.wordWrapSplit(token);\n\n // loop the characters\n for (let j = 0; j < characters.length; j++)\n {\n let char = characters[j];\n\n let k = 1;\n // we are not at the end of the token\n\n while (characters[j + k])\n {\n const nextChar = characters[j + k];\n const lastChar = char[char.length - 1];\n\n // should not split chars\n if (!TextMetrics.canBreakChars(lastChar, nextChar, token, j, style.breakWords))\n {\n // combine chars & move forward one\n char += nextChar;\n }\n else\n {\n break;\n }\n\n k++;\n }\n\n j += char.length - 1;\n\n const characterWidth = TextMetrics.getFromCache(char, letterSpacing, cache, context);\n\n if (characterWidth + width > wordWrapWidth)\n {\n lines += TextMetrics.addLine(line);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n\n line += char;\n width += characterWidth;\n }\n }\n\n // run word out of the bounds\n else\n {\n // if there are words in this line already\n // finish that line and start a new one\n if (line.length > 0)\n {\n lines += TextMetrics.addLine(line);\n line = '';\n width = 0;\n }\n\n const isLastToken = i === tokens.length - 1;\n\n // give it its own line if it's not the end\n lines += TextMetrics.addLine(token, !isLastToken);\n canPrependSpaces = false;\n line = '';\n width = 0;\n }\n }\n\n // word could fit\n else\n {\n // word won't fit because of existing words\n // start a new line\n if (tokenWidth + width > wordWrapWidth)\n {\n // if its a space we don't want it\n canPrependSpaces = false;\n\n // add a new line\n lines += TextMetrics.addLine(line);\n\n // start a new line\n line = '';\n width = 0;\n }\n\n // don't add spaces to the beginning of lines\n if (line.length > 0 || !TextMetrics.isBreakingSpace(token) || canPrependSpaces)\n {\n // add the word to the current line\n line += token;\n\n // update width counter\n width += tokenWidth;\n }\n }\n }\n\n lines += TextMetrics.addLine(line, false);\n\n return lines;\n }\n\n /**\n * Convienience function for logging each line added during the wordWrap method.\n *\n * @param line - The line of text to add\n * @param newLine - Add new line character to end\n * @return A formatted line\n */\n private static addLine(line: string, newLine = true): string\n {\n line = TextMetrics.trimRight(line);\n\n line = (newLine) ? `${line}\\n` : line;\n\n return line;\n }\n\n /**\n * Gets & sets the widths of calculated characters in a cache object\n *\n * @param key - The key\n * @param letterSpacing - The letter spacing\n * @param cache - The cache\n * @param context - The canvas context\n * @return The from cache.\n */\n private static getFromCache(key: string, letterSpacing: number, cache: CharacterWidthCache,\n context: CanvasRenderingContext2D|OffscreenCanvasRenderingContext2D): number\n {\n let width = cache[key];\n\n if (typeof width !== 'number')\n {\n const spacing = ((key.length) * letterSpacing);\n\n width = context.measureText(key).width + spacing;\n cache[key] = width;\n }\n\n return width;\n }\n\n /**\n * Determines whether we should collapse breaking spaces.\n *\n * @param whiteSpace - The TextStyle property whiteSpace\n * @return Should collapse\n */\n private static collapseSpaces(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal' || whiteSpace === 'pre-line');\n }\n\n /**\n * Determines whether we should collapse newLine chars.\n *\n * @param whiteSpace - The white space\n * @return should collapse\n */\n private static collapseNewlines(whiteSpace: TextStyleWhiteSpace): boolean\n {\n return (whiteSpace === 'normal');\n }\n\n /**\n * Trims breaking whitespaces from string.\n *\n * @param text - The text\n * @return Trimmed string\n */\n private static trimRight(text: string): string\n {\n if (typeof text !== 'string')\n {\n return '';\n }\n\n for (let i = text.length - 1; i >= 0; i--)\n {\n const char = text[i];\n\n if (!TextMetrics.isBreakingSpace(char))\n {\n break;\n }\n\n text = text.slice(0, -1);\n }\n\n return text;\n }\n\n /**\n * Determines if char is a newline.\n *\n * @param char - The character\n * @return True if newline, False otherwise.\n */\n private static isNewline(char: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._newlines.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Determines if char is a breaking whitespace.\n *\n * It allows one to determine whether char should be a breaking whitespace\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @param char - The character\n * @param [nextChar] - The next character\n * @return True if whitespace, False otherwise.\n */\n static isBreakingSpace(char: string, _nextChar?: string): boolean\n {\n if (typeof char !== 'string')\n {\n return false;\n }\n\n return (TextMetrics._breakingSpaces.indexOf(char.charCodeAt(0)) >= 0);\n }\n\n /**\n * Splits a string into words, breaking-spaces and newLine characters\n *\n * @param text - The text\n * @return A tokenized array\n */\n private static tokenize(text: string): string[]\n {\n const tokens: string[] = [];\n let token = '';\n\n if (typeof text !== 'string')\n {\n return tokens;\n }\n\n for (let i = 0; i < text.length; i++)\n {\n const char = text[i];\n const nextChar = text[i + 1];\n\n if (TextMetrics.isBreakingSpace(char, nextChar) || TextMetrics.isNewline(char))\n {\n if (token !== '')\n {\n tokens.push(token);\n token = '';\n }\n\n tokens.push(char);\n\n continue;\n }\n\n token += char;\n }\n\n if (token !== '')\n {\n tokens.push(token);\n }\n\n return tokens;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to customise which words should break\n * Examples are if the token is CJK or numbers.\n * It must return a boolean.\n *\n * @param token - The token\n * @param breakWords - The style attr break words\n * @return Whether to break word or not\n */\n static canBreakWords(_token: string, breakWords: boolean): boolean\n {\n return breakWords;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It allows one to determine whether a pair of characters\n * should be broken by newlines\n * For example certain characters in CJK langs or numbers.\n * It must return a boolean.\n *\n * @param char - The character\n * @param nextChar - The next character\n * @param token - The token/word the characters are from\n * @param index - The index in the token of the char\n * @param breakWords - The style attr break words\n * @return whether to break word or not\n */\n static canBreakChars(_char: string, _nextChar: string, _token: string, _index: number,\n _breakWords: boolean): boolean\n {\n return true;\n }\n\n /**\n * Overridable helper method used internally by TextMetrics, exposed to allow customizing the class's behavior.\n *\n * It is called when a token (usually a word) has to be split into separate pieces\n * in order to determine the point to break a word.\n * It must return an array of characters.\n *\n * @example\n * // Correctly splits emojis, eg \"🤪🤪\" will result in two element array, each with one emoji.\n * TextMetrics.wordWrapSplit = (token) => [...token];\n *\n * @param token - The token to split\n * @return The characters of the token\n */\n static wordWrapSplit(token: string): string[]\n {\n return token.split('');\n }\n\n /**\n * Calculates the ascent, descent and fontSize of a given font-style\n *\n * @param font - String representing the style of the font\n * @return Font properties object\n */\n public static measureFont(font: string): IFontMetrics\n {\n // as this method is used for preparing assets, don't recalculate things if we don't need to\n if (TextMetrics._fonts[font])\n {\n return TextMetrics._fonts[font];\n }\n\n const properties: IFontMetrics = {\n ascent: 0,\n descent: 0,\n fontSize: 0,\n };\n\n const canvas = TextMetrics._canvas;\n const context = TextMetrics._context;\n\n context.font = font;\n\n const metricsString = TextMetrics.METRICS_STRING + TextMetrics.BASELINE_SYMBOL;\n const width = Math.ceil(context.measureText(metricsString).width);\n let baseline = Math.ceil(context.measureText(TextMetrics.BASELINE_SYMBOL).width);\n const height = Math.ceil(TextMetrics.HEIGHT_MULTIPLIER * baseline);\n\n baseline = baseline * TextMetrics.BASELINE_MULTIPLIER | 0;\n\n canvas.width = width;\n canvas.height = height;\n\n context.fillStyle = '#f00';\n context.fillRect(0, 0, width, height);\n\n context.font = font;\n\n context.textBaseline = 'alphabetic';\n context.fillStyle = '#000';\n context.fillText(metricsString, 0, baseline);\n\n const imagedata = context.getImageData(0, 0, width, height).data;\n const pixels = imagedata.length;\n const line = width * 4;\n\n let i = 0;\n let idx = 0;\n let stop = false;\n\n // ascent. scan from top to bottom until we find a non red pixel\n for (i = 0; i < baseline; ++i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n if (!stop)\n {\n idx += line;\n }\n else\n {\n break;\n }\n }\n\n properties.ascent = baseline - i;\n\n idx = pixels - line;\n stop = false;\n\n // descent. scan from bottom to top until we find a non red pixel\n for (i = height; i > baseline; --i)\n {\n for (let j = 0; j < line; j += 4)\n {\n if (imagedata[idx + j] !== 255)\n {\n stop = true;\n break;\n }\n }\n\n if (!stop)\n {\n idx -= line;\n }\n else\n {\n break;\n }\n }\n\n properties.descent = i - baseline;\n properties.fontSize = properties.ascent + properties.descent;\n\n TextMetrics._fonts[font] = properties;\n\n return properties;\n }\n\n /**\n * Clear font metrics in metrics cache.\n *\n * @param {string} [font] - font name. If font name not set then clear cache for all fonts.\n */\n public static clearMetrics(font = ''): void\n {\n if (font)\n {\n delete TextMetrics._fonts[font];\n }\n else\n {\n TextMetrics._fonts = {};\n }\n }\n}\n\n/**\n * Internal return object for {@link PIXI.TextMetrics.measureFont `TextMetrics.measureFont`}.\n *\n * @typedef {object} FontMetrics\n * @property {number} ascent - The ascent distance\n * @property {number} descent - The descent distance\n * @property {number} fontSize - Font size from ascent to descent\n * @memberof PIXI.TextMetrics\n * @private\n */\n\nconst canvas = ((): HTMLCanvasElement|OffscreenCanvas =>\n{\n try\n {\n // OffscreenCanvas2D measureText can be up to 40% faster.\n const c = new OffscreenCanvas(0, 0);\n const context = c.getContext('2d');\n\n if (context && context.measureText)\n {\n return c;\n }\n\n return document.createElement('canvas');\n }\n catch (ex)\n {\n return document.createElement('canvas');\n }\n})();\n\ncanvas.width = canvas.height = 10;\n\n/**\n * Cached canvas element for measuring text\n *\n * @memberof PIXI.TextMetrics\n * @type {HTMLCanvasElement}\n * @private\n */\nTextMetrics._canvas = canvas;\n\n/**\n * Cache for context to use.\n *\n * @memberof PIXI.TextMetrics\n * @type {CanvasRenderingContext2D}\n * @private\n */\nTextMetrics._context = canvas.getContext('2d');\n\n/**\n * Cache of {@see PIXI.TextMetrics.FontMetrics} objects.\n *\n * @memberof PIXI.TextMetrics\n * @type {Object}\n * @private\n */\nTextMetrics._fonts = {};\n\n/**\n * String used for calculate font metrics.\n * These characters are all tall to help calculate the height required for text.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name METRICS_STRING\n * @type {string}\n * @default |ÉqÅ\n */\nTextMetrics.METRICS_STRING = '|ÉqÅ';\n\n/**\n * Baseline symbol for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_SYMBOL\n * @type {string}\n * @default M\n */\nTextMetrics.BASELINE_SYMBOL = 'M';\n\n/**\n * Baseline multiplier for calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name BASELINE_MULTIPLIER\n * @type {number}\n * @default 1.4\n */\nTextMetrics.BASELINE_MULTIPLIER = 1.4;\n\n/**\n * Height multiplier for setting height of canvas to calculate font metrics.\n *\n * @static\n * @memberof PIXI.TextMetrics\n * @name HEIGHT_MULTIPLIER\n * @type {number}\n * @default 2.00\n */\nTextMetrics.HEIGHT_MULTIPLIER = 2.0;\n\n/**\n * Cache of new line chars.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._newlines = [\n 0x000A, // line feed\n 0x000D, // carriage return\n];\n\n/**\n * Cache of breaking spaces.\n *\n * @memberof PIXI.TextMetrics\n * @type {number[]}\n * @private\n */\nTextMetrics._breakingSpaces = [\n 0x0009, // character tabulation\n 0x0020, // space\n 0x2000, // en quad\n 0x2001, // em quad\n 0x2002, // en space\n 0x2003, // em space\n 0x2004, // three-per-em space\n 0x2005, // four-per-em space\n 0x2006, // six-per-em space\n 0x2008, // punctuation space\n 0x2009, // thin space\n 0x200A, // hair space\n 0x205F, // medium mathematical space\n 0x3000, // ideographic space\n];\n\n/**\n * A number, or a string containing a number.\n *\n * @memberof PIXI\n * @typedef {object} IFontMetrics\n * @property {number} ascent - Font ascent\n * @property {number} descent - Font descent\n * @property {number} fontSize - Font size\n */\n","import { Text } from '@pixi/text';\nimport { Sprite } from '@pixi/sprite';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @method _renderCanvas\n * @memberof PIXI.Text#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nText.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this._autoResolution && this._resolution !== renderer.resolution)\n {\n this._resolution = renderer.resolution;\n this.dirty = true;\n }\n\n this.updateText(true);\n\n Sprite.prototype._renderCanvas.call(this, renderer);\n};\n","import { settings } from '@pixi/settings';\n\n/**\n * Default number of uploads per frame using prepare plugin.\n *\n * @static\n * @memberof PIXI.settings\n * @name UPLOADS_PER_FRAME\n * @type {number}\n * @default 4\n */\nsettings.UPLOADS_PER_FRAME = 4;\n\nexport { settings };\n","/**\n * CountLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of items per frame.\n *\n * @memberof PIXI\n */\nexport class CountLimiter\n{\n /** The maximum number of items that can be prepared each frame. */\n public maxItemsPerFrame: number;\n\n /**\n * The number of items that can be prepared in the current frame. */\n public itemsLeft: number;\n\n /**\n * @param maxItemsPerFrame - The maximum number of items that can be prepared each frame.\n */\n constructor(maxItemsPerFrame: number)\n {\n this.maxItemsPerFrame = maxItemsPerFrame;\n this.itemsLeft = 0;\n }\n\n /** Resets any counting properties to start fresh on a new frame. */\n beginFrame(): void\n {\n this.itemsLeft = this.maxItemsPerFrame;\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n *\n * @return If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return this.itemsLeft-- > 0;\n }\n}\n","import { Texture, BaseTexture } from '@pixi/core';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport { settings } from '@pixi/settings';\nimport { Container, DisplayObject } from '@pixi/display';\nimport { Text, TextStyle, TextMetrics } from '@pixi/text';\nimport { CountLimiter } from './CountLimiter';\n\nimport type { AbstractRenderer } from '@pixi/core';\n\ninterface IArrowFunction {\n (): void;\n}\ninterface IUploadHook {\n (helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean;\n}\n\ninterface IFindHook {\n (item: any, queue: Array): boolean;\n}\n\nexport interface IDisplayObjectExtended extends DisplayObject {\n _textures?: Array;\n _texture?: Texture;\n style?: TextStyle|Partial;\n}\n\n/**\n * Built-in hook to find multiple textures from objects like AnimatedSprites.\n *\n * @private\n * @param item - Display object to check\n * @param queue - Collection of items to upload\n * @return If a PIXI.Texture object was found.\n */\nfunction findMultipleBaseTextures(item: IDisplayObjectExtended, queue: Array): boolean\n{\n let result = false;\n\n // Objects with multiple textures\n if (item && item._textures && item._textures.length)\n {\n for (let i = 0; i < item._textures.length; i++)\n {\n if (item._textures[i] instanceof Texture)\n {\n const baseTexture = item._textures[i].baseTexture;\n\n if (queue.indexOf(baseTexture) === -1)\n {\n queue.push(baseTexture);\n result = true;\n }\n }\n }\n }\n\n return result;\n}\n\n/**\n * Built-in hook to find BaseTextures from Texture.\n *\n * @private\n * @param item - Display object to check\n * @param queue - Collection of items to upload\n * @return If a PIXI.Texture object was found.\n */\nfunction findBaseTexture(item: Texture, queue: Array): boolean\n{\n if (item.baseTexture instanceof BaseTexture)\n {\n const texture = item.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find textures from objects.\n *\n * @private\n * @param item - Display object to check\n * @param queue - Collection of items to upload\n * @return If a PIXI.Texture object was found.\n */\nfunction findTexture(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item._texture && item._texture instanceof Texture)\n {\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to draw PIXI.Text to its texture.\n *\n * @private\n * @param helper - Not used by this upload handler\n * @param item - Item to check\n * @return If item was uploaded.\n */\nfunction drawText(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof Text)\n {\n // updating text will return early if it is not dirty\n item.updateText(true);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to calculate a text style for a PIXI.Text object.\n *\n * @private\n * @param helper - Not used by this upload handler\n * @param item - Item to check\n * @return If item was uploaded.\n */\nfunction calculateTextStyle(_helper: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (item instanceof TextStyle)\n {\n const font = item.toFontString();\n\n TextMetrics.measureFont(font);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find Text objects.\n *\n * @private\n * @param item - Display object to check\n * @param queue - Collection of items to upload\n * @return if a PIXI.Text object was found.\n */\nfunction findText(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Text)\n {\n // push the text style to prepare it - this can be really expensive\n if (queue.indexOf(item.style) === -1)\n {\n queue.push(item.style);\n }\n // also push the text object so that we can render it (to canvas/texture) if needed\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n // also push the Text's texture for upload to GPU\n const texture = item._texture.baseTexture;\n\n if (queue.indexOf(texture) === -1)\n {\n queue.push(texture);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to find TextStyle objects.\n *\n * @private\n * @param item - Display object to check\n * @param queue - Collection of items to upload\n * @return If a PIXI.TextStyle object was found.\n */\nfunction findTextStyle(item: TextStyle, queue: Array): boolean\n{\n if (item instanceof TextStyle)\n {\n if (queue.indexOf(item) === -1)\n {\n queue.push(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * BasePrepare handles basic queuing functionality and is extended by\n * {@link PIXI.Prepare} and {@link PIXI.CanvasPrepare}\n * to provide preparation capabilities specific to their respective renderers.\n *\n * @example\n * // Create a sprite\n * const sprite = PIXI.Sprite.from('something.png');\n *\n * // Load object into GPU\n * app.renderer.plugins.prepare.upload(sprite, () => {\n *\n * //Texture(s) has been uploaded to GPU\n * app.stage.addChild(sprite);\n *\n * })\n *\n * @abstract\n * @memberof PIXI\n */\nexport class BasePrepare\n{\n /**\n * The limiter to be used to control how quickly items are prepared.\n * @type {PIXI.CountLimiter|PIXI.TimeLimiter}\n */\n private limiter: CountLimiter;\n\n /** Reference to the renderer. */\n protected renderer: AbstractRenderer;\n\n /**\n * The only real difference between CanvasPrepare and Prepare is what they pass\n * to upload hooks. That different parameter is stored here.\n */\n protected uploadHookHelper: any;\n\n /** Collection of items to uploads at once. */\n protected queue: Array;\n\n /**\n * Collection of additional hooks for finding assets.\n * @type {Array}\n */\n public addHooks: Array;\n\n /**\n * Collection of additional hooks for processing assets.\n * @type {Array}\n */\n public uploadHooks: Array;\n\n /**\n * Callback to call after completed.\n * @type {Array}\n */\n public completes: Array;\n\n /**\n * If prepare is ticking (running).\n * @type {boolean}\n */\n public ticking: boolean;\n\n /**\n * 'bound' call for prepareItems().\n * @type {Function}\n */\n private delayedTick: IArrowFunction;\n\n /**\n * @param {PIXI.AbstractRenderer} renderer - A reference to the current renderer\n */\n constructor(renderer: AbstractRenderer)\n {\n this.limiter = new CountLimiter(settings.UPLOADS_PER_FRAME);\n this.renderer = renderer;\n this.uploadHookHelper = null;\n this.queue = [];\n this.addHooks = [];\n this.uploadHooks = [];\n this.completes = [];\n this.ticking = false;\n this.delayedTick = (): void =>\n {\n // unlikely, but in case we were destroyed between tick() and delayedTick()\n if (!this.queue)\n {\n return;\n }\n this.prepareItems();\n };\n\n // hooks to find the correct texture\n this.registerFindHook(findText);\n this.registerFindHook(findTextStyle);\n this.registerFindHook(findMultipleBaseTextures);\n this.registerFindHook(findBaseTexture);\n this.registerFindHook(findTexture);\n\n // upload hooks\n this.registerUploadHook(drawText);\n this.registerUploadHook(calculateTextStyle);\n }\n\n /**\n * Upload all the textures and graphics to the GPU.\n *\n * @param {Function|PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text} item -\n * Either the container or display object to search for items to upload, the items to upload themselves,\n * or the callback function, if items have been added using `prepare.add`.\n * @param {Function} [done] - Optional callback when all queued uploads have completed\n */\n upload(item: IDisplayObjectExtended | Container | BaseTexture | Texture | (() => void), done?: () => void): void\n {\n if (typeof item === 'function')\n {\n done = item as () => void;\n item = null;\n }\n\n // If a display object, search for items\n // that we could upload\n if (item)\n {\n this.add(item as IDisplayObjectExtended | Container | BaseTexture | Texture);\n }\n\n // Get the items for upload from the display\n if (this.queue.length)\n {\n if (done)\n {\n this.completes.push(done);\n }\n\n if (!this.ticking)\n {\n this.ticking = true;\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n else if (done)\n {\n done();\n }\n }\n\n /**\n * Handle tick update\n *\n * @private\n */\n tick(): void\n {\n setTimeout(this.delayedTick, 0);\n }\n\n /**\n * Actually prepare items. This is handled outside of the tick because it will take a while\n * and we do NOT want to block the current animation frame from rendering.\n *\n * @private\n */\n prepareItems(): void\n {\n this.limiter.beginFrame();\n // Upload the graphics\n while (this.queue.length && this.limiter.allowedToUpload())\n {\n const item = this.queue[0];\n let uploaded = false;\n\n if (item && !item._destroyed)\n {\n for (let i = 0, len = this.uploadHooks.length; i < len; i++)\n {\n if (this.uploadHooks[i](this.uploadHookHelper, item))\n {\n this.queue.shift();\n uploaded = true;\n break;\n }\n }\n }\n\n if (!uploaded)\n {\n this.queue.shift();\n }\n }\n\n // We're finished\n if (!this.queue.length)\n {\n this.ticking = false;\n\n const completes = this.completes.slice(0);\n\n this.completes.length = 0;\n\n for (let i = 0, len = completes.length; i < len; i++)\n {\n completes[i]();\n }\n }\n else\n {\n // if we are not finished, on the next rAF do this again\n Ticker.system.addOnce(this.tick, this, UPDATE_PRIORITY.UTILITY);\n }\n }\n\n /**\n * Adds hooks for finding items.\n *\n * @param {Function} addHook - Function call that takes two parameters: `item:*, queue:Array`\n * function must return `true` if it was able to add item to the queue.\n * @return Instance of plugin for chaining.\n */\n registerFindHook(addHook: IFindHook): this\n {\n if (addHook)\n {\n this.addHooks.push(addHook);\n }\n\n return this;\n }\n\n /**\n * Adds hooks for uploading items.\n *\n * @param {Function} uploadHook - Function call that takes two parameters: `prepare:CanvasPrepare, item:*` and\n * function must return `true` if it was able to handle upload of item.\n * @return Instance of plugin for chaining.\n */\n registerUploadHook(uploadHook: IUploadHook): this\n {\n if (uploadHook)\n {\n this.uploadHooks.push(uploadHook);\n }\n\n return this;\n }\n\n /**\n * Manually add an item to the uploading queue.\n *\n * @param {PIXI.DisplayObject|PIXI.Container|PIXI.BaseTexture|PIXI.Texture|PIXI.Graphics|PIXI.Text|*} item - Object to\n * add to the queue\n * @return Instance of plugin for chaining.\n */\n add(item: IDisplayObjectExtended | Container | BaseTexture | Texture): this\n {\n // Add additional hooks for finding elements on special\n // types of objects that\n for (let i = 0, len = this.addHooks.length; i < len; i++)\n {\n if (this.addHooks[i](item, this.queue))\n {\n break;\n }\n }\n\n // Get children recursively\n if (item instanceof Container)\n {\n for (let i = item.children.length - 1; i >= 0; i--)\n {\n this.add(item.children[i]);\n }\n }\n\n return this;\n }\n\n /** Destroys the plugin, don't use after this. */\n destroy(): void\n {\n if (this.ticking)\n {\n Ticker.system.remove(this.tick, this);\n }\n this.ticking = false;\n this.addHooks = null;\n this.uploadHooks = null;\n this.renderer = null;\n this.completes = null;\n this.queue = null;\n this.limiter = null;\n this.uploadHookHelper = null;\n }\n}\n","import { BaseTexture } from '@pixi/core';\nimport { Graphics } from '@pixi/graphics';\nimport { BasePrepare, IDisplayObjectExtended } from './BasePrepare';\n\nimport type { AbstractRenderer, Renderer } from '@pixi/core';\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param renderer - instance of the webgl renderer\n * @param item - Item to check\n * @return If item was uploaded.\n */\nfunction uploadBaseTextures(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended | BaseTexture): boolean\n{\n if (item instanceof BaseTexture)\n {\n // if the texture already has a GL texture, then the texture has been prepared or rendered\n // before now. If the texture changed, then the changer should be calling texture.update() which\n // reuploads the texture without need for preparing it again\n if (!item._glTextures[(renderer as Renderer).CONTEXT_UID])\n {\n (renderer as Renderer).texture.bind(item);\n }\n\n return true;\n }\n\n return false;\n}\n\n/**\n * Built-in hook to upload PIXI.Graphics to the GPU.\n *\n * @private\n * @param renderer - instance of the webgl renderer\n * @param item - Item to check\n * @return If item was uploaded.\n */\nfunction uploadGraphics(renderer: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n if (!(item instanceof Graphics))\n {\n return false;\n }\n\n const { geometry } = item;\n\n // update dirty graphics to get batches\n item.finishPoly();\n geometry.updateBatches();\n\n const { batches } = geometry;\n\n // upload all textures found in styles\n for (let i = 0; i < batches.length; i++)\n {\n const { texture } = batches[i].style;\n\n if (texture)\n {\n uploadBaseTextures(renderer, texture.baseTexture);\n }\n }\n\n // if its not batchable - update vao for particular shader\n if (!geometry.batchable)\n {\n (renderer as Renderer).geometry.bind(geometry, (item as any)._resolveDirectShader((renderer as Renderer)));\n }\n\n return true;\n}\n\n/**\n * Built-in hook to find graphics.\n *\n * @private\n * @param item - Display object to check\n * @param queue - Collection of items to upload\n * @return if a PIXI.Graphics object was found.\n */\nfunction findGraphics(item: IDisplayObjectExtended, queue: Array): boolean\n{\n if (item instanceof Graphics)\n {\n queue.push(item);\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare plugin provides renderer-specific plugins for pre-rendering DisplayObjects. These plugins are useful for\n * asynchronously preparing and uploading to the GPU assets, textures, graphics waiting to be displayed.\n *\n * Do not instantiate this plugin directly. It is available from the `renderer.plugins` property.\n * See {@link PIXI.CanvasRenderer#plugins} or {@link PIXI.Renderer#plugins}.\n * @example\n * // Create a new application\n * const app = new PIXI.Application();\n * document.body.appendChild(app.view);\n *\n * // Don't start rendering right away\n * app.stop();\n *\n * // create a display object\n * const rect = new PIXI.Graphics()\n * .beginFill(0x00ff00)\n * .drawRect(40, 40, 200, 200);\n *\n * // Add to the stage\n * app.stage.addChild(rect);\n *\n * // Don't start rendering until the graphic is uploaded to the GPU\n * app.renderer.plugins.prepare.upload(app.stage, () => {\n * app.start();\n * });\n *\n *\n * @memberof PIXI\n */\nexport class Prepare extends BasePrepare\n{\n /**\n * @param {PIXI.Renderer} renderer - A reference to the current renderer\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this.renderer;\n\n // Add textures and graphics to upload\n this.registerFindHook(findGraphics);\n this.registerUploadHook(uploadBaseTextures);\n this.registerUploadHook(uploadGraphics);\n }\n}\n","/**\n * TimeLimiter limits the number of items handled by a {@link PIXI.BasePrepare} to a specified\n * number of milliseconds per frame.\n *\n * @memberof PIXI\n */\nexport class TimeLimiter\n{\n /** The maximum milliseconds that can be spent preparing items each frame. */\n public maxMilliseconds: number;\n\n /**\n * The start time of the current frame.\n *\n * @readonly\n */\n public frameStart: number;\n\n /** @param maxMilliseconds - The maximum milliseconds that can be spent preparing items each frame. */\n constructor(maxMilliseconds: number)\n {\n this.maxMilliseconds = maxMilliseconds;\n this.frameStart = 0;\n }\n\n /** Resets any counting properties to start fresh on a new frame. */\n beginFrame(): void\n {\n this.frameStart = Date.now();\n }\n\n /**\n * Checks to see if another item can be uploaded. This should only be called once per item.\n *\n * @return - If the item is allowed to be uploaded.\n */\n allowedToUpload(): boolean\n {\n return Date.now() - this.frameStart < this.maxMilliseconds;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { getResolutionOfUrl } from '@pixi/utils';\nimport type { Dict } from '@pixi/utils';\nimport type { ImageResource } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\n/**\n * Represents the JSON data for a spritesheet atlas.\n */\nexport interface ISpritesheetFrameData {\n frame: {\n x: number;\n y: number;\n w: number;\n h: number;\n };\n trimmed?: boolean;\n rotated?: boolean;\n sourceSize?: {\n w: number;\n h: number;\n };\n spriteSourceSize?: {\n x: number;\n y: number;\n };\n anchor?: IPointData;\n}\n\n/**\n * Atlas format.\n */\nexport interface ISpritesheetData {\n frames: Dict;\n animations?: Dict;\n meta: {\n scale: string;\n };\n}\n\n/**\n * Utility class for maintaining reference to a collection\n * of Textures on a single Spritesheet.\n *\n * To access a sprite sheet from your code pass its JSON data file to Pixi's loader:\n *\n * ```js\n * PIXI.Loader.shared.add(\"images/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"images/spritesheet.json\"].spritesheet;\n * ...\n * }\n * ```\n * With the `sheet.textures` you can create Sprite objects,`sheet.animations` can be used to create an AnimatedSprite.\n *\n * Sprite sheets can be packed using tools like {@link https://codeandweb.com/texturepacker|TexturePacker},\n * {@link https://renderhjs.net/shoebox/|Shoebox} or {@link https://github.com/krzysztof-o/spritesheet.js|Spritesheet.js}.\n * Default anchor points (see {@link PIXI.Texture#defaultAnchor}) and grouping of animation sprites are currently only\n * supported by TexturePacker.\n *\n * @memberof PIXI\n */\nexport class Spritesheet\n{\n /** The maximum number of Textures to build per process. */\n static readonly BATCH_SIZE = 1000;\n\n /** Reference to ths source texture. */\n public baseTexture: BaseTexture;\n\n /**\n * A map containing all textures of the sprite sheet.\n * Can be used to create a {@link PIXI.Sprite|Sprite}:\n * ```js\n * new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ```\n */\n public textures: Dict;\n\n /**\n * A map containing the textures for each animation.\n * Can be used to create an {@link PIXI.AnimatedSprite|AnimatedSprite}:\n * ```js\n * new PIXI.AnimatedSprite(sheet.animations[\"anim_name\"])\n * ```\n */\n public animations: Dict;\n\n /**\n * Reference to the original JSON data.\n * @type {Object}\n */\n public data: ISpritesheetData;\n\n /** The resolution of the spritesheet. */\n public resolution: number;\n\n /**\n * Reference to original source image from the Loader. This reference is retained so we\n * can destroy the Texture later on. It is never used internally.\n */\n private _texture: Texture;\n\n /**\n * Map of spritesheet frames.\n * @type {Object}\n */\n private _frames: Dict;\n\n /** Collection of frame names. */\n private _frameKeys: string[];\n\n /** Current batch index being processed. */\n private _batchIndex: number;\n\n /**\n * Callback when parse is completed.\n * @type {Function}\n */\n private _callback: (textures: Dict) => void;\n\n /**\n * @param baseTexture - Reference to the source BaseTexture object.\n * @param {Object} data - Spritesheet image data.\n * @param resolutionFilename - The filename to consider when determining\n * the resolution of the spritesheet. If not provided, the imageUrl will\n * be used on the BaseTexture.\n */\n constructor(texture: BaseTexture | Texture, data: ISpritesheetData, resolutionFilename: string = null)\n {\n this._texture = texture instanceof Texture ? texture : null;\n this.baseTexture = texture instanceof BaseTexture ? texture : this._texture.baseTexture;\n this.textures = {};\n this.animations = {};\n this.data = data;\n\n const resource = this.baseTexture.resource as ImageResource;\n\n this.resolution = this._updateResolution(resolutionFilename || (resource ? resource.url : null));\n this._frames = this.data.frames;\n this._frameKeys = Object.keys(this._frames);\n this._batchIndex = 0;\n this._callback = null;\n }\n\n /**\n * Generate the resolution from the filename or fallback\n * to the meta.scale field of the JSON data.\n *\n * @param resolutionFilename - The filename to use for resolving\n * the default resolution.\n * @return Resolution to use for spritesheet.\n */\n private _updateResolution(resolutionFilename: string = null): number\n {\n const { scale } = this.data.meta;\n\n // Use a defaultValue of `null` to check if a url-based resolution is set\n let resolution = getResolutionOfUrl(resolutionFilename, null);\n\n // No resolution found via URL\n if (resolution === null)\n {\n // Use the scale value or default to 1\n resolution = scale !== undefined ? parseFloat(scale) : 1;\n }\n\n // For non-1 resolutions, update baseTexture\n if (resolution !== 1)\n {\n this.baseTexture.setResolution(resolution);\n }\n\n return resolution;\n }\n\n /**\n * Parser spritesheet from loaded data. This is done asynchronously\n * to prevent creating too many Texture within a single process.\n *\n * @param {Function} callback - Callback when complete returns\n * a map of the Textures for this spritesheet.\n */\n public parse(callback: (textures?: Dict) => void): void\n {\n this._batchIndex = 0;\n this._callback = callback;\n\n if (this._frameKeys.length <= Spritesheet.BATCH_SIZE)\n {\n this._processFrames(0);\n this._processAnimations();\n this._parseComplete();\n }\n else\n {\n this._nextBatch();\n }\n }\n\n /**\n * Process a batch of frames\n *\n * @param initialFrameIndex - The index of frame to start.\n */\n private _processFrames(initialFrameIndex: number): void\n {\n let frameIndex = initialFrameIndex;\n const maxFrames = Spritesheet.BATCH_SIZE;\n\n while (frameIndex - initialFrameIndex < maxFrames && frameIndex < this._frameKeys.length)\n {\n const i = this._frameKeys[frameIndex];\n const data = this._frames[i];\n const rect = data.frame;\n\n if (rect)\n {\n let frame = null;\n let trim = null;\n const sourceSize = data.trimmed !== false && data.sourceSize\n ? data.sourceSize : data.frame;\n\n const orig = new Rectangle(\n 0,\n 0,\n Math.floor(sourceSize.w) / this.resolution,\n Math.floor(sourceSize.h) / this.resolution\n );\n\n if (data.rotated)\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.h) / this.resolution,\n Math.floor(rect.w) / this.resolution\n );\n }\n else\n {\n frame = new Rectangle(\n Math.floor(rect.x) / this.resolution,\n Math.floor(rect.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n // Check to see if the sprite is trimmed\n if (data.trimmed !== false && data.spriteSourceSize)\n {\n trim = new Rectangle(\n Math.floor(data.spriteSourceSize.x) / this.resolution,\n Math.floor(data.spriteSourceSize.y) / this.resolution,\n Math.floor(rect.w) / this.resolution,\n Math.floor(rect.h) / this.resolution\n );\n }\n\n this.textures[i] = new Texture(\n this.baseTexture,\n frame,\n orig,\n trim,\n data.rotated ? 2 : 0,\n data.anchor\n );\n\n // lets also add the frame to pixi's global cache for 'from' and 'fromLoader' functions\n Texture.addToCache(this.textures[i], i);\n }\n\n frameIndex++;\n }\n }\n\n /** Parse animations config. */\n private _processAnimations(): void\n {\n const animations = this.data.animations || {};\n\n for (const animName in animations)\n {\n this.animations[animName] = [];\n for (let i = 0; i < animations[animName].length; i++)\n {\n const frameName = animations[animName][i];\n\n this.animations[animName].push(this.textures[frameName]);\n }\n }\n }\n\n /** The parse has completed. */\n private _parseComplete(): void\n {\n const callback = this._callback;\n\n this._callback = null;\n this._batchIndex = 0;\n callback.call(this, this.textures);\n }\n\n /** Begin the next batch of textures. */\n private _nextBatch(): void\n {\n this._processFrames(this._batchIndex * Spritesheet.BATCH_SIZE);\n this._batchIndex++;\n setTimeout(() =>\n {\n if (this._batchIndex * Spritesheet.BATCH_SIZE < this._frameKeys.length)\n {\n this._nextBatch();\n }\n else\n {\n this._processAnimations();\n this._parseComplete();\n }\n }, 0);\n }\n\n /**\n * Destroy Spritesheet and don't use after this.\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n public destroy(destroyBase = false): void\n {\n for (const i in this.textures)\n {\n this.textures[i].destroy();\n }\n this._frames = null;\n this._frameKeys = null;\n this.data = null;\n this.textures = null;\n if (destroyBase)\n {\n this._texture?.destroy();\n this.baseTexture.destroy();\n }\n this._texture = null;\n this.baseTexture = null;\n }\n}\n\n/**\n * Reference to Spritesheet object created.\n * @member {PIXI.Spritesheet} spritesheet\n * @memberof PIXI.LoaderResource\n * @instance\n */\n\n/**\n * Dictionary of textures from Spritesheet.\n * @member {object} textures\n * @memberof PIXI.LoaderResource\n * @instance\n */\n","import { url } from '@pixi/utils';\nimport { Spritesheet } from './Spritesheet';\nimport { LoaderResource } from '@pixi/loaders';\nimport type { Loader } from '@pixi/loaders';\n\n/**\n * {@link PIXI.Loader} middleware for loading texture atlases that have been created with\n * TexturePacker or similar JSON-based spritesheet.\n *\n * This middleware automatically generates Texture resources.\n *\n * If you're using Webpack or other bundlers and plan on bundling the atlas' JSON,\n * use the {@link PIXI.Spritesheet} class to directly parse the JSON.\n *\n * The Loader's image Resource name is automatically appended with `\"_image\"`.\n * If a Resource with this name is already loaded, the Loader will skip parsing the\n * Spritesheet. The code below will generate an internal Loader Resource called `\"myatlas_image\"`.\n *\n * @example\n * loader.add('myatlas', 'path/to/myatlas.json');\n * loader.load(() => {\n * loader.resources.myatlas; // atlas JSON resource\n * loader.resources.myatlas_image; // atlas Image resource\n * });\n *\n * @memberof PIXI\n */\nexport class SpritesheetLoader\n{\n /**\n * Called after a resource is loaded.\n *\n * @see PIXI.Loader.loaderMiddleware\n * @param resource\n * @param next\n */\n static use(resource: LoaderResource, next: (...args: unknown[]) => void): void\n {\n // because this is middleware, it execute in loader context. `this` = loader\n const loader = (this as any) as Loader;\n const imageResourceName = `${resource.name}_image`;\n\n // skip if no data, its not json, it isn't spritesheet data, or the image resource already exists\n if (!resource.data\n || resource.type !== LoaderResource.TYPE.JSON\n || !resource.data.frames\n || loader.resources[imageResourceName]\n )\n {\n next();\n\n return;\n }\n\n // Check and add the multi atlas\n // Heavily influenced and based on https://github.com/rocket-ua/pixi-tps-loader/blob/master/src/ResourceLoader.js\n // eslint-disable-next-line camelcase\n const multiPacks = resource.data?.meta?.related_multi_packs;\n\n if (Array.isArray(multiPacks))\n {\n for (const item of multiPacks)\n {\n if (typeof item !== 'string')\n {\n continue;\n }\n\n const itemName = item.replace('.json', '');\n const itemUrl = url.resolve(resource.url.replace(loader.baseUrl, ''), item);\n\n // Check if the file wasn't already added as multipacks are redundant\n if (loader.resources[itemName]\n || Object.values(loader.resources).some((r) => url.format(url.parse(r.url)) === itemUrl))\n {\n continue;\n }\n\n const options = {\n crossOrigin: resource.crossOrigin,\n loadType: LoaderResource.LOAD_TYPE.XHR,\n xhrType: LoaderResource.XHR_RESPONSE_TYPE.JSON,\n parentResource: resource,\n metadata: resource.metadata\n };\n\n loader.add(itemName, itemUrl, options);\n }\n }\n\n const loadOptions = {\n crossOrigin: resource.crossOrigin,\n metadata: resource.metadata.imageMetadata,\n parentResource: resource,\n };\n\n const resourcePath = SpritesheetLoader.getResourcePath(resource, loader.baseUrl);\n\n // load the image for this sheet\n loader.add(imageResourceName, resourcePath, loadOptions, function onImageLoad(res: LoaderResource)\n {\n if (res.error)\n {\n next(res.error);\n\n return;\n }\n\n const spritesheet = new Spritesheet(\n res.texture,\n resource.data,\n resource.url\n );\n\n spritesheet.parse(() =>\n {\n resource.spritesheet = spritesheet;\n resource.textures = spritesheet.textures;\n next();\n });\n });\n }\n\n /**\n * Get the spritesheets root path\n *\n * @param resource - Resource to check path\n * @param baseUrl - Base root url\n */\n static getResourcePath(resource: LoaderResource, baseUrl: string): string\n {\n // Prepend url path unless the resource image is a data url\n if (resource.isDataUrl)\n {\n return resource.data.meta.image;\n }\n\n return url.resolve(resource.url.replace(baseUrl, ''), resource.data.meta.image);\n }\n}\n","import { TilingSprite } from '@pixi/sprite-tiling';\nimport { canvasUtils } from '@pixi/canvas-renderer';\nimport { CanvasRenderTarget } from '@pixi/utils';\nimport { Matrix, Point } from '@pixi/math';\n\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\nconst worldMatrix = new Matrix();\nconst patternMatrix = new Matrix();\nconst patternRect = [new Point(), new Point(), new Point(), new Point()];\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @protected\n * @function _renderCanvas\n * @memberof PIXI.TilingSprite#\n * @param {PIXI.CanvasRenderer} renderer - a reference to the canvas renderer\n */\nTilingSprite.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n const texture = this._texture;\n\n if (!texture.baseTexture.valid)\n {\n return;\n }\n\n const context = renderer.context;\n const transform = this.worldTransform;\n const baseTexture = texture.baseTexture;\n const source = baseTexture.getDrawableSource();\n const baseTextureResolution = baseTexture.resolution;\n\n // create a nice shiny pattern!\n if (this._textureID !== this._texture._updateID || this._cachedTint !== this.tint)\n {\n this._textureID = this._texture._updateID;\n // cut an object from a spritesheet..\n const tempCanvas = new CanvasRenderTarget(texture._frame.width,\n texture._frame.height,\n baseTextureResolution);\n\n // Tint the tiling sprite\n if (this.tint !== 0xFFFFFF)\n {\n this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint) as HTMLCanvasElement;\n tempCanvas.context.drawImage(this._tintedCanvas, 0, 0);\n }\n else\n {\n tempCanvas.context.drawImage(source,\n -texture._frame.x * baseTextureResolution, -texture._frame.y * baseTextureResolution);\n }\n this._cachedTint = this.tint;\n this._canvasPattern = tempCanvas.context.createPattern(tempCanvas.canvas, 'repeat');\n }\n\n // set context state..\n context.globalAlpha = this.worldAlpha;\n renderer.setBlendMode(this.blendMode);\n\n this.tileTransform.updateLocalTransform();\n const lt = this.tileTransform.localTransform;\n const W = this._width;\n const H = this._height;\n\n /*\n * # Implementation Notes\n *\n * The tiling transform is not simply a transform on the tiling sprite's local space. If that\n * were, the bounds of the tiling sprite would change. Rather the tile transform is a transform\n * on the \"pattern\" coordinates each vertex is assigned.\n *\n * To implement the `tileTransform`, we issue drawing commands in the pattern's own space, which\n * is defined as:\n *\n * Pattern_Space = Local_Space x inverse(tileTransform)\n *\n * In other words,\n * Local_Space = Pattern_Space x tileTransform\n *\n * We draw the pattern in pattern space, because the space we draw in defines the pattern's coordinates.\n * In other words, the pattern will always \"originate\" from (0, 0) in the space we draw in.\n *\n * This technique is equivalent to drawing a pattern texture, and then finding a quadrilateral that becomes\n * the tiling sprite's local bounds under the tileTransform and mapping that onto the screen.\n *\n * ## uvRespectAnchor\n *\n * The preceding paragraph discusses the case without considering `uvRespectAnchor`. The `uvRespectAnchor` flags\n * where the origin of the pattern space is. Assuming the tileTransform includes no translation, without\n * loss of generality: If uvRespectAnchor = true, then\n *\n * Local Space (0, 0) <--> Pattern Space (0, 0) (where <--> means \"maps to\")\n *\n * Here the mapping is provided by trivially by the tileTransform (note tileTransform includes no translation. That\n * means the invariant under all other transforms are the origins)\n *\n * Otherwise,\n *\n * Local Space (-localBounds.x, -localBounds.y) <--> Pattern Space (0, 0)\n *\n * Here the mapping is provided by the tileTransfrom PLUS some \"shift\". This shift is done POST-tileTransform. The shift\n * is equal to the position of the top-left corner of the tiling sprite in its local space.\n *\n * Hence,\n *\n * Local_Space = Pattern_Space x tileTransform x shiftTransform\n */\n\n // worldMatrix is used to convert from pattern space to world space.\n //\n // worldMatrix = tileTransform x shiftTransform x worldTransfrom\n // = patternMatrix x worldTransform\n worldMatrix.identity();\n\n // patternMatrix is used to convert from pattern space to local space. The drawing commands are issued in pattern space\n // and this matrix is used to inverse-map the local space vertices into it.\n //\n // patternMatrix = tileTransfrom x shiftTransform\n patternMatrix.copyFrom(lt);\n\n // Apply shiftTransform into patternMatrix. See $1.1\n if (!this.uvRespectAnchor)\n {\n patternMatrix.translate(-this.anchor.x * W, -this.anchor.y * H);\n }\n\n worldMatrix.prepend(patternMatrix);\n worldMatrix.prepend(transform);\n\n renderer.setContextTransform(worldMatrix);\n\n // Fill the pattern!\n context.fillStyle = this._canvasPattern;\n\n // The position in local space we are drawing the rectangle: (lx, ly, lx + W, ly + H)\n const lx = this.anchor.x * -W;\n const ly = this.anchor.y * -H;\n\n // Set pattern rect in local space first.\n patternRect[0].set(lx, ly);\n patternRect[1].set(lx + W, ly);\n patternRect[2].set(lx + W, ly + H);\n patternRect[3].set(lx, ly + H);\n\n // Map patternRect into pattern space.\n for (let i = 0; i < 4; i++)\n {\n patternMatrix.applyInverse(patternRect[i], patternRect[i]);\n }\n\n /*\n * # Note about verification of theory\n *\n * As discussed in the implementation notes, you can verify that `patternRect[0]` will always be (0, 0) in case of\n * `uvRespectAnchor` false and tileTransform having no translation. Indeed, because the pattern origin should map\n * to the top-left corner of the tiling sprite in its local space.\n */\n\n context.beginPath();\n context.moveTo(patternRect[0].x, patternRect[0].y);\n\n for (let i = 1; i < 4; i++)\n {\n context.lineTo(patternRect[i].x, patternRect[i].y);\n }\n\n context.closePath();\n context.fill();\n};\n","import { ObjectRenderer, Shader, State, QuadUv } from '@pixi/core';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba, correctBlendMode } from '@pixi/utils';\n\nimport fragmentSimpleSrc from './sprite-tiling-simple.frag';\nimport gl1VertexSrc from './sprite-tiling-fallback.vert';\nimport gl1FragmentSrc from './sprite-tiling-fallback.frag';\nimport gl2VertexSrc from './sprite-tiling.vert';\nimport gl2FragmentSrc from './sprite-tiling.frag';\n\nimport type { Renderer } from '@pixi/core';\nimport type { TilingSprite } from './TilingSprite';\n\nconst tempMat = new Matrix();\n\n/**\n * WebGL renderer plugin for tiling sprites\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.ObjectRenderer\n */\nexport class TilingSpriteRenderer extends ObjectRenderer\n{\n public shader: Shader;\n public simpleShader: Shader;\n public quad: QuadUv;\n public readonly state: State;\n\n /**\n * constructor for renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer this tiling awesomeness works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n // WebGL version is not available during initialization!\n renderer.runners.contextChange.add(this);\n\n this.quad = new QuadUv();\n\n /**\n * The WebGL state in which this renderer will work.\n *\n * @member {PIXI.State}\n * @readonly\n */\n this.state = State.for2d();\n }\n\n /**\n * Creates shaders when context is initialized.\n */\n contextChange(): void\n {\n const renderer = this.renderer;\n const uniforms = { globals: renderer.globalUniforms };\n\n this.simpleShader = Shader.from(gl1VertexSrc, fragmentSimpleSrc, uniforms);\n this.shader = renderer.context.webGLVersion > 1\n ? Shader.from(gl2VertexSrc, gl2FragmentSrc, uniforms)\n : Shader.from(gl1VertexSrc, gl1FragmentSrc, uniforms);\n }\n\n /**\n * @param {PIXI.TilingSprite} ts - tilingSprite to be rendered\n */\n public render(ts: TilingSprite): void\n {\n const renderer = this.renderer;\n const quad = this.quad;\n\n let vertices = quad.vertices;\n\n vertices[0] = vertices[6] = (ts._width) * -ts.anchor.x;\n vertices[1] = vertices[3] = ts._height * -ts.anchor.y;\n\n vertices[2] = vertices[4] = (ts._width) * (1.0 - ts.anchor.x);\n vertices[5] = vertices[7] = ts._height * (1.0 - ts.anchor.y);\n\n const anchorX = ts.uvRespectAnchor ? ts.anchor.x : 0;\n const anchorY = ts.uvRespectAnchor ? ts.anchor.y : 0;\n\n vertices = quad.uvs;\n\n vertices[0] = vertices[6] = -anchorX;\n vertices[1] = vertices[3] = -anchorY;\n\n vertices[2] = vertices[4] = 1.0 - anchorX;\n vertices[5] = vertices[7] = 1.0 - anchorY;\n\n quad.invalidate();\n\n const tex = ts._texture;\n const baseTex = tex.baseTexture;\n const lt = ts.tileTransform.localTransform;\n const uv = ts.uvMatrix;\n let isSimple = baseTex.isPowerOfTwo\n && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;\n\n // auto, force repeat wrapMode for big tiling textures\n if (isSimple)\n {\n if (!baseTex._glTextures[renderer.CONTEXT_UID])\n {\n if (baseTex.wrapMode === WRAP_MODES.CLAMP)\n {\n baseTex.wrapMode = WRAP_MODES.REPEAT;\n }\n }\n else\n {\n isSimple = baseTex.wrapMode !== WRAP_MODES.CLAMP;\n }\n }\n\n const shader = isSimple ? this.simpleShader : this.shader;\n\n const w = tex.width;\n const h = tex.height;\n const W = ts._width;\n const H = ts._height;\n\n tempMat.set(lt.a * w / W,\n lt.b * w / H,\n lt.c * h / W,\n lt.d * h / H,\n lt.tx / W,\n lt.ty / H);\n\n // that part is the same as above:\n // tempMat.identity();\n // tempMat.scale(tex.width, tex.height);\n // tempMat.prepend(lt);\n // tempMat.scale(1.0 / ts._width, 1.0 / ts._height);\n\n tempMat.invert();\n if (isSimple)\n {\n tempMat.prepend(uv.mapCoord);\n }\n else\n {\n shader.uniforms.uMapCoord = uv.mapCoord.toArray(true);\n shader.uniforms.uClampFrame = uv.uClampFrame;\n shader.uniforms.uClampOffset = uv.uClampOffset;\n }\n\n shader.uniforms.uTransform = tempMat.toArray(true);\n shader.uniforms.uColor = premultiplyTintToRgba(ts.tint, ts.worldAlpha,\n shader.uniforms.uColor, baseTex.alphaMode as any);\n shader.uniforms.translationMatrix = ts.transform.worldTransform.toArray(true);\n shader.uniforms.uSampler = tex;\n\n renderer.shader.bind(shader);\n renderer.geometry.bind(quad);\n\n this.state.blendMode = correctBlendMode(ts.blendMode, baseTex.alphaMode as any);\n renderer.state.set(this.state);\n renderer.geometry.draw(this.renderer.gl.TRIANGLES, 6, 0);\n }\n}\n","/* eslint-disable max-len */\n\n/**\n * Normalized parsed data from .fnt files.\n *\n * @memberof PIXI\n */\nexport class BitmapFontData\n{\n /** @readonly */\n public info: IBitmapFontDataInfo[];\n\n /** @readonly */\n public common: IBitmapFontDataCommon[];\n\n /** @readonly */\n public page: IBitmapFontDataPage[];\n\n /** @readonly */\n public char: IBitmapFontDataChar[];\n\n /** @readonly */\n public kerning: IBitmapFontDataKerning[];\n\n /** @readonly */\n public distanceField: IBitmapFontDataDistanceField[];\n\n constructor()\n {\n this.info = [];\n this.common = [];\n this.page = [];\n this.char = [];\n this.kerning = [];\n this.distanceField = [];\n }\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataInfo {\n /** Font face */\n face: string;\n\n /** Font size */\n size: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataCommon {\n /** Line height, in pixels. */\n lineHeight: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataPage {\n /** Unique id for bitmap texture */\n id: number;\n\n /** File name */\n file: string;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataChar {\n /** Unique id of character */\n id: number;\n\n /** {@link PIXI.IBitmapFontDataPage} id */\n page: number;\n\n /** x-position of character in page. */\n x: number;\n\n /** y-position of character in page. */\n y: number;\n\n /** Width of character in page. */\n width: number;\n\n /** Height of character in page. */\n height: number;\n\n /** x-offset to apply when rendering character */\n xoffset: number;\n\n /** y-offset to apply when rendering character. */\n yoffset: number;\n\n /** Advancement to apply to next character. */\n xadvance: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataKerning {\n /** First character of pair */\n first: number;\n\n /** Second character of pair */\n second: number;\n\n /** x-offset to apply between first & second characters when they are next to each other. */\n amount: number;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontDataDistanceField {\n /** Type of distance field */\n fieldType: string;\n\n /** Range of distance */\n distanceRange: number;\n}\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * Internal data format used to convert to BitmapFontData.\n * @private\n */\ninterface IBitmapFontRawData {\n info: {\n face: string;\n size: string;\n }[];\n common: { lineHeight: string }[];\n page: {\n id: string;\n file: string;\n }[];\n chars: {\n count: number;\n }[];\n char: {\n id: string;\n page: string;\n x: string;\n y: string;\n width: string;\n height: string;\n xoffset: string;\n yoffset: string;\n xadvance: string;\n }[];\n kernings?: {\n count: number;\n }[];\n kerning?: {\n first: string;\n second: string;\n amount: string;\n }[];\n distanceField?: {\n fieldType: string;\n distanceRange: string;\n }[]\n}\n\n/**\n * BitmapFont format that's Text-based.\n *\n * @private\n */\nexport class TextFormat\n{\n /**\n * Check if resource refers to txt font data.\n *\n * @param data\n * @return - True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return typeof data === 'string' && data.indexOf('info face=') === 0;\n }\n\n /**\n * Convert text font data to a javascript object.\n *\n * @param txt - Raw string data to be converted\n * @return - Parsed font data\n */\n static parse(txt: string): BitmapFontData\n {\n // Retrieve data item\n const items = txt.match(/^[a-z]+\\s+.+$/gm);\n const rawData: IBitmapFontRawData = {\n info: [],\n common: [],\n page: [],\n char: [],\n chars: [],\n kerning: [],\n kernings: [],\n distanceField: [],\n };\n\n for (const i in items)\n {\n // Extract item name\n const name = items[i].match(/^[a-z]+/gm)[0] as keyof BitmapFontData;\n\n // Extract item attribute list as string ex.: \"width=10\"\n const attributeList = items[i].match(/[a-zA-Z]+=([^\\s\"']+|\"([^\"]*)\")/gm);\n\n // Convert attribute list into an object\n const itemData: any = {};\n\n for (const i in attributeList)\n {\n // Split key-value pairs\n const split = attributeList[i].split('=');\n const key = split[0];\n\n // Remove eventual quotes from value\n const strValue = split[1].replace(/\"/gm, '');\n\n // Try to convert value into float\n const floatValue = parseFloat(strValue);\n\n // Use string value case float value is NaN\n const value = isNaN(floatValue) ? strValue : floatValue;\n\n itemData[key] = value;\n }\n\n // Push current item to the resulting data\n rawData[name].push(itemData);\n }\n\n const font = new BitmapFontData();\n\n rawData.info.forEach((info) => font.info.push({\n face: info.face,\n size: parseInt(info.size, 10),\n }));\n\n rawData.common.forEach((common) => font.common.push({\n lineHeight: parseInt(common.lineHeight, 10),\n }));\n\n rawData.page.forEach((page) => font.page.push({\n id: parseInt(page.id, 10),\n file: page.file,\n }));\n\n rawData.char.forEach((char) => font.char.push({\n id: parseInt(char.id, 10),\n page: parseInt(char.page, 10),\n x: parseInt(char.x, 10),\n y: parseInt(char.y, 10),\n width: parseInt(char.width, 10),\n height: parseInt(char.height, 10),\n xoffset: parseInt(char.xoffset, 10),\n yoffset: parseInt(char.yoffset, 10),\n xadvance: parseInt(char.xadvance, 10),\n }));\n\n rawData.kerning.forEach((kerning) => font.kerning.push({\n first: parseInt(kerning.first, 10),\n second: parseInt(kerning.second, 10),\n amount: parseInt(kerning.amount, 10),\n }));\n\n rawData.distanceField.forEach((df) => font.distanceField.push({\n distanceRange: parseInt(df.distanceRange, 10),\n fieldType: df.fieldType,\n }));\n\n return font;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @private\n */\nexport class XMLFormat\n{\n /**\n * Check if resource refers to xml font data.\n *\n * @param data\n * @return - True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n return data instanceof XMLDocument\n && data.getElementsByTagName('page').length\n && data.getElementsByTagName('info')[0].getAttribute('face') !== null;\n }\n\n /**\n * Convert the XML into BitmapFontData that we can use.\n *\n * @param xml\n * @return - Data to use for BitmapFont\n */\n static parse(xml: XMLDocument): BitmapFontData\n {\n const data = new BitmapFontData();\n const info = xml.getElementsByTagName('info');\n const common = xml.getElementsByTagName('common');\n const page = xml.getElementsByTagName('page');\n const char = xml.getElementsByTagName('char');\n const kerning = xml.getElementsByTagName('kerning');\n const distanceField = xml.getElementsByTagName('distanceField');\n\n for (let i = 0; i < info.length; i++)\n {\n data.info.push({\n face: info[i].getAttribute('face'),\n size: parseInt(info[i].getAttribute('size'), 10),\n });\n }\n\n for (let i = 0; i < common.length; i++)\n {\n data.common.push({\n lineHeight: parseInt(common[i].getAttribute('lineHeight'), 10),\n });\n }\n\n for (let i = 0; i < page.length; i++)\n {\n data.page.push({\n id: parseInt(page[i].getAttribute('id'), 10) || 0,\n file: page[i].getAttribute('file'),\n });\n }\n\n for (let i = 0; i < char.length; i++)\n {\n const letter = char[i];\n\n data.char.push({\n id: parseInt(letter.getAttribute('id'), 10),\n page: parseInt(letter.getAttribute('page'), 10) || 0,\n x: parseInt(letter.getAttribute('x'), 10),\n y: parseInt(letter.getAttribute('y'), 10),\n width: parseInt(letter.getAttribute('width'), 10),\n height: parseInt(letter.getAttribute('height'), 10),\n xoffset: parseInt(letter.getAttribute('xoffset'), 10),\n yoffset: parseInt(letter.getAttribute('yoffset'), 10),\n xadvance: parseInt(letter.getAttribute('xadvance'), 10),\n });\n }\n\n for (let i = 0; i < kerning.length; i++)\n {\n data.kerning.push({\n first: parseInt(kerning[i].getAttribute('first'), 10),\n second: parseInt(kerning[i].getAttribute('second'), 10),\n amount: parseInt(kerning[i].getAttribute('amount'), 10),\n });\n }\n\n for (let i = 0; i < distanceField.length; i++)\n {\n data.distanceField.push({\n fieldType: distanceField[i].getAttribute('fieldType'),\n distanceRange: parseInt(distanceField[i].getAttribute('distanceRange'), 10),\n });\n }\n\n return data;\n }\n}\n","import { BitmapFontData } from '../BitmapFontData';\nimport { XMLFormat } from './XMLFormat';\n\n/**\n * BitmapFont format that's XML-based.\n *\n * @private\n */\nexport class XMLStringFormat\n{\n /**\n * Check if resource refers to text xml font data.\n *\n * @param data\n * @return - True if resource could be treated as font data, false otherwise.\n */\n static test(data: unknown): boolean\n {\n if (typeof data === 'string' && data.indexOf('') > -1)\n {\n const xml = new self.DOMParser().parseFromString(data, 'text/xml');\n\n return XMLFormat.test(xml);\n }\n\n return false;\n }\n\n /**\n * Convert the text XML into BitmapFontData that we can use.\n *\n * @param xmlTxt\n * @return - Data to use for BitmapFont\n */\n static parse(xmlTxt: string): BitmapFontData\n {\n const xml = new self.DOMParser().parseFromString(xmlTxt, 'text/xml');\n\n return XMLFormat.parse(xml);\n }\n}\n","import { TextFormat } from './TextFormat';\nimport { XMLFormat } from './XMLFormat';\nimport { XMLStringFormat } from './XMLStringFormat';\n\n// Registered formats, maybe make this extensible in the future?\nconst formats = [\n TextFormat,\n XMLFormat,\n XMLStringFormat,\n] as const;\n\n/**\n * Auto-detect BitmapFont parsing format based on data.\n * @private\n * @param {any} data - Data to detect format\n * @return {any} Format or null\n */\nexport function autoDetectFormat(data: unknown): typeof formats[number] | null\n{\n for (let i = 0; i < formats.length; i++)\n {\n if (formats[i].test(data))\n {\n return formats[i];\n }\n }\n\n return null;\n}\n","import { generateFillStyle } from './generateFillStyle';\nimport { hex2rgb, string2hex } from '@pixi/utils';\nimport type { TextMetrics, TextStyle } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w drawGlyph & Text#updateText\n\n/**\n * Draws the glyph `metrics.text` on the given canvas.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {HTMLCanvasElement} canvas\n * @param {CanvasRenderingContext2D} context\n * @param {TextMetrics} metrics\n * @param {number} x\n * @param {number} y\n * @param {number} resolution\n * @param {TextStyle} style\n */\nexport function drawGlyph(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n metrics: TextMetrics,\n x: number,\n y: number,\n resolution: number,\n style: TextStyle\n): void\n{\n const char = metrics.text;\n const fontProperties = metrics.fontProperties;\n\n context.translate(x, y);\n context.scale(resolution, resolution);\n\n const tx = style.strokeThickness / 2;\n const ty = -(style.strokeThickness / 2);\n\n context.font = style.toFontString();\n context.lineWidth = style.strokeThickness;\n context.textBaseline = style.textBaseline;\n context.lineJoin = style.lineJoin;\n context.miterLimit = style.miterLimit;\n\n // set canvas text styles\n context.fillStyle = generateFillStyle(canvas, context, style, resolution, [char], metrics);\n context.strokeStyle = style.stroke as string;\n\n const dropShadowColor = style.dropShadowColor;\n const rgb = hex2rgb(typeof dropShadowColor === 'number' ? dropShadowColor : string2hex(dropShadowColor));\n\n if (style.dropShadow)\n {\n context.shadowColor = `rgba(${rgb[0] * 255},${rgb[1] * 255},${rgb[2] * 255},${style.dropShadowAlpha})`;\n context.shadowBlur = style.dropShadowBlur;\n context.shadowOffsetX = Math.cos(style.dropShadowAngle) * style.dropShadowDistance;\n context.shadowOffsetY = Math.sin(style.dropShadowAngle) * style.dropShadowDistance;\n }\n else\n {\n context.shadowColor = 'black';\n context.shadowBlur = 0;\n context.shadowOffsetX = 0;\n context.shadowOffsetY = 0;\n }\n\n if (style.stroke && style.strokeThickness)\n {\n context.strokeText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n if (style.fill)\n {\n context.fillText(char, tx, ty + metrics.lineHeight - fontProperties.descent);\n }\n\n context.setTransform(1, 0, 0, 1, 0, 0); // defaults needed for older browsers (e.g. Opera 29)\n\n context.fillStyle = 'rgba(0, 0, 0, 0)';\n}\n","import { TextStyle, TextMetrics, TEXT_GRADIENT } from '@pixi/text';\n\n// TODO: Prevent code duplication b/w generateFillStyle & Text#generateFillStyle\n\n/**\n * Generates the fill style. Can automatically generate a gradient based on the fill style being an array\n *\n * @private\n * @param {object} style - The style.\n * @param {string[]} lines - The lines of text.\n * @return {string|number|CanvasGradient} The fill style\n */\nexport function generateFillStyle(\n canvas: HTMLCanvasElement,\n context: CanvasRenderingContext2D,\n style: TextStyle,\n resolution: number,\n lines: string[],\n metrics: TextMetrics\n): string|CanvasGradient|CanvasPattern\n{\n // TODO: Can't have different types for getter and setter. The getter shouldn't have the number type as\n // the setter converts to string. See this thread for more details:\n // https://github.com/microsoft/TypeScript/issues/2521\n const fillStyle: string|string[]|CanvasGradient|CanvasPattern = style.fill as any;\n\n if (!Array.isArray(fillStyle))\n {\n return fillStyle;\n }\n else if (fillStyle.length === 1)\n {\n return fillStyle[0];\n }\n\n // the gradient will be evenly spaced out according to how large the array is.\n // ['#FF0000', '#00FF00', '#0000FF'] would created stops at 0.25, 0.5 and 0.75\n let gradient: string[]|CanvasGradient;\n\n // a dropshadow will enlarge the canvas and result in the gradient being\n // generated with the incorrect dimensions\n const dropShadowCorrection = (style.dropShadow) ? style.dropShadowDistance : 0;\n\n // should also take padding into account, padding can offset the gradient\n const padding = style.padding || 0;\n\n const width = (canvas.width / resolution) - dropShadowCorrection - (padding * 2);\n const height = (canvas.height / resolution) - dropShadowCorrection - (padding * 2);\n\n // make a copy of the style settings, so we can manipulate them later\n const fill = fillStyle.slice();\n const fillGradientStops = style.fillGradientStops.slice();\n\n // wanting to evenly distribute the fills. So an array of 4 colours should give fills of 0.25, 0.5 and 0.75\n if (!fillGradientStops.length)\n {\n const lengthPlus1 = fill.length + 1;\n\n for (let i = 1; i < lengthPlus1; ++i)\n {\n fillGradientStops.push(i / lengthPlus1);\n }\n }\n\n // stop the bleeding of the last gradient on the line above to the top gradient of the this line\n // by hard defining the first gradient colour at point 0, and last gradient colour at point 1\n fill.unshift(fillStyle[0]);\n fillGradientStops.unshift(0);\n\n fill.push(fillStyle[fillStyle.length - 1]);\n fillGradientStops.push(1);\n\n if (style.fillGradientType === TEXT_GRADIENT.LINEAR_VERTICAL)\n {\n // start the gradient at the top center of the canvas, and end at the bottom middle of the canvas\n gradient = context.createLinearGradient(width / 2, padding, width / 2, height + padding);\n\n // we need to repeat the gradient so that each individual line of text has the same vertical gradient effect\n // ['#FF0000', '#00FF00', '#0000FF'] over 2 lines would create stops at 0.125, 0.25, 0.375, 0.625, 0.75, 0.875\n\n // There's potential for floating point precision issues at the seams between gradient repeats.\n // The loop below generates the stops in order, so track the last generated one to prevent\n // floating point precision from making us go the teeniest bit backwards, resulting in\n // the first and last colors getting swapped.\n let lastIterationStop = 0;\n\n // Actual height of the text itself, not counting spacing for lineHeight/leading/dropShadow etc\n const textHeight = metrics.fontProperties.fontSize + style.strokeThickness;\n\n // textHeight, but as a 0-1 size in global gradient stop space\n const gradStopLineHeight = textHeight / height;\n\n for (let i = 0; i < lines.length; i++)\n {\n const thisLineTop = metrics.lineHeight * i;\n\n for (let j = 0; j < fill.length; j++)\n {\n // 0-1 stop point for the current line, multiplied to global space afterwards\n let lineStop = 0;\n\n if (typeof fillGradientStops[j] === 'number')\n {\n lineStop = fillGradientStops[j];\n }\n else\n {\n lineStop = j / fill.length;\n }\n\n const globalStop = (thisLineTop / height) + (lineStop * gradStopLineHeight);\n\n // Prevent color stop generation going backwards from floating point imprecision\n let clampedStop = Math.max(lastIterationStop, globalStop);\n\n clampedStop = Math.min(clampedStop, 1); // Cap at 1 as well for safety's sake to avoid a possible throw.\n gradient.addColorStop(clampedStop, fill[j]);\n lastIterationStop = clampedStop;\n }\n }\n }\n else\n {\n // start the gradient at the center left of the canvas, and end at the center right of the canvas\n gradient = context.createLinearGradient(padding, height / 2, width + padding, height / 2);\n\n // can just evenly space out the gradients in this case, as multiple lines makes no difference\n // to an even left to right gradient\n const totalIterations = fill.length + 1;\n let currentIteration = 1;\n\n for (let i = 0; i < fill.length; i++)\n {\n let stop: number;\n\n if (typeof fillGradientStops[i] === 'number')\n {\n stop = fillGradientStops[i];\n }\n else\n {\n stop = currentIteration / totalIterations;\n }\n gradient.addColorStop(stop, fill[i]);\n currentIteration++;\n }\n }\n\n return gradient;\n}\n","/**\n * Ponyfill for IE because it doesn't support `Array.from`\n * @private\n */\nexport function splitTextToCharacters(text: string): string[]\n{\n return Array.from ? Array.from(text) : text.split('');\n}\n","/**\n * Ponyfill for IE because it doesn't support `codePointAt`\n * @private\n */\nexport function extractCharCode(str: string): number\n{\n return str.codePointAt ? str.codePointAt(0) : str.charCodeAt(0);\n}\n","import { getResolutionOfUrl } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { Texture, BaseTexture } from '@pixi/core';\nimport { TextStyle, TextMetrics } from '@pixi/text';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFontData } from './BitmapFontData';\nimport { resolveCharacters, drawGlyph, extractCharCode } from './utils';\n\nimport type { Dict } from '@pixi/utils';\nimport type { ITextStyle } from '@pixi/text';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nexport interface IBitmapFontCharacter\n{\n xOffset: number;\n yOffset: number;\n xAdvance: number;\n texture: Texture;\n page: number;\n kerning: Dict;\n}\n\n/** @memberof PIXI */\nexport interface IBitmapFontOptions\n{\n /**\n * The character set to generate.\n * @default PIXI.BitmapFont.ALPHANUMERIC\n */\n chars?: string | (string | string[])[];\n\n /**\n * The resolution for rendering.\n * @default 1\n */\n resolution?: number;\n\n /**\n * The padding between glyphs in the atlas.\n * @default 4\n */\n padding?: number;\n\n /**\n * The width of the texture atlas.\n * @default 512\n */\n textureWidth?: number;\n\n /**\n * The height of the texture atlas.\n * @default 512\n */\n textureHeight?: number;\n}\n\n/**\n * BitmapFont represents a typeface available for use with the BitmapText class. Use the `install`\n * method for adding a font to be used.\n *\n * @memberof PIXI\n */\nexport class BitmapFont\n{\n /**\n * This character set includes all the letters in the alphabet (both lower- and upper- case).\n *\n * @type {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.ALPHA })\n */\n public static readonly ALPHA = [['a', 'z'], ['A', 'Z'], ' '];\n\n /**\n * This character set includes all decimal digits (from 0 to 9).\n *\n * @type {string[][]}\n * @example\n * BitmapFont.from(\"ExampleFont\", style, { chars: BitmapFont.NUMERIC })\n */\n public static readonly NUMERIC = [['0', '9']];\n\n /**\n * This character set is the union of `BitmapFont.ALPHA` and `BitmapFont.NUMERIC`.\n *\n * @type {string[][]}\n */\n public static readonly ALPHANUMERIC = [['a', 'z'], ['A', 'Z'], ['0', '9'], ' '];\n\n /**\n * This character set consists of all the ASCII table.\n *\n * @member {string[][]}\n * @see http://www.asciitable.com/\n */\n public static readonly ASCII = [[' ', '~']];\n\n /**\n * Collection of default options when using `BitmapFont.from`.\n *\n * @property {number} resolution=1\n * @property {number} textureWidth=512\n * @property {number} textureHeight=512\n * @property {number} padding=4\n * @property {string|string[]|string[][]} chars = PIXI.BitmapFont.ALPHANUMERIC\n */\n public static readonly defaultOptions: IBitmapFontOptions = {\n resolution: 1,\n textureWidth: 512,\n textureHeight: 512,\n padding: 4,\n chars: BitmapFont.ALPHANUMERIC,\n };\n\n /** Collection of available/installed fonts. */\n public static readonly available: Dict = {};\n\n /** The name of the font face. */\n public readonly font: string;\n\n /** The size of the font face in pixels. */\n public readonly size: number;\n\n /** The line-height of the font face in pixels. */\n public readonly lineHeight: number;\n\n /** The map of characters by character code. */\n public readonly chars: Dict;\n\n /** The map of base page textures (i.e., sheets of glyphs). */\n public readonly pageTextures: Dict;\n\n /** The range of the distance field in pixels. */\n public readonly distanceFieldRange: number;\n\n /** The kind of distance field for this font or \"none\". */\n public readonly distanceFieldType: string;\n\n private _ownsTextures: boolean;\n\n /**\n * @param data\n * @param textures\n * @param ownsTextures - Setting to `true` will destroy page textures\n * when the font is uninstalled.\n */\n constructor(data: BitmapFontData, textures: Texture[]|Dict, ownsTextures?: boolean)\n {\n const [info] = data.info;\n const [common] = data.common;\n const [page] = data.page;\n const [distanceField] = data.distanceField;\n const res = getResolutionOfUrl(page.file);\n const pageTextures: Dict = {};\n\n this._ownsTextures = ownsTextures;\n this.font = info.face;\n this.size = info.size;\n this.lineHeight = common.lineHeight / res;\n this.chars = {};\n this.pageTextures = pageTextures;\n\n // Convert the input Texture, Textures or object\n // into a page Texture lookup by \"id\"\n for (let i = 0; i < data.page.length; i++)\n {\n const { id, file } = data.page[i];\n\n pageTextures[id] = textures instanceof Array\n ? textures[i] : textures[file];\n\n // only MSDF and SDF fonts need no-premultiplied-alpha\n if (distanceField?.fieldType && distanceField.fieldType !== 'none')\n {\n pageTextures[id].baseTexture.alphaMode = ALPHA_MODES.NO_PREMULTIPLIED_ALPHA;\n }\n }\n\n // parse letters\n for (let i = 0; i < data.char.length; i++)\n {\n const { id, page } = data.char[i];\n let { x, y, width, height, xoffset, yoffset, xadvance } = data.char[i];\n\n x /= res;\n y /= res;\n width /= res;\n height /= res;\n xoffset /= res;\n yoffset /= res;\n xadvance /= res;\n\n const rect = new Rectangle(\n x + (pageTextures[page].frame.x / res),\n y + (pageTextures[page].frame.y / res),\n width,\n height\n );\n\n this.chars[id] = {\n xOffset: xoffset,\n yOffset: yoffset,\n xAdvance: xadvance,\n kerning: {},\n texture: new Texture(\n pageTextures[page].baseTexture,\n rect\n ),\n page,\n };\n }\n\n // parse kernings\n for (let i = 0; i < data.kerning.length; i++)\n {\n let { first, second, amount } = data.kerning[i];\n\n first /= res;\n second /= res;\n amount /= res;\n\n if (this.chars[second])\n {\n this.chars[second].kerning[first] = amount;\n }\n }\n\n // Store distance field information\n this.distanceFieldRange = distanceField?.distanceRange;\n this.distanceFieldType = distanceField?.fieldType?.toLowerCase() ?? 'none';\n }\n\n /** Remove references to created glyph textures. */\n public destroy(): void\n {\n for (const id in this.chars)\n {\n this.chars[id].texture.destroy();\n this.chars[id].texture = null;\n }\n\n for (const id in this.pageTextures)\n {\n if (this._ownsTextures)\n {\n this.pageTextures[id].destroy(true);\n }\n\n this.pageTextures[id] = null;\n }\n\n // Set readonly null.\n (this as any).chars = null;\n (this as any).pageTextures = null;\n }\n\n /**\n * Register a new bitmap font.\n *\n * @param data - The\n * characters map that could be provided as xml or raw string.\n * @param textures - List of textures for each page.\n * @param ownsTextures - Set to `true` to destroy page textures\n * when the font is uninstalled. By default fonts created with\n * `BitmapFont.from` or from the `BitmapFontLoader` are `true`.\n * @return {PIXI.BitmapFont} Result font object with font, size, lineHeight\n * and char fields.\n */\n public static install(\n data: string|XMLDocument|BitmapFontData,\n textures: Texture|Texture[]|Dict,\n ownsTextures?: boolean\n ): BitmapFont\n {\n let fontData;\n\n if (data instanceof BitmapFontData)\n {\n fontData = data;\n }\n else\n {\n const format = autoDetectFormat(data);\n\n if (!format)\n {\n throw new Error('Unrecognized data format for font.');\n }\n\n fontData = format.parse(data as any);\n }\n\n // Single texture, convert to list\n if (textures instanceof Texture)\n {\n textures = [textures];\n }\n\n const font = new BitmapFont(fontData, textures, ownsTextures);\n\n BitmapFont.available[font.font] = font;\n\n return font;\n }\n\n /**\n * Remove bitmap font by name.\n *\n * @param name - Name of the font to uninstall.\n */\n public static uninstall(name: string): void\n {\n const font = BitmapFont.available[name];\n\n if (!font)\n {\n throw new Error(`No font found named '${name}'`);\n }\n\n font.destroy();\n delete BitmapFont.available[name];\n }\n\n /**\n * Generates a bitmap-font for the given style and character set. This does not support\n * kernings yet. With `style` properties, only the following non-layout properties are used:\n *\n * - {@link PIXI.TextStyle#dropShadow|dropShadow}\n * - {@link PIXI.TextStyle#dropShadowDistance|dropShadowDistance}\n * - {@link PIXI.TextStyle#dropShadowColor|dropShadowColor}\n * - {@link PIXI.TextStyle#dropShadowBlur|dropShadowBlur}\n * - {@link PIXI.TextStyle#dropShadowAngle|dropShadowAngle}\n * - {@link PIXI.TextStyle#fill|fill}\n * - {@link PIXI.TextStyle#fillGradientStops|fillGradientStops}\n * - {@link PIXI.TextStyle#fillGradientType|fillGradientType}\n * - {@link PIXI.TextStyle#fontFamily|fontFamily}\n * - {@link PIXI.TextStyle#fontSize|fontSize}\n * - {@link PIXI.TextStyle#fontVariant|fontVariant}\n * - {@link PIXI.TextStyle#fontWeight|fontWeight}\n * - {@link PIXI.TextStyle#lineJoin|lineJoin}\n * - {@link PIXI.TextStyle#miterLimit|miterLimit}\n * - {@link PIXI.TextStyle#stroke|stroke}\n * - {@link PIXI.TextStyle#strokeThickness|strokeThickness}\n * - {@link PIXI.TextStyle#textBaseline|textBaseline}\n *\n * @param name - The name of the custom font to use with BitmapText.\n * @param style - Style options to render with BitmapFont.\n * @param options - Setup options for font or name of the font.\n * @param {string|string[]|string[][]} [options.chars=PIXI.BitmapFont.ALPHANUMERIC] - characters included\n * in the font set. You can also use ranges. For example, `[['a', 'z'], ['A', 'Z'], \"!@#$%^&*()~{}[] \"]`.\n * Don't forget to include spaces ' ' in your character set!\n * @param {number} [options.resolution=1] - Render resolution for glyphs.\n * @param {number} [options.textureWidth=512] - Optional width of atlas, smaller values to reduce memory.\n * @param {number} [options.textureHeight=512] - Optional height of atlas, smaller values to reduce memory.\n * @param {number} [options.padding=4] - Padding between glyphs on texture atlas.\n * @return Font generated by style options.\n * @example\n * PIXI.BitmapFont.from(\"TitleFont\", {\n * fontFamily: \"Arial\",\n * fontSize: 12,\n * strokeThickness: 2,\n * fill: \"purple\"\n * });\n *\n * const title = new PIXI.BitmapText(\"This is the title\", { fontName: \"TitleFont\" });\n */\n public static from(name: string, textStyle?: TextStyle | Partial, options?: IBitmapFontOptions): BitmapFont\n {\n if (!name)\n {\n throw new Error('[BitmapFont] Property `name` is required.');\n }\n\n const {\n chars,\n padding,\n resolution,\n textureWidth,\n textureHeight } = Object.assign(\n {}, BitmapFont.defaultOptions, options);\n\n const charsList = resolveCharacters(chars);\n const style = textStyle instanceof TextStyle ? textStyle : new TextStyle(textStyle);\n const lineWidth = textureWidth;\n const fontData = new BitmapFontData();\n\n fontData.info[0] = {\n face: style.fontFamily as string,\n size: style.fontSize as number,\n };\n fontData.common[0] = {\n lineHeight: style.fontSize as number,\n };\n\n let positionX = 0;\n let positionY = 0;\n\n let canvas: HTMLCanvasElement;\n let context: CanvasRenderingContext2D;\n let baseTexture: BaseTexture;\n let maxCharHeight = 0;\n const baseTextures: BaseTexture[] = [];\n const textures: Texture[] = [];\n\n for (let i = 0; i < charsList.length; i++)\n {\n if (!canvas)\n {\n canvas = document.createElement('canvas');\n canvas.width = textureWidth;\n canvas.height = textureHeight;\n\n context = canvas.getContext('2d');\n baseTexture = new BaseTexture(canvas, { resolution });\n\n baseTextures.push(baseTexture);\n textures.push(new Texture(baseTexture));\n\n fontData.page.push({\n id: textures.length - 1,\n file: '',\n });\n }\n\n // Measure glyph dimensions\n const metrics = TextMetrics.measureText(charsList[i], style, false, canvas);\n const width = metrics.width;\n const height = Math.ceil(metrics.height);\n\n // This is ugly - but italics are given more space so they don't overlap\n const textureGlyphWidth = Math.ceil((style.fontStyle === 'italic' ? 2 : 1) * width);\n\n // Can't fit char anymore: next canvas please!\n if (positionY >= textureHeight - (height * resolution))\n {\n if (positionY === 0)\n {\n // We don't want user debugging an infinite loop (or do we? :)\n throw new Error(`[BitmapFont] textureHeight ${textureHeight}px is `\n + `too small for ${style.fontSize}px fonts`);\n }\n\n --i;\n\n // Create new atlas once current has filled up\n canvas = null;\n context = null;\n baseTexture = null;\n positionY = 0;\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n maxCharHeight = Math.max(height + metrics.fontProperties.descent, maxCharHeight);\n\n // Wrap line once full row has been rendered\n if ((textureGlyphWidth * resolution) + positionX >= lineWidth)\n {\n --i;\n positionY += maxCharHeight * resolution;\n positionY = Math.ceil(positionY);\n positionX = 0;\n maxCharHeight = 0;\n\n continue;\n }\n\n drawGlyph(canvas, context, metrics, positionX, positionY, resolution, style);\n\n // Unique (numeric) ID mapping to this glyph\n const id = extractCharCode(metrics.text);\n\n // Create a texture holding just the glyph\n fontData.char.push({\n id,\n page: textures.length - 1,\n x: positionX / resolution,\n y: positionY / resolution,\n width: textureGlyphWidth,\n height,\n xoffset: 0,\n yoffset: 0,\n xadvance: Math.ceil(width\n - (style.dropShadow ? style.dropShadowDistance : 0)\n - (style.stroke ? style.strokeThickness : 0)),\n });\n\n positionX += (textureGlyphWidth + (2 * padding)) * resolution;\n positionX = Math.ceil(positionX);\n }\n\n // Brute-force kerning info, this can be expensive b/c it's an O(n²),\n // but we're using measureText which is native and fast.\n for (let i = 0, len = charsList.length; i < len; i++)\n {\n const first = charsList[i];\n\n for (let j = 0; j < len; j++)\n {\n const second = charsList[j];\n const c1 = context.measureText(first).width;\n const c2 = context.measureText(second).width;\n const total = context.measureText(first + second).width;\n const amount = total - (c1 + c2);\n\n if (amount)\n {\n fontData.kerning.push({\n first: extractCharCode(first),\n second: extractCharCode(second),\n amount,\n });\n }\n }\n }\n\n const font = new BitmapFont(fontData, textures, true);\n\n // Make it easier to replace a font\n if (BitmapFont.available[name] !== undefined)\n {\n BitmapFont.uninstall(name);\n }\n\n BitmapFont.available[name] = font;\n\n return font;\n }\n}\n","import { splitTextToCharacters } from './splitTextToCharacters';\n\n/**\n * Processes the passed character set data and returns a flattened array of all the characters.\n *\n * Ignored because not directly exposed.\n *\n * @ignore\n * @param {string | string[] | string[][] } chars\n * @returns {string[]}\n */\nexport function resolveCharacters(chars: string | (string | string[])[]): string[]\n{\n // Split the chars string into individual characters\n if (typeof chars === 'string')\n {\n chars = [chars];\n }\n\n // Handle an array of characters+ranges\n const result: string[] = [];\n\n for (let i = 0, j = chars.length; i < j; i++)\n {\n const item = chars[i];\n\n // Handle range delimited by start/end chars\n if (Array.isArray(item))\n {\n if (item.length !== 2)\n {\n throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${item.length}.`);\n }\n\n const startCode = item[0].charCodeAt(0);\n const endCode = item[1].charCodeAt(0);\n\n if (endCode < startCode)\n {\n throw new Error('[BitmapFont]: Invalid character range.');\n }\n\n for (let i = startCode, j = endCode; i <= j; i++)\n {\n result.push(String.fromCharCode(i));\n }\n }\n // Handle a character set string\n else\n {\n result.push(...splitTextToCharacters(item));\n }\n }\n\n if (result.length === 0)\n {\n throw new Error('[BitmapFont]: Empty set when resolving characters.');\n }\n\n return result;\n}\n","import { ObservablePoint, Point } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { removeItems } from '@pixi/utils';\nimport { BitmapFont } from './BitmapFont';\nimport { splitTextToCharacters, extractCharCode } from './utils';\nimport msdfFrag from './shader/msdf.frag';\nimport msdfVert from './shader/msdf.vert';\nimport type { Rectangle } from '@pixi/math';\nimport { Program, Renderer, Texture } from '@pixi/core';\nimport type { IBitmapTextStyle } from './BitmapTextStyle';\nimport type { TextStyleAlign } from '@pixi/text';\nimport { Container } from '@pixi/display';\nimport type { IDestroyOptions } from '@pixi/display';\nimport { BLEND_MODES } from '@pixi/constants';\n\ninterface PageMeshData {\n index: number;\n indexCount: number;\n vertexCount: number;\n uvsCount: number;\n total: number;\n mesh: Mesh;\n vertices?: Float32Array;\n uvs?: Float32Array;\n indices?: Uint16Array;\n}\ninterface CharRenderData {\n texture: Texture;\n line: number;\n charCode: number;\n position: Point;\n prevSpaces: number;\n}\n\n// If we ever need more than two pools, please make a Dict or something better.\nconst pageMeshDataDefaultPageMeshData: PageMeshData[] = [];\nconst pageMeshDataMSDFPageMeshData: PageMeshData[] = [];\nconst charRenderDataPool: CharRenderData[] = [];\n\n/**\n * A BitmapText object will create a line or multiple lines of text using bitmap font.\n *\n * The primary advantage of this class over Text is that all of your textures are pre-generated and loading,\n * meaning that rendering is fast, and changing text has no performance implications.\n *\n * Supporting character sets other than latin, such as CJK languages, may be impractical due to the number of characters.\n *\n * To split a line you can use '\\n', '\\r' or '\\r\\n' in your string.\n *\n * PixiJS can auto-generate fonts on-the-fly using BitmapFont or use fnt files provided by:\n * http://www.angelcode.com/products/bmfont/ for Windows or\n * http://www.bmglyph.com/ for Mac.\n *\n * You can also use SDF, MSDF and MTSDF BitmapFonts for vector-like scaling appearance provided by:\n * https://github.com/soimy/msdf-bmfont-xml for SDF and MSDF fnt files or\n * https://github.com/Chlumsky/msdf-atlas-gen for SDF, MSDF and MTSDF json files\n *\n * A BitmapText can only be created when the font is loaded.\n *\n * ```js\n * // in this case the font is in a file called 'desyrel.fnt'\n * let bitmapText = new PIXI.BitmapText(\"text using a fancy font!\", {\n * fontName: \"Desyrel\",\n * fontSize: 35,\n * align: \"right\"\n * });\n * ```\n *\n * @memberof PIXI\n */\nexport class BitmapText extends Container\n{\n public static styleDefaults: Partial = {\n align: 'left',\n tint: 0xFFFFFF,\n maxWidth: 0,\n letterSpacing: 0,\n };\n\n /** Set to `true` if the BitmapText needs to be redrawn. */\n public dirty: boolean;\n\n /**\n * Private tracker for the width of the overall text.\n *\n * @private\n */\n protected _textWidth: number;\n\n /**\n * Private tracker for the height of the overall text.\n *\n * @private\n */\n protected _textHeight: number;\n\n /**\n * Private tracker for the current text.\n *\n * @private\n */\n protected _text: string;\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting value to 0\n *\n * @private\n */\n protected _maxWidth: number;\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * ie: when trying to vertically align. (Internally used)\n *\n * @private\n */\n protected _maxLineHeight: number;\n\n /**\n * Letter spacing. This is useful for setting the space between characters.\n *\n * @private\n */\n protected _letterSpacing: number;\n\n /**\n * Text anchor.\n *\n * @readonly\n * @private\n */\n protected _anchor: ObservablePoint;\n\n /**\n * Private tracker for the current font name.\n *\n * @private\n */\n protected _fontName: string;\n\n /**\n * Private tracker for the current font size.\n *\n * @private\n */\n protected _fontSize: number;\n\n /**\n * Private tracker for the current text align.\n *\n * @type {string}\n * @private\n */\n protected _align: TextStyleAlign;\n\n /** Collection of page mesh data. */\n protected _activePagesMeshData: PageMeshData[];\n\n /**\n * Private tracker for the current tint.\n *\n * @private\n */\n protected _tint = 0xFFFFFF;\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering.\n *\n * @default PIXI.settings.ROUND_PIXELS\n */\n protected _roundPixels: boolean;\n\n /** Cached char texture is destroyed when BitmapText is destroyed. */\n private _textureCache: Record;\n\n /**\n * @param text - A string that you would like the text to display.\n * @param style - The style parameters.\n * @param {string} style.fontName - The installed BitmapFont name.\n * @param {number} [style.fontSize] - The size of the font in pixels, e.g. 24. If undefined,\n *. this will default to the BitmapFont size.\n * @param {string} [style.align='left'] - Alignment for multiline text ('left', 'center', 'right' or 'justify'),\n * does not affect single line text.\n * @param {number} [style.tint=0xFFFFFF] - The tint color.\n * @param {number} [style.letterSpacing=0] - The amount of spacing between letters.\n * @param {number} [style.maxWidth=0] - The max width of the text before line wrapping.\n */\n constructor(text: string, style: Partial = {})\n {\n super();\n\n // Apply the defaults\n const { align, tint, maxWidth, letterSpacing, fontName, fontSize } = Object.assign(\n {}, BitmapText.styleDefaults, style);\n\n if (!BitmapFont.available[fontName])\n {\n throw new Error(`Missing BitmapFont \"${fontName}\"`);\n }\n\n this._activePagesMeshData = [];\n this._textWidth = 0;\n this._textHeight = 0;\n this._align = align;\n this._tint = tint;\n this._fontName = fontName;\n this._fontSize = fontSize || BitmapFont.available[fontName].size;\n this._text = text;\n this._maxWidth = maxWidth;\n this._maxLineHeight = 0;\n this._letterSpacing = letterSpacing;\n this._anchor = new ObservablePoint((): void => { this.dirty = true; }, this, 0, 0);\n this._roundPixels = settings.ROUND_PIXELS;\n this.dirty = true;\n this._textureCache = {};\n }\n\n /**\n * Renders text and updates it when needed. This should only be called\n * if the BitmapFont is regenerated.\n */\n public updateText(): void\n {\n const data = BitmapFont.available[this._fontName];\n const scale = this._fontSize / data.size;\n const pos = new Point();\n const chars: CharRenderData[] = [];\n const lineWidths = [];\n const lineSpaces = [];\n const text = this._text.replace(/(?:\\r\\n|\\r)/g, '\\n') || ' ';\n const charsInput = splitTextToCharacters(text);\n const maxWidth = this._maxWidth * data.size / this._fontSize;\n const pageMeshDataPool = data.distanceFieldType === 'none'\n ? pageMeshDataDefaultPageMeshData : pageMeshDataMSDFPageMeshData;\n\n let prevCharCode = null;\n let lastLineWidth = 0;\n let maxLineWidth = 0;\n let line = 0;\n let lastBreakPos = -1;\n let lastBreakWidth = 0;\n let spacesRemoved = 0;\n let maxLineHeight = 0;\n let spaceCount = 0;\n\n for (let i = 0; i < charsInput.length; i++)\n {\n const char = charsInput[i];\n const charCode = extractCharCode(char);\n\n if ((/(?:\\s)/).test(char))\n {\n lastBreakPos = i;\n lastBreakWidth = lastLineWidth;\n spaceCount++;\n }\n\n if (char === '\\r' || char === '\\n')\n {\n lineWidths.push(lastLineWidth);\n lineSpaces.push(-1);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n ++line;\n ++spacesRemoved;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n spaceCount = 0;\n continue;\n }\n\n const charData = data.chars[charCode];\n\n if (!charData)\n {\n continue;\n }\n\n if (prevCharCode && charData.kerning[prevCharCode])\n {\n pos.x += charData.kerning[prevCharCode];\n }\n\n const charRenderData: CharRenderData = charRenderDataPool.pop() || {\n texture: Texture.EMPTY,\n line: 0,\n charCode: 0,\n prevSpaces: 0,\n position: new Point(),\n };\n\n charRenderData.texture = charData.texture;\n charRenderData.line = line;\n charRenderData.charCode = charCode;\n charRenderData.position.x = pos.x + charData.xOffset + (this._letterSpacing / 2);\n charRenderData.position.y = pos.y + charData.yOffset;\n charRenderData.prevSpaces = spaceCount;\n\n chars.push(charRenderData);\n\n lastLineWidth = charRenderData.position.x + charData.texture.orig.width;// Use charRenderData position!\n pos.x += charData.xAdvance + this._letterSpacing;\n maxLineHeight = Math.max(maxLineHeight, (charData.yOffset + charData.texture.height));\n prevCharCode = charCode;\n\n if (lastBreakPos !== -1 && maxWidth > 0 && pos.x > maxWidth)\n {\n ++spacesRemoved;\n removeItems(chars, 1 + lastBreakPos - spacesRemoved, 1 + i - lastBreakPos);\n i = lastBreakPos;\n lastBreakPos = -1;\n\n lineWidths.push(lastBreakWidth);\n lineSpaces.push(chars.length > 0 ? chars[chars.length - 1].prevSpaces : 0);\n maxLineWidth = Math.max(maxLineWidth, lastBreakWidth);\n line++;\n\n pos.x = 0;\n pos.y += data.lineHeight;\n prevCharCode = null;\n spaceCount = 0;\n }\n }\n\n const lastChar = charsInput[charsInput.length - 1];\n\n if (lastChar !== '\\r' && lastChar !== '\\n')\n {\n if ((/(?:\\s)/).test(lastChar))\n {\n lastLineWidth = lastBreakWidth;\n }\n\n lineWidths.push(lastLineWidth);\n maxLineWidth = Math.max(maxLineWidth, lastLineWidth);\n lineSpaces.push(-1);\n }\n\n const lineAlignOffsets = [];\n\n for (let i = 0; i <= line; i++)\n {\n let alignOffset = 0;\n\n if (this._align === 'right')\n {\n alignOffset = maxLineWidth - lineWidths[i];\n }\n else if (this._align === 'center')\n {\n alignOffset = (maxLineWidth - lineWidths[i]) / 2;\n }\n else if (this._align === 'justify')\n {\n alignOffset = lineSpaces[i] < 0 ? 0 : (maxLineWidth - lineWidths[i]) / lineSpaces[i];\n }\n\n lineAlignOffsets.push(alignOffset);\n }\n\n const lenChars = chars.length;\n\n const pagesMeshData: Record = {};\n\n const newPagesMeshData: PageMeshData[] = [];\n\n const activePagesMeshData = this._activePagesMeshData;\n\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n pageMeshDataPool.push(activePagesMeshData[i]);\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const texture = chars[i].texture;\n const baseTextureUid = texture.baseTexture.uid;\n\n if (!pagesMeshData[baseTextureUid])\n {\n let pageMeshData = pageMeshDataPool.pop();\n\n if (!pageMeshData)\n {\n const geometry = new MeshGeometry();\n let material: MeshMaterial;\n let meshBlendMode: BLEND_MODES;\n\n if (data.distanceFieldType === 'none')\n {\n material = new MeshMaterial(Texture.EMPTY);\n meshBlendMode = BLEND_MODES.NORMAL;\n }\n else\n {\n material = new MeshMaterial(Texture.EMPTY,\n { program: Program.from(msdfVert, msdfFrag), uniforms: { uFWidth: 0 } });\n meshBlendMode = BLEND_MODES.NORMAL_NPM;\n }\n\n const mesh = new Mesh(geometry, material);\n\n mesh.blendMode = meshBlendMode;\n\n pageMeshData = {\n index: 0,\n indexCount: 0,\n vertexCount: 0,\n uvsCount: 0,\n total: 0,\n mesh,\n vertices: null,\n uvs: null,\n indices: null,\n };\n }\n\n // reset data..\n pageMeshData.index = 0;\n pageMeshData.indexCount = 0;\n pageMeshData.vertexCount = 0;\n pageMeshData.uvsCount = 0;\n pageMeshData.total = 0;\n\n // TODO need to get page texture here somehow..\n const { _textureCache } = this;\n\n _textureCache[baseTextureUid] = _textureCache[baseTextureUid] || new Texture(texture.baseTexture);\n pageMeshData.mesh.texture = _textureCache[baseTextureUid];\n\n pageMeshData.mesh.tint = this._tint;\n\n newPagesMeshData.push(pageMeshData);\n\n pagesMeshData[baseTextureUid] = pageMeshData;\n }\n\n pagesMeshData[baseTextureUid].total++;\n }\n\n // lets find any previously active pageMeshDatas that are no longer required for\n // the updated text (if any), removed and return them to the pool.\n for (let i = 0; i < activePagesMeshData.length; i++)\n {\n if (newPagesMeshData.indexOf(activePagesMeshData[i]) === -1)\n {\n this.removeChild(activePagesMeshData[i].mesh);\n }\n }\n\n // next lets add any new meshes, that have not yet been added to this BitmapText\n // we only add if its not already a child of this BitmapObject\n for (let i = 0; i < newPagesMeshData.length; i++)\n {\n if (newPagesMeshData[i].mesh.parent !== this)\n {\n this.addChild(newPagesMeshData[i].mesh);\n }\n }\n\n // active page mesh datas are set to be the new pages added.\n this._activePagesMeshData = newPagesMeshData;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n const total = pageMeshData.total;\n\n // lets only allocate new buffers if we can fit the new text in the current ones..\n // unless that is, we will be batching. Currently batching dose not respect the size property of mesh\n if (!(pageMeshData.indices?.length > 6 * total) || pageMeshData.vertices.length < Mesh.BATCHABLE_SIZE * 2)\n {\n pageMeshData.vertices = new Float32Array(4 * 2 * total);\n pageMeshData.uvs = new Float32Array(4 * 2 * total);\n pageMeshData.indices = new Uint16Array(6 * total);\n }\n else\n {\n const total = pageMeshData.total;\n const vertices = pageMeshData.vertices;\n\n // Clear the garbage at the end of the vertices buffer. This will prevent the bounds miscalculation.\n for (let i = total * 4 * 2; i < vertices.length; i++)\n {\n vertices[i] = 0;\n }\n }\n\n // as a buffer maybe bigger than the current word, we set the size of the meshMaterial\n // to match the number of letters needed\n pageMeshData.mesh.size = 6 * total;\n }\n\n for (let i = 0; i < lenChars; i++)\n {\n const char = chars[i];\n let offset = char.position.x + (lineAlignOffsets[char.line] * (this._align === 'justify' ? char.prevSpaces : 1));\n\n if (this._roundPixels)\n {\n offset = Math.round(offset);\n }\n\n const xPos = offset * scale;\n const yPos = char.position.y * scale;\n const texture = char.texture;\n\n const pageMesh = pagesMeshData[texture.baseTexture.uid];\n\n const textureFrame = texture.frame;\n const textureUvs = texture._uvs;\n\n const index = pageMesh.index++;\n\n pageMesh.indices[(index * 6) + 0] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 1] = 1 + (index * 4);\n pageMesh.indices[(index * 6) + 2] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 3] = 0 + (index * 4);\n pageMesh.indices[(index * 6) + 4] = 2 + (index * 4);\n pageMesh.indices[(index * 6) + 5] = 3 + (index * 4);\n\n pageMesh.vertices[(index * 8) + 0] = xPos;\n pageMesh.vertices[(index * 8) + 1] = yPos;\n\n pageMesh.vertices[(index * 8) + 2] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 3] = yPos;\n\n pageMesh.vertices[(index * 8) + 4] = xPos + (textureFrame.width * scale);\n pageMesh.vertices[(index * 8) + 5] = yPos + (textureFrame.height * scale);\n\n pageMesh.vertices[(index * 8) + 6] = xPos;\n pageMesh.vertices[(index * 8) + 7] = yPos + (textureFrame.height * scale);\n\n pageMesh.uvs[(index * 8) + 0] = textureUvs.x0;\n pageMesh.uvs[(index * 8) + 1] = textureUvs.y0;\n\n pageMesh.uvs[(index * 8) + 2] = textureUvs.x1;\n pageMesh.uvs[(index * 8) + 3] = textureUvs.y1;\n\n pageMesh.uvs[(index * 8) + 4] = textureUvs.x2;\n pageMesh.uvs[(index * 8) + 5] = textureUvs.y2;\n\n pageMesh.uvs[(index * 8) + 6] = textureUvs.x3;\n pageMesh.uvs[(index * 8) + 7] = textureUvs.y3;\n }\n\n this._textWidth = maxLineWidth * scale;\n this._textHeight = (pos.y + data.lineHeight) * scale;\n\n for (const i in pagesMeshData)\n {\n const pageMeshData = pagesMeshData[i];\n\n // apply anchor\n if (this.anchor.x !== 0 || this.anchor.y !== 0)\n {\n let vertexCount = 0;\n\n const anchorOffsetX = this._textWidth * this.anchor.x;\n const anchorOffsetY = this._textHeight * this.anchor.y;\n\n for (let i = 0; i < pageMeshData.total; i++)\n {\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n\n pageMeshData.vertices[vertexCount++] -= anchorOffsetX;\n pageMeshData.vertices[vertexCount++] -= anchorOffsetY;\n }\n }\n\n this._maxLineHeight = maxLineHeight * scale;\n\n const vertexBuffer = pageMeshData.mesh.geometry.getBuffer('aVertexPosition');\n const textureBuffer = pageMeshData.mesh.geometry.getBuffer('aTextureCoord');\n const indexBuffer = pageMeshData.mesh.geometry.getIndex();\n\n vertexBuffer.data = pageMeshData.vertices;\n textureBuffer.data = pageMeshData.uvs;\n indexBuffer.data = pageMeshData.indices;\n\n vertexBuffer.update();\n textureBuffer.update();\n indexBuffer.update();\n }\n\n for (let i = 0; i < chars.length; i++)\n {\n charRenderDataPool.push(chars[i]);\n }\n }\n\n updateTransform(): void\n {\n this.validate();\n this.containerUpdateTransform();\n }\n\n _render(renderer: Renderer): void\n {\n // Update the uniform\n const { distanceFieldRange, distanceFieldType, size } = BitmapFont.available[this._fontName];\n\n if (distanceFieldType !== 'none')\n {\n // Inject the shader code with the correct value\n const { a, b, c, d } = this.worldTransform;\n\n const dx = Math.sqrt((a * a) + (b * b));\n const dy = Math.sqrt((c * c) + (d * d));\n const worldScale = (Math.abs(dx) + Math.abs(dy)) / 2;\n\n const fontScale = this._fontSize / size;\n\n for (const mesh of this._activePagesMeshData)\n {\n mesh.mesh.shader.uniforms.uFWidth = worldScale * distanceFieldRange * fontScale * renderer.resolution;\n }\n }\n\n super._render(renderer);\n }\n\n /**\n * Validates text before calling parent's getLocalBounds\n *\n * @return - The rectangular bounding area\n */\n public getLocalBounds(): Rectangle\n {\n this.validate();\n\n return super.getLocalBounds();\n }\n\n /**\n * Updates text when needed\n *\n * @private\n */\n protected validate(): void\n {\n if (this.dirty)\n {\n this.updateText();\n this.dirty = false;\n }\n }\n\n /**\n * The tint of the BitmapText object.\n *\n * @default 0xffffff\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n if (this._tint === value) return;\n\n this._tint = value;\n\n for (let i = 0; i < this._activePagesMeshData.length; i++)\n {\n this._activePagesMeshData[i].mesh.tint = value;\n }\n }\n\n /**\n * The alignment of the BitmapText object.\n *\n * @member {string}\n * @default 'left'\n */\n public get align(): TextStyleAlign\n {\n return this._align;\n }\n\n public set align(value: TextStyleAlign)\n {\n if (this._align !== value)\n {\n this._align = value;\n this.dirty = true;\n }\n }\n\n /** The name of the BitmapFont. */\n public get fontName(): string\n {\n return this._fontName;\n }\n\n public set fontName(value: string)\n {\n if (!BitmapFont.available[value])\n {\n throw new Error(`Missing BitmapFont \"${value}\"`);\n }\n\n if (this._fontName !== value)\n {\n this._fontName = value;\n this.dirty = true;\n }\n }\n\n /** The size of the font to display. */\n public get fontSize(): number\n {\n return this._fontSize;\n }\n\n public set fontSize(value: number)\n {\n if (this._fontSize !== value)\n {\n this._fontSize = value;\n this.dirty = true;\n }\n }\n\n /**\n * The anchor sets the origin point of the text.\n *\n * The default is `(0,0)`, this means the text's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the text's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the text's origin point will be the bottom right corner.\n */\n public get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n public set anchor(value: ObservablePoint)\n {\n if (typeof value === 'number')\n {\n this._anchor.set(value);\n }\n else\n {\n this._anchor.copyFrom(value);\n }\n }\n\n /** The text of the BitmapText object. */\n public get text(): string\n {\n return this._text;\n }\n\n public set text(text: string)\n {\n text = String(text === null || text === undefined ? '' : text);\n\n if (this._text === text)\n {\n return;\n }\n this._text = text;\n this.dirty = true;\n }\n\n /**\n * The max width of this bitmap text in pixels. If the text provided is longer than the\n * value provided, line breaks will be automatically inserted in the last whitespace.\n * Disable by setting the value to 0.\n */\n public get maxWidth(): number\n {\n return this._maxWidth;\n }\n\n public set maxWidth(value: number)\n {\n if (this._maxWidth === value)\n {\n return;\n }\n this._maxWidth = value;\n this.dirty = true;\n }\n\n /**\n * The max line height. This is useful when trying to use the total height of the Text,\n * i.e. when trying to vertically align.\n *\n * @readonly\n */\n public get maxLineHeight(): number\n {\n this.validate();\n\n return this._maxLineHeight;\n }\n\n /**\n * The width of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @readonly\n */\n public get textWidth(): number\n {\n this.validate();\n\n return this._textWidth;\n }\n\n /** Additional space between characters. */\n public get letterSpacing(): number\n {\n return this._letterSpacing;\n }\n\n public set letterSpacing(value: number)\n {\n if (this._letterSpacing !== value)\n {\n this._letterSpacing = value;\n this.dirty = true;\n }\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n * Advantages can include sharper image quality (like text) and faster rendering on canvas.\n * The main disadvantage is movement of objects may appear less smooth.\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}\n *\n * @default PIXI.settings.ROUND_PIXELS\n */\n public get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n public set roundPixels(value: boolean)\n {\n if (value !== this._roundPixels)\n {\n this._roundPixels = value;\n this.dirty = true;\n }\n }\n\n /**\n * The height of the overall text, different from fontSize,\n * which is defined in the style object.\n *\n * @readonly\n */\n public get textHeight(): number\n {\n this.validate();\n\n return this._textHeight;\n }\n\n destroy(options?: boolean | IDestroyOptions): void\n {\n const { _textureCache } = this;\n\n for (const id in _textureCache)\n {\n const texture = _textureCache[id];\n\n texture.destroy();\n delete _textureCache[id];\n }\n\n this._textureCache = null;\n\n super.destroy(options);\n }\n}\n","import { LoaderResource } from '@pixi/loaders';\nimport { autoDetectFormat } from './formats';\nimport { BitmapFont } from './BitmapFont';\n\nimport type { Loader } from '@pixi/loaders';\nimport type { Dict } from '@pixi/utils';\nimport type { Texture } from '@pixi/core';\n\n/**\n * {@link PIXI.Loader Loader} middleware for loading\n * bitmap-based fonts suitable for using with {@link PIXI.BitmapText}.\n *\n * @memberof PIXI\n */\nexport class BitmapFontLoader\n{\n /**\n * Called when the plugin is installed.\n *\n * @see PIXI.Loader.registerPlugin\n */\n public static add(): void\n {\n LoaderResource.setExtensionXhrType('fnt', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n *\n * @see PIXI.Loader.loaderMiddleware\n * @param {PIXI.LoaderResource} resource\n * @param {function} next\n */\n static use(this: Loader, resource: LoaderResource, next: (...args: any[]) => void): void\n {\n const format = autoDetectFormat(resource.data);\n\n // Resource was not recognised as any of the expected font data format\n if (!format)\n {\n next();\n\n return;\n }\n\n const baseUrl = BitmapFontLoader.getBaseUrl(this, resource);\n const data = format.parse(resource.data);\n const textures: Dict = {};\n\n // Handle completed, when the number of textures\n // load is the same number as references in the fnt file\n const completed = (page: LoaderResource): void =>\n {\n textures[page.metadata.pageFile] = page.texture;\n\n if (Object.keys(textures).length === data.page.length)\n {\n resource.bitmapFont = BitmapFont.install(data, textures, true);\n next();\n }\n };\n\n for (let i = 0; i < data.page.length; ++i)\n {\n const pageFile = data.page[i].file;\n const url = baseUrl + pageFile;\n let exists = false;\n\n // incase the image is loaded outside\n // using the same loader, resource will be available\n for (const name in this.resources)\n {\n const bitmapResource: LoaderResource = this.resources[name];\n\n if (bitmapResource.url === url)\n {\n bitmapResource.metadata.pageFile = pageFile;\n if (bitmapResource.texture)\n {\n completed(bitmapResource);\n }\n else\n {\n bitmapResource.onAfterMiddleware.add(completed);\n }\n exists = true;\n break;\n }\n }\n\n // texture is not loaded, we'll attempt to add\n // it to the load and add the texture to the list\n if (!exists)\n {\n // Standard loading options for images\n const options = {\n crossOrigin: resource.crossOrigin,\n loadType: LoaderResource.LOAD_TYPE.IMAGE,\n metadata: Object.assign(\n { pageFile },\n resource.metadata.imageMetadata\n ),\n parentResource: resource,\n };\n\n this.add(url, options, completed);\n }\n }\n }\n\n /** Get folder path from a resource. */\n private static getBaseUrl(loader: Loader, resource: LoaderResource): string\n {\n let resUrl = !resource.isDataUrl ? BitmapFontLoader.dirname(resource.url) : '';\n\n if (resource.isDataUrl)\n {\n if (resUrl === '.')\n {\n resUrl = '';\n }\n\n if (loader.baseUrl && resUrl)\n {\n // if baseurl has a trailing slash then add one to resUrl so the replace works below\n if (loader.baseUrl.charAt(loader.baseUrl.length - 1) === '/')\n {\n resUrl += '/';\n }\n }\n }\n\n // remove baseUrl from resUrl\n resUrl = resUrl.replace(loader.baseUrl, '');\n\n // if there is an resUrl now, it needs a trailing slash. Ensure that it does if the string isn't empty.\n if (resUrl && resUrl.charAt(resUrl.length - 1) !== '/')\n {\n resUrl += '/';\n }\n\n return resUrl;\n }\n\n /**\n * Replacement for NodeJS's path.dirname\n *\n * @param {string} url - Path to get directory for\n */\n private static dirname(url: string): string\n {\n const dir = url\n .replace(/\\\\/g, '/') // convert windows notation to UNIX notation, URL-safe because it's a forbidden character\n .replace(/\\/$/, '') // replace trailing slash\n .replace(/\\/[^\\/]*$/, ''); // remove everything after the last\n\n // File request is relative, use current directory\n if (dir === url)\n {\n return '.';\n }\n // Started with a slash\n else if (dir === '')\n {\n return '/';\n }\n\n return dir;\n }\n}\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\r\n t[p[i]] = s[p[i]];\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\r\n if (m) return m.call(o);\r\n return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n","import { Filter, defaultVertex } from '@pixi/core';\nimport fragment from './alpha.frag';\n\n/**\n * Simplest filter - applies alpha.\n *\n * Use this instead of Container's alpha property to avoid visual layering of individual elements.\n * AlphaFilter applies alpha evenly across the entire display object and any opaque elements it contains.\n * If elements are not opaque, they will blend with each other anyway.\n *\n * Very handy if you want to use common features of all filters:\n *\n * 1. Assign a blendMode to this filter, blend all elements inside display object with background.\n *\n * 2. To use clipping in display coordinates, assign a filterArea to the same container that has this filter.\n *\n * @memberof PIXI.filters\n */\nexport class AlphaFilter extends Filter\n{\n /**\n * @param alpha - Amount of alpha from 0 to 1, where 0 is transparent\n */\n constructor(alpha = 1.0)\n {\n super(defaultVertex, fragment, { uAlpha: 1 });\n\n this.alpha = alpha;\n }\n\n /**\n * Coefficient for alpha multiplication\n *\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n","interface IGAUSSIAN_VALUES {\n [x: number]: number[];\n}\nconst GAUSSIAN_VALUES: IGAUSSIAN_VALUES = {\n 5: [0.153388, 0.221461, 0.250301],\n 7: [0.071303, 0.131514, 0.189879, 0.214607],\n 9: [0.028532, 0.067234, 0.124009, 0.179044, 0.20236],\n 11: [0.0093, 0.028002, 0.065984, 0.121703, 0.175713, 0.198596],\n 13: [0.002406, 0.009255, 0.027867, 0.065666, 0.121117, 0.174868, 0.197641],\n 15: [0.000489, 0.002403, 0.009246, 0.02784, 0.065602, 0.120999, 0.174697, 0.197448],\n};\n\nconst fragTemplate = [\n 'varying vec2 vBlurTexCoords[%size%];',\n 'uniform sampler2D uSampler;',\n\n 'void main(void)',\n '{',\n ' gl_FragColor = vec4(0.0);',\n ' %blur%',\n '}',\n\n].join('\\n');\n\nexport function generateBlurFragSource(kernelSize: number): string\n{\n const kernel = GAUSSIAN_VALUES[kernelSize];\n const halfLength = kernel.length;\n\n let fragSource = fragTemplate;\n\n let blurLoop = '';\n const template = 'gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;';\n let value: number;\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n value = i;\n\n if (i >= halfLength)\n {\n value = kernelSize - i - 1;\n }\n\n blur = blur.replace('%value%', kernel[value].toString());\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n fragSource = fragSource.replace('%blur%', blurLoop);\n fragSource = fragSource.replace('%size%', kernelSize.toString());\n\n return fragSource;\n}\n","/*!\n * @pixi/constants - v6.2.1\n * Compiled Tue, 21 Dec 2021 19:56:15 UTC\n *\n * @pixi/constants is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nvar ENV;\n(function (ENV) {\n ENV[ENV[\"WEBGL_LEGACY\"] = 0] = \"WEBGL_LEGACY\";\n ENV[ENV[\"WEBGL\"] = 1] = \"WEBGL\";\n ENV[ENV[\"WEBGL2\"] = 2] = \"WEBGL2\";\n})(ENV || (ENV = {}));\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nvar RENDERER_TYPE;\n(function (RENDERER_TYPE) {\n RENDERER_TYPE[RENDERER_TYPE[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n RENDERER_TYPE[RENDERER_TYPE[\"WEBGL\"] = 1] = \"WEBGL\";\n RENDERER_TYPE[RENDERER_TYPE[\"CANVAS\"] = 2] = \"CANVAS\";\n})(RENDERER_TYPE || (RENDERER_TYPE = {}));\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n *\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nvar BUFFER_BITS;\n(function (BUFFER_BITS) {\n BUFFER_BITS[BUFFER_BITS[\"COLOR\"] = 16384] = \"COLOR\";\n BUFFER_BITS[BUFFER_BITS[\"DEPTH\"] = 256] = \"DEPTH\";\n BUFFER_BITS[BUFFER_BITS[\"STENCIL\"] = 1024] = \"STENCIL\";\n})(BUFFER_BITS || (BUFFER_BITS = {}));\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nvar BLEND_MODES;\n(function (BLEND_MODES) {\n BLEND_MODES[BLEND_MODES[\"NORMAL\"] = 0] = \"NORMAL\";\n BLEND_MODES[BLEND_MODES[\"ADD\"] = 1] = \"ADD\";\n BLEND_MODES[BLEND_MODES[\"MULTIPLY\"] = 2] = \"MULTIPLY\";\n BLEND_MODES[BLEND_MODES[\"SCREEN\"] = 3] = \"SCREEN\";\n BLEND_MODES[BLEND_MODES[\"OVERLAY\"] = 4] = \"OVERLAY\";\n BLEND_MODES[BLEND_MODES[\"DARKEN\"] = 5] = \"DARKEN\";\n BLEND_MODES[BLEND_MODES[\"LIGHTEN\"] = 6] = \"LIGHTEN\";\n BLEND_MODES[BLEND_MODES[\"COLOR_DODGE\"] = 7] = \"COLOR_DODGE\";\n BLEND_MODES[BLEND_MODES[\"COLOR_BURN\"] = 8] = \"COLOR_BURN\";\n BLEND_MODES[BLEND_MODES[\"HARD_LIGHT\"] = 9] = \"HARD_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"SOFT_LIGHT\"] = 10] = \"SOFT_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"DIFFERENCE\"] = 11] = \"DIFFERENCE\";\n BLEND_MODES[BLEND_MODES[\"EXCLUSION\"] = 12] = \"EXCLUSION\";\n BLEND_MODES[BLEND_MODES[\"HUE\"] = 13] = \"HUE\";\n BLEND_MODES[BLEND_MODES[\"SATURATION\"] = 14] = \"SATURATION\";\n BLEND_MODES[BLEND_MODES[\"COLOR\"] = 15] = \"COLOR\";\n BLEND_MODES[BLEND_MODES[\"LUMINOSITY\"] = 16] = \"LUMINOSITY\";\n BLEND_MODES[BLEND_MODES[\"NORMAL_NPM\"] = 17] = \"NORMAL_NPM\";\n BLEND_MODES[BLEND_MODES[\"ADD_NPM\"] = 18] = \"ADD_NPM\";\n BLEND_MODES[BLEND_MODES[\"SCREEN_NPM\"] = 19] = \"SCREEN_NPM\";\n BLEND_MODES[BLEND_MODES[\"NONE\"] = 20] = \"NONE\";\n BLEND_MODES[BLEND_MODES[\"SRC_OVER\"] = 0] = \"SRC_OVER\";\n BLEND_MODES[BLEND_MODES[\"SRC_IN\"] = 21] = \"SRC_IN\";\n BLEND_MODES[BLEND_MODES[\"SRC_OUT\"] = 22] = \"SRC_OUT\";\n BLEND_MODES[BLEND_MODES[\"SRC_ATOP\"] = 23] = \"SRC_ATOP\";\n BLEND_MODES[BLEND_MODES[\"DST_OVER\"] = 24] = \"DST_OVER\";\n BLEND_MODES[BLEND_MODES[\"DST_IN\"] = 25] = \"DST_IN\";\n BLEND_MODES[BLEND_MODES[\"DST_OUT\"] = 26] = \"DST_OUT\";\n BLEND_MODES[BLEND_MODES[\"DST_ATOP\"] = 27] = \"DST_ATOP\";\n BLEND_MODES[BLEND_MODES[\"ERASE\"] = 26] = \"ERASE\";\n BLEND_MODES[BLEND_MODES[\"SUBTRACT\"] = 28] = \"SUBTRACT\";\n BLEND_MODES[BLEND_MODES[\"XOR\"] = 29] = \"XOR\";\n})(BLEND_MODES || (BLEND_MODES = {}));\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nvar DRAW_MODES;\n(function (DRAW_MODES) {\n DRAW_MODES[DRAW_MODES[\"POINTS\"] = 0] = \"POINTS\";\n DRAW_MODES[DRAW_MODES[\"LINES\"] = 1] = \"LINES\";\n DRAW_MODES[DRAW_MODES[\"LINE_LOOP\"] = 2] = \"LINE_LOOP\";\n DRAW_MODES[DRAW_MODES[\"LINE_STRIP\"] = 3] = \"LINE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLES\"] = 4] = \"TRIANGLES\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_STRIP\"] = 5] = \"TRIANGLE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_FAN\"] = 6] = \"TRIANGLE_FAN\";\n})(DRAW_MODES || (DRAW_MODES = {}));\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} RG=33319\n * @property {number} RED=6403\n * @property {number} RGBA_INTEGER=36249\n * @property {number} RGB_INTEGER=36248\n * @property {number} RG_INTEGER=33320\n * @property {number} RED_INTEGER=36244\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nvar FORMATS;\n(function (FORMATS) {\n FORMATS[FORMATS[\"RGBA\"] = 6408] = \"RGBA\";\n FORMATS[FORMATS[\"RGB\"] = 6407] = \"RGB\";\n FORMATS[FORMATS[\"RG\"] = 33319] = \"RG\";\n FORMATS[FORMATS[\"RED\"] = 6403] = \"RED\";\n FORMATS[FORMATS[\"RGBA_INTEGER\"] = 36249] = \"RGBA_INTEGER\";\n FORMATS[FORMATS[\"RGB_INTEGER\"] = 36248] = \"RGB_INTEGER\";\n FORMATS[FORMATS[\"RG_INTEGER\"] = 33320] = \"RG_INTEGER\";\n FORMATS[FORMATS[\"RED_INTEGER\"] = 36244] = \"RED_INTEGER\";\n FORMATS[FORMATS[\"ALPHA\"] = 6406] = \"ALPHA\";\n FORMATS[FORMATS[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\n FORMATS[FORMATS[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\n FORMATS[FORMATS[\"DEPTH_COMPONENT\"] = 6402] = \"DEPTH_COMPONENT\";\n FORMATS[FORMATS[\"DEPTH_STENCIL\"] = 34041] = \"DEPTH_STENCIL\";\n})(FORMATS || (FORMATS = {}));\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nvar TARGETS;\n(function (TARGETS) {\n TARGETS[TARGETS[\"TEXTURE_2D\"] = 3553] = \"TEXTURE_2D\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP\"] = 34067] = \"TEXTURE_CUBE_MAP\";\n TARGETS[TARGETS[\"TEXTURE_2D_ARRAY\"] = 35866] = \"TEXTURE_2D_ARRAY\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_X\"] = 34069] = \"TEXTURE_CUBE_MAP_POSITIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_X\"] = 34070] = \"TEXTURE_CUBE_MAP_NEGATIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Y\"] = 34071] = \"TEXTURE_CUBE_MAP_POSITIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Y\"] = 34072] = \"TEXTURE_CUBE_MAP_NEGATIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Z\"] = 34073] = \"TEXTURE_CUBE_MAP_POSITIVE_Z\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Z\"] = 34074] = \"TEXTURE_CUBE_MAP_NEGATIVE_Z\";\n})(TARGETS || (TARGETS = {}));\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} UNSIGNED_INT=5125\n * @property {number} UNSIGNED_INT_10F_11F_11F_REV=35899\n * @property {number} UNSIGNED_INT_2_10_10_10_REV=33640\n * @property {number} UNSIGNED_INT_24_8=34042\n * @property {number} UNSIGNED_INT_5_9_9_9_REV=35902\n * @property {number} BYTE=5120\n * @property {number} SHORT=5122\n * @property {number} INT=5124\n * @property {number} FLOAT=5126\n * @property {number} FLOAT_32_UNSIGNED_INT_24_8_REV=36269\n * @property {number} HALF_FLOAT=36193\n */\nvar TYPES;\n(function (TYPES) {\n TYPES[TYPES[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\n TYPES[TYPES[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_6_5\"] = 33635] = \"UNSIGNED_SHORT_5_6_5\";\n TYPES[TYPES[\"UNSIGNED_SHORT_4_4_4_4\"] = 32819] = \"UNSIGNED_SHORT_4_4_4_4\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_5_5_1\"] = 32820] = \"UNSIGNED_SHORT_5_5_5_1\";\n TYPES[TYPES[\"UNSIGNED_INT\"] = 5125] = \"UNSIGNED_INT\";\n TYPES[TYPES[\"UNSIGNED_INT_10F_11F_11F_REV\"] = 35899] = \"UNSIGNED_INT_10F_11F_11F_REV\";\n TYPES[TYPES[\"UNSIGNED_INT_2_10_10_10_REV\"] = 33640] = \"UNSIGNED_INT_2_10_10_10_REV\";\n TYPES[TYPES[\"UNSIGNED_INT_24_8\"] = 34042] = \"UNSIGNED_INT_24_8\";\n TYPES[TYPES[\"UNSIGNED_INT_5_9_9_9_REV\"] = 35902] = \"UNSIGNED_INT_5_9_9_9_REV\";\n TYPES[TYPES[\"BYTE\"] = 5120] = \"BYTE\";\n TYPES[TYPES[\"SHORT\"] = 5122] = \"SHORT\";\n TYPES[TYPES[\"INT\"] = 5124] = \"INT\";\n TYPES[TYPES[\"FLOAT\"] = 5126] = \"FLOAT\";\n TYPES[TYPES[\"FLOAT_32_UNSIGNED_INT_24_8_REV\"] = 36269] = \"FLOAT_32_UNSIGNED_INT_24_8_REV\";\n TYPES[TYPES[\"HALF_FLOAT\"] = 36193] = \"HALF_FLOAT\";\n})(TYPES || (TYPES = {}));\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n *\n * @memberof PIXI\n * @static\n * @name SAMPLER_TYPES\n * @enum {number}\n * @property {number} FLOAT=0\n * @property {number} INT=1\n * @property {number} UINT=2\n */\nvar SAMPLER_TYPES;\n(function (SAMPLER_TYPES) {\n SAMPLER_TYPES[SAMPLER_TYPES[\"FLOAT\"] = 0] = \"FLOAT\";\n SAMPLER_TYPES[SAMPLER_TYPES[\"INT\"] = 1] = \"INT\";\n SAMPLER_TYPES[SAMPLER_TYPES[\"UINT\"] = 2] = \"UINT\";\n})(SAMPLER_TYPES || (SAMPLER_TYPES = {}));\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nvar SCALE_MODES;\n(function (SCALE_MODES) {\n SCALE_MODES[SCALE_MODES[\"NEAREST\"] = 0] = \"NEAREST\";\n SCALE_MODES[SCALE_MODES[\"LINEAR\"] = 1] = \"LINEAR\";\n})(SCALE_MODES || (SCALE_MODES = {}));\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nvar WRAP_MODES;\n(function (WRAP_MODES) {\n WRAP_MODES[WRAP_MODES[\"CLAMP\"] = 33071] = \"CLAMP\";\n WRAP_MODES[WRAP_MODES[\"REPEAT\"] = 10497] = \"REPEAT\";\n WRAP_MODES[WRAP_MODES[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\n})(WRAP_MODES || (WRAP_MODES = {}));\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource\n * that supports buffering each level-of-detail.\n */\nvar MIPMAP_MODES;\n(function (MIPMAP_MODES) {\n MIPMAP_MODES[MIPMAP_MODES[\"OFF\"] = 0] = \"OFF\";\n MIPMAP_MODES[MIPMAP_MODES[\"POW2\"] = 1] = \"POW2\";\n MIPMAP_MODES[MIPMAP_MODES[\"ON\"] = 2] = \"ON\";\n MIPMAP_MODES[MIPMAP_MODES[\"ON_MANUAL\"] = 3] = \"ON_MANUAL\";\n})(MIPMAP_MODES || (MIPMAP_MODES = {}));\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nvar ALPHA_MODES;\n(function (ALPHA_MODES) {\n ALPHA_MODES[ALPHA_MODES[\"NPM\"] = 0] = \"NPM\";\n ALPHA_MODES[ALPHA_MODES[\"UNPACK\"] = 1] = \"UNPACK\";\n ALPHA_MODES[ALPHA_MODES[\"PMA\"] = 2] = \"PMA\";\n ALPHA_MODES[ALPHA_MODES[\"NO_PREMULTIPLIED_ALPHA\"] = 0] = \"NO_PREMULTIPLIED_ALPHA\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ON_UPLOAD\"] = 1] = \"PREMULTIPLY_ON_UPLOAD\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ALPHA\"] = 2] = \"PREMULTIPLY_ALPHA\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLIED_ALPHA\"] = 2] = \"PREMULTIPLIED_ALPHA\";\n})(ALPHA_MODES || (ALPHA_MODES = {}));\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n *\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @property {number} CLEAR - Always clear the filter texture.\n * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nvar CLEAR_MODES;\n(function (CLEAR_MODES) {\n CLEAR_MODES[CLEAR_MODES[\"NO\"] = 0] = \"NO\";\n CLEAR_MODES[CLEAR_MODES[\"YES\"] = 1] = \"YES\";\n CLEAR_MODES[CLEAR_MODES[\"AUTO\"] = 2] = \"AUTO\";\n CLEAR_MODES[CLEAR_MODES[\"BLEND\"] = 0] = \"BLEND\";\n CLEAR_MODES[CLEAR_MODES[\"CLEAR\"] = 1] = \"CLEAR\";\n CLEAR_MODES[CLEAR_MODES[\"BLIT\"] = 2] = \"BLIT\";\n})(CLEAR_MODES || (CLEAR_MODES = {}));\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nvar GC_MODES;\n(function (GC_MODES) {\n GC_MODES[GC_MODES[\"AUTO\"] = 0] = \"AUTO\";\n GC_MODES[GC_MODES[\"MANUAL\"] = 1] = \"MANUAL\";\n})(GC_MODES || (GC_MODES = {}));\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nvar PRECISION;\n(function (PRECISION) {\n PRECISION[\"LOW\"] = \"lowp\";\n PRECISION[\"MEDIUM\"] = \"mediump\";\n PRECISION[\"HIGH\"] = \"highp\";\n})(PRECISION || (PRECISION = {}));\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nvar MASK_TYPES;\n(function (MASK_TYPES) {\n MASK_TYPES[MASK_TYPES[\"NONE\"] = 0] = \"NONE\";\n MASK_TYPES[MASK_TYPES[\"SCISSOR\"] = 1] = \"SCISSOR\";\n MASK_TYPES[MASK_TYPES[\"STENCIL\"] = 2] = \"STENCIL\";\n MASK_TYPES[MASK_TYPES[\"SPRITE\"] = 3] = \"SPRITE\";\n})(MASK_TYPES || (MASK_TYPES = {}));\n/**\n * Constants for multi-sampling antialiasing.\n *\n * @see PIXI.Framebuffer#multisample\n *\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nvar MSAA_QUALITY;\n(function (MSAA_QUALITY) {\n MSAA_QUALITY[MSAA_QUALITY[\"NONE\"] = 0] = \"NONE\";\n MSAA_QUALITY[MSAA_QUALITY[\"LOW\"] = 2] = \"LOW\";\n MSAA_QUALITY[MSAA_QUALITY[\"MEDIUM\"] = 4] = \"MEDIUM\";\n MSAA_QUALITY[MSAA_QUALITY[\"HIGH\"] = 8] = \"HIGH\";\n})(MSAA_QUALITY || (MSAA_QUALITY = {}));\n/**\n * Constants for various buffer types in Pixi\n *\n * @see PIXI.BUFFER_TYPE\n *\n * @name BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer\n * @property {number} ARRAY_BUFFER - buffer type for using attribute data\n * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects\n */\nvar BUFFER_TYPE;\n(function (BUFFER_TYPE) {\n BUFFER_TYPE[BUFFER_TYPE[\"ELEMENT_ARRAY_BUFFER\"] = 34963] = \"ELEMENT_ARRAY_BUFFER\";\n BUFFER_TYPE[BUFFER_TYPE[\"ARRAY_BUFFER\"] = 34962] = \"ARRAY_BUFFER\";\n // NOT YET SUPPORTED\n BUFFER_TYPE[BUFFER_TYPE[\"UNIFORM_BUFFER\"] = 35345] = \"UNIFORM_BUFFER\";\n})(BUFFER_TYPE || (BUFFER_TYPE = {}));\n\nexport { ALPHA_MODES, BLEND_MODES, BUFFER_BITS, BUFFER_TYPE, CLEAR_MODES, DRAW_MODES, ENV, FORMATS, GC_MODES, MASK_TYPES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, RENDERER_TYPE, SAMPLER_TYPES, SCALE_MODES, TARGETS, TYPES, WRAP_MODES };\n//# sourceMappingURL=constants.js.map\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { generateBlurVertSource } from './generateBlurVertSource';\nimport { generateBlurFragSource } from './generateBlurFragSource';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { FilterSystem, RenderTexture } from '@pixi/core';\n\n/**\n * The BlurFilterPass applies a horizontal or vertical Gaussian blur to an object.\n *\n * @class\n * @extends PIXI.Filter\n * @memberof PIXI.filters\n */\nexport class BlurFilterPass extends Filter\n{\n public horizontal: boolean;\n public strength: number;\n public passes: number;\n\n private _quality: number;\n\n /**\n * @param {boolean} horizontal - Do pass along the x-axis (`true`) or y-axis (`false`).\n * @param {number} [strength=8] - The strength of the blur filter.\n * @param {number} [quality=4] - The quality of the blur filter.\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param {number} [kernelSize=5] - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(horizontal: boolean, strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n const vertSrc = generateBlurVertSource(kernelSize, horizontal);\n const fragSrc = generateBlurFragSource(kernelSize);\n\n super(\n // vertex shader\n vertSrc,\n // fragment shader\n fragSrc\n );\n\n this.horizontal = horizontal;\n\n this.resolution = resolution;\n\n this._quality = 0;\n\n this.quality = quality;\n\n this.blur = strength;\n }\n\n /**\n * Applies the filter.\n *\n * @param {PIXI.FilterSystem} filterManager - The manager.\n * @param {PIXI.RenderTexture} input - The input target.\n * @param {PIXI.RenderTexture} output - The output target.\n * @param {PIXI.CLEAR_MODES} clearMode - How to clear\n */\n public apply(\n filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n if (output)\n {\n if (this.horizontal)\n {\n this.uniforms.strength = (1 / output.width) * (output.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / output.height) * (output.height / input.height);\n }\n }\n else\n {\n if (this.horizontal) // eslint-disable-line\n {\n this.uniforms.strength = (1 / filterManager.renderer.width) * (filterManager.renderer.width / input.width);\n }\n else\n {\n this.uniforms.strength = (1 / filterManager.renderer.height) * (filterManager.renderer.height / input.height); // eslint-disable-line\n }\n }\n\n // screen space!\n this.uniforms.strength *= this.strength;\n this.uniforms.strength /= this.passes;\n\n if (this.passes === 1)\n {\n filterManager.applyFilter(this, input, output, clearMode);\n }\n else\n {\n const renderTarget = filterManager.getFilterTexture();\n const renderer = filterManager.renderer;\n\n let flip = input;\n let flop = renderTarget;\n\n this.state.blend = false;\n filterManager.applyFilter(this, flip, flop, CLEAR_MODES.CLEAR);\n\n for (let i = 1; i < this.passes - 1; i++)\n {\n filterManager.bindAndClear(flip, CLEAR_MODES.BLIT);\n\n this.uniforms.uSampler = flop;\n\n const temp = flop;\n\n flop = flip;\n flip = temp;\n\n renderer.shader.bind(this);\n renderer.geometry.draw(5);\n }\n\n this.state.blend = true;\n filterManager.applyFilter(this, flop, output, clearMode);\n filterManager.returnFilterTexture(renderTarget);\n }\n }\n /**\n * Sets the strength of both the blur.\n *\n * @member {number}\n * @default 16\n */\n get blur(): number\n {\n return this.strength;\n }\n\n set blur(value: number)\n {\n this.padding = 1 + (Math.abs(value) * 2);\n this.strength = value;\n }\n\n /**\n * Sets the quality of the blur by modifying the number of passes. More passes means higher\n * quality bluring but the lower the performance.\n *\n * @member {number}\n * @default 4\n */\n get quality(): number\n {\n return this._quality;\n }\n\n set quality(value: number)\n {\n this._quality = value;\n this.passes = value;\n }\n}\n","const vertTemplate = `\n attribute vec2 aVertexPosition;\n\n uniform mat3 projectionMatrix;\n\n uniform float strength;\n\n varying vec2 vBlurTexCoords[%size%];\n\n uniform vec4 inputSize;\n uniform vec4 outputFrame;\n\n vec4 filterVertexPosition( void )\n {\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n }\n\n vec2 filterTextureCoord( void )\n {\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n }\n\n void main(void)\n {\n gl_Position = filterVertexPosition();\n\n vec2 textureCoord = filterTextureCoord();\n %blur%\n }`;\n\nexport function generateBlurVertSource(kernelSize: number, x: boolean): string\n{\n const halfLength = Math.ceil(kernelSize / 2);\n\n let vertSource = vertTemplate;\n\n let blurLoop = '';\n let template;\n\n if (x)\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);';\n }\n else\n {\n template = 'vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);';\n }\n\n for (let i = 0; i < kernelSize; i++)\n {\n let blur = template.replace('%index%', i.toString());\n\n blur = blur.replace('%sampleIndex%', `${i - (halfLength - 1)}.0`);\n\n blurLoop += blur;\n blurLoop += '\\n';\n }\n\n vertSource = vertSource.replace('%blur%', blurLoop);\n vertSource = vertSource.replace('%size%', kernelSize.toString());\n\n return vertSource;\n}\n","import { Filter } from '@pixi/core';\nimport { settings } from '@pixi/settings';\nimport { BlurFilterPass } from './BlurFilterPass';\nimport { CLEAR_MODES } from '@pixi/constants';\n\nimport type { FilterSystem, RenderTexture } from '@pixi/core';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * The BlurFilter applies a Gaussian blur to an object.\n *\n * The strength of the blur can be set for the x-axis and y-axis separately.\n *\n * @memberof PIXI.filters\n */\nexport class BlurFilter extends Filter\n{\n public blurXFilter: BlurFilterPass;\n public blurYFilter: BlurFilterPass;\n\n private _repeatEdgePixels: boolean;\n\n /**\n * @param strength - The strength of the blur filter.\n * @param quality - The quality of the blur filter.\n * @param [resolution=PIXI.settings.FILTER_RESOLUTION] - The resolution of the blur filter.\n * @param kernelSize - The kernelSize of the blur filter.Options: 5, 7, 9, 11, 13, 15.\n */\n constructor(strength = 8, quality = 4, resolution = settings.FILTER_RESOLUTION, kernelSize = 5)\n {\n super();\n\n this.blurXFilter = new BlurFilterPass(true, strength, quality, resolution, kernelSize);\n this.blurYFilter = new BlurFilterPass(false, strength, quality, resolution, kernelSize);\n\n this.resolution = resolution;\n this.quality = quality;\n this.blur = strength;\n\n this.repeatEdgePixels = false;\n }\n\n /**\n * Applies the filter.\n *\n * @param filterManager - The manager.\n * @param input - The input target.\n * @param output - The output target.\n * @param clearMode - How to clear\n */\n apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const xStrength = Math.abs(this.blurXFilter.strength);\n const yStrength = Math.abs(this.blurYFilter.strength);\n\n if (xStrength && yStrength)\n {\n const renderTarget = filterManager.getFilterTexture();\n\n this.blurXFilter.apply(filterManager, input, renderTarget, CLEAR_MODES.CLEAR);\n this.blurYFilter.apply(filterManager, renderTarget, output, clearMode);\n\n filterManager.returnFilterTexture(renderTarget);\n }\n else if (yStrength)\n {\n this.blurYFilter.apply(filterManager, input, output, clearMode);\n }\n else\n {\n this.blurXFilter.apply(filterManager, input, output, clearMode);\n }\n }\n\n protected updatePadding(): void\n {\n if (this._repeatEdgePixels)\n {\n this.padding = 0;\n }\n else\n {\n this.padding = Math.max(Math.abs(this.blurXFilter.strength), Math.abs(this.blurYFilter.strength)) * 2;\n }\n }\n\n /**\n * Sets the strength of both the blurX and blurY properties simultaneously\n *\n * @default 2\n */\n get blur(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blur(value: number)\n {\n this.blurXFilter.blur = this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the number of passes for blur. More passes means higher quality bluring.\n *\n * @default 1\n */\n get quality(): number\n {\n return this.blurXFilter.quality;\n }\n\n set quality(value: number)\n {\n this.blurXFilter.quality = this.blurYFilter.quality = value;\n }\n\n /**\n * Sets the strength of the blurX property\n *\n * @default 2\n */\n get blurX(): number\n {\n return this.blurXFilter.blur;\n }\n\n set blurX(value: number)\n {\n this.blurXFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the strength of the blurY property\n *\n * @default 2\n */\n get blurY(): number\n {\n return this.blurYFilter.blur;\n }\n\n set blurY(value: number)\n {\n this.blurYFilter.blur = value;\n this.updatePadding();\n }\n\n /**\n * Sets the blendmode of the filter\n *\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.blurYFilter.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blurYFilter.blendMode = value;\n }\n\n /**\n * If set to true the edge of the target will be clamped\n *\n * @default false\n */\n get repeatEdgePixels(): boolean\n {\n return this._repeatEdgePixels;\n }\n\n set repeatEdgePixels(value: boolean)\n {\n this._repeatEdgePixels = value;\n this.updatePadding();\n }\n}\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './colorMatrix.frag';\n\nimport type { ArrayFixed } from '@pixi/utils';\n\nexport type ColorMatrix = ArrayFixed;\n\n/**\n * The ColorMatrixFilter class lets you apply a 5x4 matrix transformation on the RGBA\n * color and alpha values of every pixel on your displayObject to produce a result\n * with a new set of RGBA color and alpha values. It's pretty powerful!\n *\n * ```js\n * let colorMatrix = new PIXI.filters.ColorMatrixFilter();\n * container.filters = [colorMatrix];\n * colorMatrix.contrast(2);\n * ```\n * @author Clément Chenebault \n * @memberof PIXI.filters\n */\nexport class ColorMatrixFilter extends Filter\n{\n public grayscale: (scale: number, multiply: boolean) => void;\n\n constructor()\n {\n const uniforms = {\n m: new Float32Array([1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0]),\n uAlpha: 1,\n };\n\n super(defaultFilterVertex, fragment, uniforms);\n\n this.alpha = 1;\n }\n\n /**\n * Transforms current matrix and set the new one\n *\n * @param {number[]} matrix - 5x4 matrix\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n private _loadMatrix(matrix: ColorMatrix, multiply = false): void\n {\n let newMatrix = matrix;\n\n if (multiply)\n {\n this._multiply(newMatrix, this.uniforms.m, matrix);\n newMatrix = this._colorMatrix(newMatrix) as any;\n }\n\n // set the new matrix\n this.uniforms.m = newMatrix;\n }\n\n /**\n * Multiplies two mat5's\n *\n * @private\n * @param out - 5x4 matrix the receiving matrix\n * @param a - 5x4 matrix the first operand\n * @param b - 5x4 matrix the second operand\n * @returns {number[]} 5x4 matrix\n */\n private _multiply(out: ColorMatrix, a: ColorMatrix, b: ColorMatrix): ColorMatrix\n {\n // Red Channel\n out[0] = (a[0] * b[0]) + (a[1] * b[5]) + (a[2] * b[10]) + (a[3] * b[15]);\n out[1] = (a[0] * b[1]) + (a[1] * b[6]) + (a[2] * b[11]) + (a[3] * b[16]);\n out[2] = (a[0] * b[2]) + (a[1] * b[7]) + (a[2] * b[12]) + (a[3] * b[17]);\n out[3] = (a[0] * b[3]) + (a[1] * b[8]) + (a[2] * b[13]) + (a[3] * b[18]);\n out[4] = (a[0] * b[4]) + (a[1] * b[9]) + (a[2] * b[14]) + (a[3] * b[19]) + a[4];\n\n // Green Channel\n out[5] = (a[5] * b[0]) + (a[6] * b[5]) + (a[7] * b[10]) + (a[8] * b[15]);\n out[6] = (a[5] * b[1]) + (a[6] * b[6]) + (a[7] * b[11]) + (a[8] * b[16]);\n out[7] = (a[5] * b[2]) + (a[6] * b[7]) + (a[7] * b[12]) + (a[8] * b[17]);\n out[8] = (a[5] * b[3]) + (a[6] * b[8]) + (a[7] * b[13]) + (a[8] * b[18]);\n out[9] = (a[5] * b[4]) + (a[6] * b[9]) + (a[7] * b[14]) + (a[8] * b[19]) + a[9];\n\n // Blue Channel\n out[10] = (a[10] * b[0]) + (a[11] * b[5]) + (a[12] * b[10]) + (a[13] * b[15]);\n out[11] = (a[10] * b[1]) + (a[11] * b[6]) + (a[12] * b[11]) + (a[13] * b[16]);\n out[12] = (a[10] * b[2]) + (a[11] * b[7]) + (a[12] * b[12]) + (a[13] * b[17]);\n out[13] = (a[10] * b[3]) + (a[11] * b[8]) + (a[12] * b[13]) + (a[13] * b[18]);\n out[14] = (a[10] * b[4]) + (a[11] * b[9]) + (a[12] * b[14]) + (a[13] * b[19]) + a[14];\n\n // Alpha Channel\n out[15] = (a[15] * b[0]) + (a[16] * b[5]) + (a[17] * b[10]) + (a[18] * b[15]);\n out[16] = (a[15] * b[1]) + (a[16] * b[6]) + (a[17] * b[11]) + (a[18] * b[16]);\n out[17] = (a[15] * b[2]) + (a[16] * b[7]) + (a[17] * b[12]) + (a[18] * b[17]);\n out[18] = (a[15] * b[3]) + (a[16] * b[8]) + (a[17] * b[13]) + (a[18] * b[18]);\n out[19] = (a[15] * b[4]) + (a[16] * b[9]) + (a[17] * b[14]) + (a[18] * b[19]) + a[19];\n\n return out;\n }\n\n /**\n * Create a Float32 Array and normalize the offset component to 0-1\n *\n * @param {number[]} matrix - 5x4 matrix\n * @return {number[]} 5x4 matrix with all values between 0-1\n */\n private _colorMatrix(matrix: ColorMatrix): ColorMatrix\n {\n // Create a Float32 Array and normalize the offset component to 0-1\n const m = new Float32Array(matrix);\n\n m[4] /= 255;\n m[9] /= 255;\n m[14] /= 255;\n m[19] /= 255;\n\n return m as any;\n }\n\n /**\n * Adjusts brightness\n *\n * @param b - value of the brigthness (0-1, where 0 is black)\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public brightness(b: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n b, 0, 0, 0, 0,\n 0, b, 0, 0, 0,\n 0, 0, b, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Sets each channel on the diagonal of the color matrix.\n * This can be used to achieve a tinting effect on Containers similar to the tint field of some\n * display objects like Sprite, Text, Graphics, and Mesh.\n *\n * @param color - Color of the tint. This is a hex value.\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public tint(color: number, multiply?: boolean): void\n {\n const r = (color >> 16) & 0xff;\n const g = (color >> 8) & 0xff;\n const b = color & 0xff;\n\n const matrix: ColorMatrix = [\n r / 255, 0, 0, 0, 0,\n 0, g / 255, 0, 0, 0,\n 0, 0, b / 255, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the matrices in grey scales\n *\n * @param scale - value of the grey (0-1, where 0 is black)\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public greyscale(scale: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n scale, scale, scale, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the black and white matrice.\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public blackAndWhite(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0.3, 0.6, 0.1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the hue property of the color\n *\n * @param rotation - in degrees\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public hue(rotation: number, multiply: boolean): void\n {\n rotation = (rotation || 0) / 180 * Math.PI;\n\n const cosR = Math.cos(rotation);\n const sinR = Math.sin(rotation);\n const sqrt = Math.sqrt;\n\n /* a good approximation for hue rotation\n This matrix is far better than the versions with magic luminance constants\n formerly used here, but also used in the starling framework (flash) and known from this\n old part of the internet: quasimondo.com/archives/000565.php\n\n This new matrix is based on rgb cube rotation in space. Look here for a more descriptive\n implementation as a shader not a general matrix:\n https://github.com/evanw/glfx.js/blob/58841c23919bd59787effc0333a4897b43835412/src/filters/adjust/huesaturation.js\n\n This is the source for the code:\n see http://stackoverflow.com/questions/8507885/shift-hue-of-an-rgb-color/8510751#8510751\n */\n\n const w = 1 / 3;\n const sqrW = sqrt(w); // weight is\n\n const a00 = cosR + ((1.0 - cosR) * w);\n const a01 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a02 = (w * (1.0 - cosR)) + (sqrW * sinR);\n\n const a10 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a11 = cosR + (w * (1.0 - cosR));\n const a12 = (w * (1.0 - cosR)) - (sqrW * sinR);\n\n const a20 = (w * (1.0 - cosR)) - (sqrW * sinR);\n const a21 = (w * (1.0 - cosR)) + (sqrW * sinR);\n const a22 = cosR + (w * (1.0 - cosR));\n\n const matrix: ColorMatrix = [\n a00, a01, a02, 0, 0,\n a10, a11, a12, 0, 0,\n a20, a21, a22, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the contrast matrix, increase the separation between dark and bright\n * Increase contrast : shadows darker and highlights brighter\n * Decrease contrast : bring the shadows up and the highlights down\n *\n * @param amount - value of the contrast (0-1)\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public contrast(amount: number, multiply: boolean): void\n {\n const v = (amount || 0) + 1;\n const o = -0.5 * (v - 1);\n\n const matrix: ColorMatrix = [\n v, 0, 0, 0, o,\n 0, v, 0, 0, o,\n 0, 0, v, 0, o,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Set the saturation matrix, increase the separation between colors\n * Increase saturation : increase contrast, brightness, and sharpness\n *\n * @param amount - The saturation amount (0-1)\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public saturate(amount = 0, multiply?: boolean): void\n {\n const x = (amount * 2 / 3) + 1;\n const y = ((x - 1) * -0.5);\n\n const matrix: ColorMatrix = [\n x, y, y, 0, 0,\n y, x, y, 0, 0,\n y, y, x, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Desaturate image (remove color)\n *\n * Call the saturate function\n */\n public desaturate(): void // eslint-disable-line no-unused-vars\n {\n this.saturate(-1);\n }\n\n /**\n * Negative image (inverse of classic rgb matrix)\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public negative(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n -1, 0, 0, 1, 0,\n 0, -1, 0, 1, 0,\n 0, 0, -1, 1, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Sepia image\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public sepia(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.393, 0.7689999, 0.18899999, 0, 0,\n 0.349, 0.6859999, 0.16799999, 0, 0,\n 0.272, 0.5339999, 0.13099999, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color motion picture process invented in 1916 (thanks Dominic Szablewski)\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public technicolor(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.9125277891456083, -0.8545344976951645, -0.09155508482755585, 0, 11.793603434377337,\n -0.3087833385928097, 1.7658908555458428, -0.10601743074722245, 0, -70.35205161461398,\n -0.231103377548616, -0.7501899197440212, 1.847597816108189, 0, 30.950940869491138,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Polaroid filter\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public polaroid(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.438, -0.062, -0.062, 0, 0,\n -0.122, 1.378, -0.122, 0, 0,\n -0.016, -0.016, 1.483, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Filter who transforms : Red -> Blue and Blue -> Red\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public toBGR(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0, 0, 1, 0, 0,\n 0, 1, 0, 0, 0,\n 1, 0, 0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Color reversal film introduced by Eastman Kodak in 1935. (thanks Dominic Szablewski)\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public kodachrome(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 1.1285582396593525, -0.3967382283601348, -0.03992559172921793, 0, 63.72958762196502,\n -0.16404339962244616, 1.0835251566291304, -0.05498805115633132, 0, 24.732407896706203,\n -0.16786010706155763, -0.5603416277695248, 1.6014850761964943, 0, 35.62982807460946,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Brown delicious browni filter (thanks Dominic Szablewski)\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public browni(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.5997023498159715, 0.34553243048391263, -0.2708298674538042, 0, 47.43192855600873,\n -0.037703249837783157, 0.8609577587992641, 0.15059552388459913, 0, -36.96841498319127,\n 0.24113635128153335, -0.07441037908422492, 0.44972182064877153, 0, -7.562075277591283,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Vintage filter (thanks Dominic Szablewski)\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public vintage(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 0.6279345635605994, 0.3202183420819367, -0.03965408211312453, 0, 9.651285835294123,\n 0.02578397704808868, 0.6441188644374771, 0.03259127616149294, 0, 7.462829176470591,\n 0.0466055556782719, -0.0851232987247891, 0.5241648018700465, 0, 5.159190588235296,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * We don't know exactly what it does, kind of gradient map, but funny to play with!\n *\n * @param desaturation - Tone values.\n * @param toned - Tone values.\n * @param lightColor - Tone values, example: `0xFFE580`\n * @param darkColor - Tone values, example: `0xFFE580`\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public colorTone(desaturation: number, toned: number, lightColor: number, darkColor: number, multiply: boolean): void\n {\n desaturation = desaturation || 0.2;\n toned = toned || 0.15;\n lightColor = lightColor || 0xFFE580;\n darkColor = darkColor || 0x338000;\n\n const lR = ((lightColor >> 16) & 0xFF) / 255;\n const lG = ((lightColor >> 8) & 0xFF) / 255;\n const lB = (lightColor & 0xFF) / 255;\n\n const dR = ((darkColor >> 16) & 0xFF) / 255;\n const dG = ((darkColor >> 8) & 0xFF) / 255;\n const dB = (darkColor & 0xFF) / 255;\n\n const matrix: ColorMatrix = [\n 0.3, 0.59, 0.11, 0, 0,\n lR, lG, lB, desaturation, 0,\n dR, dG, dB, toned, 0,\n lR - dR, lG - dG, lB - dB, 0, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Night effect\n *\n * @param intensity - The intensity of the night effect.\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public night(intensity: number, multiply: boolean): void\n {\n intensity = intensity || 0.1;\n\n const matrix: ColorMatrix = [\n intensity * (-2.0), -intensity, 0, 0, 0,\n -intensity, 0, intensity, 0, 0,\n 0, intensity, intensity * 2.0, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * Predator effect\n *\n * Erase the current matrix by setting a new indepent one\n *\n * @param amount - how much the predator feels his future victim\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public predator(amount: number, multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n // row 1\n 11.224130630493164 * amount,\n -4.794486999511719 * amount,\n -2.8746118545532227 * amount,\n 0 * amount,\n 0.40342438220977783 * amount,\n // row 2\n -3.6330697536468506 * amount,\n 9.193157196044922 * amount,\n -2.951810836791992 * amount,\n 0 * amount,\n -1.316135048866272 * amount,\n // row 3\n -3.2184197902679443 * amount,\n -4.2375030517578125 * amount,\n 7.476448059082031 * amount,\n 0 * amount,\n 0.8044459223747253 * amount,\n // row 4\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /**\n * LSD effect\n *\n * Multiply the current matrix\n *\n * @param multiply - if true, current matrix and matrix are multiplied. If false,\n * just set the current matrix with @param matrix\n */\n public lsd(multiply: boolean): void\n {\n const matrix: ColorMatrix = [\n 2, -0.4, 0.5, 0, 0,\n -0.5, 2, -0.4, 0, 0,\n -0.4, -0.5, 3, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, multiply);\n }\n\n /** Erase the current matrix by setting the default one. */\n public reset(): void\n {\n const matrix: ColorMatrix = [\n 1, 0, 0, 0, 0,\n 0, 1, 0, 0, 0,\n 0, 0, 1, 0, 0,\n 0, 0, 0, 1, 0,\n ];\n\n this._loadMatrix(matrix, false);\n }\n\n /**\n * The matrix of the color matrix filter\n *\n * @member {number[]}\n * @default [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]\n */\n get matrix(): ColorMatrix\n {\n return this.uniforms.m;\n }\n\n set matrix(value: ColorMatrix)\n {\n this.uniforms.m = value;\n }\n\n /**\n * The opacity value to use when mixing the original and resultant colors.\n *\n * When the value is 0, the original color is used without modification.\n * When the value is 1, the result color is used.\n * When in the range (0, 1) the color is interpolated between the original and result by this amount.\n *\n * @default 1\n */\n get alpha(): number\n {\n return this.uniforms.uAlpha;\n }\n\n set alpha(value: number)\n {\n this.uniforms.uAlpha = value;\n }\n}\n\n// Americanized alias\nColorMatrixFilter.prototype.grayscale = ColorMatrixFilter.prototype.greyscale;\n","import { Filter } from '@pixi/core';\nimport { Matrix, Point } from '@pixi/math';\nimport fragment from './displacement.frag';\nimport vertex from './displacement.vert';\n\nimport type { CLEAR_MODES } from '@pixi/constants';\nimport type { FilterSystem, RenderTexture, Texture, ISpriteMaskTarget } from '@pixi/core';\n\n/**\n * The DisplacementFilter class uses the pixel values from the specified texture\n * (called the displacement map) to perform a displacement of an object.\n *\n * You can use this filter to apply all manor of crazy warping effects.\n * Currently the `r` property of the texture is used to offset the `x`\n * and the `g` property of the texture is used to offset the `y`.\n *\n * The way it works is it uses the values of the displacement map to look up the\n * correct pixels to output. This means it's not technically moving the original.\n * Instead, it's starting at the output and asking \"which pixel from the original goes here\".\n * For example, if a displacement map pixel has `red = 1` and the filter scale is `20`,\n * this filter will output the pixel approximately 20 pixels to the right of the original.\n *\n * @memberof PIXI.filters\n */\nexport class DisplacementFilter extends Filter\n{\n public maskSprite: ISpriteMaskTarget;\n public maskMatrix: Matrix;\n public scale: Point;\n\n /**\n * @param {PIXI.Sprite} sprite - The sprite used for the displacement map. (make sure its added to the scene!)\n * @param scale - The scale of the displacement\n */\n constructor(sprite: ISpriteMaskTarget, scale?: number)\n {\n const maskMatrix = new Matrix();\n\n sprite.renderable = false;\n\n super(vertex, fragment, {\n mapSampler: sprite._texture,\n filterMatrix: maskMatrix,\n scale: { x: 1, y: 1 },\n rotation: new Float32Array([1, 0, 0, 1]),\n });\n\n this.maskSprite = sprite;\n this.maskMatrix = maskMatrix;\n\n if (scale === null || scale === undefined)\n {\n scale = 20;\n }\n\n /**\n * scaleX, scaleY for displacements\n * @member {PIXI.Point}\n */\n this.scale = new Point(scale, scale);\n }\n\n /**\n * Applies the filter.\n *\n * @param filterManager - The manager.\n * @param input - The input target.\n * @param output - The output target.\n * @param clearMode - clearMode.\n */\n public apply(\n filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES\n ): void\n {\n // fill maskMatrix with _normalized sprite texture coords_\n this.uniforms.filterMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, this.maskSprite);\n this.uniforms.scale.x = this.scale.x;\n this.uniforms.scale.y = this.scale.y;\n\n // Extract rotation from world transform\n const wt = this.maskSprite.worldTransform;\n const lenX = Math.sqrt((wt.a * wt.a) + (wt.b * wt.b));\n const lenY = Math.sqrt((wt.c * wt.c) + (wt.d * wt.d));\n\n if (lenX !== 0 && lenY !== 0)\n {\n this.uniforms.rotation[0] = wt.a / lenX;\n this.uniforms.rotation[1] = wt.b / lenX;\n this.uniforms.rotation[2] = wt.c / lenY;\n this.uniforms.rotation[3] = wt.d / lenY;\n }\n\n // draw the filter...\n filterManager.applyFilter(this, input, output, clearMode);\n }\n\n /** The texture used for the displacement map. Must be power of 2 sized texture. */\n get map(): Texture\n {\n return this.uniforms.mapSampler;\n }\n\n set map(value: Texture)\n {\n this.uniforms.mapSampler = value;\n }\n}\n","import { Filter } from '@pixi/core';\nimport vertex from './fxaa.vert';\nimport fragment from './fxaa.frag';\n\n/**\n * Basic FXAA (Fast Approximate Anti-Aliasing) implementation based on the code on geeks3d.com\n * with the modification that the texture2DLod stuff was removed since it is unsupported by WebGL.\n *\n * @see https://github.com/mitsuhiko/webgl-meincraft\n *\n * @memberof PIXI.filters\n */\nexport class FXAAFilter extends Filter\n{\n constructor()\n {\n // TODO - needs work\n super(vertex, fragment);\n }\n}\n","/*!\n * @pixi/constants - v6.2.1\n * Compiled Tue, 21 Dec 2021 19:56:15 UTC\n *\n * @pixi/constants is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * Different types of environments for WebGL.\n *\n * @static\n * @memberof PIXI\n * @name ENV\n * @enum {number}\n * @property {number} WEBGL_LEGACY - Used for older v1 WebGL devices. PixiJS will aim to ensure compatibility\n * with older / less advanced devices. If you experience unexplained flickering prefer this environment.\n * @property {number} WEBGL - Version 1 of WebGL\n * @property {number} WEBGL2 - Version 2 of WebGL\n */\nvar ENV;\n(function (ENV) {\n ENV[ENV[\"WEBGL_LEGACY\"] = 0] = \"WEBGL_LEGACY\";\n ENV[ENV[\"WEBGL\"] = 1] = \"WEBGL\";\n ENV[ENV[\"WEBGL2\"] = 2] = \"WEBGL2\";\n})(ENV || (ENV = {}));\n/**\n * Constant to identify the Renderer Type.\n *\n * @static\n * @memberof PIXI\n * @name RENDERER_TYPE\n * @enum {number}\n * @property {number} UNKNOWN - Unknown render type.\n * @property {number} WEBGL - WebGL render type.\n * @property {number} CANVAS - Canvas render type.\n */\nvar RENDERER_TYPE;\n(function (RENDERER_TYPE) {\n RENDERER_TYPE[RENDERER_TYPE[\"UNKNOWN\"] = 0] = \"UNKNOWN\";\n RENDERER_TYPE[RENDERER_TYPE[\"WEBGL\"] = 1] = \"WEBGL\";\n RENDERER_TYPE[RENDERER_TYPE[\"CANVAS\"] = 2] = \"CANVAS\";\n})(RENDERER_TYPE || (RENDERER_TYPE = {}));\n/**\n * Bitwise OR of masks that indicate the buffers to be cleared.\n *\n * @static\n * @memberof PIXI\n * @name BUFFER_BITS\n * @enum {number}\n * @property {number} COLOR - Indicates the buffers currently enabled for color writing.\n * @property {number} DEPTH - Indicates the depth buffer.\n * @property {number} STENCIL - Indicates the stencil buffer.\n */\nvar BUFFER_BITS;\n(function (BUFFER_BITS) {\n BUFFER_BITS[BUFFER_BITS[\"COLOR\"] = 16384] = \"COLOR\";\n BUFFER_BITS[BUFFER_BITS[\"DEPTH\"] = 256] = \"DEPTH\";\n BUFFER_BITS[BUFFER_BITS[\"STENCIL\"] = 1024] = \"STENCIL\";\n})(BUFFER_BITS || (BUFFER_BITS = {}));\n/**\n * Various blend modes supported by PIXI.\n *\n * IMPORTANT - The WebGL renderer only supports the NORMAL, ADD, MULTIPLY and SCREEN blend modes.\n * Anything else will silently act like NORMAL.\n *\n * @memberof PIXI\n * @name BLEND_MODES\n * @enum {number}\n * @property {number} NORMAL\n * @property {number} ADD\n * @property {number} MULTIPLY\n * @property {number} SCREEN\n * @property {number} OVERLAY\n * @property {number} DARKEN\n * @property {number} LIGHTEN\n * @property {number} COLOR_DODGE\n * @property {number} COLOR_BURN\n * @property {number} HARD_LIGHT\n * @property {number} SOFT_LIGHT\n * @property {number} DIFFERENCE\n * @property {number} EXCLUSION\n * @property {number} HUE\n * @property {number} SATURATION\n * @property {number} COLOR\n * @property {number} LUMINOSITY\n * @property {number} NORMAL_NPM\n * @property {number} ADD_NPM\n * @property {number} SCREEN_NPM\n * @property {number} NONE\n * @property {number} SRC_IN\n * @property {number} SRC_OUT\n * @property {number} SRC_ATOP\n * @property {number} DST_OVER\n * @property {number} DST_IN\n * @property {number} DST_OUT\n * @property {number} DST_ATOP\n * @property {number} SUBTRACT\n * @property {number} SRC_OVER\n * @property {number} ERASE\n * @property {number} XOR\n */\nvar BLEND_MODES;\n(function (BLEND_MODES) {\n BLEND_MODES[BLEND_MODES[\"NORMAL\"] = 0] = \"NORMAL\";\n BLEND_MODES[BLEND_MODES[\"ADD\"] = 1] = \"ADD\";\n BLEND_MODES[BLEND_MODES[\"MULTIPLY\"] = 2] = \"MULTIPLY\";\n BLEND_MODES[BLEND_MODES[\"SCREEN\"] = 3] = \"SCREEN\";\n BLEND_MODES[BLEND_MODES[\"OVERLAY\"] = 4] = \"OVERLAY\";\n BLEND_MODES[BLEND_MODES[\"DARKEN\"] = 5] = \"DARKEN\";\n BLEND_MODES[BLEND_MODES[\"LIGHTEN\"] = 6] = \"LIGHTEN\";\n BLEND_MODES[BLEND_MODES[\"COLOR_DODGE\"] = 7] = \"COLOR_DODGE\";\n BLEND_MODES[BLEND_MODES[\"COLOR_BURN\"] = 8] = \"COLOR_BURN\";\n BLEND_MODES[BLEND_MODES[\"HARD_LIGHT\"] = 9] = \"HARD_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"SOFT_LIGHT\"] = 10] = \"SOFT_LIGHT\";\n BLEND_MODES[BLEND_MODES[\"DIFFERENCE\"] = 11] = \"DIFFERENCE\";\n BLEND_MODES[BLEND_MODES[\"EXCLUSION\"] = 12] = \"EXCLUSION\";\n BLEND_MODES[BLEND_MODES[\"HUE\"] = 13] = \"HUE\";\n BLEND_MODES[BLEND_MODES[\"SATURATION\"] = 14] = \"SATURATION\";\n BLEND_MODES[BLEND_MODES[\"COLOR\"] = 15] = \"COLOR\";\n BLEND_MODES[BLEND_MODES[\"LUMINOSITY\"] = 16] = \"LUMINOSITY\";\n BLEND_MODES[BLEND_MODES[\"NORMAL_NPM\"] = 17] = \"NORMAL_NPM\";\n BLEND_MODES[BLEND_MODES[\"ADD_NPM\"] = 18] = \"ADD_NPM\";\n BLEND_MODES[BLEND_MODES[\"SCREEN_NPM\"] = 19] = \"SCREEN_NPM\";\n BLEND_MODES[BLEND_MODES[\"NONE\"] = 20] = \"NONE\";\n BLEND_MODES[BLEND_MODES[\"SRC_OVER\"] = 0] = \"SRC_OVER\";\n BLEND_MODES[BLEND_MODES[\"SRC_IN\"] = 21] = \"SRC_IN\";\n BLEND_MODES[BLEND_MODES[\"SRC_OUT\"] = 22] = \"SRC_OUT\";\n BLEND_MODES[BLEND_MODES[\"SRC_ATOP\"] = 23] = \"SRC_ATOP\";\n BLEND_MODES[BLEND_MODES[\"DST_OVER\"] = 24] = \"DST_OVER\";\n BLEND_MODES[BLEND_MODES[\"DST_IN\"] = 25] = \"DST_IN\";\n BLEND_MODES[BLEND_MODES[\"DST_OUT\"] = 26] = \"DST_OUT\";\n BLEND_MODES[BLEND_MODES[\"DST_ATOP\"] = 27] = \"DST_ATOP\";\n BLEND_MODES[BLEND_MODES[\"ERASE\"] = 26] = \"ERASE\";\n BLEND_MODES[BLEND_MODES[\"SUBTRACT\"] = 28] = \"SUBTRACT\";\n BLEND_MODES[BLEND_MODES[\"XOR\"] = 29] = \"XOR\";\n})(BLEND_MODES || (BLEND_MODES = {}));\n/**\n * Various webgl draw modes. These can be used to specify which GL drawMode to use\n * under certain situations and renderers.\n *\n * @memberof PIXI\n * @static\n * @name DRAW_MODES\n * @enum {number}\n * @property {number} POINTS\n * @property {number} LINES\n * @property {number} LINE_LOOP\n * @property {number} LINE_STRIP\n * @property {number} TRIANGLES\n * @property {number} TRIANGLE_STRIP\n * @property {number} TRIANGLE_FAN\n */\nvar DRAW_MODES;\n(function (DRAW_MODES) {\n DRAW_MODES[DRAW_MODES[\"POINTS\"] = 0] = \"POINTS\";\n DRAW_MODES[DRAW_MODES[\"LINES\"] = 1] = \"LINES\";\n DRAW_MODES[DRAW_MODES[\"LINE_LOOP\"] = 2] = \"LINE_LOOP\";\n DRAW_MODES[DRAW_MODES[\"LINE_STRIP\"] = 3] = \"LINE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLES\"] = 4] = \"TRIANGLES\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_STRIP\"] = 5] = \"TRIANGLE_STRIP\";\n DRAW_MODES[DRAW_MODES[\"TRIANGLE_FAN\"] = 6] = \"TRIANGLE_FAN\";\n})(DRAW_MODES || (DRAW_MODES = {}));\n/**\n * Various GL texture/resources formats.\n *\n * @memberof PIXI\n * @static\n * @name FORMATS\n * @enum {number}\n * @property {number} RGBA=6408\n * @property {number} RGB=6407\n * @property {number} RG=33319\n * @property {number} RED=6403\n * @property {number} RGBA_INTEGER=36249\n * @property {number} RGB_INTEGER=36248\n * @property {number} RG_INTEGER=33320\n * @property {number} RED_INTEGER=36244\n * @property {number} ALPHA=6406\n * @property {number} LUMINANCE=6409\n * @property {number} LUMINANCE_ALPHA=6410\n * @property {number} DEPTH_COMPONENT=6402\n * @property {number} DEPTH_STENCIL=34041\n */\nvar FORMATS;\n(function (FORMATS) {\n FORMATS[FORMATS[\"RGBA\"] = 6408] = \"RGBA\";\n FORMATS[FORMATS[\"RGB\"] = 6407] = \"RGB\";\n FORMATS[FORMATS[\"RG\"] = 33319] = \"RG\";\n FORMATS[FORMATS[\"RED\"] = 6403] = \"RED\";\n FORMATS[FORMATS[\"RGBA_INTEGER\"] = 36249] = \"RGBA_INTEGER\";\n FORMATS[FORMATS[\"RGB_INTEGER\"] = 36248] = \"RGB_INTEGER\";\n FORMATS[FORMATS[\"RG_INTEGER\"] = 33320] = \"RG_INTEGER\";\n FORMATS[FORMATS[\"RED_INTEGER\"] = 36244] = \"RED_INTEGER\";\n FORMATS[FORMATS[\"ALPHA\"] = 6406] = \"ALPHA\";\n FORMATS[FORMATS[\"LUMINANCE\"] = 6409] = \"LUMINANCE\";\n FORMATS[FORMATS[\"LUMINANCE_ALPHA\"] = 6410] = \"LUMINANCE_ALPHA\";\n FORMATS[FORMATS[\"DEPTH_COMPONENT\"] = 6402] = \"DEPTH_COMPONENT\";\n FORMATS[FORMATS[\"DEPTH_STENCIL\"] = 34041] = \"DEPTH_STENCIL\";\n})(FORMATS || (FORMATS = {}));\n/**\n * Various GL target types.\n *\n * @memberof PIXI\n * @static\n * @name TARGETS\n * @enum {number}\n * @property {number} TEXTURE_2D=3553\n * @property {number} TEXTURE_CUBE_MAP=34067\n * @property {number} TEXTURE_2D_ARRAY=35866\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_X=34069\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_X=34070\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Y=34071\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Y=34072\n * @property {number} TEXTURE_CUBE_MAP_POSITIVE_Z=34073\n * @property {number} TEXTURE_CUBE_MAP_NEGATIVE_Z=34074\n */\nvar TARGETS;\n(function (TARGETS) {\n TARGETS[TARGETS[\"TEXTURE_2D\"] = 3553] = \"TEXTURE_2D\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP\"] = 34067] = \"TEXTURE_CUBE_MAP\";\n TARGETS[TARGETS[\"TEXTURE_2D_ARRAY\"] = 35866] = \"TEXTURE_2D_ARRAY\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_X\"] = 34069] = \"TEXTURE_CUBE_MAP_POSITIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_X\"] = 34070] = \"TEXTURE_CUBE_MAP_NEGATIVE_X\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Y\"] = 34071] = \"TEXTURE_CUBE_MAP_POSITIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Y\"] = 34072] = \"TEXTURE_CUBE_MAP_NEGATIVE_Y\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_POSITIVE_Z\"] = 34073] = \"TEXTURE_CUBE_MAP_POSITIVE_Z\";\n TARGETS[TARGETS[\"TEXTURE_CUBE_MAP_NEGATIVE_Z\"] = 34074] = \"TEXTURE_CUBE_MAP_NEGATIVE_Z\";\n})(TARGETS || (TARGETS = {}));\n/**\n * Various GL data format types.\n *\n * @memberof PIXI\n * @static\n * @name TYPES\n * @enum {number}\n * @property {number} UNSIGNED_BYTE=5121\n * @property {number} UNSIGNED_SHORT=5123\n * @property {number} UNSIGNED_SHORT_5_6_5=33635\n * @property {number} UNSIGNED_SHORT_4_4_4_4=32819\n * @property {number} UNSIGNED_SHORT_5_5_5_1=32820\n * @property {number} UNSIGNED_INT=5125\n * @property {number} UNSIGNED_INT_10F_11F_11F_REV=35899\n * @property {number} UNSIGNED_INT_2_10_10_10_REV=33640\n * @property {number} UNSIGNED_INT_24_8=34042\n * @property {number} UNSIGNED_INT_5_9_9_9_REV=35902\n * @property {number} BYTE=5120\n * @property {number} SHORT=5122\n * @property {number} INT=5124\n * @property {number} FLOAT=5126\n * @property {number} FLOAT_32_UNSIGNED_INT_24_8_REV=36269\n * @property {number} HALF_FLOAT=36193\n */\nvar TYPES;\n(function (TYPES) {\n TYPES[TYPES[\"UNSIGNED_BYTE\"] = 5121] = \"UNSIGNED_BYTE\";\n TYPES[TYPES[\"UNSIGNED_SHORT\"] = 5123] = \"UNSIGNED_SHORT\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_6_5\"] = 33635] = \"UNSIGNED_SHORT_5_6_5\";\n TYPES[TYPES[\"UNSIGNED_SHORT_4_4_4_4\"] = 32819] = \"UNSIGNED_SHORT_4_4_4_4\";\n TYPES[TYPES[\"UNSIGNED_SHORT_5_5_5_1\"] = 32820] = \"UNSIGNED_SHORT_5_5_5_1\";\n TYPES[TYPES[\"UNSIGNED_INT\"] = 5125] = \"UNSIGNED_INT\";\n TYPES[TYPES[\"UNSIGNED_INT_10F_11F_11F_REV\"] = 35899] = \"UNSIGNED_INT_10F_11F_11F_REV\";\n TYPES[TYPES[\"UNSIGNED_INT_2_10_10_10_REV\"] = 33640] = \"UNSIGNED_INT_2_10_10_10_REV\";\n TYPES[TYPES[\"UNSIGNED_INT_24_8\"] = 34042] = \"UNSIGNED_INT_24_8\";\n TYPES[TYPES[\"UNSIGNED_INT_5_9_9_9_REV\"] = 35902] = \"UNSIGNED_INT_5_9_9_9_REV\";\n TYPES[TYPES[\"BYTE\"] = 5120] = \"BYTE\";\n TYPES[TYPES[\"SHORT\"] = 5122] = \"SHORT\";\n TYPES[TYPES[\"INT\"] = 5124] = \"INT\";\n TYPES[TYPES[\"FLOAT\"] = 5126] = \"FLOAT\";\n TYPES[TYPES[\"FLOAT_32_UNSIGNED_INT_24_8_REV\"] = 36269] = \"FLOAT_32_UNSIGNED_INT_24_8_REV\";\n TYPES[TYPES[\"HALF_FLOAT\"] = 36193] = \"HALF_FLOAT\";\n})(TYPES || (TYPES = {}));\n/**\n * Various sampler types. Correspond to `sampler`, `isampler`, `usampler` GLSL types respectively.\n * WebGL1 works only with FLOAT.\n *\n * @memberof PIXI\n * @static\n * @name SAMPLER_TYPES\n * @enum {number}\n * @property {number} FLOAT=0\n * @property {number} INT=1\n * @property {number} UINT=2\n */\nvar SAMPLER_TYPES;\n(function (SAMPLER_TYPES) {\n SAMPLER_TYPES[SAMPLER_TYPES[\"FLOAT\"] = 0] = \"FLOAT\";\n SAMPLER_TYPES[SAMPLER_TYPES[\"INT\"] = 1] = \"INT\";\n SAMPLER_TYPES[SAMPLER_TYPES[\"UINT\"] = 2] = \"UINT\";\n})(SAMPLER_TYPES || (SAMPLER_TYPES = {}));\n/**\n * The scale modes that are supported by pixi.\n *\n * The {@link PIXI.settings.SCALE_MODE} scale mode affects the default scaling mode of future operations.\n * It can be re-assigned to either LINEAR or NEAREST, depending upon suitability.\n *\n * @memberof PIXI\n * @static\n * @name SCALE_MODES\n * @enum {number}\n * @property {number} LINEAR Smooth scaling\n * @property {number} NEAREST Pixelating scaling\n */\nvar SCALE_MODES;\n(function (SCALE_MODES) {\n SCALE_MODES[SCALE_MODES[\"NEAREST\"] = 0] = \"NEAREST\";\n SCALE_MODES[SCALE_MODES[\"LINEAR\"] = 1] = \"LINEAR\";\n})(SCALE_MODES || (SCALE_MODES = {}));\n/**\n * The wrap modes that are supported by pixi.\n *\n * The {@link PIXI.settings.WRAP_MODE} wrap mode affects the default wrapping mode of future operations.\n * It can be re-assigned to either CLAMP or REPEAT, depending upon suitability.\n * If the texture is non power of two then clamp will be used regardless as WebGL can\n * only use REPEAT if the texture is po2.\n *\n * This property only affects WebGL.\n *\n * @name WRAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} CLAMP - The textures uvs are clamped\n * @property {number} REPEAT - The texture uvs tile and repeat\n * @property {number} MIRRORED_REPEAT - The texture uvs tile and repeat with mirroring\n */\nvar WRAP_MODES;\n(function (WRAP_MODES) {\n WRAP_MODES[WRAP_MODES[\"CLAMP\"] = 33071] = \"CLAMP\";\n WRAP_MODES[WRAP_MODES[\"REPEAT\"] = 10497] = \"REPEAT\";\n WRAP_MODES[WRAP_MODES[\"MIRRORED_REPEAT\"] = 33648] = \"MIRRORED_REPEAT\";\n})(WRAP_MODES || (WRAP_MODES = {}));\n/**\n * Mipmap filtering modes that are supported by pixi.\n *\n * The {@link PIXI.settings.MIPMAP_TEXTURES} affects default texture filtering.\n * Mipmaps are generated for a baseTexture if its `mipmap` field is `ON`,\n * or its `POW2` and texture dimensions are powers of 2.\n * Due to platform restriction, `ON` option will work like `POW2` for webgl-1.\n *\n * This property only affects WebGL.\n *\n * @name MIPMAP_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} OFF - No mipmaps\n * @property {number} POW2 - Generate mipmaps if texture dimensions are pow2\n * @property {number} ON - Always generate mipmaps\n * @property {number} ON_MANUAL - Use mipmaps, but do not auto-generate them; this is used with a resource\n * that supports buffering each level-of-detail.\n */\nvar MIPMAP_MODES;\n(function (MIPMAP_MODES) {\n MIPMAP_MODES[MIPMAP_MODES[\"OFF\"] = 0] = \"OFF\";\n MIPMAP_MODES[MIPMAP_MODES[\"POW2\"] = 1] = \"POW2\";\n MIPMAP_MODES[MIPMAP_MODES[\"ON\"] = 2] = \"ON\";\n MIPMAP_MODES[MIPMAP_MODES[\"ON_MANUAL\"] = 3] = \"ON_MANUAL\";\n})(MIPMAP_MODES || (MIPMAP_MODES = {}));\n/**\n * How to treat textures with premultiplied alpha\n *\n * @name ALPHA_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NO_PREMULTIPLIED_ALPHA - Source is not premultiplied, leave it like that.\n * Option for compressed and data textures that are created from typed arrays.\n * @property {number} PREMULTIPLY_ON_UPLOAD - Source is not premultiplied, premultiply on upload.\n * Default option, used for all loaded images.\n * @property {number} PREMULTIPLIED_ALPHA - Source is already premultiplied\n * Example: spine atlases with `_pma` suffix.\n * @property {number} NPM - Alias for NO_PREMULTIPLIED_ALPHA.\n * @property {number} UNPACK - Default option, alias for PREMULTIPLY_ON_UPLOAD.\n * @property {number} PMA - Alias for PREMULTIPLIED_ALPHA.\n */\nvar ALPHA_MODES;\n(function (ALPHA_MODES) {\n ALPHA_MODES[ALPHA_MODES[\"NPM\"] = 0] = \"NPM\";\n ALPHA_MODES[ALPHA_MODES[\"UNPACK\"] = 1] = \"UNPACK\";\n ALPHA_MODES[ALPHA_MODES[\"PMA\"] = 2] = \"PMA\";\n ALPHA_MODES[ALPHA_MODES[\"NO_PREMULTIPLIED_ALPHA\"] = 0] = \"NO_PREMULTIPLIED_ALPHA\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ON_UPLOAD\"] = 1] = \"PREMULTIPLY_ON_UPLOAD\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLY_ALPHA\"] = 2] = \"PREMULTIPLY_ALPHA\";\n ALPHA_MODES[ALPHA_MODES[\"PREMULTIPLIED_ALPHA\"] = 2] = \"PREMULTIPLIED_ALPHA\";\n})(ALPHA_MODES || (ALPHA_MODES = {}));\n/**\n * Configure whether filter textures are cleared after binding.\n *\n * Filter textures need not be cleared if the filter does not use pixel blending. {@link CLEAR_MODES.BLIT} will detect\n * this and skip clearing as an optimization.\n *\n * @name CLEAR_MODES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} BLEND - Do not clear the filter texture. The filter's output will blend on top of the output texture.\n * @property {number} CLEAR - Always clear the filter texture.\n * @property {number} BLIT - Clear only if {@link FilterSystem.forceClear} is set or if the filter uses pixel blending.\n * @property {number} NO - Alias for BLEND, same as `false` in earlier versions\n * @property {number} YES - Alias for CLEAR, same as `true` in earlier versions\n * @property {number} AUTO - Alias for BLIT\n */\nvar CLEAR_MODES;\n(function (CLEAR_MODES) {\n CLEAR_MODES[CLEAR_MODES[\"NO\"] = 0] = \"NO\";\n CLEAR_MODES[CLEAR_MODES[\"YES\"] = 1] = \"YES\";\n CLEAR_MODES[CLEAR_MODES[\"AUTO\"] = 2] = \"AUTO\";\n CLEAR_MODES[CLEAR_MODES[\"BLEND\"] = 0] = \"BLEND\";\n CLEAR_MODES[CLEAR_MODES[\"CLEAR\"] = 1] = \"CLEAR\";\n CLEAR_MODES[CLEAR_MODES[\"BLIT\"] = 2] = \"BLIT\";\n})(CLEAR_MODES || (CLEAR_MODES = {}));\n/**\n * The gc modes that are supported by pixi.\n *\n * The {@link PIXI.settings.GC_MODE} Garbage Collection mode for PixiJS textures is AUTO\n * If set to GC_MODE, the renderer will occasionally check textures usage. If they are not\n * used for a specified period of time they will be removed from the GPU. They will of course\n * be uploaded again when they are required. This is a silent behind the scenes process that\n * should ensure that the GPU does not get filled up.\n *\n * Handy for mobile devices!\n * This property only affects WebGL.\n *\n * @name GC_MODES\n * @enum {number}\n * @static\n * @memberof PIXI\n * @property {number} AUTO - Garbage collection will happen periodically automatically\n * @property {number} MANUAL - Garbage collection will need to be called manually\n */\nvar GC_MODES;\n(function (GC_MODES) {\n GC_MODES[GC_MODES[\"AUTO\"] = 0] = \"AUTO\";\n GC_MODES[GC_MODES[\"MANUAL\"] = 1] = \"MANUAL\";\n})(GC_MODES || (GC_MODES = {}));\n/**\n * Constants that specify float precision in shaders.\n *\n * @name PRECISION\n * @memberof PIXI\n * @constant\n * @static\n * @enum {string}\n * @property {string} LOW='lowp'\n * @property {string} MEDIUM='mediump'\n * @property {string} HIGH='highp'\n */\nvar PRECISION;\n(function (PRECISION) {\n PRECISION[\"LOW\"] = \"lowp\";\n PRECISION[\"MEDIUM\"] = \"mediump\";\n PRECISION[\"HIGH\"] = \"highp\";\n})(PRECISION || (PRECISION = {}));\n/**\n * Constants for mask implementations.\n * We use `type` suffix because it leads to very different behaviours\n *\n * @name MASK_TYPES\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - Mask is ignored\n * @property {number} SCISSOR - Scissor mask, rectangle on screen, cheap\n * @property {number} STENCIL - Stencil mask, 1-bit, medium, works only if renderer supports stencil\n * @property {number} SPRITE - Mask that uses SpriteMaskFilter, uses temporary RenderTexture\n */\nvar MASK_TYPES;\n(function (MASK_TYPES) {\n MASK_TYPES[MASK_TYPES[\"NONE\"] = 0] = \"NONE\";\n MASK_TYPES[MASK_TYPES[\"SCISSOR\"] = 1] = \"SCISSOR\";\n MASK_TYPES[MASK_TYPES[\"STENCIL\"] = 2] = \"STENCIL\";\n MASK_TYPES[MASK_TYPES[\"SPRITE\"] = 3] = \"SPRITE\";\n})(MASK_TYPES || (MASK_TYPES = {}));\n/**\n * Constants for multi-sampling antialiasing.\n *\n * @see PIXI.Framebuffer#multisample\n *\n * @name MSAA_QUALITY\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} NONE - No multisampling for this renderTexture\n * @property {number} LOW - Try 2 samples\n * @property {number} MEDIUM - Try 4 samples\n * @property {number} HIGH - Try 8 samples\n */\nvar MSAA_QUALITY;\n(function (MSAA_QUALITY) {\n MSAA_QUALITY[MSAA_QUALITY[\"NONE\"] = 0] = \"NONE\";\n MSAA_QUALITY[MSAA_QUALITY[\"LOW\"] = 2] = \"LOW\";\n MSAA_QUALITY[MSAA_QUALITY[\"MEDIUM\"] = 4] = \"MEDIUM\";\n MSAA_QUALITY[MSAA_QUALITY[\"HIGH\"] = 8] = \"HIGH\";\n})(MSAA_QUALITY || (MSAA_QUALITY = {}));\n/**\n * Constants for various buffer types in Pixi\n *\n * @see PIXI.BUFFER_TYPE\n *\n * @name BUFFER_TYPE\n * @memberof PIXI\n * @static\n * @enum {number}\n * @property {number} ELEMENT_ARRAY_BUFFER - buffer type for using as an index buffer\n * @property {number} ARRAY_BUFFER - buffer type for using attribute data\n * @property {number} UNIFORM_BUFFER - the buffer type is for uniform buffer objects\n */\nvar BUFFER_TYPE;\n(function (BUFFER_TYPE) {\n BUFFER_TYPE[BUFFER_TYPE[\"ELEMENT_ARRAY_BUFFER\"] = 34963] = \"ELEMENT_ARRAY_BUFFER\";\n BUFFER_TYPE[BUFFER_TYPE[\"ARRAY_BUFFER\"] = 34962] = \"ARRAY_BUFFER\";\n // NOT YET SUPPORTED\n BUFFER_TYPE[BUFFER_TYPE[\"UNIFORM_BUFFER\"] = 35345] = \"UNIFORM_BUFFER\";\n})(BUFFER_TYPE || (BUFFER_TYPE = {}));\n\nexport { ALPHA_MODES, BLEND_MODES, BUFFER_BITS, BUFFER_TYPE, CLEAR_MODES, DRAW_MODES, ENV, FORMATS, GC_MODES, MASK_TYPES, MIPMAP_MODES, MSAA_QUALITY, PRECISION, RENDERER_TYPE, SAMPLER_TYPES, SCALE_MODES, TARGETS, TYPES, WRAP_MODES };\n//# sourceMappingURL=constants.js.map\n","import { Filter, defaultFilterVertex } from '@pixi/core';\nimport fragment from './noise.frag';\n\n/**\n * A Noise effect filter.\n *\n * original filter: https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js\n *\n * @memberof PIXI.filters\n * @author Vico @vicocotea\n */\nexport class NoiseFilter extends Filter\n{\n /**\n * @param {number} [noise=0.5] - The noise intensity, should be a normalized value in the range [0, 1].\n * @param {number} [seed] - A random seed for the noise generation. Default is `Math.random()`.\n */\n constructor(noise = 0.5, seed = Math.random())\n {\n super(defaultFilterVertex, fragment, {\n uNoise: 0,\n uSeed: 0,\n });\n\n this.noise = noise;\n this.seed = seed;\n }\n\n /**\n * The amount of noise to apply, this value should be in the range (0, 1].\n *\n * @default 0.5\n */\n get noise(): number\n {\n return this.uniforms.uNoise;\n }\n\n set noise(value: number)\n {\n this.uniforms.uNoise = value;\n }\n\n /** A seed value to apply to the random noise generation. `Math.random()` is a good value to use. */\n get seed(): number\n {\n return this.uniforms.uSeed;\n }\n\n set seed(value: number)\n {\n this.uniforms.uSeed = value;\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Sprite } from '@pixi/sprite';\nimport { Ticker, UPDATE_PRIORITY } from '@pixi/ticker';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * An AnimatedSprite is a simple way to display an animation depicted by a list of textures.\n *\n * ```js\n * let alienImages = [\"image_sequence_01.png\",\"image_sequence_02.png\",\"image_sequence_03.png\",\"image_sequence_04.png\"];\n * let textureArray = [];\n *\n * for (let i=0; i < 4; i++)\n * {\n * let texture = PIXI.Texture.from(alienImages[i]);\n * textureArray.push(texture);\n * };\n *\n * let animatedSprite = new PIXI.AnimatedSprite(textureArray);\n * ```\n *\n * The more efficient and simpler way to create an animated sprite is using a {@link PIXI.Spritesheet}\n * containing the animation definitions:\n *\n * ```js\n * PIXI.Loader.shared.add(\"assets/spritesheet.json\").load(setup);\n *\n * function setup() {\n * let sheet = PIXI.Loader.shared.resources[\"assets/spritesheet.json\"].spritesheet;\n * animatedSprite = new PIXI.AnimatedSprite(sheet.animations[\"image_sequence\"]);\n * ...\n * }\n * ```\n *\n * @memberof PIXI\n */\nexport class AnimatedSprite extends Sprite\n{\n /**\n * The speed that the AnimatedSprite will play at. Higher is faster, lower is slower.\n *\n * @default 1\n */\n public animationSpeed: number;\n\n /**\n * Whether or not the animate sprite repeats after playing.\n *\n * @default true\n */\n public loop: boolean;\n\n /**\n * Update anchor to [Texture's defaultAnchor]{@link PIXI.Texture#defaultAnchor} when frame changes.\n *\n * Useful with [sprite sheet animations]{@link PIXI.Spritesheet#animations} created with tools.\n * Changing anchor for each frame allows to pin sprite origin to certain moving feature\n * of the frame (e.g. left foot).\n *\n * Note: Enabling this will override any previously set `anchor` on each frame change.\n *\n * @default false\n */\n public updateAnchor: boolean;\n\n /**\n * User-assigned function to call when an AnimatedSprite finishes playing.\n *\n * @example\n * animation.onComplete = function () {\n * // finished!\n * };\n */\n public onComplete?: () => void;\n\n /**\n * User-assigned function to call when an AnimatedSprite changes which texture is being rendered.\n *\n * @example\n * animation.onFrameChange = function () {\n * // updated!\n * };\n */\n public onFrameChange?: (currentFrame: number) => void;\n\n /**\n * User-assigned function to call when `loop` is true, and an AnimatedSprite is played and\n * loops around to start again.\n *\n * @example\n * animation.onLoop = function () {\n * // looped!\n * };\n */\n public onLoop?: () => void;\n\n private _playing: boolean;\n private _textures: Texture[];\n private _durations: number[];\n\n /**\n * `true` uses PIXI.Ticker.shared to auto update animation time.\n *\n * @default true\n */\n private _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update animation time.\n *\n * @default false\n */\n private _isConnectedToTicker: boolean;\n\n /** Elapsed time since animation has been started, used internally to display current texture. */\n private _currentTime: number;\n\n /** The texture index that was displayed last time. */\n private _previousFrame: number;\n\n /**\n * @param textures - An array of {@link PIXI.Texture} or frame\n * objects that make up the animation.\n * @param {boolean} [autoUpdate=true] - Whether to use PIXI.Ticker.shared to auto update animation time.\n */\n constructor(textures: Texture[]|FrameObject[], autoUpdate = true)\n {\n super(textures[0] instanceof Texture ? textures[0] : textures[0].texture);\n\n this._textures = null;\n this._durations = null;\n this._autoUpdate = autoUpdate;\n this._isConnectedToTicker = false;\n\n this.animationSpeed = 1;\n this.loop = true;\n this.updateAnchor = false;\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n\n this._currentTime = 0;\n\n this._playing = false;\n this._previousFrame = null;\n\n this.textures = textures;\n }\n\n /** Stops the AnimatedSprite. */\n public stop(): void\n {\n if (!this._playing)\n {\n return;\n }\n\n this._playing = false;\n if (this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Plays the AnimatedSprite. */\n public play(): void\n {\n if (this._playing)\n {\n return;\n }\n\n this._playing = true;\n if (this._autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this, UPDATE_PRIORITY.HIGH);\n this._isConnectedToTicker = true;\n }\n }\n\n /**\n * Stops the AnimatedSprite and goes to a specific frame.\n *\n * @param frameNumber - Frame index to stop at.\n */\n public gotoAndStop(frameNumber: number): void\n {\n this.stop();\n\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n }\n\n /**\n * Goes to a specific frame and begins playing the AnimatedSprite.\n *\n * @param frameNumber - Frame index to start at.\n */\n public gotoAndPlay(frameNumber: number): void\n {\n const previousFrame = this.currentFrame;\n\n this._currentTime = frameNumber;\n\n if (previousFrame !== this.currentFrame)\n {\n this.updateTexture();\n }\n\n this.play();\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * @param deltaTime - Time since last tick.\n */\n update(deltaTime: number): void\n {\n if (!this._playing)\n {\n return;\n }\n\n const elapsed = this.animationSpeed * deltaTime;\n const previousFrame = this.currentFrame;\n\n if (this._durations !== null)\n {\n let lag = this._currentTime % 1 * this._durations[this.currentFrame];\n\n lag += elapsed / 60 * 1000;\n\n while (lag < 0)\n {\n this._currentTime--;\n lag += this._durations[this.currentFrame];\n }\n\n const sign = Math.sign(this.animationSpeed * deltaTime);\n\n this._currentTime = Math.floor(this._currentTime);\n\n while (lag >= this._durations[this.currentFrame])\n {\n lag -= this._durations[this.currentFrame] * sign;\n this._currentTime += sign;\n }\n\n this._currentTime += lag / this._durations[this.currentFrame];\n }\n else\n {\n this._currentTime += elapsed;\n }\n\n if (this._currentTime < 0 && !this.loop)\n {\n this.gotoAndStop(0);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (this._currentTime >= this._textures.length && !this.loop)\n {\n this.gotoAndStop(this._textures.length - 1);\n\n if (this.onComplete)\n {\n this.onComplete();\n }\n }\n else if (previousFrame !== this.currentFrame)\n {\n if (this.loop && this.onLoop)\n {\n if (this.animationSpeed > 0 && this.currentFrame < previousFrame)\n {\n this.onLoop();\n }\n else if (this.animationSpeed < 0 && this.currentFrame > previousFrame)\n {\n this.onLoop();\n }\n }\n\n this.updateTexture();\n }\n }\n\n /** Updates the displayed texture to match the current frame index. */\n private updateTexture(): void\n {\n const currentFrame = this.currentFrame;\n\n if (this._previousFrame === currentFrame)\n {\n return;\n }\n\n this._previousFrame = currentFrame;\n\n this._texture = this._textures[currentFrame];\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n this.uvs = this._texture._uvs.uvsFloat32;\n\n if (this.updateAnchor)\n {\n this._anchor.copyFrom(this._texture.defaultAnchor);\n }\n\n if (this.onFrameChange)\n {\n this.onFrameChange(this.currentFrame);\n }\n }\n\n /**\n * Stops the AnimatedSprite and destroys it.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all options\n * have been set to that value.\n * @param {boolean} [options.children=false] - If set to true, all the children will have their destroy\n * method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Should it destroy the current texture of the sprite as well.\n * @param {boolean} [options.baseTexture=false] - Should it destroy the base texture of the sprite as well.\n */\n public destroy(options?: IDestroyOptions|boolean): void\n {\n this.stop();\n super.destroy(options);\n\n this.onComplete = null;\n this.onFrameChange = null;\n this.onLoop = null;\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of frame ids.\n *\n * @param frames - The array of frames ids the AnimatedSprite will use as its texture frames.\n * @return - The new animated sprite with the specified frames.\n */\n public static fromFrames(frames: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < frames.length; ++i)\n {\n textures.push(Texture.from(frames[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * A short hand way of creating an AnimatedSprite from an array of image ids.\n *\n * @param images - The array of image urls the AnimatedSprite will use as its texture frames.\n * @return The new animate sprite with the specified images as frames.\n */\n public static fromImages(images: string[]): AnimatedSprite\n {\n const textures = [];\n\n for (let i = 0; i < images.length; ++i)\n {\n textures.push(Texture.from(images[i]));\n }\n\n return new AnimatedSprite(textures);\n }\n\n /**\n * The total number of frames in the AnimatedSprite. This is the same as number of textures\n * assigned to the AnimatedSprite.\n *\n * @readonly\n * @default 0\n */\n get totalFrames(): number\n {\n return this._textures.length;\n }\n\n /** The array of textures used for this AnimatedSprite. */\n get textures(): Texture[]|FrameObject[]\n {\n return this._textures;\n }\n\n set textures(value: Texture[]|FrameObject[])\n {\n if (value[0] instanceof Texture)\n {\n this._textures = value as Texture[];\n this._durations = null;\n }\n else\n {\n this._textures = [];\n this._durations = [];\n\n for (let i = 0; i < value.length; i++)\n {\n this._textures.push((value[i] as FrameObject).texture);\n this._durations.push((value[i] as FrameObject).time);\n }\n }\n this._previousFrame = null;\n this.gotoAndStop(0);\n this.updateTexture();\n }\n\n /**\n * The AnimatedSprites current frame index.\n *\n * @readonly\n */\n get currentFrame(): number\n {\n let currentFrame = Math.floor(this._currentTime) % this._textures.length;\n\n if (currentFrame < 0)\n {\n currentFrame += this._textures.length;\n }\n\n return currentFrame;\n }\n\n /**\n * Indicates if the AnimatedSprite is currently playing.\n *\n * @readonly\n */\n get playing(): boolean\n {\n return this._playing;\n }\n\n /** Whether to use PIXI.Ticker.shared to auto update animation time. */\n get autoUpdate(): boolean\n {\n return this._autoUpdate;\n }\n\n set autoUpdate(value: boolean)\n {\n if (value !== this._autoUpdate)\n {\n this._autoUpdate = value;\n\n if (!this._autoUpdate && this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._playing)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n}\n\n/** @memberof PIXI.AnimatedSprite */\nexport interface FrameObject {\n /** The {@link PIXI.Texture} of the frame. */\n texture: Texture;\n\n /** The duration of the frame, in milliseconds. */\n time: number;\n}\n","import { Graphics } from '@pixi/graphics';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\nimport { RenderTexture, Texture } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { BaseRenderTexture } from '@pixi/core';\n\nlet canvasRenderer: CanvasRenderer;\nconst tempMatrix = new Matrix();\n\n/**\n * Generates a canvas texture. Only available with **pixi.js-legacy** bundle\n * or the **@pixi/canvas-graphics** package.\n * @method generateCanvasTexture\n * @memberof PIXI.Graphics#\n * @param {PIXI.SCALE_MODES} scaleMode - The scale mode of the texture.\n * @param {number} resolution - The resolution of the texture.\n * @return {PIXI.Texture} The new texture.\n */\nGraphics.prototype.generateCanvasTexture = function generateCanvasTexture(scaleMode: SCALE_MODES, resolution = 1): Texture\n{\n const bounds = this.getLocalBounds();\n\n const canvasBuffer = RenderTexture.create({\n width: bounds.width,\n height: bounds.height,\n scaleMode,\n resolution,\n });\n\n if (!canvasRenderer)\n {\n canvasRenderer = new CanvasRenderer();\n }\n\n this.transform.updateLocalTransform();\n this.transform.localTransform.copyTo(tempMatrix);\n\n tempMatrix.invert();\n\n tempMatrix.tx -= bounds.x;\n tempMatrix.ty -= bounds.y;\n\n canvasRenderer.render(this, { renderTexture: canvasBuffer, clear: true, transform: tempMatrix });\n\n const texture = Texture.from((canvasBuffer.baseTexture as BaseRenderTexture)._canvasRenderTarget.canvas, {\n scaleMode,\n });\n\n texture.baseTexture.setResolution(resolution);\n\n return texture;\n};\n\nGraphics.prototype.cachedGraphicsData = [];\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @method _renderCanvas\n * @memberof PIXI.Graphics#\n * @private\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nGraphics.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n if (this.isMask === true)\n {\n return;\n }\n\n this.finishPoly();\n renderer.plugins.graphics.render(this);\n};\n","/**\n * Utilities for polygon\n * @class\n * @private\n */\nexport class PolygonUtils\n{\n /**\n * Calculate points of an offset polygon\n * @see {@link http://csharphelper.com/blog/2016/01/enlarge-a-polygon-in-c/}\n *\n * @private\n * @param {number[]} points - polygon coordinates\n * @param {number} offset\n * @return {number[]} - offset points\n */\n static offsetPolygon(points: number[], offset: number): number[]\n {\n const offsetPoints: number[] = [];\n const length: number = points.length;\n\n offset = PolygonUtils.isPolygonClockwise(points) ? offset : -1 * offset;\n\n for (let j = 0; j < length; j += 2)\n {\n // Find location for the points before and after j\n let i = (j - 2);\n\n if (i < 0)\n {\n i += length;\n }\n\n const k = (j + 2) % length;\n\n // Move the points by the offset\n let v1x = points[j] - points[i];\n let v1y = points[j + 1] - points[i + 1];\n let len = Math.sqrt((v1x * v1x) + (v1y * v1y));\n\n v1x /= len;\n v1y /= len;\n v1x *= offset;\n v1y *= offset;\n\n const norm1x = -v1y;\n const norm1y = v1x;\n\n const pij1 = [points[i] + norm1x, points[i + 1] + norm1y];\n const pij2 = [points[j] + norm1x, points[j + 1] + norm1y];\n\n let v2x = points[k] - points[j];\n let v2y = points[k + 1] - points[j + 1];\n\n len = Math.sqrt((v2x * v2x) + (v2y * v2y));\n\n v2x /= len;\n v2y /= len;\n v2x *= offset;\n v2y *= offset;\n\n const norm2x = -v2y;\n const norm2y = v2x;\n\n const pjk1 = [points[j] + norm2x, points[j + 1] + norm2y];\n const pjk2 = [points[k] + norm2x, points[k + 1] + norm2y];\n\n // Find where the shifted lines ij and jk intersect.\n const intersectPoint = PolygonUtils\n .findIntersection(pij1[0], pij1[1], pij2[0], pij2[1], pjk1[0], pjk1[1], pjk2[0], pjk2[1]);\n\n if (intersectPoint)\n {\n offsetPoints.push(...intersectPoint);\n }\n }\n\n return offsetPoints;\n }\n\n /**\n * Determine the intersection point of two line segments\n * @see {@link here http://paulbourke.net/geometry/pointlineplane/}\n *\n * @private\n * @param {number} x1 - x-coordinate of start point at first line\n * @param {number} y1 - y-coordinate of start point at first line\n * @param {number} x2 - x-coordinate of end point at first line\n * @param {number} y2 - y-coordinate of end point at first line\n * @param {number} x3 - x-coordinate of start point at second line\n * @param {number} y3 - y-coordinate of start point at second line\n * @param {number} x4 - x-coordinate of end point at second line\n * @param {number} y4 - y-coordinate of end point at second line\n * @returns {[number, number] | null} - [x, y] coordinates of intersection\n */\n static findIntersection(\n x1: number, y1: number, x2: number, y2: number,\n x3: number, y3: number, x4: number, y4: number\n ): [number, number] | null\n {\n const denominator = ((y4 - y3) * (x2 - x1)) - ((x4 - x3) * (y2 - y1));\n const numeratorA = ((x4 - x3) * (y1 - y3)) - ((y4 - y3) * (x1 - x3));\n const numeratorB = ((x2 - x1) * (y1 - y3)) - ((y2 - y1) * (x1 - x3));\n\n // lines are parallel\n if (denominator === 0)\n {\n // lines are coincident\n if (numeratorA === 0 && numeratorB === 0)\n {\n return [(x1 + x2) / 2, (y1 + y2) / 2];\n }\n\n return null;\n }\n\n const uA = numeratorA / denominator;\n\n return [x1 + (uA * (x2 - x1)), y1 + (uA * (y2 - y1))];\n }\n\n /**\n * Determine polygon are clockwise or counterclockwise\n * @see {@link https://stackoverflow.com/questions/1165647}\n *\n * @private\n * @param {number[]} polygon - polygon coordinates\n * @return {boolean}\n */\n static isPolygonClockwise(polygon: number[]): boolean\n {\n let sum = 0;\n\n for (let i = 0; i < polygon.length - 2; i += 2)\n {\n sum += (polygon[i + 2] - polygon[i]) * (polygon[i + 3] + polygon[i + 1]);\n }\n\n return sum > 0;\n }\n}\n","import { Texture } from '@pixi/core';\nimport { SHAPES, Matrix } from '@pixi/math';\nimport { canvasUtils, CrossPlatformCanvasRenderingContext2D } from '@pixi/canvas-renderer';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { FillStyle, Graphics, GraphicsData, LineStyle } from '@pixi/graphics';\nimport type { Circle, Ellipse, Polygon, Rectangle, RoundedRectangle } from '@pixi/math';\nimport { PolygonUtils } from './utils/PolygonUtils';\n\n/*\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they\n * now share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's CanvasGraphicsRenderer:\n * https://github.com/libgdx/libgdx/blob/1.0.0/gdx/src/com/badlogic/gdx/graphics/glutils/ShapeRenderer.java\n */\n\n/**\n * Renderer dedicated to drawing and batching graphics objects.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class CanvasGraphicsRenderer\n{\n /** A reference to the current renderer */\n public renderer: CanvasRenderer;\n private _svgMatrix: DOMMatrix|boolean = null;\n private _tempMatrix: Matrix = new Matrix();\n\n /**\n * @param renderer - A reference to the current renderer.\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * calculates fill/stroke style for canvas\n *\n * @private\n * @param style - A graphics {@link PIXI.FILL_STYLE} where if `texture` is specified then a tinted CanvasPattern\n * will be used for the fill.stroke\n * @param tint - color to set the fill/stroke too.\n */\n private _calcCanvasStyle(style: FillStyle, tint: number): string|CanvasPattern\n {\n let res;\n\n if (style.texture && style.texture.baseTexture !== Texture.WHITE.baseTexture)\n {\n if (style.texture.valid)\n {\n res = canvasUtils.getTintedPattern(style.texture, tint);\n this.setPatternTransform(res, style.matrix || Matrix.IDENTITY);\n }\n else\n {\n res = '#808080';\n }\n }\n else\n {\n res = `#${(`00000${(tint | 0).toString(16)}`).substr(-6)}`;\n }\n\n return res;\n }\n\n /**\n * Renders a Graphics object to a canvas.\n *\n * @param graphics - the actual graphics object to render\n */\n public render(graphics: Graphics): void\n {\n const renderer = this.renderer;\n const context = renderer.context;\n const worldAlpha = graphics.worldAlpha;\n const transform = graphics.transform.worldTransform;\n\n renderer.setContextTransform(transform);\n renderer.setBlendMode(graphics.blendMode);\n\n const graphicsData = graphics.geometry.graphicsData;\n\n let contextFillStyle;\n let contextStrokeStyle;\n\n const tintR = ((graphics.tint >> 16) & 0xFF) / 255;\n const tintG = ((graphics.tint >> 8) & 0xFF) / 255;\n const tintB = (graphics.tint & 0xFF) / 255;\n\n for (let i = 0; i < graphicsData.length; i++)\n {\n const data = graphicsData[i];\n const shape = data.shape;\n const fillStyle = data.fillStyle;\n const lineStyle = data.lineStyle;\n\n const fillColor = data.fillStyle.color | 0;\n const lineColor = data.lineStyle.color | 0;\n\n if (data.matrix)\n {\n renderer.setContextTransform(transform.copyTo(this._tempMatrix).append(data.matrix));\n }\n\n if (fillStyle.visible)\n {\n const fillTint = (\n (((fillColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)\n + (((fillColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)\n + (((fillColor & 0xFF) / 255) * tintB * 255)\n );\n\n contextFillStyle = this._calcCanvasStyle(fillStyle, fillTint);\n }\n if (lineStyle.visible)\n {\n const lineTint = (\n (((lineColor >> 16) & 0xFF) / 255 * tintR * 255 << 16)\n + (((lineColor >> 8) & 0xFF) / 255 * tintG * 255 << 8)\n + (((lineColor & 0xFF) / 255) * tintB * 255)\n );\n\n contextStrokeStyle = this._calcCanvasStyle(lineStyle, lineTint);\n }\n\n context.lineWidth = lineStyle.width;\n context.lineCap = lineStyle.cap;\n context.lineJoin = lineStyle.join;\n context.miterLimit = lineStyle.miterLimit;\n\n if (data.type === SHAPES.POLY)\n {\n context.beginPath();\n\n const tempShape = shape as Polygon;\n let points = tempShape.points;\n const holes = data.holes;\n let outerArea;\n let innerArea;\n let px;\n let py;\n let holesDirection: boolean[];\n\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n\n if (tempShape.closeStroke)\n {\n context.closePath();\n }\n\n if (holes.length > 0)\n {\n holesDirection = [];\n outerArea = 0;\n px = points[0];\n py = points[1];\n for (let j = 2; j + 2 < points.length; j += 2)\n {\n outerArea += ((points[j] - px) * (points[j + 3] - py))\n - ((points[j + 2] - px) * (points[j + 1] - py));\n }\n\n for (let k = 0; k < holes.length; k++)\n {\n points = (holes[k].shape as Polygon).points;\n\n if (!points)\n {\n continue;\n }\n\n innerArea = 0;\n px = points[0];\n py = points[1];\n for (let j = 2; j + 2 < points.length; j += 2)\n {\n innerArea += ((points[j] - px) * (points[j + 3] - py))\n - ((points[j + 2] - px) * (points[j + 1] - py));\n }\n\n if (innerArea * outerArea < 0)\n {\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n else\n {\n context.moveTo(points[points.length - 2], points[points.length - 1]);\n\n for (let j = points.length - 4; j >= 0; j -= 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n\n if ((holes[k].shape as Polygon).closeStroke)\n {\n context.closePath();\n }\n\n holesDirection[k] = innerArea * outerArea < 0;\n }\n }\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n\n if (lineStyle.visible)\n {\n this.paintPolygonStroke(\n tempShape, lineStyle, contextStrokeStyle, holes, holesDirection, worldAlpha, context\n );\n }\n }\n else if (data.type === SHAPES.RECT)\n {\n const tempShape = shape as Rectangle;\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fillRect(tempShape.x, tempShape.y, tempShape.width, tempShape.height);\n }\n\n if (lineStyle.visible)\n {\n const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));\n const width = tempShape.width + (2 * alignmentOffset);\n const height = tempShape.height + (2 * alignmentOffset);\n\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.strokeRect(tempShape.x - alignmentOffset, tempShape.y - alignmentOffset, width, height);\n }\n }\n else if (data.type === SHAPES.CIRC)\n {\n const tempShape = shape as Circle;\n\n // TODO - need to be Undefined!\n context.beginPath();\n context.arc(tempShape.x, tempShape.y, tempShape.radius, 0, 2 * Math.PI);\n context.closePath();\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n\n if (lineStyle.visible)\n {\n if (lineStyle.alignment !== 0.5)\n {\n const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));\n\n context.beginPath();\n context.arc(tempShape.x, tempShape.y, tempShape.radius + alignmentOffset, 0, 2 * Math.PI);\n context.closePath();\n }\n\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n }\n else if (data.type === SHAPES.ELIP)\n {\n const tempShape = shape as Ellipse;\n const drawShapeOverStroke = lineStyle.alignment === 1;\n\n if (!drawShapeOverStroke)\n {\n this.paintEllipse(tempShape, fillStyle, lineStyle, contextFillStyle, worldAlpha, context);\n }\n\n if (lineStyle.visible)\n {\n if (lineStyle.alignment !== 0.5)\n {\n const kappa = 0.5522848;\n const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));\n const sW = (tempShape.width + alignmentOffset) * 2;\n const sH = (tempShape.height + alignmentOffset) * 2;\n const sX = tempShape.x - (sW / 2);\n const sY = tempShape.y - (sH / 2);\n const sOx = (sW / 2) * kappa;\n const sOy = (sH / 2) * kappa;\n const sXe = sX + sW;\n const sYe = sY + sH;\n const sXm = sX + (sW / 2);\n const sYm = sY + (sH / 2);\n\n context.beginPath();\n context.moveTo(sX, sYm);\n context.bezierCurveTo(sX, sYm - sOy, sXm - sOx, sY, sXm, sY);\n context.bezierCurveTo(sXm + sOx, sY, sXe, sYm - sOy, sXe, sYm);\n context.bezierCurveTo(sXe, sYm + sOy, sXm + sOx, sYe, sXm, sYe);\n context.bezierCurveTo(sXm - sOx, sYe, sX, sYm + sOy, sX, sYm);\n context.closePath();\n }\n\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n\n if (drawShapeOverStroke)\n {\n this.paintEllipse(tempShape, fillStyle, lineStyle, contextFillStyle, worldAlpha, context);\n }\n }\n else if (data.type === SHAPES.RREC)\n {\n const tempShape = shape as RoundedRectangle;\n const drawShapeOverStroke = lineStyle.alignment === 1;\n\n if (!drawShapeOverStroke)\n {\n this.paintRoundedRectangle(tempShape, fillStyle, lineStyle, contextFillStyle, worldAlpha, context);\n }\n\n if (lineStyle.visible)\n {\n if (lineStyle.alignment !== 0.5)\n {\n const width = tempShape.width;\n const height = tempShape.height;\n const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));\n const sRx = tempShape.x - alignmentOffset;\n const sRy = tempShape.y - alignmentOffset;\n const sWidth = tempShape.width + (2 * alignmentOffset);\n const sHeight = tempShape.height + (2 * alignmentOffset);\n const radiusOffset = alignmentOffset * (lineStyle.alignment >= 1\n ? Math.min(sWidth / width, sHeight / height) : Math.min(width / sWidth, height / sHeight));\n let sRadius = tempShape.radius + radiusOffset;\n const sMaxRadius = Math.min(sWidth, sHeight) / 2;\n\n sRadius = sRadius > sMaxRadius ? sMaxRadius : sRadius;\n\n context.beginPath();\n context.moveTo(sRx, sRy + sRadius);\n context.lineTo(sRx, sRy + sHeight - sRadius);\n context.quadraticCurveTo(sRx, sRy + sHeight, sRx + sRadius, sRy + sHeight);\n context.lineTo(sRx + sWidth - sRadius, sRy + sHeight);\n context.quadraticCurveTo(sRx + sWidth, sRy + sHeight, sRx + sWidth, sRy + sHeight - sRadius);\n context.lineTo(sRx + sWidth, sRy + sRadius);\n context.quadraticCurveTo(sRx + sWidth, sRy, sRx + sWidth - sRadius, sRy);\n context.lineTo(sRx + sRadius, sRy);\n context.quadraticCurveTo(sRx, sRy, sRx, sRy + sRadius);\n context.closePath();\n }\n\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n\n if (drawShapeOverStroke)\n {\n this.paintRoundedRectangle(tempShape, fillStyle, lineStyle, contextFillStyle, worldAlpha, context);\n }\n }\n }\n }\n\n /**\n * Paint stroke for polygon and holes\n *\n * @private\n * @param shape - Shape to be drawn\n * @param lineStyle - Line style for the shape\n * @param contextStrokeStyle - The strokeStyle for the canvas context\n * @param holes - Holes to be added to the shape\n * @param holesDirection -\n * @param worldAlpha - The multiplied alpha of the displayObject\n * @param context - The canvas context\n */\n private paintPolygonStroke(\n shape: Polygon, lineStyle: LineStyle, contextStrokeStyle: string|CanvasPattern,\n holes: GraphicsData[], holesDirection: boolean[],\n worldAlpha: number, context: CrossPlatformCanvasRenderingContext2D\n ): void\n {\n if (lineStyle.alignment !== 0.5)\n {\n const alignmentOffset = lineStyle.width * (0.5 - (1 - lineStyle.alignment));\n let offsetPoints = PolygonUtils.offsetPolygon(shape.points, alignmentOffset);\n let points;\n\n context.beginPath();\n context.moveTo(offsetPoints[0], offsetPoints[1]);\n\n for (let j = 2; j < offsetPoints.length; j += 2)\n {\n context.lineTo(offsetPoints[j], offsetPoints[j + 1]);\n }\n\n if (shape.closeStroke)\n {\n context.closePath();\n }\n\n for (let k = 0; k < holes.length; k++)\n {\n points = (holes[k].shape as Polygon).points;\n offsetPoints = PolygonUtils.offsetPolygon(points, alignmentOffset);\n\n if (holesDirection[k])\n {\n context.moveTo(offsetPoints[0], offsetPoints[1]);\n\n for (let j = 2; j < offsetPoints.length; j += 2)\n {\n context.lineTo(offsetPoints[j], offsetPoints[j + 1]);\n }\n }\n else\n {\n context.moveTo(offsetPoints[offsetPoints.length - 2], offsetPoints[offsetPoints.length - 1]);\n\n for (let j = offsetPoints.length - 4; j >= 0; j -= 2)\n {\n context.lineTo(offsetPoints[j], offsetPoints[j + 1]);\n }\n }\n\n if ((holes[k].shape as Polygon).closeStroke)\n {\n context.closePath();\n }\n }\n }\n\n context.globalAlpha = lineStyle.alpha * worldAlpha;\n context.strokeStyle = contextStrokeStyle;\n context.stroke();\n }\n\n /**\n * Paint Ellipse\n *\n * @private\n * @param shape - Shape to be drawn\n * @param fillStyle - Fill for the shape\n * @param lineStyle - Line style for the shape\n * @param contextFillStyle - The canvas context fill style\n * @param worldAlpha - The multiplied alpha of the displayObject\n * @param context - The canvas context\n */\n private paintEllipse(\n shape: Ellipse, fillStyle: FillStyle, lineStyle: LineStyle,\n contextFillStyle: string|CanvasPattern, worldAlpha: number,\n context: CrossPlatformCanvasRenderingContext2D): void\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n const w = shape.width * 2;\n const h = shape.height * 2;\n\n const x = shape.x - (w / 2);\n const y = shape.y - (h / 2);\n\n const kappa = 0.5522848;\n const ox = (w / 2) * kappa; // control point offset horizontal\n const oy = (h / 2) * kappa; // control point offset vertical\n const xe = x + w; // x-end\n const ye = y + h; // y-end\n const xm = x + (w / 2); // x-middle\n const ym = y + (h / 2); // y-middle\n\n context.beginPath();\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n context.closePath();\n\n if (lineStyle.alignment === 0)\n {\n context.clip();\n }\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n }\n\n /**\n * Paint Rounded Rectangle\n *\n * @private\n * @param shape - Shape to be drawn\n * @param fillStyle - Fill for the shape\n * @param lineStyle - Line style for the shape\n * @param contextFillStyle - The canvas context fill style\n * @param worldAlpha - The multiplied alpha of the displayObject\n * @param context - The canvas context\n */\n private paintRoundedRectangle(\n shape: RoundedRectangle, fillStyle: FillStyle, lineStyle: LineStyle,\n contextFillStyle: string|CanvasPattern, worldAlpha: number,\n context: CrossPlatformCanvasRenderingContext2D\n ): void\n {\n const rx = shape.x;\n const ry = shape.y;\n const width = shape.width;\n const height = shape.height;\n let radius = shape.radius;\n\n const maxRadius = Math.min(width, height) / 2;\n\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.beginPath();\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n\n if (lineStyle.alignment === 0)\n {\n context.clip();\n }\n\n if (fillStyle.visible)\n {\n context.globalAlpha = fillStyle.alpha * worldAlpha;\n context.fillStyle = contextFillStyle;\n context.fill();\n }\n }\n\n public setPatternTransform(pattern: CanvasPattern, matrix: Matrix): void\n {\n if (this._svgMatrix === false)\n {\n return;\n }\n if (!this._svgMatrix)\n {\n const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n\n if (svg && svg.createSVGMatrix)\n {\n this._svgMatrix = svg.createSVGMatrix();\n }\n if (!this._svgMatrix || !pattern.setTransform)\n {\n this._svgMatrix = false;\n\n return;\n }\n }\n\n (this._svgMatrix as DOMMatrix).a = matrix.a;\n (this._svgMatrix as DOMMatrix).b = matrix.b;\n (this._svgMatrix as DOMMatrix).c = matrix.c;\n (this._svgMatrix as DOMMatrix).d = matrix.d;\n (this._svgMatrix as DOMMatrix).e = matrix.tx;\n (this._svgMatrix as DOMMatrix).f = matrix.ty;\n pattern.setTransform((this._svgMatrix as DOMMatrix).inverse());\n }\n\n /** destroy graphics object */\n public destroy(): void\n {\n this.renderer = null;\n this._svgMatrix = null;\n this._tempMatrix = null;\n }\n}\n","import { SCALE_MODES, BLEND_MODES } from '@pixi/constants';\nimport { Matrix, groupD8 } from '@pixi/math';\nimport { canvasUtils } from '@pixi/canvas-renderer';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { Sprite } from '@pixi/sprite';\n\nconst canvasRenderWorldTransform = new Matrix();\n\n/**\n * Types that can be passed to drawImage\n * @typedef {HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | ImageBitmap} ICanvasImageSource\n * @memberof PIXI\n */\n\n/*\n * @author Mat Groves\n *\n * Big thanks to the very clever Matt DesLauriers https://github.com/mattdesl/\n * for creating the original PixiJS version!\n * Also a thanks to https://github.com/bchevalier for tweaking the tint and alpha so that they now\n * share 4 bytes on the vertex buffer\n *\n * Heavily inspired by LibGDX's CanvasSpriteRenderer:\n * https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/graphics/g2d/CanvasSpriteRenderer.java\n */\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nexport class CanvasSpriteRenderer\n{\n /** A reference to the current renderer */\n protected renderer: CanvasRenderer;\n\n /** @param renderer - A reference to the current renderer */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Renders the sprite object.\n *\n * @param sprite - the sprite to render when using this spritebatch\n */\n render(sprite: Sprite): void\n {\n const texture = sprite._texture;\n const renderer = this.renderer;\n const context = renderer.context;\n\n if (!texture.valid)\n {\n return;\n }\n\n const width = texture._frame.width;\n const height = texture._frame.height;\n\n let wt = sprite.transform.worldTransform;\n let dx = 0;\n let dy = 0;\n\n const source = texture.baseTexture.getDrawableSource();\n\n if (texture.orig.width <= 0 || texture.orig.height <= 0 || !texture.valid || !source)\n {\n return;\n }\n\n renderer.setBlendMode(sprite.blendMode, true);\n\n renderer.context.globalAlpha = sprite.worldAlpha;\n\n // If smoothingEnabled is supported and we need to change the smoothing property for sprite texture\n const smoothingEnabled = texture.baseTexture.scaleMode === SCALE_MODES.LINEAR;\n\n if (renderer.smoothProperty\n && renderer.context[renderer.smoothProperty] !== smoothingEnabled)\n {\n context[renderer.smoothProperty] = smoothingEnabled;\n }\n\n if (texture.trim)\n {\n dx = (texture.trim.width / 2) + texture.trim.x - (sprite.anchor.x * texture.orig.width);\n dy = (texture.trim.height / 2) + texture.trim.y - (sprite.anchor.y * texture.orig.height);\n }\n else\n {\n dx = (0.5 - sprite.anchor.x) * texture.orig.width;\n dy = (0.5 - sprite.anchor.y) * texture.orig.height;\n }\n\n if (texture.rotate)\n {\n wt.copyTo(canvasRenderWorldTransform);\n wt = canvasRenderWorldTransform;\n groupD8.matrixAppendRotationInv(wt, texture.rotate, dx, dy);\n // the anchor has already been applied above, so lets set it to zero\n dx = 0;\n dy = 0;\n }\n\n dx -= width / 2;\n dy -= height / 2;\n\n renderer.setContextTransform(wt, sprite.roundPixels, 1);\n // Allow for pixel rounding\n if (sprite.roundPixels)\n {\n dx = dx | 0;\n dy = dy | 0;\n }\n\n const resolution = texture.baseTexture.resolution;\n const outerBlend = renderer._outerBlend;\n\n if (outerBlend)\n {\n context.save();\n context.beginPath();\n context.rect(\n dx * renderer.resolution,\n dy * renderer.resolution,\n width * renderer.resolution,\n height * renderer.resolution\n );\n context.clip();\n }\n\n if (sprite.tint !== 0xFFFFFF)\n {\n if (sprite._cachedTint !== sprite.tint || sprite._tintedCanvas.tintId !== sprite._texture._updateID)\n {\n sprite._cachedTint = sprite.tint;\n\n // TODO clean up caching - how to clean up the caches?\n sprite._tintedCanvas = canvasUtils.getTintedCanvas(sprite, sprite.tint);\n }\n\n context.drawImage(\n sprite._tintedCanvas,\n 0,\n 0,\n Math.floor(width * resolution),\n Math.floor(height * resolution),\n Math.floor(dx * renderer.resolution),\n Math.floor(dy * renderer.resolution),\n Math.floor(width * renderer.resolution),\n Math.floor(height * renderer.resolution)\n );\n }\n else\n {\n context.drawImage(\n source,\n texture._frame.x * resolution,\n texture._frame.y * resolution,\n Math.floor(width * resolution),\n Math.floor(height * resolution),\n Math.floor(dx * renderer.resolution),\n Math.floor(dy * renderer.resolution),\n Math.floor(width * renderer.resolution),\n Math.floor(height * renderer.resolution)\n );\n }\n\n if (outerBlend)\n {\n context.restore();\n }\n // just in case, leaking outer blend here will be catastrophic!\n renderer.setBlendMode(BLEND_MODES.NORMAL);\n }\n\n /** destroy the sprite object */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Sprite } from '@pixi/sprite';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Cached tinted texture.\n * @memberof PIXI.Sprite#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nSprite.prototype._tintedCanvas = null;\n\n/**\n* Renders the object using the Canvas renderer\n*\n* @private\n* @method _renderCanvas\n* @memberof PIXI.Sprite#\n* @param {PIXI.CanvasRenderer} renderer - The renderer\n*/\nSprite.prototype._renderCanvas = function _renderCanvas(renderer: CanvasRenderer): void\n{\n renderer.plugins.sprite.render(this);\n};\n","import { RenderTexture } from '@pixi/core';\nimport { CanvasRenderTarget } from '@pixi/utils';\nimport { Rectangle } from '@pixi/math';\nimport { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { DisplayObject } from '@pixi/display';\nimport type { BaseRenderTexture } from '@pixi/core';\n\nconst TEMP_RECT = new Rectangle();\n\n/**\n * The extract manager provides functionality to export content from the renderers.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.extract`\n *\n * @class\n * @memberof PIXI\n */\nexport class CanvasExtract\n{\n /** A reference to the current renderer */\n public renderer: CanvasRenderer;\n\n /**\n * @param renderer - A reference to the current renderer\n */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Will return a HTML Image of the target\n *\n * @param target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param format - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param quality - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return HTML Image of the target\n */\n public image(target?: DisplayObject|RenderTexture, format?: string, quality?: number): HTMLImageElement\n {\n const image = new Image();\n\n image.src = this.base64(target, format, quality);\n\n return image;\n }\n\n /**\n * Will return a a base64 encoded string of this target. It works by calling\n * `CanvasExtract.getCanvas` and then running toDataURL on that.\n *\n * @param target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @param format - Image format, e.g. \"image/jpeg\" or \"image/webp\".\n * @param quality - JPEG or Webp compression from 0 to 1. Default is 0.92.\n * @return A base64 encoded string of the texture.\n */\n public base64(target?: DisplayObject|RenderTexture, format?: string, quality?: number): string\n {\n return this.canvas(target).toDataURL(format, quality);\n }\n\n /**\n * Creates a Canvas element, renders this target to it and then returns it.\n *\n * @param target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return A Canvas element with the texture rendered on.\n */\n public canvas(target?: DisplayObject|RenderTexture): HTMLCanvasElement\n {\n const renderer = this.renderer;\n let context;\n let resolution;\n let frame;\n let renderTexture;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = renderer.generateTexture(target);\n }\n }\n\n if (renderTexture)\n {\n context = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.context;\n resolution = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n context = renderer.rootContext;\n resolution = renderer.resolution;\n frame = TEMP_RECT;\n frame.width = this.renderer.width;\n frame.height = this.renderer.height;\n }\n\n const width = Math.floor((frame.width * resolution) + 1e-4);\n const height = Math.floor((frame.height * resolution) + 1e-4);\n\n const canvasBuffer = new CanvasRenderTarget(width, height, 1);\n const canvasData = context.getImageData(frame.x * resolution, frame.y * resolution, width, height);\n\n canvasBuffer.context.putImageData(canvasData, 0, 0);\n\n // send the canvas back..\n return canvasBuffer.canvas;\n }\n\n /**\n * Will return a one-dimensional array containing the pixel data of the entire texture in RGBA\n * order, with integer values between 0 and 255 (included).\n *\n * @param target - A displayObject or renderTexture\n * to convert. If left empty will use the main renderer\n * @return One-dimensional array containing the pixel data of the entire texture\n */\n public pixels(target?: DisplayObject|RenderTexture): Uint8ClampedArray\n {\n const renderer = this.renderer;\n let context;\n let resolution;\n let frame;\n let renderTexture;\n\n if (target)\n {\n if (target instanceof RenderTexture)\n {\n renderTexture = target;\n }\n else\n {\n renderTexture = renderer.generateTexture(target);\n }\n }\n\n if (renderTexture)\n {\n context = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.context;\n resolution = (renderTexture.baseTexture as BaseRenderTexture)._canvasRenderTarget.resolution;\n frame = renderTexture.frame;\n }\n else\n {\n context = renderer.rootContext;\n resolution = renderer.resolution;\n frame = TEMP_RECT;\n frame.width = renderer.width;\n frame.height = renderer.height;\n }\n\n const x = frame.x * resolution;\n const y = frame.y * resolution;\n const width = frame.width * resolution;\n const height = frame.height * resolution;\n\n return context.getImageData(x, y, width, height).data;\n }\n\n /** Destroys the extract */\n public destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { BaseTexture } from '@pixi/core';\nimport { BasePrepare } from '@pixi/prepare';\n\nimport type { AbstractRenderer } from '@pixi/core';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { IDisplayObjectExtended } from '@pixi/prepare';\n\nconst CANVAS_START_SIZE = 16;\n\n/**\n * Built-in hook to upload PIXI.Texture objects to the GPU.\n *\n * @private\n * @param prepare - Instance of CanvasPrepare\n * @param item - Item to check\n * @return If item was uploaded.\n */\nfunction uploadBaseTextures(prepare: AbstractRenderer | BasePrepare, item: IDisplayObjectExtended): boolean\n{\n const tempPrepare = prepare as CanvasPrepare;\n\n if (item instanceof BaseTexture)\n {\n const image = (item as any).source;\n\n // Sometimes images (like atlas images) report a size of zero, causing errors on windows phone.\n // So if the width or height is equal to zero then use the canvas size\n // Otherwise use whatever is smaller, the image dimensions or the canvas dimensions.\n const imageWidth = image.width === 0 ? tempPrepare.canvas.width : Math.min(tempPrepare.canvas.width, image.width);\n const imageHeight = image.height === 0 ? tempPrepare.canvas.height\n : Math.min(tempPrepare.canvas.height, image.height);\n\n // Only a small subsections is required to be drawn to have the whole texture uploaded to the GPU\n // A smaller draw can be faster.\n tempPrepare.ctx.drawImage(\n image, 0, 0, imageWidth, imageHeight, 0, 0,\n tempPrepare.canvas.width, tempPrepare.canvas.height\n );\n\n return true;\n }\n\n return false;\n}\n\n/**\n * The prepare manager provides functionality to upload content to the GPU.\n *\n * This cannot be done directly for Canvas like in WebGL, but the effect can be achieved by drawing\n * textures to an offline canvas. This draw call will force the texture to be moved onto the GPU.\n *\n * An instance of this class is automatically created by default, and can be found at `renderer.plugins.prepare`\n *\n * @class\n * @extends PIXI.BasePrepare\n * @memberof PIXI\n */\nexport class CanvasPrepare extends BasePrepare\n{\n /**\n * An offline canvas to render textures to\n * @internal\n */\n canvas: HTMLCanvasElement;\n /**\n * The context to the canvas\n * @internal\n */\n ctx: CanvasRenderingContext2D;\n\n /**\n * @param renderer - A reference to the current renderer\n */\n constructor(renderer: CanvasRenderer)\n {\n super(renderer);\n\n this.uploadHookHelper = this;\n\n this.canvas = document.createElement('canvas');\n this.canvas.width = CANVAS_START_SIZE;\n this.canvas.height = CANVAS_START_SIZE;\n\n this.ctx = this.canvas.getContext('2d');\n\n // Add textures to upload\n this.registerUploadHook(uploadBaseTextures);\n }\n\n /** Destroys the plugin, don't use after this */\n public destroy(): void\n {\n super.destroy();\n this.ctx = null;\n this.canvas = null;\n }\n}\n","import { Container } from '@pixi/display';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\nimport type { MaskData } from '@pixi/core';\n\n/**\n * To be overridden by the subclass\n * @method _renderCanvas\n * @memberof PIXI.Container#\n * @protected\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nContainer.prototype._renderCanvas = function _renderCanvas(_renderer: CanvasRenderer): void\n{\n // this is where content itself gets rendered...\n};\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.Container#\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nContainer.prototype.renderCanvas = function renderCanvas(renderer: CanvasRenderer): void\n{\n // if not visible or the alpha is 0 then no need to render this\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n if (this._mask)\n {\n renderer.maskManager.pushMask(this._mask as MaskData);\n }\n\n this._renderCanvas(renderer);\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].renderCanvas(renderer);\n }\n\n if (this._mask)\n {\n renderer.maskManager.popMask(renderer);\n }\n};\n","import { DisplayObject } from '@pixi/display';\nimport type { CanvasRenderer } from '@pixi/canvas-renderer';\n\n/**\n * Renders the object using the Canvas renderer\n * @method renderCanvas\n * @memberof PIXI.Container#\n * @param {PIXI.CanvasRenderer} renderer - The renderer\n */\nDisplayObject.prototype.renderCanvas = function renderCanvas(_renderer: CanvasRenderer): void\n{\n // OVERWRITE;\n};\n","import { Polygon, SHAPES } from '@pixi/math';\n\nimport type { CanvasRenderer } from '../CanvasRenderer';\nimport type { Graphics } from '@pixi/graphics';\nimport type { MaskData } from '@pixi/core';\nimport type { Container } from '@pixi/display';\n\n/**\n * A set of functions used to handle masking.\n *\n * Sprite masking is not supported on the CanvasRenderer.\n *\n * @class\n * @memberof PIXI\n */\nexport class CanvasMaskManager\n{\n /** A reference to the current renderer */\n private renderer: CanvasRenderer;\n private _foundShapes: Array = [];\n\n /** @param renderer - A reference to the current renderer */\n constructor(renderer: CanvasRenderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * This method adds it to the current stack of masks.\n *\n * @param maskData - the maskData that will be pushed\n */\n pushMask(maskData: MaskData | Graphics): void\n {\n const renderer = this.renderer;\n const maskObject = ((maskData as MaskData).maskObject || maskData) as Container;\n\n renderer.context.save();\n\n // TODO support sprite alpha masks??\n // lots of effort required. If demand is great enough..\n\n const foundShapes = this._foundShapes;\n\n this.recursiveFindShapes(maskObject, foundShapes);\n if (foundShapes.length > 0)\n {\n const { context } = renderer;\n\n context.beginPath();\n\n for (let i = 0; i < foundShapes.length; i++)\n {\n const shape = foundShapes[i];\n const transform = shape.transform.worldTransform;\n\n this.renderer.setContextTransform(transform);\n\n this.renderGraphicsShape(shape);\n }\n\n foundShapes.length = 0;\n context.clip();\n }\n }\n\n /**\n * Renders all PIXI.Graphics shapes in a subtree.\n *\n * @param container - container to scan.\n * @param out - where to put found shapes\n */\n recursiveFindShapes(container: Container, out: Array): void\n {\n if ((container as Graphics).geometry && (container as Graphics).geometry.graphicsData)\n {\n out.push(container as Graphics);\n }\n\n const { children } = container;\n\n if (children)\n {\n for (let i = 0; i < children.length; i++)\n {\n this.recursiveFindShapes(children[i] as Container, out);\n }\n }\n }\n\n /**\n * Renders a PIXI.Graphics shape.\n *\n * @param graphics - The object to render.\n */\n renderGraphicsShape(graphics: Graphics): void\n {\n graphics.finishPoly();\n\n const context = this.renderer.context;\n const graphicsData = graphics.geometry.graphicsData;\n const len = graphicsData.length;\n\n if (len === 0)\n {\n return;\n }\n\n for (let i = 0; i < len; i++)\n {\n const data = graphicsData[i];\n const shape = data.shape;\n\n if (shape.type === SHAPES.POLY)\n {\n let points = shape.points;\n const holes = data.holes;\n let outerArea;\n let innerArea;\n let px;\n let py;\n\n context.moveTo(points[0], points[1]);\n\n for (let j = 1; j < points.length / 2; j++)\n {\n context.lineTo(points[j * 2], points[(j * 2) + 1]);\n }\n if (holes.length > 0)\n {\n outerArea = 0;\n px = points[0];\n py = points[1];\n for (let j = 2; j + 2 < points.length; j += 2)\n {\n outerArea += ((points[j] - px) * (points[j + 3] - py))\n - ((points[j + 2] - px) * (points[j + 1] - py));\n }\n\n for (let k = 0; k < holes.length; k++)\n {\n points = (holes[k].shape as Polygon).points;\n\n if (!points)\n {\n continue;\n }\n\n innerArea = 0;\n px = points[0];\n py = points[1];\n for (let j = 2; j + 2 < points.length; j += 2)\n {\n innerArea += ((points[j] - px) * (points[j + 3] - py))\n - ((points[j + 2] - px) * (points[j + 1] - py));\n }\n\n if (innerArea * outerArea < 0)\n {\n context.moveTo(points[0], points[1]);\n\n for (let j = 2; j < points.length; j += 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n else\n {\n context.moveTo(points[points.length - 2], points[points.length - 1]);\n\n for (let j = points.length - 4; j >= 0; j -= 2)\n {\n context.lineTo(points[j], points[j + 1]);\n }\n }\n\n if ((holes[k].shape as Polygon).closeStroke)\n {\n context.closePath();\n }\n }\n }\n // if the first and last point are the same close the path - much neater :)\n if (points[0] === points[points.length - 2] && points[1] === points[points.length - 1])\n {\n context.closePath();\n }\n }\n else if (shape.type === SHAPES.RECT)\n {\n context.rect(shape.x, shape.y, shape.width, shape.height);\n context.closePath();\n }\n else if (shape.type === SHAPES.CIRC)\n {\n // TODO - need to be Undefined!\n context.arc(shape.x, shape.y, shape.radius, 0, 2 * Math.PI);\n context.closePath();\n }\n else if (shape.type === SHAPES.ELIP)\n {\n // ellipse code taken from: http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas\n\n const w = shape.width * 2;\n const h = shape.height * 2;\n\n const x = shape.x - (w / 2);\n const y = shape.y - (h / 2);\n\n const kappa = 0.5522848;\n const ox = (w / 2) * kappa; // control point offset horizontal\n const oy = (h / 2) * kappa; // control point offset vertical\n const xe = x + w; // x-end\n const ye = y + h; // y-end\n const xm = x + (w / 2); // x-middle\n const ym = y + (h / 2); // y-middle\n\n context.moveTo(x, ym);\n context.bezierCurveTo(x, ym - oy, xm - ox, y, xm, y);\n context.bezierCurveTo(xm + ox, y, xe, ym - oy, xe, ym);\n context.bezierCurveTo(xe, ym + oy, xm + ox, ye, xm, ye);\n context.bezierCurveTo(xm - ox, ye, x, ym + oy, x, ym);\n context.closePath();\n }\n else if (shape.type === SHAPES.RREC)\n {\n const rx = shape.x;\n const ry = shape.y;\n const width = shape.width;\n const height = shape.height;\n let radius = shape.radius;\n\n const maxRadius = Math.min(width, height) / 2;\n\n radius = radius > maxRadius ? maxRadius : radius;\n\n context.moveTo(rx, ry + radius);\n context.lineTo(rx, ry + height - radius);\n context.quadraticCurveTo(rx, ry + height, rx + radius, ry + height);\n context.lineTo(rx + width - radius, ry + height);\n context.quadraticCurveTo(rx + width, ry + height, rx + width, ry + height - radius);\n context.lineTo(rx + width, ry + radius);\n context.quadraticCurveTo(rx + width, ry, rx + width - radius, ry);\n context.lineTo(rx + radius, ry);\n context.quadraticCurveTo(rx, ry, rx, ry + radius);\n context.closePath();\n }\n }\n }\n\n /**\n * Restores the current drawing context to the state it was before the mask was applied.\n *\n * @param renderer - The renderer context to use.\n */\n popMask(renderer: CanvasRenderer): void\n {\n renderer.context.restore();\n renderer.invalidateBlendMode();\n }\n\n /** Destroys this canvas mask manager. */\n public destroy(): void\n {\n /* empty */\n }\n}\n","/**\n * Creates a little colored canvas\n *\n * @ignore\n * @param {string} color - The color to make the canvas\n * @return {canvas} a small canvas element\n */\nfunction createColoredCanvas(color: string): HTMLCanvasElement\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 6;\n canvas.height = 1;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = color;\n context.fillRect(0, 0, 6, 1);\n\n return canvas;\n}\n\n/**\n * Checks whether the Canvas BlendModes are supported by the current browser\n *\n * @private\n * @return {boolean} whether they are supported\n */\nexport function canUseNewCanvasBlendModes(): boolean\n{\n if (typeof document === 'undefined')\n {\n return false;\n }\n\n const magenta = createColoredCanvas('#ff00ff');\n const yellow = createColoredCanvas('#ffff00');\n\n const canvas = document.createElement('canvas');\n\n canvas.width = 6;\n canvas.height = 1;\n\n const context = canvas.getContext('2d');\n\n context.globalCompositeOperation = 'multiply';\n context.drawImage(magenta, 0, 0);\n context.drawImage(yellow, 2, 0);\n\n const imageData = context.getImageData(2, 0, 1, 1);\n\n if (!imageData)\n {\n return false;\n }\n\n const data = imageData.data;\n\n return (data[0] === 255 && data[1] === 0 && data[2] === 0);\n}\n","import { AbstractRenderer, CanvasResource, RenderTexture, BaseRenderTexture } from '@pixi/core';\nimport { CanvasRenderTarget, sayHello, rgb2hex, hex2string, deprecation } from '@pixi/utils';\nimport { CanvasMaskManager } from './utils/CanvasMaskManager';\nimport { mapCanvasBlendModesToPixi } from './utils/mapCanvasBlendModesToPixi';\nimport { RENDERER_TYPE, SCALE_MODES, BLEND_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { Matrix } from '@pixi/math';\n\nimport type { DisplayObject } from '@pixi/display';\nimport type {\n IRendererOptions,\n IRendererPlugin,\n IRendererPlugins,\n IRendererRenderOptions\n} from '@pixi/core';\n\nconst tempMatrix = new Matrix();\n\nexport interface ICanvasRendererPluginConstructor {\n new (renderer: CanvasRenderer, options?: any): IRendererPlugin;\n}\n\nexport interface ICanvasRendererPlugins\n{\n [key: string]: any;\n}\n\n/*\n * Different browsers support different smoothing property names\n * this is the list of all platform props.\n */\ntype SmoothingEnabledProperties =\n 'imageSmoothingEnabled' |\n 'webkitImageSmoothingEnabled' |\n 'mozImageSmoothingEnabled' |\n 'oImageSmoothingEnabled' |\n 'msImageSmoothingEnabled';\n\n/**\n * Rendering context for all browsers. This includes platform-specific\n * properties that are not included in the spec for CanvasRenderingContext2D\n * @private\n */\nexport interface CrossPlatformCanvasRenderingContext2D extends CanvasRenderingContext2D\n{\n webkitImageSmoothingEnabled: boolean;\n mozImageSmoothingEnabled: boolean;\n oImageSmoothingEnabled: boolean;\n msImageSmoothingEnabled: boolean;\n}\n\n/**\n * The CanvasRenderer draws the scene and all its content onto a 2d canvas.\n *\n * This renderer should be used for browsers that do not support WebGL.\n * Don't forget to add the CanvasRenderer.view to your DOM or you will not see anything!\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.AbstractRenderer\n */\nexport class CanvasRenderer extends AbstractRenderer\n{\n /**\n * Fired after rendering finishes.\n * @event PIXI.CanvasRenderer#postrender\n */\n /**\n * Fired before rendering starts.\n * @event PIXI.CanvasRenderer#prerender\n */\n\n /** The root canvas 2d context that everything is drawn with. */\n public readonly rootContext: CrossPlatformCanvasRenderingContext2D;\n /** The currently active canvas 2d context (could change with renderTextures) */\n public context: CrossPlatformCanvasRenderingContext2D;\n /** Boolean flag controlling canvas refresh. */\n public refresh = true;\n /**\n * Instance of a CanvasMaskManager, handles masking when using the canvas renderer.\n * @member {PIXI.CanvasMaskManager}\n */\n public maskManager: CanvasMaskManager = new CanvasMaskManager(this);\n /** The canvas property used to set the canvas smoothing property. */\n public smoothProperty: SmoothingEnabledProperties = 'imageSmoothingEnabled';\n /** Tracks the blend modes useful for this renderer. */\n public readonly blendModes: string[] = mapCanvasBlendModesToPixi();\n public renderingToScreen = false;\n\n private _activeBlendMode: BLEND_MODES =null;\n /** Projection transform, passed in render() stored here */\n private _projTransform: Matrix = null;\n\n /** @private */\n _outerBlend = false;\n\n /**\n * @param options - The optional renderer parameters\n * @param {number} [options.width=800] - the width of the screen\n * @param {number} [options.height=600] - the height of the screen\n * @param {HTMLCanvasElement} [options.view] - the canvas to use as a view, optional\n * @param {boolean} [options.useContextAlpha=true] - Pass-through value for canvas' context `alpha` property.\n * If you want to set transparency, please use `backgroundAlpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1\n * @param {boolean} [options.antialias=false] - sets antialias\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.preserveDrawingBuffer=false] - enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the webgl context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {number} [options.backgroundAlpha=1] - Value from 0 (fully transparent) to 1 (fully opaque).\n */\n constructor(options?: IRendererOptions)\n {\n super(RENDERER_TYPE.CANVAS, options);\n\n this.rootContext = this.view.getContext('2d', { alpha: this.useContextAlpha }) as\n CrossPlatformCanvasRenderingContext2D;\n\n this.context = this.rootContext;\n\n if (!this.rootContext.imageSmoothingEnabled)\n {\n const rc = this.rootContext;\n\n if (rc.webkitImageSmoothingEnabled)\n {\n this.smoothProperty = 'webkitImageSmoothingEnabled';\n }\n else if (rc.mozImageSmoothingEnabled)\n {\n this.smoothProperty = 'mozImageSmoothingEnabled';\n }\n else if (rc.oImageSmoothingEnabled)\n {\n this.smoothProperty = 'oImageSmoothingEnabled';\n }\n else if (rc.msImageSmoothingEnabled)\n {\n this.smoothProperty = 'msImageSmoothingEnabled';\n }\n }\n\n this.initPlugins(CanvasRenderer.__plugins);\n\n sayHello('Canvas');\n\n this.resize(this.options.width, this.options.height);\n }\n\n /**\n * Renders the object to its WebGL view.\n *\n * @param displayObject - The object to be rendered.\n * @param options - Object to use for render options.\n * @param {PIXI.RenderTexture} [options.renderTexture] - The render texture to render to.\n * @param {boolean} [options.clear=true] - Should the canvas be cleared before the new render.\n * @param {PIXI.Matrix} [options.transform] - A transform to apply to the render texture before rendering.\n * @param {boolean} [options.skipUpdateTransform=false] - Should we skip the update transform pass?\n */\n render(displayObject: DisplayObject, options?: IRendererRenderOptions): void;\n\n /**\n * Please use the `option` render arguments instead.\n *\n * @deprecated Since 6.0.0\n * @param displayObject - The object to be rendered.\n * @param renderTexture - The render texture to render to.\n * @param clear - Should the canvas be cleared before the new render.\n * @param transform - A transform to apply to the render texture before rendering.\n * @param skipUpdateTransform - Should we skip the update transform pass?\n */\n render(displayObject: DisplayObject, renderTexture?: RenderTexture | BaseRenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /** @ignore */\n public render(displayObject: DisplayObject, options?: IRendererRenderOptions | RenderTexture | BaseRenderTexture): void\n {\n if (!this.view)\n {\n return;\n }\n\n let renderTexture: BaseRenderTexture | RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n if (options instanceof RenderTexture || options instanceof BaseRenderTexture)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'CanvasRenderer#render arguments changed, use options instead.');\n // #endif\n\n /* eslint-disable prefer-rest-params */\n renderTexture = options;\n clear = arguments[2];\n transform = arguments[3];\n skipUpdateTransform = arguments[4];\n /* eslint-enable prefer-rest-params */\n }\n else\n {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n }\n\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n\n this.emit('prerender');\n\n const rootResolution = this.resolution;\n\n if (renderTexture)\n {\n renderTexture = renderTexture.castToBaseTexture() as BaseRenderTexture;\n\n if (!renderTexture._canvasRenderTarget)\n {\n renderTexture._canvasRenderTarget = new CanvasRenderTarget(\n renderTexture.width,\n renderTexture.height,\n renderTexture.resolution\n );\n renderTexture.resource = new CanvasResource(renderTexture._canvasRenderTarget.canvas);\n renderTexture.valid = true;\n }\n\n this.context = renderTexture._canvasRenderTarget.context as CrossPlatformCanvasRenderingContext2D;\n this.resolution = renderTexture._canvasRenderTarget.resolution;\n }\n else\n {\n this.context = this.rootContext;\n }\n\n const context = this.context;\n\n this._projTransform = transform || null;\n\n if (!renderTexture)\n {\n this._lastObjectRendered = displayObject;\n }\n\n if (!skipUpdateTransform)\n {\n // update the scene graph\n const cacheParent = displayObject.enableTempParent();\n\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n }\n\n context.save();\n context.setTransform(1, 0, 0, 1, 0, 0);\n context.globalAlpha = 1;\n this._activeBlendMode = BLEND_MODES.NORMAL;\n this._outerBlend = false;\n context.globalCompositeOperation = this.blendModes[BLEND_MODES.NORMAL];\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n if (this.renderingToScreen)\n {\n context.clearRect(0, 0, this.width, this.height);\n\n if (this.backgroundAlpha > 0)\n {\n context.globalAlpha = this.useContextAlpha ? this.backgroundAlpha : 1;\n context.fillStyle = this._backgroundColorString;\n context.fillRect(0, 0, this.width, this.height);\n context.globalAlpha = 1;\n }\n }\n else\n {\n renderTexture = (renderTexture as BaseRenderTexture);\n renderTexture._canvasRenderTarget.clear();\n\n const clearColor = renderTexture.clearColor;\n\n if (clearColor[3] > 0)\n {\n context.globalAlpha = this.useContextAlpha ? clearColor[3] : 1;\n context.fillStyle = hex2string(rgb2hex(clearColor));\n context.fillRect(0, 0, renderTexture.realWidth, renderTexture.realHeight);\n context.globalAlpha = 1;\n }\n }\n }\n\n // TODO RENDER TARGET STUFF HERE..\n const tempContext = this.context;\n\n this.context = context;\n displayObject.renderCanvas(this);\n this.context = tempContext;\n\n context.restore();\n\n this.resolution = rootResolution;\n this._projTransform = null;\n\n this.emit('postrender');\n }\n\n /**\n * Sets matrix of context.\n * called only from render() methods\n * takes care about resolution\n * @param transform - world matrix of current element\n * @param roundPixels - whether to round (tx,ty) coords\n * @param localResolution - If specified, used instead of `renderer.resolution` for local scaling\n */\n setContextTransform(transform: Matrix, roundPixels?: boolean, localResolution?: number): void\n {\n let mat = transform;\n const proj = this._projTransform;\n const resolution = this.resolution;\n\n localResolution = localResolution || resolution;\n\n if (proj)\n {\n mat = tempMatrix;\n mat.copyFrom(transform);\n mat.prepend(proj);\n }\n\n if (roundPixels)\n {\n this.context.setTransform(\n mat.a * localResolution,\n mat.b * localResolution,\n mat.c * localResolution,\n mat.d * localResolution,\n (mat.tx * resolution) | 0,\n (mat.ty * resolution) | 0\n );\n }\n else\n {\n this.context.setTransform(\n mat.a * localResolution,\n mat.b * localResolution,\n mat.c * localResolution,\n mat.d * localResolution,\n mat.tx * resolution,\n mat.ty * resolution\n );\n }\n }\n\n /**\n * Clear the canvas of renderer.\n *\n * @param {string} [clearColor] - Clear the canvas with this color, except the canvas is transparent.\n * @param {number} [alpha] - Alpha to apply to the background fill color.\n */\n public clear(clearColor: string = this._backgroundColorString, alpha: number = this.backgroundAlpha): void\n {\n const { context } = this;\n\n context.clearRect(0, 0, this.width, this.height);\n\n if (clearColor)\n {\n context.globalAlpha = this.useContextAlpha ? alpha : 1;\n context.fillStyle = clearColor;\n context.fillRect(0, 0, this.width, this.height);\n context.globalAlpha = 1;\n }\n }\n\n /**\n * Sets the blend mode of the renderer.\n *\n * @param {number} blendMode - See {@link PIXI.BLEND_MODES} for valid values.\n * @param {boolean} [readyForOuterBlend=false] - Some blendModes are dangerous, they affect outer space of sprite.\n * Pass `true` only if you are ready to use them.\n */\n setBlendMode(blendMode: BLEND_MODES, readyForOuterBlend?: boolean): void\n {\n const outerBlend = blendMode === BLEND_MODES.SRC_IN\n || blendMode === BLEND_MODES.SRC_OUT\n || blendMode === BLEND_MODES.DST_IN\n || blendMode === BLEND_MODES.DST_ATOP;\n\n if (!readyForOuterBlend && outerBlend)\n {\n blendMode = BLEND_MODES.NORMAL;\n }\n\n if (this._activeBlendMode === blendMode)\n {\n return;\n }\n\n this._activeBlendMode = blendMode;\n this._outerBlend = outerBlend;\n this.context.globalCompositeOperation = this.blendModes[blendMode];\n }\n\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param {boolean} [removeView=false] - Removes the Canvas element from the DOM.\n */\n public destroy(removeView?: boolean): void\n {\n // call the base destroy\n super.destroy(removeView);\n\n this.context = null;\n\n this.refresh = true;\n\n this.maskManager.destroy();\n this.maskManager = null;\n\n this.smoothProperty = null;\n }\n\n /**\n * Resizes the canvas view to the specified width and height.\n *\n * @extends PIXI.AbstractRenderer#resize\n *\n * @param desiredScreenWidth - the desired width of the screen\n * @param desiredScreenHeight - the desired height of the screen\n */\n public resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n super.resize(desiredScreenWidth, desiredScreenHeight);\n\n // reset the scale mode.. oddly this seems to be reset when the canvas is resized.\n // surely a browser bug?? Let PixiJS fix that for you..\n if (this.smoothProperty)\n {\n this.rootContext[this.smoothProperty] = (settings.SCALE_MODE === SCALE_MODES.LINEAR);\n }\n }\n\n /** Checks if blend mode has changed. */\n invalidateBlendMode(): void\n {\n this._activeBlendMode = this.blendModes.indexOf(this.context.globalCompositeOperation);\n }\n\n static __plugins: IRendererPlugins;\n\n /**\n * Collection of installed plugins. These are included by default in PIXI, but can be excluded\n * by creating a custom build. Consult the README for more information about creating custom\n * builds and excluding plugins.\n * @member {object} plugins\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.CanvasExtract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.CanvasPrepare} prepare Pre-render display objects.\n */\n\n /**\n * Adds a plugin to the renderer.\n *\n * @param pluginName - The name of the plugin.\n * @param ctor - The constructor function or class for the plugin.\n */\n static registerPlugin(pluginName: string, ctor: ICanvasRendererPluginConstructor): void\n {\n CanvasRenderer.__plugins = CanvasRenderer.__plugins || {};\n CanvasRenderer.__plugins[pluginName] = ctor;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\nimport { canUseNewCanvasBlendModes } from './canUseNewCanvasBlendModes';\n\n/**\n * Maps blend combinations to Canvas.\n *\n * @memberof PIXI\n * @function mapCanvasBlendModesToPixi\n * @private\n * @param {string[]} [array=[]] - The array to output into.\n * @return {string[]} Mapped modes.\n */\nexport function mapCanvasBlendModesToPixi(array: string[] = []): string[]\n{\n if (canUseNewCanvasBlendModes())\n {\n array[BLEND_MODES.NORMAL] = 'source-over';\n array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???\n array[BLEND_MODES.MULTIPLY] = 'multiply';\n array[BLEND_MODES.SCREEN] = 'screen';\n array[BLEND_MODES.OVERLAY] = 'overlay';\n array[BLEND_MODES.DARKEN] = 'darken';\n array[BLEND_MODES.LIGHTEN] = 'lighten';\n array[BLEND_MODES.COLOR_DODGE] = 'color-dodge';\n array[BLEND_MODES.COLOR_BURN] = 'color-burn';\n array[BLEND_MODES.HARD_LIGHT] = 'hard-light';\n array[BLEND_MODES.SOFT_LIGHT] = 'soft-light';\n array[BLEND_MODES.DIFFERENCE] = 'difference';\n array[BLEND_MODES.EXCLUSION] = 'exclusion';\n array[BLEND_MODES.HUE] = 'hue';\n array[BLEND_MODES.SATURATION] = 'saturate';\n array[BLEND_MODES.COLOR] = 'color';\n array[BLEND_MODES.LUMINOSITY] = 'luminosity';\n }\n else\n {\n // this means that the browser does not support the cool new blend modes in canvas 'cough' ie 'cough'\n array[BLEND_MODES.NORMAL] = 'source-over';\n array[BLEND_MODES.ADD] = 'lighter'; // IS THIS OK???\n array[BLEND_MODES.MULTIPLY] = 'source-over';\n array[BLEND_MODES.SCREEN] = 'source-over';\n array[BLEND_MODES.OVERLAY] = 'source-over';\n array[BLEND_MODES.DARKEN] = 'source-over';\n array[BLEND_MODES.LIGHTEN] = 'source-over';\n array[BLEND_MODES.COLOR_DODGE] = 'source-over';\n array[BLEND_MODES.COLOR_BURN] = 'source-over';\n array[BLEND_MODES.HARD_LIGHT] = 'source-over';\n array[BLEND_MODES.SOFT_LIGHT] = 'source-over';\n array[BLEND_MODES.DIFFERENCE] = 'source-over';\n array[BLEND_MODES.EXCLUSION] = 'source-over';\n array[BLEND_MODES.HUE] = 'source-over';\n array[BLEND_MODES.SATURATION] = 'source-over';\n array[BLEND_MODES.COLOR] = 'source-over';\n array[BLEND_MODES.LUMINOSITY] = 'source-over';\n }\n // not-premultiplied, only for webgl\n array[BLEND_MODES.NORMAL_NPM] = array[BLEND_MODES.NORMAL];\n array[BLEND_MODES.ADD_NPM] = array[BLEND_MODES.ADD];\n array[BLEND_MODES.SCREEN_NPM] = array[BLEND_MODES.SCREEN];\n\n // composite operations\n array[BLEND_MODES.SRC_IN] = 'source-in';\n array[BLEND_MODES.SRC_OUT] = 'source-out';\n array[BLEND_MODES.SRC_ATOP] = 'source-atop';\n array[BLEND_MODES.DST_OVER] = 'destination-over';\n array[BLEND_MODES.DST_IN] = 'destination-in';\n array[BLEND_MODES.DST_OUT] = 'destination-out';\n array[BLEND_MODES.DST_ATOP] = 'destination-atop';\n array[BLEND_MODES.XOR] = 'xor';\n\n // SUBTRACT from flash, does not exist in canvas\n array[BLEND_MODES.SUBTRACT] = 'source-over';\n\n return array;\n}\n","import { hex2rgb, rgb2hex } from '@pixi/utils';\nimport { canUseNewCanvasBlendModes } from './utils/canUseNewCanvasBlendModes';\n\nimport type { Texture } from '@pixi/core';\n\n/**\n * Utility methods for Sprite/Texture tinting.\n *\n * Tinting with the CanvasRenderer involves creating a new canvas to use as a texture,\n * so be aware of the performance implications.\n *\n * @namespace PIXI.canvasUtils\n * @memberof PIXI\n */\nexport const canvasUtils = {\n canvas: null as HTMLCanvasElement,\n\n /**\n * Basically this method just needs a sprite and a color and tints the sprite with the given color.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Sprite} sprite - the sprite to tint\n * @param {number} color - the color to use to tint the sprite with\n * @return {HTMLCanvasElement} The tinted canvas\n */\n getTintedCanvas: (sprite: { texture: Texture }, color: number): HTMLCanvasElement | HTMLImageElement =>\n {\n const texture = sprite.texture;\n\n color = canvasUtils.roundColor(color);\n\n const stringColor = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n texture.tintCache = texture.tintCache || {};\n\n const cachedCanvas = texture.tintCache[stringColor];\n\n let canvas: HTMLCanvasElement;\n\n if (cachedCanvas)\n {\n if (cachedCanvas.tintId === texture._updateID)\n {\n return texture.tintCache[stringColor];\n }\n\n canvas = texture.tintCache[stringColor] as HTMLCanvasElement;\n }\n else\n {\n canvas = document.createElement('canvas');\n }\n\n canvasUtils.tintMethod(texture, color, canvas);\n\n canvas.tintId = texture._updateID;\n\n if (canvasUtils.convertTintToImage)\n {\n // is this better?\n const tintImage = new Image();\n\n tintImage.src = (canvas as HTMLCanvasElement).toDataURL();\n\n texture.tintCache[stringColor] = tintImage;\n }\n else\n {\n texture.tintCache[stringColor] = canvas;\n }\n\n return canvas;\n },\n\n /**\n * Basically this method just needs a sprite and a color and tints the sprite with the given color.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the sprite to tint\n * @param {number} color - the color to use to tint the sprite with\n * @return {HTMLCanvasElement} The tinted canvas\n */\n getTintedPattern: (texture: Texture, color: number): CanvasPattern =>\n {\n color = canvasUtils.roundColor(color);\n\n const stringColor = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n texture.patternCache = texture.patternCache || {};\n\n let pattern = texture.patternCache[stringColor];\n\n if (pattern && pattern.tintId === texture._updateID)\n {\n return pattern;\n }\n if (!canvasUtils.canvas)\n {\n canvasUtils.canvas = document.createElement('canvas');\n }\n canvasUtils.tintMethod(texture, color, canvasUtils.canvas);\n pattern = canvasUtils.canvas.getContext('2d').createPattern(canvasUtils.canvas, 'repeat');\n pattern.tintId = texture._updateID;\n texture.patternCache[stringColor] = pattern;\n\n return pattern;\n },\n\n /**\n * Tint a texture using the 'multiply' operation.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithMultiply: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.fillStyle = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'multiply';\n\n const source = texture.baseTexture.getDrawableSource();\n\n context.drawImage(\n source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n context.globalCompositeOperation = 'destination-atop';\n\n context.drawImage(\n source,\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n context.restore();\n },\n\n /**\n * Tint a texture using the 'overlay' operation.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithOverlay: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.globalCompositeOperation = 'copy';\n context.fillStyle = `#${(`00000${(color | 0).toString(16)}`).substr(-6)}`;\n context.fillRect(0, 0, crop.width, crop.height);\n\n context.globalCompositeOperation = 'destination-atop';\n context.drawImage(\n texture.baseTexture.getDrawableSource(),\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n\n // context.globalCompositeOperation = 'copy';\n context.restore();\n },\n\n /**\n * Tint a texture pixel per pixel.\n *\n * @memberof PIXI.canvasUtils\n * @param {PIXI.Texture} texture - the texture to tint\n * @param {number} color - the color to use to tint the sprite with\n * @param {HTMLCanvasElement} canvas - the current canvas\n */\n tintWithPerPixel: (texture: Texture, color: number, canvas: HTMLCanvasElement): void =>\n {\n const context = canvas.getContext('2d');\n const crop = texture._frame.clone();\n const resolution = texture.baseTexture.resolution;\n\n crop.x *= resolution;\n crop.y *= resolution;\n crop.width *= resolution;\n crop.height *= resolution;\n\n canvas.width = Math.ceil(crop.width);\n canvas.height = Math.ceil(crop.height);\n\n context.save();\n context.globalCompositeOperation = 'copy';\n context.drawImage(\n texture.baseTexture.getDrawableSource(),\n crop.x,\n crop.y,\n crop.width,\n crop.height,\n 0,\n 0,\n crop.width,\n crop.height\n );\n context.restore();\n\n const rgbValues = hex2rgb(color);\n const r = rgbValues[0];\n const g = rgbValues[1];\n const b = rgbValues[2];\n\n const pixelData = context.getImageData(0, 0, crop.width, crop.height);\n\n const pixels = pixelData.data;\n\n for (let i = 0; i < pixels.length; i += 4)\n {\n pixels[i + 0] *= r;\n pixels[i + 1] *= g;\n pixels[i + 2] *= b;\n }\n\n context.putImageData(pixelData, 0, 0);\n },\n\n /**\n * Rounds the specified color according to the canvasUtils.cacheStepsPerColorChannel.\n *\n * @memberof PIXI.canvasUtils\n * @param {number} color - the color to round, should be a hex color\n * @return {number} The rounded color.\n */\n roundColor: (color: number): number =>\n {\n const step = canvasUtils.cacheStepsPerColorChannel;\n\n const rgbValues = hex2rgb(color);\n\n rgbValues[0] = Math.min(255, (rgbValues[0] / step) * step);\n rgbValues[1] = Math.min(255, (rgbValues[1] / step) * step);\n rgbValues[2] = Math.min(255, (rgbValues[2] / step) * step);\n\n return rgb2hex(rgbValues);\n },\n\n /**\n * Number of steps which will be used as a cap when rounding colors.\n *\n * @memberof PIXI.canvasUtils\n * @type {number}\n */\n cacheStepsPerColorChannel: 8,\n\n /**\n * Tint cache boolean flag.\n *\n * @memberof PIXI.canvasUtils\n * @type {boolean}\n */\n convertTintToImage: false,\n\n /**\n * Whether or not the Canvas BlendModes are supported, consequently the ability to tint using the multiply method.\n *\n * @memberof PIXI.canvasUtils\n * @type {boolean}\n */\n canUseMultiply: canUseNewCanvasBlendModes(),\n\n /**\n * The tinting method that will be used.\n *\n * @memberof PIXI.canvasUtils\n * @type {Function}\n */\n tintMethod: null as (texture: Texture, color: number, canvas: HTMLCanvasElement) => void,\n};\n\ncanvasUtils.tintMethod = canvasUtils.canUseMultiply ? canvasUtils.tintWithMultiply : canvasUtils.tintWithPerPixel;\n","import { Renderer } from '@pixi/core';\nimport { CanvasRenderer } from './CanvasRenderer';\n\nimport type { AbstractRenderer, IRendererOptionsAuto } from '@pixi/core';\n\n// Reference to Renderer.create static function\nconst parentCreate = Renderer.create;\n\n/**\n * Override the Renderer.create to fallback to use CanvasRenderer.\n * Also supports forceCanvas option with Application or autoDetectRenderer.\n * @private\n */\nRenderer.create = function create(options: IRendererOptionsAuto): AbstractRenderer\n{\n const forceCanvas = options && options.forceCanvas;\n\n if (!forceCanvas)\n {\n try\n {\n return parentCreate(options);\n }\n catch (err)\n {\n // swallow WebGL-unsupported error\n }\n }\n\n return new CanvasRenderer(options);\n};\n","import { BaseTexture, BaseRenderTexture, Texture } from '@pixi/core';\n\n/**\n * Get the drawable source, such as HTMLCanvasElement or HTMLImageElement suitable\n * for rendering with CanvasRenderer. Provided by **@pixi/canvas-renderer** package.\n * @method getDrawableSource\n * @memberof PIXI.BaseTexture#\n * @return {PIXI.ICanvasImageSource} Source to render with CanvasRenderer\n */\nBaseTexture.prototype.getDrawableSource = function getDrawableSource(): CanvasImageSource\n{\n const resource = this.resource as any;\n\n return resource ? (resource.bitmap || resource.source) : null;\n};\n\n/**\n * A reference to the canvas render target (we only need one as this can be shared across renderers)\n *\n * @protected\n * @member {PIXI.utils.CanvasRenderTarget} _canvasRenderTarget\n * @memberof PIXI.BaseRenderTexture#\n */\n\nBaseRenderTexture.prototype._canvasRenderTarget = null;\n\nTexture.prototype.patternCache = null;\n\nTexture.prototype.tintCache = null;\n","/*!\n * @pixi/canvas-mesh - v6.2.1\n * Compiled Tue, 21 Dec 2021 19:56:15 UTC\n *\n * @pixi/canvas-mesh is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\nimport { settings, isMobile } from '@pixi/settings';\nimport { BLEND_MODES, ENV, ALPHA_MODES, SCALE_MODES, FORMATS, TYPES, TARGETS, MIPMAP_MODES, BUFFER_TYPE, CLEAR_MODES, DRAW_MODES, MSAA_QUALITY, BUFFER_BITS, MASK_TYPES, GC_MODES, SAMPLER_TYPES, WRAP_MODES, RENDERER_TYPE, PRECISION } from '@pixi/constants';\nimport { canvasUtils } from '@pixi/canvas-renderer';\nimport { MeshMaterial, Mesh } from '@pixi/mesh';\nimport { NineSlicePlane, SimpleMesh, SimpleRope } from '@pixi/mesh-extras';\n\nvar commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction createCommonjsModule(fn, basedir, module) {\n\treturn module = {\n\t\tpath: basedir,\n\t\texports: {},\n\t\trequire: function (path, base) {\n\t\t\treturn commonjsRequire(path, (base === undefined || base === null) ? module.path : base);\n\t\t}\n\t}, fn(module, module.exports), module.exports;\n}\n\nfunction commonjsRequire () {\n\tthrow new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');\n}\n\nvar eventemitter3 = createCommonjsModule(function (module) {\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) { prefix = false; }\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) { emitter._events[evt] = listener, emitter._eventsCount++; }\n else if (!emitter._events[evt].fn) { emitter._events[evt].push(listener); }\n else { emitter._events[evt] = [emitter._events[evt], listener]; }\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) { emitter._events = new Events(); }\n else { delete emitter._events[evt]; }\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) { return names; }\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) { names.push(prefix ? name.slice(1) : name); }\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) { return []; }\n if (handlers.fn) { return [handlers.fn]; }\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) { return 0; }\n if (listeners.fn) { return 1; }\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var arguments$1 = arguments;\n\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) { return false; }\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) { this.removeListener(event, listeners.fn, undefined, true); }\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments$1[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) { this.removeListener(event, listeners[i].fn, undefined, true); }\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) { for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments$1[j];\n } }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) { return this; }\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) { this._events[evt] = events.length === 1 ? events[0] : events; }\n else { clearEvent(this, evt); }\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) { clearEvent(this, evt); }\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\n{\n module.exports = EventEmitter;\n}\n});\n\nvar punycode = createCommonjsModule(function (module, exports) {\n(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal;\n\tif (\n\t\tfreeGlobal.global === freeGlobal ||\n\t\tfreeGlobal.window === freeGlobal ||\n\t\tfreeGlobal.self === freeGlobal\n\t) {\n\t\troot = freeGlobal;\n\t}\n\n\t/**\n\t * The `punycode` object.\n\t * @name punycode\n\t * @type Object\n\t */\n\tvar punycode,\n\n\t/** Highest positive signed 32-bit float value */\n\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t/** Bootstring parameters */\n\tbase = 36,\n\ttMin = 1,\n\ttMax = 26,\n\tskew = 38,\n\tdamp = 700,\n\tinitialBias = 72,\n\tinitialN = 128, // 0x80\n\tdelimiter = '-', // '\\x2D'\n\n\t/** Regular expressions */\n\tregexPunycode = /^xn--/,\n\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t/** Error messages */\n\terrors = {\n\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t'invalid-input': 'Invalid input'\n\t},\n\n\t/** Convenience shortcuts */\n\tbaseMinusTMin = base - tMin,\n\tfloor = Math.floor,\n\tstringFromCharCode = String.fromCharCode,\n\n\t/** Temporary variable */\n\tkey;\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/**\n\t * A generic error utility function.\n\t * @private\n\t * @param {String} type The error type.\n\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t */\n\tfunction error(type) {\n\t\tthrow RangeError(errors[type]);\n\t}\n\n\t/**\n\t * A generic `Array#map` utility function.\n\t * @private\n\t * @param {Array} array The array to iterate over.\n\t * @param {Function} callback The function that gets called for every array\n\t * item.\n\t * @returns {Array} A new array of values returned by the callback function.\n\t */\n\tfunction map(array, fn) {\n\t\tvar length = array.length;\n\t\tvar result = [];\n\t\twhile (length--) {\n\t\t\tresult[length] = fn(array[length]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t * addresses.\n\t * @private\n\t * @param {String} domain The domain name or email address.\n\t * @param {Function} callback The function that gets called for every\n\t * character.\n\t * @returns {Array} A new string of characters returned by the callback\n\t * function.\n\t */\n\tfunction mapDomain(string, fn) {\n\t\tvar parts = string.split('@');\n\t\tvar result = '';\n\t\tif (parts.length > 1) {\n\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\tresult = parts[0] + '@';\n\t\t\tstring = parts[1];\n\t\t}\n\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\tvar labels = string.split('.');\n\t\tvar encoded = map(labels, fn).join('.');\n\t\treturn result + encoded;\n\t}\n\n\t/**\n\t * Creates an array containing the numeric code points of each Unicode\n\t * character in the string. While JavaScript uses UCS-2 internally,\n\t * this function will convert a pair of surrogate halves (each of which\n\t * UCS-2 exposes as separate characters) into a single code point,\n\t * matching UTF-16.\n\t * @see `punycode.ucs2.encode`\n\t * @see \n\t * @memberOf punycode.ucs2\n\t * @name decode\n\t * @param {String} string The Unicode input string (UCS-2).\n\t * @returns {Array} The new array of code points.\n\t */\n\tfunction ucs2decode(string) {\n\t\tvar output = [],\n\t\t counter = 0,\n\t\t length = string.length,\n\t\t value,\n\t\t extra;\n\t\twhile (counter < length) {\n\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t} else {\n\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\toutput.push(value);\n\t\t\t\t\tcounter--;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\toutput.push(value);\n\t\t\t}\n\t\t}\n\t\treturn output;\n\t}\n\n\t/**\n\t * Creates a string based on an array of numeric code points.\n\t * @see `punycode.ucs2.decode`\n\t * @memberOf punycode.ucs2\n\t * @name encode\n\t * @param {Array} codePoints The array of numeric code points.\n\t * @returns {String} The new Unicode string (UCS-2).\n\t */\n\tfunction ucs2encode(array) {\n\t\treturn map(array, function(value) {\n\t\t\tvar output = '';\n\t\t\tif (value > 0xFFFF) {\n\t\t\t\tvalue -= 0x10000;\n\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t}\n\t\t\toutput += stringFromCharCode(value);\n\t\t\treturn output;\n\t\t}).join('');\n\t}\n\n\t/**\n\t * Converts a basic code point into a digit/integer.\n\t * @see `digitToBasic()`\n\t * @private\n\t * @param {Number} codePoint The basic numeric code point value.\n\t * @returns {Number} The numeric value of a basic code point (for use in\n\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t * the code point does not represent a value.\n\t */\n\tfunction basicToDigit(codePoint) {\n\t\tif (codePoint - 48 < 10) {\n\t\t\treturn codePoint - 22;\n\t\t}\n\t\tif (codePoint - 65 < 26) {\n\t\t\treturn codePoint - 65;\n\t\t}\n\t\tif (codePoint - 97 < 26) {\n\t\t\treturn codePoint - 97;\n\t\t}\n\t\treturn base;\n\t}\n\n\t/**\n\t * Converts a digit/integer into a basic code point.\n\t * @see `basicToDigit()`\n\t * @private\n\t * @param {Number} digit The numeric value of a basic code point.\n\t * @returns {Number} The basic code point whose value (when used for\n\t * representing integers) is `digit`, which needs to be in the range\n\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t * used; else, the lowercase form is used. The behavior is undefined\n\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t */\n\tfunction digitToBasic(digit, flag) {\n\t\t// 0..25 map to ASCII a..z or A..Z\n\t\t// 26..35 map to ASCII 0..9\n\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t}\n\n\t/**\n\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t * @private\n\t */\n\tfunction adapt(delta, numPoints, firstTime) {\n\t\tvar k = 0;\n\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\tdelta += floor(delta / numPoints);\n\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t}\n\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t}\n\n\t/**\n\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t * symbols.\n\t * @memberOf punycode\n\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t * @returns {String} The resulting string of Unicode symbols.\n\t */\n\tfunction decode(input) {\n\t\t// Don't use UCS-2\n\t\tvar output = [],\n\t\t inputLength = input.length,\n\t\t out,\n\t\t i = 0,\n\t\t n = initialN,\n\t\t bias = initialBias,\n\t\t basic,\n\t\t j,\n\t\t index,\n\t\t oldi,\n\t\t w,\n\t\t k,\n\t\t digit,\n\t\t t,\n\t\t /** Cached calculation results */\n\t\t baseMinusT;\n\n\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t// the first basic code points to the output.\n\n\t\tbasic = input.lastIndexOf(delimiter);\n\t\tif (basic < 0) {\n\t\t\tbasic = 0;\n\t\t}\n\n\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t// if it's not a basic code point\n\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\terror('not-basic');\n\t\t\t}\n\t\t\toutput.push(input.charCodeAt(j));\n\t\t}\n\n\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t// points were copied; start at the beginning otherwise.\n\n\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t// value at the end to obtain `delta`.\n\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\terror('invalid-input');\n\t\t\t\t}\n\n\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\ti += digit * w;\n\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\tif (digit < t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbaseMinusT = base - t;\n\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tw *= baseMinusT;\n\n\t\t\t}\n\n\t\t\tout = output.length + 1;\n\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tn += floor(i / out);\n\t\t\ti %= out;\n\n\t\t\t// Insert `n` at position `i` of the output\n\t\t\toutput.splice(i++, 0, n);\n\n\t\t}\n\n\t\treturn ucs2encode(output);\n\t}\n\n\t/**\n\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t * Punycode string of ASCII-only symbols.\n\t * @memberOf punycode\n\t * @param {String} input The string of Unicode symbols.\n\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t */\n\tfunction encode(input) {\n\t\tvar n,\n\t\t delta,\n\t\t handledCPCount,\n\t\t basicLength,\n\t\t bias,\n\t\t j,\n\t\t m,\n\t\t q,\n\t\t k,\n\t\t t,\n\t\t currentValue,\n\t\t output = [],\n\t\t /** `inputLength` will hold the number of code points in `input`. */\n\t\t inputLength,\n\t\t /** Cached calculation results */\n\t\t handledCPCountPlusOne,\n\t\t baseMinusT,\n\t\t qMinusT;\n\n\t\t// Convert the input in UCS-2 to Unicode\n\t\tinput = ucs2decode(input);\n\n\t\t// Cache the length\n\t\tinputLength = input.length;\n\n\t\t// Initialize the state\n\t\tn = initialN;\n\t\tdelta = 0;\n\t\tbias = initialBias;\n\n\t\t// Handle the basic code points\n\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\tcurrentValue = input[j];\n\t\t\tif (currentValue < 0x80) {\n\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t}\n\t\t}\n\n\t\thandledCPCount = basicLength = output.length;\n\n\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t// `basicLength` is the number of basic code points.\n\n\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\tif (basicLength) {\n\t\t\toutput.push(delimiter);\n\t\t}\n\n\t\t// Main encoding loop:\n\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t// larger one:\n\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\tm = currentValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Increase `delta` enough to advance the decoder's state to ,\n\t\t\t// but guard against overflow\n\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\terror('overflow');\n\t\t\t}\n\n\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\tn = m;\n\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t);\n\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t}\n\n\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\tdelta = 0;\n\t\t\t\t\t++handledCPCount;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t++delta;\n\t\t\t++n;\n\n\t\t}\n\t\treturn output.join('');\n\t}\n\n\t/**\n\t * Converts a Punycode string representing a domain name or an email address\n\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t * it doesn't matter if you call it on a string that has already been\n\t * converted to Unicode.\n\t * @memberOf punycode\n\t * @param {String} input The Punycoded domain name or email address to\n\t * convert to Unicode.\n\t * @returns {String} The Unicode representation of the given Punycode\n\t * string.\n\t */\n\tfunction toUnicode(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexPunycode.test(string)\n\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/**\n\t * Converts a Unicode string representing a domain name or an email address to\n\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t * ASCII.\n\t * @memberOf punycode\n\t * @param {String} input The domain name or email address to convert, as a\n\t * Unicode string.\n\t * @returns {String} The Punycode representation of the given domain name or\n\t * email address.\n\t */\n\tfunction toASCII(input) {\n\t\treturn mapDomain(input, function(string) {\n\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t: string;\n\t\t});\n\t}\n\n\t/*--------------------------------------------------------------------------*/\n\n\t/** Define the public API */\n\tpunycode = {\n\t\t/**\n\t\t * A string representing the current Punycode.js version number.\n\t\t * @memberOf punycode\n\t\t * @type String\n\t\t */\n\t\t'version': '1.3.2',\n\t\t/**\n\t\t * An object of methods to convert from JavaScript's internal character\n\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t * @see \n\t\t * @memberOf punycode\n\t\t * @type Object\n\t\t */\n\t\t'ucs2': {\n\t\t\t'decode': ucs2decode,\n\t\t\t'encode': ucs2encode\n\t\t},\n\t\t'decode': decode,\n\t\t'encode': encode,\n\t\t'toASCII': toASCII,\n\t\t'toUnicode': toUnicode\n\t};\n\n\t/** Expose `punycode` */\n\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t// like the following:\n\tif (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\tfor (key in punycode) {\n\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t}\n\t\t}\n\t} else { // in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(commonjsGlobal));\n});\n\nvar util = {\n isString: function(arg) {\n return typeof(arg) === 'string';\n },\n isObject: function(arg) {\n return typeof(arg) === 'object' && arg !== null;\n },\n isNull: function(arg) {\n return arg === null;\n },\n isNullOrUndefined: function(arg) {\n return arg == null;\n }\n};\n\n// Copyright Joyent, Inc. and other Node contributors.\n\n// If obj.hasOwnProperty has been overridden, then calling\n// obj.hasOwnProperty(prop) will break.\n// See: https://github.com/joyent/node/issues/1707\nfunction hasOwnProperty(obj, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n\nvar decode = function(qs, sep, eq, options) {\n sep = sep || '&';\n eq = eq || '=';\n var obj = {};\n\n if (typeof qs !== 'string' || qs.length === 0) {\n return obj;\n }\n\n var regexp = /\\+/g;\n qs = qs.split(sep);\n\n var maxKeys = 1000;\n if (options && typeof options.maxKeys === 'number') {\n maxKeys = options.maxKeys;\n }\n\n var len = qs.length;\n // maxKeys <= 0 means that we should not limit keys count\n if (maxKeys > 0 && len > maxKeys) {\n len = maxKeys;\n }\n\n for (var i = 0; i < len; ++i) {\n var x = qs[i].replace(regexp, '%20'),\n idx = x.indexOf(eq),\n kstr, vstr, k, v;\n\n if (idx >= 0) {\n kstr = x.substr(0, idx);\n vstr = x.substr(idx + 1);\n } else {\n kstr = x;\n vstr = '';\n }\n\n k = decodeURIComponent(kstr);\n v = decodeURIComponent(vstr);\n\n if (!hasOwnProperty(obj, k)) {\n obj[k] = v;\n } else if (Array.isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\n// Copyright Joyent, Inc. and other Node contributors.\n\nvar stringifyPrimitive = function(v) {\n switch (typeof v) {\n case 'string':\n return v;\n\n case 'boolean':\n return v ? 'true' : 'false';\n\n case 'number':\n return isFinite(v) ? v : '';\n\n default:\n return '';\n }\n};\n\nvar encode = function(obj, sep, eq, name) {\n sep = sep || '&';\n eq = eq || '=';\n if (obj === null) {\n obj = undefined;\n }\n\n if (typeof obj === 'object') {\n return Object.keys(obj).map(function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (Array.isArray(obj[k])) {\n return obj[k].map(function(v) {\n return ks + encodeURIComponent(stringifyPrimitive(v));\n }).join(sep);\n } else {\n return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n }\n }).join(sep);\n\n }\n\n if (!name) { return ''; }\n return encodeURIComponent(stringifyPrimitive(name)) + eq +\n encodeURIComponent(stringifyPrimitive(obj));\n};\n\nvar querystring = createCommonjsModule(function (module, exports) {\n\nexports.decode = exports.parse = decode;\nexports.encode = exports.stringify = encode;\n});\n\nvar parse = urlParse;\nvar resolve = urlResolve;\nvar format = urlFormat;\n\nfunction Url() {\n this.protocol = null;\n this.slashes = null;\n this.auth = null;\n this.host = null;\n this.port = null;\n this.hostname = null;\n this.hash = null;\n this.search = null;\n this.query = null;\n this.pathname = null;\n this.path = null;\n this.href = null;\n}\n\n// Reference: RFC 3986, RFC 1808, RFC 2396\n\n// define these here so at least they only have to be\n// compiled once on the first module load.\nvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n portPattern = /:[0-9]*$/,\n\n // Special case for a simple path URL\n simplePathPattern = /^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,\n\n // RFC 2396: characters reserved for delimiting URLs.\n // We actually just auto-escape these.\n delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n // RFC 2396: characters not allowed for various reasons.\n unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n // Allowed by RFCs, but cause of XSS attacks. Always escape these.\n autoEscape = ['\\''].concat(unwise),\n // Characters that are never ever allowed in a hostname.\n // Note that any invalid chars are also handled, but these\n // are the ones that are *expected* to be seen, so we fast-path\n // them.\n nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n hostEndingChars = ['/', '?', '#'],\n hostnameMaxLen = 255,\n hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/,\n hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/,\n // protocols that can allow \"unsafe\" and \"unwise\" chars.\n unsafeProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that never have a hostname.\n hostlessProtocol = {\n 'javascript': true,\n 'javascript:': true\n },\n // protocols that always contain a // bit.\n slashedProtocol = {\n 'http': true,\n 'https': true,\n 'ftp': true,\n 'gopher': true,\n 'file': true,\n 'http:': true,\n 'https:': true,\n 'ftp:': true,\n 'gopher:': true,\n 'file:': true\n };\n\nfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n if (url && util.isObject(url) && url instanceof Url) { return url; }\n\n var u = new Url;\n u.parse(url, parseQueryString, slashesDenoteHost);\n return u;\n}\n\nUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n if (!util.isString(url)) {\n throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n }\n\n // Copy chrome, IE, opera backslash-handling behavior.\n // Back slashes before the query string get converted to forward slashes\n // See: https://code.google.com/p/chromium/issues/detail?id=25916\n var queryIndex = url.indexOf('?'),\n splitter =\n (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#',\n uSplit = url.split(splitter),\n slashRegex = /\\\\/g;\n uSplit[0] = uSplit[0].replace(slashRegex, '/');\n url = uSplit.join(splitter);\n\n var rest = url;\n\n // trim before proceeding.\n // This is to support parse stuff like \" http://foo.com \\n\"\n rest = rest.trim();\n\n if (!slashesDenoteHost && url.split('#').length === 1) {\n // Try fast path regexp\n var simplePath = simplePathPattern.exec(rest);\n if (simplePath) {\n this.path = rest;\n this.href = rest;\n this.pathname = simplePath[1];\n if (simplePath[2]) {\n this.search = simplePath[2];\n if (parseQueryString) {\n this.query = querystring.parse(this.search.substr(1));\n } else {\n this.query = this.search.substr(1);\n }\n } else if (parseQueryString) {\n this.search = '';\n this.query = {};\n }\n return this;\n }\n }\n\n var proto = protocolPattern.exec(rest);\n if (proto) {\n proto = proto[0];\n var lowerProto = proto.toLowerCase();\n this.protocol = lowerProto;\n rest = rest.substr(proto.length);\n }\n\n // figure out if it's got a host\n // user@server is *always* interpreted as a hostname, and url\n // resolution will treat //foo/bar as host=foo,path=bar because that's\n // how the browser resolves relative URLs.\n if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n var slashes = rest.substr(0, 2) === '//';\n if (slashes && !(proto && hostlessProtocol[proto])) {\n rest = rest.substr(2);\n this.slashes = true;\n }\n }\n\n if (!hostlessProtocol[proto] &&\n (slashes || (proto && !slashedProtocol[proto]))) {\n\n // there's a hostname.\n // the first instance of /, ?, ;, or # ends the host.\n //\n // If there is an @ in the hostname, then non-host chars *are* allowed\n // to the left of the last @ sign, unless some host-ending character\n // comes *before* the @-sign.\n // URLs are obnoxious.\n //\n // ex:\n // http://a@b@c/ => user:a@b host:c\n // http://a@b?@c => user:a host:c path:/?@c\n\n // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n // Review our test case against browsers more comprehensively.\n\n // find the first instance of any hostEndingChars\n var hostEnd = -1;\n for (var i = 0; i < hostEndingChars.length; i++) {\n var hec = rest.indexOf(hostEndingChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n { hostEnd = hec; }\n }\n\n // at this point, either we have an explicit point where the\n // auth portion cannot go past, or the last @ char is the decider.\n var auth, atSign;\n if (hostEnd === -1) {\n // atSign can be anywhere.\n atSign = rest.lastIndexOf('@');\n } else {\n // atSign must be in auth portion.\n // http://a@b/c@d => host:b auth:a path:/c@d\n atSign = rest.lastIndexOf('@', hostEnd);\n }\n\n // Now we have a portion which is definitely the auth.\n // Pull that off.\n if (atSign !== -1) {\n auth = rest.slice(0, atSign);\n rest = rest.slice(atSign + 1);\n this.auth = decodeURIComponent(auth);\n }\n\n // the host is the remaining to the left of the first non-host char\n hostEnd = -1;\n for (var i = 0; i < nonHostChars.length; i++) {\n var hec = rest.indexOf(nonHostChars[i]);\n if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n { hostEnd = hec; }\n }\n // if we still have not hit it, then the entire thing is a host.\n if (hostEnd === -1)\n { hostEnd = rest.length; }\n\n this.host = rest.slice(0, hostEnd);\n rest = rest.slice(hostEnd);\n\n // pull out port.\n this.parseHost();\n\n // we've indicated that there is a hostname,\n // so even if it's empty, it has to be present.\n this.hostname = this.hostname || '';\n\n // if hostname begins with [ and ends with ]\n // assume that it's an IPv6 address.\n var ipv6Hostname = this.hostname[0] === '[' &&\n this.hostname[this.hostname.length - 1] === ']';\n\n // validate a little.\n if (!ipv6Hostname) {\n var hostparts = this.hostname.split(/\\./);\n for (var i = 0, l = hostparts.length; i < l; i++) {\n var part = hostparts[i];\n if (!part) { continue; }\n if (!part.match(hostnamePartPattern)) {\n var newpart = '';\n for (var j = 0, k = part.length; j < k; j++) {\n if (part.charCodeAt(j) > 127) {\n // we replace non-ASCII char with a temporary placeholder\n // we need this to make sure size of hostname is not\n // broken by replacing non-ASCII by nothing\n newpart += 'x';\n } else {\n newpart += part[j];\n }\n }\n // we test again with ASCII char only\n if (!newpart.match(hostnamePartPattern)) {\n var validParts = hostparts.slice(0, i);\n var notHost = hostparts.slice(i + 1);\n var bit = part.match(hostnamePartStart);\n if (bit) {\n validParts.push(bit[1]);\n notHost.unshift(bit[2]);\n }\n if (notHost.length) {\n rest = '/' + notHost.join('.') + rest;\n }\n this.hostname = validParts.join('.');\n break;\n }\n }\n }\n }\n\n if (this.hostname.length > hostnameMaxLen) {\n this.hostname = '';\n } else {\n // hostnames are always lower case.\n this.hostname = this.hostname.toLowerCase();\n }\n\n if (!ipv6Hostname) {\n // IDNA Support: Returns a punycoded representation of \"domain\".\n // It only converts parts of the domain name that\n // have non-ASCII characters, i.e. it doesn't matter if\n // you call it with a domain that already is ASCII-only.\n this.hostname = punycode.toASCII(this.hostname);\n }\n\n var p = this.port ? ':' + this.port : '';\n var h = this.hostname || '';\n this.host = h + p;\n this.href += this.host;\n\n // strip [ and ] from the hostname\n // the host field still retains them, though\n if (ipv6Hostname) {\n this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n if (rest[0] !== '/') {\n rest = '/' + rest;\n }\n }\n }\n\n // now rest is set to the post-host stuff.\n // chop off any delim chars.\n if (!unsafeProtocol[lowerProto]) {\n\n // First, make 100% sure that any \"autoEscape\" chars get\n // escaped, even if encodeURIComponent doesn't think they\n // need to be.\n for (var i = 0, l = autoEscape.length; i < l; i++) {\n var ae = autoEscape[i];\n if (rest.indexOf(ae) === -1)\n { continue; }\n var esc = encodeURIComponent(ae);\n if (esc === ae) {\n esc = escape(ae);\n }\n rest = rest.split(ae).join(esc);\n }\n }\n\n\n // chop off from the tail first.\n var hash = rest.indexOf('#');\n if (hash !== -1) {\n // got a fragment string.\n this.hash = rest.substr(hash);\n rest = rest.slice(0, hash);\n }\n var qm = rest.indexOf('?');\n if (qm !== -1) {\n this.search = rest.substr(qm);\n this.query = rest.substr(qm + 1);\n if (parseQueryString) {\n this.query = querystring.parse(this.query);\n }\n rest = rest.slice(0, qm);\n } else if (parseQueryString) {\n // no query string, but parseQueryString still requested\n this.search = '';\n this.query = {};\n }\n if (rest) { this.pathname = rest; }\n if (slashedProtocol[lowerProto] &&\n this.hostname && !this.pathname) {\n this.pathname = '/';\n }\n\n //to support http.request\n if (this.pathname || this.search) {\n var p = this.pathname || '';\n var s = this.search || '';\n this.path = p + s;\n }\n\n // finally, reconstruct the href based on what has been validated.\n this.href = this.format();\n return this;\n};\n\n// format a parsed object into a url string\nfunction urlFormat(obj) {\n // ensure it's an object, and not a string url.\n // If it's an obj, this is a no-op.\n // this way, you can call url_format() on strings\n // to clean up potentially wonky urls.\n if (util.isString(obj)) { obj = urlParse(obj); }\n if (!(obj instanceof Url)) { return Url.prototype.format.call(obj); }\n return obj.format();\n}\n\nUrl.prototype.format = function() {\n var auth = this.auth || '';\n if (auth) {\n auth = encodeURIComponent(auth);\n auth = auth.replace(/%3A/i, ':');\n auth += '@';\n }\n\n var protocol = this.protocol || '',\n pathname = this.pathname || '',\n hash = this.hash || '',\n host = false,\n query = '';\n\n if (this.host) {\n host = auth + this.host;\n } else if (this.hostname) {\n host = auth + (this.hostname.indexOf(':') === -1 ?\n this.hostname :\n '[' + this.hostname + ']');\n if (this.port) {\n host += ':' + this.port;\n }\n }\n\n if (this.query &&\n util.isObject(this.query) &&\n Object.keys(this.query).length) {\n query = querystring.stringify(this.query);\n }\n\n var search = this.search || (query && ('?' + query)) || '';\n\n if (protocol && protocol.substr(-1) !== ':') { protocol += ':'; }\n\n // only the slashedProtocols get the //. Not mailto:, xmpp:, etc.\n // unless they had them to begin with.\n if (this.slashes ||\n (!protocol || slashedProtocol[protocol]) && host !== false) {\n host = '//' + (host || '');\n if (pathname && pathname.charAt(0) !== '/') { pathname = '/' + pathname; }\n } else if (!host) {\n host = '';\n }\n\n if (hash && hash.charAt(0) !== '#') { hash = '#' + hash; }\n if (search && search.charAt(0) !== '?') { search = '?' + search; }\n\n pathname = pathname.replace(/[?#]/g, function(match) {\n return encodeURIComponent(match);\n });\n search = search.replace('#', '%23');\n\n return protocol + host + pathname + search + hash;\n};\n\nfunction urlResolve(source, relative) {\n return urlParse(source, false, true).resolve(relative);\n}\n\nUrl.prototype.resolve = function(relative) {\n return this.resolveObject(urlParse(relative, false, true)).format();\n};\n\nUrl.prototype.resolveObject = function(relative) {\n if (util.isString(relative)) {\n var rel = new Url();\n rel.parse(relative, false, true);\n relative = rel;\n }\n\n var result = new Url();\n var tkeys = Object.keys(this);\n for (var tk = 0; tk < tkeys.length; tk++) {\n var tkey = tkeys[tk];\n result[tkey] = this[tkey];\n }\n\n // hash is always overridden, no matter what.\n // even href=\"\" will remove it.\n result.hash = relative.hash;\n\n // if the relative url is empty, then there's nothing left to do here.\n if (relative.href === '') {\n result.href = result.format();\n return result;\n }\n\n // hrefs like //foo/bar always cut to the protocol.\n if (relative.slashes && !relative.protocol) {\n // take everything except the protocol from relative\n var rkeys = Object.keys(relative);\n for (var rk = 0; rk < rkeys.length; rk++) {\n var rkey = rkeys[rk];\n if (rkey !== 'protocol')\n { result[rkey] = relative[rkey]; }\n }\n\n //urlParse appends trailing / to urls like http://www.example.com\n if (slashedProtocol[result.protocol] &&\n result.hostname && !result.pathname) {\n result.path = result.pathname = '/';\n }\n\n result.href = result.format();\n return result;\n }\n\n if (relative.protocol && relative.protocol !== result.protocol) {\n // if it's a known url protocol, then changing\n // the protocol does weird things\n // first, if it's not file:, then we MUST have a host,\n // and if there was a path\n // to begin with, then we MUST have a path.\n // if it is file:, then the host is dropped,\n // because that's known to be hostless.\n // anything else is assumed to be absolute.\n if (!slashedProtocol[relative.protocol]) {\n var keys = Object.keys(relative);\n for (var v = 0; v < keys.length; v++) {\n var k = keys[v];\n result[k] = relative[k];\n }\n result.href = result.format();\n return result;\n }\n\n result.protocol = relative.protocol;\n if (!relative.host && !hostlessProtocol[relative.protocol]) {\n var relPath = (relative.pathname || '').split('/');\n while (relPath.length && !(relative.host = relPath.shift())){ }\n if (!relative.host) { relative.host = ''; }\n if (!relative.hostname) { relative.hostname = ''; }\n if (relPath[0] !== '') { relPath.unshift(''); }\n if (relPath.length < 2) { relPath.unshift(''); }\n result.pathname = relPath.join('/');\n } else {\n result.pathname = relative.pathname;\n }\n result.search = relative.search;\n result.query = relative.query;\n result.host = relative.host || '';\n result.auth = relative.auth;\n result.hostname = relative.hostname || relative.host;\n result.port = relative.port;\n // to support http.request\n if (result.pathname || result.search) {\n var p = result.pathname || '';\n var s = result.search || '';\n result.path = p + s;\n }\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n }\n\n var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n isRelAbs = (\n relative.host ||\n relative.pathname && relative.pathname.charAt(0) === '/'\n ),\n mustEndAbs = (isRelAbs || isSourceAbs ||\n (result.host && relative.pathname)),\n removeAllDots = mustEndAbs,\n srcPath = result.pathname && result.pathname.split('/') || [],\n relPath = relative.pathname && relative.pathname.split('/') || [],\n psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n // if the url is a non-slashed url, then relative\n // links like ../.. should be able\n // to crawl up to the hostname, as well. This is strange.\n // result.protocol has already been set by now.\n // Later on, put the first path part into the host field.\n if (psychotic) {\n result.hostname = '';\n result.port = null;\n if (result.host) {\n if (srcPath[0] === '') { srcPath[0] = result.host; }\n else { srcPath.unshift(result.host); }\n }\n result.host = '';\n if (relative.protocol) {\n relative.hostname = null;\n relative.port = null;\n if (relative.host) {\n if (relPath[0] === '') { relPath[0] = relative.host; }\n else { relPath.unshift(relative.host); }\n }\n relative.host = null;\n }\n mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n }\n\n if (isRelAbs) {\n // it's absolute.\n result.host = (relative.host || relative.host === '') ?\n relative.host : result.host;\n result.hostname = (relative.hostname || relative.hostname === '') ?\n relative.hostname : result.hostname;\n result.search = relative.search;\n result.query = relative.query;\n srcPath = relPath;\n // fall through to the dot-handling below.\n } else if (relPath.length) {\n // it's relative\n // throw away the existing file, and take the new path instead.\n if (!srcPath) { srcPath = []; }\n srcPath.pop();\n srcPath = srcPath.concat(relPath);\n result.search = relative.search;\n result.query = relative.query;\n } else if (!util.isNullOrUndefined(relative.search)) {\n // just pull out the search.\n // like href='?foo'.\n // Put this after the other two cases because it simplifies the booleans\n if (psychotic) {\n result.hostname = result.host = srcPath.shift();\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n result.search = relative.search;\n result.query = relative.query;\n //to support http.request\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.href = result.format();\n return result;\n }\n\n if (!srcPath.length) {\n // no path at all. easy.\n // we've already handled the other stuff above.\n result.pathname = null;\n //to support http.request\n if (result.search) {\n result.path = '/' + result.search;\n } else {\n result.path = null;\n }\n result.href = result.format();\n return result;\n }\n\n // if a url ENDs in . or .., then it must get a trailing slash.\n // however, if it ends in anything else non-slashy,\n // then it must NOT get a trailing slash.\n var last = srcPath.slice(-1)[0];\n var hasTrailingSlash = (\n (result.host || relative.host || srcPath.length > 1) &&\n (last === '.' || last === '..') || last === '');\n\n // strip single dots, resolve double dots to parent dir\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = srcPath.length; i >= 0; i--) {\n last = srcPath[i];\n if (last === '.') {\n srcPath.splice(i, 1);\n } else if (last === '..') {\n srcPath.splice(i, 1);\n up++;\n } else if (up) {\n srcPath.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (!mustEndAbs && !removeAllDots) {\n for (; up--; up) {\n srcPath.unshift('..');\n }\n }\n\n if (mustEndAbs && srcPath[0] !== '' &&\n (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n srcPath.unshift('');\n }\n\n if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n srcPath.push('');\n }\n\n var isAbsolute = srcPath[0] === '' ||\n (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n // put the host back\n if (psychotic) {\n result.hostname = result.host = isAbsolute ? '' :\n srcPath.length ? srcPath.shift() : '';\n //occationaly the auth can get stuck only in host\n //this especially happens in cases like\n //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n var authInHost = result.host && result.host.indexOf('@') > 0 ?\n result.host.split('@') : false;\n if (authInHost) {\n result.auth = authInHost.shift();\n result.host = result.hostname = authInHost.shift();\n }\n }\n\n mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n if (mustEndAbs && !isAbsolute) {\n srcPath.unshift('');\n }\n\n if (!srcPath.length) {\n result.pathname = null;\n result.path = null;\n } else {\n result.pathname = srcPath.join('/');\n }\n\n //to support request.http\n if (!util.isNull(result.pathname) || !util.isNull(result.search)) {\n result.path = (result.pathname ? result.pathname : '') +\n (result.search ? result.search : '');\n }\n result.auth = relative.auth || result.auth;\n result.slashes = result.slashes || relative.slashes;\n result.href = result.format();\n return result;\n};\n\nUrl.prototype.parseHost = function() {\n var host = this.host;\n var port = portPattern.exec(host);\n if (port) {\n port = port[0];\n if (port !== ':') {\n this.port = port.substr(1);\n }\n host = host.substr(0, host.length - port.length);\n }\n if (host) { this.hostname = host; }\n};\n\n/*!\n * @pixi/utils - v6.2.1\n * Compiled Tue, 21 Dec 2021 19:56:15 UTC\n *\n * @pixi/utils is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n/**\n * This file contains redeclared types for Node `url` and `querystring` modules. These modules\n * don't provide their own typings but instead are a part of the full Node typings. The purpose of\n * this file is to redeclare the required types to avoid having the whole Node types as a\n * dependency.\n */\nvar url = {\n parse: parse,\n format: format,\n resolve: resolve,\n};\n\n/**\n * The prefix that denotes a URL is for a retina asset.\n *\n * @static\n * @name RETINA_PREFIX\n * @memberof PIXI.settings\n * @type {RegExp}\n * @default /@([0-9\\.]+)x/\n * @example `@2x`\n */\nsettings.RETINA_PREFIX = /@([0-9\\.]+)x/;\n/**\n * Should the `failIfMajorPerformanceCaveat` flag be enabled as a context option used in the `isWebGLSupported` function.\n * If set to true, a WebGL renderer can fail to be created if the browser thinks there could be performance issues when\n * using WebGL.\n *\n * In PixiJS v6 this has changed from true to false by default, to allow WebGL to work in as many scenarios as possible.\n * However, some users may have a poor experience, for example, if a user has a gpu or driver version blacklisted by the\n * browser.\n *\n * If your application requires high performance rendering, you may wish to set this to false.\n * We recommend one of two options if you decide to set this flag to false:\n *\n * 1: Use the `pixi.js-legacy` package, which includes a Canvas renderer as a fallback in case high performance WebGL is\n * not supported.\n *\n * 2: Call `isWebGLSupported` (which if found in the PIXI.utils package) in your code before attempting to create a PixiJS\n * renderer, and show an error message to the user if the function returns false, explaining that their device & browser\n * combination does not support high performance WebGL.\n * This is a much better strategy than trying to create a PixiJS renderer and finding it then fails.\n *\n * @static\n * @name FAIL_IF_MAJOR_PERFORMANCE_CAVEAT\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;\n\nvar saidHello = false;\nvar VERSION = '6.2.1';\n/**\n * Logs out the version and renderer information for this running instance of PIXI.\n * If you don't want to see this message you can run `PIXI.utils.skipHello()` before\n * creating your renderer. Keep in mind that doing that will forever make you a jerk face.\n *\n * @static\n * @function sayHello\n * @memberof PIXI.utils\n * @param {string} type - The string renderer type to log.\n */\nfunction sayHello(type) {\n var _a;\n if (saidHello) {\n return;\n }\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {\n var args = [\n \"\\n %c %c %c PixiJS \" + VERSION + \" - \\u2730 \" + type + \" \\u2730 %c %c http://www.pixijs.com/ %c %c \\u2665%c\\u2665%c\\u2665 \\n\\n\",\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff66a5; background: #030307; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'background: #ffc3dc; padding:5px 0;',\n 'background: #ff66a5; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;',\n 'color: #ff2424; background: #fff; padding:5px 0;' ];\n (_a = self.console).log.apply(_a, args);\n }\n else if (self.console) {\n self.console.log(\"PixiJS \" + VERSION + \" - \" + type + \" - http://www.pixijs.com/\");\n }\n saidHello = true;\n}\n\nvar supported;\n/**\n * Helper for checking for WebGL support.\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} Is WebGL supported.\n */\nfunction isWebGLSupported() {\n if (typeof supported === 'undefined') {\n supported = (function supported() {\n var contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n try {\n if (!self.WebGLRenderingContext) {\n return false;\n }\n var canvas = document.createElement('canvas');\n var gl = (canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions));\n var success = !!(gl && gl.getContextAttributes().stencil);\n if (gl) {\n var loseContext = gl.getExtension('WEBGL_lose_context');\n if (loseContext) {\n loseContext.loseContext();\n }\n }\n gl = null;\n return success;\n }\n catch (e) {\n return false;\n }\n })();\n }\n return supported;\n}\n\n/**\n * Converts a hexadecimal color number to an [R, G, B] array of normalized floats (numbers from 0.0 to 1.0).\n *\n * @example\n * PIXI.utils.hex2rgb(0xffffff); // returns [1, 1, 1]\n * @memberof PIXI.utils\n * @function hex2rgb\n * @param {number} hex - The hexadecimal number to convert\n * @param {number[]} [out=[]] - If supplied, this array will be used rather than returning a new one\n * @return {number[]} An array representing the [R, G, B] of the color where all values are floats.\n */\nfunction hex2rgb(hex, out) {\n if (out === void 0) { out = []; }\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n return out;\n}\n/**\n * Converts a hexadecimal color number to a string.\n *\n * @example\n * PIXI.utils.hex2string(0xffffff); // returns \"#ffffff\"\n * @memberof PIXI.utils\n * @function hex2string\n * @param {number} hex - Number in hex (e.g., `0xffffff`)\n * @return {string} The string color (e.g., `\"#ffffff\"`).\n */\nfunction hex2string(hex) {\n var hexString = hex.toString(16);\n hexString = '000000'.substr(0, 6 - hexString.length) + hexString;\n return \"#\" + hexString;\n}\n\n/**\n * Corrects PixiJS blend, takes premultiplied alpha into account\n *\n * @memberof PIXI.utils\n * @function mapPremultipliedBlendModes\n * @private\n * @return {Array} Mapped modes.\n */\nfunction mapPremultipliedBlendModes() {\n var pm = [];\n var npm = [];\n for (var i = 0; i < 32; i++) {\n pm[i] = i;\n npm[i] = i;\n }\n pm[BLEND_MODES.NORMAL_NPM] = BLEND_MODES.NORMAL;\n pm[BLEND_MODES.ADD_NPM] = BLEND_MODES.ADD;\n pm[BLEND_MODES.SCREEN_NPM] = BLEND_MODES.SCREEN;\n npm[BLEND_MODES.NORMAL] = BLEND_MODES.NORMAL_NPM;\n npm[BLEND_MODES.ADD] = BLEND_MODES.ADD_NPM;\n npm[BLEND_MODES.SCREEN] = BLEND_MODES.SCREEN_NPM;\n var array = [];\n array.push(npm);\n array.push(pm);\n return array;\n}\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array}\n */\nvar premultiplyBlendMode = mapPremultipliedBlendModes();\n/**\n * premultiplies tint\n *\n * @memberof PIXI.utils\n * @function premultiplyTint\n * @param {number} tint - integer RGB\n * @param {number} alpha - floating point alpha (0.0-1.0)\n * @returns {number} tint multiplied by alpha\n */\nfunction premultiplyTint(tint, alpha) {\n if (alpha === 1.0) {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0) {\n return 0;\n }\n var R = ((tint >> 16) & 0xFF);\n var G = ((tint >> 8) & 0xFF);\n var B = (tint & 0xFF);\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\nfunction getBufferType(array) {\n if (array.BYTES_PER_ELEMENT === 4) {\n if (array instanceof Float32Array) {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array) {\n return 'Uint32Array';\n }\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2) {\n if (array instanceof Uint16Array) {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1) {\n if (array instanceof Uint8Array) {\n return 'Uint8Array';\n }\n }\n // TODO map out the rest of the array elements!\n return null;\n}\n\n// Taken from the bit-twiddle package\n/**\n * Rounds to next power of two.\n *\n * @function nextPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number}\n */\nfunction nextPow2(v) {\n v += v === 0 ? 1 : 0;\n --v;\n v |= v >>> 1;\n v |= v >>> 2;\n v |= v >>> 4;\n v |= v >>> 8;\n v |= v >>> 16;\n return v + 1;\n}\n/**\n * Checks if a number is a power of two.\n *\n * @function isPow2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {boolean} `true` if value is power of two\n */\nfunction isPow2(v) {\n return !(v & (v - 1)) && (!!v);\n}\n/**\n * Computes ceil of log base 2\n *\n * @function log2\n * @memberof PIXI.utils\n * @param {number} v - input value\n * @return {number} logarithm base 2\n */\nfunction log2(v) {\n var r = (v > 0xFFFF ? 1 : 0) << 4;\n v >>>= r;\n var shift = (v > 0xFF ? 1 : 0) << 3;\n v >>>= shift;\n r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift;\n r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift;\n r |= shift;\n return r | (v >> 1);\n}\n\n/**\n * Remove items from a javascript array without generating garbage\n *\n * @function removeItems\n * @memberof PIXI.utils\n * @param {Array} arr - Array to remove elements from\n * @param {number} startIdx - starting index\n * @param {number} removeCount - how many to remove\n */\nfunction removeItems(arr, startIdx, removeCount) {\n var length = arr.length;\n var i;\n if (startIdx >= length || removeCount === 0) {\n return;\n }\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n var len = length - removeCount;\n for (i = startIdx; i < len; ++i) {\n arr[i] = arr[i + removeCount];\n }\n arr.length = len;\n}\n\nvar nextUid = 0;\n/**\n * Gets the next unique identifier\n *\n * @memberof PIXI.utils\n * @function uid\n * @return {number} The next unique identifier to use.\n */\nfunction uid() {\n return ++nextUid;\n}\n\n// A map of warning messages already fired\nvar warnings = {};\n/**\n * Helper for warning developers about deprecated features & settings.\n * A stack track for warnings is given; useful for tracking-down where\n * deprecated methods/properties/classes are being used within the code.\n *\n * @memberof PIXI.utils\n * @function deprecation\n * @param {string} version - The version where the feature became deprecated\n * @param {string} message - Message should include what is deprecated, where, and the new solution\n * @param {number} [ignoreDepth=3] - The number of steps to ignore at the top of the error stack\n * this is mostly to ignore internal deprecation calls.\n */\nfunction deprecation(version, message, ignoreDepth) {\n if (ignoreDepth === void 0) { ignoreDepth = 3; }\n // Ignore duplicat\n if (warnings[message]) {\n return;\n }\n /* eslint-disable no-console */\n var stack = new Error().stack;\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined') {\n console.warn('PixiJS Deprecation Warning: ', message + \"\\nDeprecated since v\" + version);\n }\n else {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n if (console.groupCollapsed) {\n console.groupCollapsed('%cPixiJS Deprecation Warning: %c%s', 'color:#614108;background:#fffbe6', 'font-weight:normal;color:#614108;background:#fffbe6', message + \"\\nDeprecated since v\" + version);\n console.warn(stack);\n console.groupEnd();\n }\n else {\n console.warn('PixiJS Deprecation Warning: ', message + \"\\nDeprecated since v\" + version);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n warnings[message] = true;\n}\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nvar ProgramCache = {};\n/**\n * @todo Describe property usage\n *\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nvar TextureCache = Object.create(null);\n/**\n * @todo Describe property usage\n *\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nvar BaseTextureCache = Object.create(null);\n\n/**\n * Creates a Canvas element of the given size to be used as a target for rendering to.\n *\n * @class\n * @memberof PIXI.utils\n */\nvar CanvasRenderTarget = /** @class */ (function () {\n /**\n * @param width - the width for the newly created canvas\n * @param height - the height for the newly created canvas\n * @param {number} [resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the canvas\n */\n function CanvasRenderTarget(width, height, resolution) {\n this.canvas = document.createElement('canvas');\n this.context = this.canvas.getContext('2d');\n this.resolution = resolution || settings.RESOLUTION;\n this.resize(width, height);\n }\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\n CanvasRenderTarget.prototype.clear = function () {\n this.context.setTransform(1, 0, 0, 1, 0, 0);\n this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n };\n /**\n * Resizes the canvas to the specified width and height.\n *\n * @param desiredWidth - the desired width of the canvas\n * @param desiredHeight - the desired height of the canvas\n */\n CanvasRenderTarget.prototype.resize = function (desiredWidth, desiredHeight) {\n this.canvas.width = Math.round(desiredWidth * this.resolution);\n this.canvas.height = Math.round(desiredHeight * this.resolution);\n };\n /** Destroys this canvas. */\n CanvasRenderTarget.prototype.destroy = function () {\n this.context = null;\n this.canvas = null;\n };\n Object.defineProperty(CanvasRenderTarget.prototype, \"width\", {\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get: function () {\n return this.canvas.width;\n },\n set: function (val) {\n this.canvas.width = Math.round(val);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CanvasRenderTarget.prototype, \"height\", {\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get: function () {\n return this.canvas.height;\n },\n set: function (val) {\n this.canvas.height = Math.round(val);\n },\n enumerable: false,\n configurable: true\n });\n return CanvasRenderTarget;\n}());\n\nvar tempAnchor;\n/**\n * Sets the `crossOrigin` property for this resource based on if the url\n * for this resource is cross-origin. If crossOrigin was manually set, this\n * function does nothing.\n * Nipped from the resource loader!\n *\n * @ignore\n * @param {string} url - The url to test.\n * @param {object} [loc=window.location] - The location object to test against.\n * @return {string} The crossOrigin value to use (or empty string for none).\n */\nfunction determineCrossOrigin(url$1, loc) {\n if (loc === void 0) { loc = self.location; }\n // data: and javascript: urls are considered same-origin\n if (url$1.indexOf('data:') === 0) {\n return '';\n }\n // default is window.location\n loc = loc || self.location;\n if (!tempAnchor) {\n tempAnchor = document.createElement('a');\n }\n // let the browser determine the full href for the url of this resource and then\n // parse with the node url lib, we can't use the properties of the anchor element\n // because they don't work in IE9 :(\n tempAnchor.href = url$1;\n var parsedUrl = url.parse(tempAnchor.href);\n var samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol) {\n return 'anonymous';\n }\n return '';\n}\n\n/**\n * get the resolution / device pixel ratio of an asset by looking for the prefix\n * used by spritesheets and image urls\n *\n * @memberof PIXI.utils\n * @function getResolutionOfUrl\n * @param {string} url - the image path\n * @param {number} [defaultValue=1] - the defaultValue if no filename prefix is set.\n * @return {number} resolution / device pixel ratio of an asset\n */\nfunction getResolutionOfUrl(url, defaultValue) {\n var resolution = settings.RETINA_PREFIX.exec(url);\n if (resolution) {\n return parseFloat(resolution[1]);\n }\n return defaultValue !== undefined ? defaultValue : 1;\n}\n\n/*!\n * @pixi/runner - v6.2.1\n * Compiled Tue, 21 Dec 2021 19:56:15 UTC\n *\n * @pixi/runner is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * A Runner is a highly performant and simple alternative to signals. Best used in situations\n * where events are dispatched to many objects at high frequency (say every frame!)\n *\n *\n * like a signal..\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myObject = {\n * loaded: new Runner('loaded')\n * }\n *\n * const listener = {\n * loaded: function(){\n * // thin\n * }\n * }\n *\n * myObject.loaded.add(listener);\n *\n * myObject.loaded.emit();\n * ```\n *\n * Or for handling calling the same function on many items\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const myGame = {\n * update: new Runner('update')\n * }\n *\n * const gameObject = {\n * update: function(time){\n * // update my gamey state\n * }\n * }\n *\n * myGame.update.add(gameObject);\n *\n * myGame.update.emit(time);\n * ```\n *\n * @memberof PIXI\n */\nvar Runner = /** @class */ (function () {\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n function Runner(name) {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\n /**\n * Dispatch/Broadcast Runner to all listeners added to the queue.\n *\n * @param {...any} params - (optional) parameters to pass to each listener\n */\n Runner.prototype.emit = function (a0, a1, a2, a3, a4, a5, a6, a7) {\n if (arguments.length > 8) {\n throw new Error('max arguments reached');\n }\n var _a = this, name = _a.name, items = _a.items;\n this._aliasCount++;\n for (var i = 0, len = items.length; i < len; i++) {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n if (items === this.items) {\n this._aliasCount--;\n }\n return this;\n };\n Runner.prototype.ensureNonAliasedItems = function () {\n if (this._aliasCount > 0 && this.items.length > 1) {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\n };\n /**\n * Add a listener to the Runner\n *\n * Runners do not need to have scope or functions passed to them.\n * All that is required is to pass the listening object and ensure that it has contains a function that has the same name\n * as the name provided to the Runner when it was created.\n *\n * Eg A listener passed to this Runner will require a 'complete' function.\n *\n * ```\n * import { Runner } from '@pixi/runner';\n *\n * const complete = new Runner('complete');\n * ```\n *\n * The scope used will be the object itself.\n *\n * @param {any} item - The object that will be listening.\n */\n Runner.prototype.add = function (item) {\n if (item[this._name]) {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n return this;\n };\n /**\n * Remove a single listener from the dispatch queue.\n *\n * @param {any} item - The listener that you would like to remove.\n */\n Runner.prototype.remove = function (item) {\n var index = this.items.indexOf(item);\n if (index !== -1) {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n return this;\n };\n /**\n * Check to see if the listener is already in the Runner\n *\n * @param {any} item - The listener that you would like to check.\n */\n Runner.prototype.contains = function (item) {\n return this.items.indexOf(item) !== -1;\n };\n /** Remove all listeners from the Runner */\n Runner.prototype.removeAll = function () {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n return this;\n };\n /** Remove all references, don't use after this. */\n Runner.prototype.destroy = function () {\n this.removeAll();\n this.items = null;\n this._name = null;\n };\n Object.defineProperty(Runner.prototype, \"empty\", {\n /**\n * `true` if there are no this Runner contains no listeners\n *\n * @readonly\n */\n get: function () {\n return this.items.length === 0;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Runner.prototype, \"name\", {\n /**\n * The name of the runner.\n *\n * @readonly\n */\n get: function () {\n return this._name;\n },\n enumerable: false,\n configurable: true\n });\n return Runner;\n}());\nObject.defineProperties(Runner.prototype, {\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method dispatch\n * @see PIXI.Runner#emit\n */\n dispatch: { value: Runner.prototype.emit },\n /**\n * Alias for `emit`\n * @memberof PIXI.Runner#\n * @method run\n * @see PIXI.Runner#emit\n */\n run: { value: Runner.prototype.emit },\n});\n\n/*!\n * @pixi/ticker - v6.2.1\n * Compiled Tue, 21 Dec 2021 19:56:15 UTC\n *\n * @pixi/ticker is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n/**\n * Target frames per millisecond.\n *\n * @static\n * @name TARGET_FPMS\n * @memberof PIXI.settings\n * @type {number}\n * @default 0.06\n */\nsettings.TARGET_FPMS = 0.06;\n\n/**\n * Represents the update priorities used by internal PIXI classes when registered with\n * the {@link PIXI.Ticker} object. Higher priority items are updated first and lower\n * priority items, such as render, should go later.\n *\n * @static\n * @constant\n * @name UPDATE_PRIORITY\n * @memberof PIXI\n * @enum {number}\n * @property {number} INTERACTION=50 Highest priority, used for {@link PIXI.InteractionManager}\n * @property {number} HIGH=25 High priority updating, {@link PIXI.VideoBaseTexture} and {@link PIXI.AnimatedSprite}\n * @property {number} NORMAL=0 Default priority for ticker events, see {@link PIXI.Ticker#add}.\n * @property {number} LOW=-25 Low priority used for {@link PIXI.Application} rendering.\n * @property {number} UTILITY=-50 Lowest priority used for {@link PIXI.BasePrepare} utility.\n */\nvar UPDATE_PRIORITY;\n(function (UPDATE_PRIORITY) {\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"INTERACTION\"] = 50] = \"INTERACTION\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"HIGH\"] = 25] = \"HIGH\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"NORMAL\"] = 0] = \"NORMAL\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"LOW\"] = -25] = \"LOW\";\n UPDATE_PRIORITY[UPDATE_PRIORITY[\"UTILITY\"] = -50] = \"UTILITY\";\n})(UPDATE_PRIORITY || (UPDATE_PRIORITY = {}));\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI\n */\nvar TickerListener = /** @class */ (function () {\n /**\n * Constructor\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param priority - The priority for emitting\n * @param once - If the handler should fire once\n */\n function TickerListener(fn, context, priority, once) {\n if (context === void 0) { context = null; }\n if (priority === void 0) { priority = 0; }\n if (once === void 0) { once = false; }\n /** The next item in chain. */\n this.next = null;\n /** The previous item in chain. */\n this.previous = null;\n /** `true` if this listener has been destroyed already. */\n this._destroyed = false;\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\n /**\n * Simple compare function to figure out if a function and context match.\n * @private\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @return `true` if the listener match the arguments\n */\n TickerListener.prototype.match = function (fn, context) {\n if (context === void 0) { context = null; }\n return this.fn === fn && this.context === context;\n };\n /**\n * Emit by calling the current function.\n * @private\n * @param deltaTime - time since the last emit.\n * @return Next ticker\n */\n TickerListener.prototype.emit = function (deltaTime) {\n if (this.fn) {\n if (this.context) {\n this.fn.call(this.context, deltaTime);\n }\n else {\n this.fn(deltaTime);\n }\n }\n var redirect = this.next;\n if (this.once) {\n this.destroy(true);\n }\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed) {\n this.next = null;\n }\n return redirect;\n };\n /**\n * Connect to the list.\n * @private\n * @param previous - Input node, previous listener\n */\n TickerListener.prototype.connect = function (previous) {\n this.previous = previous;\n if (previous.next) {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n };\n /**\n * Destroy and don't use after this.\n * @private\n * @param hard - `true` to remove the `next` reference, this\n * is considered a hard destroy. Soft destroy maintains the next reference.\n * @return The listener to redirect while emitting or removing.\n */\n TickerListener.prototype.destroy = function (hard) {\n if (hard === void 0) { hard = false; }\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n // Disconnect, hook up next and previous\n if (this.previous) {\n this.previous.next = this.next;\n }\n if (this.next) {\n this.next.previous = this.previous;\n }\n // Redirect to the next item\n var redirect = this.next;\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n return redirect;\n };\n return TickerListener;\n}());\n\n/**\n * A Ticker class that runs an update loop that other objects listen to.\n *\n * This class is composed around listeners meant for execution on the next requested animation frame.\n * Animation frames are requested only when necessary, e.g. When the ticker is started and the emitter has listeners.\n *\n * @class\n * @memberof PIXI\n */\nvar Ticker = /** @class */ (function () {\n function Ticker() {\n var _this = this;\n /**\n * Whether or not this ticker should invoke the method\n * {@link PIXI.Ticker#start} automatically\n * when a listener is added.\n */\n this.autoStart = false;\n /**\n * Scalar time value from last frame to this frame.\n * This value is capped by setting {@link PIXI.Ticker#minFPS}\n * and is scaled with {@link PIXI.Ticker#speed}.\n * **Note:** The cap may be exceeded by scaling.\n */\n this.deltaTime = 1;\n /**\n * The last time {@link PIXI.Ticker#update} was invoked.\n * This value is also reset internally outside of invoking\n * update, but only when a new animation frame is requested.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n */\n this.lastTime = -1;\n /**\n * Factor of current {@link PIXI.Ticker#deltaTime}.\n * @example\n * // Scales ticker.deltaTime to what would be\n * // the equivalent of approximately 120 FPS\n * ticker.speed = 2;\n */\n this.speed = 1;\n /**\n * Whether or not this ticker has been started.\n * `true` if {@link PIXI.Ticker#start} has been called.\n * `false` if {@link PIXI.Ticker#stop} has been called.\n * While `false`, this value may change to `true` in the\n * event of {@link PIXI.Ticker#autoStart} being `true`\n * and a listener is added.\n */\n this.started = false;\n /** Internal current frame request ID */\n this._requestId = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n this._maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n this._minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n this._protected = false;\n /**\n * The last time keyframe was executed.\n * Maintains a relatively fixed interval with the previous value.\n */\n this._lastFrame = -1;\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / settings.TARGET_FPMS;\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n this._tick = function (time) {\n _this._requestId = null;\n if (_this.started) {\n // Invoke listeners now\n _this.update(time);\n // Listener side effects may have modified ticker state.\n if (_this.started && _this._requestId === null && _this._head.next) {\n _this._requestId = requestAnimationFrame(_this._tick);\n }\n }\n };\n }\n /**\n * Conditionally requests a new animation frame.\n * If a frame has not already been requested, and if the internal\n * emitter has listeners, a new frame is requested.\n *\n * @private\n */\n Ticker.prototype._requestIfNeeded = function () {\n if (this._requestId === null && this._head.next) {\n // ensure callbacks get correct delta\n this.lastTime = performance.now();\n this._lastFrame = this.lastTime;\n this._requestId = requestAnimationFrame(this._tick);\n }\n };\n /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n Ticker.prototype._cancelIfNeeded = function () {\n if (this._requestId !== null) {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\n };\n /**\n * Conditionally requests a new animation frame.\n * If the ticker has been started it checks if a frame has not already\n * been requested, and if the internal emitter has listeners. If these\n * conditions are met, a new frame is requested. If the ticker has not\n * been started, but autoStart is `true`, then the ticker starts now,\n * and continues with the previous conditions to request a new frame.\n *\n * @private\n */\n Ticker.prototype._startIfPossible = function () {\n if (this.started) {\n this._requestIfNeeded();\n }\n else if (this.autoStart) {\n this.start();\n }\n };\n /**\n * Register a handler for tick events. Calls continuously unless\n * it is removed or the ticker is stopped.\n *\n * @param fn - The listener function to be added for updates\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n Ticker.prototype.add = function (fn, context, priority) {\n if (priority === void 0) { priority = UPDATE_PRIORITY.NORMAL; }\n return this._addListener(new TickerListener(fn, context, priority));\n };\n /**\n * Add a handler for the tick event which is only execute once.\n *\n * @param fn - The listener function to be added for one update\n * @param context - The listener context\n * @param {number} [priority=PIXI.UPDATE_PRIORITY.NORMAL] - The priority for emitting\n * @returns This instance of a ticker\n */\n Ticker.prototype.addOnce = function (fn, context, priority) {\n if (priority === void 0) { priority = UPDATE_PRIORITY.NORMAL; }\n return this._addListener(new TickerListener(fn, context, priority, true));\n };\n /**\n * Internally adds the event handler so that it can be sorted by priority.\n * Priority allows certain handler (user, AnimatedSprite, Interaction) to be run\n * before the rendering.\n *\n * @private\n * @param listener - Current listener being added.\n * @returns This instance of a ticker\n */\n Ticker.prototype._addListener = function (listener) {\n // For attaching to head\n var current = this._head.next;\n var previous = this._head;\n // Add the first item\n if (!current) {\n listener.connect(previous);\n }\n else {\n // Go from highest to lowest priority\n while (current) {\n if (listener.priority > current.priority) {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n // Not yet connected\n if (!listener.previous) {\n listener.connect(previous);\n }\n }\n this._startIfPossible();\n return this;\n };\n /**\n * Removes any handlers matching the function and context parameters.\n * If no handlers are left after removing, then it cancels the animation frame.\n *\n * @param fn - The listener function to be removed\n * @param context - The listener context to be removed\n * @returns This instance of a ticker\n */\n Ticker.prototype.remove = function (fn, context) {\n var listener = this._head.next;\n while (listener) {\n // We found a match, lets remove it\n // no break to delete all possible matches\n // incase a listener was added 2+ times\n if (listener.match(fn, context)) {\n listener = listener.destroy();\n }\n else {\n listener = listener.next;\n }\n }\n if (!this._head.next) {\n this._cancelIfNeeded();\n }\n return this;\n };\n Object.defineProperty(Ticker.prototype, \"count\", {\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n *\n * @readonly\n * @member {number}\n */\n get: function () {\n if (!this._head) {\n return 0;\n }\n var count = 0;\n var current = this._head;\n while ((current = current.next)) {\n count++;\n }\n return count;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n Ticker.prototype.start = function () {\n if (!this.started) {\n this.started = true;\n this._requestIfNeeded();\n }\n };\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n Ticker.prototype.stop = function () {\n if (this.started) {\n this.started = false;\n this._cancelIfNeeded();\n }\n };\n /**\n * Destroy the ticker and don't use after this. Calling\n * this method removes all references to internal events.\n */\n Ticker.prototype.destroy = function () {\n if (!this._protected) {\n this.stop();\n var listener = this._head.next;\n while (listener) {\n listener = listener.destroy(true);\n }\n this._head.destroy();\n this._head = null;\n }\n };\n /**\n * Triggers an update. An update entails setting the\n * current {@link PIXI.Ticker#elapsedMS},\n * the current {@link PIXI.Ticker#deltaTime},\n * invoking all listeners with current deltaTime,\n * and then finally setting {@link PIXI.Ticker#lastTime}\n * with the value of currentTime that was provided.\n * This method will be called automatically by animation\n * frame callbacks if the ticker instance has been started\n * and listeners are added.\n *\n * @param {number} [currentTime=performance.now()] - the current time of execution\n */\n Ticker.prototype.update = function (currentTime) {\n if (currentTime === void 0) { currentTime = performance.now(); }\n var elapsedMS;\n // If the difference in time is zero or negative, we ignore most of the work done here.\n // If there is no valid difference, then should be no reason to let anyone know about it.\n // A zero delta, is exactly that, nothing should update.\n //\n // The difference in time can be negative, and no this does not mean time traveling.\n // This can be the result of a race condition between when an animation frame is requested\n // on the current JavaScript engine event loop, and when the ticker's start method is invoked\n // (which invokes the internal _requestIfNeeded method). If a frame is requested before\n // _requestIfNeeded is invoked, then the callback for the animation frame the ticker requests,\n // can receive a time argument that can be less than the lastTime value that was set within\n // _requestIfNeeded. This difference is in microseconds, but this is enough to cause problems.\n //\n // This check covers this browser engine timing issue, as well as if consumers pass an invalid\n // currentTime value. This may happen if consumers opt-out of the autoStart, and update themselves.\n if (currentTime > this.lastTime) {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS) {\n elapsedMS = this._maxElapsedMS;\n }\n elapsedMS *= this.speed;\n // If not enough time has passed, exit the function.\n // Get ready for next frame by setting _lastFrame, but based on _minElapsedMS\n // adjustment to ensure a relatively stable interval.\n if (this._minElapsedMS) {\n var delta = currentTime - this._lastFrame | 0;\n if (delta < this._minElapsedMS) {\n return;\n }\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n var head = this._head;\n // Invoke listeners added to internal emitter\n var listener = head.next;\n while (listener) {\n listener = listener.emit(this.deltaTime);\n }\n if (!head.next) {\n this._cancelIfNeeded();\n }\n }\n else {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n this.lastTime = currentTime;\n };\n Object.defineProperty(Ticker.prototype, \"FPS\", {\n /**\n * The frames per second at which this ticker is running.\n * The default is approximately 60 in most modern browsers.\n * **Note:** This does not factor in the value of\n * {@link PIXI.Ticker#speed}, which is specific\n * to scaling {@link PIXI.Ticker#deltaTime}.\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n return 1000 / this.elapsedMS;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Ticker.prototype, \"minFPS\", {\n /**\n * Manages the maximum amount of milliseconds allowed to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This value is used to cap {@link PIXI.Ticker#deltaTime},\n * but does not effect the measured value of {@link PIXI.Ticker#FPS}.\n * When setting this property it is clamped to a value between\n * `0` and `PIXI.settings.TARGET_FPMS * 1000`.\n *\n * @member {number}\n * @default 10\n */\n get: function () {\n return 1000 / this._maxElapsedMS;\n },\n set: function (fps) {\n // Minimum must be below the maxFPS\n var minFPS = Math.min(this.maxFPS, fps);\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n var minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n this._maxElapsedMS = 1 / minFPMS;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Ticker.prototype, \"maxFPS\", {\n /**\n * Manages the minimum amount of milliseconds required to\n * elapse between invoking {@link PIXI.Ticker#update}.\n * This will effect the measured value of {@link PIXI.Ticker#FPS}.\n * If it is set to `0`, then there is no limit; PixiJS will render as many frames as it can.\n * Otherwise it will be at least `minFPS`\n *\n * @member {number}\n * @default 0\n */\n get: function () {\n if (this._minElapsedMS) {\n return Math.round(1000 / this._minElapsedMS);\n }\n return 0;\n },\n set: function (fps) {\n if (fps === 0) {\n this._minElapsedMS = 0;\n }\n else {\n // Max must be at least the minFPS\n var maxFPS = Math.max(this.minFPS, fps);\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Ticker, \"shared\", {\n /**\n * The shared ticker instance used by {@link PIXI.AnimatedSprite} and by\n * {@link PIXI.VideoResource} to update animation frames / video textures.\n *\n * It may also be used by {@link PIXI.Application} if created with the `sharedTicker` option property set to true.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n * Please follow the examples for usage, including how to opt-out of auto-starting the shared ticker.\n *\n * @example\n * let ticker = PIXI.Ticker.shared;\n * // Set this to prevent starting this ticker when listeners are added.\n * // By default this is true only for the PIXI.Ticker.shared instance.\n * ticker.autoStart = false;\n * // FYI, call this to ensure the ticker is stopped. It should be stopped\n * // if you have not attempted to render anything yet.\n * ticker.stop();\n * // Call this when you are ready for a running shared ticker.\n * ticker.start();\n *\n * @example\n * // You may use the shared ticker to render...\n * let renderer = PIXI.autoDetectRenderer();\n * let stage = new PIXI.Container();\n * document.body.appendChild(renderer.view);\n * ticker.add(function (time) {\n * renderer.render(stage);\n * });\n *\n * @example\n * // Or you can just update it manually.\n * ticker.autoStart = false;\n * ticker.stop();\n * function animate(time) {\n * ticker.update(time);\n * renderer.render(stage);\n * requestAnimationFrame(animate);\n * }\n * animate(performance.now());\n *\n * @member {PIXI.Ticker}\n * @static\n */\n get: function () {\n if (!Ticker._shared) {\n var shared = Ticker._shared = new Ticker();\n shared.autoStart = true;\n shared._protected = true;\n }\n return Ticker._shared;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Ticker, \"system\", {\n /**\n * The system ticker instance used by {@link PIXI.InteractionManager} and by\n * {@link PIXI.BasePrepare} for core timing functionality that shouldn't usually need to be paused,\n * unlike the `shared` ticker which drives visual animations and rendering which may want to be paused.\n *\n * The property {@link PIXI.Ticker#autoStart} is set to `true` for this instance.\n *\n * @member {PIXI.Ticker}\n * @static\n */\n get: function () {\n if (!Ticker._system) {\n var system = Ticker._system = new Ticker();\n system.autoStart = true;\n system._protected = true;\n }\n return Ticker._system;\n },\n enumerable: false,\n configurable: true\n });\n return Ticker;\n}());\n\n/*!\n * @pixi/math - v6.2.1\n * Compiled Tue, 21 Dec 2021 19:56:15 UTC\n *\n * @pixi/math is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n/**\n * Two Pi.\n *\n * @static\n * @member {number}\n * @memberof PIXI\n */\nvar PI_2 = Math.PI * 2;\n/**\n * Constants that identify shapes, mainly to prevent `instanceof` calls.\n *\n * @static\n * @memberof PIXI\n * @enum {number}\n * @property {number} POLY Polygon\n * @property {number} RECT Rectangle\n * @property {number} CIRC Circle\n * @property {number} ELIP Ellipse\n * @property {number} RREC Rounded Rectangle\n */\nvar SHAPES;\n(function (SHAPES) {\n SHAPES[SHAPES[\"POLY\"] = 0] = \"POLY\";\n SHAPES[SHAPES[\"RECT\"] = 1] = \"RECT\";\n SHAPES[SHAPES[\"CIRC\"] = 2] = \"CIRC\";\n SHAPES[SHAPES[\"ELIP\"] = 3] = \"ELIP\";\n SHAPES[SHAPES[\"RREC\"] = 4] = \"RREC\";\n})(SHAPES || (SHAPES = {}));\n\n/**\n * Size object, contains width and height\n *\n * @memberof PIXI\n * @typedef {object} ISize\n */\n/**\n * Rectangle object is an area defined by its position, as indicated by its top-left corner\n * point (x, y) and by its width and its height.\n *\n * @memberof PIXI\n */\nvar Rectangle = /** @class */ (function () {\n /**\n * @param x - The X coordinate of the upper-left corner of the rectangle\n * @param y - The Y coordinate of the upper-left corner of the rectangle\n * @param width - The overall width of the rectangle\n * @param height - The overall height of the rectangle\n */\n function Rectangle(x, y, width, height) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n if (width === void 0) { width = 0; }\n if (height === void 0) { height = 0; }\n this.x = Number(x);\n this.y = Number(y);\n this.width = Number(width);\n this.height = Number(height);\n this.type = SHAPES.RECT;\n }\n Object.defineProperty(Rectangle.prototype, \"left\", {\n /** Returns the left edge of the rectangle. */\n get: function () {\n return this.x;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"right\", {\n /** Returns the right edge of the rectangle. */\n get: function () {\n return this.x + this.width;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"top\", {\n /** Returns the top edge of the rectangle. */\n get: function () {\n return this.y;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rectangle.prototype, \"bottom\", {\n /** Returns the bottom edge of the rectangle. */\n get: function () {\n return this.y + this.height;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Rectangle, \"EMPTY\", {\n /** A constant empty rectangle. */\n get: function () {\n return new Rectangle(0, 0, 0, 0);\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Creates a clone of this Rectangle\n *\n * @return a copy of the rectangle\n */\n Rectangle.prototype.clone = function () {\n return new Rectangle(this.x, this.y, this.width, this.height);\n };\n /**\n * Copies another rectangle to this one.\n *\n * @param rectangle - The rectangle to copy from.\n * @return Returns itself.\n */\n Rectangle.prototype.copyFrom = function (rectangle) {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n return this;\n };\n /**\n * Copies this rectangle to another one.\n *\n * @param rectangle - The rectangle to copy to.\n * @return Returns given parameter.\n */\n Rectangle.prototype.copyTo = function (rectangle) {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n return rectangle;\n };\n /**\n * Checks whether the x and y coordinates given are contained within this Rectangle\n *\n * @param x - The X coordinate of the point to test\n * @param y - The Y coordinate of the point to test\n * @return Whether the x/y coordinates are within this Rectangle\n */\n Rectangle.prototype.contains = function (x, y) {\n if (this.width <= 0 || this.height <= 0) {\n return false;\n }\n if (x >= this.x && x < this.x + this.width) {\n if (y >= this.y && y < this.y + this.height) {\n return true;\n }\n }\n return false;\n };\n /**\n * Pads the rectangle making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param paddingX - The horizontal padding amount.\n * @param paddingY - The vertical padding amount.\n * @return Returns itself.\n */\n Rectangle.prototype.pad = function (paddingX, paddingY) {\n if (paddingX === void 0) { paddingX = 0; }\n if (paddingY === void 0) { paddingY = paddingX; }\n this.x -= paddingX;\n this.y -= paddingY;\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n return this;\n };\n /**\n * Fits this rectangle around the passed one.\n *\n * @param rectangle - The rectangle to fit.\n * @return Returns itself.\n */\n Rectangle.prototype.fit = function (rectangle) {\n var x1 = Math.max(this.x, rectangle.x);\n var x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n var y1 = Math.max(this.y, rectangle.y);\n var y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n this.x = x1;\n this.width = Math.max(x2 - x1, 0);\n this.y = y1;\n this.height = Math.max(y2 - y1, 0);\n return this;\n };\n /**\n * Enlarges rectangle that way its corners lie on grid\n *\n * @param resolution - resolution\n * @param eps - precision\n * @return Returns itself.\n */\n Rectangle.prototype.ceil = function (resolution, eps) {\n if (resolution === void 0) { resolution = 1; }\n if (eps === void 0) { eps = 0.001; }\n var x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n var y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n return this;\n };\n /**\n * Enlarges this rectangle to include the passed rectangle.\n *\n * @param rectangle - The rectangle to include.\n * @return Returns itself.\n */\n Rectangle.prototype.enlarge = function (rectangle) {\n var x1 = Math.min(this.x, rectangle.x);\n var x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n var y1 = Math.min(this.y, rectangle.y);\n var y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n return this;\n };\n Rectangle.prototype.toString = function () {\n return \"[@pixi/math:Rectangle x=\" + this.x + \" y=\" + this.y + \" width=\" + this.width + \" height=\" + this.height + \"]\";\n };\n return Rectangle;\n}());\n\n/**\n * The Point object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis\n *\n * @class\n * @memberof PIXI\n * @implements IPoint\n */\nvar Point = /** @class */ (function () {\n /** Creates a new `Point`\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n function Point(x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n /** Position of the point on the x axis */\n this.x = 0;\n /** Position of the point on the y axis */\n this.y = 0;\n this.x = x;\n this.y = y;\n }\n /** Creates a clone of this point\n * @returns A clone of this point\n */\n Point.prototype.clone = function () {\n return new Point(this.x, this.y);\n };\n /**\n * Copies `x` and `y` from the given point into this point\n *\n * @param p - The point to copy from\n * @returns The point instance itself\n */\n Point.prototype.copyFrom = function (p) {\n this.set(p.x, p.y);\n return this;\n };\n /**\n * Copies this point's x and y into the given point (`p`).\n *\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n Point.prototype.copyTo = function (p) {\n p.set(this.x, this.y);\n return p;\n };\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n *\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n Point.prototype.equals = function (p) {\n return (p.x === this.x) && (p.y === this.y);\n };\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n *\n * @param {number} [x=0] - position of the point on the `x` axis\n * @param {number} [y=x] - position of the point on the `y` axis\n * @returns The point instance itself\n */\n Point.prototype.set = function (x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = x; }\n this.x = x;\n this.y = y;\n return this;\n };\n Point.prototype.toString = function () {\n return \"[@pixi/math:Point x=\" + this.x + \" y=\" + this.y + \"]\";\n };\n return Point;\n}());\n\n/**\n * The ObservablePoint object represents a location in a two-dimensional coordinate system, where `x` represents\n * the position on the horizontal axis and `y` represents the position on the vertical axis.\n *\n * An `ObservablePoint` is a point that triggers a callback when the point's position is changed.\n *\n * @memberof PIXI\n */\nvar ObservablePoint = /** @class */ (function () {\n /**\n * Creates a new `ObservablePoint`\n *\n * @param cb - callback function triggered when `x` and/or `y` are changed\n * @param scope - owner of callback\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=0] - position of the point on the y axis\n */\n function ObservablePoint(cb, scope, x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n this._x = x;\n this._y = y;\n this.cb = cb;\n this.scope = scope;\n }\n /**\n * Creates a clone of this point.\n * The callback and scope params can be overridden otherwise they will default\n * to the clone object's values.\n *\n * @override\n * @param cb - The callback function triggered when `x` and/or `y` are changed\n * @param scope - The owner of the callback\n * @return a copy of this observable point\n */\n ObservablePoint.prototype.clone = function (cb, scope) {\n if (cb === void 0) { cb = this.cb; }\n if (scope === void 0) { scope = this.scope; }\n return new ObservablePoint(cb, scope, this._x, this._y);\n };\n /**\n * Sets the point to a new `x` and `y` position.\n * If `y` is omitted, both `x` and `y` will be set to `x`.\n *\n * @param {number} [x=0] - position of the point on the x axis\n * @param {number} [y=x] - position of the point on the y axis\n * @returns The observable point instance itself\n */\n ObservablePoint.prototype.set = function (x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = x; }\n if (this._x !== x || this._y !== y) {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n return this;\n };\n /**\n * Copies x and y from the given point (`p`)\n *\n * @param p - The point to copy from. Can be any of type that is or extends `IPointData`\n * @returns The observable point instance itself\n */\n ObservablePoint.prototype.copyFrom = function (p) {\n if (this._x !== p.x || this._y !== p.y) {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n return this;\n };\n /**\n * Copies this point's x and y into that of the given point (`p`)\n *\n * @param p - The point to copy to. Can be any of type that is or extends `IPointData`\n * @returns The point (`p`) with values updated\n */\n ObservablePoint.prototype.copyTo = function (p) {\n p.set(this._x, this._y);\n return p;\n };\n /**\n * Accepts another point (`p`) and returns `true` if the given point is equal to this point\n *\n * @param p - The point to check\n * @returns Returns `true` if both `x` and `y` are equal\n */\n ObservablePoint.prototype.equals = function (p) {\n return (p.x === this._x) && (p.y === this._y);\n };\n ObservablePoint.prototype.toString = function () {\n return \"[@pixi/math:ObservablePoint x=\" + 0 + \" y=\" + 0 + \" scope=\" + this.scope + \"]\";\n };\n Object.defineProperty(ObservablePoint.prototype, \"x\", {\n /** Position of the observable point on the x axis. */\n get: function () {\n return this._x;\n },\n set: function (value) {\n if (this._x !== value) {\n this._x = value;\n this.cb.call(this.scope);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ObservablePoint.prototype, \"y\", {\n /** Position of the observable point on the y axis. */\n get: function () {\n return this._y;\n },\n set: function (value) {\n if (this._y !== value) {\n this._y = value;\n this.cb.call(this.scope);\n }\n },\n enumerable: false,\n configurable: true\n });\n return ObservablePoint;\n}());\n\n/**\n * The PixiJS Matrix as a class makes it a lot faster.\n *\n * Here is a representation of it:\n * ```js\n * | a | c | tx|\n * | b | d | ty|\n * | 0 | 0 | 1 |\n * ```\n *\n * @memberof PIXI\n */\nvar Matrix = /** @class */ (function () {\n /**\n * @param a - x scale\n * @param b - y skew\n * @param c - x skew\n * @param d - y scale\n * @param tx - x translation\n * @param ty - y translation\n */\n function Matrix(a, b, c, d, tx, ty) {\n if (a === void 0) { a = 1; }\n if (b === void 0) { b = 0; }\n if (c === void 0) { c = 0; }\n if (d === void 0) { d = 1; }\n if (tx === void 0) { tx = 0; }\n if (ty === void 0) { ty = 0; }\n this.array = null;\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n }\n /**\n * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows:\n *\n * a = array[0]\n * b = array[1]\n * c = array[3]\n * d = array[4]\n * tx = array[2]\n * ty = array[5]\n *\n * @param array - The array that the matrix will be populated from.\n */\n Matrix.prototype.fromArray = function (array) {\n this.a = array[0];\n this.b = array[1];\n this.c = array[3];\n this.d = array[4];\n this.tx = array[2];\n this.ty = array[5];\n };\n /**\n * Sets the matrix properties.\n *\n * @param a - Matrix component\n * @param b - Matrix component\n * @param c - Matrix component\n * @param d - Matrix component\n * @param tx - Matrix component\n * @param ty - Matrix component\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.set = function (a, b, c, d, tx, ty) {\n this.a = a;\n this.b = b;\n this.c = c;\n this.d = d;\n this.tx = tx;\n this.ty = ty;\n return this;\n };\n /**\n * Creates an array from the current Matrix object.\n *\n * @param transpose - Whether we need to transpose the matrix or not\n * @param [out=new Float32Array(9)] - If provided the array will be assigned to out\n * @return The newly created array which contains the matrix\n */\n Matrix.prototype.toArray = function (transpose, out) {\n if (!this.array) {\n this.array = new Float32Array(9);\n }\n var array = out || this.array;\n if (transpose) {\n array[0] = this.a;\n array[1] = this.b;\n array[2] = 0;\n array[3] = this.c;\n array[4] = this.d;\n array[5] = 0;\n array[6] = this.tx;\n array[7] = this.ty;\n array[8] = 1;\n }\n else {\n array[0] = this.a;\n array[1] = this.c;\n array[2] = this.tx;\n array[3] = this.b;\n array[4] = this.d;\n array[5] = this.ty;\n array[6] = 0;\n array[7] = 0;\n array[8] = 1;\n }\n return array;\n };\n /**\n * Get a new position with the current transformation applied.\n * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering)\n *\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, transformed through this matrix\n */\n Matrix.prototype.apply = function (pos, newPos) {\n newPos = (newPos || new Point());\n var x = pos.x;\n var y = pos.y;\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n return newPos;\n };\n /**\n * Get a new position with the inverse of the current transformation applied.\n * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input)\n *\n * @param pos - The origin\n * @param {PIXI.Point} [newPos] - The point that the new position is assigned to (allowed to be same as input)\n * @return {PIXI.Point} The new point, inverse-transformed through this matrix\n */\n Matrix.prototype.applyInverse = function (pos, newPos) {\n newPos = (newPos || new Point());\n var id = 1 / ((this.a * this.d) + (this.c * -this.b));\n var x = pos.x;\n var y = pos.y;\n newPos.x = (this.d * id * x) + (-this.c * id * y) + (((this.ty * this.c) - (this.tx * this.d)) * id);\n newPos.y = (this.a * id * y) + (-this.b * id * x) + (((-this.ty * this.a) + (this.tx * this.b)) * id);\n return newPos;\n };\n /**\n * Translates the matrix on the x and y.\n *\n * @param x - How much to translate x by\n * @param y - How much to translate y by\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.translate = function (x, y) {\n this.tx += x;\n this.ty += y;\n return this;\n };\n /**\n * Applies a scale transformation to the matrix.\n *\n * @param x - The amount to scale horizontally\n * @param y - The amount to scale vertically\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.scale = function (x, y) {\n this.a *= x;\n this.d *= y;\n this.c *= x;\n this.b *= y;\n this.tx *= x;\n this.ty *= y;\n return this;\n };\n /**\n * Applies a rotation transformation to the matrix.\n *\n * @param angle - The angle in radians.\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.rotate = function (angle) {\n var cos = Math.cos(angle);\n var sin = Math.sin(angle);\n var a1 = this.a;\n var c1 = this.c;\n var tx1 = this.tx;\n this.a = (a1 * cos) - (this.b * sin);\n this.b = (a1 * sin) + (this.b * cos);\n this.c = (c1 * cos) - (this.d * sin);\n this.d = (c1 * sin) + (this.d * cos);\n this.tx = (tx1 * cos) - (this.ty * sin);\n this.ty = (tx1 * sin) + (this.ty * cos);\n return this;\n };\n /**\n * Appends the given Matrix to this Matrix.\n *\n * @param matrix - The matrix to append.\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.append = function (matrix) {\n var a1 = this.a;\n var b1 = this.b;\n var c1 = this.c;\n var d1 = this.d;\n this.a = (matrix.a * a1) + (matrix.b * c1);\n this.b = (matrix.a * b1) + (matrix.b * d1);\n this.c = (matrix.c * a1) + (matrix.d * c1);\n this.d = (matrix.c * b1) + (matrix.d * d1);\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n return this;\n };\n /**\n * Sets the matrix based on all the available properties\n *\n * @param x - Position on the x axis\n * @param y - Position on the y axis\n * @param pivotX - Pivot on the x axis\n * @param pivotY - Pivot on the y axis\n * @param scaleX - Scale on the x axis\n * @param scaleY - Scale on the y axis\n * @param rotation - Rotation in radians\n * @param skewX - Skew on the x axis\n * @param skewY - Skew on the y axis\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.setTransform = function (x, y, pivotX, pivotY, scaleX, scaleY, rotation, skewX, skewY) {\n this.a = Math.cos(rotation + skewY) * scaleX;\n this.b = Math.sin(rotation + skewY) * scaleX;\n this.c = -Math.sin(rotation - skewX) * scaleY;\n this.d = Math.cos(rotation - skewX) * scaleY;\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n return this;\n };\n /**\n * Prepends the given Matrix to this Matrix.\n *\n * @param matrix - The matrix to prepend\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.prepend = function (matrix) {\n var tx1 = this.tx;\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1) {\n var a1 = this.a;\n var c1 = this.c;\n this.a = (a1 * matrix.a) + (this.b * matrix.c);\n this.b = (a1 * matrix.b) + (this.b * matrix.d);\n this.c = (c1 * matrix.a) + (this.d * matrix.c);\n this.d = (c1 * matrix.b) + (this.d * matrix.d);\n }\n this.tx = (tx1 * matrix.a) + (this.ty * matrix.c) + matrix.tx;\n this.ty = (tx1 * matrix.b) + (this.ty * matrix.d) + matrix.ty;\n return this;\n };\n /**\n * Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.\n *\n * @param transform - The transform to apply the properties to.\n * @return The transform with the newly applied properties\n */\n Matrix.prototype.decompose = function (transform) {\n // sort out rotation / skew..\n var a = this.a;\n var b = this.b;\n var c = this.c;\n var d = this.d;\n var pivot = transform.pivot;\n var skewX = -Math.atan2(-c, d);\n var skewY = Math.atan2(b, a);\n var delta = Math.abs(skewX + skewY);\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001) {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\n // next set scale\n transform.scale.x = Math.sqrt((a * a) + (b * b));\n transform.scale.y = Math.sqrt((c * c) + (d * d));\n // next set position\n transform.position.x = this.tx + ((pivot.x * a) + (pivot.y * c));\n transform.position.y = this.ty + ((pivot.x * b) + (pivot.y * d));\n return transform;\n };\n /**\n * Inverts this matrix\n *\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.invert = function () {\n var a1 = this.a;\n var b1 = this.b;\n var c1 = this.c;\n var d1 = this.d;\n var tx1 = this.tx;\n var n = (a1 * d1) - (b1 * c1);\n this.a = d1 / n;\n this.b = -b1 / n;\n this.c = -c1 / n;\n this.d = a1 / n;\n this.tx = ((c1 * this.ty) - (d1 * tx1)) / n;\n this.ty = -((a1 * this.ty) - (b1 * tx1)) / n;\n return this;\n };\n /**\n * Resets this Matrix to an identity (default) matrix.\n *\n * @return This matrix. Good for chaining method calls.\n */\n Matrix.prototype.identity = function () {\n this.a = 1;\n this.b = 0;\n this.c = 0;\n this.d = 1;\n this.tx = 0;\n this.ty = 0;\n return this;\n };\n /**\n * Creates a new Matrix object with the same values as this one.\n *\n * @return A copy of this matrix. Good for chaining method calls.\n */\n Matrix.prototype.clone = function () {\n var matrix = new Matrix();\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n return matrix;\n };\n /**\n * Changes the values of the given matrix to be the same as the ones in this matrix\n *\n * @param matrix - The matrix to copy to.\n * @return The matrix given in parameter with its values updated.\n */\n Matrix.prototype.copyTo = function (matrix) {\n matrix.a = this.a;\n matrix.b = this.b;\n matrix.c = this.c;\n matrix.d = this.d;\n matrix.tx = this.tx;\n matrix.ty = this.ty;\n return matrix;\n };\n /**\n * Changes the values of the matrix to be the same as the ones in given matrix\n *\n * @param {PIXI.Matrix} matrix - The matrix to copy from.\n * @return {PIXI.Matrix} this\n */\n Matrix.prototype.copyFrom = function (matrix) {\n this.a = matrix.a;\n this.b = matrix.b;\n this.c = matrix.c;\n this.d = matrix.d;\n this.tx = matrix.tx;\n this.ty = matrix.ty;\n return this;\n };\n Matrix.prototype.toString = function () {\n return \"[@pixi/math:Matrix a=\" + this.a + \" b=\" + this.b + \" c=\" + this.c + \" d=\" + this.d + \" tx=\" + this.tx + \" ty=\" + this.ty + \"]\";\n };\n Object.defineProperty(Matrix, \"IDENTITY\", {\n /**\n * A default (identity) matrix\n *\n * @readonly\n */\n get: function () {\n return new Matrix();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Matrix, \"TEMP_MATRIX\", {\n /**\n * A temp matrix\n *\n * @readonly\n */\n get: function () {\n return new Matrix();\n },\n enumerable: false,\n configurable: true\n });\n return Matrix;\n}());\n\n// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\nvar ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nvar uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nvar vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nvar vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n/**\n * [Cayley Table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * for the composition of each rotation in the dihederal group D8.\n *\n * @type number[][]\n * @private\n */\nvar rotationCayley = [];\n/**\n * Matrices for each `GD8Symmetry` rotation.\n *\n * @type Matrix[]\n * @private\n */\nvar rotationMatrices = [];\n/*\n * Alias for {@code Math.sign}.\n */\nvar signum = Math.sign;\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init() {\n for (var i = 0; i < 16; i++) {\n var row = [];\n rotationCayley.push(row);\n for (var j = 0; j < 16; j++) {\n /* Multiplies rotation matrices i and j. */\n var _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n var _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n var _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n var _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n /* Finds rotation matrix matching the product and pushes it. */\n for (var k = 0; k < 16; k++) {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy) {\n row.push(k);\n break;\n }\n }\n }\n }\n for (var i = 0; i < 16; i++) {\n var mat = new Matrix();\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\ninit();\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\n/**\n * Implements the dihedral group D8, which is similar to\n * [group D4]{@link http://mathworld.wolfram.com/DihedralGroupD4.html};\n * D8 is the same but with diagonals, and it is used for texture\n * rotations.\n *\n * The directions the U- and V- axes after rotation\n * of an angle of `a: GD8Constant` are the vectors `(uX(a), uY(a))`\n * and `(vX(a), vY(a))`. These aren't necessarily unit vectors.\n *\n * **Origin:**
\n * This is the small part of gameofbombs.com portal system. It works.\n *\n * @see PIXI.groupD8.E\n * @see PIXI.groupD8.SE\n * @see PIXI.groupD8.S\n * @see PIXI.groupD8.SW\n * @see PIXI.groupD8.W\n * @see PIXI.groupD8.NW\n * @see PIXI.groupD8.N\n * @see PIXI.groupD8.NE\n * @author Ivan @ivanpopelyshev\n * @namespace PIXI.groupD8\n * @memberof PIXI\n */\nvar groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n /**\n * Reflection about Y-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n /**\n * Reflection about the main diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n /**\n * Reflection about X-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n /**\n * Reflection about reverse diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the U-axis\n * after rotating the axes.\n */\n uX: function (ind) { return ux[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the U-axis\n * after rotating the axes.\n */\n uY: function (ind) { return uy[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The X-component of the V-axis\n * after rotating the axes.\n */\n vX: function (ind) { return vx[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} ind - sprite rotation angle.\n * @return {PIXI.GD8Symmetry} The Y-component of the V-axis\n * after rotating the axes.\n */\n vY: function (ind) { return vy[ind]; },\n /**\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - symmetry whose opposite\n * is needed. Only rotations have opposite symmetries while\n * reflections don't.\n * @return {PIXI.GD8Symmetry} The opposite symmetry of `rotation`\n */\n inv: function (rotation) {\n if (rotation & 8) // true only if between 8 & 15 (reflections)\n {\n return rotation & 15; // or rotation % 16\n }\n return (-rotation) & 7; // or (8 - rotation) % 8\n },\n /**\n * Composes the two D8 operations.\n *\n * Taking `^` as reflection:\n *\n * | | E=0 | S=2 | W=4 | N=6 | E^=8 | S^=10 | W^=12 | N^=14 |\n * |-------|-----|-----|-----|-----|------|-------|-------|-------|\n * | E=0 | E | S | W | N | E^ | S^ | W^ | N^ |\n * | S=2 | S | W | N | E | S^ | W^ | N^ | E^ |\n * | W=4 | W | N | E | S | W^ | N^ | E^ | S^ |\n * | N=6 | N | E | S | W | N^ | E^ | S^ | W^ |\n * | E^=8 | E^ | N^ | W^ | S^ | E | N | W | S |\n * | S^=10 | S^ | E^ | N^ | W^ | S | E | N | W |\n * | W^=12 | W^ | S^ | E^ | N^ | W | S | E | N |\n * | N^=14 | N^ | W^ | S^ | E^ | N | W | S | E |\n *\n * [This is a Cayley table]{@link https://en.wikipedia.org/wiki/Cayley_table}\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation, which\n * is the row in the above cayley table.\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation, which\n * is the column in the above cayley table.\n * @return {PIXI.GD8Symmetry} Composed operation\n */\n add: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][rotationFirst]); },\n /**\n * Reverse of `add`.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotationSecond - Second operation\n * @param {PIXI.GD8Symmetry} rotationFirst - First operation\n * @return {PIXI.GD8Symmetry} Result\n */\n sub: function (rotationSecond, rotationFirst) { return (rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]); },\n /**\n * Adds 180 degrees to rotation, which is a commutative\n * operation.\n *\n * @memberof PIXI.groupD8\n * @param {number} rotation - The number to rotate.\n * @returns {number} Rotated number\n */\n rotate180: function (rotation) { return rotation ^ 4; },\n /**\n * Checks if the rotation angle is vertical, i.e. south\n * or north. It doesn't work for reflections.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.GD8Symmetry} rotation - The number to check.\n * @returns {boolean} Whether or not the direction is vertical\n */\n isVertical: function (rotation) { return (rotation & 3) === 2; },\n /**\n * Approximates the vector `V(dx,dy)` into one of the\n * eight directions provided by `groupD8`.\n *\n * @memberof PIXI.groupD8\n * @param {number} dx - X-component of the vector\n * @param {number} dy - Y-component of the vector\n * @return {PIXI.GD8Symmetry} Approximation of the vector into\n * one of the eight symmetries.\n */\n byDirection: function (dx, dy) {\n if (Math.abs(dx) * 2 <= Math.abs(dy)) {\n if (dy >= 0) {\n return groupD8.S;\n }\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx)) {\n if (dx > 0) {\n return groupD8.E;\n }\n return groupD8.W;\n }\n else if (dy > 0) {\n if (dx > 0) {\n return groupD8.SE;\n }\n return groupD8.SW;\n }\n else if (dx > 0) {\n return groupD8.NE;\n }\n return groupD8.NW;\n },\n /**\n * Helps sprite to compensate texture packer rotation.\n *\n * @memberof PIXI.groupD8\n * @param {PIXI.Matrix} matrix - sprite world matrix\n * @param {PIXI.GD8Symmetry} rotation - The rotation factor to use.\n * @param {number} tx - sprite anchoring\n * @param {number} ty - sprite anchoring\n */\n matrixAppendRotationInv: function (matrix, rotation, tx, ty) {\n if (tx === void 0) { tx = 0; }\n if (ty === void 0) { ty = 0; }\n // Packer used \"rotation\", we use \"inv(rotation)\"\n var mat = rotationMatrices[groupD8.inv(rotation)];\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n\n/**\n * Transform that takes care about its versions.\n *\n * @memberof PIXI\n */\nvar Transform = /** @class */ (function () {\n function Transform() {\n this.worldTransform = new Matrix();\n this.localTransform = new Matrix();\n this.position = new ObservablePoint(this.onChange, this, 0, 0);\n this.scale = new ObservablePoint(this.onChange, this, 1, 1);\n this.pivot = new ObservablePoint(this.onChange, this, 0, 0);\n this.skew = new ObservablePoint(this.updateSkew, this, 0, 0);\n this._rotation = 0;\n this._cx = 1;\n this._sx = 0;\n this._cy = 0;\n this._sy = 1;\n this._localID = 0;\n this._currentLocalID = 0;\n this._worldID = 0;\n this._parentID = 0;\n }\n /** Called when a value changes. */\n Transform.prototype.onChange = function () {\n this._localID++;\n };\n /** Called when the skew or the rotation changes. */\n Transform.prototype.updateSkew = function () {\n this._cx = Math.cos(this._rotation + this.skew.y);\n this._sx = Math.sin(this._rotation + this.skew.y);\n this._cy = -Math.sin(this._rotation - this.skew.x); // cos, added PI/2\n this._sy = Math.cos(this._rotation - this.skew.x); // sin, added PI/2\n this._localID++;\n };\n Transform.prototype.toString = function () {\n return \"[@pixi/math:Transform \"\n + (\"position=(\" + this.position.x + \", \" + this.position.y + \") \")\n + (\"rotation=\" + this.rotation + \" \")\n + (\"scale=(\" + this.scale.x + \", \" + this.scale.y + \") \")\n + (\"skew=(\" + this.skew.x + \", \" + this.skew.y + \") \")\n + \"]\";\n };\n /** Updates the local transformation matrix. */\n Transform.prototype.updateLocalTransform = function () {\n var lt = this.localTransform;\n if (this._localID !== this._currentLocalID) {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n // force an update..\n this._parentID = -1;\n }\n };\n /**\n * Updates the local and the world transformation matrices.\n *\n * @param parentTransform - The parent transform\n */\n Transform.prototype.updateTransform = function (parentTransform) {\n var lt = this.localTransform;\n if (this._localID !== this._currentLocalID) {\n // get the matrix values of the displayobject based on its transform properties..\n lt.a = this._cx * this.scale.x;\n lt.b = this._sx * this.scale.x;\n lt.c = this._cy * this.scale.y;\n lt.d = this._sy * this.scale.y;\n lt.tx = this.position.x - ((this.pivot.x * lt.a) + (this.pivot.y * lt.c));\n lt.ty = this.position.y - ((this.pivot.x * lt.b) + (this.pivot.y * lt.d));\n this._currentLocalID = this._localID;\n // force an update..\n this._parentID = -1;\n }\n if (this._parentID !== parentTransform._worldID) {\n // concat the parent matrix with the objects transform.\n var pt = parentTransform.worldTransform;\n var wt = this.worldTransform;\n wt.a = (lt.a * pt.a) + (lt.b * pt.c);\n wt.b = (lt.a * pt.b) + (lt.b * pt.d);\n wt.c = (lt.c * pt.a) + (lt.d * pt.c);\n wt.d = (lt.c * pt.b) + (lt.d * pt.d);\n wt.tx = (lt.tx * pt.a) + (lt.ty * pt.c) + pt.tx;\n wt.ty = (lt.tx * pt.b) + (lt.ty * pt.d) + pt.ty;\n this._parentID = parentTransform._worldID;\n // update the id of the transform..\n this._worldID++;\n }\n };\n /**\n * Decomposes a matrix and sets the transforms properties based on it.\n *\n * @param matrix - The matrix to decompose\n */\n Transform.prototype.setFromMatrix = function (matrix) {\n matrix.decompose(this);\n this._localID++;\n };\n Object.defineProperty(Transform.prototype, \"rotation\", {\n /** The rotation of the object in radians. */\n get: function () {\n return this._rotation;\n },\n set: function (value) {\n if (this._rotation !== value) {\n this._rotation = value;\n this.updateSkew();\n }\n },\n enumerable: false,\n configurable: true\n });\n /** A default (identity) transform. */\n Transform.IDENTITY = new Transform();\n return Transform;\n}());\n\n/*!\n * @pixi/core - v6.2.1\n * Compiled Tue, 21 Dec 2021 19:56:15 UTC\n *\n * @pixi/core is licensed under the MIT License.\n * http://www.opensource.org/licenses/mit-license\n */\n\n/**\n * The maximum support for using WebGL. If a device does not\n * support WebGL version, for instance WebGL 2, it will still\n * attempt to fallback support to WebGL 1. If you want to\n * explicitly remove feature support to target a more stable\n * baseline, prefer a lower environment.\n *\n * Due to {@link https://bugs.chromium.org/p/chromium/issues/detail?id=934823|bug in chromium}\n * we disable webgl2 by default for all non-apple mobile devices.\n *\n * @static\n * @name PREFER_ENV\n * @memberof PIXI.settings\n * @type {number}\n * @default PIXI.ENV.WEBGL2\n */\nsettings.PREFER_ENV = isMobile.any ? ENV.WEBGL : ENV.WEBGL2;\n/**\n * If set to `true`, *only* Textures and BaseTexture objects stored\n * in the caches ({@link PIXI.utils.TextureCache TextureCache} and\n * {@link PIXI.utils.BaseTextureCache BaseTextureCache}) can be\n * used when calling {@link PIXI.Texture.from Texture.from} or\n * {@link PIXI.BaseTexture.from BaseTexture.from}.\n * Otherwise, these `from` calls throw an exception. Using this property\n * can be useful if you want to enforce preloading all assets with\n * {@link PIXI.Loader Loader}.\n *\n * @static\n * @name STRICT_TEXTURE_CACHE\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.STRICT_TEXTURE_CACHE = false;\n\n/**\n * Collection of installed resource types, class must extend {@link PIXI.Resource}.\n * @example\n * class CustomResource extends PIXI.Resource {\n * // MUST have source, options constructor signature\n * // for auto-detected resources to be created.\n * constructor(source, options) {\n * super();\n * }\n * upload(renderer, baseTexture, glTexture) {\n * // upload with GL\n * return true;\n * }\n * // used to auto-detect resource\n * static test(source, extension) {\n * return extension === 'xyz'|| source instanceof SomeClass;\n * }\n * }\n * // Install the new resource type\n * PIXI.INSTALLED.push(CustomResource);\n *\n * @memberof PIXI\n * @type {Array}\n * @static\n * @readonly\n */\nvar INSTALLED = [];\n/**\n * Create a resource element from a single source element. This\n * auto-detects which type of resource to create. All resources that\n * are auto-detectable must have a static `test` method and a constructor\n * with the arguments `(source, options?)`. Currently, the supported\n * resources for auto-detection include:\n * - {@link PIXI.ImageResource}\n * - {@link PIXI.CanvasResource}\n * - {@link PIXI.VideoResource}\n * - {@link PIXI.SVGResource}\n * - {@link PIXI.BufferResource}\n * @static\n * @memberof PIXI\n * @function autoDetectResource\n * @param {string|*} source - Resource source, this can be the URL to the resource,\n * a typed-array (for BufferResource), HTMLVideoElement, SVG data-uri\n * or any other resource that can be auto-detected. If not resource is\n * detected, it's assumed to be an ImageResource.\n * @param {object} [options] - Pass-through options to use for Resource\n * @param {number} [options.width] - Width of BufferResource or SVG rasterization\n * @param {number} [options.height] - Height of BufferResource or SVG rasterization\n * @param {boolean} [options.autoLoad=true] - Image, SVG and Video flag to start loading\n * @param {number} [options.scale=1] - SVG source scale. Overridden by width, height\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - Image option to create Bitmap object\n * @param {boolean} [options.crossorigin=true] - Image and Video option to set crossOrigin\n * @param {boolean} [options.autoPlay=true] - Video option to start playing video immediately\n * @param {number} [options.updateFPS=0] - Video option to update how many times a second the\n * texture should be updated from the video. Leave at 0 to update at every render\n * @return {PIXI.Resource} The created resource.\n */\nfunction autoDetectResource(source, options) {\n if (!source) {\n return null;\n }\n var extension = '';\n if (typeof source === 'string') {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n var result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n if (result) {\n extension = result[1].toLowerCase();\n }\n }\n for (var i = INSTALLED.length - 1; i >= 0; --i) {\n var ResourcePlugin = INSTALLED[i];\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension)) {\n return new ResourcePlugin(source, options);\n }\n }\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation. All rights reserved.\r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License. You may obtain a copy of the\r\nLicense at http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\r\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\r\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\r\nMERCHANTABLITY OR NON-INFRINGEMENT.\r\n\r\nSee the Apache Version 2.0 License for specific language governing permissions\r\nand limitations under the License.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) { d[p] = b[p]; } } };\r\n return extendStatics(d, b);\r\n};\r\n\r\nfunction __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nvar __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\n var arguments$1 = arguments;\n\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments$1[i];\r\n for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) { t[p] = s[p]; } }\r\n }\r\n return t;\r\n };\r\n return __assign.apply(this, arguments);\r\n};\r\n\r\nfunction __rest(s, e) {\r\n var t = {};\r\n for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n { t[p] = s[p]; } }\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n { for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0)\r\n { t[p[i]] = s[p[i]]; } } }\r\n return t;\r\n}\n\n/**\n * Base resource class for textures that manages validation and uploading, depending on its type.\n *\n * Uploading of a base texture to the GPU is required.\n *\n * @memberof PIXI\n */\nvar Resource = /** @class */ (function () {\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n function Resource(width, height) {\n if (width === void 0) { width = 0; }\n if (height === void 0) { height = 0; }\n this._width = width;\n this._height = height;\n this.destroyed = false;\n this.internal = false;\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n /**\n * Bind to a parent BaseTexture\n *\n * @param baseTexture - Parent texture\n */\n Resource.prototype.bind = function (baseTexture) {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height) {\n this.onResize.emit(this._width, this._height);\n }\n };\n /**\n * Unbind to a parent BaseTexture\n *\n * @param baseTexture - Parent texture\n */\n Resource.prototype.unbind = function (baseTexture) {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n };\n /**\n * Trigger a resize event\n *\n * @param width - X dimension\n * @param height - Y dimension\n */\n Resource.prototype.resize = function (width, height) {\n if (width !== this._width || height !== this._height) {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n };\n Object.defineProperty(Resource.prototype, \"valid\", {\n /**\n * Has been validated\n *\n * @readonly\n */\n get: function () {\n return !!this._width && !!this._height;\n },\n enumerable: false,\n configurable: true\n });\n /** Has been updated trigger event. */\n Resource.prototype.update = function () {\n if (!this.destroyed) {\n this.onUpdate.emit();\n }\n };\n /**\n * This can be overridden to start preloading a resource\n * or do any other prepare step.\n *\n * @protected\n * @return Handle the validate event\n */\n Resource.prototype.load = function () {\n return Promise.resolve(this);\n };\n Object.defineProperty(Resource.prototype, \"width\", {\n /**\n * The width of the resource.\n *\n * @readonly\n */\n get: function () {\n return this._width;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Resource.prototype, \"height\", {\n /**\n * The height of the resource.\n *\n * @readonly\n */\n get: function () {\n return this._height;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Set the style, optional to override\n *\n * @param renderer - yeah, renderer!\n * @param baseTexture - the texture\n * @param glTexture - texture instance for this webgl context\n * @returns - `true` is success\n */\n Resource.prototype.style = function (_renderer, _baseTexture, _glTexture) {\n return false;\n };\n /** Clean up anything, this happens when destroying is ready. */\n Resource.prototype.dispose = function () {\n // override\n };\n /**\n * Call when destroying resource, unbind any BaseTexture object\n * before calling this method, as reference counts are maintained\n * internally.\n */\n Resource.prototype.destroy = function () {\n if (!this.destroyed) {\n this.destroyed = true;\n this.dispose();\n this.onError.removeAll();\n this.onError = null;\n this.onResize.removeAll();\n this.onResize = null;\n this.onUpdate.removeAll();\n this.onUpdate = null;\n }\n };\n /**\n * Abstract, used to auto-detect resource type.\n *\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n */\n Resource.test = function (_source, _extension) {\n return false;\n };\n return Resource;\n}());\n\n/**\n * @interface SharedArrayBuffer\n */\n/**\n * Buffer resource with data of typed array.\n *\n * @memberof PIXI\n */\nvar BufferResource = /** @class */ (function (_super) {\n __extends(BufferResource, _super);\n /**\n * @param source - Source buffer\n * @param options - Options\n * @param {number} options.width - Width of the texture\n * @param {number} options.height - Height of the texture\n */\n function BufferResource(source, options) {\n var _this = this;\n var _a = options || {}, width = _a.width, height = _a.height;\n if (!width || !height) {\n throw new Error('BufferResource width or height invalid');\n }\n _this = _super.call(this, width, height) || this;\n _this.data = source;\n return _this;\n }\n /**\n * Upload the texture to the GPU.\n *\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @returns - true is success\n */\n BufferResource.prototype.upload = function (renderer, baseTexture, glTexture) {\n var gl = renderer.gl;\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n var width = baseTexture.realWidth;\n var height = baseTexture.realHeight;\n if (glTexture.width === width && glTexture.height === height) {\n gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data);\n }\n else {\n glTexture.width = width;\n glTexture.height = height;\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data);\n }\n return true;\n };\n /** Destroy and don't use after this. */\n BufferResource.prototype.dispose = function () {\n this.data = null;\n };\n /**\n * Used to auto-detect the type of resource.\n *\n * @param {*} source - The source object\n * @return {boolean} `true` if \n */\n BufferResource.test = function (source) {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n };\n return BufferResource;\n}(Resource));\n\nvar defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n/**\n * A Texture stores the information that represents an image.\n * All textures have a base texture, which contains information about the source.\n * Therefore you can have many textures all using a single BaseTexture\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n * @typeParam RO - The options for constructing resource.\n */\nvar BaseTexture = /** @class */ (function (_super) {\n __extends(BaseTexture, _super);\n /**\n * @param {PIXI.Resource|string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement} [resource=null] -\n * The current resource to use, for things that aren't Resource objects, will be converted\n * into a Resource.\n * @param {Object} [options] - Collection of options\n * @param {PIXI.MIPMAP_MODES} [options.mipmap=PIXI.settings.MIPMAP_TEXTURES] - If mipmapping is enabled for texture\n * @param {number} [options.anisotropicLevel=PIXI.settings.ANISOTROPIC_LEVEL] - Anisotropic filtering level of texture\n * @param {PIXI.WRAP_MODES} [options.wrapMode=PIXI.settings.WRAP_MODE] - Wrap mode for textures\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - Default scale mode, linear, nearest\n * @param {PIXI.FORMATS} [options.format=PIXI.FORMATS.RGBA] - GL format type\n * @param {PIXI.TYPES} [options.type=PIXI.TYPES.UNSIGNED_BYTE] - GL data type\n * @param {PIXI.TARGETS} [options.target=PIXI.TARGETS.TEXTURE_2D] - GL texture target\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Pre multiply the image alpha\n * @param {number} [options.width=0] - Width of the texture\n * @param {number} [options.height=0] - Height of the texture\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - Resolution of the base texture\n * @param {object} [options.resourceOptions] - Optional resource options,\n * see {@link PIXI.autoDetectResource autoDetectResource}\n */\n function BaseTexture(resource, options) {\n if (resource === void 0) { resource = null; }\n if (options === void 0) { options = null; }\n var _this = _super.call(this) || this;\n options = options || {};\n var alphaMode = options.alphaMode, mipmap = options.mipmap, anisotropicLevel = options.anisotropicLevel, scaleMode = options.scaleMode, width = options.width, height = options.height, wrapMode = options.wrapMode, format = options.format, type = options.type, target = options.target, resolution = options.resolution, resourceOptions = options.resourceOptions;\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource)) {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\n _this.resolution = resolution || settings.RESOLUTION;\n _this.width = Math.round((width || 0) * _this.resolution) / _this.resolution;\n _this.height = Math.round((height || 0) * _this.resolution) / _this.resolution;\n _this._mipmap = mipmap !== undefined ? mipmap : settings.MIPMAP_TEXTURES;\n _this.anisotropicLevel = anisotropicLevel !== undefined ? anisotropicLevel : settings.ANISOTROPIC_LEVEL;\n _this._wrapMode = wrapMode || settings.WRAP_MODE;\n _this._scaleMode = scaleMode !== undefined ? scaleMode : settings.SCALE_MODE;\n _this.format = format || FORMATS.RGBA;\n _this.type = type || TYPES.UNSIGNED_BYTE;\n _this.target = target || TARGETS.TEXTURE_2D;\n _this.alphaMode = alphaMode !== undefined ? alphaMode : ALPHA_MODES.UNPACK;\n _this.uid = uid();\n _this.touched = 0;\n _this.isPowerOfTwo = false;\n _this._refreshPOT();\n _this._glTextures = {};\n _this.dirtyId = 0;\n _this.dirtyStyleId = 0;\n _this.cacheId = null;\n _this.valid = width > 0 && height > 0;\n _this.textureCacheIds = [];\n _this.destroyed = false;\n _this.resource = null;\n _this._batchEnabled = 0;\n _this._batchLocation = 0;\n _this.parentTextureArray = null;\n /**\n * Fired when a not-immediately-available source finishes loading.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n /**\n * Fired when a not-immediately-available source fails to load.\n *\n * @protected\n * @event PIXI.BaseTexture#error\n * @param {PIXI.BaseTexture} baseTexture - Resource errored.\n * @param {ErrorEvent} event - Load error event.\n */\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\n /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#update\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being updated.\n */\n /**\n * Fired when BaseTexture is destroyed.\n *\n * @protected\n * @event PIXI.BaseTexture#dispose\n * @param {PIXI.BaseTexture} baseTexture - Instance of texture being destroyed.\n */\n // Set the resource\n _this.setResource(resource);\n return _this;\n }\n Object.defineProperty(BaseTexture.prototype, \"realWidth\", {\n /**\n * Pixel width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get: function () {\n return Math.round(this.width * this.resolution);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseTexture.prototype, \"realHeight\", {\n /**\n * Pixel height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get: function () {\n return Math.round(this.height * this.resolution);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseTexture.prototype, \"mipmap\", {\n /**\n * Mipmap mode of the texture, affects downscaled images\n *\n * @member {PIXI.MIPMAP_MODES}\n * @default PIXI.settings.MIPMAP_TEXTURES\n */\n get: function () {\n return this._mipmap;\n },\n set: function (value) {\n if (this._mipmap !== value) {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseTexture.prototype, \"scaleMode\", {\n /**\n * The scale mode to apply when scaling this texture\n *\n * @member {PIXI.SCALE_MODES}\n * @default PIXI.settings.SCALE_MODE\n */\n get: function () {\n return this._scaleMode;\n },\n set: function (value) {\n if (this._scaleMode !== value) {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BaseTexture.prototype, \"wrapMode\", {\n /**\n * How the texture wraps\n * @member {PIXI.WRAP_MODES}\n * @default PIXI.settings.WRAP_MODE\n */\n get: function () {\n return this._wrapMode;\n },\n set: function (value) {\n if (this._wrapMode !== value) {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Changes style options of BaseTexture\n *\n * @param {PIXI.SCALE_MODES} [scaleMode] - Pixi scalemode\n * @param {PIXI.MIPMAP_MODES} [mipmap] - enable mipmaps\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setStyle = function (scaleMode, mipmap) {\n var dirty;\n if (scaleMode !== undefined && scaleMode !== this.scaleMode) {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n if (mipmap !== undefined && mipmap !== this.mipmap) {\n this.mipmap = mipmap;\n dirty = true;\n }\n if (dirty) {\n this.dirtyStyleId++;\n }\n return this;\n };\n /**\n * Changes w/h/resolution. Texture becomes valid if width and height are greater than zero.\n *\n * @param {number} desiredWidth - Desired visual width\n * @param {number} desiredHeight - Desired visual height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setSize = function (desiredWidth, desiredHeight, resolution) {\n resolution = resolution || this.resolution;\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n };\n /**\n * Sets real size of baseTexture, preserves current resolution.\n *\n * @param {number} realWidth - Full rendered width\n * @param {number} realHeight - Full rendered height\n * @param {number} [resolution] - Optionally set resolution\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setRealSize = function (realWidth, realHeight, resolution) {\n this.resolution = resolution || this.resolution;\n this.width = Math.round(realWidth) / this.resolution;\n this.height = Math.round(realHeight) / this.resolution;\n this._refreshPOT();\n this.update();\n return this;\n };\n /**\n * Refresh check for isPowerOfTwo texture based on size\n *\n * @private\n */\n BaseTexture.prototype._refreshPOT = function () {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n };\n /**\n * Changes resolution\n *\n * @param {number} resolution - res\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setResolution = function (resolution) {\n var oldResolution = this.resolution;\n if (oldResolution === resolution) {\n return this;\n }\n this.resolution = resolution;\n if (this.valid) {\n this.width = Math.round(this.width * oldResolution) / resolution;\n this.height = Math.round(this.height * oldResolution) / resolution;\n this.emit('update', this);\n }\n this._refreshPOT();\n return this;\n };\n /**\n * Sets the resource if it wasn't set. Throws error if resource already present\n *\n * @param {PIXI.Resource} resource - that is managing this BaseTexture\n * @returns {PIXI.BaseTexture} this\n */\n BaseTexture.prototype.setResource = function (resource) {\n if (this.resource === resource) {\n return this;\n }\n if (this.resource) {\n throw new Error('Resource can be set only once');\n }\n resource.bind(this);\n this.resource = resource;\n return this;\n };\n /**\n * Invalidates the object. Texture becomes valid if width and height are greater than zero.\n */\n BaseTexture.prototype.update = function () {\n if (!this.valid) {\n if (this.width > 0 && this.height > 0) {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n };\n /**\n * Handle errors with resources.\n * @private\n * @param {ErrorEvent} event - Error event emitted.\n */\n BaseTexture.prototype.onError = function (event) {\n this.emit('error', this, event);\n };\n /**\n * Destroys this base texture.\n * The method stops if resource doesn't want this texture to be destroyed.\n * Removes texture from all caches.\n */\n BaseTexture.prototype.destroy = function () {\n // remove and destroy the resource\n if (this.resource) {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal) {\n this.resource.destroy();\n }\n this.resource = null;\n }\n if (this.cacheId) {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n this.cacheId = null;\n }\n // finally let the WebGL renderer know..\n this.dispose();\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n this.destroyed = true;\n };\n /**\n * Frees the texture from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n BaseTexture.prototype.dispose = function () {\n this.emit('dispose', this);\n };\n /**\n * Utility function for BaseTexture|Texture cast\n */\n BaseTexture.prototype.castToBaseTexture = function () {\n return this;\n };\n /**\n * Helper function that creates a base texture based on the source you provide.\n * The source can be - image url, image element, canvas element. If the\n * source is an image url or an image element and not in the base texture\n * cache, it will be created and loaded.\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|SVGElement|HTMLVideoElement} source - The\n * source to create base texture from.\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @returns {PIXI.BaseTexture} The new base texture.\n */\n BaseTexture.from = function (source, options, strict) {\n if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; }\n var isFrame = typeof source === 'string';\n var cacheId = null;\n if (isFrame) {\n cacheId = source;\n }\n else {\n if (!source._pixiId) {\n var prefix = (options && options.pixiIdPrefix) || 'pixiid';\n source._pixiId = prefix + \"_\" + uid();\n }\n cacheId = source._pixiId;\n }\n var baseTexture = BaseTextureCache[cacheId];\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture) {\n throw new Error(\"The cacheId \\\"\" + cacheId + \"\\\" does not exist in BaseTextureCache.\");\n }\n if (!baseTexture) {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n return baseTexture;\n };\n /**\n * Create a new BaseTexture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.BaseTexture} The resulting new BaseTexture\n */\n BaseTexture.fromBuffer = function (buffer, width, height, options) {\n buffer = buffer || new Float32Array(width * height * 4);\n var resource = new BufferResource(buffer, { width: width, height: height });\n var type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width: width, height: height, type: type }));\n };\n /**\n * Adds a BaseTexture to the global BaseTextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.BaseTexture} baseTexture - The BaseTexture to add to the cache.\n * @param {string} id - The id that the BaseTexture will be stored against.\n */\n BaseTexture.addToCache = function (baseTexture, id) {\n if (id) {\n if (baseTexture.textureCacheIds.indexOf(id) === -1) {\n baseTexture.textureCacheIds.push(id);\n }\n if (BaseTextureCache[id]) {\n // eslint-disable-next-line no-console\n console.warn(\"BaseTexture added to the cache with an id [\" + id + \"] that already had an entry\");\n }\n BaseTextureCache[id] = baseTexture;\n }\n };\n /**\n * Remove a BaseTexture from the global BaseTextureCache.\n *\n * @static\n * @param {string|PIXI.BaseTexture} baseTexture - id of a BaseTexture to be removed, or a BaseTexture instance itself.\n * @return {PIXI.BaseTexture|null} The BaseTexture that was removed.\n */\n BaseTexture.removeFromCache = function (baseTexture) {\n if (typeof baseTexture === 'string') {\n var baseTextureFromCache = BaseTextureCache[baseTexture];\n if (baseTextureFromCache) {\n var index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n if (index > -1) {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n delete BaseTextureCache[baseTexture];\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds) {\n for (var i = 0; i < baseTexture.textureCacheIds.length; ++i) {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n baseTexture.textureCacheIds.length = 0;\n return baseTexture;\n }\n return null;\n };\n /**\n * Global number of the texture batch, used by multi-texture renderers\n *\n * @static\n * @member {number}\n */\n BaseTexture._globalBatch = 0;\n return BaseTexture;\n}(eventemitter3));\n\n/**\n * Resource that can manage several resource (items) inside.\n * All resources need to have the same pixel size.\n * Parent class for CubeResource and ArrayResource\n *\n * @memberof PIXI\n */\nvar AbstractMultiResource = /** @class */ (function (_super) {\n __extends(AbstractMultiResource, _super);\n /**\n * @param length\n * @param options - Options to for Resource constructor\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n function AbstractMultiResource(length, options) {\n var _this = this;\n var _a = options || {}, width = _a.width, height = _a.height;\n _this = _super.call(this, width, height) || this;\n _this.items = [];\n _this.itemDirtyIds = [];\n for (var i = 0; i < length; i++) {\n var partTexture = new BaseTexture();\n _this.items.push(partTexture);\n // -2 - first run of texture array upload\n // -1 - texture item was allocated\n // >=0 - texture item uploaded , in sync with items[i].dirtyId\n _this.itemDirtyIds.push(-2);\n }\n _this.length = length;\n _this._load = null;\n _this.baseTexture = null;\n return _this;\n }\n /**\n * Used from ArrayResource and CubeResource constructors.\n *\n * @param resources - Can be resources, image elements, canvas, etc. ,\n * length should be same as constructor length\n * @param options - Detect options for resources\n */\n AbstractMultiResource.prototype.initFromArray = function (resources, options) {\n for (var i = 0; i < this.length; i++) {\n if (!resources[i]) {\n continue;\n }\n if (resources[i].castToBaseTexture) {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource) {\n this.addResourceAt(resources[i], i);\n }\n else {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n };\n /** Destroy this BaseImageResource. */\n AbstractMultiResource.prototype.dispose = function () {\n for (var i = 0, len = this.length; i < len; i++) {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n };\n /**\n * Set a resource by ID\n *\n * @param resource\n * @param index - Zero-based index of resource to set\n * @return - Instance for chaining\n */\n AbstractMultiResource.prototype.addResourceAt = function (resource, index) {\n if (!this.items[index]) {\n throw new Error(\"Index \" + index + \" is out of bounds\");\n }\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid) {\n this.resize(resource.width, resource.height);\n }\n this.items[index].setResource(resource);\n return this;\n };\n /** Set the parent base texture. */\n AbstractMultiResource.prototype.bind = function (baseTexture) {\n if (this.baseTexture !== null) {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n _super.prototype.bind.call(this, baseTexture);\n for (var i = 0; i < this.length; i++) {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n };\n /** Unset the parent base texture. */\n AbstractMultiResource.prototype.unbind = function (baseTexture) {\n _super.prototype.unbind.call(this, baseTexture);\n for (var i = 0; i < this.length; i++) {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n };\n /**\n * Load all the resources simultaneously\n *\n * @return - When load is resolved\n */\n AbstractMultiResource.prototype.load = function () {\n var _this = this;\n if (this._load) {\n return this._load;\n }\n var resources = this.items.map(function (item) { return item.resource; }).filter(function (item) { return item; });\n // TODO: also implement load part-by-part strategy\n var promises = resources.map(function (item) { return item.load(); });\n this._load = Promise.all(promises)\n .then(function () {\n var _a = _this.items[0], realWidth = _a.realWidth, realHeight = _a.realHeight;\n _this.resize(realWidth, realHeight);\n return Promise.resolve(_this);\n });\n return this._load;\n };\n return AbstractMultiResource;\n}(Resource));\n\n/**\n * A resource that contains a number of sources.\n *\n * @memberof PIXI\n */\nvar ArrayResource = /** @class */ (function (_super) {\n __extends(ArrayResource, _super);\n /**\n * @param source - Number of items in array or the collection\n * of image URLs to use. Can also be resources, image elements, canvas, etc.\n * @param options - Options to apply to {@link PIXI.autoDetectResource}\n * @param {number} [options.width] - Width of the resource\n * @param {number} [options.height] - Height of the resource\n */\n function ArrayResource(source, options) {\n var _this = this;\n var _a = options || {}, width = _a.width, height = _a.height;\n var urls;\n var length;\n if (Array.isArray(source)) {\n urls = source;\n length = source.length;\n }\n else {\n length = source;\n }\n _this = _super.call(this, length, { width: width, height: height }) || this;\n if (urls) {\n _this.initFromArray(urls, options);\n }\n return _this;\n }\n /**\n * Set a baseTexture by ID,\n * ArrayResource just takes resource from it, nothing more\n *\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @return - Instance for chaining\n */\n ArrayResource.prototype.addBaseTextureAt = function (baseTexture, index) {\n if (baseTexture.resource) {\n this.addResourceAt(baseTexture.resource, index);\n }\n else {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n return this;\n };\n /** Add binding */\n ArrayResource.prototype.bind = function (baseTexture) {\n _super.prototype.bind.call(this, baseTexture);\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n };\n /**\n * Upload the resources to the GPU.\n *\n * @param renderer\n * @param texture\n * @param glTexture\n * @returns - whether texture was uploaded\n */\n ArrayResource.prototype.upload = function (renderer, texture, glTexture) {\n var _a = this, length = _a.length, itemDirtyIds = _a.itemDirtyIds, items = _a.items;\n var gl = renderer.gl;\n if (glTexture.dirtyId < 0) {\n gl.texImage3D(gl.TEXTURE_2D_ARRAY, 0, glTexture.internalFormat, this._width, this._height, length, 0, texture.format, glTexture.type, null);\n }\n for (var i = 0; i < length; i++) {\n var item = items[i];\n if (itemDirtyIds[i] < item.dirtyId) {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid) {\n gl.texSubImage3D(gl.TEXTURE_2D_ARRAY, 0, 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width, item.resource.height, 1, texture.format, glTexture.type, item.resource.source);\n }\n }\n }\n return true;\n };\n return ArrayResource;\n}(AbstractMultiResource));\n\n/**\n * Base for all the image/canvas resources.\n *\n * @memberof PIXI\n */\nvar BaseImageResource = /** @class */ (function (_super) {\n __extends(BaseImageResource, _super);\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n function BaseImageResource(source) {\n var _this = this;\n var sourceAny = source;\n var width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n var height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n _this = _super.call(this, width, height) || this;\n _this.source = source;\n _this.noSubImage = false;\n return _this;\n }\n /**\n * Set cross origin based detecting the url and the crossorigin\n *\n * @param element - Element to apply crossOrigin\n * @param url - URL to check\n * @param crossorigin - Cross origin value to use\n */\n BaseImageResource.crossOrigin = function (element, url, crossorigin) {\n if (crossorigin === undefined && url.indexOf('data:') !== 0) {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false) {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\n };\n /**\n * Upload the texture to the GPU.\n *\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} [source] - (optional)\n * @returns - true is success\n */\n BaseImageResource.prototype.upload = function (renderer, baseTexture, glTexture, source) {\n var gl = renderer.gl;\n var width = baseTexture.realWidth;\n var height = baseTexture.realHeight;\n source = source || this.source;\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height) {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else {\n glTexture.width = width;\n glTexture.height = height;\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n return true;\n };\n /**\n * Checks if source width/height was changed, resize can cause extra baseTexture update.\n * Triggers one update in any case.\n */\n BaseImageResource.prototype.update = function () {\n if (this.destroyed) {\n return;\n }\n var source = this.source;\n var width = source.naturalWidth || source.videoWidth || source.width;\n var height = source.naturalHeight || source.videoHeight || source.height;\n this.resize(width, height);\n _super.prototype.update.call(this);\n };\n /** Destroy this {@link BaseImageResource} */\n BaseImageResource.prototype.dispose = function () {\n this.source = null;\n };\n return BaseImageResource;\n}(Resource));\n\n/**\n * @interface OffscreenCanvas\n */\n/**\n * Resource type for HTMLCanvasElement.\n *\n * @memberof PIXI\n */\nvar CanvasResource = /** @class */ (function (_super) {\n __extends(CanvasResource, _super);\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n function CanvasResource(source) {\n return _super.call(this, source) || this;\n }\n /**\n * Used to auto-detect the type of resource.\n *\n * @param {*} source - The source object\n * @return {boolean} `true` if source is HTMLCanvasElement or OffscreenCanvas\n */\n CanvasResource.test = function (source) {\n var OffscreenCanvas = self.OffscreenCanvas;\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas) {\n return true;\n }\n return self.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n };\n return CanvasResource;\n}(BaseImageResource));\n\n/**\n * Resource for a CubeTexture which contains six resources.\n *\n * @memberof PIXI\n */\nvar CubeResource = /** @class */ (function (_super) {\n __extends(CubeResource, _super);\n /**\n * @param {Array} [source] - Collection of URLs or resources\n * to use as the sides of the cube.\n * @param options - ImageResource options\n * @param {number} [options.width] - Width of resource\n * @param {number} [options.height] - Height of resource\n * @param {number} [options.autoLoad=true] - Whether to auto-load resources\n * @param {number} [options.linkBaseTexture=true] - In case BaseTextures are supplied,\n * whether to copy them or use\n */\n function CubeResource(source, options) {\n var _this = this;\n var _a = options || {}, width = _a.width, height = _a.height, autoLoad = _a.autoLoad, linkBaseTexture = _a.linkBaseTexture;\n if (source && source.length !== CubeResource.SIDES) {\n throw new Error(\"Invalid length. Got \" + source.length + \", expected 6\");\n }\n _this = _super.call(this, 6, { width: width, height: height }) || this;\n for (var i = 0; i < CubeResource.SIDES; i++) {\n _this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n _this.linkBaseTexture = linkBaseTexture !== false;\n if (source) {\n _this.initFromArray(source, options);\n }\n if (autoLoad !== false) {\n _this.load();\n }\n return _this;\n }\n /**\n * Add binding.\n *\n * @param baseTexture - parent base texture\n */\n CubeResource.prototype.bind = function (baseTexture) {\n _super.prototype.bind.call(this, baseTexture);\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n };\n CubeResource.prototype.addBaseTextureAt = function (baseTexture, index, linkBaseTexture) {\n if (linkBaseTexture === undefined) {\n linkBaseTexture = this.linkBaseTexture;\n }\n if (!this.items[index]) {\n throw new Error(\"Index \" + index + \" is out of bounds\");\n }\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0) {\n // copy mode\n if (baseTexture.resource) {\n this.addResourceAt(baseTexture.resource, index);\n }\n else {\n throw new Error(\"CubeResource does not support copying of renderTexture.\");\n }\n }\n else {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n this.items[index] = baseTexture;\n }\n if (baseTexture.valid && !this.valid) {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n this.items[index] = baseTexture;\n return this;\n };\n /**\n * Upload the resource\n *\n * @returns {boolean} true is success\n */\n CubeResource.prototype.upload = function (renderer, _baseTexture, glTexture) {\n var dirty = this.itemDirtyIds;\n for (var i = 0; i < CubeResource.SIDES; i++) {\n var side = this.items[i];\n if (dirty[i] < side.dirtyId) {\n if (side.valid && side.resource) {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1) {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0, glTexture.internalFormat, _baseTexture.realWidth, _baseTexture.realHeight, 0, _baseTexture.format, glTexture.type, null);\n dirty[i] = -1;\n }\n }\n }\n return true;\n };\n /**\n * Used to auto-detect the type of resource.\n *\n * @param {*} source - The source object\n * @return {boolean} `true` if source is an array of 6 elements\n */\n CubeResource.test = function (source) {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n };\n /** Number of texture sides to store for CubeResources. */\n CubeResource.SIDES = 6;\n return CubeResource;\n}(AbstractMultiResource));\n\n/**\n * Resource type for HTMLImageElement.\n *\n * @memberof PIXI\n */\nvar ImageResource = /** @class */ (function (_super) {\n __extends(ImageResource, _super);\n /**\n * @param source - image source or URL\n * @param options\n * @param {boolean} [options.autoLoad=true] - start loading process\n * @param {boolean} [options.createBitmap=PIXI.settings.CREATE_IMAGE_BITMAP] - whether its required to create\n * a bitmap before upload\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n * @param {PIXI.ALPHA_MODES} [options.alphaMode=PIXI.ALPHA_MODES.UNPACK] - Premultiply image alpha in bitmap\n */\n function ImageResource(source, options) {\n var _this = this;\n options = options || {};\n if (!(source instanceof HTMLImageElement)) {\n var imageElement = new Image();\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n imageElement.src = source;\n source = imageElement;\n }\n _this = _super.call(this, source) || this;\n // FireFox 68, and possibly other versions, seems like setting the HTMLImageElement#width and #height\n // to non-zero values before its loading completes if images are in a cache.\n // Because of this, need to set the `_width` and the `_height` to zero to avoid uploading incomplete images.\n // Please refer to the issue #5968 (https://github.com/pixijs/pixi.js/issues/5968).\n if (!source.complete && !!_this._width && !!_this._height) {\n _this._width = 0;\n _this._height = 0;\n }\n _this.url = source.src;\n _this._process = null;\n _this.preserveBitmap = false;\n _this.createBitmap = (options.createBitmap !== undefined\n ? options.createBitmap : settings.CREATE_IMAGE_BITMAP) && !!self.createImageBitmap;\n _this.alphaMode = typeof options.alphaMode === 'number' ? options.alphaMode : null;\n _this.bitmap = null;\n _this._load = null;\n if (options.autoLoad !== false) {\n _this.load();\n }\n return _this;\n }\n /**\n * Returns a promise when image will be loaded and processed.\n *\n * @param createBitmap - whether process image into bitmap\n */\n ImageResource.prototype.load = function (createBitmap) {\n var _this = this;\n if (this._load) {\n return this._load;\n }\n if (createBitmap !== undefined) {\n this.createBitmap = createBitmap;\n }\n this._load = new Promise(function (resolve, reject) {\n var source = _this.source;\n _this.url = source.src;\n var completed = function () {\n if (_this.destroyed) {\n return;\n }\n source.onload = null;\n source.onerror = null;\n _this.resize(source.width, source.height);\n _this._load = null;\n if (_this.createBitmap) {\n resolve(_this.process());\n }\n else {\n resolve(_this);\n }\n };\n if (source.complete && source.src) {\n completed();\n }\n else {\n source.onload = completed;\n source.onerror = function (event) {\n // Avoids Promise freezing when resource broken\n reject(event);\n _this.onError.emit(event);\n };\n }\n });\n return this._load;\n };\n /**\n * Called when we need to convert image into BitmapImage.\n * Can be called multiple times, real promise is cached inside.\n *\n * @return - Cached promise to fill that bitmap\n */\n ImageResource.prototype.process = function () {\n var _this = this;\n var source = this.source;\n if (this._process !== null) {\n return this._process;\n }\n if (this.bitmap !== null || !self.createImageBitmap) {\n return Promise.resolve(this);\n }\n var createImageBitmap = self.createImageBitmap;\n var cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n this._process = fetch(source.src, {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then(function (r) { return r.blob(); })\n .then(function (blob) { return createImageBitmap(blob, 0, 0, source.width, source.height, {\n premultiplyAlpha: _this.alphaMode === ALPHA_MODES.UNPACK ? 'premultiply' : 'none',\n }); })\n .then(function (bitmap) {\n if (_this.destroyed) {\n return Promise.reject();\n }\n _this.bitmap = bitmap;\n _this.update();\n _this._process = null;\n return Promise.resolve(_this);\n });\n return this._process;\n };\n /**\n * Upload the image resource to GPU.\n *\n * @param renderer - Renderer to upload to\n * @param baseTexture - BaseTexture for this resource\n * @param glTexture - GLTexture to use\n * @returns {boolean} true is success\n */\n ImageResource.prototype.upload = function (renderer, baseTexture, glTexture) {\n if (typeof this.alphaMode === 'number') {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n baseTexture.alphaMode = this.alphaMode;\n }\n if (!this.createBitmap) {\n return _super.prototype.upload.call(this, renderer, baseTexture, glTexture);\n }\n if (!this.bitmap) {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap) {\n return false;\n }\n }\n _super.prototype.upload.call(this, renderer, baseTexture, glTexture, this.bitmap);\n if (!this.preserveBitmap) {\n // checks if there are other renderers that possibly need this bitmap\n var flag = true;\n var glTextures = baseTexture._glTextures;\n for (var key in glTextures) {\n var otherTex = glTextures[key];\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId) {\n flag = false;\n break;\n }\n }\n if (flag) {\n if (this.bitmap.close) {\n this.bitmap.close();\n }\n this.bitmap = null;\n }\n }\n return true;\n };\n /** Destroys this resource. */\n ImageResource.prototype.dispose = function () {\n this.source.onload = null;\n this.source.onerror = null;\n _super.prototype.dispose.call(this);\n if (this.bitmap) {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n };\n /**\n * Used to auto-detect the type of resource.\n *\n * @param {*} source - The source object\n * @return {boolean} `true` if source is string or HTMLImageElement\n */\n ImageResource.test = function (source) {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n };\n return ImageResource;\n}(BaseImageResource));\n\n/**\n * Resource type for SVG elements and graphics.\n *\n * @memberof PIXI\n */\nvar SVGResource = /** @class */ (function (_super) {\n __extends(SVGResource, _super);\n /**\n * @param sourceBase64 - Base64 encoded SVG element or URL for SVG file.\n * @param {object} [options] - Options to use\n * @param {number} [options.scale=1] - Scale to apply to SVG. Overridden by...\n * @param {number} [options.width] - Rasterize SVG this wide. Aspect ratio preserved if height not specified.\n * @param {number} [options.height] - Rasterize SVG this high. Aspect ratio preserved if width not specified.\n * @param {boolean} [options.autoLoad=true] - Start loading right away.\n */\n function SVGResource(sourceBase64, options) {\n var _this = this;\n options = options || {};\n _this = _super.call(this, document.createElement('canvas')) || this;\n _this._width = 0;\n _this._height = 0;\n _this.svg = sourceBase64;\n _this.scale = options.scale || 1;\n _this._overrideWidth = options.width;\n _this._overrideHeight = options.height;\n _this._resolve = null;\n _this._crossorigin = options.crossorigin;\n _this._load = null;\n if (options.autoLoad !== false) {\n _this.load();\n }\n return _this;\n }\n SVGResource.prototype.load = function () {\n var _this = this;\n if (this._load) {\n return this._load;\n }\n this._load = new Promise(function (resolve) {\n // Save this until after load is finished\n _this._resolve = function () {\n _this.resize(_this.source.width, _this.source.height);\n resolve(_this);\n };\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(_this.svg.trim())) {\n if (!btoa) {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n _this.svg = \"data:image/svg+xml;base64,\" + btoa(unescape(encodeURIComponent(_this.svg)));\n }\n _this._loadSvg();\n });\n return this._load;\n };\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n SVGResource.prototype._loadSvg = function () {\n var _this = this;\n var tempImage = new Image();\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n tempImage.onerror = function (event) {\n if (!_this._resolve) {\n return;\n }\n tempImage.onerror = null;\n _this.onError.emit(event);\n };\n tempImage.onload = function () {\n if (!_this._resolve) {\n return;\n }\n var svgWidth = tempImage.width;\n var svgHeight = tempImage.height;\n if (!svgWidth || !svgHeight) {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n // Set render size\n var width = svgWidth * _this.scale;\n var height = svgHeight * _this.scale;\n if (_this._overrideWidth || _this._overrideHeight) {\n width = _this._overrideWidth || _this._overrideHeight / svgHeight * svgWidth;\n height = _this._overrideHeight || _this._overrideWidth / svgWidth * svgHeight;\n }\n width = Math.round(width);\n height = Math.round(height);\n // Create a canvas element\n var canvas = _this.source;\n canvas.width = width;\n canvas.height = height;\n canvas._pixiId = \"canvas_\" + uid();\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n _this._resolve();\n _this._resolve = null;\n };\n };\n /**\n * Get size from an svg string using a regular expression.\n *\n * @param svgString - a serialized svg element\n * @return - image extension\n */\n SVGResource.getSize = function (svgString) {\n var sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n var size = {};\n if (sizeMatch) {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n return size;\n };\n /** Destroys this texture. */\n SVGResource.prototype.dispose = function () {\n _super.prototype.dispose.call(this);\n this._resolve = null;\n this._crossorigin = null;\n };\n /**\n * Used to auto-detect the type of resource.\n *\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @return {boolean} - If the source is a SVG source or data file\n */\n SVGResource.test = function (source, extension) {\n // url file extension is SVG\n return extension === 'svg'\n // source is SVG data-uri\n || (typeof source === 'string' && (/^data:image\\/svg\\+xml(;(charset=utf8|utf8))?;base64/).test(source))\n // source is SVG inline\n || (typeof source === 'string' && SVGResource.SVG_XML.test(source));\n };\n /**\n * Regular expression for SVG XML document.\n *\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n SVGResource.SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n return SVGResource;\n}(BaseImageResource));\n\n/**\n * Resource type for {@code HTMLVideoElement}.\n *\n * @memberof PIXI\n */\nvar VideoResource = /** @class */ (function (_super) {\n __extends(VideoResource, _super);\n /**\n * @param {HTMLVideoElement|object|string|Array} source - Video element to use.\n * @param {object} [options] - Options to use\n * @param {boolean} [options.autoLoad=true] - Start loading the video immediately\n * @param {boolean} [options.autoPlay=true] - Start playing video immediately\n * @param {number} [options.updateFPS=0] - How many times a second to update the texture from the video.\n * Leave at 0 to update at every render.\n * @param {boolean} [options.crossorigin=true] - Load image using cross origin\n */\n function VideoResource(source, options) {\n var _this = this;\n options = options || {};\n if (!(source instanceof HTMLVideoElement)) {\n var videoElement = document.createElement('video');\n // workaround for https://github.com/pixijs/pixi.js/issues/5996\n videoElement.setAttribute('preload', 'auto');\n videoElement.setAttribute('webkit-playsinline', '');\n videoElement.setAttribute('playsinline', '');\n if (typeof source === 'string') {\n source = [source];\n }\n var firstSrc = source[0].src || source[0];\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n // array of objects or strings\n for (var i = 0; i < source.length; ++i) {\n var sourceElement = document.createElement('source');\n var _a = source[i], src = _a.src, mime = _a.mime;\n src = src || source[i];\n var baseSrc = src.split('?').shift().toLowerCase();\n var ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);\n mime = mime || VideoResource.MIME_TYPES[ext] || \"video/\" + ext;\n sourceElement.src = src;\n sourceElement.type = mime;\n videoElement.appendChild(sourceElement);\n }\n // Override the source\n source = videoElement;\n }\n _this = _super.call(this, source) || this;\n _this.noSubImage = true;\n _this._autoUpdate = true;\n _this._isConnectedToTicker = false;\n _this._updateFPS = options.updateFPS || 0;\n _this._msToNextUpdate = 0;\n _this.autoPlay = options.autoPlay !== false;\n _this._load = null;\n _this._resolve = null;\n // Bind for listeners\n _this._onCanPlay = _this._onCanPlay.bind(_this);\n _this._onError = _this._onError.bind(_this);\n if (options.autoLoad !== false) {\n _this.load();\n }\n return _this;\n }\n /**\n * Trigger updating of the texture.\n *\n * @param deltaTime - time delta since last tick\n */\n VideoResource.prototype.update = function (_deltaTime) {\n if (!this.destroyed) {\n // account for if video has had its playbackRate changed\n var elapsedMS = Ticker.shared.elapsedMS * this.source.playbackRate;\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0) {\n _super.prototype.update.call(this);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n };\n /**\n * Start preloading the video resource.\n *\n * @return {Promise} Handle the validate event\n */\n VideoResource.prototype.load = function () {\n var _this = this;\n if (this._load) {\n return this._load;\n }\n var source = this.source;\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height) {\n source.complete = true;\n }\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n if (!this._isSourceReady()) {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else {\n this._onCanPlay();\n }\n this._load = new Promise(function (resolve) {\n if (_this.valid) {\n resolve(_this);\n }\n else {\n _this._resolve = resolve;\n source.load();\n }\n });\n return this._load;\n };\n /** Handle video error events. */\n VideoResource.prototype._onError = function (event) {\n this.source.removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n };\n /**\n * Returns true if the underlying source is playing.\n *\n * @return - True if playing.\n */\n VideoResource.prototype._isSourcePlaying = function () {\n var source = this.source;\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n };\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @return - True if ready.\n */\n VideoResource.prototype._isSourceReady = function () {\n var source = this.source;\n return source.readyState === 3 || source.readyState === 4;\n };\n /** Runs the update loop when the video is ready to play. */\n VideoResource.prototype._onPlayStart = function () {\n // Just in case the video has not received its can play even yet..\n if (!this.valid) {\n this._onCanPlay();\n }\n if (this.autoUpdate && !this._isConnectedToTicker) {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n };\n /** Fired when a pause event is triggered, stops the update loop. */\n VideoResource.prototype._onPlayStop = function () {\n if (this._isConnectedToTicker) {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n };\n /** Fired when the video is loaded and ready to play. */\n VideoResource.prototype._onCanPlay = function () {\n var source = this.source;\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n var valid = this.valid;\n this.resize(source.videoWidth, source.videoHeight);\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve) {\n this._resolve(this);\n this._resolve = null;\n }\n if (this._isSourcePlaying()) {\n this._onPlayStart();\n }\n else if (this.autoPlay) {\n source.play();\n }\n };\n /** Destroys this texture. */\n VideoResource.prototype.dispose = function () {\n if (this._isConnectedToTicker) {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n var source = this.source;\n if (source) {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n _super.prototype.dispose.call(this);\n };\n Object.defineProperty(VideoResource.prototype, \"autoUpdate\", {\n /** Should the base texture automatically update itself, set to true by default. */\n get: function () {\n return this._autoUpdate;\n },\n set: function (value) {\n if (value !== this._autoUpdate) {\n this._autoUpdate = value;\n if (!this._autoUpdate && this._isConnectedToTicker) {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n else if (this._autoUpdate && !this._isConnectedToTicker && this._isSourcePlaying()) {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(VideoResource.prototype, \"updateFPS\", {\n /**\n * How many times a second to update the texture from the video. Leave at 0 to update at every render.\n * A lower fps can help performance, as updating the texture at 60fps on a 30ps video may not be efficient.\n */\n get: function () {\n return this._updateFPS;\n },\n set: function (value) {\n if (value !== this._updateFPS) {\n this._updateFPS = value;\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Used to auto-detect the type of resource.\n *\n * @param {*} source - The source object\n * @param {string} extension - The extension of source, if set\n * @return {boolean} `true` if video source\n */\n VideoResource.test = function (source, extension) {\n return (self.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n };\n /**\n * List of common video file extensions supported by VideoResource.\n *\n * @readonly\n */\n VideoResource.TYPES = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n *\n * @readonly\n */\n VideoResource.MIME_TYPES = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n return VideoResource;\n}(BaseImageResource));\n\n/**\n * Resource type for ImageBitmap.\n *\n * @memberof PIXI\n */\nvar ImageBitmapResource = /** @class */ (function (_super) {\n __extends(ImageBitmapResource, _super);\n /**\n * @param source - Image element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n function ImageBitmapResource(source) {\n return _super.call(this, source) || this;\n }\n /**\n * Used to auto-detect the type of resource.\n *\n * @param {*} source - The source object\n * @return {boolean} `true` if source is an ImageBitmap\n */\n ImageBitmapResource.test = function (source) {\n return !!self.createImageBitmap && source instanceof ImageBitmap;\n };\n return ImageBitmapResource;\n}(BaseImageResource));\n\nINSTALLED.push(ImageResource, ImageBitmapResource, CanvasResource, VideoResource, SVGResource, BufferResource, CubeResource, ArrayResource);\n\nvar _resources = {\n __proto__: null,\n Resource: Resource,\n BaseImageResource: BaseImageResource,\n INSTALLED: INSTALLED,\n autoDetectResource: autoDetectResource,\n AbstractMultiResource: AbstractMultiResource,\n ArrayResource: ArrayResource,\n BufferResource: BufferResource,\n CanvasResource: CanvasResource,\n CubeResource: CubeResource,\n ImageResource: ImageResource,\n SVGResource: SVGResource,\n VideoResource: VideoResource,\n ImageBitmapResource: ImageBitmapResource\n};\n\n/**\n * Resource type for DepthTexture.\n *\n * @memberof PIXI\n */\nvar DepthResource = /** @class */ (function (_super) {\n __extends(DepthResource, _super);\n function DepthResource() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Upload the texture to the GPU.\n *\n * @param renderer - Upload to the renderer\n * @param baseTexture - Reference to parent texture\n * @param glTexture - glTexture\n * @return - true is success\n */\n DepthResource.prototype.upload = function (renderer, baseTexture, glTexture) {\n var gl = renderer.gl;\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n var width = baseTexture.realWidth;\n var height = baseTexture.realHeight;\n if (glTexture.width === width && glTexture.height === height) {\n gl.texSubImage2D(baseTexture.target, 0, 0, 0, width, height, baseTexture.format, glTexture.type, this.data);\n }\n else {\n glTexture.width = width;\n glTexture.height = height;\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, width, height, 0, baseTexture.format, glTexture.type, this.data);\n }\n return true;\n };\n return DepthResource;\n}(BufferResource));\n\n/**\n * A framebuffer can be used to render contents off of the screen. {@link PIXI.BaseRenderTexture} uses\n * one internally to render into itself. You can attach a depth or stencil buffer to a framebuffer.\n *\n * On WebGL 2 machines, shaders can output to multiple textures simultaneously with GLSL 300 ES.\n *\n * @class\n * @memberof PIXI\n */\nvar Framebuffer = /** @class */ (function () {\n /**\n * @param {number} width - Width of the frame buffer\n * @param {number} height - Height of the frame buffer\n */\n function Framebuffer(width, height) {\n /**\n * Width of framebuffer in pixels\n * @member {number}\n */\n this.width = Math.round(width || 100);\n /**\n * Height of framebuffer in pixels\n * @member {number}\n */\n this.height = Math.round(height || 100);\n this.stencil = false;\n this.depth = false;\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n this.depthTexture = null;\n this.colorTextures = [];\n this.glFramebuffers = {};\n this.disposeRunner = new Runner('disposeFramebuffer');\n /**\n * Desired number of samples for antialiasing. 0 means AA should not be used.\n *\n * Experimental WebGL2 feature, allows to use antialiasing in individual renderTextures.\n * Antialiasing is the same as for main buffer with renderer `antialias:true` options.\n * Seriously affects GPU memory consumption and GPU performance.\n *\n *```js\n * renderTexture.framebuffer.multisample = PIXI.MSAA_QUALITY.HIGH;\n * //...\n * renderer.render(myContainer, {renderTexture});\n * renderer.framebuffer.blit(); // copies data from MSAA framebuffer to texture\n * ```\n *\n * @member {PIXI.MSAA_QUALITY}\n * @default PIXI.MSAA_QUALITY.NONE\n */\n this.multisample = MSAA_QUALITY.NONE;\n }\n Object.defineProperty(Framebuffer.prototype, \"colorTexture\", {\n /**\n * Reference to the colorTexture.\n *\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n get: function () {\n return this.colorTextures[0];\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Add texture to the colorTexture array\n *\n * @param {number} [index=0] - Index of the array to add the texture to\n * @param {PIXI.BaseTexture} [texture] - Texture to add to the array\n */\n Framebuffer.prototype.addColorTexture = function (index, texture) {\n if (index === void 0) { index = 0; }\n // TODO add some validation to the texture - same width / height etc?\n this.colorTextures[index] = texture || new BaseTexture(null, {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n mipmap: MIPMAP_MODES.OFF,\n width: this.width,\n height: this.height,\n });\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n };\n /**\n * Add a depth texture to the frame buffer\n *\n * @param {PIXI.BaseTexture} [texture] - Texture to add\n */\n Framebuffer.prototype.addDepthTexture = function (texture) {\n /* eslint-disable max-len */\n this.depthTexture = texture || new BaseTexture(new DepthResource(null, { width: this.width, height: this.height }), {\n scaleMode: SCALE_MODES.NEAREST,\n resolution: 1,\n width: this.width,\n height: this.height,\n mipmap: MIPMAP_MODES.OFF,\n format: FORMATS.DEPTH_COMPONENT,\n type: TYPES.UNSIGNED_SHORT,\n });\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n };\n /**\n * Enable depth on the frame buffer\n */\n Framebuffer.prototype.enableDepth = function () {\n this.depth = true;\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n };\n /**\n * Enable stencil on the frame buffer\n */\n Framebuffer.prototype.enableStencil = function () {\n this.stencil = true;\n this.dirtyId++;\n this.dirtyFormat++;\n return this;\n };\n /**\n * Resize the frame buffer\n *\n * @param {number} width - Width of the frame buffer to resize to\n * @param {number} height - Height of the frame buffer to resize to\n */\n Framebuffer.prototype.resize = function (width, height) {\n width = Math.round(width);\n height = Math.round(height);\n if (width === this.width && height === this.height)\n { return; }\n this.width = width;\n this.height = height;\n this.dirtyId++;\n this.dirtySize++;\n for (var i = 0; i < this.colorTextures.length; i++) {\n var texture = this.colorTextures[i];\n var resolution = texture.resolution;\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n if (this.depthTexture) {\n var resolution = this.depthTexture.resolution;\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n };\n /**\n * Disposes WebGL resources that are connected to this geometry\n */\n Framebuffer.prototype.dispose = function () {\n this.disposeRunner.emit(this, false);\n };\n /**\n * Destroys and removes the depth texture added to this framebuffer.\n */\n Framebuffer.prototype.destroyDepthTexture = function () {\n if (this.depthTexture) {\n this.depthTexture.destroy();\n this.depthTexture = null;\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n };\n return Framebuffer;\n}());\n\n/**\n * A BaseRenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a BaseRenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * A BaseRenderTexture takes a snapshot of any Display Object given to its render method. The position\n * and rotation of the given Display Objects is ignored. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 800, height: 600 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let baseRenderTexture = new PIXI.BaseRenderTexture({ width: 100, height: 100 });\n * let renderTexture = new PIXI.RenderTexture(baseRenderTexture);\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n *\n * @class\n * @extends PIXI.BaseTexture\n * @memberof PIXI\n */\nvar BaseRenderTexture = /** @class */ (function (_super) {\n __extends(BaseRenderTexture, _super);\n /**\n * @param {object} [options]\n * @param {number} [options.width=100] - The width of the base render texture.\n * @param {number} [options.height=100] - The height of the base render texture.\n * @param {PIXI.SCALE_MODES} [options.scaleMode=PIXI.settings.SCALE_MODE] - See {@link PIXI.SCALE_MODES}\n * for possible values.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio\n * of the texture being generated.\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer.\n */\n function BaseRenderTexture(options) {\n var _this = this;\n if (typeof options === 'number') {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n var width = arguments[0];\n var height = arguments[1];\n var scaleMode = arguments[2];\n var resolution = arguments[3];\n options = { width: width, height: height, scaleMode: scaleMode, resolution: resolution };\n /* eslint-enable prefer-rest-params */\n }\n options.width = options.width || 100;\n options.height = options.height || 100;\n options.multisample = options.multisample !== undefined ? options.multisample : MSAA_QUALITY.NONE;\n _this = _super.call(this, null, options) || this;\n // Set defaults\n _this.mipmap = MIPMAP_MODES.OFF;\n _this.valid = true;\n _this.clearColor = [0, 0, 0, 0];\n _this.framebuffer = new Framebuffer(_this.realWidth, _this.realHeight)\n .addColorTexture(0, _this);\n _this.framebuffer.multisample = options.multisample;\n // TODO - could this be added the systems?\n /**\n * The data structure for the stencil masks.\n *\n * @member {PIXI.MaskData[]}\n */\n _this.maskStack = [];\n /**\n * The data structure for the filters.\n *\n * @member {Object[]}\n */\n _this.filterStack = [{}];\n return _this;\n }\n /**\n * Resizes the BaseRenderTexture.\n *\n * @param {number} desiredWidth - The desired width to resize to.\n * @param {number} desiredHeight - The desired height to resize to.\n */\n BaseRenderTexture.prototype.resize = function (desiredWidth, desiredHeight) {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n };\n /**\n * Frees the texture and framebuffer from WebGL memory without destroying this texture object.\n * This means you can still use the texture later which will upload it to GPU\n * memory again.\n *\n * @fires PIXI.BaseTexture#dispose\n */\n BaseRenderTexture.prototype.dispose = function () {\n this.framebuffer.dispose();\n _super.prototype.dispose.call(this);\n };\n /**\n * Destroys this texture.\n */\n BaseRenderTexture.prototype.destroy = function () {\n _super.prototype.destroy.call(this);\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n };\n return BaseRenderTexture;\n}(BaseTexture));\n\n/**\n * Stores a texture's frame in UV coordinates, in\n * which everything lies in the rectangle `[(0,0), (1,0),\n * (1,1), (0,1)]`.\n *\n * | Corner | Coordinates |\n * |--------------|-------------|\n * | Top-Left | `(x0,y0)` |\n * | Top-Right | `(x1,y1)` |\n * | Bottom-Right | `(x2,y2)` |\n * | Bottom-Left | `(x3,y3)` |\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nvar TextureUvs = /** @class */ (function () {\n function TextureUvs() {\n /**\n * X-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.x0 = 0;\n /**\n * Y-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.y0 = 0;\n /**\n * X-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.x1 = 1;\n /**\n * Y-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.y1 = 0;\n /**\n * X-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.x2 = 1;\n /**\n * Y-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.y2 = 1;\n /**\n * X-component of bottom-left corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.x3 = 0;\n /**\n * Y-component of bottom-right corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.y3 = 1;\n this.uvsFloat32 = new Float32Array(8);\n }\n /**\n * Sets the texture Uvs based on the given frame information.\n *\n * @protected\n * @param {PIXI.Rectangle} frame - The frame of the texture\n * @param {PIXI.Rectangle} baseFrame - The base frame of the texture\n * @param {number} rotate - Rotation of frame, see {@link PIXI.groupD8}\n */\n TextureUvs.prototype.set = function (frame, baseFrame, rotate) {\n var tw = baseFrame.width;\n var th = baseFrame.height;\n if (rotate) {\n // width and height div 2 div baseFrame size\n var w2 = frame.width / 2 / tw;\n var h2 = frame.height / 2 / th;\n // coordinates of center\n var cX = (frame.x / tw) + w2;\n var cY = (frame.y / th) + h2;\n rotate = groupD8.add(rotate, groupD8.NW); // NW is top-left corner\n this.x0 = cX + (w2 * groupD8.uX(rotate));\n this.y0 = cY + (h2 * groupD8.uY(rotate));\n rotate = groupD8.add(rotate, 2); // rotate 90 degrees clockwise\n this.x1 = cX + (w2 * groupD8.uX(rotate));\n this.y1 = cY + (h2 * groupD8.uY(rotate));\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n rotate = groupD8.add(rotate, 2);\n this.x3 = cX + (w2 * groupD8.uX(rotate));\n this.y3 = cY + (h2 * groupD8.uY(rotate));\n }\n else {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\n this.uvsFloat32[0] = this.x0;\n this.uvsFloat32[1] = this.y0;\n this.uvsFloat32[2] = this.x1;\n this.uvsFloat32[3] = this.y1;\n this.uvsFloat32[4] = this.x2;\n this.uvsFloat32[5] = this.y2;\n this.uvsFloat32[6] = this.x3;\n this.uvsFloat32[7] = this.y3;\n };\n TextureUvs.prototype.toString = function () {\n return \"[@pixi/core:TextureUvs \"\n + (\"x0=\" + this.x0 + \" y0=\" + this.y0 + \" \")\n + (\"x1=\" + this.x1 + \" y1=\" + this.y1 + \" x2=\" + this.x2 + \" \")\n + (\"y2=\" + this.y2 + \" x3=\" + this.x3 + \" y3=\" + this.y3)\n + \"]\";\n };\n return TextureUvs;\n}());\n\nvar DEFAULT_UVS = new TextureUvs();\n/**\n * A texture stores the information that represents an image or part of an image.\n *\n * It cannot be added to the display list directly; instead use it as the texture for a Sprite.\n * If no frame is provided for a texture, then the whole image is used.\n *\n * You can directly create a texture from an image and then reuse it multiple times like this :\n *\n * ```js\n * let texture = PIXI.Texture.from('assets/image.png');\n * let sprite1 = new PIXI.Sprite(texture);\n * let sprite2 = new PIXI.Sprite(texture);\n * ```\n *\n * If you didnt pass the texture frame to constructor, it enables `noFrame` mode:\n * it subscribes on baseTexture events, it automatically resizes at the same time as baseTexture.\n *\n * Textures made from SVGs, loaded or not, cannot be used before the file finishes processing.\n * You can check for this by checking the sprite's _textureID property.\n * ```js\n * var texture = PIXI.Texture.from('assets/image.svg');\n * var sprite1 = new PIXI.Sprite(texture);\n * //sprite1._textureID should not be undefined if the texture has finished processing the SVG file\n * ```\n * You can use a ticker or rAF to ensure your sprites load the finished textures after processing. See issue #3068.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n * @typeParam R - The BaseTexture's Resource type.\n */\nvar Texture = /** @class */ (function (_super) {\n __extends(Texture, _super);\n /**\n * @param {PIXI.BaseTexture} baseTexture - The base texture source to create the texture from\n * @param {PIXI.Rectangle} [frame] - The rectangle frame of the texture to show\n * @param {PIXI.Rectangle} [orig] - The area of original texture\n * @param {PIXI.Rectangle} [trim] - Trimmed rectangle of original texture\n * @param {number} [rotate] - indicates how the texture was rotated by texture packer. See {@link PIXI.groupD8}\n * @param {PIXI.IPointData} [anchor] - Default anchor point used for sprite placement / rotation\n */\n function Texture(baseTexture, frame, orig, trim, rotate, anchor) {\n var _this = _super.call(this) || this;\n /**\n * Does this Texture have any frame data assigned to it?\n *\n * This mode is enabled automatically if no frame was passed inside constructor.\n *\n * In this mode texture is subscribed to baseTexture events, and fires `update` on any change.\n *\n * Beware, after loading or resize of baseTexture event can fired two times!\n * If you want more control, subscribe on baseTexture itself.\n *\n * ```js\n * texture.on('update', () => {});\n * ```\n *\n * Any assignment of `frame` switches off `noFrame` mode.\n *\n * @member {boolean}\n */\n _this.noFrame = false;\n if (!frame) {\n _this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n if (baseTexture instanceof Texture) {\n baseTexture = baseTexture.baseTexture;\n }\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n _this.baseTexture = baseTexture;\n /**\n * This is the area of the BaseTexture image to actually copy to the Canvas / WebGL when rendering,\n * irrespective of the actual frame size or placement (which can be influenced by trimmed texture atlases)\n *\n * @member {PIXI.Rectangle}\n */\n _this._frame = frame;\n /**\n * This is the trimmed area of original texture, before it was put in atlas\n * Please call `updateUvs()` after you change coordinates of `trim` manually.\n *\n * @member {PIXI.Rectangle}\n */\n _this.trim = trim;\n /**\n * This will let the renderer know if the texture is valid. If it's not then it cannot be rendered.\n *\n * @member {boolean}\n */\n _this.valid = false;\n /**\n * The WebGL UV data cache. Can be used as quad UV\n *\n * @member {PIXI.TextureUvs}\n * @protected\n */\n _this._uvs = DEFAULT_UVS;\n /**\n * Default TextureMatrix instance for this texture\n * By default that object is not created because its heavy\n *\n * @member {PIXI.TextureMatrix}\n */\n _this.uvMatrix = null;\n /**\n * This is the area of original texture, before it was put in atlas\n *\n * @member {PIXI.Rectangle}\n */\n _this.orig = orig || frame; // new Rectangle(0, 0, 1, 1);\n _this._rotate = Number(rotate || 0);\n if (rotate === true) {\n // this is old texturepacker legacy, some games/libraries are passing \"true\" for rotated textures\n _this._rotate = 2;\n }\n else if (_this._rotate % 2 !== 0) {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\n /**\n * Anchor point that is used as default if sprite is created with this texture.\n * Changing the `defaultAnchor` at a later point of time will not update Sprite's anchor point.\n * @member {PIXI.Point}\n * @default {0,0}\n */\n _this.defaultAnchor = anchor ? new Point(anchor.x, anchor.y) : new Point(0, 0);\n /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n *\n * @member {number}\n * @protected\n */\n _this._updateID = 0;\n /**\n * The ids under which this Texture has been added to the texture cache. This is\n * automatically set as long as Texture.addToCache is used, but may not be set if a\n * Texture is added directly to the TextureCache array.\n *\n * @member {string[]}\n */\n _this.textureCacheIds = [];\n if (!baseTexture.valid) {\n baseTexture.once('loaded', _this.onBaseTextureUpdated, _this);\n }\n else if (_this.noFrame) {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid) {\n _this.onBaseTextureUpdated(baseTexture);\n }\n }\n else {\n _this.frame = frame;\n }\n if (_this.noFrame) {\n baseTexture.on('update', _this.onBaseTextureUpdated, _this);\n }\n return _this;\n }\n /**\n * Updates this texture on the gpu.\n *\n * Calls the TextureResource update.\n *\n * If you adjusted `frame` manually, please call `updateUvs()` instead.\n *\n */\n Texture.prototype.update = function () {\n if (this.baseTexture.resource) {\n this.baseTexture.resource.update();\n }\n };\n /**\n * Called when the base texture is updated\n *\n * @protected\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n Texture.prototype.onBaseTextureUpdated = function (baseTexture) {\n if (this.noFrame) {\n if (!this.baseTexture.valid) {\n return;\n }\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else {\n // TODO this code looks confusing.. boo to abusing getters and setters!\n // if user gave us frame that has bigger size than resized texture it can be a problem\n this.frame = this._frame;\n }\n this.emit('update', this);\n };\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n Texture.prototype.destroy = function (destroyBase) {\n if (this.baseTexture) {\n if (destroyBase) {\n var resource = this.baseTexture.resource;\n // delete the texture if it exists in the texture cache..\n // this only needs to be removed if the base texture is actually destroyed too..\n if (resource && resource.url && TextureCache[resource.url]) {\n Texture.removeFromCache(resource.url);\n }\n this.baseTexture.destroy();\n }\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n this.baseTexture = null;\n }\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n this.valid = false;\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n };\n /**\n * Creates a new texture object that acts the same as this one.\n *\n * @return {PIXI.Texture} The new texture\n */\n Texture.prototype.clone = function () {\n var clonedFrame = this._frame.clone();\n var clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n var clonedTexture = new Texture(this.baseTexture, !this.noFrame && clonedFrame, clonedOrig, this.trim && this.trim.clone(), this.rotate, this.defaultAnchor);\n if (this.noFrame) {\n clonedTexture._frame = clonedFrame;\n }\n return clonedTexture;\n };\n /**\n * Updates the internal WebGL UV cache. Use it after you change `frame` or `trim` of the texture.\n * Call it after changing the frame\n */\n Texture.prototype.updateUvs = function () {\n if (this._uvs === DEFAULT_UVS) {\n this._uvs = new TextureUvs();\n }\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n this._updateID++;\n };\n /**\n * Helper function that creates a new Texture based on the source you provide.\n * The source can be - frame id, image url, video url, canvas element, video element, base texture\n *\n * @static\n * @param {string|HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|PIXI.BaseTexture} source -\n * Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @param {string} [options.pixiIdPrefix=pixiid] - If a source has no id, this is the prefix of the generated id\n * @param {boolean} [strict] - Enforce strict-mode, see {@link PIXI.settings.STRICT_TEXTURE_CACHE}.\n * @return {PIXI.Texture} The newly created texture\n */\n Texture.from = function (source, options, strict) {\n if (options === void 0) { options = {}; }\n if (strict === void 0) { strict = settings.STRICT_TEXTURE_CACHE; }\n var isFrame = typeof source === 'string';\n var cacheId = null;\n if (isFrame) {\n cacheId = source;\n }\n else if (source instanceof BaseTexture) {\n if (!source.cacheId) {\n var prefix = (options && options.pixiIdPrefix) || 'pixiid';\n source.cacheId = prefix + \"-\" + uid();\n BaseTexture.addToCache(source, source.cacheId);\n }\n cacheId = source.cacheId;\n }\n else {\n if (!source._pixiId) {\n var prefix = (options && options.pixiIdPrefix) || 'pixiid';\n source._pixiId = prefix + \"_\" + uid();\n }\n cacheId = source._pixiId;\n }\n var texture = TextureCache[cacheId];\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture) {\n throw new Error(\"The cacheId \\\"\" + cacheId + \"\\\" does not exist in TextureCache.\");\n }\n if (!texture && !(source instanceof BaseTexture)) {\n if (!options.resolution) {\n options.resolution = getResolutionOfUrl(source);\n }\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture)) {\n texture = new Texture(source);\n Texture.addToCache(texture, cacheId);\n }\n // lets assume its a base texture!\n return texture;\n };\n /**\n * Useful for loading textures via URLs. Use instead of `Texture.from` because\n * it does a better job of handling failed URLs more effectively. This also ignores\n * `PIXI.settings.STRICT_TEXTURE_CACHE`. Works for Videos, SVGs, Images.\n * @param {string} url - The remote URL to load.\n * @param {object} [options] - Optional options to include\n * @return {Promise} A Promise that resolves to a Texture.\n */\n Texture.fromURL = function (url, options) {\n var resourceOptions = Object.assign({ autoLoad: false }, options === null || options === void 0 ? void 0 : options.resourceOptions);\n var texture = Texture.from(url, Object.assign({ resourceOptions: resourceOptions }, options), false);\n var resource = texture.baseTexture.resource;\n // The texture was already loaded\n if (texture.baseTexture.valid) {\n return Promise.resolve(texture);\n }\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(function () { return Promise.resolve(texture); });\n };\n /**\n * Create a new Texture with a BufferResource from a Float32Array.\n * RGBA values are floats from 0 to 1.\n * @static\n * @param {Float32Array|Uint8Array} buffer - The optional array to use, if no data\n * is provided, a new Float32Array is created.\n * @param {number} width - Width of the resource\n * @param {number} height - Height of the resource\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return {PIXI.Texture} The resulting new BaseTexture\n */\n Texture.fromBuffer = function (buffer, width, height, options) {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n };\n /**\n * Create a texture from a source and add to the cache.\n *\n * @static\n * @param {HTMLImageElement|HTMLCanvasElement|string} source - The input source.\n * @param {String} imageUrl - File name of texture, for cache and resolving resolution.\n * @param {String} [name] - Human readable name for the texture cache. If no name is\n * specified, only `imageUrl` will be used as the cache ID.\n * @return {PIXI.Texture} Output texture\n */\n Texture.fromLoader = function (source, imageUrl, name, options) {\n var baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n var resource = baseTexture.resource;\n if (resource instanceof ImageResource) {\n resource.url = imageUrl;\n }\n var texture = new Texture(baseTexture);\n // No name, use imageUrl instead\n if (!name) {\n name = imageUrl;\n }\n // lets also add the frame to pixi's global cache for 'fromLoader' function\n BaseTexture.addToCache(texture.baseTexture, name);\n Texture.addToCache(texture, name);\n // also add references by url if they are different.\n if (name !== imageUrl) {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n // Generally images are valid right away\n if (texture.baseTexture.valid) {\n return Promise.resolve(texture);\n }\n // SVG assets need to be parsed async, let's wait\n return new Promise(function (resolve) {\n texture.baseTexture.once('loaded', function () { return resolve(texture); });\n });\n };\n /**\n * Adds a Texture to the global TextureCache. This cache is shared across the whole PIXI object.\n *\n * @static\n * @param {PIXI.Texture} texture - The Texture to add to the cache.\n * @param {string} id - The id that the Texture will be stored against.\n */\n Texture.addToCache = function (texture, id) {\n if (id) {\n if (texture.textureCacheIds.indexOf(id) === -1) {\n texture.textureCacheIds.push(id);\n }\n if (TextureCache[id]) {\n // eslint-disable-next-line no-console\n console.warn(\"Texture added to the cache with an id [\" + id + \"] that already had an entry\");\n }\n TextureCache[id] = texture;\n }\n };\n /**\n * Remove a Texture from the global TextureCache.\n *\n * @static\n * @param {string|PIXI.Texture} texture - id of a Texture to be removed, or a Texture instance itself\n * @return {PIXI.Texture|null} The Texture that was removed\n */\n Texture.removeFromCache = function (texture) {\n if (typeof texture === 'string') {\n var textureFromCache = TextureCache[texture];\n if (textureFromCache) {\n var index = textureFromCache.textureCacheIds.indexOf(texture);\n if (index > -1) {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n delete TextureCache[texture];\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds) {\n for (var i = 0; i < texture.textureCacheIds.length; ++i) {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture) {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n texture.textureCacheIds.length = 0;\n return texture;\n }\n return null;\n };\n Object.defineProperty(Texture.prototype, \"resolution\", {\n /**\n * Returns resolution of baseTexture\n *\n * @member {number}\n * @readonly\n */\n get: function () {\n return this.baseTexture.resolution;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Texture.prototype, \"frame\", {\n /**\n * The frame specifies the region of the base texture that this texture uses.\n * Please call `updateUvs()` after you change coordinates of `frame` manually.\n *\n * @member {PIXI.Rectangle}\n */\n get: function () {\n return this._frame;\n },\n set: function (frame) {\n this._frame = frame;\n this.noFrame = false;\n var x = frame.x, y = frame.y, width = frame.width, height = frame.height;\n var xNotFit = x + width > this.baseTexture.width;\n var yNotFit = y + height > this.baseTexture.height;\n if (xNotFit || yNotFit) {\n var relationship = xNotFit && yNotFit ? 'and' : 'or';\n var errorX = \"X: \" + x + \" + \" + width + \" = \" + (x + width) + \" > \" + this.baseTexture.width;\n var errorY = \"Y: \" + y + \" + \" + height + \" = \" + (y + height) + \" > \" + this.baseTexture.height;\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + (errorX + \" \" + relationship + \" \" + errorY));\n }\n this.valid = width && height && this.baseTexture.valid;\n if (!this.trim && !this.rotate) {\n this.orig = frame;\n }\n if (this.valid) {\n this.updateUvs();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Texture.prototype, \"rotate\", {\n /**\n * Indicates whether the texture is rotated inside the atlas\n * set to 2 to compensate for texture packer rotation\n * set to 6 to compensate for spine packer rotation\n * can be used to rotate or mirror sprites\n * See {@link PIXI.groupD8} for explanation\n *\n * @member {number}\n */\n get: function () {\n return this._rotate;\n },\n set: function (rotate) {\n this._rotate = rotate;\n if (this.valid) {\n this.updateUvs();\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Texture.prototype, \"width\", {\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n get: function () {\n return this.orig.width;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Texture.prototype, \"height\", {\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n get: function () {\n return this.orig.height;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Utility function for BaseTexture|Texture cast\n */\n Texture.prototype.castToBaseTexture = function () {\n return this.baseTexture;\n };\n return Texture;\n}(eventemitter3));\nfunction createWhiteTexture() {\n var canvas = document.createElement('canvas');\n canvas.width = 16;\n canvas.height = 16;\n var context = canvas.getContext('2d');\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n return new Texture(new BaseTexture(new CanvasResource(canvas)));\n}\nfunction removeAllHandlers(tex) {\n tex.destroy = function _emptyDestroy() { };\n tex.on = function _emptyOn() { };\n tex.once = function _emptyOnce() { };\n tex.emit = function _emptyEmit() { };\n}\n/**\n * An empty texture, used often to not have to create multiple empty textures.\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\nTexture.EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n/**\n * A white texture of 16x16 size, used for graphics and other things\n * Can not be destroyed.\n *\n * @static\n * @constant\n * @member {PIXI.Texture}\n */\nTexture.WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n\n/**\n * A RenderTexture is a special texture that allows any PixiJS display object to be rendered to it.\n *\n * __Hint__: All DisplayObjects (i.e. Sprites) that render to a RenderTexture should be preloaded\n * otherwise black rectangles will be drawn instead.\n *\n * __Hint-2__: The actual memory allocation will happen on first render.\n * You shouldn't create renderTextures each frame just to delete them after, try to reuse them.\n *\n * A RenderTexture takes a snapshot of any Display Object given to its render method. For example:\n *\n * ```js\n * let renderer = PIXI.autoDetectRenderer();\n * let renderTexture = PIXI.RenderTexture.create({ width: 800, height: 600 });\n * let sprite = PIXI.Sprite.from(\"spinObj_01.png\");\n *\n * sprite.position.x = 800/2;\n * sprite.position.y = 600/2;\n * sprite.anchor.x = 0.5;\n * sprite.anchor.y = 0.5;\n *\n * renderer.render(sprite, {renderTexture});\n * ```\n * Note that you should not create a new renderer, but reuse the same one as the rest of the application.\n *\n * The Sprite in this case will be rendered using its local transform. To render this sprite at 0,0\n * you can clear the transform\n *\n * ```js\n *\n * sprite.setTransform()\n *\n * let renderTexture = new PIXI.RenderTexture.create({ width: 100, height: 100 });\n *\n * renderer.render(sprite, {renderTexture}); // Renders to center of RenderTexture\n * ```\n *\n * @memberof PIXI\n */\nvar RenderTexture = /** @class */ (function (_super) {\n __extends(RenderTexture, _super);\n /**\n * @param baseRenderTexture - The base texture object that this texture uses.\n * @param frame - The rectangle frame of the texture to show.\n */\n function RenderTexture(baseRenderTexture, frame) {\n var _this = _super.call(this, baseRenderTexture, frame) || this;\n _this.valid = true;\n _this.filterFrame = null;\n _this.filterPoolKey = null;\n _this.updateUvs();\n return _this;\n }\n Object.defineProperty(RenderTexture.prototype, \"framebuffer\", {\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n *\n * @readonly\n */\n get: function () {\n return this.baseTexture.framebuffer;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(RenderTexture.prototype, \"multisample\", {\n /**\n * Shortcut to `this.framebuffer.multisample`.\n *\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get: function () {\n return this.framebuffer.multisample;\n },\n set: function (value) {\n this.framebuffer.multisample = value;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Resizes the RenderTexture.\n *\n * @param desiredWidth - The desired width to resize to.\n * @param desiredHeight - The desired height to resize to.\n * @param resizeBaseTexture - Should the baseTexture.width and height values be resized as well?\n */\n RenderTexture.prototype.resize = function (desiredWidth, desiredHeight, resizeBaseTexture) {\n if (resizeBaseTexture === void 0) { resizeBaseTexture = true; }\n var resolution = this.baseTexture.resolution;\n var width = Math.round(desiredWidth * resolution) / resolution;\n var height = Math.round(desiredHeight * resolution) / resolution;\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n if (resizeBaseTexture) {\n this.baseTexture.resize(width, height);\n }\n this.updateUvs();\n };\n /**\n * Changes the resolution of baseTexture, but does not change framebuffer size.\n *\n * @param resolution - The new resolution to apply to RenderTexture\n */\n RenderTexture.prototype.setResolution = function (resolution) {\n var baseTexture = this.baseTexture;\n if (baseTexture.resolution === resolution) {\n return;\n }\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n };\n RenderTexture.create = function (options) {\n var arguments$1 = arguments;\n\n var rest = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n rest[_i - 1] = arguments$1[_i];\n }\n // @deprecated fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number') {\n deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.');\n /* eslint-disable prefer-rest-params */\n options = {\n width: options,\n height: rest[0],\n scaleMode: rest[1],\n resolution: rest[2],\n };\n /* eslint-enable prefer-rest-params */\n }\n return new RenderTexture(new BaseRenderTexture(options));\n };\n return RenderTexture;\n}(Texture));\n\n/**\n * Texture pool, used by FilterSystem and plugins.\n *\n * Stores collection of temporary pow2 or screen-sized renderTextures\n *\n * If you use custom RenderTexturePool for your filters, you can use methods\n * `getFilterTexture` and `returnFilterTexture` same as in\n *\n * @memberof PIXI\n */\nvar RenderTexturePool = /** @class */ (function () {\n /**\n * @param textureOptions - options that will be passed to BaseRenderTexture constructor\n * @param {PIXI.SCALE_MODES} [textureOptions.scaleMode] - See {@link PIXI.SCALE_MODES} for possible values.\n */\n function RenderTexturePool(textureOptions) {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\n /**\n * Creates texture with params that were specified in pool constructor.\n *\n * @param realWidth - Width of texture in pixels.\n * @param realHeight - Height of texture in pixels.\n * @param multisample - Number of samples of the framebuffer.\n */\n RenderTexturePool.prototype.createTexture = function (realWidth, realHeight, multisample) {\n if (multisample === void 0) { multisample = MSAA_QUALITY.NONE; }\n var baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample: multisample,\n }, this.textureOptions));\n return new RenderTexture(baseRenderTexture);\n };\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @param minWidth - The minimum width of the render texture.\n * @param minHeight - The minimum height of the render texture.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @return The new render texture.\n */\n RenderTexturePool.prototype.getOptimalTexture = function (minWidth, minHeight, resolution, multisample) {\n if (resolution === void 0) { resolution = 1; }\n if (multisample === void 0) { multisample = MSAA_QUALITY.NONE; }\n var key;\n minWidth = Math.ceil(minWidth * resolution);\n minHeight = Math.ceil(minHeight * resolution);\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight) {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n if (multisample > 1) {\n key += multisample * 0x100000000;\n }\n }\n else {\n key = multisample > 1 ? -multisample : -1;\n }\n if (!this.texturePool[key]) {\n this.texturePool[key] = [];\n }\n var renderTexture = this.texturePool[key].pop();\n if (!renderTexture) {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n return renderTexture;\n };\n /**\n * Gets extra texture of the same size as input renderTexture\n *\n * `getFilterTexture(input, 0.5)` or `getFilterTexture(0.5, input)`\n *\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * It overrides, it does not multiply\n * @param multisample - number of samples of the renderTexture\n * @returns\n */\n RenderTexturePool.prototype.getFilterTexture = function (input, resolution, multisample) {\n var filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution, multisample || MSAA_QUALITY.NONE);\n filterTexture.filterFrame = input.filterFrame;\n return filterTexture;\n };\n /**\n * Place a render texture back into the pool.\n *\n * @param renderTexture - The renderTexture to free\n */\n RenderTexturePool.prototype.returnTexture = function (renderTexture) {\n var key = renderTexture.filterPoolKey;\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n };\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n *\n * @param renderTexture - The renderTexture to free\n */\n RenderTexturePool.prototype.returnFilterTexture = function (renderTexture) {\n this.returnTexture(renderTexture);\n };\n /**\n * Clears the pool.\n *\n * @param destroyTextures - Destroy all stored textures.\n */\n RenderTexturePool.prototype.clear = function (destroyTextures) {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures) {\n for (var i in this.texturePool) {\n var textures = this.texturePool[i];\n if (textures) {\n for (var j = 0; j < textures.length; j++) {\n textures[j].destroy(true);\n }\n }\n }\n }\n this.texturePool = {};\n };\n /**\n * If screen size was changed, drops all screen-sized textures,\n * sets new screen size, sets `enableFullScreen` to true\n *\n * Size is measured in pixels, `renderer.view` can be passed here, not `renderer.screen`\n *\n * @param size - Initial size of screen.\n */\n RenderTexturePool.prototype.setScreenSize = function (size) {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight) {\n return;\n }\n this.enableFullScreen = size.width > 0 && size.height > 0;\n for (var i in this.texturePool) {\n if (!(Number(i) < 0)) {\n continue;\n }\n var textures = this.texturePool[i];\n if (textures) {\n for (var j = 0; j < textures.length; j++) {\n textures[j].destroy(true);\n }\n }\n this.texturePool[i] = [];\n }\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n };\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n *\n * @constant\n */\n RenderTexturePool.SCREEN_KEY = -1;\n return RenderTexturePool;\n}());\n\n/* eslint-disable max-len */\n/**\n * Holds the information for a single attribute structure required to render geometry.\n *\n * This does not contain the actual data, but instead has a buffer id that maps to a {@link PIXI.Buffer}\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * @memberof PIXI\n */\nvar Attribute = /** @class */ (function () {\n /**\n * @param buffer - the id of the buffer that this attribute will look for\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2.\n * @param normalized - should the data be normalized.\n * @param {PIXI.TYPES} [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param [instance=false] - Whether the geometry is instanced.\n */\n function Attribute(buffer, size, normalized, type, stride, start, instance) {\n if (size === void 0) { size = 0; }\n if (normalized === void 0) { normalized = false; }\n if (type === void 0) { type = TYPES.FLOAT; }\n this.buffer = buffer;\n this.size = size;\n this.normalized = normalized;\n this.type = type;\n this.stride = stride;\n this.start = start;\n this.instance = instance;\n }\n /** Destroys the Attribute. */\n Attribute.prototype.destroy = function () {\n this.buffer = null;\n };\n /**\n * Helper function that creates an Attribute based on the information provided\n *\n * @param buffer - the id of the buffer that this attribute will look for\n * @param [size=0] - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param [normalized=false] - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {@link PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @returns - A new {@link PIXI.Attribute} based on the information provided\n */\n Attribute.from = function (buffer, size, normalized, type, stride) {\n return new Attribute(buffer, size, normalized, type, stride);\n };\n return Attribute;\n}());\n\nvar UID = 0;\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n *\n * @memberof PIXI\n */\nvar Buffer = /** @class */ (function () {\n /**\n * @param {ArrayBuffer| SharedArrayBuffer|ArrayBufferView} data - the data to store in the buffer.\n * @param _static - `true` for static buffer\n * @param index - `true` for index buffer\n */\n function Buffer(data, _static, index) {\n if (_static === void 0) { _static = true; }\n if (index === void 0) { index = false; }\n this.data = (data || new Float32Array(1));\n this._glBuffers = {};\n this._updateID = 0;\n this.index = index;\n this.static = _static;\n this.id = UID++;\n this.disposeRunner = new Runner('disposeBuffer');\n }\n // TODO could explore flagging only a partial upload?\n /**\n * Flags this buffer as requiring an upload to the GPU.\n * @param {ArrayBuffer|SharedArrayBuffer|ArrayBufferView|number[]} [data] - the data to update in the buffer.\n */\n Buffer.prototype.update = function (data) {\n if (data instanceof Array) {\n data = new Float32Array(data);\n }\n this.data = data || this.data;\n this._updateID++;\n };\n /** Disposes WebGL resources that are connected to this geometry. */\n Buffer.prototype.dispose = function () {\n this.disposeRunner.emit(this, false);\n };\n /** Destroys the buffer. */\n Buffer.prototype.destroy = function () {\n this.dispose();\n this.data = null;\n };\n Object.defineProperty(Buffer.prototype, \"index\", {\n get: function () {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n },\n /**\n * Flags whether this is an index buffer.\n *\n * Index buffers are of type `ELEMENT_ARRAY_BUFFER`. Note that setting this property to false will make\n * the buffer of type `ARRAY_BUFFER`.\n *\n * For backwards compatibility.\n */\n set: function (value) {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Helper function that creates a buffer based on an array or TypedArray\n *\n * @param {ArrayBufferView | number[]} data - the TypedArray that the buffer will store. If this is a regular Array it will be converted to a Float32Array.\n * @return - A new Buffer based on the data provided.\n */\n Buffer.from = function (data) {\n if (data instanceof Array) {\n data = new Float32Array(data);\n }\n return new Buffer(data);\n };\n return Buffer;\n}());\n\n/* eslint-disable object-shorthand */\nvar map = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\nfunction interleaveTypedArrays(arrays, sizes) {\n var outSize = 0;\n var stride = 0;\n var views = {};\n for (var i = 0; i < arrays.length; i++) {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n var buffer = new ArrayBuffer(outSize * 4);\n var out = null;\n var littleOffset = 0;\n for (var i = 0; i < arrays.length; i++) {\n var size = sizes[i];\n var array = arrays[i];\n var type = getBufferType(array);\n if (!views[type]) {\n views[type] = new map[type](buffer);\n }\n out = views[type];\n for (var j = 0; j < array.length; j++) {\n var indexStart = ((j / size | 0) * stride) + littleOffset;\n var index = j % size;\n out[indexStart + index] = array[j];\n }\n littleOffset += size;\n }\n return new Float32Array(buffer);\n}\n\nvar byteSizeMap = { 5126: 4, 5123: 2, 5121: 1 };\nvar UID$1 = 0;\n/* eslint-disable object-shorthand */\nvar map$1 = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n/* eslint-disable max-len */\n/**\n * The Geometry represents a model. It consists of two components:\n * - GeometryStyle - The structure of the model such as the attributes layout\n * - GeometryData - the data of the model - this consists of buffers.\n * This can include anything from positions, uvs, normals, colors etc.\n *\n * Geometry can be defined without passing in a style or data if required (thats how I prefer!)\n *\n * ```js\n * let geometry = new PIXI.Geometry();\n *\n * geometry.addAttribute('positions', [0, 0, 100, 0, 100, 100, 0, 100], 2);\n * geometry.addAttribute('uvs', [0,0,1,0,1,1,0,1],2)\n * geometry.addIndex([0,1,2,1,3,2])\n * ```\n *\n * @memberof PIXI\n */\nvar Geometry = /** @class */ (function () {\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n function Geometry(buffers, attributes) {\n if (buffers === void 0) { buffers = []; }\n if (attributes === void 0) { attributes = {}; }\n this.buffers = buffers;\n this.indexBuffer = null;\n this.attributes = attributes;\n this.glVertexArrayObjects = {};\n this.id = UID$1++;\n this.instanced = false;\n this.instanceCount = 1;\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\n /**\n *\n * Adds an attribute to the geometry\n * Note: `stride` and `start` should be `undefined` if you dont know them, not 0!\n *\n * @param id - the name of the attribute (matching up to a shader)\n * @param {PIXI.Buffer|number[]} buffer - the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.\n * @param size - the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2\n * @param normalized - should the data be normalized.\n * @param [type=PIXI.TYPES.FLOAT] - what type of number is the attribute. Check {PIXI.TYPES} to see the ones available\n * @param [stride=0] - How far apart, in bytes, the start of each value is. (used for interleaving data)\n * @param [start=0] - How far into the array to start reading values (used for interleaving data)\n * @param instance - Instancing flag\n * @return - Returns self, useful for chaining.\n */\n Geometry.prototype.addAttribute = function (id, buffer, size, normalized, type, stride, start, instance) {\n if (size === void 0) { size = 0; }\n if (normalized === void 0) { normalized = false; }\n if (instance === void 0) { instance = false; }\n if (!buffer) {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n // check if this is a buffer!\n if (!(buffer instanceof Buffer)) {\n // its an array!\n if (buffer instanceof Array) {\n buffer = new Float32Array(buffer);\n }\n buffer = new Buffer(buffer);\n }\n var ids = id.split('|');\n if (ids.length > 1) {\n for (var i = 0; i < ids.length; i++) {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n return this;\n }\n var bufferIndex = this.buffers.indexOf(buffer);\n if (bufferIndex === -1) {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n return this;\n };\n /**\n * Returns the requested attribute.\n *\n * @param id - The name of the attribute required\n * @return - The attribute requested.\n */\n Geometry.prototype.getAttribute = function (id) {\n return this.attributes[id];\n };\n /**\n * Returns the requested buffer.\n *\n * @param id - The name of the buffer required.\n * @return - The buffer requested.\n */\n Geometry.prototype.getBuffer = function (id) {\n return this.buffers[this.getAttribute(id).buffer];\n };\n /**\n *\n * Adds an index buffer to the geometry\n * The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.\n *\n * @param {PIXI.Buffer|number[]} [buffer] - The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.\n * @return - Returns self, useful for chaining.\n */\n Geometry.prototype.addIndex = function (buffer) {\n if (!(buffer instanceof Buffer)) {\n // its an array!\n if (buffer instanceof Array) {\n buffer = new Uint16Array(buffer);\n }\n buffer = new Buffer(buffer);\n }\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n this.indexBuffer = buffer;\n if (this.buffers.indexOf(buffer) === -1) {\n this.buffers.push(buffer);\n }\n return this;\n };\n /**\n * Returns the index buffer\n *\n * @return - The index buffer.\n */\n Geometry.prototype.getIndex = function () {\n return this.indexBuffer;\n };\n /**\n * This function modifies the structure so that all current attributes become interleaved into a single buffer\n * This can be useful if your model remains static as it offers a little performance boost\n *\n * @return - Returns self, useful for chaining.\n */\n Geometry.prototype.interleave = function () {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer))\n { return this; }\n // assume already that no buffers are interleaved\n var arrays = [];\n var sizes = [];\n var interleavedBuffer = new Buffer();\n var i;\n for (i in this.attributes) {\n var attribute = this.attributes[i];\n var buffer = this.buffers[attribute.buffer];\n arrays.push(buffer.data);\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n attribute.buffer = 0;\n }\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n for (i = 0; i < this.buffers.length; i++) {\n if (this.buffers[i] !== this.indexBuffer) {\n this.buffers[i].destroy();\n }\n }\n this.buffers = [interleavedBuffer];\n if (this.indexBuffer) {\n this.buffers.push(this.indexBuffer);\n }\n return this;\n };\n /** Get the size of the geometries, in vertices. */\n Geometry.prototype.getSize = function () {\n for (var i in this.attributes) {\n var attribute = this.attributes[i];\n var buffer = this.buffers[attribute.buffer];\n return buffer.data.length / ((attribute.stride / 4) || attribute.size);\n }\n return 0;\n };\n /** Disposes WebGL resources that are connected to this geometry. */\n Geometry.prototype.dispose = function () {\n this.disposeRunner.emit(this, false);\n };\n /** Destroys the geometry. */\n Geometry.prototype.destroy = function () {\n this.dispose();\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n };\n /**\n * Returns a clone of the geometry.\n *\n * @returns - A new clone of this geometry.\n */\n Geometry.prototype.clone = function () {\n var geometry = new Geometry();\n for (var i = 0; i < this.buffers.length; i++) {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n for (var i in this.attributes) {\n var attrib = this.attributes[i];\n geometry.attributes[i] = new Attribute(attrib.buffer, attrib.size, attrib.normalized, attrib.type, attrib.stride, attrib.start, attrib.instance);\n }\n if (this.indexBuffer) {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n return geometry;\n };\n /**\n * Merges an array of geometries into a new single one.\n *\n * Geometry attribute styles must match for this operation to work.\n *\n * @param geometries - array of geometries to merge\n * @return - Shiny new geometry!\n */\n Geometry.merge = function (geometries) {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n var geometryOut = new Geometry();\n var arrays = [];\n var sizes = [];\n var offsets = [];\n var geometry;\n // pass one.. get sizes..\n for (var i = 0; i < geometries.length; i++) {\n geometry = geometries[i];\n for (var j = 0; j < geometry.buffers.length; j++) {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n // build the correct size arrays..\n for (var i = 0; i < geometry.buffers.length; i++) {\n // TODO types!\n arrays[i] = new map$1[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n // pass to set data..\n for (var i = 0; i < geometries.length; i++) {\n geometry = geometries[i];\n for (var j = 0; j < geometry.buffers.length; j++) {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n geometryOut.attributes = geometry.attributes;\n if (geometry.indexBuffer) {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n var offset = 0;\n var stride = 0;\n var offset2 = 0;\n var bufferIndexToCount = 0;\n // get a buffer\n for (var i = 0; i < geometry.buffers.length; i++) {\n if (geometry.buffers[i] !== geometry.indexBuffer) {\n bufferIndexToCount = i;\n break;\n }\n }\n // figure out the stride of one buffer..\n for (var i in geometry.attributes) {\n var attribute = geometry.attributes[i];\n if ((attribute.buffer | 0) === bufferIndexToCount) {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n // time to off set all indexes..\n for (var i = 0; i < geometries.length; i++) {\n var indexBufferData = geometries[i].indexBuffer.data;\n for (var j = 0; j < indexBufferData.length; j++) {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n return geometryOut;\n };\n return Geometry;\n}());\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nvar Quad = /** @class */ (function (_super) {\n __extends(Quad, _super);\n function Quad() {\n var _this = _super.call(this) || this;\n _this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1 ]))\n .addIndex([0, 1, 3, 2]);\n return _this;\n }\n return Quad;\n}(Geometry));\n\n/**\n * Helper class to create a quad with uvs like in v4\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nvar QuadUv = /** @class */ (function (_super) {\n __extends(QuadUv, _super);\n function QuadUv() {\n var _this = _super.call(this) || this;\n /**\n * An array of vertices\n *\n * @member {Float32Array}\n */\n _this.vertices = new Float32Array([\n -1, -1,\n 1, -1,\n 1, 1,\n -1, 1 ]);\n /**\n * The Uvs of the quad\n *\n * @member {Float32Array}\n */\n _this.uvs = new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1 ]);\n _this.vertexBuffer = new Buffer(_this.vertices);\n _this.uvBuffer = new Buffer(_this.uvs);\n _this.addAttribute('aVertexPosition', _this.vertexBuffer)\n .addAttribute('aTextureCoord', _this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n return _this;\n }\n /**\n * Maps two Rectangle to the quad.\n *\n * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle\n * @param {PIXI.Rectangle} destinationFrame - the second rectangle\n * @return {PIXI.Quad} Returns itself.\n */\n QuadUv.prototype.map = function (targetTextureFrame, destinationFrame) {\n var x = 0; // destinationFrame.x / targetTextureFrame.width;\n var y = 0; // destinationFrame.y / targetTextureFrame.height;\n this.uvs[0] = x;\n this.uvs[1] = y;\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n x = destinationFrame.x;\n y = destinationFrame.y;\n this.vertices[0] = x;\n this.vertices[1] = y;\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n this.invalidate();\n return this;\n };\n /**\n * legacy upload method, just marks buffers dirty\n * @returns {PIXI.QuadUv} Returns itself.\n */\n QuadUv.prototype.invalidate = function () {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n return this;\n };\n return QuadUv;\n}(Geometry));\n\nvar UID$2 = 0;\n/**\n * Uniform group holds uniform map and some ID's for work\n *\n * `UniformGroup` has two modes:\n *\n * 1: Normal mode\n * Normal mode will upload the uniforms with individual function calls as required\n *\n * 2: Uniform buffer mode\n * This mode will treat the uniforms as a uniform buffer. You can pass in either a buffer that you manually handle, or\n * or a generic object that PixiJS will automatically map to a buffer for you.\n * For maximum benefits, make Ubo UniformGroups static, and only update them each frame.\n *\n * Rules of UBOs:\n * - UBOs only work with WebGL2, so make sure you have a fallback!\n * - Only floats are supported (including vec[2,3,4], mat[2,3,4])\n * - Samplers cannot be used in ubo's (a GPU limitation)\n * - You must ensure that the object you pass in exactly matches in the shader ubo structure.\n * Otherwise, weirdness will ensue!\n * - The name of the ubo object added to the group must match exactly the name of the ubo in the shader.\n *\n * ```\n * // ubo in shader:\n * uniform myCoolData { // declaring a ubo..\n * mat4 uCoolMatrix;\n * float uFloatyMcFloatFace\n *\n *\n * // a new uniform buffer object..\n * const myCoolData = new UniformBufferGroup({\n * uCoolMatrix: new Matrix(),\n * uFloatyMcFloatFace: 23,\n * }}\n *\n * // build a shader...\n * const shader = Shader.from(srcVert, srcFrag, {\n * myCoolData // name matches the ubo name in the shader. will be processed accordingly.\n * })\n *\n * ```\n *\n * @class\n * @memberof PIXI\n */\nvar UniformGroup = /** @class */ (function () {\n /**\n * @param {object | Buffer} [uniforms] - Custom uniforms to use to augment the built-in ones. Or a pixi buffer\n * @param {boolean} [isStatic] - Uniforms wont be changed after creation\n * @param {boolean} [isUbo] - if true, will treat this uniform group as a uniform buffer object\n */\n function UniformGroup(uniforms, isStatic, isUbo) {\n /**\n * Its a group and not a single uniforms\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.group = true;\n // lets generate this when the shader ?\n this.syncUniforms = {};\n /**\n * dirty version\n * @protected\n * @member {number}\n */\n this.dirtyId = 0;\n /**\n * unique id\n * @protected\n * @member {number}\n */\n this.id = UID$2++;\n /**\n * Uniforms wont be changed after creation\n * @member {boolean}\n */\n this.static = !!isStatic;\n /**\n * Flags whether this group is treated like a uniform buffer object.\n * @member {boolean}\n */\n this.ubo = !!isUbo;\n if (uniforms instanceof Buffer) {\n this.buffer = uniforms;\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = false;\n this.ubo = true;\n }\n else {\n /**\n * uniform values\n * @member {object}\n * @readonly\n */\n this.uniforms = uniforms;\n if (this.ubo) {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n UniformGroup.prototype.update = function () {\n this.dirtyId++;\n if (!this.autoManage && this.buffer) {\n this.buffer.update();\n }\n };\n UniformGroup.prototype.add = function (name, uniforms, _static) {\n if (!this.ubo) {\n this.uniforms[name] = new UniformGroup(uniforms, _static);\n }\n else {\n // eslint-disable-next-line max-len\n throw new Error('[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them');\n }\n };\n UniformGroup.from = function (uniforms, _static, _ubo) {\n return new UniformGroup(uniforms, _static, _ubo);\n };\n /**\n * A short hand function for creating a static UBO UniformGroup.\n *\n * @param uniforms - the ubo item\n * @param _static - should this be updated each time it is used? defaults to true here!\n */\n UniformGroup.uboFrom = function (uniforms, _static) {\n return new UniformGroup(uniforms, _static !== null && _static !== void 0 ? _static : true, true);\n };\n return UniformGroup;\n}());\n\n/**\n * System plugin to the renderer to manage filter states.\n *\n * @ignore\n */\nvar FilterState = /** @class */ (function () {\n function FilterState() {\n this.renderTexture = null;\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n // next three fields are created only for root\n // re-assigned for everything else\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.bindingSourceFrame = new Rectangle();\n this.bindingDestinationFrame = new Rectangle();\n this.filters = [];\n this.transform = null;\n }\n /** Clears the state */\n FilterState.prototype.clear = function () {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n };\n return FilterState;\n}());\n\nvar tempPoints = [new Point(), new Point(), new Point(), new Point()];\nvar tempMatrix = new Matrix();\n/**\n * System plugin to the renderer to manage filters.\n *\n * ## Pipeline\n *\n * The FilterSystem executes the filtering pipeline by rendering the display-object into a texture, applying its\n * [filters]{@link PIXI.Filter} in series, and the last filter outputs into the final render-target.\n *\n * The filter-frame is the rectangle in world space being filtered, and those contents are mapped into\n * `(0, 0, filterFrame.width, filterFrame.height)` into the filter render-texture. The filter-frame is also called\n * the source-frame, as it is used to bind the filter render-textures. The last filter outputs to the `filterFrame`\n * in the final render-target.\n *\n * ## Usage\n *\n * {@link PIXI.Container#renderAdvanced} is an example of how to use the filter system. It is a 3 step process:\n *\n * * **push**: Use {@link PIXI.FilterSystem#push} to push the set of filters to be applied on a filter-target.\n * * **render**: Render the contents to be filtered using the renderer. The filter-system will only capture the contents\n * inside the bounds of the filter-target. NOTE: Using {@link PIXI.Renderer#render} is\n * illegal during an existing render cycle, and it may reset the filter system.\n * * **pop**: Use {@link PIXI.FilterSystem#pop} to pop & execute the filters you initially pushed. It will apply them\n * serially and output to the bounds of the filter-target.\n *\n * @memberof PIXI\n */\nvar FilterSystem = /** @class */ (function () {\n /**\n * @param renderer - The renderer this System works for.\n */\n function FilterSystem(renderer) {\n this.renderer = renderer;\n this.defaultFilterStack = [{}];\n this.texturePool = new RenderTexturePool();\n this.texturePool.setScreenSize(renderer.view);\n this.statePool = [];\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {};\n this.globalUniforms = new UniformGroup({\n outputFrame: new Rectangle(),\n inputSize: new Float32Array(4),\n inputPixel: new Float32Array(4),\n inputClamp: new Float32Array(4),\n resolution: 1,\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n this.forceClear = false;\n this.useMaxPadding = false;\n }\n /**\n * Pushes a set of filters to be applied later to the system. This will redirect further rendering into an\n * input render-texture for the rest of the filtering pipeline.\n *\n * @param {PIXI.DisplayObject} target - The target of the filter to render.\n * @param filters - The filters to apply.\n */\n FilterSystem.prototype.push = function (target, filters) {\n var _a, _b;\n var renderer = this.renderer;\n var filterStack = this.defaultFilterStack;\n var state = this.statePool.pop() || new FilterState();\n var renderTextureSystem = this.renderer.renderTexture;\n var resolution = filters[0].resolution;\n var multisample = filters[0].multisample;\n var padding = filters[0].padding;\n var autoFit = filters[0].autoFit;\n // We don't know whether it's a legacy filter until it was bound for the first time,\n // therefore we have to assume that it is if legacy is undefined.\n var legacy = (_a = filters[0].legacy) !== null && _a !== void 0 ? _a : true;\n for (var i = 1; i < filters.length; i++) {\n var filter = filters[i];\n // let's use the lowest resolution\n resolution = Math.min(resolution, filter.resolution);\n // let's use the lowest number of samples\n multisample = Math.min(multisample, filter.multisample);\n // figure out the padding required for filters\n padding = this.useMaxPadding\n // old behavior: use largest amount of padding!\n ? Math.max(padding, filter.padding)\n // new behavior: sum the padding\n : padding + filter.padding;\n // only auto fit if all filters are autofit\n autoFit = autoFit && filter.autoFit;\n legacy = legacy || ((_b = filter.legacy) !== null && _b !== void 0 ? _b : true);\n }\n if (filterStack.length === 1) {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n filterStack.push(state);\n state.resolution = resolution;\n state.multisample = multisample;\n state.legacy = legacy;\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n state.sourceFrame.pad(padding);\n if (autoFit) {\n var sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform) {\n this.transformAABB(tempMatrix.copyFrom(renderer.projection.transform).invert(), sourceFrameProjected);\n }\n state.sourceFrame.fit(sourceFrameProjected);\n }\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(state.sourceFrame, renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution, renderTextureSystem.sourceFrame, renderTextureSystem.destinationFrame, renderer.projection.transform);\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height, resolution, multisample);\n state.filters = filters;\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n var destinationFrame = this.tempRect;\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n state.transform = renderer.projection.transform;\n renderer.projection.transform = null;\n renderTextureSystem.bind(state.renderTexture, state.sourceFrame, destinationFrame);\n renderer.framebuffer.clear(0, 0, 0, 0);\n };\n /** Pops off the filter and applies it. */\n FilterSystem.prototype.pop = function () {\n var filterStack = this.defaultFilterStack;\n var state = filterStack.pop();\n var filters = state.filters;\n this.activeState = state;\n var globalUniforms = this.globalUniforms.uniforms;\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n var inputSize = globalUniforms.inputSize;\n var inputPixel = globalUniforms.inputPixel;\n var inputClamp = globalUniforms.inputClamp;\n inputSize[0] = state.destinationFrame.width;\n inputSize[1] = state.destinationFrame.height;\n inputSize[2] = 1.0 / inputSize[0];\n inputSize[3] = 1.0 / inputSize[1];\n inputPixel[0] = Math.round(inputSize[0] * state.resolution);\n inputPixel[1] = Math.round(inputSize[1] * state.resolution);\n inputPixel[2] = 1.0 / inputPixel[0];\n inputPixel[3] = 1.0 / inputPixel[1];\n inputClamp[0] = 0.5 * inputPixel[2];\n inputClamp[1] = 0.5 * inputPixel[3];\n inputClamp[2] = (state.sourceFrame.width * inputSize[2]) - (0.5 * inputPixel[2]);\n inputClamp[3] = (state.sourceFrame.height * inputSize[3]) - (0.5 * inputPixel[3]);\n // only update the rect if its legacy..\n if (state.legacy) {\n var filterArea = globalUniforms.filterArea;\n filterArea[0] = state.destinationFrame.width;\n filterArea[1] = state.destinationFrame.height;\n filterArea[2] = state.sourceFrame.x;\n filterArea[3] = state.sourceFrame.y;\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n this.globalUniforms.update();\n var lastState = filterStack[filterStack.length - 1];\n this.renderer.framebuffer.blit();\n if (filters.length === 1) {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n this.returnFilterTexture(state.renderTexture);\n }\n else {\n var flip = state.renderTexture;\n var flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution);\n flop.filterFrame = flip.filterFrame;\n var i = 0;\n for (i = 0; i < filters.length - 1; ++i) {\n if (i === 1 && state.multisample > 1) {\n flop = this.getOptimalFilterTexture(flip.width, flip.height, state.resolution);\n flop.filterFrame = flip.filterFrame;\n }\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n var t = flip;\n flip = flop;\n flop = t;\n }\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n if (i > 1 && state.multisample > 1) {\n this.returnFilterTexture(state.renderTexture);\n }\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n // lastState.renderTexture is blitted when lastState is popped\n state.clear();\n this.statePool.push(state);\n };\n /**\n * Binds a renderTexture with corresponding `filterFrame`, clears it if mode corresponds.\n *\n * @param filterTexture - renderTexture to bind, should belong to filter pool or filter stack\n * @param clearMode - clearMode, by default its CLEAR/YES. See {@link PIXI.CLEAR_MODES}\n */\n FilterSystem.prototype.bindAndClear = function (filterTexture, clearMode) {\n if (clearMode === void 0) { clearMode = CLEAR_MODES.CLEAR; }\n var _a = this.renderer, renderTextureSystem = _a.renderTexture, stateSystem = _a.state;\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n if (filterTexture && filterTexture.filterFrame) {\n var destinationFrame = this.tempRect;\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture) {\n renderTextureSystem.bind(filterTexture);\n }\n else {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(filterTexture, this.activeState.bindingSourceFrame, this.activeState.bindingDestinationFrame);\n }\n // Clear the texture in BLIT mode if blending is disabled or the forceClear flag is set. The blending\n // is stored in the 0th bit of the state.\n var autoClear = (stateSystem.stateId & 1) || this.forceClear;\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear)) {\n // Use framebuffer.clear because we want to clear the whole filter texture, not just the filtering\n // area over which the shaders are run. This is because filters may sampling outside of it (e.g. blur)\n // instead of clamping their arithmetic.\n this.renderer.framebuffer.clear(0, 0, 0, 0);\n }\n };\n /**\n * Draws a filter using the default rendering process.\n *\n * This should be called only by {@link Filter#apply}.\n *\n * @param filter - The filter to draw.\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it\n */\n FilterSystem.prototype.applyFilter = function (filter, input, output, clearMode) {\n var renderer = this.renderer;\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n // TODO make it so that the order of this does not matter..\n // because it does at the moment cos of global uniforms.\n // they need to get resynced\n renderer.shader.bind(filter);\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n if (filter.legacy) {\n this.quadUv.map(input._frame, input.filterFrame);\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\n };\n /**\n * Multiply _input normalized coordinates_ to this matrix to get _sprite texture normalized coordinates_.\n *\n * Use `outputMatrix * vTextureCoord` in the shader.\n *\n * @param outputMatrix - The matrix to output to.\n * @param {PIXI.Sprite} sprite - The sprite to map to.\n * @return The mapped matrix.\n */\n FilterSystem.prototype.calculateSpriteMatrix = function (outputMatrix, sprite) {\n var _a = this.activeState, sourceFrame = _a.sourceFrame, destinationFrame = _a.destinationFrame;\n var orig = sprite._texture.orig;\n var mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0, destinationFrame.height, sourceFrame.x, sourceFrame.y);\n var worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n worldTransform.invert();\n mappedMatrix.prepend(worldTransform);\n mappedMatrix.scale(1.0 / orig.width, 1.0 / orig.height);\n mappedMatrix.translate(sprite.anchor.x, sprite.anchor.y);\n return mappedMatrix;\n };\n /** Destroys this Filter System. */\n FilterSystem.prototype.destroy = function () {\n this.renderer = null;\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n };\n /**\n * Gets a Power-of-Two render texture or fullScreen texture\n *\n * @param minWidth - The minimum width of the render texture in real pixels.\n * @param minHeight - The minimum height of the render texture in real pixels.\n * @param resolution - The resolution of the render texture.\n * @param multisample - Number of samples of the render texture.\n * @return - The new render texture.\n */\n FilterSystem.prototype.getOptimalFilterTexture = function (minWidth, minHeight, resolution, multisample) {\n if (resolution === void 0) { resolution = 1; }\n if (multisample === void 0) { multisample = MSAA_QUALITY.NONE; }\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n };\n /**\n * Gets extra render texture to use inside current filter\n * To be compliant with older filters, you can use params in any order\n *\n * @param input - renderTexture from which size and resolution will be copied\n * @param resolution - override resolution of the renderTexture\n * @param multisample - number of samples of the renderTexture\n */\n FilterSystem.prototype.getFilterTexture = function (input, resolution, multisample) {\n if (typeof input === 'number') {\n var swap = input;\n input = resolution;\n resolution = swap;\n }\n input = input || this.activeState.renderTexture;\n var filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution, multisample || MSAA_QUALITY.NONE);\n filterTexture.filterFrame = input.filterFrame;\n return filterTexture;\n };\n /**\n * Frees a render texture back into the pool.\n *\n * @param renderTexture - The renderTarget to free\n */\n FilterSystem.prototype.returnFilterTexture = function (renderTexture) {\n this.texturePool.returnTexture(renderTexture);\n };\n /** Empties the texture pool. */\n FilterSystem.prototype.emptyPool = function () {\n this.texturePool.clear(true);\n };\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n FilterSystem.prototype.resize = function () {\n this.texturePool.setScreenSize(this.renderer.view);\n };\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n FilterSystem.prototype.transformAABB = function (matrix, rect) {\n var lt = tempPoints[0];\n var lb = tempPoints[1];\n var rt = tempPoints[2];\n var rb = tempPoints[3];\n lt.set(rect.left, rect.top);\n lb.set(rect.left, rect.bottom);\n rt.set(rect.right, rect.top);\n rb.set(rect.right, rect.bottom);\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n var x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n var y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n var x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n var y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n };\n FilterSystem.prototype.roundFrame = function (frame, resolution, bindingSourceFrame, bindingDestinationFrame, transform) {\n if (transform) {\n var a = transform.a, b = transform.b, c = transform.c, d = transform.d;\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n if ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4)) {\n return;\n }\n }\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(bindingDestinationFrame.width / bindingSourceFrame.width, bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n // Round frame in screen space\n frame.ceil(resolution);\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n };\n return FilterSystem;\n}());\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n *\n * @memberof PIXI\n */\nvar ObjectRenderer = /** @class */ (function () {\n /**\n * @param renderer - The renderer this manager works for.\n */\n function ObjectRenderer(renderer) {\n this.renderer = renderer;\n }\n /**\n * Stub method that should be used to empty the current\n * batch by rendering objects now.\n */\n ObjectRenderer.prototype.flush = function () {\n // flush!\n };\n /**\n * Generic destruction method that frees all resources. This\n * should be called by subclasses.\n */\n ObjectRenderer.prototype.destroy = function () {\n this.renderer = null;\n };\n /**\n * Stub method that initializes any state required before\n * rendering starts. It is different from the `prerender`\n * signal, which occurs every frame, in that it is called\n * whenever an object requests _this_ renderer specifically.\n */\n ObjectRenderer.prototype.start = function () {\n // set the shader..\n };\n /**\n * Stops the renderer. It should free up any state and\n * become dormant.\n */\n ObjectRenderer.prototype.stop = function () {\n this.flush();\n };\n /**\n * Keeps the object to render. It doesn't have to be\n * rendered immediately.\n *\n * @param {PIXI.DisplayObject} object - The object to render.\n */\n ObjectRenderer.prototype.render = function (_object) {\n // render the object\n };\n return ObjectRenderer;\n}());\n\n/**\n * System plugin to the renderer to manage batching.\n *\n * @memberof PIXI\n */\nvar BatchSystem = /** @class */ (function () {\n /**\n * @param renderer - The renderer this System works for.\n */\n function BatchSystem(renderer) {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param objectRenderer - The object renderer to use.\n */\n BatchSystem.prototype.setObjectRenderer = function (objectRenderer) {\n if (this.currentRenderer === objectRenderer) {\n return;\n }\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n this.currentRenderer.start();\n };\n /**\n * This should be called if you wish to do some custom rendering\n * It will basically render anything that may be batched up such as sprites\n */\n BatchSystem.prototype.flush = function () {\n this.setObjectRenderer(this.emptyRenderer);\n };\n /**\n * Reset the system to an empty renderer\n */\n BatchSystem.prototype.reset = function () {\n this.setObjectRenderer(this.emptyRenderer);\n };\n /**\n * Handy function for batch renderers: copies bound textures in first maxTextures locations to array\n * sets actual _batchLocation for them\n *\n * @param arr - arr copy destination\n * @param maxTextures - number of copied elements\n */\n BatchSystem.prototype.copyBoundTextures = function (arr, maxTextures) {\n var boundTextures = this.renderer.texture.boundTextures;\n for (var i = maxTextures - 1; i >= 0; --i) {\n arr[i] = boundTextures[i] || null;\n if (arr[i]) {\n arr[i]._batchLocation = i;\n }\n }\n };\n /**\n * Assigns batch locations to textures in array based on boundTextures state.\n * All textures in texArray should have `_batchEnabled = _batchId`,\n * and their count should be less than `maxTextures`.\n *\n * @param texArray - textures to bound\n * @param boundTextures - current state of bound textures\n * @param batchId - marker for _batchEnabled param of textures in texArray\n * @param maxTextures - number of texture locations to manipulate\n */\n BatchSystem.prototype.boundArray = function (texArray, boundTextures, batchId, maxTextures) {\n var elements = texArray.elements, ids = texArray.ids, count = texArray.count;\n var j = 0;\n for (var i = 0; i < count; i++) {\n var tex = elements[i];\n var loc = tex._batchLocation;\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex) {\n ids[i] = loc;\n continue;\n }\n while (j < maxTextures) {\n var bound = boundTextures[j];\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j) {\n j++;\n continue;\n }\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n };\n /**\n * @ignore\n */\n BatchSystem.prototype.destroy = function () {\n this.renderer = null;\n };\n return BatchSystem;\n}());\n\nvar CONTEXT_UID_COUNTER = 0;\n/**\n * System plugin to the renderer to manage the context.\n *\n * @memberof PIXI\n */\nvar ContextSystem = /** @class */ (function () {\n /** @param renderer - The renderer this System works for. */\n function ContextSystem(renderer) {\n this.renderer = renderer;\n this.webGLVersion = 1;\n this.extensions = {};\n this.supports = {\n uint32Indices: false,\n };\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n renderer.view.addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n Object.defineProperty(ContextSystem.prototype, \"isLost\", {\n /**\n * `true` if the context is lost\n *\n * @readonly\n */\n get: function () {\n return (!this.gl || this.gl.isContextLost());\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Handles the context change event.\n *\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n ContextSystem.prototype.contextChange = function (gl) {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context')) {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n };\n /**\n * Initializes the context.\n *\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n ContextSystem.prototype.initFromContext = function (gl) {\n this.gl = gl;\n this.validateContext(gl);\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n this.renderer.runners.contextChange.emit(gl);\n };\n /**\n * Initialize from context options\n *\n * @protected\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext\n * @param {object} options - context attributes\n */\n ContextSystem.prototype.initFromOptions = function (options) {\n var gl = this.createContext(this.renderer.view, options);\n this.initFromContext(gl);\n };\n /**\n * Helper class to create a WebGL Context\n *\n * @param canvas - the canvas element that we will get the context from\n * @param options - An options object that gets passed in to the canvas element containing the\n * context attributes\n * @see https://developer.mozilla.org/en/docs/Web/API/HTMLCanvasElement/getContext\n * @return {WebGLRenderingContext} the WebGL context\n */\n ContextSystem.prototype.createContext = function (canvas, options) {\n var gl;\n if (settings.PREFER_ENV >= ENV.WEBGL2) {\n gl = canvas.getContext('webgl2', options);\n }\n if (gl) {\n this.webGLVersion = 2;\n }\n else {\n this.webGLVersion = 1;\n gl = canvas.getContext('webgl', options)\n || canvas.getContext('experimental-webgl', options);\n if (!gl) {\n // fail, not able to get a context\n throw new Error('This browser does not support WebGL. Try using the canvas renderer');\n }\n }\n this.gl = gl;\n this.getExtensions();\n return this.gl;\n };\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n ContextSystem.prototype.getExtensions = function () {\n // time to set up default extensions that Pixi uses.\n var gl = this.gl;\n var common = {\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n s3tc: gl.getExtension('WEBGL_compressed_texture_s3tc'),\n s3tc_sRGB: gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'),\n etc: gl.getExtension('WEBGL_compressed_texture_etc'),\n etc1: gl.getExtension('WEBGL_compressed_texture_etc1'),\n pvrtc: gl.getExtension('WEBGL_compressed_texture_pvrtc')\n || gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\n atc: gl.getExtension('WEBGL_compressed_texture_atc'),\n astc: gl.getExtension('WEBGL_compressed_texture_astc')\n };\n if (this.webGLVersion === 1) {\n Object.assign(this.extensions, common, {\n drawBuffers: gl.getExtension('WEBGL_draw_buffers'),\n depthTexture: gl.getExtension('WEBGL_depth_texture'),\n loseContext: gl.getExtension('WEBGL_lose_context'),\n vertexArrayObject: gl.getExtension('OES_vertex_array_object')\n || gl.getExtension('MOZ_OES_vertex_array_object')\n || gl.getExtension('WEBKIT_OES_vertex_array_object'),\n uint32ElementIndex: gl.getExtension('OES_element_index_uint'),\n // Floats and half-floats\n floatTexture: gl.getExtension('OES_texture_float'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n textureHalfFloat: gl.getExtension('OES_texture_half_float'),\n textureHalfFloatLinear: gl.getExtension('OES_texture_half_float_linear'),\n });\n }\n else if (this.webGLVersion === 2) {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n };\n /**\n * Handles a lost webgl context\n *\n * @param {WebGLContextEvent} event - The context lost event.\n */\n ContextSystem.prototype.handleContextLost = function (event) {\n event.preventDefault();\n };\n /** Handles a restored webgl context. */\n ContextSystem.prototype.handleContextRestored = function () {\n this.renderer.runners.contextChange.emit(this.gl);\n };\n ContextSystem.prototype.destroy = function () {\n var view = this.renderer.view;\n this.renderer = null;\n // remove listeners\n view.removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n this.gl.useProgram(null);\n if (this.extensions.loseContext) {\n this.extensions.loseContext.loseContext();\n }\n };\n /** Handle the post-render runner event. */\n ContextSystem.prototype.postrender = function () {\n if (this.renderer.renderingToScreen) {\n this.gl.flush();\n }\n };\n /**\n * Validate context.\n *\n * @param {WebGLRenderingContext} gl - Render context.\n */\n ContextSystem.prototype.validateContext = function (gl) {\n var attributes = gl.getContextAttributes();\n var isWebGl2 = 'WebGL2RenderingContext' in self && gl instanceof self.WebGL2RenderingContext;\n if (isWebGl2) {\n this.webGLVersion = 2;\n }\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil) {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not have a stencil buffer, masks may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n var hasuint32 = isWebGl2 || !!gl.getExtension('OES_element_index_uint');\n this.supports.uint32Indices = hasuint32;\n if (!hasuint32) {\n /* eslint-disable max-len, no-console */\n console.warn('Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly');\n /* eslint-enable max-len, no-console */\n }\n };\n return ContextSystem;\n}());\n\n/**\n * Internal framebuffer for WebGL context\n * @class\n * @memberof PIXI\n */\nvar GLFramebuffer = /** @class */ (function () {\n function GLFramebuffer(framebuffer) {\n /**\n * The WebGL framebuffer\n * @member {WebGLFramebuffer}\n */\n this.framebuffer = framebuffer;\n /**\n * stencil+depth , usually costs 32bits per pixel\n * @member {WebGLRenderbuffer}\n */\n this.stencil = null;\n /**\n * latest known version of framebuffer\n * @member {number}\n * @protected\n */\n this.dirtyId = -1;\n /**\n * latest known version of framebuffer format\n * @member {number}\n * @protected\n */\n this.dirtyFormat = -1;\n /**\n * latest known version of framebuffer size\n * @member {number}\n * @protected\n */\n this.dirtySize = -1;\n /**\n * Detected AA samples number\n * @member {PIXI.MSAA_QUALITY}\n */\n this.multisample = MSAA_QUALITY.NONE;\n /**\n * In case MSAA, we use this Renderbuffer instead of colorTextures[0] when we write info\n * @member {WebGLRenderbuffer}\n */\n this.msaaBuffer = null;\n /**\n * In case we use MSAA, this is actual framebuffer that has colorTextures[0]\n * The contents of that framebuffer are read when we use that renderTexture in sprites\n * @member {PIXI.Framebuffer}\n */\n this.blitFramebuffer = null;\n /**\n * store the current mipmap of the textures the framebuffer will write too.\n */\n this.mipLevel = 0;\n }\n return GLFramebuffer;\n}());\n\nvar tempRectangle = new Rectangle();\n/**\n * System plugin to the renderer to manage framebuffers.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nvar FramebufferSystem = /** @class */ (function () {\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function FramebufferSystem(renderer) {\n this.renderer = renderer;\n /**\n * A list of managed framebuffers\n * @member {PIXI.Framebuffer[]}\n * @readonly\n */\n this.managedFramebuffers = [];\n /**\n * Framebuffer value that shows that we don't know what is bound\n * @member {Framebuffer}\n * @readonly\n */\n this.unknownFramebuffer = new Framebuffer(10, 10);\n this.msaaSamples = null;\n }\n /**\n * Sets up the renderer context and necessary buffers.\n */\n FramebufferSystem.prototype.contextChange = function () {\n var gl = this.gl = this.renderer.gl;\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n this.hasMRT = true;\n this.writeDepthTexture = true;\n this.disposeAll(true);\n // webgl2\n if (this.renderer.context.webGLVersion === 1) {\n // webgl 1!\n var nativeDrawBuffersExtension_1 = this.renderer.context.extensions.drawBuffers;\n var nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY) {\n nativeDrawBuffersExtension_1 = null;\n nativeDepthTextureExtension = null;\n }\n if (nativeDrawBuffersExtension_1) {\n gl.drawBuffers = function (activeTextures) {\n return nativeDrawBuffersExtension_1.drawBuffersWEBGL(activeTextures);\n };\n }\n else {\n this.hasMRT = false;\n gl.drawBuffers = function () {\n // empty\n };\n }\n if (!nativeDepthTextureExtension) {\n this.writeDepthTexture = false;\n }\n }\n else {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\n };\n /**\n * Bind a framebuffer\n *\n * @param {PIXI.Framebuffer} [framebuffer]\n * @param {PIXI.Rectangle} [frame] - frame, default is framebuffer size\n * @param {number} [mipLevel] - optional mip level to set on the framebuffer - defaults to 0\n */\n FramebufferSystem.prototype.bind = function (framebuffer, frame, mipLevel) {\n if (mipLevel === void 0) { mipLevel = 0; }\n var gl = this.gl;\n if (framebuffer) {\n // TODO caching layer!\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n if (this.current !== framebuffer) {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n if (fbo.mipLevel !== mipLevel) {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId) {\n fbo.dirtyId = framebuffer.dirtyId;\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat) {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize) {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n for (var i = 0; i < framebuffer.colorTextures.length; i++) {\n var tex = framebuffer.colorTextures[i];\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n if (framebuffer.depthTexture) {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n if (frame) {\n var mipWidth = (frame.width >> mipLevel);\n var mipHeight = (frame.height >> mipLevel);\n var scale = mipWidth / frame.width;\n this.setViewport(frame.x * scale, frame.y * scale, mipWidth, mipHeight);\n }\n else {\n var mipWidth = (framebuffer.width >> mipLevel);\n var mipHeight = (framebuffer.height >> mipLevel);\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else {\n if (this.current) {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n if (frame) {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\n }\n };\n /**\n * Set the WebGLRenderingContext's viewport.\n *\n * @param {Number} x - X position of viewport\n * @param {Number} y - Y position of viewport\n * @param {Number} width - Width of viewport\n * @param {Number} height - Height of viewport\n */\n FramebufferSystem.prototype.setViewport = function (x, y, width, height) {\n var v = this.viewport;\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y) {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n this.gl.viewport(x, y, width, height);\n }\n };\n Object.defineProperty(FramebufferSystem.prototype, \"size\", {\n /**\n * Get the size of the current width and height. Returns object with `width` and `height` values.\n *\n * @member {object}\n * @readonly\n */\n get: function () {\n if (this.current) {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Clear the color of the context\n *\n * @param {Number} r - Red value from 0 to 1\n * @param {Number} g - Green value from 0 to 1\n * @param {Number} b - Blue value from 0 to 1\n * @param {Number} a - Alpha value from 0 to 1\n * @param {PIXI.BUFFER_BITS} [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n FramebufferSystem.prototype.clear = function (r, g, b, a, mask) {\n if (mask === void 0) { mask = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH; }\n var gl = this.gl;\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n };\n /**\n * Initialize framebuffer for this context\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @returns {PIXI.GLFramebuffer} created GLFramebuffer\n */\n FramebufferSystem.prototype.initFramebuffer = function (framebuffer) {\n var gl = this.gl;\n var fbo = new GLFramebuffer(gl.createFramebuffer());\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n return fbo;\n };\n /**\n * Resize the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n FramebufferSystem.prototype.resizeFramebuffer = function (framebuffer) {\n var gl = this.gl;\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n if (fbo.msaaBuffer) {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height);\n }\n if (fbo.stencil) {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n if (fbo.msaaBuffer) {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n var colorTextures = framebuffer.colorTextures;\n var count = colorTextures.length;\n if (!gl.drawBuffers) {\n count = Math.min(count, 1);\n }\n for (var i = 0; i < count; i++) {\n var texture = colorTextures[i];\n var parentTexture = texture.parentTextureArray || texture;\n this.renderer.texture.bind(parentTexture, 0);\n }\n if (framebuffer.depthTexture && this.writeDepthTexture) {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n };\n /**\n * Update the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @param {number} mipLevel\n */\n FramebufferSystem.prototype.updateFramebuffer = function (framebuffer, mipLevel) {\n var gl = this.gl;\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n // bind the color texture\n var colorTextures = framebuffer.colorTextures;\n var count = colorTextures.length;\n if (!gl.drawBuffers) {\n count = Math.min(count, 1);\n }\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer)) {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.RGBA8, framebuffer.width, framebuffer.height);\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, fbo.msaaBuffer);\n }\n else if (fbo.msaaBuffer) {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n if (fbo.blitFramebuffer) {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n var activeTextures = [];\n for (var i = 0; i < count; i++) {\n var texture = colorTextures[i];\n var parentTexture = texture.parentTextureArray || texture;\n this.renderer.texture.bind(parentTexture, 0);\n if (i === 0 && fbo.msaaBuffer) {\n continue;\n }\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0 + i, texture.target, parentTexture._glTextures[this.CONTEXT_UID].texture, mipLevel);\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n if (activeTextures.length > 1) {\n gl.drawBuffers(activeTextures);\n }\n if (framebuffer.depthTexture) {\n var writeDepthTexture = this.writeDepthTexture;\n if (writeDepthTexture) {\n var depthTexture = framebuffer.depthTexture;\n this.renderer.texture.bind(depthTexture, 0);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_2D, depthTexture._glTextures[this.CONTEXT_UID].texture, mipLevel);\n }\n }\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture)) {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n if (fbo.msaaBuffer) {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil) {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n };\n /**\n * Returns true if the frame buffer can be multisampled\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n FramebufferSystem.prototype.canMultisampleFramebuffer = function (framebuffer) {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n };\n /**\n * Detects number of samples that is not more than a param but as close to it as possible\n *\n * @param {PIXI.MSAA_QUALITY} samples - number of samples\n * @returns {PIXI.MSAA_QUALITY} - recommended number of samples\n */\n FramebufferSystem.prototype.detectSamples = function (samples) {\n var msaaSamples = this.msaaSamples;\n var res = MSAA_QUALITY.NONE;\n if (samples <= 1 || msaaSamples === null) {\n return res;\n }\n for (var i = 0; i < msaaSamples.length; i++) {\n if (msaaSamples[i] <= samples) {\n res = msaaSamples[i];\n break;\n }\n }\n if (res === 1) {\n res = MSAA_QUALITY.NONE;\n }\n return res;\n };\n /**\n * Only works with WebGL2\n *\n * blits framebuffer to another of the same or bigger size\n * after that target framebuffer is bound\n *\n * Fails with WebGL warning if blits multisample framebuffer to different size\n *\n * @param {PIXI.Framebuffer} [framebuffer] - by default it blits \"into itself\", from renderBuffer to texture.\n * @param {PIXI.Rectangle} [sourcePixels] - source rectangle in pixels\n * @param {PIXI.Rectangle} [destPixels] - dest rectangle in pixels, assumed to be the same as sourcePixels\n */\n FramebufferSystem.prototype.blit = function (framebuffer, sourcePixels, destPixels) {\n var _a = this, current = _a.current, renderer = _a.renderer, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID;\n if (renderer.context.webGLVersion !== 2) {\n return;\n }\n if (!current) {\n return;\n }\n var fbo = current.glFramebuffers[CONTEXT_UID];\n if (!fbo) {\n return;\n }\n if (!framebuffer) {\n if (!fbo.msaaBuffer) {\n return;\n }\n var colorTexture = current.colorTextures[0];\n if (!colorTexture) {\n return;\n }\n if (!fbo.blitFramebuffer) {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n framebuffer = fbo.blitFramebuffer;\n if (framebuffer.colorTextures[0] !== colorTexture) {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n if (framebuffer.width !== current.width || framebuffer.height !== current.height) {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n if (!sourcePixels) {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels) {\n destPixels = sourcePixels;\n }\n var sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height, destPixels.x, destPixels.y, destPixels.width, destPixels.height, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR);\n };\n /**\n * Disposes framebuffer\n * @param {PIXI.Framebuffer} framebuffer - framebuffer that has to be disposed of\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n FramebufferSystem.prototype.disposeFramebuffer = function (framebuffer, contextLost) {\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n var gl = this.gl;\n if (!fbo) {\n return;\n }\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n var index = this.managedFramebuffers.indexOf(framebuffer);\n if (index >= 0) {\n this.managedFramebuffers.splice(index, 1);\n }\n framebuffer.disposeRunner.remove(this);\n if (!contextLost) {\n gl.deleteFramebuffer(fbo.framebuffer);\n if (fbo.msaaBuffer) {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n if (fbo.stencil) {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n if (fbo.blitFramebuffer) {\n fbo.blitFramebuffer.dispose();\n }\n };\n /**\n * Disposes all framebuffers, but not textures bound to them\n * @param {boolean} [contextLost=false] - If context was lost, we suppress all delete function calls\n */\n FramebufferSystem.prototype.disposeAll = function (contextLost) {\n var list = this.managedFramebuffers;\n this.managedFramebuffers = [];\n for (var i = 0; i < list.length; i++) {\n this.disposeFramebuffer(list[i], contextLost);\n }\n };\n /**\n * Forcing creation of stencil buffer for current framebuffer, if it wasn't done before.\n * Used by MaskSystem, when its time to use stencil mask for Graphics element.\n *\n * Its an alternative for public lazy `framebuffer.enableStencil`, in case we need stencil without rebind.\n *\n * @private\n */\n FramebufferSystem.prototype.forceStencil = function () {\n var framebuffer = this.current;\n if (!framebuffer) {\n return;\n }\n var fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n if (!fbo || fbo.stencil) {\n return;\n }\n framebuffer.stencil = true;\n var w = framebuffer.width;\n var h = framebuffer.height;\n var gl = this.gl;\n var stencil = gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n if (fbo.msaaBuffer) {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n };\n /**\n * resets framebuffer stored state, binds screen framebuffer\n *\n * should be called before renderTexture reset()\n */\n FramebufferSystem.prototype.reset = function () {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n };\n /**\n * @ignore\n */\n FramebufferSystem.prototype.destroy = function () {\n this.renderer = null;\n };\n return FramebufferSystem;\n}());\n\nvar byteSizeMap$1 = { 5126: 4, 5123: 2, 5121: 1 };\n/**\n * System plugin to the renderer to manage geometry.\n *\n * @memberof PIXI\n */\nvar GeometrySystem = /** @class */ (function () {\n /** @param renderer - The renderer this System works for. */\n function GeometrySystem(renderer) {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n /** Sets up the renderer context and necessary buffers. */\n GeometrySystem.prototype.contextChange = function () {\n this.disposeAll(true);\n var gl = this.gl = this.renderer.gl;\n var context = this.renderer.context;\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n // webgl2\n if (context.webGLVersion !== 2) {\n // webgl 1!\n var nativeVaoExtension_1 = this.renderer.context.extensions.vertexArrayObject;\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY) {\n nativeVaoExtension_1 = null;\n }\n if (nativeVaoExtension_1) {\n gl.createVertexArray = function () {\n return nativeVaoExtension_1.createVertexArrayOES();\n };\n gl.bindVertexArray = function (vao) {\n return nativeVaoExtension_1.bindVertexArrayOES(vao);\n };\n gl.deleteVertexArray = function (vao) {\n return nativeVaoExtension_1.deleteVertexArrayOES(vao);\n };\n }\n else {\n this.hasVao = false;\n gl.createVertexArray = function () {\n return null;\n };\n gl.bindVertexArray = function () {\n return null;\n };\n gl.deleteVertexArray = function () {\n return null;\n };\n }\n }\n if (context.webGLVersion !== 2) {\n var instanceExt_1 = gl.getExtension('ANGLE_instanced_arrays');\n if (instanceExt_1) {\n gl.vertexAttribDivisor = function (a, b) {\n return instanceExt_1.vertexAttribDivisorANGLE(a, b);\n };\n gl.drawElementsInstanced = function (a, b, c, d, e) {\n return instanceExt_1.drawElementsInstancedANGLE(a, b, c, d, e);\n };\n gl.drawArraysInstanced = function (a, b, c, d) {\n return instanceExt_1.drawArraysInstancedANGLE(a, b, c, d);\n };\n }\n else {\n this.hasInstance = false;\n }\n }\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n };\n /**\n * Binds geometry so that is can be drawn. Creating a Vao if required\n *\n * @param geometry - Instance of geometry to bind.\n * @param shader - Instance of shader to use vao for.\n */\n GeometrySystem.prototype.bind = function (geometry, shader) {\n shader = shader || this.renderer.shader.shader;\n var gl = this.gl;\n // not sure the best way to address this..\n // currently different shaders require different VAOs for the same geometry\n // Still mulling over the best way to solve this one..\n // will likely need to modify the shader attribute locations at run time!\n var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n var incRefCount = false;\n if (!vaos) {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n var vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n this._activeGeometry = geometry;\n if (this._activeVao !== vao) {\n this._activeVao = vao;\n if (this.hasVao) {\n gl.bindVertexArray(vao);\n }\n else {\n this.activateVao(geometry, shader.program);\n }\n }\n // TODO - optimise later!\n // don't need to loop through if nothing changed!\n // maybe look to add an 'autoupdate' to geometry?\n this.updateBuffers();\n };\n /** Reset and unbind any active VAO and geometry. */\n GeometrySystem.prototype.reset = function () {\n this.unbind();\n };\n /** Update buffers of the currently bound geometry. */\n GeometrySystem.prototype.updateBuffers = function () {\n var geometry = this._activeGeometry;\n var bufferSystem = this.renderer.buffer;\n for (var i = 0; i < geometry.buffers.length; i++) {\n var buffer = geometry.buffers[i];\n bufferSystem.update(buffer);\n }\n };\n /**\n * Check compatibility between a geometry and a program\n *\n * @param geometry - Geometry instance.\n * @param program - Program instance.\n */\n GeometrySystem.prototype.checkCompatibility = function (geometry, program) {\n // geometry must have at least all the attributes that the shader requires.\n var geometryAttributes = geometry.attributes;\n var shaderAttributes = program.attributeData;\n for (var j in shaderAttributes) {\n if (!geometryAttributes[j]) {\n throw new Error(\"shader and geometry incompatible, geometry missing the \\\"\" + j + \"\\\" attribute\");\n }\n }\n };\n /**\n * Takes a geometry and program and generates a unique signature for them.\n *\n * @param geometry - To get signature from.\n * @param program - To test geometry against.\n * @return - Unique signature of the geometry and program\n */\n GeometrySystem.prototype.getSignature = function (geometry, program) {\n var attribs = geometry.attributes;\n var shaderAttributes = program.attributeData;\n var strings = ['g', geometry.id];\n for (var i in attribs) {\n if (shaderAttributes[i]) {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n return strings.join('-');\n };\n /**\n * Creates or gets Vao with the same structure as the geometry and stores it on the geometry.\n * If vao is created, it is bound automatically. We use a shader to infer what and how to set up the\n * attribute locations.\n *\n * @param geometry - Instance of geometry to to generate Vao for.\n * @param shader - Instance of the shader.\n * @param incRefCount - Increment refCount of all geometry buffers.\n */\n GeometrySystem.prototype.initGeometryVao = function (geometry, shader, incRefCount) {\n if (incRefCount === void 0) { incRefCount = true; }\n var gl = this.gl;\n var CONTEXT_UID = this.CONTEXT_UID;\n var bufferSystem = this.renderer.buffer;\n var program = shader.program;\n if (!program.glPrograms[CONTEXT_UID]) {\n this.renderer.shader.generateProgram(shader);\n }\n this.checkCompatibility(geometry, program);\n var signature = this.getSignature(geometry, program);\n var vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n var vao = vaoObjectHash[signature];\n if (vao) {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n return vao;\n }\n var buffers = geometry.buffers;\n var attributes = geometry.attributes;\n var tempStride = {};\n var tempStart = {};\n for (var j in buffers) {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n for (var j in attributes) {\n if (!attributes[j].size && program.attributeData[j]) {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size) {\n console.warn(\"PIXI Geometry attribute '\" + j + \"' size cannot be determined (likely the bound shader does not have the attribute)\"); // eslint-disable-line\n }\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap$1[attributes[j].type];\n }\n for (var j in attributes) {\n var attribute = attributes[j];\n var attribSize = attribute.size;\n if (attribute.stride === undefined) {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap$1[attribute.type]) {\n attribute.stride = 0;\n }\n else {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n if (attribute.start === undefined) {\n attribute.start = tempStart[attribute.buffer];\n tempStart[attribute.buffer] += attribSize * byteSizeMap$1[attribute.type];\n }\n }\n vao = gl.createVertexArray();\n gl.bindVertexArray(vao);\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (var i = 0; i < buffers.length; i++) {\n var buffer = buffers[i];\n bufferSystem.bind(buffer);\n if (incRefCount) {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n this.activateVao(geometry, program);\n this._activeVao = vao;\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n return vao;\n };\n /**\n * Disposes geometry.\n *\n * @param geometry - Geometry with buffers. Only VAO will be disposed\n * @param [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n GeometrySystem.prototype.disposeGeometry = function (geometry, contextLost) {\n var _a;\n if (!this.managedGeometries[geometry.id]) {\n return;\n }\n delete this.managedGeometries[geometry.id];\n var vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n var gl = this.gl;\n var buffers = geometry.buffers;\n var bufferSystem = (_a = this.renderer) === null || _a === void 0 ? void 0 : _a.buffer;\n geometry.disposeRunner.remove(this);\n if (!vaos) {\n return;\n }\n // bufferSystem may have already been destroyed..\n // if this is the case, there is no need to destroy the geometry buffers...\n // they already have been!\n if (bufferSystem) {\n for (var i = 0; i < buffers.length; i++) {\n var buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n // my be null as context may have changed right before the dispose is called\n if (buf) {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost) {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n if (!contextLost) {\n for (var vaoId in vaos) {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g') {\n var vao = vaos[vaoId];\n if (this._activeVao === vao) {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n };\n /**\n * Dispose all WebGL resources of all managed geometries.\n *\n * @param [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n GeometrySystem.prototype.disposeAll = function (contextLost) {\n var all = Object.keys(this.managedGeometries);\n for (var i = 0; i < all.length; i++) {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n };\n /**\n * Activate vertex array object.\n *\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n GeometrySystem.prototype.activateVao = function (geometry, program) {\n var gl = this.gl;\n var CONTEXT_UID = this.CONTEXT_UID;\n var bufferSystem = this.renderer.buffer;\n var buffers = geometry.buffers;\n var attributes = geometry.attributes;\n if (geometry.indexBuffer) {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n var lastBuffer = null;\n // add a new one!\n for (var j in attributes) {\n var attribute = attributes[j];\n var buffer = buffers[attribute.buffer];\n var glBuffer = buffer._glBuffers[CONTEXT_UID];\n if (program.attributeData[j]) {\n if (lastBuffer !== glBuffer) {\n bufferSystem.bind(buffer);\n lastBuffer = glBuffer;\n }\n var location = program.attributeData[j].location;\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n gl.vertexAttribPointer(location, attribute.size, attribute.type || gl.FLOAT, attribute.normalized, attribute.stride, attribute.start);\n if (attribute.instance) {\n // TODO calculate instance count based of this...\n if (this.hasInstance) {\n gl.vertexAttribDivisor(location, 1);\n }\n else {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\n }\n }\n }\n };\n /**\n * Draws the currently bound geometry.\n *\n * @param type - The type primitive to render.\n * @param size - The number of elements to be rendered. If not specified, all vertices after the\n * starting vertex will be drawn.\n * @param start - The starting vertex in the geometry to start drawing from. If not specified,\n * drawing will start from the first vertex.\n * @param instanceCount - The number of instances of the set of elements to execute. If not specified,\n * all instances will be drawn.\n */\n GeometrySystem.prototype.draw = function (type, size, start, instanceCount) {\n var gl = this.gl;\n var geometry = this._activeGeometry;\n // TODO.. this should not change so maybe cache the function?\n if (geometry.indexBuffer) {\n var byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n var glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex)) {\n if (geometry.instanced) {\n /* eslint-disable max-len */\n gl.drawElementsInstanced(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize, instanceCount || 1);\n /* eslint-enable max-len */\n }\n else {\n /* eslint-disable max-len */\n gl.drawElements(type, size || geometry.indexBuffer.data.length, glType, (start || 0) * byteSize);\n /* eslint-enable max-len */\n }\n }\n else {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced) {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n return this;\n };\n /** Unbind/reset everything. */\n GeometrySystem.prototype.unbind = function () {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n };\n GeometrySystem.prototype.destroy = function () {\n this.renderer = null;\n };\n return GeometrySystem;\n}());\n\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n *\n * @memberof PIXI\n */\nvar MaskData = /** @class */ (function () {\n /**\n * Create MaskData\n *\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n function MaskData(maskObject) {\n if (maskObject === void 0) { maskObject = null; }\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n this.maskObject = maskObject || null;\n this.pooled = false;\n this.isMaskData = true;\n this.resolution = null;\n this.multisample = settings.FILTER_MULTISAMPLE;\n this.enabled = true;\n this._filters = null;\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n this._scissorRectLocal = null;\n this._target = null;\n }\n Object.defineProperty(MaskData.prototype, \"filter\", {\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get: function () {\n return this._filters ? this._filters[0] : null;\n },\n set: function (value) {\n if (value) {\n if (this._filters) {\n this._filters[0] = value;\n }\n else {\n this._filters = [value];\n }\n }\n else {\n this._filters = null;\n }\n },\n enumerable: false,\n configurable: true\n });\n /** Resets the mask data after popMask(). */\n MaskData.prototype.reset = function () {\n if (this.pooled) {\n this.maskObject = null;\n this.type = MASK_TYPES.NONE;\n this.autoDetect = true;\n }\n this._target = null;\n this._scissorRectLocal = null;\n };\n /** Copies counters from maskData above, called from pushMask(). */\n MaskData.prototype.copyCountersOrReset = function (maskAbove) {\n if (maskAbove) {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\n };\n return MaskData;\n}());\n\n/**\n * @private\n * @param {WebGLRenderingContext} gl - The current WebGL context {WebGLProgram}\n * @param {Number} type - the type, can be either VERTEX_SHADER or FRAGMENT_SHADER\n * @param {string} src - The vertex shader source as an array of strings.\n * @return {WebGLShader} the shader\n */\nfunction compileShader(gl, type, src) {\n var shader = gl.createShader(type);\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n return shader;\n}\n\n/**\n * will log a shader error highlighting the lines with the error\n * also will add numbers along the side.\n *\n * @param gl - the WebGLContext\n * @param shader - the shader to log errors for\n */\nfunction logPrettyShaderError(gl, shader) {\n var shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map(function (line, index) { return index + \": \" + line; });\n var shaderLog = gl.getShaderInfoLog(shader);\n var splitShader = shaderLog.split('\\n');\n var dedupe = {};\n var lineNumbers = splitShader.map(function (line) { return parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')); })\n .filter(function (n) {\n if (n && !dedupe[n]) {\n dedupe[n] = true;\n return true;\n }\n return false;\n });\n var logArgs = [''];\n lineNumbers.forEach(function (number) {\n shaderSrc[number - 1] = \"%c\" + shaderSrc[number - 1] + \"%c\";\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n var fragmentSourceToLog = shaderSrc\n .join('\\n');\n logArgs[0] = fragmentSourceToLog;\n console.error(shaderLog);\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn.apply(console, logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\n/**\n *\n * logs out any program errors\n *\n * @param gl - The current WebGL context\n * @param program - the WebGL program to display errors for\n * @param vertexShader - the fragment WebGL shader program\n * @param fragmentShader - the vertex WebGL shader program\n */\nfunction logProgramError(gl, program, vertexShader, fragmentShader) {\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {\n logPrettyShaderError(gl, vertexShader);\n }\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {\n logPrettyShaderError(gl, fragmentShader);\n }\n console.error('PixiJS Error: Could not initialize shader.');\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '') {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n\nfunction booleanArray(size) {\n var array = new Array(size);\n for (var i = 0; i < array.length; i++) {\n array[i] = false;\n }\n return array;\n}\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nfunction defaultValue(type, size) {\n switch (type) {\n case 'float':\n return 0;\n case 'vec2':\n return new Float32Array(2 * size);\n case 'vec3':\n return new Float32Array(3 * size);\n case 'vec4':\n return new Float32Array(4 * size);\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n case 'ivec2':\n return new Int32Array(2 * size);\n case 'ivec3':\n return new Int32Array(3 * size);\n case 'ivec4':\n return new Int32Array(4 * size);\n case 'uvec2':\n return new Uint32Array(2 * size);\n case 'uvec3':\n return new Uint32Array(3 * size);\n case 'uvec4':\n return new Uint32Array(4 * size);\n case 'bool':\n return false;\n case 'bvec2':\n return booleanArray(2 * size);\n case 'bvec3':\n return booleanArray(3 * size);\n case 'bvec4':\n return booleanArray(4 * size);\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n case 'mat4':\n return new Float32Array([1, 0, 0, 0,\n 0, 1, 0, 0,\n 0, 0, 1, 0,\n 0, 0, 0, 1]);\n }\n return null;\n}\n\nvar unknownContext = {};\nvar context = unknownContext;\n/**\n * returns a little WebGL context to use for program inspection.\n *\n * @static\n * @private\n * @returns {WebGLRenderingContext} a gl context to test with\n */\nfunction getTestContext() {\n if (context === unknownContext || (context && context.isContextLost())) {\n var canvas = document.createElement('canvas');\n var gl = void 0;\n if (settings.PREFER_ENV >= ENV.WEBGL2) {\n gl = canvas.getContext('webgl2', {});\n }\n if (!gl) {\n gl = canvas.getContext('webgl', {})\n || canvas.getContext('experimental-webgl', {});\n if (!gl) {\n // fail, not able to get a context\n gl = null;\n }\n else {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n context = gl;\n }\n return context;\n}\n\nvar maxFragmentPrecision;\nfunction getMaxFragmentPrecision() {\n if (!maxFragmentPrecision) {\n maxFragmentPrecision = PRECISION.MEDIUM;\n var gl = getTestContext();\n if (gl) {\n if (gl.getShaderPrecisionFormat) {\n var shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n return maxFragmentPrecision;\n}\n\n/**\n * Sets the float precision on the shader, ensuring the device supports the request precision.\n * If the precision is already present, it just ensures that the device is able to handle it.\n *\n * @private\n * @param {string} src - The shader source\n * @param {PIXI.PRECISION} requestedPrecision - The request float precision of the shader.\n * @param {PIXI.PRECISION} maxSupportedPrecision - The maximum precision the shader supports.\n *\n * @return {string} modified shader source\n */\nfunction setPrecision(src, requestedPrecision, maxSupportedPrecision) {\n if (src.substring(0, 9) !== 'precision') {\n // no precision supplied, so PixiJS will add the requested level.\n var precision = requestedPrecision;\n // If highp is requested but not supported, downgrade precision to a level all devices support.\n if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH) {\n precision = PRECISION.MEDIUM;\n }\n return \"precision \" + precision + \" float;\\n\" + src;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp') {\n // precision was supplied, but at a level this device does not support, so downgrading to mediump.\n return src.replace('precision highp', 'precision mediump');\n }\n return src;\n}\n\nvar GLSL_TO_SIZE = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 4,\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n mat2: 4,\n mat3: 9,\n mat4: 16,\n sampler2D: 1,\n};\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {String} type\n * @return {Number}\n */\nfunction mapSize(type) {\n return GLSL_TO_SIZE[type];\n}\n\nvar GL_TABLE = null;\nvar GL_TO_GLSL_TYPES = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n SAMPLER_2D: 'sampler2D',\n INT_SAMPLER_2D: 'sampler2D',\n UNSIGNED_INT_SAMPLER_2D: 'sampler2D',\n SAMPLER_CUBE: 'samplerCube',\n INT_SAMPLER_CUBE: 'samplerCube',\n UNSIGNED_INT_SAMPLER_CUBE: 'samplerCube',\n SAMPLER_2D_ARRAY: 'sampler2DArray',\n INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n UNSIGNED_INT_SAMPLER_2D_ARRAY: 'sampler2DArray',\n};\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction mapType(gl, type) {\n if (!GL_TABLE) {\n var typeNames = Object.keys(GL_TO_GLSL_TYPES);\n GL_TABLE = {};\n for (var i = 0; i < typeNames.length; ++i) {\n var tn = typeNames[i];\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n return GL_TABLE[type];\n}\n\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n// Parsers, each one of these will take a look at the type of shader property and uniform.\n// if they pass the test function then the code function is called that returns a the shader upload code for that uniform.\n// Shader upload code is automagically generated with these parsers.\n// If no parser is valid then the default upload functions are used.\n// exposing Parsers means that custom upload logic can be added to pixi's shaders.\n// A good example would be a pixi rectangle can be directly set on a uniform.\n// If the shader sees it it knows how to upload the rectangle structure as a vec4\n// format is as follows:\n//\n// {\n// test: (data, uniform) => {} <--- test is this code should be used for this uniform\n// code: (name, uniform) => {} <--- returns the string of the piece of code that uploads the uniform\n// codeUbo: (name, uniform) => {} <--- returns the string of the piece of code that uploads the\n// uniform to a uniform buffer\n// }\nvar uniformParsers = [\n // a float cache layer\n {\n test: function (data) {\n return data.type === 'float' && data.size === 1;\n },\n code: function (name) {\n return \"\\n if(uv[\\\"\" + name + \"\\\"] !== ud[\\\"\" + name + \"\\\"].value)\\n {\\n ud[\\\"\" + name + \"\\\"].value = uv[\\\"\" + name + \"\\\"]\\n gl.uniform1f(ud[\\\"\" + name + \"\\\"].location, uv[\\\"\" + name + \"\\\"])\\n }\\n \";\n },\n },\n // handling samplers\n {\n test: function (data) {\n // eslint-disable-next-line max-len\n return (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray;\n },\n code: function (name) { return \"t = syncData.textureCount++;\\n\\n renderer.texture.bind(uv[\\\"\" + name + \"\\\"], t);\\n\\n if(ud[\\\"\" + name + \"\\\"].value !== t)\\n {\\n ud[\\\"\" + name + \"\\\"].value = t;\\n gl.uniform1i(ud[\\\"\" + name + \"\\\"].location, t);\\n; // eslint-disable-line max-len\\n }\"; },\n },\n // uploading pixi matrix object to mat3\n {\n test: function (data, uniform) {\n return data.type === 'mat3' && data.size === 1 && uniform.a !== undefined;\n },\n code: function (name) {\n // TODO and some smart caching dirty ids here!\n return \"\\n gl.uniformMatrix3fv(ud[\\\"\" + name + \"\\\"].location, false, uv[\\\"\" + name + \"\\\"].toArray(true));\\n \";\n },\n codeUbo: function (name) {\n return \"\\n var \" + name + \"_matrix = uv.\" + name + \".toArray(true);\\n\\n data[offset] = \" + name + \"_matrix[0];\\n data[offset+1] = \" + name + \"_matrix[1];\\n data[offset+2] = \" + name + \"_matrix[2];\\n \\n data[offset + 4] = \" + name + \"_matrix[3];\\n data[offset + 5] = \" + name + \"_matrix[4];\\n data[offset + 6] = \" + name + \"_matrix[5];\\n \\n data[offset + 8] = \" + name + \"_matrix[6];\\n data[offset + 9] = \" + name + \"_matrix[7];\\n data[offset + 10] = \" + name + \"_matrix[8];\\n \";\n },\n },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: function (data, uniform) {\n return data.type === 'vec2' && data.size === 1 && uniform.x !== undefined;\n },\n code: function (name) {\n return \"\\n cv = ud[\\\"\" + name + \"\\\"].value;\\n v = uv[\\\"\" + name + \"\\\"];\\n\\n if(cv[0] !== v.x || cv[1] !== v.y)\\n {\\n cv[0] = v.x;\\n cv[1] = v.y;\\n gl.uniform2f(ud[\\\"\" + name + \"\\\"].location, v.x, v.y);\\n }\";\n },\n codeUbo: function (name) {\n return \"\\n v = uv.\" + name + \";\\n\\n data[offset] = v.x;\\n data[offset+1] = v.y;\\n \";\n }\n },\n // caching layer for a vec2\n {\n test: function (data) {\n return data.type === 'vec2' && data.size === 1;\n },\n code: function (name) {\n return \"\\n cv = ud[\\\"\" + name + \"\\\"].value;\\n v = uv[\\\"\" + name + \"\\\"];\\n\\n if(cv[0] !== v[0] || cv[1] !== v[1])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n gl.uniform2f(ud[\\\"\" + name + \"\\\"].location, v[0], v[1]);\\n }\\n \";\n },\n },\n // upload a pixi rectangle as a vec4 with caching layer\n {\n test: function (data, uniform) {\n return data.type === 'vec4' && data.size === 1 && uniform.width !== undefined;\n },\n code: function (name) {\n return \"\\n cv = ud[\\\"\" + name + \"\\\"].value;\\n v = uv[\\\"\" + name + \"\\\"];\\n\\n if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)\\n {\\n cv[0] = v.x;\\n cv[1] = v.y;\\n cv[2] = v.width;\\n cv[3] = v.height;\\n gl.uniform4f(ud[\\\"\" + name + \"\\\"].location, v.x, v.y, v.width, v.height)\\n }\";\n },\n codeUbo: function (name) {\n return \"\\n v = uv.\" + name + \";\\n\\n data[offset] = v.x;\\n data[offset+1] = v.y;\\n data[offset+2] = v.width;\\n data[offset+3] = v.height;\\n \";\n }\n },\n // a caching layer for vec4 uploading\n {\n test: function (data) {\n return data.type === 'vec4' && data.size === 1;\n },\n code: function (name) {\n return \"\\n cv = ud[\\\"\" + name + \"\\\"].value;\\n v = uv[\\\"\" + name + \"\\\"];\\n\\n if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n cv[3] = v[3];\\n\\n gl.uniform4f(ud[\\\"\" + name + \"\\\"].location, v[0], v[1], v[2], v[3])\\n }\";\n },\n } ];\n\n// cu = Cached value's uniform data field\n// cv = Cached value\n// v = value to upload\n// ud = uniformData\n// uv = uniformValue\n// l = location\nvar GLSL_TO_SINGLE_SETTERS_CACHED = {\n float: \"\\n if (cv !== v)\\n {\\n cu.value = v;\\n gl.uniform1f(location, v);\\n }\",\n vec2: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n\\n gl.uniform2f(location, v[0], v[1])\\n }\",\n vec3: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n\\n gl.uniform3f(location, v[0], v[1], v[2])\\n }\",\n vec4: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n cv[3] = v[3];\\n\\n gl.uniform4f(location, v[0], v[1], v[2], v[3]);\\n }\",\n int: \"\\n if (cv !== v)\\n {\\n cu.value = v;\\n\\n gl.uniform1i(location, v);\\n }\",\n ivec2: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n\\n gl.uniform2i(location, v[0], v[1]);\\n }\",\n ivec3: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n\\n gl.uniform3i(location, v[0], v[1], v[2]);\\n }\",\n ivec4: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n cv[3] = v[3];\\n\\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\\n }\",\n uint: \"\\n if (cv !== v)\\n {\\n cu.value = v;\\n\\n gl.uniform1ui(location, v);\\n }\",\n uvec2: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n\\n gl.uniform2ui(location, v[0], v[1]);\\n }\",\n uvec3: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n\\n gl.uniform3ui(location, v[0], v[1], v[2]);\\n }\",\n uvec4: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n cv[3] = v[3];\\n\\n gl.uniform4ui(location, v[0], v[1], v[2], v[3]);\\n }\",\n bool: \"\\n if (cv !== v)\\n {\\n cu.value = v;\\n gl.uniform1i(location, v);\\n }\",\n bvec2: \"\\n if (cv[0] != v[0] || cv[1] != v[1])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n\\n gl.uniform2i(location, v[0], v[1]);\\n }\",\n bvec3: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n\\n gl.uniform3i(location, v[0], v[1], v[2]);\\n }\",\n bvec4: \"\\n if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])\\n {\\n cv[0] = v[0];\\n cv[1] = v[1];\\n cv[2] = v[2];\\n cv[3] = v[3];\\n\\n gl.uniform4i(location, v[0], v[1], v[2], v[3]);\\n }\",\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n sampler2D: 'gl.uniform1i(location, v)',\n samplerCube: 'gl.uniform1i(location, v)',\n sampler2DArray: 'gl.uniform1i(location, v)',\n};\nvar GLSL_TO_ARRAY_SETTERS = {\n float: \"gl.uniform1fv(location, v)\",\n vec2: \"gl.uniform2fv(location, v)\",\n vec3: \"gl.uniform3fv(location, v)\",\n vec4: 'gl.uniform4fv(location, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n int: 'gl.uniform1iv(location, v)',\n ivec2: 'gl.uniform2iv(location, v)',\n ivec3: 'gl.uniform3iv(location, v)',\n ivec4: 'gl.uniform4iv(location, v)',\n uint: 'gl.uniform1uiv(location, v)',\n uvec2: 'gl.uniform2uiv(location, v)',\n uvec3: 'gl.uniform3uiv(location, v)',\n uvec4: 'gl.uniform4uiv(location, v)',\n bool: 'gl.uniform1iv(location, v)',\n bvec2: 'gl.uniform2iv(location, v)',\n bvec3: 'gl.uniform3iv(location, v)',\n bvec4: 'gl.uniform4iv(location, v)',\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\nfunction generateUniformsSync(group, uniformData) {\n var _a;\n var funcFragments = [\"\\n var v = null;\\n var cv = null;\\n var cu = null;\\n var t = 0;\\n var gl = renderer.gl;\\n \"];\n for (var i in group.uniforms) {\n var data = uniformData[i];\n if (!data) {\n if ((_a = group.uniforms[i]) === null || _a === void 0 ? void 0 : _a.group) {\n if (group.uniforms[i].ubo) {\n funcFragments.push(\"\\n renderer.shader.syncUniformBufferGroup(uv.\" + i + \", '\" + i + \"');\\n \");\n }\n else {\n funcFragments.push(\"\\n renderer.shader.syncUniformGroup(uv.\" + i + \", syncData);\\n \");\n }\n }\n continue;\n }\n var uniform = group.uniforms[i];\n var parsed = false;\n for (var j = 0; j < uniformParsers.length; j++) {\n if (uniformParsers[j].test(data, uniform)) {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n break;\n }\n }\n if (!parsed) {\n var templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n var template = templateType[data.type].replace('location', \"ud[\\\"\" + i + \"\\\"].location\");\n funcFragments.push(\"\\n cu = ud[\\\"\" + i + \"\\\"];\\n cv = cu.value;\\n v = uv[\\\"\" + i + \"\\\"];\\n \" + template + \";\");\n }\n }\n /*\n * the introduction of syncData is to solve an issue where textures in uniform groups are not set correctly\n * the texture count was always starting from 0 in each group. This needs to increment each time a texture is used\n * no matter which group is being used\n *\n */\n // eslint-disable-next-line no-new-func\n return new Function('ud', 'uv', 'renderer', 'syncData', funcFragments.join('\\n'));\n}\n\nvar fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}' ].join('\\n');\nfunction generateIfTestSrc(maxIfs) {\n var src = '';\n for (var i = 0; i < maxIfs; ++i) {\n if (i > 0) {\n src += '\\nelse ';\n }\n if (i < maxIfs - 1) {\n src += \"if(test == \" + i + \".0){}\";\n }\n }\n return src;\n}\nfunction checkMaxIfStatementsInShader(maxIfs, gl) {\n if (maxIfs === 0) {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n var shader = gl.createShader(gl.FRAGMENT_SHADER);\n while (true) // eslint-disable-line no-constant-condition\n {\n var fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n maxIfs = (maxIfs / 2) | 0;\n }\n else {\n // valid!\n break;\n }\n }\n return maxIfs;\n}\n\n// Cache the result to prevent running this over and over\nvar unsafeEval;\n/**\n * Not all platforms allow to generate function code (e.g., `new Function`).\n * this provides the platform-level detection.\n *\n * @private\n * @returns {boolean}\n */\nfunction unsafeEvalSupported() {\n if (typeof unsafeEval === 'boolean') {\n return unsafeEval;\n }\n try {\n /* eslint-disable no-new-func */\n var func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e) {\n unsafeEval = false;\n }\n return unsafeEval;\n}\n\nvar defaultFragment = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor *= texture2D(uSampler, vTextureCoord);\\n}\";\n\nvar defaultVertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void){\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n vTextureCoord = aTextureCoord;\\n}\\n\";\n\nvar UID$3 = 0;\nvar nameCache = {};\n/**\n * Helper class to create a shader program.\n *\n * @memberof PIXI\n */\nvar Program = /** @class */ (function () {\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n */\n function Program(vertexSrc, fragmentSrc, name) {\n if (name === void 0) { name = 'pixi-shader'; }\n this.id = UID$3++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n if (this.vertexSrc.substring(0, 8) !== '#version') {\n name = name.replace(/\\s+/g, '-');\n if (nameCache[name]) {\n nameCache[name]++;\n name += \"-\" + nameCache[name];\n }\n else {\n nameCache[name] = 1;\n }\n this.vertexSrc = \"#define SHADER_NAME \" + name + \"\\n\" + this.vertexSrc;\n this.fragmentSrc = \"#define SHADER_NAME \" + name + \"\\n\" + this.fragmentSrc;\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n this.syncUniforms = null;\n }\n Object.defineProperty(Program, \"defaultVertexSrc\", {\n /**\n * The default vertex shader source.\n *\n * @constant\n */\n get: function () {\n return defaultVertex;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Program, \"defaultFragmentSrc\", {\n /**\n * The default fragment shader source.\n *\n * @constant\n */\n get: function () {\n return defaultFragment;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * A short hand function to create a program based of a vertex and fragment shader.\n *\n * This method will also check to see if there is a cached program.\n *\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param name - Name for shader\n * @returns A shiny new PixiJS shader program!\n */\n Program.from = function (vertexSrc, fragmentSrc, name) {\n var key = vertexSrc + fragmentSrc;\n var program = ProgramCache[key];\n if (!program) {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n return program;\n };\n return Program;\n}());\n\n/**\n * A helper class for shaders.\n *\n * @memberof PIXI\n */\nvar Shader = /** @class */ (function () {\n /**\n * @param program - The program the shader will use.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n function Shader(program, uniforms) {\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n this.uniformBindCount = 0;\n this.program = program;\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms) {\n if (uniforms instanceof UniformGroup) {\n this.uniformGroup = uniforms;\n }\n else {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else {\n this.uniformGroup = new UniformGroup({});\n }\n }\n // TODO move to shader system..\n Shader.prototype.checkUniformExists = function (name, group) {\n if (group.uniforms[name]) {\n return true;\n }\n for (var i in group.uniforms) {\n var uniform = group.uniforms[i];\n if (uniform.group) {\n if (this.checkUniformExists(name, uniform)) {\n return true;\n }\n }\n }\n return false;\n };\n Shader.prototype.destroy = function () {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n };\n Object.defineProperty(Shader.prototype, \"uniforms\", {\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n *\n * @readonly\n */\n get: function () {\n return this.uniformGroup.uniforms;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * A short hand function to create a shader based of a vertex and fragment shader.\n *\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n * @returns A shiny new PixiJS shader!\n */\n Shader.from = function (vertexSrc, fragmentSrc, uniforms) {\n var program = Program.from(vertexSrc, fragmentSrc);\n return new Shader(program, uniforms);\n };\n return Shader;\n}());\n\n/* eslint-disable max-len */\nvar BLEND = 0;\nvar OFFSET = 1;\nvar CULLING = 2;\nvar DEPTH_TEST = 3;\nvar WINDING = 4;\nvar DEPTH_MASK = 5;\n/**\n * This is a WebGL state, and is is passed to {@link PIXI.StateSystem}.\n *\n * Each mesh rendered may require WebGL to be in a different state.\n * For example you may want different blend mode or to enable polygon offsets\n *\n * @memberof PIXI\n */\nvar State = /** @class */ (function () {\n function State() {\n this.data = 0;\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n Object.defineProperty(State.prototype, \"blend\", {\n /**\n * Activates blending of the computed fragment color values.\n *\n * @default true\n */\n get: function () {\n return !!(this.data & (1 << BLEND));\n },\n set: function (value) {\n if (!!(this.data & (1 << BLEND)) !== value) {\n this.data ^= (1 << BLEND);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"offsets\", {\n /**\n * Activates adding an offset to depth values of polygon's fragments\n *\n * @default false\n */\n get: function () {\n return !!(this.data & (1 << OFFSET));\n },\n set: function (value) {\n if (!!(this.data & (1 << OFFSET)) !== value) {\n this.data ^= (1 << OFFSET);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"culling\", {\n /**\n * Activates culling of polygons.\n *\n * @default false\n */\n get: function () {\n return !!(this.data & (1 << CULLING));\n },\n set: function (value) {\n if (!!(this.data & (1 << CULLING)) !== value) {\n this.data ^= (1 << CULLING);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"depthTest\", {\n /**\n * Activates depth comparisons and updates to the depth buffer.\n *\n * @default false\n */\n get: function () {\n return !!(this.data & (1 << DEPTH_TEST));\n },\n set: function (value) {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value) {\n this.data ^= (1 << DEPTH_TEST);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"depthMask\", {\n /**\n * Enables or disables writing to the depth buffer.\n *\n * @default true\n */\n get: function () {\n return !!(this.data & (1 << DEPTH_MASK));\n },\n set: function (value) {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value) {\n this.data ^= (1 << DEPTH_MASK);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"clockwiseFrontFace\", {\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n *\n * @default false\n */\n get: function () {\n return !!(this.data & (1 << WINDING));\n },\n set: function (value) {\n if (!!(this.data & (1 << WINDING)) !== value) {\n this.data ^= (1 << WINDING);\n }\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"blendMode\", {\n /**\n * The blend mode to be applied when this state is set. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n * Setting this mode to anything other than NO_BLEND will automatically switch blending on.\n *\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get: function () {\n return this._blendMode;\n },\n set: function (value) {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(State.prototype, \"polygonOffset\", {\n /**\n * The polygon offset. Setting this property to anything other than 0 will automatically enable polygon offset fill.\n *\n * @default 0\n */\n get: function () {\n return this._polygonOffset;\n },\n set: function (value) {\n this.offsets = !!value;\n this._polygonOffset = value;\n },\n enumerable: false,\n configurable: true\n });\n State.prototype.toString = function () {\n return \"[@pixi/core:State \"\n + (\"blendMode=\" + this.blendMode + \" \")\n + (\"clockwiseFrontFace=\" + this.clockwiseFrontFace + \" \")\n + (\"culling=\" + this.culling + \" \")\n + (\"depthMask=\" + this.depthMask + \" \")\n + (\"polygonOffset=\" + this.polygonOffset)\n + \"]\";\n };\n State.for2d = function () {\n var state = new State();\n state.depthTest = false;\n state.blend = true;\n return state;\n };\n return State;\n}());\n\nvar defaultVertex$1 = \"attribute vec2 aVertexPosition;\\n\\nuniform mat3 projectionMatrix;\\n\\nvarying vec2 vTextureCoord;\\n\\nuniform vec4 inputSize;\\nuniform vec4 outputFrame;\\n\\nvec4 filterVertexPosition( void )\\n{\\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\\n\\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\\n}\\n\\nvec2 filterTextureCoord( void )\\n{\\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\\n}\\n\\nvoid main(void)\\n{\\n gl_Position = filterVertexPosition();\\n vTextureCoord = filterTextureCoord();\\n}\\n\";\n\nvar defaultFragment$1 = \"varying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\n\\nvoid main(void){\\n gl_FragColor = texture2D(uSampler, vTextureCoord);\\n}\\n\";\n\n/**\n * A filter is a special shader that applies post-processing effects to an input texture and writes into an output\n * render-target.\n *\n * {@link http://pixijs.io/examples/#/filters/blur-filter.js Example} of the\n * {@link PIXI.filters.BlurFilter BlurFilter}.\n *\n * ### Usage\n * Filters can be applied to any DisplayObject or Container.\n * PixiJS' `FilterSystem` renders the container into temporary Framebuffer,\n * then filter renders it to the screen.\n * Multiple filters can be added to the `filters` array property and stacked on each other.\n *\n * ```\n * const filter = new PIXI.Filter(myShaderVert, myShaderFrag, { myUniform: 0.5 });\n * const container = new PIXI.Container();\n * container.filters = [filter];\n * ```\n *\n * ### Previous Version Differences\n *\n * In PixiJS **v3**, a filter was always applied to _whole screen_.\n *\n * In PixiJS **v4**, a filter can be applied _only part of the screen_.\n * Developers had to create a set of uniforms to deal with coordinates.\n *\n * In PixiJS **v5** combines _both approaches_.\n * Developers can use normal coordinates of v3 and then allow filter to use partial Framebuffers,\n * bringing those extra uniforms into account.\n *\n * Also be aware that we have changed default vertex shader, please consult\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * ### Frames\n *\n * The following table summarizes the coordinate spaces used in the filtering pipeline:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
Coordinate SpaceDescription
Texture Coordinates\n * The texture (or UV) coordinates in the input base-texture's space. These are normalized into the (0,1) range along\n * both axes.\n *
World Space\n * A point in the same space as the world bounds of any display-object (i.e. in the scene graph's space).\n *
Physical Pixels\n * This is base-texture's space with the origin on the top-left. You can calculate these by multiplying the texture\n * coordinates by the dimensions of the texture.\n *
\n *\n * ### Built-in Uniforms\n *\n * PixiJS viewport uses screen (CSS) coordinates, `(0, 0, renderer.screen.width, renderer.screen.height)`,\n * and `projectionMatrix` uniform maps it to the gl viewport.\n *\n * **uSampler**\n *\n * The most important uniform is the input texture that container was rendered into.\n * _Important note: as with all Framebuffers in PixiJS, both input and output are\n * premultiplied by alpha._\n *\n * By default, input normalized coordinates are passed to fragment shader with `vTextureCoord`.\n * Use it to sample the input.\n *\n * ```\n * const fragment = `\n * varying vec2 vTextureCoord;\n * uniform sampler2D uSampler;\n * void main(void)\n * {\n * gl_FragColor = texture2D(uSampler, vTextureCoord);\n * }\n * `;\n *\n * const myFilter = new PIXI.Filter(null, fragment);\n * ```\n *\n * This filter is just one uniform less than {@link PIXI.filters.AlphaFilter AlphaFilter}.\n *\n * **outputFrame**\n *\n * The `outputFrame` holds the rectangle where filter is applied in screen (CSS) coordinates.\n * It's the same as `renderer.screen` for a fullscreen filter.\n * Only a part of `outputFrame.zw` size of temporary Framebuffer is used,\n * `(0, 0, outputFrame.width, outputFrame.height)`,\n *\n * Filters uses this quad to normalized (0-1) space, its passed into `aVertexPosition` attribute.\n * To calculate vertex position in screen space using normalized (0-1) space:\n *\n * ```\n * vec4 filterVertexPosition( void )\n * {\n * vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n * return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n * }\n * ```\n *\n * **inputSize**\n *\n * Temporary framebuffer is different, it can be either the size of screen, either power-of-two.\n * The `inputSize.xy` are size of temporary framebuffer that holds input.\n * The `inputSize.zw` is inverted, it's a shortcut to evade division inside the shader.\n *\n * Set `inputSize.xy = outputFrame.zw` for a fullscreen filter.\n *\n * To calculate input normalized coordinate, you have to map it to filter normalized space.\n * Multiply by `outputFrame.zw` to get input coordinate.\n * Divide by `inputSize.xy` to get input normalized coordinate.\n *\n * ```\n * vec2 filterTextureCoord( void )\n * {\n * return aVertexPosition * (outputFrame.zw * inputSize.zw); // same as /inputSize.xy\n * }\n * ```\n * **resolution**\n *\n * The `resolution` is the ratio of screen (CSS) pixels to real pixels.\n *\n * **inputPixel**\n *\n * `inputPixel.xy` is the size of framebuffer in real pixels, same as `inputSize.xy * resolution`\n * `inputPixel.zw` is inverted `inputPixel.xy`.\n *\n * It's handy for filters that use neighbour pixels, like {@link PIXI.filters.FXAAFilter FXAAFilter}.\n *\n * **inputClamp**\n *\n * If you try to get info from outside of used part of Framebuffer - you'll get undefined behaviour.\n * For displacements, coordinates has to be clamped.\n *\n * The `inputClamp.xy` is left-top pixel center, you may ignore it, because we use left-top part of Framebuffer\n * `inputClamp.zw` is bottom-right pixel center.\n *\n * ```\n * vec4 color = texture2D(uSampler, clamp(modifiedTextureCoord, inputClamp.xy, inputClamp.zw))\n * ```\n * OR\n * ```\n * vec4 color = texture2D(uSampler, min(modifigedTextureCoord, inputClamp.zw))\n * ```\n *\n * ### Additional Information\n *\n * Complete documentation on Filter usage is located in the\n * {@link https://github.com/pixijs/pixi.js/wiki/v5-Creating-filters Wiki}.\n *\n * Since PixiJS only had a handful of built-in filters, additional filters can be downloaded\n * {@link https://github.com/pixijs/pixi-filters here} from the PixiJS Filters repository.\n *\n * @memberof PIXI\n */\nvar Filter = /** @class */ (function (_super) {\n __extends(Filter, _super);\n /**\n * @param vertexSrc - The source of the vertex shader.\n * @param fragmentSrc - The source of the fragment shader.\n * @param uniforms - Custom uniforms to use to augment the built-in ones.\n */\n function Filter(vertexSrc, fragmentSrc, uniforms) {\n var _this = this;\n var program = Program.from(vertexSrc || Filter.defaultVertexSrc, fragmentSrc || Filter.defaultFragmentSrc);\n _this = _super.call(this, program, uniforms) || this;\n _this.padding = 0;\n _this.resolution = settings.FILTER_RESOLUTION;\n _this.multisample = settings.FILTER_MULTISAMPLE;\n _this.enabled = true;\n _this.autoFit = true;\n _this.state = new State();\n return _this;\n }\n /**\n * Applies the filter\n *\n * @param {PIXI.FilterSystem} filterManager - The renderer to retrieve the filter from\n * @param {PIXI.RenderTexture} input - The input render target.\n * @param {PIXI.RenderTexture} output - The target to output to.\n * @param {PIXI.CLEAR_MODES} [clearMode] - Should the output be cleared before rendering to it.\n * @param {object} [currentState] - It's current state of filter.\n * There are some useful properties in the currentState :\n * target, filters, sourceFrame, destinationFrame, renderTarget, resolution\n */\n Filter.prototype.apply = function (filterManager, input, output, clearMode, _currentState) {\n // do as you please!\n filterManager.applyFilter(this, input, output, clearMode);\n // or just do a regular render..\n };\n Object.defineProperty(Filter.prototype, \"blendMode\", {\n /**\n * Sets the blend mode of the filter.\n *\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get: function () {\n return this.state.blendMode;\n },\n set: function (value) {\n this.state.blendMode = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Filter.prototype, \"resolution\", {\n /**\n * The resolution of the filter. Setting this to be lower will lower the quality but\n * increase the performance of the filter.\n */\n get: function () {\n return this._resolution;\n },\n set: function (value) {\n this._resolution = value;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Filter, \"defaultVertexSrc\", {\n /**\n * The default vertex shader source\n *\n * @constant\n */\n get: function () {\n return defaultVertex$1;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(Filter, \"defaultFragmentSrc\", {\n /**\n * The default fragment shader source\n *\n * @constant\n */\n get: function () {\n return defaultFragment$1;\n },\n enumerable: false,\n configurable: true\n });\n return Filter;\n}(Shader));\n\nvar vertex = \"attribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 otherMatrix;\\n\\nvarying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\n\\nvoid main(void)\\n{\\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;\\n}\\n\";\n\nvar fragment = \"varying vec2 vMaskCoord;\\nvarying vec2 vTextureCoord;\\n\\nuniform sampler2D uSampler;\\nuniform sampler2D mask;\\nuniform float alpha;\\nuniform float npmAlpha;\\nuniform vec4 maskClamp;\\n\\nvoid main(void)\\n{\\n float clip = step(3.5,\\n step(maskClamp.x, vMaskCoord.x) +\\n step(maskClamp.y, vMaskCoord.y) +\\n step(vMaskCoord.x, maskClamp.z) +\\n step(vMaskCoord.y, maskClamp.w));\\n\\n vec4 original = texture2D(uSampler, vTextureCoord);\\n vec4 masky = texture2D(mask, vMaskCoord);\\n float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);\\n\\n original *= (alphaMul * masky.r * alpha * clip);\\n\\n gl_FragColor = original;\\n}\\n\";\n\nvar tempMat = new Matrix();\n/**\n * Class controls uv mapping from Texture normal space to BaseTexture normal space.\n *\n * Takes `trim` and `rotate` into account. May contain clamp settings for Meshes and TilingSprite.\n *\n * Can be used in Texture `uvMatrix` field, or separately, you can use different clamp settings on the same texture.\n * If you want to add support for texture region of certain feature or filter, that's what you're looking for.\n *\n * Takes track of Texture changes through `_lastTextureID` private field.\n * Use `update()` method call to track it from outside.\n *\n * @see PIXI.Texture\n * @see PIXI.Mesh\n * @see PIXI.TilingSprite\n * @class\n * @memberof PIXI\n */\nvar TextureMatrix = /** @class */ (function () {\n /**\n *\n * @param {PIXI.Texture} texture - observed texture\n * @param {number} [clampMargin] - Changes frame clamping, 0.5 by default. Use -0.5 for extra border.\n * @constructor\n */\n function TextureMatrix(texture, clampMargin) {\n this._texture = texture;\n /**\n * Matrix operation that converts texture region coords to texture coords\n * @member {PIXI.Matrix}\n * @readonly\n */\n this.mapCoord = new Matrix();\n /**\n * Clamp region for normalized coords, left-top pixel center in xy , bottom-right in zw.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampFrame = new Float32Array(4);\n /**\n * Normalized clamp offset.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampOffset = new Float32Array(2);\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._textureID = -1;\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._updateID = 0;\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to 1.5 if you texture has repeated right and bottom lines, that leads to smoother borders\n *\n * @default 0\n * @member {number}\n */\n this.clampOffset = 0;\n /**\n * Changes frame clamping\n * Works with TilingSprite and Mesh\n * Change to -0.5 to add a pixel to the edge, recommended for transparent trimmed textures in atlas\n *\n * @default 0.5\n * @member {number}\n */\n this.clampMargin = (typeof clampMargin === 'undefined') ? 0.5 : clampMargin;\n /**\n * If texture size is the same as baseTexture\n * @member {boolean}\n * @default false\n * @readonly\n */\n this.isSimple = false;\n }\n Object.defineProperty(TextureMatrix.prototype, \"texture\", {\n /**\n * texture property\n * @member {PIXI.Texture}\n */\n get: function () {\n return this._texture;\n },\n set: function (value) {\n this._texture = value;\n this._textureID = -1;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Multiplies uvs array to transform\n * @param {Float32Array} uvs - mesh uvs\n * @param {Float32Array} [out=uvs] - output\n * @returns {Float32Array} output\n */\n TextureMatrix.prototype.multiplyUvs = function (uvs, out) {\n if (out === undefined) {\n out = uvs;\n }\n var mat = this.mapCoord;\n for (var i = 0; i < uvs.length; i += 2) {\n var x = uvs[i];\n var y = uvs[i + 1];\n out[i] = (x * mat.a) + (y * mat.c) + mat.tx;\n out[i + 1] = (x * mat.b) + (y * mat.d) + mat.ty;\n }\n return out;\n };\n /**\n * updates matrices if texture was changed\n * @param {boolean} [forceUpdate=false] - if true, matrices will be updated any case\n * @returns {boolean} whether or not it was updated\n */\n TextureMatrix.prototype.update = function (forceUpdate) {\n var tex = this._texture;\n if (!tex || !tex.valid) {\n return false;\n }\n if (!forceUpdate\n && this._textureID === tex._updateID) {\n return false;\n }\n this._textureID = tex._updateID;\n this._updateID++;\n var uvs = tex._uvs;\n this.mapCoord.set(uvs.x1 - uvs.x0, uvs.y1 - uvs.y0, uvs.x3 - uvs.x0, uvs.y3 - uvs.y0, uvs.x0, uvs.y0);\n var orig = tex.orig;\n var trim = tex.trim;\n if (trim) {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height, -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n var texBase = tex.baseTexture;\n var frame = this.uClampFrame;\n var margin = this.clampMargin / texBase.resolution;\n var offset = this.clampOffset;\n frame[0] = (tex._frame.x + margin + offset) / texBase.width;\n frame[1] = (tex._frame.y + margin + offset) / texBase.height;\n frame[2] = (tex._frame.x + tex._frame.width - margin + offset) / texBase.width;\n frame[3] = (tex._frame.y + tex._frame.height - margin + offset) / texBase.height;\n this.uClampOffset[0] = offset / texBase.realWidth;\n this.uClampOffset[1] = offset / texBase.realHeight;\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n return true;\n };\n return TextureMatrix;\n}());\n\n/**\n * This handles a Sprite acting as a mask, as opposed to a Graphic.\n *\n * WebGL only.\n *\n * @memberof PIXI\n */\nvar SpriteMaskFilter = /** @class */ (function (_super) {\n __extends(SpriteMaskFilter, _super);\n /** @ignore */\n function SpriteMaskFilter(vertexSrc, fragmentSrc, uniforms) {\n var _this = this;\n var sprite = null;\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined) {\n sprite = vertexSrc;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n _this = _super.call(this, vertexSrc || vertex, fragmentSrc || fragment, uniforms) || this;\n _this.maskSprite = sprite;\n _this.maskMatrix = new Matrix();\n return _this;\n }\n Object.defineProperty(SpriteMaskFilter.prototype, \"maskSprite\", {\n /**\n * Sprite mask\n *\n * @type {PIXI.DisplayObject}\n */\n get: function () {\n return this._maskSprite;\n },\n set: function (value) {\n this._maskSprite = value;\n if (this._maskSprite) {\n this._maskSprite.renderable = false;\n }\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Applies the filter\n *\n * @param filterManager - The renderer to retrieve the filter from\n * @param input - The input render target.\n * @param output - The target to output to.\n * @param clearMode - Should the output be cleared before rendering to it.\n */\n SpriteMaskFilter.prototype.apply = function (filterManager, input, output, clearMode) {\n var maskSprite = this._maskSprite;\n var tex = maskSprite._texture;\n if (!tex.valid) {\n return;\n }\n if (!tex.uvMatrix) {\n // margin = 0.0, let it bleed a bit, shader code becomes easier\n // assuming that atlas textures were made with 1-pixel padding\n tex.uvMatrix = new TextureMatrix(tex, 0.0);\n }\n tex.uvMatrix.update();\n this.uniforms.npmAlpha = tex.baseTexture.alphaMode ? 0.0 : 1.0;\n this.uniforms.mask = tex;\n // get _normalized sprite texture coords_ and convert them to _normalized atlas texture coords_ with `prepend`\n this.uniforms.otherMatrix = filterManager.calculateSpriteMatrix(this.maskMatrix, maskSprite)\n .prepend(tex.uvMatrix.mapCoord);\n this.uniforms.alpha = maskSprite.worldAlpha;\n this.uniforms.maskClamp = tex.uvMatrix.uClampFrame;\n filterManager.applyFilter(this, input, output, clearMode);\n };\n return SpriteMaskFilter;\n}(Filter));\n\n/**\n * System plugin to the renderer to manage masks.\n *\n * There are three built-in types of masking:\n * * **Scissor Masking**: Scissor masking discards pixels that are outside of a rectangle called the scissor box. It is\n * the most performant as the scissor test is inexpensive. However, it can only be used when the mask is rectangular.\n * * **Stencil Masking**: Stencil masking discards pixels that don't overlap with the pixels rendered into the stencil\n * buffer. It is the next fastest option as it does not require rendering into a separate framebuffer. However, it does\n * cause the mask to be rendered **twice** for each masking operation; hence, minimize the rendering cost of your masks.\n * * **Sprite Mask Filtering**: Sprite mask filtering discards pixels based on the red channel of the sprite-mask's\n * texture. (Generally, the masking texture is grayscale). Using advanced techniques, you might be able to embed this\n * type of masking in a custom shader - and hence, bypassing the masking system fully for performance wins.\n *\n * The best type of masking is auto-detected when you `push` one. To use scissor masking, you must pass in a `Graphics`\n * object with just a rectangle drawn.\n *\n * ## Mask Stacks\n *\n * In the scene graph, masks can be applied recursively, i.e. a mask can be applied during a masking operation. The mask\n * stack stores the currently applied masks in order. Each {@link PIXI.BaseRenderTexture} holds its own mask stack, i.e.\n * when you switch render-textures, the old masks only applied when you switch back to rendering to the old render-target.\n *\n * @memberof PIXI\n */\nvar MaskSystem = /** @class */ (function () {\n /**\n * @param renderer - The renderer this System works for.\n */\n function MaskSystem(renderer) {\n this.renderer = renderer;\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param maskStack - The mask stack\n */\n MaskSystem.prototype.setMaskStack = function (maskStack) {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n };\n /**\n * Enables the mask and appends it to the current mask stack.\n *\n * NOTE: The batch renderer should be flushed beforehand to prevent pending renders from being masked.\n *\n * @param {PIXI.DisplayObject} target - Display Object to push the mask to\n * @param {PIXI.MaskData|PIXI.Sprite|PIXI.Graphics|PIXI.DisplayObject} maskData - The masking data.\n */\n MaskSystem.prototype.push = function (target, maskDataOrTarget) {\n var maskData = maskDataOrTarget;\n if (!maskData.isMaskData) {\n var d = this.maskDataPool.pop() || new MaskData();\n d.pooled = true;\n d.maskObject = maskDataOrTarget;\n maskData = d;\n }\n var maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n maskData.copyCountersOrReset(maskAbove);\n if (maskData.autoDetect) {\n this.detect(maskData);\n }\n maskData._target = target;\n if (maskData.type !== MASK_TYPES.SPRITE) {\n this.maskStack.push(maskData);\n }\n if (maskData.enabled) {\n switch (maskData.type) {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.push(maskData);\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.push(maskData);\n break;\n case MASK_TYPES.SPRITE:\n maskData.copyCountersOrReset(null);\n this.pushSpriteMask(maskData);\n break;\n }\n }\n if (maskData.type === MASK_TYPES.SPRITE) {\n this.maskStack.push(maskData);\n }\n };\n /**\n * Removes the last mask from the mask stack and doesn't return it.\n *\n * NOTE: The batch renderer should be flushed beforehand to render the masked contents before the mask is removed.\n *\n * @param {PIXI.DisplayObject} target - Display Object to pop the mask from\n */\n MaskSystem.prototype.pop = function (target) {\n var maskData = this.maskStack.pop();\n if (!maskData || maskData._target !== target) {\n // TODO: add an assert when we have it\n return;\n }\n if (maskData.enabled) {\n switch (maskData.type) {\n case MASK_TYPES.SCISSOR:\n this.renderer.scissor.pop();\n break;\n case MASK_TYPES.STENCIL:\n this.renderer.stencil.pop(maskData.maskObject);\n break;\n case MASK_TYPES.SPRITE:\n this.popSpriteMask(maskData);\n break;\n }\n }\n maskData.reset();\n if (maskData.pooled) {\n this.maskDataPool.push(maskData);\n }\n if (this.maskStack.length !== 0) {\n var maskCurrent = this.maskStack[this.maskStack.length - 1];\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters) {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n };\n /** Sets type of MaskData based on its maskObject. */\n MaskSystem.prototype.detect = function (maskData) {\n var maskObject = maskData.maskObject;\n if (maskObject.isSprite) {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData)) {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else {\n maskData.type = MASK_TYPES.STENCIL;\n }\n };\n /**\n * Applies the Mask and adds it to the current filter stack.\n *\n * @param maskData - Sprite to be used as the mask.\n */\n MaskSystem.prototype.pushSpriteMask = function (maskData) {\n var _a, _b;\n var maskObject = maskData.maskObject;\n var target = maskData._target;\n var alphaMaskFilter = maskData._filters;\n if (!alphaMaskFilter) {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n if (!alphaMaskFilter) {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n var renderer = this.renderer;\n var renderTextureSystem = renderer.renderTexture;\n var resolution;\n var multisample;\n if (renderTextureSystem.current) {\n var renderTexture = renderTextureSystem.current;\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = (_a = maskData.multisample) !== null && _a !== void 0 ? _a : renderTexture.multisample;\n }\n else {\n resolution = maskData.resolution || renderer.resolution;\n multisample = (_b = maskData.multisample) !== null && _b !== void 0 ? _b : renderer.multisample;\n }\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n var stashFilterArea = target.filterArea;\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n if (!maskData._filters) {\n this.alphaMaskIndex++;\n }\n };\n /**\n * Removes the last filter from the filter stack and doesn't return it.\n *\n * @param maskData - Sprite to be used as the mask.\n */\n MaskSystem.prototype.popSpriteMask = function (maskData) {\n this.renderer.filter.pop();\n if (maskData._filters) {\n maskData._filters[0].maskSprite = null;\n }\n else {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n };\n MaskSystem.prototype.destroy = function () {\n this.renderer = null;\n };\n return MaskSystem;\n}());\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n *\n * @memberof PIXI\n */\nvar AbstractMaskSystem = /** @class */ (function () {\n /**\n * @param renderer - The renderer this System works for.\n */\n function AbstractMaskSystem(renderer) {\n this.renderer = renderer;\n this.maskStack = [];\n this.glConst = 0;\n }\n /** Gets count of masks of certain type. */\n AbstractMaskSystem.prototype.getStackLength = function () {\n return this.maskStack.length;\n };\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n AbstractMaskSystem.prototype.setMaskStack = function (maskStack) {\n var gl = this.renderer.gl;\n var curStackLen = this.getStackLength();\n this.maskStack = maskStack;\n var newStackLen = this.getStackLength();\n if (newStackLen !== curStackLen) {\n if (newStackLen === 0) {\n gl.disable(this.glConst);\n }\n else {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n };\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n AbstractMaskSystem.prototype._useCurrent = function () {\n // OVERWRITE;\n };\n /** Destroys the mask stack. */\n AbstractMaskSystem.prototype.destroy = function () {\n this.renderer = null;\n this.maskStack = null;\n };\n return AbstractMaskSystem;\n}());\n\nvar tempMatrix$1 = new Matrix();\n/**\n * System plugin to the renderer to manage scissor masking.\n *\n * Scissor masking discards pixels outside of a rectangle called the scissor box. The scissor box is in the framebuffer\n * viewport's space; however, the mask's rectangle is projected from world-space to viewport space automatically\n * by this system.\n *\n * @memberof PIXI\n */\nvar ScissorSystem = /** @class */ (function (_super) {\n __extends(ScissorSystem, _super);\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function ScissorSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.glConst = WebGLRenderingContext.SCISSOR_TEST;\n return _this;\n }\n ScissorSystem.prototype.getStackLength = function () {\n var maskData = this.maskStack[this.maskStack.length - 1];\n if (maskData) {\n return maskData._scissorCounter;\n }\n return 0;\n };\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n ScissorSystem.prototype.calcScissorRect = function (maskData) {\n if (maskData._scissorRectLocal) {\n return;\n }\n var prevData = maskData._scissorRect;\n var maskObject = maskData.maskObject;\n var renderer = this.renderer;\n var renderTextureSystem = renderer.renderTexture;\n maskObject.renderable = true;\n var rect = maskObject.getBounds();\n this.roundFrameToPixels(rect, renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution, renderTextureSystem.sourceFrame, renderTextureSystem.destinationFrame, renderer.projection.transform);\n maskObject.renderable = false;\n if (prevData) {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n };\n ScissorSystem.isMatrixRotated = function (matrix) {\n if (!matrix) {\n return false;\n }\n var a = matrix.a, b = matrix.b, c = matrix.c, d = matrix.d;\n // Skip if skew/rotation present in matrix, except for multiple of 90° rotation. If rotation\n // is a multiple of 90°, then either pair of (b,c) or (a,d) will be (0,0).\n return ((Math.abs(b) > 1e-4 || Math.abs(c) > 1e-4)\n && (Math.abs(a) > 1e-4 || Math.abs(d) > 1e-4));\n };\n /**\n * Test, whether the object can be scissor mask with current renderer projection.\n * Calls \"calcScissorRect()\" if its true.\n * @param maskData mask data\n * @returns whether Whether the object can be scissor mask\n */\n ScissorSystem.prototype.testScissor = function (maskData) {\n var maskObject = maskData.maskObject;\n if (!maskObject.isFastRect || !maskObject.isFastRect()) {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform)) {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform)) {\n return false;\n }\n this.calcScissorRect(maskData);\n var rect = maskData._scissorRectLocal;\n return rect.width > 0 && rect.height > 0;\n };\n ScissorSystem.prototype.roundFrameToPixels = function (frame, resolution, bindingSourceFrame, bindingDestinationFrame, transform) {\n if (ScissorSystem.isMatrixRotated(transform)) {\n return;\n }\n transform = transform ? tempMatrix$1.copyFrom(transform) : tempMatrix$1.identity();\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(bindingDestinationFrame.width / bindingSourceFrame.width, bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n // Convert frame to screen space\n this.renderer.filter.transformAABB(transform, frame);\n frame.fit(bindingDestinationFrame);\n frame.x = Math.round(frame.x * resolution);\n frame.y = Math.round(frame.y * resolution);\n frame.width = Math.round(frame.width * resolution);\n frame.height = Math.round(frame.height * resolution);\n };\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @author alvin\n * @param maskData - The mask data.\n */\n ScissorSystem.prototype.push = function (maskData) {\n if (!maskData._scissorRectLocal) {\n this.calcScissorRect(maskData);\n }\n var gl = this.renderer.gl;\n if (!maskData._scissorRect) {\n gl.enable(gl.SCISSOR_TEST);\n }\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n };\n /**\n * This should be called after a mask is popped off the mask stack. It will rebind the scissor box to be latest with the\n * last mask in the stack.\n *\n * This can also be called when you directly modify the scissor box and want to restore PixiJS state.\n */\n ScissorSystem.prototype.pop = function () {\n var gl = this.renderer.gl;\n if (this.getStackLength() > 0) {\n this._useCurrent();\n }\n else {\n gl.disable(gl.SCISSOR_TEST);\n }\n };\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n ScissorSystem.prototype._useCurrent = function () {\n var rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n var y;\n if (this.renderer.renderTexture.current) {\n y = rect.y;\n }\n else {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n };\n return ScissorSystem;\n}(AbstractMaskSystem));\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n *\n * @memberof PIXI\n */\nvar StencilSystem = /** @class */ (function (_super) {\n __extends(StencilSystem, _super);\n /**\n * @param renderer - The renderer this System works for.\n */\n function StencilSystem(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.glConst = WebGLRenderingContext.STENCIL_TEST;\n return _this;\n }\n StencilSystem.prototype.getStackLength = function () {\n var maskData = this.maskStack[this.maskStack.length - 1];\n if (maskData) {\n return maskData._stencilCounter;\n }\n return 0;\n };\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @param maskData - The mask data\n */\n StencilSystem.prototype.push = function (maskData) {\n var maskObject = maskData.maskObject;\n var gl = this.renderer.gl;\n var prevMaskCount = maskData._stencilCounter;\n if (prevMaskCount === 0) {\n // force use stencil texture in current framebuffer\n this.renderer.framebuffer.forceStencil();\n gl.clearStencil(0);\n gl.clear(gl.STENCIL_BUFFER_BIT);\n gl.enable(gl.STENCIL_TEST);\n }\n maskData._stencilCounter++;\n // Increment the reference stencil value where the new mask overlaps with the old ones.\n gl.colorMask(false, false, false, false);\n gl.stencilFunc(gl.EQUAL, prevMaskCount, 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.INCR);\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n this._useCurrent();\n };\n /**\n * Pops stencil mask. MaskData is already removed from stack\n *\n * @param {PIXI.DisplayObject} maskObject - object of popped mask data\n */\n StencilSystem.prototype.pop = function (maskObject) {\n var gl = this.renderer.gl;\n if (this.getStackLength() === 0) {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else {\n // Decrement the reference stencil value where the popped mask overlaps with the other ones\n gl.colorMask(false, false, false, false);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.DECR);\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n this._useCurrent();\n }\n };\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n StencilSystem.prototype._useCurrent = function () {\n var gl = this.renderer.gl;\n gl.colorMask(true, true, true, true);\n gl.stencilFunc(gl.EQUAL, this.getStackLength(), 0xFFFFFFFF);\n gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);\n };\n return StencilSystem;\n}(AbstractMaskSystem));\n\n/**\n * System plugin to the renderer to manage the projection matrix.\n *\n * The `projectionMatrix` is a global uniform provided to all shaders. It is used to transform points in world space to\n * normalized device coordinates.\n *\n * @memberof PIXI\n */\nvar ProjectionSystem = /** @class */ (function () {\n /** @param renderer - The renderer this System works for. */\n function ProjectionSystem(renderer) {\n this.renderer = renderer;\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\n /**\n * Updates the projection-matrix based on the sourceFrame → destinationFrame mapping provided.\n *\n * NOTE: It is expected you call `renderer.framebuffer.setViewport(destinationFrame)` after this. This is because\n * the framebuffer viewport converts shader vertex output in normalized device coordinates to window coordinates.\n *\n * NOTE-2: {@link RenderTextureSystem#bind} updates the projection-matrix when you bind a render-texture. It is expected\n * that you dirty the current bindings when calling this manually.\n *\n * @param destinationFrame - The rectangle in the render-target to render the contents into. If rendering to the canvas,\n * the origin is on the top-left; if rendering to a render-texture, the origin is on the bottom-left.\n * @param sourceFrame - The rectangle in world space that contains the contents being rendered.\n * @param resolution - The resolution of the render-target, which is the ratio of\n * world-space (or CSS) pixels to physical pixels.\n * @param root - Whether the render-target is the screen. This is required because rendering to textures\n * is y-flipped (i.e. upside down relative to the screen).\n */\n ProjectionSystem.prototype.update = function (destinationFrame, sourceFrame, resolution, root) {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n if (this.transform) {\n this.projectionMatrix.append(this.transform);\n }\n var renderer = this.renderer;\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n // this will work for now\n // but would be sweet to stick and even on the global uniforms..\n if (renderer.shader.shader) {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\n };\n /**\n * Calculates the `projectionMatrix` to map points inside `sourceFrame` to inside `destinationFrame`.\n *\n * @param destinationFrame - The destination frame in the render-target.\n * @param sourceFrame - The source frame in world space.\n * @param resolution - The render-target's resolution, i.e. ratio of CSS to physical pixels.\n * @param root - Whether rendering into the screen. Otherwise, if rendering to a framebuffer, the projection\n * is y-flipped.\n */\n ProjectionSystem.prototype.calculateProjection = function (_destinationFrame, sourceFrame, _resolution, root) {\n var pm = this.projectionMatrix;\n var sign = !root ? 1 : -1;\n pm.identity();\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n };\n /**\n * Sets the transform of the active render target to the given matrix.\n *\n * @param matrix - The transformation matrix\n */\n ProjectionSystem.prototype.setTransform = function (_matrix) {\n // this._activeRenderTarget.transform = matrix;\n };\n ProjectionSystem.prototype.destroy = function () {\n this.renderer = null;\n };\n return ProjectionSystem;\n}());\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nvar tempRect = new Rectangle();\n// Temporary rectangle for renderTexture destinationFrame\nvar tempRect2 = new Rectangle();\n/* eslint-disable max-len */\n/**\n * System plugin to the renderer to manage render textures.\n *\n * Should be added after FramebufferSystem\n *\n * ### Frames\n *\n * The `RenderTextureSystem` holds a sourceFrame → destinationFrame projection. The following table explains the different\n * coordinate spaces used:\n *\n * | Frame | Description | Coordinate System |\n * | ---------------------- | ---------------------------------------------------------------- | ------------------------------------------------------- |\n * | sourceFrame | The rectangle inside of which display-objects are being rendered | **World Space**: The origin on the top-left |\n * | destinationFrame | The rectangle in the render-target (canvas or texture) into which contents should be rendered | If rendering to the canvas, this is in screen space and the origin is on the top-left. If rendering to a render-texture, this is in its base-texture's space with the origin on the bottom-left. |\n * | viewportFrame | The framebuffer viewport corresponding to the destination-frame | **Window Coordinates**: The origin is always on the bottom-left. |\n *\n * @memberof PIXI\n */\nvar RenderTextureSystem = /** @class */ (function () {\n /**\n * @param renderer - The renderer this System works for.\n */\n function RenderTextureSystem(renderer) {\n this.renderer = renderer;\n this.clearColor = renderer._backgroundColorRgba;\n this.defaultMaskStack = [];\n this.current = null;\n this.sourceFrame = new Rectangle();\n this.destinationFrame = new Rectangle();\n this.viewportFrame = new Rectangle();\n }\n /**\n * Bind the current render texture.\n *\n * @param renderTexture - RenderTexture to bind, by default its `null` - the screen.\n * @param sourceFrame - Part of world that is mapped to the renderTexture.\n * @param destinationFrame - Part of renderTexture, by default it has the same size as sourceFrame.\n */\n RenderTextureSystem.prototype.bind = function (renderTexture, sourceFrame, destinationFrame) {\n if (renderTexture === void 0) { renderTexture = null; }\n var renderer = this.renderer;\n this.current = renderTexture;\n var baseTexture;\n var framebuffer;\n var resolution;\n if (renderTexture) {\n baseTexture = renderTexture.baseTexture;\n resolution = baseTexture.resolution;\n if (!sourceFrame) {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n sourceFrame = tempRect;\n }\n if (!destinationFrame) {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n destinationFrame = tempRect2;\n }\n framebuffer = baseTexture.framebuffer;\n }\n else {\n resolution = renderer.resolution;\n if (!sourceFrame) {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n sourceFrame = tempRect;\n }\n if (!destinationFrame) {\n destinationFrame = tempRect;\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n var viewportFrame = this.viewportFrame;\n viewportFrame.x = destinationFrame.x * resolution;\n viewportFrame.y = destinationFrame.y * resolution;\n viewportFrame.width = destinationFrame.width * resolution;\n viewportFrame.height = destinationFrame.height * resolution;\n if (!renderTexture) {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n viewportFrame.ceil();\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n if (renderTexture) {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n };\n /**\n * Erases the render texture and fills the drawing area with a colour.\n *\n * @param clearColor - The color as rgba, default to use the renderer backgroundColor\n * @param [mask=BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH] - Bitwise OR of masks\n * that indicate the buffers to be cleared, by default COLOR and DEPTH buffers.\n */\n RenderTextureSystem.prototype.clear = function (clearColor, mask) {\n if (this.current) {\n clearColor = clearColor || this.current.baseTexture.clearColor;\n }\n else {\n clearColor = clearColor || this.clearColor;\n }\n var destinationFrame = this.destinationFrame;\n var baseFrame = this.current ? this.current.baseTexture : this.renderer.screen;\n var clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n if (clearMask) {\n var _a = this.viewportFrame, x = _a.x, y = _a.y, width = _a.width, height = _a.height;\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n // TODO: ScissorSystem should cache whether the scissor test is enabled or not.\n this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST);\n this.renderer.gl.scissor(x, y, width, height);\n }\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n if (clearMask) {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n };\n RenderTextureSystem.prototype.resize = function () {\n // resize the root only!\n this.bind(null);\n };\n /** Resets render-texture state. */\n RenderTextureSystem.prototype.reset = function () {\n this.bind(null);\n };\n RenderTextureSystem.prototype.destroy = function () {\n this.renderer = null;\n };\n return RenderTextureSystem;\n}());\n\nfunction uboUpdate(_ud, _uv, _renderer, _syncData, buffer) {\n _renderer.buffer.update(buffer);\n}\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nvar UBO_TO_SINGLE_SETTERS = {\n float: \"\\n data[offset] = v;\\n \",\n vec2: \"\\n data[offset] = v[0];\\n data[offset+1] = v[1];\\n \",\n vec3: \"\\n data[offset] = v[0];\\n data[offset+1] = v[1];\\n data[offset+2] = v[2];\\n\\n \",\n vec4: \"\\n data[offset] = v[0];\\n data[offset+1] = v[1];\\n data[offset+2] = v[2];\\n data[offset+3] = v[3];\\n \",\n mat2: \"\\n data[offset] = v[0];\\n data[offset+1] = v[1];\\n\\n data[offset+4] = v[2];\\n data[offset+5] = v[3];\\n \",\n mat3: \"\\n data[offset] = v[0];\\n data[offset+1] = v[1];\\n data[offset+2] = v[2];\\n\\n data[offset + 4] = v[3];\\n data[offset + 5] = v[4];\\n data[offset + 6] = v[5];\\n\\n data[offset + 8] = v[6];\\n data[offset + 9] = v[7];\\n data[offset + 10] = v[8];\\n \",\n mat4: \"\\n for(var i = 0; i < 16; i++)\\n {\\n data[offset + i] = v[i];\\n }\\n \"\n};\nvar GLSL_TO_STD40_SIZE = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n/**\n * @ignore\n *\n * logic originally from here: https://github.com/sketchpunk/FunWithWebGL2/blob/master/lesson_022/Shaders.js\n * rewrote it, but this was a great starting point to get a solid understanding of whats going on :)\n *\n * @param uniformData\n */\nfunction createUBOElements(uniformData) {\n var uboElements = uniformData.map(function (data) {\n return ({\n data: data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n });\n });\n var size = 0;\n var chunkSize = 0;\n var offset = 0;\n for (var i = 0; i < uboElements.length; i++) {\n var uboElement = uboElements[i];\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n if (uboElement.data.size > 1) {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n uboElement.dataLen = size;\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n if (chunkSize % size !== 0 && chunkSize < 16) {\n // diff required to line up..\n var lineUpValue = (chunkSize % size) % 16;\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n if ((chunkSize + size) > 16) {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n offset = Math.ceil(offset / 16) * 16;\n return { uboElements: uboElements, size: offset };\n}\nfunction getUBOData(uniforms, uniformData) {\n var usedUniformDatas = [];\n // build..\n for (var i in uniforms) {\n if (uniformData[i]) {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n // sort them out by index!\n usedUniformDatas.sort(function (a, b) { return a.index - b.index; });\n return usedUniformDatas;\n}\nfunction generateUniformBufferSync(group, uniformData) {\n if (!group.autoManage) {\n // if the group is nott automatically managed, we don't need to generate a special function for it...\n return { size: 0, syncFunc: uboUpdate };\n }\n var usedUniformDatas = getUBOData(group.uniforms, uniformData);\n var _a = createUBOElements(usedUniformDatas), uboElements = _a.uboElements, size = _a.size;\n var funcFragments = [\"\\n var v = null;\\n var v2 = null;\\n var cv = null;\\n var t = 0;\\n var gl = renderer.gl\\n var index = 0;\\n var data = buffer.data;\\n \"];\n for (var i = 0; i < uboElements.length; i++) {\n var uboElement = uboElements[i];\n var uniform = group.uniforms[uboElement.data.name];\n var name = uboElement.data.name;\n var parsed = false;\n for (var j = 0; j < uniformParsers.length; j++) {\n var uniformParser = uniformParsers[j];\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform)) {\n funcFragments.push(\"offset = \" + uboElement.offset / 4 + \";\", uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n break;\n }\n }\n if (!parsed) {\n if (uboElement.data.size > 1) {\n var size_1 = mapSize(uboElement.data.type);\n var rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n var elementSize = size_1 / rowSize;\n var remainder = (4 - (elementSize % 4)) % 4;\n funcFragments.push(\"\\n cv = ud.\" + name + \".value;\\n v = uv.\" + name + \";\\n offset = \" + uboElement.offset / 4 + \";\\n\\n t = 0;\\n\\n for(var i=0; i < \" + uboElement.data.size * rowSize + \"; i++)\\n {\\n for(var j = 0; j < \" + elementSize + \"; j++)\\n {\\n data[offset++] = v[t++];\\n }\\n offset += \" + remainder + \";\\n }\\n\\n \");\n }\n else {\n var template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n funcFragments.push(\"\\n cv = ud.\" + name + \".value;\\n v = uv.\" + name + \";\\n offset = \" + uboElement.offset / 4 + \";\\n \" + template + \";\\n \");\n }\n }\n }\n funcFragments.push(\"\\n renderer.buffer.update(buffer);\\n \");\n return {\n size: size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function('ud', 'uv', 'renderer', 'syncData', 'buffer', funcFragments.join('\\n'))\n };\n}\n/**\n * Helper class to create a WebGL Program\n *\n * @class\n * @memberof PIXI\n */\nvar GLProgram = /** @class */ (function () {\n /**\n * Makes a new Pixi program\n *\n * @param {WebGLProgram} program - webgl program\n * @param {Object} uniformData - uniforms\n */\n function GLProgram(program, uniformData) {\n /**\n * The shader program\n *\n * @member {WebGLProgram}\n */\n this.program = program;\n /**\n * holds the uniform data which contains uniform locations\n * and current uniform values used for caching and preventing unneeded GPU commands\n * @member {Object}\n */\n this.uniformData = uniformData;\n /**\n * uniformGroups holds the various upload functions for the shader. Each uniform group\n * and program have a unique upload function generated.\n * @member {Object}\n */\n this.uniformGroups = {};\n this.uniformDirtyGroups = {};\n this.uniformBufferBindings = {};\n }\n /**\n * Destroys this program\n */\n GLProgram.prototype.destroy = function () {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n };\n return GLProgram;\n}());\n\n/**\n * returns the attribute data from the program\n * @private\n *\n * @param {WebGLProgram} [program] - the WebGL program\n * @param {WebGLRenderingContext} [gl] - the WebGL context\n *\n * @returns {object} the attribute data for this program\n */\nfunction getAttributeData(program, gl) {\n var attributes = {};\n var totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n for (var i = 0; i < totalAttributes; i++) {\n var attribData = gl.getActiveAttrib(program, i);\n if (attribData.name.indexOf('gl_') === 0) {\n continue;\n }\n var type = mapType(gl, attribData.type);\n var data = {\n type: type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n attributes[attribData.name] = data;\n }\n return attributes;\n}\n\n/**\n * returns the uniform data from the program\n * @private\n *\n * @param program - the webgl program\n * @param gl - the WebGL context\n *\n * @returns {object} the uniform data for this program\n */\nfunction getUniformData(program, gl) {\n var uniforms = {};\n var totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n for (var i = 0; i < totalUniforms; i++) {\n var uniformData = gl.getActiveUniform(program, i);\n var name = uniformData.name.replace(/\\[.*?\\]$/, '');\n var isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n var type = mapType(gl, uniformData.type);\n uniforms[name] = {\n name: name,\n index: i,\n type: type,\n size: uniformData.size,\n isArray: isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n return uniforms;\n}\n\n/**\n * generates a WebGL Program object from a high level Pixi Program.\n *\n * @param gl - a rendering context on which to generate the program\n * @param program - the high level Pixi Program.\n */\nfunction generateProgram(gl, program) {\n var glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n var glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n var webGLProgram = gl.createProgram();\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n gl.linkProgram(webGLProgram);\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS)) {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n // GLSL 1.00: bind attributes sorted by name in ascending order\n // GLSL 3.00: don't change the attribute locations that where chosen by the compiler\n // or assigned by the layout specifier in the shader source code\n if (!(/^[ \\t]*#[ \\t]*version[ \\t]+300[ \\t]+es[ \\t]*$/m).test(program.vertexSrc)) {\n var keys = Object.keys(program.attributeData);\n keys.sort(function (a, b) { return (a > b) ? 1 : -1; }); // eslint-disable-line no-confusing-arrow\n for (var i = 0; i < keys.length; i++) {\n program.attributeData[keys[i]].location = i;\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n gl.linkProgram(webGLProgram);\n }\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n var uniformData = {};\n for (var i in program.uniformData) {\n var data = program.uniformData[i];\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n var glProgram = new GLProgram(webGLProgram, uniformData);\n return glProgram;\n}\n\nvar UID$4 = 0;\n// default sync data so we don't create a new one each time!\nvar defaultSyncData = { textureCount: 0, uboCount: 0 };\n/**\n * System plugin to the renderer to manage shaders.\n *\n * @memberof PIXI\n */\nvar ShaderSystem = /** @class */ (function () {\n /** @param renderer - The renderer this System works for. */\n function ShaderSystem(renderer) {\n this.destroyed = false;\n this.renderer = renderer;\n // Validation check that this environment support `new Function`\n this.systemCheck();\n this.gl = null;\n this.shader = null;\n this.program = null;\n this.cache = {};\n this._uboCache = {};\n this.id = UID$4++;\n }\n /**\n * Overrideable function by `@pixi/unsafe-eval` to silence\n * throwing an error if platform doesn't support unsafe-evals.\n *\n * @private\n */\n ShaderSystem.prototype.systemCheck = function () {\n if (!unsafeEvalSupported()) {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n };\n ShaderSystem.prototype.contextChange = function (gl) {\n this.gl = gl;\n this.reset();\n };\n /**\n * Changes the current shader to the one given in parameter.\n *\n * @param shader - the new shader\n * @param dontSync - false if the shader should automatically sync its uniforms.\n * @returns the glProgram that belongs to the shader.\n */\n ShaderSystem.prototype.bind = function (shader, dontSync) {\n shader.uniforms.globals = this.renderer.globalUniforms;\n var program = shader.program;\n var glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n this.shader = shader;\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program) {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n if (!dontSync) {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n return glProgram;\n };\n /**\n * Uploads the uniforms values to the currently bound shader.\n *\n * @param uniforms - the uniforms values that be applied to the current shader\n */\n ShaderSystem.prototype.setUniforms = function (uniforms) {\n var shader = this.shader.program;\n var glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n };\n /* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n /**\n * Syncs uniforms on the group\n *\n * @param group - the uniform group to sync\n * @param syncData - this is data that is passed to the sync function and any nested sync functions\n */\n ShaderSystem.prototype.syncUniformGroup = function (group, syncData) {\n var glProgram = this.getGlProgram();\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id]) {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n this.syncUniforms(group, glProgram, syncData);\n }\n };\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n */\n ShaderSystem.prototype.syncUniforms = function (group, glProgram, syncData) {\n var syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n };\n ShaderSystem.prototype.createSyncGroups = function (group) {\n var id = this.getSignature(group, this.shader.program.uniformData, 'u');\n if (!this.cache[id]) {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n return group.syncUniforms[this.shader.program.id];\n };\n /**\n * Syncs uniform buffers\n *\n * @param group - the uniform buffer group to sync\n * @param name - the name of the uniform buffer\n */\n ShaderSystem.prototype.syncUniformBufferGroup = function (group, name) {\n var glProgram = this.getGlProgram();\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id]) {\n group.dirtyId = 0;\n var syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n // TODO wrap update in a cache??\n group.buffer.update();\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, defaultSyncData, group.buffer);\n }\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n };\n /**\n * Will create a function that uploads a uniform buffer using the STD140 standard.\n * The upload function will then be cached for future calls\n * If a group is manually managed, then a simple upload function is generated\n *\n * @param group - the uniform buffer group to sync\n * @param glProgram - the gl program to attach the uniform bindings to\n * @param name - the name of the uniform buffer (must exist on the shader)\n */\n ShaderSystem.prototype.createSyncBufferGroup = function (group, glProgram, name) {\n var gl = this.renderer.gl;\n this.renderer.buffer.bind(group.buffer);\n // bind them...\n var uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n this.shader.uniformBindCount++;\n var id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n var uboData = this._uboCache[id];\n if (!uboData) {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n if (group.autoManage) {\n var data = new Float32Array(uboData.size / 4);\n group.buffer.update(data);\n }\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n return glProgram.uniformGroups[group.id];\n };\n /**\n * Takes a uniform group and data and generates a unique signature for them.\n *\n * @param group - The uniform group to get signature of\n * @param uniformData - Uniform information generated by the shader\n * @returns Unique signature of the uniform group\n */\n ShaderSystem.prototype.getSignature = function (group, uniformData, preFix) {\n var uniforms = group.uniforms;\n var strings = [preFix + \"-\"];\n for (var i in uniforms) {\n strings.push(i);\n if (uniformData[i]) {\n strings.push(uniformData[i].type);\n }\n }\n return strings.join('-');\n };\n /**\n * Returns the underlying GLShade rof the currently bound shader.\n *\n * This can be handy for when you to have a little more control over the setting of your uniforms.\n *\n * @return The glProgram for the currently bound Shader for this context\n */\n ShaderSystem.prototype.getGlProgram = function () {\n if (this.shader) {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n return null;\n };\n /**\n * Generates a glProgram version of the Shader provided.\n *\n * @param shader - The shader that the glProgram will be based on.\n * @return A shiny new glProgram!\n */\n ShaderSystem.prototype.generateProgram = function (shader) {\n var gl = this.gl;\n var program = shader.program;\n var glProgram = generateProgram(gl, program);\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n return glProgram;\n };\n /** Resets ShaderSystem state, does not affect WebGL state. */\n ShaderSystem.prototype.reset = function () {\n this.program = null;\n this.shader = null;\n };\n /** Destroys this System and removes all its textures. */\n ShaderSystem.prototype.destroy = function () {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n };\n return ShaderSystem;\n}());\n\n/**\n * Maps gl blend combinations to WebGL.\n *\n * @memberof PIXI\n * @function mapWebGLBlendModesToPixi\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @param {number[][]} [array=[]] - The array to output into.\n * @return {number[][]} Mapped modes.\n */\nfunction mapWebGLBlendModesToPixi(gl, array) {\n if (array === void 0) { array = []; }\n // TODO - premultiply alpha would be different.\n // add a boolean for that!\n array[BLEND_MODES.NORMAL] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD] = [gl.ONE, gl.ONE];\n array[BLEND_MODES.MULTIPLY] = [gl.DST_COLOR, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SCREEN] = [gl.ONE, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.OVERLAY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DARKEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LIGHTEN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_DODGE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR_BURN] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HARD_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SOFT_LIGHT] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DIFFERENCE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.EXCLUSION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.HUE] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.SATURATION] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.COLOR] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.LUMINOSITY] = [gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.NONE] = [0, 0];\n // not-premultiplied blend modes\n array[BLEND_MODES.NORMAL_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.ADD_NPM] = [gl.SRC_ALPHA, gl.ONE, gl.ONE, gl.ONE];\n array[BLEND_MODES.SCREEN_NPM] = [gl.SRC_ALPHA, gl.ONE_MINUS_SRC_COLOR, gl.ONE, gl.ONE_MINUS_SRC_ALPHA];\n // composite operations\n array[BLEND_MODES.SRC_IN] = [gl.DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_OUT] = [gl.ONE_MINUS_DST_ALPHA, gl.ZERO];\n array[BLEND_MODES.SRC_ATOP] = [gl.DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_OVER] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE];\n array[BLEND_MODES.DST_IN] = [gl.ZERO, gl.SRC_ALPHA];\n array[BLEND_MODES.DST_OUT] = [gl.ZERO, gl.ONE_MINUS_SRC_ALPHA];\n array[BLEND_MODES.DST_ATOP] = [gl.ONE_MINUS_DST_ALPHA, gl.SRC_ALPHA];\n array[BLEND_MODES.XOR] = [gl.ONE_MINUS_DST_ALPHA, gl.ONE_MINUS_SRC_ALPHA];\n // SUBTRACT from flash\n array[BLEND_MODES.SUBTRACT] = [gl.ONE, gl.ONE, gl.ONE, gl.ONE, gl.FUNC_REVERSE_SUBTRACT, gl.FUNC_ADD];\n return array;\n}\n\nvar BLEND$1 = 0;\nvar OFFSET$1 = 1;\nvar CULLING$1 = 2;\nvar DEPTH_TEST$1 = 3;\nvar WINDING$1 = 4;\nvar DEPTH_MASK$1 = 5;\n/**\n * System plugin to the renderer to manage WebGL state machines.\n *\n * @memberof PIXI\n */\nvar StateSystem = /** @class */ (function () {\n function StateSystem() {\n this.gl = null;\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n this._blendEq = false;\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND$1] = this.setBlend;\n this.map[OFFSET$1] = this.setOffset;\n this.map[CULLING$1] = this.setCullFace;\n this.map[DEPTH_TEST$1] = this.setDepthTest;\n this.map[WINDING$1] = this.setFrontFace;\n this.map[DEPTH_MASK$1] = this.setDepthMask;\n this.checks = [];\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n StateSystem.prototype.contextChange = function (gl) {\n this.gl = gl;\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n this.set(this.defaultState);\n this.reset();\n };\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n StateSystem.prototype.set = function (state) {\n state = state || this.defaultState;\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data) {\n var diff = this.stateId ^ state.data;\n var i = 0;\n // order from least to most common\n while (diff) {\n if (diff & 1) {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n diff = diff >> 1;\n i++;\n }\n this.stateId = state.data;\n }\n // based on the above settings we check for specific modes..\n // for example if blend is active we check and set the blend modes\n // or of polygon offset is active we check the poly depth.\n for (var i = 0; i < this.checks.length; i++) {\n this.checks[i](this, state);\n }\n };\n /**\n * Sets the state, when previous state is unknown.\n *\n * @param {*} state - The state to set\n */\n StateSystem.prototype.forceState = function (state) {\n state = state || this.defaultState;\n for (var i = 0; i < this.map.length; i++) {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (var i = 0; i < this.checks.length; i++) {\n this.checks[i](this, state);\n }\n this.stateId = state.data;\n };\n /**\n * Sets whether to enable or disable blending.\n *\n * @param value - Turn on or off WebGl blending.\n */\n StateSystem.prototype.setBlend = function (value) {\n this.updateCheck(StateSystem.checkBlendMode, value);\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n };\n /**\n * Sets whether to enable or disable polygon offset fill.\n *\n * @param value - Turn on or off webgl polygon offset testing.\n */\n StateSystem.prototype.setOffset = function (value) {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n };\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param value - Turn on or off webgl depth testing.\n */\n StateSystem.prototype.setDepthTest = function (value) {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n };\n /**\n * Sets whether to enable or disable depth mask.\n *\n * @param value - Turn on or off webgl depth mask.\n */\n StateSystem.prototype.setDepthMask = function (value) {\n this.gl.depthMask(value);\n };\n /**\n * Sets whether to enable or disable cull face.\n *\n * @param {boolean} value - Turn on or off webgl cull face.\n */\n StateSystem.prototype.setCullFace = function (value) {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n };\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n StateSystem.prototype.setFrontFace = function (value) {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n };\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n StateSystem.prototype.setBlendMode = function (value) {\n if (value === this.blendMode) {\n return;\n }\n this.blendMode = value;\n var mode = this.blendModes[value];\n var gl = this.gl;\n if (mode.length === 2) {\n gl.blendFunc(mode[0], mode[1]);\n }\n else {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6) {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq) {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\n };\n /**\n * Sets the polygon offset.\n *\n * @param {number} value - the polygon offset\n * @param {number} scale - the polygon offset scale\n */\n StateSystem.prototype.setPolygonOffset = function (value, scale) {\n this.gl.polygonOffset(value, scale);\n };\n // used\n /** Resets all the logic and disables the VAOs. */\n StateSystem.prototype.reset = function () {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n this.forceState(this.defaultState);\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n };\n /**\n * Checks to see which updates should be checked based on which settings have been activated.\n *\n * For example, if blend is enabled then we should check the blend modes each time the state is changed\n * or if polygon fill is activated then we need to check if the polygon offset changes.\n * The idea is that we only check what we have too.\n *\n * @param func - the checking function to add or remove\n * @param value - should the check function be added or removed.\n */\n StateSystem.prototype.updateCheck = function (func, value) {\n var index = this.checks.indexOf(func);\n if (value && index === -1) {\n this.checks.push(func);\n }\n else if (!value && index !== -1) {\n this.checks.splice(index, 1);\n }\n };\n /**\n * A private little wrapper function that we call to check the blend mode.\n *\n * @param System - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n StateSystem.checkBlendMode = function (system, state) {\n system.setBlendMode(state.blendMode);\n };\n /**\n * A private little wrapper function that we call to check the polygon offset.\n *\n * @param System - the System to perform the state check on\n * @param state - the state that the blendMode will pulled from\n */\n StateSystem.checkPolygonOffset = function (system, state) {\n system.setPolygonOffset(1, state.polygonOffset);\n };\n /**\n * @ignore\n */\n StateSystem.prototype.destroy = function () {\n this.gl = null;\n };\n return StateSystem;\n}());\n\n/**\n * System plugin to the renderer to manage texture garbage collection on the GPU,\n * ensuring that it does not get clogged up with textures that are no longer being used.\n *\n * @class\n * @memberof PIXI\n * @extends PIXI.System\n */\nvar TextureGCSystem = /** @class */ (function () {\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function TextureGCSystem(renderer) {\n this.renderer = renderer;\n /**\n * Count\n * @member {number}\n * @readonly\n */\n this.count = 0;\n /**\n * Check count\n * @member {number}\n * @readonly\n */\n this.checkCount = 0;\n /**\n * Maximum idle time, in seconds\n * @member {number}\n * @see PIXI.settings.GC_MAX_IDLE\n */\n this.maxIdle = settings.GC_MAX_IDLE;\n /**\n * Maximum number of item to check\n * @member {number}\n * @see PIXI.settings.GC_MAX_CHECK_COUNT\n */\n this.checkCountMax = settings.GC_MAX_CHECK_COUNT;\n /**\n * Current garbage collection mode\n * @member {PIXI.GC_MODES}\n * @see PIXI.settings.GC_MODE\n */\n this.mode = settings.GC_MODE;\n }\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n TextureGCSystem.prototype.postrender = function () {\n if (!this.renderer.renderingToScreen) {\n return;\n }\n this.count++;\n if (this.mode === GC_MODES.MANUAL) {\n return;\n }\n this.checkCount++;\n if (this.checkCount > this.checkCountMax) {\n this.checkCount = 0;\n this.run();\n }\n };\n /**\n * Checks to see when the last time a texture was used\n * if the texture has not been used for a specified amount of time it will be removed from the GPU\n */\n TextureGCSystem.prototype.run = function () {\n var tm = this.renderer.texture;\n var managedTextures = tm.managedTextures;\n var wasRemoved = false;\n for (var i = 0; i < managedTextures.length; i++) {\n var texture = managedTextures[i];\n // only supports non generated textures at the moment!\n if (!texture.framebuffer && this.count - texture.touched > this.maxIdle) {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n if (wasRemoved) {\n var j = 0;\n for (var i = 0; i < managedTextures.length; i++) {\n if (managedTextures[i] !== null) {\n managedTextures[j++] = managedTextures[i];\n }\n }\n managedTextures.length = j;\n }\n };\n /**\n * Removes all the textures within the specified displayObject and its children from the GPU\n *\n * @param {PIXI.DisplayObject} displayObject - the displayObject to remove the textures from.\n */\n TextureGCSystem.prototype.unload = function (displayObject) {\n var tm = this.renderer.texture;\n var texture = displayObject._texture;\n // only destroy non generated textures\n if (texture && !texture.framebuffer) {\n tm.destroyTexture(texture);\n }\n for (var i = displayObject.children.length - 1; i >= 0; i--) {\n this.unload(displayObject.children[i]);\n }\n };\n /**\n * @ignore\n */\n TextureGCSystem.prototype.destroy = function () {\n this.renderer = null;\n };\n return TextureGCSystem;\n}());\n\n/**\n * Returns a lookup table that maps each type-format pair to a compatible internal format.\n *\n * @memberof PIXI\n * @function mapTypeAndFormatToInternalFormat\n * @private\n * @param {WebGLRenderingContext} gl - The rendering context.\n * @return {{ [type: number]: { [format: number]: number } }} Lookup table.\n */\nfunction mapTypeAndFormatToInternalFormat(gl) {\n var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;\n var table;\n if ('WebGL2RenderingContext' in self && gl instanceof self.WebGL2RenderingContext) {\n table = (_a = {},\n _a[TYPES.UNSIGNED_BYTE] = (_b = {},\n _b[FORMATS.RGBA] = gl.RGBA8,\n _b[FORMATS.RGB] = gl.RGB8,\n _b[FORMATS.RG] = gl.RG8,\n _b[FORMATS.RED] = gl.R8,\n _b[FORMATS.RGBA_INTEGER] = gl.RGBA8UI,\n _b[FORMATS.RGB_INTEGER] = gl.RGB8UI,\n _b[FORMATS.RG_INTEGER] = gl.RG8UI,\n _b[FORMATS.RED_INTEGER] = gl.R8UI,\n _b[FORMATS.ALPHA] = gl.ALPHA,\n _b[FORMATS.LUMINANCE] = gl.LUMINANCE,\n _b[FORMATS.LUMINANCE_ALPHA] = gl.LUMINANCE_ALPHA,\n _b),\n _a[TYPES.BYTE] = (_c = {},\n _c[FORMATS.RGBA] = gl.RGBA8_SNORM,\n _c[FORMATS.RGB] = gl.RGB8_SNORM,\n _c[FORMATS.RG] = gl.RG8_SNORM,\n _c[FORMATS.RED] = gl.R8_SNORM,\n _c[FORMATS.RGBA_INTEGER] = gl.RGBA8I,\n _c[FORMATS.RGB_INTEGER] = gl.RGB8I,\n _c[FORMATS.RG_INTEGER] = gl.RG8I,\n _c[FORMATS.RED_INTEGER] = gl.R8I,\n _c),\n _a[TYPES.UNSIGNED_SHORT] = (_d = {},\n _d[FORMATS.RGBA_INTEGER] = gl.RGBA16UI,\n _d[FORMATS.RGB_INTEGER] = gl.RGB16UI,\n _d[FORMATS.RG_INTEGER] = gl.RG16UI,\n _d[FORMATS.RED_INTEGER] = gl.R16UI,\n _d[FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT16,\n _d),\n _a[TYPES.SHORT] = (_e = {},\n _e[FORMATS.RGBA_INTEGER] = gl.RGBA16I,\n _e[FORMATS.RGB_INTEGER] = gl.RGB16I,\n _e[FORMATS.RG_INTEGER] = gl.RG16I,\n _e[FORMATS.RED_INTEGER] = gl.R16I,\n _e),\n _a[TYPES.UNSIGNED_INT] = (_f = {},\n _f[FORMATS.RGBA_INTEGER] = gl.RGBA32UI,\n _f[FORMATS.RGB_INTEGER] = gl.RGB32UI,\n _f[FORMATS.RG_INTEGER] = gl.RG32UI,\n _f[FORMATS.RED_INTEGER] = gl.R32UI,\n _f[FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT24,\n _f),\n _a[TYPES.INT] = (_g = {},\n _g[FORMATS.RGBA_INTEGER] = gl.RGBA32I,\n _g[FORMATS.RGB_INTEGER] = gl.RGB32I,\n _g[FORMATS.RG_INTEGER] = gl.RG32I,\n _g[FORMATS.RED_INTEGER] = gl.R32I,\n _g),\n _a[TYPES.FLOAT] = (_h = {},\n _h[FORMATS.RGBA] = gl.RGBA32F,\n _h[FORMATS.RGB] = gl.RGB32F,\n _h[FORMATS.RG] = gl.RG32F,\n _h[FORMATS.RED] = gl.R32F,\n _h[FORMATS.DEPTH_COMPONENT] = gl.DEPTH_COMPONENT32F,\n _h),\n _a[TYPES.HALF_FLOAT] = (_j = {},\n _j[FORMATS.RGBA] = gl.RGBA16F,\n _j[FORMATS.RGB] = gl.RGB16F,\n _j[FORMATS.RG] = gl.RG16F,\n _j[FORMATS.RED] = gl.R16F,\n _j),\n _a[TYPES.UNSIGNED_SHORT_5_6_5] = (_k = {},\n _k[FORMATS.RGB] = gl.RGB565,\n _k),\n _a[TYPES.UNSIGNED_SHORT_4_4_4_4] = (_l = {},\n _l[FORMATS.RGBA] = gl.RGBA4,\n _l),\n _a[TYPES.UNSIGNED_SHORT_5_5_5_1] = (_m = {},\n _m[FORMATS.RGBA] = gl.RGB5_A1,\n _m),\n _a[TYPES.UNSIGNED_INT_2_10_10_10_REV] = (_o = {},\n _o[FORMATS.RGBA] = gl.RGB10_A2,\n _o[FORMATS.RGBA_INTEGER] = gl.RGB10_A2UI,\n _o),\n _a[TYPES.UNSIGNED_INT_10F_11F_11F_REV] = (_p = {},\n _p[FORMATS.RGB] = gl.R11F_G11F_B10F,\n _p),\n _a[TYPES.UNSIGNED_INT_5_9_9_9_REV] = (_q = {},\n _q[FORMATS.RGB] = gl.RGB9_E5,\n _q),\n _a[TYPES.UNSIGNED_INT_24_8] = (_r = {},\n _r[FORMATS.DEPTH_STENCIL] = gl.DEPTH24_STENCIL8,\n _r),\n _a[TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV] = (_s = {},\n _s[FORMATS.DEPTH_STENCIL] = gl.DEPTH32F_STENCIL8,\n _s),\n _a);\n }\n else {\n table = (_t = {},\n _t[TYPES.UNSIGNED_BYTE] = (_u = {},\n _u[FORMATS.RGBA] = gl.RGBA,\n _u[FORMATS.RGB] = gl.RGB,\n _u[FORMATS.ALPHA] = gl.ALPHA,\n _u[FORMATS.LUMINANCE] = gl.LUMINANCE,\n _u[FORMATS.LUMINANCE_ALPHA] = gl.LUMINANCE_ALPHA,\n _u),\n _t[TYPES.UNSIGNED_SHORT_5_6_5] = (_v = {},\n _v[FORMATS.RGB] = gl.RGB,\n _v),\n _t[TYPES.UNSIGNED_SHORT_4_4_4_4] = (_w = {},\n _w[FORMATS.RGBA] = gl.RGBA,\n _w),\n _t[TYPES.UNSIGNED_SHORT_5_5_5_1] = (_x = {},\n _x[FORMATS.RGBA] = gl.RGBA,\n _x),\n _t);\n }\n return table;\n}\n\n/**\n * Internal texture for WebGL context\n * @class\n * @memberof PIXI\n */\nvar GLTexture = /** @class */ (function () {\n function GLTexture(texture) {\n /**\n * The WebGL texture\n * @member {WebGLTexture}\n */\n this.texture = texture;\n /**\n * Width of texture that was used in texImage2D\n * @member {number}\n */\n this.width = -1;\n /**\n * Height of texture that was used in texImage2D\n * @member {number}\n */\n this.height = -1;\n /**\n * Texture contents dirty flag\n * @member {number}\n */\n this.dirtyId = -1;\n /**\n * Texture style dirty flag\n * @member {number}\n */\n this.dirtyStyleId = -1;\n /**\n * Whether mip levels has to be generated\n * @member {boolean}\n */\n this.mipmap = false;\n /**\n * WrapMode copied from baseTexture\n * @member {number}\n */\n this.wrapMode = 33071;\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.type = TYPES.UNSIGNED_BYTE;\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.internalFormat = FORMATS.RGBA;\n this.samplerType = 0;\n }\n return GLTexture;\n}());\n\n/**\n * System plugin to the renderer to manage textures.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nvar TextureSystem = /** @class */ (function () {\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function TextureSystem(renderer) {\n this.renderer = renderer;\n // TODO set to max textures...\n /**\n * Bound textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.boundTextures = [];\n /**\n * Current location\n * @member {number}\n * @readonly\n */\n this.currentLocation = -1;\n /**\n * List of managed textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.managedTextures = [];\n /**\n * Did someone temper with textures state? We'll overwrite them when we need to unbind something.\n * @member {boolean}\n * @private\n */\n this._unknownBoundTextures = false;\n /**\n * BaseTexture value that shows that we don't know what is bound\n * @member {PIXI.BaseTexture}\n * @readonly\n */\n this.unknownTexture = new BaseTexture();\n this.hasIntegerTextures = false;\n }\n /**\n * Sets up the renderer context and necessary buffers.\n */\n TextureSystem.prototype.contextChange = function () {\n var gl = this.gl = this.renderer.gl;\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n this.webGLVersion = this.renderer.context.webGLVersion;\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n var maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n this.boundTextures.length = maxTextures;\n for (var i = 0; i < maxTextures; i++) {\n this.boundTextures[i] = null;\n }\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n var emptyTexture2D = new GLTexture(gl.createTexture());\n gl.bindTexture(gl.TEXTURE_2D, emptyTexture2D.texture);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array(4));\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n for (var i = 0; i < 6; i++) {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_CUBE_MAP, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n for (var i = 0; i < this.boundTextures.length; i++) {\n this.bind(null, i);\n }\n };\n /**\n * Bind a texture to a specific location\n *\n * If you want to unbind something, please use `unbind(texture)` instead of `bind(null, textureLocation)`\n *\n * @param {PIXI.Texture|PIXI.BaseTexture} texture_ - Texture to bind\n * @param {number} [location=0] - Location to bind at\n */\n TextureSystem.prototype.bind = function (texture, location) {\n if (location === void 0) { location = 0; }\n var gl = this.gl;\n texture = texture === null || texture === void 0 ? void 0 : texture.castToBaseTexture();\n // cannot bind partial texture\n // TODO: report a warning\n if (texture && texture.valid && !texture.parentTextureArray) {\n texture.touched = this.renderer.textureGC.count;\n var glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n if (this.boundTextures[location] !== texture) {\n if (this.currentLocation !== location) {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(texture.target, glTexture.texture);\n }\n if (glTexture.dirtyId !== texture.dirtyId) {\n if (this.currentLocation !== location) {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n this.boundTextures[location] = texture;\n }\n else {\n if (this.currentLocation !== location) {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\n };\n /**\n * Resets texture location and bound textures\n *\n * Actual `bind(null, i)` calls will be performed at next `unbind()` call\n */\n TextureSystem.prototype.reset = function () {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n for (var i = 0; i < this.boundTextures.length; i++) {\n this.boundTextures[i] = this.unknownTexture;\n }\n };\n /**\n * Unbind a texture\n * @param {PIXI.BaseTexture} texture - Texture to bind\n */\n TextureSystem.prototype.unbind = function (texture) {\n var _a = this, gl = _a.gl, boundTextures = _a.boundTextures;\n if (this._unknownBoundTextures) {\n this._unknownBoundTextures = false;\n // someone changed webGL state,\n // we have to be sure that our texture does not appear in multi-texture renderer samplers\n for (var i = 0; i < boundTextures.length; i++) {\n if (boundTextures[i] === this.unknownTexture) {\n this.bind(null, i);\n }\n }\n }\n for (var i = 0; i < boundTextures.length; i++) {\n if (boundTextures[i] === texture) {\n if (this.currentLocation !== i) {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\n }\n };\n /**\n * Ensures that current boundTextures all have FLOAT sampler type,\n * see {@link PIXI.SAMPLER_TYPES} for explanation.\n *\n * @param maxTextures - number of locations to check\n */\n TextureSystem.prototype.ensureSamplerType = function (maxTextures) {\n var _a = this, boundTextures = _a.boundTextures, hasIntegerTextures = _a.hasIntegerTextures, CONTEXT_UID = _a.CONTEXT_UID;\n if (!hasIntegerTextures) {\n return;\n }\n for (var i = maxTextures - 1; i >= 0; --i) {\n var tex = boundTextures[i];\n if (tex) {\n var glTexture = tex._glTextures[CONTEXT_UID];\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT) {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n };\n /**\n * Initialize a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n TextureSystem.prototype.initTexture = function (texture) {\n var glTexture = new GLTexture(this.gl.createTexture());\n // guarantee an update..\n glTexture.dirtyId = -1;\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n return glTexture;\n };\n TextureSystem.prototype.initTextureType = function (texture, glTexture) {\n var _a, _b;\n glTexture.internalFormat = (_b = (_a = this.internalFormats[texture.type]) === null || _a === void 0 ? void 0 : _a[texture.format]) !== null && _b !== void 0 ? _b : texture.format;\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT) {\n // TYPES.HALF_FLOAT is WebGL1 HALF_FLOAT_OES\n // we have to convert it to WebGL HALF_FLOAT\n glTexture.type = this.gl.HALF_FLOAT;\n }\n else {\n glTexture.type = texture.type;\n }\n };\n /**\n * Update a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n TextureSystem.prototype.updateTexture = function (texture) {\n var glTexture = texture._glTextures[this.CONTEXT_UID];\n if (!glTexture) {\n return;\n }\n var renderer = this.renderer;\n this.initTextureType(texture, glTexture);\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture)) {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT) {\n this.hasIntegerTextures = true;\n }\n }\n else {\n // default, renderTexture-like logic\n var width = texture.realWidth;\n var height = texture.realHeight;\n var gl = renderer.gl;\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0) {\n glTexture.width = width;\n glTexture.height = height;\n gl.texImage2D(texture.target, 0, glTexture.internalFormat, width, height, 0, texture.format, glTexture.type, null);\n }\n }\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId) {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n };\n /**\n * Deletes the texture from WebGL\n *\n * @private\n * @param {PIXI.BaseTexture|PIXI.Texture} texture_ - the texture to destroy\n * @param {boolean} [skipRemove=false] - Whether to skip removing the texture from the TextureManager.\n */\n TextureSystem.prototype.destroyTexture = function (texture, skipRemove) {\n var gl = this.gl;\n texture = texture.castToBaseTexture();\n if (texture._glTextures[this.CONTEXT_UID]) {\n this.unbind(texture);\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n delete texture._glTextures[this.CONTEXT_UID];\n if (!skipRemove) {\n var i = this.managedTextures.indexOf(texture);\n if (i !== -1) {\n removeItems(this.managedTextures, i, 1);\n }\n }\n }\n };\n /**\n * Update texture style such as mipmap flag\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n */\n TextureSystem.prototype.updateTextureStyle = function (texture) {\n var glTexture = texture._glTextures[this.CONTEXT_UID];\n if (!glTexture) {\n return;\n }\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo) {\n glTexture.mipmap = false;\n }\n else {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo) {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else {\n glTexture.wrapMode = texture.wrapMode;\n }\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture)) ;\n else {\n this.setStyle(texture, glTexture);\n }\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n };\n /**\n * Set style for texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to update\n * @param {PIXI.GLTexture} glTexture\n */\n TextureSystem.prototype.setStyle = function (texture, glTexture) {\n var gl = this.gl;\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL) {\n gl.generateMipmap(texture.target);\n }\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n if (glTexture.mipmap) {\n /* eslint-disable max-len */\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR_MIPMAP_LINEAR : gl.NEAREST_MIPMAP_NEAREST);\n /* eslint-disable max-len */\n var anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR) {\n var level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n };\n /**\n * @ignore\n */\n TextureSystem.prototype.destroy = function () {\n this.renderer = null;\n };\n return TextureSystem;\n}());\n\n\n\nvar _systems = {\n __proto__: null,\n FilterSystem: FilterSystem,\n BatchSystem: BatchSystem,\n ContextSystem: ContextSystem,\n FramebufferSystem: FramebufferSystem,\n GeometrySystem: GeometrySystem,\n MaskSystem: MaskSystem,\n ScissorSystem: ScissorSystem,\n StencilSystem: StencilSystem,\n ProjectionSystem: ProjectionSystem,\n RenderTextureSystem: RenderTextureSystem,\n ShaderSystem: ShaderSystem,\n StateSystem: StateSystem,\n TextureGCSystem: TextureGCSystem,\n TextureSystem: TextureSystem\n};\n\nvar tempMatrix$2 = new Matrix();\n/**\n * The AbstractRenderer is the base for a PixiJS Renderer. It is extended by the {@link PIXI.CanvasRenderer}\n * and {@link PIXI.Renderer} which can be used for rendering a PixiJS scene.\n *\n * @abstract\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nvar AbstractRenderer = /** @class */ (function (_super) {\n __extends(AbstractRenderer, _super);\n /**\n * @param system - The name of the system this renderer is for.\n * @param [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.useContextAlpha=true] - Pass-through value for canvas' context `alpha` property.\n * If you want to set transparency, please use `backgroundAlpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear the canvas or\n * not before the new render pass.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {number} [options.backgroundAlpha=1] - Value from 0 (fully transparent) to 1 (fully opaque).\n */\n function AbstractRenderer(type, options) {\n if (type === void 0) { type = RENDERER_TYPE.UNKNOWN; }\n var _this = _super.call(this) || this;\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n _this.options = options;\n /**\n * The type of the renderer.\n *\n * @member {number}\n * @default PIXI.RENDERER_TYPE.UNKNOWN\n * @see PIXI.RENDERER_TYPE\n */\n _this.type = type;\n /**\n * Measurements of the screen. (0, 0, screenWidth, screenHeight).\n *\n * Its safe to use as filterArea or hitArea for the whole stage.\n *\n * @member {PIXI.Rectangle}\n */\n _this.screen = new Rectangle(0, 0, options.width, options.height);\n /**\n * The canvas element that everything is drawn to.\n *\n * @member {HTMLCanvasElement}\n */\n _this.view = options.view || document.createElement('canvas');\n /**\n * The resolution / device pixel ratio of the renderer.\n *\n * @member {number}\n * @default PIXI.settings.RESOLUTION\n */\n _this.resolution = options.resolution || settings.RESOLUTION;\n /**\n * Pass-thru setting for the the canvas' context `alpha` property. This is typically\n * not something you need to fiddle with. If you want transparency, use `backgroundAlpha`.\n *\n * @member {boolean}\n */\n _this.useContextAlpha = options.useContextAlpha;\n /**\n * Whether CSS dimensions of canvas view should be resized to screen dimensions automatically.\n *\n * @member {boolean}\n */\n _this.autoDensity = !!options.autoDensity;\n /**\n * The value of the preserveDrawingBuffer flag affects whether or not the contents of\n * the stencil buffer is retained after rendering.\n *\n * @member {boolean}\n */\n _this.preserveDrawingBuffer = options.preserveDrawingBuffer;\n /**\n * This sets if the CanvasRenderer will clear the canvas or not before the new render pass.\n * If the scene is NOT transparent PixiJS will use a canvas sized fillRect operation every\n * frame to set the canvas background color. If the scene is transparent PixiJS will use clearRect\n * to clear the canvas every frame. Disable this by setting this to false. For example, if\n * your game has a canvas filling background image you often don't need this set.\n *\n * @member {boolean}\n * @default\n */\n _this.clearBeforeRender = options.clearBeforeRender;\n /**\n * The background color as a number.\n *\n * @member {number}\n * @protected\n */\n _this._backgroundColor = 0x000000;\n /**\n * The background color as an [R, G, B, A] array.\n *\n * @member {number[]}\n * @protected\n */\n _this._backgroundColorRgba = [0, 0, 0, 1];\n /**\n * The background color as a string.\n *\n * @member {string}\n * @protected\n */\n _this._backgroundColorString = '#000000';\n _this.backgroundColor = options.backgroundColor || _this._backgroundColor; // run bg color setter\n _this.backgroundAlpha = options.backgroundAlpha;\n // @deprecated\n if (options.transparent !== undefined) {\n deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.');\n _this.useContextAlpha = options.transparent;\n _this.backgroundAlpha = options.transparent ? 0 : 1;\n }\n /**\n * The last root object that the renderer tried to render.\n *\n * @member {PIXI.DisplayObject}\n * @protected\n */\n _this._lastObjectRendered = null;\n /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n _this.plugins = {};\n return _this;\n }\n /**\n * Initialize the plugins.\n *\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n AbstractRenderer.prototype.initPlugins = function (staticMap) {\n for (var o in staticMap) {\n this.plugins[o] = new (staticMap[o])(this);\n }\n };\n Object.defineProperty(AbstractRenderer.prototype, \"width\", {\n /**\n * Same as view.width, actual number of pixels in the canvas by horizontal.\n *\n * @member {number}\n * @readonly\n * @default 800\n */\n get: function () {\n return this.view.width;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AbstractRenderer.prototype, \"height\", {\n /**\n * Same as view.height, actual number of pixels in the canvas by vertical.\n *\n * @member {number}\n * @readonly\n * @default 600\n */\n get: function () {\n return this.view.height;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Resizes the screen and canvas as close as possible to the specified width and height.\n * Canvas dimensions are multiplied by resolution and rounded to the nearest integers.\n * The new canvas dimensions divided by the resolution become the new screen dimensions.\n *\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n AbstractRenderer.prototype.resize = function (desiredScreenWidth, desiredScreenHeight) {\n this.view.width = Math.round(desiredScreenWidth * this.resolution);\n this.view.height = Math.round(desiredScreenHeight * this.resolution);\n var screenWidth = this.view.width / this.resolution;\n var screenHeight = this.view.height / this.resolution;\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n if (this.autoDensity) {\n this.view.style.width = screenWidth + \"px\";\n this.view.style.height = screenHeight + \"px\";\n }\n /**\n * Fired after view has been resized.\n *\n * @event PIXI.Renderer#resize\n * @param {number} screenWidth - The new width of the screen.\n * @param {number} screenHeight - The new height of the screen.\n */\n this.emit('resize', screenWidth, screenHeight);\n };\n /**\n * @ignore\n */\n AbstractRenderer.prototype.generateTexture = function (displayObject, options, resolution, region) {\n if (options === void 0) { options = {}; }\n // @deprecated parameters spread, use options instead\n if (typeof options === 'number') {\n deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.');\n options = { scaleMode: options, resolution: resolution, region: region };\n }\n var manualRegion = options.region, textureOptions = __rest(options, [\"region\"]);\n region = manualRegion || displayObject.getLocalBounds(null, true);\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0)\n { region.width = 1; }\n if (region.height === 0)\n { region.height = 1; }\n var renderTexture = RenderTexture.create(__assign({ width: region.width, height: region.height }, textureOptions));\n tempMatrix$2.tx = -region.x;\n tempMatrix$2.ty = -region.y;\n this.render(displayObject, {\n renderTexture: renderTexture,\n clear: false,\n transform: tempMatrix$2,\n skipUpdateTransform: !!displayObject.parent\n });\n return renderTexture;\n };\n /**\n * Removes everything from the renderer and optionally removes the Canvas DOM element.\n *\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n */\n AbstractRenderer.prototype.destroy = function (removeView) {\n for (var o in this.plugins) {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n if (removeView && this.view.parentNode) {\n this.view.parentNode.removeChild(this.view);\n }\n var thisAny = this;\n // null-ing all objects, that's a tradition!\n thisAny.plugins = null;\n thisAny.type = RENDERER_TYPE.UNKNOWN;\n thisAny.view = null;\n thisAny.screen = null;\n thisAny._tempDisplayObjectParent = null;\n thisAny.options = null;\n this._backgroundColorRgba = null;\n this._backgroundColorString = null;\n this._lastObjectRendered = null;\n };\n Object.defineProperty(AbstractRenderer.prototype, \"backgroundColor\", {\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n get: function () {\n return this._backgroundColor;\n },\n set: function (value) {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(AbstractRenderer.prototype, \"backgroundAlpha\", {\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n *\n * @member {number}\n */\n get: function () {\n return this._backgroundColorRgba[3];\n },\n set: function (value) {\n this._backgroundColorRgba[3] = value;\n },\n enumerable: false,\n configurable: true\n });\n return AbstractRenderer;\n}(eventemitter3));\n\nvar GLBuffer = /** @class */ (function () {\n function GLBuffer(buffer) {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n return GLBuffer;\n}());\n\n/**\n * System plugin to the renderer to manage buffers.\n *\n * WebGL uses Buffers as a way to store objects to the GPU.\n * This system makes working with them a lot easier.\n *\n * Buffers are used in three main places in WebGL\n * - geometry information\n * - Uniform information (via uniform buffer objects - a WebGL 2 only feature)\n * - Transform feedback information. (WebGL 2 only feature)\n *\n * This system will handle the binding of buffers to the GPU as well as uploading\n * them. With this system, you never need to work directly with GPU buffers, but instead work with\n * the PIXI.Buffer class.\n *\n *\n * @class\n * @memberof PIXI\n */\nvar BufferSystem = /** @class */ (function () {\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n function BufferSystem(renderer) {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n /**\n * @ignore\n */\n BufferSystem.prototype.destroy = function () {\n this.renderer = null;\n };\n /**\n * Sets up the renderer context and necessary buffers.\n */\n BufferSystem.prototype.contextChange = function () {\n this.disposeAll(true);\n this.gl = this.renderer.gl;\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n };\n /**\n * This binds specified buffer. On first run, it will create the webGL buffers for the context too\n *\n * @param buffer - the buffer to bind to the renderer\n */\n BufferSystem.prototype.bind = function (buffer) {\n var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID;\n var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n };\n /**\n * Binds an uniform buffer to at the given index.\n *\n * A cache is used so a buffer will not be bound again if already bound.\n *\n * @param buffer - the buffer to bind\n * @param index - the base index to bind it to.\n */\n BufferSystem.prototype.bindBufferBase = function (buffer, index) {\n var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID;\n if (this.boundBufferBases[index] !== buffer) {\n var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n this.boundBufferBases[index] = buffer;\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\n };\n /**\n * Binds a buffer whilst also binding its range.\n * This will make the buffer start from the offset supplied rather than 0 when it is read.\n *\n * @param buffer - the buffer to bind\n * @param index - the base index to bind at, defaults to 0\n * @param offset - the offset to bind at (this is blocks of 256). 0 = 0, 1 = 256, 2 = 512 etc\n */\n BufferSystem.prototype.bindBufferRange = function (buffer, index, offset) {\n var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID;\n offset = offset || 0;\n var glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n };\n /**\n * Will ensure sure the the data in the buffer is uploaded to the GPU.\n *\n * @param {PIXI.Buffer} buffer - the buffer to update\n */\n BufferSystem.prototype.update = function (buffer) {\n var _a = this, gl = _a.gl, CONTEXT_UID = _a.CONTEXT_UID;\n var glBuffer = buffer._glBuffers[CONTEXT_UID];\n if (buffer._updateID === glBuffer.updateID) {\n return;\n }\n glBuffer.updateID = buffer._updateID;\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n if (glBuffer.byteLength >= buffer.data.byteLength) {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else {\n var drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\n };\n /**\n * Disposes buffer\n * @param {PIXI.Buffer} buffer - buffer with data\n * @param {boolean} [contextLost=false] - If context was lost, we suppress deleteVertexArray\n */\n BufferSystem.prototype.dispose = function (buffer, contextLost) {\n if (!this.managedBuffers[buffer.id]) {\n return;\n }\n delete this.managedBuffers[buffer.id];\n var glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n var gl = this.gl;\n buffer.disposeRunner.remove(this);\n if (!glBuffer) {\n return;\n }\n if (!contextLost) {\n gl.deleteBuffer(glBuffer.buffer);\n }\n delete buffer._glBuffers[this.CONTEXT_UID];\n };\n /**\n * dispose all WebGL resources of all managed buffers\n * @param {boolean} [contextLost=false] - If context was lost, we suppress `gl.delete` calls\n */\n BufferSystem.prototype.disposeAll = function (contextLost) {\n var all = Object.keys(this.managedBuffers);\n for (var i = 0; i < all.length; i++) {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n };\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @protected\n */\n BufferSystem.prototype.createGLBuffer = function (buffer) {\n var _a = this, CONTEXT_UID = _a.CONTEXT_UID, gl = _a.gl;\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n this.managedBuffers[buffer.id] = buffer;\n buffer.disposeRunner.add(this);\n return buffer._glBuffers[CONTEXT_UID];\n };\n return BufferSystem;\n}());\n\n/**\n * The Renderer draws the scene and all its content onto a WebGL enabled canvas.\n *\n * This renderer should be used for browsers that support WebGL.\n *\n * This renderer works by automatically managing WebGLBatchesm, so no need for Sprite Batches or Sprite Clouds.\n * Don't forget to add the view to your DOM or you will not see anything!\n *\n * Renderer is composed of systems that manage specific tasks. The following systems are added by default\n * whenever you create a renderer:\n *\n * | System | Description |\n * | ------------------------------------ | ----------------------------------------------------------------------------- |\n * | {@link PIXI.BatchSystem} | This manages object renderers that defer rendering until a flush. |\n * | {@link PIXI.ContextSystem} | This manages the WebGL context and extensions. |\n * | {@link PIXI.EventSystem} | This manages UI events. |\n * | {@link PIXI.FilterSystem} | This manages the filtering pipeline for post-processing effects. |\n * | {@link PIXI.FramebufferSystem} | This manages framebuffers, which are used for offscreen rendering. |\n * | {@link PIXI.GeometrySystem} | This manages geometries & buffers, which are used to draw object meshes. |\n * | {@link PIXI.MaskSystem} | This manages masking operations. |\n * | {@link PIXI.ProjectionSystem} | This manages the `projectionMatrix`, used by shaders to get NDC coordinates. |\n * | {@link PIXI.RenderTextureSystem} | This manages render-textures, which are an abstraction over framebuffers. |\n * | {@link PIXI.ScissorSystem} | This handles scissor masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.ShaderSystem} | This manages shaders, programs that run on the GPU to calculate 'em pixels. |\n * | {@link PIXI.StateSystem} | This manages the WebGL state variables like blend mode, depth testing, etc. |\n * | {@link PIXI.StencilSystem} | This handles stencil masking, and is used internally by {@link MaskSystem} |\n * | {@link PIXI.TextureSystem} | This manages textures and their resources on the GPU. |\n * | {@link PIXI.TextureGCSystem} | This will automatically remove textures from the GPU if they are not used. |\n *\n * The breadth of the API surface provided by the renderer is contained within these systems.\n *\n * @memberof PIXI\n */\nvar Renderer = /** @class */ (function (_super) {\n __extends(Renderer, _super);\n /**\n * @param [options] - The optional renderer parameters.\n * @param {number} [options.width=800] - The width of the screen.\n * @param {number} [options.height=600] - The height of the screen.\n * @param {HTMLCanvasElement} [options.view] - The canvas to use as a view, optional.\n * @param {boolean} [options.useContextAlpha=true] - Pass-through value for canvas' context `alpha` property.\n * If you want to set transparency, please use `backgroundAlpha`. This option is for cases where the\n * canvas needs to be opaque, possibly for performance reasons on some older devices.\n * @param {boolean} [options.autoDensity=false] - Resizes renderer view in CSS pixels to allow for\n * resolutions other than 1.\n * @param {boolean} [options.antialias=false] - Sets antialias. If not available natively then FXAA\n * antialiasing is used.\n * @param {number} [options.resolution=PIXI.settings.RESOLUTION] - The resolution / device pixel ratio of the renderer.\n * @param {boolean} [options.clearBeforeRender=true] - This sets if the renderer will clear\n * the canvas or not before the new render pass. If you wish to set this to false, you *must* set\n * preserveDrawingBuffer to `true`.\n * @param {boolean} [options.preserveDrawingBuffer=false] - Enables drawing buffer preservation,\n * enable this if you need to call toDataUrl on the WebGL context.\n * @param {number} [options.backgroundColor=0x000000] - The background color of the rendered area\n * (shown if not transparent).\n * @param {number} [options.backgroundAlpha=1] - Value from 0 (fully transparent) to 1 (fully opaque).\n * @param {string} [options.powerPreference] - Parameter passed to WebGL context, set to \"high-performance\"\n * for devices with dual graphics card.\n * @param {object} [options.context] - If WebGL context already exists, all parameters must be taken from it.\n */\n function Renderer(options) {\n var _this = _super.call(this, RENDERER_TYPE.WEBGL, options) || this;\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = _this.options;\n _this.gl = null;\n _this.CONTEXT_UID = 0;\n _this.runners = {\n destroy: new Runner('destroy'),\n contextChange: new Runner('contextChange'),\n reset: new Runner('reset'),\n update: new Runner('update'),\n postrender: new Runner('postrender'),\n prerender: new Runner('prerender'),\n resize: new Runner('resize'),\n };\n _this.runners.contextChange.add(_this);\n _this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n _this.addSystem(MaskSystem, 'mask')\n .addSystem(ContextSystem, 'context')\n .addSystem(StateSystem, 'state')\n .addSystem(ShaderSystem, 'shader')\n .addSystem(TextureSystem, 'texture')\n .addSystem(BufferSystem, 'buffer')\n .addSystem(GeometrySystem, 'geometry')\n .addSystem(FramebufferSystem, 'framebuffer')\n .addSystem(ScissorSystem, 'scissor')\n .addSystem(StencilSystem, 'stencil')\n .addSystem(ProjectionSystem, 'projection')\n .addSystem(TextureGCSystem, 'textureGC')\n .addSystem(FilterSystem, 'filter')\n .addSystem(RenderTextureSystem, 'renderTexture')\n .addSystem(BatchSystem, 'batch');\n _this.initPlugins(Renderer.__plugins);\n _this.multisample = undefined;\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context) {\n _this.context.initFromContext(options.context);\n }\n else {\n _this.context.initFromOptions({\n alpha: !!_this.useContextAlpha,\n antialias: options.antialias,\n premultipliedAlpha: _this.useContextAlpha && _this.useContextAlpha !== 'notMultiplied',\n stencil: true,\n preserveDrawingBuffer: options.preserveDrawingBuffer,\n powerPreference: _this.options.powerPreference,\n });\n }\n _this.renderingToScreen = true;\n sayHello(_this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n _this.resize(_this.options.width, _this.options.height);\n return _this;\n }\n /**\n * Create renderer if WebGL is available. Overrideable\n * by the **@pixi/canvas-renderer** package to allow fallback.\n * throws error if WebGL is not available.\n *\n * @private\n */\n Renderer.create = function (options) {\n if (isWebGLSupported()) {\n return new Renderer(options);\n }\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n };\n Renderer.prototype.contextChange = function () {\n var gl = this.gl;\n var samples;\n if (this.context.webGLVersion === 1) {\n var framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n samples = gl.getParameter(gl.SAMPLES);\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else {\n var framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n samples = gl.getParameter(gl.SAMPLES);\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n if (samples >= MSAA_QUALITY.HIGH) {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM) {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW) {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else {\n this.multisample = MSAA_QUALITY.NONE;\n }\n };\n /**\n * Add a new system to the renderer.\n * @param ClassRef - Class reference\n * @param [name] - Property name for system, if not specified\n * will use a static `name` property on the class itself. This\n * name will be assigned as s property on the Renderer so make\n * sure it doesn't collide with properties on Renderer.\n * @return Return instance of renderer\n */\n Renderer.prototype.addSystem = function (ClassRef, name) {\n var system = new ClassRef(this);\n if (this[name]) {\n throw new Error(\"Whoops! The name \\\"\" + name + \"\\\" is already in use\");\n }\n this[name] = system;\n for (var i in this.runners) {\n this.runners[i].add(system);\n }\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.Renderer#postrender\n */\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.Renderer#prerender\n */\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n return this;\n };\n /**\n * @ignore\n */\n Renderer.prototype.render = function (displayObject, options) {\n var renderTexture;\n var clear;\n var transform;\n var skipUpdateTransform;\n if (options) {\n if (options instanceof RenderTexture) {\n deprecation('6.0.0', 'Renderer#render arguments changed, use options instead.');\n /* eslint-disable prefer-rest-params */\n renderTexture = options;\n clear = arguments[2];\n transform = arguments[3];\n skipUpdateTransform = arguments[4];\n /* eslint-enable prefer-rest-params */\n }\n else {\n renderTexture = options.renderTexture;\n clear = options.clear;\n transform = options.transform;\n skipUpdateTransform = options.skipUpdateTransform;\n }\n }\n // can be handy to know!\n this.renderingToScreen = !renderTexture;\n this.runners.prerender.emit();\n this.emit('prerender');\n // apply a transform at a GPU level\n this.projection.transform = transform;\n // no point rendering if our context has been blown up!\n if (this.context.isLost) {\n return;\n }\n if (!renderTexture) {\n this._lastObjectRendered = displayObject;\n }\n if (!skipUpdateTransform) {\n // update the scene graph\n var cacheParent = displayObject.enableTempParent();\n displayObject.updateTransform();\n displayObject.disableTempParent(cacheParent);\n // displayObject.hitArea = //TODO add a temp hit area\n }\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n if (clear !== undefined ? clear : this.clearBeforeRender) {\n this.renderTexture.clear();\n }\n displayObject.render(this);\n // apply transform..\n this.batch.currentRenderer.flush();\n if (renderTexture) {\n renderTexture.baseTexture.update();\n }\n this.runners.postrender.emit();\n // reset transform after render\n this.projection.transform = null;\n this.emit('postrender');\n };\n /**\n * @override\n * @ignore\n */\n Renderer.prototype.generateTexture = function (displayObject, options, resolution, region) {\n if (options === void 0) { options = {}; }\n var renderTexture = _super.prototype.generateTexture.call(this, displayObject, options, resolution, region);\n this.framebuffer.blit();\n return renderTexture;\n };\n /**\n * Resizes the WebGL view to the specified width and height.\n *\n * @param desiredScreenWidth - The desired width of the screen.\n * @param desiredScreenHeight - The desired height of the screen.\n */\n Renderer.prototype.resize = function (desiredScreenWidth, desiredScreenHeight) {\n _super.prototype.resize.call(this, desiredScreenWidth, desiredScreenHeight);\n this.runners.resize.emit(this.screen.height, this.screen.width);\n };\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return Returns itself.\n */\n Renderer.prototype.reset = function () {\n this.runners.reset.emit();\n return this;\n };\n /** Clear the frame buffer. */\n Renderer.prototype.clear = function () {\n this.renderTexture.bind();\n this.renderTexture.clear();\n };\n /**\n * Removes everything from the renderer (event listeners, spritebatch, etc...)\n *\n * @param [removeView=false] - Removes the Canvas element from the DOM.\n * See: https://github.com/pixijs/pixi.js/issues/2233\n */\n Renderer.prototype.destroy = function (removeView) {\n this.runners.destroy.emit();\n for (var r in this.runners) {\n this.runners[r].destroy();\n }\n // call base destroy\n _super.prototype.destroy.call(this, removeView);\n // TODO nullify all the managers..\n this.gl = null;\n };\n Object.defineProperty(Renderer.prototype, \"extract\", {\n /**\n * Please use `plugins.extract` instead.\n * @member {PIXI.Extract} extract\n * @deprecated since 6.0.0\n * @readonly\n */\n get: function () {\n deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.');\n return this.plugins.extract;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Adds a plugin to the renderer.\n *\n * @param pluginName - The name of the plugin.\n * @param ctor - The constructor function or class for the plugin.\n */\n Renderer.registerPlugin = function (pluginName, ctor) {\n Renderer.__plugins = Renderer.__plugins || {};\n Renderer.__plugins[pluginName] = ctor;\n };\n return Renderer;\n}(AbstractRenderer));\n\n/**\n * Used by the batcher to draw batches.\n * Each one of these contains all information required to draw a bound geometry.\n *\n * @memberof PIXI\n */\nvar BatchDrawCall = /** @class */ (function () {\n function BatchDrawCall() {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n this.start = 0;\n this.size = 0;\n this.data = null;\n }\n return BatchDrawCall;\n}());\n\n/**\n * Used by the batcher to build texture batches.\n * Holds list of textures and their respective locations.\n *\n * @memberof PIXI\n */\nvar BatchTextureArray = /** @class */ (function () {\n function BatchTextureArray() {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n BatchTextureArray.prototype.clear = function () {\n for (var i = 0; i < this.count; i++) {\n this.elements[i] = null;\n }\n this.count = 0;\n };\n return BatchTextureArray;\n}());\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n *\n * @class\n * @memberof PIXI\n */\nvar ViewableBuffer = /** @class */ (function () {\n function ViewableBuffer(sizeOrBuffer) {\n if (typeof sizeOrBuffer === 'number') {\n /**\n * Underlying `ArrayBuffer` that holds all the data and is of capacity `this.size`.\n *\n * @member {ArrayBuffer}\n */\n this.rawBinaryData = new ArrayBuffer(sizeOrBuffer);\n }\n else if (sizeOrBuffer instanceof Uint8Array) {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else {\n this.rawBinaryData = sizeOrBuffer;\n }\n /**\n * View on the raw binary data as a `Uint32Array`.\n *\n * @member {Uint32Array}\n */\n this.uint32View = new Uint32Array(this.rawBinaryData);\n /**\n * View on the raw binary data as a `Float32Array`.\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n Object.defineProperty(ViewableBuffer.prototype, \"int8View\", {\n /**\n * View on the raw binary data as a `Int8Array`.\n *\n * @member {Int8Array}\n */\n get: function () {\n if (!this._int8View) {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n return this._int8View;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ViewableBuffer.prototype, \"uint8View\", {\n /**\n * View on the raw binary data as a `Uint8Array`.\n *\n * @member {Uint8Array}\n */\n get: function () {\n if (!this._uint8View) {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n return this._uint8View;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ViewableBuffer.prototype, \"int16View\", {\n /**\n * View on the raw binary data as a `Int16Array`.\n *\n * @member {Int16Array}\n */\n get: function () {\n if (!this._int16View) {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n return this._int16View;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ViewableBuffer.prototype, \"uint16View\", {\n /**\n * View on the raw binary data as a `Uint16Array`.\n *\n * @member {Uint16Array}\n */\n get: function () {\n if (!this._uint16View) {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n return this._uint16View;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(ViewableBuffer.prototype, \"int32View\", {\n /**\n * View on the raw binary data as a `Int32Array`.\n *\n * @member {Int32Array}\n */\n get: function () {\n if (!this._int32View) {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n return this._int32View;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Returns the view of the given type.\n *\n * @param {string} type - One of `int8`, `uint8`, `int16`,\n * `uint16`, `int32`, `uint32`, and `float32`.\n * @return {object} typed array of given type\n */\n ViewableBuffer.prototype.view = function (type) {\n return this[type + \"View\"];\n };\n /**\n * Destroys all buffer references. Do not use after calling\n * this.\n */\n ViewableBuffer.prototype.destroy = function () {\n this.rawBinaryData = null;\n this._int8View = null;\n this._uint8View = null;\n this._int16View = null;\n this._uint16View = null;\n this._int32View = null;\n this.uint32View = null;\n this.float32View = null;\n };\n ViewableBuffer.sizeOf = function (type) {\n switch (type) {\n case 'int8':\n case 'uint8':\n return 1;\n case 'int16':\n case 'uint16':\n return 2;\n case 'int32':\n case 'uint32':\n case 'float32':\n return 4;\n default:\n throw new Error(type + \" isn't a valid view type\");\n }\n };\n return ViewableBuffer;\n}());\n\n/**\n * Renderer dedicated to drawing and batching sprites.\n *\n * This is the default batch renderer. It buffers objects\n * with texture-based geometries and renders them in\n * batches. It uploads multiple textures to the GPU to\n * reduce to the number of draw calls.\n *\n * @memberof PIXI\n */\nvar AbstractBatchRenderer = /** @class */ (function (_super) {\n __extends(AbstractBatchRenderer, _super);\n /**\n * This will hook onto the renderer's `contextChange`\n * and `prerender` signals.\n *\n * @param {PIXI.Renderer} renderer - The renderer this works for.\n */\n function AbstractBatchRenderer(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.shaderGenerator = null;\n _this.geometryClass = null;\n _this.vertexSize = null;\n _this.state = State.for2d();\n _this.size = settings.SPRITE_BATCH_SIZE * 4;\n _this._vertexCount = 0;\n _this._indexCount = 0;\n _this._bufferedElements = [];\n _this._bufferedTextures = [];\n _this._bufferSize = 0;\n _this._shader = null;\n _this._packedGeometries = [];\n _this._packedGeometryPoolSize = 2;\n _this._flushId = 0;\n _this._aBuffers = {};\n _this._iBuffers = {};\n _this.MAX_TEXTURES = 1;\n _this.renderer.on('prerender', _this.onPrerender, _this);\n renderer.runners.contextChange.add(_this);\n _this._dcIndex = 0;\n _this._aIndex = 0;\n _this._iIndex = 0;\n _this._attributeBuffer = null;\n _this._indexBuffer = null;\n _this._tempBoundTextures = [];\n return _this;\n }\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.\n */\n AbstractBatchRenderer.prototype.contextChange = function () {\n var gl = this.renderer.gl;\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY) {\n this.MAX_TEXTURES = 1;\n }\n else {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS), settings.SPRITE_MAX_TEXTURES);\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl);\n }\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n // we use the second shader as the first one depending on your browser\n // may omit aTextureId as it is not used by the shader so is optimized out.\n for (var i = 0; i < this._packedGeometryPoolSize; i++) {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n this.initFlushBuffers();\n };\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n AbstractBatchRenderer.prototype.initFlushBuffers = function () {\n var _drawCallPool = AbstractBatchRenderer._drawCallPool, _textureArrayPool = AbstractBatchRenderer._textureArrayPool;\n // max draw calls\n var MAX_SPRITES = this.size / 4;\n // max texture arrays\n var MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n while (_drawCallPool.length < MAX_SPRITES) {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA) {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (var i = 0; i < this.MAX_TEXTURES; i++) {\n this._tempBoundTextures[i] = null;\n }\n };\n /**\n * Handles the `prerender` signal.\n *\n * It ensures that flushes start from the first geometry object again.\n */\n AbstractBatchRenderer.prototype.onPrerender = function () {\n this._flushId = 0;\n };\n /**\n * Buffers the \"batchable\" object. It need not be rendered immediately.\n *\n * @param {PIXI.DisplayObject} element - the element to render when\n * using this renderer\n */\n AbstractBatchRenderer.prototype.render = function (element) {\n if (!element._texture.valid) {\n return;\n }\n if (this._vertexCount + (element.vertexData.length / 2) > this.size) {\n this.flush();\n }\n this._vertexCount += element.vertexData.length / 2;\n this._indexCount += element.indices.length;\n this._bufferedTextures[this._bufferSize] = element._texture.baseTexture;\n this._bufferedElements[this._bufferSize++] = element;\n };\n AbstractBatchRenderer.prototype.buildTexturesAndDrawCalls = function () {\n var _a = this, textures = _a._bufferedTextures, MAX_TEXTURES = _a.MAX_TEXTURES;\n var textureArrays = AbstractBatchRenderer._textureArrayPool;\n var batch = this.renderer.batch;\n var boundTextures = this._tempBoundTextures;\n var touch = this.renderer.textureGC.count;\n var TICK = ++BaseTexture._globalBatch;\n var countTexArrays = 0;\n var texArray = textureArrays[0];\n var start = 0;\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n for (var i = 0; i < this._bufferSize; ++i) {\n var tex = textures[i];\n textures[i] = null;\n if (tex._batchEnabled === TICK) {\n continue;\n }\n if (texArray.count >= MAX_TEXTURES) {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, i);\n start = i;\n texArray = textureArrays[++countTexArrays];\n ++TICK;\n }\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n if (texArray.count > 0) {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n // Clean-up\n for (var i = 0; i < boundTextures.length; i++) {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n };\n /** Populating drawcalls for rendering */\n AbstractBatchRenderer.prototype.buildDrawCalls = function (texArray, start, finish) {\n var _a = this, elements = _a._bufferedElements, _attributeBuffer = _a._attributeBuffer, _indexBuffer = _a._indexBuffer, vertexSize = _a.vertexSize;\n var drawCalls = AbstractBatchRenderer._drawCallPool;\n var dcIndex = this._dcIndex;\n var aIndex = this._aIndex;\n var iIndex = this._iIndex;\n var drawCall = drawCalls[dcIndex];\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n for (var i = start; i < finish; ++i) {\n var sprite = elements[i];\n var tex = sprite._texture.baseTexture;\n var spriteBlendMode = premultiplyBlendMode[tex.alphaMode ? 1 : 0][sprite.blendMode];\n elements[i] = null;\n if (start < i && drawCall.blend !== spriteBlendMode) {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n drawCall.blend = spriteBlendMode;\n }\n if (start < finish) {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n };\n /** Bind textures for current rendering */\n AbstractBatchRenderer.prototype.bindAndClearTexArray = function (texArray) {\n var textureSystem = this.renderer.texture;\n for (var j = 0; j < texArray.count; j++) {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n };\n AbstractBatchRenderer.prototype.updateGeometry = function () {\n var _a = this, packedGeometries = _a._packedGeometries, attributeBuffer = _a._attributeBuffer, indexBuffer = _a._indexBuffer;\n if (!settings.CAN_UPLOAD_SAME_BUFFER) { /* Usually on iOS devices, where the browser doesn't\n like uploads to the same buffer in a single frame. */\n if (this._packedGeometryPoolSize <= this._flushId) {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else {\n // lets use the faster option, always use buffer number 0\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n this.renderer.geometry.updateBuffers();\n }\n };\n AbstractBatchRenderer.prototype.drawBatches = function () {\n var dcCount = this._dcIndex;\n var _a = this.renderer, gl = _a.gl, stateSystem = _a.state;\n var drawCalls = AbstractBatchRenderer._drawCallPool;\n var curTexArray = null;\n // Upload textures and do the draw calls\n for (var i = 0; i < dcCount; i++) {\n var _b = drawCalls[i], texArray = _b.texArray, type = _b.type, size = _b.size, start = _b.start, blend = _b.blend;\n if (curTexArray !== texArray) {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n };\n /** Renders the content _now_ and empties the current batch. */\n AbstractBatchRenderer.prototype.flush = function () {\n if (this._vertexCount === 0) {\n return;\n }\n this._attributeBuffer = this.getAttributeBuffer(this._vertexCount);\n this._indexBuffer = this.getIndexBuffer(this._indexCount);\n this._aIndex = 0;\n this._iIndex = 0;\n this._dcIndex = 0;\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n };\n /** Starts a new sprite batch. */\n AbstractBatchRenderer.prototype.start = function () {\n this.renderer.state.set(this.state);\n this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);\n this.renderer.shader.bind(this._shader);\n if (settings.CAN_UPLOAD_SAME_BUFFER) {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n };\n /** Stops and flushes the current batch. */\n AbstractBatchRenderer.prototype.stop = function () {\n this.flush();\n };\n /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */\n AbstractBatchRenderer.prototype.destroy = function () {\n for (var i = 0; i < this._packedGeometryPoolSize; i++) {\n if (this._packedGeometries[i]) {\n this._packedGeometries[i].destroy();\n }\n }\n this.renderer.off('prerender', this.onPrerender, this);\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n if (this._shader) {\n this._shader.destroy();\n this._shader = null;\n }\n _super.prototype.destroy.call(this);\n };\n /**\n * Fetches an attribute buffer from `this._aBuffers` that can hold atleast `size` floats.\n *\n * @param size - minimum capacity required\n * @return - buffer than can hold atleast `size` floats\n */\n AbstractBatchRenderer.prototype.getAttributeBuffer = function (size) {\n // 8 vertices is enough for 2 quads\n var roundedP2 = nextPow2(Math.ceil(size / 8));\n var roundedSizeIndex = log2(roundedP2);\n var roundedSize = roundedP2 * 8;\n if (this._aBuffers.length <= roundedSizeIndex) {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n var buffer = this._aBuffers[roundedSize];\n if (!buffer) {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n return buffer;\n };\n /**\n * Fetches an index buffer from `this._iBuffers` that can\n * have at least `size` capacity.\n *\n * @param size - minimum required capacity\n * @return - buffer that can fit `size` indices.\n */\n AbstractBatchRenderer.prototype.getIndexBuffer = function (size) {\n // 12 indices is enough for 2 quads\n var roundedP2 = nextPow2(Math.ceil(size / 12));\n var roundedSizeIndex = log2(roundedP2);\n var roundedSize = roundedP2 * 12;\n if (this._iBuffers.length <= roundedSizeIndex) {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n var buffer = this._iBuffers[roundedSizeIndex];\n if (!buffer) {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n return buffer;\n };\n /**\n * Takes the four batching parameters of `element`, interleaves\n * and pushes them into the batching attribute/index buffers given.\n *\n * It uses these properties: `vertexData` `uvs`, `textureId` and\n * `indicies`. It also uses the \"tint\" of the base-texture, if\n * present.\n *\n * @param {PIXI.DisplayObject} element - element being rendered\n * @param attributeBuffer - attribute buffer.\n * @param indexBuffer - index buffer\n * @param aIndex - number of floats already in the attribute buffer\n * @param iIndex - number of indices already in `indexBuffer`\n */\n AbstractBatchRenderer.prototype.packInterleavedGeometry = function (element, attributeBuffer, indexBuffer, aIndex, iIndex) {\n var uint32View = attributeBuffer.uint32View, float32View = attributeBuffer.float32View;\n var packedVertices = aIndex / this.vertexSize;\n var uvs = element.uvs;\n var indicies = element.indices;\n var vertexData = element.vertexData;\n var textureId = element._texture.baseTexture._batchLocation;\n var alpha = Math.min(element.worldAlpha, 1.0);\n var argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n // lets not worry about tint! for now..\n for (var i = 0; i < vertexData.length; i += 2) {\n float32View[aIndex++] = vertexData[i];\n float32View[aIndex++] = vertexData[i + 1];\n float32View[aIndex++] = uvs[i];\n float32View[aIndex++] = uvs[i + 1];\n uint32View[aIndex++] = argb;\n float32View[aIndex++] = textureId;\n }\n for (var i = 0; i < indicies.length; i++) {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\n };\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @member {PIXI.BatchDrawCall[]}\n */\n AbstractBatchRenderer._drawCallPool = [];\n /**\n * Pool of `BatchDrawCall` objects that `flush` used\n * to create \"batches\" of the objects being rendered.\n *\n * These are never re-allocated again.\n * Shared between all batch renderers because it can be only one \"flush\" working at the moment.\n *\n * @member {PIXI.BatchTextureArray[]}\n */\n AbstractBatchRenderer._textureArrayPool = [];\n return AbstractBatchRenderer;\n}(ObjectRenderer));\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n *\n * @memberof PIXI\n */\nvar BatchShaderGenerator = /** @class */ (function () {\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n function BatchShaderGenerator(vertexSrc, fragTemplate) {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n this.programCache = {};\n this.defaultGroupCache = {};\n if (fragTemplate.indexOf('%count%') < 0) {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n if (fragTemplate.indexOf('%forloop%') < 0) {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n BatchShaderGenerator.prototype.generateShader = function (maxTextures) {\n if (!this.programCache[maxTextures]) {\n var sampleValues = new Int32Array(maxTextures);\n for (var i = 0; i < maxTextures; i++) {\n sampleValues[i] = i;\n }\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n var fragmentSrc = this.fragTemplate;\n fragmentSrc = fragmentSrc.replace(/%count%/gi, \"\" + maxTextures);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n var uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n return new Shader(this.programCache[maxTextures], uniforms);\n };\n BatchShaderGenerator.prototype.generateSampleSrc = function (maxTextures) {\n var src = '';\n src += '\\n';\n src += '\\n';\n for (var i = 0; i < maxTextures; i++) {\n if (i > 0) {\n src += '\\nelse ';\n }\n if (i < maxTextures - 1) {\n src += \"if(vTextureId < \" + i + \".5)\";\n }\n src += '\\n{';\n src += \"\\n\\tcolor = texture2D(uSamplers[\" + i + \"], vTextureCoord);\";\n src += '\\n}';\n }\n src += '\\n';\n src += '\\n';\n return src;\n };\n return BatchShaderGenerator;\n}());\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n *\n * @memberof PIXI\n */\nvar BatchGeometry = /** @class */ (function (_super) {\n __extends(BatchGeometry, _super);\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n function BatchGeometry(_static) {\n if (_static === void 0) { _static = false; }\n var _this = _super.call(this) || this;\n _this._buffer = new Buffer(null, _static, false);\n _this._indexBuffer = new Buffer(null, _static, true);\n _this.addAttribute('aVertexPosition', _this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', _this._buffer, 2, false, TYPES.FLOAT)\n .addAttribute('aColor', _this._buffer, 4, true, TYPES.UNSIGNED_BYTE)\n .addAttribute('aTextureId', _this._buffer, 1, true, TYPES.FLOAT)\n .addIndex(_this._indexBuffer);\n return _this;\n }\n return BatchGeometry;\n}(Geometry));\n\nvar defaultVertex$3 = \"precision highp float;\\nattribute vec2 aVertexPosition;\\nattribute vec2 aTextureCoord;\\nattribute vec4 aColor;\\nattribute float aTextureId;\\n\\nuniform mat3 projectionMatrix;\\nuniform mat3 translationMatrix;\\nuniform vec4 tint;\\n\\nvarying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying float vTextureId;\\n\\nvoid main(void){\\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\\n\\n vTextureCoord = aTextureCoord;\\n vTextureId = aTextureId;\\n vColor = aColor * tint;\\n}\\n\";\n\nvar defaultFragment$2 = \"varying vec2 vTextureCoord;\\nvarying vec4 vColor;\\nvarying float vTextureId;\\nuniform sampler2D uSamplers[%count%];\\n\\nvoid main(void){\\n vec4 color;\\n %forloop%\\n gl_FragColor = color * vColor;\\n}\\n\";\n\n/** @memberof PIXI */\nvar BatchPluginFactory = /** @class */ (function () {\n function BatchPluginFactory() {\n }\n /**\n * Create a new BatchRenderer plugin for Renderer. this convenience can provide an easy way\n * to extend BatchRenderer with all the necessary pieces.\n * @example\n * const fragment = `\n * varying vec2 vTextureCoord;\n * varying vec4 vColor;\n * varying float vTextureId;\n * uniform sampler2D uSamplers[%count%];\n *\n * void main(void){\n * vec4 color;\n * %forloop%\n * gl_FragColor = vColor * vec4(color.a - color.rgb, color.a);\n * }\n * `;\n * const InvertBatchRenderer = PIXI.BatchPluginFactory.create({ fragment });\n * PIXI.Renderer.registerPlugin('invert', InvertBatchRenderer);\n * const sprite = new PIXI.Sprite();\n * sprite.pluginName = 'invert';\n *\n * @param {object} [options]\n * @param {string} [options.vertex=PIXI.BatchPluginFactory.defaultVertexSrc] - Vertex shader source\n * @param {string} [options.fragment=PIXI.BatchPluginFactory.defaultFragmentTemplate] - Fragment shader template\n * @param {number} [options.vertexSize=6] - Vertex size\n * @param {object} [options.geometryClass=PIXI.BatchGeometry]\n * @return {*} New batch renderer plugin\n */\n BatchPluginFactory.create = function (options) {\n var _a = Object.assign({\n vertex: defaultVertex$3,\n fragment: defaultFragment$2,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options), vertex = _a.vertex, fragment = _a.fragment, vertexSize = _a.vertexSize, geometryClass = _a.geometryClass;\n return /** @class */ (function (_super) {\n __extends(BatchPlugin, _super);\n function BatchPlugin(renderer) {\n var _this = _super.call(this, renderer) || this;\n _this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n _this.geometryClass = geometryClass;\n _this.vertexSize = vertexSize;\n return _this;\n }\n return BatchPlugin;\n }(AbstractBatchRenderer));\n };\n Object.defineProperty(BatchPluginFactory, \"defaultVertexSrc\", {\n /**\n * The default vertex shader source\n *\n * @readonly\n */\n get: function () {\n return defaultVertex$3;\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(BatchPluginFactory, \"defaultFragmentTemplate\", {\n /**\n * The default fragment shader source\n *\n * @readonly\n */\n get: function () {\n return defaultFragment$2;\n },\n enumerable: false,\n configurable: true\n });\n return BatchPluginFactory;\n}());\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nvar BatchRenderer = BatchPluginFactory.create();\n\n/**\n * @memberof PIXI\n * @namespace resources\n * @see PIXI\n * @deprecated since 6.0.0\n */\nvar resources = {};\nvar _loop_1 = function (name) {\n Object.defineProperty(resources, name, {\n get: function () {\n deprecation('6.0.0', \"PIXI.systems.\" + name + \" has moved to PIXI.\" + name);\n return _resources[name];\n },\n });\n};\nfor (var name in _resources) {\n _loop_1(name);\n}\n/**\n * @memberof PIXI\n * @namespace systems\n * @see PIXI\n * @deprecated since 6.0.0\n */\nvar systems = {};\nvar _loop_2 = function (name) {\n Object.defineProperty(systems, name, {\n get: function () {\n deprecation('6.0.0', \"PIXI.resources.\" + name + \" has moved to PIXI.\" + name);\n return _systems[name];\n },\n });\n};\nfor (var name in _systems) {\n _loop_2(name);\n}\n\n/**\n * Renderer dedicated to meshes.\n *\n * @class\n * @protected\n * @memberof PIXI\n */\nvar CanvasMeshRenderer = /** @class */ (function () {\n /** @param renderer - A reference to the current renderer */\n function CanvasMeshRenderer(renderer) {\n this.renderer = renderer;\n }\n /**\n * Renders the Mesh\n *\n * @param mesh - the Mesh to render\n */\n CanvasMeshRenderer.prototype.render = function (mesh) {\n var renderer = this.renderer;\n var transform = mesh.worldTransform;\n renderer.context.globalAlpha = mesh.worldAlpha;\n renderer.setBlendMode(mesh.blendMode);\n renderer.setContextTransform(transform, mesh.roundPixels);\n if (mesh.drawMode !== DRAW_MODES.TRIANGLES) {\n this._renderTriangleMesh(mesh);\n }\n else {\n this._renderTriangles(mesh);\n }\n };\n /**\n * Draws the object in Triangle Mesh mode\n *\n * @private\n * @param mesh - the Mesh to render\n */\n CanvasMeshRenderer.prototype._renderTriangleMesh = function (mesh) {\n // draw triangles!!\n var length = mesh.geometry.buffers[0].data.length;\n for (var i = 0; i < length - 2; i++) {\n // draw some triangles!\n var index = i * 2;\n this._renderDrawTriangle(mesh, index, (index + 2), (index + 4));\n }\n };\n /**\n * Draws the object in triangle mode using canvas\n *\n * @private\n * @param mesh - the current mesh\n */\n CanvasMeshRenderer.prototype._renderTriangles = function (mesh) {\n // draw triangles!!\n var indices = mesh.geometry.getIndex().data;\n var length = indices.length;\n for (var i = 0; i < length; i += 3) {\n // draw some triangles!\n var index0 = indices[i] * 2;\n var index1 = indices[i + 1] * 2;\n var index2 = indices[i + 2] * 2;\n this._renderDrawTriangle(mesh, index0, index1, index2);\n }\n };\n /**\n * Draws one of the triangles that from the Mesh\n *\n * @private\n * @param mesh - the current mesh\n * @param index0 - the index of the first vertex\n * @param index1 - the index of the second vertex\n * @param index2 - the index of the third vertex\n */\n CanvasMeshRenderer.prototype._renderDrawTriangle = function (mesh, index0, index1, index2) {\n var context = this.renderer.context;\n var vertices = mesh.geometry.buffers[0].data;\n var uvs = mesh.uvs, texture = mesh.texture;\n if (!texture.valid) {\n return;\n }\n var isTinted = mesh.tint !== 0xFFFFFF;\n var base = texture.baseTexture;\n var textureWidth = base.width;\n var textureHeight = base.height;\n if (isTinted) {\n if (mesh._cachedTint !== mesh.tint) {\n mesh._cachedTint = mesh.tint;\n mesh._cachedTexture = mesh._cachedTexture || new Texture(base);\n mesh._tintedCanvas = canvasUtils.getTintedCanvas({ texture: mesh._cachedTexture }, mesh.tint);\n }\n }\n var textureSource = isTinted ? mesh._tintedCanvas : base.getDrawableSource();\n var u0 = uvs[index0] * base.width;\n var u1 = uvs[index1] * base.width;\n var u2 = uvs[index2] * base.width;\n var v0 = uvs[index0 + 1] * base.height;\n var v1 = uvs[index1 + 1] * base.height;\n var v2 = uvs[index2 + 1] * base.height;\n var x0 = vertices[index0];\n var x1 = vertices[index1];\n var x2 = vertices[index2];\n var y0 = vertices[index0 + 1];\n var y1 = vertices[index1 + 1];\n var y2 = vertices[index2 + 1];\n var screenPadding = mesh.canvasPadding / this.renderer.resolution;\n if (screenPadding > 0) {\n var _a = mesh.worldTransform, a = _a.a, b = _a.b, c = _a.c, d = _a.d;\n var centerX = (x0 + x1 + x2) / 3;\n var centerY = (y0 + y1 + y2) / 3;\n var normX = x0 - centerX;\n var normY = y0 - centerY;\n // Transform to screen space and calculate the distance\n var screenX = (a * normX) + (c * normY);\n var screenY = (b * normX) + (d * normY);\n var screenDist = Math.sqrt((screenX * screenX) + (screenY * screenY));\n // Factor by which to scale in order to add padding equal to screenPadding\n var paddingFactor = 1 + (screenPadding / screenDist);\n x0 = centerX + (normX * paddingFactor);\n y0 = centerY + (normY * paddingFactor);\n normX = x1 - centerX;\n normY = y1 - centerY;\n screenX = (a * normX) + (c * normY);\n screenY = (b * normX) + (d * normY);\n screenDist = Math.sqrt((screenX * screenX) + (screenY * screenY));\n paddingFactor = 1 + (screenPadding / screenDist);\n x1 = centerX + (normX * paddingFactor);\n y1 = centerY + (normY * paddingFactor);\n normX = x2 - centerX;\n normY = y2 - centerY;\n screenX = (a * normX) + (c * normY);\n screenY = (b * normX) + (d * normY);\n screenDist = Math.sqrt((screenX * screenX) + (screenY * screenY));\n paddingFactor = 1 + (screenPadding / screenDist);\n x2 = centerX + (normX * paddingFactor);\n y2 = centerY + (normY * paddingFactor);\n }\n context.save();\n context.beginPath();\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n context.closePath();\n context.clip();\n // Compute matrix transform\n var delta = (u0 * v1) + (v0 * u2) + (u1 * v2) - (v1 * u2) - (v0 * u1) - (u0 * v2);\n var deltaA = (x0 * v1) + (v0 * x2) + (x1 * v2) - (v1 * x2) - (v0 * x1) - (x0 * v2);\n var deltaB = (u0 * x1) + (x0 * u2) + (u1 * x2) - (x1 * u2) - (x0 * u1) - (u0 * x2);\n var deltaC = (u0 * v1 * x2) + (v0 * x1 * u2) + (x0 * u1 * v2) - (x0 * v1 * u2) - (v0 * u1 * x2) - (u0 * x1 * v2);\n var deltaD = (y0 * v1) + (v0 * y2) + (y1 * v2) - (v1 * y2) - (v0 * y1) - (y0 * v2);\n var deltaE = (u0 * y1) + (y0 * u2) + (u1 * y2) - (y1 * u2) - (y0 * u1) - (u0 * y2);\n var deltaF = (u0 * v1 * y2) + (v0 * y1 * u2) + (y0 * u1 * v2) - (y0 * v1 * u2) - (v0 * u1 * y2) - (u0 * y1 * v2);\n context.transform(deltaA / delta, deltaD / delta, deltaB / delta, deltaE / delta, deltaC / delta, deltaF / delta);\n context.drawImage(textureSource, 0, 0, textureWidth * base.resolution, textureHeight * base.resolution, 0, 0, textureWidth, textureHeight);\n context.restore();\n this.renderer.invalidateBlendMode();\n };\n /**\n * Renders a flat Mesh\n *\n * @private\n * @param mesh - The Mesh to render\n */\n CanvasMeshRenderer.prototype.renderMeshFlat = function (mesh) {\n var context = this.renderer.context;\n var vertices = mesh.geometry.getBuffer('aVertexPosition').data;\n var length = vertices.length / 2;\n // this.count++;\n context.beginPath();\n for (var i = 1; i < length - 2; ++i) {\n // draw some triangles!\n var index = i * 2;\n var x0 = vertices[index];\n var y0 = vertices[index + 1];\n var x1 = vertices[index + 2];\n var y1 = vertices[index + 3];\n var x2 = vertices[index + 4];\n var y2 = vertices[index + 5];\n context.moveTo(x0, y0);\n context.lineTo(x1, y1);\n context.lineTo(x2, y2);\n }\n context.fillStyle = '#FF0000';\n context.fill();\n context.closePath();\n };\n /** destroy the the renderer */\n CanvasMeshRenderer.prototype.destroy = function () {\n this.renderer = null;\n };\n return CanvasMeshRenderer;\n}());\n\n/**\n * Default `canvasPadding` for canvas-based Mesh rendering.\n *\n * @see PIXI.Mesh2d#canvasPadding\n * @static\n * @memberof PIXI.settings\n * @member {number}\n * @default 0\n */\nsettings.MESH_CANVAS_PADDING = 0;\n\n/**\n * Renders the mesh using the Canvas renderer\n *\n * @protected\n * @method render\n * @memberof PIXI.MeshMaterial#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n * @param {PIXI.Mesh} mesh - Mesh to render.\n */\nMeshMaterial.prototype._renderCanvas = function _renderCanvas(renderer, mesh) {\n renderer.plugins.mesh.render(mesh);\n};\n\n/**\n * Cached tint value so we can tell when the tint is changed.\n * @memberof PIXI.NineSlicePlane#\n * @member {number} _cachedTint\n * @protected\n */\nNineSlicePlane.prototype._cachedTint = 0xFFFFFF;\n/**\n * Cached tinted texture.\n * @memberof PIXI.NineSlicePlane#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nNineSlicePlane.prototype._tintedCanvas = null;\n/**\n * Temporary storage for canvas source coords\n * @memberof PIXI.NineSlicePlane#\n * @member {number[]} _canvasUvs\n * @private\n */\nNineSlicePlane.prototype._canvasUvs = null;\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.NineSlicePlane#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer to render with.\n */\nNineSlicePlane.prototype._renderCanvas = function _renderCanvas(renderer) {\n var context = renderer.context;\n var transform = this.worldTransform;\n var isTinted = this.tint !== 0xFFFFFF;\n var texture = this.texture;\n if (!texture.valid) {\n return;\n }\n // Work out tinting\n if (isTinted) {\n if (this._cachedTint !== this.tint) {\n // Tint has changed, need to update the tinted texture and use that instead\n this._cachedTint = this.tint;\n this._tintedCanvas = canvasUtils.getTintedCanvas(this, this.tint);\n }\n }\n var textureSource = !isTinted ? texture.baseTexture.getDrawableSource() : this._tintedCanvas;\n if (!this._canvasUvs) {\n this._canvasUvs = [0, 0, 0, 0, 0, 0, 0, 0];\n }\n var vertices = this.vertices;\n var uvs = this._canvasUvs;\n var u0 = isTinted ? 0 : texture.frame.x;\n var v0 = isTinted ? 0 : texture.frame.y;\n var u1 = u0 + texture.frame.width;\n var v1 = v0 + texture.frame.height;\n uvs[0] = u0;\n uvs[1] = u0 + this._leftWidth;\n uvs[2] = u1 - this._rightWidth;\n uvs[3] = u1;\n uvs[4] = v0;\n uvs[5] = v0 + this._topHeight;\n uvs[6] = v1 - this._bottomHeight;\n uvs[7] = v1;\n for (var i = 0; i < 8; i++) {\n uvs[i] *= texture.baseTexture.resolution;\n }\n context.globalAlpha = this.worldAlpha;\n renderer.setBlendMode(this.blendMode);\n renderer.setContextTransform(transform, this.roundPixels);\n for (var row = 0; row < 3; row++) {\n for (var col = 0; col < 3; col++) {\n var ind = (col * 2) + (row * 8);\n var sw = Math.max(1, uvs[col + 1] - uvs[col]);\n var sh = Math.max(1, uvs[row + 5] - uvs[row + 4]);\n var dw = Math.max(1, vertices[ind + 10] - vertices[ind]);\n var dh = Math.max(1, vertices[ind + 11] - vertices[ind + 1]);\n context.drawImage(textureSource, uvs[col], uvs[row + 4], sw, sh, vertices[ind], vertices[ind + 1], dw, dh);\n }\n }\n};\n\nvar warned = false;\n/**\n * Cached tint value so we can tell when the tint is changed.\n * @memberof PIXI.Mesh#\n * @member {number} _cachedTint\n * @protected\n */\nMesh.prototype._cachedTint = 0xFFFFFF;\n/**\n * Cached tinted texture.\n * @memberof PIXI.Mesh#\n * @member {HTMLCanvasElement} _tintedCanvas\n * @protected\n */\nMesh.prototype._tintedCanvas = null;\n/**\n * The cache texture is used to generate `_tintedCanvas`.\n * @memberof PIXI.Mesh#\n * @member {PIXI.Texture} _cachedTexture\n * @protected\n */\nMesh.prototype._cachedTexture = null;\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nMesh.prototype._renderCanvas = function _renderCanvas(renderer) {\n if (this.shader.uvMatrix) {\n this.shader.uvMatrix.update();\n this.calculateUvs();\n }\n if (this.material._renderCanvas) {\n this.material._renderCanvas(renderer, this);\n }\n else if (!warned) {\n warned = true;\n if (self.console) {\n console.warn('Mesh with custom shaders are not supported in CanvasRenderer.');\n }\n }\n};\n// IMPORTANT: Please do NOT use this as a precedent to use `settings` after the object is created\n// this was merely created to completely decouple canvas from the base Mesh class and we are\n// unable to add `canvasPadding` in the constructor anymore, as the case was for PixiJS v4.\n/**\n * Internal variable for `canvasPadding`.\n *\n * @private\n * @memberof PIXI.Mesh\n * @member {number}\n * @default null\n */\nMesh.prototype._canvasPadding = null;\n/**\n * Triangles in canvas mode are automatically antialiased, use this value to force triangles\n * to overlap a bit with each other. To set the global default, set {@link PIXI.settings.MESH_CANVAS_PADDING}\n *\n * @see PIXI.settings.MESH_CANVAS_PADDING\n * @member {number} canvasPadding\n * @memberof PIXI.SimpleMesh#\n * @default 0\n */\nObject.defineProperty(Mesh.prototype, 'canvasPadding', {\n get: function () {\n return this._canvasPadding !== null ? this._canvasPadding : settings.MESH_CANVAS_PADDING;\n },\n set: function (value) {\n this._canvasPadding = value;\n },\n});\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @private\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nSimpleMesh.prototype._renderCanvas = function _renderCanvas(renderer) {\n if (this.autoUpdate) {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n if (this.shader.update) {\n this.shader.update();\n }\n this.calculateUvs();\n this.material._renderCanvas(renderer, this);\n};\n\n/**\n * Renders the object using the Canvas renderer\n *\n * @protected\n * @method _renderCanvas\n * @memberof PIXI.Mesh#\n * @param {PIXI.CanvasRenderer} renderer - The canvas renderer.\n */\nSimpleRope.prototype._renderCanvas = function _renderCanvas(renderer) {\n if (this.autoUpdate\n || this.geometry._width !== this.shader.texture.height) {\n this.geometry._width = this.shader.texture.height;\n this.geometry.update();\n }\n if (this.shader.update) {\n this.shader.update();\n }\n this.calculateUvs();\n this.material._renderCanvas(renderer, this);\n};\n\nexport { CanvasMeshRenderer };\n//# sourceMappingURL=canvas-mesh.js.map\n","import promiseFinally from './finally';\nimport allSettled from './allSettled';\n\n// Store setTimeout reference so promise-polyfill will be unaffected by\n// other code modifying setTimeout (like sinon.useFakeTimers())\nvar setTimeoutFunc = setTimeout;\n// @ts-ignore\nvar setImmediateFunc = typeof setImmediate !== 'undefined' ? setImmediate : null;\n\nfunction isArray(x) {\n return Boolean(x && typeof x.length !== 'undefined');\n}\n\nfunction noop() {}\n\n// Polyfill for Function.prototype.bind\nfunction bind(fn, thisArg) {\n return function() {\n fn.apply(thisArg, arguments);\n };\n}\n\n/**\n * @constructor\n * @param {Function} fn\n */\nfunction Promise(fn) {\n if (!(this instanceof Promise))\n throw new TypeError('Promises must be constructed via new');\n if (typeof fn !== 'function') throw new TypeError('not a function');\n /** @type {!number} */\n this._state = 0;\n /** @type {!boolean} */\n this._handled = false;\n /** @type {Promise|undefined} */\n this._value = undefined;\n /** @type {!Array} */\n this._deferreds = [];\n\n doResolve(fn, this);\n}\n\nfunction handle(self, deferred) {\n while (self._state === 3) {\n self = self._value;\n }\n if (self._state === 0) {\n self._deferreds.push(deferred);\n return;\n }\n self._handled = true;\n Promise._immediateFn(function() {\n var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n return;\n }\n var ret;\n try {\n ret = cb(self._value);\n } catch (e) {\n reject(deferred.promise, e);\n return;\n }\n resolve(deferred.promise, ret);\n });\n}\n\nfunction resolve(self, newValue) {\n try {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self)\n throw new TypeError('A promise cannot be resolved with itself.');\n if (\n newValue &&\n (typeof newValue === 'object' || typeof newValue === 'function')\n ) {\n var then = newValue.then;\n if (newValue instanceof Promise) {\n self._state = 3;\n self._value = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(bind(then, newValue), self);\n return;\n }\n }\n self._state = 1;\n self._value = newValue;\n finale(self);\n } catch (e) {\n reject(self, e);\n }\n}\n\nfunction reject(self, newValue) {\n self._state = 2;\n self._value = newValue;\n finale(self);\n}\n\nfunction finale(self) {\n if (self._state === 2 && self._deferreds.length === 0) {\n Promise._immediateFn(function() {\n if (!self._handled) {\n Promise._unhandledRejectionFn(self._value);\n }\n });\n }\n\n for (var i = 0, len = self._deferreds.length; i < len; i++) {\n handle(self, self._deferreds[i]);\n }\n self._deferreds = null;\n}\n\n/**\n * @constructor\n */\nfunction Handler(onFulfilled, onRejected, promise) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}\n\nPromise.prototype['catch'] = function(onRejected) {\n return this.then(null, onRejected);\n};\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n // @ts-ignore\n var prom = new this.constructor(noop);\n\n handle(this, new Handler(onFulfilled, onRejected, prom));\n return prom;\n};\n\nPromise.prototype['finally'] = promiseFinally;\n\nPromise.all = function(arr) {\n return new Promise(function(resolve, reject) {\n if (!isArray(arr)) {\n return reject(new TypeError('Promise.all accepts an array'));\n }\n\n var args = Array.prototype.slice.call(arr);\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n\n function res(i, val) {\n try {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n var then = val.then;\n if (typeof then === 'function') {\n then.call(\n val,\n function(val) {\n res(i, val);\n },\n reject\n );\n return;\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n } catch (ex) {\n reject(ex);\n }\n }\n\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n};\n\nPromise.allSettled = allSettled;\n\nPromise.resolve = function(value) {\n if (value && typeof value === 'object' && value.constructor === Promise) {\n return value;\n }\n\n return new Promise(function(resolve) {\n resolve(value);\n });\n};\n\nPromise.reject = function(value) {\n return new Promise(function(resolve, reject) {\n reject(value);\n });\n};\n\nPromise.race = function(arr) {\n return new Promise(function(resolve, reject) {\n if (!isArray(arr)) {\n return reject(new TypeError('Promise.race accepts an array'));\n }\n\n for (var i = 0, len = arr.length; i < len; i++) {\n Promise.resolve(arr[i]).then(resolve, reject);\n }\n });\n};\n\n// Use polyfill for setImmediate for performance gains\nPromise._immediateFn =\n // @ts-ignore\n (typeof setImmediateFunc === 'function' &&\n function(fn) {\n // @ts-ignore\n setImmediateFunc(fn);\n }) ||\n function(fn) {\n setTimeoutFunc(fn, 0);\n };\n\nPromise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n if (typeof console !== 'undefined' && console) {\n console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console\n }\n};\n\nexport default Promise;\n","var scope = (typeof global !== \"undefined\" && global) ||\n (typeof self !== \"undefined\" && self) ||\n window;\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(scope, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\nrequire(\"setimmediate\");\n// On some exotic environments, it's not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\nexports.setImmediate = (typeof self !== \"undefined\" && self.setImmediate) ||\n (typeof global !== \"undefined\" && global.setImmediate) ||\n (this && this.setImmediate);\nexports.clearImmediate = (typeof self !== \"undefined\" && self.clearImmediate) ||\n (typeof global !== \"undefined\" && global.clearImmediate) ||\n (this && this.clearImmediate);\n","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a