{"version":3,"sources":["../../../../../node_modules/tslib/tslib.es6.js","../../../src/Sprite.ts","../../../src/base/Signal.ts","../../../src/base/parseUri.ts","../../../src/LoaderResource.ts","../../../src/base/AsyncQueue.ts","../../../src/Loader.ts","../../../src/AppLoaderPlugin.ts","../../../src/TextureLoader.ts","../../../src/middleware/parsing.ts","../../../src/index.ts","../../../src/base/encodeBinary.ts","../../../src/const.ts","../../../src/settings.ts","../../../src/TickerListener.ts","../../../src/Ticker.ts","../../../src/TickerPlugin.ts","../../../src/styles/FillStyle.ts","../../../src/utils/buildPoly.ts","../../../src/utils/buildCircle.ts","../../../src/utils/buildRectangle.ts","../../../src/utils/buildRoundedRectangle.ts","../../../src/utils/buildLine.ts","../../../src/utils/ArcUtils.ts","../../../src/utils/BezierUtils.ts","../../../src/utils/QuadraticUtils.ts","../../../src/utils/BatchPart.ts","../../../src/utils/index.ts","../../../src/utils/isPolygonClockwise.ts","../../../src/GraphicsData.ts","../../../src/GraphicsGeometry.ts","../../../src/styles/LineStyle.ts","../../../src/Graphics.ts","../../../src/MeshBatchUvs.ts","../../../src/Mesh.ts","../../../src/MeshMaterial.ts","../../../src/MeshGeometry.ts","../../../src/geometry/PlaneGeometry.ts","../../../src/geometry/RopeGeometry.ts","../../../src/SimpleRope.ts","../../../src/SimplePlane.ts","../../../src/SimpleMesh.ts","../../../src/NineSlicePlane.ts","../../../src/Runner.ts","../node_modules/@pixi/utils/node_modules/eventemitter3/index.js","../node_modules/earcut/src/earcut.js","../../../src/textures/resources/autoDetectResource.ts","../../../src/textures/resources/Resource.ts","../../../src/textures/resources/BufferResource.ts","../../../src/textures/BaseTexture.ts","../../../src/textures/resources/AbstractMultiResource.ts","../../../src/textures/resources/ArrayResource.ts","../../../src/textures/resources/BaseImageResource.ts","../../../src/textures/resources/CanvasResource.ts","../../../src/textures/resources/CubeResource.ts","../../../src/textures/resources/ImageResource.ts","../../../src/textures/resources/SVGResource.ts","../../../src/textures/resources/VideoResource.ts","../../../src/textures/resources/ImageBitmapResource.ts","../../../src/textures/resources/index.ts","../../../src/textures/resources/DepthResource.ts","../../../src/framebuffer/Framebuffer.ts","../../../src/renderTexture/BaseRenderTexture.ts","../../../src/textures/TextureUvs.ts","../../../src/textures/Texture.ts","../../../src/renderTexture/RenderTexture.ts","../../../src/renderTexture/RenderTexturePool.ts","../../../src/geometry/Attribute.ts","../../../src/geometry/Buffer.ts","../../../src/geometry/utils/interleaveTypedArrays.ts","../../../src/geometry/Geometry.ts","../../../src/utils/Quad.ts","../../../src/utils/QuadUv.ts","../../../src/shader/UniformGroup.ts","../../../src/filters/FilterState.ts","../../../src/filters/FilterSystem.ts","../../../src/batch/ObjectRenderer.ts","../../../src/batch/BatchSystem.ts","../../../src/context/ContextSystem.ts","../../../src/framebuffer/GLFramebuffer.ts","../../../src/framebuffer/FramebufferSystem.ts","../../../src/geometry/GeometrySystem.ts","../../../src/mask/MaskData.ts","../../../src/shader/utils/compileShader.ts","../../../src/shader/utils/logProgramError.ts","../../../src/shader/utils/defaultValue.ts","../../../src/shader/utils/getTestContext.ts","../../../src/shader/utils/getMaxFragmentPrecision.ts","../../../src/shader/utils/setPrecision.ts","../../../src/shader/utils/mapSize.ts","../../../src/shader/utils/mapType.ts","../../../src/shader/utils/uniformParsers.ts","../../../src/shader/utils/generateUniformsSync.ts","../../../src/shader/utils/checkMaxIfStatementsInShader.ts","../../../src/shader/utils/unsafeEvalSupported.ts","../../../src/shader/Program.ts","../../../src/shader/Shader.ts","../../../src/state/State.ts","../../../src/filters/Filter.ts","../../../src/textures/TextureMatrix.ts","../../../src/filters/spriteMask/SpriteMaskFilter.ts","../../../src/mask/MaskSystem.ts","../../../src/mask/AbstractMaskSystem.ts","../../../src/mask/ScissorSystem.ts","../../../src/mask/StencilSystem.ts","../../../src/projection/ProjectionSystem.ts","../../../src/renderTexture/RenderTextureSystem.ts","../../../src/shader/utils/generateUniformBufferSync.ts","../../../src/shader/GLProgram.ts","../../../src/shader/utils/generateProgram.ts","../../../src/shader/utils/getAttributeData.ts","../../../src/shader/utils/getUniformData.ts","../../../src/shader/ShaderSystem.ts","../../../src/state/StateSystem.ts","../../../src/state/utils/mapWebGLBlendModesToPixi.ts","../../../src/textures/TextureGCSystem.ts","../../../src/textures/GLTexture.ts","../../../src/textures/TextureSystem.ts","../../../src/textures/utils/mapTypeAndFormatToInternalFormat.ts","../../../src/AbstractRenderer.ts","../../../src/geometry/GLBuffer.ts","../../../src/geometry/BufferSystem.ts","../../../src/Renderer.ts","../../../src/autoDetectRenderer.ts","../../../src/fragments/index.ts","../../../src/ISystem.ts","../../../src/batch/BatchDrawCall.ts","../../../src/batch/BatchTextureArray.ts","../../../src/geometry/ViewableBuffer.ts","../../../src/batch/AbstractBatchRenderer.ts","../../../src/batch/BatchShaderGenerator.ts","../../../src/batch/BatchGeometry.ts","../../../src/batch/BatchPluginFactory.ts","../../../src/deprecations.ts","../../../src/shapes/Rectangle.ts","../../../src/shapes/Circle.ts","../../../src/shapes/Ellipse.ts","../../../src/shapes/Polygon.ts","../../../src/shapes/RoundedRectangle.ts","../../../src/Point.ts","../../../src/ObservablePoint.ts","../../../src/Matrix.ts","../../../src/groupD8.ts","../../../src/Transform.ts","../../../src/url.ts","../../../src/browser/hello.ts","../../../src/browser/isWebGLSupported.ts","../../../src/color/hex.ts","../../../src/color/premultiply.ts","../../../src/data/createIndicesForQuads.ts","../../../src/data/getBufferType.ts","../../../src/data/interleaveTypedArrays.ts","../../../src/data/pow2.ts","../../../src/data/removeItems.ts","../../../src/data/sign.ts","../../../src/data/uid.ts","../../../src/logging/deprecation.ts","../../../src/media/caches.ts","../../../src/media/CanvasRenderTarget.ts","../../../src/media/trimCanvas.ts","../../../src/network/determineCrossOrigin.ts","../../../src/network/decomposeDataUri.ts","../../../src/network/getResolutionOfUrl.ts","../../src/isMobile.ts","../../../../constants/dist/esm/constants.js","../../../src/utils/isMobile.ts","../../../src/utils/maxRecommendedTextures.ts","../../../src/utils/canUploadSameBuffer.ts","../../../src/Bounds.ts","../../../src/DisplayObject.ts","../../../src/Container.ts","../node_modules/url/url.js","../node_modules/node-libs-browser/node_modules/punycode/punycode.js","../node_modules/url/util.js","../node_modules/querystring-es3/index.js","../node_modules/querystring-es3/decode.js","../node_modules/querystring-es3/encode.js"],"names":["d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","tempPoint","indices","Uint16Array","texture","_anchor","_onAnchorUpdate","defaultAnchor","x","y","_texture","_width","_height","_tint","_tintRGB","tint","blendMode","NORMAL","_cachedTint","uvs","EMPTY","vertexData","Float32Array","vertexTrimmedData","_transformID","_textureID","_transformTrimmedID","_textureTrimmedID","pluginName","isSprite","_roundPixels","ROUND_PIXELS","__","this","constructor","prototype","create","_onTextureUpdate","scale","orig","width","height","calculateVertices","transform","_worldID","_updateID","_uvs","uvsFloat32","wt","worldTransform","a","c","tx","ty","trim","anchor","w0","w1","h0","h1","_x","_y","resolution","RESOLUTION","i","length","Math","round","calculateTrimmedVertices","_render","renderer","batch","setObjectRenderer","plugins","render","_calculateBounds","_bounds","addQuad","getLocalBounds","rect","children","minX","minY","maxX","maxY","_localBoundsRect","getRectangle","call","containsPoint","point","applyInverse","x1","y1","destroy","options","off","destroyBaseTexture","baseTexture","from","source","Sprite","value","abs","s","copyFrom","valid","once","fn","thisArg","_fn","_once","_thisArg","_next","_prev","_owner","detach","_addSignalBinding","self","node","_head","_tail","undefined","handlers","exists","ee","push","has","SignalBinding","Error","dispatch","apply","args","add","detachAll","parseUri","str","opts","o","key","q","name","parser","strict","loose","m","strictMode","exec","uri","replace","_t0","t1","t2","useXdr","XDomainRequest","XMLHttpRequest","tempAnchor","_noop","setExtMap","map","extname","val","indexOf","substring","reqType","xhr","toString","url","_dequeue","_onLoadBinding","_elementTimer","_boundComplete","_boundOnError","_boundOnProgress","_boundOnTimeout","_boundXhrOnError","_boundXhrOnTimeout","_boundXhrOnAbort","_boundXhrOnLoad","_flags","_setFlag","LoaderResource","STATUS_FLAGS","DATA_URL","extension","_getExtension","data","crossOrigin","timeout","loadType","_determineLoadType","xhrType","metadata","error","type","TYPE","UNKNOWN","progressChunk","complete","bind","_onError","_onProgress","_onTimeout","_xhrOnError","_xhrOnTimeout","_xhrOnAbort","_xhrOnLoad","onStart","Signal","onProgress","onComplete","onAfterMiddleware","setExtensionLoadType","_loadTypeMap","setExtensionXhrType","_xhrTypeMap","_hasFlag","COMPLETE","LOADING","_clearEvents","_finish","abort","message","xdr","src","EMPTY_GIF","firstChild","removeChild","load","cb","isLoading","isComplete","setTimeout","_determineCrossOrigin","LOAD_TYPE","IMAGE","_loadElement","AUDIO","_loadSourceElement","VIDEO","XHR","_loadXdr","_loadXhr","flag","clearTimeout","removeEventListener","onerror","ontimeout","onprogress","onload","loadElement","Image","document","createElement","skipSource","addEventListener","Audio","navigator","isCocoonJS","isArray","mimeTypes","mimeType","appendChild","_createSource","_determineXhrType","open","XHR_RESPONSE_TYPE","JSON","DOCUMENT","responseType","TEXT","send","mime","event","target","nodeName","lengthComputable","loaded","total","status","statusText","text","responseText","BUFFER","parse","e","DOMParser","domparser","parseFromString","div","innerHTML","XML","response","responseURL","loc","origin","location","href","parsedUrl","samePort","port","protocol","host","hostname","ext","isDataUrl","slashIndex","queryStart","hashStart","index","min","lastIndexOf","toLowerCase","_getMimeFromXhrType","BLOB","DEFAULT","onlyOnce","callFn","gif","png","bmp","jpg","jpeg","tif","tiff","webp","tga","svg","mp3","ogg","wav","mp4","webm","xhtml","html","htm","xml","tmx","tsx","json","txt","ttf","otf","callback","worker","concurrency","workers","saturated","unsaturated","empty","drain","started","paused","_tasks","_insert","insertAtFront","idle","item","AsyncQueueItem","unshift","process","task","shift","_worker","buffer","kill","running","pause","resume","w","eachSeries","array","iterator","deferNext","len","next","err","queue","AsyncQueue","rgxExtractUrlHash","baseUrl","_beforeMiddleware","_afterMiddleware","_resourcesParsing","_boundLoadResource","r","_loadResource","resources","progress","loading","defaultQueryString","_queue","onError","onLoad","Loader","_plugins","plugin","pre","use","_protected","_add","parentResource","_prepareUrl","parent","incompleteChildren","eachChunk","reset","k","res","_onStart","_onComplete","chunk","result","path","charAt","hash","substr","resource","dequeue","_onLoad","splice","shared","_shared","registerPlugin","init","assign","sharedLoader","loader","fromLoader","then","catch","Url","URL","webkitURL","Blob","createObjectURL","blob","revokeObjectURL","getResponseHeader","input","output","inx","bytebuffer","encodedCharIndexes","jnx","charCodeAt","encodeBinary","context","priority","previous","_destroyed","match","emit","deltaTime","redirect","connect","hard","autoStart","lastTime","speed","_requestId","_maxElapsedMS","_minElapsedMS","_lastFrame","TickerListener","Infinity","deltaMS","TARGET_FPMS","elapsedMS","_tick","time","update","requestAnimationFrame","_requestIfNeeded","performance","now","_cancelIfNeeded","cancelAnimationFrame","_startIfPossible","start","UPDATE_PRIORITY","_addListener","addOnce","listener","current","remove","count","stop","currentTime","delta","head","fps","minFPS","maxFPS","minFPMS","max","Ticker","_system","system","sharedTicker","defineProperty","set","ticker","_ticker","LOW","get","oldTicker","color","alpha","WHITE","matrix","visible","clone","obj","FillStyle","__extends","buildPoly","build","graphicsData","points","shape","slice","triangulate","graphicsGeometry","holes","verts","holeArray","hole","concat","triangles","vertPos","buildCircle","circleData","CIRC","radius","ellipseData","totalSegs","floor","sqrt","seg","PI","sin","cos","center","circle","buildRectangle","rectData","getPt","n1","n2","perc","quadraticBezierCurve","fromX","fromY","cpX","cpY","toX","toY","out","xa","ya","xb","yb","j","buildRoundedRectangle","rrectData","vecPos","square","nx","ny","innerWeight","outerWeight","clockwise","exx","eyy","eix","eiy","eox","eoy","cx","cy","sx","sy","ex","ey","cx2p0x","cy2p0y","angle0","atan2","angle1","startAngle","angleDiff","absAngleDiff","segCount","angleInc","angle","buildLine","lineStyle","native","closedShape","POLY","closeStroke","startIndex","currentIndex","buildNativeLine","eps","closePointEps","style","firstPoint","lastPoint","closedPath","pop","midPointX","midPointY","indexCount","indexStart","widthSquared","miterLimitSquared","miterLimit","x0","y0","x2","y2","perpx","perpy","perp1x","perp1y","dist","ratio","alignment","cap","LINE_CAP","ROUND","SQUARE","dx0","dy0","dx1","dy1","cross","c1","c2","px","py","pdist","imx","imy","omx","omy","insideWeight","join","LINE_JOIN","BEVEL","eps2","GRAPHICS_CURVES","epsilon","buildNonNativeLine","curveTo","a1","b1","a2","b2","mm","dd","cc","tt","k1","k2","j1","j2","qx","qy","endAngle","anticlockwise","arc","_startX","_startY","_anticlockwise","sweep","n","_segmentsCount","ceil","theta","theta2","cTheta","sTheta","segMinus","remainder","curveLength","cpX2","cpY2","t","t3","nt","nt2","nt3","dx","dy","prevX","prevY","BezierUtils","dt","dt2","dt3","ax","ay","bx","by","a32","ba","log","QuadraticUtils","begin","attribStart","end","endIndex","endAttrib","attribSize","size","FILL_COMMANDS","ELIP","RECT","RREC","BATCH_POOL","DRAW_CALL_POOL","isPolygonClockwise","polygon","sum","fillStyle","GraphicsData","tmpPoint","tmpBounds","boundsPadding","indicesUint16","batchable","colors","textureIds","drawCalls","batchDirty","batches","dirty","cacheDirty","clearDirty","shapeIndex","boundsDirty","calculateBounds","invalidate","texArray","clear","batchPart","drawShape","drawHole","lastShape","indexBuffer","contains","hitHole","updateBatches","allow32Indices","validateBatching","currentStyle","transformPoints","nextTexture","attribIndex","wrapMode","REPEAT","processFill","processLine","_compareStyles","BatchPart","addUvs","attrib","need32","Uint32Array","isBatchable","packBatches","buildDrawCalls","styleA","styleB","l","fill","line","GraphicsGeometry","BATCHABLE_SIZE","TICK","_globalBatch","currentGroup","TRIANGLES","textureCount","currentTexture","textureId","drawMode","LINES","_batchEnabled","touched","_batchLocation","elements","addColors","addTextureIds","packAttributes","glPoints","ArrayBuffer","f32","u32","_buffer","_indexBuffer","processHoles","bounds","sequenceBounds","curMatrix","IDENTITY","nextMatrix","lineWidth","isEmpty","addBoundsMatrix","addFramePad","ellipse","poly","addVerticesMatrix","pad","offset","rgb","rgba","id","uvsStart","frame","adjustUvs","finish","scaleX","scaleY","offsetX","offsetY","BUTT","MITER","LineStyle","temp","DEFAULT_SHADERS","geometry","shader","currentPath","batchTint","_fillStyle","_lineStyle","_matrix","_holeMode","state","for2d","_geometry","refCount","finishPoly","Graphics","lineTextureStyle","startPoly","invert","moveTo","lineTo","_initCurve","quadraticCurveTo","bezierCurveTo","arcTo","ArcUtils","startX","startY","xDiff","yDiff","beginFill","beginTextureFill","endFill","drawRect","drawRoundedRect","drawCircle","drawEllipse","drawPolygon","_boundsID","isFastRect","hasuint32","supports","uint32Indices","_populateBatches","_renderBatched","flush","_renderDirect","gI","_batchRGB","worldAlpha","calculateTints","_resolveDirectShader","uniforms","translationMatrix","_renderDrawCallDirect","drawCall","groupTextureCount","draw","MAX_TEXTURES","sampleValues","Int32Array","default","uSamplers","program","_shader","addFrame","_TEMP_POINT","tintRGB","wtID","closePath","setMatrix","beginHole","endHole","dispose","uvBuffer","uvMatrix","_bufferUpdateId","_textureUpdateId","forceUpdate","multiplyUvs","tempPolygon","vertexDirty","batchUvs","buffers","vertices","Mesh","_renderToBatch","_renderDefault","toArray","instanceCount","calculateUvs","material","verticesBuffer","vertexDirtyId","geomUvs","isSimple","MeshBatchUvs","addVertexData","getBounds","getBuffer","getIndex","step","ind0","ind1","ind2","_cachedTexture","uSampler","uTextureMatrix","uColor","_colorDirty","_alpha","alphaMode","mapCoord","uvsBuffer","addAttribute","FLOAT","addIndex","_updateId","segWidth","segHeight","segmentsX","segmentsY","sizeX","sizeY","totalSub","xpos","ypos","value2","value3","value4","textureScale","vertexBuffer","amount","prev","textureWidth","distance","updateVertices","nextPoint","perpX","perpY","perpLength","num","ropeGeometry","RopeGeometry","meshMaterial","autoUpdate","verticesX","verticesY","planeGeometry","PlaneGeometry","autoResize","textureUpdated","static","leftWidth","topHeight","rightWidth","bottomHeight","_origWidth","_origHeight","_leftWidth","_rightWidth","_topHeight","_bottomHeight","_refresh","updateHorizontalVertices","_getMinScale","updateVerticalVertices","scaleW","h","scaleH","_uvw","_uvh","SimplePlane","items","_name","_aliasCount","a0","a3","a4","a5","a6","a7","arguments","ensureNonAliasedItems","removeAll","defineProperties","Runner","run","prefix","Events","EE","addListener","emitter","TypeError","evt","_events","_eventsCount","clearEvent","EventEmitter","eventNames","events","names","getOwnPropertySymbols","listeners","listenerCount","removeListener","on","removeAllListeners","prefixed","module","exports","earcut","holeIndices","dim","invSize","hasHoles","outerLen","outerNode","linkedList","list","steiner","getLeftmost","sort","compareX","filterPoints","eliminateHole","eliminateHoles","earcutLinked","last","signedArea","insertNode","equals","removeNode","again","area","ear","pass","z","zOrder","prevZ","nextZ","tail","numMerges","pSize","qSize","inSize","sortLinked","indexCurve","isEarHashed","isEar","cureLocalIntersections","splitEarcut","pointInTriangle","minTX","minTY","maxTX","maxTY","minZ","maxZ","intersects","locallyInside","isValidDiagonal","splitPolygon","bridge","hx","hy","tan","mx","my","tanMin","sectorContainsSector","findHoleBridge","bridgeReverse","filteredBridge","leftmost","intersectsPolygon","inside","middleInside","p1","p2","q1","q2","o1","sign","o2","o3","o4","onSegment","Node","an","bp","deviation","polygonArea","trianglesArea","flatten","dimensions","holeIndex","INSTALLED","autoDetectResource","ResourcePlugin","test","destroyed","internal","onResize","onUpdate","unbind","resize","Promise","resolve","_renderer","_baseTexture","_glTexture","_source","_extension","upload","glTexture","gl","pixelStorei","UNPACK_PREMULTIPLY_ALPHA_WEBGL","UNPACK","realWidth","realHeight","texSubImage2D","format","texImage2D","internalFormat","Uint8Array","Resource","defaultBufferOptions","scaleMode","NEAREST","RGBA","NPM","mipmap","anisotropicLevel","resourceOptions","_mipmap","MIPMAP_TEXTURES","ANISOTROPIC_LEVEL","_wrapMode","WRAP_MODE","_scaleMode","SCALE_MODE","UNSIGNED_BYTE","TEXTURE_2D","uid","isPowerOfTwo","_refreshPOT","_glTextures","dirtyId","dirtyStyleId","cacheId","textureCacheIds","parentTextureArray","setResource","setStyle","setSize","desiredWidth","desiredHeight","setRealSize","setResolution","oldResolution","BaseTexture","removeFromCache","castToBaseTexture","STRICT_TEXTURE_CACHE","isFrame","_pixiId","pixiIdPrefix","addToCache","fromBuffer","BufferResource","console","warn","baseTextureFromCache","itemDirtyIds","partTexture","_load","initFromArray","addBaseTextureAt","addResourceAt","promises","filter","all","urls","TEXTURE_2D_ARRAY","texImage3D","texSubImage3D","AbstractMultiResource","sourceAny","naturalWidth","videoWidth","naturalHeight","videoHeight","noSubImage","element","crossorigin","OffscreenCanvas","HTMLCanvasElement","BaseImageResource","autoLoad","linkBaseTexture","CubeResource","SIDES","TEXTURE_CUBE_MAP_POSITIVE_X","TEXTURE_CUBE_MAP","keys","side","HTMLImageElement","imageElement","_process","preserveBitmap","createBitmap","CREATE_IMAGE_BITMAP","createImageBitmap","bitmap","reject","completed","cors","fetch","mode","premultiplyAlpha","glTextures","otherTex","close","sourceBase64","_overrideWidth","_overrideHeight","_resolve","_crossorigin","SVGResource","SVG_XML","btoa","unescape","encodeURIComponent","_loadSvg","tempImage","svgWidth","svgHeight","canvas","getContext","drawImage","getSize","svgString","sizeMatch","SVG_SIZE","parseFloat","HTMLVideoElement","videoElement","setAttribute","firstSrc","sourceElement","baseSrc","split","VideoResource","MIME_TYPES","_autoUpdate","_isConnectedToTicker","_updateFPS","updateFPS","_msToNextUpdate","autoPlay","_onCanPlay","_deltaTime","playbackRate","readyState","HAVE_ENOUGH_DATA","HAVE_FUTURE_DATA","_onPlayStart","_onPlayStop","_isSourceReady","_isSourcePlaying","ended","play","TYPES","ogv","mov","m4v","ImageBitmap","ImageResource","ImageBitmapResource","CanvasResource","ArrayResource","stencil","depth","dirtyFormat","dirtySize","depthTexture","colorTextures","glFramebuffers","disposeRunner","multisample","NONE","addColorTexture","OFF","addDepthTexture","DepthResource","DEPTH_COMPONENT","UNSIGNED_SHORT","enableDepth","enableStencil","destroyDepthTexture","clearColor","framebuffer","Framebuffer","maskStack","filterStack","x3","y3","baseFrame","rotate","tw","th","w2","h2","cX","cY","NW","uX","uY","DEFAULT_UVS","TextureUvs","noFrame","Texture","_frame","_rotate","Number","onBaseTextureUpdated","updateUvs","destroyBase","clonedFrame","clonedOrig","clonedTexture","fromURL","imageUrl","textureFromCache","xNotFit","yNotFit","relationship","errorX","errorY","removeAllHandlers","tex","fillRect","createWhiteTexture","baseRenderTexture","filterFrame","filterPoolKey","resizeBaseTexture","rest","RenderTexture","BaseRenderTexture","textureOptions","texturePool","enableFullScreen","_pixelsWidth","_pixelsHeight","createTexture","getOptimalTexture","minWidth","minHeight","renderTexture","getFilterTexture","filterTexture","returnTexture","returnFilterTexture","destroyTextures","textures","setScreenSize","SCREEN_KEY","normalized","stride","instance","Attribute","UID","_static","_glBuffers","ELEMENT_ARRAY_BUFFER","ARRAY_BUFFER","Buffer","byteSizeMap","attributes","glVertexArrayObjects","instanced","ids","bufferIndex","getAttribute","interleave","arrays","sizes","interleavedBuffer","attribute","outSize","views","littleOffset","interleaveTypedArrays","Geometry","merge","geometries","geometryOut","offsets","offset2","bufferIndexToCount","indexBufferData","targetTextureFrame","destinationFrame","isStatic","isUbo","group","syncUniforms","ubo","UNIFORM_BUFFER","autoManage","UniformGroup","_ubo","uboFrom","legacy","sourceFrame","bindingSourceFrame","bindingDestinationFrame","filters","tempPoints","tempMatrix","defaultFilterStack","RenderTexturePool","view","statePool","quad","Quad","quadUv","QuadUv","tempRect","activeState","globalUniforms","outputFrame","inputSize","inputPixel","inputClamp","filterArea","filterClamp","forceClear","useMaxPadding","FilterState","renderTextureSystem","padding","autoFit","sourceFrameProjected","projection","transformAABB","fit","roundFrame","getOptimalFilterTexture","lastState","blit","BLEND","flip","flop","CLEAR","bindAndClear","clearMode","stateSystem","autoClear","stateId","BLIT","applyFilter","filterGlobals","attributeData","aTextureCoord","TRIANGLE_STRIP","calculateSpriteMatrix","outputMatrix","sprite","mappedMatrix","copyTo","TEMP_MATRIX","prepend","translate","swap","emptyPool","lt","lb","rt","rb","left","top","bottom","right","identity","_object","emptyRenderer","ObjectRenderer","currentRenderer","objectRenderer","copyBoundTextures","arr","maxTextures","boundTextures","boundArray","batchId","bound","CONTEXT_UID_COUNTER","webGLVersion","extensions","handleContextLost","handleContextRestored","isContextLost","contextChange","CONTEXT_UID","getExtension","restoreContext","initFromContext","validateContext","runners","initFromOptions","createContext","PREFER_ENV","WEBGL2","getExtensions","common","anisotropicFiltering","floatTextureLinear","s3tc","s3tc_sRGB","etc","etc1","pvrtc","atc","astc","drawBuffers","loseContext","vertexArrayObject","uint32ElementIndex","floatTexture","textureHalfFloat","textureHalfFloatLinear","colorBufferFloat","preventDefault","useProgram","postrender","renderingToScreen","getContextAttributes","isWebGl2","WebGL2RenderingContext","msaaBuffer","blitFramebuffer","mipLevel","tempRectangle","managedFramebuffers","unknownFramebuffer","msaaSamples","viewport","hasMRT","writeDepthTexture","disposeAll","nativeDepthTextureExtension","WEBGL_LEGACY","activeTextures","drawBuffersWEBGL","getInternalformatParameter","RENDERBUFFER","RGBA8","SAMPLES","fbo","initFramebuffer","bindFramebuffer","FRAMEBUFFER","updateFramebuffer","resizeFramebuffer","mipWidth","mipHeight","setViewport","v","g","mask","COLOR","DEPTH","GLFramebuffer","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","LINEAR","disposeFramebuffer","contextLost","deleteFramebuffer","forceStencil","_activeGeometry","_activeVao","hasVao","hasInstance","canUseUInt32ElementIndex","managedGeometries","createVertexArray","createVertexArrayOES","bindVertexArray","vao","bindVertexArrayOES","deleteVertexArray","deleteVertexArrayOES","vertexAttribDivisor","vertexAttribDivisorANGLE","drawElementsInstanced","drawElementsInstancedANGLE","drawArraysInstanced","drawArraysInstancedANGLE","vaos","incRefCount","initGeometryVao","activateVao","updateBuffers","bufferSystem","checkCompatibility","geometryAttributes","shaderAttributes","getSignature","attribs","strings","glPrograms","generateProgram","signature","vaoObjectHash","tempStride","tempStart","disposeGeometry","buf","vaoId","lastBuffer","glBuffer","enableVertexAttribArray","vertexAttribPointer","byteSize","BYTES_PER_ELEMENT","glType","UNSIGNED_INT","drawElements","drawArrays","maskObject","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","forEach","number","fragmentSourceToLog","groupCollapsed","groupEnd","booleanArray","defaultValue","maxFragmentPrecision","unknownContext","getTestContext","setPrecision","requestedPrecision","maxSupportedPrecision","precision","HIGH","MEDIUM","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","fragTemplate","generateIfTestSrc","maxIfs","checkMaxIfStatementsInShader","FRAGMENT_SHADER","fragmentSrc","getShaderParameter","COMPILE_STATUS","nameCache","vertexSrc","Program","defaultVertexSrc","defaultFragmentSrc","PRECISION_VERTEX","PRECISION_FRAGMENT","getShaderPrecisionFormat","shaderFragment","HIGH_FLOAT","getMaxFragmentPrecision","uniformBindCount","uniformGroup","checkUniformExists","Shader","polygonOffset","blend","depthMask","_blendMode","_polygonOffset","clockwiseFrontFace","culling","State","depthTest","Filter","FILTER_RESOLUTION","filterManager","_currentState","_resolution","tempMat","clampMargin","uClampFrame","uClampOffset","clampOffset","mat","append","texBase","margin","maskSprite","maskMatrix","_maskSprite","renderable","TextureMatrix","npmAlpha","otherMatrix","maskClamp","enableScissor","alphaMaskPool","maskDataPool","alphaMaskIndex","setMaskStack","scissor","maskDataOrTarget","maskData","MaskData","detect","SPRITE","SCISSOR","STENCIL","pushSpriteMask","popSpriteMask","maskCurrent","testScissor","alphaMaskFilter","SpriteMaskFilter","stashFilterArea","glConst","getStackLength","curStackLen","newStackLen","disable","enable","_useCurrent","WebGLRenderingContext","SCISSOR_TEST","calcScissorRect","prevData","roundFrameToPixels","isMatrixRotated","ScissorSystem","AbstractMaskSystem","STENCIL_TEST","prevMaskCount","clearStencil","STENCIL_BUFFER_BIT","colorMask","stencilFunc","EQUAL","stencilOp","KEEP","INCR","DECR","defaultFrame","projectionMatrix","root","calculateProjection","syncUniformGroup","globals","_destinationFrame","pm","setTransform","tempRect2","_backgroundColorRgba","defaultMaskStack","viewportFrame","screen","clearMask","uboUpdate","_ud","_uv","_syncData","UBO_TO_SINGLE_SETTERS","GLSL_TO_STD40_SIZE","createUBOElements","uniformData","uboElements","dataLen","chunkSize","uboElement","lineUpValue","getUBOData","usedUniformDatas","generateUniformBufferSync","syncFunc","funcFragments","parsed","uniformParser","rowSize","elementSize","template","Function","uniformGroups","uniformDirtyGroups","uniformBufferBindings","glVertShader","VERTEX_SHADER","glFragShader","webGLProgram","createProgram","attachShader","linkProgram","getProgramParameter","LINK_STATUS","vertexShader","fragmentShader","getProgramInfoLog","logProgramError","totalAttributes","ACTIVE_ATTRIBUTES","attribData","getActiveAttrib","getAttribLocation","getAttributeData","totalUniforms","ACTIVE_UNIFORMS","getActiveUniform","getUniformData","bindAttribLocation","deleteShader","getUniformLocation","GLProgram","defaultSyncData","uboCount","systemCheck","cache","_uboCache","func","unsafeEvalSupported","dontSync","glProgram","setUniforms","syncData","getGlProgram","createSyncGroups","generateUniformsSync","syncUniformBufferGroup","createSyncBufferGroup","bindBufferBase","uniformBlockIndex","getUniformBlockIndex","uniformBlockBinding","uboData","preFix","_blendEq","setBlend","setOffset","setCullFace","setDepthTest","setFrontFace","setDepthMask","checks","defaultState","blendModes","ONE","ONE_MINUS_SRC_ALPHA","ADD","MULTIPLY","DST_COLOR","SCREEN","ONE_MINUS_SRC_COLOR","OVERLAY","DARKEN","LIGHTEN","COLOR_DODGE","COLOR_BURN","HARD_LIGHT","SOFT_LIGHT","DIFFERENCE","EXCLUSION","HUE","SATURATION","LUMINOSITY","NORMAL_NPM","SRC_ALPHA","ADD_NPM","SCREEN_NPM","SRC_IN","DST_ALPHA","ZERO","SRC_OUT","ONE_MINUS_DST_ALPHA","SRC_ATOP","DST_OVER","DST_IN","DST_OUT","DST_ATOP","XOR","SUBTRACT","FUNC_REVERSE_SUBTRACT","FUNC_ADD","mapWebGLBlendModesToPixi","diff","forceState","updateCheck","StateSystem","checkBlendMode","checkPolygonOffset","POLYGON_OFFSET_FILL","DEPTH_TEST","CULL_FACE","frontFace","setBlendMode","blendFunc","blendFuncSeparate","blendEquationSeparate","setPolygonOffset","UNPACK_FLIP_Y_WEBGL","checkCount","maxIdle","GC_MAX_IDLE","checkCountMax","GC_MAX_CHECK_COUNT","GC_MODE","MANUAL","tm","managedTextures","wasRemoved","destroyTexture","unload","displayObject","samplerType","currentLocation","_unknownBoundTextures","unknownTexture","hasIntegerTextures","internalFormats","table","RGB","RGB8","RG","RG8","RED","R8","RGBA_INTEGER","RGBA8UI","RGB_INTEGER","RGB8UI","RG_INTEGER","RG8UI","RED_INTEGER","R8UI","ALPHA","LUMINANCE","LUMINANCE_ALPHA","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","HALF_FLOAT","RGBA16F","RGB16F","RG16F","R16F","UNSIGNED_SHORT_5_6_5","RGB565","UNSIGNED_SHORT_4_4_4_4","RGBA4","UNSIGNED_SHORT_5_5_5_1","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","GLTexture","bindTexture","texParameteri","TEXTURE_MAG_FILTER","TEXTURE_MIN_FILTER","textureGC","initTexture","activeTexture","TEXTURE0","updateTexture","ensureSamplerType","initTextureType","updateTextureStyle","skipRemove","deleteTexture","POW2","CLAMP","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","RENDER_OPTIONS","useContextAlpha","autoDensity","preserveDrawingBuffer","clearBeforeRender","_backgroundColor","_backgroundColorString","backgroundColor","backgroundAlpha","transparent","_lastObjectRendered","initPlugins","staticMap","desiredScreenWidth","desiredScreenHeight","screenWidth","screenHeight","generateTexture","region","manualRegion","skipUpdateTransform","removeView","parentNode","thisAny","_tempDisplayObjectParent","updateID","byteLength","managedBuffers","boundBufferBases","createGLBuffer","bindBuffer","bindBufferRange","bufferSubData","drawType","STATIC_DRAW","DYNAMIC_DRAW","bufferData","deleteBuffer","GLBuffer","createBuffer","WEBGL","prerender","addSystem","MaskSystem","ContextSystem","ShaderSystem","TextureSystem","BufferSystem","GeometrySystem","FramebufferSystem","StencilSystem","ProjectionSystem","TextureGCSystem","FilterSystem","RenderTextureSystem","BatchSystem","Renderer","__plugins","antialias","premultipliedAlpha","powerPreference","FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER_BINDING","DRAW_FRAMEBUFFER","ClassRef","isLost","cacheParent","enableTempParent","updateTransform","disableTempParent","extract","ctor","AbstractRenderer","autoDetectRenderer","defaultVertex","defaultFilterVertex","sizeOrBuffer","rawBinaryData","uint32View","float32View","_int8View","Int8Array","_uint8View","_int16View","Int16Array","_uint16View","_int32View","sizeOf","shaderGenerator","geometryClass","vertexSize","SPRITE_BATCH_SIZE","_vertexCount","_indexCount","_bufferedElements","_bufferedTextures","_bufferSize","_packedGeometries","_packedGeometryPoolSize","_flushId","_aBuffers","_iBuffers","onPrerender","_dcIndex","_aIndex","_iIndex","_attributeBuffer","_tempBoundTextures","SPRITE_MAX_TEXTURES","generateShader","initFlushBuffers","_drawCallPool","AbstractBatchRenderer","_textureArrayPool","MAX_SPRITES","MAX_TA","BatchDrawCall","BatchTextureArray","buildTexturesAndDrawCalls","textureArrays","touch","countTexArrays","dcIndex","aIndex","iIndex","spriteBlendMode","packInterleavedGeometry","bindAndClearTexArray","textureSystem","updateGeometry","packedGeometries","attributeBuffer","CAN_UPLOAD_SAME_BUFFER","drawBatches","dcCount","curTexArray","getAttributeBuffer","getIndexBuffer","roundedP2","roundedSizeIndex","roundedSize","ViewableBuffer","packedVertices","indicies","argb","programCache","defaultGroupCache","generateSampleSrc","vertex","fragment","defaultFragment","BatchGeometry","BatchShaderGenerator","BatchRenderer","BatchPluginFactory","_resources","systems","_systems","SHAPES","Rectangle","rectangle","paddingX","paddingY","enlarge","Circle","r2","halfWidth","halfHeight","Ellipse","normx","normy","flat","il","Polygon","xi","yi","xj","yj","reduce","pointsDesc","currentPoint","RoundedRectangle","radius2","Point","scope","ObservablePoint","fromArray","transpose","pos","newPos","tx1","d1","pivotX","pivotY","rotation","skewX","skewY","decompose","pivot","PI_2","skew","position","Matrix","ux","uy","vx","vy","rotationCayley","rotationMatrices","signum","row","_ux","_uy","_vx","_vy","groupD8","E","SE","S","SW","W","N","NE","MIRROR_VERTICAL","MAIN_DIAGONAL","MIRROR_HORIZONTAL","REVERSE_DIAGONAL","ind","vX","vY","inv","rotationSecond","rotationFirst","sub","rotate180","isVertical","byDirection","matrixAppendRotationInv","localTransform","onChange","updateSkew","_rotation","_cx","_sx","_cy","_sy","_localID","_currentLocalID","_parentID","updateLocalTransform","parentTransform","pt","setFromMatrix","Transform","_parse","_format","supported","saidHello","skipHello","sayHello","userAgent","isWebGLSupported","contextOptions","failIfMajorPerformanceCaveat","FAIL_IF_MAJOR_PERFORMANCE_CAVEAT","success","hex2rgb","hex","hex2string","hexString","string2hex","string","cssColorNames","parseInt","rgb2hex","premultiplyBlendMode","npm","mapPremultipliedBlendModes","correctBlendMode","premultiplied","premultiplyRgba","premultiply","premultiplyTint","R","G","B","premultiplyTintToRgba","createIndicesForQuads","outBuffer","totalIndices","getBufferType","nextPow2","isPow2","log2","removeItems","startIdx","removeCount","nextUid","warnings","deprecation","version","ignoreDepth","stack","ProgramCache","TextureCache","BaseTextureCache","destroyTextureCache","clearTextureCache","clearRect","trimCanvas","pixels","getImageData","DATA_URI","decomposeDataUri","dataUri","dataUriMatch","mediaType","subType","charset","encoding","determineCrossOrigin","_url","getResolutionOfUrl","RETINA_PREFIX","ENV","RENDERER_TYPE","BUFFER_BITS","BLEND_MODES","DRAW_MODES","FORMATS","TARGETS","SAMPLER_TYPES","SCALE_MODES","WRAP_MODES","MIPMAP_MODES","ALPHA_MODES","CLEAR_MODES","GC_MODES","PRECISION","MASK_TYPES","MSAA_QUALITY","BUFFER_TYPE","isMobile","allowMax","tablet","phone","apple","device","android","SORTABLE_CHILDREN","addPoint","addPointMatrix","addFrameMatrix","beginOffset","endOffset","addVertices","padX","padY","rawX","rawY","addBounds","addBoundsMask","_minX","_minY","_maxX","_maxY","addBoundsArea","tempDisplayObjectParent","_lastSortedIndex","_zIndex","_enabledFilters","Bounds","_localBounds","_boundsRect","_mask","_maskRefCount","isMask","mixin","propertyName","DisplayObject","getOwnPropertyDescriptor","_recursivePostUpdateTransform","skipUpdate","transformRef","parentRef","worldBounds","worldBoundsID","toGlobal","displayObjectUpdateTransform","toLocal","setParent","container","addChild","_options","hitArea","interactive","interactiveChildren","TemporaryDisplayObject","myParent","sortDirty","sortChildren","zIndex","sortableChildren","onChildrenChange","_length","child","addChildAt","swapChildren","child2","index1","getChildIndex","index2","setChildIndex","getChildAt","removeChildAt","removeChildren","beginIndex","removed","range","RangeError","sortRequired","skipChildrenUpdate","renderAdvanced","destroyChildren","oldChildren","Container","containerUpdateTransform","punycode","require","util","slashes","auth","search","query","pathname","urlParse","relative","resolveObject","isString","protocolPattern","portPattern","simplePathPattern","unwise","autoEscape","nonHostChars","hostEndingChars","hostnamePartPattern","hostnamePartStart","unsafeProtocol","hostlessProtocol","slashedProtocol","querystring","parseQueryString","slashesDenoteHost","isObject","u","queryIndex","splitter","uSplit","simplePath","proto","lowerProto","atSign","hostEnd","hec","decodeURIComponent","parseHost","ipv6Hostname","hostparts","part","newpart","validParts","notHost","bit","toASCII","ae","esc","escape","qm","stringify","rel","tkeys","tk","tkey","rkeys","rk","rkey","relPath","isSourceAbs","isRelAbs","mustEndAbs","removeAllDots","srcPath","psychotic","isNullOrUndefined","authInHost","isNull","hasTrailingSlash","up","isAbsolute","nodeType","freeGlobal","global","window","maxInt","base","regexPunycode","regexNonASCII","regexSeparators","errors","stringFromCharCode","String","fromCharCode","mapDomain","parts","ucs2decode","extra","counter","ucs2encode","digitToBasic","digit","adapt","numPoints","firstTime","baseMinusTMin","decode","basic","oldi","baseMinusT","codePoint","inputLength","bias","encode","handledCPCount","basicLength","currentValue","handledCPCountPlusOne","qMinusT","define","arg","prop","qs","sep","eq","regexp","maxKeys","kstr","vstr","idx","xs","stringifyPrimitive","isFinite","objectKeys","ks","f"],"mappings":";uLAgBI,EAAgB,SAASA,EAAGC,GAI5B,OAHA,EAAgBC,OAAOC,gBAClB,CAAEC,UAAW,cAAgBC,OAAS,SAAUL,EAAGC,GAAKD,EAAEI,UAAYH,IACvE,SAAUD,EAAGC,GAAK,IAAK,IAAIK,KAAKL,EAAOA,EAAEM,eAAeD,KAAIN,EAAEM,GAAKL,EAAEK,MACpDN,EAAGC,ICT5B,IAAMO,EAAY,IAAI,IAChBC,EAAU,IAAIC,YAAY,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,IA8BhD,cAoHI,WAAYC,GAAZ,MAEI,cAAO,K,OAEP,EAAKC,QAAU,IAAI,IACf,EAAKC,gBACL,EACCF,EAAUA,EAAQG,cAAcC,EAAI,EACpCJ,EAAUA,EAAQG,cAAcE,EAAI,GAGzC,EAAKC,SAAW,KAEhB,EAAKC,OAAS,EACd,EAAKC,QAAU,EACf,EAAKC,MAAQ,KACb,EAAKC,SAAW,KAEhB,EAAKC,KAAO,SACZ,EAAKC,UAAY,IAAYC,OAC7B,EAAKC,YAAc,SACnB,EAAKC,IAAM,KAGX,EAAKf,QAAUA,GAAW,KAAQgB,MAClC,EAAKC,WAAa,IAAIC,aAAa,GACnC,EAAKC,kBAAoB,KAEzB,EAAKC,cAAgB,EACrB,EAAKC,YAAc,EAEnB,EAAKC,qBAAuB,EAC5B,EAAKC,mBAAqB,EAI1B,EAAKzB,QAAUA,EAEf,EAAK0B,WAAa,QAMlB,EAAKC,UAAW,EAChB,EAAKC,aAAe,IAASC,a,EA+brC,ODnnBO,SAAmBtC,EAAGC,GAEzB,SAASsC,IAAOC,KAAK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ASjgF,EAAKigF,EAAIK,GAChB,GAAIL,EAAGjgF,IAAK,OAAOigF,EAAGjgF,IAAIsgF,GAE1B,IADA,IAAI7wE,EAAM,GACDvV,EAAI,EAAGA,EAAI+lF,EAAG9lF,OAAQD,IAC7BuV,EAAI1R,KAAKuiF,EAAEL,EAAG/lF,GAAIA,IAEpB,OAAOuV,EAGT,IAAI2wE,EAAavqF,OAAO2tC,MAAQ,SAAUttB,GACxC,IAAIzG,EAAM,GACV,IAAK,IAAI7Q,KAAOsX,EACVrgB,OAAOwC,UAAUnC,eAAeuF,KAAKya,EAAKtX,IAAM6Q,EAAI1R,KAAKa,GAE/D,OAAO6Q","file":"static/js/35.d146982f.chunk.js","sourcesContent":["/*! *****************************************************************************\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 { BLEND_MODES } from '@pixi/constants';\nimport { Texture } from '@pixi/core';\nimport { Container } from '@pixi/display';\nimport { ObservablePoint, Point, Rectangle } from '@pixi/math';\nimport { settings } from '@pixi/settings';\nimport { sign } from '@pixi/utils';\n\nimport type { IBaseTextureOptions, Renderer, TextureSource } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst indices = new Uint16Array([0, 1, 2, 0, 2, 3]);\n\nexport type SpriteSource = TextureSource|Texture;\n\nexport interface Sprite extends GlobalMixins.Sprite, Container {}\n\n/**\n * The Sprite object is the base for all textured objects that are rendered to the screen\n*\n * A sprite can be created directly from an image like this:\n *\n * ```js\n * let sprite = PIXI.Sprite.from('assets/image.png');\n * ```\n *\n * The more efficient way to create sprites is using a {@link PIXI.Spritesheet},\n * as swapping base textures when rendering to the screen is inefficient.\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 * let sprite = new PIXI.Sprite(sheet.textures[\"image.png\"]);\n * ...\n * }\n * ```\n *\n * @memberof PIXI\n */\nexport class Sprite extends Container\n{\n /**\n * The blend mode to be applied to the sprite. Apply a value of `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @default PIXI.BLEND_MODES.NORMAL\n */\n public blendMode: BLEND_MODES;\n public indices: Uint16Array;\n\n /**\n * Plugin that is responsible for rendering this element.\n * Allows to customize the rendering process without overriding '_render' & '_renderCanvas' methods.\n *\n * @default 'batch'\n */\n public pluginName: string;\n\n /**\n * The width of the sprite (this is initially set by the texture).\n *\n * @protected\n */\n _width: number;\n\n /**\n * The height of the sprite (this is initially set by the texture)\n *\n * @protected\n */\n _height: number;\n\n /**\n * The texture that the sprite is using.\n *\n * @private\n */\n _texture: Texture;\n _textureID: number;\n\n /**\n * Cached tint value so we can tell when the tint is changed.\n * Value is used for 2d CanvasRenderer.\n *\n * @protected\n * @default 0xFFFFFF\n */\n _cachedTint: number;\n protected _textureTrimmedID: number;\n\n /**\n * This is used to store the uvs data of the sprite, assigned at the same time\n * as the vertexData in calculateVertices().\n *\n * @member {Float32Array}\n */\n protected uvs: Float32Array;\n\n /**\n * The anchor point defines the normalized coordinates\n * in the texture that map to the position of this\n * sprite.\n *\n * By default, this is `(0,0)` (or `texture.defaultAnchor`\n * if you have modified that), which means the position\n * `(x,y)` of this `Sprite` will be the top-left corner.\n *\n * Note: Updating `texture.defaultAnchor` after\n * constructing a `Sprite` does _not_ update its anchor.\n *\n * {@link https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html}\n *\n * @default `this.texture.defaultAnchor`\n */\n protected _anchor: ObservablePoint;\n\n /**\n * This is used to store the vertex data of the sprite (basically a quad).\n *\n * @member {Float32Array}\n */\n protected vertexData: Float32Array;\n\n /**\n * This is used to calculate the bounds of the object IF it is a trimmed sprite.\n *\n * @member {Float32Array}\n */\n private vertexTrimmedData: Float32Array;\n\n /**\n * Internal roundPixels field\n *\n * @private\n */\n private _roundPixels: boolean;\n private _transformID: number;\n private _transformTrimmedID: number;\n\n /**\n * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @default 0xFFFFFF\n */\n private _tint: number;\n\n // Internal-only properties\n /**\n * The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.\n *\n * @private\n * @default 16777215\n */\n _tintRGB: number;\n\n /** @param texture - The texture for this sprite. */\n constructor(texture?: Texture)\n {\n super();\n\n this._anchor = new ObservablePoint(\n this._onAnchorUpdate,\n this,\n (texture ? texture.defaultAnchor.x : 0),\n (texture ? texture.defaultAnchor.y : 0)\n );\n\n this._texture = null;\n\n this._width = 0;\n this._height = 0;\n this._tint = null;\n this._tintRGB = null;\n\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n this._cachedTint = 0xFFFFFF;\n this.uvs = null;\n\n // call texture setter\n this.texture = texture || Texture.EMPTY;\n this.vertexData = new Float32Array(8);\n this.vertexTrimmedData = null;\n\n this._transformID = -1;\n this._textureID = -1;\n\n this._transformTrimmedID = -1;\n this._textureTrimmedID = -1;\n\n // Batchable stuff..\n // TODO could make this a mixin?\n this.indices = indices;\n\n this.pluginName = 'batch';\n\n /**\n * Used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = true;\n this._roundPixels = settings.ROUND_PIXELS;\n }\n\n /** When the texture is updated, this event will fire to update the scale and frame. */\n protected _onTextureUpdate(): void\n {\n this._textureID = -1;\n this._textureTrimmedID = -1;\n this._cachedTint = 0xFFFFFF;\n\n // so if _width is 0 then width was not set..\n if (this._width)\n {\n this.scale.x = sign(this.scale.x) * this._width / this._texture.orig.width;\n }\n\n if (this._height)\n {\n this.scale.y = sign(this.scale.y) * this._height / this._texture.orig.height;\n }\n }\n\n /** Called when the anchor position updates. */\n private _onAnchorUpdate(): void\n {\n this._transformID = -1;\n this._transformTrimmedID = -1;\n }\n\n /** Calculates worldTransform * vertices, store it in vertexData. */\n public calculateVertices(): void\n {\n const texture = this._texture;\n\n if (this._transformID === this.transform._worldID && this._textureID === texture._updateID)\n {\n return;\n }\n\n // update texture UV here, because base texture can be changed without calling `_onTextureUpdate`\n if (this._textureID !== texture._updateID)\n {\n this.uvs = this._texture._uvs.uvsFloat32;\n }\n\n this._transformID = this.transform._worldID;\n this._textureID = texture._updateID;\n\n // set the vertex data\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n const vertexData = this.vertexData;\n const trim = texture.trim;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n let w0 = 0;\n let w1 = 0;\n let h0 = 0;\n let h1 = 0;\n\n if (trim)\n {\n // if the sprite is trimmed and is not a tilingsprite then we need to add the extra\n // space before transforming the sprite coords.\n w1 = trim.x - (anchor._x * orig.width);\n w0 = w1 + trim.width;\n\n h1 = trim.y - (anchor._y * orig.height);\n h0 = h1 + trim.height;\n }\n else\n {\n w1 = -anchor._x * orig.width;\n w0 = w1 + orig.width;\n\n h1 = -anchor._y * orig.height;\n h0 = h1 + orig.height;\n }\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n }\n\n /**\n * Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.\n *\n * This is used to ensure that the true width and height of a trimmed texture is respected.\n */\n public calculateTrimmedVertices(): void\n {\n if (!this.vertexTrimmedData)\n {\n this.vertexTrimmedData = new Float32Array(8);\n }\n else if (this._transformTrimmedID === this.transform._worldID && this._textureTrimmedID === this._texture._updateID)\n {\n return;\n }\n\n this._transformTrimmedID = this.transform._worldID;\n this._textureTrimmedID = this._texture._updateID;\n\n // lets do some special trim code!\n const texture = this._texture;\n const vertexData = this.vertexTrimmedData;\n const orig = texture.orig;\n const anchor = this._anchor;\n\n // lets calculate the new untrimmed bounds..\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const w1 = -anchor._x * orig.width;\n const w0 = w1 + orig.width;\n\n const h1 = -anchor._y * orig.height;\n const h0 = h1 + orig.height;\n\n // xy\n vertexData[0] = (a * w1) + (c * h1) + tx;\n vertexData[1] = (d * h1) + (b * w1) + ty;\n\n // xy\n vertexData[2] = (a * w0) + (c * h1) + tx;\n vertexData[3] = (d * h1) + (b * w0) + ty;\n\n // xy\n vertexData[4] = (a * w0) + (c * h0) + tx;\n vertexData[5] = (d * h0) + (b * w0) + ty;\n\n // xy\n vertexData[6] = (a * w1) + (c * h0) + tx;\n vertexData[7] = (d * h0) + (b * w1) + ty;\n }\n\n /**\n *\n * Renders the object using the WebGL renderer\n *\n * @param renderer - The webgl renderer to use.\n */\n protected _render(renderer: Renderer): void\n {\n this.calculateVertices();\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n renderer.plugins[this.pluginName].render(this);\n }\n\n /** Updates the bounds of the sprite. */\n protected _calculateBounds(): void\n {\n const trim = this._texture.trim;\n const orig = this._texture.orig;\n\n // First lets check to see if the current texture has a trim..\n if (!trim || (trim.width === orig.width && trim.height === orig.height))\n {\n // no trim! lets use the usual calculations..\n this.calculateVertices();\n this._bounds.addQuad(this.vertexData);\n }\n else\n {\n // lets calculate a special trimmed bounds...\n this.calculateTrimmedVertices();\n this._bounds.addQuad(this.vertexTrimmedData);\n }\n }\n\n /**\n * Gets the local bounds of the sprite object.\n *\n * @param rect - Optional output rectangle.\n * @return The bounds.\n */\n public getLocalBounds(rect?: Rectangle): Rectangle\n {\n // we can do a fast local bounds if the sprite has no children!\n if (this.children.length === 0)\n {\n this._bounds.minX = this._texture.orig.width * -this._anchor._x;\n this._bounds.minY = this._texture.orig.height * -this._anchor._y;\n this._bounds.maxX = this._texture.orig.width * (1 - this._anchor._x);\n this._bounds.maxY = this._texture.orig.height * (1 - this._anchor._y);\n\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n return super.getLocalBounds.call(this, rect);\n }\n\n /**\n * Tests if a point is inside this sprite\n *\n * @param point - the point to test\n * @return The result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, tempPoint);\n\n const width = this._texture.orig.width;\n const height = this._texture.orig.height;\n const x1 = -width * this.anchor.x;\n let y1 = 0;\n\n if (tempPoint.x >= x1 && tempPoint.x < x1 + width)\n {\n y1 = -height * this.anchor.y;\n\n if (tempPoint.y >= y1 && tempPoint.y < y1 + height)\n {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Destroys this sprite and optionally its texture and children.\n *\n * @param options - Options parameter. A boolean will act as if all options\n * have been set to that value\n * @param [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 [options.texture=false] - Should it destroy the current texture of the sprite as well\n * @param [options.baseTexture=false] - Should it destroy the base texture of the sprite as well\n */\n public destroy(options?: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n this._texture.off('update', this._onTextureUpdate, this);\n\n this._anchor = null;\n\n const destroyTexture = typeof options === 'boolean' ? options : options && options.texture;\n\n if (destroyTexture)\n {\n const destroyBaseTexture = typeof options === 'boolean' ? options : options && options.baseTexture;\n\n this._texture.destroy(!!destroyBaseTexture);\n }\n\n this._texture = null;\n }\n\n // some helper functions..\n\n /**\n * Helper function that creates a new sprite 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 * @param {string|PIXI.Texture|HTMLCanvasElement|HTMLVideoElement} source - Source to create texture from\n * @param {object} [options] - See {@link PIXI.BaseTexture}'s constructor for options.\n * @return The newly created sprite\n */\n static from(source: SpriteSource, options?: IBaseTextureOptions): Sprite\n {\n const texture = (source instanceof Texture)\n ? source\n : Texture.from(source, options);\n\n return new Sprite(texture);\n }\n\n /**\n * If true PixiJS will Math.floor() x/y values when rendering, stopping pixel interpolation.\n *\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 *\n * To set the global default, change {@link PIXI.settings.ROUND_PIXELS}.\n *\n * @default false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /** The width of the sprite, setting this will actually modify the scale to achieve the value set. */\n get width(): number\n {\n return Math.abs(this.scale.x) * this._texture.orig.width;\n }\n\n set width(value: number)\n {\n const s = sign(this.scale.x) || 1;\n\n this.scale.x = s * value / this._texture.orig.width;\n this._width = value;\n }\n\n /** The height of the sprite, setting this will actually modify the scale to achieve the value set. */\n get height(): number\n {\n return Math.abs(this.scale.y) * this._texture.orig.height;\n }\n\n set height(value: number)\n {\n const s = sign(this.scale.y) || 1;\n\n this.scale.y = s * value / this._texture.orig.height;\n this._height = value;\n }\n\n /**\n * The anchor sets the origin point of the sprite. The default value is taken from the {@link PIXI.Texture|Texture}\n * and passed to the constructor.\n *\n * The default is `(0,0)`, this means the sprite's origin is the top left.\n *\n * Setting the anchor to `(0.5,0.5)` means the sprite's origin is centered.\n *\n * Setting the anchor to `(1,1)` would mean the sprite's origin point will be the bottom right corner.\n *\n * If you pass only single parameter, it will set both x and y to the same value as shown in the example below.\n *\n * @example\n * const sprite = new PIXI.Sprite(texture);\n * sprite.anchor.set(0.5); // This will set the origin to center. (0.5) is same as (0.5, 0.5).\n */\n get anchor(): ObservablePoint\n {\n return this._anchor;\n }\n\n set anchor(value: ObservablePoint)\n {\n this._anchor.copyFrom(value);\n }\n\n /**\n * The tint applied to the sprite. This is a hex value.\n *\n * A value of 0xFFFFFF will remove any tint effect.\n *\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return this._tint;\n }\n\n set tint(value: number)\n {\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n }\n\n /** The texture that the sprite is using. */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n if (this._texture === value)\n {\n return;\n }\n\n if (this._texture)\n {\n this._texture.off('update', this._onTextureUpdate, this);\n }\n\n this._texture = value || Texture.EMPTY;\n this._cachedTint = 0xFFFFFF;\n\n this._textureID = -1;\n this._textureTrimmedID = -1;\n\n if (value)\n {\n // wait for the texture to load\n if (value.baseTexture.valid)\n {\n this._onTextureUpdate();\n }\n else\n {\n value.once('update', this._onTextureUpdate, this);\n }\n }\n }\n}\n","/* jshint -W097 */\n\n/**\n * @memberof PIXI\n */\nexport class SignalBinding\n{\n _fn: any;\n _once: boolean;\n _next: SignalBinding;\n _prev: SignalBinding;\n _owner: Signal;\n _thisArg: any;\n\n /**\n * SignalBinding constructor.\n * @constructs SignalBinding\n * @param {Function} fn - Event handler to be called.\n * @param {Boolean} [once=false] - Should this listener be removed after dispatch\n * @param {object} [thisArg] - The context of the callback function.\n * @api private\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n constructor(fn: CbType, once = false, thisArg: any)\n {\n this._fn = fn;\n this._once = once;\n this._thisArg = thisArg;\n this._next = this._prev = this._owner = null;\n }\n\n detach(): boolean\n {\n if (this._owner === null) return false;\n this._owner.detach(this);\n\n return true;\n }\n}\n\n/**\n * @private\n */\nfunction _addSignalBinding(self: Signal, node: SignalBinding)\n{\n if (!self._head)\n {\n self._head = node;\n self._tail = node;\n }\n else\n {\n self._tail._next = node;\n node._prev = self._tail;\n self._tail = node;\n }\n\n node._owner = self;\n\n return node;\n}\n\n/**\n * @memberof PIXI\n */\nexport class Signal void>\n{\n _head: SignalBinding;\n _tail: SignalBinding;\n\n /**\n * MiniSignal constructor.\n * @example\n * let mySignal = new Signal();\n * let binding = mySignal.add(onSignal);\n * mySignal.dispatch('foo', 'bar');\n * mySignal.detach(binding);\n */\n constructor()\n {\n this._head = this._tail = undefined;\n }\n\n /**\n * Return an array of attached SignalBinding.\n *\n * @param {Boolean} [exists=false] - We only need to know if there are handlers.\n * @returns {PIXI.SignalBinding[]|Boolean} Array of attached SignalBinding or Boolean if called with exists = true\n * @api public\n */\n handlers(exists = false): Array> | boolean\n {\n let node = this._head;\n\n if (exists) return !!node;\n\n const ee = [];\n\n while (node)\n {\n ee.push(node);\n node = node._next;\n }\n\n return ee;\n }\n\n /**\n * Return true if node is a SignalBinding attached to this MiniSignal\n *\n * @param {PIXI.SignalBinding} node - Node to check.\n * @returns {Boolean} True if node is attache to mini-signal\n */\n has(node: SignalBinding): boolean\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#has(): First arg must be a SignalBinding object.');\n }\n\n return node._owner === this;\n }\n\n /**\n * Dispaches a signal to all registered listeners.\n *\n * @returns {Boolean} Indication if we've emitted an event.\n */\n dispatch(...args: any[]): boolean\n {\n let node = this._head;\n\n if (!node) return false;\n\n while (node)\n {\n if (node._once) this.detach(node);\n node._fn.apply(node._thisArg, args);\n node = node._next;\n }\n\n return true;\n }\n\n /**\n * Register a new listener.\n *\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n add(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#add(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, false, thisArg));\n }\n\n /**\n * Register a new listener that will be executed only once.\n *\n * @param {Function} fn - Callback function.\n * @param {object} [thisArg] - The context of the callback function.\n * @returns {PIXI.SignalBinding} The SignalBinding node that was added.\n */\n once(fn: CbType, thisArg: any = null): SignalBinding\n {\n if (typeof fn !== 'function')\n {\n throw new Error('MiniSignal#once(): First arg must be a Function.');\n }\n\n return _addSignalBinding(this, new SignalBinding(fn, true, thisArg));\n }\n\n /**\n * Remove binding object.\n *\n * @param {PIXI.SignalBinding} node - The binding node that will be removed.\n * @returns {Signal} The instance on which this method was called.\n * @api public */\n detach(node: SignalBinding): this\n {\n if (!(node instanceof SignalBinding))\n {\n throw new Error('MiniSignal#detach(): First arg must be a SignalBinding object.');\n }\n if (node._owner !== this) return this; // todo: or error?\n\n if (node._prev) node._prev._next = node._next;\n if (node._next) node._next._prev = node._prev;\n\n if (node === this._head)\n { // first node\n this._head = node._next;\n if (node._next === null)\n {\n this._tail = null;\n }\n }\n else if (node === this._tail)\n { // last node\n this._tail = node._prev;\n this._tail._next = null;\n }\n\n node._owner = null;\n\n return this;\n }\n\n /**\n * Detach all listeners.\n *\n * @returns {Signal} The instance on which this method was called.\n */\n detachAll(): this\n {\n let node = this._head;\n\n if (!node) return this;\n\n this._head = this._tail = null;\n\n while (node)\n {\n node._owner = null;\n node = node._next;\n }\n\n return this;\n }\n}\n","/**\n * function from npm package `parseUri`, converted to TS to avoid leftpad incident\n * @param {string} str\n * @param [opts] - options\n * @param {boolean} [opts.strictMode] - type of parser\n */\nexport function parseUri(str: string, opts: { strictMode?: boolean }): any\n{\n opts = opts || {};\n\n const o = {\n // eslint-disable-next-line max-len\n key: ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'],\n q: {\n name: 'queryKey',\n parser: /(?:^|&)([^&=]*)=?([^&]*)/g\n },\n parser: {\n // eslint-disable-next-line max-len\n strict: /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/,\n // eslint-disable-next-line max-len\n loose: /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/\n }\n };\n\n const m = o.parser[opts.strictMode ? 'strict' : 'loose'].exec(str);\n const uri: any = {};\n let i = 14;\n\n while (i--) uri[o.key[i]] = m[i] || '';\n\n uri[o.q.name] = {};\n uri[o.key[12]].replace(o.q.parser, (_t0: any, t1: any, t2: any) =>\n {\n if (t1) uri[o.q.name][t1] = t2;\n });\n\n return uri;\n}\n","import { Dict } from '@pixi/utils';\nimport { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport type { IBaseTextureOptions, Texture } from '@pixi/core';\n\n// tests if CORS is supported in XHR, if not we need to use XDR\nconst useXdr = !!((self as any).XDomainRequest && !('withCredentials' in (new XMLHttpRequest())));\nlet tempAnchor: any = null;\n\n// some status constants\nconst STATUS_NONE = 0;\nconst STATUS_OK = 200;\nconst STATUS_EMPTY = 204;\nconst STATUS_IE_BUG_EMPTY = 1223;\nconst STATUS_TYPE_OK = 2;\n\n// noop\nfunction _noop(): void { /* empty */ }\n\n/**\n * Quick helper to set a value on one of the extension maps. Ensures there is no\n * dot at the start of the extension.\n *\n * @ignore\n * @param map - The map to set on.\n * @param extname - The extension (or key) to set.\n * @param val - The value to set.\n */\nfunction setExtMap(map: Dict, extname: string, val: number)\n{\n if (extname && extname.indexOf('.') === 0)\n {\n extname = extname.substring(1);\n }\n\n if (!extname)\n {\n return;\n }\n\n map[extname] = val;\n}\n\n/**\n * Quick helper to get string xhr type.\n *\n * @ignore\n * @param xhr - The request to check.\n * @return The type.\n */\nfunction reqType(xhr: XMLHttpRequest)\n{\n return xhr.toString().replace('object ', '');\n}\n\n/**\n * Metadata for loader resource. It is very messy way to pass options for loader middlewares\n *\n * Can be extended in `GlobalMixins.IResourceMetadata`\n *\n * @memberof PIXI\n */\nexport interface IResourceMetadata extends GlobalMixins.IResourceMetadata, IBaseTextureOptions\n{\n /**\n * The element to use for loading, instead of creating one.\n */\n loadElement?: HTMLImageElement | HTMLAudioElement | HTMLVideoElement;\n /**\n * Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n */\n skipSource?: boolean;\n /**\n * The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n mimeType?: string | string[];\n\n /**\n * Used by BitmapFonts, Spritesheet and CompressedTextures as the options to used for\n * metadata when loading the child image.\n */\n imageMetadata?: IResourceMetadata;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface LoaderResource extends GlobalMixins.LoaderResource, GlobalMixins.ILoaderResource {}\n\n/**\n * Manages the state and loading of a resource and all child resources.\n *\n * Can be extended in `GlobalMixins.LoaderResource`.\n *\n * @memberof PIXI\n */\nclass LoaderResource\n{\n /**\n * Texture reference for loading images and other textures.\n * @type {PIXI.Texture}\n */\n texture?: Texture;\n\n /**\n * used by parsing middleware\n */\n blob?: Blob;\n\n /**\n * The name of this resource.\n *\n * @readonly\n * @type {string}\n */\n readonly name: string;\n /**\n * The url used to load this resource.\n *\n * @readonly\n * @type {string}\n */\n readonly url: string;\n /**\n * The extension used to load this resource.\n *\n * @readonly\n * @type {string}\n */\n readonly extension: string;\n /**\n * The data that was loaded by the resource.\n */\n data: any;\n /**\n * Is this request cross-origin? If unset, determined automatically.\n */\n crossOrigin: string | boolean;\n /**\n * A timeout in milliseconds for the load. If the load takes longer than this time\n * it is cancelled and the load is considered a failure. If this value is set to `0`\n * then there is no explicit timeout.\n *\n * @type {number}\n */\n timeout: number;\n /**\n * The method of loading to use for this resource.\n *\n * @type {PIXI.LoaderResource.LOAD_TYPE}\n */\n loadType: LoaderResource.LOAD_TYPE;\n /**\n * The type used to load the resource via XHR. If unset, determined automatically.\n *\n * @member {string}\n */\n xhrType: string;\n\n /**\n * Extra info for middleware, and controlling specifics about how the resource loads.\n *\n * Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n * Meaning it will modify it as it sees fit.\n *\n * @type {PIXI.IResourceMetadata}\n */\n metadata: IResourceMetadata;\n /**\n * The error that occurred while loading (if any).\n *\n * @readonly\n * @member {Error}\n */\n error: Error;\n /**\n * The XHR object that was used to load this resource. This is only set\n * when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n *\n * @readonly\n */\n xhr: XMLHttpRequest;\n\n private xdr: any;\n /**\n * The child resources this resource owns.\n *\n * @type {PIXI.LoaderResource[]}\n */\n readonly children: LoaderResource[];\n /**\n * The resource type.\n *\n * @readonly\n * @type {PIXI.LoaderResource.TYPE}\n */\n type: LoaderResource.TYPE;\n /**\n * The progress chunk owned by this resource.\n *\n * @readonly\n * @member {number}\n */\n progressChunk: number;\n /**\n * Dispatched when the resource beings to load.\n *\n * The callback looks like {@link LoaderResource.OnStartSignal}.\n *\n * @type {PIXI.Signal}\n */\n onStart: Signal;\n /**\n * Dispatched each time progress of this resource load updates.\n * Not all resources types and loader systems can support this event\n * so sometimes it may not be available. If the resource\n * is being loaded on a modern browser, using XHR, and the remote server\n * properly sets Content-Length headers, then this will be available.\n *\n * The callback looks like {@link LoaderResource.OnProgressSignal}.\n *\n * @type {PIXI.Signal}\n */\n onProgress: Signal;\n /**\n * Dispatched once this resource has loaded, if there was an error it will\n * be in the `error` property.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n *\n * @type {PIXI.Signal}\n */\n onComplete: Signal;\n /**\n * Dispatched after this resource has had all the *after* middleware run on it.\n *\n * The callback looks like {@link LoaderResource.OnCompleteSignal}.\n *\n * @type {PIXI.Signal}\n */\n onAfterMiddleware: Signal;\n\n /**\n * The state flags of this resource.\n *\n * @private\n * @member {number}\n */\n private _flags: number;\n\n /**\n * The `dequeue` method that will be used a storage place for the async queue dequeue method\n * used privately by the loader.\n *\n * @private\n * @member {function}\n */\n _dequeue: any = _noop;\n\n /**\n * Used a storage place for the on load binding used privately by the loader.\n *\n * @private\n * @member {function}\n */\n _onLoadBinding: any = null;\n\n /**\n * The timer for element loads to check if they timeout.\n *\n * @private\n */\n private _elementTimer = 0;\n\n /**\n * The `complete` function bound to this resource's context.\n *\n * @private\n * @type {function}\n */\n private _boundComplete: any = null;\n\n /**\n * The `_onError` function bound to this resource's context.\n *\n * @private\n * @type {function}\n */\n private _boundOnError: any = null;\n\n /**\n * The `_onProgress` function bound to this resource's context.\n *\n * @private\n * @type {function}\n */\n private _boundOnProgress: any = null;\n\n /**\n * The `_onTimeout` function bound to this resource's context.\n *\n * @private\n * @type {function}\n */\n private _boundOnTimeout: any = null;\n\n private _boundXhrOnError: any = null;\n private _boundXhrOnTimeout: any = null;\n private _boundXhrOnAbort: any = null;\n private _boundXhrOnLoad: any = null;\n\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.LOAD_TYPE} loadType - The load type to set it to.\n */\n static setExtensionLoadType(extname: string, loadType: LoaderResource.LOAD_TYPE): void\n {\n setExtMap(LoaderResource._loadTypeMap, extname, loadType);\n }\n /**\n * Sets the load type to be used for a specific extension.\n *\n * @static\n * @param {string} extname - The extension to set the type for, e.g. \"png\" or \"fnt\"\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} xhrType - The xhr type to set it to.\n */\n static setExtensionXhrType(extname: string, xhrType: LoaderResource.XHR_RESPONSE_TYPE): void\n {\n setExtMap(LoaderResource._xhrTypeMap, extname, xhrType as any);\n }\n\n /**\n * @param {string} name - The name of the resource to load.\n * @param {string|string[]} url - The url for this resource, for audio/video loads you can pass\n * an array of sources.\n * @param {object} [options] - The options for the load.\n * @param {string|boolean} [options.crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @param {number} [options.timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @param {PIXI.LoaderResource.LOAD_TYPE} [options.loadType=LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @param {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [options.xhrType=XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @param {PIXI.LoaderResource.IMetadata} [options.metadata] - Extra configuration for middleware\n * and the Resource object.\n */\n constructor(name: string, url: string | string[], options?: {\n crossOrigin?: string | boolean;\n timeout?: number;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n metadata?: IResourceMetadata;\n })\n {\n if (typeof name !== 'string' || typeof url !== 'string')\n {\n throw new Error('Both name and url are required for constructing a resource.');\n }\n\n options = options || {};\n\n this._flags = 0;\n\n // set data url flag, needs to be set early for some _determineX checks to work.\n this._setFlag(LoaderResource.STATUS_FLAGS.DATA_URL, url.indexOf('data:') === 0);\n\n this.name = name;\n\n this.url = url;\n\n this.extension = this._getExtension();\n\n this.data = null;\n\n this.crossOrigin = options.crossOrigin === true ? 'anonymous' : options.crossOrigin;\n\n this.timeout = options.timeout || 0;\n\n this.loadType = options.loadType || this._determineLoadType();\n\n // The type used to load the resource via XHR. If unset, determined automatically.\n this.xhrType = options.xhrType;\n\n // Extra info for middleware, and controlling specifics about how the resource loads.\n // Note that if you pass in a `loadElement`, the Resource class takes ownership of it.\n // Meaning it will modify it as it sees fit.\n this.metadata = options.metadata || {};\n\n // The error that occurred while loading (if any).\n this.error = null;\n\n // The XHR object that was used to load this resource. This is only set\n // when `loadType` is `LoaderResource.LOAD_TYPE.XHR`.\n this.xhr = null;\n\n // The child resources this resource owns.\n this.children = [];\n\n // The resource type.\n this.type = LoaderResource.TYPE.UNKNOWN;\n\n // The progress chunk owned by this resource.\n this.progressChunk = 0;\n\n // The `dequeue` method that will be used a storage place for the async queue dequeue method\n // used privately by the loader.\n this._dequeue = _noop;\n\n // Used a storage place for the on load binding used privately by the loader.\n this._onLoadBinding = null;\n\n // The timer for element loads to check if they timeout.\n this._elementTimer = 0;\n\n this._boundComplete = this.complete.bind(this);\n this._boundOnError = this._onError.bind(this);\n this._boundOnProgress = this._onProgress.bind(this);\n this._boundOnTimeout = this._onTimeout.bind(this);\n\n // xhr callbacks\n this._boundXhrOnError = this._xhrOnError.bind(this);\n this._boundXhrOnTimeout = this._xhrOnTimeout.bind(this);\n this._boundXhrOnAbort = this._xhrOnAbort.bind(this);\n this._boundXhrOnLoad = this._xhrOnLoad.bind(this);\n\n // Dispatched when the resource beings to load.\n this.onStart = new Signal();\n\n // Dispatched each time progress of this resource load updates.\n // Not all resources types and loader systems can support this event\n // so sometimes it may not be available. If the resource\n // is being loaded on a modern browser, using XHR, and the remote server\n // properly sets Content-Length headers, then this will be available.\n this.onProgress = new Signal();\n\n // Dispatched once this resource has loaded, if there was an error it will\n // be in the `error` property.\n this.onComplete = new Signal();\n\n // Dispatched after this resource has had all the *after* middleware run on it.\n this.onAfterMiddleware = new Signal();\n }\n\n /**\n * When the resource starts to load.\n *\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * When the resource reports loading progress.\n *\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n\n /**\n * When the resource finishes loading.\n *\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n\n /**\n * @memberof PIXI.LoaderResource\n * @typedef {object} IMetadata\n * @property {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [loadElement=null] - The\n * element to use for loading, instead of creating one.\n * @property {boolean} [skipSource=false] - Skips adding source(s) to the load element. This\n * is useful if you want to pass in a `loadElement` that you already added load sources to.\n * @property {string|string[]} [mimeType] - The mime type to use for the source element\n * of a video/audio elment. If the urls are an array, you can pass this as an array as well\n * where each index is the mime type to use for the corresponding url index.\n */\n\n /**\n * Stores whether or not this url is a data url.\n *\n * @readonly\n * @member {boolean}\n */\n get isDataUrl(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.DATA_URL);\n }\n\n /**\n * Describes if this resource has finished loading. Is true when the resource has completely\n * loaded.\n *\n * @readonly\n * @member {boolean}\n */\n get isComplete(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.COMPLETE);\n }\n\n /**\n * Describes if this resource is currently loading. Is true when the resource starts loading,\n * and is false again when complete.\n *\n * @readonly\n * @member {boolean}\n */\n get isLoading(): boolean\n {\n return this._hasFlag(LoaderResource.STATUS_FLAGS.LOADING);\n }\n\n /**\n * Marks the resource as complete.\n *\n */\n complete(): void\n {\n this._clearEvents();\n this._finish();\n }\n\n /**\n * Aborts the loading of this resource, with an optional message.\n *\n * @param {string} message - The message to use for the error\n */\n abort(message: string): void\n {\n // abort can be called multiple times, ignore subsequent calls.\n if (this.error)\n {\n return;\n }\n\n // store error\n this.error = new Error(message);\n\n // clear events before calling aborts\n this._clearEvents();\n\n // abort the actual loading\n if (this.xhr)\n {\n this.xhr.abort();\n }\n else if (this.xdr)\n {\n this.xdr.abort();\n }\n else if (this.data)\n {\n // single source\n if (this.data.src)\n {\n this.data.src = LoaderResource.EMPTY_GIF;\n }\n // multi-source\n else\n {\n while (this.data.firstChild)\n {\n this.data.removeChild(this.data.firstChild);\n }\n }\n }\n\n // done now.\n this._finish();\n }\n\n /**\n * Kicks off loading of this resource. This method is asynchronous.\n *\n * @param {PIXI.LoaderResource.OnCompleteSignal} [cb] - Optional callback to call once the resource is loaded.\n */\n load(cb?: LoaderResource.OnCompleteSignal): void\n {\n if (this.isLoading)\n {\n return;\n }\n\n if (this.isComplete)\n {\n if (cb)\n {\n setTimeout(() => cb(this), 1);\n }\n\n return;\n }\n else if (cb)\n {\n this.onComplete.once(cb);\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, true);\n\n this.onStart.dispatch(this);\n\n // if unset, determine the value\n if (this.crossOrigin === false || typeof this.crossOrigin !== 'string')\n {\n this.crossOrigin = this._determineCrossOrigin(this.url);\n }\n\n switch (this.loadType)\n {\n case LoaderResource.LOAD_TYPE.IMAGE:\n this.type = LoaderResource.TYPE.IMAGE;\n this._loadElement('image');\n break;\n\n case LoaderResource.LOAD_TYPE.AUDIO:\n this.type = LoaderResource.TYPE.AUDIO;\n this._loadSourceElement('audio');\n break;\n\n case LoaderResource.LOAD_TYPE.VIDEO:\n this.type = LoaderResource.TYPE.VIDEO;\n this._loadSourceElement('video');\n break;\n\n case LoaderResource.LOAD_TYPE.XHR:\n /* falls through */\n default:\n if (useXdr && this.crossOrigin)\n {\n this._loadXdr();\n }\n else\n {\n this._loadXhr();\n }\n break;\n }\n }\n\n /**\n * Checks if the flag is set.\n *\n * @param flag - The flag to check.\n * @return True if the flag is set.\n */\n private _hasFlag(flag: number): boolean\n {\n return (this._flags & flag) !== 0;\n }\n\n /**\n * (Un)Sets the flag.\n *\n * @param flag - The flag to (un)set.\n * @param value - Whether to set or (un)set the flag.\n */\n private _setFlag(flag: number, value: boolean): void\n {\n this._flags = value ? (this._flags | flag) : (this._flags & ~flag);\n }\n\n /**\n * Clears all the events from the underlying loading source.\n */\n private _clearEvents(): void\n {\n clearTimeout(this._elementTimer);\n\n if (this.data && this.data.removeEventListener)\n {\n this.data.removeEventListener('error', this._boundOnError, false);\n this.data.removeEventListener('load', this._boundComplete, false);\n this.data.removeEventListener('progress', this._boundOnProgress, false);\n this.data.removeEventListener('canplaythrough', this._boundComplete, false);\n }\n\n if (this.xhr)\n {\n if (this.xhr.removeEventListener)\n {\n this.xhr.removeEventListener('error', this._boundXhrOnError, false);\n this.xhr.removeEventListener('timeout', this._boundXhrOnTimeout, false);\n this.xhr.removeEventListener('abort', this._boundXhrOnAbort, false);\n this.xhr.removeEventListener('progress', this._boundOnProgress, false);\n this.xhr.removeEventListener('load', this._boundXhrOnLoad, false);\n }\n else\n {\n this.xhr.onerror = null;\n this.xhr.ontimeout = null;\n this.xhr.onprogress = null;\n this.xhr.onload = null;\n }\n }\n }\n\n /**\n * Finalizes the load.\n */\n private _finish(): void\n {\n if (this.isComplete)\n {\n throw new Error('Complete called again for an already completed resource.');\n }\n\n this._setFlag(LoaderResource.STATUS_FLAGS.COMPLETE, true);\n this._setFlag(LoaderResource.STATUS_FLAGS.LOADING, false);\n\n this.onComplete.dispatch(this);\n }\n\n /**\n * Loads this resources using an element that has a single source,\n * like an HTMLImageElement.\n * @private\n * @param type - The type of element to use.\n */\n _loadElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'image' && typeof self.Image !== 'undefined')\n {\n this.data = new Image();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n this.data.src = this.url;\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /**\n * Loads this resources using an element that has multiple sources,\n * like an HTMLAudioElement or HTMLVideoElement.\n * @param type - The type of element to use.\n */\n private _loadSourceElement(type: string): void\n {\n if (this.metadata.loadElement)\n {\n this.data = this.metadata.loadElement;\n }\n else if (type === 'audio' && typeof self.Audio !== 'undefined')\n {\n this.data = new Audio();\n }\n else\n {\n this.data = document.createElement(type);\n }\n\n if (this.data === null)\n {\n this.abort(`Unsupported element: ${type}`);\n\n return;\n }\n\n if (this.crossOrigin)\n {\n this.data.crossOrigin = this.crossOrigin;\n }\n\n if (!this.metadata.skipSource)\n {\n // support for CocoonJS Canvas+ runtime, lacks document.createElement('source')\n if ((navigator as any).isCocoonJS)\n {\n this.data.src = Array.isArray(this.url) ? this.url[0] : this.url;\n }\n else if (Array.isArray(this.url))\n {\n const mimeTypes = this.metadata.mimeType;\n\n for (let i = 0; i < this.url.length; ++i)\n {\n this.data.appendChild(\n this._createSource(type, this.url[i], Array.isArray(mimeTypes) ? mimeTypes[i] : mimeTypes)\n );\n }\n }\n else\n {\n const mimeTypes = this.metadata.mimeType;\n\n this.data.appendChild(\n this._createSource(type, this.url, Array.isArray(mimeTypes) ? mimeTypes[0] : mimeTypes)\n );\n }\n }\n\n this.data.addEventListener('error', this._boundOnError, false);\n this.data.addEventListener('load', this._boundComplete, false);\n this.data.addEventListener('progress', this._boundOnProgress, false);\n this.data.addEventListener('canplaythrough', this._boundComplete, false);\n\n this.data.load();\n\n if (this.timeout)\n {\n this._elementTimer = setTimeout(this._boundOnTimeout, this.timeout) as any;\n }\n }\n\n /**\n * Loads this resources using an XMLHttpRequest.\n */\n private _loadXhr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xhr = this.xhr = new XMLHttpRequest();\n\n // set the request type and url\n xhr.open('GET', this.url, true);\n\n xhr.timeout = this.timeout;\n\n // load json as text and parse it ourselves. We do this because some browsers\n // *cough* safari *cough* can't deal with it.\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON\n || this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n xhr.responseType = LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n else\n {\n xhr.responseType = this.xhrType as any;\n }\n\n xhr.addEventListener('error', this._boundXhrOnError, false);\n xhr.addEventListener('timeout', this._boundXhrOnTimeout, false);\n xhr.addEventListener('abort', this._boundXhrOnAbort, false);\n xhr.addEventListener('progress', this._boundOnProgress, false);\n xhr.addEventListener('load', this._boundXhrOnLoad, false);\n\n xhr.send();\n }\n\n /**\n * Loads this resources using an XDomainRequest. This is here because we need to support IE9 (gross).\n */\n private _loadXdr(): void\n {\n // if unset, determine the value\n if (typeof this.xhrType !== 'string')\n {\n this.xhrType = this._determineXhrType();\n }\n\n const xdr = this.xhr = new (self as any).XDomainRequest(); // eslint-disable-line no-undef\n\n // XDomainRequest has a few quirks. Occasionally it will abort requests\n // A way to avoid this is to make sure ALL callbacks are set even if not used\n // More info here: http://stackoverflow.com/questions/15786966/xdomainrequest-aborts-post-on-ie-9\n xdr.timeout = this.timeout || 5000; // XDR needs a timeout value or it breaks in IE9\n\n xdr.onerror = this._boundXhrOnError;\n xdr.ontimeout = this._boundXhrOnTimeout;\n xdr.onprogress = this._boundOnProgress;\n xdr.onload = this._boundXhrOnLoad;\n\n xdr.open('GET', this.url, true);\n\n // Note: The xdr.send() call is wrapped in a timeout to prevent an\n // issue with the interface where some requests are lost if multiple\n // XDomainRequests are being sent at the same time.\n // Some info here: https://github.com/photonstorm/phaser/issues/1248\n setTimeout(() => xdr.send(), 1);\n }\n\n /**\n * Creates a source used in loading via an element.\n * @param type - The element type (video or audio).\n * @param url - The source URL to load from.\n * @param [mime] - The mime type of the video\n * @return The source element.\n */\n private _createSource(type: string, url: string, mime: string): HTMLSourceElement\n {\n if (!mime)\n {\n mime = `${type}/${this._getExtension(url)}`;\n }\n\n const source = document.createElement('source');\n\n source.src = url;\n source.type = mime;\n\n return source;\n }\n\n /**\n * Called if a load errors out.\n *\n * @param event - The error event from the element that emits it.\n */\n private _onError(event: Event): void\n {\n this.abort(`Failed to load element using: ${(event.target as any).nodeName}`);\n }\n\n /**\n * Called if a load progress event fires for an element or xhr/xdr.\n * @param event - Progress event.\n */\n private _onProgress(event: ProgressEvent): void\n {\n if (event && event.lengthComputable)\n {\n this.onProgress.dispatch(this, event.loaded / event.total);\n }\n }\n\n /**\n * Called if a timeout event fires for an element.\n */\n private _onTimeout(): void\n {\n this.abort(`Load timed out.`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n */\n private _xhrOnError(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request failed. Status: ${xhr.status}, text: \"${xhr.statusText}\"`);\n }\n\n /**\n * Called if an error event fires for xhr/xdr.\n */\n private _xhrOnTimeout(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request timed out.`);\n }\n\n /**\n * Called if an abort event fires for xhr/xdr.\n */\n private _xhrOnAbort(): void\n {\n const xhr = this.xhr;\n\n this.abort(`${reqType(xhr)} Request was aborted by the user.`);\n }\n\n /**\n * Called when data successfully loads from an xhr/xdr request.\n */\n private _xhrOnLoad(): void\n {\n const xhr = this.xhr;\n let text = '';\n let status = typeof xhr.status === 'undefined' ? STATUS_OK : xhr.status; // XDR has no `.status`, assume 200.\n\n // responseText is accessible only if responseType is '' or 'text' and on older browsers\n if (xhr.responseType === '' || xhr.responseType === 'text' || typeof xhr.responseType === 'undefined')\n {\n text = xhr.responseText;\n }\n\n // status can be 0 when using the `file://` protocol so we also check if a response is set.\n // If it has a response, we assume 200; otherwise a 0 status code with no contents is an aborted request.\n if (status === STATUS_NONE && (text.length > 0 || xhr.responseType === LoaderResource.XHR_RESPONSE_TYPE.BUFFER))\n {\n status = STATUS_OK;\n }\n // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request\n else if (status === STATUS_IE_BUG_EMPTY)\n {\n status = STATUS_EMPTY;\n }\n\n const statusType = (status / 100) | 0;\n\n if (statusType === STATUS_TYPE_OK)\n {\n // if text, just return it\n if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.TEXT)\n {\n this.data = text;\n this.type = LoaderResource.TYPE.TEXT;\n }\n // if json, parse into json object\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.JSON)\n {\n try\n {\n this.data = JSON.parse(text);\n this.type = LoaderResource.TYPE.JSON;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded json: ${e}`);\n\n return;\n }\n }\n // if xml, parse into an xml document or div element\n else if (this.xhrType === LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT)\n {\n try\n {\n if (self.DOMParser)\n {\n const domparser = new DOMParser();\n\n this.data = domparser.parseFromString(text, 'text/xml');\n }\n else\n {\n const div = document.createElement('div');\n\n div.innerHTML = text;\n\n this.data = div;\n }\n\n this.type = LoaderResource.TYPE.XML;\n }\n catch (e)\n {\n this.abort(`Error trying to parse loaded xml: ${e}`);\n\n return;\n }\n }\n // other types just return the response\n else\n {\n this.data = xhr.response || text;\n }\n }\n else\n {\n this.abort(`[${xhr.status}] ${xhr.statusText}: ${xhr.responseURL}`);\n\n return;\n }\n\n this.complete();\n }\n\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 * @private\n * @param url - The url to test.\n * @param [loc=self.location] - The location object to test against.\n * @return The crossOrigin value to use (or empty string for none).\n */\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n _determineCrossOrigin(url: string, loc?: any): string\n {\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // A sandboxed iframe without the 'allow-same-origin' attribute will have a special\n // origin designed not to match self.location.origin, and will always require\n // crossOrigin requests regardless of whether the location matches.\n if (self.origin !== self.location.origin)\n {\n return 'anonymous';\n }\n\n // default is self.location\n loc = loc || self.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\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;\n const parsedUrl = parseUri(tempAnchor.href, { strictMode: true });\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n const protocol = parsedUrl.protocol ? `${parsedUrl.protocol}:` : '';\n\n // if cross origin\n if (parsedUrl.host !== loc.hostname || !samePort || protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n }\n\n /**\n * Determines the responseType of an XHR request based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {PIXI.LoaderResource.XHR_RESPONSE_TYPE} The responseType to use.\n */\n private _determineXhrType(): LoaderResource.XHR_RESPONSE_TYPE\n {\n return LoaderResource._xhrTypeMap[this.extension] || LoaderResource.XHR_RESPONSE_TYPE.TEXT;\n }\n\n /**\n * Determines the loadType of a resource based on the extension of the\n * resource being loaded.\n *\n * @private\n * @return {PIXI.LoaderResource.LOAD_TYPE} The loadType to use.\n */\n private _determineLoadType(): LoaderResource.LOAD_TYPE\n {\n return LoaderResource._loadTypeMap[this.extension] || LoaderResource.LOAD_TYPE.XHR;\n }\n\n /**\n * Extracts the extension (sans '.') of the file being loaded by the resource.\n *\n * @param [url] - url to parse, `this.url` by default.\n * @return The extension.\n */\n private _getExtension(url = this.url): string\n {\n let ext = '';\n\n if (this.isDataUrl)\n {\n const slashIndex = url.indexOf('/');\n\n ext = url.substring(slashIndex + 1, url.indexOf(';', slashIndex));\n }\n else\n {\n const queryStart = url.indexOf('?');\n const hashStart = url.indexOf('#');\n const index = Math.min(\n queryStart > -1 ? queryStart : url.length,\n hashStart > -1 ? hashStart : url.length\n );\n\n url = url.substring(0, index);\n ext = url.substring(url.lastIndexOf('.') + 1);\n }\n\n return ext.toLowerCase();\n }\n\n /**\n * Determines the mime type of an XHR request based on the responseType of\n * resource being loaded.\n *\n * @param type - The type to get a mime type for.\n * @private\n * @return The mime type to use.\n */\n _getMimeFromXhrType(type: LoaderResource.XHR_RESPONSE_TYPE): string\n {\n switch (type)\n {\n case LoaderResource.XHR_RESPONSE_TYPE.BUFFER:\n return 'application/octet-binary';\n\n case LoaderResource.XHR_RESPONSE_TYPE.BLOB:\n return 'application/blob';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT:\n return 'application/xml';\n\n case LoaderResource.XHR_RESPONSE_TYPE.JSON:\n return 'application/json';\n\n case LoaderResource.XHR_RESPONSE_TYPE.DEFAULT:\n case LoaderResource.XHR_RESPONSE_TYPE.TEXT:\n /* falls through */\n default:\n return 'text/plain';\n }\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace LoaderResource {\n /**\n * When the resource starts to load.\n *\n * @memberof PIXI.LoaderResource\n * @callback OnStartSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n export type OnStartSignal = (resource: LoaderResource) => void;\n /**\n * When the resource reports loading progress.\n *\n * @memberof PIXI.LoaderResource\n * @callback OnProgressSignal\n * @param {Resource} resource - The resource that the event happened on.\n * @param {number} percentage - The progress of the load in the range [0, 1].\n */\n export type OnProgressSignal = (resource: LoaderResource, percentage: number) => void;\n /**\n * When the resource finishes loading.\n *\n * @memberof PIXI.LoaderResource\n * @callback OnCompleteSignal\n * @param {Resource} resource - The resource that the event happened on.\n */\n export type OnCompleteSignal = (resource: LoaderResource) => void;\n\n /**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum STATUS_FLAGS {\n /** None */\n NONE= 0,\n /** Data URL */\n DATA_URL= (1 << 0),\n /** Complete */\n COMPLETE= (1 << 1),\n /** Loading */\n LOADING= (1 << 2),\n }\n\n /**\n * The types of resources a resource could represent.\n *\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum TYPE {\n /** Unknown */\n UNKNOWN= 0,\n /** JSON */\n JSON= 1,\n /** XML */\n XML= 2,\n /** Image */\n IMAGE= 3,\n /** Audio */\n AUDIO= 4,\n /** Video */\n VIDEO= 5,\n /** Plain text */\n TEXT= 6,\n }\n\n /**\n * The types of loading a resource can use.\n *\n * @static\n * @readonly\n * @enum {number}\n * @memberof PIXI.LoaderResource\n */\n export enum LOAD_TYPE {\n /** Uses XMLHttpRequest to load the resource. */\n XHR = 1,\n /** Uses an `Image` object to load the resource. */\n IMAGE = 2,\n /** Uses an `Audio` object to load the resource. */\n AUDIO = 3,\n /** Uses a `Video` object to load the resource. */\n VIDEO = 4,\n }\n\n /**\n * The XHR ready states, used internally.\n *\n * @static\n * @readonly\n * @enum {string}\n * @memberof PIXI.LoaderResource\n */\n export enum XHR_RESPONSE_TYPE {\n /** string */\n DEFAULT = 'text',\n /** ArrayBuffer */\n BUFFER = 'arraybuffer',\n /** Blob */\n BLOB = 'blob',\n /** Document */\n DOCUMENT = 'document',\n /** Object */\n JSON = 'json',\n /** String */\n TEXT = 'text',\n }\n\n export const _loadTypeMap: Dict = {\n // images\n gif: LoaderResource.LOAD_TYPE.IMAGE,\n png: LoaderResource.LOAD_TYPE.IMAGE,\n bmp: LoaderResource.LOAD_TYPE.IMAGE,\n jpg: LoaderResource.LOAD_TYPE.IMAGE,\n jpeg: LoaderResource.LOAD_TYPE.IMAGE,\n tif: LoaderResource.LOAD_TYPE.IMAGE,\n tiff: LoaderResource.LOAD_TYPE.IMAGE,\n webp: LoaderResource.LOAD_TYPE.IMAGE,\n tga: LoaderResource.LOAD_TYPE.IMAGE,\n svg: LoaderResource.LOAD_TYPE.IMAGE,\n 'svg+xml': LoaderResource.LOAD_TYPE.IMAGE, // for SVG data urls\n\n // audio\n mp3: LoaderResource.LOAD_TYPE.AUDIO,\n ogg: LoaderResource.LOAD_TYPE.AUDIO,\n wav: LoaderResource.LOAD_TYPE.AUDIO,\n\n // videos\n mp4: LoaderResource.LOAD_TYPE.VIDEO,\n webm: LoaderResource.LOAD_TYPE.VIDEO,\n };\n\n export const _xhrTypeMap: Dict = {\n // xml\n xhtml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n html: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n htm: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n xml: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n tmx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n svg: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // This was added to handle Tiled Tileset XML, but .tsx is also a TypeScript React Component.\n // Since it is way less likely for people to be loading TypeScript files instead of Tiled files,\n // this should probably be fine.\n tsx: LoaderResource.XHR_RESPONSE_TYPE.DOCUMENT,\n\n // images\n gif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n png: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n bmp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n jpeg: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tif: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tiff: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n webp: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n tga: LoaderResource.XHR_RESPONSE_TYPE.BLOB,\n\n // json\n json: LoaderResource.XHR_RESPONSE_TYPE.JSON,\n\n // text\n text: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n txt: LoaderResource.XHR_RESPONSE_TYPE.TEXT,\n\n // fonts\n ttf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n otf: LoaderResource.XHR_RESPONSE_TYPE.BUFFER,\n };\n\n // We can't set the `src` attribute to empty string, so on abort we set it to this 1px transparent gif\n export const EMPTY_GIF = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';\n}\n\nexport { LoaderResource };\n\n/** @deprecated - Use LoaderResource instead */\nexport type ILoaderResource = LoaderResource;\n","/**\n * Smaller version of the async library constructs.\n * @ignore\n */\nfunction _noop(): void\n{ /* empty */\n}\n\n/**\n * Ensures a function is only called once.\n * @ignore\n * @param {function} fn - The function to wrap.\n * @return {function} The wrapping function.\n */\nfunction onlyOnce(fn: () => void): () => void\n{\n return function onceWrapper(this: any, ...args: any)\n {\n if (fn === null)\n {\n throw new Error('Callback was already called.');\n }\n\n const callFn = fn;\n\n fn = null;\n callFn.apply(this, args);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IQueue {\n\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueueItem\n{\n data: TaskData;\n callback: (...args: any[]) => void;\n\n /**\n * @private\n */\n constructor(data: TaskData, callback: (...args: any[]) => void)\n {\n this.data = data;\n this.callback = callback;\n }\n}\n\n/**\n * @private\n * @memberof PIXI\n */\nexport class AsyncQueue\n{\n workers = 0;\n\n concurrency: number;\n buffer: number;\n\n saturated: () => void = _noop;\n unsaturated: () => void = _noop;\n empty: () => void = _noop;\n drain: () => void = _noop;\n error: (err: Error, task: TaskData) => void = _noop;\n\n started = false;\n paused = false;\n\n private _worker: (x: TaskData, next: () => void) => void;\n _tasks: Array> = [];\n\n /**\n * @private\n */\n constructor(worker: (x: TaskData, next: () => void) => void, concurrency = 1)\n {\n this._worker = worker;\n\n if (concurrency === 0)\n {\n throw new Error('Concurrency must not be zero');\n }\n\n this.concurrency = concurrency;\n this.buffer = concurrency / 4.0;\n }\n\n private _insert = (data: any, insertAtFront: boolean, callback?: () => void) =>\n {\n if (callback && typeof callback !== 'function')\n {\n throw new Error('task callback must be a function');\n }\n\n this.started = true;\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (data == null && this.idle())\n {\n // call drain immediately if there are no tasks\n setTimeout(() => this.drain(), 1);\n\n return;\n }\n\n const item = new AsyncQueueItem(\n data,\n typeof callback === 'function' ? callback : _noop\n );\n\n if (insertAtFront)\n {\n this._tasks.unshift(item);\n }\n else\n {\n this._tasks.push(item);\n }\n\n setTimeout(this.process, 1);\n };\n\n process = (): void =>\n {\n while (!this.paused && this.workers < this.concurrency && this._tasks.length)\n {\n const task = this._tasks.shift();\n\n if (this._tasks.length === 0)\n {\n this.empty();\n }\n\n this.workers += 1;\n\n if (this.workers === this.concurrency)\n {\n this.saturated();\n }\n\n this._worker(task.data, onlyOnce(this._next(task)));\n }\n };\n\n /**\n * @private\n */\n _next(task: AsyncQueueItem): (...args: any) => void\n {\n return (...args: any) =>\n {\n this.workers -= 1;\n\n task.callback(...args);\n\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (args[0] != null)\n {\n this.error(args[0], task.data);\n }\n\n if (this.workers <= (this.concurrency - this.buffer))\n {\n this.unsaturated();\n }\n\n if (this.idle())\n {\n this.drain();\n }\n\n this.process();\n };\n }\n\n // That was in object\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n push(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, false, callback);\n }\n\n kill(): void\n {\n this.workers = 0;\n this.drain = _noop;\n this.started = false;\n this._tasks = [];\n }\n\n // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\n unshift(data: any, callback?: (...args: any[]) => void): void\n {\n this._insert(data, true, callback);\n }\n\n length(): number\n {\n return this._tasks.length;\n }\n\n running(): number\n {\n return this.workers;\n }\n\n idle(): boolean\n {\n return this._tasks.length + this.workers === 0;\n }\n\n pause(): void\n {\n if (this.paused === true)\n {\n return;\n }\n\n this.paused = true;\n }\n\n resume(): void\n {\n if (this.paused === false)\n {\n return;\n }\n\n this.paused = false;\n\n // Need to call this.process once per concurrent\n // worker to preserve full concurrency after pause\n for (let w = 1; w <= this.concurrency; w++)\n {\n this.process();\n }\n }\n\n /**\n * Iterates an array in series.\n *\n * @param {Array.<*>} array - Array to iterate.\n * @param {function} iterator - Function to call for each element.\n * @param {function} callback - Function to call when done, or on error.\n * @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.\n */\n static eachSeries(array: Array, iterator: (x: any, next: (err?: any) => void) => void,\n callback?: (err?: any) => void, deferNext?: boolean): void\n {\n let i = 0;\n const len = array.length;\n\n function next(err?: any)\n {\n if (err || i === len)\n {\n if (callback)\n {\n callback(err);\n }\n\n return;\n }\n\n if (deferNext)\n {\n setTimeout(() =>\n {\n iterator(array[i++], next);\n }, 1);\n }\n else\n {\n iterator(array[i++], next);\n }\n }\n\n next();\n }\n\n /**\n * Async queue implementation,\n *\n * @param {function} worker - The worker function to call for each task.\n * @param {number} concurrency - How many workers to run in parrallel.\n * @return {*} The async queue object.\n */\n static queue(worker: (x: any, next: (...args: any) => void) => void, concurrency?: number): AsyncQueue\n {\n return new AsyncQueue(worker, concurrency);\n }\n}\n","import { Signal } from './base/Signal';\nimport { parseUri } from './base/parseUri';\nimport { IResourceMetadata, LoaderResource } from './LoaderResource';\nimport { AsyncQueue } from './base/AsyncQueue';\nimport { Dict } from '@pixi/utils';\n\n// some constants\nconst MAX_PROGRESS = 100;\nconst rgxExtractUrlHash = /(#[\\w-]+)?$/;\n\nexport type ILoaderMiddleware = (resource: LoaderResource, next: (...args: any[]) => void) => void;\n\nexport interface ILoaderAdd {\n (this: Loader, name: string, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, name: string, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, url: string, options?: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): Loader;\n (this: Loader, resources: (IAddOptions | string)[], callback?: LoaderResource.OnCompleteSignal): Loader;\n}\n\n/**\n * Options for a call to `.add()`.\n *\n * @see Loader#add\n *\n * @typedef {object} IAddOptions\n * @property {string} [name] - The name of the resource to load, if not passed the url is used.\n * @property {string} [key] - Alias for `name`.\n * @property {string} [url] - The url for this resource, relative to the baseUrl of this loader.\n * @property {string|boolean} [crossOrigin] - Is this request cross-origin? Default is to\n * determine automatically.\n * @property {number} [timeout=0] - A timeout in milliseconds for the load. If the load takes\n * longer than this time it is cancelled and the load is considered a failure. If this value is\n * set to `0` then there is no explicit timeout.\n * @property {PIXI.LoaderResource.LOAD_TYPE} [loadType=LoaderResource.LOAD_TYPE.XHR] - How should this resource\n * be loaded?\n * @property {PIXI.LoaderResource.XHR_RESPONSE_TYPE} [xhrType=LoaderResource.XHR_RESPONSE_TYPE.DEFAULT] - How\n * should the data being loaded be interpreted when using XHR?\n * @property {PIXI.LoaderResource.OnCompleteSignal} [onComplete] - Callback to add an an onComplete signal istener.\n * @property {PIXI.LoaderResource.OnCompleteSignal} [callback] - Alias for `onComplete`.\n * @property {PIXI.LoaderResource.IMetadata} [metadata] - Extra configuration for middleware and the Resource object.\n */\nexport interface IAddOptions {\n name?: string;\n key?: string;\n url?: string;\n crossOrigin?: string | boolean;\n timeout?: number;\n parentResource?: LoaderResource;\n loadType?: LoaderResource.LOAD_TYPE;\n xhrType?: LoaderResource.XHR_RESPONSE_TYPE;\n onComplete?: LoaderResource.OnCompleteSignal;\n callback?: LoaderResource.OnCompleteSignal;\n metadata?: IResourceMetadata;\n}\n\n/**\n * The new loader, forked from Resource Loader by Chad Engler: https://github.com/englercj/resource-loader\n *\n * ```js\n * const loader = PIXI.Loader.shared; // PixiJS exposes a premade instance for you to use.\n * //or\n * const loader = new PIXI.Loader(); // you can also create your own if you want\n *\n * const sprites = {};\n *\n * // Chainable `add` to enqueue a resource\n * loader.add('bunny', 'data/bunny.png')\n * .add('spaceship', 'assets/spritesheet.json');\n * loader.add('scoreFont', 'assets/score.fnt');\n *\n * // Chainable `pre` to add a middleware that runs for each resource, *before* loading that resource.\n * // This is useful to implement custom caching modules (using filesystem, indexeddb, memory, etc).\n * loader.pre(cachingMiddleware);\n *\n * // Chainable `use` to add a middleware that runs for each resource, *after* loading that resource.\n * // This is useful to implement custom parsing modules (like spritesheet parsers, spine parser, etc).\n * loader.use(parsingMiddleware);\n *\n * // The `load` method loads the queue of resources, and calls the passed in callback called once all\n * // resources have loaded.\n * loader.load((loader, resources) => {\n * // resources is an object where the key is the name of the resource loaded and the value is the resource object.\n * // They have a couple default properties:\n * // - `url`: The URL that the resource was loaded from\n * // - `error`: The error that happened when trying to load (if any)\n * // - `data`: The raw data that was loaded\n * // also may contain other properties based on the middleware that runs.\n * sprites.bunny = new PIXI.TilingSprite(resources.bunny.texture);\n * sprites.spaceship = new PIXI.TilingSprite(resources.spaceship.texture);\n * sprites.scoreFont = new PIXI.TilingSprite(resources.scoreFont.texture);\n * });\n *\n * // throughout the process multiple signals can be dispatched.\n * loader.onProgress.add(() => {}); // called once per loaded/errored file\n * loader.onError.add(() => {}); // called once per errored file\n * loader.onLoad.add(() => {}); // called once per loaded file\n * loader.onComplete.add(() => {}); // called once when the queued resources all load.\n * ```\n *\n * @class Loader\n * @memberof PIXI\n */\nclass Loader\n{\n /**\n * The base url for all resources loaded by this loader.\n *\n * @member {string}\n */\n baseUrl: string;\n\n /**\n * The progress percent of the loader going through the queue.\n *\n * @member {number}\n * @default 0\n */\n progress: number;\n\n /**\n * Loading state of the loader, true if it is currently loading resources.\n *\n * @member {boolean}\n * @default false\n */\n loading: boolean;\n\n /**\n * A querystring to append to every URL added to the loader.\n *\n * This should be a valid query string *without* the question-mark (`?`). The loader will\n * also *not* escape values for you. Make sure to escape your parameters with\n * [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.\n *\n * @example\n * const loader = new Loader();\n *\n * loader.defaultQueryString = 'user=me&password=secret';\n *\n * // This will request 'image.png?user=me&password=secret'\n * loader.add('image.png').load();\n *\n * loader.reset();\n *\n * // This will request 'image.png?v=1&user=me&password=secret'\n * loader.add('iamge.png?v=1').load();\n *\n * @member {string}\n * @default ''\n */\n defaultQueryString: string;\n\n /**\n * The middleware to run before loading each resource.\n */\n private _beforeMiddleware: Array = [];\n\n /**\n * The middleware to run after loading each resource.\n */\n private _afterMiddleware: Array = [];\n\n /**\n * The tracks the resources we are currently completing parsing for.\n */\n private _resourcesParsing: Array = [];\n\n /**\n * The `_loadResource` function bound with this object context.\n *\n * @private\n * @member {function}\n * @param {PIXI.LoaderResource} r - The resource to load\n * @param {Function} d - The dequeue function\n * @return {undefined}\n */\n _boundLoadResource = (r: LoaderResource, d: () => void): void => this._loadResource(r, d);\n\n /**\n * The resources waiting to be loaded.\n * @private\n */\n _queue: AsyncQueue;\n\n /**\n * All the resources for this loader keyed by name.\n *\n * @member {object}\n */\n resources: Dict = {};\n\n /**\n * Dispatched once per loaded or errored resource.\n *\n * @member {PIXI.Signal}\n */\n onProgress: Signal;\n\n /**\n * Dispatched once per errored resource.\n *\n * @member {PIXI.Signal}\n */\n onError: Signal;\n\n /**\n * Dispatched once per loaded resource.\n *\n * @member {PIXI.Signal}\n */\n onLoad: Signal;\n\n /**\n * Dispatched when the loader begins to process the queue.\n *\n * @member {PIXI.Signal}\n */\n onStart: Signal;\n\n /**\n * Dispatched when the queued resources all load.\n *\n * @member {PIXI.Signal}\n */\n onComplete: Signal;\n\n /**\n * @param baseUrl - The base url for all resources loaded by this loader.\n * @param concurrency - The number of resources to load concurrently.\n */\n constructor(baseUrl = '', concurrency = 10)\n {\n this.baseUrl = baseUrl;\n this.progress = 0;\n this.loading = false;\n this.defaultQueryString = '';\n this._beforeMiddleware = [];\n this._afterMiddleware = [];\n this._resourcesParsing = [];\n this._boundLoadResource = (r, d) => this._loadResource(r, d);\n this._queue = AsyncQueue.queue(this._boundLoadResource, concurrency);\n this._queue.pause();\n this.resources = {};\n this.onProgress = new Signal();\n this.onError = new Signal();\n this.onLoad = new Signal();\n this.onStart = new Signal();\n this.onComplete = new Signal();\n\n for (let i = 0; i < Loader._plugins.length; ++i)\n {\n const plugin = Loader._plugins[i];\n const { pre, use } = plugin;\n\n if (pre)\n {\n this.pre(pre);\n }\n\n if (use)\n {\n this.use(use);\n }\n }\n\n this._protected = false;\n }\n\n /* eslint-disable require-jsdoc,valid-jsdoc */\n /**\n * Adds a resource (or multiple resources) to the loader queue.\n *\n * This function can take a wide variety of different parameters. The only thing that is always\n * required the url to load. All the following will work:\n *\n * ```js\n * loader\n * // normal param syntax\n * .add('key', 'http://...', function () {})\n * .add('http://...', function () {})\n * .add('http://...')\n *\n * // object syntax\n * .add({\n * name: 'key2',\n * url: 'http://...'\n * }, function () {})\n * .add({\n * url: 'http://...'\n * }, function () {})\n * .add({\n * name: 'key3',\n * url: 'http://...'\n * onComplete: function () {}\n * })\n * .add({\n * url: 'https://...',\n * onComplete: function () {},\n * crossOrigin: true\n * })\n *\n * // you can also pass an array of objects or urls or both\n * .add([\n * { name: 'key4', url: 'http://...', onComplete: function () {} },\n * { url: 'http://...', onComplete: function () {} },\n * 'http://...'\n * ])\n *\n * // and you can use both params and options\n * .add('key', 'http://...', { crossOrigin: true }, function () {})\n * .add('http://...', { crossOrigin: true }, function () {});\n * ```\n */\n add: ILoaderAdd;\n\n /**\n * Same as add, params have strict order\n * @private\n * @param name - The name of the resource to load.\n * @param url - The url for this resource, relative to the baseUrl of this loader.\n * @param options - The options for the load.\n * @param callback - Function to call when this specific resource completes loading.\n * @return {this} Returns itself.\n */\n protected _add(name: string, url: string, options: IAddOptions, callback?: LoaderResource.OnCompleteSignal): this\n {\n // if loading already you can only add resources that have a parent.\n if (this.loading && (!options || !options.parentResource))\n {\n throw new Error('Cannot add resources while the loader is running.');\n }\n\n // check if resource already exists.\n if (this.resources[name])\n {\n throw new Error(`Resource named \"${name}\" already exists.`);\n }\n\n // add base url if this isn't an absolute url\n url = this._prepareUrl(url);\n\n // create the store the resource\n this.resources[name] = new LoaderResource(name, url, options);\n\n if (typeof callback === 'function')\n {\n this.resources[name].onAfterMiddleware.once(callback);\n }\n\n // if actively loading, make sure to adjust progress chunks for that parent and its children\n if (this.loading)\n {\n const parent = options.parentResource;\n const incompleteChildren = [];\n\n for (let i = 0; i < parent.children.length; ++i)\n {\n if (!parent.children[i].isComplete)\n {\n incompleteChildren.push(parent.children[i]);\n }\n }\n\n const fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent\n const eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child\n\n parent.children.push(this.resources[name]);\n parent.progressChunk = eachChunk;\n\n for (let i = 0; i < incompleteChildren.length; ++i)\n {\n incompleteChildren[i].progressChunk = eachChunk;\n }\n\n this.resources[name].progressChunk = eachChunk;\n }\n\n // add the resource to the queue\n this._queue.push(this.resources[name]);\n\n return this;\n }\n\n /* eslint-enable require-jsdoc,valid-jsdoc */\n\n /**\n * Sets up a middleware function that will run *before* the\n * resource is loaded.\n *\n * @param fn - The middleware function to register.\n * @return Returns itself.\n */\n pre(fn: ILoaderMiddleware): this\n {\n this._beforeMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Sets up a middleware function that will run *after* the\n * resource is loaded.\n *\n * @param fn - The middleware function to register.\n * @return Returns itself.\n */\n use(fn: ILoaderMiddleware): this\n {\n this._afterMiddleware.push(fn);\n\n return this;\n }\n\n /**\n * Resets the queue of the loader to prepare for a new load.\n *\n * @return Returns itself.\n */\n reset(): this\n {\n this.progress = 0;\n this.loading = false;\n\n this._queue.kill();\n this._queue.pause();\n\n // abort all resource loads\n for (const k in this.resources)\n {\n const res = this.resources[k];\n\n if (res._onLoadBinding)\n {\n res._onLoadBinding.detach();\n }\n\n if (res.isLoading)\n {\n res.abort('loader reset');\n }\n }\n\n this.resources = {};\n\n return this;\n }\n\n /**\n * Starts loading the queued resources.\n * @param [cb] - Optional callback that will be bound to the `complete` event.\n * @return Returns itself.\n */\n load(cb?: Loader.OnCompleteSignal): this\n {\n // register complete callback if they pass one\n if (typeof cb === 'function')\n {\n this.onComplete.once(cb);\n }\n\n // if the queue has already started we are done here\n if (this.loading)\n {\n return this;\n }\n\n if (this._queue.idle())\n {\n this._onStart();\n this._onComplete();\n }\n else\n {\n // distribute progress chunks\n const numTasks = this._queue._tasks.length;\n const chunk = MAX_PROGRESS / numTasks;\n\n for (let i = 0; i < this._queue._tasks.length; ++i)\n {\n this._queue._tasks[i].data.progressChunk = chunk;\n }\n\n // notify we are starting\n this._onStart();\n\n // start loading\n this._queue.resume();\n }\n\n return this;\n }\n\n /**\n * The number of resources to load concurrently.\n *\n * @member {number}\n * @default 10\n */\n get concurrency(): number\n {\n return this._queue.concurrency;\n }\n // eslint-disable-next-line require-jsdoc\n set concurrency(concurrency: number)\n {\n this._queue.concurrency = concurrency;\n }\n\n /**\n * Prepares a url for usage based on the configuration of this object\n * @param url - The url to prepare.\n * @return The prepared url.\n */\n private _prepareUrl(url: string): string\n {\n const parsedUrl = parseUri(url, { strictMode: true });\n let result;\n\n // absolute url, just use it as is.\n if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0)\n {\n result = url;\n }\n // if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween\n else if (this.baseUrl.length\n && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1\n && url.charAt(0) !== '/'\n )\n {\n result = `${this.baseUrl}/${url}`;\n }\n else\n {\n result = this.baseUrl + url;\n }\n\n // if we need to add a default querystring, there is a bit more work\n if (this.defaultQueryString)\n {\n const hash = rgxExtractUrlHash.exec(result)[0];\n\n result = result.substr(0, result.length - hash.length);\n\n if (result.indexOf('?') !== -1)\n {\n result += `&${this.defaultQueryString}`;\n }\n else\n {\n result += `?${this.defaultQueryString}`;\n }\n\n result += hash;\n }\n\n return result;\n }\n\n /**\n * Loads a single resource.\n *\n * @private\n * @param {PIXI.LoaderResource} resource - The resource to load.\n * @param {function} dequeue - The function to call when we need to dequeue this item.\n */\n _loadResource(resource: LoaderResource, dequeue: () => void): void\n {\n resource._dequeue = dequeue;\n\n // run before middleware\n AsyncQueue.eachSeries(\n this._beforeMiddleware,\n (fn: any, next: (...args: any) => void) =>\n {\n fn.call(this, resource, () =>\n {\n // if the before middleware marks the resource as complete,\n // break and don't process any more before middleware\n next(resource.isComplete ? {} : null);\n });\n },\n () =>\n {\n if (resource.isComplete)\n {\n this._onLoad(resource);\n }\n else\n {\n resource._onLoadBinding = resource.onComplete.once(this._onLoad, this);\n resource.load();\n }\n },\n true\n );\n }\n\n /**\n * Called once loading has started.\n */\n private _onStart(): void\n {\n this.progress = 0;\n this.loading = true;\n this.onStart.dispatch(this);\n }\n\n /**\n * Called once each resource has loaded.\n */\n private _onComplete(): void\n {\n this.progress = MAX_PROGRESS;\n this.loading = false;\n this.onComplete.dispatch(this, this.resources);\n }\n\n /**\n * Called each time a resources is loaded.\n * @param resource - The resource that was loaded\n */\n private _onLoad(resource: LoaderResource): void\n {\n resource._onLoadBinding = null;\n\n // remove this resource from the async queue, and add it to our list of resources that are being parsed\n this._resourcesParsing.push(resource);\n resource._dequeue();\n\n // run all the after middleware for this resource\n AsyncQueue.eachSeries(\n this._afterMiddleware,\n (fn: any, next: any) =>\n {\n fn.call(this, resource, next);\n },\n () =>\n {\n resource.onAfterMiddleware.dispatch(resource);\n\n this.progress = Math.min(MAX_PROGRESS, this.progress + resource.progressChunk);\n this.onProgress.dispatch(this, resource);\n\n if (resource.error)\n {\n this.onError.dispatch(resource.error, this, resource);\n }\n else\n {\n this.onLoad.dispatch(this, resource);\n }\n\n this._resourcesParsing.splice(this._resourcesParsing.indexOf(resource), 1);\n\n // do completion check\n if (this._queue.idle() && this._resourcesParsing.length === 0)\n {\n this._onComplete();\n }\n },\n true\n );\n }\n\n private static _plugins: Array = [];\n private static _shared: Loader;\n /**\n * If this loader cannot be destroyed.\n * @default false\n */\n private _protected: boolean;\n\n /**\n * Destroy the loader, removes references.\n */\n public destroy(): void\n {\n if (!this._protected)\n {\n this.reset();\n }\n }\n\n /**\n * A premade instance of the loader that can be used to load resources.\n */\n public static get shared(): Loader\n {\n let shared = Loader._shared;\n\n if (!shared)\n {\n shared = new Loader();\n shared._protected = true;\n Loader._shared = shared;\n }\n\n return shared;\n }\n\n /**\n * Adds a Loader plugin for the global shared loader and all\n * new Loader instances created.\n *\n * @param plugin - The plugin to add\n * @return Reference to PIXI.Loader for chaining\n */\n public static registerPlugin(plugin: ILoaderPlugin): typeof Loader\n {\n Loader._plugins.push(plugin);\n\n if (plugin.add)\n {\n plugin.add();\n }\n\n return Loader;\n }\n}\n\nLoader.prototype.add = function add(this: Loader, name: any, url?: any, options?: any, callback?: any): Loader\n{\n // special case of an array of objects or urls\n if (Array.isArray(name))\n {\n for (let i = 0; i < name.length; ++i)\n {\n this.add((name as any)[i]);\n }\n\n return this;\n }\n\n // if an object is passed instead of params\n if (typeof name === 'object')\n {\n options = name;\n callback = (url as any) || options.callback || options.onComplete;\n url = options.url;\n name = options.name || options.key || options.url;\n }\n\n // case where no name is passed shift all args over by one.\n if (typeof url !== 'string')\n {\n callback = options as any;\n options = url;\n url = name;\n }\n\n // now that we shifted make sure we have a proper url.\n if (typeof url !== 'string')\n {\n throw new Error('No url passed to add resource to loader.');\n }\n\n // options are optional so people might pass a function and no options\n if (typeof options === 'function')\n {\n callback = options;\n options = null;\n }\n\n return this._add(name, url, options, callback);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nnamespace Loader\n{\n /**\n * When the resource starts to load.\n * @param resource - The resource that the event happened on.\n */\n export type OnStartSignal = (loader: Loader) => void;\n /**\n * When the progress changes the loader and resource are dispatched.\n * @param loader - The loader the progress is advancing on.\n * @param resource - The resource that has completed or failed to cause the progress to advance.\n */\n export type OnProgressSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When a load completes without error the loader and resource are dispatched.\n * @param loader - The loader that has started loading resources.\n * @param resource - The resource that has completed.\n */\n export type OnLoadSignal = (loader: Loader, resource: LoaderResource) => void;\n /**\n * When the loader starts loading resources it dispatches this callback.\n * @param loader - The loader that has started loading resources.\n */\n export type OnCompleteSignal = (loader: Loader, resources: Dict) => void;\n /**\n * When an error occurs the loader and resource are dispatched.\n * @param loader - The loader the error happened in.\n * @param resource - The resource that caused the error.\n */\n export type OnErrorSignal = (error: Error, loader: Loader, resource: LoaderResource) => void;\n}\n\nexport { Loader };\n\n/**\n * Plugin to be installed for handling specific Loader resources.\n *\n * @property [add] - Function to call immediate after registering plugin.\n * @property [pre] - Middleware function to run before load, the\n * arguments for this are `(resource, next)`\n * @property [use] - Middleware function to run after load, the\n * arguments for this are `(resource, next)`\n */\nexport interface ILoaderPlugin {\n /**\n * Function to call immediate after registering plugin.\n */\n add?(): void;\n\n /**\n * Middleware function to run before load\n * @param resource - resource\n * @param next - next middleware\n */\n pre?(resource: LoaderResource, next: (...args: any[]) => void): void;\n\n /**\n * Middleware function to run after load\n * @param resource - resource\n * @param next - next middleware\n */\n use?(resource: LoaderResource, next: (...args: any[]) => void): void;\n}\n","import { Loader } from './Loader';\n\n/**\n * Application plugin for supporting loader option. Installing the LoaderPlugin\n * is not necessary if using **pixi.js** or **pixi.js-legacy**.\n * @example\n * import {AppLoaderPlugin} from '@pixi/loaders';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(AppLoaderPlugin);\n * @class\n * @memberof PIXI\n */\nexport class AppLoaderPlugin\n{\n public static loader: Loader;\n\n /**\n * Called on application constructor\n * @param {object} options\n * @private\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n options = Object.assign({\n sharedLoader: false,\n }, options);\n\n /**\n * Loader instance to help with asset loading.\n * @memberof PIXI.Application#\n * @type {PIXI.Loader}\n * @readonly\n */\n this.loader = options.sharedLoader ? Loader.shared : new Loader();\n }\n\n /**\n * Called when application destroyed\n *\n * @private\n */\n static destroy(): void\n {\n if (this.loader)\n {\n this.loader.destroy();\n this.loader = null;\n }\n }\n}\n","import { Texture } from '@pixi/core';\nimport { LoaderResource } from './LoaderResource';\n\n/**\n * Loader plugin for handling Texture resources.\n *\n * @memberof PIXI\n */\nexport class TextureLoader\n{\n /**\n * Handle SVG elements a text, render with SVGResource.\n */\n public static add(): void\n {\n LoaderResource.setExtensionLoadType('svg', LoaderResource.LOAD_TYPE.XHR);\n LoaderResource.setExtensionXhrType('svg', LoaderResource.XHR_RESPONSE_TYPE.TEXT);\n }\n\n /**\n * Called after a resource is loaded.\n * @see PIXI.Loader.loaderMiddleware\n * @param resource\n * @param {function} next\n */\n public static use(resource: LoaderResource, next: (...args: any[]) => void): void\n {\n // create a new texture if the data is an Image object\n if (resource.data && (resource.type === LoaderResource.TYPE.IMAGE || resource.extension === 'svg'))\n {\n const { data, url, name, metadata } = resource;\n\n Texture.fromLoader(data, url, name, metadata).then((texture) =>\n {\n resource.texture = texture;\n next();\n })\n // TODO: handle errors in Texture.fromLoader\n // so we can pass them to the Loader\n .catch(next);\n }\n else\n {\n next();\n }\n }\n}\n","import { LoaderResource } from '../LoaderResource';\nimport { encodeBinary } from '../base/encodeBinary';\n\nconst Url = self.URL || self.webkitURL;\n\n/**\n * A middleware for transforming XHR loaded Blobs into more useful objects\n *\n * @ignore\n * @function parsing\n * @example\n * import { Loader, middleware } from 'resource-loader';\n * const loader = new Loader();\n * loader.use(middleware.parsing);\n * @param resource - Current Resource\n * @param next - Callback when complete\n */\nexport function parsing(resource: LoaderResource, next: (...args: any) => void): void\n{\n if (!resource.data)\n {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === LoaderResource.XHR_RESPONSE_TYPE.BLOB)\n {\n // if there is no blob support we probably got a binary string back\n if (!self.Blob || typeof resource.data === 'string')\n {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0)\n {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () =>\n {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0)\n {\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = LoaderResource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () =>\n {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\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 */\nexport enum ENV {\n WEBGL_LEGACY,\n WEBGL,\n WEBGL2,\n}\n\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 */\nexport enum RENDERER_TYPE {\n UNKNOWN,\n WEBGL,\n CANVAS,\n}\n\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 */\nexport enum BUFFER_BITS {\n COLOR = 0x00004000,\n DEPTH = 0x00000100,\n STENCIL = 0x00000400\n}\n\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 */\nexport enum BLEND_MODES {\n NORMAL = 0,\n ADD = 1,\n MULTIPLY = 2,\n SCREEN = 3,\n OVERLAY = 4,\n DARKEN = 5,\n LIGHTEN = 6,\n COLOR_DODGE = 7,\n COLOR_BURN = 8,\n HARD_LIGHT = 9,\n SOFT_LIGHT = 10,\n DIFFERENCE = 11,\n EXCLUSION = 12,\n HUE = 13,\n SATURATION = 14,\n COLOR = 15,\n LUMINOSITY = 16,\n NORMAL_NPM = 17,\n ADD_NPM = 18,\n SCREEN_NPM = 19,\n NONE = 20,\n\n SRC_OVER = 0,\n SRC_IN = 21,\n SRC_OUT = 22,\n SRC_ATOP = 23,\n DST_OVER = 24,\n DST_IN = 25,\n DST_OUT = 26,\n DST_ATOP = 27,\n ERASE = 26,\n SUBTRACT = 28,\n XOR = 29,\n}\n\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 */\nexport enum DRAW_MODES {\n POINTS,\n LINES,\n LINE_LOOP,\n LINE_STRIP,\n TRIANGLES,\n TRIANGLE_STRIP,\n TRIANGLE_FAN,\n}\n\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 */\nexport enum FORMATS {\n RGBA = 6408,\n RGB = 6407,\n RG = 33319,\n RED = 6403,\n RGBA_INTEGER = 36249,\n RGB_INTEGER = 36248,\n RG_INTEGER = 33320,\n RED_INTEGER = 36244,\n ALPHA = 6406,\n LUMINANCE = 6409,\n LUMINANCE_ALPHA = 6410,\n DEPTH_COMPONENT = 6402,\n DEPTH_STENCIL = 34041,\n}\n\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 */\nexport enum TARGETS {\n TEXTURE_2D = 3553,\n TEXTURE_CUBE_MAP = 34067,\n TEXTURE_2D_ARRAY = 35866,\n TEXTURE_CUBE_MAP_POSITIVE_X = 34069,\n TEXTURE_CUBE_MAP_NEGATIVE_X = 34070,\n TEXTURE_CUBE_MAP_POSITIVE_Y = 34071,\n TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072,\n TEXTURE_CUBE_MAP_POSITIVE_Z = 34073,\n TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074,\n}\n\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 */\nexport enum TYPES {\n UNSIGNED_BYTE = 5121,\n UNSIGNED_SHORT = 5123,\n UNSIGNED_SHORT_5_6_5 = 33635,\n UNSIGNED_SHORT_4_4_4_4 = 32819,\n UNSIGNED_SHORT_5_5_5_1 = 32820,\n UNSIGNED_INT = 5125,\n UNSIGNED_INT_10F_11F_11F_REV = 35899,\n UNSIGNED_INT_2_10_10_10_REV = 33640,\n UNSIGNED_INT_24_8 = 34042,\n UNSIGNED_INT_5_9_9_9_REV = 35902,\n BYTE = 5120,\n SHORT = 5122,\n INT = 5124,\n FLOAT = 5126,\n FLOAT_32_UNSIGNED_INT_24_8_REV = 36269,\n HALF_FLOAT = 36193,\n}\n\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 */\nexport enum SAMPLER_TYPES {\n FLOAT = 0,\n INT = 1,\n UINT = 2,\n}\n\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 */\nexport enum SCALE_MODES {\n NEAREST,\n LINEAR,\n}\n\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 */\nexport enum WRAP_MODES {\n CLAMP = 33071,\n REPEAT = 10497,\n MIRRORED_REPEAT = 33648,\n}\n\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 */\nexport enum MIPMAP_MODES {\n OFF,\n POW2,\n ON,\n ON_MANUAL\n}\n\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 */\nexport enum ALPHA_MODES {\n NPM = 0,\n UNPACK = 1,\n PMA = 2,\n NO_PREMULTIPLIED_ALPHA = 0,\n PREMULTIPLY_ON_UPLOAD = 1,\n PREMULTIPLY_ALPHA = 2, // deprecated, undocumented\n PREMULTIPLIED_ALPHA = 2,\n}\n\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 */\nexport enum CLEAR_MODES {\n NO = 0,\n YES = 1,\n AUTO = 2,\n BLEND = 0,\n CLEAR = 1,\n BLIT = 2,\n}\n\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 */\nexport enum GC_MODES {\n AUTO,\n MANUAL,\n}\n\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 */\nexport enum PRECISION {\n LOW = 'lowp',\n MEDIUM = 'mediump',\n HIGH = 'highp',\n}\n\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 */\nexport enum MASK_TYPES {\n NONE = 0,\n SCISSOR = 1,\n STENCIL = 2,\n SPRITE = 3,\n}\n\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 */\nexport enum MSAA_QUALITY {\n NONE = 0,\n LOW = 2,\n MEDIUM = 4,\n HIGH = 8\n}\n\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 */\nexport enum BUFFER_TYPE {\n ELEMENT_ARRAY_BUFFER = 34963,\n ARRAY_BUFFER = 34962,\n // NOT YET SUPPORTED\n UNIFORM_BUFFER = 35345,\n}\n","const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\n/**\n * Encodes binary into base64.\n *\n * @function encodeBinary\n * @param {string} input - The input data to encode.\n * @returns {string} The encoded base64 string\n */\nexport function encodeBinary(input: string): string\n{\n let output = '';\n let inx = 0;\n\n while (inx < input.length)\n {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx)\n {\n if (inx < input.length)\n {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else\n {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes)\n {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx)\n {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n","/**\n * Regexp for data URI.\n * Based on: {@link https://github.com/ragingwind/data-uri-regex}\n *\n * @static\n * @constant {RegExp|string} DATA_URI\n * @memberof PIXI\n * @example data:image/png;base64\n */\nexport const DATA_URI = /^\\s*data:(?:([\\w-]+)\\/([\\w+.-]+))?(?:;charset=([\\w-]+))?(?:;(base64))?,(.*)/i;\n","import { settings } from '@pixi/settings';\n\n/**\n * Sets the default value for the container property 'sortableChildren'.\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @static\n * @constant\n * @name SORTABLE_CHILDREN\n * @memberof PIXI.settings\n * @type {boolean}\n * @default false\n */\nsettings.SORTABLE_CHILDREN = false;\n\nexport { settings };\n","import { TickerCallback } from './Ticker';\n\n/**\n * Internal class for handling the priority sorting of ticker handlers.\n *\n * @private\n * @class\n * @memberof PIXI\n */\nexport class TickerListener\n{\n /** The current priority. */\n public priority: number;\n /** The next item in chain. */\n public next: TickerListener = null;\n /** The previous item in chain. */\n public previous: TickerListener = null;\n\n /** The handler function to execute. */\n private fn: TickerCallback;\n /** The calling to execute. */\n private context: T;\n /** If this should only execute once. */\n private once: boolean;\n /** `true` if this listener has been destroyed already. */\n private _destroyed = false;\n\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 constructor(fn: TickerCallback, context: T = null, priority = 0, once = false)\n {\n this.fn = fn;\n this.context = context;\n this.priority = priority;\n this.once = once;\n }\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 match(fn: TickerCallback, context: any = null): boolean\n {\n return this.fn === fn && this.context === context;\n }\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 emit(deltaTime: number): TickerListener\n {\n if (this.fn)\n {\n if (this.context)\n {\n this.fn.call(this.context, deltaTime);\n }\n else\n {\n (this as TickerListener).fn(deltaTime);\n }\n }\n\n const redirect = this.next;\n\n if (this.once)\n {\n this.destroy(true);\n }\n\n // Soft-destroying should remove\n // the next reference\n if (this._destroyed)\n {\n this.next = null;\n }\n\n return redirect;\n }\n\n /**\n * Connect to the list.\n * @private\n * @param previous - Input node, previous listener\n */\n connect(previous: TickerListener): void\n {\n this.previous = previous;\n if (previous.next)\n {\n previous.next.previous = this;\n }\n this.next = previous.next;\n previous.next = this;\n }\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 destroy(hard = false): TickerListener\n {\n this._destroyed = true;\n this.fn = null;\n this.context = null;\n\n // Disconnect, hook up next and previous\n if (this.previous)\n {\n this.previous.next = this.next;\n }\n\n if (this.next)\n {\n this.next.previous = this.previous;\n }\n\n // Redirect to the next item\n const redirect = this.next;\n\n // Remove references\n this.next = hard ? null : redirect;\n this.previous = null;\n\n return redirect;\n }\n}\n","import { settings } from './settings';\nimport { UPDATE_PRIORITY } from './const';\nimport { TickerListener } from './TickerListener';\n\nexport type TickerCallback = (this: T, dt: number) => any;\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 */\nexport class Ticker\n{\n /** The private shared ticker instance */\n private static _shared: Ticker;\n /** The private system ticker instance */\n private static _system: Ticker;\n\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 public 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 public deltaTime = 1;\n /**\n * Scaler time elapsed in milliseconds 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 * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public deltaMS: number;\n /**\n * Time elapsed in milliseconds from last frame to this frame.\n * Opposed to what the scalar {@link PIXI.Ticker#deltaTime}\n * is based, this value is neither capped nor scaled.\n * If the platform supports DOMHighResTimeStamp,\n * this value will have a precision of 1 µs.\n * Defaults to target frame time\n * @default 16.66\n */\n public elapsedMS: number;\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 public 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 public 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 public started = false;\n\n /** The first listener. All new listeners added are chained on this. */\n private _head: TickerListener;\n /** Internal current frame request ID */\n private _requestId: number = null;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _maxElapsedMS = 100;\n /**\n * Internal value managed by minFPS property setter and getter.\n * This is the maximum allowed milliseconds between updates.\n */\n private _minElapsedMS = 0;\n /** If enabled, deleting is disabled.*/\n private _protected = false;\n /**\n * The last time keyframe was executed.\n * Maintains a relatively fixed interval with the previous value.\n */\n private _lastFrame = -1;\n /**\n * Internal tick method bound to ticker instance.\n * This is because in early 2015, Function.bind\n * is still 60% slower in high performance scenarios.\n * Also separating frame requests from update method\n * so listeners may be called at any time and with\n * any animation API, just invoke ticker.update(time).\n *\n * @param time - Time since last tick.\n */\n private _tick: (time: number) => any;\n\n constructor()\n {\n this._head = new TickerListener(null, null, Infinity);\n this.deltaMS = 1 / settings.TARGET_FPMS;\n this.elapsedMS = 1 / settings.TARGET_FPMS;\n\n this._tick = (time: number): void =>\n {\n this._requestId = null;\n\n if (this.started)\n {\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 {\n this._requestId = requestAnimationFrame(this._tick);\n }\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 private _requestIfNeeded(): void\n {\n if (this._requestId === null && this._head.next)\n {\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 /**\n * Conditionally cancels a pending animation frame.\n * @private\n */\n private _cancelIfNeeded(): void\n {\n if (this._requestId !== null)\n {\n cancelAnimationFrame(this._requestId);\n this._requestId = null;\n }\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 private _startIfPossible(): void\n {\n if (this.started)\n {\n this._requestIfNeeded();\n }\n else if (this.autoStart)\n {\n this.start();\n }\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 add(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority));\n }\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 addOnce(fn: TickerCallback, context?: T, priority = UPDATE_PRIORITY.NORMAL): this\n {\n return this._addListener(new TickerListener(fn, context, priority, true));\n }\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 private _addListener(listener: TickerListener): this\n {\n // For attaching to head\n let current = this._head.next;\n let previous = this._head;\n\n // Add the first item\n if (!current)\n {\n listener.connect(previous);\n }\n else\n {\n // Go from highest to lowest priority\n while (current)\n {\n if (listener.priority > current.priority)\n {\n listener.connect(previous);\n break;\n }\n previous = current;\n current = current.next;\n }\n\n // Not yet connected\n if (!listener.previous)\n {\n listener.connect(previous);\n }\n }\n\n this._startIfPossible();\n\n return this;\n }\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 remove(fn: TickerCallback, context?: T): this\n {\n let listener = this._head.next;\n\n while (listener)\n {\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 {\n listener = listener.destroy();\n }\n else\n {\n listener = listener.next;\n }\n }\n\n if (!this._head.next)\n {\n this._cancelIfNeeded();\n }\n\n return this;\n }\n\n /**\n * The number of listeners on this ticker, calculated by walking through linked list\n *\n * @readonly\n * @member {number}\n */\n get count(): number\n {\n if (!this._head)\n {\n return 0;\n }\n\n let count = 0;\n let current = this._head;\n\n while ((current = current.next))\n {\n count++;\n }\n\n return count;\n }\n\n /**\n * Starts the ticker. If the ticker has listeners\n * a new animation frame is requested at this point.\n */\n start(): void\n {\n if (!this.started)\n {\n this.started = true;\n this._requestIfNeeded();\n }\n }\n\n /**\n * Stops the ticker. If the ticker has requested\n * an animation frame it is canceled at this point.\n */\n stop(): void\n {\n if (this.started)\n {\n this.started = false;\n this._cancelIfNeeded();\n }\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 destroy(): void\n {\n if (!this._protected)\n {\n this.stop();\n\n let listener = this._head.next;\n\n while (listener)\n {\n listener = listener.destroy(true);\n }\n\n this._head.destroy();\n this._head = null;\n }\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 update(currentTime = performance.now()): void\n {\n let elapsedMS;\n\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\n if (currentTime > this.lastTime)\n {\n // Save uncapped elapsedMS for measurement\n elapsedMS = this.elapsedMS = currentTime - this.lastTime;\n\n // cap the milliseconds elapsed used for deltaTime\n if (elapsedMS > this._maxElapsedMS)\n {\n elapsedMS = this._maxElapsedMS;\n }\n\n elapsedMS *= this.speed;\n\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 {\n const delta = currentTime - this._lastFrame | 0;\n\n if (delta < this._minElapsedMS)\n {\n return;\n }\n\n this._lastFrame = currentTime - (delta % this._minElapsedMS);\n }\n\n this.deltaMS = elapsedMS;\n this.deltaTime = this.deltaMS * settings.TARGET_FPMS;\n\n // Cache a local reference, in-case ticker is destroyed\n // during the emit, we can still check for head.next\n const head = this._head;\n\n // Invoke listeners added to internal emitter\n let listener = head.next;\n\n while (listener)\n {\n listener = listener.emit(this.deltaTime);\n }\n\n if (!head.next)\n {\n this._cancelIfNeeded();\n }\n }\n else\n {\n this.deltaTime = this.deltaMS = this.elapsedMS = 0;\n }\n\n this.lastTime = currentTime;\n }\n\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 FPS(): number\n {\n return 1000 / this.elapsedMS;\n }\n\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 minFPS(): number\n {\n return 1000 / this._maxElapsedMS;\n }\n\n set minFPS(fps: number)\n {\n // Minimum must be below the maxFPS\n const minFPS = Math.min(this.maxFPS, fps);\n\n // Must be at least 0, but below 1 / settings.TARGET_FPMS\n const minFPMS = Math.min(Math.max(0, minFPS) / 1000, settings.TARGET_FPMS);\n\n this._maxElapsedMS = 1 / minFPMS;\n }\n\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 maxFPS(): number\n {\n if (this._minElapsedMS)\n {\n return Math.round(1000 / this._minElapsedMS);\n }\n\n return 0;\n }\n\n set maxFPS(fps: number)\n {\n if (fps === 0)\n {\n this._minElapsedMS = 0;\n }\n else\n {\n // Max must be at least the minFPS\n const maxFPS = Math.max(this.minFPS, fps);\n\n this._minElapsedMS = 1 / (maxFPS / 1000);\n }\n }\n\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 static get shared(): Ticker\n {\n if (!Ticker._shared)\n {\n const shared = Ticker._shared = new Ticker();\n\n shared.autoStart = true;\n shared._protected = true;\n }\n\n return Ticker._shared;\n }\n\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 static get system(): Ticker\n {\n if (!Ticker._system)\n {\n const system = Ticker._system = new Ticker();\n\n system.autoStart = true;\n system._protected = true;\n }\n\n return Ticker._system;\n }\n}\n","import { UPDATE_PRIORITY } from './const';\nimport { Ticker } from './Ticker';\n\n/**\n * Middleware for for Application Ticker.\n *\n * @example\n * import {TickerPlugin} from '@pixi/ticker';\n * import {Application} from '@pixi/app';\n * Application.registerPlugin(TickerPlugin);\n *\n * @class\n * @memberof PIXI\n */\nexport class TickerPlugin\n{\n static start: () => void;\n static stop: () => void;\n static _ticker: Ticker;\n static ticker: Ticker;\n\n /**\n * Initialize the plugin with scope of application instance\n *\n * @static\n * @private\n * @param {object} [options] - See application options\n */\n static init(options?: GlobalMixins.IApplicationOptions): void\n {\n // Set default\n options = Object.assign({\n autoStart: true,\n sharedTicker: false,\n }, options);\n\n // Create ticker setter\n Object.defineProperty(this, 'ticker',\n {\n set(ticker)\n {\n if (this._ticker)\n {\n this._ticker.remove(this.render, this);\n }\n this._ticker = ticker;\n if (ticker)\n {\n ticker.add(this.render, this, UPDATE_PRIORITY.LOW);\n }\n },\n get()\n {\n return this._ticker;\n },\n });\n\n /**\n * Convenience method for stopping the render.\n *\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.stop = (): void =>\n {\n this._ticker.stop();\n };\n\n /**\n * Convenience method for starting the render.\n *\n * @method\n * @memberof PIXI.Application\n * @instance\n */\n this.start = (): void =>\n {\n this._ticker.start();\n };\n\n /**\n * Internal reference to the ticker.\n *\n * @type {PIXI.Ticker}\n * @name _ticker\n * @memberof PIXI.Application#\n * @private\n */\n this._ticker = null;\n\n /**\n * Ticker for doing render updates.\n *\n * @type {PIXI.Ticker}\n * @name ticker\n * @memberof PIXI.Application#\n * @default PIXI.Ticker.shared\n */\n this.ticker = options.sharedTicker ? Ticker.shared : new Ticker();\n\n // Start the rendering\n if (options.autoStart)\n {\n this.start();\n }\n }\n\n /**\n * Clean up the ticker, scoped to application.\n *\n * @static\n * @private\n */\n static destroy(): void\n {\n if (this._ticker)\n {\n const oldTicker = this._ticker;\n\n this.ticker = null;\n oldTicker.destroy();\n }\n }\n}\n","import { Texture } from '@pixi/core';\nimport type { Matrix } from '@pixi/math';\n\n/**\n * Fill style object for Graphics.\n *\n * @class\n * @memberof PIXI\n */\nexport class FillStyle\n{\n /**\n * The hex color value used when coloring the Graphics object.\n *\n * @default 0xFFFFFF\n */\n public color = 0xFFFFFF;\n\n /** The alpha value used when filling the Graphics object. */\n public alpha = 1.0;\n\n /**\n * The texture to be used for the fill.\n *\n * @member {PIXI.Texture}\n * @default 0\n */\n public texture: Texture = Texture.WHITE;\n\n /**\n * The transform applied to the texture.\n *\n * @member {PIXI.Matrix}\n * @default null\n */\n public matrix: Matrix = null;\n\n /** If the current fill is visible. */\n public visible = false;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Clones the object\n *\n * @return {PIXI.FillStyle}\n */\n public clone(): FillStyle\n {\n const obj = new FillStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n\n return obj;\n }\n\n /**\n * Reset\n */\n public reset(): void\n {\n this.color = 0xFFFFFF;\n this.alpha = 1;\n this.texture = Texture.WHITE;\n this.matrix = null;\n this.visible = false;\n }\n\n /**\n * Destroy and don't use after this\n */\n public destroy(): void\n {\n this.texture = null;\n this.matrix = null;\n }\n}\n","import { earcut } from '@pixi/utils';\n\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Polygon } from '@pixi/math';\n\n/**\n * Builds a polygon to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildPoly: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n graphicsData.points = (graphicsData.shape as Polygon).points.slice();\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n let points = graphicsData.points;\n const holes = graphicsData.holes;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n if (points.length >= 6)\n {\n const holeArray = [];\n // Process holes..\n\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n\n holeArray.push(points.length / 2);\n points = points.concat(hole.points);\n }\n\n // sort color\n const triangles = earcut(points, holeArray, 2);\n\n if (!triangles)\n {\n return;\n }\n\n const vertPos = verts.length / 2;\n\n for (let i = 0; i < triangles.length; i += 3)\n {\n indices.push(triangles[i] + vertPos);\n indices.push(triangles[i + 1] + vertPos);\n indices.push(triangles[i + 2] + vertPos);\n }\n\n for (let i = 0; i < points.length; i++)\n {\n verts.push(points[i]);\n }\n }\n },\n};\n","// for type only\nimport { SHAPES } from '@pixi/math';\n\nimport type { Circle, Ellipse } from '@pixi/math';\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Builds a circle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object to draw\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildCircle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // need to convert points to a nice regular data\n const circleData = graphicsData.shape as Circle;\n const points = graphicsData.points;\n const x = circleData.x;\n const y = circleData.y;\n let width;\n let height;\n\n points.length = 0;\n\n // TODO - bit hacky??\n if (graphicsData.type === SHAPES.CIRC)\n {\n width = circleData.radius;\n height = circleData.radius;\n }\n else\n {\n const ellipseData = graphicsData.shape as Ellipse;\n\n width = ellipseData.width;\n height = ellipseData.height;\n }\n\n if (width === 0 || height === 0)\n {\n return;\n }\n\n let totalSegs = Math.floor(30 * Math.sqrt(circleData.radius))\n || Math.floor(15 * Math.sqrt(width + height));\n\n totalSegs /= 2.3;\n\n const seg = (Math.PI * 2) / totalSegs;\n\n for (let i = 0; i < totalSegs - 0.5; i++)\n {\n points.push(\n x + (Math.sin(-seg * i) * width),\n y + (Math.cos(-seg * i) * height)\n );\n }\n\n points.push(points[0], points[1]);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n let vertPos = verts.length / 2;\n const center = vertPos;\n\n const circle = (graphicsData.shape) as Circle;\n const matrix = graphicsData.matrix;\n const x = circle.x;\n const y = circle.y;\n\n // Push center (special point)\n verts.push(\n graphicsData.matrix ? (matrix.a * x) + (matrix.c * y) + matrix.tx : x,\n graphicsData.matrix ? (matrix.b * x) + (matrix.d * y) + matrix.ty : y);\n\n for (let i = 0; i < points.length; i += 2)\n {\n verts.push(points[i], points[i + 1]);\n\n // add some uvs\n indices.push(vertPos++, center, vertPos);\n }\n },\n};\n","import type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { Rectangle } from '@pixi/math';\n\n/**\n * Builds a rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n // --- //\n // need to convert points to a nice regular data\n //\n const rectData = graphicsData.shape as Rectangle;\n const x = rectData.x;\n const y = rectData.y;\n const width = rectData.width;\n const height = rectData.height;\n\n const points = graphicsData.points;\n\n points.length = 0;\n\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n const verts = graphicsGeometry.points;\n\n const vertPos = verts.length / 2;\n\n verts.push(points[0], points[1],\n points[2], points[3],\n points[6], points[7],\n points[4], points[5]);\n\n graphicsGeometry.indices.push(vertPos, vertPos + 1, vertPos + 2,\n vertPos + 1, vertPos + 2, vertPos + 3);\n },\n};\n","import { earcut } from '@pixi/utils';\n\n// for type only\nimport type { IShapeBuildCommand } from './IShapeBuildCommand';\nimport type { RoundedRectangle } from '@pixi/math';\n\n/**\n * Calculate a single point for a quadratic bezier curve.\n * Utility function used by quadraticBezierCurve.\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} n1 - first number\n * @param {number} n2 - second number\n * @param {number} perc - percentage\n * @return {number} the result\n *\n */\nfunction getPt(n1: number, n2: number, perc: number): number\n{\n const diff = n2 - n1;\n\n return n1 + (diff * perc);\n}\n\n/**\n * Calculate the points for a quadratic bezier curve. (helper function..)\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} fromX - Origin point x\n * @param {number} fromY - Origin point x\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} [out=[]] - The output array to add points into. If not passed, a new array is created.\n * @return {number[]} an array of points\n */\nfunction quadraticBezierCurve(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number,\n out: Array = []): Array\n{\n const n = 20;\n const points = out;\n\n let xa = 0;\n let ya = 0;\n let xb = 0;\n let yb = 0;\n let x = 0;\n let y = 0;\n\n for (let i = 0, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n // The Green Line\n xa = getPt(fromX, cpX, j);\n ya = getPt(fromY, cpY, j);\n xb = getPt(cpX, toX, j);\n yb = getPt(cpY, toY, j);\n\n // The Black Dot\n x = getPt(xa, xb, j);\n y = getPt(ya, yb, j);\n\n // Handle case when first curve points overlaps and earcut fails to triangulate\n if (i === 0 && points[points.length - 2] === x && points[points.length - 1] === y)\n {\n continue;\n }\n\n points.push(x, y);\n }\n\n return points;\n}\n\n/**\n * Builds a rounded rectangle to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.WebGLGraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {object} webGLData - an object containing all the WebGL-specific information to create this shape\n * @param {object} webGLDataNativeLines - an object containing all the WebGL-specific information to create nativeLines\n */\nexport const buildRoundedRectangle: IShapeBuildCommand = {\n\n build(graphicsData)\n {\n const rrectData = graphicsData.shape as RoundedRectangle;\n const points = graphicsData.points;\n const x = rrectData.x;\n const y = rrectData.y;\n const width = rrectData.width;\n const height = rrectData.height;\n\n // Don't allow negative radius or greater than half the smallest width\n const radius = Math.max(0, Math.min(rrectData.radius, Math.min(width, height) / 2));\n\n points.length = 0;\n\n // No radius, do a simple rectangle\n if (!radius)\n {\n points.push(x, y,\n x + width, y,\n x + width, y + height,\n x, y + height);\n }\n else\n {\n quadraticBezierCurve(x, y + radius,\n x, y,\n x + radius, y,\n points);\n quadraticBezierCurve(x + width - radius,\n y, x + width, y,\n x + width, y + radius,\n points);\n quadraticBezierCurve(x + width, y + height - radius,\n x + width, y + height,\n x + width - radius, y + height,\n points);\n quadraticBezierCurve(x + radius, y + height,\n x, y + height,\n x, y + height - radius,\n points);\n }\n },\n\n triangulate(graphicsData, graphicsGeometry)\n {\n const points = graphicsData.points;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n\n const vecPos = verts.length / 2;\n\n const triangles = earcut(points, null, 2);\n\n for (let i = 0, j = triangles.length; i < j; i += 3)\n {\n indices.push(triangles[i] + vecPos);\n // indices.push(triangles[i] + vecPos);\n indices.push(triangles[i + 1] + vecPos);\n // indices.push(triangles[i + 2] + vecPos);\n indices.push(triangles[i + 2] + vecPos);\n }\n\n for (let i = 0, j = points.length; i < j; i++)\n {\n verts.push(points[i], points[++i]);\n }\n },\n};\n","import { Point, SHAPES } from '@pixi/math';\n\nimport type { Polygon } from '@pixi/math';\nimport type { GraphicsData } from '../GraphicsData';\nimport type { GraphicsGeometry } from '../GraphicsGeometry';\nimport { LINE_JOIN, LINE_CAP, GRAPHICS_CURVES } from '../const';\n\n/**\n * Buffers vertices to draw a square cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} x - X-coord of end point\n * @param {number} y - Y-coord of end point\n * @param {number} nx - X-coord of line normal pointing inside\n * @param {number} ny - Y-coord of line normal pointing inside\n * @param {Array} verts - vertex buffer\n * @returns {}\n */\nfunction square(\n x: number,\n y: number,\n nx: number,\n ny: number,\n innerWeight: number,\n outerWeight: number,\n clockwise: boolean, /* rotation for square (true at left end, false at right end) */\n verts: Array\n): number\n{\n const ix = x - (nx * innerWeight);\n const iy = y - (ny * innerWeight);\n const ox = x + (nx * outerWeight);\n const oy = y + (ny * outerWeight);\n\n /* Rotate nx,ny for extension vector */\n let exx; let\n eyy;\n\n if (clockwise)\n {\n exx = ny;\n eyy = -nx;\n }\n else\n {\n exx = -ny;\n eyy = nx;\n }\n\n /* [i|0]x,y extended at cap */\n const eix = ix + exx;\n const eiy = iy + eyy;\n const eox = ox + exx;\n const eoy = oy + eyy;\n\n /* Square itself must be inserted clockwise*/\n verts.push(eix, eiy);\n verts.push(eox, eoy);\n\n return 2;\n}\n\n/**\n * Buffers vertices to draw an arc at the line joint or cap.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {number} cx - X-coord of center\n * @param {number} cy - Y-coord of center\n * @param {number} sx - X-coord of arc start\n * @param {number} sy - Y-coord of arc start\n * @param {number} ex - X-coord of arc end\n * @param {number} ey - Y-coord of arc end\n * @param {Array} verts - buffer of vertices\n * @param {boolean} clockwise - orientation of vertices\n * @returns {number} - no. of vertices pushed\n */\nfunction round(\n cx: number,\n cy: number,\n sx: number,\n sy: number,\n ex: number,\n ey: number,\n verts: Array,\n clockwise: boolean, /* if not cap, then clockwise is turn of joint, otherwise rotation from angle0 to angle1 */\n): number\n{\n const cx2p0x = sx - cx;\n const cy2p0y = sy - cy;\n\n let angle0 = Math.atan2(cx2p0x, cy2p0y);\n let angle1 = Math.atan2(ex - cx, ey - cy);\n\n if (clockwise && angle0 < angle1)\n {\n angle0 += Math.PI * 2;\n }\n else if (!clockwise && angle0 > angle1)\n {\n angle1 += Math.PI * 2;\n }\n\n let startAngle = angle0;\n const angleDiff = angle1 - angle0;\n const absAngleDiff = Math.abs(angleDiff);\n\n /* if (absAngleDiff >= PI_LBOUND && absAngleDiff <= PI_UBOUND)\n {\n const r1x = cx - nxtPx;\n const r1y = cy - nxtPy;\n\n if (r1x === 0)\n {\n if (r1y > 0)\n {\n angleDiff = -angleDiff;\n }\n }\n else if (r1x >= -GRAPHICS_CURVES.epsilon)\n {\n angleDiff = -angleDiff;\n }\n }*/\n\n const radius = Math.sqrt((cx2p0x * cx2p0x) + (cy2p0y * cy2p0y));\n const segCount = ((15 * absAngleDiff * Math.sqrt(radius) / Math.PI) >> 0) + 1;\n const angleInc = angleDiff / segCount;\n\n startAngle += angleInc;\n\n if (clockwise)\n {\n verts.push(cx, cy);\n verts.push(sx, sy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx, cy);\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n }\n\n verts.push(cx, cy);\n verts.push(ex, ey);\n }\n else\n {\n verts.push(sx, sy);\n verts.push(cx, cy);\n\n for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc)\n {\n verts.push(cx + ((Math.sin(angle) * radius)),\n cy + ((Math.cos(angle) * radius)));\n verts.push(cx, cy);\n }\n\n verts.push(ex, ey);\n verts.push(cx, cy);\n }\n\n return segCount * 2;\n}\n\n/**\n * Builds a line to draw using the polygon method.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNonNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n const shape = graphicsData.shape as Polygon;\n let points = graphicsData.points || shape.points.slice();\n const eps = graphicsGeometry.closePointEps;\n\n if (points.length === 0)\n {\n return;\n }\n // if the line width is an odd number add 0.5 to align to a whole pixel\n // commenting this out fixes #711 and #1620\n // if (graphicsData.lineWidth%2)\n // {\n // for (i = 0; i < points.length; i++)\n // {\n // points[i] += 0.5;\n // }\n // }\n\n const style = graphicsData.lineStyle;\n\n // get first and last point.. figure out the middle!\n const firstPoint = new Point(points[0], points[1]);\n const lastPoint = new Point(points[points.length - 2], points[points.length - 1]);\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n const closedPath = Math.abs(firstPoint.x - lastPoint.x) < eps\n && Math.abs(firstPoint.y - lastPoint.y) < eps;\n\n // if the first point is the last point - gonna have issues :)\n if (closedShape)\n {\n // need to clone as we are going to slightly modify the shape..\n points = points.slice();\n\n if (closedPath)\n {\n points.pop();\n points.pop();\n lastPoint.set(points[points.length - 2], points[points.length - 1]);\n }\n\n const midPointX = (firstPoint.x + lastPoint.x) * 0.5;\n const midPointY = (lastPoint.y + firstPoint.y) * 0.5;\n\n points.unshift(midPointX, midPointY);\n points.push(midPointX, midPointY);\n }\n\n const verts = graphicsGeometry.points;\n const length = points.length / 2;\n let indexCount = points.length;\n const indexStart = verts.length / 2;\n\n // Max. inner and outer width\n const width = style.width / 2;\n const widthSquared = width * width;\n const miterLimitSquared = style.miterLimit * style.miterLimit;\n\n /* Line segments of interest where (x1,y1) forms the corner. */\n let x0 = points[0];\n let y0 = points[1];\n let x1 = points[2];\n let y1 = points[3];\n let x2 = 0;\n let y2 = 0;\n\n /* perp[?](x|y) = the line normal with magnitude lineWidth. */\n let perpx = -(y0 - y1);\n let perpy = x0 - x1;\n let perp1x = 0;\n let perp1y = 0;\n\n let dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n const ratio = style.alignment;// 0.5;\n const innerWeight = (1 - ratio) * 2;\n const outerWeight = ratio * 2;\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x0 - (perpx * (innerWeight - outerWeight) * 0.5),\n y0 - (perpy * (innerWeight - outerWeight) * 0.5),\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight),\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight),\n verts,\n true,\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);\n }\n }\n\n // Push first point (below & above vertices)\n verts.push(\n x0 - (perpx * innerWeight),\n y0 - (perpy * innerWeight));\n verts.push(\n x0 + (perpx * outerWeight),\n y0 + (perpy * outerWeight));\n\n for (let i = 1; i < length - 1; ++i)\n {\n x0 = points[(i - 1) * 2];\n y0 = points[((i - 1) * 2) + 1];\n\n x1 = points[i * 2];\n y1 = points[(i * 2) + 1];\n\n x2 = points[(i + 1) * 2];\n y2 = points[((i + 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n perp1x = -(y1 - y2);\n perp1y = x1 - x2;\n\n dist = Math.sqrt((perp1x * perp1x) + (perp1y * perp1y));\n perp1x /= dist;\n perp1y /= dist;\n perp1x *= width;\n perp1y *= width;\n\n /* d[x|y](0|1) = the component displacement between points p(0,1|1,2) */\n const dx0 = x1 - x0;\n const dy0 = y0 - y1;\n const dx1 = x1 - x2;\n const dy1 = y2 - y1;\n\n /* +ve if internal angle counterclockwise, -ve if internal angle clockwise. */\n const cross = (dy0 * dx1) - (dy1 * dx0);\n const clockwise = (cross < 0);\n\n /* Going nearly straight? */\n if (Math.abs(cross) < 0.1)\n {\n verts.push(\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight));\n verts.push(\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight));\n\n continue;\n }\n\n /* p[x|y] is the miter point. pdist is the distance between miter point and p1. */\n const c1 = ((-perpx + x0) * (-perpy + y1)) - ((-perpx + x1) * (-perpy + y0));\n const c2 = ((-perp1x + x2) * (-perp1y + y1)) - ((-perp1x + x1) * (-perp1y + y2));\n const px = ((dx0 * c2) - (dx1 * c1)) / cross;\n const py = ((dy1 * c1) - (dy0 * c2)) / cross;\n const pdist = ((px - x1) * (px - x1)) + ((py - y1) * (py - y1));\n\n /* Inner miter point */\n const imx = x1 + ((px - x1) * innerWeight);\n const imy = y1 + ((py - y1) * innerWeight);\n /* Outer miter point */\n const omx = x1 - ((px - x1) * outerWeight);\n const omy = y1 - ((py - y1) * outerWeight);\n\n /* Is the inside miter point too far away, creating a spike? */\n const smallerInsideSegmentSq = Math.min((dx0 * dx0) + (dy0 * dy0), (dx1 * dx1) + (dy1 * dy1));\n const insideWeight = clockwise ? innerWeight : outerWeight;\n const smallerInsideDiagonalSq = smallerInsideSegmentSq + (insideWeight * insideWeight * widthSquared);\n const insideMiterOk = pdist <= smallerInsideDiagonalSq;\n\n if (insideMiterOk)\n {\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n if (clockwise) /* rotating at inner angle */\n {\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));// first segment's outer vertex\n verts.push(imx, imy);// inner miter point\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));// second segment's outer vertex\n }\n else /* rotating at outer angle */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));// first segment's inner vertex\n verts.push(omx, omy);// outer miter point\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));// second segment's outer vertex\n verts.push(omx, omy);// outer miter point\n }\n\n indexCount += 2;\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n verts.push(imx, imy);\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 4;\n\n verts.push(imx, imy);\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight));\n }\n else /* arc is inside */\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(omx, omy);\n\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 4;\n\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight));\n verts.push(omx, omy);\n }\n }\n else\n {\n verts.push(imx, imy);\n verts.push(omx, omy);\n }\n }\n else // inside miter is NOT ok\n {\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight)); // first segment's inner vertex\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight)); // first segment's outer vertex\n if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared)\n {\n // Nothing needed\n }\n else if (style.join === LINE_JOIN.ROUND)\n {\n if (clockwise) /* arc is outside */\n {\n indexCount += round(\n x1, y1,\n x1 + (perpx * outerWeight), y1 + (perpy * outerWeight),\n x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight),\n verts, true\n ) + 2;\n }\n else /* arc is inside */\n {\n indexCount += round(\n x1, y1,\n x1 - (perpx * innerWeight), y1 - (perpy * innerWeight),\n x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight),\n verts, false\n ) + 2;\n }\n }\n else\n {\n if (clockwise)\n {\n verts.push(omx, omy); // inner miter point\n verts.push(omx, omy); // inner miter point\n }\n else\n {\n verts.push(imx, imy); // outer miter point\n verts.push(imx, imy); // outer miter point\n }\n indexCount += 2;\n }\n verts.push(x1 - (perp1x * innerWeight), y1 - (perp1y * innerWeight)); // second segment's inner vertex\n verts.push(x1 + (perp1x * outerWeight), y1 + (perp1y * outerWeight)); // second segment's outer vertex\n indexCount += 2;\n }\n }\n\n x0 = points[(length - 2) * 2];\n y0 = points[((length - 2) * 2) + 1];\n\n x1 = points[(length - 1) * 2];\n y1 = points[((length - 1) * 2) + 1];\n\n perpx = -(y0 - y1);\n perpy = x0 - x1;\n\n dist = Math.sqrt((perpx * perpx) + (perpy * perpy));\n perpx /= dist;\n perpy /= dist;\n perpx *= width;\n perpy *= width;\n\n verts.push(x1 - (perpx * innerWeight), y1 - (perpy * innerWeight));\n verts.push(x1 + (perpx * outerWeight), y1 + (perpy * outerWeight));\n\n if (!closedShape)\n {\n if (style.cap === LINE_CAP.ROUND)\n {\n indexCount += round(\n x1 - (perpx * (innerWeight - outerWeight) * 0.5),\n y1 - (perpy * (innerWeight - outerWeight) * 0.5),\n x1 - (perpx * innerWeight),\n y1 - (perpy * innerWeight),\n x1 + (perpx * outerWeight),\n y1 + (perpy * outerWeight),\n verts,\n false\n ) + 2;\n }\n else if (style.cap === LINE_CAP.SQUARE)\n {\n indexCount += square(x1, y1, perpx, perpy, innerWeight, outerWeight, false, verts);\n }\n }\n\n const indices = graphicsGeometry.indices;\n const eps2 = GRAPHICS_CURVES.epsilon * GRAPHICS_CURVES.epsilon;\n\n // indices.push(indexStart);\n for (let i = indexStart; i < indexCount + indexStart - 2; ++i)\n {\n x0 = verts[(i * 2)];\n y0 = verts[(i * 2) + 1];\n\n x1 = verts[(i + 1) * 2];\n y1 = verts[((i + 1) * 2) + 1];\n\n x2 = verts[(i + 2) * 2];\n y2 = verts[((i + 2) * 2) + 1];\n\n /* Skip zero area triangles */\n if (Math.abs((x0 * (y1 - y2)) + (x1 * (y2 - y0)) + (x2 * (y0 - y1))) < eps2)\n {\n continue;\n }\n\n indices.push(i, i + 1, i + 2);\n }\n}\n\n/**\n * Builds a line to draw using the gl.drawArrays(gl.LINES) method\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nfunction buildNativeLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n let i = 0;\n\n const shape = graphicsData.shape as Polygon;\n const points = graphicsData.points || shape.points;\n const closedShape = shape.type !== SHAPES.POLY || shape.closeStroke;\n\n if (points.length === 0) return;\n\n const verts = graphicsGeometry.points;\n const indices = graphicsGeometry.indices;\n const length = points.length / 2;\n\n const startIndex = verts.length / 2;\n let currentIndex = startIndex;\n\n verts.push(points[0], points[1]);\n\n for (i = 1; i < length; i++)\n {\n verts.push(points[i * 2], points[(i * 2) + 1]);\n indices.push(currentIndex, currentIndex + 1);\n\n currentIndex++;\n }\n\n if (closedShape)\n {\n indices.push(currentIndex, startIndex);\n }\n}\n\n/**\n * Builds a line to draw\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {PIXI.GraphicsData} graphicsData - The graphics object containing all the necessary properties\n * @param {PIXI.GraphicsGeometry} graphicsGeometry - Geometry where to append output\n */\nexport function buildLine(graphicsData: GraphicsData, graphicsGeometry: GraphicsGeometry): void\n{\n if (graphicsData.lineStyle.native)\n {\n buildNativeLine(graphicsData, graphicsGeometry);\n }\n else\n {\n buildNonNativeLine(graphicsData, graphicsGeometry);\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\nimport { PI_2 } from '@pixi/math';\n\ninterface IArcLikeShape {\n cx: number;\n cy: number;\n radius: number;\n startAngle: number;\n endAngle: number;\n anticlockwise: boolean;\n}\n\n/**\n * Utilities for arc curves\n * @class\n * @private\n */\nexport class ArcUtils\n{\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @private\n * @param {number} x1 - The x-coordinate of the beginning of the arc\n * @param {number} y1 - The y-coordinate of the beginning of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {object} If the arc length is valid, return center of circle, radius and other info otherwise `null`.\n */\n static curveTo(x1: number, y1: number, x2: number, y2: number, radius: number, points: Array): IArcLikeShape\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const a1 = fromY - y1;\n const b1 = fromX - x1;\n const a2 = y2 - y1;\n const b2 = x2 - x1;\n const mm = Math.abs((a1 * b2) - (b1 * a2));\n\n if (mm < 1.0e-8 || radius === 0)\n {\n if (points[points.length - 2] !== x1 || points[points.length - 1] !== y1)\n {\n points.push(x1, y1);\n }\n\n return null;\n }\n\n const dd = (a1 * a1) + (b1 * b1);\n const cc = (a2 * a2) + (b2 * b2);\n const tt = (a1 * a2) + (b1 * b2);\n const k1 = radius * Math.sqrt(dd) / mm;\n const k2 = radius * Math.sqrt(cc) / mm;\n const j1 = k1 * tt / dd;\n const j2 = k2 * tt / cc;\n const cx = (k1 * b2) + (k2 * b1);\n const cy = (k1 * a2) + (k2 * a1);\n const px = b1 * (k2 + j1);\n const py = a1 * (k2 + j1);\n const qx = b2 * (k1 + j2);\n const qy = a2 * (k1 + j2);\n const startAngle = Math.atan2(py - cy, px - cx);\n const endAngle = Math.atan2(qy - cy, qx - cx);\n\n return {\n cx: (cx + x1),\n cy: (cy + y1),\n radius,\n startAngle,\n endAngle,\n anticlockwise: (b1 * a2 > b2 * a1),\n };\n }\n\n /* eslint-disable max-len */\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @private\n * @param {number} startX - Start x location of arc\n * @param {number} startY - Start y location of arc\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} anticlockwise - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @param {number[]} points - Collection of points to add to\n */\n static arc(_startX: number, _startY: number, cx: number, cy: number, radius: number,\n startAngle: number, endAngle: number, _anticlockwise: boolean, points: Array): void\n {\n const sweep = endAngle - startAngle;\n const n = GRAPHICS_CURVES._segmentsCount(\n Math.abs(sweep) * radius,\n Math.ceil(Math.abs(sweep) / PI_2) * 40\n );\n\n const theta = (sweep) / (n * 2);\n const theta2 = theta * 2;\n const cTheta = Math.cos(theta);\n const sTheta = Math.sin(theta);\n const segMinus = n - 1;\n const remainder = (segMinus % 1) / segMinus;\n\n for (let i = 0; i <= segMinus; ++i)\n {\n const real = i + (remainder * i);\n const angle = ((theta) + startAngle + (theta2 * real));\n const c = Math.cos(angle);\n const s = -Math.sin(angle);\n\n points.push(\n (((cTheta * c) + (sTheta * s)) * radius) + cx,\n (((cTheta * -s) + (sTheta * c)) * radius) + cy\n );\n }\n }\n /* eslint-enable max-len */\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for bezier curves\n * @class\n * @private\n */\nexport class BezierUtils\n{\n /**\n * Calculate length of bezier curve.\n * Analytical solution is impossible, since it involves an integral that does not integrate in general.\n * Therefore numerical solution is used.\n *\n * @private\n * @param {number} fromX - Starting point x\n * @param {number} fromY - Starting point y\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {number} Length of bezier curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number): number\n {\n const n = 10;\n let result = 0.0;\n let t = 0.0;\n let t2 = 0.0;\n let t3 = 0.0;\n let nt = 0.0;\n let nt2 = 0.0;\n let nt3 = 0.0;\n let x = 0.0;\n let y = 0.0;\n let dx = 0.0;\n let dy = 0.0;\n let prevX = fromX;\n let prevY = fromY;\n\n for (let i = 1; i <= n; ++i)\n {\n t = i / n;\n t2 = t * t;\n t3 = t2 * t;\n nt = (1.0 - t);\n nt2 = nt * nt;\n nt3 = nt2 * nt;\n\n x = (nt3 * fromX) + (3.0 * nt2 * t * cpX) + (3.0 * nt * t2 * cpX2) + (t3 * toX);\n y = (nt3 * fromY) + (3.0 * nt2 * t * cpY) + (3 * nt * t2 * cpY2) + (t3 * toY);\n dx = prevX - x;\n dy = prevY - y;\n prevX = x;\n prevY = y;\n\n result += Math.sqrt((dx * dx) + (dy * dy));\n }\n\n return result;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Path array to push points into\n */\n static curveTo(\n cpX: number, cpY: number,\n cpX2: number, cpY2: number,\n toX: number, toY: number,\n points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n points.length -= 2;\n\n const n = GRAPHICS_CURVES._segmentsCount(\n BezierUtils.curveLength(fromX, fromY, cpX, cpY, cpX2, cpY2, toX, toY)\n );\n\n let dt = 0;\n let dt2 = 0;\n let dt3 = 0;\n let t2 = 0;\n let t3 = 0;\n\n points.push(fromX, fromY);\n\n for (let i = 1, j = 0; i <= n; ++i)\n {\n j = i / n;\n\n dt = (1 - j);\n dt2 = dt * dt;\n dt3 = dt2 * dt;\n\n t2 = j * j;\n t3 = t2 * j;\n\n points.push(\n (dt3 * fromX) + (3 * dt2 * j * cpX) + (3 * dt * t2 * cpX2) + (t3 * toX),\n (dt3 * fromY) + (3 * dt2 * j * cpY) + (3 * dt * t2 * cpY2) + (t3 * toY)\n );\n }\n }\n}\n","import { GRAPHICS_CURVES } from '../const';\n\n/**\n * Utilities for quadratic curves\n * @class\n * @private\n */\nexport class QuadraticUtils\n{\n /**\n * Calculate length of quadratic curve\n * @see {@link http://www.malczak.linuxpl.com/blog/quadratic-bezier-curve-length/}\n * for the detailed explanation of math behind this.\n *\n * @private\n * @param {number} fromX - x-coordinate of curve start point\n * @param {number} fromY - y-coordinate of curve start point\n * @param {number} cpX - x-coordinate of curve control point\n * @param {number} cpY - y-coordinate of curve control point\n * @param {number} toX - x-coordinate of curve end point\n * @param {number} toY - y-coordinate of curve end point\n * @return {number} Length of quadratic curve\n */\n static curveLength(\n fromX: number, fromY: number,\n cpX: number, cpY: number,\n toX: number, toY: number): number\n {\n const ax = fromX - (2.0 * cpX) + toX;\n const ay = fromY - (2.0 * cpY) + toY;\n const bx = (2.0 * cpX) - (2.0 * fromX);\n const by = (2.0 * cpY) - (2.0 * fromY);\n const a = 4.0 * ((ax * ax) + (ay * ay));\n const b = 4.0 * ((ax * bx) + (ay * by));\n const c = (bx * bx) + (by * by);\n\n const s = 2.0 * Math.sqrt(a + b + c);\n const a2 = Math.sqrt(a);\n const a32 = 2.0 * a * a2;\n const c2 = 2.0 * Math.sqrt(c);\n const ba = b / a2;\n\n return (\n (a32 * s)\n + (a2 * b * (s - c2))\n + (\n ((4.0 * c * a) - (b * b))\n * Math.log(((2.0 * a2) + ba + s) / (ba + c2))\n )\n ) / (4.0 * a32);\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @private\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @param {number[]} points - Points to add segments to.\n */\n static curveTo(cpX: number, cpY: number, toX: number, toY: number, points: Array): void\n {\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n const n = GRAPHICS_CURVES._segmentsCount(\n QuadraticUtils.curveLength(fromX, fromY, cpX, cpY, toX, toY)\n );\n\n let xa = 0;\n let ya = 0;\n\n for (let i = 1; i <= n; ++i)\n {\n const j = i / n;\n\n xa = fromX + ((cpX - fromX) * j);\n ya = fromY + ((cpY - fromY) * j);\n\n points.push(xa + (((cpX + ((toX - cpX) * j)) - xa) * j),\n ya + (((cpY + ((toY - cpY) * j)) - ya) * j));\n }\n }\n}\n","import type { LineStyle } from '../styles/LineStyle';\nimport type { FillStyle } from '../styles/FillStyle';\n\n/**\n * A structure to hold interim batch objects for Graphics.\n * @class\n * @memberof PIXI.graphicsUtils\n */\nexport class BatchPart\n{\n public style: LineStyle | FillStyle;\n public start: number;\n public size: number;\n public attribStart: number;\n public attribSize: number;\n\n constructor()\n {\n this.reset();\n }\n\n /**\n * Begin batch part\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} style\n * @param {number} startIndex\n * @param {number} attribStart\n */\n public begin(style: LineStyle | FillStyle, startIndex: number, attribStart: number): void\n {\n this.reset();\n this.style = style;\n this.start = startIndex;\n this.attribStart = attribStart;\n }\n\n /**\n * End batch part\n *\n * @param {number} endIndex\n * @param {number} endAttrib\n */\n public end(endIndex: number, endAttrib: number): void\n {\n this.attribSize = endAttrib - this.attribStart;\n this.size = endIndex - this.start;\n }\n\n public reset(): void\n {\n this.style = null;\n this.size = 0;\n this.start = 0;\n this.attribStart = 0;\n this.attribSize = 0;\n }\n}\n","/**\n * Generalized convenience utilities for Graphics.\n *\n * @namespace graphicsUtils\n * @memberof PIXI\n */\n\nimport { buildPoly } from './buildPoly';\nexport { buildPoly };\n\nimport { buildCircle } from './buildCircle';\nexport { buildCircle };\n\nimport { buildRectangle } from './buildRectangle';\nexport { buildRectangle };\n\nimport { buildRoundedRectangle } from './buildRoundedRectangle';\nexport { buildRoundedRectangle };\n\nexport * from './buildLine';\nexport * from './ArcUtils';\nexport * from './BezierUtils';\nexport * from './QuadraticUtils';\nexport * from './BatchPart';\n\n// for type only\nimport { BatchPart } from './BatchPart';\nimport { SHAPES } from '@pixi/math';\nimport { BatchDrawCall } from '@pixi/core';\nimport { IShapeBuildCommand } from './IShapeBuildCommand';\n\n/**\n * Map of fill commands for each shape type.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Object} FILL_COMMANDS\n */\nexport const FILL_COMMANDS: Record = {\n [SHAPES.POLY]: buildPoly,\n [SHAPES.CIRC]: buildCircle,\n [SHAPES.ELIP]: buildCircle,\n [SHAPES.RECT]: buildRectangle,\n [SHAPES.RREC]: buildRoundedRectangle,\n};\n\n/**\n * Batch pool, stores unused batches for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} BATCH_POOL\n */\nexport const BATCH_POOL: Array = [];\n\n/**\n * Draw call pool, stores unused draw calls for preventing allocations.\n *\n * @memberof PIXI.graphicsUtils\n * @member {Array} DRAW_CALL_POOL\n */\nexport const DRAW_CALL_POOL: Array = [];\n","import { Polygon } from '@pixi/math';\n\n/**\n * Determine if polygon is clockwise or counterclockwise.\n * @see {@link https://stackoverflow.com/questions/1165647}\n *\n * Ignored from docs since it is not directly exposed.\n *\n * @ignore\n * @private\n * @param {Polygon} polygon\n * @return {boolean}\n */\nexport function isPolygonClockwise(polygon: Polygon): boolean\n{\n const points = polygon.points;\n\n let sum = 0;\n\n for (let i = 0; i < points.length - 2; i += 2)\n {\n sum += (points[i + 2] - points[i]) * (points[i + 3] + points[i + 1]);\n }\n\n return sum > 0;\n}\n","import type { Matrix, SHAPES, IShape } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/**\n * A class to contain data useful for Graphics objects\n *\n * @class\n * @memberof PIXI\n */\nexport class GraphicsData\n{\n shape: IShape;\n lineStyle: LineStyle;\n fillStyle: FillStyle;\n matrix: Matrix;\n type: SHAPES;\n\n /** The collection of points. */\n points: number[] = [];\n\n /**\n * The collection of holes.\n *\n * @member {PIXI.GraphicsData[]}\n */\n holes: Array = [];\n /**\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} [fillStyle] - the width of the line to draw\n * @param {PIXI.LineStyle} [lineStyle] - the color of the line to draw\n * @param {PIXI.Matrix} [matrix] - Transform matrix\n */\n constructor(shape: IShape, fillStyle: FillStyle = null, lineStyle: LineStyle = null, matrix: Matrix = null)\n {\n /**\n * The shape object to draw.\n * @member {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle}\n */\n this.shape = shape;\n\n /**\n * The style of the line.\n * @member {PIXI.LineStyle}\n */\n this.lineStyle = lineStyle;\n\n /**\n * The style of the fill.\n * @member {PIXI.FillStyle}\n */\n this.fillStyle = fillStyle;\n\n /**\n * The transform matrix.\n * @member {PIXI.Matrix}\n */\n this.matrix = matrix;\n\n /**\n * The type of the shape, see the Const.Shapes file for all the existing types,\n * @member {number}\n */\n this.type = shape.type;\n }\n\n /**\n * Creates a new GraphicsData object with the same values as this one.\n *\n * @return {PIXI.GraphicsData} Cloned GraphicsData object\n */\n public clone(): GraphicsData\n {\n return new GraphicsData(\n this.shape,\n this.fillStyle,\n this.lineStyle,\n this.matrix\n );\n }\n\n /**\n * Destroys the Graphics data.\n *\n */\n public destroy(): void\n {\n this.shape = null;\n this.holes.length = 0;\n this.holes = null;\n this.points.length = 0;\n this.points = null;\n this.lineStyle = null;\n this.fillStyle = null;\n }\n}\n","import {\n buildLine,\n buildPoly,\n BatchPart,\n FILL_COMMANDS,\n BATCH_POOL,\n DRAW_CALL_POOL,\n} from './utils';\n\nimport {\n BatchGeometry,\n BatchDrawCall,\n BatchTextureArray,\n BaseTexture,\n Texture,\n} from '@pixi/core';\n\nimport { isPolygonClockwise } from './utils/isPolygonClockwise';\nimport { DRAW_MODES, WRAP_MODES } from '@pixi/constants';\nimport { SHAPES, Point, Matrix } from '@pixi/math';\nimport { GraphicsData } from './GraphicsData';\nimport { premultiplyTint } from '@pixi/utils';\nimport { Bounds } from '@pixi/display';\n\nimport type { Circle, Ellipse, Polygon, Rectangle, RoundedRectangle, IPointData } from '@pixi/math';\nimport type { FillStyle } from './styles/FillStyle';\nimport type { LineStyle } from './styles/LineStyle';\n\n/*\n * Complex shape type\n * @todo Move to Math shapes\n */\ntype IShape = Circle | Ellipse | Polygon | Rectangle | RoundedRectangle;\n\nconst tmpPoint = new Point();\nconst tmpBounds = new Bounds();\n\n/**\n * The Graphics class contains methods used to draw primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them.\n *\n * GraphicsGeometry is designed to not be continually updating the geometry since it's expensive\n * to re-tesselate using **earcut**. Consider using {@link PIXI.Mesh} for this use-case, it's much faster.\n *\n * @class\n * @extends PIXI.BatchGeometry\n * @memberof PIXI\n */\nexport class GraphicsGeometry extends BatchGeometry\n{\n /**\n * The maximum number of points to consider an object \"batchable\",\n * able to be batched by the renderer's batch system.\n\\ */\n public static BATCHABLE_SIZE = 100;\n\n /**\n * Minimal distance between points that are considered different.\n * Affects line tesselation.\n */\n public closePointEps = 1e-4;\n\n /** Padding to add to the bounds. */\n public boundsPadding = 0;\n\n uvsFloat32: Float32Array = null;\n indicesUint16: Uint16Array | Uint32Array = null;\n batchable = false;\n\n /** An array of points to draw, 2 numbers per point */\n points: number[] = [];\n\n /** The collection of colors */\n colors: number[] = [];\n\n /** The UVs collection */\n uvs: number[] = [];\n\n /** The indices of the vertices */\n indices: number[] = [];\n\n /** Reference to the texture IDs. */\n textureIds: number[] = [];\n\n /**\n * The collection of drawn shapes.\n *\n * @member {PIXI.GraphicsData[]}\n */\n graphicsData: Array = [];\n\n /**\n * List of current draw calls drived from the batches.\n *\n * @member {PIXI.BatchDrawCall[]}\n */\n drawCalls: Array = [];\n\n /** Batches need to regenerated if the geometry is updated. */\n batchDirty = -1;\n\n /**\n * Intermediate abstract format sent to batch system.\n * Can be converted to drawCalls or to batchable objects.\n *\n * @member {PIXI.graphicsUtils.BatchPart[]}\n */\n batches: Array = [];\n\n /** Used to detect if the graphics object has changed. */\n protected dirty = 0;\n\n /** Used to check if the cache is dirty. */\n protected cacheDirty = -1;\n\n /** Used to detect if we cleared the graphicsData. */\n protected clearDirty = 0;\n\n /** Index of the last batched shape in the stack of calls. */\n protected shapeIndex = 0;\n\n /**\n * Cached bounds.\n *\n * @member {PIXI.Bounds}\n */\n protected _bounds: Bounds = new Bounds();\n\n /** The bounds dirty flag. */\n protected boundsDirty = -1;\n\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor()\n {\n super();\n }\n\n /**\n * Get the current bounds of the graphic geometry.\n *\n * @member {PIXI.Bounds}\n * @readonly\n */\n public get bounds(): Bounds\n {\n if (this.boundsDirty !== this.dirty)\n {\n this.boundsDirty = this.dirty;\n this.calculateBounds();\n }\n\n return this._bounds;\n }\n\n /**\n * Call if you changed graphicsData manually.\n * Empties all batch buffers.\n */\n protected invalidate(): void\n {\n this.boundsDirty = -1;\n this.dirty++;\n this.batchDirty++;\n this.shapeIndex = 0;\n\n this.points.length = 0;\n this.colors.length = 0;\n this.uvs.length = 0;\n this.indices.length = 0;\n this.textureIds.length = 0;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batchPart = this.batches[i];\n\n batchPart.reset();\n BATCH_POOL.push(batchPart);\n }\n\n this.batches.length = 0;\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.GraphicsGeometry} This GraphicsGeometry object. Good for chaining method calls\n */\n public clear(): GraphicsGeometry\n {\n if (this.graphicsData.length > 0)\n {\n this.invalidate();\n this.clearDirty++;\n this.graphicsData.length = 0;\n }\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.FillStyle} fillStyle - Defines style of the fill.\n * @param {PIXI.LineStyle} lineStyle - Defines style of the lines.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawShape(\n shape: IShape,\n fillStyle: FillStyle = null,\n lineStyle: LineStyle = null,\n matrix: Matrix = null): GraphicsGeometry\n {\n const data = new GraphicsData(shape, fillStyle, lineStyle, matrix);\n\n this.graphicsData.push(data);\n this.dirty++;\n\n return this;\n }\n\n /**\n * Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - The shape object to draw.\n * @param {PIXI.Matrix} matrix - Transform applied to the points of the shape.\n * @return {PIXI.GraphicsGeometry} Returns geometry for chaining.\n */\n public drawHole(shape: IShape, matrix: Matrix = null): GraphicsGeometry\n {\n if (!this.graphicsData.length)\n {\n return null;\n }\n\n const data = new GraphicsData(shape, null, null, matrix);\n\n const lastShape = this.graphicsData[this.graphicsData.length - 1];\n\n data.lineStyle = lastShape.lineStyle;\n\n lastShape.holes.push(data);\n\n this.dirty++;\n\n return this;\n }\n\n /**\n * Destroys the GraphicsGeometry object.\n *\n */\n public destroy(): void\n {\n super.destroy();\n\n // destroy each of the GraphicsData objects\n for (let i = 0; i < this.graphicsData.length; ++i)\n {\n this.graphicsData[i].destroy();\n }\n\n this.points.length = 0;\n this.points = null;\n this.colors.length = 0;\n this.colors = null;\n this.uvs.length = 0;\n this.uvs = null;\n this.indices.length = 0;\n this.indices = null;\n this.indexBuffer.destroy();\n this.indexBuffer = null;\n this.graphicsData.length = 0;\n this.graphicsData = null;\n this.drawCalls.length = 0;\n this.drawCalls = null;\n this.batches.length = 0;\n this.batches = null;\n this._bounds = null;\n }\n\n /**\n * Check to see if a point is contained within this geometry.\n *\n * @param {PIXI.IPointData} point - Point to check if it's contained.\n * @return {Boolean} `true` if the point is contained within geometry.\n */\n public containsPoint(point: IPointData): boolean\n {\n const graphicsData = this.graphicsData;\n\n for (let i = 0; i < graphicsData.length; ++i)\n {\n const data = graphicsData[i];\n\n if (!data.fillStyle.visible)\n {\n continue;\n }\n\n // only deal with fills..\n if (data.shape)\n {\n if (data.matrix)\n {\n data.matrix.applyInverse(point, tmpPoint);\n }\n else\n {\n tmpPoint.copyFrom(point);\n }\n\n if (data.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n let hitHole = false;\n\n if (data.holes)\n {\n for (let i = 0; i < data.holes.length; i++)\n {\n const hole = data.holes[i];\n\n if (hole.shape.contains(tmpPoint.x, tmpPoint.y))\n {\n hitHole = true;\n break;\n }\n }\n }\n\n if (!hitHole)\n {\n return true;\n }\n }\n }\n }\n\n return false;\n }\n\n /**\n * Generates intermediate batch data. Either gets converted to drawCalls\n * or used to convert to batch objects directly by the Graphics object.\n *\n * @param {boolean} [allow32Indices] - Allow using 32-bit indices for preventing artifacts when more that 65535 vertices\n */\n updateBatches(allow32Indices?: boolean): void\n {\n if (!this.graphicsData.length)\n {\n this.batchable = true;\n\n return;\n }\n\n if (!this.validateBatching())\n {\n return;\n }\n\n this.cacheDirty = this.dirty;\n\n const uvs = this.uvs;\n const graphicsData = this.graphicsData;\n\n let batchPart: BatchPart = null;\n\n let currentStyle = null;\n\n if (this.batches.length > 0)\n {\n batchPart = this.batches[this.batches.length - 1];\n currentStyle = batchPart.style;\n }\n\n for (let i = this.shapeIndex; i < graphicsData.length; i++)\n {\n this.shapeIndex++;\n\n const data = graphicsData[i];\n const fillStyle = data.fillStyle;\n const lineStyle = data.lineStyle;\n const command = FILL_COMMANDS[data.type];\n\n // build out the shapes points..\n command.build(data);\n\n if (data.matrix)\n {\n this.transformPoints(data.points, data.matrix);\n }\n\n for (let j = 0; j < 2; j++)\n {\n const style = (j === 0) ? fillStyle : lineStyle;\n\n if (!style.visible) continue;\n\n const nextTexture = style.texture.baseTexture;\n const index = this.indices.length;\n const attribIndex = this.points.length / 2;\n\n nextTexture.wrapMode = WRAP_MODES.REPEAT;\n\n if (j === 0)\n {\n this.processFill(data);\n }\n else\n {\n this.processLine(data);\n }\n\n const size = (this.points.length / 2) - attribIndex;\n\n if (size === 0) continue;\n // close batch if style is different\n if (batchPart && !this._compareStyles(currentStyle, style))\n {\n batchPart.end(index, attribIndex);\n batchPart = null;\n }\n // spawn new batch if its first batch or previous was closed\n if (!batchPart)\n {\n batchPart = BATCH_POOL.pop() || new BatchPart();\n batchPart.begin(style, index, attribIndex);\n this.batches.push(batchPart);\n currentStyle = style;\n }\n\n this.addUvs(this.points, uvs, style.texture, attribIndex, size, style.matrix);\n }\n }\n\n const index = this.indices.length;\n const attrib = this.points.length / 2;\n\n if (batchPart)\n {\n batchPart.end(index, attrib);\n }\n\n if (this.batches.length === 0)\n {\n // there are no visible styles in GraphicsData\n // its possible that someone wants Graphics just for the bounds\n this.batchable = true;\n\n return;\n }\n\n // prevent allocation when length is same as buffer\n if (this.indicesUint16 && this.indices.length === this.indicesUint16.length)\n {\n this.indicesUint16.set(this.indices);\n }\n else\n {\n const need32\n = attrib > 0xffff && allow32Indices;\n\n this.indicesUint16 = need32 ? new Uint32Array(this.indices) : new Uint16Array(this.indices);\n }\n\n // TODO make this a const..\n this.batchable = this.isBatchable();\n\n if (this.batchable)\n {\n this.packBatches();\n }\n else\n {\n this.buildDrawCalls();\n }\n }\n\n /**\n * Affinity check\n *\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleA\n * @param {PIXI.FillStyle | PIXI.LineStyle} styleB\n */\n protected _compareStyles(styleA: FillStyle | LineStyle, styleB: FillStyle | LineStyle): boolean\n {\n if (!styleA || !styleB)\n {\n return false;\n }\n\n if (styleA.texture.baseTexture !== styleB.texture.baseTexture)\n {\n return false;\n }\n\n if (styleA.color + styleA.alpha !== styleB.color + styleB.alpha)\n {\n return false;\n }\n\n if (!!(styleA as LineStyle).native !== !!(styleB as LineStyle).native)\n {\n return false;\n }\n\n return true;\n }\n\n /**\n * Test geometry for batching process.\n *\n * @protected\n */\n protected validateBatching(): boolean\n {\n if (this.dirty === this.cacheDirty || !this.graphicsData.length)\n {\n return false;\n }\n\n for (let i = 0, l = this.graphicsData.length; i < l; i++)\n {\n const data = this.graphicsData[i];\n const fill = data.fillStyle;\n const line = data.lineStyle;\n\n if (fill && !fill.texture.baseTexture.valid) return false;\n if (line && !line.texture.baseTexture.valid) return false;\n }\n\n return true;\n }\n\n /**\n * Offset the indices so that it works with the batcher.\n *\n * @protected\n */\n protected packBatches(): void\n {\n this.batchDirty++;\n this.uvsFloat32 = new Float32Array(this.uvs);\n\n const batches = this.batches;\n\n for (let i = 0, l = batches.length; i < l; i++)\n {\n const batch = batches[i];\n\n for (let j = 0; j < batch.size; j++)\n {\n const index = batch.start + j;\n\n this.indicesUint16[index] = this.indicesUint16[index] - batch.attribStart;\n }\n }\n }\n\n /**\n * Checks to see if this graphics geometry can be batched.\n * Currently it needs to be small enough and not contain any native lines.\n *\n * @protected\n */\n protected isBatchable(): boolean\n {\n // prevent heavy mesh batching\n if (this.points.length > 0xffff * 2)\n {\n return false;\n }\n\n const batches = this.batches;\n\n for (let i = 0; i < batches.length; i++)\n {\n if ((batches[i].style as LineStyle).native)\n {\n return false;\n }\n }\n\n return (this.points.length < GraphicsGeometry.BATCHABLE_SIZE * 2);\n }\n\n /**\n * Converts intermediate batches data to drawCalls.\n *\n * @protected\n */\n protected buildDrawCalls(): void\n {\n let TICK = ++BaseTexture._globalBatch;\n\n for (let i = 0; i < this.drawCalls.length; i++)\n {\n this.drawCalls[i].texArray.clear();\n DRAW_CALL_POOL.push(this.drawCalls[i]);\n }\n\n this.drawCalls.length = 0;\n\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n let currentGroup: BatchDrawCall = DRAW_CALL_POOL.pop();\n\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n currentGroup.texArray.count = 0;\n currentGroup.start = 0;\n currentGroup.size = 0;\n currentGroup.type = DRAW_MODES.TRIANGLES;\n\n let textureCount = 0;\n let currentTexture = null;\n let textureId = 0;\n let native = false;\n let drawMode = DRAW_MODES.TRIANGLES;\n\n let index = 0;\n\n this.drawCalls.push(currentGroup);\n\n // TODO - this can be simplified\n for (let i = 0; i < this.batches.length; i++)\n {\n const data = this.batches[i];\n\n // TODO add some full on MAX_TEXTURE CODE..\n const MAX_TEXTURES = 8;\n\n // Forced cast for checking `native` without errors\n const style = data.style as LineStyle;\n\n const nextTexture = style.texture.baseTexture;\n\n if (native !== !!style.native)\n {\n native = !!style.native;\n drawMode = native ? DRAW_MODES.LINES : DRAW_MODES.TRIANGLES;\n\n // force the batch to break!\n currentTexture = null;\n textureCount = MAX_TEXTURES;\n TICK++;\n }\n\n if (currentTexture !== nextTexture)\n {\n currentTexture = nextTexture;\n\n if (nextTexture._batchEnabled !== TICK)\n {\n if (textureCount === MAX_TEXTURES)\n {\n TICK++;\n\n textureCount = 0;\n\n if (currentGroup.size > 0)\n {\n currentGroup = DRAW_CALL_POOL.pop();\n if (!currentGroup)\n {\n currentGroup = new BatchDrawCall();\n currentGroup.texArray = new BatchTextureArray();\n }\n this.drawCalls.push(currentGroup);\n }\n\n currentGroup.start = index;\n currentGroup.size = 0;\n currentGroup.texArray.count = 0;\n currentGroup.type = drawMode;\n }\n\n // TODO add this to the render part..\n // Hack! Because texture has protected `touched`\n nextTexture.touched = 1;// touch;\n\n nextTexture._batchEnabled = TICK;\n nextTexture._batchLocation = textureCount;\n nextTexture.wrapMode = WRAP_MODES.REPEAT;\n\n currentGroup.texArray.elements[currentGroup.texArray.count++] = nextTexture;\n textureCount++;\n }\n }\n\n currentGroup.size += data.size;\n index += data.size;\n\n textureId = nextTexture._batchLocation;\n\n this.addColors(colors, style.color, style.alpha, data.attribSize, data.attribStart);\n this.addTextureIds(textureIds, textureId, data.attribSize, data.attribStart);\n }\n\n BaseTexture._globalBatch = TICK;\n\n // upload..\n // merge for now!\n this.packAttributes();\n }\n\n /**\n * Packs attributes to single buffer.\n *\n * @protected\n */\n protected packAttributes(): void\n {\n const verts = this.points;\n const uvs = this.uvs;\n const colors = this.colors;\n const textureIds = this.textureIds;\n\n // verts are 2 positions.. so we * by 3 as there are 6 properties.. then 4 cos its bytes\n const glPoints = new ArrayBuffer(verts.length * 3 * 4);\n const f32 = new Float32Array(glPoints);\n const u32 = new Uint32Array(glPoints);\n\n let p = 0;\n\n for (let i = 0; i < verts.length / 2; i++)\n {\n f32[p++] = verts[i * 2];\n f32[p++] = verts[(i * 2) + 1];\n\n f32[p++] = uvs[i * 2];\n f32[p++] = uvs[(i * 2) + 1];\n\n u32[p++] = colors[i];\n\n f32[p++] = textureIds[i];\n }\n\n this._buffer.update(glPoints);\n this._indexBuffer.update(this.indicesUint16);\n }\n\n /**\n * Process fill part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processFill(data: GraphicsData): void\n {\n if (data.holes.length)\n {\n this.processHoles(data.holes);\n\n buildPoly.triangulate(data, this);\n }\n else\n {\n const command = FILL_COMMANDS[data.type];\n\n command.triangulate(data, this);\n }\n }\n\n /**\n * Process line part of Graphics.\n *\n * @param {PIXI.GraphicsData} data\n * @protected\n */\n protected processLine(data: GraphicsData): void\n {\n buildLine(data, this);\n\n for (let i = 0; i < data.holes.length; i++)\n {\n buildLine(data.holes[i], this);\n }\n }\n\n /**\n * Process the holes data.\n *\n * @param {PIXI.GraphicsData[]} holes - Holes to render\n * @protected\n */\n protected processHoles(holes: Array): void\n {\n for (let i = 0; i < holes.length; i++)\n {\n const hole = holes[i];\n const command = FILL_COMMANDS[hole.type];\n\n command.build(hole);\n\n if (hole.matrix)\n {\n this.transformPoints(hole.points, hole.matrix);\n }\n }\n }\n\n /**\n * Update the local bounds of the object. Expensive to use performance-wise.\n *\n * @protected\n */\n protected calculateBounds(): void\n {\n const bounds = this._bounds;\n const sequenceBounds = tmpBounds;\n let curMatrix = Matrix.IDENTITY;\n\n this._bounds.clear();\n sequenceBounds.clear();\n\n for (let i = 0; i < this.graphicsData.length; i++)\n {\n const data = this.graphicsData[i];\n const shape = data.shape;\n const type = data.type;\n const lineStyle = data.lineStyle;\n const nextMatrix = data.matrix || Matrix.IDENTITY;\n let lineWidth = 0.0;\n\n if (lineStyle && lineStyle.visible)\n {\n const alignment = lineStyle.alignment;\n\n lineWidth = lineStyle.width;\n\n if (type === SHAPES.POLY)\n {\n if (isPolygonClockwise(shape as Polygon))\n {\n lineWidth = lineWidth * (1 - alignment);\n }\n else\n {\n lineWidth = lineWidth * alignment;\n }\n }\n else\n {\n lineWidth = lineWidth * Math.max(0, alignment);\n }\n }\n\n if (curMatrix !== nextMatrix)\n {\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n sequenceBounds.clear();\n }\n curMatrix = nextMatrix;\n }\n\n if (type === SHAPES.RECT || type === SHAPES.RREC)\n {\n const rect = shape as Rectangle | RoundedRectangle;\n\n sequenceBounds.addFramePad(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height,\n lineWidth, lineWidth);\n }\n else if (type === SHAPES.CIRC)\n {\n const circle = shape as Circle;\n\n sequenceBounds.addFramePad(circle.x, circle.y, circle.x, circle.y,\n circle.radius + lineWidth, circle.radius + lineWidth);\n }\n else if (type === SHAPES.ELIP)\n {\n const ellipse = shape as Ellipse;\n\n sequenceBounds.addFramePad(ellipse.x, ellipse.y, ellipse.x, ellipse.y,\n ellipse.width + lineWidth, ellipse.height + lineWidth);\n }\n else\n {\n const poly = shape as Polygon;\n // adding directly to the bounds\n\n bounds.addVerticesMatrix(curMatrix, (poly.points as any), 0, poly.points.length, lineWidth, lineWidth);\n }\n }\n\n if (!sequenceBounds.isEmpty())\n {\n bounds.addBoundsMatrix(sequenceBounds, curMatrix);\n }\n\n bounds.pad(this.boundsPadding, this.boundsPadding);\n }\n\n /**\n * Transform points using matrix.\n *\n * @protected\n * @param {number[]} points - Points to transform\n * @param {PIXI.Matrix} matrix - Transform matrix\n */\n protected transformPoints(points: Array, matrix: Matrix): void\n {\n for (let i = 0; i < points.length / 2; i++)\n {\n const x = points[(i * 2)];\n const y = points[(i * 2) + 1];\n\n points[(i * 2)] = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n points[(i * 2) + 1] = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n }\n }\n\n /**\n * Add colors.\n *\n * @protected\n * @param {number[]} colors - List of colors to add to\n * @param {number} color - Color to add\n * @param {number} alpha - Alpha to use\n * @param {number} size - Number of colors to add\n * @param {number} offset\n */\n protected addColors(\n colors: Array,\n color: number,\n alpha: number,\n size: number,\n offset = 0): void\n {\n // TODO use the premultiply bits Ivan added\n const rgb = (color >> 16) + (color & 0xff00) + ((color & 0xff) << 16);\n\n const rgba = premultiplyTint(rgb, alpha);\n\n colors.length = Math.max(colors.length, offset + size);\n\n for (let i = 0; i < size; i++)\n {\n colors[offset + i] = rgba;\n }\n }\n\n /**\n * Add texture id that the shader/fragment wants to use.\n *\n * @protected\n * @param {number[]} textureIds\n * @param {number} id\n * @param {number} size\n * @param {number} offset\n */\n protected addTextureIds(\n textureIds: Array,\n id: number,\n size: number,\n offset = 0): void\n {\n textureIds.length = Math.max(textureIds.length, offset + size);\n\n for (let i = 0; i < size; i++)\n {\n textureIds[offset + i] = id;\n }\n }\n\n /**\n * Generates the UVs for a shape.\n *\n * @protected\n * @param {number[]} verts - Vertices\n * @param {number[]} uvs - UVs\n * @param {PIXI.Texture} texture - Reference to Texture\n * @param {number} start - Index buffer start index.\n * @param {number} size - The size/length for index buffer.\n * @param {PIXI.Matrix} [matrix] - Optional transform for all points.\n */\n protected addUvs(\n verts: Array,\n uvs: Array,\n texture: Texture,\n start: number, size:\n number, matrix:\n Matrix = null): void\n {\n let index = 0;\n const uvsStart = uvs.length;\n const frame = texture.frame;\n\n while (index < size)\n {\n let x = verts[(start + index) * 2];\n let y = verts[((start + index) * 2) + 1];\n\n if (matrix)\n {\n const nx = (matrix.a * x) + (matrix.c * y) + matrix.tx;\n\n y = (matrix.b * x) + (matrix.d * y) + matrix.ty;\n x = nx;\n }\n\n index++;\n\n uvs.push(x / frame.width, y / frame.height);\n }\n\n const baseTexture = texture.baseTexture;\n\n if (frame.width < baseTexture.width\n || frame.height < baseTexture.height)\n {\n this.adjustUvs(uvs, texture, uvsStart, size);\n }\n }\n\n /**\n * Modify uvs array according to position of texture region\n * Does not work with rotated or trimmed textures\n *\n * @param {number[]} uvs - array\n * @param {PIXI.Texture} texture - region\n * @param {number} start - starting index for uvs\n * @param {number} size - how many points to adjust\n */\n protected adjustUvs(uvs: Array, texture: Texture, start: number, size: number): void\n {\n const baseTexture = texture.baseTexture;\n const eps = 1e-6;\n const finish = start + (size * 2);\n const frame = texture.frame;\n const scaleX = frame.width / baseTexture.width;\n const scaleY = frame.height / baseTexture.height;\n let offsetX = frame.x / frame.width;\n let offsetY = frame.y / frame.height;\n let minX = Math.floor(uvs[start] + eps);\n let minY = Math.floor(uvs[start + 1] + eps);\n\n for (let i = start + 2; i < finish; i += 2)\n {\n minX = Math.min(minX, Math.floor(uvs[i] + eps));\n minY = Math.min(minY, Math.floor(uvs[i + 1] + eps));\n }\n offsetX -= minX;\n offsetY -= minY;\n for (let i = start; i < finish; i += 2)\n {\n uvs[i] = (uvs[i] + offsetX) * scaleX;\n uvs[i + 1] = (uvs[i + 1] + offsetY) * scaleY;\n }\n }\n}\n","import { FillStyle } from './FillStyle';\nimport { LINE_JOIN, LINE_CAP } from '../const';\n\n/**\n * Represents the line style for Graphics.\n * @memberof PIXI\n * @class\n * @extends PIXI.FillStyle\n */\nexport class LineStyle extends FillStyle\n{\n /** The width (thickness) of any lines drawn. */\n public width = 0;\n\n /** The alignment of any lines drawn (0.5 = middle, 1 = outer, 0 = inner). WebGL only. */\n public alignment = 0.5;\n\n /** If true the lines will be draw using LINES instead of TRIANGLE_STRIP */\n public native = false;\n\n /**\n * Line cap style.\n *\n * @member {PIXI.LINE_CAP}\n * @default PIXI.LINE_CAP.BUTT\n */\n public cap = LINE_CAP.BUTT;\n\n /**\n * Line join style.\n *\n * @member {PIXI.LINE_JOIN}\n * @default PIXI.LINE_JOIN.MITER\n */\n public join = LINE_JOIN.MITER;\n\n /** Miter limit. */\n public miterLimit = 10;\n\n /**\n * Clones the object\n *\n * @return {PIXI.LineStyle}\n */\n public clone(): LineStyle\n {\n const obj = new LineStyle();\n\n obj.color = this.color;\n obj.alpha = this.alpha;\n obj.texture = this.texture;\n obj.matrix = this.matrix;\n obj.visible = this.visible;\n obj.width = this.width;\n obj.alignment = this.alignment;\n obj.native = this.native;\n obj.cap = this.cap;\n obj.join = this.join;\n obj.miterLimit = this.miterLimit;\n\n return obj;\n }\n\n /**\n * Reset the line style to default.\n */\n public reset(): void\n {\n super.reset();\n\n // Override default line style color\n this.color = 0x0;\n\n this.alignment = 0.5;\n this.width = 0;\n this.native = false;\n }\n}\n","import {\n Circle,\n Ellipse,\n PI_2,\n Point,\n Polygon,\n Rectangle,\n RoundedRectangle,\n Matrix,\n SHAPES,\n} from '@pixi/math';\n\nimport { Texture, UniformGroup, State, Renderer, BatchDrawCall, Shader } from '@pixi/core';\nimport { BezierUtils, QuadraticUtils, ArcUtils } from './utils';\nimport { hex2rgb } from '@pixi/utils';\nimport { GraphicsGeometry } from './GraphicsGeometry';\nimport { FillStyle } from './styles/FillStyle';\nimport { LineStyle } from './styles/LineStyle';\nimport { BLEND_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\n\nimport type { IShape, IPointData } from '@pixi/math';\nimport type { IDestroyOptions } from '@pixi/display';\nimport { LINE_JOIN, LINE_CAP } from './const';\n\n/**\n * Batch element computed from Graphics geometry\n */\nexport interface IGraphicsBatchElement {\n vertexData: Float32Array;\n blendMode: BLEND_MODES;\n indices: Uint16Array | Uint32Array;\n uvs: Float32Array;\n alpha: number;\n worldAlpha: number;\n _batchRGB: number[];\n _tintRGB: number;\n _texture: Texture;\n}\n\nexport interface IFillStyleOptions {\n color?: number;\n alpha?: number;\n texture?: Texture;\n matrix?: Matrix;\n}\n\nexport interface ILineStyleOptions extends IFillStyleOptions {\n width?: number;\n alignment?: number;\n native?: boolean;\n cap?: LINE_CAP;\n join?: LINE_JOIN;\n miterLimit?: number;\n}\n\nconst temp = new Float32Array(3);\n\n// a default shaders map used by graphics..\nconst DEFAULT_SHADERS: {[key: string]: Shader} = {};\n\nexport interface Graphics extends GlobalMixins.Graphics, Container {}\n\n/**\n * The Graphics class is primarily used to render primitive shapes such as lines, circles and\n * rectangles to the display, and to color and fill them. However, you can also use a Graphics\n * object to build a list of primitives to use as a mask, or as a complex hitArea.\n *\n * Please note that due to legacy naming conventions, the behavior of some functions in this class\n * can be confusing. Each call to `drawRect()`, `drawPolygon()`, etc. actually stores that primitive\n * in the Geometry class's GraphicsGeometry object for later use in rendering or hit testing - the\n * functions do not directly draw anything to the screen. Similarly, the `clear()` function doesn't\n * change the screen, it simply resets the list of primitives, which can be useful if you want to\n * rebuild the contents of an existing Graphics object.\n *\n * Once a GraphicsGeometry list is built, you can re-use it in other Geometry objects as\n * an optimization, by passing it into a new Geometry object's constructor. Because of this\n * ability, it's important to call `destroy()` on Geometry objects once you are done with them, to\n * properly dereference each GraphicsGeometry and prevent memory leaks.\n *\n * @class\n * @extends PIXI.Container\n * @memberof PIXI\n */\nexport class Graphics extends Container\n{\n /**\n * Temporary point to use for containsPoint\n *\n * @static\n * @private\n */\n static _TEMP_POINT = new Point();\n\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Graphics objects.\n */\n public shader: Shader = null;\n\n /** Renderer plugin for batching */\n public pluginName = 'batch';\n\n /**\n * Current path\n *\n * @member {PIXI.Polygon}\n * @readonly\n */\n public currentPath: Polygon = null;\n\n /**\n * A collections of batches! These can be drawn by the renderer batch system.\n *\n * @member {PIXI.IGraphicsBatchElement[]}\n */\n protected batches: Array = [];\n\n /** Update dirty for limiting calculating tints for batches. */\n protected batchTint = -1;\n\n /** Update dirty for limiting calculating batches.*/\n protected batchDirty = -1;\n\n /** Copy of the object vertex data. */\n protected vertexData: Float32Array = null;\n\n /**\n * Current fill style\n *\n * @member {PIXI.FillStyle}\n */\n protected _fillStyle: FillStyle = new FillStyle();\n\n /**\n * Current line style\n *\n * @member {PIXI.LineStyle}\n */\n protected _lineStyle: LineStyle = new LineStyle();\n\n /**\n * Current shape transform matrix.\n *\n * @member {PIXI.Matrix}\n */\n protected _matrix: Matrix = null;\n\n /** Current hole mode is enabled. */\n protected _holeMode = false;\n protected _transformID: number;\n protected _tint: number;\n\n /**\n * Represents the WebGL state the Graphics required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n *\n * @member {PIXI.State}\n */\n private state: State = State.for2d();\n private _geometry: GraphicsGeometry;\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh or Graphics objects.\n *\n * @member {PIXI.GraphicsGeometry}\n * @readonly\n */\n public get geometry(): GraphicsGeometry\n {\n return this._geometry;\n }\n\n /**\n * @param {PIXI.GraphicsGeometry} [geometry=null] - Geometry to use, if omitted\n * will create a new GraphicsGeometry instance.\n */\n constructor(geometry: GraphicsGeometry = null)\n {\n super();\n\n this._geometry = geometry || new GraphicsGeometry();\n this._geometry.refCount++;\n\n /**\n * When cacheAsBitmap is set to true the graphics object will be rendered as if it was a sprite.\n * This is useful if your graphics element does not change often, as it will speed up the rendering\n * of the object in exchange for taking up texture memory. It is also useful if you need the graphics\n * object to be anti-aliased, because it will be rendered using canvas. This is not recommended if\n * you are constantly redrawing the graphics element.\n *\n * @name cacheAsBitmap\n * @member {boolean}\n * @memberof PIXI.Graphics#\n * @default false\n */\n\n this._transformID = -1;\n\n // Set default\n this.tint = 0xFFFFFF;\n this.blendMode = BLEND_MODES.NORMAL;\n }\n\n /**\n * Creates a new Graphics object with the same values as this one.\n * Note that only the geometry of the object is cloned, not its transform (position,scale,etc)\n *\n * @return {PIXI.Graphics} A clone of the graphics object\n */\n public clone(): Graphics\n {\n this.finishPoly();\n\n return new Graphics(this._geometry);\n }\n\n /**\n * The blend mode to be applied to the graphic shape. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode. Note that, since each\n * primitive in the GraphicsGeometry list is rendered sequentially, modes\n * such as `PIXI.BLEND_MODES.ADD` and `PIXI.BLEND_MODES.MULTIPLY` will\n * be applied per-primitive.\n *\n * @member {number}\n * @default PIXI.BLEND_MODES.NORMAL;\n * @see PIXI.BLEND_MODES\n */\n public set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n public get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n /**\n * The tint applied to each graphic shape. This is a hex value. A value of\n * 0xFFFFFF will remove any tint effect.\n *\n * @member {number}\n * @default 0xFFFFFF\n */\n public get tint(): number\n {\n return this._tint;\n }\n\n public set tint(value: number)\n {\n this._tint = value;\n }\n\n /**\n * The current fill style.\n *\n * @member {PIXI.FillStyle}\n * @readonly\n */\n public get fill(): FillStyle\n {\n return this._fillStyle;\n }\n\n /**\n * The current line style.\n *\n * @member {PIXI.LineStyle}\n * @readonly\n */\n public get line(): LineStyle\n {\n return this._lineStyle;\n }\n\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {number} [width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer).\n * WebGL only.\n * @param {boolean} [native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineStyle(width: number, color?: number, alpha?: number, alignment?: number, native?: boolean): this;\n\n /**\n * Specifies the line style used for subsequent calls to Graphics methods such as the lineTo()\n * method or the drawCircle() method.\n *\n * @param {object} [options] - Line style options\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer).\n * WebGL only.\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineStyle(options?: ILineStyleOptions): this;\n\n public lineStyle(options: ILineStyleOptions | number = null,\n color = 0x0, alpha = 1, alignment = 0.5, native = false): this\n {\n // Support non-object params: (width, color, alpha, alignment, native)\n if (typeof options === 'number')\n {\n options = { width: options, color, alpha, alignment, native } as ILineStyleOptions;\n }\n\n return this.lineTextureStyle(options);\n }\n\n /**\n * Like line style but support texture for line fill.\n *\n * @param {object} [options] - Collection of options for setting line style.\n * @param {number} [options.width=0] - width of the line to draw, will update the objects stored style\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to use\n * @param {number} [options.color=0x0] - color of the line to draw, will update the objects stored style.\n * Default 0xFFFFFF if texture present.\n * @param {number} [options.alpha=1] - alpha of the line to draw, will update the objects stored style\n * @param {PIXI.Matrix} [options.matrix=null] - Texture matrix to transform texture\n * @param {number} [options.alignment=0.5] - alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer).\n * WebGL only.\n * @param {boolean} [options.native=false] - If true the lines will be draw using LINES instead of TRIANGLE_STRIP\n * @param {PIXI.LINE_CAP}[options.cap=PIXI.LINE_CAP.BUTT] - line cap style\n * @param {PIXI.LINE_JOIN}[options.join=PIXI.LINE_JOIN.MITER] - line join style\n * @param {number}[options.miterLimit=10] - miter limit ratio\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTextureStyle(options: ILineStyleOptions): this\n {\n // Apply defaults\n options = Object.assign({\n width: 0,\n texture: Texture.WHITE,\n color: (options && options.texture) ? 0xFFFFFF : 0x0,\n alpha: 1,\n matrix: null,\n alignment: 0.5,\n native: false,\n cap: LINE_CAP.BUTT,\n join: LINE_JOIN.MITER,\n miterLimit: 10,\n }, options);\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.width > 0 && options.alpha > 0;\n\n if (!visible)\n {\n this._lineStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._lineStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Start a polygon object internally\n * @protected\n */\n protected startPoly(): void\n {\n if (this.currentPath)\n {\n const points = this.currentPath.points;\n const len = this.currentPath.points.length;\n\n if (len > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n this.currentPath.points.push(points[len - 2], points[len - 1]);\n }\n }\n else\n {\n this.currentPath = new Polygon();\n this.currentPath.closeStroke = false;\n }\n }\n\n /**\n * Finish the polygon object.\n * @protected\n */\n finishPoly(): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length > 2)\n {\n this.drawShape(this.currentPath);\n this.currentPath = null;\n }\n else\n {\n this.currentPath.points.length = 0;\n }\n }\n }\n\n /**\n * Moves the current drawing position to x, y.\n *\n * @param {number} x - the X coordinate to move to\n * @param {number} y - the Y coordinate to move to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public moveTo(x: number, y: number): this\n {\n this.startPoly();\n this.currentPath.points[0] = x;\n this.currentPath.points[1] = y;\n\n return this;\n }\n\n /**\n * Draws a line using the current line style from the current drawing position to (x, y);\n * The current drawing position is then set to (x, y).\n *\n * @param {number} x - the X coordinate to draw to\n * @param {number} y - the Y coordinate to draw to\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public lineTo(x: number, y: number): this\n {\n if (!this.currentPath)\n {\n this.moveTo(0, 0);\n }\n\n // remove duplicates..\n const points = this.currentPath.points;\n const fromX = points[points.length - 2];\n const fromY = points[points.length - 1];\n\n if (fromX !== x || fromY !== y)\n {\n points.push(x, y);\n }\n\n return this;\n }\n\n /**\n * Initialize the curve\n *\n * @param {number} [x=0]\n * @param {number} [y=0]\n */\n protected _initCurve(x = 0, y = 0): void\n {\n if (this.currentPath)\n {\n if (this.currentPath.points.length === 0)\n {\n this.currentPath.points = [x, y];\n }\n }\n else\n {\n this.moveTo(x, y);\n }\n }\n\n /**\n * Calculate the points for a quadratic bezier curve and then draws it.\n * Based on: https://stackoverflow.com/questions/785097/how-do-i-implement-a-bezier-curve-in-c\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n const points = this.currentPath.points;\n\n if (points.length === 0)\n {\n this.moveTo(0, 0);\n }\n\n QuadraticUtils.curveTo(cpX, cpY, toX, toY, points);\n\n return this;\n }\n\n /**\n * Calculate the points for a bezier curve and then draws it.\n *\n * @param {number} cpX - Control point x\n * @param {number} cpY - Control point y\n * @param {number} cpX2 - Second Control point x\n * @param {number} cpY2 - Second Control point y\n * @param {number} toX - Destination point x\n * @param {number} toY - Destination point y\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number): this\n {\n this._initCurve();\n\n BezierUtils.curveTo(cpX, cpY, cpX2, cpY2, toX, toY, this.currentPath.points);\n\n return this;\n }\n\n /**\n * The arcTo() method creates an arc/curve between two tangents on the canvas.\n *\n * \"borrowed\" from https://code.google.com/p/fxcanvas/ - thanks google!\n *\n * @param {number} x1 - The x-coordinate of the first tangent point of the arc\n * @param {number} y1 - The y-coordinate of the first tangent point of the arc\n * @param {number} x2 - The x-coordinate of the end of the arc\n * @param {number} y2 - The y-coordinate of the end of the arc\n * @param {number} radius - The radius of the arc\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): this\n {\n this._initCurve(x1, y1);\n\n const points = this.currentPath.points;\n\n const result = ArcUtils.curveTo(x1, y1, x2, y2, radius, points);\n\n if (result)\n {\n const { cx, cy, radius, startAngle, endAngle, anticlockwise } = result;\n\n this.arc(cx, cy, radius, startAngle, endAngle, anticlockwise);\n }\n\n return this;\n }\n\n /**\n * The arc method creates an arc/curve (used to create circles, or parts of circles).\n *\n * @param {number} cx - The x-coordinate of the center of the circle\n * @param {number} cy - The y-coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @param {number} startAngle - The starting angle, in radians (0 is at the 3 o'clock position\n * of the arc's circle)\n * @param {number} endAngle - The ending angle, in radians\n * @param {boolean} [anticlockwise=false] - Specifies whether the drawing should be\n * counter-clockwise or clockwise. False is default, and indicates clockwise, while true\n * indicates counter-clockwise.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public arc(cx: number, cy: number, radius: number, startAngle: number, endAngle: number, anticlockwise = false): this\n {\n if (startAngle === endAngle)\n {\n return this;\n }\n\n if (!anticlockwise && endAngle <= startAngle)\n {\n endAngle += PI_2;\n }\n else if (anticlockwise && startAngle <= endAngle)\n {\n startAngle += PI_2;\n }\n\n const sweep = endAngle - startAngle;\n\n if (sweep === 0)\n {\n return this;\n }\n\n const startX = cx + (Math.cos(startAngle) * radius);\n const startY = cy + (Math.sin(startAngle) * radius);\n const eps = this._geometry.closePointEps;\n\n // If the currentPath exists, take its points. Otherwise call `moveTo` to start a path.\n let points = this.currentPath ? this.currentPath.points : null;\n\n if (points)\n {\n // TODO: make a better fix.\n\n // We check how far our start is from the last existing point\n const xDiff = Math.abs(points[points.length - 2] - startX);\n const yDiff = Math.abs(points[points.length - 1] - startY);\n\n if (xDiff < eps && yDiff < eps)\n {\n // If the point is very close, we don't add it, since this would lead to artifacts\n // during tessellation due to floating point imprecision.\n }\n else\n {\n points.push(startX, startY);\n }\n }\n else\n {\n this.moveTo(startX, startY);\n points = this.currentPath.points;\n }\n\n ArcUtils.arc(startX, startY, cx, cy, radius, startAngle, endAngle, anticlockwise, points);\n\n return this;\n }\n\n /**\n * Specifies a simple one-color fill that subsequent calls to other Graphics methods\n * (such as lineTo() or drawCircle()) use when drawing.\n *\n * @param {number} [color=0] - the color of the fill\n * @param {number} [alpha=1] - the alpha of the fill\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public beginFill(color = 0, alpha = 1): this\n {\n return this.beginTextureFill({ texture: Texture.WHITE, color, alpha });\n }\n\n /**\n * Begin the texture fill\n *\n * @param {object} [options] - Object object.\n * @param {PIXI.Texture} [options.texture=PIXI.Texture.WHITE] - Texture to fill\n * @param {number} [options.color=0xffffff] - Background to fill behind texture\n * @param {number} [options.alpha=1] - Alpha of fill\n * @param {PIXI.Matrix} [options.matrix=null] - Transform matrix\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n beginTextureFill(options?: IFillStyleOptions): this\n {\n // Apply defaults\n options = Object.assign({\n texture: Texture.WHITE,\n color: 0xFFFFFF,\n alpha: 1,\n matrix: null,\n }, options) as IFillStyleOptions;\n\n if (this.currentPath)\n {\n this.startPoly();\n }\n\n const visible = options.alpha > 0;\n\n if (!visible)\n {\n this._fillStyle.reset();\n }\n else\n {\n if (options.matrix)\n {\n options.matrix = options.matrix.clone();\n options.matrix.invert();\n }\n\n Object.assign(this._fillStyle, { visible }, options);\n }\n\n return this;\n }\n\n /**\n * Applies a fill to the lines and shapes that were added since the last call to the beginFill() method.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public endFill(): this\n {\n this.finishPoly();\n\n this._fillStyle.reset();\n\n return this;\n }\n\n /**\n * Draws a rectangle shape.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRect(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Rectangle(x, y, width, height));\n }\n\n /**\n * Draw a rectangle shape with rounded/beveled corners.\n *\n * @param {number} x - The X coord of the top-left of the rectangle\n * @param {number} y - The Y coord of the top-left of the rectangle\n * @param {number} width - The width of the rectangle\n * @param {number} height - The height of the rectangle\n * @param {number} radius - Radius of the rectangle corners\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawRoundedRect(x: number, y: number, width: number, height: number, radius: number): this\n {\n return this.drawShape(new RoundedRectangle(x, y, width, height, radius));\n }\n\n /**\n * Draws a circle.\n *\n * @param {number} x - The X coordinate of the center of the circle\n * @param {number} y - The Y coordinate of the center of the circle\n * @param {number} radius - The radius of the circle\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawCircle(x: number, y: number, radius: number): this\n {\n return this.drawShape(new Circle(x, y, radius));\n }\n\n /**\n * Draws an ellipse.\n *\n * @param {number} x - The X coordinate of the center of the ellipse\n * @param {number} y - The Y coordinate of the center of the ellipse\n * @param {number} width - The half width of the ellipse\n * @param {number} height - The half height of the ellipse\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawEllipse(x: number, y: number, width: number, height: number): this\n {\n return this.drawShape(new Ellipse(x, y, width, height));\n }\n\n public drawPolygon(...path: Array | Array): this\n public drawPolygon(path: Array | Array | Polygon): this\n\n /**\n * Draws a polygon using the given path.\n *\n * @param {number[]|PIXI.Point[]|PIXI.Polygon} path - The path data used to construct the polygon.\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawPolygon(...path: any[]): this\n {\n let points: Array | Array;\n let closeStroke = true;// !!this._fillStyle;\n\n const poly = path[0] as Polygon;\n\n // check if data has points..\n if (poly.points)\n {\n closeStroke = poly.closeStroke;\n points = poly.points;\n }\n else\n if (Array.isArray(path[0]))\n {\n points = path[0];\n }\n else\n {\n points = path;\n }\n\n const shape = new Polygon(points);\n\n shape.closeStroke = closeStroke;\n\n this.drawShape(shape);\n\n return this;\n }\n\n /**\n * Draw any shape.\n *\n * @param {PIXI.Circle|PIXI.Ellipse|PIXI.Polygon|PIXI.Rectangle|PIXI.RoundedRectangle} shape - Shape to draw\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public drawShape(shape: IShape): this\n {\n if (!this._holeMode)\n {\n this._geometry.drawShape(\n shape,\n this._fillStyle.clone(),\n this._lineStyle.clone(),\n this._matrix\n );\n }\n else\n {\n this._geometry.drawHole(shape, this._matrix);\n }\n\n return this;\n }\n\n /**\n * Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.\n *\n * @return {PIXI.Graphics} This Graphics object. Good for chaining method calls\n */\n public clear(): this\n {\n this._geometry.clear();\n this._lineStyle.reset();\n this._fillStyle.reset();\n\n this._boundsID++;\n this._matrix = null;\n this._holeMode = false;\n this.currentPath = null;\n\n return this;\n }\n\n /**\n * True if graphics consists of one rectangle, and thus, can be drawn like a Sprite and\n * masked with gl.scissor.\n *\n * @returns {boolean} True if only 1 rect.\n */\n public isFastRect(): boolean\n {\n const data = this._geometry.graphicsData;\n\n return data.length === 1\n && data[0].shape.type === SHAPES.RECT\n && !data[0].holes.length\n && !(data[0].lineStyle.visible && data[0].lineStyle.width);\n }\n\n /**\n * Renders the object using the WebGL renderer\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(renderer: Renderer): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n const hasuint32 = renderer.context.supports.uint32Indices;\n // batch part..\n // batch it!\n\n geometry.updateBatches(hasuint32);\n\n if (geometry.batchable)\n {\n if (this.batchDirty !== geometry.batchDirty)\n {\n this._populateBatches();\n }\n\n this._renderBatched(renderer);\n }\n else\n {\n // no batching...\n renderer.batch.flush();\n\n this._renderDirect(renderer);\n }\n }\n\n /** Populating batches for rendering. */\n protected _populateBatches(): void\n {\n const geometry = this._geometry;\n const blendMode = this.blendMode;\n const len = geometry.batches.length;\n\n this.batchTint = -1;\n this._transformID = -1;\n this.batchDirty = geometry.batchDirty;\n this.batches.length = len;\n\n this.vertexData = new Float32Array(geometry.points);\n\n for (let i = 0; i < len; i++)\n {\n const gI = geometry.batches[i];\n const color = gI.style.color;\n const vertexData = new Float32Array(this.vertexData.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const uvs = new Float32Array(geometry.uvsFloat32.buffer,\n gI.attribStart * 4 * 2,\n gI.attribSize * 2);\n\n const indices = new Uint16Array(geometry.indicesUint16.buffer,\n gI.start * 2,\n gI.size);\n\n const batch = {\n vertexData,\n blendMode,\n indices,\n uvs,\n _batchRGB: hex2rgb(color) as Array,\n _tintRGB: color,\n _texture: gI.style.texture,\n alpha: gI.style.alpha,\n worldAlpha: 1 };\n\n this.batches[i] = batch;\n }\n }\n\n /**\n * Renders the batches using the BathedRenderer plugin\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderBatched(renderer: Renderer): void\n {\n if (!this.batches.length)\n {\n return;\n }\n\n renderer.batch.setObjectRenderer(renderer.plugins[this.pluginName]);\n\n this.calculateVertices();\n this.calculateTints();\n\n for (let i = 0, l = this.batches.length; i < l; i++)\n {\n const batch = this.batches[i];\n\n batch.worldAlpha = this.worldAlpha * batch.alpha;\n\n renderer.plugins[this.pluginName].render(batch);\n }\n }\n\n /**\n * Renders the graphics direct\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _renderDirect(renderer: Renderer): void\n {\n const shader = this._resolveDirectShader(renderer);\n\n const geometry = this._geometry;\n const tint = this.tint;\n const worldAlpha = this.worldAlpha;\n const uniforms = shader.uniforms;\n const drawCalls = geometry.drawCalls;\n\n // lets set the transfomr\n uniforms.translationMatrix = this.transform.worldTransform;\n\n // and then lets set the tint..\n uniforms.tint[0] = (((tint >> 16) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[1] = (((tint >> 8) & 0xFF) / 255) * worldAlpha;\n uniforms.tint[2] = ((tint & 0xFF) / 255) * worldAlpha;\n uniforms.tint[3] = worldAlpha;\n\n // the first draw call, we can set the uniforms of the shader directly here.\n\n // this means that we can tack advantage of the sync function of pixi!\n // bind and sync uniforms..\n // there is a way to optimise this..\n renderer.shader.bind(shader);\n renderer.geometry.bind(geometry, shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // then render the rest of them...\n for (let i = 0, l = drawCalls.length; i < l; i++)\n {\n this._renderDrawCallDirect(renderer, geometry.drawCalls[i]);\n }\n }\n\n /**\n * Renders specific DrawCall\n *\n * @param {PIXI.Renderer} renderer\n * @param {PIXI.BatchDrawCall} drawCall\n */\n protected _renderDrawCallDirect(renderer: Renderer, drawCall: BatchDrawCall): void\n {\n const { texArray, type, size, start } = drawCall;\n const groupTextureCount = texArray.count;\n\n for (let j = 0; j < groupTextureCount; j++)\n {\n renderer.texture.bind(texArray.elements[j], j);\n }\n\n renderer.geometry.draw(type, size, start);\n }\n\n /**\n * Resolves shader for direct rendering\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _resolveDirectShader(renderer: Renderer): Shader\n {\n let shader = this.shader;\n\n const pluginName = this.pluginName;\n\n if (!shader)\n {\n // if there is no shader here, we can use the default shader.\n // and that only gets created if we actually need it..\n // but may be more than one plugins for graphics\n if (!DEFAULT_SHADERS[pluginName])\n {\n const MAX_TEXTURES = renderer.plugins.batch.MAX_TEXTURES;\n const sampleValues = new Int32Array(MAX_TEXTURES);\n\n for (let i = 0; i < MAX_TEXTURES; i++)\n {\n sampleValues[i] = i;\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: UniformGroup.from({ uSamplers: sampleValues }, true),\n };\n\n const program = renderer.plugins[pluginName]._shader.program;\n\n DEFAULT_SHADERS[pluginName] = new Shader(program, uniforms);\n }\n\n shader = DEFAULT_SHADERS[pluginName];\n }\n\n return shader;\n }\n\n /** Retrieves the bounds of the graphic shape as a rectangle object. */\n protected _calculateBounds(): void\n {\n this.finishPoly();\n\n const geometry = this._geometry;\n\n // skipping when graphics is empty, like a container\n if (!geometry.graphicsData.length)\n {\n return;\n }\n\n const { minX, minY, maxX, maxY } = geometry.bounds;\n\n this._bounds.addFrame(this.transform, minX, minY, maxX, maxY);\n }\n\n /**\n * Tests if a point is inside this graphics object\n *\n * @param {PIXI.IPointData} point - the point to test\n * @return {boolean} the result of the test\n */\n public containsPoint(point: IPointData): boolean\n {\n this.worldTransform.applyInverse(point, Graphics._TEMP_POINT);\n\n return this._geometry.containsPoint(Graphics._TEMP_POINT);\n }\n\n /** Recalculate the tint by applying tint to batches using Graphics tint. */\n protected calculateTints(): void\n {\n if (this.batchTint !== this.tint)\n {\n this.batchTint = this.tint;\n\n const tintRGB = hex2rgb(this.tint, temp);\n\n for (let i = 0; i < this.batches.length; i++)\n {\n const batch = this.batches[i];\n\n const batchTint = batch._batchRGB;\n\n const r = (tintRGB[0] * batchTint[0]) * 255;\n const g = (tintRGB[1] * batchTint[1]) * 255;\n const b = (tintRGB[2] * batchTint[2]) * 255;\n\n // TODO Ivan, can this be done in one go?\n const color = (r << 16) + (g << 8) + (b | 0);\n\n batch._tintRGB = (color >> 16)\n + (color & 0xff00)\n + ((color & 0xff) << 16);\n }\n }\n }\n\n /**\n * If there's a transform update or a change to the shape of the\n * geometry, recalculate the vertices.\n */\n protected calculateVertices(): void\n {\n const wtID = this.transform._worldID;\n\n if (this._transformID === wtID)\n {\n return;\n }\n\n this._transformID = wtID;\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const data = this._geometry.points;// batch.vertexDataOriginal;\n const vertexData = this.vertexData;\n\n let count = 0;\n\n for (let i = 0; i < data.length; i += 2)\n {\n const x = data[i];\n const y = data[i + 1];\n\n vertexData[count++] = (a * x) + (c * y) + tx;\n vertexData[count++] = (d * y) + (b * x) + ty;\n }\n }\n\n /**\n * Closes the current path.\n *\n * @return {PIXI.Graphics} Returns itself.\n */\n public closePath(): this\n {\n const currentPath = this.currentPath;\n\n if (currentPath)\n {\n // we don't need to add extra point in the end because buildLine will take care of that\n currentPath.closeStroke = true;\n // ensure that the polygon is completed, and is available for hit detection\n // (even if the graphics is not rendered yet)\n this.finishPoly();\n }\n\n return this;\n }\n\n /**\n * Apply a matrix to the positional data.\n *\n * @param {PIXI.Matrix} matrix - Matrix to use for transform current shape.\n * @return {PIXI.Graphics} Returns itself.\n */\n public setMatrix(matrix: Matrix): this\n {\n this._matrix = matrix;\n\n return this;\n }\n\n /**\n * Begin adding holes to the last draw shape\n * IMPORTANT: holes must be fully inside a shape to work\n * Also weirdness ensues if holes overlap!\n * Ellipses, Circles, Rectangles and Rounded Rectangles cannot be holes or host for holes in CanvasRenderer,\n * please use `moveTo` `lineTo`, `quadraticCurveTo` if you rely on pixi-legacy bundle.\n * @return {PIXI.Graphics} Returns itself.\n */\n public beginHole(): this\n {\n this.finishPoly();\n this._holeMode = true;\n\n return this;\n }\n\n /**\n * End adding holes to the last draw shape\n * @return {PIXI.Graphics} Returns itself.\n */\n public endHole(): this\n {\n this.finishPoly();\n this._holeMode = false;\n\n return this;\n }\n\n /**\n * Destroys the Graphics object.\n *\n * @param {object|boolean} [options] - Options parameter. A boolean will act as if all\n * options have been set to that value\n * @param {boolean} [options.children=false] - if set to true, all the children will have\n * their destroy method called as well. 'options' will be passed on to those calls.\n * @param {boolean} [options.texture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n public destroy(options?: IDestroyOptions|boolean): void\n {\n this._geometry.refCount--;\n if (this._geometry.refCount === 0)\n {\n this._geometry.dispose();\n }\n\n this._matrix = null;\n this.currentPath = null;\n this._lineStyle.destroy();\n this._lineStyle = null;\n this._fillStyle.destroy();\n this._fillStyle = null;\n this._geometry = null;\n this.shader = null;\n this.vertexData = null;\n this.batches.length = 0;\n this.batches = null;\n\n super.destroy(options);\n }\n}\n","import type { TextureMatrix, Buffer } from '@pixi/core';\n\n/**\n * Class controls cache for UV mapping from Texture normal space to BaseTexture normal space.\n *\n * @class\n * @memberof PIXI\n */\nexport class MeshBatchUvs\n{\n public readonly data: Float32Array;\n public uvBuffer: Buffer;\n public uvMatrix: TextureMatrix;\n\n private _bufferUpdateId: number;\n private _textureUpdateId: number;\n\n // Internal-only properties\n _updateID: number;\n\n /**\n * @param {PIXI.Buffer} uvBuffer - Buffer with normalized uv's\n * @param {PIXI.TextureMatrix} uvMatrix - Material UV matrix\n */\n constructor(uvBuffer: Buffer, uvMatrix: TextureMatrix)\n {\n /**\n * Buffer with normalized UV's\n * @member {PIXI.Buffer}\n */\n this.uvBuffer = uvBuffer;\n\n /**\n * Material UV matrix\n * @member {PIXI.TextureMatrix}\n */\n this.uvMatrix = uvMatrix;\n\n /**\n * UV Buffer data\n * @member {Float32Array}\n * @readonly\n */\n this.data = null;\n\n this._bufferUpdateId = -1;\n\n this._textureUpdateId = -1;\n\n this._updateID = 0;\n }\n\n /**\n * updates\n *\n * @param {boolean} [forceUpdate] - force the update\n */\n public update(forceUpdate?: boolean): void\n {\n if (!forceUpdate\n && this._bufferUpdateId === this.uvBuffer._updateID\n && this._textureUpdateId === this.uvMatrix._updateID\n )\n {\n return;\n }\n\n this._bufferUpdateId = this.uvBuffer._updateID;\n this._textureUpdateId = this.uvMatrix._updateID;\n\n const data = this.uvBuffer.data as Float32Array;\n\n if (!this.data || this.data.length !== data.length)\n {\n (this.data as any) = new Float32Array(data.length);\n }\n\n this.uvMatrix.multiplyUvs(data, this.data);\n\n this._updateID++;\n }\n}\n","import { Shader, State } from '@pixi/core';\nimport { Point, Polygon } from '@pixi/math';\nimport { BLEND_MODES, DRAW_MODES } from '@pixi/constants';\nimport { Container } from '@pixi/display';\nimport { settings } from '@pixi/settings';\nimport { MeshBatchUvs } from './MeshBatchUvs';\nimport { MeshMaterial } from './MeshMaterial';\n\nimport type { IDestroyOptions } from '@pixi/display';\nimport type { Texture, Renderer, Geometry, Buffer } from '@pixi/core';\nimport type { IPointData } from '@pixi/math';\n\nconst tempPoint = new Point();\nconst tempPolygon = new Polygon();\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Mesh extends GlobalMixins.Mesh {}\n\n/**\n * Base mesh class.\n *\n * This class empowers you to have maximum flexibility to render any kind of WebGL visuals you can think of.\n * This class assumes a certain level of WebGL knowledge.\n * If you know a bit this should abstract enough away to make your life easier!\n *\n * Pretty much ALL WebGL can be broken down into the following:\n * - Geometry - The structure and data for the mesh. This can include anything from positions, uvs, normals, colors etc..\n * - Shader - This is the shader that PixiJS will render the geometry with (attributes in the shader must match the geometry)\n * - State - This is the state of WebGL required to render the mesh.\n *\n * Through a combination of the above elements you can render anything you want, 2D or 3D!\n *\n * @memberof PIXI\n */\nexport class Mesh extends Container\n{\n /**\n * Represents the vertex and fragment shaders that processes the geometry and runs on the GPU.\n * Can be shared between multiple Mesh objects.\n *\n * @type {PIXI.Shader|PIXI.MeshMaterial}\n */\n public shader: T;\n\n /**\n * Represents the WebGL state the Mesh required to render, excludes shader and geometry. E.g.,\n * blend mode, culling, depth testing, direction of rendering triangles, backface, etc.\n */\n public state: State;\n\n /** The way the Mesh should be drawn, can be any of the {@link PIXI.DRAW_MODES} constants. */\n public drawMode: DRAW_MODES;\n\n /**\n * Typically the index of the IndexBuffer where to start drawing.\n *\n * @default 0\n */\n public start: number;\n\n /**\n * How much of the geometry to draw, by default `0` renders everything.\n *\n * @default 0\n */\n public size: number;\n\n private _geometry: Geometry;\n\n /** This is the caching layer used by the batcher. */\n private vertexData: Float32Array;\n\n /**\n * If geometry is changed used to decide to re-transform\n * the vertexData.\n */\n private vertexDirty: number;\n private _transformID: number;\n\n /** Internal roundPixels field. */\n private _roundPixels: boolean;\n\n /** Batched UV's are cached for atlas textures. */\n private batchUvs: MeshBatchUvs;\n\n // Internal-only properties\n /**\n * These are used as easy access for batching.\n *\n * @private\n */\n uvs: Float32Array;\n\n /**\n * These are used as easy access for batching.\n *\n * @private\n */\n indices: Uint16Array;\n _tintRGB: number;\n _texture: Texture;\n\n /**\n * @param geometry - The geometry the mesh will use.\n * @param {PIXI.MeshMaterial} shader - The shader the mesh will use.\n * @param state - The state that the WebGL context is required to be in to render the mesh\n * if no state is provided, uses {@link PIXI.State.for2d} to create a 2D state for PixiJS.\n * @param drawMode - The drawMode, can be any of the {@link PIXI.DRAW_MODES} constants.\n */\n constructor(geometry: Geometry, shader: T, state?: State, drawMode: DRAW_MODES = DRAW_MODES.TRIANGLES)\n {\n super();\n\n this.geometry = geometry;\n this.shader = shader;\n this.state = state || State.for2d();\n this.drawMode = drawMode;\n this.start = 0;\n this.size = 0;\n\n this.uvs = null;\n this.indices = null;\n this.vertexData = new Float32Array(1);\n this.vertexDirty = -1;\n\n this._transformID = -1;\n this._roundPixels = settings.ROUND_PIXELS;\n this.batchUvs = null;\n }\n\n /**\n * Includes vertex positions, face indices, normals, colors, UVs, and\n * custom attributes within buffers, reducing the cost of passing all\n * this data to the GPU. Can be shared between multiple Mesh objects.\n */\n get geometry(): Geometry\n {\n return this._geometry;\n }\n\n set geometry(value: Geometry)\n {\n if (this._geometry === value)\n {\n return;\n }\n\n if (this._geometry)\n {\n this._geometry.refCount--;\n\n if (this._geometry.refCount === 0)\n {\n this._geometry.dispose();\n }\n }\n\n this._geometry = value;\n\n if (this._geometry)\n {\n this._geometry.refCount++;\n }\n\n this.vertexDirty = -1;\n }\n\n /**\n * To change mesh uv's, change its uvBuffer data and increment its _updateID.\n *\n * @readonly\n */\n get uvBuffer(): Buffer\n {\n return this.geometry.buffers[1];\n }\n\n /**\n * To change mesh vertices, change its uvBuffer data and increment its _updateID.\n * Incrementing _updateID is optional because most of Mesh objects do it anyway.\n *\n * @readonly\n */\n get verticesBuffer(): Buffer\n {\n return this.geometry.buffers[0];\n }\n\n /** Alias for {@link PIXI.Mesh#shader}. */\n set material(value: T)\n {\n this.shader = value;\n }\n\n get material(): T\n {\n return this.shader;\n }\n\n /**\n * The blend mode to be applied to the Mesh. Apply a value of\n * `PIXI.BLEND_MODES.NORMAL` to reset the blend mode.\n *\n * @default PIXI.BLEND_MODES.NORMAL;\n */\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\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 false\n */\n set roundPixels(value: boolean)\n {\n if (this._roundPixels !== value)\n {\n this._transformID = -1;\n }\n this._roundPixels = value;\n }\n\n get roundPixels(): boolean\n {\n return this._roundPixels;\n }\n\n /**\n * The multiply tint applied to the Mesh. This is a hex value. A value of\n * `0xFFFFFF` will remove any tint effect.\n *\n * Null for non-MeshMaterial shaders\n *\n * @default 0xFFFFFF\n */\n get tint(): number\n {\n return 'tint' in this.shader ? (this.shader as unknown as MeshMaterial).tint : null;\n }\n\n set tint(value: number)\n {\n (this.shader as unknown as MeshMaterial).tint = value;\n }\n\n /**\n * The texture that the Mesh uses.\n *\n * Null for non-MeshMaterial shaders\n */\n get texture(): Texture\n {\n return 'texture' in this.shader ? (this.shader as unknown as MeshMaterial).texture : null;\n }\n\n set texture(value: Texture)\n {\n (this.shader as unknown as MeshMaterial).texture = value;\n }\n\n /**\n * Standard renderer draw.\n *\n * @param renderer - Instance to renderer.\n */\n protected _render(renderer: Renderer): void\n {\n // set properties for batching..\n // TODO could use a different way to grab verts?\n const vertices = this.geometry.buffers[0].data;\n const shader = this.shader as unknown as MeshMaterial;\n\n // TODO benchmark check for attribute size..\n if (\n shader.batchable\n && this.drawMode === DRAW_MODES.TRIANGLES\n && vertices.length < Mesh.BATCHABLE_SIZE * 2\n )\n {\n this._renderToBatch(renderer);\n }\n else\n {\n this._renderDefault(renderer);\n }\n }\n\n /**\n * Standard non-batching way of rendering.\n *\n * @param renderer - Instance to renderer.\n */\n protected _renderDefault(renderer: Renderer): void\n {\n const shader = this.shader as unknown as MeshMaterial;\n\n shader.alpha = this.worldAlpha;\n if (shader.update)\n {\n shader.update();\n }\n\n renderer.batch.flush();\n\n // bind and sync uniforms..\n shader.uniforms.translationMatrix = this.transform.worldTransform.toArray(true);\n renderer.shader.bind(shader);\n\n // set state..\n renderer.state.set(this.state);\n\n // bind the geometry...\n renderer.geometry.bind(this.geometry, shader);\n\n // then render it\n renderer.geometry.draw(this.drawMode, this.size, this.start, this.geometry.instanceCount);\n }\n\n /**\n * Rendering by using the Batch system.\n *\n * @param renderer - Instance to renderer.\n */\n protected _renderToBatch(renderer: Renderer): void\n {\n const geometry = this.geometry;\n const shader = this.shader as unknown as MeshMaterial;\n\n if (shader.uvMatrix)\n {\n shader.uvMatrix.update();\n this.calculateUvs();\n }\n\n // set properties for batching..\n this.calculateVertices();\n this.indices = geometry.indexBuffer.data as Uint16Array;\n this._tintRGB = shader._tintRGB;\n this._texture = shader.texture;\n\n const pluginName = (this.material as unknown as MeshMaterial).pluginName;\n\n renderer.batch.setObjectRenderer(renderer.plugins[pluginName]);\n renderer.plugins[pluginName].render(this);\n }\n\n /** Updates vertexData field based on transform and vertices. */\n public calculateVertices(): void\n {\n const geometry = this.geometry;\n const verticesBuffer = geometry.buffers[0];\n const vertices = verticesBuffer.data;\n const vertexDirtyId = verticesBuffer._updateID;\n\n if (vertexDirtyId === this.vertexDirty && this._transformID === this.transform._worldID)\n {\n return;\n }\n\n this._transformID = this.transform._worldID;\n\n if (this.vertexData.length !== vertices.length)\n {\n this.vertexData = new Float32Array(vertices.length);\n }\n\n const wt = this.transform.worldTransform;\n const a = wt.a;\n const b = wt.b;\n const c = wt.c;\n const d = wt.d;\n const tx = wt.tx;\n const ty = wt.ty;\n\n const vertexData = this.vertexData;\n\n for (let i = 0; i < vertexData.length / 2; i++)\n {\n const x = vertices[(i * 2)];\n const y = vertices[(i * 2) + 1];\n\n vertexData[(i * 2)] = (a * x) + (c * y) + tx;\n vertexData[(i * 2) + 1] = (b * x) + (d * y) + ty;\n }\n\n if (this._roundPixels)\n {\n const resolution = settings.RESOLUTION;\n\n for (let i = 0; i < vertexData.length; ++i)\n {\n vertexData[i] = Math.round((vertexData[i] * resolution | 0) / resolution);\n }\n }\n\n this.vertexDirty = vertexDirtyId;\n }\n\n /** Updates uv field based on from geometry uv's or batchUvs. */\n public calculateUvs(): void\n {\n const geomUvs = this.geometry.buffers[1];\n const shader = this.shader as unknown as MeshMaterial;\n\n if (!shader.uvMatrix.isSimple)\n {\n if (!this.batchUvs)\n {\n this.batchUvs = new MeshBatchUvs(geomUvs, shader.uvMatrix);\n }\n this.batchUvs.update();\n this.uvs = this.batchUvs.data;\n }\n else\n {\n this.uvs = geomUvs.data as Float32Array;\n }\n }\n\n /**\n * Updates the bounds of the mesh as a rectangle. The bounds calculation takes the worldTransform into account.\n * there must be a aVertexPosition attribute present in the geometry for bounds to be calculated correctly.\n */\n protected _calculateBounds(): void\n {\n this.calculateVertices();\n\n this._bounds.addVertexData(this.vertexData, 0, this.vertexData.length);\n }\n\n /**\n * Tests if a point is inside this mesh. Works only for PIXI.DRAW_MODES.TRIANGLES.\n *\n * @param point - The point to test.\n * @return - The result of the test.\n */\n public containsPoint(point: IPointData): boolean\n {\n if (!this.getBounds().contains(point.x, point.y))\n {\n return false;\n }\n\n this.worldTransform.applyInverse(point, tempPoint);\n\n const vertices = this.geometry.getBuffer('aVertexPosition').data;\n\n const points = tempPolygon.points;\n const indices = this.geometry.getIndex().data;\n const len = indices.length;\n const step = this.drawMode === 4 ? 3 : 1;\n\n for (let i = 0; i + 2 < len; i += step)\n {\n const ind0 = indices[i] * 2;\n const ind1 = indices[i + 1] * 2;\n const ind2 = indices[i + 2] * 2;\n\n points[0] = vertices[ind0];\n points[1] = vertices[ind0 + 1];\n points[2] = vertices[ind1];\n points[3] = vertices[ind1 + 1];\n points[4] = vertices[ind2];\n points[5] = vertices[ind2 + 1];\n\n if (tempPolygon.contains(tempPoint.x, tempPoint.y))\n {\n return true;\n }\n }\n\n return false;\n }\n\n public destroy(options?: IDestroyOptions|boolean): void\n {\n super.destroy(options);\n\n if (this._cachedTexture)\n {\n this._cachedTexture.destroy();\n this._cachedTexture = null;\n }\n\n this.geometry = null;\n this.shader = null;\n this.state = null;\n this.uvs = null;\n this.indices = null;\n this.vertexData = null;\n }\n\n /**\n * The maximum number of vertices to consider batchable. Generally, the complexity\n * of the geometry.\n */\n public static BATCHABLE_SIZE = 100;\n}\n","import { Program, Shader, TextureMatrix } from '@pixi/core';\nimport { Matrix } from '@pixi/math';\nimport { premultiplyTintToRgba } from '@pixi/utils';\nimport fragment from './shader/mesh.frag';\nimport vertex from './shader/mesh.vert';\n\nimport type { Texture } from '@pixi/core';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IMeshMaterialOptions {\n alpha?: number;\n tint?: number;\n pluginName?: string;\n program?: Program;\n uniforms?: Dict;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface MeshMaterial extends GlobalMixins.MeshMaterial {}\n\n/**\n * Slightly opinionated default shader for PixiJS 2D objects.\n * @class\n * @memberof PIXI\n * @extends PIXI.Shader\n */\nexport class MeshMaterial extends Shader\n{\n public readonly uvMatrix: TextureMatrix;\n\n public batchable: boolean;\n public pluginName: string;\n\n // Internal-only properties\n _tintRGB: number;\n\n private _colorDirty: boolean;\n private _alpha: number;\n private _tint: number;\n\n /**\n * @param {PIXI.Texture} uSampler - Texture that material uses to render.\n * @param {object} [options] - Additional options\n * @param {number} [options.alpha=1] - Default alpha.\n * @param {number} [options.tint=0xFFFFFF] - Default tint.\n * @param {string} [options.pluginName='batch'] - Renderer plugin for batching.\n * @param {PIXI.Program} [options.program=0xFFFFFF] - Custom program.\n * @param {object} [options.uniforms] - Custom uniforms.\n */\n constructor(uSampler: Texture, options?: IMeshMaterialOptions)\n {\n const uniforms = {\n uSampler,\n alpha: 1,\n uTextureMatrix: Matrix.IDENTITY,\n uColor: new Float32Array([1, 1, 1, 1]),\n };\n\n // Set defaults\n options = Object.assign({\n tint: 0xFFFFFF,\n alpha: 1,\n pluginName: 'batch',\n }, options);\n\n if (options.uniforms)\n {\n Object.assign(uniforms, options.uniforms);\n }\n\n super(options.program || Program.from(vertex, fragment), uniforms);\n\n /**\n * Only do update if tint or alpha changes.\n * @member {boolean}\n * @private\n * @default false\n */\n this._colorDirty = false;\n\n /**\n * TextureMatrix instance for this Mesh, used to track Texture changes\n *\n * @member {PIXI.TextureMatrix}\n * @readonly\n */\n this.uvMatrix = new TextureMatrix(uSampler);\n\n /**\n * `true` if shader can be batch with the renderer's batch system.\n * @member {boolean}\n * @default true\n */\n this.batchable = options.program === undefined;\n\n /**\n * Renderer plugin for batching\n *\n * @member {string}\n * @default 'batch'\n */\n this.pluginName = options.pluginName;\n\n this.tint = options.tint;\n this.alpha = options.alpha;\n }\n\n /**\n * Reference to the texture being rendered.\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this.uniforms.uSampler;\n }\n set texture(value: Texture)\n {\n if (this.uniforms.uSampler !== value)\n {\n this.uniforms.uSampler = value;\n this.uvMatrix.texture = value;\n }\n }\n\n /**\n * This gets automatically set by the object using this.\n *\n * @default 1\n * @member {number}\n */\n set alpha(value: number)\n {\n if (value === this._alpha) return;\n\n this._alpha = value;\n this._colorDirty = true;\n }\n get alpha(): number\n {\n return this._alpha;\n }\n\n /**\n * Multiply tint for the material.\n * @member {number}\n * @default 0xFFFFFF\n */\n set tint(value: number)\n {\n if (value === this._tint) return;\n\n this._tint = value;\n this._tintRGB = (value >> 16) + (value & 0xff00) + ((value & 0xff) << 16);\n this._colorDirty = true;\n }\n get tint(): number\n {\n return this._tint;\n }\n\n /**\n * Gets called automatically by the Mesh. Intended to be overridden for custom\n * MeshMaterial objects.\n */\n public update(): void\n {\n if (this._colorDirty)\n {\n this._colorDirty = false;\n const baseTexture = this.texture.baseTexture;\n\n premultiplyTintToRgba(\n this._tint, this._alpha, this.uniforms.uColor, (baseTexture.alphaMode as unknown as boolean)\n );\n }\n if (this.uvMatrix.update())\n {\n this.uniforms.uTextureMatrix = this.uvMatrix.mapCoord;\n }\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Buffer, Geometry } from '@pixi/core';\n\nimport type { IArrayBuffer } from '@pixi/core';\n\n/**\n * Standard 2D geometry used in PixiJS.\n *\n * Geometry can be defined without passing in a style or data if required.\n *\n * ```js\n * const 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 * @class\n * @memberof PIXI\n * @extends PIXI.Geometry\n */\nexport class MeshGeometry extends Geometry\n{\n // Internal-only properties\n _updateId: number;\n\n /**\n * @param {Float32Array|number[]} [vertices] - Positional data on geometry.\n * @param {Float32Array|number[]} [uvs] - Texture UVs.\n * @param {Uint16Array|number[]} [index] - IndexBuffer\n */\n constructor(vertices?: IArrayBuffer, uvs?: IArrayBuffer, index?: IArrayBuffer)\n {\n super();\n\n const verticesBuffer = new Buffer(vertices);\n const uvsBuffer = new Buffer(uvs, true);\n const indexBuffer = new Buffer(index, true, true);\n\n this.addAttribute('aVertexPosition', verticesBuffer, 2, false, TYPES.FLOAT)\n .addAttribute('aTextureCoord', uvsBuffer, 2, false, TYPES.FLOAT)\n .addIndex(indexBuffer);\n\n /**\n * Dirty flag to limit update calls on Mesh. For example,\n * limiting updates on a single Mesh instance with a shared Geometry\n * within the render loop.\n * @private\n * @member {number}\n * @default -1\n */\n this._updateId = -1;\n }\n\n /**\n * If the vertex position is updated.\n * @member {number}\n * @readonly\n * @private\n */\n get vertexDirtyId(): number\n {\n return this.buffers[0]._updateID;\n }\n}\n","import { MeshGeometry } from '@pixi/mesh';\n\n/**\n * @memberof PIXI\n */\nexport class PlaneGeometry extends MeshGeometry\n{\n public segWidth: number;\n public segHeight: number;\n public width: number;\n public height: number;\n\n /**\n * @param width - The width of the plane.\n * @param height - The height of the plane.\n * @param segWidth - Number of horizontal segments.\n * @param segHeight - Number of vertical segments.\n */\n constructor(width = 100, height = 100, segWidth = 10, segHeight = 10)\n {\n super();\n\n this.segWidth = segWidth;\n this.segHeight = segHeight;\n\n this.width = width;\n this.height = height;\n\n this.build();\n }\n\n /**\n * Refreshes plane coordinates\n * @private\n */\n build(): void\n {\n const total = this.segWidth * this.segHeight;\n const verts = [];\n const uvs = [];\n const indices = [];\n\n const segmentsX = this.segWidth - 1;\n const segmentsY = this.segHeight - 1;\n\n const sizeX = (this.width) / segmentsX;\n const sizeY = (this.height) / segmentsY;\n\n for (let i = 0; i < total; i++)\n {\n const x = (i % this.segWidth);\n const y = ((i / this.segWidth) | 0);\n\n verts.push(x * sizeX, y * sizeY);\n uvs.push(x / segmentsX, y / segmentsY);\n }\n\n const totalSub = segmentsX * segmentsY;\n\n for (let i = 0; i < totalSub; i++)\n {\n const xpos = i % segmentsX;\n const ypos = (i / segmentsX) | 0;\n\n const value = (ypos * this.segWidth) + xpos;\n const value2 = (ypos * this.segWidth) + xpos + 1;\n const value3 = ((ypos + 1) * this.segWidth) + xpos;\n const value4 = ((ypos + 1) * this.segWidth) + xpos + 1;\n\n indices.push(value, value2, value3,\n value2, value4, value3);\n }\n\n this.buffers[0].data = new Float32Array(verts);\n this.buffers[1].data = new Float32Array(uvs);\n this.indexBuffer.data = new Uint16Array(indices);\n\n // ensure that the changes are uploaded\n this.buffers[0].update();\n this.buffers[1].update();\n this.indexBuffer.update();\n }\n}\n","import { MeshGeometry } from '@pixi/mesh';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * RopeGeometry allows you to draw a geometry across several points and then manipulate these points.\n *\n * ```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * const rope = new PIXI.RopeGeometry(100, points);\n * ```\n *\n * @class\n * @extends PIXI.MeshGeometry\n * @memberof PIXI\n *\n */\nexport class RopeGeometry extends MeshGeometry\n{\n public points: IPoint[];\n public readonly textureScale: number;\n _width: number;\n\n /**\n * @param {number} [width=200] - The width (i.e., thickness) of the rope.\n * @param {PIXI.Point[]} [points] - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} [textureScale=0] - By default the rope texture will be stretched to match\n * rope length. If textureScale is positive this value will be treated as a scaling\n * factor and the texture will preserve its aspect ratio instead. To create a tiling rope\n * set baseTexture.wrapMode to {@link PIXI.WRAP_MODES.REPEAT} and use a power of two texture,\n * then set textureScale=1 to keep the original texture pixel size.\n * In order to reduce alpha channel artifacts provide a larger texture and downsample -\n * i.e. set textureScale=0.5 to scale it down twice.\n */\n constructor(width = 200, points: IPoint[], textureScale = 0)\n {\n super(new Float32Array(points.length * 4),\n new Float32Array(points.length * 4),\n new Uint16Array((points.length - 1) * 6));\n\n /**\n * An array of points that determine the rope\n * @member {PIXI.Point[]}\n */\n this.points = points;\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n this._width = width;\n\n /**\n * Rope texture scale, if zero then the rope texture is stretched.\n * @member {number}\n * @readOnly\n */\n this.textureScale = textureScale;\n\n this.build();\n }\n\n /**\n * The width (i.e., thickness) of the rope.\n * @member {number}\n * @readOnly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * Refreshes Rope indices and uvs\n * @private\n */\n private build(): void\n {\n const points = this.points;\n\n if (!points) return;\n\n const vertexBuffer = this.getBuffer('aVertexPosition');\n const uvBuffer = this.getBuffer('aTextureCoord');\n const indexBuffer = this.getIndex();\n\n // if too little points, or texture hasn't got UVs set yet just move on.\n if (points.length < 1)\n {\n return;\n }\n\n // if the number of points has changed we will need to recreate the arraybuffers\n if (vertexBuffer.data.length / 4 !== points.length)\n {\n vertexBuffer.data = new Float32Array(points.length * 4);\n uvBuffer.data = new Float32Array(points.length * 4);\n indexBuffer.data = new Uint16Array((points.length - 1) * 6);\n }\n\n const uvs = uvBuffer.data;\n const indices = indexBuffer.data;\n\n uvs[0] = 0;\n uvs[1] = 0;\n uvs[2] = 0;\n uvs[3] = 1;\n\n let amount = 0;\n let prev = points[0];\n const textureWidth = this._width * this.textureScale;\n const total = points.length; // - 1;\n\n for (let i = 0; i < total; i++)\n {\n // time to do some smart drawing!\n const index = i * 4;\n\n if (this.textureScale > 0)\n {\n // calculate pixel distance from previous point\n const dx = prev.x - points[i].x;\n const dy = prev.y - points[i].y;\n const distance = Math.sqrt((dx * dx) + (dy * dy));\n\n prev = points[i];\n amount += distance / textureWidth;\n }\n else\n {\n // stretch texture\n amount = i / (total - 1);\n }\n\n uvs[index] = amount;\n uvs[index + 1] = 0;\n\n uvs[index + 2] = amount;\n uvs[index + 3] = 1;\n }\n\n let indexCount = 0;\n\n for (let i = 0; i < total - 1; i++)\n {\n const index = i * 2;\n\n indices[indexCount++] = index;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 2;\n\n indices[indexCount++] = index + 2;\n indices[indexCount++] = index + 1;\n indices[indexCount++] = index + 3;\n }\n\n // ensure that the changes are uploaded\n uvBuffer.update();\n indexBuffer.update();\n\n this.updateVertices();\n }\n\n /**\n * refreshes vertices of Rope mesh\n */\n public updateVertices(): void\n {\n const points = this.points;\n\n if (points.length < 1)\n {\n return;\n }\n\n let lastPoint = points[0];\n let nextPoint;\n let perpX = 0;\n let perpY = 0;\n\n const vertices = this.buffers[0].data;\n const total = points.length;\n\n for (let i = 0; i < total; i++)\n {\n const point = points[i];\n const index = i * 4;\n\n if (i < points.length - 1)\n {\n nextPoint = points[i + 1];\n }\n else\n {\n nextPoint = point;\n }\n\n perpY = -(nextPoint.x - lastPoint.x);\n perpX = nextPoint.y - lastPoint.y;\n\n let ratio = (1 - (i / (total - 1))) * 10;\n\n if (ratio > 1)\n {\n ratio = 1;\n }\n\n const perpLength = Math.sqrt((perpX * perpX) + (perpY * perpY));\n const num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;\n\n perpX /= perpLength;\n perpY /= perpLength;\n\n perpX *= num;\n perpY *= num;\n\n vertices[index] = point.x + perpX;\n vertices[index + 1] = point.y + perpY;\n vertices[index + 2] = point.x - perpX;\n vertices[index + 3] = point.y - perpY;\n\n lastPoint = point;\n }\n\n this.buffers[0].update();\n }\n\n public update(): void\n {\n if (this.textureScale > 0)\n {\n this.build(); // we need to update UVs\n }\n else\n {\n this.updateVertices();\n }\n }\n}\n","import { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { WRAP_MODES } from '@pixi/constants';\nimport { RopeGeometry } from './geometry/RopeGeometry';\n\nimport type { Texture, Renderer } from '@pixi/core';\nimport type { IPoint } from '@pixi/math';\n\n/**\n * The rope allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let rope = new PIXI.SimpleRope(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @memberof PIXI\n */\nexport class SimpleRope extends Mesh\n{\n public autoUpdate: boolean;\n\n /**\n * @param texture - The texture to use on the rope.\n * @param points - An array of {@link PIXI.Point} objects to construct this rope.\n * @param {number} textureScale - Optional. Positive values scale rope texture\n * keeping its aspect ratio. You can reduce alpha channel artifacts by providing a larger texture\n * and downsampling here. If set to zero, texture will be stretched instead.\n */\n constructor(texture: Texture, points: IPoint[], textureScale = 0)\n {\n const ropeGeometry = new RopeGeometry(texture.height, points, textureScale);\n const meshMaterial = new MeshMaterial(texture);\n\n if (textureScale > 0)\n {\n // attempt to set UV wrapping, will fail on non-power of two textures\n texture.baseTexture.wrapMode = WRAP_MODES.REPEAT;\n }\n super(ropeGeometry, meshMaterial);\n\n /**\n * re-calculate vertices by rope points each frame\n *\n * @member {boolean}\n */\n this.autoUpdate = true;\n }\n\n _render(renderer: Renderer): void\n {\n const geometry: RopeGeometry = this.geometry as any;\n\n if (this.autoUpdate || geometry._width !== this.shader.texture.height)\n {\n geometry._width = this.shader.texture.height;\n geometry.update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { Mesh, MeshMaterial } from '@pixi/mesh';\nimport { PlaneGeometry } from './geometry/PlaneGeometry';\n\nimport type{ Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from '@pixi/display';\n\n/**\n * The SimplePlane allows you to draw a texture across several points and then manipulate these points\n *\n *```js\n * for (let i = 0; i < 20; i++) {\n * points.push(new PIXI.Point(i * 50, 0));\n * };\n * let SimplePlane = new PIXI.SimplePlane(PIXI.Texture.from(\"snake.png\"), points);\n * ```\n *\n * @memberof PIXI\n */\nexport class SimplePlane extends Mesh\n{\n /** The geometry is automatically updated when the texture size changes. */\n public autoResize: boolean;\n\n protected _textureID: number;\n\n /**\n * @param texture - The texture to use on the SimplePlane.\n * @param verticesX - The number of vertices in the x-axis\n * @param verticesY - The number of vertices in the y-axis\n */\n constructor(texture: Texture, verticesX: number, verticesY: number)\n {\n const planeGeometry = new PlaneGeometry(texture.width, texture.height, verticesX, verticesY);\n const meshMaterial = new MeshMaterial(Texture.WHITE);\n\n super(planeGeometry, meshMaterial);\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n this.autoResize = true;\n }\n\n /**\n * Method used for overrides, to do something in case texture frame was changed.\n * Meshes based on plane can override it and change more details based on texture.\n */\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n\n const geometry: PlaneGeometry = this.geometry as any;\n const { width, height } = this.shader.texture;\n\n if (this.autoResize && (geometry.width !== width || geometry.height !== height))\n {\n geometry.width = this.shader.texture.width;\n geometry.height = this.shader.texture.height;\n geometry.build();\n }\n }\n\n set texture(value: Texture)\n {\n // Track texture same way sprite does.\n // For generated meshes like NineSlicePlane it can change the geometry.\n // Unfortunately, this method might not work if you directly change texture in material.\n\n if (this.shader.texture === value)\n {\n return;\n }\n\n this.shader.texture = value;\n this._textureID = -1;\n\n if (value.baseTexture.valid)\n {\n this.textureUpdated();\n }\n else\n {\n value.once('update', this.textureUpdated, this);\n }\n }\n\n get texture(): Texture\n {\n return this.shader.texture;\n }\n\n _render(renderer: Renderer): void\n {\n if (this._textureID !== this.shader.texture._updateID)\n {\n this.textureUpdated();\n }\n\n super._render(renderer);\n }\n\n public destroy(options?: IDestroyOptions|boolean): void\n {\n this.shader.texture.off('update', this.textureUpdated, this);\n super.destroy(options);\n }\n}\n","import { Mesh, MeshGeometry, MeshMaterial } from '@pixi/mesh';\nimport { Texture } from '@pixi/core';\n\nimport type { ITypedArray, IArrayBuffer, Renderer } from '@pixi/core';\nimport type { DRAW_MODES } from '@pixi/constants';\n\n/**\n * The Simple Mesh class mimics Mesh in PixiJS v4, providing easy-to-use constructor arguments.\n * For more robust customization, use {@link PIXI.Mesh}.\n *\n * @memberof PIXI\n */\nexport class SimpleMesh extends Mesh\n{\n /** Upload vertices buffer each frame. */\n public autoUpdate: boolean;\n\n /**\n * @param texture - The texture to use\n * @param {Float32Array} [vertices] - if you want to specify the vertices\n * @param {Float32Array} [uvs] - if you want to specify the uvs\n * @param {Uint16Array} [indices] - if you want to specify the indices\n * @param drawMode - the drawMode, can be any of the Mesh.DRAW_MODES consts\n */\n constructor(\n texture: Texture = Texture.EMPTY,\n vertices?: IArrayBuffer,\n uvs?: IArrayBuffer,\n indices?: IArrayBuffer,\n drawMode?: DRAW_MODES\n )\n {\n const geometry = new MeshGeometry(vertices, uvs, indices);\n\n geometry.getBuffer('aVertexPosition').static = false;\n\n const meshMaterial = new MeshMaterial(texture);\n\n super(geometry, meshMaterial, null, drawMode);\n\n this.autoUpdate = true;\n }\n\n /**\n * Collection of vertices data.\n * @type {Float32Array}\n */\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n _render(renderer: Renderer): void\n {\n if (this.autoUpdate)\n {\n this.geometry.getBuffer('aVertexPosition').update();\n }\n\n super._render(renderer);\n }\n}\n","import { Texture } from '@pixi/core';\nimport { SimplePlane } from './SimplePlane';\n\nimport type { ITypedArray } from '@pixi/core';\n\nconst DEFAULT_BORDER_SIZE = 10;\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface NineSlicePlane extends GlobalMixins.NineSlicePlane {}\n\n/**\n * The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful\n * for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically\n *\n *```js\n * let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);\n * ```\n *
\n *      A                          B\n *    +---+----------------------+---+\n *  C | 1 |          2           | 3 |\n *    +---+----------------------+---+\n *    |   |                      |   |\n *    | 4 |          5           | 6 |\n *    |   |                      |   |\n *    +---+----------------------+---+\n *  D | 7 |          8           | 9 |\n *    +---+----------------------+---+\n\n *  When changing this objects width and/or height:\n *     areas 1 3 7 and 9 will remain unscaled.\n *     areas 2 and 8 will be stretched horizontally\n *     areas 4 and 6 will be stretched vertically\n *     area 5 will be stretched both horizontally and vertically\n * 
\n *\n * @memberof PIXI\n */\nexport class NineSlicePlane extends SimplePlane\n{\n private _origWidth: number;\n private _origHeight: number;\n\n /**\n * The width of the left column (a).\n *\n * @private\n */\n _leftWidth: number;\n\n /**\n * The width of the right column (b)\n *\n * @private\n */\n _rightWidth: number;\n\n /**\n * The height of the top row (c)\n *\n * @private\n */\n _topHeight: number;\n\n /**\n * The height of the bottom row (d)\n *\n * @private\n */\n _bottomHeight: number;\n\n /**\n * @param texture - The texture to use on the NineSlicePlane.\n * @param {number} [leftWidth=10] - size of the left vertical bar (A)\n * @param {number} [topHeight=10] - size of the top horizontal bar (C)\n * @param {number} [rightWidth=10] - size of the right vertical bar (B)\n * @param {number} [bottomHeight=10] - size of the bottom horizontal bar (D)\n */\n constructor(\n texture: Texture,\n leftWidth = DEFAULT_BORDER_SIZE,\n topHeight = DEFAULT_BORDER_SIZE,\n rightWidth = DEFAULT_BORDER_SIZE,\n bottomHeight = DEFAULT_BORDER_SIZE\n )\n {\n super(Texture.WHITE, 4, 4);\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n /** The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */\n this._width = this._origWidth;\n\n /** The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */\n this._height = this._origHeight;\n\n this._leftWidth = leftWidth;\n this._rightWidth = rightWidth;\n this._topHeight = topHeight;\n this._bottomHeight = bottomHeight;\n\n // lets call the setter to ensure all necessary updates are performed\n this.texture = texture;\n }\n\n public textureUpdated(): void\n {\n this._textureID = this.shader.texture._updateID;\n this._refresh();\n }\n\n get vertices(): ITypedArray\n {\n return this.geometry.getBuffer('aVertexPosition').data;\n }\n\n set vertices(value: ITypedArray)\n {\n this.geometry.getBuffer('aVertexPosition').data = value;\n }\n\n /** Updates the horizontal vertices. */\n public updateHorizontalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[9] = vertices[11] = vertices[13] = vertices[15] = this._topHeight * scale;\n vertices[17] = vertices[19] = vertices[21] = vertices[23] = this._height - (this._bottomHeight * scale);\n vertices[25] = vertices[27] = vertices[29] = vertices[31] = this._height;\n }\n\n /** Updates the vertical vertices. */\n public updateVerticalVertices(): void\n {\n const vertices = this.vertices;\n\n const scale = this._getMinScale();\n\n vertices[2] = vertices[10] = vertices[18] = vertices[26] = this._leftWidth * scale;\n vertices[4] = vertices[12] = vertices[20] = vertices[28] = this._width - (this._rightWidth * scale);\n vertices[6] = vertices[14] = vertices[22] = vertices[30] = this._width;\n }\n\n /**\n * Returns the smaller of a set of vertical and horizontal scale of nine slice corners.\n *\n * @return Smaller number of vertical and horizontal scale.\n */\n private _getMinScale(): number\n {\n const w = this._leftWidth + this._rightWidth;\n const scaleW = this._width > w ? 1.0 : this._width / w;\n\n const h = this._topHeight + this._bottomHeight;\n const scaleH = this._height > h ? 1.0 : this._height / h;\n\n const scale = Math.min(scaleW, scaleH);\n\n return scale;\n }\n\n /** The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */\n get width(): number\n {\n return this._width;\n }\n\n set width(value: number)\n {\n this._width = value;\n this._refresh();\n }\n\n /** The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane. */\n get height(): number\n {\n return this._height;\n }\n\n set height(value: number)\n {\n this._height = value;\n this._refresh();\n }\n\n /** The width of the left column. */\n get leftWidth(): number\n {\n return this._leftWidth;\n }\n\n set leftWidth(value: number)\n {\n this._leftWidth = value;\n this._refresh();\n }\n\n /** The width of the right column. */\n get rightWidth(): number\n {\n return this._rightWidth;\n }\n\n set rightWidth(value: number)\n {\n this._rightWidth = value;\n this._refresh();\n }\n\n /** The height of the top row. */\n get topHeight(): number\n {\n return this._topHeight;\n }\n\n set topHeight(value: number)\n {\n this._topHeight = value;\n this._refresh();\n }\n\n /** The height of the bottom row. */\n get bottomHeight(): number\n {\n return this._bottomHeight;\n }\n\n set bottomHeight(value: number)\n {\n this._bottomHeight = value;\n this._refresh();\n }\n\n /** Refreshes NineSlicePlane coords. All of them. */\n private _refresh(): void\n {\n const texture = this.texture;\n\n const uvs = this.geometry.buffers[1].data;\n\n this._origWidth = texture.orig.width;\n this._origHeight = texture.orig.height;\n\n const _uvw = 1.0 / this._origWidth;\n const _uvh = 1.0 / this._origHeight;\n\n uvs[0] = uvs[8] = uvs[16] = uvs[24] = 0;\n uvs[1] = uvs[3] = uvs[5] = uvs[7] = 0;\n uvs[6] = uvs[14] = uvs[22] = uvs[30] = 1;\n uvs[25] = uvs[27] = uvs[29] = uvs[31] = 1;\n\n uvs[2] = uvs[10] = uvs[18] = uvs[26] = _uvw * this._leftWidth;\n uvs[4] = uvs[12] = uvs[20] = uvs[28] = 1 - (_uvw * this._rightWidth);\n uvs[9] = uvs[11] = uvs[13] = uvs[15] = _uvh * this._topHeight;\n uvs[17] = uvs[19] = uvs[21] = uvs[23] = 1 - (_uvh * this._bottomHeight);\n\n this.updateHorizontalVertices();\n this.updateVerticalVertices();\n\n this.geometry.buffers[0].update();\n this.geometry.buffers[1].update();\n }\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 */\nexport class Runner\n{\n public items: any[];\n private _name: string;\n private _aliasCount: number;\n\n /**\n * @param name - The function name that will be executed on the listeners added to this Runner.\n */\n constructor(name: string)\n {\n this.items = [];\n this._name = name;\n this._aliasCount = 0;\n }\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 public emit(a0?: unknown, a1?: unknown, a2?: unknown, a3?: unknown,\n a4?: unknown, a5?: unknown, a6?: unknown, a7?: unknown): this\n {\n if (arguments.length > 8)\n {\n throw new Error('max arguments reached');\n }\n\n const { name, items } = this;\n\n this._aliasCount++;\n\n for (let i = 0, len = items.length; i < len; i++)\n {\n items[i][name](a0, a1, a2, a3, a4, a5, a6, a7);\n }\n\n if (items === this.items)\n {\n this._aliasCount--;\n }\n\n return this;\n }\n\n private ensureNonAliasedItems(): void\n {\n if (this._aliasCount > 0 && this.items.length > 1)\n {\n this._aliasCount = 0;\n this.items = this.items.slice(0);\n }\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 public add(item: unknown): this\n {\n if ((item as any)[this._name])\n {\n this.ensureNonAliasedItems();\n this.remove(item);\n this.items.push(item);\n }\n\n return this;\n }\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 public remove(item: unknown): this\n {\n const index = this.items.indexOf(item);\n\n if (index !== -1)\n {\n this.ensureNonAliasedItems();\n this.items.splice(index, 1);\n }\n\n return this;\n }\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 public contains(item: unknown): boolean\n {\n return this.items.indexOf(item) !== -1;\n }\n\n /** Remove all listeners from the Runner */\n public removeAll(): this\n {\n this.ensureNonAliasedItems();\n this.items.length = 0;\n\n return this;\n }\n\n /** Remove all references, don't use after this. */\n public destroy(): void\n {\n this.removeAll();\n this.items = null;\n this._name = null;\n }\n\n /**\n * `true` if there are no this Runner contains no listeners\n *\n * @readonly\n */\n public get empty(): boolean\n {\n return this.items.length === 0;\n }\n\n /**\n * The name of the runner.\n *\n * @readonly\n */\n public get name(): string\n {\n return this._name;\n }\n}\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","'use strict';\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 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[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[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//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","'use strict';\n\nmodule.exports = earcut;\nmodule.exports.default = earcut;\n\nfunction earcut(data, holeIndices, dim) {\n\n dim = dim || 2;\n\n var hasHoles = holeIndices && holeIndices.length,\n outerLen = hasHoles ? holeIndices[0] * dim : data.length,\n outerNode = linkedList(data, 0, outerLen, dim, true),\n triangles = [];\n\n if (!outerNode || outerNode.next === outerNode.prev) return triangles;\n\n var minX, minY, maxX, maxY, x, y, invSize;\n\n if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim);\n\n // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox\n if (data.length > 80 * dim) {\n minX = maxX = data[0];\n minY = maxY = data[1];\n\n for (var i = dim; i < outerLen; i += dim) {\n x = data[i];\n y = data[i + 1];\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x > maxX) maxX = x;\n if (y > maxY) maxY = y;\n }\n\n // minX, minY and invSize are later used to transform coords into integers for z-order calculation\n invSize = Math.max(maxX - minX, maxY - minY);\n invSize = invSize !== 0 ? 1 / invSize : 0;\n }\n\n earcutLinked(outerNode, triangles, dim, minX, minY, invSize);\n\n return triangles;\n}\n\n// create a circular doubly linked list from polygon points in the specified winding order\nfunction linkedList(data, start, end, dim, clockwise) {\n var i, last;\n\n if (clockwise === (signedArea(data, start, end, dim) > 0)) {\n for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last);\n } else {\n for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last);\n }\n\n if (last && equals(last, last.next)) {\n removeNode(last);\n last = last.next;\n }\n\n return last;\n}\n\n// eliminate colinear or duplicate points\nfunction filterPoints(start, end) {\n if (!start) return start;\n if (!end) end = start;\n\n var p = start,\n again;\n do {\n again = false;\n\n if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) {\n removeNode(p);\n p = end = p.prev;\n if (p === p.next) break;\n again = true;\n\n } else {\n p = p.next;\n }\n } while (again || p !== end);\n\n return end;\n}\n\n// main ear slicing loop which triangulates a polygon (given as a linked list)\nfunction earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {\n if (!ear) return;\n\n // interlink polygon nodes in z-order\n if (!pass && invSize) indexCurve(ear, minX, minY, invSize);\n\n var stop = ear,\n prev, next;\n\n // iterate through ears, slicing them one by one\n while (ear.prev !== ear.next) {\n prev = ear.prev;\n next = ear.next;\n\n if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {\n // cut off the triangle\n triangles.push(prev.i / dim);\n triangles.push(ear.i / dim);\n triangles.push(next.i / dim);\n\n removeNode(ear);\n\n // skipping the next vertex leads to less sliver triangles\n ear = next.next;\n stop = next.next;\n\n continue;\n }\n\n ear = next;\n\n // if we looped through the whole remaining polygon and can't find any more ears\n if (ear === stop) {\n // try filtering points and slicing again\n if (!pass) {\n earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);\n\n // if this didn't work, try curing all small self-intersections locally\n } else if (pass === 1) {\n ear = cureLocalIntersections(filterPoints(ear), triangles, dim);\n earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);\n\n // as a last resort, try splitting the remaining polygon into two\n } else if (pass === 2) {\n splitEarcut(ear, triangles, dim, minX, minY, invSize);\n }\n\n break;\n }\n }\n}\n\n// check whether a polygon node forms a valid ear with adjacent nodes\nfunction isEar(ear) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // now make sure we don't have other points inside the potential ear\n var p = ear.next.next;\n\n while (p !== ear.prev) {\n if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.next;\n }\n\n return true;\n}\n\nfunction isEarHashed(ear, minX, minY, invSize) {\n var a = ear.prev,\n b = ear,\n c = ear.next;\n\n if (area(a, b, c) >= 0) return false; // reflex, can't be an ear\n\n // triangle bbox; min & max are calculated like this for speed\n var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x),\n minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y),\n maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x),\n maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y);\n\n // z-order range for the current triangle bbox;\n var minZ = zOrder(minTX, minTY, minX, minY, invSize),\n maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);\n\n var p = ear.prevZ,\n n = ear.nextZ;\n\n // look for points inside the triangle in both directions\n while (p && p.z >= minZ && n && n.z <= maxZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n // look for remaining points in decreasing z-order\n while (p && p.z >= minZ) {\n if (p !== ear.prev && p !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) &&\n area(p.prev, p, p.next) >= 0) return false;\n p = p.prevZ;\n }\n\n // look for remaining points in increasing z-order\n while (n && n.z <= maxZ) {\n if (n !== ear.prev && n !== ear.next &&\n pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) &&\n area(n.prev, n, n.next) >= 0) return false;\n n = n.nextZ;\n }\n\n return true;\n}\n\n// go through all polygon nodes and cure small local self-intersections\nfunction cureLocalIntersections(start, triangles, dim) {\n var p = start;\n do {\n var a = p.prev,\n b = p.next.next;\n\n if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {\n\n triangles.push(a.i / dim);\n triangles.push(p.i / dim);\n triangles.push(b.i / dim);\n\n // remove two nodes involved\n removeNode(p);\n removeNode(p.next);\n\n p = start = b;\n }\n p = p.next;\n } while (p !== start);\n\n return filterPoints(p);\n}\n\n// try splitting polygon into two and triangulate them independently\nfunction splitEarcut(start, triangles, dim, minX, minY, invSize) {\n // look for a valid diagonal that divides the polygon into two\n var a = start;\n do {\n var b = a.next.next;\n while (b !== a.prev) {\n if (a.i !== b.i && isValidDiagonal(a, b)) {\n // split the polygon in two by the diagonal\n var c = splitPolygon(a, b);\n\n // filter colinear points around the cuts\n a = filterPoints(a, a.next);\n c = filterPoints(c, c.next);\n\n // run earcut on each half\n earcutLinked(a, triangles, dim, minX, minY, invSize);\n earcutLinked(c, triangles, dim, minX, minY, invSize);\n return;\n }\n b = b.next;\n }\n a = a.next;\n } while (a !== start);\n}\n\n// link every hole into the outer loop, producing a single-ring polygon without holes\nfunction eliminateHoles(data, holeIndices, outerNode, dim) {\n var queue = [],\n i, len, start, end, list;\n\n for (i = 0, len = holeIndices.length; i < len; i++) {\n start = holeIndices[i] * dim;\n end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n list = linkedList(data, start, end, dim, false);\n if (list === list.next) list.steiner = true;\n queue.push(getLeftmost(list));\n }\n\n queue.sort(compareX);\n\n // process holes from left to right\n for (i = 0; i < queue.length; i++) {\n outerNode = eliminateHole(queue[i], outerNode);\n outerNode = filterPoints(outerNode, outerNode.next);\n }\n\n return outerNode;\n}\n\nfunction compareX(a, b) {\n return a.x - b.x;\n}\n\n// find a bridge between vertices that connects hole with an outer ring and and link it\nfunction eliminateHole(hole, outerNode) {\n var bridge = findHoleBridge(hole, outerNode);\n if (!bridge) {\n return outerNode;\n }\n\n var bridgeReverse = splitPolygon(bridge, hole);\n\n // filter collinear points around the cuts\n var filteredBridge = filterPoints(bridge, bridge.next);\n filterPoints(bridgeReverse, bridgeReverse.next);\n\n // Check if input node was removed by the filtering\n return outerNode === bridge ? filteredBridge : outerNode;\n}\n\n// David Eberly's algorithm for finding a bridge between hole and outer polygon\nfunction findHoleBridge(hole, outerNode) {\n var p = outerNode,\n hx = hole.x,\n hy = hole.y,\n qx = -Infinity,\n m;\n\n // find a segment intersected by a ray from the hole's leftmost point to the left;\n // segment's endpoint with lesser x will be potential connection point\n do {\n if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) {\n var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y);\n if (x <= hx && x > qx) {\n qx = x;\n if (x === hx) {\n if (hy === p.y) return p;\n if (hy === p.next.y) return p.next;\n }\n m = p.x < p.next.x ? p : p.next;\n }\n }\n p = p.next;\n } while (p !== outerNode);\n\n if (!m) return null;\n\n if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint\n\n // look for points inside the triangle of hole point, segment intersection and endpoint;\n // if there are no points found, we have a valid connection;\n // otherwise choose the point of the minimum angle with the ray as connection point\n\n var stop = m,\n mx = m.x,\n my = m.y,\n tanMin = Infinity,\n tan;\n\n p = m;\n\n do {\n if (hx >= p.x && p.x >= mx && hx !== p.x &&\n pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) {\n\n tan = Math.abs(hy - p.y) / (hx - p.x); // tangential\n\n if (locallyInside(p, hole) &&\n (tan < tanMin || (tan === tanMin && (p.x > m.x || (p.x === m.x && sectorContainsSector(m, p)))))) {\n m = p;\n tanMin = tan;\n }\n }\n\n p = p.next;\n } while (p !== stop);\n\n return m;\n}\n\n// whether sector in vertex m contains sector in vertex p in the same coordinates\nfunction sectorContainsSector(m, p) {\n return area(m.prev, m, p.prev) < 0 && area(p.next, m, m.next) < 0;\n}\n\n// interlink polygon nodes in z-order\nfunction indexCurve(start, minX, minY, invSize) {\n var p = start;\n do {\n if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);\n p.prevZ = p.prev;\n p.nextZ = p.next;\n p = p.next;\n } while (p !== start);\n\n p.prevZ.nextZ = null;\n p.prevZ = null;\n\n sortLinked(p);\n}\n\n// Simon Tatham's linked list merge sort algorithm\n// http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html\nfunction sortLinked(list) {\n var i, p, q, e, tail, numMerges, pSize, qSize,\n inSize = 1;\n\n do {\n p = list;\n list = null;\n tail = null;\n numMerges = 0;\n\n while (p) {\n numMerges++;\n q = p;\n pSize = 0;\n for (i = 0; i < inSize; i++) {\n pSize++;\n q = q.nextZ;\n if (!q) break;\n }\n qSize = inSize;\n\n while (pSize > 0 || (qSize > 0 && q)) {\n\n if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) {\n e = p;\n p = p.nextZ;\n pSize--;\n } else {\n e = q;\n q = q.nextZ;\n qSize--;\n }\n\n if (tail) tail.nextZ = e;\n else list = e;\n\n e.prevZ = tail;\n tail = e;\n }\n\n p = q;\n }\n\n tail.nextZ = null;\n inSize *= 2;\n\n } while (numMerges > 1);\n\n return list;\n}\n\n// z-order of a point given coords and inverse of the longer side of data bbox\nfunction zOrder(x, y, minX, minY, invSize) {\n // coords are transformed into non-negative 15-bit integer range\n x = 32767 * (x - minX) * invSize;\n y = 32767 * (y - minY) * invSize;\n\n x = (x | (x << 8)) & 0x00FF00FF;\n x = (x | (x << 4)) & 0x0F0F0F0F;\n x = (x | (x << 2)) & 0x33333333;\n x = (x | (x << 1)) & 0x55555555;\n\n y = (y | (y << 8)) & 0x00FF00FF;\n y = (y | (y << 4)) & 0x0F0F0F0F;\n y = (y | (y << 2)) & 0x33333333;\n y = (y | (y << 1)) & 0x55555555;\n\n return x | (y << 1);\n}\n\n// find the leftmost node of a polygon ring\nfunction getLeftmost(start) {\n var p = start,\n leftmost = start;\n do {\n if (p.x < leftmost.x || (p.x === leftmost.x && p.y < leftmost.y)) leftmost = p;\n p = p.next;\n } while (p !== start);\n\n return leftmost;\n}\n\n// check if a point lies within a convex triangle\nfunction pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {\n return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&\n (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&\n (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;\n}\n\n// check if a diagonal between two polygon nodes is valid (lies in polygon interior)\nfunction isValidDiagonal(a, b) {\n return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && // dones't intersect other edges\n (locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && // locally visible\n (area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors\n equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case\n}\n\n// signed area of a triangle\nfunction area(p, q, r) {\n return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);\n}\n\n// check if two points are equal\nfunction equals(p1, p2) {\n return p1.x === p2.x && p1.y === p2.y;\n}\n\n// check if two segments intersect\nfunction intersects(p1, q1, p2, q2) {\n var o1 = sign(area(p1, q1, p2));\n var o2 = sign(area(p1, q1, q2));\n var o3 = sign(area(p2, q2, p1));\n var o4 = sign(area(p2, q2, q1));\n\n if (o1 !== o2 && o3 !== o4) return true; // general case\n\n if (o1 === 0 && onSegment(p1, p2, q1)) return true; // p1, q1 and p2 are collinear and p2 lies on p1q1\n if (o2 === 0 && onSegment(p1, q2, q1)) return true; // p1, q1 and q2 are collinear and q2 lies on p1q1\n if (o3 === 0 && onSegment(p2, p1, q2)) return true; // p2, q2 and p1 are collinear and p1 lies on p2q2\n if (o4 === 0 && onSegment(p2, q1, q2)) return true; // p2, q2 and q1 are collinear and q1 lies on p2q2\n\n return false;\n}\n\n// for collinear points p, q, r, check if point q lies on segment pr\nfunction onSegment(p, q, r) {\n return q.x <= Math.max(p.x, r.x) && q.x >= Math.min(p.x, r.x) && q.y <= Math.max(p.y, r.y) && q.y >= Math.min(p.y, r.y);\n}\n\nfunction sign(num) {\n return num > 0 ? 1 : num < 0 ? -1 : 0;\n}\n\n// check if a polygon diagonal intersects any polygon segments\nfunction intersectsPolygon(a, b) {\n var p = a;\n do {\n if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i &&\n intersects(p, p.next, a, b)) return true;\n p = p.next;\n } while (p !== a);\n\n return false;\n}\n\n// check if a polygon diagonal is locally inside the polygon\nfunction locallyInside(a, b) {\n return area(a.prev, a, a.next) < 0 ?\n area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 :\n area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;\n}\n\n// check if the middle point of a polygon diagonal is inside the polygon\nfunction middleInside(a, b) {\n var p = a,\n inside = false,\n px = (a.x + b.x) / 2,\n py = (a.y + b.y) / 2;\n do {\n if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y &&\n (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x))\n inside = !inside;\n p = p.next;\n } while (p !== a);\n\n return inside;\n}\n\n// link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two;\n// if one belongs to the outer ring and another to a hole, it merges it into a single ring\nfunction splitPolygon(a, b) {\n var a2 = new Node(a.i, a.x, a.y),\n b2 = new Node(b.i, b.x, b.y),\n an = a.next,\n bp = b.prev;\n\n a.next = b;\n b.prev = a;\n\n a2.next = an;\n an.prev = a2;\n\n b2.next = a2;\n a2.prev = b2;\n\n bp.next = b2;\n b2.prev = bp;\n\n return b2;\n}\n\n// create a node and optionally link it with previous one (in a circular doubly linked list)\nfunction insertNode(i, x, y, last) {\n var p = new Node(i, x, y);\n\n if (!last) {\n p.prev = p;\n p.next = p;\n\n } else {\n p.next = last.next;\n p.prev = last;\n last.next.prev = p;\n last.next = p;\n }\n return p;\n}\n\nfunction removeNode(p) {\n p.next.prev = p.prev;\n p.prev.next = p.next;\n\n if (p.prevZ) p.prevZ.nextZ = p.nextZ;\n if (p.nextZ) p.nextZ.prevZ = p.prevZ;\n}\n\nfunction Node(i, x, y) {\n // vertex index in coordinates array\n this.i = i;\n\n // vertex coordinates\n this.x = x;\n this.y = y;\n\n // previous and next vertex nodes in a polygon ring\n this.prev = null;\n this.next = null;\n\n // z-order curve value\n this.z = null;\n\n // previous and next nodes in z-order\n this.prevZ = null;\n this.nextZ = null;\n\n // indicates whether this is a steiner point\n this.steiner = false;\n}\n\n// return a percentage difference between the polygon area and its triangulation area;\n// used to verify correctness of triangulation\nearcut.deviation = function (data, holeIndices, dim, triangles) {\n var hasHoles = holeIndices && holeIndices.length;\n var outerLen = hasHoles ? holeIndices[0] * dim : data.length;\n\n var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));\n if (hasHoles) {\n for (var i = 0, len = holeIndices.length; i < len; i++) {\n var start = holeIndices[i] * dim;\n var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;\n polygonArea -= Math.abs(signedArea(data, start, end, dim));\n }\n }\n\n var trianglesArea = 0;\n for (i = 0; i < triangles.length; i += 3) {\n var a = triangles[i] * dim;\n var b = triangles[i + 1] * dim;\n var c = triangles[i + 2] * dim;\n trianglesArea += Math.abs(\n (data[a] - data[c]) * (data[b + 1] - data[a + 1]) -\n (data[a] - data[b]) * (data[c + 1] - data[a + 1]));\n }\n\n return polygonArea === 0 && trianglesArea === 0 ? 0 :\n Math.abs((trianglesArea - polygonArea) / polygonArea);\n};\n\nfunction signedArea(data, start, end, dim) {\n var sum = 0;\n for (var i = start, j = end - dim; i < end; i += dim) {\n sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]);\n j = i;\n }\n return sum;\n}\n\n// turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts\nearcut.flatten = function (data) {\n var dim = data[0][0].length,\n result = {vertices: [], holes: [], dimensions: dim},\n holeIndex = 0;\n\n for (var i = 0; i < data.length; i++) {\n for (var j = 0; j < data[i].length; j++) {\n for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]);\n }\n if (i > 0) {\n holeIndex += data[i - 1].length;\n result.holes.push(holeIndex);\n }\n }\n return result;\n};\n","import { Resource } from './Resource';\n\nimport type { IImageResourceOptions } from './ImageResource';\nimport type { ISize } from '@pixi/math';\nimport type { ICubeResourceOptions } from './CubeResource';\nimport type { ISVGResourceOptions } from './SVGResource';\nimport type { IVideoResourceOptions } from './VideoResource';\n\n/*\n * Allow flexible options for resource plugins\n */\nexport type IResourcePluginOptions = { [key: string]: any };\n\n/*\n * All allowable options for autoDetectResource\n */\nexport type IAutoDetectOptions = ISize\n | ICubeResourceOptions\n | IImageResourceOptions\n | ISVGResourceOptions\n | IVideoResourceOptions\n | IResourcePluginOptions;\n\n/**\n * Shape of supported resource plugins\n *\n * @memberof PIXI\n */\nexport interface IResourcePlugin\n{\n test(source: unknown, extension: string): boolean;\n new (source: any, options?: RO): R;\n}\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 */\nexport const INSTALLED: Array> = [];\n\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 */\nexport function autoDetectResource(source: unknown, options?: RO): R\n{\n if (!source)\n {\n return null;\n }\n\n let extension = '';\n\n if (typeof source === 'string')\n {\n // search for file extension: period, 3-4 chars, then ?, # or EOL\n const result = (/\\.(\\w{3,4})(?:$|\\?|#)/i).exec(source);\n\n if (result)\n {\n extension = result[1].toLowerCase();\n }\n }\n\n for (let i = INSTALLED.length - 1; i >= 0; --i)\n {\n const ResourcePlugin = INSTALLED[i] as IResourcePlugin;\n\n if (ResourcePlugin.test && ResourcePlugin.test(source, extension))\n {\n return new ResourcePlugin(source, options);\n }\n }\n\n throw new Error('Unrecognized source type to auto-detect Resource');\n}\n","import { Runner } from '@pixi/runner';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\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 */\nexport abstract class Resource\n{\n /**\n * If resource has been destroyed.\n *\n * @readonly\n * @default false\n */\n public destroyed: boolean;\n\n /**\n * `true` if resource is created by BaseTexture\n * useful for doing cleanup with BaseTexture destroy\n * and not cleaning up resources that were created\n * externally.\n */\n public internal: boolean;\n\n /** Internal width of the resource. */\n protected _width: number;\n\n /** Internal height of the resource. */\n protected _height: number;\n\n /**\n * Mini-runner for handling resize events\n * accepts 2 parameters: width, height\n *\n * @member {Runner}\n * @private\n */\n protected onResize: Runner; // TODO: Should this be private? It doesn't seem to be used anywhere else.\n\n /**\n * Mini-runner for handling update events\n *\n * @member {Runner}\n * @private\n */\n protected onUpdate: Runner;\n\n /**\n * Handle internal errors, such as loading errors\n * accepts 1 param: error\n *\n * @member {Runner}\n * @private\n */\n protected onError: Runner;\n\n /**\n * @param width - Width of the resource\n * @param height - Height of the resource\n */\n constructor(width = 0, height = 0)\n {\n this._width = width;\n this._height = height;\n\n this.destroyed = false;\n this.internal = false;\n\n this.onResize = new Runner('setRealSize');\n this.onUpdate = new Runner('update');\n this.onError = new Runner('onError');\n }\n\n /**\n * Bind to a parent BaseTexture\n *\n * @param baseTexture - Parent texture\n */\n bind(baseTexture: BaseTexture): void\n {\n this.onResize.add(baseTexture);\n this.onUpdate.add(baseTexture);\n this.onError.add(baseTexture);\n\n // Call a resize immediate if we already\n // have the width and height of the resource\n if (this._width || this._height)\n {\n this.onResize.emit(this._width, this._height);\n }\n }\n\n /**\n * Unbind to a parent BaseTexture\n *\n * @param baseTexture - Parent texture\n */\n unbind(baseTexture: BaseTexture): void\n {\n this.onResize.remove(baseTexture);\n this.onUpdate.remove(baseTexture);\n this.onError.remove(baseTexture);\n }\n\n /**\n * Trigger a resize event\n *\n * @param width - X dimension\n * @param height - Y dimension\n */\n resize(width: number, height: number): void\n {\n if (width !== this._width || height !== this._height)\n {\n this._width = width;\n this._height = height;\n this.onResize.emit(width, height);\n }\n }\n\n /**\n * Has been validated\n *\n * @readonly\n */\n get valid(): boolean\n {\n return !!this._width && !!this._height;\n }\n\n /** Has been updated trigger event. */\n update(): void\n {\n if (!this.destroyed)\n {\n this.onUpdate.emit();\n }\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 load(): Promise\n {\n return Promise.resolve(this);\n }\n\n /**\n * The width of the resource.\n *\n * @readonly\n */\n get width(): number\n {\n return this._width;\n }\n\n /**\n * The height of the resource.\n *\n * @readonly\n */\n get height(): number\n {\n return this._height;\n }\n\n /**\n * Uploads the texture or returns false if it cant for some reason. Override this.\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 abstract upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean;\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 style(_renderer: Renderer, _baseTexture: BaseTexture, _glTexture: GLTexture): boolean\n {\n return false;\n }\n\n /** Clean up anything, this happens when destroying is ready. */\n dispose(): void\n {\n // override\n }\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 destroy(): void\n {\n if (!this.destroyed)\n {\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 /**\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 static test(_source: unknown, _extension?: string): boolean\n {\n return false;\n }\n}\n","import { Resource } from './Resource';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { ISize } from '@pixi/math';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n/**\n * @interface SharedArrayBuffer\n */\n\n/**\n * Buffer resource with data of typed array.\n *\n * @memberof PIXI\n */\nexport class BufferResource extends Resource\n{\n /**\n * Source array\n * Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL\n */\n data: Float32Array|Uint8Array|Uint16Array|Uint32Array;\n\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 constructor(source: Float32Array|Uint8Array|Uint16Array|Uint32Array, options: ISize)\n {\n const { width, height } = options || {};\n\n if (!width || !height)\n {\n throw new Error('BufferResource width or height invalid');\n }\n\n super(width, height);\n\n this.data = source;\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 - glTexture\n * @returns - true is success\n */\n upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data\n );\n }\n\n return true;\n }\n\n /** Destroy and don't use after this. */\n dispose(): void\n {\n this.data = null;\n }\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 static test(source: unknown): source is Float32Array|Uint8Array|Uint32Array\n {\n return source instanceof Float32Array\n || source instanceof Uint8Array\n || source instanceof Uint32Array;\n }\n}\n","import { BaseTextureCache, EventEmitter, isPow2, TextureCache, uid } from '@pixi/utils';\nimport { FORMATS, SCALE_MODES, TARGETS, TYPES, ALPHA_MODES, MIPMAP_MODES, WRAP_MODES } from '@pixi/constants';\nimport { Resource } from './resources/Resource';\nimport { BufferResource } from './resources/BufferResource';\nimport { autoDetectResource } from './resources/autoDetectResource';\nimport { settings } from '@pixi/settings';\n\nimport type { MSAA_QUALITY } from '@pixi/constants';\nimport type { IAutoDetectOptions } from './resources/autoDetectResource';\nimport type { GLTexture } from './GLTexture';\n\nconst defaultBufferOptions = {\n scaleMode: SCALE_MODES.NEAREST,\n format: FORMATS.RGBA,\n alphaMode: ALPHA_MODES.NPM,\n};\n\nexport type ImageSource = HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|ImageBitmap;\n\nexport interface IBaseTextureOptions {\n alphaMode?: ALPHA_MODES;\n mipmap?: MIPMAP_MODES;\n anisotropicLevel?: number;\n scaleMode?: SCALE_MODES;\n width?: number;\n height?: number;\n wrapMode?: WRAP_MODES;\n format?: FORMATS;\n type?: TYPES;\n target?: TARGETS;\n resolution?: number;\n multisample?: MSAA_QUALITY;\n resourceOptions?: RO;\n pixiIdPrefix?: string;\n}\n\nexport interface BaseTexture extends GlobalMixins.BaseTexture, EventEmitter {}\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 */\nexport class BaseTexture extends EventEmitter\n{\n /**\n * The width of the base texture set when the image has loaded\n *\n * @readonly\n */\n public width: number;\n\n /**\n * The height of the base texture set when the image has loaded\n *\n * @readonly\n */\n public height: number;\n\n /**\n * The resolution / device pixel ratio of the texture\n *\n * @readonly\n * @default PIXI.settings.RESOLUTION\n */\n public resolution: number;\n\n /**\n * How to treat premultiplied alpha, see {@link PIXI.ALPHA_MODES}.\n *\n * @member {PIXI.ALPHA_MODES}\n * @default PIXI.ALPHA_MODES.UNPACK\n */\n public alphaMode?: ALPHA_MODES;\n\n /**\n * Anisotropic filtering level of texture\n *\n * @member {number}\n * @default PIXI.settings.ANISOTROPIC_LEVEL\n */\n public anisotropicLevel?: number;\n\n /**\n * The pixel format of the texture\n *\n * @default PIXI.FORMATS.RGBA\n */\n public format?: FORMATS;\n\n /**\n * The type of resource data\n *\n * @default PIXI.TYPES.UNSIGNED_BYTE\n */\n public type?: TYPES;\n\n /**\n * The target type\n *\n * @default PIXI.TARGETS.TEXTURE_2D\n */\n public target?: TARGETS;\n\n /**\n * Global unique identifier for this BaseTexture\n *\n * @protected\n */\n public readonly uid: number;\n\n /**\n * Used by automatic texture Garbage Collection, stores last GC tick when it was bound\n *\n * @protected\n */\n touched: number;\n\n /**\n * Whether or not the texture is a power of two, try to use power of two textures as much\n * as you can\n *\n * @readonly\n * @default false\n */\n isPowerOfTwo: boolean;\n\n /**\n * The map of render context textures where this is bound\n *\n * @private\n */\n _glTextures: { [key: number]: GLTexture };\n\n /**\n * Used by TextureSystem to only update texture to the GPU when needed.\n * Please call `update()` to increment it.\n *\n * @readonly\n */\n dirtyId: number;\n\n /**\n * Used by TextureSystem to only update texture style when needed.\n *\n * @protected\n */\n dirtyStyleId: number;\n\n /**\n * Currently default cache ID.\n *\n * @member {string}\n */\n public cacheId: string;\n\n /**\n * Generally speaking means when resource is loaded.\n * @readonly\n * @member {boolean}\n */\n public valid: boolean;\n\n /**\n * The collection of alternative cache ids, since some BaseTextures\n * can have more than one ID, short name and longer full URL\n *\n * @member {Array}\n * @readonly\n */\n public textureCacheIds: Array;\n\n /**\n * Flag if BaseTexture has been destroyed.\n *\n * @member {boolean}\n * @readonly\n */\n public destroyed: boolean;\n\n /**\n * The resource used by this BaseTexture, there can only\n * be one resource per BaseTexture, but textures can share\n * resources.\n *\n * @member {PIXI.Resource}\n * @readonly\n */\n public resource: R;\n\n /**\n * Number of the texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n _batchEnabled: number;\n\n /**\n * Location inside texture batch, used by multi-texture renderers\n *\n * @member {number}\n */\n _batchLocation: number;\n\n /**\n * Whether its a part of another texture, handled by ArrayResource or CubeResource\n *\n * @member {PIXI.BaseTexture}\n */\n parentTextureArray: BaseTexture;\n\n private _mipmap?: MIPMAP_MODES;\n private _scaleMode?: SCALE_MODES;\n private _wrapMode?: WRAP_MODES;\n\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 constructor(resource: R | ImageSource | string | any = null, options: IBaseTextureOptions = null)\n {\n super();\n\n options = options || {};\n\n const { alphaMode, mipmap, anisotropicLevel, scaleMode, width, height,\n wrapMode, format, type, target, resolution, resourceOptions } = options;\n\n // Convert the resource to a Resource object\n if (resource && !(resource instanceof Resource))\n {\n resource = autoDetectResource(resource, resourceOptions);\n resource.internal = true;\n }\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\n this.uid = uid();\n this.touched = 0;\n this.isPowerOfTwo = false;\n this._refreshPOT();\n\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\n this._batchEnabled = 0;\n this._batchLocation = 0;\n this.parentTextureArray = null;\n\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 /**\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 /**\n * Fired when BaseTexture is updated.\n *\n * @protected\n * @event PIXI.BaseTexture#loaded\n * @param {PIXI.BaseTexture} baseTexture - Resource loaded.\n */\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 /**\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\n // Set the resource\n this.setResource(resource);\n }\n\n /**\n * Pixel width of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realWidth(): number\n {\n return Math.round(this.width * this.resolution);\n }\n\n /**\n * Pixel height of the source of this texture\n *\n * @readonly\n * @member {number}\n */\n get realHeight(): number\n {\n return Math.round(this.height * this.resolution);\n }\n\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 mipmap(): MIPMAP_MODES\n {\n return this._mipmap;\n }\n set mipmap(value: MIPMAP_MODES)\n {\n if (this._mipmap !== value)\n {\n this._mipmap = value;\n this.dirtyStyleId++;\n }\n }\n\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 scaleMode(): SCALE_MODES\n {\n return this._scaleMode;\n }\n set scaleMode(value: SCALE_MODES)\n {\n if (this._scaleMode !== value)\n {\n this._scaleMode = value;\n this.dirtyStyleId++;\n }\n }\n\n /**\n * How the texture wraps\n * @member {PIXI.WRAP_MODES}\n * @default PIXI.settings.WRAP_MODE\n */\n get wrapMode(): WRAP_MODES\n {\n return this._wrapMode;\n }\n set wrapMode(value: WRAP_MODES)\n {\n if (this._wrapMode !== value)\n {\n this._wrapMode = value;\n this.dirtyStyleId++;\n }\n }\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 setStyle(scaleMode?: SCALE_MODES, mipmap?: MIPMAP_MODES): this\n {\n let dirty;\n\n if (scaleMode !== undefined && scaleMode !== this.scaleMode)\n {\n this.scaleMode = scaleMode;\n dirty = true;\n }\n\n if (mipmap !== undefined && mipmap !== this.mipmap)\n {\n this.mipmap = mipmap;\n dirty = true;\n }\n\n if (dirty)\n {\n this.dirtyStyleId++;\n }\n\n return this;\n }\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 setSize(desiredWidth: number, desiredHeight: number, resolution?: number): this\n {\n resolution = resolution || this.resolution;\n\n return this.setRealSize(desiredWidth * resolution, desiredHeight * resolution, resolution);\n }\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 setRealSize(realWidth: number, realHeight: number, resolution?: number): this\n {\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\n return this;\n }\n\n /**\n * Refresh check for isPowerOfTwo texture based on size\n *\n * @private\n */\n protected _refreshPOT(): void\n {\n this.isPowerOfTwo = isPow2(this.realWidth) && isPow2(this.realHeight);\n }\n\n /**\n * Changes resolution\n *\n * @param {number} resolution - res\n * @returns {PIXI.BaseTexture} this\n */\n setResolution(resolution: number): this\n {\n const oldResolution = this.resolution;\n\n if (oldResolution === resolution)\n {\n return this;\n }\n\n this.resolution = resolution;\n\n if (this.valid)\n {\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\n this._refreshPOT();\n\n return this;\n }\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 setResource(resource: R): this\n {\n if (this.resource === resource)\n {\n return this;\n }\n\n if (this.resource)\n {\n throw new Error('Resource can be set only once');\n }\n\n resource.bind(this);\n\n this.resource = resource;\n\n return this;\n }\n\n /**\n * Invalidates the object. Texture becomes valid if width and height are greater than zero.\n */\n update(): void\n {\n if (!this.valid)\n {\n if (this.width > 0 && this.height > 0)\n {\n this.valid = true;\n this.emit('loaded', this);\n this.emit('update', this);\n }\n }\n else\n {\n this.dirtyId++;\n this.dirtyStyleId++;\n this.emit('update', this);\n }\n }\n\n /**\n * Handle errors with resources.\n * @private\n * @param {ErrorEvent} event - Error event emitted.\n */\n onError(event: ErrorEvent): void\n {\n this.emit('error', this, event);\n }\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 destroy(): void\n {\n // remove and destroy the resource\n if (this.resource)\n {\n this.resource.unbind(this);\n // only destroy resourced created internally\n if (this.resource.internal)\n {\n this.resource.destroy();\n }\n this.resource = null;\n }\n\n if (this.cacheId)\n {\n delete BaseTextureCache[this.cacheId];\n delete TextureCache[this.cacheId];\n\n this.cacheId = null;\n }\n\n // finally let the WebGL renderer know..\n this.dispose();\n\n BaseTexture.removeFromCache(this);\n this.textureCacheIds = null;\n\n this.destroyed = true;\n }\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 dispose(): void\n {\n this.emit('dispose', this);\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this;\n }\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 static from(source: ImageSource|string,\n options?: IBaseTextureOptions, strict = settings.STRICT_TEXTURE_CACHE): BaseTexture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let baseTexture = BaseTextureCache[cacheId] as BaseTexture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !baseTexture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in BaseTextureCache.`);\n }\n\n if (!baseTexture)\n {\n baseTexture = new BaseTexture(source, options);\n baseTexture.cacheId = cacheId;\n BaseTexture.addToCache(baseTexture, cacheId);\n }\n\n return baseTexture;\n }\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 static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): BaseTexture\n {\n buffer = buffer || new Float32Array(width * height * 4);\n\n const resource = new BufferResource(buffer, { width, height });\n const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;\n\n return new BaseTexture(resource, Object.assign(defaultBufferOptions, options || { width, height, type }));\n }\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 static addToCache(baseTexture: BaseTexture, id: string): void\n {\n if (id)\n {\n if (baseTexture.textureCacheIds.indexOf(id) === -1)\n {\n baseTexture.textureCacheIds.push(id);\n }\n\n if (BaseTextureCache[id])\n {\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\n BaseTextureCache[id] = baseTexture;\n }\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 static removeFromCache(baseTexture: string | BaseTexture): BaseTexture|null\n {\n if (typeof baseTexture === 'string')\n {\n const baseTextureFromCache = BaseTextureCache[baseTexture];\n\n if (baseTextureFromCache)\n {\n const index = baseTextureFromCache.textureCacheIds.indexOf(baseTexture);\n\n if (index > -1)\n {\n baseTextureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete BaseTextureCache[baseTexture];\n\n return baseTextureFromCache;\n }\n }\n else if (baseTexture && baseTexture.textureCacheIds)\n {\n for (let i = 0; i < baseTexture.textureCacheIds.length; ++i)\n {\n delete BaseTextureCache[baseTexture.textureCacheIds[i]];\n }\n\n baseTexture.textureCacheIds.length = 0;\n\n return baseTexture;\n }\n\n return null;\n }\n\n /**\n * Global number of the texture batch, used by multi-texture renderers\n *\n * @static\n * @member {number}\n */\n static _globalBatch = 0;\n}\n","import { Resource } from './Resource';\nimport { BaseTexture } from '../BaseTexture';\nimport { ISize } from '@pixi/math';\nimport { autoDetectResource, IAutoDetectOptions } from './autoDetectResource';\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 */\nexport abstract class AbstractMultiResource extends Resource\n{\n /** Number of elements in array. */\n readonly length: number;\n\n /**\n * Collection of partial baseTextures that correspond to resources.\n *\n * @readonly\n */\n items: Array;\n\n /**\n * Dirty IDs for each part.\n *\n * @readonly\n */\n itemDirtyIds: Array;\n\n /**\n * Promise when loading.\n *\n * @default null\n */\n private _load: Promise;\n\n /** Bound baseTexture, there can only be one. */\n baseTexture: BaseTexture;\n\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 constructor(length: number, options?: ISize)\n {\n const { width, height } = options || {};\n\n super(width, height);\n\n this.items = [];\n this.itemDirtyIds = [];\n\n for (let i = 0; i < length; i++)\n {\n const partTexture = new BaseTexture();\n\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\n this.length = length;\n this._load = null;\n this.baseTexture = null;\n }\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 protected initFromArray(resources: Array, options?: IAutoDetectOptions): void\n {\n for (let i = 0; i < this.length; i++)\n {\n if (!resources[i])\n {\n continue;\n }\n if (resources[i].castToBaseTexture)\n {\n this.addBaseTextureAt(resources[i].castToBaseTexture(), i);\n }\n else if (resources[i] instanceof Resource)\n {\n this.addResourceAt(resources[i], i);\n }\n else\n {\n this.addResourceAt(autoDetectResource(resources[i], options), i);\n }\n }\n }\n\n /** Destroy this BaseImageResource. */\n dispose(): void\n {\n for (let i = 0, len = this.length; i < len; i++)\n {\n this.items[i].destroy();\n }\n this.items = null;\n this.itemDirtyIds = null;\n this._load = null;\n }\n\n /**\n * Set a baseTexture by ID\n *\n * @param baseTexture\n * @param index - Zero-based index of resource to set\n * @return - Instance for chaining\n */\n abstract addBaseTextureAt(baseTexture: BaseTexture, index: number): this;\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 addResourceAt(resource: Resource, index: number): this\n {\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n // Inherit the first resource dimensions\n if (resource.valid && !this.valid)\n {\n this.resize(resource.width, resource.height);\n }\n\n this.items[index].setResource(resource);\n\n return this;\n }\n\n /** Set the parent base texture. */\n bind(baseTexture: BaseTexture): void\n {\n if (this.baseTexture !== null)\n {\n throw new Error('Only one base texture per TextureArray is allowed');\n }\n super.bind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = baseTexture;\n this.items[i].on('update', baseTexture.update, baseTexture);\n }\n }\n\n /** Unset the parent base texture. */\n unbind(baseTexture: BaseTexture): void\n {\n super.unbind(baseTexture);\n\n for (let i = 0; i < this.length; i++)\n {\n this.items[i].parentTextureArray = null;\n this.items[i].off('update', baseTexture.update, baseTexture);\n }\n }\n\n /**\n * Load all the resources simultaneously\n *\n * @return - When load is resolved\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const resources = this.items.map((item) => item.resource).filter((item) => item);\n\n // TODO: also implement load part-by-part strategy\n const promises = resources.map((item) => item.load());\n\n this._load = Promise.all(promises)\n .then(() =>\n {\n const { realWidth, realHeight } = this.items[0];\n\n this.resize(realWidth, realHeight);\n\n return Promise.resolve(this);\n }\n );\n\n return this._load;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\nimport { BaseTexture } from '../BaseTexture';\n\nimport type { BaseImageResource } from './BaseImageResource';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\nimport type { ISize } from '@pixi/math';\n\n/**\n * A resource that contains a number of sources.\n *\n * @memberof PIXI\n */\nexport class ArrayResource extends AbstractMultiResource\n{\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 constructor(source: number|Array, options?: ISize)\n {\n const { width, height } = options || {};\n\n let urls;\n let length: number;\n\n if (Array.isArray(source))\n {\n urls = source;\n length = source.length;\n }\n else\n {\n length = source;\n }\n\n super(length, { width, height });\n\n if (urls)\n {\n this.initFromArray(urls, options);\n }\n }\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 addBaseTextureAt(baseTexture: BaseTexture, index: number): this\n {\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error('ArrayResource does not support RenderTexture');\n }\n\n return this;\n }\n\n /** Add binding */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_2D_ARRAY;\n }\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 upload(renderer: Renderer, texture: BaseTexture, glTexture: GLTexture): boolean\n {\n const { length, itemDirtyIds, items } = this;\n const { gl } = renderer;\n\n if (glTexture.dirtyId < 0)\n {\n gl.texImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n glTexture.internalFormat,\n this._width,\n this._height,\n length,\n 0,\n texture.format,\n glTexture.type,\n null\n );\n }\n\n for (let i = 0; i < length; i++)\n {\n const item = items[i];\n\n if (itemDirtyIds[i] < item.dirtyId)\n {\n itemDirtyIds[i] = item.dirtyId;\n if (item.valid)\n {\n gl.texSubImage3D(\n gl.TEXTURE_2D_ARRAY,\n 0,\n 0, // xoffset\n 0, // yoffset\n i, // zoffset\n item.resource.width,\n item.resource.height,\n 1,\n texture.format,\n glTexture.type,\n (item.resource as BaseImageResource).source\n );\n }\n }\n }\n\n return true;\n }\n}\n","import { Resource } from './Resource';\nimport { determineCrossOrigin } from '@pixi/utils';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture, ImageSource } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Base for all the image/canvas resources.\n *\n * @memberof PIXI\n */\nexport class BaseImageResource extends Resource\n{\n /**\n * The source element.\n *\n * @member {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement}\n * @readonly\n */\n public source: ImageSource;\n\n /**\n * If set to `true`, will force `texImage2D` over `texSubImage2D` for uploading.\n * Certain types of media (e.g. video) using `texImage2D` is more performant.\n *\n * @default false\n * @private\n */\n public noSubImage: boolean;\n\n /**\n * @param {HTMLImageElement|HTMLCanvasElement|HTMLVideoElement|SVGElement} source\n */\n constructor(source: ImageSource)\n {\n const sourceAny = source as any;\n const width = sourceAny.naturalWidth || sourceAny.videoWidth || sourceAny.width;\n const height = sourceAny.naturalHeight || sourceAny.videoHeight || sourceAny.height;\n\n super(width, height);\n\n this.source = source;\n this.noSubImage = false;\n }\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 static crossOrigin(element: HTMLImageElement|HTMLVideoElement, url: string, crossorigin?: boolean|string): void\n {\n if (crossorigin === undefined && url.indexOf('data:') !== 0)\n {\n element.crossOrigin = determineCrossOrigin(url);\n }\n else if (crossorigin !== false)\n {\n element.crossOrigin = typeof crossorigin === 'string' ? crossorigin : 'anonymous';\n }\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 upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture, source?: ImageSource): boolean\n {\n const gl = renderer.gl;\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n source = source || this.source;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n if (!this.noSubImage\n && baseTexture.target === gl.TEXTURE_2D\n && glTexture.width === width\n && glTexture.height === height)\n {\n gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, baseTexture.format, glTexture.type, source);\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(baseTexture.target, 0, glTexture.internalFormat, baseTexture.format, glTexture.type, source);\n }\n\n return true;\n }\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 update(): void\n {\n if (this.destroyed)\n {\n return;\n }\n\n const source = this.source as any;\n\n const width = source.naturalWidth || source.videoWidth || source.width;\n const height = source.naturalHeight || source.videoHeight || source.height;\n\n this.resize(width, height);\n\n super.update();\n }\n\n /** Destroy this {@link BaseImageResource} */\n dispose(): void\n {\n this.source = null;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * @interface OffscreenCanvas\n */\n\n/**\n * Resource type for HTMLCanvasElement.\n *\n * @memberof PIXI\n */\nexport class CanvasResource extends BaseImageResource\n{\n /**\n * @param source - Canvas element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: HTMLCanvasElement)\n {\n super(source);\n }\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 static test(source: unknown): source is OffscreenCanvas|HTMLCanvasElement\n {\n const { OffscreenCanvas } = self;\n\n // Check for browsers that don't yet support OffscreenCanvas\n if (OffscreenCanvas && source instanceof OffscreenCanvas)\n {\n return true;\n }\n\n return self.HTMLCanvasElement && source instanceof HTMLCanvasElement;\n }\n}\n","import { AbstractMultiResource } from './AbstractMultiResource';\nimport { TARGETS } from '@pixi/constants';\n\nimport type { Resource } from './Resource';\nimport type { ISize } from '@pixi/math';\nimport type { ArrayFixed } from '@pixi/utils';\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Constructor options for CubeResource\n */\nexport interface ICubeResourceOptions extends ISize\n{\n /** Whether to auto-load resources */\n autoLoad?: boolean;\n\n /** In case BaseTextures are supplied, whether to copy them or use. */\n linkBaseTexture?: boolean;\n}\n\n/**\n * Resource for a CubeTexture which contains six resources.\n *\n * @memberof PIXI\n */\nexport class CubeResource extends AbstractMultiResource\n{\n items: ArrayFixed;\n\n /**\n * In case BaseTextures are supplied, whether to use same resource or bind baseTexture itself.\n *\n * @protected\n */\n linkBaseTexture: boolean;\n\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 constructor(source?: ArrayFixed, options?: ICubeResourceOptions)\n {\n const { width, height, autoLoad, linkBaseTexture } = options || {};\n\n if (source && source.length !== CubeResource.SIDES)\n {\n throw new Error(`Invalid length. Got ${source.length}, expected 6`);\n }\n\n super(6, { width, height });\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n this.items[i].target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + i;\n }\n\n this.linkBaseTexture = linkBaseTexture !== false;\n\n if (source)\n {\n this.initFromArray(source, options);\n }\n\n if (autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Add binding.\n *\n * @param baseTexture - parent base texture\n */\n bind(baseTexture: BaseTexture): void\n {\n super.bind(baseTexture);\n\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP;\n }\n\n addBaseTextureAt(baseTexture: BaseTexture, index: number, linkBaseTexture?: boolean): this\n {\n if (linkBaseTexture === undefined)\n {\n linkBaseTexture = this.linkBaseTexture;\n }\n\n if (!this.items[index])\n {\n throw new Error(`Index ${index} is out of bounds`);\n }\n\n if (!this.linkBaseTexture\n || baseTexture.parentTextureArray\n || Object.keys(baseTexture._glTextures).length > 0)\n {\n // copy mode\n if (baseTexture.resource)\n {\n this.addResourceAt(baseTexture.resource, index);\n }\n else\n {\n throw new Error(`CubeResource does not support copying of renderTexture.`);\n }\n }\n else\n {\n // link mode, the difficult one!\n baseTexture.target = TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X + index;\n baseTexture.parentTextureArray = this.baseTexture;\n\n this.items[index] = baseTexture;\n }\n\n if (baseTexture.valid && !this.valid)\n {\n this.resize(baseTexture.realWidth, baseTexture.realHeight);\n }\n\n this.items[index] = baseTexture;\n\n return this;\n }\n\n /**\n * Upload the resource\n *\n * @returns {boolean} true is success\n */\n upload(renderer: Renderer, _baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const dirty = this.itemDirtyIds;\n\n for (let i = 0; i < CubeResource.SIDES; i++)\n {\n const side = this.items[i];\n\n if (dirty[i] < side.dirtyId)\n {\n if (side.valid && side.resource)\n {\n side.resource.upload(renderer, side, glTexture);\n dirty[i] = side.dirtyId;\n }\n else if (dirty[i] < -1)\n {\n // either item is not valid yet, either its a renderTexture\n // allocate the memory\n renderer.gl.texImage2D(side.target, 0,\n glTexture.internalFormat,\n _baseTexture.realWidth,\n _baseTexture.realHeight,\n 0,\n _baseTexture.format,\n glTexture.type,\n null);\n dirty[i] = -1;\n }\n }\n }\n\n return true;\n }\n\n /** Number of texture sides to store for CubeResources. */\n static SIDES = 6;\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 static test(source: unknown): source is ArrayFixed\n {\n return Array.isArray(source) && source.length === CubeResource.SIDES;\n }\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { settings } from '@pixi/settings';\nimport { ALPHA_MODES } from '@pixi/constants';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\nexport interface IImageResourceOptions\n{\n /** Start loading process */\n autoLoad?: boolean;\n\n /** Whether its required to create a bitmap before upload. */\n createBitmap?: boolean;\n\n /** Load image using cross origin. */\n crossorigin?: boolean|string;\n\n /** Premultiply image alpha in bitmap. */\n alphaMode?: ALPHA_MODES;\n}\n\n/**\n * Resource type for HTMLImageElement.\n *\n * @memberof PIXI\n */\nexport class ImageResource extends BaseImageResource\n{\n /** URL of the image source */\n url: string;\n\n /**\n * If the image should be disposed after upload\n *\n * @default false\n */\n preserveBitmap: boolean;\n\n /**\n * If capable, convert the image using createImageBitmap API.\n *\n * @default PIXI.settings.CREATE_IMAGE_BITMAP\n */\n createBitmap: boolean;\n\n /**\n * Controls texture alphaMode field\n * Copies from options\n * Default is `null`, copies option from baseTexture\n *\n * @readonly\n */\n alphaMode: ALPHA_MODES;\n\n /**\n * The ImageBitmap element created for a {@code HTMLImageElement}.\n *\n * @default null\n */\n bitmap: ImageBitmap;\n\n /**\n * Promise when loading.\n *\n * @default null\n */\n private _load: Promise;\n\n /** When process is completed */\n private _process: Promise;\n\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 constructor(source: HTMLImageElement|string, options?: IImageResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLImageElement))\n {\n const imageElement = new Image();\n\n BaseImageResource.crossOrigin(imageElement, source, options.crossorigin);\n\n imageElement.src = source;\n source = imageElement;\n }\n\n super(source);\n\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 {\n this._width = 0;\n this._height = 0;\n }\n\n this.url = source.src;\n\n this._process = null;\n\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\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Returns a promise when image will be loaded and processed.\n *\n * @param createBitmap - whether process image into bitmap\n */\n load(createBitmap?: boolean): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n if (createBitmap !== undefined)\n {\n this.createBitmap = createBitmap;\n }\n\n this._load = new Promise((resolve, reject): void =>\n {\n const source = this.source as HTMLImageElement;\n\n this.url = source.src;\n\n const completed = (): void =>\n {\n if (this.destroyed)\n {\n return;\n }\n source.onload = null;\n source.onerror = null;\n\n this.resize(source.width, source.height);\n this._load = null;\n\n if (this.createBitmap)\n {\n resolve(this.process());\n }\n else\n {\n resolve(this);\n }\n };\n\n if (source.complete && source.src)\n {\n completed();\n }\n else\n {\n source.onload = completed;\n source.onerror = (event): void =>\n {\n // Avoids Promise freezing when resource broken\n reject(event);\n this.onError.emit(event);\n };\n }\n });\n\n return this._load;\n }\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 process(): Promise\n {\n const source = this.source as HTMLImageElement;\n\n if (this._process !== null)\n {\n return this._process;\n }\n if (this.bitmap !== null || !self.createImageBitmap)\n {\n return Promise.resolve(this);\n }\n\n const createImageBitmap = self.createImageBitmap as any;\n const cors = !source.crossOrigin || source.crossOrigin === 'anonymous';\n\n this._process = fetch(source.src,\n {\n mode: cors ? 'cors' : 'no-cors'\n })\n .then((r) => r.blob())\n .then((blob) => createImageBitmap(blob,\n 0, 0, source.width, source.height,\n {\n premultiplyAlpha: this.alphaMode === ALPHA_MODES.UNPACK ? 'premultiply' : 'none',\n }))\n .then((bitmap: ImageBitmap) =>\n {\n if (this.destroyed)\n {\n return Promise.reject();\n }\n this.bitmap = bitmap;\n this.update();\n this._process = null;\n\n return Promise.resolve(this);\n });\n\n return this._process;\n }\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 upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n if (typeof this.alphaMode === 'number')\n {\n // bitmap stores unpack premultiply flag, we dont have to notify texImage2D about it\n\n baseTexture.alphaMode = this.alphaMode;\n }\n\n if (!this.createBitmap)\n {\n return super.upload(renderer, baseTexture, glTexture);\n }\n if (!this.bitmap)\n {\n // yeah, ignore the output\n this.process();\n if (!this.bitmap)\n {\n return false;\n }\n }\n\n super.upload(renderer, baseTexture, glTexture, this.bitmap);\n\n if (!this.preserveBitmap)\n {\n // checks if there are other renderers that possibly need this bitmap\n\n let flag = true;\n\n const glTextures = baseTexture._glTextures;\n\n for (const key in glTextures)\n {\n const otherTex = glTextures[key];\n\n if (otherTex !== glTexture && otherTex.dirtyId !== baseTexture.dirtyId)\n {\n flag = false;\n break;\n }\n }\n\n if (flag)\n {\n if (this.bitmap.close)\n {\n this.bitmap.close();\n }\n\n this.bitmap = null;\n }\n }\n\n return true;\n }\n\n /** Destroys this resource. */\n dispose(): void\n {\n (this.source as HTMLImageElement).onload = null;\n (this.source as HTMLImageElement).onerror = null;\n\n super.dispose();\n\n if (this.bitmap)\n {\n this.bitmap.close();\n this.bitmap = null;\n }\n this._process = null;\n this._load = null;\n }\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 static test(source: unknown): source is string|HTMLImageElement\n {\n return typeof source === 'string' || source instanceof HTMLImageElement;\n }\n}\n","import { uid } from '@pixi/utils';\nimport { BaseImageResource } from './BaseImageResource';\n\nimport type { ISize } from '@pixi/math';\n\nexport interface ISVGResourceOptions\n{\n source?: string;\n scale?: number;\n width?: number;\n height?: number;\n autoLoad?: boolean;\n crossorigin?: boolean|string;\n}\n/**\n * Resource type for SVG elements and graphics.\n *\n * @memberof PIXI\n */\nexport class SVGResource extends BaseImageResource\n{\n /** Base64 encoded SVG element or URL for SVG file. */\n public readonly svg: string;\n\n /** The source scale to apply when rasterizing on load. */\n public readonly scale: number;\n\n /** A width override for rasterization on load. */\n public readonly _overrideWidth: number;\n\n /** A height override for rasterization on load. */\n public readonly _overrideHeight: number;\n\n /** Call when completely loaded. */\n private _resolve: () => void;\n\n /** Promise when loading */\n private _load: Promise;\n\n /** Cross origin value to use */\n private _crossorigin?: boolean|string;\n\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 constructor(sourceBase64: string, options?: ISVGResourceOptions)\n {\n options = options || {};\n\n super(document.createElement('canvas'));\n this._width = 0;\n this._height = 0;\n\n this.svg = sourceBase64;\n this.scale = options.scale || 1;\n this._overrideWidth = options.width;\n this._overrideHeight = options.height;\n\n this._resolve = null;\n this._crossorigin = options.crossorigin;\n this._load = null;\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n this._load = new Promise((resolve): void =>\n {\n // Save this until after load is finished\n this._resolve = (): void =>\n {\n this.resize(this.source.width, this.source.height);\n resolve(this);\n };\n\n // Convert SVG inline string to data-uri\n if (SVGResource.SVG_XML.test(this.svg.trim()))\n {\n if (!btoa)\n {\n throw new Error('Your browser doesn\\'t support base64 conversions.');\n }\n (this as any).svg = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`;\n }\n\n this._loadSvg();\n });\n\n return this._load;\n }\n\n /** Loads an SVG image from `imageUrl` or `data URL`. */\n private _loadSvg(): void\n {\n const tempImage = new Image();\n\n BaseImageResource.crossOrigin(tempImage, this.svg, this._crossorigin);\n tempImage.src = this.svg;\n\n tempImage.onerror = (event): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n tempImage.onerror = null;\n this.onError.emit(event);\n };\n\n tempImage.onload = (): void =>\n {\n if (!this._resolve)\n {\n return;\n }\n\n const svgWidth = tempImage.width;\n const svgHeight = tempImage.height;\n\n if (!svgWidth || !svgHeight)\n {\n throw new Error('The SVG image must have width and height defined (in pixels), canvas API needs them.');\n }\n\n // Set render size\n let width = svgWidth * this.scale;\n let height = svgHeight * this.scale;\n\n if (this._overrideWidth || this._overrideHeight)\n {\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\n // Create a canvas element\n const canvas = this.source as HTMLCanvasElement;\n\n canvas.width = width;\n canvas.height = height;\n (canvas as any)._pixiId = `canvas_${uid()}`;\n\n // Draw the Svg to the canvas\n canvas\n .getContext('2d')\n .drawImage(tempImage, 0, 0, svgWidth, svgHeight, 0, 0, width, height);\n\n this._resolve();\n this._resolve = null;\n };\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 static getSize(svgString?: string): ISize\n {\n const sizeMatch = SVGResource.SVG_SIZE.exec(svgString);\n const size: any = {};\n\n if (sizeMatch)\n {\n size[sizeMatch[1]] = Math.round(parseFloat(sizeMatch[3]));\n size[sizeMatch[5]] = Math.round(parseFloat(sizeMatch[7]));\n }\n\n return size;\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n super.dispose();\n this._resolve = null;\n this._crossorigin = null;\n }\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 static test(source: unknown, extension?: string): boolean\n {\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 /**\n * Regular expression for SVG XML document.\n *\n * @example <?xml version=\"1.0\" encoding=\"utf-8\" ?><!-- image/svg --><svg\n * @readonly\n */\n static SVG_XML = /^(<\\?xml[^?]+\\?>)?\\s*()]*-->)?\\s*\\]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*(?:\\s(width|height)=('|\")(\\d*(?:\\.\\d+)?)(?:px)?('|\"))[^>]*>/i; // eslint-disable-line max-len\n}\n","import { BaseImageResource } from './BaseImageResource';\nimport { Ticker } from '@pixi/ticker';\n\nimport type { Dict } from '@pixi/utils';\n\nexport interface IVideoResourceOptions\n{\n autoLoad?: boolean;\n autoPlay?: boolean;\n updateFPS?: number;\n crossorigin?: boolean|string;\n}\n\nexport interface IVideoResourceOptionsElement\n{\n src: string;\n mime: string;\n}\n\n/**\n * Resource type for {@code HTMLVideoElement}.\n *\n * @memberof PIXI\n */\nexport class VideoResource extends BaseImageResource\n{\n /** Override the source to be the video element. */\n public source: HTMLVideoElement;\n\n /**\n * `true` to use PIXI.Ticker.shared to auto update the base texture.\n *\n * @default true\n */\n protected _autoUpdate: boolean;\n\n /**\n * `true` if the instance is currently connected to PIXI.Ticker.shared to auto update the base texture.\n *\n * @default false\n */\n protected _isConnectedToTicker: boolean;\n protected _updateFPS: number;\n protected _msToNextUpdate: number;\n\n /**\n * When set to true will automatically play videos used by this texture once\n * they are loaded. If false, it will not modify the playing state.\n *\n * @default true\n */\n protected autoPlay: boolean;\n\n /**\n * Promise when loading.\n *\n * @default null\n */\n private _load: Promise;\n\n /** Callback when completed with load. */\n private _resolve: (value?: VideoResource | PromiseLike) => void;\n\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 constructor(source?: HTMLVideoElement|Array|string, options?: IVideoResourceOptions)\n {\n options = options || {};\n\n if (!(source instanceof HTMLVideoElement))\n {\n const videoElement = document.createElement('video');\n\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\n if (typeof source === 'string')\n {\n source = [source];\n }\n\n const firstSrc = (source[0] as IVideoResourceOptionsElement).src || source[0] as string;\n\n BaseImageResource.crossOrigin(videoElement, firstSrc, options.crossorigin);\n\n // array of objects or strings\n for (let i = 0; i < source.length; ++i)\n {\n const sourceElement = document.createElement('source');\n\n let { src, mime } = source[i] as IVideoResourceOptionsElement;\n\n src = src || source[i] as string;\n\n const baseSrc = src.split('?').shift().toLowerCase();\n const ext = baseSrc.substr(baseSrc.lastIndexOf('.') + 1);\n\n mime = mime || VideoResource.MIME_TYPES[ext] || `video/${ext}`;\n\n sourceElement.src = src;\n sourceElement.type = mime;\n\n videoElement.appendChild(sourceElement);\n }\n\n // Override the source\n source = videoElement;\n }\n\n super(source);\n\n this.noSubImage = true;\n\n this._autoUpdate = true;\n this._isConnectedToTicker = false;\n\n this._updateFPS = options.updateFPS || 0;\n this._msToNextUpdate = 0;\n this.autoPlay = options.autoPlay !== false;\n\n this._load = null;\n this._resolve = null;\n\n // Bind for listeners\n this._onCanPlay = this._onCanPlay.bind(this);\n this._onError = this._onError.bind(this);\n\n if (options.autoLoad !== false)\n {\n this.load();\n }\n }\n\n /**\n * Trigger updating of the texture.\n *\n * @param deltaTime - time delta since last tick\n */\n update(_deltaTime = 0): void\n {\n if (!this.destroyed)\n {\n // account for if video has had its playbackRate changed\n const elapsedMS = Ticker.shared.elapsedMS * (this.source as HTMLVideoElement).playbackRate;\n\n this._msToNextUpdate = Math.floor(this._msToNextUpdate - elapsedMS);\n if (!this._updateFPS || this._msToNextUpdate <= 0)\n {\n super.update(/* deltaTime*/);\n this._msToNextUpdate = this._updateFPS ? Math.floor(1000 / this._updateFPS) : 0;\n }\n }\n }\n\n /**\n * Start preloading the video resource.\n *\n * @return {Promise} Handle the validate event\n */\n load(): Promise\n {\n if (this._load)\n {\n return this._load;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if ((source.readyState === source.HAVE_ENOUGH_DATA || source.readyState === source.HAVE_FUTURE_DATA)\n && source.width && source.height)\n {\n (source as any).complete = true;\n }\n\n source.addEventListener('play', this._onPlayStart.bind(this));\n source.addEventListener('pause', this._onPlayStop.bind(this));\n\n if (!this._isSourceReady())\n {\n source.addEventListener('canplay', this._onCanPlay);\n source.addEventListener('canplaythrough', this._onCanPlay);\n source.addEventListener('error', this._onError, true);\n }\n else\n {\n this._onCanPlay();\n }\n\n this._load = new Promise((resolve): void =>\n {\n if (this.valid)\n {\n resolve(this);\n }\n else\n {\n this._resolve = resolve;\n\n source.load();\n }\n });\n\n return this._load;\n }\n\n /** Handle video error events. */\n private _onError(event: ErrorEvent): void\n {\n (this.source as HTMLVideoElement).removeEventListener('error', this._onError, true);\n this.onError.emit(event);\n }\n\n /**\n * Returns true if the underlying source is playing.\n *\n * @return - True if playing.\n */\n private _isSourcePlaying(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return (source.currentTime > 0 && source.paused === false && source.ended === false && source.readyState > 2);\n }\n\n /**\n * Returns true if the underlying source is ready for playing.\n *\n * @return - True if ready.\n */\n private _isSourceReady(): boolean\n {\n const source = this.source as HTMLVideoElement;\n\n return source.readyState === 3 || source.readyState === 4;\n }\n\n /** Runs the update loop when the video is ready to play. */\n private _onPlayStart(): void\n {\n // Just in case the video has not received its can play even yet..\n if (!this.valid)\n {\n this._onCanPlay();\n }\n\n if (this.autoUpdate && !this._isConnectedToTicker)\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n\n /** Fired when a pause event is triggered, stops the update loop. */\n private _onPlayStop(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n }\n\n /** Fired when the video is loaded and ready to play. */\n private _onCanPlay(): void\n {\n const source = this.source as HTMLVideoElement;\n\n source.removeEventListener('canplay', this._onCanPlay);\n source.removeEventListener('canplaythrough', this._onCanPlay);\n\n const valid = this.valid;\n\n this.resize(source.videoWidth, source.videoHeight);\n\n // prevent multiple loaded dispatches..\n if (!valid && this._resolve)\n {\n this._resolve(this);\n this._resolve = null;\n }\n\n if (this._isSourcePlaying())\n {\n this._onPlayStart();\n }\n else if (this.autoPlay)\n {\n source.play();\n }\n }\n\n /** Destroys this texture. */\n dispose(): void\n {\n if (this._isConnectedToTicker)\n {\n Ticker.shared.remove(this.update, this);\n this._isConnectedToTicker = false;\n }\n\n const source = this.source as HTMLVideoElement;\n\n if (source)\n {\n source.removeEventListener('error', this._onError, true);\n source.pause();\n source.src = '';\n source.load();\n }\n super.dispose();\n }\n\n /** Should the base texture automatically update itself, set to true by default. */\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._isSourcePlaying())\n {\n Ticker.shared.add(this.update, this);\n this._isConnectedToTicker = true;\n }\n }\n }\n\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 updateFPS(): number\n {\n return this._updateFPS;\n }\n\n set updateFPS(value: number)\n {\n if (value !== this._updateFPS)\n {\n this._updateFPS = value;\n }\n }\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 static test(source: unknown, extension?: string): source is HTMLVideoElement\n {\n return (self.HTMLVideoElement && source instanceof HTMLVideoElement)\n || VideoResource.TYPES.indexOf(extension) > -1;\n }\n\n /**\n * List of common video file extensions supported by VideoResource.\n *\n * @readonly\n */\n static TYPES: Array = ['mp4', 'm4v', 'webm', 'ogg', 'ogv', 'h264', 'avi', 'mov'];\n\n /**\n * Map of video MIME types that can't be directly derived from file extensions.\n *\n * @readonly\n */\n static MIME_TYPES: Dict = {\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n m4v: 'video/mp4',\n };\n}\n","import { BaseImageResource } from './BaseImageResource';\n\n/**\n * Resource type for ImageBitmap.\n *\n * @memberof PIXI\n */\nexport class ImageBitmapResource extends BaseImageResource\n{\n /**\n * @param source - Image element to use\n */\n // eslint-disable-next-line @typescript-eslint/no-useless-constructor\n constructor(source: ImageBitmap)\n {\n super(source);\n }\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 static test(source: unknown): source is ImageBitmap\n {\n return !!self.createImageBitmap && source instanceof ImageBitmap;\n }\n}\n","import { INSTALLED } from './autoDetectResource';\nimport { ArrayResource } from './ArrayResource';\nimport { BufferResource } from './BufferResource';\nimport { CanvasResource } from './CanvasResource';\nimport { CubeResource } from './CubeResource';\nimport { ImageResource } from './ImageResource';\nimport { SVGResource } from './SVGResource';\nimport { VideoResource } from './VideoResource';\nimport { ImageBitmapResource } from './ImageBitmapResource';\n\nexport * from './Resource';\nexport * from './BaseImageResource';\n\nINSTALLED.push(\n ImageResource,\n ImageBitmapResource,\n CanvasResource,\n VideoResource,\n SVGResource,\n BufferResource,\n CubeResource,\n ArrayResource\n);\n\nexport * from './autoDetectResource';\nexport * from './AbstractMultiResource';\nexport * from './ArrayResource';\nexport * from './BufferResource';\nexport * from './CanvasResource';\nexport * from './CubeResource';\nexport * from './ImageResource';\nexport * from './SVGResource';\nexport * from './VideoResource';\nexport * from './ImageBitmapResource';\n","import { ALPHA_MODES } from '@pixi/constants';\nimport { BufferResource } from './BufferResource';\n\nimport type { BaseTexture } from '../BaseTexture';\nimport type { Renderer } from '../../Renderer';\nimport type { GLTexture } from '../GLTexture';\n\n/**\n * Resource type for DepthTexture.\n *\n * @memberof PIXI\n */\nexport class DepthResource extends BufferResource\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 upload(renderer: Renderer, baseTexture: BaseTexture, glTexture: GLTexture): boolean\n {\n const gl = renderer.gl;\n\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, baseTexture.alphaMode === ALPHA_MODES.UNPACK);\n\n const width = baseTexture.realWidth;\n const height = baseTexture.realHeight;\n\n if (glTexture.width === width && glTexture.height === height)\n {\n gl.texSubImage2D(\n baseTexture.target,\n 0,\n 0,\n 0,\n width,\n height,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n else\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(\n baseTexture.target,\n 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n baseTexture.format,\n glTexture.type,\n this.data,\n );\n }\n\n return true;\n }\n}\n","import { Runner } from '@pixi/runner';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { DepthResource } from '../textures/resources/DepthResource';\nimport { FORMATS, MIPMAP_MODES, SCALE_MODES, TYPES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { GLFramebuffer } from './GLFramebuffer';\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 */\nexport class Framebuffer\n{\n public width: number;\n public height: number;\n public multisample: MSAA_QUALITY;\n\n stencil: boolean;\n depth: boolean;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n depthTexture: BaseTexture;\n colorTextures: Array;\n glFramebuffers: {[key: string]: GLFramebuffer};\n disposeRunner: Runner;\n\n /**\n * @param {number} width - Width of the frame buffer\n * @param {number} height - Height of the frame buffer\n */\n constructor(width: number, height: number)\n {\n /**\n * Width of framebuffer in pixels\n * @member {number}\n */\n this.width = Math.round(width || 100);\n\n /**\n * Height of framebuffer in pixels\n * @member {number}\n */\n this.height = Math.round(height || 100);\n\n this.stencil = false;\n this.depth = false;\n\n this.dirtyId = 0;\n this.dirtyFormat = 0;\n this.dirtySize = 0;\n\n this.depthTexture = null;\n this.colorTextures = [];\n\n this.glFramebuffers = {};\n\n this.disposeRunner = new Runner('disposeFramebuffer');\n\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\n /**\n * Reference to the colorTexture.\n *\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n get colorTexture(): BaseTexture\n {\n return this.colorTextures[0];\n }\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 addColorTexture(index = 0, texture?: BaseTexture): this\n {\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\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Add a depth texture to the frame buffer\n *\n * @param {PIXI.BaseTexture} [texture] - Texture to add\n */\n addDepthTexture(texture?: BaseTexture): this\n {\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\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable depth on the frame buffer\n */\n enableDepth(): this\n {\n this.depth = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\n\n /**\n * Enable stencil on the frame buffer\n */\n enableStencil(): this\n {\n this.stencil = true;\n\n this.dirtyId++;\n this.dirtyFormat++;\n\n return this;\n }\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 resize(width: number, height: number): void\n {\n width = Math.round(width);\n height = Math.round(height);\n\n if (width === this.width && height === this.height) return;\n\n this.width = width;\n this.height = height;\n\n this.dirtyId++;\n this.dirtySize++;\n\n for (let i = 0; i < this.colorTextures.length; i++)\n {\n const texture = this.colorTextures[i];\n const resolution = texture.resolution;\n\n // take into account the fact the texture may have a different resolution..\n texture.setSize(width / resolution, height / resolution);\n }\n\n if (this.depthTexture)\n {\n const resolution = this.depthTexture.resolution;\n\n this.depthTexture.setSize(width / resolution, height / resolution);\n }\n }\n\n /**\n * Disposes WebGL resources that are connected to this geometry\n */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /**\n * Destroys and removes the depth texture added to this framebuffer.\n */\n destroyDepthTexture(): void\n {\n if (this.depthTexture)\n {\n this.depthTexture.destroy();\n this.depthTexture = null;\n\n ++this.dirtyId;\n ++this.dirtyFormat;\n }\n }\n}\n","import { BaseTexture } from '../textures/BaseTexture';\nimport { Framebuffer } from '../framebuffer/Framebuffer';\nimport { MIPMAP_MODES, MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MaskData } from '../mask/MaskData';\n\nexport interface BaseRenderTexture extends GlobalMixins.BaseRenderTexture, BaseTexture {}\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 */\nexport class BaseRenderTexture extends BaseTexture\n{\n public clearColor: number[];\n public framebuffer: Framebuffer;\n maskStack: Array;\n filterStack: Array;\n\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 constructor(options?: IBaseTextureOptions)\n {\n if (typeof options === 'number')\n {\n /* eslint-disable prefer-rest-params */\n // Backward compatibility of signature\n const width = arguments[0];\n const height = arguments[1];\n const scaleMode = arguments[2];\n const resolution = arguments[3];\n\n options = { width, height, scaleMode, resolution };\n /* eslint-enable prefer-rest-params */\n }\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\n super(null, options);\n\n // Set defaults\n this.mipmap = MIPMAP_MODES.OFF;\n this.valid = true;\n\n this.clearColor = [0, 0, 0, 0];\n\n this.framebuffer = new Framebuffer(this.realWidth, this.realHeight)\n .addColorTexture(0, this);\n this.framebuffer.multisample = options.multisample;\n\n // TODO - could this be added the systems?\n\n /**\n * The data structure for the stencil masks.\n *\n * @member {PIXI.MaskData[]}\n */\n this.maskStack = [];\n\n /**\n * The data structure for the filters.\n *\n * @member {Object[]}\n */\n this.filterStack = [{}];\n }\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 resize(desiredWidth: number, desiredHeight: number): void\n {\n this.framebuffer.resize(desiredWidth * this.resolution, desiredHeight * this.resolution);\n this.setRealSize(this.framebuffer.width, this.framebuffer.height);\n }\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 dispose(): void\n {\n this.framebuffer.dispose();\n\n super.dispose();\n }\n\n /**\n * Destroys this texture.\n */\n destroy(): void\n {\n super.destroy();\n\n this.framebuffer.destroyDepthTexture();\n this.framebuffer = null;\n }\n}\n","import { groupD8 } from '@pixi/math';\n\nimport type { Rectangle, ISize } from '@pixi/math';\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 */\nexport class TextureUvs\n{\n public x0: number;\n public y0: number;\n public x1: number;\n public y1: number;\n public x2: number;\n public y2: number;\n public x3: number;\n public y3: number;\n public uvsFloat32: Float32Array;\n\n constructor()\n {\n /**\n * X-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.x0 = 0;\n\n /**\n * Y-component of top-left corner `(x0,y0)`.\n *\n * @member {number}\n */\n this.y0 = 0;\n\n /**\n * X-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.x1 = 1;\n\n /**\n * Y-component of top-right corner `(x1,y1)`.\n *\n * @member {number}\n */\n this.y1 = 0;\n\n /**\n * X-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.x2 = 1;\n\n /**\n * Y-component of bottom-right corner `(x2,y2)`.\n *\n * @member {number}\n */\n this.y2 = 1;\n\n /**\n * X-component of bottom-left corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.x3 = 0;\n\n /**\n * Y-component of bottom-right corner `(x3,y3)`.\n *\n * @member {number}\n */\n this.y3 = 1;\n\n this.uvsFloat32 = new Float32Array(8);\n }\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 set(frame: Rectangle, baseFrame: ISize, rotate: number): void\n {\n const tw = baseFrame.width;\n const th = baseFrame.height;\n\n if (rotate)\n {\n // width and height div 2 div baseFrame size\n const w2 = frame.width / 2 / tw;\n const h2 = frame.height / 2 / th;\n\n // coordinates of center\n const cX = (frame.x / tw) + w2;\n const cY = (frame.y / th) + h2;\n\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\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\n rotate = groupD8.add(rotate, 2);\n this.x2 = cX + (w2 * groupD8.uX(rotate));\n this.y2 = cY + (h2 * groupD8.uY(rotate));\n\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 {\n this.x0 = frame.x / tw;\n this.y0 = frame.y / th;\n\n this.x1 = (frame.x + frame.width) / tw;\n this.y1 = frame.y / th;\n\n this.x2 = (frame.x + frame.width) / tw;\n this.y2 = (frame.y + frame.height) / th;\n\n this.x3 = frame.x / tw;\n this.y3 = (frame.y + frame.height) / th;\n }\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\n // #if _DEBUG\n toString(): string\n {\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 // #endif\n}\n","import { BaseTexture } from './BaseTexture';\nimport { ImageResource } from './resources/ImageResource';\nimport { CanvasResource } from './resources/CanvasResource';\nimport { TextureUvs } from './TextureUvs';\nimport { settings } from '@pixi/settings';\nimport { Rectangle, Point } from '@pixi/math';\nimport { uid, TextureCache, getResolutionOfUrl, EventEmitter } from '@pixi/utils';\n\nimport type { Resource } from './resources/Resource';\nimport type { BufferResource } from './resources/BufferResource';\nimport type { IPointData, ISize } from '@pixi/math';\nimport type { IBaseTextureOptions, ImageSource } from './BaseTexture';\nimport type { TextureMatrix } from './TextureMatrix';\n\nconst DEFAULT_UVS = new TextureUvs();\n\nexport type TextureSource = string|BaseTexture|ImageSource;\n\nexport interface Texture extends GlobalMixins.Texture, EventEmitter {}\n\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 */\nexport class Texture extends EventEmitter\n{\n public baseTexture: BaseTexture;\n public orig: Rectangle;\n public trim: Rectangle;\n public valid: boolean;\n public noFrame: boolean;\n public defaultAnchor: Point;\n public uvMatrix: TextureMatrix;\n protected _rotate: number;\n _updateID: number;\n _frame: Rectangle;\n _uvs: TextureUvs;\n textureCacheIds: Array;\n\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 constructor(baseTexture: BaseTexture, frame?: Rectangle,\n orig?: Rectangle, trim?: Rectangle, rotate?: number, anchor?: IPointData)\n {\n super();\n\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\n if (!frame)\n {\n this.noFrame = true;\n frame = new Rectangle(0, 0, 1, 1);\n }\n\n if (baseTexture instanceof Texture)\n {\n baseTexture = baseTexture.baseTexture;\n }\n\n /**\n * The base texture that this texture uses.\n *\n * @member {PIXI.BaseTexture}\n */\n this.baseTexture = baseTexture;\n\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 /**\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 /**\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 /**\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 /**\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 /**\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\n this._rotate = Number(rotate || 0);\n\n if (rotate as any === true)\n {\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 {\n throw new Error('attempt to use diamond-shaped UVs. If you are sure, set rotation manually');\n }\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 /**\n * Update ID is observed by sprites and TextureMatrix instances.\n * Call updateUvs() to increment it.\n *\n * @member {number}\n * @protected\n */\n\n this._updateID = 0;\n\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\n if (!baseTexture.valid)\n {\n baseTexture.once('loaded', this.onBaseTextureUpdated, this);\n }\n else if (this.noFrame)\n {\n // if there is no frame we should monitor for any base texture changes..\n if (baseTexture.valid)\n {\n this.onBaseTextureUpdated(baseTexture);\n }\n }\n else\n {\n this.frame = frame;\n }\n\n if (this.noFrame)\n {\n baseTexture.on('update', this.onBaseTextureUpdated, this);\n }\n }\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 update(): void\n {\n if (this.baseTexture.resource)\n {\n this.baseTexture.resource.update();\n }\n }\n\n /**\n * Called when the base texture is updated\n *\n * @protected\n * @param {PIXI.BaseTexture} baseTexture - The base texture.\n */\n onBaseTextureUpdated(baseTexture: BaseTexture): void\n {\n if (this.noFrame)\n {\n if (!this.baseTexture.valid)\n {\n return;\n }\n\n this._frame.width = baseTexture.width;\n this._frame.height = baseTexture.height;\n this.valid = true;\n this.updateUvs();\n }\n else\n {\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\n this.emit('update', this);\n }\n\n /**\n * Destroys this texture\n *\n * @param {boolean} [destroyBase=false] - Whether to destroy the base texture as well\n */\n destroy(destroyBase?: boolean): void\n {\n if (this.baseTexture)\n {\n if (destroyBase)\n {\n const { resource } = this.baseTexture as unknown as BaseTexture;\n\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 {\n Texture.removeFromCache(resource.url);\n }\n\n this.baseTexture.destroy();\n }\n\n this.baseTexture.off('loaded', this.onBaseTextureUpdated, this);\n this.baseTexture.off('update', this.onBaseTextureUpdated, this);\n\n this.baseTexture = null;\n }\n\n this._frame = null;\n this._uvs = null;\n this.trim = null;\n this.orig = null;\n\n this.valid = false;\n\n Texture.removeFromCache(this);\n this.textureCacheIds = null;\n }\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 clone(): Texture\n {\n const clonedFrame = this._frame.clone();\n const clonedOrig = this._frame === this.orig ? clonedFrame : this.orig.clone();\n const clonedTexture = new Texture(this.baseTexture,\n !this.noFrame && clonedFrame,\n clonedOrig,\n this.trim && this.trim.clone(),\n this.rotate,\n this.defaultAnchor\n );\n\n if (this.noFrame)\n {\n clonedTexture._frame = clonedFrame;\n }\n\n return clonedTexture;\n }\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 updateUvs(): void\n {\n if (this._uvs === DEFAULT_UVS)\n {\n this._uvs = new TextureUvs();\n }\n\n this._uvs.set(this._frame, this.baseTexture, this.rotate);\n\n this._updateID++;\n }\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 static from(source: TextureSource, options: IBaseTextureOptions = {},\n strict = settings.STRICT_TEXTURE_CACHE): Texture\n {\n const isFrame = typeof source === 'string';\n let cacheId = null;\n\n if (isFrame)\n {\n cacheId = source;\n }\n else if (source instanceof BaseTexture)\n {\n if (!source.cacheId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n source.cacheId = `${prefix}-${uid()}`;\n BaseTexture.addToCache(source, source.cacheId);\n }\n\n cacheId = source.cacheId;\n }\n else\n {\n if (!(source as any)._pixiId)\n {\n const prefix = (options && options.pixiIdPrefix) || 'pixiid';\n\n (source as any)._pixiId = `${prefix}_${uid()}`;\n }\n\n cacheId = (source as any)._pixiId;\n }\n\n let texture = TextureCache[cacheId] as Texture;\n\n // Strict-mode rejects invalid cacheIds\n if (isFrame && strict && !texture)\n {\n throw new Error(`The cacheId \"${cacheId}\" does not exist in TextureCache.`);\n }\n\n if (!texture && !(source instanceof BaseTexture))\n {\n if (!options.resolution)\n {\n options.resolution = getResolutionOfUrl(source as string);\n }\n\n texture = new Texture(new BaseTexture(source, options));\n texture.baseTexture.cacheId = cacheId;\n\n BaseTexture.addToCache(texture.baseTexture, cacheId);\n Texture.addToCache(texture, cacheId);\n }\n else if (!texture && (source instanceof BaseTexture))\n {\n texture = new Texture(source as BaseTexture);\n\n Texture.addToCache(texture, cacheId);\n }\n\n // lets assume its a base texture!\n return texture;\n }\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 static fromURL(\n url: string, options?: IBaseTextureOptions): Promise>\n {\n const resourceOptions = Object.assign({ autoLoad: false }, options?.resourceOptions);\n const texture = Texture.from(url, Object.assign({ resourceOptions }, options), false);\n const resource = texture.baseTexture.resource;\n\n // The texture was already loaded\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // Manually load the texture, this should allow users to handle load errors\n return resource.load().then(() => Promise.resolve(texture));\n }\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 static fromBuffer(buffer: Float32Array|Uint8Array,\n width: number, height: number, options?: IBaseTextureOptions): Texture\n {\n return new Texture(BaseTexture.fromBuffer(buffer, width, height, options));\n }\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 static fromLoader(source: HTMLImageElement|HTMLCanvasElement|string,\n imageUrl: string, name?: string, options?: IBaseTextureOptions): Promise>\n {\n const baseTexture = new BaseTexture(source, Object.assign({\n scaleMode: settings.SCALE_MODE,\n resolution: getResolutionOfUrl(imageUrl),\n }, options));\n\n const { resource } = baseTexture;\n\n if (resource instanceof ImageResource)\n {\n resource.url = imageUrl;\n }\n\n const texture = new Texture(baseTexture);\n\n // No name, use imageUrl instead\n if (!name)\n {\n name = imageUrl;\n }\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\n // also add references by url if they are different.\n if (name !== imageUrl)\n {\n BaseTexture.addToCache(texture.baseTexture, imageUrl);\n Texture.addToCache(texture, imageUrl);\n }\n\n // Generally images are valid right away\n if (texture.baseTexture.valid)\n {\n return Promise.resolve(texture);\n }\n\n // SVG assets need to be parsed async, let's wait\n return new Promise((resolve) =>\n {\n texture.baseTexture.once('loaded', () => resolve(texture));\n });\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 static addToCache(texture: Texture, id: string): void\n {\n if (id)\n {\n if (texture.textureCacheIds.indexOf(id) === -1)\n {\n texture.textureCacheIds.push(id);\n }\n\n if (TextureCache[id])\n {\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\n TextureCache[id] = texture;\n }\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 static removeFromCache(texture: string|Texture): Texture|null\n {\n if (typeof texture === 'string')\n {\n const textureFromCache = TextureCache[texture];\n\n if (textureFromCache)\n {\n const index = textureFromCache.textureCacheIds.indexOf(texture);\n\n if (index > -1)\n {\n textureFromCache.textureCacheIds.splice(index, 1);\n }\n\n delete TextureCache[texture];\n\n return textureFromCache;\n }\n }\n else if (texture && texture.textureCacheIds)\n {\n for (let i = 0; i < texture.textureCacheIds.length; ++i)\n {\n // Check that texture matches the one being passed in before deleting it from the cache.\n if (TextureCache[texture.textureCacheIds[i]] === texture)\n {\n delete TextureCache[texture.textureCacheIds[i]];\n }\n }\n\n texture.textureCacheIds.length = 0;\n\n return texture;\n }\n\n return null;\n }\n\n /**\n * Returns resolution of baseTexture\n *\n * @member {number}\n * @readonly\n */\n get resolution(): number\n {\n return this.baseTexture.resolution;\n }\n\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 frame(): Rectangle\n {\n return this._frame;\n }\n\n set frame(frame: Rectangle)\n {\n this._frame = frame;\n\n this.noFrame = false;\n\n const { x, y, width, height } = frame;\n const xNotFit = x + width > this.baseTexture.width;\n const yNotFit = y + height > this.baseTexture.height;\n\n if (xNotFit || yNotFit)\n {\n const relationship = xNotFit && yNotFit ? 'and' : 'or';\n const errorX = `X: ${x} + ${width} = ${x + width} > ${this.baseTexture.width}`;\n const errorY = `Y: ${y} + ${height} = ${y + height} > ${this.baseTexture.height}`;\n\n throw new Error('Texture Error: frame does not fit inside the base Texture dimensions: '\n + `${errorX} ${relationship} ${errorY}`);\n }\n\n this.valid = width && height && this.baseTexture.valid;\n\n if (!this.trim && !this.rotate)\n {\n this.orig = frame;\n }\n\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\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 rotate(): number\n {\n return this._rotate;\n }\n\n set rotate(rotate: number)\n {\n this._rotate = rotate;\n if (this.valid)\n {\n this.updateUvs();\n }\n }\n\n /**\n * The width of the Texture in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.orig.width;\n }\n\n /**\n * The height of the Texture in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.orig.height;\n }\n\n /**\n * Utility function for BaseTexture|Texture cast\n */\n castToBaseTexture(): BaseTexture\n {\n return this.baseTexture;\n }\n\n static readonly EMPTY: Texture;\n static readonly WHITE: Texture;\n}\n\nfunction createWhiteTexture(): Texture\n{\n const canvas = document.createElement('canvas');\n\n canvas.width = 16;\n canvas.height = 16;\n\n const context = canvas.getContext('2d');\n\n context.fillStyle = 'white';\n context.fillRect(0, 0, 16, 16);\n\n return new Texture(new BaseTexture(new CanvasResource(canvas)));\n}\n\nfunction removeAllHandlers(tex: any): void\n{\n tex.destroy = function _emptyDestroy(): void { /* empty */ };\n tex.on = function _emptyOn(): void { /* empty */ };\n tex.once = function _emptyOnce(): void { /* empty */ };\n tex.emit = function _emptyEmit(): void { /* empty */ };\n}\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 */\n(Texture as any).EMPTY = new Texture(new BaseTexture());\nremoveAllHandlers(Texture.EMPTY);\nremoveAllHandlers(Texture.EMPTY.baseTexture);\n\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 */\n(Texture as any).WHITE = createWhiteTexture();\nremoveAllHandlers(Texture.WHITE);\nremoveAllHandlers(Texture.WHITE.baseTexture);\n","import { BaseRenderTexture } from './BaseRenderTexture';\nimport { Texture } from '../textures/Texture';\n\nimport type { Rectangle } from '@pixi/math';\nimport type { Framebuffer } from '../framebuffer/Framebuffer';\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { MSAA_QUALITY, SCALE_MODES } from '@pixi/constants';\nimport { deprecation } from '@pixi/utils';\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 */\nexport class RenderTexture extends Texture\n{\n public baseTexture: BaseRenderTexture;\n\n /**\n * Stores `sourceFrame` when this texture is inside current filter stack.\n *\n * You can read it inside filters.\n *\n * @readonly\n */\n public filterFrame: Rectangle|null;\n\n /**\n * The key for pooled texture of FilterSystem.\n *\n * @see PIXI.RenderTexturePool\n */\n public filterPoolKey: string|number|null;\n\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 constructor(baseRenderTexture: BaseRenderTexture, frame?: Rectangle)\n {\n super(baseRenderTexture, frame);\n\n this.valid = true;\n\n this.filterFrame = null;\n this.filterPoolKey = null;\n\n this.updateUvs();\n }\n\n /**\n * Shortcut to `this.baseTexture.framebuffer`, saves baseTexture cast.\n *\n * @readonly\n */\n get framebuffer(): Framebuffer\n {\n return this.baseTexture.framebuffer;\n }\n\n /**\n * Shortcut to `this.framebuffer.multisample`.\n *\n * @default PIXI.MSAA_QUALITY.NONE\n */\n get multisample(): MSAA_QUALITY\n {\n return this.framebuffer.multisample;\n }\n\n set multisample(value: MSAA_QUALITY)\n {\n this.framebuffer.multisample = value;\n }\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 resize(desiredWidth: number, desiredHeight: number, resizeBaseTexture = true): void\n {\n const resolution = this.baseTexture.resolution;\n const width = Math.round(desiredWidth * resolution) / resolution;\n const height = Math.round(desiredHeight * resolution) / resolution;\n\n // TODO - could be not required..\n this.valid = (width > 0 && height > 0);\n\n this._frame.width = this.orig.width = width;\n this._frame.height = this.orig.height = height;\n\n if (resizeBaseTexture)\n {\n this.baseTexture.resize(width, height);\n }\n\n this.updateUvs();\n }\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 setResolution(resolution: number): void\n {\n const { baseTexture } = this;\n\n if (baseTexture.resolution === resolution)\n {\n return;\n }\n\n baseTexture.setResolution(resolution);\n this.resize(baseTexture.width, baseTexture.height, false);\n }\n\n /**\n * Use the object-based construction instead.\n *\n * @deprecated since 6.0.0\n * @param {number} [width]\n * @param {number} [height]\n * @param {PIXI.SCALE_MODES} [scaleMode=PIXI.settings.SCALE_MODE]\n * @param {number} [resolution=PIXI.settings.FILTER_RESOLUTION]\n */\n static create(width: number, height: number, scaleMode?: SCALE_MODES, resolution?: number): RenderTexture;\n\n /**\n * A short hand way of creating a render texture.\n *\n * @param options - Options\n * @param {number} [options.width=100] - The width of the render texture\n * @param {number} [options.height=100] - The height of the 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 of the texture\n * being generated\n * @param {PIXI.MSAA_QUALITY} [options.multisample=PIXI.MSAA_QUALITY.NONE] - The number of samples of the frame buffer\n * @return The new render texture\n */\n static create(options?: IBaseTextureOptions): RenderTexture;\n static create(options?: IBaseTextureOptions | number, ...rest: any[]): RenderTexture\n {\n // @deprecated fallback, old-style: create(width, height, scaleMode, resolution)\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Arguments (width, height, scaleMode, resolution) have been deprecated.');\n // #endif\n\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\n return new RenderTexture(new BaseRenderTexture(options));\n }\n}\n","import { RenderTexture } from './RenderTexture';\nimport { BaseRenderTexture } from './BaseRenderTexture';\nimport { nextPow2 } from '@pixi/utils';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { IBaseTextureOptions } from '../textures/BaseTexture';\nimport type { ISize } from '@pixi/math';\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 */\nexport class RenderTexturePool\n{\n public textureOptions: IBaseTextureOptions;\n\n /**\n * Allow renderTextures of the same size as screen, not just pow2\n *\n * Automatically sets to true after `setScreenSize`\n *\n * @default false\n */\n public enableFullScreen: boolean;\n texturePool: {[x in string|number]: RenderTexture[]};\n private _pixelsWidth: number;\n private _pixelsHeight: number;\n\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 constructor(textureOptions?: IBaseTextureOptions)\n {\n this.texturePool = {};\n this.textureOptions = textureOptions || {};\n this.enableFullScreen = false;\n\n this._pixelsWidth = 0;\n this._pixelsHeight = 0;\n }\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 createTexture(realWidth: number, realHeight: number, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n const baseRenderTexture = new BaseRenderTexture(Object.assign({\n width: realWidth,\n height: realHeight,\n resolution: 1,\n multisample,\n }, this.textureOptions));\n\n return new RenderTexture(baseRenderTexture);\n }\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 getOptimalTexture(minWidth: number, minHeight: number, resolution = 1, multisample = MSAA_QUALITY.NONE): RenderTexture\n {\n let key;\n\n minWidth = Math.ceil(minWidth * resolution);\n minHeight = Math.ceil(minHeight * resolution);\n\n if (!this.enableFullScreen || minWidth !== this._pixelsWidth || minHeight !== this._pixelsHeight)\n {\n minWidth = nextPow2(minWidth);\n minHeight = nextPow2(minHeight);\n key = (((minWidth & 0xFFFF) << 16) | (minHeight & 0xFFFF)) >>> 0;\n\n if (multisample > 1)\n {\n key += multisample * 0x100000000;\n }\n }\n else\n {\n key = multisample > 1 ? -multisample : -1;\n }\n\n if (!this.texturePool[key])\n {\n this.texturePool[key] = [];\n }\n\n let renderTexture = this.texturePool[key].pop();\n\n if (!renderTexture)\n {\n renderTexture = this.createTexture(minWidth, minHeight, multisample);\n }\n\n renderTexture.filterPoolKey = key;\n renderTexture.setResolution(resolution);\n\n return renderTexture;\n }\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 getFilterTexture(input: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n const filterTexture = this.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Place a render texture back into the pool.\n *\n * @param renderTexture - The renderTexture to free\n */\n returnTexture(renderTexture: RenderTexture): void\n {\n const key = renderTexture.filterPoolKey;\n\n renderTexture.filterFrame = null;\n this.texturePool[key].push(renderTexture);\n }\n\n /**\n * Alias for returnTexture, to be compliant with FilterSystem interface.\n *\n * @param renderTexture - The renderTexture to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.returnTexture(renderTexture);\n }\n\n /**\n * Clears the pool.\n *\n * @param destroyTextures - Destroy all stored textures.\n */\n clear(destroyTextures?: boolean): void\n {\n destroyTextures = destroyTextures !== false;\n if (destroyTextures)\n {\n for (const i in this.texturePool)\n {\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n }\n }\n\n this.texturePool = {};\n }\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 setScreenSize(size: ISize): void\n {\n if (size.width === this._pixelsWidth\n && size.height === this._pixelsHeight)\n {\n return;\n }\n\n this.enableFullScreen = size.width > 0 && size.height > 0;\n\n for (const i in this.texturePool)\n {\n if (!(Number(i) < 0))\n {\n continue;\n }\n\n const textures = this.texturePool[i];\n\n if (textures)\n {\n for (let j = 0; j < textures.length; j++)\n {\n textures[j].destroy(true);\n }\n }\n\n this.texturePool[i] = [];\n }\n\n this._pixelsWidth = size.width;\n this._pixelsHeight = size.height;\n }\n\n /**\n * Key that is used to store fullscreen renderTextures in a pool\n *\n * @constant\n */\n static SCREEN_KEY = -1;\n}\n","import { TYPES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\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 */\nexport class Attribute\n{\n public buffer: number;\n public size: number;\n public normalized: boolean;\n public type: TYPES;\n public stride: number;\n public start: number;\n public instance: boolean;\n\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 constructor(buffer: number, size = 0, normalized = false, type = TYPES.FLOAT, stride?: number, start?: number, instance?: boolean)\n {\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\n /** Destroys the Attribute. */\n destroy(): void\n {\n this.buffer = null;\n }\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 static from(buffer: number, size?: number, normalized?: boolean, type?: TYPES, stride?: number): Attribute\n {\n return new Attribute(buffer, size, normalized, type, stride);\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport { Runner } from '@pixi/runner';\n\nimport type { GLBuffer } from './GLBuffer';\n\nlet UID = 0;\n/* eslint-disable max-len */\n\n/**\n * Marks places in PixiJS where you can pass Float32Array, UInt32Array, any typed arrays, and ArrayBuffer\n *\n * Same as ArrayBuffer in typescript lib, defined here just for documentation\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IArrayBuffer extends ArrayBuffer\n{\n}\n\n/**\n * PixiJS classes use this type instead of ArrayBuffer and typed arrays\n * to support expressions like `geometry.buffers[0].data[0] = position.x`.\n *\n * Gives access to indexing and `length` field\n *\n * @popelyshev: If data is actually ArrayBuffer and throws Exception on indexing - its user problem :)\n */\nexport interface ITypedArray extends IArrayBuffer\n{\n readonly length: number;\n [index: number]: number;\n readonly BYTES_PER_ELEMENT: number;\n}\n\n/**\n * A wrapper for data so that it can be used and uploaded by WebGL\n *\n * @memberof PIXI\n */\nexport class Buffer\n{\n /**\n * The data in the buffer, as a typed array\n *\n * @type {ArrayBuffer| SharedArrayBuffer | ArrayBufferView}\n */\n public data: ITypedArray;\n\n /**\n * The type of buffer this is, one of:\n * + ELEMENT_ARRAY_BUFFER - used as an index buffer\n * + ARRAY_BUFFER - used as an attribute buffer\n * + UNIFORM_BUFFER - used as a uniform buffer (if available)\n */\n public type: BUFFER_TYPE;\n\n public static: boolean;\n public id: number;\n disposeRunner: Runner;\n\n /**\n * A map of renderer IDs to webgl buffer\n *\n * @private\n * @type {object}\n */\n _glBuffers: {[key: number]: GLBuffer};\n _updateID: number;\n\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 constructor(data?: IArrayBuffer, _static = true, index = false)\n {\n this.data = (data || new Float32Array(1)) as ITypedArray;\n\n this._glBuffers = {};\n this._updateID = 0;\n\n this.index = index;\n this.static = _static;\n this.id = UID++;\n\n this.disposeRunner = new Runner('disposeBuffer');\n }\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 update(data?: IArrayBuffer | Array): void\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n this.data = (data as ITypedArray) || this.data;\n this._updateID++;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the buffer. */\n destroy(): void\n {\n this.dispose();\n\n this.data = null;\n }\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 index(value: boolean)\n {\n this.type = value ? BUFFER_TYPE.ELEMENT_ARRAY_BUFFER : BUFFER_TYPE.ARRAY_BUFFER;\n }\n\n get index(): boolean\n {\n return this.type === BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\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 static from(data: IArrayBuffer | number[]): Buffer\n {\n if (data instanceof Array)\n {\n data = new Float32Array(data);\n }\n\n return new Buffer(data);\n }\n}\n","import { getBufferType } from '@pixi/utils';\n\nimport type { ITypedArray } from '../Buffer';\nimport type { Dict } from '@pixi/utils';\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n};\n\nexport function interleaveTypedArrays(arrays: Array, sizes: Array): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: Dict = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n const type = getBufferType(array);\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","import { Attribute } from './Attribute';\nimport { Buffer } from './Buffer';\nimport { interleaveTypedArrays } from './utils/interleaveTypedArrays';\nimport { getBufferType } from '@pixi/utils';\nimport { Runner } from '@pixi/runner';\n\nimport { BUFFER_TYPE, TYPES } from '@pixi/constants';\nimport type { IArrayBuffer } from './Buffer';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\nlet UID = 0;\n\n/* eslint-disable object-shorthand */\nconst map: Dict = {\n Float32Array: Float32Array,\n Uint32Array: Uint32Array,\n Int32Array: Int32Array,\n Uint8Array: Uint8Array,\n Uint16Array: Uint16Array,\n};\n\n/* eslint-disable max-len */\n\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 */\nexport class Geometry\n{\n public buffers: Array;\n public indexBuffer: Buffer;\n public attributes: {[key: string]: Attribute};\n public id: number;\n\n /** Whether the geometry is instanced. */\n public instanced: boolean;\n\n /**\n * Number of instances in this geometry, pass it to `GeometrySystem.draw()`.\n *\n * @default 1\n */\n public instanceCount: number;\n\n /**\n * A map of renderer IDs to webgl VAOs\n *\n * @type {object}\n */\n glVertexArrayObjects: {[key: number]: {[key: string]: WebGLVertexArrayObject}};\n disposeRunner: Runner;\n\n /** Count of existing (not destroyed) meshes that reference this geometry. */\n refCount: number;\n\n /**\n * @param buffers - An array of buffers. optional.\n * @param attributes - Of the geometry, optional structure of the attributes layout\n */\n constructor(buffers: Array = [], attributes: {[key: string]: Attribute} = {})\n {\n this.buffers = buffers;\n\n this.indexBuffer = null;\n\n this.attributes = attributes;\n\n this.glVertexArrayObjects = {};\n\n this.id = UID++;\n\n this.instanced = false;\n this.instanceCount = 1;\n\n this.disposeRunner = new Runner('disposeGeometry');\n this.refCount = 0;\n }\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 addAttribute(id: string, buffer: Buffer|Float32Array|Uint32Array|Array, size = 0, normalized = false,\n type?: TYPES, stride?: number, start?: number, instance = false): this\n {\n if (!buffer)\n {\n throw new Error('You must pass a buffer when creating an attribute');\n }\n\n // check if this is a buffer!\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Float32Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n const ids = id.split('|');\n\n if (ids.length > 1)\n {\n for (let i = 0; i < ids.length; i++)\n {\n this.addAttribute(ids[i], buffer, size, normalized, type);\n }\n\n return this;\n }\n\n let bufferIndex = this.buffers.indexOf(buffer);\n\n if (bufferIndex === -1)\n {\n this.buffers.push(buffer);\n bufferIndex = this.buffers.length - 1;\n }\n\n this.attributes[id] = new Attribute(bufferIndex, size, normalized, type, stride, start, instance);\n\n // assuming that if there is instanced data then this will be drawn with instancing!\n this.instanced = this.instanced || instance;\n\n return this;\n }\n\n /**\n * Returns the requested attribute.\n *\n * @param id - The name of the attribute required\n * @return - The attribute requested.\n */\n getAttribute(id: string): Attribute\n {\n return this.attributes[id];\n }\n\n /**\n * Returns the requested buffer.\n *\n * @param id - The name of the buffer required.\n * @return - The buffer requested.\n */\n getBuffer(id: string): Buffer\n {\n return this.buffers[this.getAttribute(id).buffer];\n }\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 addIndex(buffer?: Buffer | IArrayBuffer | number[]): Geometry\n {\n if (!(buffer instanceof Buffer))\n {\n // its an array!\n if (buffer instanceof Array)\n {\n buffer = new Uint16Array(buffer);\n }\n\n buffer = new Buffer(buffer);\n }\n\n buffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n this.indexBuffer = buffer;\n\n if (this.buffers.indexOf(buffer) === -1)\n {\n this.buffers.push(buffer);\n }\n\n return this;\n }\n\n /**\n * Returns the index buffer\n *\n * @return - The index buffer.\n */\n getIndex(): Buffer\n {\n return this.indexBuffer;\n }\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 interleave(): Geometry\n {\n // a simple check to see if buffers are already interleaved..\n if (this.buffers.length === 1 || (this.buffers.length === 2 && this.indexBuffer)) return this;\n\n // assume already that no buffers are interleaved\n const arrays = [];\n const sizes = [];\n const interleavedBuffer = new Buffer();\n let i;\n\n for (i in this.attributes)\n {\n const attribute = this.attributes[i];\n\n const buffer = this.buffers[attribute.buffer];\n\n arrays.push(buffer.data);\n\n sizes.push((attribute.size * byteSizeMap[attribute.type]) / 4);\n\n attribute.buffer = 0;\n }\n\n interleavedBuffer.data = interleaveTypedArrays(arrays, sizes);\n\n for (i = 0; i < this.buffers.length; i++)\n {\n if (this.buffers[i] !== this.indexBuffer)\n {\n this.buffers[i].destroy();\n }\n }\n\n this.buffers = [interleavedBuffer];\n\n if (this.indexBuffer)\n {\n this.buffers.push(this.indexBuffer);\n }\n\n return this;\n }\n\n /** Get the size of the geometries, in vertices. */\n getSize(): number\n {\n for (const i in this.attributes)\n {\n const attribute = this.attributes[i];\n const buffer = this.buffers[attribute.buffer];\n\n return (buffer.data as any).length / ((attribute.stride / 4) || attribute.size);\n }\n\n return 0;\n }\n\n /** Disposes WebGL resources that are connected to this geometry. */\n dispose(): void\n {\n this.disposeRunner.emit(this, false);\n }\n\n /** Destroys the geometry. */\n destroy(): void\n {\n this.dispose();\n\n this.buffers = null;\n this.indexBuffer = null;\n this.attributes = null;\n }\n\n /**\n * Returns a clone of the geometry.\n *\n * @returns - A new clone of this geometry.\n */\n clone(): Geometry\n {\n const geometry = new Geometry();\n\n for (let i = 0; i < this.buffers.length; i++)\n {\n geometry.buffers[i] = new Buffer(this.buffers[i].data.slice(0));\n }\n\n for (const i in this.attributes)\n {\n const attrib = this.attributes[i];\n\n geometry.attributes[i] = new Attribute(\n attrib.buffer,\n attrib.size,\n attrib.normalized,\n attrib.type,\n attrib.stride,\n attrib.start,\n attrib.instance\n );\n }\n\n if (this.indexBuffer)\n {\n geometry.indexBuffer = geometry.buffers[this.buffers.indexOf(this.indexBuffer)];\n geometry.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n }\n\n return geometry;\n }\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 static merge(geometries: Array): Geometry\n {\n // todo add a geometry check!\n // also a size check.. cant be too big!]\n\n const geometryOut = new Geometry();\n\n const arrays = [];\n const sizes: Array = [];\n const offsets = [];\n\n let geometry;\n\n // pass one.. get sizes..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n sizes[j] = sizes[j] || 0;\n sizes[j] += geometry.buffers[j].data.length;\n offsets[j] = 0;\n }\n }\n\n // build the correct size arrays..\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n // TODO types!\n arrays[i] = new map[getBufferType(geometry.buffers[i].data)](sizes[i]);\n geometryOut.buffers[i] = new Buffer(arrays[i]);\n }\n\n // pass to set data..\n for (let i = 0; i < geometries.length; i++)\n {\n geometry = geometries[i];\n\n for (let j = 0; j < geometry.buffers.length; j++)\n {\n arrays[j].set(geometry.buffers[j].data, offsets[j]);\n offsets[j] += geometry.buffers[j].data.length;\n }\n }\n\n geometryOut.attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n geometryOut.indexBuffer = geometryOut.buffers[geometry.buffers.indexOf(geometry.indexBuffer)];\n geometryOut.indexBuffer.type = BUFFER_TYPE.ELEMENT_ARRAY_BUFFER;\n\n let offset = 0;\n let stride = 0;\n let offset2 = 0;\n let bufferIndexToCount = 0;\n\n // get a buffer\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n if (geometry.buffers[i] !== geometry.indexBuffer)\n {\n bufferIndexToCount = i;\n break;\n }\n }\n\n // figure out the stride of one buffer..\n for (const i in geometry.attributes)\n {\n const attribute = geometry.attributes[i];\n\n if ((attribute.buffer | 0) === bufferIndexToCount)\n {\n stride += ((attribute.size * byteSizeMap[attribute.type]) / 4);\n }\n }\n\n // time to off set all indexes..\n for (let i = 0; i < geometries.length; i++)\n {\n const indexBufferData = geometries[i].indexBuffer.data;\n\n for (let j = 0; j < indexBufferData.length; j++)\n {\n geometryOut.indexBuffer.data[j + offset2] += offset;\n }\n\n offset += geometries[i].buffers[bufferIndexToCount].data.length / (stride);\n offset2 += indexBufferData.length;\n }\n }\n\n return geometryOut;\n }\n}\n","import { Geometry } from '../geometry/Geometry';\n\n/**\n * Helper class to create a quad\n *\n * @class\n * @memberof PIXI\n */\nexport class Quad extends Geometry\n{\n constructor()\n {\n super();\n\n this.addAttribute('aVertexPosition', new Float32Array([\n 0, 0,\n 1, 0,\n 1, 1,\n 0, 1,\n ]))\n .addIndex([0, 1, 3, 2]);\n }\n}\n","import { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\nimport type { Rectangle } from '@pixi/math';\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 */\nexport class QuadUv extends Geometry\n{\n vertexBuffer: Buffer;\n uvBuffer: Buffer;\n vertices: Float32Array;\n uvs: Float32Array;\n\n constructor()\n {\n super();\n\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\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 ]);\n\n this.vertexBuffer = new Buffer(this.vertices);\n this.uvBuffer = new Buffer(this.uvs);\n\n this.addAttribute('aVertexPosition', this.vertexBuffer)\n .addAttribute('aTextureCoord', this.uvBuffer)\n .addIndex([0, 1, 2, 0, 2, 3]);\n }\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 map(targetTextureFrame: Rectangle, destinationFrame: Rectangle): this\n {\n let x = 0; // destinationFrame.x / targetTextureFrame.width;\n let y = 0; // destinationFrame.y / targetTextureFrame.height;\n\n this.uvs[0] = x;\n this.uvs[1] = y;\n\n this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[3] = y;\n\n this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);\n this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);\n\n this.uvs[6] = x;\n this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);\n\n x = destinationFrame.x;\n y = destinationFrame.y;\n\n this.vertices[0] = x;\n this.vertices[1] = y;\n\n this.vertices[2] = x + destinationFrame.width;\n this.vertices[3] = y;\n\n this.vertices[4] = x + destinationFrame.width;\n this.vertices[5] = y + destinationFrame.height;\n\n this.vertices[6] = x;\n this.vertices[7] = y + destinationFrame.height;\n\n this.invalidate();\n\n return this;\n }\n\n /**\n * legacy upload method, just marks buffers dirty\n * @returns {PIXI.QuadUv} Returns itself.\n */\n invalidate(): this\n {\n this.vertexBuffer._updateID++;\n this.uvBuffer._updateID++;\n\n return this;\n }\n}\n","import { BUFFER_TYPE } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\nimport { Buffer } from '../geometry/Buffer';\nimport type { UniformsSyncCallback } from './utils';\n\nlet UID = 0;\n\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 */\nexport class UniformGroup>\n{\n public readonly uniforms: LAYOUT;\n public readonly group: boolean;\n public id: number;\n syncUniforms: Dict;\n dirtyId: number;\n static: boolean;\n ubo: boolean;\n buffer?: Buffer;\n autoManage: boolean;\n\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 constructor(uniforms: LAYOUT | Buffer, isStatic?: boolean, isUbo?: boolean)\n {\n /**\n * Its a group and not a single uniforms\n * @member {boolean}\n * @readonly\n * @default true\n */\n this.group = true;\n\n // lets generate this when the shader ?\n this.syncUniforms = {};\n\n /**\n * dirty version\n * @protected\n * @member {number}\n */\n this.dirtyId = 0;\n\n /**\n * unique id\n * @protected\n * @member {number}\n */\n this.id = UID++;\n\n /**\n * Uniforms wont be changed after creation\n * @member {boolean}\n */\n this.static = !!isStatic;\n\n /**\n * Flags whether this group is treated like a uniform buffer object.\n * @member {boolean}\n */\n this.ubo = !!isUbo;\n\n if (uniforms instanceof Buffer)\n {\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 /**\n * uniform values\n * @member {object}\n * @readonly\n */\n this.uniforms = uniforms;\n\n if (this.ubo)\n {\n this.buffer = new Buffer(new Float32Array(1));\n this.buffer.type = BUFFER_TYPE.UNIFORM_BUFFER;\n this.autoManage = true;\n }\n }\n }\n\n update(): void\n {\n this.dirtyId++;\n\n if (!this.autoManage && this.buffer)\n {\n this.buffer.update();\n }\n }\n\n add(name: string, uniforms: Dict, _static?: boolean): void\n {\n if (!this.ubo)\n {\n (this.uniforms as any)[name] = new UniformGroup(uniforms, _static);\n }\n else\n {\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\n static from(uniforms: Dict | Buffer, _static?: boolean, _ubo?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static, _ubo);\n }\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 static uboFrom(uniforms: Dict | Buffer, _static?: boolean): UniformGroup\n {\n return new UniformGroup(uniforms, _static ?? true, true);\n }\n}\n","import { Matrix, Rectangle } from '@pixi/math';\nimport { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\n/**\n * System plugin to the renderer to manage filter states.\n *\n * @ignore\n */\nexport class FilterState\n{\n renderTexture: RenderTexture;\n\n /**\n * Target of the filters\n * We store for case when custom filter wants to know the element it was applied on\n * @member {PIXI.DisplayObject}\n */\n target: IFilterTarget;\n\n /**\n * Compatibility with PixiJS v4 filters\n * @default false\n */\n legacy: boolean;\n\n /**\n * Resolution of filters\n * @default 1\n */\n resolution: number;\n\n /**\n * Number of samples\n * @default MSAA_QUALITY.NONE\n */\n multisample: MSAA_QUALITY;\n\n /** Source frame. */\n sourceFrame: Rectangle;\n\n /** Destination frame. */\n destinationFrame: Rectangle;\n\n /** Original render-target source frame. */\n bindingSourceFrame: Rectangle;\n\n /** Original render-target destination frame. */\n bindingDestinationFrame: Rectangle;\n\n /** Collection of filters. */\n filters: Array;\n\n /** Projection system transform saved by link. */\n transform: Matrix;\n\n constructor()\n {\n this.renderTexture = null;\n\n this.target = null;\n this.legacy = false;\n this.resolution = 1;\n this.multisample = MSAA_QUALITY.NONE;\n\n // next three fields are created only for root\n // re-assigned for everything else\n\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\n /** Clears the state */\n clear(): void\n {\n this.target = null;\n this.filters = null;\n this.renderTexture = null;\n }\n}\n","import { RenderTexturePool } from '../renderTexture/RenderTexturePool';\nimport { Quad } from '../utils/Quad';\nimport { QuadUv } from '../utils/QuadUv';\nimport { Rectangle, Matrix, Point } from '@pixi/math';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { DRAW_MODES, CLEAR_MODES, MSAA_QUALITY } from '@pixi/constants';\nimport { FilterState } from './FilterState';\n\nimport type { ISystem } from '../ISystem';\nimport type { Filter } from './Filter';\nimport type { IFilterTarget } from './IFilterTarget';\nimport type { ISpriteMaskTarget } from './spriteMask/SpriteMaskFilter';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { Renderer } from '../Renderer';\n\nconst tempPoints = [new Point(), new Point(), new Point(), new Point()];\nconst tempMatrix = new Matrix();\n\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 */\nexport class FilterSystem implements ISystem\n{\n /**\n * List of filters for the FilterSystem\n * @member {Object[]}\n */\n public readonly defaultFilterStack: Array;\n\n /** A pool for storing filter states, save us creating new ones each tick. */\n public statePool: Array;\n\n /** Stores a bunch of POT textures used for filtering. */\n public texturePool: RenderTexturePool;\n\n /** Whether to clear output renderTexture in AUTO/BLIT mode. See {@link PIXI.CLEAR_MODES}. */\n public forceClear: boolean;\n\n /**\n * Old padding behavior is to use the max amount instead of sum padding.\n * Use this flag if you need the old behavior.\n * @default false\n */\n public useMaxPadding: boolean;\n\n /** A very simple geometry used when drawing a filter effect to the screen. */\n protected quad: Quad;\n\n /** Quad UVs */\n protected quadUv: QuadUv;\n\n /**\n * Active state\n * @member {object}\n */\n protected activeState: FilterState;\n\n /**\n * This uniform group is attached to filter uniforms when used.\n *\n * @property {PIXI.Rectangle} outputFrame\n * @property {Float32Array} inputSize\n * @property {Float32Array} inputPixel\n * @property {Float32Array} inputClamp\n * @property {Number} resolution\n * @property {Float32Array} filterArea\n * @property {Float32Array} filterClamp\n */\n protected globalUniforms: UniformGroup;\n\n /** Temporary rect for math. */\n private tempRect: Rectangle;\n public renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.defaultFilterStack = [{}] as any;\n\n this.texturePool = new RenderTexturePool();\n this.texturePool.setScreenSize(renderer.view);\n this.statePool = [];\n\n this.quad = new Quad();\n this.quadUv = new QuadUv();\n this.tempRect = new Rectangle();\n this.activeState = {} as any;\n\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\n // legacy variables\n filterArea: new Float32Array(4),\n filterClamp: new Float32Array(4),\n }, true);\n\n this.forceClear = false;\n this.useMaxPadding = false;\n }\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 push(target: IFilterTarget, filters: Array): void\n {\n const renderer = this.renderer;\n const filterStack = this.defaultFilterStack;\n const state = this.statePool.pop() || new FilterState();\n const renderTextureSystem = this.renderer.renderTexture;\n\n let resolution = filters[0].resolution;\n let multisample = filters[0].multisample;\n let padding = filters[0].padding;\n let 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 let legacy = filters[0].legacy ?? true;\n\n for (let i = 1; i < filters.length; i++)\n {\n const filter = filters[i];\n\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\n legacy = legacy || (filter.legacy ?? true);\n }\n\n if (filterStack.length === 1)\n {\n this.defaultFilterStack[0].renderTexture = renderTextureSystem.current;\n }\n\n filterStack.push(state);\n\n state.resolution = resolution;\n state.multisample = multisample;\n\n state.legacy = legacy;\n\n state.target = target;\n state.sourceFrame.copyFrom(target.filterArea || target.getBounds(true));\n\n state.sourceFrame.pad(padding);\n\n if (autoFit)\n {\n const sourceFrameProjected = this.tempRect.copyFrom(renderTextureSystem.sourceFrame);\n\n // Project source frame into world space (if projection is applied)\n if (renderer.projection.transform)\n {\n this.transformAABB(\n tempMatrix.copyFrom(renderer.projection.transform).invert(),\n sourceFrameProjected\n );\n }\n\n state.sourceFrame.fit(sourceFrameProjected);\n }\n\n // Round sourceFrame in screen space based on render-texture.\n this.roundFrame(\n state.sourceFrame,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform,\n );\n\n state.renderTexture = this.getOptimalFilterTexture(state.sourceFrame.width, state.sourceFrame.height,\n resolution, multisample);\n state.filters = filters;\n\n state.destinationFrame.width = state.renderTexture.width;\n state.destinationFrame.height = state.renderTexture.height;\n\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = state.sourceFrame.width;\n destinationFrame.height = state.sourceFrame.height;\n\n state.renderTexture.filterFrame = state.sourceFrame;\n state.bindingSourceFrame.copyFrom(renderTextureSystem.sourceFrame);\n state.bindingDestinationFrame.copyFrom(renderTextureSystem.destinationFrame);\n\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\n /** Pops off the filter and applies it. */\n pop(): void\n {\n const filterStack = this.defaultFilterStack;\n const state = filterStack.pop();\n const filters = state.filters;\n\n this.activeState = state;\n\n const globalUniforms = this.globalUniforms.uniforms;\n\n globalUniforms.outputFrame = state.sourceFrame;\n globalUniforms.resolution = state.resolution;\n\n const inputSize = globalUniforms.inputSize;\n const inputPixel = globalUniforms.inputPixel;\n const inputClamp = globalUniforms.inputClamp;\n\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\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\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\n // only update the rect if its legacy..\n if (state.legacy)\n {\n const filterArea = globalUniforms.filterArea;\n\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\n globalUniforms.filterClamp = globalUniforms.inputClamp;\n }\n\n this.globalUniforms.update();\n\n const lastState = filterStack[filterStack.length - 1];\n\n this.renderer.framebuffer.blit();\n\n if (filters.length === 1)\n {\n filters[0].apply(this, state.renderTexture, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n this.returnFilterTexture(state.renderTexture);\n }\n else\n {\n let flip = state.renderTexture;\n let flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n\n let i = 0;\n\n for (i = 0; i < filters.length - 1; ++i)\n {\n if (i === 1 && state.multisample > 1)\n {\n flop = this.getOptimalFilterTexture(\n flip.width,\n flip.height,\n state.resolution\n );\n\n flop.filterFrame = flip.filterFrame;\n }\n\n filters[i].apply(this, flip, flop, CLEAR_MODES.CLEAR, state);\n\n const t = flip;\n\n flip = flop;\n flop = t;\n }\n\n filters[i].apply(this, flip, lastState.renderTexture, CLEAR_MODES.BLEND, state);\n\n if (i > 1 && state.multisample > 1)\n {\n this.returnFilterTexture(state.renderTexture);\n }\n\n this.returnFilterTexture(flip);\n this.returnFilterTexture(flop);\n }\n\n // lastState.renderTexture is blitted when lastState is popped\n\n state.clear();\n this.statePool.push(state);\n }\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 bindAndClear(filterTexture: RenderTexture, clearMode: CLEAR_MODES = CLEAR_MODES.CLEAR): void\n {\n const {\n renderTexture: renderTextureSystem,\n state: stateSystem,\n } = this.renderer;\n\n if (filterTexture === this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n // Restore projection transform if rendering into the output render-target.\n this.renderer.projection.transform = this.activeState.transform;\n }\n else\n {\n // Prevent projection within filtering pipeline.\n this.renderer.projection.transform = null;\n }\n\n if (filterTexture && filterTexture.filterFrame)\n {\n const destinationFrame = this.tempRect;\n\n destinationFrame.x = 0;\n destinationFrame.y = 0;\n destinationFrame.width = filterTexture.filterFrame.width;\n destinationFrame.height = filterTexture.filterFrame.height;\n\n renderTextureSystem.bind(filterTexture, filterTexture.filterFrame, destinationFrame);\n }\n else if (filterTexture !== this.defaultFilterStack[this.defaultFilterStack.length - 1].renderTexture)\n {\n renderTextureSystem.bind(filterTexture);\n }\n else\n {\n // Restore binding for output render-target.\n this.renderer.renderTexture.bind(\n filterTexture,\n this.activeState.bindingSourceFrame,\n this.activeState.bindingDestinationFrame\n );\n }\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 const autoClear = (stateSystem.stateId & 1) || this.forceClear;\n\n if (clearMode === CLEAR_MODES.CLEAR\n || (clearMode === CLEAR_MODES.BLIT && autoClear))\n {\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 /**\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 applyFilter(filter: Filter, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES): void\n {\n const renderer = this.renderer;\n\n // Set state before binding, so bindAndClear gets the blend mode.\n renderer.state.set(filter.state);\n this.bindAndClear(output, clearMode);\n\n // set the uniforms..\n filter.uniforms.uSampler = input;\n filter.uniforms.filterGlobals = this.globalUniforms;\n\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\n // check to see if the filter is a legacy one..\n filter.legacy = !!filter.program.attributeData.aTextureCoord;\n\n if (filter.legacy)\n {\n this.quadUv.map(input._frame, input.filterFrame);\n\n renderer.geometry.bind(this.quadUv);\n renderer.geometry.draw(DRAW_MODES.TRIANGLES);\n }\n else\n {\n renderer.geometry.bind(this.quad);\n renderer.geometry.draw(DRAW_MODES.TRIANGLE_STRIP);\n }\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 calculateSpriteMatrix(outputMatrix: Matrix, sprite: ISpriteMaskTarget): Matrix\n {\n const { sourceFrame, destinationFrame } = this.activeState;\n const { orig } = sprite._texture;\n const mappedMatrix = outputMatrix.set(destinationFrame.width, 0, 0,\n destinationFrame.height, sourceFrame.x, sourceFrame.y);\n const worldTransform = sprite.worldTransform.copyTo(Matrix.TEMP_MATRIX);\n\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\n return mappedMatrix;\n }\n\n /** Destroys this Filter System. */\n destroy(): void\n {\n this.renderer = null;\n\n // Those textures has to be destroyed by RenderTextureSystem or FramebufferSystem\n this.texturePool.clear(false);\n }\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 protected getOptimalFilterTexture(minWidth: number, minHeight: number, resolution = 1,\n multisample: MSAA_QUALITY = MSAA_QUALITY.NONE): RenderTexture\n {\n return this.texturePool.getOptimalTexture(minWidth, minHeight, resolution, multisample);\n }\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 getFilterTexture(input?: RenderTexture, resolution?: number, multisample?: MSAA_QUALITY): RenderTexture\n {\n if (typeof input === 'number')\n {\n const swap = input;\n\n input = resolution as any;\n resolution = swap;\n }\n\n input = input || this.activeState.renderTexture;\n\n const filterTexture = this.texturePool.getOptimalTexture(input.width, input.height, resolution || input.resolution,\n multisample || MSAA_QUALITY.NONE);\n\n filterTexture.filterFrame = input.filterFrame;\n\n return filterTexture;\n }\n\n /**\n * Frees a render texture back into the pool.\n *\n * @param renderTexture - The renderTarget to free\n */\n returnFilterTexture(renderTexture: RenderTexture): void\n {\n this.texturePool.returnTexture(renderTexture);\n }\n\n /** Empties the texture pool. */\n emptyPool(): void\n {\n this.texturePool.clear(true);\n }\n\n /** Calls `texturePool.resize()`, affects fullScreen renderTextures. */\n resize(): void\n {\n this.texturePool.setScreenSize(this.renderer.view);\n }\n\n /**\n * @param matrix - first param\n * @param rect - second param\n */\n private transformAABB(matrix: Matrix, rect: Rectangle): void\n {\n const lt = tempPoints[0];\n const lb = tempPoints[1];\n const rt = tempPoints[2];\n const rb = tempPoints[3];\n\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\n matrix.apply(lt, lt);\n matrix.apply(lb, lb);\n matrix.apply(rt, rt);\n matrix.apply(rb, rb);\n\n const x0 = Math.min(lt.x, lb.x, rt.x, rb.x);\n const y0 = Math.min(lt.y, lb.y, rt.y, rb.y);\n const x1 = Math.max(lt.x, lb.x, rt.x, rb.x);\n const y1 = Math.max(lt.y, lb.y, rt.y, rb.y);\n\n rect.x = x0;\n rect.y = y0;\n rect.width = x1 - x0;\n rect.height = y1 - y0;\n }\n\n private roundFrame(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix\n )\n {\n if (transform)\n {\n const { a, b, c, d } = transform;\n\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 {\n return;\n }\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n this.transformAABB(transform, frame);\n\n // Round frame in screen space\n frame.ceil(resolution);\n\n // Project back into world space.\n this.transformAABB(transform.invert(), frame);\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\n\n/**\n * Base for a common object renderer that can be used as a\n * system renderer plugin.\n *\n * @memberof PIXI\n */\nexport class ObjectRenderer implements ISystem\n{\n /** The renderer this manager works for. */\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this manager works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n }\n\n /**\n * Stub method that should be used to empty the current\n * batch by rendering objects now.\n */\n flush(): void\n {\n // flush!\n }\n\n /**\n * Generic destruction method that frees all resources. This\n * should be called by subclasses.\n */\n destroy(): void\n {\n this.renderer = null;\n }\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 start(): void\n {\n // set the shader..\n }\n\n /**\n * Stops the renderer. It should free up any state and\n * become dormant.\n */\n stop(): void\n {\n this.flush();\n }\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 render(_object: any): void // eslint-disable-line @typescript-eslint/explicit-module-boundary-types\n {\n // render the object\n }\n}\n","import { ObjectRenderer } from './ObjectRenderer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { BaseTexture } from '../textures/BaseTexture';\nimport type { BatchTextureArray } from './BatchTextureArray';\n\n/**\n * System plugin to the renderer to manage batching.\n *\n * @memberof PIXI\n */\nexport class BatchSystem implements ISystem\n{\n /** An empty renderer. */\n public readonly emptyRenderer: ObjectRenderer;\n\n /** The currently active ObjectRenderer. */\n public currentRenderer: ObjectRenderer;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.emptyRenderer = new ObjectRenderer(renderer);\n this.currentRenderer = this.emptyRenderer;\n }\n\n /**\n * Changes the current renderer to the one given in parameter\n *\n * @param objectRenderer - The object renderer to use.\n */\n setObjectRenderer(objectRenderer: ObjectRenderer): void\n {\n if (this.currentRenderer === objectRenderer)\n {\n return;\n }\n\n this.currentRenderer.stop();\n this.currentRenderer = objectRenderer;\n\n this.currentRenderer.start();\n }\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 flush(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\n\n /**\n * Reset the system to an empty renderer\n */\n reset(): void\n {\n this.setObjectRenderer(this.emptyRenderer);\n }\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 copyBoundTextures(arr: BaseTexture[], maxTextures: number): void\n {\n const { boundTextures } = this.renderer.texture;\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n arr[i] = boundTextures[i] || null;\n if (arr[i])\n {\n arr[i]._batchLocation = i;\n }\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 boundArray(texArray: BatchTextureArray, boundTextures: Array,\n batchId: number, maxTextures: number): void\n {\n const { elements, ids, count } = texArray;\n let j = 0;\n\n for (let i = 0; i < count; i++)\n {\n const tex = elements[i];\n const loc = tex._batchLocation;\n\n if (loc >= 0 && loc < maxTextures\n && boundTextures[loc] === tex)\n {\n ids[i] = loc;\n continue;\n }\n\n while (j < maxTextures)\n {\n const bound = boundTextures[j];\n\n if (bound && bound._batchEnabled === batchId\n && bound._batchLocation === j)\n {\n j++;\n continue;\n }\n\n ids[i] = j;\n tex._batchLocation = j;\n boundTextures[j] = tex;\n break;\n }\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\nimport type { WebGLExtensions } from './WebGLExtensions';\n\nlet CONTEXT_UID_COUNTER = 0;\n\nexport interface ISupportDict {\n uint32Indices: boolean;\n}\n\n/**\n * System plugin to the renderer to manage the context.\n *\n * @memberof PIXI\n */\nexport class ContextSystem implements ISystem\n{\n /**\n * Either 1 or 2 to reflect the WebGL version being used.\n *\n * @readonly\n */\n public webGLVersion: number;\n\n /**\n * Features supported by current context.\n *\n * @type {object}\n * @readonly\n * @property {boolean} uint32Indices - Support for 32-bit indices buffer.\n */\n readonly supports: ISupportDict;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n\n /**\n * Extensions available.\n *\n * @type {object}\n * @readonly\n * @property {WEBGL_draw_buffers} drawBuffers - WebGL v1 extension\n * @property {WEBGL_depth_texture} depthTexture - WebGL v1 extension\n * @property {OES_texture_float} floatTexture - WebGL v1 extension\n * @property {WEBGL_lose_context} loseContext - WebGL v1 extension\n * @property {OES_vertex_array_object} vertexArrayObject - WebGL v1 extension\n * @property {EXT_texture_filter_anisotropic} anisotropicFiltering - WebGL v1 and v2 extension\n */\n public extensions: WebGLExtensions;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.webGLVersion = 1;\n this.extensions = {};\n\n this.supports = {\n uint32Indices: false,\n };\n\n // Bind functions\n this.handleContextLost = this.handleContextLost.bind(this);\n this.handleContextRestored = this.handleContextRestored.bind(this);\n\n (renderer.view as any).addEventListener('webglcontextlost', this.handleContextLost, false);\n renderer.view.addEventListener('webglcontextrestored', this.handleContextRestored, false);\n }\n\n /**\n * `true` if the context is lost\n *\n * @readonly\n */\n get isLost(): boolean\n {\n return (!this.gl || this.gl.isContextLost());\n }\n\n /**\n * Handles the context change event.\n *\n * @param {WebGLRenderingContext} gl - New WebGL context.\n */\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.renderer.gl = gl;\n this.renderer.CONTEXT_UID = CONTEXT_UID_COUNTER++;\n\n // restore a context if it was previously lost\n if (gl.isContextLost() && gl.getExtension('WEBGL_lose_context'))\n {\n gl.getExtension('WEBGL_lose_context').restoreContext();\n }\n }\n\n /**\n * Initializes the context.\n *\n * @protected\n * @param {WebGLRenderingContext} gl - WebGL context\n */\n initFromContext(gl: IRenderingContext): void\n {\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 /**\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 initFromOptions(options: WebGLContextAttributes): void\n {\n const gl = this.createContext(this.renderer.view, options);\n\n this.initFromContext(gl);\n }\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 createContext(canvas: HTMLCanvasElement, options: WebGLContextAttributes): IRenderingContext\n {\n let gl;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', options);\n }\n\n if (gl)\n {\n this.webGLVersion = 2;\n }\n else\n {\n this.webGLVersion = 1;\n\n gl = canvas.getContext('webgl', options)\n || canvas.getContext('experimental-webgl', options);\n\n if (!gl)\n {\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\n this.gl = gl as IRenderingContext;\n\n this.getExtensions();\n\n return this.gl;\n }\n\n /** Auto-populate the {@link PIXI.ContextSystem.extensions extensions}. */\n protected getExtensions(): void\n {\n // time to set up default extensions that Pixi uses.\n const { gl } = this;\n\n const common = {\n anisotropicFiltering: gl.getExtension('EXT_texture_filter_anisotropic'),\n floatTextureLinear: gl.getExtension('OES_texture_float_linear'),\n\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 if (this.webGLVersion === 1)\n {\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 {\n Object.assign(this.extensions, common, {\n // Floats and half-floats\n colorBufferFloat: gl.getExtension('EXT_color_buffer_float')\n });\n }\n }\n\n /**\n * Handles a lost webgl context\n *\n * @param {WebGLContextEvent} event - The context lost event.\n */\n protected handleContextLost(event: WebGLContextEvent): void\n {\n event.preventDefault();\n }\n\n /** Handles a restored webgl context. */\n protected handleContextRestored(): void\n {\n this.renderer.runners.contextChange.emit(this.gl);\n }\n\n destroy(): void\n {\n const view = this.renderer.view;\n\n this.renderer = null;\n\n // remove listeners\n (view as any).removeEventListener('webglcontextlost', this.handleContextLost);\n view.removeEventListener('webglcontextrestored', this.handleContextRestored);\n\n this.gl.useProgram(null);\n\n if (this.extensions.loseContext)\n {\n this.extensions.loseContext.loseContext();\n }\n }\n\n /** Handle the post-render runner event. */\n protected postrender(): void\n {\n if (this.renderer.renderingToScreen)\n {\n this.gl.flush();\n }\n }\n\n /**\n * Validate context.\n *\n * @param {WebGLRenderingContext} gl - Render context.\n */\n protected validateContext(gl: IRenderingContext): void\n {\n const attributes = gl.getContextAttributes();\n\n const isWebGl2 = 'WebGL2RenderingContext' in self && gl instanceof self.WebGL2RenderingContext;\n\n if (isWebGl2)\n {\n this.webGLVersion = 2;\n }\n\n // this is going to be fairly simple for now.. but at least we have room to grow!\n if (!attributes.stencil)\n {\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\n const hasuint32 = isWebGl2 || !!(gl as WebGLRenderingContext).getExtension('OES_element_index_uint');\n\n this.supports.uint32Indices = hasuint32;\n\n if (!hasuint32)\n {\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}\n","import { MSAA_QUALITY } from '@pixi/constants';\n\nimport type { Framebuffer } from './Framebuffer';\n\n/**\n * Internal framebuffer for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLFramebuffer\n{\n public framebuffer: WebGLFramebuffer;\n public stencil: WebGLRenderbuffer;\n public multisample: MSAA_QUALITY;\n public msaaBuffer: WebGLRenderbuffer;\n public blitFramebuffer: Framebuffer;\n dirtyId: number;\n dirtyFormat: number;\n dirtySize: number;\n mipLevel: number;\n\n constructor(framebuffer: WebGLTexture)\n {\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 /**\n * Detected AA samples number\n * @member {PIXI.MSAA_QUALITY}\n */\n this.multisample = MSAA_QUALITY.NONE;\n\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 /**\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 /**\n * store the current mipmap of the textures the framebuffer will write too.\n */\n this.mipLevel = 0;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { ENV, BUFFER_BITS, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '../settings';\nimport { Framebuffer } from './Framebuffer';\nimport { GLFramebuffer } from './GLFramebuffer';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst tempRectangle = new Rectangle();\n\n/**\n * System plugin to the renderer to manage framebuffers.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\nexport class FramebufferSystem implements ISystem\n{\n public readonly managedFramebuffers: Array;\n public current: Framebuffer;\n public viewport: Rectangle;\n public hasMRT: boolean;\n public writeDepthTexture: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected unknownFramebuffer: Framebuffer;\n protected msaaSamples: Array;\n public renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n /**\n * A list of managed framebuffers\n * @member {PIXI.Framebuffer[]}\n * @readonly\n */\n this.managedFramebuffers = [];\n\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\n this.msaaSamples = null;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\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\n this.disposeAll(true);\n\n // webgl2\n if (this.renderer.context.webGLVersion === 1)\n {\n // webgl 1!\n let nativeDrawBuffersExtension = this.renderer.context.extensions.drawBuffers;\n let nativeDepthTextureExtension = this.renderer.context.extensions.depthTexture;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeDrawBuffersExtension = null;\n nativeDepthTextureExtension = null;\n }\n\n if (nativeDrawBuffersExtension)\n {\n gl.drawBuffers = (activeTextures: number[]): void =>\n nativeDrawBuffersExtension.drawBuffersWEBGL(activeTextures);\n }\n else\n {\n this.hasMRT = false;\n gl.drawBuffers = (): void =>\n {\n // empty\n };\n }\n\n if (!nativeDepthTextureExtension)\n {\n this.writeDepthTexture = false;\n }\n }\n else\n {\n // WebGL2\n // cache possible MSAA samples\n this.msaaSamples = gl.getInternalformatParameter(gl.RENDERBUFFER, gl.RGBA8, gl.SAMPLES);\n }\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 bind(framebuffer?: Framebuffer, frame?: Rectangle, mipLevel = 0): void\n {\n const { gl } = this;\n\n if (framebuffer)\n {\n // TODO caching layer!\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID] || this.initFramebuffer(framebuffer);\n\n if (this.current !== framebuffer)\n {\n this.current = framebuffer;\n gl.bindFramebuffer(gl.FRAMEBUFFER, fbo.framebuffer);\n }\n // make sure all textures are unbound..\n\n if (fbo.mipLevel !== mipLevel)\n {\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n fbo.mipLevel = mipLevel;\n }\n\n // now check for updates...\n if (fbo.dirtyId !== framebuffer.dirtyId)\n {\n fbo.dirtyId = framebuffer.dirtyId;\n\n if (fbo.dirtyFormat !== framebuffer.dirtyFormat)\n {\n fbo.dirtyFormat = framebuffer.dirtyFormat;\n fbo.dirtySize = framebuffer.dirtySize;\n this.updateFramebuffer(framebuffer, mipLevel);\n }\n else if (fbo.dirtySize !== framebuffer.dirtySize)\n {\n fbo.dirtySize = framebuffer.dirtySize;\n this.resizeFramebuffer(framebuffer);\n }\n }\n\n for (let i = 0; i < framebuffer.colorTextures.length; i++)\n {\n const tex = framebuffer.colorTextures[i];\n\n this.renderer.texture.unbind(tex.parentTextureArray || tex);\n }\n\n if (framebuffer.depthTexture)\n {\n this.renderer.texture.unbind(framebuffer.depthTexture);\n }\n\n if (frame)\n {\n const mipWidth = (frame.width >> mipLevel);\n const mipHeight = (frame.height >> mipLevel);\n\n const scale = mipWidth / frame.width;\n\n this.setViewport(\n frame.x * scale,\n frame.y * scale,\n mipWidth,\n mipHeight\n );\n }\n else\n {\n const mipWidth = (framebuffer.width >> mipLevel);\n const mipHeight = (framebuffer.height >> mipLevel);\n\n this.setViewport(0, 0, mipWidth, mipHeight);\n }\n }\n else\n {\n if (this.current)\n {\n this.current = null;\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n }\n\n if (frame)\n {\n this.setViewport(frame.x, frame.y, frame.width, frame.height);\n }\n else\n {\n this.setViewport(0, 0, this.renderer.width, this.renderer.height);\n }\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 setViewport(x: number, y: number, width: number, height: number): void\n {\n const v = this.viewport;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\n if (v.width !== width || v.height !== height || v.x !== x || v.y !== y)\n {\n v.x = x;\n v.y = y;\n v.width = width;\n v.height = height;\n\n this.gl.viewport(x, y, width, height);\n }\n }\n\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 size(): { x: number; y: number; width: number; height: number }\n {\n if (this.current)\n {\n // TODO store temp\n return { x: 0, y: 0, width: this.current.width, height: this.current.height };\n }\n\n return { x: 0, y: 0, width: this.renderer.width, height: this.renderer.height };\n }\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 clear(r: number, g: number, b: number, a: number, mask: BUFFER_BITS = BUFFER_BITS.COLOR | BUFFER_BITS.DEPTH): void\n {\n const { gl } = this;\n\n // TODO clear color can be set only one right?\n gl.clearColor(r, g, b, a);\n gl.clear(mask);\n }\n\n /**\n * Initialize framebuffer for this context\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @returns {PIXI.GLFramebuffer} created GLFramebuffer\n */\n initFramebuffer(framebuffer: Framebuffer): GLFramebuffer\n {\n const { gl } = this;\n const fbo = new GLFramebuffer(gl.createFramebuffer());\n\n fbo.multisample = this.detectSamples(framebuffer.multisample);\n framebuffer.glFramebuffers[this.CONTEXT_UID] = fbo;\n\n this.managedFramebuffers.push(framebuffer);\n framebuffer.disposeRunner.add(this);\n\n return fbo;\n }\n\n /**\n * Resize the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n resizeFramebuffer(framebuffer: Framebuffer): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (fbo.msaaBuffer)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.RGBA8, framebuffer.width, framebuffer.height);\n }\n\n if (fbo.stencil)\n {\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n }\n\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n }\n\n if (framebuffer.depthTexture && this.writeDepthTexture)\n {\n this.renderer.texture.bind(framebuffer.depthTexture, 0);\n }\n }\n\n /**\n * Update the framebuffer\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n * @param {number} mipLevel\n */\n updateFramebuffer(framebuffer: Framebuffer, mipLevel: number): void\n {\n const { gl } = this;\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n // bind the color texture\n const colorTextures = framebuffer.colorTextures;\n\n let count = colorTextures.length;\n\n if (!gl.drawBuffers)\n {\n count = Math.min(count, 1);\n }\n\n if (fbo.multisample > 1 && this.canMultisampleFramebuffer(framebuffer))\n {\n fbo.msaaBuffer = fbo.msaaBuffer || gl.createRenderbuffer();\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.msaaBuffer);\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n 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 {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n fbo.msaaBuffer = null;\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n fbo.blitFramebuffer = null;\n }\n }\n\n const activeTextures = [];\n\n for (let i = 0; i < count; i++)\n {\n const texture = colorTextures[i];\n const parentTexture = texture.parentTextureArray || texture;\n\n this.renderer.texture.bind(parentTexture, 0);\n\n if (i === 0 && fbo.msaaBuffer)\n {\n continue;\n }\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.COLOR_ATTACHMENT0 + i,\n texture.target,\n parentTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n\n activeTextures.push(gl.COLOR_ATTACHMENT0 + i);\n }\n\n if (activeTextures.length > 1)\n {\n gl.drawBuffers(activeTextures);\n }\n\n if (framebuffer.depthTexture)\n {\n const writeDepthTexture = this.writeDepthTexture;\n\n if (writeDepthTexture)\n {\n const depthTexture = framebuffer.depthTexture;\n\n this.renderer.texture.bind(depthTexture, 0);\n\n gl.framebufferTexture2D(gl.FRAMEBUFFER,\n gl.DEPTH_ATTACHMENT,\n gl.TEXTURE_2D,\n depthTexture._glTextures[this.CONTEXT_UID].texture,\n mipLevel);\n }\n }\n\n if ((framebuffer.stencil || framebuffer.depth) && !(framebuffer.depthTexture && this.writeDepthTexture))\n {\n fbo.stencil = fbo.stencil || gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, fbo.stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample,\n gl.DEPTH24_STENCIL8, framebuffer.width, framebuffer.height);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, framebuffer.width, framebuffer.height);\n }\n\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, fbo.stencil);\n }\n else if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n fbo.stencil = null;\n }\n }\n\n /**\n * Returns true if the frame buffer can be multisampled\n *\n * @protected\n * @param {PIXI.Framebuffer} framebuffer\n */\n protected canMultisampleFramebuffer(framebuffer: Framebuffer): boolean\n {\n return this.renderer.context.webGLVersion !== 1\n && framebuffer.colorTextures.length <= 1 && !framebuffer.depthTexture;\n }\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 protected detectSamples(samples: MSAA_QUALITY): MSAA_QUALITY\n {\n const { msaaSamples } = this;\n let res: number = MSAA_QUALITY.NONE;\n\n if (samples <= 1 || msaaSamples === null)\n {\n return res;\n }\n for (let i = 0; i < msaaSamples.length; i++)\n {\n if (msaaSamples[i] <= samples)\n {\n res = msaaSamples[i];\n break;\n }\n }\n\n if (res === 1)\n {\n res = MSAA_QUALITY.NONE;\n }\n\n return res;\n }\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 public blit(framebuffer?: Framebuffer, sourcePixels?: Rectangle, destPixels?: Rectangle): void\n {\n const { current, renderer, gl, CONTEXT_UID } = this;\n\n if (renderer.context.webGLVersion !== 2)\n {\n return;\n }\n\n if (!current)\n {\n return;\n }\n const fbo = current.glFramebuffers[CONTEXT_UID];\n\n if (!fbo)\n {\n return;\n }\n if (!framebuffer)\n {\n if (!fbo.msaaBuffer)\n {\n return;\n }\n\n const colorTexture = current.colorTextures[0];\n\n if (!colorTexture)\n {\n return;\n }\n\n if (!fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer = new Framebuffer(current.width, current.height);\n fbo.blitFramebuffer.addColorTexture(0, colorTexture);\n }\n\n framebuffer = fbo.blitFramebuffer;\n\n if (framebuffer.colorTextures[0] !== colorTexture)\n {\n framebuffer.colorTextures[0] = colorTexture;\n framebuffer.dirtyId++;\n framebuffer.dirtyFormat++;\n }\n\n if (framebuffer.width !== current.width || framebuffer.height !== current.height)\n {\n framebuffer.width = current.width;\n framebuffer.height = current.height;\n framebuffer.dirtyId++;\n framebuffer.dirtySize++;\n }\n }\n\n if (!sourcePixels)\n {\n sourcePixels = tempRectangle;\n sourcePixels.width = current.width;\n sourcePixels.height = current.height;\n }\n if (!destPixels)\n {\n destPixels = sourcePixels;\n }\n\n const sameSize = sourcePixels.width === destPixels.width && sourcePixels.height === destPixels.height;\n\n this.bind(framebuffer);\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);\n gl.blitFramebuffer(sourcePixels.x, sourcePixels.y, sourcePixels.width, sourcePixels.height,\n destPixels.x, destPixels.y, destPixels.width, destPixels.height,\n gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR\n );\n }\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 disposeFramebuffer(framebuffer: Framebuffer, contextLost?: boolean): void\n {\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n if (!fbo)\n {\n return;\n }\n\n delete framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n const index = this.managedFramebuffers.indexOf(framebuffer);\n\n if (index >= 0)\n {\n this.managedFramebuffers.splice(index, 1);\n }\n\n framebuffer.disposeRunner.remove(this);\n\n if (!contextLost)\n {\n gl.deleteFramebuffer(fbo.framebuffer);\n\n if (fbo.msaaBuffer)\n {\n gl.deleteRenderbuffer(fbo.msaaBuffer);\n }\n\n if (fbo.stencil)\n {\n gl.deleteRenderbuffer(fbo.stencil);\n }\n }\n\n if (fbo.blitFramebuffer)\n {\n fbo.blitFramebuffer.dispose();\n }\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 disposeAll(contextLost?: boolean): void\n {\n const list = this.managedFramebuffers;\n\n (this.managedFramebuffers as any) = [];\n\n for (let i = 0; i < list.length; i++)\n {\n this.disposeFramebuffer(list[i], contextLost);\n }\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 forceStencil(): void\n {\n const framebuffer = this.current;\n\n if (!framebuffer)\n {\n return;\n }\n\n const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];\n\n if (!fbo || fbo.stencil)\n {\n return;\n }\n\n framebuffer.stencil = true;\n\n const w = framebuffer.width;\n const h = framebuffer.height;\n const gl = this.gl;\n const stencil = gl.createRenderbuffer();\n\n gl.bindRenderbuffer(gl.RENDERBUFFER, stencil);\n\n if (fbo.msaaBuffer)\n {\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, fbo.multisample, gl.DEPTH24_STENCIL8, w, h);\n }\n else\n {\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, w, h);\n }\n\n fbo.stencil = stencil;\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, stencil);\n }\n\n /**\n * resets framebuffer stored state, binds screen framebuffer\n *\n * should be called before renderTexture reset()\n */\n reset(): void\n {\n this.current = this.unknownFramebuffer;\n this.viewport = new Rectangle();\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { GLBuffer } from './GLBuffer';\nimport { ENV } from '@pixi/constants';\nimport { settings } from '../settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { DRAW_MODES } from '@pixi/constants';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Geometry } from './Geometry';\nimport type { Shader } from '../shader/Shader';\nimport type { Program } from '../shader/Program';\nimport type { Dict } from '@pixi/utils';\n\nconst byteSizeMap: {[key: number]: number} = { 5126: 4, 5123: 2, 5121: 1 };\n\n/**\n * System plugin to the renderer to manage geometry.\n *\n * @memberof PIXI\n */\nexport class GeometrySystem implements ISystem\n{\n /**\n * `true` if we has `*_vertex_array_object` extension.\n *\n * @readonly\n */\n public hasVao: boolean;\n\n /**\n * `true` if has `ANGLE_instanced_arrays` extension.\n *\n * @readonly\n */\n public hasInstance: boolean;\n\n /**\n * `true` if support `gl.UNSIGNED_INT` in `gl.drawElements` or `gl.drawElementsInstanced`.\n *\n * @readonly\n */\n public canUseUInt32ElementIndex: boolean;\n\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected _activeGeometry: Geometry;\n protected _activeVao: WebGLVertexArrayObject;\n protected _boundBuffer: GLBuffer;\n\n /** Cache for all geometries by id, used in case renderer gets destroyed or for profiling. */\n readonly managedGeometries: {[key: number]: Geometry};\n\n /** Renderer that owns this {@link GeometrySystem}. */\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this._activeGeometry = null;\n this._activeVao = null;\n\n this.hasVao = true;\n this.hasInstance = true;\n this.canUseUInt32ElementIndex = false;\n this.managedGeometries = {};\n }\n\n /** Sets up the renderer context and necessary buffers. */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n const gl = this.gl = this.renderer.gl;\n const context = this.renderer.context;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n // webgl2\n if (context.webGLVersion !== 2)\n {\n // webgl 1!\n let nativeVaoExtension = this.renderer.context.extensions.vertexArrayObject;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n nativeVaoExtension = null;\n }\n\n if (nativeVaoExtension)\n {\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n nativeVaoExtension.createVertexArrayOES();\n\n gl.bindVertexArray = (vao): void =>\n nativeVaoExtension.bindVertexArrayOES(vao);\n\n gl.deleteVertexArray = (vao): void =>\n nativeVaoExtension.deleteVertexArrayOES(vao);\n }\n else\n {\n this.hasVao = false;\n gl.createVertexArray = (): WebGLVertexArrayObject =>\n null;\n\n gl.bindVertexArray = (): void =>\n null;\n\n gl.deleteVertexArray = (): void =>\n null;\n }\n }\n\n if (context.webGLVersion !== 2)\n {\n const instanceExt = gl.getExtension('ANGLE_instanced_arrays');\n\n if (instanceExt)\n {\n gl.vertexAttribDivisor = (a, b): void =>\n instanceExt.vertexAttribDivisorANGLE(a, b);\n\n gl.drawElementsInstanced = (a, b, c, d, e): void =>\n instanceExt.drawElementsInstancedANGLE(a, b, c, d, e);\n\n gl.drawArraysInstanced = (a, b, c, d): void =>\n instanceExt.drawArraysInstancedANGLE(a, b, c, d);\n }\n else\n {\n this.hasInstance = false;\n }\n }\n\n this.canUseUInt32ElementIndex = context.webGLVersion === 2 || !!context.extensions.uint32ElementIndex;\n }\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 bind(geometry?: Geometry, shader?: Shader): void\n {\n shader = shader || this.renderer.shader.shader;\n\n const { gl } = this;\n\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 let vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n let incRefCount = false;\n\n if (!vaos)\n {\n this.managedGeometries[geometry.id] = geometry;\n geometry.disposeRunner.add(this);\n geometry.glVertexArrayObjects[this.CONTEXT_UID] = vaos = {};\n incRefCount = true;\n }\n\n const vao = vaos[shader.program.id] || this.initGeometryVao(geometry, shader, incRefCount);\n\n this._activeGeometry = geometry;\n\n if (this._activeVao !== vao)\n {\n this._activeVao = vao;\n\n if (this.hasVao)\n {\n gl.bindVertexArray(vao);\n }\n else\n {\n this.activateVao(geometry, shader.program);\n }\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\n /** Reset and unbind any active VAO and geometry. */\n reset(): void\n {\n this.unbind();\n }\n\n /** Update buffers of the currently bound geometry. */\n updateBuffers(): void\n {\n const geometry = this._activeGeometry;\n\n const bufferSystem = this.renderer.buffer;\n\n for (let i = 0; i < geometry.buffers.length; i++)\n {\n const buffer = geometry.buffers[i];\n\n bufferSystem.update(buffer);\n }\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 protected checkCompatibility(geometry: Geometry, program: Program): void\n {\n // geometry must have at least all the attributes that the shader requires.\n const geometryAttributes = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n for (const j in shaderAttributes)\n {\n if (!geometryAttributes[j])\n {\n throw new Error(`shader and geometry incompatible, geometry missing the \"${j}\" attribute`);\n }\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 protected getSignature(geometry: Geometry, program: Program): string\n {\n const attribs = geometry.attributes;\n const shaderAttributes = program.attributeData;\n\n const strings = ['g', geometry.id];\n\n for (const i in attribs)\n {\n if (shaderAttributes[i])\n {\n strings.push(i, shaderAttributes[i].location);\n }\n }\n\n return strings.join('-');\n }\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 protected initGeometryVao(geometry: Geometry, shader: Shader, incRefCount = true): WebGLVertexArrayObject\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const program = shader.program;\n\n if (!program.glPrograms[CONTEXT_UID])\n {\n this.renderer.shader.generateProgram(shader);\n }\n\n this.checkCompatibility(geometry, program);\n\n const signature = this.getSignature(geometry, program);\n\n const vaoObjectHash = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n\n let vao = vaoObjectHash[signature];\n\n if (vao)\n {\n // this will give us easy access to the vao\n vaoObjectHash[program.id] = vao;\n\n return vao;\n }\n\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n const tempStride: Dict = {};\n const tempStart: Dict = {};\n\n for (const j in buffers)\n {\n tempStride[j] = 0;\n tempStart[j] = 0;\n }\n\n for (const j in attributes)\n {\n if (!attributes[j].size && program.attributeData[j])\n {\n attributes[j].size = program.attributeData[j].size;\n }\n else if (!attributes[j].size)\n {\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\n tempStride[attributes[j].buffer] += attributes[j].size * byteSizeMap[attributes[j].type];\n }\n\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const attribSize = attribute.size;\n\n if (attribute.stride === undefined)\n {\n if (tempStride[attribute.buffer] === attribSize * byteSizeMap[attribute.type])\n {\n attribute.stride = 0;\n }\n else\n {\n attribute.stride = tempStride[attribute.buffer];\n }\n }\n\n if (attribute.start === undefined)\n {\n attribute.start = tempStart[attribute.buffer];\n\n tempStart[attribute.buffer] += attribSize * byteSizeMap[attribute.type];\n }\n }\n\n vao = gl.createVertexArray();\n\n gl.bindVertexArray(vao);\n\n // first update - and create the buffers!\n // only create a gl buffer if it actually gets\n for (let i = 0; i < buffers.length; i++)\n {\n const buffer = buffers[i];\n\n bufferSystem.bind(buffer);\n\n if (incRefCount)\n {\n buffer._glBuffers[CONTEXT_UID].refCount++;\n }\n }\n\n // TODO - maybe make this a data object?\n // lets wait to see if we need to first!\n\n this.activateVao(geometry, program);\n\n this._activeVao = vao;\n\n // add it to the cache!\n vaoObjectHash[program.id] = vao;\n vaoObjectHash[signature] = vao;\n\n return vao;\n }\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 disposeGeometry(geometry: Geometry, contextLost?: boolean): void\n {\n if (!this.managedGeometries[geometry.id])\n {\n return;\n }\n\n delete this.managedGeometries[geometry.id];\n\n const vaos = geometry.glVertexArrayObjects[this.CONTEXT_UID];\n const gl = this.gl;\n const buffers = geometry.buffers;\n const bufferSystem = this.renderer?.buffer;\n\n geometry.disposeRunner.remove(this);\n\n if (!vaos)\n {\n return;\n }\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 {\n for (let i = 0; i < buffers.length; i++)\n {\n const buf = buffers[i]._glBuffers[this.CONTEXT_UID];\n\n // my be null as context may have changed right before the dispose is called\n if (buf)\n {\n buf.refCount--;\n if (buf.refCount === 0 && !contextLost)\n {\n bufferSystem.dispose(buffers[i], contextLost);\n }\n }\n }\n }\n\n if (!contextLost)\n {\n for (const vaoId in vaos)\n {\n // delete only signatures, everything else are copies\n if (vaoId[0] === 'g')\n {\n const vao = vaos[vaoId];\n\n if (this._activeVao === vao)\n {\n this.unbind();\n }\n gl.deleteVertexArray(vao);\n }\n }\n }\n\n delete geometry.glVertexArrayObjects[this.CONTEXT_UID];\n }\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 disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedGeometries);\n\n for (let i = 0; i < all.length; i++)\n {\n this.disposeGeometry(this.managedGeometries[all[i]], contextLost);\n }\n }\n\n /**\n * Activate vertex array object.\n *\n * @param geometry - Geometry instance.\n * @param program - Shader program instance.\n */\n protected activateVao(geometry: Geometry, program: Program): void\n {\n const gl = this.gl;\n const CONTEXT_UID = this.CONTEXT_UID;\n const bufferSystem = this.renderer.buffer;\n const buffers = geometry.buffers;\n const attributes = geometry.attributes;\n\n if (geometry.indexBuffer)\n {\n // first update the index buffer if we have one..\n bufferSystem.bind(geometry.indexBuffer);\n }\n\n let lastBuffer = null;\n\n // add a new one!\n for (const j in attributes)\n {\n const attribute = attributes[j];\n const buffer = buffers[attribute.buffer];\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (program.attributeData[j])\n {\n if (lastBuffer !== glBuffer)\n {\n bufferSystem.bind(buffer);\n\n lastBuffer = glBuffer;\n }\n\n const location = program.attributeData[j].location;\n\n // TODO introduce state again\n // we can optimise this for older devices that have no VAOs\n gl.enableVertexAttribArray(location);\n\n gl.vertexAttribPointer(location,\n attribute.size,\n attribute.type || gl.FLOAT,\n attribute.normalized,\n attribute.stride,\n attribute.start);\n\n if (attribute.instance)\n {\n // TODO calculate instance count based of this...\n if (this.hasInstance)\n {\n gl.vertexAttribDivisor(location, 1);\n }\n else\n {\n throw new Error('geometry error, GPU Instancing is not supported on this device');\n }\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 draw(type: DRAW_MODES, size?: number, start?: number, instanceCount?: number): this\n {\n const { gl } = this;\n const geometry = this._activeGeometry;\n\n // TODO.. this should not change so maybe cache the function?\n\n if (geometry.indexBuffer)\n {\n const byteSize = geometry.indexBuffer.data.BYTES_PER_ELEMENT;\n const glType = byteSize === 2 ? gl.UNSIGNED_SHORT : gl.UNSIGNED_INT;\n\n if (byteSize === 2 || (byteSize === 4 && this.canUseUInt32ElementIndex))\n {\n if (geometry.instanced)\n {\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 {\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 {\n console.warn('unsupported index buffer type: uint32');\n }\n }\n else if (geometry.instanced)\n {\n // TODO need a better way to calculate size..\n gl.drawArraysInstanced(type, start, size || geometry.getSize(), instanceCount || 1);\n }\n else\n {\n gl.drawArrays(type, start, size || geometry.getSize());\n }\n\n return this;\n }\n\n /** Unbind/reset everything. */\n protected unbind(): void\n {\n this.gl.bindVertexArray(null);\n this._activeVao = null;\n this._activeGeometry = null;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { MASK_TYPES, MSAA_QUALITY } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { ISpriteMaskFilter } from '@pixi/core';\n\nimport type { Rectangle, Matrix } from '@pixi/math';\nimport type { IFilterTarget } from '../filters/IFilterTarget';\nimport type { Renderer } from '../Renderer';\n\nexport interface IMaskTarget extends IFilterTarget\n{\n renderable: boolean;\n isSprite?: boolean;\n worldTransform: Matrix;\n isFastRect?(): boolean;\n getBounds(skipUpdate?: boolean): Rectangle;\n render(renderer: Renderer): void;\n}\n/**\n * Component for masked elements.\n *\n * Holds mask mode and temporary data about current mask.\n *\n * @memberof PIXI\n */\nexport class MaskData\n{\n /** Mask type */\n public type: MASK_TYPES;\n\n /**\n * Whether we know the mask type beforehand\n * @default true\n */\n public autoDetect: boolean;\n\n /**\n * Which element we use to mask\n * @member {PIXI.DisplayObject}\n */\n public maskObject: IMaskTarget;\n\n /** Whether it belongs to MaskSystem pool */\n public pooled: boolean;\n\n /** Indicator of the type (always true for {@link MaskData} objects) */\n public isMaskData: boolean;// webdoc crashes if the type is true because reasons... (will fix)\n\n /**\n * Resolution of the sprite mask filter.\n * If set to `null` or `0`, the resolution of the current render target is used.\n * @default null\n */\n public resolution: number;\n\n /**\n * Number of samples of the sprite mask filter.\n * If set to `null`, the sample count of the current render target is used.\n * @default PIXI.settings.FILTER_MULTISAMPLE\n */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the mask is applied, if false it will not. */\n public enabled: boolean;\n\n /**\n * The sprite mask filter wrapped in an array.\n * @private\n */\n _filters: ISpriteMaskFilter[];\n\n /**\n * Stencil counter above the mask in stack\n * @private\n */\n _stencilCounter: number;\n\n /**\n * Scissor counter above the mask in stack\n * @private\n */\n _scissorCounter: number;\n\n /**\n * Scissor operation above the mask in stack.\n * Null if _scissorCounter is zero, rectangle instance if positive.\n */\n _scissorRect: Rectangle;\n\n /**\n * pre-computed scissor rect\n * does become _scissorRect when mask is actually pushed\n */\n _scissorRectLocal: Rectangle;\n\n /**\n * Targeted element. Temporary variable set by MaskSystem\n * @member {PIXI.DisplayObject}\n * @private\n */\n _target: IMaskTarget;\n\n /**\n * Create MaskData\n *\n * @param {PIXI.DisplayObject} [maskObject=null] - object that describes the mask\n */\n constructor(maskObject: IMaskTarget = null)\n {\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\n /**\n * The sprite mask filter.\n * If set to `null`, the default sprite mask filter is used.\n * @default null\n */\n get filter(): ISpriteMaskFilter\n {\n return this._filters ? this._filters[0] : null;\n }\n\n set filter(value: ISpriteMaskFilter)\n {\n if (value)\n {\n if (this._filters)\n {\n this._filters[0] = value;\n }\n else\n {\n this._filters = [value];\n }\n }\n else\n {\n this._filters = null;\n }\n }\n\n /** Resets the mask data after popMask(). */\n reset(): void\n {\n if (this.pooled)\n {\n this.maskObject = null;\n\n this.type = MASK_TYPES.NONE;\n\n this.autoDetect = true;\n }\n\n this._target = null;\n this._scissorRectLocal = null;\n }\n\n /** Copies counters from maskData above, called from pushMask(). */\n copyCountersOrReset(maskAbove?: MaskData): void\n {\n if (maskAbove)\n {\n this._stencilCounter = maskAbove._stencilCounter;\n this._scissorCounter = maskAbove._scissorCounter;\n this._scissorRect = maskAbove._scissorRect;\n }\n else\n {\n this._stencilCounter = 0;\n this._scissorCounter = 0;\n this._scissorRect = null;\n }\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 */\nexport function compileShader(gl: WebGLRenderingContextBase, type: number, src: string): WebGLShader\n{\n const shader = gl.createShader(type);\n\n gl.shaderSource(shader, src);\n gl.compileShader(shader);\n\n return shader;\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: WebGLRenderingContext, shader: WebGLShader): void\n{\n const shaderSrc = gl.getShaderSource(shader)\n .split('\\n')\n .map((line, index) => `${index}: ${line}`);\n\n const shaderLog = gl.getShaderInfoLog(shader);\n const splitShader = shaderLog.split('\\n');\n\n const dedupe: Record = {};\n\n const lineNumbers = splitShader.map((line) => parseFloat(line.replace(/^ERROR\\: 0\\:([\\d]+)\\:.*$/, '$1')))\n .filter((n) =>\n {\n if (n && !dedupe[n])\n {\n dedupe[n] = true;\n\n return true;\n }\n\n return false;\n });\n\n const logArgs = [''];\n\n lineNumbers.forEach((number) =>\n {\n shaderSrc[number - 1] = `%c${shaderSrc[number - 1]}%c`;\n logArgs.push('background: #FF0000; color:#FFFFFF; font-size: 10px', 'font-size: 10px');\n });\n\n const fragmentSourceToLog = shaderSrc\n .join('\\n');\n\n logArgs[0] = fragmentSourceToLog;\n\n console.error(shaderLog);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('click to view full shader code');\n console.warn(...logArgs);\n // eslint-disable-next-line no-console\n console.groupEnd();\n}\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 */\nexport function logProgramError(\n gl: WebGLRenderingContext,\n program: WebGLProgram,\n vertexShader: WebGLShader,\n fragmentShader: WebGLShader\n): void\n{\n // if linking fails, then log and cleanup\n if (!gl.getProgramParameter(program, gl.LINK_STATUS))\n {\n if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, vertexShader);\n }\n\n if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS))\n {\n logPrettyShaderError(gl, fragmentShader);\n }\n\n console.error('PixiJS Error: Could not initialize shader.');\n\n // if there is a program info log, log it\n if (gl.getProgramInfoLog(program) !== '')\n {\n console.warn('PixiJS Warning: gl.getProgramInfoLog()', gl.getProgramInfoLog(program));\n }\n }\n}\n","function booleanArray(size: number): Array\n{\n const array = new Array(size);\n\n for (let i = 0; i < array.length; i++)\n {\n array[i] = false;\n }\n\n return array;\n}\n\n/**\n * @method defaultValue\n * @memberof PIXI.glCore.shader\n * @param {string} type - Type of value\n * @param {number} size\n * @private\n */\nexport function defaultValue(type: string, size: number): number|Float32Array|Int32Array|Uint32Array|boolean|boolean[]\n{\n switch (type)\n {\n case 'float':\n return 0;\n\n case 'vec2':\n return new Float32Array(2 * size);\n\n case 'vec3':\n return new Float32Array(3 * size);\n\n case 'vec4':\n return new Float32Array(4 * size);\n\n case 'int':\n case 'uint':\n case 'sampler2D':\n case 'sampler2DArray':\n return 0;\n\n case 'ivec2':\n return new Int32Array(2 * size);\n\n case 'ivec3':\n return new Int32Array(3 * size);\n\n case 'ivec4':\n return new Int32Array(4 * size);\n\n case 'uvec2':\n return new Uint32Array(2 * size);\n\n case 'uvec3':\n return new Uint32Array(3 * size);\n\n case 'uvec4':\n return new Uint32Array(4 * size);\n\n case 'bool':\n return false;\n\n case 'bvec2':\n\n return booleanArray(2 * size);\n\n case 'bvec3':\n return booleanArray(3 * size);\n\n case 'bvec4':\n return booleanArray(4 * size);\n\n case 'mat2':\n return new Float32Array([1, 0,\n 0, 1]);\n\n case 'mat3':\n return new Float32Array([1, 0, 0,\n 0, 1, 0,\n 0, 0, 1]);\n\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\n return null;\n}\n","import { settings } from '../../settings';\nimport { ENV } from '@pixi/constants';\n\nconst unknownContext = {};\nlet context: WebGLRenderingContext | WebGL2RenderingContext = unknownContext as any;\n\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 */\nexport function getTestContext(): WebGLRenderingContext | WebGL2RenderingContext\n{\n if (context === unknownContext || (context && context.isContextLost()))\n {\n const canvas = document.createElement('canvas');\n\n let gl: WebGLRenderingContext | WebGL2RenderingContext;\n\n if (settings.PREFER_ENV >= ENV.WEBGL2)\n {\n gl = canvas.getContext('webgl2', {});\n }\n\n if (!gl)\n {\n gl = canvas.getContext('webgl', {})\n || (canvas.getContext('experimental-webgl', {}) as WebGLRenderingContext);\n\n if (!gl)\n {\n // fail, not able to get a context\n gl = null;\n }\n else\n {\n // for shader testing..\n gl.getExtension('WEBGL_draw_buffers');\n }\n }\n\n context = gl;\n }\n\n return context;\n}\n","import { getTestContext } from './getTestContext';\nimport { PRECISION } from '@pixi/constants';\n\nlet maxFragmentPrecision: PRECISION;\n\nexport function getMaxFragmentPrecision(): PRECISION\n{\n if (!maxFragmentPrecision)\n {\n maxFragmentPrecision = PRECISION.MEDIUM;\n const gl = getTestContext();\n\n if (gl)\n {\n if (gl.getShaderPrecisionFormat)\n {\n const shaderFragment = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT);\n\n maxFragmentPrecision = shaderFragment.precision ? PRECISION.HIGH : PRECISION.MEDIUM;\n }\n }\n }\n\n return maxFragmentPrecision;\n}\n","import { PRECISION } from '@pixi/constants';\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 */\nexport function setPrecision(src: string, requestedPrecision: PRECISION, maxSupportedPrecision: PRECISION): string\n{\n if (src.substring(0, 9) !== 'precision')\n {\n // no precision supplied, so PixiJS will add the requested level.\n let precision = requestedPrecision;\n\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 {\n precision = PRECISION.MEDIUM;\n }\n\n return `precision ${precision} float;\\n${src}`;\n }\n else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === 'precision highp')\n {\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\n return src;\n}\n","import type { Dict } from '@pixi/utils';\n\nconst GLSL_TO_SIZE: Dict = {\n float: 1,\n vec2: 2,\n vec3: 3,\n vec4: 4,\n\n int: 1,\n ivec2: 2,\n ivec3: 3,\n ivec4: 4,\n\n uint: 1,\n uvec2: 2,\n uvec3: 3,\n uvec4: 4,\n\n bool: 1,\n bvec2: 2,\n bvec3: 3,\n bvec4: 4,\n\n mat2: 4,\n mat3: 9,\n mat4: 16,\n\n sampler2D: 1,\n};\n\n/**\n * @private\n * @method mapSize\n * @memberof PIXI.glCore.shader\n * @param {String} type\n * @return {Number}\n */\nexport function mapSize(type: string): number\n{\n return GLSL_TO_SIZE[type];\n}\n","import type { Dict } from '@pixi/utils';\n\nlet GL_TABLE: Dict = null;\n\nconst GL_TO_GLSL_TYPES: Dict = {\n FLOAT: 'float',\n FLOAT_VEC2: 'vec2',\n FLOAT_VEC3: 'vec3',\n FLOAT_VEC4: 'vec4',\n\n INT: 'int',\n INT_VEC2: 'ivec2',\n INT_VEC3: 'ivec3',\n INT_VEC4: 'ivec4',\n\n UNSIGNED_INT: 'uint',\n UNSIGNED_INT_VEC2: 'uvec2',\n UNSIGNED_INT_VEC3: 'uvec3',\n UNSIGNED_INT_VEC4: 'uvec4',\n\n BOOL: 'bool',\n BOOL_VEC2: 'bvec2',\n BOOL_VEC3: 'bvec3',\n BOOL_VEC4: 'bvec4',\n\n FLOAT_MAT2: 'mat2',\n FLOAT_MAT3: 'mat3',\n FLOAT_MAT4: 'mat4',\n\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\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nexport function mapType(gl: any, type: number): string\n{\n if (!GL_TABLE)\n {\n const typeNames = Object.keys(GL_TO_GLSL_TYPES);\n\n GL_TABLE = {};\n\n for (let i = 0; i < typeNames.length; ++i)\n {\n const tn = typeNames[i];\n\n GL_TABLE[gl[tn]] = GL_TO_GLSL_TYPES[tn];\n }\n }\n\n return GL_TABLE[type];\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// }\n\nexport interface IUniformParser\n{\n test(data: unknown, uniform: any): boolean;\n code(name: string, uniform: any): string;\n codeUbo?(name: string, uniform: any): string;\n}\n\nexport const uniformParsers: IUniformParser[] = [\n\n // a float cache layer\n {\n test: (data: any): boolean =>\n data.type === 'float' && data.size === 1,\n code: (name: string): string =>\n `\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 // handling samplers\n {\n test: (data: any): boolean =>\n // eslint-disable-next-line max-len\n (data.type === 'sampler2D' || data.type === 'samplerCube' || data.type === 'sampler2DArray') && data.size === 1 && !data.isArray,\n code: (name: string): string => `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: (data: any, uniform: any): boolean =>\n data.type === 'mat3' && data.size === 1 && uniform.a !== undefined,\n code: (name: string): string =>\n\n // TODO and some smart caching dirty ids here!\n `\n gl.uniformMatrix3fv(ud[\"${name}\"].location, false, uv[\"${name}\"].toArray(true));\n `,\n codeUbo: (name: string): string =>\n `\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 },\n // uploading a pixi point as a vec2 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec2' && data.size === 1 && uniform.x !== undefined,\n code: (name: string): string =>\n `\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 codeUbo: (name: string): string =>\n `\n v = uv.${name};\n\n data[offset] = v.x;\n data[offset+1] = v.y;\n `\n },\n // caching layer for a vec2\n {\n test: (data: any): boolean =>\n data.type === 'vec2' && data.size === 1,\n code: (name: string): string =>\n `\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 // upload a pixi rectangle as a vec4 with caching layer\n {\n test: (data: any, uniform: any): boolean =>\n data.type === 'vec4' && data.size === 1 && uniform.width !== undefined,\n\n code: (name: string): string =>\n `\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 codeUbo: (name: string): string =>\n `\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 // a caching layer for vec4 uploading\n {\n test: (data: any): boolean =>\n data.type === 'vec4' && data.size === 1,\n code: (name: string): string =>\n `\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","import { uniformParsers } from './uniformParsers';\n\nimport type { UniformGroup } from '../UniformGroup';\nimport type { Dict } from '@pixi/utils';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\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\nconst GLSL_TO_SINGLE_SETTERS_CACHED: Dict = {\n\n float: `\n if (cv !== v)\n {\n cu.value = v;\n gl.uniform1f(location, v);\n }`,\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\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\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\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\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\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\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n\n sampler2D: 'gl.uniform1i(location, v)',\n samplerCube: 'gl.uniform1i(location, v)',\n sampler2DArray: 'gl.uniform1i(location, v)',\n};\n\nconst GLSL_TO_ARRAY_SETTERS: Dict = {\n\n float: `gl.uniform1fv(location, v)`,\n\n vec2: `gl.uniform2fv(location, v)`,\n vec3: `gl.uniform3fv(location, v)`,\n vec4: 'gl.uniform4fv(location, v)',\n\n mat4: 'gl.uniformMatrix4fv(location, false, v)',\n mat3: 'gl.uniformMatrix3fv(location, false, v)',\n mat2: 'gl.uniformMatrix2fv(location, false, v)',\n\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\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\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\n sampler2D: 'gl.uniform1iv(location, v)',\n samplerCube: 'gl.uniform1iv(location, v)',\n sampler2DArray: 'gl.uniform1iv(location, v)',\n};\n\nexport function generateUniformsSync(group: UniformGroup, uniformData: Dict): UniformsSyncCallback\n{\n const funcFragments = [`\n var v = null;\n var cv = null;\n var cu = null;\n var t = 0;\n var gl = renderer.gl;\n `];\n\n for (const i in group.uniforms)\n {\n const data = uniformData[i];\n\n if (!data)\n {\n if (group.uniforms[i]?.group)\n {\n if (group.uniforms[i].ubo)\n {\n funcFragments.push(`\n renderer.shader.syncUniformBufferGroup(uv.${i}, '${i}');\n `);\n }\n else\n {\n funcFragments.push(`\n renderer.shader.syncUniformGroup(uv.${i}, syncData);\n `);\n }\n }\n\n continue;\n }\n\n const uniform = group.uniforms[i];\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n if (uniformParsers[j].test(data, uniform))\n {\n funcFragments.push(uniformParsers[j].code(i, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n const templateType = (data.size === 1) ? GLSL_TO_SINGLE_SETTERS_CACHED : GLSL_TO_ARRAY_SETTERS;\n\n const template = templateType[data.type].replace('location', `ud[\"${i}\"].location`);\n\n funcFragments.push(`\n cu = ud[\"${i}\"];\n cv = cu.value;\n v = uv[\"${i}\"];\n ${template};`);\n }\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')) as UniformsSyncCallback;\n}\n","import type { IRenderingContext } from '../../IRenderingContext';\n\nconst fragTemplate = [\n 'precision mediump float;',\n 'void main(void){',\n 'float test = 0.1;',\n '%forloop%',\n 'gl_FragColor = vec4(0.0);',\n '}',\n].join('\\n');\n\nfunction generateIfTestSrc(maxIfs: number): string\n{\n let src = '';\n\n for (let i = 0; i < maxIfs; ++i)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxIfs - 1)\n {\n src += `if(test == ${i}.0){}`;\n }\n }\n\n return src;\n}\n\nexport function checkMaxIfStatementsInShader(maxIfs: number, gl: IRenderingContext): number\n{\n if (maxIfs === 0)\n {\n throw new Error('Invalid value of `0` passed to `checkMaxIfStatementsInShader`');\n }\n\n const shader = gl.createShader(gl.FRAGMENT_SHADER);\n\n while (true) // eslint-disable-line no-constant-condition\n {\n const fragmentSrc = fragTemplate.replace(/%forloop%/gi, generateIfTestSrc(maxIfs));\n\n gl.shaderSource(shader, fragmentSrc);\n gl.compileShader(shader);\n\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))\n {\n maxIfs = (maxIfs / 2) | 0;\n }\n else\n {\n // valid!\n break;\n }\n }\n\n return maxIfs;\n}\n","// Cache the result to prevent running this over and over\nlet unsafeEval: boolean;\n\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 */\nexport function unsafeEvalSupported(): boolean\n{\n if (typeof unsafeEval === 'boolean')\n {\n return unsafeEval;\n }\n\n try\n {\n /* eslint-disable no-new-func */\n const func = new Function('param1', 'param2', 'param3', 'return param1[param2] === param3;');\n /* eslint-enable no-new-func */\n\n unsafeEval = func({ a: 'b' }, 'a', 'b') === true;\n }\n catch (e)\n {\n unsafeEval = false;\n }\n\n return unsafeEval;\n}\n","import { setPrecision,\n getMaxFragmentPrecision } from './utils';\nimport { ProgramCache } from '@pixi/utils';\nimport defaultFragment from './defaultProgram.frag';\nimport defaultVertex from './defaultProgram.vert';\nimport { settings } from '@pixi/settings';\nimport { PRECISION } from '@pixi/constants';\n\nimport type { GLProgram } from './GLProgram';\n\nlet UID = 0;\n\nconst nameCache: { [key: string]: number } = {};\n\nexport interface IAttributeData\n{\n type: string;\n size: number;\n location: number;\n name: string;\n}\n\nexport interface IUniformData\n{\n index: number;\n type: string;\n size: number;\n isArray: boolean;\n value: any;\n name: string;\n}\n\n/**\n * Helper class to create a shader program.\n *\n * @memberof PIXI\n */\nexport class Program\n{\n public id: number;\n\n /** Source code for the vertex shader. */\n public vertexSrc: string;\n\n /** Source code for the fragment shader. */\n public fragmentSrc: string;\n\n nameCache: any;\n glPrograms: { [ key: number ]: GLProgram};\n syncUniforms: any;\n\n /** Assigned when a program is first bound to the shader system. */\n attributeData: { [key: string]: IAttributeData};\n\n /** Assigned when a program is first bound to the shader system. */\n uniformData: {[key: string]: IUniformData};\n\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 constructor(vertexSrc?: string, fragmentSrc?: string, name = 'pixi-shader')\n {\n this.id = UID++;\n this.vertexSrc = vertexSrc || Program.defaultVertexSrc;\n this.fragmentSrc = fragmentSrc || Program.defaultFragmentSrc;\n\n this.vertexSrc = this.vertexSrc.trim();\n this.fragmentSrc = this.fragmentSrc.trim();\n\n if (this.vertexSrc.substring(0, 8) !== '#version')\n {\n name = name.replace(/\\s+/g, '-');\n\n if (nameCache[name])\n {\n nameCache[name]++;\n name += `-${nameCache[name]}`;\n }\n else\n {\n nameCache[name] = 1;\n }\n\n this.vertexSrc = `#define SHADER_NAME ${name}\\n${this.vertexSrc}`;\n this.fragmentSrc = `#define SHADER_NAME ${name}\\n${this.fragmentSrc}`;\n\n this.vertexSrc = setPrecision(this.vertexSrc, settings.PRECISION_VERTEX, PRECISION.HIGH);\n this.fragmentSrc = setPrecision(this.fragmentSrc, settings.PRECISION_FRAGMENT, getMaxFragmentPrecision());\n }\n\n // currently this does not extract structs only default types\n // this is where we store shader references..\n this.glPrograms = {};\n\n this.syncUniforms = null;\n }\n\n /**\n * The default vertex shader source.\n *\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source.\n *\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\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 static from(vertexSrc?: string, fragmentSrc?: string, name?: string): Program\n {\n const key = vertexSrc + fragmentSrc;\n\n let program = ProgramCache[key];\n\n if (!program)\n {\n ProgramCache[key] = program = new Program(vertexSrc, fragmentSrc, name);\n }\n\n return program;\n }\n}\n","import { Program } from './Program';\nimport { UniformGroup } from './UniformGroup';\n\nimport type { Dict } from '@pixi/utils';\n\n/**\n * A helper class for shaders.\n *\n * @memberof PIXI\n */\nexport class Shader\n{\n /** Program that the shader uses. */\n public program: Program;\n public uniformGroup: UniformGroup;\n\n /**\n * Used internally to bind uniform buffer objects.\n * @ignore\n */\n uniformBindCount = 0;\n\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 constructor(program: Program, uniforms?: Dict)\n {\n this.program = program;\n\n // lets see whats been passed in\n // uniforms should be converted to a uniform group\n if (uniforms)\n {\n if (uniforms instanceof UniformGroup)\n {\n this.uniformGroup = uniforms;\n }\n else\n {\n this.uniformGroup = new UniformGroup(uniforms);\n }\n }\n else\n {\n this.uniformGroup = new UniformGroup({});\n }\n }\n\n // TODO move to shader system..\n checkUniformExists(name: string, group: UniformGroup): boolean\n {\n if (group.uniforms[name])\n {\n return true;\n }\n\n for (const i in group.uniforms)\n {\n const uniform = group.uniforms[i];\n\n if (uniform.group)\n {\n if (this.checkUniformExists(name, uniform))\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n destroy(): void\n {\n // usage count on programs?\n // remove if not used!\n this.uniformGroup = null;\n }\n\n /**\n * Shader uniform values, shortcut for `uniformGroup.uniforms`.\n *\n * @readonly\n */\n get uniforms(): Dict\n {\n return this.uniformGroup.uniforms;\n }\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 static from(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict): Shader\n {\n const program = Program.from(vertexSrc, fragmentSrc);\n\n return new Shader(program, uniforms);\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\n\n/* eslint-disable max-len */\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\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 */\nexport class State\n{\n data: number;\n _blendMode: BLEND_MODES;\n _polygonOffset: number;\n\n constructor()\n {\n this.data = 0;\n\n this.blendMode = BLEND_MODES.NORMAL;\n this.polygonOffset = 0;\n\n this.blend = true;\n this.depthMask = true;\n // this.depthTest = true;\n }\n\n /**\n * Activates blending of the computed fragment color values.\n *\n * @default true\n */\n get blend(): boolean\n {\n return !!(this.data & (1 << BLEND));\n }\n\n set blend(value: boolean)\n {\n if (!!(this.data & (1 << BLEND)) !== value)\n {\n this.data ^= (1 << BLEND);\n }\n }\n\n /**\n * Activates adding an offset to depth values of polygon's fragments\n *\n * @default false\n */\n get offsets(): boolean\n {\n return !!(this.data & (1 << OFFSET));\n }\n\n set offsets(value: boolean)\n {\n if (!!(this.data & (1 << OFFSET)) !== value)\n {\n this.data ^= (1 << OFFSET);\n }\n }\n\n /**\n * Activates culling of polygons.\n *\n * @default false\n */\n get culling(): boolean\n {\n return !!(this.data & (1 << CULLING));\n }\n\n set culling(value: boolean)\n {\n if (!!(this.data & (1 << CULLING)) !== value)\n {\n this.data ^= (1 << CULLING);\n }\n }\n\n /**\n * Activates depth comparisons and updates to the depth buffer.\n *\n * @default false\n */\n get depthTest(): boolean\n {\n return !!(this.data & (1 << DEPTH_TEST));\n }\n\n set depthTest(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_TEST)) !== value)\n {\n this.data ^= (1 << DEPTH_TEST);\n }\n }\n\n /**\n * Enables or disables writing to the depth buffer.\n *\n * @default true\n */\n get depthMask(): boolean\n {\n return !!(this.data & (1 << DEPTH_MASK));\n }\n\n set depthMask(value: boolean)\n {\n if (!!(this.data & (1 << DEPTH_MASK)) !== value)\n {\n this.data ^= (1 << DEPTH_MASK);\n }\n }\n\n /**\n * Specifies whether or not front or back-facing polygons can be culled.\n *\n * @default false\n */\n get clockwiseFrontFace(): boolean\n {\n return !!(this.data & (1 << WINDING));\n }\n\n set clockwiseFrontFace(value: boolean)\n {\n if (!!(this.data & (1 << WINDING)) !== value)\n {\n this.data ^= (1 << WINDING);\n }\n }\n\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 blendMode(): BLEND_MODES\n {\n return this._blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.blend = (value !== BLEND_MODES.NONE);\n this._blendMode = value;\n }\n\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 polygonOffset(): number\n {\n return this._polygonOffset;\n }\n\n set polygonOffset(value: number)\n {\n this.offsets = !!value;\n this._polygonOffset = value;\n }\n\n // #if _DEBUG\n toString(): string\n {\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 // #endif\n\n static for2d(): State\n {\n const state = new State();\n\n state.depthTest = false;\n state.blend = true;\n\n return state;\n }\n}\n\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { State } from '../state/State';\nimport { settings } from '@pixi/settings';\nimport { MSAA_QUALITY } from '@pixi/constants';\nimport defaultVertex from './defaultFilter.vert';\nimport defaultFragment from './defaultFilter.frag';\n\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\nimport type { FilterSystem } from './FilterSystem';\nimport type { FilterState } from './FilterState';\nimport type { BLEND_MODES, CLEAR_MODES } from '@pixi/constants';\nimport type { Dict } from '@pixi/utils';\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 */\nexport class Filter extends Shader\n{\n /**\n * The padding of the filter. Some filters require extra space to breath such as a blur.\n * Increasing this will add extra width and height to the bounds of the object that the\n * filter is applied to.\n */\n public padding: number;\n\n /** The samples of the filter. */\n public multisample: MSAA_QUALITY;\n\n /** If enabled is true the filter is applied, if false it will not. */\n public enabled: boolean;\n\n /**\n * If enabled, PixiJS will fit the filter area into boundaries for better performance.\n * Switch it off if it does not work for specific shader.\n *\n * @default true\n */\n public autoFit: boolean;\n\n /**\n * Legacy filters use position and uvs from attributes (set by filter system)\n *\n * @readonly\n */\n public legacy: boolean;\n\n /** The WebGL state the filter requires to render. */\n state: State;\n\n protected _resolution: number;\n\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 constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict)\n {\n const program = Program.from(vertexSrc || Filter.defaultVertexSrc,\n fragmentSrc || Filter.defaultFragmentSrc);\n\n super(program, uniforms);\n\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 }\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 apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode?: CLEAR_MODES,\n _currentState?: FilterState): void\n {\n // do as you please!\n\n filterManager.applyFilter(this, input, output, clearMode);\n\n // or just do a regular render..\n }\n\n /**\n * Sets the blend mode of the filter.\n *\n * @default PIXI.BLEND_MODES.NORMAL\n */\n get blendMode(): BLEND_MODES\n {\n return this.state.blendMode;\n }\n\n set blendMode(value: BLEND_MODES)\n {\n this.state.blendMode = value;\n }\n\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 resolution(): number\n {\n return this._resolution;\n }\n\n set resolution(value: number)\n {\n this._resolution = value;\n }\n\n /**\n * The default vertex shader source\n *\n * @constant\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @constant\n */\n static get defaultFragmentSrc(): string\n {\n return defaultFragment;\n }\n\n /** Used for caching shader IDs. */\n static SOURCE_KEY_MAP: Dict;\n}\n","import { Matrix } from '@pixi/math';\n\nimport type { Texture } from './Texture';\n\nconst tempMat = new Matrix();\n\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 */\nexport class TextureMatrix\n{\n public mapCoord: Matrix;\n public clampOffset: number;\n public clampMargin: number;\n readonly uClampFrame: Float32Array;\n readonly uClampOffset: Float32Array;\n _textureID: number;\n _updateID: number;\n _texture: Texture;\n isSimple: boolean;\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 constructor(texture: Texture, clampMargin?: number)\n {\n this._texture = texture;\n\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 /**\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 /**\n * Normalized clamp offset.\n * Calculated based on clampOffset.\n * @member {Float32Array}\n * @readonly\n */\n this.uClampOffset = new Float32Array(2);\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._textureID = -1;\n\n /**\n * Tracks Texture frame changes\n * @member {number}\n * @protected\n */\n this._updateID = 0;\n\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 /**\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 /**\n * If texture size is the same as baseTexture\n * @member {boolean}\n * @default false\n * @readonly\n */\n this.isSimple = false;\n }\n\n /**\n * texture property\n * @member {PIXI.Texture}\n */\n get texture(): Texture\n {\n return this._texture;\n }\n\n set texture(value: Texture)\n {\n this._texture = value;\n this._textureID = -1;\n }\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 multiplyUvs(uvs: Float32Array, out?: Float32Array): Float32Array\n {\n if (out === undefined)\n {\n out = uvs;\n }\n\n const mat = this.mapCoord;\n\n for (let i = 0; i < uvs.length; i += 2)\n {\n const x = uvs[i];\n const y = uvs[i + 1];\n\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\n return out;\n }\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 update(forceUpdate?: boolean): boolean\n {\n const tex = this._texture;\n\n if (!tex || !tex.valid)\n {\n return false;\n }\n\n if (!forceUpdate\n && this._textureID === tex._updateID)\n {\n return false;\n }\n\n this._textureID = tex._updateID;\n this._updateID++;\n\n const uvs = tex._uvs;\n\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\n const orig = tex.orig;\n const trim = tex.trim;\n\n if (trim)\n {\n tempMat.set(orig.width / trim.width, 0, 0, orig.height / trim.height,\n -trim.x / trim.width, -trim.y / trim.height);\n this.mapCoord.append(tempMat);\n }\n\n const texBase = tex.baseTexture;\n const frame = this.uClampFrame;\n const margin = this.clampMargin / texBase.resolution;\n const offset = this.clampOffset;\n\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\n this.isSimple = tex._frame.width === texBase.width\n && tex._frame.height === texBase.height\n && tex.rotate === 0;\n\n return true;\n }\n}\n","import { Filter } from '../Filter';\nimport { Matrix, Point } from '@pixi/math';\nimport { CLEAR_MODES } from '@pixi/constants';\nimport vertex from './spriteMaskFilter.vert';\nimport fragment from './spriteMaskFilter.frag';\nimport { TextureMatrix } from '../../textures/TextureMatrix';\n\nimport type { FilterSystem } from '../FilterSystem';\nimport type { IMaskTarget } from '../../mask/MaskData';\nimport type { Texture } from '../../textures/Texture';\nimport type { RenderTexture } from '../../renderTexture/RenderTexture';\nimport type { Dict } from '@pixi/utils';\n\nexport interface ISpriteMaskTarget extends IMaskTarget\n{\n _texture: Texture;\n worldAlpha: number;\n anchor: Point;\n}\n\nexport interface ISpriteMaskFilter extends Filter\n{\n maskSprite: IMaskTarget;\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 */\nexport class SpriteMaskFilter extends Filter\n{\n /** @private */\n _maskSprite: IMaskTarget;\n\n /** Mask matrix */\n maskMatrix: Matrix;\n\n /**\n * @param {PIXI.Sprite} sprite - The target sprite.\n */\n constructor(sprite: IMaskTarget);\n\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 constructor(vertexSrc?: string, fragmentSrc?: string, uniforms?: Dict);\n\n /** @ignore */\n constructor(vertexSrc?: string | IMaskTarget, fragmentSrc?: string, uniforms?: Dict)\n {\n let sprite = null;\n\n if (typeof vertexSrc !== 'string' && fragmentSrc === undefined && uniforms === undefined)\n {\n sprite = vertexSrc as IMaskTarget;\n vertexSrc = undefined;\n fragmentSrc = undefined;\n uniforms = undefined;\n }\n\n super(vertexSrc as string || vertex, fragmentSrc || fragment, uniforms);\n\n this.maskSprite = sprite;\n this.maskMatrix = new Matrix();\n }\n\n /**\n * Sprite mask\n *\n * @type {PIXI.DisplayObject}\n */\n get maskSprite(): IMaskTarget\n {\n return this._maskSprite;\n }\n\n set maskSprite(value: IMaskTarget)\n {\n this._maskSprite = value;\n\n if (this._maskSprite)\n {\n this._maskSprite.renderable = false;\n }\n }\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 apply(filterManager: FilterSystem, input: RenderTexture, output: RenderTexture, clearMode: CLEAR_MODES): void\n {\n const maskSprite = this._maskSprite as ISpriteMaskTarget;\n const tex = maskSprite._texture;\n\n if (!tex.valid)\n {\n return;\n }\n if (!tex.uvMatrix)\n {\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\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\n filterManager.applyFilter(this, input, output, clearMode);\n }\n}\n","import { MaskData } from './MaskData';\nimport { SpriteMaskFilter } from '../filters/spriteMask/SpriteMaskFilter';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IMaskTarget } from './MaskData';\nimport type { Renderer } from '../Renderer';\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 */\nexport class MaskSystem implements ISystem\n{\n /**\n * Flag to enable scissor masking.\n *\n * @default true\n */\n public enableScissor: boolean;\n\n /** Pool of used sprite mask filters. */\n protected readonly alphaMaskPool: Array;\n\n /**\n * Current index of alpha mask pool.\n * @default 0\n * @readonly\n */\n protected alphaMaskIndex: number;\n\n /** Pool of mask data. */\n private readonly maskDataPool: Array;\n private maskStack: Array;\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.enableScissor = true;\n this.alphaMaskPool = [];\n this.maskDataPool = [];\n\n this.maskStack = [];\n this.alphaMaskIndex = 0;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n this.maskStack = maskStack;\n this.renderer.scissor.setMaskStack(maskStack);\n this.renderer.stencil.setMaskStack(maskStack);\n }\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 push(target: IMaskTarget, maskDataOrTarget: MaskData|IMaskTarget): void\n {\n let maskData = maskDataOrTarget as MaskData;\n\n if (!maskData.isMaskData)\n {\n const d = this.maskDataPool.pop() || new MaskData();\n\n d.pooled = true;\n d.maskObject = maskDataOrTarget as IMaskTarget;\n maskData = d;\n }\n\n const maskAbove = this.maskStack.length !== 0 ? this.maskStack[this.maskStack.length - 1] : null;\n\n maskData.copyCountersOrReset(maskAbove);\n\n if (maskData.autoDetect)\n {\n this.detect(maskData);\n }\n\n maskData._target = target;\n\n if (maskData.type !== MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\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 default:\n break;\n }\n }\n\n if (maskData.type === MASK_TYPES.SPRITE)\n {\n this.maskStack.push(maskData);\n }\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 pop(target: IMaskTarget): void\n {\n const maskData = this.maskStack.pop();\n\n if (!maskData || maskData._target !== target)\n {\n // TODO: add an assert when we have it\n\n return;\n }\n\n if (maskData.enabled)\n {\n switch (maskData.type)\n {\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 default:\n break;\n }\n }\n\n maskData.reset();\n\n if (maskData.pooled)\n {\n this.maskDataPool.push(maskData);\n }\n\n if (this.maskStack.length !== 0)\n {\n const maskCurrent = this.maskStack[this.maskStack.length - 1];\n\n if (maskCurrent.type === MASK_TYPES.SPRITE && maskCurrent._filters)\n {\n maskCurrent._filters[0].maskSprite = maskCurrent.maskObject;\n }\n }\n }\n\n /** Sets type of MaskData based on its maskObject. */\n detect(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n\n if (maskObject.isSprite)\n {\n maskData.type = MASK_TYPES.SPRITE;\n }\n else if (this.enableScissor && this.renderer.scissor.testScissor(maskData))\n {\n maskData.type = MASK_TYPES.SCISSOR;\n }\n else\n {\n maskData.type = MASK_TYPES.STENCIL;\n }\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 pushSpriteMask(maskData: MaskData): void\n {\n const { maskObject } = maskData;\n const target = maskData._target;\n let alphaMaskFilter = maskData._filters;\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex];\n\n if (!alphaMaskFilter)\n {\n alphaMaskFilter = this.alphaMaskPool[this.alphaMaskIndex] = [new SpriteMaskFilter()];\n }\n }\n\n const renderer = this.renderer;\n const renderTextureSystem = renderer.renderTexture;\n\n let resolution;\n let multisample;\n\n if (renderTextureSystem.current)\n {\n const renderTexture = renderTextureSystem.current;\n\n resolution = maskData.resolution || renderTexture.resolution;\n multisample = maskData.multisample ?? renderTexture.multisample;\n }\n else\n {\n resolution = maskData.resolution || renderer.resolution;\n multisample = maskData.multisample ?? renderer.multisample;\n }\n\n alphaMaskFilter[0].resolution = resolution;\n alphaMaskFilter[0].multisample = multisample;\n alphaMaskFilter[0].maskSprite = maskObject;\n\n const stashFilterArea = target.filterArea;\n\n target.filterArea = maskObject.getBounds(true);\n renderer.filter.push(target, alphaMaskFilter);\n target.filterArea = stashFilterArea;\n\n if (!maskData._filters)\n {\n this.alphaMaskIndex++;\n }\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 popSpriteMask(maskData: MaskData): void\n {\n this.renderer.filter.pop();\n\n if (maskData._filters)\n {\n maskData._filters[0].maskSprite = null;\n }\n else\n {\n this.alphaMaskIndex--;\n this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite = null;\n }\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { ISystem } from '../ISystem';\nimport type { MaskData } from './MaskData';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage specific types of masking operations.\n *\n * @memberof PIXI\n */\nexport class AbstractMaskSystem implements ISystem\n{\n /**\n * The mask stack\n * @member {PIXI.MaskData[]}\n */\n protected maskStack: Array;\n\n /**\n * Constant for gl.enable\n * @private\n */\n protected glConst: number;\n protected renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.maskStack = [];\n this.glConst = 0;\n }\n\n /** Gets count of masks of certain type. */\n getStackLength(): number\n {\n return this.maskStack.length;\n }\n\n /**\n * Changes the mask stack that is used by this System.\n *\n * @param {PIXI.MaskData[]} maskStack - The mask stack\n */\n setMaskStack(maskStack: Array): void\n {\n const { gl } = this.renderer;\n const curStackLen = this.getStackLength();\n\n this.maskStack = maskStack;\n\n const newStackLen = this.getStackLength();\n\n if (newStackLen !== curStackLen)\n {\n if (newStackLen === 0)\n {\n gl.disable(this.glConst);\n }\n else\n {\n gl.enable(this.glConst);\n this._useCurrent();\n }\n }\n }\n\n /**\n * Setup renderer to use the current mask data.\n * @private\n */\n protected _useCurrent(): void\n {\n // OVERWRITE;\n }\n\n /** Destroys the mask stack. */\n destroy(): void\n {\n this.renderer = null;\n this.maskStack = null;\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { MaskData } from './MaskData';\nimport { Matrix, Rectangle } from '@pixi/math';\n\nconst tempMatrix = new Matrix();\n\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 */\nexport class ScissorSystem extends AbstractMaskSystem\n{\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.SCISSOR_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._scissorCounter;\n }\n\n return 0;\n }\n\n /**\n * evaluates _boundsTransformed, _scissorRect for MaskData\n * @param maskData\n */\n calcScissorRect(maskData: MaskData): void\n {\n if (maskData._scissorRectLocal)\n {\n return;\n }\n\n const prevData = maskData._scissorRect;\n const { maskObject } = maskData;\n const { renderer } = this;\n const renderTextureSystem = renderer.renderTexture;\n\n maskObject.renderable = true;\n\n const rect = maskObject.getBounds();\n\n this.roundFrameToPixels(rect,\n renderTextureSystem.current ? renderTextureSystem.current.resolution : renderer.resolution,\n renderTextureSystem.sourceFrame,\n renderTextureSystem.destinationFrame,\n renderer.projection.transform);\n\n maskObject.renderable = false;\n\n if (prevData)\n {\n rect.fit(prevData);\n }\n maskData._scissorRectLocal = rect;\n }\n\n private static isMatrixRotated(matrix: Matrix)\n {\n if (!matrix)\n {\n return false;\n }\n const { a, b, c, d } = matrix;\n\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 /**\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 public testScissor(maskData: MaskData): boolean\n {\n const { maskObject } = maskData;\n\n if (!maskObject.isFastRect || !maskObject.isFastRect())\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(maskObject.worldTransform))\n {\n return false;\n }\n if (ScissorSystem.isMatrixRotated(this.renderer.projection.transform))\n {\n return false;\n }\n\n this.calcScissorRect(maskData);\n\n const rect = maskData._scissorRectLocal;\n\n return rect.width > 0 && rect.height > 0;\n }\n\n private roundFrameToPixels(\n frame: Rectangle,\n resolution: number,\n bindingSourceFrame: Rectangle,\n bindingDestinationFrame: Rectangle,\n transform?: Matrix,\n )\n {\n if (ScissorSystem.isMatrixRotated(transform))\n {\n return;\n }\n\n transform = transform ? tempMatrix.copyFrom(transform) : tempMatrix.identity();\n\n // Get forward transform from world space to screen space\n transform\n .translate(-bindingSourceFrame.x, -bindingSourceFrame.y)\n .scale(\n bindingDestinationFrame.width / bindingSourceFrame.width,\n bindingDestinationFrame.height / bindingSourceFrame.height)\n .translate(bindingDestinationFrame.x, bindingDestinationFrame.y);\n\n // Convert frame to screen space\n (this.renderer.filter as any).transformAABB(transform, frame);\n\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 /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @author alvin\n * @param maskData - The mask data.\n */\n push(maskData: MaskData): void\n {\n if (!maskData._scissorRectLocal)\n {\n this.calcScissorRect(maskData);\n }\n\n const { gl } = this.renderer;\n\n if (!maskData._scissorRect)\n {\n gl.enable(gl.SCISSOR_TEST);\n }\n\n maskData._scissorCounter++;\n maskData._scissorRect = maskData._scissorRectLocal;\n this._useCurrent();\n }\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 pop(): void\n {\n const { gl } = this.renderer;\n\n if (this.getStackLength() > 0)\n {\n this._useCurrent();\n }\n else\n {\n gl.disable(gl.SCISSOR_TEST);\n }\n }\n\n /**\n * Setup renderer to use the current scissor data.\n * @private\n */\n _useCurrent(): void\n {\n const rect = this.maskStack[this.maskStack.length - 1]._scissorRect;\n let y: number;\n\n if (this.renderer.renderTexture.current)\n {\n y = rect.y;\n }\n else\n {\n // flipY. In future we'll have it over renderTextures as an option\n y = this.renderer.height - rect.height - rect.y;\n }\n\n this.renderer.gl.scissor(rect.x, y, rect.width, rect.height);\n }\n}\n","import { AbstractMaskSystem } from './AbstractMaskSystem';\n\nimport type { Renderer } from '../Renderer';\nimport type { IMaskTarget, MaskData } from './MaskData';\n\n/**\n * System plugin to the renderer to manage stencils (used for masks).\n *\n * @memberof PIXI\n */\nexport class StencilSystem extends AbstractMaskSystem\n{\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.glConst = WebGLRenderingContext.STENCIL_TEST;\n }\n\n getStackLength(): number\n {\n const maskData = this.maskStack[this.maskStack.length - 1];\n\n if (maskData)\n {\n return maskData._stencilCounter;\n }\n\n return 0;\n }\n\n /**\n * Applies the Mask and adds it to the current stencil stack.\n *\n * @param maskData - The mask data\n */\n push(maskData: MaskData): void\n {\n const maskObject = maskData.maskObject;\n const { gl } = this.renderer;\n const prevMaskCount = maskData._stencilCounter;\n\n if (prevMaskCount === 0)\n {\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\n maskData._stencilCounter++;\n\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\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\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 pop(maskObject: IMaskTarget): void\n {\n const gl = this.renderer.gl;\n\n if (this.getStackLength() === 0)\n {\n // the stack is empty!\n gl.disable(gl.STENCIL_TEST);\n }\n else\n {\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\n maskObject.renderable = true;\n maskObject.render(this.renderer);\n this.renderer.batch.flush();\n maskObject.renderable = false;\n\n this._useCurrent();\n }\n }\n\n /**\n * Setup renderer to use the current stencil data.\n * @private\n */\n _useCurrent(): void\n {\n const gl = this.renderer.gl;\n\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}\n","import { Matrix } from '@pixi/math';\n\nimport type { ISystem } from '../ISystem';\nimport type { Rectangle } from '@pixi/math';\nimport type { Renderer } from '../Renderer';\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 */\nexport class ProjectionSystem implements ISystem\n{\n /**\n * The destination frame used to calculate the current projection matrix.\n *\n * The destination frame is the rectangle in the render-target into which contents are rendered. If rendering\n * to the screen, the origin is on the top-left. If rendering to a framebuffer, the origin is on the\n * bottom-left. This \"flipping\" phenomenon is because of WebGL convention for (shader) texture coordinates, where\n * the bottom-left corner is (0,0). It allows display-objects to map their (0,0) position in local-space (top-left)\n * to (0,0) in texture space (bottom-left). In other words, a sprite's top-left corner actually renders the\n * texture's bottom-left corner. You will also notice this when using a tool like SpectorJS to view your textures\n * at runtime.\n *\n * The destination frame's dimensions (width,height) should be equal to the source frame. This is because,\n * otherwise, the contents will be scaled to fill the destination frame. Similarly, the destination frame's (x,y)\n * coordinates are (0,0) unless you know what you're doing.\n *\n * @readonly\n */\n public destinationFrame: Rectangle;\n\n /**\n * The source frame used to calculate the current projection matrix.\n *\n * The source frame is the rectangle in world space containing the contents to be rendered.\n *\n * @readonly\n */\n public sourceFrame: Rectangle;\n\n /**\n * Default destination frame\n *\n * This is not used internally. It is not advised to use this feature specifically unless you know what\n * you're doing. The `update` method will default to this frame if you do not pass the destination frame.\n *\n * @readonly\n */\n public defaultFrame: Rectangle;\n\n /**\n * Projection matrix\n *\n * This matrix can be used to transform points from world space to normalized device coordinates, and is calculated\n * from the sourceFrame → destinationFrame mapping provided.\n *\n * The renderer's `globalUniforms` keeps a reference to this, and so it is available for all shaders to use as a\n * uniform.\n *\n * @readonly\n */\n public projectionMatrix: Matrix;\n\n /**\n * A transform to be appended to the projection matrix.\n *\n * This can be used to transform points in world-space one last time before they are outputted by the shader. You can\n * use to rotate the whole scene, for example. Remember to clear it once you've rendered everything.\n *\n * @member {PIXI.Matrix}\n */\n public transform: Matrix;\n\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n this.destinationFrame = null;\n this.sourceFrame = null;\n this.defaultFrame = null;\n this.projectionMatrix = new Matrix();\n this.transform = null;\n }\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 update(destinationFrame: Rectangle, sourceFrame: Rectangle, resolution: number, root: boolean): void\n {\n this.destinationFrame = destinationFrame || this.destinationFrame || this.defaultFrame;\n this.sourceFrame = sourceFrame || this.sourceFrame || destinationFrame;\n\n // Calculate object-space to clip-space projection\n this.calculateProjection(this.destinationFrame, this.sourceFrame, resolution, root);\n\n if (this.transform)\n {\n this.projectionMatrix.append(this.transform);\n }\n\n const renderer = this.renderer;\n\n renderer.globalUniforms.uniforms.projectionMatrix = this.projectionMatrix;\n renderer.globalUniforms.update();\n\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 {\n renderer.shader.syncUniformGroup(renderer.shader.shader.uniforms.globals);\n }\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 calculateProjection(_destinationFrame: Rectangle, sourceFrame: Rectangle, _resolution: number, root: boolean): void\n {\n const pm = this.projectionMatrix;\n const sign = !root ? 1 : -1;\n\n pm.identity();\n\n pm.a = (1 / sourceFrame.width * 2);\n pm.d = sign * (1 / sourceFrame.height * 2);\n\n pm.tx = -1 - (sourceFrame.x * pm.a);\n pm.ty = -sign - (sourceFrame.y * pm.d);\n }\n\n /**\n * Sets the transform of the active render target to the given matrix.\n *\n * @param matrix - The transformation matrix\n */\n setTransform(_matrix: Matrix): void\n {\n // this._activeRenderTarget.transform = matrix;\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { Rectangle } from '@pixi/math';\nimport { BUFFER_BITS } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { RenderTexture } from './RenderTexture';\nimport type { BaseRenderTexture } from './BaseRenderTexture';\nimport type { MaskData } from '../mask/MaskData';\nimport type { ISize } from '@pixi/math';\n\n// Temporary rectangle for assigned sourceFrame or destinationFrame\nconst tempRect = new Rectangle();\n\n// Temporary rectangle for renderTexture destinationFrame\nconst tempRect2 = new Rectangle();\n\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 */\nexport class RenderTextureSystem implements ISystem\n{\n/* eslint-enable max-len */\n\n /** The clear background color as RGBA. */\n public clearColor: number[];\n\n /**\n * List of masks for the {@link PIXI.StencilSystem}.\n *\n * @readonly\n */\n public defaultMaskStack: Array;\n\n /**\n * Render texture currently bound. {@code null} if rendering to the canvas.\n *\n * @readonly\n */\n public current: RenderTexture | null;\n\n /**\n * The source frame for the render-target's projection mapping.\n *\n * See {@link PIXI.ProjectionSystem#sourceFrame} for more details\n */\n public readonly sourceFrame: Rectangle;\n\n /**\n * The destination frame for the render-target's projection mapping.\n *\n * See {@link PIXI.Projection#destinationFrame} for more details.\n */\n public readonly destinationFrame: Rectangle;\n\n /**\n * The viewport frame for the render-target's viewport binding. This is equal to the destination-frame\n * for render-textures, while it is y-flipped when rendering to the screen (i.e. its origin is always on\n * the bottom-left).\n */\n public readonly viewportFrame: Rectangle;\n\n private renderer: Renderer;\n\n /**\n * @param renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\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 /**\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 bind(renderTexture: RenderTexture = null, sourceFrame?: Rectangle, destinationFrame?: Rectangle): void\n {\n const renderer = this.renderer;\n\n this.current = renderTexture;\n\n let baseTexture: BaseRenderTexture;\n let framebuffer;\n let resolution;\n\n if (renderTexture)\n {\n baseTexture = renderTexture.baseTexture as BaseRenderTexture;\n\n resolution = baseTexture.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderTexture.frame.width;\n tempRect.height = renderTexture.frame.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n tempRect2.x = renderTexture.frame.x;\n tempRect2.y = renderTexture.frame.y;\n tempRect2.width = sourceFrame.width;\n tempRect2.height = sourceFrame.height;\n\n destinationFrame = tempRect2;\n }\n\n framebuffer = baseTexture.framebuffer;\n }\n else\n {\n resolution = renderer.resolution;\n\n if (!sourceFrame)\n {\n tempRect.width = renderer.screen.width;\n tempRect.height = renderer.screen.height;\n\n sourceFrame = tempRect;\n }\n\n if (!destinationFrame)\n {\n destinationFrame = tempRect;\n\n destinationFrame.width = sourceFrame.width;\n destinationFrame.height = sourceFrame.height;\n }\n }\n\n const viewportFrame = this.viewportFrame;\n\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\n if (!renderTexture)\n {\n viewportFrame.y = renderer.view.height - (viewportFrame.y + viewportFrame.height);\n }\n\n viewportFrame.ceil();\n\n this.renderer.framebuffer.bind(framebuffer, viewportFrame);\n this.renderer.projection.update(destinationFrame, sourceFrame, resolution, !framebuffer);\n\n if (renderTexture)\n {\n this.renderer.mask.setMaskStack(baseTexture.maskStack);\n }\n else\n {\n this.renderer.mask.setMaskStack(this.defaultMaskStack);\n }\n\n this.sourceFrame.copyFrom(sourceFrame);\n this.destinationFrame.copyFrom(destinationFrame);\n }\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 clear(clearColor?: number[], mask?: BUFFER_BITS): void\n {\n if (this.current)\n {\n clearColor = clearColor || (this.current.baseTexture as BaseRenderTexture).clearColor;\n }\n else\n {\n clearColor = clearColor || this.clearColor;\n }\n\n const destinationFrame = this.destinationFrame;\n const baseFrame: ISize = this.current ? this.current.baseTexture : this.renderer.screen;\n const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;\n\n if (clearMask)\n {\n let { x, y, width, height } = this.viewportFrame;\n\n x = Math.round(x);\n y = Math.round(y);\n width = Math.round(width);\n height = Math.round(height);\n\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\n this.renderer.framebuffer.clear(clearColor[0], clearColor[1], clearColor[2], clearColor[3], mask);\n\n if (clearMask)\n {\n // Restore the scissor box\n this.renderer.scissor.pop();\n }\n }\n\n resize(): void // screenWidth, screenHeight)\n {\n // resize the root only!\n this.bind(null);\n }\n\n /** Resets render-texture state. */\n reset(): void\n {\n this.bind(null);\n }\n\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import type { Dict } from '@pixi/utils';\nimport { mapSize } from '../utils';\nimport { IUniformData } from '../Program';\nimport { UniformGroup } from '../UniformGroup';\nimport { uniformParsers } from './uniformParsers';\nimport type { Renderer } from '../../Renderer';\nimport type { Buffer } from '../../geometry/Buffer';\n\nexport type UniformsSyncCallback = (...args: any[]) => void;\n\nfunction uboUpdate(_ud: any, _uv: any, _renderer: Renderer, _syncData: any, buffer: Buffer): void\n{\n _renderer.buffer.update(buffer);\n}\n\n// cv = CachedValue\n// v = value\n// ud = uniformData\n// uv = uniformValue\n// l = location\nconst UBO_TO_SINGLE_SETTERS: Dict = {\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};\n\nconst GLSL_TO_STD40_SIZE: Dict = {\n float: 4,\n vec2: 8,\n vec3: 12,\n vec4: 16,\n\n int: 4,\n ivec2: 8,\n ivec3: 12,\n ivec4: 16,\n\n uint: 4,\n uvec2: 8,\n uvec3: 12,\n uvec4: 16,\n\n bool: 4,\n bvec2: 8,\n bvec3: 12,\n bvec4: 16,\n\n mat2: 16 * 2,\n mat3: 16 * 3,\n mat4: 16 * 4,\n};\n\ninterface UBOElement {\n data: IUniformData\n offset: number,\n dataLen: number,\n dirty: number\n}\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 */\nexport function createUBOElements(uniformData: IUniformData[]): {uboElements: UBOElement[], size: number}\n{\n const uboElements: UBOElement[] = uniformData.map((data: IUniformData) =>\n ({\n data,\n offset: 0,\n dataLen: 0,\n dirty: 0\n }));\n\n let size = 0;\n let chunkSize = 0;\n let offset = 0;\n\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n\n size = GLSL_TO_STD40_SIZE[uboElement.data.type];\n\n if (uboElement.data.size > 1)\n {\n size = Math.max(size, 16) * uboElement.data.size;\n }\n\n uboElement.dataLen = size;\n\n // add some size offset..\n // must align to the nearest 16 bytes or internally nearest round size\n\n if (chunkSize % size !== 0 && chunkSize < 16)\n {\n // diff required to line up..\n const lineUpValue = (chunkSize % size) % 16;\n\n chunkSize += lineUpValue;\n offset += lineUpValue;\n }\n\n if ((chunkSize + size) > 16)\n {\n offset = Math.ceil(offset / 16) * 16;\n uboElement.offset = offset;\n offset += size;\n chunkSize = size;\n }\n else\n {\n uboElement.offset = offset;\n chunkSize += size;\n offset += size;\n }\n }\n\n offset = Math.ceil(offset / 16) * 16;\n\n return { uboElements, size: offset };\n}\n\nexport function getUBOData(uniforms: Dict, uniformData: Dict): any[]\n{\n const usedUniformDatas = [];\n\n // build..\n for (const i in uniforms)\n {\n if (uniformData[i])\n {\n usedUniformDatas.push(uniformData[i]);\n }\n }\n\n // sort them out by index!\n usedUniformDatas.sort((a, b) => a.index - b.index);\n\n return usedUniformDatas;\n}\n\nexport function generateUniformBufferSync(\n group: UniformGroup,\n uniformData: Dict\n): {size: number, syncFunc: UniformsSyncCallback}\n{\n if (!group.autoManage)\n {\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\n const usedUniformDatas = getUBOData(group.uniforms, uniformData);\n\n const { uboElements, size } = createUBOElements(usedUniformDatas);\n\n const 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\n for (let i = 0; i < uboElements.length; i++)\n {\n const uboElement = uboElements[i];\n const uniform = group.uniforms[uboElement.data.name];\n\n const name = uboElement.data.name;\n\n let parsed = false;\n\n for (let j = 0; j < uniformParsers.length; j++)\n {\n const uniformParser = uniformParsers[j];\n\n if (uniformParser.codeUbo && uniformParser.test(uboElement.data, uniform))\n {\n funcFragments.push(\n `offset = ${uboElement.offset / 4};`,\n uniformParsers[j].codeUbo(uboElement.data.name, uniform));\n parsed = true;\n\n break;\n }\n }\n\n if (!parsed)\n {\n if (uboElement.data.size > 1)\n {\n const size = mapSize(uboElement.data.type);\n const rowSize = Math.max(GLSL_TO_STD40_SIZE[uboElement.data.type] / 16, 1);\n const elementSize = size / rowSize;\n const remainder = (4 - (elementSize % 4)) % 4;\n\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 {\n const template = UBO_TO_SINGLE_SETTERS[uboElement.data.type];\n\n funcFragments.push(`\n cv = ud.${name}.value;\n v = uv.${name};\n offset = ${uboElement.offset / 4};\n ${template};\n `);\n }\n }\n }\n\n funcFragments.push(`\n renderer.buffer.update(buffer);\n `);\n\n return {\n size,\n // eslint-disable-next-line no-new-func\n syncFunc: new Function(\n 'ud',\n 'uv',\n 'renderer',\n 'syncData',\n 'buffer',\n funcFragments.join('\\n')\n ) as UniformsSyncCallback\n };\n}\n","import type { Dict } from '@pixi/utils';\n\n/**\n * @private\n */\nexport class IGLUniformData\n{\n location: WebGLUniformLocation;\n value: number | boolean | Float32Array | Int32Array | Uint32Array | boolean[];\n}\n\n/**\n * Helper class to create a WebGL Program\n *\n * @class\n * @memberof PIXI\n */\nexport class GLProgram\n{\n public program: WebGLProgram;\n public uniformData: Dict;\n public uniformGroups: Dict;\n /**\n * A hash that stores where UBOs are bound to on the program.\n */\n public uniformBufferBindings: Dict;\n /**\n * A hash for lazily-generated uniform uploading functions.\n */\n public uniformSync: Dict;\n /**\n * a place where dirty ticks are stored for groups\n * If a tick here does not match with the Higher level Programs tick, it means\n * we should re upload the data.\n */\n public uniformDirtyGroups: Dict;\n\n /**\n * Makes a new Pixi program\n *\n * @param {WebGLProgram} program - webgl program\n * @param {Object} uniformData - uniforms\n */\n constructor(program: WebGLProgram, uniformData: {[key: string]: IGLUniformData})\n {\n /**\n * The shader program\n *\n * @member {WebGLProgram}\n */\n this.program = program;\n\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 /**\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\n this.uniformDirtyGroups = {};\n\n this.uniformBufferBindings = {};\n }\n\n /**\n * Destroys this program\n */\n destroy(): void\n {\n this.uniformData = null;\n this.uniformGroups = null;\n this.uniformDirtyGroups = null;\n this.uniformBufferBindings = null;\n this.program = null;\n }\n}\n","import { Program } from '../Program';\nimport type { IRenderingContext } from '../../IRenderingContext';\nimport type { IGLUniformData } from '../GLProgram';\nimport { GLProgram } from '../GLProgram';\nimport { compileShader } from './compileShader';\nimport { defaultValue } from './defaultValue';\nimport { getAttributeData } from './getAttributeData';\nimport { getUniformData } from './getUniformData';\nimport { logProgramError } from './logProgramError';\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 */\nexport function generateProgram(gl: IRenderingContext, program: Program): GLProgram\n{\n const glVertShader = compileShader(gl, gl.VERTEX_SHADER, program.vertexSrc);\n const glFragShader = compileShader(gl, gl.FRAGMENT_SHADER, program.fragmentSrc);\n\n const webGLProgram = gl.createProgram();\n\n gl.attachShader(webGLProgram, glVertShader);\n gl.attachShader(webGLProgram, glFragShader);\n\n gl.linkProgram(webGLProgram);\n\n if (!gl.getProgramParameter(webGLProgram, gl.LINK_STATUS))\n {\n logProgramError(gl, webGLProgram, glVertShader, glFragShader);\n }\n\n program.attributeData = getAttributeData(webGLProgram, gl);\n program.uniformData = getUniformData(webGLProgram, gl);\n\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 {\n const keys = Object.keys(program.attributeData);\n\n keys.sort((a, b) => (a > b) ? 1 : -1); // eslint-disable-line no-confusing-arrow\n\n for (let i = 0; i < keys.length; i++)\n {\n program.attributeData[keys[i]].location = i;\n\n gl.bindAttribLocation(webGLProgram, i, keys[i]);\n }\n\n gl.linkProgram(webGLProgram);\n }\n\n gl.deleteShader(glVertShader);\n gl.deleteShader(glFragShader);\n\n const uniformData: {[key: string]: IGLUniformData} = {};\n\n for (const i in program.uniformData)\n {\n const data = program.uniformData[i];\n\n uniformData[i] = {\n location: gl.getUniformLocation(webGLProgram, i),\n value: defaultValue(data.type, data.size),\n };\n }\n\n const glProgram = new GLProgram(webGLProgram, uniformData);\n\n return glProgram;\n}\n","import { IAttributeData } from '../Program';\nimport { mapSize } from './mapSize';\nimport { mapType } from './mapType';\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 */\nexport function getAttributeData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IAttributeData}\n{\n const attributes: {[key: string]: IAttributeData} = {};\n\n const totalAttributes = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);\n\n for (let i = 0; i < totalAttributes; i++)\n {\n const attribData = gl.getActiveAttrib(program, i);\n\n if (attribData.name.indexOf('gl_') === 0)\n {\n continue;\n }\n\n const type = mapType(gl, attribData.type);\n const data = {\n type,\n name: attribData.name,\n size: mapSize(type),\n location: gl.getAttribLocation(program, attribData.name),\n };\n\n attributes[attribData.name] = data;\n }\n\n return attributes;\n}\n","import { IUniformData } from '../Program';\nimport { defaultValue } from './defaultValue';\nimport { mapType } from './mapType';\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 */\nexport function getUniformData(program: WebGLProgram, gl: WebGLRenderingContextBase): {[key: string]: IUniformData}\n{\n const uniforms: {[key: string]: IUniformData} = {};\n\n const totalUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);\n\n for (let i = 0; i < totalUniforms; i++)\n {\n const uniformData = gl.getActiveUniform(program, i);\n const name = uniformData.name.replace(/\\[.*?\\]$/, '');\n\n const isArray = !!(uniformData.name.match(/\\[.*?\\]$/));\n\n const type = mapType(gl, uniformData.type);\n\n uniforms[name] = {\n name,\n index: i,\n type,\n size: uniformData.size,\n isArray,\n value: defaultValue(type, uniformData.size),\n };\n }\n\n return uniforms;\n}\n","import { GLProgram } from './GLProgram';\nimport { generateUniformsSync, unsafeEvalSupported } from './utils';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Shader } from './Shader';\nimport type { Program } from './Program';\nimport type { UniformGroup } from './UniformGroup';\nimport type { Dict } from '@pixi/utils';\nimport type { UniformsSyncCallback } from './utils';\nimport { generateUniformBufferSync } from './utils/generateUniformBufferSync';\n\nimport { generateProgram } from './utils/generateProgram';\n\nlet UID = 0;\n// default sync data so we don't create a new one each time!\nconst defaultSyncData = { textureCount: 0, uboCount: 0 };\n\n/**\n * System plugin to the renderer to manage shaders.\n *\n * @memberof PIXI\n */\nexport class ShaderSystem implements ISystem\n{\n /**\n * The current WebGL rendering context.\n *\n * @member {WebGLRenderingContext}\n */\n protected gl: IRenderingContext;\n\n public shader: Shader;\n public program: Program;\n public id: number;\n public destroyed = false;\n\n /** Cache to holds the generated functions. Stored against UniformObjects unique signature. */\n private cache: Dict;\n private _uboCache: Dict<{size: number, syncFunc: UniformsSyncCallback}>;\n private renderer: Renderer;\n\n /** @param renderer - The renderer this System works for. */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // Validation check that this environment support `new Function`\n this.systemCheck();\n\n this.gl = null;\n\n this.shader = null;\n this.program = null;\n\n this.cache = {};\n this._uboCache = {};\n\n this.id = UID++;\n }\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 systemCheck(): void\n {\n if (!unsafeEvalSupported())\n {\n throw new Error('Current environment does not allow unsafe-eval, '\n + 'please use @pixi/unsafe-eval module to enable support.');\n }\n }\n\n protected contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n this.reset();\n }\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 bind(shader: Shader, dontSync?: boolean): GLProgram\n {\n shader.uniforms.globals = this.renderer.globalUniforms;\n\n const program = shader.program;\n const glProgram = program.glPrograms[this.renderer.CONTEXT_UID] || this.generateProgram(shader);\n\n this.shader = shader;\n\n // TODO - some current Pixi plugins bypass this.. so it not safe to use yet..\n if (this.program !== program)\n {\n this.program = program;\n this.gl.useProgram(glProgram.program);\n }\n\n if (!dontSync)\n {\n defaultSyncData.textureCount = 0;\n defaultSyncData.uboCount = 0;\n\n this.syncUniformGroup(shader.uniformGroup, defaultSyncData);\n }\n\n return glProgram;\n }\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 setUniforms(uniforms: Dict): void\n {\n const shader = this.shader.program;\n const glProgram = shader.glPrograms[this.renderer.CONTEXT_UID];\n\n shader.syncUniforms(glProgram.uniformData, uniforms, this.renderer);\n }\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 syncUniformGroup(group: UniformGroup, syncData?: any): void\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== glProgram.uniformDirtyGroups[group.id])\n {\n glProgram.uniformDirtyGroups[group.id] = group.dirtyId;\n\n this.syncUniforms(group, glProgram, syncData);\n }\n }\n\n /**\n * Overrideable by the @pixi/unsafe-eval package to use static syncUniforms instead.\n */\n syncUniforms(group: UniformGroup, glProgram: GLProgram, syncData: any): void\n {\n const syncFunc = group.syncUniforms[this.shader.program.id] || this.createSyncGroups(group);\n\n syncFunc(glProgram.uniformData, group.uniforms, this.renderer, syncData);\n }\n\n createSyncGroups(group: UniformGroup): UniformsSyncCallback\n {\n const id = this.getSignature(group, this.shader.program.uniformData, 'u');\n\n if (!this.cache[id])\n {\n this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);\n }\n\n group.syncUniforms[this.shader.program.id] = this.cache[id];\n\n return group.syncUniforms[this.shader.program.id];\n }\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 syncUniformBufferGroup(group: UniformGroup, name?: string)\n {\n const glProgram = this.getGlProgram();\n\n if (!group.static || group.dirtyId !== 0 || !glProgram.uniformGroups[group.id])\n {\n group.dirtyId = 0;\n\n const syncFunc = glProgram.uniformGroups[group.id]\n || this.createSyncBufferGroup(group, glProgram, name);\n\n // TODO wrap update in a cache??\n group.buffer.update();\n\n syncFunc(glProgram.uniformData,\n group.uniforms,\n this.renderer,\n defaultSyncData,\n group.buffer\n );\n }\n\n this.renderer.buffer.bindBufferBase(group.buffer, glProgram.uniformBufferBindings[name]);\n }\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 protected createSyncBufferGroup(group: UniformGroup, glProgram: GLProgram, name: string): UniformsSyncCallback\n {\n const { gl } = this.renderer;\n\n this.renderer.buffer.bind(group.buffer);\n\n // bind them...\n const uniformBlockIndex = this.gl.getUniformBlockIndex(glProgram.program, name);\n\n glProgram.uniformBufferBindings[name] = this.shader.uniformBindCount;\n\n gl.uniformBlockBinding(glProgram.program, uniformBlockIndex, this.shader.uniformBindCount);\n\n this.shader.uniformBindCount++;\n\n const id = this.getSignature(group, this.shader.program.uniformData, 'ubo');\n\n let uboData = this._uboCache[id];\n\n if (!uboData)\n {\n uboData = this._uboCache[id] = generateUniformBufferSync(group, this.shader.program.uniformData);\n }\n\n if (group.autoManage)\n {\n const data = new Float32Array(uboData.size / 4);\n\n group.buffer.update(data);\n }\n\n glProgram.uniformGroups[group.id] = uboData.syncFunc;\n\n return glProgram.uniformGroups[group.id];\n }\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 private getSignature(group: {uniforms: Dict}, uniformData: Dict, preFix: string): string\n {\n const uniforms = group.uniforms;\n\n const strings = [`${preFix}-`];\n\n for (const i in uniforms)\n {\n strings.push(i);\n\n if (uniformData[i])\n {\n strings.push(uniformData[i].type);\n }\n }\n\n return strings.join('-');\n }\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 getGlProgram(): GLProgram\n {\n if (this.shader)\n {\n return this.shader.program.glPrograms[this.renderer.CONTEXT_UID];\n }\n\n return null;\n }\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 generateProgram(shader: Shader): GLProgram\n {\n const gl = this.gl;\n const program = shader.program;\n\n const glProgram = generateProgram(gl, program);\n\n program.glPrograms[this.renderer.CONTEXT_UID] = glProgram;\n\n return glProgram;\n }\n\n /** Resets ShaderSystem state, does not affect WebGL state. */\n reset(): void\n {\n this.program = null;\n this.shader = null;\n }\n\n /** Destroys this System and removes all its textures. */\n destroy(): void\n {\n this.renderer = null;\n // TODO implement destroy method for ShaderSystem\n this.destroyed = true;\n }\n}\n","import { mapWebGLBlendModesToPixi } from './utils/mapWebGLBlendModesToPixi';\nimport { State } from './State';\nimport { BLEND_MODES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { IRenderingContext } from '../IRenderingContext';\n\nconst BLEND = 0;\nconst OFFSET = 1;\nconst CULLING = 2;\nconst DEPTH_TEST = 3;\nconst WINDING = 4;\nconst DEPTH_MASK = 5;\n\n/**\n * System plugin to the renderer to manage WebGL state machines.\n *\n * @memberof PIXI\n */\nexport class StateSystem implements ISystem\n{\n /**\n * State ID\n * @readonly\n */\n public stateId: number;\n\n /**\n * Polygon offset\n * @readonly\n */\n public polygonOffset: number;\n\n /**\n * Blend mode\n * @default PIXI.BLEND_MODES.NONE\n * @readonly\n */\n public blendMode: BLEND_MODES;\n\n /** Whether current blend equation is different */\n protected _blendEq: boolean;\n\n /**\n * GL context\n * @member {WebGLRenderingContext}\n * @readonly\n */\n protected gl: IRenderingContext;\n\n protected blendModes: number[][];\n\n /**\n * Collection of calls\n * @member {function[]}\n */\n protected readonly map: Array<(value: boolean) => void>;\n\n /**\n * Collection of check calls\n * @member {function[]}\n */\n protected readonly checks: Array<(system: this, state: State) => void>;\n\n /**\n * Default WebGL State\n * @readonly\n */\n protected defaultState: State;\n\n constructor()\n {\n this.gl = null;\n\n this.stateId = 0;\n this.polygonOffset = 0;\n this.blendMode = BLEND_MODES.NONE;\n\n this._blendEq = false;\n\n // map functions for when we set state..\n this.map = [];\n this.map[BLEND] = this.setBlend;\n this.map[OFFSET] = this.setOffset;\n this.map[CULLING] = this.setCullFace;\n this.map[DEPTH_TEST] = this.setDepthTest;\n this.map[WINDING] = this.setFrontFace;\n this.map[DEPTH_MASK] = this.setDepthMask;\n\n this.checks = [];\n\n this.defaultState = new State();\n this.defaultState.blend = true;\n }\n\n contextChange(gl: IRenderingContext): void\n {\n this.gl = gl;\n\n this.blendModes = mapWebGLBlendModesToPixi(gl);\n\n this.set(this.defaultState);\n\n this.reset();\n }\n\n /**\n * Sets the current state\n *\n * @param {*} state - The state to set.\n */\n set(state: State): void\n {\n state = state || this.defaultState;\n\n // TODO maybe to an object check? ( this.state === state )?\n if (this.stateId !== state.data)\n {\n let diff = this.stateId ^ state.data;\n let i = 0;\n\n // order from least to most common\n while (diff)\n {\n if (diff & 1)\n {\n // state change!\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n\n diff = diff >> 1;\n i++;\n }\n\n this.stateId = state.data;\n }\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 (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n }\n\n /**\n * Sets the state, when previous state is unknown.\n *\n * @param {*} state - The state to set\n */\n forceState(state: State): void\n {\n state = state || this.defaultState;\n for (let i = 0; i < this.map.length; i++)\n {\n this.map[i].call(this, !!(state.data & (1 << i)));\n }\n for (let i = 0; i < this.checks.length; i++)\n {\n this.checks[i](this, state);\n }\n\n this.stateId = state.data;\n }\n\n /**\n * Sets whether to enable or disable blending.\n *\n * @param value - Turn on or off WebGl blending.\n */\n setBlend(value: boolean): void\n {\n this.updateCheck(StateSystem.checkBlendMode, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.BLEND);\n }\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 setOffset(value: boolean): void\n {\n this.updateCheck(StateSystem.checkPolygonOffset, value);\n\n this.gl[value ? 'enable' : 'disable'](this.gl.POLYGON_OFFSET_FILL);\n }\n\n /**\n * Sets whether to enable or disable depth test.\n *\n * @param value - Turn on or off webgl depth testing.\n */\n setDepthTest(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.DEPTH_TEST);\n }\n\n /**\n * Sets whether to enable or disable depth mask.\n *\n * @param value - Turn on or off webgl depth mask.\n */\n setDepthMask(value: boolean): void\n {\n this.gl.depthMask(value);\n }\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 setCullFace(value: boolean): void\n {\n this.gl[value ? 'enable' : 'disable'](this.gl.CULL_FACE);\n }\n\n /**\n * Sets the gl front face.\n *\n * @param {boolean} value - true is clockwise and false is counter-clockwise\n */\n setFrontFace(value: boolean): void\n {\n this.gl.frontFace(this.gl[value ? 'CW' : 'CCW']);\n }\n\n /**\n * Sets the blend mode.\n *\n * @param {number} value - The blend mode to set to.\n */\n setBlendMode(value: number): void\n {\n if (value === this.blendMode)\n {\n return;\n }\n\n this.blendMode = value;\n\n const mode = this.blendModes[value];\n const gl = this.gl;\n\n if (mode.length === 2)\n {\n gl.blendFunc(mode[0], mode[1]);\n }\n else\n {\n gl.blendFuncSeparate(mode[0], mode[1], mode[2], mode[3]);\n }\n if (mode.length === 6)\n {\n this._blendEq = true;\n gl.blendEquationSeparate(mode[4], mode[5]);\n }\n else if (this._blendEq)\n {\n this._blendEq = false;\n gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD);\n }\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 setPolygonOffset(value: number, scale: number): void\n {\n this.gl.polygonOffset(value, scale);\n }\n\n // used\n /** Resets all the logic and disables the VAOs. */\n reset(): void\n {\n this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL, false);\n\n this.forceState(this.defaultState);\n\n this._blendEq = true;\n this.blendMode = -1;\n this.setBlendMode(0);\n }\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 updateCheck(func: (system: this, state: State) => void, value: boolean): void\n {\n const index = this.checks.indexOf(func);\n\n if (value && index === -1)\n {\n this.checks.push(func);\n }\n else if (!value && index !== -1)\n {\n this.checks.splice(index, 1);\n }\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 private static checkBlendMode(system: StateSystem, state: State): void\n {\n system.setBlendMode(state.blendMode);\n }\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 private static checkPolygonOffset(system: StateSystem, state: State): void\n {\n system.setPolygonOffset(1, state.polygonOffset);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.gl = null;\n }\n}\n","import { BLEND_MODES } from '@pixi/constants';\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 */\nexport function mapWebGLBlendModesToPixi(gl: WebGLRenderingContextBase, array: number[][] = []): number[][]\n{\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\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\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\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\n return array;\n}\n","import { GC_MODES } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\n\nimport type { ISystem } from '../ISystem';\nimport type { Renderer } from '../Renderer';\nimport type { Texture } from './Texture';\nimport type { RenderTexture } from '../renderTexture/RenderTexture';\n\nexport interface IUnloadableTexture {\n _texture: Texture | RenderTexture;\n children: IUnloadableTexture[];\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 */\nexport class TextureGCSystem implements ISystem\n{\n public count: number;\n public checkCount: number;\n public maxIdle: number;\n public checkCountMax: number;\n public mode: GC_MODES;\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n /**\n * Count\n * @member {number}\n * @readonly\n */\n this.count = 0;\n\n /**\n * Check count\n * @member {number}\n * @readonly\n */\n this.checkCount = 0;\n\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 /**\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 /**\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 /**\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 protected postrender(): void\n {\n if (!this.renderer.renderingToScreen)\n {\n return;\n }\n\n this.count++;\n\n if (this.mode === GC_MODES.MANUAL)\n {\n return;\n }\n\n this.checkCount++;\n\n if (this.checkCount > this.checkCountMax)\n {\n this.checkCount = 0;\n\n this.run();\n }\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 run(): void\n {\n const tm = this.renderer.texture;\n const managedTextures = tm.managedTextures;\n let wasRemoved = false;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n const texture = managedTextures[i];\n\n // only supports non generated textures at the moment!\n if (!(texture as any).framebuffer && this.count - texture.touched > this.maxIdle)\n {\n tm.destroyTexture(texture, true);\n managedTextures[i] = null;\n wasRemoved = true;\n }\n }\n\n if (wasRemoved)\n {\n let j = 0;\n\n for (let i = 0; i < managedTextures.length; i++)\n {\n if (managedTextures[i] !== null)\n {\n managedTextures[j++] = managedTextures[i];\n }\n }\n\n managedTextures.length = j;\n }\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 unload(displayObject: IUnloadableTexture): void\n {\n const tm = this.renderer.texture;\n const texture = displayObject._texture as RenderTexture;\n\n // only destroy non generated textures\n if (texture && !texture.framebuffer)\n {\n tm.destroyTexture(texture);\n }\n\n for (let i = displayObject.children.length - 1; i >= 0; i--)\n {\n this.unload(displayObject.children[i]);\n }\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\n\n/**\n * Internal texture for WebGL context\n * @class\n * @memberof PIXI\n */\nexport class GLTexture\n{\n public texture: WebGLTexture;\n public width: number;\n public height: number;\n public mipmap: boolean;\n public wrapMode: number;\n public type: number;\n public internalFormat: number;\n /** Type of sampler corresponding to this texture. See {@link PIXI.SAMPLER_TYPES} */\n public samplerType: number;\n\n dirtyId: number;\n dirtyStyleId: number;\n\n constructor(texture: WebGLTexture)\n {\n /**\n * The WebGL texture\n * @member {WebGLTexture}\n */\n this.texture = texture;\n\n /**\n * Width of texture that was used in texImage2D\n * @member {number}\n */\n this.width = -1;\n\n /**\n * Height of texture that was used in texImage2D\n * @member {number}\n */\n this.height = -1;\n\n /**\n * Texture contents dirty flag\n * @member {number}\n */\n this.dirtyId = -1;\n\n /**\n * Texture style dirty flag\n * @member {number}\n */\n this.dirtyStyleId = -1;\n\n /**\n * Whether mip levels has to be generated\n * @member {boolean}\n */\n this.mipmap = false;\n\n /**\n * WrapMode copied from baseTexture\n * @member {number}\n */\n this.wrapMode = 33071;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.type = TYPES.UNSIGNED_BYTE;\n\n /**\n * Type copied from baseTexture\n * @member {number}\n */\n this.internalFormat = FORMATS.RGBA;\n\n this.samplerType = 0;\n }\n}\n","import { mapTypeAndFormatToInternalFormat } from './utils/mapTypeAndFormatToInternalFormat';\nimport { BaseTexture } from './BaseTexture';\nimport { GLTexture } from './GLTexture';\nimport { removeItems } from '@pixi/utils';\nimport { MIPMAP_MODES, WRAP_MODES, SCALE_MODES, TYPES, SAMPLER_TYPES } from '@pixi/constants';\n\nimport type { ISystem } from '../ISystem';\nimport type { Texture } from './Texture';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Renderer } from '../Renderer';\n\n/**\n * System plugin to the renderer to manage textures.\n *\n * @class\n * @extends PIXI.System\n * @memberof PIXI\n */\n\nexport class TextureSystem implements ISystem\n{\n public boundTextures: BaseTexture[];\n public managedTextures: Array;\n /** Whether glTexture with int/uint sampler type was uploaded. */\n protected hasIntegerTextures: boolean;\n protected CONTEXT_UID: number;\n protected gl: IRenderingContext;\n protected internalFormats: { [type: number]: { [format: number]: number } };\n protected webGLVersion: number;\n protected unknownTexture: BaseTexture;\n protected _unknownBoundTextures: boolean;\n currentLocation: number;\n emptyTextures: {[key: number]: GLTexture};\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n\n // TODO set to max textures...\n /**\n * Bound textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.boundTextures = [];\n\n /**\n * Current location\n * @member {number}\n * @readonly\n */\n this.currentLocation = -1;\n\n /**\n * List of managed textures\n * @member {PIXI.BaseTexture[]}\n * @readonly\n */\n this.managedTextures = [];\n\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 /**\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\n this.hasIntegerTextures = false;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n contextChange(): void\n {\n const gl = this.gl = this.renderer.gl;\n\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n\n this.webGLVersion = this.renderer.context.webGLVersion;\n\n this.internalFormats = mapTypeAndFormatToInternalFormat(gl);\n\n const maxTextures = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n\n this.boundTextures.length = maxTextures;\n\n for (let i = 0; i < maxTextures; i++)\n {\n this.boundTextures[i] = null;\n }\n\n // TODO move this.. to a nice make empty textures class..\n this.emptyTextures = {};\n\n const emptyTexture2D = new GLTexture(gl.createTexture());\n\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\n this.emptyTextures[gl.TEXTURE_2D] = emptyTexture2D;\n this.emptyTextures[gl.TEXTURE_CUBE_MAP] = new GLTexture(gl.createTexture());\n\n gl.bindTexture(gl.TEXTURE_CUBE_MAP, this.emptyTextures[gl.TEXTURE_CUBE_MAP].texture);\n\n for (let i = 0; i < 6; i++)\n {\n gl.texImage2D(gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, gl.RGBA, 1, 1, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);\n }\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\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.bind(null, i);\n }\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 bind(texture: Texture|BaseTexture, location = 0): void\n {\n const { gl } = this;\n\n texture = texture?.castToBaseTexture();\n\n // cannot bind partial texture\n // TODO: report a warning\n if (texture && texture.valid && !texture.parentTextureArray)\n {\n texture.touched = this.renderer.textureGC.count;\n\n const glTexture = texture._glTextures[this.CONTEXT_UID] || this.initTexture(texture);\n\n if (this.boundTextures[location] !== texture)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(texture.target, glTexture.texture);\n }\n\n if (glTexture.dirtyId !== texture.dirtyId)\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n this.updateTexture(texture);\n }\n\n this.boundTextures[location] = texture;\n }\n else\n {\n if (this.currentLocation !== location)\n {\n this.currentLocation = location;\n gl.activeTexture(gl.TEXTURE0 + location);\n }\n\n gl.bindTexture(gl.TEXTURE_2D, this.emptyTextures[gl.TEXTURE_2D].texture);\n this.boundTextures[location] = null;\n }\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 reset(): void\n {\n this._unknownBoundTextures = true;\n this.hasIntegerTextures = false;\n this.currentLocation = -1;\n\n for (let i = 0; i < this.boundTextures.length; i++)\n {\n this.boundTextures[i] = this.unknownTexture;\n }\n }\n\n /**\n * Unbind a texture\n * @param {PIXI.BaseTexture} texture - Texture to bind\n */\n unbind(texture?: BaseTexture): void\n {\n const { gl, boundTextures } = this;\n\n if (this._unknownBoundTextures)\n {\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 (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === this.unknownTexture)\n {\n this.bind(null, i);\n }\n }\n }\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n if (boundTextures[i] === texture)\n {\n if (this.currentLocation !== i)\n {\n gl.activeTexture(gl.TEXTURE0 + i);\n this.currentLocation = i;\n }\n\n gl.bindTexture(texture.target, this.emptyTextures[texture.target].texture);\n boundTextures[i] = null;\n }\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 ensureSamplerType(maxTextures: number): void\n {\n const { boundTextures, hasIntegerTextures, CONTEXT_UID } = this;\n\n if (!hasIntegerTextures)\n {\n return;\n }\n\n for (let i = maxTextures - 1; i >= 0; --i)\n {\n const tex = boundTextures[i];\n\n if (tex)\n {\n const glTexture = tex._glTextures[CONTEXT_UID];\n\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.renderer.texture.unbind(tex);\n }\n }\n }\n }\n\n /**\n * Initialize a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n initTexture(texture: BaseTexture): GLTexture\n {\n const glTexture = new GLTexture(this.gl.createTexture());\n\n // guarantee an update..\n glTexture.dirtyId = -1;\n\n texture._glTextures[this.CONTEXT_UID] = glTexture;\n\n this.managedTextures.push(texture);\n texture.on('dispose', this.destroyTexture, this);\n\n return glTexture;\n }\n\n initTextureType(texture: BaseTexture, glTexture: GLTexture): void\n {\n glTexture.internalFormat = this.internalFormats[texture.type]?.[texture.format] ?? texture.format;\n\n if (this.webGLVersion === 2 && texture.type === TYPES.HALF_FLOAT)\n {\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 {\n glTexture.type = texture.type;\n }\n }\n\n /**\n * Update a texture\n *\n * @private\n * @param {PIXI.BaseTexture} texture - Texture to initialize\n */\n updateTexture(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n const renderer = this.renderer;\n\n this.initTextureType(texture, glTexture);\n\n if (texture.resource && texture.resource.upload(renderer, texture, glTexture))\n {\n // texture is uploaded, dont do anything!\n if (glTexture.samplerType !== SAMPLER_TYPES.FLOAT)\n {\n this.hasIntegerTextures = true;\n }\n }\n else\n {\n // default, renderTexture-like logic\n const width = texture.realWidth;\n const height = texture.realHeight;\n const gl = renderer.gl;\n\n if (glTexture.width !== width\n || glTexture.height !== height\n || glTexture.dirtyId < 0)\n {\n glTexture.width = width;\n glTexture.height = height;\n\n gl.texImage2D(texture.target, 0,\n glTexture.internalFormat,\n width,\n height,\n 0,\n texture.format,\n glTexture.type,\n null);\n }\n }\n\n // lets only update what changes..\n if (texture.dirtyStyleId !== glTexture.dirtyStyleId)\n {\n this.updateTextureStyle(texture);\n }\n glTexture.dirtyId = texture.dirtyId;\n }\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 destroyTexture(texture: BaseTexture|Texture, skipRemove?: boolean): void\n {\n const { gl } = this;\n\n texture = texture.castToBaseTexture();\n\n if (texture._glTextures[this.CONTEXT_UID])\n {\n this.unbind(texture);\n\n gl.deleteTexture(texture._glTextures[this.CONTEXT_UID].texture);\n texture.off('dispose', this.destroyTexture, this);\n\n delete texture._glTextures[this.CONTEXT_UID];\n\n if (!skipRemove)\n {\n const i = this.managedTextures.indexOf(texture);\n\n if (i !== -1)\n {\n removeItems(this.managedTextures, i, 1);\n }\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 updateTextureStyle(texture: BaseTexture): void\n {\n const glTexture = texture._glTextures[this.CONTEXT_UID];\n\n if (!glTexture)\n {\n return;\n }\n\n if ((texture.mipmap === MIPMAP_MODES.POW2 || this.webGLVersion !== 2) && !texture.isPowerOfTwo)\n {\n glTexture.mipmap = false;\n }\n else\n {\n glTexture.mipmap = texture.mipmap >= 1;\n }\n\n if (this.webGLVersion !== 2 && !texture.isPowerOfTwo)\n {\n glTexture.wrapMode = WRAP_MODES.CLAMP;\n }\n else\n {\n glTexture.wrapMode = texture.wrapMode;\n }\n\n if (texture.resource && texture.resource.style(this.renderer, texture, glTexture))\n {\n // style is set, dont do anything!\n }\n else\n {\n this.setStyle(texture, glTexture);\n }\n\n glTexture.dirtyStyleId = texture.dirtyStyleId;\n }\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 setStyle(texture: BaseTexture, glTexture: GLTexture): void\n {\n const gl = this.gl;\n\n if (glTexture.mipmap && texture.mipmap !== MIPMAP_MODES.ON_MANUAL)\n {\n gl.generateMipmap(texture.target);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_S, glTexture.wrapMode);\n gl.texParameteri(texture.target, gl.TEXTURE_WRAP_T, glTexture.wrapMode);\n\n if (glTexture.mipmap)\n {\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\n const anisotropicExt = this.renderer.context.extensions.anisotropicFiltering;\n\n if (anisotropicExt && texture.anisotropicLevel > 0 && texture.scaleMode === SCALE_MODES.LINEAR)\n {\n const level = Math.min(texture.anisotropicLevel, gl.getParameter(anisotropicExt.MAX_TEXTURE_MAX_ANISOTROPY_EXT));\n\n gl.texParameterf(texture.target, anisotropicExt.TEXTURE_MAX_ANISOTROPY_EXT, level);\n }\n }\n else\n {\n gl.texParameteri(texture.target, gl.TEXTURE_MIN_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n gl.texParameteri(texture.target, gl.TEXTURE_MAG_FILTER, texture.scaleMode === SCALE_MODES.LINEAR ? gl.LINEAR : gl.NEAREST);\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { FORMATS, TYPES } from '@pixi/constants';\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 */\nexport function mapTypeAndFormatToInternalFormat(gl: WebGLRenderingContextBase):\n { [type: number]: { [format: number]: number } }\n{\n let table;\n\n if ('WebGL2RenderingContext' in self && gl instanceof self.WebGL2RenderingContext)\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8,\n [FORMATS.RGB]: gl.RGB8,\n [FORMATS.RG]: gl.RG8,\n [FORMATS.RED]: gl.R8,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8UI,\n [FORMATS.RGB_INTEGER]: gl.RGB8UI,\n [FORMATS.RG_INTEGER]: gl.RG8UI,\n [FORMATS.RED_INTEGER]: gl.R8UI,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.BYTE]: {\n [FORMATS.RGBA]: gl.RGBA8_SNORM,\n [FORMATS.RGB]: gl.RGB8_SNORM,\n [FORMATS.RG]: gl.RG8_SNORM,\n [FORMATS.RED]: gl.R8_SNORM,\n [FORMATS.RGBA_INTEGER]: gl.RGBA8I,\n [FORMATS.RGB_INTEGER]: gl.RGB8I,\n [FORMATS.RG_INTEGER]: gl.RG8I,\n [FORMATS.RED_INTEGER]: gl.R8I,\n },\n [TYPES.UNSIGNED_SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16UI,\n [FORMATS.RGB_INTEGER]: gl.RGB16UI,\n [FORMATS.RG_INTEGER]: gl.RG16UI,\n [FORMATS.RED_INTEGER]: gl.R16UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT16,\n },\n [TYPES.SHORT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA16I,\n [FORMATS.RGB_INTEGER]: gl.RGB16I,\n [FORMATS.RG_INTEGER]: gl.RG16I,\n [FORMATS.RED_INTEGER]: gl.R16I,\n },\n [TYPES.UNSIGNED_INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32UI,\n [FORMATS.RGB_INTEGER]: gl.RGB32UI,\n [FORMATS.RG_INTEGER]: gl.RG32UI,\n [FORMATS.RED_INTEGER]: gl.R32UI,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT24,\n },\n [TYPES.INT]: {\n [FORMATS.RGBA_INTEGER]: gl.RGBA32I,\n [FORMATS.RGB_INTEGER]: gl.RGB32I,\n [FORMATS.RG_INTEGER]: gl.RG32I,\n [FORMATS.RED_INTEGER]: gl.R32I,\n },\n [TYPES.FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA32F,\n [FORMATS.RGB]: gl.RGB32F,\n [FORMATS.RG]: gl.RG32F,\n [FORMATS.RED]: gl.R32F,\n [FORMATS.DEPTH_COMPONENT]: gl.DEPTH_COMPONENT32F,\n },\n [TYPES.HALF_FLOAT]: {\n [FORMATS.RGBA]: gl.RGBA16F,\n [FORMATS.RGB]: gl.RGB16F,\n [FORMATS.RG]: gl.RG16F,\n [FORMATS.RED]: gl.R16F,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB565,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA4,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGB5_A1,\n },\n [TYPES.UNSIGNED_INT_2_10_10_10_REV]: {\n [FORMATS.RGBA]: gl.RGB10_A2,\n [FORMATS.RGBA_INTEGER]: gl.RGB10_A2UI,\n },\n [TYPES.UNSIGNED_INT_10F_11F_11F_REV]: {\n [FORMATS.RGB]: gl.R11F_G11F_B10F,\n },\n [TYPES.UNSIGNED_INT_5_9_9_9_REV]: {\n [FORMATS.RGB]: gl.RGB9_E5,\n },\n [TYPES.UNSIGNED_INT_24_8]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH24_STENCIL8,\n },\n [TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]: {\n [FORMATS.DEPTH_STENCIL]: gl.DEPTH32F_STENCIL8,\n },\n };\n }\n else\n {\n table = {\n [TYPES.UNSIGNED_BYTE]: {\n [FORMATS.RGBA]: gl.RGBA,\n [FORMATS.RGB]: gl.RGB,\n [FORMATS.ALPHA]: gl.ALPHA,\n [FORMATS.LUMINANCE]: gl.LUMINANCE,\n [FORMATS.LUMINANCE_ALPHA]: gl.LUMINANCE_ALPHA,\n },\n [TYPES.UNSIGNED_SHORT_5_6_5]: {\n [FORMATS.RGB]: gl.RGB,\n },\n [TYPES.UNSIGNED_SHORT_4_4_4_4]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n [TYPES.UNSIGNED_SHORT_5_5_5_1]: {\n [FORMATS.RGBA]: gl.RGBA,\n },\n };\n }\n\n return table;\n}\n","import { hex2string, hex2rgb, EventEmitter, deprecation } from '@pixi/utils';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';\nimport { settings } from '@pixi/settings';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableContainer, IRenderableObject } from './IRenderableObject';\n\nconst tempMatrix = new Matrix();\n\nexport interface IRendererOptions extends GlobalMixins.IRendererOptions\n{\n width?: number;\n height?: number;\n view?: HTMLCanvasElement;\n useContextAlpha?: boolean | 'notMultiplied';\n /**\n * Use `backgroundAlpha` instead.\n * @deprecated\n */\n transparent?: boolean;\n autoDensity?: boolean;\n antialias?: boolean;\n resolution?: number;\n preserveDrawingBuffer?: boolean;\n clearBeforeRender?: boolean;\n backgroundColor?: number;\n backgroundAlpha?: number;\n powerPreference?: WebGLPowerPreference;\n context?: IRenderingContext;\n}\n\nexport interface IRendererPlugins\n{\n [key: string]: any;\n}\n\nexport interface IRendererRenderOptions {\n renderTexture?: RenderTexture;\n clear?: boolean;\n transform?: Matrix;\n skipUpdateTransform?: boolean;\n}\n\nexport interface IGenerateTextureOptions {\n scaleMode?: SCALE_MODES;\n resolution?: number;\n region?: Rectangle;\n multisample?: MSAA_QUALITY;\n}\n\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 */\nexport abstract class AbstractRenderer extends EventEmitter\n{\n public resolution: number;\n public clearBeforeRender?: boolean;\n public readonly options: IRendererOptions;\n public readonly type: RENDERER_TYPE;\n public readonly screen: Rectangle;\n public readonly view: HTMLCanvasElement;\n public readonly plugins: IRendererPlugins;\n public readonly useContextAlpha: boolean | 'notMultiplied';\n public readonly autoDensity: boolean;\n public readonly preserveDrawingBuffer: boolean;\n\n protected _backgroundColor: number;\n protected _backgroundColorString: string;\n _backgroundColorRgba: number[];\n _lastObjectRendered: IRenderableObject;\n\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 constructor(type: RENDERER_TYPE = RENDERER_TYPE.UNKNOWN, options?: IRendererOptions)\n {\n super();\n\n // Add the default render options\n options = Object.assign({}, settings.RENDER_OPTIONS, options);\n\n /**\n * The supplied constructor options.\n *\n * @member {Object}\n * @readOnly\n */\n this.options = options;\n\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 /**\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 /**\n * The canvas element that everything is drawn to.\n *\n * @member {HTMLCanvasElement}\n */\n this.view = options.view || document.createElement('canvas');\n\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 /**\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 /**\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 /**\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 /**\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 /**\n * The background color as a number.\n *\n * @member {number}\n * @protected\n */\n this._backgroundColor = 0x000000;\n\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 /**\n * The background color as a string.\n *\n * @member {string}\n * @protected\n */\n this._backgroundColorString = '#000000';\n\n this.backgroundColor = options.backgroundColor || this._backgroundColor; // run bg color setter\n this.backgroundAlpha = options.backgroundAlpha;\n\n // @deprecated\n if (options.transparent !== undefined)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Option transparent is deprecated, please use backgroundAlpha instead.');\n // #endif\n this.useContextAlpha = options.transparent;\n this.backgroundAlpha = options.transparent ? 0 : 1;\n }\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 /**\n * Collection of plugins.\n * @readonly\n * @member {object}\n */\n this.plugins = {};\n }\n\n /**\n * Initialize the plugins.\n *\n * @protected\n * @param {object} staticMap - The dictionary of statically saved plugins.\n */\n initPlugins(staticMap: IRendererPlugins): void\n {\n for (const o in staticMap)\n {\n this.plugins[o] = new (staticMap[o])(this);\n }\n }\n\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 width(): number\n {\n return this.view.width;\n }\n\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 height(): number\n {\n return this.view.height;\n }\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 resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n this.view.width = Math.round(desiredScreenWidth * this.resolution);\n this.view.height = Math.round(desiredScreenHeight * this.resolution);\n\n const screenWidth = this.view.width / this.resolution;\n const screenHeight = this.view.height / this.resolution;\n\n this.screen.width = screenWidth;\n this.screen.height = screenHeight;\n\n if (this.autoDensity)\n {\n this.view.style.width = `${screenWidth}px`;\n this.view.style.height = `${screenHeight}px`;\n }\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 /**\n * Useful function that returns a texture of the display object that can then be used to create sprites\n * This can be quite useful if your displayObject is complicated and needs to be reused multiple times.\n * @method PIXI.AbstractRenderer#generateTexture\n * @param displayObject - The displayObject the object will be generated from.\n * @param {object} options - Generate texture options.\n * @param {PIXI.SCALE_MODES} options.scaleMode - The scale mode of the texture.\n * @param {number} options.resolution - The resolution / device pixel ratio of the texture being generated.\n * @param {PIXI.Rectangle} options.region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @param {PIXI.MSAA_QUALITY} options.multisample - The number of samples of the frame buffer.\n * @return A texture of the graphics object.\n */\n generateTexture(displayObject: IRenderableObject, options?: IGenerateTextureOptions): RenderTexture;\n\n /**\n * Please use the options argument instead.\n *\n * @method PIXI.AbstractRenderer#generateTexture\n * @deprecated Since 6.1.0\n * @param displayObject - The displayObject the object will be generated from.\n * @param scaleMode - The scale mode of the texture.\n * @param resolution - The resolution / device pixel ratio of the texture being generated.\n * @param region - The region of the displayObject, that shall be rendered,\n * if no region is specified, defaults to the local bounds of the displayObject.\n * @return A texture of the graphics object.\n */\n generateTexture(\n displayObject: IRenderableObject,\n scaleMode?: SCALE_MODES,\n resolution?: number,\n region?: Rectangle): RenderTexture;\n\n /**\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n // @deprecated parameters spread, use options instead\n if (typeof options === 'number')\n {\n // #if _DEBUG\n deprecation('6.1.0', 'generateTexture options (scaleMode, resolution, region) are now object options.');\n // #endif\n\n options = { scaleMode: options, resolution, region };\n }\n\n const { region: manualRegion, ...textureOptions } = options;\n\n region = manualRegion || (displayObject as IRenderableContainer).getLocalBounds(null, true);\n\n // minimum texture size is 1x1, 0x0 will throw an error\n if (region.width === 0) region.width = 1;\n if (region.height === 0) region.height = 1;\n\n const renderTexture = RenderTexture.create(\n {\n width: region.width,\n height: region.height,\n ...textureOptions,\n });\n\n tempMatrix.tx = -region.x;\n tempMatrix.ty = -region.y;\n\n this.render(displayObject, {\n renderTexture,\n clear: false,\n transform: tempMatrix,\n skipUpdateTransform: !!displayObject.parent\n });\n\n return renderTexture;\n }\n\n abstract render(displayObject: IRenderableObject, options?: IRendererRenderOptions): void;\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 destroy(removeView?: boolean): void\n {\n for (const o in this.plugins)\n {\n this.plugins[o].destroy();\n this.plugins[o] = null;\n }\n\n if (removeView && this.view.parentNode)\n {\n this.view.parentNode.removeChild(this.view);\n }\n\n const thisAny = this as any;\n\n // null-ing all objects, that's a tradition!\n\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\n /**\n * The background color to fill if not transparent\n *\n * @member {number}\n */\n get backgroundColor(): number\n {\n return this._backgroundColor;\n }\n\n set backgroundColor(value: number)\n {\n this._backgroundColor = value;\n this._backgroundColorString = hex2string(value);\n hex2rgb(value, this._backgroundColorRgba);\n }\n\n /**\n * The background color alpha. Setting this to 0 will make the canvas transparent.\n *\n * @member {number}\n */\n get backgroundAlpha(): number\n {\n return this._backgroundColorRgba[3];\n }\n set backgroundAlpha(value: number)\n {\n this._backgroundColorRgba[3] = value;\n }\n}\n","export class GLBuffer\n{\n buffer: WebGLBuffer;\n updateID: number;\n byteLength: number;\n refCount: number;\n\n constructor(buffer?: WebGLBuffer)\n {\n this.buffer = buffer || null;\n this.updateID = -1;\n this.byteLength = -1;\n this.refCount = 0;\n }\n}\n","import { GLBuffer } from './GLBuffer';\n\nimport type { Renderer } from '../Renderer';\nimport type { IRenderingContext } from '../IRenderingContext';\nimport type { Buffer } from './Buffer';\nimport type { ISystem } from '../ISystem';\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 */\nexport class BufferSystem implements ISystem\n{\n CONTEXT_UID: number;\n gl: IRenderingContext;\n\n /** Cache for all buffers by id, used in case renderer gets destroyed or for profiling */\n readonly managedBuffers: {[key: number]: Buffer};\n\n /** Cache keeping track of the base bound buffer bases */\n readonly boundBufferBases: {[key: number]: Buffer};\n\n private renderer: Renderer;\n\n /**\n * @param {PIXI.Renderer} renderer - The renderer this System works for.\n */\n constructor(renderer: Renderer)\n {\n this.renderer = renderer;\n this.managedBuffers = {};\n this.boundBufferBases = {};\n }\n\n /**\n * @ignore\n */\n destroy(): void\n {\n this.renderer = null;\n }\n\n /**\n * Sets up the renderer context and necessary buffers.\n */\n protected contextChange(): void\n {\n this.disposeAll(true);\n\n this.gl = this.renderer.gl;\n\n // TODO fill out...\n this.CONTEXT_UID = this.renderer.CONTEXT_UID;\n }\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 bind(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n }\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 bindBufferBase(buffer: Buffer, index: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n if (this.boundBufferBases[index] !== buffer)\n {\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n this.boundBufferBases[index] = buffer;\n\n gl.bindBufferBase(gl.UNIFORM_BUFFER, index, glBuffer.buffer);\n }\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 bindBufferRange(buffer: Buffer, index?: number, offset?: number): void\n {\n const { gl, CONTEXT_UID } = this;\n\n offset = offset || 0;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID] || this.createGLBuffer(buffer);\n\n gl.bindBufferRange(gl.UNIFORM_BUFFER, index || 0, glBuffer.buffer, offset * 256, 256);\n }\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 update(buffer: Buffer): void\n {\n const { gl, CONTEXT_UID } = this;\n\n const glBuffer = buffer._glBuffers[CONTEXT_UID];\n\n if (buffer._updateID === glBuffer.updateID)\n {\n return;\n }\n\n glBuffer.updateID = buffer._updateID;\n\n gl.bindBuffer(buffer.type, glBuffer.buffer);\n\n if (glBuffer.byteLength >= buffer.data.byteLength)\n {\n // offset is always zero for now!\n gl.bufferSubData(buffer.type, 0, buffer.data);\n }\n else\n {\n const drawType = buffer.static ? gl.STATIC_DRAW : gl.DYNAMIC_DRAW;\n\n glBuffer.byteLength = buffer.data.byteLength;\n gl.bufferData(buffer.type, buffer.data, drawType);\n }\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 dispose(buffer: Buffer, contextLost?: boolean): void\n {\n if (!this.managedBuffers[buffer.id])\n {\n return;\n }\n\n delete this.managedBuffers[buffer.id];\n\n const glBuffer = buffer._glBuffers[this.CONTEXT_UID];\n const gl = this.gl;\n\n buffer.disposeRunner.remove(this);\n\n if (!glBuffer)\n {\n return;\n }\n\n if (!contextLost)\n {\n gl.deleteBuffer(glBuffer.buffer);\n }\n\n delete buffer._glBuffers[this.CONTEXT_UID];\n }\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 disposeAll(contextLost?: boolean): void\n {\n const all: Array = Object.keys(this.managedBuffers);\n\n for (let i = 0; i < all.length; i++)\n {\n this.dispose(this.managedBuffers[all[i]], contextLost);\n }\n }\n\n /**\n * creates and attaches a GLBuffer object tied to the current context.\n * @protected\n */\n protected createGLBuffer(buffer: Buffer): GLBuffer\n {\n const { CONTEXT_UID, gl } = this;\n\n buffer._glBuffers[CONTEXT_UID] = new GLBuffer(gl.createBuffer());\n\n this.managedBuffers[buffer.id] = buffer;\n\n buffer.disposeRunner.add(this);\n\n return buffer._glBuffers[CONTEXT_UID];\n }\n}\n","import { AbstractRenderer } from './AbstractRenderer';\nimport { sayHello, isWebGLSupported, deprecation } from '@pixi/utils';\nimport { MaskSystem } from './mask/MaskSystem';\nimport { StencilSystem } from './mask/StencilSystem';\nimport { ScissorSystem } from './mask/ScissorSystem';\nimport { FilterSystem } from './filters/FilterSystem';\nimport { FramebufferSystem } from './framebuffer/FramebufferSystem';\nimport { RenderTextureSystem } from './renderTexture/RenderTextureSystem';\nimport { TextureSystem } from './textures/TextureSystem';\nimport { ProjectionSystem } from './projection/ProjectionSystem';\nimport { StateSystem } from './state/StateSystem';\nimport { GeometrySystem } from './geometry/GeometrySystem';\nimport { ShaderSystem } from './shader/ShaderSystem';\nimport { ContextSystem } from './context/ContextSystem';\nimport { BatchSystem } from './batch/BatchSystem';\nimport { TextureGCSystem } from './textures/TextureGCSystem';\nimport { MSAA_QUALITY, RENDERER_TYPE } from '@pixi/constants';\nimport { UniformGroup } from './shader/UniformGroup';\nimport { Matrix, Rectangle } from '@pixi/math';\nimport { Runner } from '@pixi/runner';\nimport { BufferSystem } from './geometry/BufferSystem';\nimport { RenderTexture } from './renderTexture/RenderTexture';\n\nimport type { SCALE_MODES } from '@pixi/constants';\nimport type { IRendererOptions, IRendererPlugins, IRendererRenderOptions,\n IGenerateTextureOptions } from './AbstractRenderer';\nimport type { ISystemConstructor } from './ISystem';\nimport type { IRenderingContext } from './IRenderingContext';\nimport type { IRenderableObject } from './IRenderableObject';\n\nexport interface IRendererPluginConstructor {\n new (renderer: Renderer, options?: any): IRendererPlugin;\n}\n\nexport interface IRendererPlugin {\n destroy(): void;\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 */\nexport class Renderer extends AbstractRenderer\n{\n /**\n * WebGL context, set by {@link PIXI.ContextSystem this.context}.\n *\n * @readonly\n * @member {WebGLRenderingContext}\n */\n public gl: IRenderingContext;\n\n /** Global uniforms */\n public globalUniforms: UniformGroup;\n\n /** Unique UID assigned to the renderer's WebGL context. */\n public CONTEXT_UID: number;\n\n /**\n * Flag if we are rendering to the screen vs renderTexture\n *\n * @readonly\n * @default true\n */\n public renderingToScreen: boolean;\n\n /**\n * The number of msaa samples of the canvas.\n * @readonly\n */\n public multisample: MSAA_QUALITY;\n // systems\n\n /**\n * Mask system instance\n * @readonly\n */\n public mask: MaskSystem;\n\n /**\n * Context system instance\n * @readonly\n */\n public context: ContextSystem;\n\n /**\n * State system instance\n * @readonly\n */\n public state: StateSystem;\n\n /**\n * Shader system instance\n * @readonly\n */\n public shader: ShaderSystem;\n\n /**\n * Texture system instance\n * @readonly\n */\n public texture: TextureSystem;\n\n /**\n * Buffer system instance\n * @readonly\n */\n public buffer: BufferSystem;\n\n /**\n * Geometry system instance\n * @readonly\n */\n public geometry: GeometrySystem;\n\n /**\n * Framebuffer system instance\n * @readonly\n */\n public framebuffer: FramebufferSystem;\n\n /**\n * Scissor system instance\n * @readonly\n */\n public scissor: ScissorSystem;\n\n /**\n * Stencil system instance\n * @readonly\n */\n public stencil: StencilSystem;\n\n /**\n * Projection system instance\n * @readonly\n */\n public projection: ProjectionSystem;\n\n /**\n * Texture garbage collector system instance\n * @readonly\n */\n public textureGC: TextureGCSystem;\n\n /**\n * Filter system instance\n * @readonly\n */\n public filter: FilterSystem;\n\n /**\n * RenderTexture system instance\n * @readonly\n */\n public renderTexture: RenderTextureSystem;\n\n /**\n * Batch system instance\n * @readonly\n */\n public batch: BatchSystem;\n\n /**\n * Internal signal instances of **runner**, these\n * are assigned to each system created.\n * @see PIXI.Runner\n * @name runners\n * @private\n * @type {object}\n * @readonly\n * @property {PIXI.Runner} destroy - Destroy runner\n * @property {PIXI.Runner} contextChange - Context change runner\n * @property {PIXI.Runner} reset - Reset runner\n * @property {PIXI.Runner} update - Update runner\n * @property {PIXI.Runner} postrender - Post-render runner\n * @property {PIXI.Runner} prerender - Pre-render runner\n * @property {PIXI.Runner} resize - Resize runner\n */\n runners: {[key: string]: Runner};\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 static create(options?: IRendererOptions): AbstractRenderer\n {\n if (isWebGLSupported())\n {\n return new Renderer(options);\n }\n\n throw new Error('WebGL unsupported in this browser, use \"pixi.js-legacy\" for fallback canvas2d support.');\n }\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. 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 constructor(options? : IRendererOptions)\n {\n super(RENDERER_TYPE.WEBGL, options);\n\n // the options will have been modified here in the super constructor with pixi's default settings..\n options = this.options;\n\n this.gl = null;\n\n this.CONTEXT_UID = 0;\n\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\n this.runners.contextChange.add(this);\n\n this.globalUniforms = new UniformGroup({\n projectionMatrix: new Matrix(),\n }, true);\n\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\n this.initPlugins(Renderer.__plugins);\n\n this.multisample = undefined;\n\n /*\n * The options passed in to create a new WebGL context.\n */\n if (options.context)\n {\n this.context.initFromContext(options.context);\n }\n else\n {\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\n this.renderingToScreen = true;\n\n sayHello(this.context.webGLVersion === 2 ? 'WebGL 2' : 'WebGL 1');\n\n this.resize(this.options.width, this.options.height);\n }\n\n protected contextChange(): void\n {\n const gl = this.gl;\n\n let samples;\n\n if (this.context.webGLVersion === 1)\n {\n const framebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);\n }\n else\n {\n const framebuffer = gl.getParameter(gl.DRAW_FRAMEBUFFER_BINDING);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);\n\n samples = gl.getParameter(gl.SAMPLES);\n\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, framebuffer);\n }\n\n if (samples >= MSAA_QUALITY.HIGH)\n {\n this.multisample = MSAA_QUALITY.HIGH;\n }\n else if (samples >= MSAA_QUALITY.MEDIUM)\n {\n this.multisample = MSAA_QUALITY.MEDIUM;\n }\n else if (samples >= MSAA_QUALITY.LOW)\n {\n this.multisample = MSAA_QUALITY.LOW;\n }\n else\n {\n this.multisample = MSAA_QUALITY.NONE;\n }\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 addSystem(ClassRef: ISystemConstructor, name: string): this\n {\n const system = new ClassRef(this);\n\n if ((this as any)[name])\n {\n throw new Error(`Whoops! The name \"${name}\" is already in use`);\n }\n\n (this as any)[name] = system;\n\n for (const i in this.runners)\n {\n this.runners[i].add(system);\n }\n\n /**\n * Fired after rendering finishes.\n *\n * @event PIXI.Renderer#postrender\n */\n\n /**\n * Fired before rendering starts.\n *\n * @event PIXI.Renderer#prerender\n */\n\n /**\n * Fired when the WebGL context is set.\n *\n * @event PIXI.Renderer#context\n * @param {WebGLRenderingContext} gl - WebGL context.\n */\n\n return this;\n }\n\n /**\n * Renders the object to its WebGL view.\n *\n * @param displayObject - The object to be rendered.\n * @param {object} [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: IRenderableObject, options?: IRendererRenderOptions): void;\n\n /**\n * Please use the `option` render arguments instead.\n *\n * @deprecated Since 6.0.0\n * @param displayObject\n * @param renderTexture\n * @param clear\n * @param transform\n * @param skipUpdateTransform\n */\n render(displayObject: IRenderableObject, renderTexture?: RenderTexture,\n clear?: boolean, transform?: Matrix, skipUpdateTransform?: boolean): void;\n\n /**\n * @ignore\n */\n render(displayObject: IRenderableObject, options?: IRendererRenderOptions | RenderTexture): void\n {\n let renderTexture: RenderTexture;\n let clear: boolean;\n let transform: Matrix;\n let skipUpdateTransform: boolean;\n\n if (options)\n {\n if (options instanceof RenderTexture)\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#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.runners.prerender.emit();\n this.emit('prerender');\n\n // apply a transform at a GPU level\n this.projection.transform = transform;\n\n // no point rendering if our context has been blown up!\n if (this.context.isLost)\n {\n return;\n }\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 // displayObject.hitArea = //TODO add a temp hit area\n }\n\n this.renderTexture.bind(renderTexture);\n this.batch.currentRenderer.start();\n\n if (clear !== undefined ? clear : this.clearBeforeRender)\n {\n this.renderTexture.clear();\n }\n\n displayObject.render(this);\n\n // apply transform..\n this.batch.currentRenderer.flush();\n\n if (renderTexture)\n {\n renderTexture.baseTexture.update();\n }\n\n this.runners.postrender.emit();\n\n // reset transform after render\n this.projection.transform = null;\n\n this.emit('postrender');\n }\n\n /**\n * @override\n * @ignore\n */\n generateTexture(displayObject: IRenderableObject,\n options: IGenerateTextureOptions | SCALE_MODES = {},\n resolution?: number, region?: Rectangle): RenderTexture\n {\n const renderTexture = super.generateTexture(displayObject, options as any, resolution, region);\n\n this.framebuffer.blit();\n\n return renderTexture;\n }\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 resize(desiredScreenWidth: number, desiredScreenHeight: number): void\n {\n super.resize(desiredScreenWidth, desiredScreenHeight);\n\n this.runners.resize.emit(this.screen.height, this.screen.width);\n }\n\n /**\n * Resets the WebGL state so you can render things however you fancy!\n *\n * @return Returns itself.\n */\n reset(): this\n {\n this.runners.reset.emit();\n\n return this;\n }\n\n /** Clear the frame buffer. */\n clear(): void\n {\n this.renderTexture.bind();\n this.renderTexture.clear();\n }\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 destroy(removeView?: boolean): void\n {\n this.runners.destroy.emit();\n\n for (const r in this.runners)\n {\n this.runners[r].destroy();\n }\n\n // call base destroy\n super.destroy(removeView);\n\n // TODO nullify all the managers..\n this.gl = null;\n }\n\n /**\n * Please use `plugins.extract` instead.\n * @member {PIXI.Extract} extract\n * @deprecated since 6.0.0\n * @readonly\n */\n public get extract(): any\n {\n // #if _DEBUG\n deprecation('6.0.0', 'Renderer#extract has been deprecated, please use Renderer#plugins.extract instead.');\n // #endif\n\n return this.plugins.extract;\n }\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 *\n * @readonly\n * @property {PIXI.AccessibilityManager} accessibility Support tabbing interactive elements.\n * @property {PIXI.Extract} extract Extract image data from renderer.\n * @property {PIXI.InteractionManager} interaction Handles mouse, touch and pointer events.\n * @property {PIXI.ParticleRenderer} particle Renderer for ParticleContainer objects.\n * @property {PIXI.Prepare} prepare Pre-render display objects.\n * @property {PIXI.BatchRenderer} batch Batching of Sprite, Graphics and Mesh objects.\n * @property {PIXI.TilingSpriteRenderer} tilingSprite Renderer for TilingSprite objects.\n */\n static __plugins: IRendererPlugins;\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: IRendererPluginConstructor): void\n {\n Renderer.__plugins = Renderer.__plugins || {};\n Renderer.__plugins[pluginName] = ctor;\n }\n}\n","import { Renderer } from './Renderer';\nimport type { AbstractRenderer, IRendererOptions } from './AbstractRenderer';\n\nexport interface IRendererOptionsAuto extends IRendererOptions\n{\n forceCanvas?: boolean;\n}\n/**\n * This helper function will automatically detect which renderer you should be using.\n * WebGL is the preferred renderer as it is a lot faster. If WebGL is not supported by\n * the browser then this function will return a canvas renderer\n *\n * @memberof PIXI\n * @function autoDetectRenderer\n * @param {object} [options] - The optional renderer parameters\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.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 {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 {string} [options.powerPreference] - Parameter passed to webgl context, set to \"high-performance\"\n * for devices with dual graphics card **webgl only**\n * @return {PIXI.Renderer|PIXI.CanvasRenderer} Returns WebGL renderer if available, otherwise CanvasRenderer\n */\nexport function autoDetectRenderer(options?: IRendererOptionsAuto): AbstractRenderer\n{\n return Renderer.create(options);\n}\n","import $defaultVertex from './default.vert';\nimport $defaultFilterVertex from './defaultFilter.vert';\n\n/**\n * Default vertex shader\n * @memberof PIXI\n * @member {string} defaultVertex\n */\n\n/**\n * Default filter vertex shader\n * @memberof PIXI\n * @member {string} defaultFilterVertex\n */\n\n// NOTE: This black magic is so that @microsoft/api-extractor does not complain! This explicitly specifies the types\n// of defaultVertex, defaultFilterVertex.\nconst defaultVertex: string = $defaultVertex;\nconst defaultFilterVertex: string = $defaultFilterVertex;\n\nexport { defaultVertex, defaultFilterVertex };\n","import type { Renderer } from './Renderer';\nimport { deprecation } from '@pixi/utils';\n\n/**\n * Interface for systems used by the {@link PIXI.Renderer}.\n * @memberof PIXI\n */\nexport interface ISystem\n{\n /**\n * Generic destroy methods to be overridden by the subclass\n */\n destroy(): void;\n}\n\n/**\n * Types for system and pipe classes.\n *\n * @ignore\n */\nexport interface ISystemConstructor\n{\n new (renderer: R): ISystem;\n}\n\n/**\n * Use the ISystem interface instead.\n * @deprecated since 6.1.0\n * @memberof PIXI\n */\nexport class System implements ISystem\n{\n /** Reference to the main renderer */\n public renderer: Renderer;\n\n /**\n * @param renderer - Reference to Renderer\n */\n constructor(renderer: Renderer)\n {\n // #if _DEBUG\n deprecation('6.1.0', 'System class is deprecated, implemement ISystem interface instead.');\n // #endif\n\n this.renderer = renderer;\n }\n\n /** Destroy and don't use after this. */\n destroy(): void\n {\n this.renderer = null;\n }\n}\n","import { DRAW_MODES } from '@pixi/constants';\n\nimport type { BLEND_MODES } from '@pixi/constants';\nimport type { BatchTextureArray } from './BatchTextureArray';\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 */\nexport class BatchDrawCall\n{\n texArray: BatchTextureArray;\n type: DRAW_MODES;\n blend: BLEND_MODES;\n start: number;\n size: number;\n\n /** Data for uniforms or custom webgl state. */\n data: any;\n\n constructor()\n {\n this.texArray = null;\n this.blend = 0;\n this.type = DRAW_MODES.TRIANGLES;\n\n this.start = 0;\n this.size = 0;\n\n this.data = null;\n }\n}\n","import type { BaseTexture } from '@pixi/core';\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 */\nexport class BatchTextureArray\n{\n /** Inside textures array. */\n public elements: BaseTexture[];\n\n /** Respective locations for textures. */\n public ids: number[];\n\n /** Number of filled elements. */\n public count: number;\n\n constructor()\n {\n this.elements = [];\n this.ids = [];\n this.count = 0;\n }\n\n clear(): void\n {\n for (let i = 0; i < this.count; i++)\n {\n this.elements[i] = null;\n }\n this.count = 0;\n }\n}\n","import type { ITypedArray } from './Buffer';\n\n/**\n * Flexible wrapper around `ArrayBuffer` that also provides typed array views on demand.\n *\n * @class\n * @memberof PIXI\n */\nexport class ViewableBuffer\n{\n public size: number;\n public rawBinaryData: ArrayBuffer;\n public uint32View: Uint32Array;\n public float32View: Float32Array;\n\n private _int8View: Int8Array;\n private _uint8View: Uint8Array;\n private _int16View: Int16Array;\n private _uint16View: Uint16Array;\n private _int32View: Int32Array;\n\n /**\n * @param {number} length - The size of the buffer in bytes.\n */\n constructor(length: number);\n\n /**\n * @param {ArrayBuffer} arrayBuffer - The source array buffer.\n */\n constructor(arrayBuffer: ArrayBuffer);\n\n constructor(sizeOrBuffer: number | ArrayBuffer | Uint8Array)\n {\n if (typeof sizeOrBuffer === 'number')\n {\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 {\n this.rawBinaryData = sizeOrBuffer.buffer;\n }\n else\n {\n this.rawBinaryData = sizeOrBuffer;\n }\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 /**\n * View on the raw binary data as a `Float32Array`.\n *\n * @member {Float32Array}\n */\n this.float32View = new Float32Array(this.rawBinaryData);\n }\n\n /**\n * View on the raw binary data as a `Int8Array`.\n *\n * @member {Int8Array}\n */\n get int8View(): Int8Array\n {\n if (!this._int8View)\n {\n this._int8View = new Int8Array(this.rawBinaryData);\n }\n\n return this._int8View;\n }\n\n /**\n * View on the raw binary data as a `Uint8Array`.\n *\n * @member {Uint8Array}\n */\n get uint8View(): Uint8Array\n {\n if (!this._uint8View)\n {\n this._uint8View = new Uint8Array(this.rawBinaryData);\n }\n\n return this._uint8View;\n }\n\n /**\n * View on the raw binary data as a `Int16Array`.\n *\n * @member {Int16Array}\n */\n get int16View(): Int16Array\n {\n if (!this._int16View)\n {\n this._int16View = new Int16Array(this.rawBinaryData);\n }\n\n return this._int16View;\n }\n\n /**\n * View on the raw binary data as a `Uint16Array`.\n *\n * @member {Uint16Array}\n */\n get uint16View(): Uint16Array\n {\n if (!this._uint16View)\n {\n this._uint16View = new Uint16Array(this.rawBinaryData);\n }\n\n return this._uint16View;\n }\n\n /**\n * View on the raw binary data as a `Int32Array`.\n *\n * @member {Int32Array}\n */\n get int32View(): Int32Array\n {\n if (!this._int32View)\n {\n this._int32View = new Int32Array(this.rawBinaryData);\n }\n\n return this._int32View;\n }\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 view(type: string): ITypedArray\n {\n return (this as any)[`${type}View`];\n }\n\n /**\n * Destroys all buffer references. Do not use after calling\n * this.\n */\n destroy(): void\n {\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\n static sizeOf(type: string): number\n {\n switch (type)\n {\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}\n","import { BatchDrawCall } from './BatchDrawCall';\nimport { BatchTextureArray } from './BatchTextureArray';\nimport { BaseTexture } from '../textures/BaseTexture';\nimport { ObjectRenderer } from './ObjectRenderer';\nimport { State } from '../state/State';\nimport { ViewableBuffer } from '../geometry/ViewableBuffer';\n\nimport { checkMaxIfStatementsInShader } from '../shader/utils/checkMaxIfStatementsInShader';\n\nimport { settings } from '@pixi/settings';\nimport { premultiplyBlendMode, premultiplyTint, nextPow2, log2 } from '@pixi/utils';\nimport { ENV } from '@pixi/constants';\n\nimport type { Renderer } from '../Renderer';\nimport type { Shader } from '../shader/Shader';\nimport type { BatchShaderGenerator } from './BatchShaderGenerator';\nimport type { BatchGeometry } from './BatchGeometry';\nimport type { Texture } from '../textures/Texture';\nimport type { BLEND_MODES } from '@pixi/constants';\n\n/**\n * Interface for elements like Sprite, Mesh etc. for batching.\n *\n * @memberof PIXI\n */\nexport interface IBatchableElement {\n _texture: Texture;\n vertexData: Float32Array;\n indices: Uint16Array | Uint32Array | Array;\n uvs: Float32Array;\n worldAlpha: number;\n _tintRGB: number;\n blendMode: BLEND_MODES;\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 */\nexport class AbstractBatchRenderer extends ObjectRenderer\n{\n /** The WebGL state in which this renderer will work. */\n public readonly state: State;\n\n /**\n * The number of bufferable objects before a flush\n * occurs automatically.\n *\n * @default settings.SPRITE_BATCH_SIZE * 4\n */\n public size: number;\n\n /**\n * Maximum number of textures that can be uploaded to\n * the GPU under the current context. It is initialized\n * properly in `this.contextChange`.\n *\n * @see PIXI.AbstractBatchRenderer#contextChange\n * @readonly\n */\n public MAX_TEXTURES: number;\n\n /**\n * This is used to generate a shader that can\n * color each vertex based on a `aTextureId`\n * attribute that points to an texture in `uSampler`.\n *\n * This enables the objects with different textures\n * to be drawn in the same draw call.\n *\n * You can customize your shader by creating your\n * custom shader generator.\n */\n protected shaderGenerator: BatchShaderGenerator;\n\n /**\n * The class that represents the geometry of objects\n * that are going to be batched with this.\n *\n * @member {object}\n * @default PIXI.BatchGeometry\n */\n protected geometryClass: typeof BatchGeometry;\n\n /**\n * Size of data being buffered per vertex in the\n * attribute buffers (in floats). By default, the\n * batch-renderer plugin uses 6:\n *\n * | aVertexPosition | 2 |\n * |-----------------|---|\n * | aTextureCoords | 2 |\n * | aColor | 1 |\n * | aTextureId | 1 |\n *\n * @readonly\n */\n protected vertexSize: number;\n\n /** Total count of all vertices used by the currently buffered objects. */\n protected _vertexCount: number;\n\n /** Total count of all indices used by the currently buffered objects. */\n protected _indexCount: number;\n\n /**\n * Buffer of objects that are yet to be rendered.\n *\n * @member {PIXI.DisplayObject[]}\n */\n protected _bufferedElements: Array;\n\n /**\n * Data for texture batch builder, helps to save a bit of CPU on a pass.\n *\n * @member {PIXI.BaseTexture[]}\n */\n protected _bufferedTextures: Array;\n\n /** Number of elements that are buffered and are waiting to be flushed. */\n protected _bufferSize: number;\n\n /**\n * This shader is generated by `this.shaderGenerator`.\n *\n * It is generated specifically to handle the required\n * number of textures being batched together.\n */\n protected _shader: Shader;\n\n /**\n * A flush may occur multiple times in a single\n * frame. On iOS devices or when\n * `settings.CAN_UPLOAD_SAME_BUFFER` is false, the\n * batch renderer does not upload data to the same\n * `WebGLBuffer` for performance reasons.\n *\n * This is the index into `packedGeometries` that points to\n * geometry holding the most recent buffers.\n */\n protected _flushId: number;\n\n /**\n * Pool of `ViewableBuffer` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing attributes.\n *\n * The first buffer has a size of 8; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {PIXI.ViewableBuffer[]}\n * @see PIXI.AbstractBatchRenderer#getAttributeBuffer\n */\n protected _aBuffers: Array;\n\n /**\n * Pool of `Uint16Array` objects that are sorted in\n * order of increasing size. The flush method uses\n * the buffer with the least size above the amount\n * it requires. These are used for passing indices.\n *\n * The first buffer has a size of 12; each subsequent\n * buffer has double capacity of its previous.\n *\n * @member {Uint16Array[]}\n * @see PIXI.AbstractBatchRenderer#getIndexBuffer\n */\n protected _iBuffers: Array;\n protected _dcIndex: number;\n protected _aIndex: number;\n protected _iIndex: number;\n protected _attributeBuffer: ViewableBuffer;\n protected _indexBuffer: Uint16Array;\n protected _tempBoundTextures: BaseTexture[];\n\n /**\n * Pool of `this.geometryClass` geometry objects\n * that store buffers. They are used to pass data\n * to the shader on each draw call.\n *\n * These are never re-allocated again, unless a\n * context change occurs; however, the pool may\n * be expanded if required.\n *\n * @member {PIXI.Geometry[]}\n * @see PIXI.AbstractBatchRenderer.contextChange\n */\n private _packedGeometries: Array;\n\n /**\n * Size of `this._packedGeometries`. It can be expanded\n * if more than `this._packedGeometryPoolSize` flushes\n * occur in a single frame.\n */\n private _packedGeometryPoolSize: number;\n\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 constructor(renderer: Renderer)\n {\n super(renderer);\n\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 = {} as any;\n this._iBuffers = {} as any;\n\n this.MAX_TEXTURES = 1;\n\n this.renderer.on('prerender', this.onPrerender, this);\n renderer.runners.contextChange.add(this);\n\n this._dcIndex = 0;\n this._aIndex = 0;\n this._iIndex = 0;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n this._tempBoundTextures = [];\n }\n\n /**\n * Handles the `contextChange` signal.\n *\n * It calculates `this.MAX_TEXTURES` and allocating the packed-geometry object pool.\n */\n contextChange(): void\n {\n const gl = this.renderer.gl;\n\n if (settings.PREFER_ENV === ENV.WEBGL_LEGACY)\n {\n this.MAX_TEXTURES = 1;\n }\n else\n {\n // step 1: first check max textures the GPU can handle.\n this.MAX_TEXTURES = Math.min(\n gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS),\n settings.SPRITE_MAX_TEXTURES);\n\n // step 2: check the maximum number of if statements the shader can have too..\n this.MAX_TEXTURES = checkMaxIfStatementsInShader(\n this.MAX_TEXTURES, gl);\n }\n\n this._shader = this.shaderGenerator.generateShader(this.MAX_TEXTURES);\n\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 (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n /* eslint-disable max-len */\n this._packedGeometries[i] = new (this.geometryClass)();\n }\n\n this.initFlushBuffers();\n }\n\n /** Makes sure that static and dynamic flush pooled objects have correct dimensions. */\n initFlushBuffers(): void\n {\n const {\n _drawCallPool,\n _textureArrayPool,\n } = AbstractBatchRenderer;\n // max draw calls\n const MAX_SPRITES = this.size / 4;\n // max texture arrays\n const MAX_TA = Math.floor(MAX_SPRITES / this.MAX_TEXTURES) + 1;\n\n while (_drawCallPool.length < MAX_SPRITES)\n {\n _drawCallPool.push(new BatchDrawCall());\n }\n while (_textureArrayPool.length < MAX_TA)\n {\n _textureArrayPool.push(new BatchTextureArray());\n }\n for (let i = 0; i < this.MAX_TEXTURES; i++)\n {\n this._tempBoundTextures[i] = null;\n }\n }\n\n /**\n * Handles the `prerender` signal.\n *\n * It ensures that flushes start from the first geometry object again.\n */\n onPrerender(): void\n {\n this._flushId = 0;\n }\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 render(element: IBatchableElement): void\n {\n if (!element._texture.valid)\n {\n return;\n }\n\n if (this._vertexCount + (element.vertexData.length / 2) > this.size)\n {\n this.flush();\n }\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\n buildTexturesAndDrawCalls(): void\n {\n const {\n _bufferedTextures: textures,\n MAX_TEXTURES,\n } = this;\n const textureArrays = AbstractBatchRenderer._textureArrayPool;\n const batch = this.renderer.batch;\n const boundTextures = this._tempBoundTextures;\n const touch = this.renderer.textureGC.count;\n\n let TICK = ++BaseTexture._globalBatch;\n let countTexArrays = 0;\n let texArray = textureArrays[0];\n let start = 0;\n\n batch.copyBoundTextures(boundTextures, MAX_TEXTURES);\n\n for (let i = 0; i < this._bufferSize; ++i)\n {\n const tex = textures[i];\n\n textures[i] = null;\n if (tex._batchEnabled === TICK)\n {\n continue;\n }\n\n if (texArray.count >= MAX_TEXTURES)\n {\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\n tex._batchEnabled = TICK;\n tex.touched = touch;\n texArray.elements[texArray.count++] = tex;\n }\n\n if (texArray.count > 0)\n {\n batch.boundArray(texArray, boundTextures, TICK, MAX_TEXTURES);\n this.buildDrawCalls(texArray, start, this._bufferSize);\n ++countTexArrays;\n ++TICK;\n }\n\n // Clean-up\n\n for (let i = 0; i < boundTextures.length; i++)\n {\n boundTextures[i] = null;\n }\n BaseTexture._globalBatch = TICK;\n }\n\n /** Populating drawcalls for rendering */\n buildDrawCalls(texArray: BatchTextureArray, start: number, finish: number): void\n {\n const {\n _bufferedElements: elements,\n _attributeBuffer,\n _indexBuffer,\n vertexSize,\n } = this;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let dcIndex = this._dcIndex;\n let aIndex = this._aIndex;\n let iIndex = this._iIndex;\n\n let drawCall = drawCalls[dcIndex];\n\n drawCall.start = this._iIndex;\n drawCall.texArray = texArray;\n\n for (let i = start; i < finish; ++i)\n {\n const sprite = elements[i];\n const tex = sprite._texture.baseTexture;\n const spriteBlendMode = premultiplyBlendMode[\n tex.alphaMode ? 1 : 0][sprite.blendMode];\n\n elements[i] = null;\n\n if (start < i && drawCall.blend !== spriteBlendMode)\n {\n drawCall.size = iIndex - drawCall.start;\n start = i;\n drawCall = drawCalls[++dcIndex];\n drawCall.texArray = texArray;\n drawCall.start = iIndex;\n }\n\n this.packInterleavedGeometry(sprite, _attributeBuffer, _indexBuffer, aIndex, iIndex);\n aIndex += sprite.vertexData.length / 2 * vertexSize;\n iIndex += sprite.indices.length;\n\n drawCall.blend = spriteBlendMode;\n }\n\n if (start < finish)\n {\n drawCall.size = iIndex - drawCall.start;\n ++dcIndex;\n }\n\n this._dcIndex = dcIndex;\n this._aIndex = aIndex;\n this._iIndex = iIndex;\n }\n\n /** Bind textures for current rendering */\n bindAndClearTexArray(texArray: BatchTextureArray): void\n {\n const textureSystem = this.renderer.texture;\n\n for (let j = 0; j < texArray.count; j++)\n {\n textureSystem.bind(texArray.elements[j], texArray.ids[j]);\n texArray.elements[j] = null;\n }\n texArray.count = 0;\n }\n\n updateGeometry(): void\n {\n const {\n _packedGeometries: packedGeometries,\n _attributeBuffer: attributeBuffer,\n _indexBuffer: indexBuffer,\n } = this;\n\n if (!settings.CAN_UPLOAD_SAME_BUFFER)\n { /* 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 {\n this._packedGeometryPoolSize++;\n packedGeometries[this._flushId] = new (this.geometryClass)();\n }\n\n packedGeometries[this._flushId]._buffer.update(attributeBuffer.rawBinaryData);\n packedGeometries[this._flushId]._indexBuffer.update(indexBuffer);\n\n this.renderer.geometry.bind(packedGeometries[this._flushId]);\n this.renderer.geometry.updateBuffers();\n this._flushId++;\n }\n else\n {\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\n this.renderer.geometry.updateBuffers();\n }\n }\n\n drawBatches(): void\n {\n const dcCount = this._dcIndex;\n const { gl, state: stateSystem } = this.renderer;\n const drawCalls = AbstractBatchRenderer._drawCallPool;\n\n let curTexArray = null;\n\n // Upload textures and do the draw calls\n for (let i = 0; i < dcCount; i++)\n {\n const { texArray, type, size, start, blend } = drawCalls[i];\n\n if (curTexArray !== texArray)\n {\n curTexArray = texArray;\n this.bindAndClearTexArray(texArray);\n }\n\n this.state.blendMode = blend;\n stateSystem.set(this.state);\n gl.drawElements(type, size, gl.UNSIGNED_SHORT, start * 2);\n }\n }\n\n /** Renders the content _now_ and empties the current batch. */\n flush(): void\n {\n if (this._vertexCount === 0)\n {\n return;\n }\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\n this.buildTexturesAndDrawCalls();\n this.updateGeometry();\n this.drawBatches();\n\n // reset elements buffer for the next flush\n this._bufferSize = 0;\n this._vertexCount = 0;\n this._indexCount = 0;\n }\n\n /** Starts a new sprite batch. */\n start(): void\n {\n this.renderer.state.set(this.state);\n\n this.renderer.texture.ensureSamplerType(this.MAX_TEXTURES);\n\n this.renderer.shader.bind(this._shader);\n\n if (settings.CAN_UPLOAD_SAME_BUFFER)\n {\n // bind buffer #0, we don't need others\n this.renderer.geometry.bind(this._packedGeometries[this._flushId]);\n }\n }\n\n /** Stops and flushes the current batch. */\n stop(): void\n {\n this.flush();\n }\n\n /** Destroys this `AbstractBatchRenderer`. It cannot be used again. */\n destroy(): void\n {\n for (let i = 0; i < this._packedGeometryPoolSize; i++)\n {\n if (this._packedGeometries[i])\n {\n this._packedGeometries[i].destroy();\n }\n }\n\n this.renderer.off('prerender', this.onPrerender, this);\n\n this._aBuffers = null;\n this._iBuffers = null;\n this._packedGeometries = null;\n this._attributeBuffer = null;\n this._indexBuffer = null;\n\n if (this._shader)\n {\n this._shader.destroy();\n this._shader = null;\n }\n\n super.destroy();\n }\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 getAttributeBuffer(size: number): ViewableBuffer\n {\n // 8 vertices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 8));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 8;\n\n if (this._aBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._aBuffers[roundedSize];\n\n if (!buffer)\n {\n this._aBuffers[roundedSize] = buffer = new ViewableBuffer(roundedSize * this.vertexSize * 4);\n }\n\n return buffer;\n }\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 getIndexBuffer(size: number): Uint16Array\n {\n // 12 indices is enough for 2 quads\n const roundedP2 = nextPow2(Math.ceil(size / 12));\n const roundedSizeIndex = log2(roundedP2);\n const roundedSize = roundedP2 * 12;\n\n if (this._iBuffers.length <= roundedSizeIndex)\n {\n this._iBuffers.length = roundedSizeIndex + 1;\n }\n\n let buffer = this._iBuffers[roundedSizeIndex];\n\n if (!buffer)\n {\n this._iBuffers[roundedSizeIndex] = buffer = new Uint16Array(roundedSize);\n }\n\n return buffer;\n }\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 packInterleavedGeometry(element: IBatchableElement, attributeBuffer: ViewableBuffer, indexBuffer: Uint16Array,\n aIndex: number, iIndex: number): void\n {\n const {\n uint32View,\n float32View,\n } = attributeBuffer;\n\n const packedVertices = aIndex / this.vertexSize;\n const uvs = element.uvs;\n const indicies = element.indices;\n const vertexData = element.vertexData;\n const textureId = element._texture.baseTexture._batchLocation;\n\n const alpha = Math.min(element.worldAlpha, 1.0);\n const argb = (alpha < 1.0\n && element._texture.baseTexture.alphaMode)\n ? premultiplyTint(element._tintRGB, alpha)\n : element._tintRGB + (alpha * 255 << 24);\n\n // lets not worry about tint! for now..\n for (let i = 0; i < vertexData.length; i += 2)\n {\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\n for (let i = 0; i < indicies.length; i++)\n {\n indexBuffer[iIndex++] = packedVertices + indicies[i];\n }\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 static _drawCallPool: Array = [];\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.BatchTextureArray[]}\n */\n static _textureArrayPool: Array = [];\n}\n","import { Shader } from '../shader/Shader';\nimport { Program } from '../shader/Program';\nimport { UniformGroup } from '../shader/UniformGroup';\nimport { Matrix } from '@pixi/math';\n\n/**\n * Helper that generates batching multi-texture shader. Use it with your new BatchRenderer\n *\n * @memberof PIXI\n */\nexport class BatchShaderGenerator\n{\n /** Reference to the vertex shader source. */\n public vertexSrc: string;\n\n /** Reference to the fragment shader template. Must contain \"%count%\" and \"%forloop%\". */\n public fragTemplate: string;\n\n programCache: {[key: number]: Program};\n defaultGroupCache: {[key: number]: UniformGroup};\n\n /**\n * @param vertexSrc - Vertex shader\n * @param fragTemplate - Fragment shader template\n */\n constructor(vertexSrc: string, fragTemplate: string)\n {\n this.vertexSrc = vertexSrc;\n this.fragTemplate = fragTemplate;\n\n this.programCache = {};\n this.defaultGroupCache = {};\n\n if (fragTemplate.indexOf('%count%') < 0)\n {\n throw new Error('Fragment template must contain \"%count%\".');\n }\n\n if (fragTemplate.indexOf('%forloop%') < 0)\n {\n throw new Error('Fragment template must contain \"%forloop%\".');\n }\n }\n\n generateShader(maxTextures: number): Shader\n {\n if (!this.programCache[maxTextures])\n {\n const sampleValues = new Int32Array(maxTextures);\n\n for (let i = 0; i < maxTextures; i++)\n {\n sampleValues[i] = i;\n }\n\n this.defaultGroupCache[maxTextures] = UniformGroup.from({ uSamplers: sampleValues }, true);\n\n let fragmentSrc = this.fragTemplate;\n\n fragmentSrc = fragmentSrc.replace(/%count%/gi, `${maxTextures}`);\n fragmentSrc = fragmentSrc.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));\n\n this.programCache[maxTextures] = new Program(this.vertexSrc, fragmentSrc);\n }\n\n const uniforms = {\n tint: new Float32Array([1, 1, 1, 1]),\n translationMatrix: new Matrix(),\n default: this.defaultGroupCache[maxTextures],\n };\n\n return new Shader(this.programCache[maxTextures], uniforms);\n }\n\n generateSampleSrc(maxTextures: number): string\n {\n let src = '';\n\n src += '\\n';\n src += '\\n';\n\n for (let i = 0; i < maxTextures; i++)\n {\n if (i > 0)\n {\n src += '\\nelse ';\n }\n\n if (i < maxTextures - 1)\n {\n src += `if(vTextureId < ${i}.5)`;\n }\n\n src += '\\n{';\n src += `\\n\\tcolor = texture2D(uSamplers[${i}], vTextureCoord);`;\n src += '\\n}';\n }\n\n src += '\\n';\n src += '\\n';\n\n return src;\n }\n}\n","import { TYPES } from '@pixi/constants';\nimport { Geometry } from '../geometry/Geometry';\nimport { Buffer } from '../geometry/Buffer';\n\n/**\n * Geometry used to batch standard PIXI content (e.g. Mesh, Sprite, Graphics objects).\n *\n * @memberof PIXI\n */\nexport class BatchGeometry extends Geometry\n{\n /**\n * Buffer used for position, color, texture IDs\n *\n * @protected\n */\n _buffer: Buffer;\n\n /**\n * Index buffer data\n *\n * @protected\n */\n _indexBuffer: Buffer;\n\n /**\n * @param {boolean} [_static=false] - Optimization flag, where `false`\n * is updated every frame, `true` doesn't change frame-to-frame.\n */\n constructor(_static = false)\n {\n super();\n\n this._buffer = new Buffer(null, _static, false);\n\n this._indexBuffer = new Buffer(null, _static, true);\n\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 }\n}\n","import { BatchShaderGenerator } from './BatchShaderGenerator';\nimport { BatchGeometry } from './BatchGeometry';\nimport { AbstractBatchRenderer } from './AbstractBatchRenderer';\n\nimport defaultVertex from './texture.vert';\nimport defaultFragment from './texture.frag';\n\nimport type { Renderer } from '../Renderer';\n\nexport interface IBatchFactoryOptions\n{\n vertex?: string;\n fragment?: string;\n geometryClass?: typeof BatchGeometry;\n vertexSize?: number;\n}\n\n/** @memberof PIXI */\nexport class 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 static create(options?: IBatchFactoryOptions): typeof AbstractBatchRenderer\n {\n const { vertex, fragment, vertexSize, geometryClass } = Object.assign({\n vertex: defaultVertex,\n fragment: defaultFragment,\n geometryClass: BatchGeometry,\n vertexSize: 6,\n }, options);\n\n return class BatchPlugin extends AbstractBatchRenderer\n {\n constructor(renderer: Renderer)\n {\n super(renderer);\n\n this.shaderGenerator = new BatchShaderGenerator(vertex, fragment);\n this.geometryClass = geometryClass;\n this.vertexSize = vertexSize;\n }\n };\n }\n\n /**\n * The default vertex shader source\n *\n * @readonly\n */\n static get defaultVertexSrc(): string\n {\n return defaultVertex;\n }\n\n /**\n * The default fragment shader source\n *\n * @readonly\n */\n static get defaultFragmentTemplate(): string\n {\n return defaultFragment;\n }\n}\n\n// Setup the default BatchRenderer plugin, this is what\n// we'll actually export at the root level\nexport const BatchRenderer = BatchPluginFactory.create();\n","import { deprecation } from '@pixi/utils';\nimport * as _systems from './systems';\nimport * as _resources from './textures/resources';\n\n/**\n * @memberof PIXI\n * @namespace resources\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst resources = {};\n\nfor (const name in _resources)\n{\n Object.defineProperty(resources, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.systems.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_resources as any)[name];\n },\n });\n}\n\n/**\n * @memberof PIXI\n * @namespace systems\n * @see PIXI\n * @deprecated since 6.0.0\n */\nconst systems = {};\n\nfor (const name in _systems)\n{\n Object.defineProperty(systems, name,\n {\n get()\n {\n // #if _DEBUG\n deprecation('6.0.0', `PIXI.resources.${name} has moved to PIXI.${name}`);\n // #endif\n\n return (_systems as any)[name];\n },\n });\n}\n\nexport { resources, systems };\n","import { SHAPES } from '../const';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Rectangle extends GlobalMixins.Rectangle {}\n\n/**\n * Size object, contains width and height\n *\n * @memberof PIXI\n * @typedef {object} ISize\n */\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 */\nexport class Rectangle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n * @default PIXI.SHAPES.RECT\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.RECT;\n\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 constructor(x = 0, y = 0, width = 0, height = 0)\n {\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\n /** Returns the left edge of the rectangle. */\n get left(): number\n {\n return this.x;\n }\n\n /** Returns the right edge of the rectangle. */\n get right(): number\n {\n return this.x + this.width;\n }\n\n /** Returns the top edge of the rectangle. */\n get top(): number\n {\n return this.y;\n }\n\n /** Returns the bottom edge of the rectangle. */\n get bottom(): number\n {\n return this.y + this.height;\n }\n\n /** A constant empty rectangle. */\n static get EMPTY(): Rectangle\n {\n return new Rectangle(0, 0, 0, 0);\n }\n\n /**\n * Creates a clone of this Rectangle\n *\n * @return a copy of the rectangle\n */\n clone(): Rectangle\n {\n return new Rectangle(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Copies another rectangle to this one.\n *\n * @param rectangle - The rectangle to copy from.\n * @return Returns itself.\n */\n copyFrom(rectangle: Rectangle): Rectangle\n {\n this.x = rectangle.x;\n this.y = rectangle.y;\n this.width = rectangle.width;\n this.height = rectangle.height;\n\n return this;\n }\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 copyTo(rectangle: Rectangle): Rectangle\n {\n rectangle.x = this.x;\n rectangle.y = this.y;\n rectangle.width = this.width;\n rectangle.height = this.height;\n\n return rectangle;\n }\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 contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n if (x >= this.x && x < this.x + this.width)\n {\n if (y >= this.y && y < this.y + this.height)\n {\n return true;\n }\n }\n\n return false;\n }\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 pad(paddingX = 0, paddingY = paddingX): this\n {\n this.x -= paddingX;\n this.y -= paddingY;\n\n this.width += paddingX * 2;\n this.height += paddingY * 2;\n\n return this;\n }\n\n /**\n * Fits this rectangle around the passed one.\n *\n * @param rectangle - The rectangle to fit.\n * @return Returns itself.\n */\n fit(rectangle: Rectangle): this\n {\n const x1 = Math.max(this.x, rectangle.x);\n const x2 = Math.min(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.max(this.y, rectangle.y);\n const y2 = Math.min(this.y + this.height, rectangle.y + rectangle.height);\n\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\n return this;\n }\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 ceil(resolution = 1, eps = 0.001): this\n {\n const x2 = Math.ceil((this.x + this.width - eps) * resolution) / resolution;\n const y2 = Math.ceil((this.y + this.height - eps) * resolution) / resolution;\n\n this.x = Math.floor((this.x + eps) * resolution) / resolution;\n this.y = Math.floor((this.y + eps) * resolution) / resolution;\n\n this.width = x2 - this.x;\n this.height = y2 - this.y;\n\n return this;\n }\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 enlarge(rectangle: Rectangle): this\n {\n const x1 = Math.min(this.x, rectangle.x);\n const x2 = Math.max(this.x + this.width, rectangle.x + rectangle.width);\n const y1 = Math.min(this.y, rectangle.y);\n const y2 = Math.max(this.y + this.height, rectangle.y + rectangle.height);\n\n this.x = x1;\n this.width = x2 - x1;\n this.y = y1;\n this.height = y2 - y1;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from './../const';\nimport { Rectangle } from './Rectangle';\n\n/**\n * The Circle object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @memberof PIXI\n */\nexport class Circle\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public radius: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @default PIXI.SHAPES.CIRC\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.CIRC;\n\n /**\n * @param x - The X coordinate of the center of this circle\n * @param y - The Y coordinate of the center of this circle\n * @param radius - The radius of the circle\n */\n constructor(x = 0, y = 0, radius = 0)\n {\n this.x = x;\n this.y = y;\n this.radius = radius;\n\n this.type = SHAPES.CIRC;\n }\n\n /**\n * Creates a clone of this Circle instance\n *\n * @return A copy of the Circle\n */\n clone(): Circle\n {\n return new Circle(this.x, this.y, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this circle\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 Circle\n */\n contains(x: number, y: number): boolean\n {\n if (this.radius <= 0)\n {\n return false;\n }\n\n const r2 = this.radius * this.radius;\n let dx = (this.x - x);\n let dy = (this.y - y);\n\n dx *= dx;\n dy *= dy;\n\n return (dx + dy <= r2);\n }\n\n /**\n * Returns the framing rectangle of the circle as a Rectangle object\n *\n * @return The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.radius, this.y - this.radius, this.radius * 2, this.radius * 2);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`;\n }\n // #endif\n}\n","import { Rectangle } from './Rectangle';\nimport { SHAPES } from '../const';\n\n/**\n * The Ellipse object is used to help draw graphics and can also be used to specify a hit area for displayObjects.\n *\n * @memberof PIXI\n */\nexport class Ellipse\n{\n /** @default 0 */\n public x: number;\n\n /** @default 0 */\n public y: number;\n\n /** @default 0 */\n public width: number;\n\n /** @default 0 */\n public height: number;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @default PIXI.SHAPES.ELIP\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.ELIP;\n\n /**\n * @param x - The X coordinate of the center of this ellipse\n * @param y - The Y coordinate of the center of this ellipse\n * @param halfWidth - The half width of this ellipse\n * @param halfHeight - The half height of this ellipse\n */\n constructor(x = 0, y = 0, halfWidth = 0, halfHeight = 0)\n {\n this.x = x;\n this.y = y;\n this.width = halfWidth;\n this.height = halfHeight;\n\n this.type = SHAPES.ELIP;\n }\n\n /**\n * Creates a clone of this Ellipse instance\n *\n * @return {PIXI.Ellipse} A copy of the ellipse\n */\n clone(): Ellipse\n {\n return new Ellipse(this.x, this.y, this.width, this.height);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this ellipse\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 coords are within this ellipse\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n\n // normalize the coords to an ellipse with center 0,0\n let normx = ((x - this.x) / this.width);\n let normy = ((y - this.y) / this.height);\n\n normx *= normx;\n normy *= normy;\n\n return (normx + normy <= 1);\n }\n\n /**\n * Returns the framing rectangle of the ellipse as a Rectangle object\n *\n * @return The framing rectangle\n */\n getBounds(): Rectangle\n {\n return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\nimport type { IPointData } from '../IPointData';\n\n/**\n * A class to define a shape via user defined coordinates.\n *\n * @memberof PIXI\n */\nexport class Polygon\n{\n /** An array of the points of this polygon. */\n public points: number[];\n\n /** `false` after moveTo, `true` after `closePath`. In all other cases it is `true`. */\n public closeStroke: boolean;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @default PIXI.SHAPES.POLY\n * @see PIXI.SHAPES\n */\n public readonly type: SHAPES.POLY;\n\n constructor(points: IPointData[]|number[]);\n constructor(...points: IPointData[]|number[]);\n\n /**\n * @param {PIXI.IPointData[]|number[]} points - This can be an array of Points\n * that form the polygon, a flat array of numbers that will be interpreted as [x,y, x,y, ...], or\n * the arguments passed can be all the points of the polygon e.g.\n * `new PIXI.Polygon(new PIXI.Point(), new PIXI.Point(), ...)`, or the arguments passed can be flat\n * x,y values e.g. `new Polygon(x,y, x,y, x,y, ...)` where `x` and `y` are Numbers.\n */\n constructor(...points: any[])\n {\n let flat: IPointData[]|number[] = Array.isArray(points[0]) ? points[0] : points;\n\n // if this is an array of points, convert it to a flat array of numbers\n if (typeof flat[0] !== 'number')\n {\n const p: number[] = [];\n\n for (let i = 0, il = flat.length; i < il; i++)\n {\n p.push((flat[i] as IPointData).x, (flat[i] as IPointData).y);\n }\n\n flat = p;\n }\n\n this.points = flat as number[];\n this.type = SHAPES.POLY;\n this.closeStroke = true;\n }\n\n /**\n * Creates a clone of this polygon.\n *\n * @return - A copy of the polygon.\n */\n clone(): Polygon\n {\n const points = this.points.slice();\n const polygon = new Polygon(points);\n\n polygon.closeStroke = this.closeStroke;\n\n return polygon;\n }\n\n /**\n * Checks whether the x and y coordinates passed to this function are contained within this polygon.\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 polygon.\n */\n contains(x: number, y: number): boolean\n {\n let inside = false;\n\n // use some raycasting to test hits\n // https://github.com/substack/point-in-polygon/blob/master/index.js\n const length = this.points.length / 2;\n\n for (let i = 0, j = length - 1; i < length; j = i++)\n {\n const xi = this.points[i * 2];\n const yi = this.points[(i * 2) + 1];\n const xj = this.points[j * 2];\n const yj = this.points[(j * 2) + 1];\n const intersect = ((yi > y) !== (yj > y)) && (x < ((xj - xi) * ((y - yi) / (yj - yi))) + xi);\n\n if (intersect)\n {\n inside = !inside;\n }\n }\n\n return inside;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Polygon`\n + `closeStroke=${this.closeStroke}`\n + `points=${this.points.reduce((pointsDesc, currentPoint) => `${pointsDesc}, ${currentPoint}`, '')}]`;\n }\n // #endif\n}\n","import { SHAPES } from '../const';\n\n/**\n * The Rounded Rectangle object is an area that has nice rounded corners, as indicated by its\n * top-left corner point (x, y) and by its width and its height and its radius.\n *\n * @class\n * @memberof PIXI\n */\nexport class RoundedRectangle\n{\n public x: number;\n public y: number;\n public width: number;\n public height: number;\n public radius: number;\n public readonly type: SHAPES.RREC;\n\n /**\n * @param {number} [x=0] - The X coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [y=0] - The Y coordinate of the upper-left corner of the rounded rectangle\n * @param {number} [width=0] - The overall width of this rounded rectangle\n * @param {number} [height=0] - The overall height of this rounded rectangle\n * @param {number} [radius=20] - Controls the radius of the rounded corners\n */\n constructor(x = 0, y = 0, width = 0, height = 0, radius = 20)\n {\n /**\n * @member {number}\n * @default 0\n */\n this.x = x;\n\n /**\n * @member {number}\n * @default 0\n */\n this.y = y;\n\n /**\n * @member {number}\n * @default 0\n */\n this.width = width;\n\n /**\n * @member {number}\n * @default 0\n */\n this.height = height;\n\n /**\n * @member {number}\n * @default 20\n */\n this.radius = radius;\n\n /**\n * The type of the object, mainly used to avoid `instanceof` checks\n *\n * @member {number}\n * @readonly\n * @default PIXI.SHAPES.RREC\n * @see PIXI.SHAPES\n */\n this.type = SHAPES.RREC;\n }\n\n /**\n * Creates a clone of this Rounded Rectangle\n *\n * @return {PIXI.RoundedRectangle} a copy of the rounded rectangle\n */\n clone(): RoundedRectangle\n {\n return new RoundedRectangle(this.x, this.y, this.width, this.height, this.radius);\n }\n\n /**\n * Checks whether the x and y coordinates given are contained within this Rounded Rectangle\n *\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 Rounded Rectangle\n */\n contains(x: number, y: number): boolean\n {\n if (this.width <= 0 || this.height <= 0)\n {\n return false;\n }\n if (x >= this.x && x <= this.x + this.width)\n {\n if (y >= this.y && y <= this.y + this.height)\n {\n const radius = Math.max(0, Math.min(this.radius, Math.min(this.width, this.height) / 2));\n\n if ((y >= this.y + radius && y <= this.y + this.height - radius)\n || (x >= this.x + radius && x <= this.x + this.width - radius))\n {\n return true;\n }\n let dx = x - (this.x + radius);\n let dy = y - (this.y + radius);\n const radius2 = radius * radius;\n\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + this.width - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dy = y - (this.y + this.height - radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n dx = x - (this.x + radius);\n if ((dx * dx) + (dy * dy) <= radius2)\n {\n return true;\n }\n }\n }\n\n return false;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}`\n + `width=${this.width} height=${this.height} radius=${this.radius}]`;\n }\n // #endif\n}\n","import type { IPoint } from './IPoint';\nimport type { IPointData } from './IPointData';\n\nexport interface Point extends GlobalMixins.Point, IPoint {}\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 */\nexport class Point implements IPoint\n{\n /** Position of the point on the x axis */\n public x = 0;\n /** Position of the point on the y axis */\n public y = 0;\n\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 constructor(x = 0, y = 0)\n {\n this.x = x;\n this.y = y;\n }\n\n /** Creates a clone of this point\n * @returns A clone of this point\n */\n clone(): Point\n {\n return new Point(this.x, this.y);\n }\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 copyFrom(p: IPointData): this\n {\n this.set(p.x, p.y);\n\n return this;\n }\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 copyTo(p: T): T\n {\n p.set(this.x, this.y);\n\n return p;\n }\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 equals(p: IPointData): boolean\n {\n return (p.x === this.x) && (p.y === this.y);\n }\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 set(x = 0, y = x): this\n {\n this.x = x;\n this.y = y;\n\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:Point x=${this.x} y=${this.y}]`;\n }\n // #endif\n}\n","import type { IPointData } from './IPointData';\nimport type { IPoint } from './IPoint';\n\nexport interface ObservablePoint extends GlobalMixins.Point, IPoint {}\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 */\nexport class ObservablePoint implements IPoint\n{\n /** The callback function triggered when `x` and/or `y` are changed */\n public cb: (this: T) => any;\n\n /** The owner of the callback */\n public scope: any;\n\n _x: number;\n _y: number;\n\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 constructor(cb: (this: T) => any, scope: T, x = 0, y = 0)\n {\n this._x = x;\n this._y = y;\n\n this.cb = cb;\n this.scope = scope;\n }\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 clone(cb = this.cb, scope = this.scope): ObservablePoint\n {\n return new ObservablePoint(cb, scope, this._x, this._y);\n }\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 set(x = 0, y = x): this\n {\n if (this._x !== x || this._y !== y)\n {\n this._x = x;\n this._y = y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\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 copyFrom(p: IPointData): this\n {\n if (this._x !== p.x || this._y !== p.y)\n {\n this._x = p.x;\n this._y = p.y;\n this.cb.call(this.scope);\n }\n\n return this;\n }\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 copyTo(p: T): T\n {\n p.set(this._x, this._y);\n\n return p;\n }\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 equals(p: IPointData): boolean\n {\n return (p.x === this._x) && (p.y === this._y);\n }\n\n // #if _DEBUG\n toString(): string\n {\n return `[@pixi/math:ObservablePoint x=${0} y=${0} scope=${this.scope}]`;\n }\n // #endif\n\n /** Position of the observable point on the x axis. */\n get x(): number\n {\n return this._x;\n }\n\n set x(value: number)\n {\n if (this._x !== value)\n {\n this._x = value;\n this.cb.call(this.scope);\n }\n }\n\n /** Position of the observable point on the y axis. */\n get y(): number\n {\n return this._y;\n }\n\n set y(value: number)\n {\n if (this._y !== value)\n {\n this._y = value;\n this.cb.call(this.scope);\n }\n }\n}\n","import { Point } from './Point';\nimport { PI_2 } from './const';\n\nimport type { Transform } from './Transform';\nimport type { IPointData } from './IPointData';\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 */\nexport class Matrix\n{\n /** @default 1 */\n public a: number;\n\n /** @default 0 */\n public b: number;\n\n /** @default 0 */\n public c: number;\n\n /** @default 1 */\n public d: number;\n\n /** @default 0 */\n public tx: number;\n\n /** @default 0 */\n public ty: number;\n\n public array: Float32Array|null = null;\n\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 constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0)\n {\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 /**\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 fromArray(array: number[]): void\n {\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 /**\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 set(a: number, b: number, c: number, d: number, tx: number, ty: number): this\n {\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 return this;\n }\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 toArray(transpose: boolean, out?: Float32Array): Float32Array\n {\n if (!this.array)\n {\n this.array = new Float32Array(9);\n }\n\n const array = out || this.array;\n\n if (transpose)\n {\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 {\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\n return array;\n }\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 apply

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const x = pos.x;\n const y = pos.y;\n\n newPos.x = (this.a * x) + (this.c * y) + this.tx;\n newPos.y = (this.b * x) + (this.d * y) + this.ty;\n\n return newPos;\n }\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 applyInverse

(pos: IPointData, newPos?: P): P\n {\n newPos = (newPos || new Point()) as P;\n\n const id = 1 / ((this.a * this.d) + (this.c * -this.b));\n\n const x = pos.x;\n const y = pos.y;\n\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\n return newPos;\n }\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 translate(x: number, y: number): this\n {\n this.tx += x;\n this.ty += y;\n\n return this;\n }\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 scale(x: number, y: number): this\n {\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\n return this;\n }\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 rotate(angle: number): this\n {\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n\n const a1 = this.a;\n const c1 = this.c;\n const tx1 = this.tx;\n\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\n return this;\n }\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 append(matrix: Matrix): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n\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\n this.tx = (matrix.tx * a1) + (matrix.ty * c1) + this.tx;\n this.ty = (matrix.tx * b1) + (matrix.ty * d1) + this.ty;\n\n return this;\n }\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 setTransform(x: number, y: number, pivotX: number, pivotY: number, scaleX: number,\n scaleY: number, rotation: number, skewX: number, skewY: number): this\n {\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\n this.tx = x - ((pivotX * this.a) + (pivotY * this.c));\n this.ty = y - ((pivotX * this.b) + (pivotY * this.d));\n\n return this;\n }\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 prepend(matrix: Matrix): this\n {\n const tx1 = this.tx;\n\n if (matrix.a !== 1 || matrix.b !== 0 || matrix.c !== 0 || matrix.d !== 1)\n {\n const a1 = this.a;\n const c1 = this.c;\n\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\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\n return this;\n }\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 decompose(transform: Transform): Transform\n {\n // sort out rotation / skew..\n const a = this.a;\n const b = this.b;\n const c = this.c;\n const d = this.d;\n const pivot = transform.pivot;\n\n const skewX = -Math.atan2(-c, d);\n const skewY = Math.atan2(b, a);\n\n const delta = Math.abs(skewX + skewY);\n\n if (delta < 0.00001 || Math.abs(PI_2 - delta) < 0.00001)\n {\n transform.rotation = skewY;\n transform.skew.x = transform.skew.y = 0;\n }\n else\n {\n transform.rotation = 0;\n transform.skew.x = skewX;\n transform.skew.y = skewY;\n }\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\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\n return transform;\n }\n\n /**\n * Inverts this matrix\n *\n * @return This matrix. Good for chaining method calls.\n */\n invert(): this\n {\n const a1 = this.a;\n const b1 = this.b;\n const c1 = this.c;\n const d1 = this.d;\n const tx1 = this.tx;\n const n = (a1 * d1) - (b1 * c1);\n\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\n return this;\n }\n\n /**\n * Resets this Matrix to an identity (default) matrix.\n *\n * @return This matrix. Good for chaining method calls.\n */\n identity(): this\n {\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\n return this;\n }\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 clone(): Matrix\n {\n const matrix = new Matrix();\n\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\n return matrix;\n }\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 copyTo(matrix: Matrix): Matrix\n {\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\n return matrix;\n }\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 copyFrom(matrix: Matrix): this\n {\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\n return this;\n }\n\n // #if _DEBUG\n toString(): string\n {\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 // #endif\n\n /**\n * A default (identity) matrix\n *\n * @readonly\n */\n static get IDENTITY(): Matrix\n {\n return new Matrix();\n }\n\n /**\n * A temp matrix\n *\n * @readonly\n */\n static get TEMP_MATRIX(): Matrix\n {\n return new Matrix();\n }\n}\n","// Your friendly neighbour https://en.wikipedia.org/wiki/Dihedral_group\n//\n// This file implements the dihedral group of order 16, also called\n// of degree 8. That's why its called groupD8.\n\nimport { Matrix } from './Matrix';\n\n/*\n * Transform matrix for operation n is:\n * | ux | vx |\n * | uy | vy |\n */\n\nconst ux = [1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1];\nconst uy = [0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vx = [0, -1, -1, -1, 0, 1, 1, 1, 0, 1, 1, 1, 0, -1, -1, -1];\nconst vy = [1, 1, 0, -1, -1, -1, 0, 1, -1, -1, 0, 1, 1, 1, 0, -1];\n\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 */\nconst rotationCayley: number[][] = [];\n\n/**\n * Matrices for each `GD8Symmetry` rotation.\n *\n * @type Matrix[]\n * @private\n */\nconst rotationMatrices: Matrix[] = [];\n\n/*\n * Alias for {@code Math.sign}.\n */\nconst signum = Math.sign;\n\n/*\n * Initializes `rotationCayley` and `rotationMatrices`. It is called\n * only once below.\n */\nfunction init(): void\n{\n for (let i = 0; i < 16; i++)\n {\n const row: number[] = [];\n\n rotationCayley.push(row);\n\n for (let j = 0; j < 16; j++)\n {\n /* Multiplies rotation matrices i and j. */\n const _ux = signum((ux[i] * ux[j]) + (vx[i] * uy[j]));\n const _uy = signum((uy[i] * ux[j]) + (vy[i] * uy[j]));\n const _vx = signum((ux[i] * vx[j]) + (vx[i] * vy[j]));\n const _vy = signum((uy[i] * vx[j]) + (vy[i] * vy[j]));\n\n /* Finds rotation matrix matching the product and pushes it. */\n for (let k = 0; k < 16; k++)\n {\n if (ux[k] === _ux && uy[k] === _uy\n && vx[k] === _vx && vy[k] === _vy)\n {\n row.push(k);\n break;\n }\n }\n }\n }\n\n for (let i = 0; i < 16; i++)\n {\n const mat = new Matrix();\n\n mat.set(ux[i], uy[i], vx[i], vy[i], 0, 0);\n rotationMatrices.push(mat);\n }\n}\n\ninit();\n\ntype GD8Symmetry = number;\n/**\n * @memberof PIXI\n * @typedef {number} GD8Symmetry\n * @see PIXI.groupD8\n */\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 */\nexport const groupD8 = {\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 0° | East |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n E: 0,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 45°↻ | Southeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SE: 1,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 90°↻ | South |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n S: 2,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 135°↻ | Southwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n SW: 3,\n\n /**\n * | Rotation | Direction |\n * |----------|-----------|\n * | 180° | West |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n W: 4,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -135°/225°↻ | Northwest |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NW: 5,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -90°/270°↻ | North |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n N: 6,\n\n /**\n * | Rotation | Direction |\n * |-------------|--------------|\n * | -45°/315°↻ | Northeast |\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n NE: 7,\n\n /**\n * Reflection about Y-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_VERTICAL: 8,\n\n /**\n * Reflection about the main diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MAIN_DIAGONAL: 10,\n\n /**\n * Reflection about X-axis.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n MIRROR_HORIZONTAL: 12,\n\n /**\n * Reflection about reverse diagonal.\n *\n * @memberof PIXI.groupD8\n * @constant {PIXI.GD8Symmetry}\n */\n REVERSE_DIAGONAL: 14,\n\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: (ind: GD8Symmetry): GD8Symmetry => ux[ind],\n\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: (ind: GD8Symmetry): GD8Symmetry => uy[ind],\n\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: (ind: GD8Symmetry): GD8Symmetry => vx[ind],\n\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: (ind: GD8Symmetry): GD8Symmetry => vy[ind],\n\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: (rotation: GD8Symmetry): GD8Symmetry =>\n {\n if (rotation & 8)// true only if between 8 & 15 (reflections)\n {\n return rotation & 15;// or rotation % 16\n }\n\n return (-rotation) & 7;// or (8 - rotation) % 8\n },\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: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][rotationFirst]\n ),\n\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: (rotationSecond: GD8Symmetry, rotationFirst: GD8Symmetry): GD8Symmetry => (\n rotationCayley[rotationSecond][groupD8.inv(rotationFirst)]\n ),\n\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: (rotation: number): number => rotation ^ 4,\n\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: (rotation: GD8Symmetry): boolean => (rotation & 3) === 2, // rotation % 4 === 2\n\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: (dx: number, dy: number): GD8Symmetry =>\n {\n if (Math.abs(dx) * 2 <= Math.abs(dy))\n {\n if (dy >= 0)\n {\n return groupD8.S;\n }\n\n return groupD8.N;\n }\n else if (Math.abs(dy) * 2 <= Math.abs(dx))\n {\n if (dx > 0)\n {\n return groupD8.E;\n }\n\n return groupD8.W;\n }\n else if (dy > 0)\n {\n if (dx > 0)\n {\n return groupD8.SE;\n }\n\n return groupD8.SW;\n }\n else if (dx > 0)\n {\n return groupD8.NE;\n }\n\n return groupD8.NW;\n },\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: (matrix: Matrix, rotation: GD8Symmetry, tx = 0, ty = 0): void =>\n {\n // Packer used \"rotation\", we use \"inv(rotation)\"\n const mat: Matrix = rotationMatrices[groupD8.inv(rotation)];\n\n mat.tx = tx;\n mat.ty = ty;\n matrix.append(mat);\n },\n};\n","import { ObservablePoint } from './ObservablePoint';\nimport { Matrix } from './Matrix';\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface Transform extends GlobalMixins.Transform {}\n\n/**\n * Transform that takes care about its versions.\n *\n * @memberof PIXI\n */\nexport class Transform\n{\n /** A default (identity) transform. */\n public static readonly IDENTITY = new Transform();\n\n /** The world transformation matrix. */\n public worldTransform: Matrix;\n\n /** The local transformation matrix. */\n public localTransform: Matrix;\n\n /** The coordinate of the object relative to the local coordinates of the parent. */\n public position: ObservablePoint;\n\n /** The scale factor of the object. */\n public scale: ObservablePoint;\n\n /** The pivot point of the displayObject that it rotates around. */\n public pivot: ObservablePoint;\n\n /** The skew amount, on the x and y axis. */\n public skew: ObservablePoint;\n\n /**\n * The locally unique ID of the parent's world transform\n * used to calculate the current world transformation matrix.\n */\n public _parentID: number;\n\n /** The locally unique ID of the world transform. */\n _worldID: number;\n\n /** The rotation amount. */\n protected _rotation: number;\n\n /**\n * The X-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _cx: number;\n\n /**\n * The Y-coordinate value of the normalized local X axis,\n * the first column of the local transformation matrix without a scale.\n */\n protected _sx: number;\n\n /**\n * The X-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _cy: number;\n\n /**\n * The Y-coordinate value of the normalized local Y axis,\n * the second column of the local transformation matrix without a scale.\n */\n protected _sy: number;\n\n /** The locally unique ID of the local transform. */\n protected _localID: number;\n\n /**\n * The locally unique ID of the local transform\n * used to calculate the current local transformation matrix.\n */\n protected _currentLocalID: number;\n\n constructor()\n {\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\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\n this._worldID = 0;\n this._parentID = 0;\n }\n\n /** Called when a value changes. */\n protected onChange(): void\n {\n this._localID++;\n }\n\n /** Called when the skew or the rotation changes. */\n protected updateSkew(): void\n {\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\n this._localID++;\n }\n\n // #if _DEBUG\n toString(): string\n {\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 // #endif\n\n /** Updates the local transformation matrix. */\n updateLocalTransform(): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\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\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\n // force an update..\n this._parentID = -1;\n }\n }\n\n /**\n * Updates the local and the world transformation matrices.\n *\n * @param parentTransform - The parent transform\n */\n updateTransform(parentTransform: Transform): void\n {\n const lt = this.localTransform;\n\n if (this._localID !== this._currentLocalID)\n {\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\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\n // force an update..\n this._parentID = -1;\n }\n\n if (this._parentID !== parentTransform._worldID)\n {\n // concat the parent matrix with the objects transform.\n const pt = parentTransform.worldTransform;\n const wt = this.worldTransform;\n\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\n this._parentID = parentTransform._worldID;\n\n // update the id of the transform..\n this._worldID++;\n }\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 setFromMatrix(matrix: Matrix): void\n {\n matrix.decompose(this);\n this._localID++;\n }\n\n /** The rotation of the object in radians. */\n get rotation(): number\n {\n return this._rotation;\n }\n\n set rotation(value: number)\n {\n if (this._rotation !== value)\n {\n this._rotation = value;\n this.updateSkew();\n }\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 */\n\nimport { parse as _parse, format as _format, resolve as _resolve } from 'url';\n\ninterface ParsedUrlQuery {\n [key: string]: string | string[];\n}\n\ninterface ParsedUrlQueryInput {\n [key: string]: unknown;\n}\n\ninterface UrlObjectCommon {\n auth?: string;\n hash?: string;\n host?: string;\n hostname?: string;\n href?: string;\n path?: string;\n pathname?: string;\n protocol?: string;\n search?: string;\n slashes?: boolean;\n}\n\n// Input to `url.format`\ninterface UrlObject extends UrlObjectCommon {\n port?: string | number;\n query?: string | null | ParsedUrlQueryInput;\n}\n\n// Output of `url.parse`\ninterface Url extends UrlObjectCommon {\n port?: string;\n query?: string | null | ParsedUrlQuery;\n}\n\ninterface UrlWithParsedQuery extends Url {\n query: ParsedUrlQuery;\n}\n\ninterface UrlWithStringQuery extends Url {\n query: string | null;\n}\n\ninterface URLFormatOptions {\n auth?: boolean;\n fragment?: boolean;\n search?: boolean;\n unicode?: boolean;\n}\n\ntype ParseFunction = {\n (urlStr: string): UrlWithStringQuery;\n (urlStr: string, parseQueryString: false | undefined, slashesDenoteHost?: boolean): UrlWithStringQuery;\n (urlStr: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;\n (urlStr: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;\n};\n\ntype FormatFunction = {\n (URL: URL, options?: URLFormatOptions): string;\n (urlObject: UrlObject | string): string;\n};\n\ntype ResolveFunction = {\n (from: string, to: string): string;\n};\n\nexport const url = {\n parse: _parse as ParseFunction,\n format: _format as FormatFunction,\n resolve: _resolve as ResolveFunction,\n};\n","let saidHello = false;\nconst VERSION = '$_VERSION';\n\n/**\n * Skips the hello message of renderers that are created after this is run.\n *\n * @function skipHello\n * @memberof PIXI.utils\n */\nexport function skipHello(): void\n{\n saidHello = true;\n}\n\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 */\nexport function sayHello(type: string): void\n{\n if (saidHello)\n {\n return;\n }\n\n if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1)\n {\n const args = [\n `\\n %c %c %c PixiJS ${VERSION} - ✰ ${type} ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \\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 ];\n\n self.console.log(...args);\n }\n else if (self.console)\n {\n self.console.log(`PixiJS ${VERSION} - ${type} - http://www.pixijs.com/`);\n }\n\n saidHello = true;\n}\n","import { settings } from '../settings';\n\nlet supported: boolean|undefined;\n\n/**\n * Helper for checking for WebGL support.\n *\n * @memberof PIXI.utils\n * @function isWebGLSupported\n * @return {boolean} Is WebGL supported.\n */\nexport function isWebGLSupported(): boolean\n{\n if (typeof supported === 'undefined')\n {\n supported = (function supported(): boolean\n {\n const contextOptions = {\n stencil: true,\n failIfMajorPerformanceCaveat: settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT,\n };\n\n try\n {\n if (!self.WebGLRenderingContext)\n {\n return false;\n }\n\n const canvas = document.createElement('canvas');\n let gl = (\n canvas.getContext('webgl', contextOptions)\n || canvas.getContext('experimental-webgl', contextOptions)\n ) as WebGLRenderingContext;\n\n const success = !!(gl && gl.getContextAttributes().stencil);\n\n if (gl)\n {\n const loseContext = gl.getExtension('WEBGL_lose_context');\n\n if (loseContext)\n {\n loseContext.loseContext();\n }\n }\n\n gl = null;\n\n return success;\n }\n catch (e)\n {\n return false;\n }\n })();\n }\n\n return supported;\n}\n","import { default as cssColorNames } from 'css-color-names';\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 */\nexport function hex2rgb(hex: number, out: Array | Float32Array = []): Array | Float32Array\n{\n out[0] = ((hex >> 16) & 0xFF) / 255;\n out[1] = ((hex >> 8) & 0xFF) / 255;\n out[2] = (hex & 0xFF) / 255;\n\n return out;\n}\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 */\nexport function hex2string(hex: number): string\n{\n let hexString = hex.toString(16);\n\n hexString = '000000'.substr(0, 6 - hexString.length) + hexString;\n\n return `#${hexString}`;\n}\n\n/**\n * Converts a string to a hexadecimal color number.\n * It can handle:\n * hex strings starting with #: \"#ffffff\"\n * hex strings starting with 0x: \"0xffffff\"\n * hex strings without prefix: \"ffffff\"\n * css colors: \"black\"\n *\n * @example\n * PIXI.utils.string2hex(\"#ffffff\"); // returns 0xffffff\n * @memberof PIXI.utils\n * @function string2hex\n * @param {string} string - The string color (e.g., `\"#ffffff\"`)\n * @return {number} Number in hexadecimal.\n */\nexport function string2hex(string: string): number\n{\n if (typeof string === 'string')\n {\n string = (cssColorNames as {[key: string]: string})[string.toLowerCase()] || string;\n\n if (string[0] === '#')\n {\n string = string.substr(1);\n }\n }\n\n return parseInt(string, 16);\n}\n\n/**\n * Converts a color as an [R, G, B] array of normalized floats to a hexadecimal number.\n *\n * @example\n * PIXI.utils.rgb2hex([1, 1, 1]); // returns 0xffffff\n * @memberof PIXI.utils\n * @function rgb2hex\n * @param {number[]} rgb - Array of numbers where all values are normalized floats from 0.0 to 1.0.\n * @return {number} Number in hexadecimal.\n */\nexport function rgb2hex(rgb: number[] | Float32Array): number\n{\n return (((rgb[0] * 255) << 16) + ((rgb[1] * 255) << 8) + (rgb[2] * 255 | 0));\n}\n","import { BLEND_MODES } from '@pixi/constants';\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(): number[][]\n{\n const pm = [];\n const npm = [];\n\n for (let i = 0; i < 32; i++)\n {\n pm[i] = i;\n npm[i] = i;\n }\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\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\n const array: number[][] = [];\n\n array.push(npm);\n array.push(pm);\n\n return array;\n}\n\n/**\n * maps premultiply flag and blendMode to adjusted blendMode\n * @memberof PIXI.utils\n * @const premultiplyBlendMode\n * @type {Array}\n */\nexport const premultiplyBlendMode = mapPremultipliedBlendModes();\n\n/**\n * changes blendMode according to texture format\n *\n * @memberof PIXI.utils\n * @function correctBlendMode\n * @param {number} blendMode - supposed blend mode\n * @param {boolean} premultiplied - whether source is premultiplied\n * @returns {number} true blend mode for this texture\n */\nexport function correctBlendMode(blendMode: number, premultiplied: boolean): number\n{\n return premultiplyBlendMode[premultiplied ? 1 : 0][blendMode];\n}\n\n/**\n * combines rgb and alpha to out array\n *\n * @memberof PIXI.utils\n * @function premultiplyRgba\n * @param {Float32Array|number[]} rgb - input rgb\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyRgba(\n rgb: Float32Array|number[],\n alpha: number,\n out?: Float32Array,\n premultiply?: boolean\n): Float32Array\n{\n out = out || new Float32Array(4);\n if (premultiply || premultiply === undefined)\n {\n out[0] = rgb[0] * alpha;\n out[1] = rgb[1] * alpha;\n out[2] = rgb[2] * alpha;\n }\n else\n {\n out[0] = rgb[0];\n out[1] = rgb[1];\n out[2] = rgb[2];\n }\n out[3] = alpha;\n\n return out;\n}\n\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 */\nexport function premultiplyTint(tint: number, alpha: number): number\n{\n if (alpha === 1.0)\n {\n return (alpha * 255 << 24) + tint;\n }\n if (alpha === 0.0)\n {\n return 0;\n }\n let R = ((tint >> 16) & 0xFF);\n let G = ((tint >> 8) & 0xFF);\n let B = (tint & 0xFF);\n\n R = ((R * alpha) + 0.5) | 0;\n G = ((G * alpha) + 0.5) | 0;\n B = ((B * alpha) + 0.5) | 0;\n\n return (alpha * 255 << 24) + (R << 16) + (G << 8) + B;\n}\n\n/**\n * converts integer tint and float alpha to vec4 form, premultiplies by default\n *\n * @memberof PIXI.utils\n * @function premultiplyTintToRgba\n * @param {number} tint - input tint\n * @param {number} alpha - alpha param\n * @param {Float32Array} [out] - output\n * @param {boolean} [premultiply=true] - do premultiply it\n * @returns {Float32Array} vec4 rgba\n */\nexport function premultiplyTintToRgba(tint: number, alpha: number, out: Float32Array, premultiply?: boolean): Float32Array\n{\n out = out || new Float32Array(4);\n out[0] = ((tint >> 16) & 0xFF) / 255.0;\n out[1] = ((tint >> 8) & 0xFF) / 255.0;\n out[2] = (tint & 0xFF) / 255.0;\n if (premultiply || premultiply === undefined)\n {\n out[0] *= alpha;\n out[1] *= alpha;\n out[2] *= alpha;\n }\n out[3] = alpha;\n\n return out;\n}\n","/**\n * Generic Mask Stack data structure\n *\n * @memberof PIXI.utils\n * @function createIndicesForQuads\n * @param {number} size - Number of quads\n * @param {Uint16Array|Uint32Array} [outBuffer] - Buffer for output, length has to be `6 * size`\n * @return {Uint16Array|Uint32Array} - Resulting index buffer\n */\nexport function createIndicesForQuads(size: number, outBuffer: Uint16Array|Uint32Array = null): Uint16Array|Uint32Array\n{\n // the total number of indices in our array, there are 6 points per quad.\n const totalIndices = size * 6;\n\n outBuffer = outBuffer || new Uint16Array(totalIndices);\n\n if (outBuffer.length !== totalIndices)\n {\n throw new Error(`Out buffer length is incorrect, got ${outBuffer.length} and expected ${totalIndices}`);\n }\n\n // fill the indices with the quads to draw\n for (let i = 0, j = 0; i < totalIndices; i += 6, j += 4)\n {\n outBuffer[i + 0] = j + 0;\n outBuffer[i + 1] = j + 1;\n outBuffer[i + 2] = j + 2;\n outBuffer[i + 3] = j + 0;\n outBuffer[i + 4] = j + 2;\n outBuffer[i + 5] = j + 3;\n }\n\n return outBuffer;\n}\n","import type { ITypedArray } from '@pixi/core';\n\nexport function getBufferType(array: ITypedArray): 'Float32Array'|'Uint32Array'|'Int32Array'|'Uint16Array'|'Uint8Array'|null\n{\n if (array.BYTES_PER_ELEMENT === 4)\n {\n if (array instanceof Float32Array)\n {\n return 'Float32Array';\n }\n else if (array instanceof Uint32Array)\n {\n return 'Uint32Array';\n }\n\n return 'Int32Array';\n }\n else if (array.BYTES_PER_ELEMENT === 2)\n {\n if (array instanceof Uint16Array)\n {\n return 'Uint16Array';\n }\n }\n else if (array.BYTES_PER_ELEMENT === 1)\n {\n if (array instanceof Uint8Array)\n {\n return 'Uint8Array';\n }\n }\n\n // TODO map out the rest of the array elements!\n return null;\n}\n","import { getBufferType } from './getBufferType';\n\n/* eslint-disable object-shorthand */\nconst map = { Float32Array: Float32Array, Uint32Array: Uint32Array, Int32Array: Int32Array, Uint8Array: Uint8Array };\n\ntype PackedArray = Float32Array|Uint32Array|Int32Array|Uint8Array;\n\nexport function interleaveTypedArrays(arrays: PackedArray[], sizes: number[]): Float32Array\n{\n let outSize = 0;\n let stride = 0;\n const views: {[key: string]: PackedArray} = {};\n\n for (let i = 0; i < arrays.length; i++)\n {\n stride += sizes[i];\n outSize += arrays[i].length;\n }\n\n const buffer = new ArrayBuffer(outSize * 4);\n\n let out = null;\n let littleOffset = 0;\n\n for (let i = 0; i < arrays.length; i++)\n {\n const size = sizes[i];\n const array = arrays[i];\n\n /*\n @todo This is unsafe casting but consistent with how the code worked previously. Should it stay this way\n or should and `getBufferTypeUnsafe` function be exposed that throws an Error if unsupported type is passed?\n */\n const type = getBufferType(array) as keyof typeof map;\n\n if (!views[type])\n {\n views[type] = new map[type](buffer);\n }\n\n out = views[type];\n\n for (let j = 0; j < array.length; j++)\n {\n const indexStart = ((j / size | 0) * stride) + littleOffset;\n const index = j % size;\n\n out[indexStart + index] = array[j];\n }\n\n littleOffset += size;\n }\n\n return new Float32Array(buffer);\n}\n","// Taken from the bit-twiddle package\n\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 */\nexport function nextPow2(v: number): number\n{\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\n return v + 1;\n}\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 */\nexport function isPow2(v: number): boolean\n{\n return !(v & (v - 1)) && (!!v);\n}\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 */\nexport function log2(v: number): number\n{\n let r = (v > 0xFFFF ? 1 : 0) << 4;\n\n v >>>= r;\n\n let shift = (v > 0xFF ? 1 : 0) << 3;\n\n v >>>= shift; r |= shift;\n shift = (v > 0xF ? 1 : 0) << 2;\n v >>>= shift; r |= shift;\n shift = (v > 0x3 ? 1 : 0) << 1;\n v >>>= shift; r |= shift;\n\n return r | (v >> 1);\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 */\nexport function removeItems(arr: any[], startIdx: number, removeCount: number): void\n{\n const length = arr.length;\n let i;\n\n if (startIdx >= length || removeCount === 0)\n {\n return;\n }\n\n removeCount = (startIdx + removeCount > length ? length - startIdx : removeCount);\n\n const len = length - removeCount;\n\n for (i = startIdx; i < len; ++i)\n {\n arr[i] = arr[i + removeCount];\n }\n\n arr.length = len;\n}\n","/**\n * Returns sign of number\n *\n * @memberof PIXI.utils\n * @function sign\n * @param {number} n - the number to check the sign of\n * @returns {number} 0 if `n` is 0, -1 if `n` is negative, 1 if `n` is positive\n */\nexport function sign(n: number): -1|0|1\n{\n if (n === 0) return 0;\n\n return n < 0 ? -1 : 1;\n}\n","let nextUid = 0;\n\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 */\nexport function uid(): number\n{\n return ++nextUid;\n}\n","import type { Dict } from '../types';\n\n// A map of warning messages already fired\nconst warnings: Dict = {};\n\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 */\nexport function deprecation(version: string, message: string, ignoreDepth = 3): void\n{\n // Ignore duplicat\n if (warnings[message])\n {\n return;\n }\n\n /* eslint-disable no-console */\n let stack = new Error().stack;\n\n // Handle IE < 10 and Safari < 6\n if (typeof stack === 'undefined')\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n }\n else\n {\n // chop off the stack trace which includes PixiJS internal calls\n stack = stack.split('\\n').splice(ignoreDepth).join('\\n');\n\n if (console.groupCollapsed)\n {\n console.groupCollapsed(\n '%cPixiJS Deprecation Warning: %c%s',\n 'color:#614108;background:#fffbe6',\n 'font-weight:normal;color:#614108;background:#fffbe6',\n `${message}\\nDeprecated since v${version}`\n );\n console.warn(stack);\n console.groupEnd();\n }\n else\n {\n console.warn('PixiJS Deprecation Warning: ', `${message}\\nDeprecated since v${version}`);\n console.warn(stack);\n }\n }\n /* eslint-enable no-console */\n\n warnings[message] = true;\n}\n","import type { Program, Texture, BaseTexture } from '@pixi/core';\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name ProgramCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const ProgramCache: {[key: string]: Program} = {};\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name TextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const TextureCache: {[key: string]: Texture} = Object.create(null);\n\n/**\n * @todo Describe property usage\n *\n * @static\n * @name BaseTextureCache\n * @memberof PIXI.utils\n * @type {Object}\n */\nexport const BaseTextureCache: {[key: string]: BaseTexture} = Object.create(null);\n\n/**\n * Destroys all texture in the cache\n *\n * @memberof PIXI.utils\n * @function destroyTextureCache\n */\nexport function destroyTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n TextureCache[key].destroy();\n }\n for (key in BaseTextureCache)\n {\n BaseTextureCache[key].destroy();\n }\n}\n\n/**\n * Removes all textures from cache, but does not destroy them\n *\n * @memberof PIXI.utils\n * @function clearTextureCache\n */\nexport function clearTextureCache(): void\n{\n let key;\n\n for (key in TextureCache)\n {\n delete TextureCache[key];\n }\n for (key in BaseTextureCache)\n {\n delete BaseTextureCache[key];\n }\n}\n","import { settings } from '@pixi/settings';\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 */\nexport class CanvasRenderTarget\n{\n /** The Canvas object that belongs to this CanvasRenderTarget. */\n public canvas: HTMLCanvasElement;\n\n /** A CanvasRenderingContext2D object representing a two-dimensional rendering context. */\n public context: CanvasRenderingContext2D;\n\n /**\n * The resolution / device pixel ratio of the canvas\n * @default 1\n */\n public resolution: number;\n\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 constructor(width: number, height: number, resolution?: number)\n {\n this.canvas = document.createElement('canvas');\n\n this.context = this.canvas.getContext('2d');\n\n this.resolution = resolution || settings.RESOLUTION;\n\n this.resize(width, height);\n }\n\n /**\n * Clears the canvas that was created by the CanvasRenderTarget class.\n *\n * @private\n */\n clear(): void\n {\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 /**\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 resize(desiredWidth: number, desiredHeight: number): void\n {\n this.canvas.width = Math.round(desiredWidth * this.resolution);\n this.canvas.height = Math.round(desiredHeight * this.resolution);\n }\n\n /** Destroys this canvas. */\n destroy(): void\n {\n this.context = null;\n this.canvas = null;\n }\n\n /**\n * The width of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get width(): number\n {\n return this.canvas.width;\n }\n\n set width(val: number)\n {\n this.canvas.width = Math.round(val);\n }\n\n /**\n * The height of the canvas buffer in pixels.\n *\n * @member {number}\n */\n get height(): number\n {\n return this.canvas.height;\n }\n\n set height(val: number)\n {\n this.canvas.height = Math.round(val);\n }\n}\n","interface Inset {\n top?: number;\n left?: number;\n right?: number;\n bottom?: number;\n}\n\n/**\n * Trim transparent borders from a canvas\n *\n * @memberof PIXI.utils\n * @function trimCanvas\n * @param {HTMLCanvasElement} canvas - the canvas to trim\n * @returns {object} Trim data\n */\nexport function trimCanvas(canvas: HTMLCanvasElement): {width: number; height: number; data?: ImageData}\n{\n // https://gist.github.com/remy/784508\n\n let width = canvas.width;\n let height = canvas.height;\n\n const context = canvas.getContext('2d');\n const imageData = context.getImageData(0, 0, width, height);\n const pixels = imageData.data;\n const len = pixels.length;\n\n const bound: Inset = {\n top: null,\n left: null,\n right: null,\n bottom: null,\n };\n let data = null;\n let i;\n let x;\n let y;\n\n for (i = 0; i < len; i += 4)\n {\n if (pixels[i + 3] !== 0)\n {\n x = (i / 4) % width;\n y = ~~((i / 4) / width);\n\n if (bound.top === null)\n {\n bound.top = y;\n }\n\n if (bound.left === null)\n {\n bound.left = x;\n }\n else if (x < bound.left)\n {\n bound.left = x;\n }\n\n if (bound.right === null)\n {\n bound.right = x + 1;\n }\n else if (bound.right < x)\n {\n bound.right = x + 1;\n }\n\n if (bound.bottom === null)\n {\n bound.bottom = y;\n }\n else if (bound.bottom < y)\n {\n bound.bottom = y;\n }\n }\n }\n\n if (bound.top !== null)\n {\n width = bound.right - bound.left;\n height = bound.bottom - bound.top + 1;\n data = context.getImageData(bound.left, bound.top, width, height);\n }\n\n return {\n height,\n width,\n data,\n };\n}\n","import { url as _url } from '../url';\n\nlet tempAnchor: HTMLAnchorElement|undefined;\n\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 */\nexport function determineCrossOrigin(url: string, loc: Location = self.location): string\n{\n // data: and javascript: urls are considered same-origin\n if (url.indexOf('data:') === 0)\n {\n return '';\n }\n\n // default is window.location\n loc = loc || self.location;\n\n if (!tempAnchor)\n {\n tempAnchor = document.createElement('a');\n }\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;\n const parsedUrl = _url.parse(tempAnchor.href);\n\n const samePort = (!parsedUrl.port && loc.port === '') || (parsedUrl.port === loc.port);\n\n // if cross origin\n if (parsedUrl.hostname !== loc.hostname || !samePort || parsedUrl.protocol !== loc.protocol)\n {\n return 'anonymous';\n }\n\n return '';\n}\n","import { DATA_URI } from '../const';\n\nexport interface DecomposedDataUri {\n mediaType: string;\n subType: string;\n charset: string;\n encoding: string;\n data: string;\n}\n\n/**\n * @memberof PIXI.utils\n * @interface DecomposedDataUri\n */\n\n/**\n * type, eg. `image`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} mediaType\n */\n\n/**\n * Sub type, eg. `png`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} subType\n */\n\n/**\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} charset\n */\n\n/**\n * Data encoding, eg. `base64`\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} encoding\n */\n\n/**\n * The actual data\n * @memberof PIXI.utils.DecomposedDataUri#\n * @member {string} data\n */\n\n/**\n * Split a data URI into components. Returns undefined if\n * parameter `dataUri` is not a valid data URI.\n *\n * @memberof PIXI.utils\n * @function decomposeDataUri\n * @param {string} dataUri - the data URI to check\n * @return {PIXI.utils.DecomposedDataUri|undefined} The decomposed data uri or undefined\n */\nexport function decomposeDataUri(dataUri: string): DecomposedDataUri\n{\n const dataUriMatch = DATA_URI.exec(dataUri);\n\n if (dataUriMatch)\n {\n return {\n mediaType: dataUriMatch[1] ? dataUriMatch[1].toLowerCase() : undefined,\n subType: dataUriMatch[2] ? dataUriMatch[2].toLowerCase() : undefined,\n charset: dataUriMatch[3] ? dataUriMatch[3].toLowerCase() : undefined,\n encoding: dataUriMatch[4] ? dataUriMatch[4].toLowerCase() : undefined,\n data: dataUriMatch[5],\n };\n }\n\n return undefined;\n}\n","import { settings } from '../settings';\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 */\nexport function getResolutionOfUrl(url: string, defaultValue?: number): number\n{\n const resolution = settings.RETINA_PREFIX.exec(url);\n\n if (resolution)\n {\n return parseFloat(resolution[1]);\n }\n\n return defaultValue !== undefined ? defaultValue : 1;\n}\n","var appleIphone = /iPhone/i;\nvar appleIpod = /iPod/i;\nvar appleTablet = /iPad/i;\nvar appleUniversal = /\\biOS-universal(?:.+)Mac\\b/i;\nvar androidPhone = /\\bAndroid(?:.+)Mobile\\b/i;\nvar androidTablet = /Android/i;\nvar amazonPhone = /(?:SD4930UR|\\bSilk(?:.+)Mobile\\b)/i;\nvar amazonTablet = /Silk/i;\nvar windowsPhone = /Windows Phone/i;\nvar windowsTablet = /\\bWindows(?:.+)ARM\\b/i;\nvar otherBlackBerry = /BlackBerry/i;\nvar otherBlackBerry10 = /BB10/i;\nvar otherOpera = /Opera Mini/i;\nvar otherChrome = /\\b(CriOS|Chrome)(?:.+)Mobile/i;\nvar otherFirefox = /Mobile(?:.+)Firefox\\b/i;\nvar isAppleTabletOnIos13 = function (navigator) {\n return (typeof navigator !== 'undefined' &&\n navigator.platform === 'MacIntel' &&\n typeof navigator.maxTouchPoints === 'number' &&\n navigator.maxTouchPoints > 1 &&\n typeof MSStream === 'undefined');\n};\nfunction createMatch(userAgent) {\n return function (regex) { return regex.test(userAgent); };\n}\nexport default function isMobile(param) {\n var nav = {\n userAgent: '',\n platform: '',\n maxTouchPoints: 0\n };\n if (!param && typeof navigator !== 'undefined') {\n nav = {\n userAgent: navigator.userAgent,\n platform: navigator.platform,\n maxTouchPoints: navigator.maxTouchPoints || 0\n };\n }\n else if (typeof param === 'string') {\n nav.userAgent = param;\n }\n else if (param && param.userAgent) {\n nav = {\n userAgent: param.userAgent,\n platform: param.platform,\n maxTouchPoints: param.maxTouchPoints || 0\n };\n }\n var userAgent = nav.userAgent;\n var tmp = userAgent.split('[FBAN');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n tmp = userAgent.split('Twitter');\n if (typeof tmp[1] !== 'undefined') {\n userAgent = tmp[0];\n }\n var match = createMatch(userAgent);\n var result = {\n apple: {\n phone: match(appleIphone) && !match(windowsPhone),\n ipod: match(appleIpod),\n tablet: !match(appleIphone) &&\n (match(appleTablet) || isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone),\n universal: match(appleUniversal),\n device: (match(appleIphone) ||\n match(appleIpod) ||\n match(appleTablet) ||\n match(appleUniversal) ||\n isAppleTabletOnIos13(nav)) &&\n !match(windowsPhone)\n },\n amazon: {\n phone: match(amazonPhone),\n tablet: !match(amazonPhone) && match(amazonTablet),\n device: match(amazonPhone) || match(amazonTablet)\n },\n android: {\n phone: (!match(windowsPhone) && match(amazonPhone)) ||\n (!match(windowsPhone) && match(androidPhone)),\n tablet: !match(windowsPhone) &&\n !match(amazonPhone) &&\n !match(androidPhone) &&\n (match(amazonTablet) || match(androidTablet)),\n device: (!match(windowsPhone) &&\n (match(amazonPhone) ||\n match(amazonTablet) ||\n match(androidPhone) ||\n match(androidTablet))) ||\n match(/\\bokhttp\\b/i)\n },\n windows: {\n phone: match(windowsPhone),\n tablet: match(windowsTablet),\n device: match(windowsPhone) || match(windowsTablet)\n },\n other: {\n blackberry: match(otherBlackBerry),\n blackberry10: match(otherBlackBerry10),\n opera: match(otherOpera),\n firefox: match(otherFirefox),\n chrome: match(otherChrome),\n device: match(otherBlackBerry) ||\n match(otherBlackBerry10) ||\n match(otherOpera) ||\n match(otherFirefox) ||\n match(otherChrome)\n },\n any: false,\n phone: false,\n tablet: false\n };\n result.any =\n result.apple.device ||\n result.android.device ||\n result.windows.device ||\n result.other.device;\n result.phone =\n result.apple.phone || result.android.phone || result.windows.phone;\n result.tablet =\n result.apple.tablet || result.android.tablet || result.windows.tablet;\n return result;\n}\n//# sourceMappingURL=isMobile.js.map","/*!\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","// The ESM/CJS versions of ismobilejs only\n// exports the function for executing\n// designed for Node-only environments\nimport isMobileCall from 'ismobilejs';\nimport type { isMobileResult } from 'ismobilejs';\n\nconst isMobile: isMobileResult = isMobileCall(self.navigator);\n\nexport { isMobile };\n","import { isMobile } from './isMobile';\n\n/**\n * The maximum recommended texture units to use.\n * In theory the bigger the better, and for desktop we'll use as many as we can.\n * But some mobile devices slow down if there is to many branches in the shader.\n * So in practice there seems to be a sweet spot size that varies depending on the device.\n *\n * In v4, all mobile devices were limited to 4 texture units because for this.\n * In v5, we allow all texture units to be used on modern Apple or Android devices.\n *\n * @private\n * @param {number} max\n * @returns {number}\n */\nexport function maxRecommendedTextures(max: number): number\n{\n let allowMax = true;\n\n if (isMobile.tablet || isMobile.phone)\n {\n if (isMobile.apple.device)\n {\n const match = (navigator.userAgent).match(/OS (\\d+)_(\\d+)?/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below iOS 11, which will be older hardware\n if (majorVersion < 11)\n {\n allowMax = false;\n }\n }\n }\n if (isMobile.android.device)\n {\n const match = (navigator.userAgent).match(/Android\\s([0-9.]*)/);\n\n if (match)\n {\n const majorVersion = parseInt(match[1], 10);\n\n // Limit texture units on devices below Android 7 (Nougat), which will be older hardware\n if (majorVersion < 7)\n {\n allowMax = false;\n }\n }\n }\n }\n\n return allowMax ? max : 4;\n}\n","import { isMobile } from './isMobile';\n\n/**\n * Uploading the same buffer multiple times in a single frame can cause performance issues.\n * Apparent on iOS so only check for that at the moment\n * This check may become more complex if this issue pops up elsewhere.\n *\n * @private\n * @returns {boolean}\n */\nexport function canUploadSameBuffer(): boolean\n{\n return !isMobile.apple.device;\n}\n","import { Rectangle } from '@pixi/math';\n\nimport type { IPointData, Transform, Matrix } from '@pixi/math';\n\n/**\n * 'Builder' pattern for bounds rectangles.\n *\n * This could be called an Axis-Aligned Bounding Box.\n * It is not an actual shape. It is a mutable thing; no 'EMPTY' or those kind of problems.\n *\n * @class\n * @memberof PIXI\n */\nexport class Bounds\n{\n public minX: number;\n public minY: number;\n public maxX: number;\n public maxY: number;\n public rect: Rectangle;\n public updateID: number;\n\n constructor()\n {\n /**\n * @member {number}\n * @default 0\n */\n this.minX = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.minY = Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxX = -Infinity;\n\n /**\n * @member {number}\n * @default 0\n */\n this.maxY = -Infinity;\n\n this.rect = null;\n\n /**\n * It is updated to _boundsID of corresponding object to keep bounds in sync with content.\n * Updated from outside, thus public modifier.\n *\n * @member {number}\n * @public\n */\n this.updateID = -1;\n }\n\n /**\n * Checks if bounds are empty.\n *\n * @return {boolean} True if empty.\n */\n isEmpty(): boolean\n {\n return this.minX > this.maxX || this.minY > this.maxY;\n }\n\n /**\n * Clears the bounds and resets.\n *\n */\n clear(): void\n {\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n }\n\n /**\n * Can return Rectangle.EMPTY constant, either construct new rectangle, either use your rectangle\n * It is not guaranteed that it will return tempRect\n *\n * @param {PIXI.Rectangle} rect - temporary object will be used if AABB is not empty\n * @returns {PIXI.Rectangle} A rectangle of the bounds\n */\n getRectangle(rect?: Rectangle): Rectangle\n {\n if (this.minX > this.maxX || this.minY > this.maxY)\n {\n return Rectangle.EMPTY;\n }\n\n rect = rect || new Rectangle(0, 0, 1, 1);\n\n rect.x = this.minX;\n rect.y = this.minY;\n rect.width = this.maxX - this.minX;\n rect.height = this.maxY - this.minY;\n\n return rect;\n }\n\n /**\n * This function should be inlined when its possible.\n *\n * @param {PIXI.IPointData} point - The point to add.\n */\n addPoint(point: IPointData): void\n {\n this.minX = Math.min(this.minX, point.x);\n this.maxX = Math.max(this.maxX, point.x);\n this.minY = Math.min(this.minY, point.y);\n this.maxY = Math.max(this.maxY, point.y);\n }\n\n /**\n * Adds a point, after transformed. This should be inlined when its possible.\n *\n * @param matrix\n * @param point\n */\n addPointMatrix(matrix: Matrix, point: IPointData): void\n {\n const { a, b, c, d, tx, ty } = matrix;\n\n const x = (a * point.x) + (c * point.y) + tx;\n const y = (b * point.x) + (d * point.y) + ty;\n\n this.minX = Math.min(this.minX, x);\n this.maxX = Math.max(this.maxX, x);\n this.minY = Math.min(this.minY, y);\n this.maxY = Math.max(this.maxY, y);\n }\n\n /**\n * Adds a quad, not transformed\n *\n * @param {Float32Array} vertices - The verts to add.\n */\n addQuad(vertices: Float32Array): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = vertices[0];\n let y = vertices[1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[2];\n y = vertices[3];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[4];\n y = vertices[5];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = vertices[6];\n y = vertices[7];\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds sprite frame, transformed.\n *\n * @param {PIXI.Transform} transform - transform to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrame(transform: Transform, x0: number, y0: number, x1: number, y1: number): void\n {\n this.addFrameMatrix(transform.worldTransform, x0, y0, x1, y1);\n }\n\n /**\n * Adds sprite frame, multiplied by matrix\n *\n * @param {PIXI.Matrix} matrix - matrix to apply\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n */\n addFrameMatrix(matrix: Matrix, x0: number, y0: number, x1: number, y1: number): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n let x = (a * x0) + (c * y0) + tx;\n let y = (b * x0) + (d * y0) + ty;\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y0) + tx;\n y = (b * x1) + (d * y0) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x0) + (c * y1) + tx;\n y = (b * x0) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n x = (a * x1) + (c * y1) + tx;\n y = (b * x1) + (d * y1) + ty;\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds screen vertices from array\n *\n * @param {Float32Array} vertexData - calculated vertices\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertexData(vertexData: Float32Array, beginOffset: number, endOffset: number): void\n {\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const x = vertexData[i];\n const y = vertexData[i + 1];\n\n minX = x < minX ? x : minX;\n minY = y < minY ? y : minY;\n maxX = x > maxX ? x : maxX;\n maxY = y > maxY ? y : maxY;\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Add an array of mesh vertices\n *\n * @param {PIXI.Transform} transform - mesh transform\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n */\n addVertices(transform: Transform, vertices: Float32Array, beginOffset: number, endOffset: number): void\n {\n this.addVerticesMatrix(transform.worldTransform, vertices, beginOffset, endOffset);\n }\n\n /**\n * Add an array of mesh vertices.\n *\n * @param {PIXI.Matrix} matrix - mesh matrix\n * @param {Float32Array} vertices - mesh coordinates in array\n * @param {number} beginOffset - begin offset\n * @param {number} endOffset - end offset, excluded\n * @param {number} [padX=0] - x padding\n * @param {number} [padY=0] - y padding\n */\n addVerticesMatrix(matrix: Matrix, vertices: Float32Array, beginOffset: number,\n endOffset: number, padX = 0, padY = padX): void\n {\n const a = matrix.a;\n const b = matrix.b;\n const c = matrix.c;\n const d = matrix.d;\n const tx = matrix.tx;\n const ty = matrix.ty;\n\n let minX = this.minX;\n let minY = this.minY;\n let maxX = this.maxX;\n let maxY = this.maxY;\n\n for (let i = beginOffset; i < endOffset; i += 2)\n {\n const rawX = vertices[i];\n const rawY = vertices[i + 1];\n const x = (a * rawX) + (c * rawY) + tx;\n const y = (d * rawY) + (b * rawX) + ty;\n\n minX = Math.min(minX, x - padX);\n maxX = Math.max(maxX, x + padX);\n minY = Math.min(minY, y - padY);\n maxY = Math.max(maxY, y + padY);\n }\n\n this.minX = minX;\n this.minY = minY;\n this.maxX = maxX;\n this.maxY = maxY;\n }\n\n /**\n * Adds other Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added\n */\n addBounds(bounds: Bounds): void\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = bounds.minX < minX ? bounds.minX : minX;\n this.minY = bounds.minY < minY ? bounds.minY : minY;\n this.maxX = bounds.maxX > maxX ? bounds.maxX : maxX;\n this.maxY = bounds.maxY > maxY ? bounds.maxY : maxY;\n }\n\n /**\n * Adds other Bounds, masked with Bounds.\n *\n * @param {PIXI.Bounds} bounds - The Bounds to be added.\n * @param {PIXI.Bounds} mask - TODO\n */\n addBoundsMask(bounds: Bounds, mask: Bounds): void\n {\n const _minX = bounds.minX > mask.minX ? bounds.minX : mask.minX;\n const _minY = bounds.minY > mask.minY ? bounds.minY : mask.minY;\n const _maxX = bounds.maxX < mask.maxX ? bounds.maxX : mask.maxX;\n const _maxY = bounds.maxY < mask.maxY ? bounds.maxY : mask.maxY;\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Adds other Bounds, multiplied by matrix. Bounds shouldn't be empty.\n *\n * @param {PIXI.Bounds} bounds - other bounds\n * @param {PIXI.Matrix} matrix - multiplicator\n */\n addBoundsMatrix(bounds: Bounds, matrix: Matrix): void\n {\n this.addFrameMatrix(matrix, bounds.minX, bounds.minY, bounds.maxX, bounds.maxY);\n }\n\n /**\n * Adds other Bounds, masked with Rectangle.\n *\n * @param {PIXI.Bounds} bounds - TODO\n * @param {PIXI.Rectangle} area - TODO\n */\n addBoundsArea(bounds: Bounds, area: Rectangle): void\n {\n const _minX = bounds.minX > area.x ? bounds.minX : area.x;\n const _minY = bounds.minY > area.y ? bounds.minY : area.y;\n const _maxX = bounds.maxX < area.x + area.width ? bounds.maxX : (area.x + area.width);\n const _maxY = bounds.maxY < area.y + area.height ? bounds.maxY : (area.y + area.height);\n\n if (_minX <= _maxX && _minY <= _maxY)\n {\n const minX = this.minX;\n const minY = this.minY;\n const maxX = this.maxX;\n const maxY = this.maxY;\n\n this.minX = _minX < minX ? _minX : minX;\n this.minY = _minY < minY ? _minY : minY;\n this.maxX = _maxX > maxX ? _maxX : maxX;\n this.maxY = _maxY > maxY ? _maxY : maxY;\n }\n }\n\n /**\n * Pads bounds object, making it grow in all directions.\n * If paddingY is omitted, both paddingX and paddingY will be set to paddingX.\n *\n * @param {number} [paddingX=0] - The horizontal padding amount.\n * @param {number} [paddingY=0] - The vertical padding amount.\n */\n pad(paddingX = 0, paddingY = paddingX): void\n {\n if (!this.isEmpty())\n {\n this.minX -= paddingX;\n this.maxX += paddingX;\n this.minY -= paddingY;\n this.maxY += paddingY;\n }\n }\n\n /**\n * Adds padded frame. (x0, y0) should be strictly less than (x1, y1)\n *\n * @param {number} x0 - left X of frame\n * @param {number} y0 - top Y of frame\n * @param {number} x1 - right X of frame\n * @param {number} y1 - bottom Y of frame\n * @param {number} padX - padding X\n * @param {number} padY - padding Y\n */\n addFramePad(x0: number, y0: number, x1: number, y1: number, padX: number, padY: number): void\n {\n x0 -= padX;\n y0 -= padY;\n x1 += padX;\n y1 += padY;\n\n this.minX = this.minX < x0 ? this.minX : x0;\n this.maxX = this.maxX > x1 ? this.maxX : x1;\n this.minY = this.minY < y0 ? this.minY : y0;\n this.maxY = this.maxY > y1 ? this.maxY : y1;\n }\n}\n","import { DEG_TO_RAD, Matrix, Point, RAD_TO_DEG, Rectangle, Transform } from '@pixi/math';\nimport { EventEmitter } from '@pixi/utils';\nimport { Bounds } from './Bounds';\n\nimport type { Container } from './Container';\nimport type { Filter, MaskData, Renderer } from '@pixi/core';\nimport type { IPointData, ObservablePoint } from '@pixi/math';\nimport type { Dict } from '@pixi/utils';\n\nexport interface IDestroyOptions {\n children?: boolean;\n texture?: boolean;\n baseTexture?: boolean;\n}\n\nexport interface DisplayObject extends Omit, EventEmitter {}\n\n/**\n * The base class for all objects that are rendered on the screen.\n *\n * This is an abstract class and can not be used on its own; rather it should be extended.\n *\n * ## Display objects implemented in PixiJS\n *\n * | Display Object | Description |\n * | ------------------------------- | --------------------------------------------------------------------- |\n * | {@link PIXI.Container} | Adds support for `children` to DisplayObject |\n * | {@link PIXI.Graphics} | Shape-drawing display object similar to the Canvas API |\n * | {@link PIXI.Sprite} | Draws textures (i.e. images) |\n * | {@link PIXI.Text} | Draws text using the Canvas API internally |\n * | {@link PIXI.BitmapText} | More scaleable solution for text rendering, reusing glyph textures |\n * | {@link PIXI.TilingSprite} | Draws textures/images in a tiled fashion |\n * | {@link PIXI.AnimatedSprite} | Draws an animation of multiple images |\n * | {@link PIXI.Mesh} | Provides a lower-level API for drawing meshes with custom data |\n * | {@link PIXI.NineSlicePlane} | Mesh-related |\n * | {@link PIXI.SimpleMesh} | v4-compatible mesh |\n * | {@link PIXI.SimplePlane} | Mesh-related |\n * | {@link PIXI.SimpleRope} | Mesh-related |\n *\n * ## Transforms\n *\n * The [transform]{@link DisplayObject#transform} of a display object describes the projection from its\n * local coordinate space to its parent's local coordinate space. The following properties are derived\n * from the transform:\n *\n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n * \n *
PropertyDescription
[pivot]{@link PIXI.DisplayObject#pivot}\n * Invariant under rotation, scaling, and skewing. The projection of into the parent's space of the pivot\n * is equal to position, regardless of the other three transformations. In other words, It is the center of\n * rotation, scaling, and skewing.\n *
[position]{@link PIXI.DisplayObject#position}\n * Translation. This is the position of the [pivot]{@link PIXI.DisplayObject#pivot} in the parent's local\n * space. The default value of the pivot is the origin (0,0). If the top-left corner of your display object\n * is (0,0) in its local space, then the position will be its top-left corner in the parent's local space.\n *
[scale]{@link PIXI.DisplayObject#scale}\n * Scaling. This will stretch (or compress) the display object's projection. The scale factors are along the\n * local coordinate axes. In other words, the display object is scaled before rotated or skewed. The center\n * of scaling is the [pivot]{@link PIXI.DisplayObject#pivot}.\n *
[rotation]{@link PIXI.DisplayObject#rotation}\n * Rotation. This will rotate the display object's projection by this angle (in radians).\n *
[skew]{@link PIXI.DisplayObject#skew}\n *

Skewing. This can be used to deform a rectangular display object into a parallelogram.

\n *

\n * In PixiJS, skew has a slightly different behaviour than the conventional meaning. It can be\n * thought of the net rotation applied to the coordinate axes (separately). For example, if \"skew.x\" is\n * ⍺ and \"skew.y\" is β, then the line x = 0 will be rotated by ⍺ (y = -x*cot⍺) and the line y = 0 will be\n * rotated by β (y = x*tanβ). A line y = x*tanϴ (i.e. a line at angle ϴ to the x-axis in local-space) will\n * be rotated by an angle between ⍺ and β.\n *

\n *

\n * It can be observed that if skew is applied equally to both axes, then it will be equivalent to applying\n * a rotation. Indeed, if \"skew.x\" = -ϴ and \"skew.y\" = ϴ, it will produce an equivalent of \"rotation\" = ϴ.\n *

\n *

\n * Another quite interesting observation is that \"skew.x\", \"skew.y\", rotation are communtative operations. Indeed,\n * because rotation is essentially a careful combination of the two.\n *

\n *
angleRotation. This is an alias for [rotation]{@link PIXI.DisplayObject#rotation}, but in degrees.
xTranslation. This is an alias for position.x!
yTranslation. This is an alias for position.y!
width\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The width property calculates scale.x by dividing\n * the \"requested\" width by the local bounding box width. It is indirectly an abstraction over scale.x, and there\n * is no concept of user-defined width.\n *
height\n * Implemented in [Container]{@link PIXI.Container}. Scaling. The height property calculates scale.y by dividing\n * the \"requested\" height by the local bounding box height. It is indirectly an abstraction over scale.y, and there\n * is no concept of user-defined height.\n *
\n *\n * ## Bounds\n *\n * The bounds of a display object is defined by the minimum axis-aligned rectangle in world space that can fit\n * around it. The abstract `calculateBounds` method is responsible for providing it (and it should use the\n * `worldTransform` to calculate in world space).\n *\n * There are a few additional types of bounding boxes:\n *\n * | Bounds | Description |\n * | --------------------- | ---------------------------------------------------------------------------------------- |\n * | World Bounds | This is synonymous is the regular bounds described above. See `getBounds()`. |\n * | Local Bounds | This the axis-aligned bounding box in the parent's local space. See `getLocalBounds()`. |\n * | Render Bounds | The bounds, but including extra rendering effects like filter padding. |\n * | Projected Bounds | The bounds of the projected display object onto the screen. Usually equals world bounds. |\n * | Relative Bounds | The bounds of a display object when projected onto a ancestor's (or parent's) space. |\n * | Natural Bounds | The bounds of an object in its own local space (not parent's space, like in local bounds)|\n * | Content Bounds | The natural bounds when excluding all children of a `Container`. |\n *\n * ### calculateBounds\n *\n * [Container]{@link Container} already implements `calculateBounds` in a manner that includes children.\n *\n * But for a non-Container display object, the `calculateBounds` method must be overridden in order for `getBounds` and\n * `getLocalBounds` to work. This method must write the bounds into `this._bounds`.\n *\n * Generally, the following technique works for most simple cases: take the list of points\n * forming the \"hull\" of the object (i.e. outline of the object's shape), and then add them\n * using {@link PIXI.Bounds#addPointMatrix}.\n *\n * ```js\n * calculateBounds(): void\n * {\n * const points = [...];\n *\n * for (let i = 0, j = points.length; i < j; i++)\n * {\n * this._bounds.addPointMatrix(this.worldTransform, points[i]);\n * }\n * }\n * ```\n *\n * You can optimize this for a large number of points by using {@link PIXI.Bounds#addVerticesMatrix} to pass them\n * in one array together.\n *\n * ## Alpha\n *\n * This alpha sets a display object's **relative opacity** w.r.t its parent. For example, if the alpha of a display\n * object is 0.5 and its parent's alpha is 0.5, then it will be rendered with 25% opacity (assuming alpha is not\n * applied on any ancestor further up the chain).\n *\n * The alpha with which the display object will be rendered is called the [worldAlpha]{@link PIXI.DisplayObject#worldAlpha}.\n *\n * ## Renderable vs Visible\n *\n * The `renderable` and `visible` properties can be used to prevent a display object from being rendered to the\n * screen. However, there is a subtle difference between the two. When using `renderable`, the transforms of the display\n * object (and its children subtree) will continue to be calculated. When using `visible`, the transforms will not\n * be calculated.\n *\n * It is recommended that applications use the `renderable` property for culling. See\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} or\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} for more details.\n *\n * Otherwise, to prevent an object from rendering in the general-purpose sense - `visible` is the property to use. This\n * one is also better in terms of performance.\n *\n * @class\n * @extends PIXI.utils.EventEmitter\n * @memberof PIXI\n */\nexport abstract class DisplayObject extends EventEmitter\n{\n abstract sortDirty: boolean;\n\n public parent: Container;\n public worldAlpha: number;\n public transform: Transform;\n public alpha: number;\n public visible: boolean;\n public renderable: boolean;\n public filterArea: Rectangle;\n public filters: Filter[] | null;\n public isSprite: boolean;\n public isMask: boolean;\n public _lastSortedIndex: number;\n public _mask: Container|MaskData;\n public _bounds: Bounds;\n public _localBounds: Bounds;\n\n protected _zIndex: number;\n protected _enabledFilters: Filter[];\n protected _boundsID: number;\n protected _boundsRect: Rectangle;\n protected _localBoundsRect: Rectangle;\n protected _destroyed: boolean;\n\n private _maskRefCount: number;\n private tempDisplayObjectParent: TemporaryDisplayObject;\n public displayObjectUpdateTransform: () => void;\n\n /**\n * Mixes all enumerable properties and methods from a source object to DisplayObject.\n *\n * @param {object} source - The source of properties and methods to mix in.\n */\n static mixin(source: Dict): void\n {\n // in ES8/ES2017, this would be really easy:\n // Object.defineProperties(DisplayObject.prototype, Object.getOwnPropertyDescriptors(source));\n\n // get all the enumerable property keys\n const keys = Object.keys(source);\n\n // loop through properties\n for (let i = 0; i < keys.length; ++i)\n {\n const propertyName = keys[i];\n\n // Set the property using the property descriptor - this works for accessors and normal value properties\n Object.defineProperty(\n DisplayObject.prototype,\n propertyName,\n Object.getOwnPropertyDescriptor(source, propertyName)\n );\n }\n }\n\n constructor()\n {\n super();\n\n this.tempDisplayObjectParent = null;\n\n // TODO: need to create Transform from factory\n /**\n * World transform and local transform of this object.\n * This will become read-only later, please do not assign anything there unless you know what are you doing.\n *\n * @member {PIXI.Transform}\n */\n this.transform = new Transform();\n\n /**\n * The opacity of the object.\n *\n * @member {number}\n */\n this.alpha = 1;\n\n /**\n * The visibility of the object. If false the object will not be drawn, and\n * the updateTransform function will not be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds or call updateTransform manually.\n *\n * @member {boolean}\n */\n this.visible = true;\n\n /**\n * Can this object be rendered, if false the object will not be drawn but the updateTransform\n * methods will still be called.\n *\n * Only affects recursive calls from parent. You can ask for bounds manually.\n *\n * @member {boolean}\n */\n this.renderable = true;\n\n /**\n * The display object container that contains this display object.\n *\n * @member {PIXI.Container}\n */\n this.parent = null;\n\n /**\n * The multiplied alpha of the displayObject.\n *\n * @member {number}\n * @readonly\n */\n this.worldAlpha = 1;\n\n /**\n * Which index in the children array the display component was before the previous zIndex sort.\n * Used by containers to help sort objects with the same zIndex, by using previous array index as the decider.\n *\n * @member {number}\n * @protected\n */\n this._lastSortedIndex = 0;\n\n /**\n * The zIndex of the displayObject.\n * A higher value will mean it will be rendered on top of other displayObjects within the same container.\n *\n * @member {number}\n * @protected\n */\n this._zIndex = 0;\n\n /**\n * The area the filter is applied to. This is used as more of an optimization\n * rather than figuring out the dimensions of the displayObject each frame you can set this rectangle.\n *\n * Also works as an interaction mask.\n *\n * @member {?PIXI.Rectangle}\n */\n this.filterArea = null;\n\n /**\n * Sets the filters for the displayObject.\n * * IMPORTANT: This is a WebGL only feature and will be ignored by the canvas renderer.\n * To remove filters simply set this property to `'null'`.\n *\n * @member {?PIXI.Filter[]}\n */\n this.filters = null;\n\n /**\n * Currently enabled filters\n * @member {PIXI.Filter[]}\n * @protected\n */\n this._enabledFilters = null;\n\n /**\n * The bounds object, this is used to calculate and store the bounds of the displayObject.\n *\n * @member {PIXI.Bounds}\n */\n this._bounds = new Bounds();\n\n /**\n * Local bounds object, swapped with `_bounds` when using `getLocalBounds()`.\n *\n * @member {PIXI.Bounds}\n */\n this._localBounds = null;\n\n /**\n * Flags the cached bounds as dirty.\n *\n * @member {number}\n * @protected\n */\n this._boundsID = 0;\n\n /**\n * Cache of this display-object's bounds-rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._boundsRect = null;\n\n /**\n * Cache of this display-object's local-bounds rectangle.\n *\n * @member {PIXI.Bounds}\n * @protected\n */\n this._localBoundsRect = null;\n\n /**\n * The original, cached mask of the object.\n *\n * @member {PIXI.Container|PIXI.MaskData|null}\n * @protected\n */\n this._mask = null;\n\n /**\n * The number of times this object is used as a mask by another object.\n *\n * @member {number}\n * @private\n */\n this._maskRefCount = 0;\n\n /**\n * If the object has been destroyed via destroy(). If true, it should not be used.\n *\n * @member {boolean}\n * @protected\n */\n this._destroyed = false;\n\n /**\n * used to fast check if a sprite is.. a sprite!\n * @member {boolean}\n */\n this.isSprite = false;\n\n /**\n * Does any other displayObject use this object as a mask?\n * @member {boolean}\n */\n this.isMask = false;\n }\n\n /**\n * Fired when this DisplayObject is added to a Container.\n *\n * @instance\n * @event added\n * @param {PIXI.Container} container - The container added to.\n */\n\n /**\n * Fired when this DisplayObject is removed from a Container.\n *\n * @instance\n * @event removed\n * @param {PIXI.Container} container - The container removed from.\n */\n\n /**\n * Fired when this DisplayObject is destroyed.\n *\n * @instance\n * @event destroyed\n */\n\n /**\n * Readonly flag for destroyed display objects.\n */\n get destroyed(): boolean\n {\n return this._destroyed;\n }\n\n /**\n * Recalculates the bounds of the display object.\n */\n abstract calculateBounds(): void;\n\n abstract removeChild(child: DisplayObject): void;\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * @param {PIXI.Renderer} renderer - The renderer.\n */\n abstract render(renderer: Renderer): void;\n\n /**\n * Recursively updates transform of all objects from the root to this one\n * internal function for toLocal()\n */\n protected _recursivePostUpdateTransform(): void\n {\n if (this.parent)\n {\n this.parent._recursivePostUpdateTransform();\n this.transform.updateTransform(this.parent.transform);\n }\n else\n {\n this.transform.updateTransform(this._tempDisplayObjectParent.transform);\n }\n }\n\n /**\n * Updates the object transform for rendering.\n *\n * TODO - Optimization pass!\n */\n updateTransform(): void\n {\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n // multiply the alphas..\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n }\n\n /**\n * Calculates and returns the (world) bounds of the display object as a [Rectangle]{@link PIXI.Rectangle}.\n *\n * This method is expensive on containers with a large subtree (like the stage). This is because the bounds\n * of a container depend on its children's bounds, which recursively causes all bounds in the subtree to\n * be recalculated. The upside, however, is that calling `getBounds` once on a container will indeed update\n * the bounds of all children (the whole subtree, in fact). This side effect should be exploited by using\n * `displayObject._bounds.getRectangle()` when traversing through all the bounds in a scene graph. Otherwise,\n * calling `getBounds` on each object in a subtree will cause the total cost to increase quadratically as\n * its height increases.\n *\n * * The transforms of all objects in a container's **subtree** and of all **ancestors** are updated.\n * * The world bounds of all display objects in a container's **subtree** will also be recalculated.\n *\n * The `_bounds` object stores the last calculation of the bounds. You can use to entirely skip bounds\n * calculation if needed.\n *\n * ```js\n * const lastCalculatedBounds = displayObject._bounds.getRectangle(optionalRect);\n * ```\n *\n * Do know that usage of `getLocalBounds` can corrupt the `_bounds` of children (the whole subtree, actually). This\n * is a known issue that has not been solved. See [getLocalBounds]{@link PIXI.DisplayObject#getLocalBounds} for more\n * details.\n *\n * `getBounds` should be called with `skipUpdate` equal to `true` in a render() call. This is because the transforms\n * are guaranteed to be update-to-date. In fact, recalculating inside a render() call may cause corruption in certain\n * cases.\n *\n * @param {boolean} [skipUpdate] - Setting to `true` will stop the transforms of the scene graph from\n * being updated. This means the calculation returned MAY be out of date BUT will give you a\n * nice performance boost.\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The minimum axis-aligned rectangle in world space that fits around this object.\n */\n getBounds(skipUpdate?: boolean, rect?: Rectangle): Rectangle\n {\n if (!skipUpdate)\n {\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.updateTransform();\n this.parent = null;\n }\n else\n {\n this._recursivePostUpdateTransform();\n this.updateTransform();\n }\n }\n\n if (this._bounds.updateID !== this._boundsID)\n {\n this.calculateBounds();\n this._bounds.updateID = this._boundsID;\n }\n\n if (!rect)\n {\n if (!this._boundsRect)\n {\n this._boundsRect = new Rectangle();\n }\n\n rect = this._boundsRect;\n }\n\n return this._bounds.getRectangle(rect);\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n getLocalBounds(rect?: Rectangle): Rectangle\n {\n if (!rect)\n {\n if (!this._localBoundsRect)\n {\n this._localBoundsRect = new Rectangle();\n }\n\n rect = this._localBoundsRect;\n }\n\n if (!this._localBounds)\n {\n this._localBounds = new Bounds();\n }\n\n const transformRef = this.transform;\n const parentRef = this.parent;\n\n this.parent = null;\n this.transform = this._tempDisplayObjectParent.transform;\n\n const worldBounds = this._bounds;\n const worldBoundsID = this._boundsID;\n\n this._bounds = this._localBounds;\n\n const bounds = this.getBounds(false, rect);\n\n this.parent = parentRef;\n this.transform = transformRef;\n\n this._bounds = worldBounds;\n this._bounds.updateID += this._boundsID - worldBoundsID;// reflect side-effects\n\n return bounds;\n }\n\n /**\n * Calculates the global position of the display object.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform.\n * @return {PIXI.Point} A point object representing the position of this object.\n */\n toGlobal

(position: IPointData, point?: P, skipUpdate = false): P\n {\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // don't need to update the lot\n return this.worldTransform.apply

(position, point);\n }\n\n /**\n * Calculates the local position of the display object relative to another point.\n *\n * @param {PIXI.IPointData} position - The world origin to calculate from.\n * @param {PIXI.DisplayObject} [from] - The DisplayObject to calculate the global position from.\n * @param {PIXI.Point} [point] - A Point object in which to store the value, optional\n * (otherwise will create a new Point).\n * @param {boolean} [skipUpdate=false] - Should we skip the update transform\n * @return {PIXI.Point} A point object representing the position of this object\n */\n toLocal

(position: IPointData, from?: DisplayObject, point?: P, skipUpdate?: boolean): P\n {\n if (from)\n {\n position = from.toGlobal(position, point, skipUpdate);\n }\n\n if (!skipUpdate)\n {\n this._recursivePostUpdateTransform();\n\n // this parent check is for just in case the item is a root object.\n // If it is we need to give it a temporary parent so that displayObjectUpdateTransform works correctly\n // this is mainly to avoid a parent check in the main loop. Every little helps for performance :)\n if (!this.parent)\n {\n this.parent = this._tempDisplayObjectParent as Container;\n this.displayObjectUpdateTransform();\n this.parent = null;\n }\n else\n {\n this.displayObjectUpdateTransform();\n }\n }\n\n // simply apply the matrix..\n return this.worldTransform.applyInverse

(position, point);\n }\n\n /**\n * Set the parent Container of this DisplayObject.\n *\n * @param {PIXI.Container} container - The Container to add this DisplayObject to.\n * @return {PIXI.Container} The Container that this DisplayObject was added to.\n */\n setParent(container: Container): Container\n {\n if (!container || !container.addChild)\n {\n throw new Error('setParent: Argument must be a Container');\n }\n\n container.addChild(this);\n\n return container;\n }\n\n /**\n * Convenience function to set the position, scale, skew and pivot at once.\n *\n * @param {number} [x=0] - The X position\n * @param {number} [y=0] - The Y position\n * @param {number} [scaleX=1] - The X scale value\n * @param {number} [scaleY=1] - The Y scale value\n * @param {number} [rotation=0] - The rotation\n * @param {number} [skewX=0] - The X skew value\n * @param {number} [skewY=0] - The Y skew value\n * @param {number} [pivotX=0] - The X pivot value\n * @param {number} [pivotY=0] - The Y pivot value\n * @return {PIXI.DisplayObject} The DisplayObject instance\n */\n setTransform(x = 0, y = 0, scaleX = 1, scaleY = 1, rotation = 0, skewX = 0, skewY = 0, pivotX = 0, pivotY = 0): this\n {\n this.position.x = x;\n this.position.y = y;\n this.scale.x = !scaleX ? 1 : scaleX;\n this.scale.y = !scaleY ? 1 : scaleY;\n this.rotation = rotation;\n this.skew.x = skewX;\n this.skew.y = skewY;\n this.pivot.x = pivotX;\n this.pivot.y = pivotY;\n\n return this;\n }\n\n /**\n * Base destroy method for generic display objects. This will automatically\n * remove the display object from its parent Container as well as remove\n * all current event listeners and internal references. Do not use a DisplayObject\n * after calling `destroy()`.\n *\n */\n destroy(_options?: IDestroyOptions|boolean): void\n {\n if (this.parent)\n {\n this.parent.removeChild(this);\n }\n this.emit('destroyed');\n this.removeAllListeners();\n this.transform = null;\n\n this.parent = null;\n this._bounds = null;\n this.mask = null;\n\n this.filters = null;\n this.filterArea = null;\n this.hitArea = null;\n\n this.interactive = false;\n this.interactiveChildren = false;\n\n this._destroyed = true;\n }\n\n /**\n * @protected\n * @member {PIXI.Container}\n */\n get _tempDisplayObjectParent(): TemporaryDisplayObject\n {\n if (this.tempDisplayObjectParent === null)\n {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n this.tempDisplayObjectParent = new TemporaryDisplayObject();\n }\n\n return this.tempDisplayObjectParent;\n }\n\n /**\n * Used in Renderer, cacheAsBitmap and other places where you call an `updateTransform` on root\n *\n * ```\n * const cacheParent = elem.enableTempParent();\n * elem.updateTransform();\n * elem.disableTempParent(cacheParent);\n * ```\n *\n * @returns {PIXI.Container} current parent\n */\n enableTempParent(): Container\n {\n const myParent = this.parent;\n\n this.parent = this._tempDisplayObjectParent as Container;\n\n return myParent;\n }\n\n /**\n * Pair method for `enableTempParent`\n *\n * @param {PIXI.Container} cacheParent - Actual parent of element\n */\n disableTempParent(cacheParent: Container): void\n {\n this.parent = cacheParent;\n }\n\n /**\n * The position of the displayObject on the x axis relative to the local coordinates of the parent.\n * An alias to position.x\n *\n * @member {number}\n */\n get x(): number\n {\n return this.position.x;\n }\n\n set x(value: number)\n {\n this.transform.position.x = value;\n }\n\n /**\n * The position of the displayObject on the y axis relative to the local coordinates of the parent.\n * An alias to position.y\n *\n * @member {number}\n */\n get y(): number\n {\n return this.position.y;\n }\n\n set y(value: number)\n {\n this.transform.position.y = value;\n }\n\n /**\n * Current transform of the object based on world (parent) factors.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get worldTransform(): Matrix\n {\n return this.transform.worldTransform;\n }\n\n /**\n * Current transform of the object based on local factors: position, scale, other stuff.\n *\n * @member {PIXI.Matrix}\n * @readonly\n */\n get localTransform(): Matrix\n {\n return this.transform.localTransform;\n }\n\n /**\n * The coordinate of the object relative to the local coordinates of the parent.\n *\n * @since PixiJS 4\n * @member {PIXI.ObservablePoint}\n */\n get position(): ObservablePoint\n {\n return this.transform.position;\n }\n\n set position(value: ObservablePoint)\n {\n this.transform.position.copyFrom(value);\n }\n\n /**\n * The scale factors of this object along the local coordinate axes.\n *\n * The default scale is (1, 1).\n *\n * @since PixiJS 4\n * @member {PIXI.ObservablePoint}\n */\n get scale(): ObservablePoint\n {\n return this.transform.scale;\n }\n\n set scale(value: ObservablePoint)\n {\n this.transform.scale.copyFrom(value);\n }\n\n /**\n * The center of rotation, scaling, and skewing for this display object in its local space. The `position`\n * is the projection of `pivot` in the parent's local space.\n *\n * By default, the pivot is the origin (0, 0).\n *\n * @since PixiJS 4\n * @member {PIXI.ObservablePoint}\n */\n get pivot(): ObservablePoint\n {\n return this.transform.pivot;\n }\n\n set pivot(value: ObservablePoint)\n {\n this.transform.pivot.copyFrom(value);\n }\n\n /**\n * The skew factor for the object in radians.\n *\n * @since PixiJS 4\n * @member {PIXI.ObservablePoint}\n */\n get skew(): ObservablePoint\n {\n return this.transform.skew;\n }\n\n set skew(value: ObservablePoint)\n {\n this.transform.skew.copyFrom(value);\n }\n\n /**\n * The rotation of the object in radians.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get rotation(): number\n {\n return this.transform.rotation;\n }\n\n set rotation(value: number)\n {\n this.transform.rotation = value;\n }\n\n /**\n * The angle of the object in degrees.\n * 'rotation' and 'angle' have the same effect on a display object; rotation is in radians, angle is in degrees.\n *\n * @member {number}\n */\n get angle(): number\n {\n return this.transform.rotation * RAD_TO_DEG;\n }\n\n set angle(value: number)\n {\n this.transform.rotation = value * DEG_TO_RAD;\n }\n\n /**\n * The zIndex of the displayObject.\n *\n * If a container has the sortableChildren property set to true, children will be automatically\n * sorted by zIndex value; a higher value will mean it will be moved towards the end of the array,\n * and thus rendered on top of other display objects within the same container.\n *\n * @member {number}\n * @see PIXI.Container#sortableChildren\n */\n get zIndex(): number\n {\n return this._zIndex;\n }\n\n set zIndex(value: number)\n {\n this._zIndex = value;\n if (this.parent)\n {\n this.parent.sortDirty = true;\n }\n }\n\n /**\n * Indicates if the object is globally visible.\n *\n * @member {boolean}\n * @readonly\n */\n get worldVisible(): boolean\n {\n let item = this as DisplayObject;\n\n do\n {\n if (!item.visible)\n {\n return false;\n }\n\n item = item.parent;\n } while (item);\n\n return true;\n }\n\n /**\n * Sets a mask for the displayObject. A mask is an object that limits the visibility of an\n * object to the shape of the mask applied to it. In PixiJS a regular mask must be a\n * {@link PIXI.Graphics} or a {@link PIXI.Sprite} object. This allows for much faster masking in canvas as it\n * utilities shape clipping. To remove a mask, set this property to `null`.\n *\n * For sprite mask both alpha and red channel are used. Black mask is the same as transparent mask.\n *\n * @example\n * const graphics = new PIXI.Graphics();\n * graphics.beginFill(0xFF3300);\n * graphics.drawRect(50, 250, 100, 100);\n * graphics.endFill();\n *\n * const sprite = new PIXI.Sprite(texture);\n * sprite.mask = graphics;\n *\n * @todo At the moment, PIXI.CanvasRenderer doesn't support PIXI.Sprite as mask.\n * @member {PIXI.Container|PIXI.MaskData|null}\n */\n get mask(): Container|MaskData|null\n {\n return this._mask;\n }\n\n set mask(value: Container|MaskData|null)\n {\n if (this._mask === value)\n {\n return;\n }\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n maskObject._maskRefCount--;\n\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = true;\n maskObject.isMask = false;\n }\n }\n\n this._mask = value;\n\n if (this._mask)\n {\n const maskObject = ((this._mask as MaskData).maskObject || this._mask) as Container;\n\n if (maskObject._maskRefCount === 0)\n {\n maskObject.renderable = false;\n maskObject.isMask = true;\n }\n\n maskObject._maskRefCount++;\n }\n }\n}\n\n/**\n * @private\n */\nexport class TemporaryDisplayObject extends DisplayObject\n{\n calculateBounds: () => null;\n removeChild: (child: DisplayObject) => null;\n render: (renderer: Renderer) => null;\n sortDirty: boolean = null;\n}\n\n/**\n * DisplayObject default updateTransform, does not update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.DisplayObject#\n * @method displayObjectUpdateTransform\n */\nDisplayObject.prototype.displayObjectUpdateTransform = DisplayObject.prototype.updateTransform;\n","import { settings } from '@pixi/settings';\nimport { removeItems } from '@pixi/utils';\nimport { DisplayObject } from './DisplayObject';\nimport { Rectangle } from '@pixi/math';\nimport { MASK_TYPES } from '@pixi/constants';\n\nimport type { MaskData, Renderer } from '@pixi/core';\nimport type { IDestroyOptions } from './DisplayObject';\n\nfunction sortChildren(a: DisplayObject, b: DisplayObject): number\n{\n if (a.zIndex === b.zIndex)\n {\n return a._lastSortedIndex - b._lastSortedIndex;\n }\n\n return a.zIndex - b.zIndex;\n}\n\nexport interface Container extends GlobalMixins.Container, DisplayObject {}\n\n/**\n * Container is a general-purpose display object that holds children. It also adds built-in support for advanced\n * rendering features like masking and filtering.\n *\n * It is the base class of all display objects that act as a container for other objects, including Graphics\n * and Sprite.\n *\n * ```js\n * import { BlurFilter } from '@pixi/filter-blur';\n * import { Container } from '@pixi/display';\n * import { Graphics } from '@pixi/graphics';\n * import { Sprite } from '@pixi/sprite';\n *\n * let container = new Container();\n * let sprite = Sprite.from(\"https://s3-us-west-2.amazonaws.com/s.cdpn.io/693612/IaUrttj.png\");\n *\n * sprite.width = 512;\n * sprite.height = 512;\n *\n * // Adds a sprite as a child to this container. As a result, the sprite will be rendered whenever the container\n * // is rendered.\n * container.addChild(sprite);\n *\n * // Blurs whatever is rendered by the container\n * container.filters = [new BlurFilter()];\n *\n * // Only the contents within a circle at the center should be rendered onto the screen.\n * container.mask = new Graphics()\n * .beginFill(0xffffff)\n * .drawCircle(sprite.width / 2, sprite.height / 2, Math.min(sprite.width, sprite.height) / 2)\n * .endFill();\n * ```\n *\n * @class\n * @extends PIXI.DisplayObject\n * @memberof PIXI\n */\nexport class Container extends DisplayObject\n{\n public readonly children: DisplayObject[];\n public sortableChildren: boolean;\n public sortDirty: boolean;\n public parent: Container;\n public containerUpdateTransform: () => void;\n\n protected _width: number;\n protected _height: number;\n\n constructor()\n {\n super();\n\n /**\n * The array of children of this container.\n *\n * @member {PIXI.DisplayObject[]}\n * @readonly\n */\n this.children = [];\n\n /**\n * If set to true, the container will sort its children by zIndex value\n * when updateTransform() is called, or manually if sortChildren() is called.\n *\n * This actually changes the order of elements in the array, so should be treated\n * as a basic solution that is not performant compared to other solutions,\n * such as @link https://github.com/pixijs/pixi-display\n *\n * Also be aware of that this may not work nicely with the addChildAt() function,\n * as the zIndex sorting may cause the child to automatically sorted to another position.\n *\n * @see PIXI.settings.SORTABLE_CHILDREN\n *\n * @member {boolean}\n */\n this.sortableChildren = settings.SORTABLE_CHILDREN;\n\n /**\n * Should children be sorted by zIndex at the next updateTransform call.\n *\n * Will get automatically set to true if a new child is added, or if a child's zIndex changes.\n *\n * @member {boolean}\n */\n this.sortDirty = false;\n\n /**\n * Fired when a DisplayObject is added to this Container.\n *\n * @event PIXI.Container#childAdded\n * @param {PIXI.DisplayObject} child - The child added to the Container.\n * @param {PIXI.Container} container - The container that added the child.\n * @param {number} index - The children's index of the added child.\n */\n\n /**\n * Fired when a DisplayObject is removed from this Container.\n *\n * @event PIXI.DisplayObject#removedFrom\n * @param {PIXI.DisplayObject} child - The child removed from the Container.\n * @param {PIXI.Container} container - The container that removed removed the child.\n * @param {number} index - The former children's index of the removed child\n */\n }\n\n /**\n * Overridable method that can be used by Container subclasses whenever the children array is modified\n *\n * @protected\n */\n protected onChildrenChange(_length?: number): void\n {\n /* empty */\n }\n\n /**\n * Adds one or more children to the container.\n *\n * Multiple items can be added like so: `myContainer.addChild(thingOne, thingTwo, thingThree)`\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to add to the container\n * @return {PIXI.DisplayObject} The first child that was added.\n */\n addChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the array and add all children\n for (let i = 0; i < children.length; i++)\n {\n // eslint-disable-next-line prefer-rest-params\n this.addChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n // if the child has a parent then lets remove it as PixiJS objects can only exist in one place\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.push(child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(this.children.length - 1);\n this.emit('childAdded', child, this, this.children.length - 1);\n child.emit('added', this);\n }\n\n return children[0];\n }\n\n /**\n * Adds a child to the container at a specified index. If the index is out of bounds an error will be thrown\n *\n * @param {PIXI.DisplayObject} child - The child to add\n * @param {number} index - The index to place the child in\n * @return {PIXI.DisplayObject} The child that was added.\n */\n addChildAt(child: T, index: number): T\n {\n if (index < 0 || index > this.children.length)\n {\n throw new Error(`${child}addChildAt: The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n if (child.parent)\n {\n child.parent.removeChild(child);\n }\n\n child.parent = this;\n this.sortDirty = true;\n\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n\n this.children.splice(index, 0, child);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('added', this);\n this.emit('childAdded', child, this, index);\n\n return child;\n }\n\n /**\n * Swaps the position of 2 Display Objects within this container.\n *\n * @param {PIXI.DisplayObject} child - First display object to swap\n * @param {PIXI.DisplayObject} child2 - Second display object to swap\n */\n swapChildren(child: DisplayObject, child2: DisplayObject): void\n {\n if (child === child2)\n {\n return;\n }\n\n const index1 = this.getChildIndex(child);\n const index2 = this.getChildIndex(child2);\n\n this.children[index1] = child2;\n this.children[index2] = child;\n this.onChildrenChange(index1 < index2 ? index1 : index2);\n }\n\n /**\n * Returns the index position of a child DisplayObject instance\n *\n * @param {PIXI.DisplayObject} child - The DisplayObject instance to identify\n * @return {number} The index position of the child display object to identify\n */\n getChildIndex(child: DisplayObject): number\n {\n const index = this.children.indexOf(child);\n\n if (index === -1)\n {\n throw new Error('The supplied DisplayObject must be a child of the caller');\n }\n\n return index;\n }\n\n /**\n * Changes the position of an existing child in the display object container\n *\n * @param {PIXI.DisplayObject} child - The child DisplayObject instance for which you want to change the index number\n * @param {number} index - The resulting index number for the child display object\n */\n setChildIndex(child: DisplayObject, index: number): void\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`The index ${index} supplied is out of bounds ${this.children.length}`);\n }\n\n const currentIndex = this.getChildIndex(child);\n\n removeItems(this.children, currentIndex, 1); // remove from old position\n this.children.splice(index, 0, child); // add at new position\n\n this.onChildrenChange(index);\n }\n\n /**\n * Returns the child at the specified index\n *\n * @param {number} index - The index to get the child at\n * @return {PIXI.DisplayObject} The child at the given index, if any.\n */\n getChildAt(index: number): DisplayObject\n {\n if (index < 0 || index >= this.children.length)\n {\n throw new Error(`getChildAt: Index (${index}) does not exist.`);\n }\n\n return this.children[index];\n }\n\n /**\n * Removes one or more children from the container.\n *\n * @param {...PIXI.DisplayObject} children - The DisplayObject(s) to remove\n * @return {PIXI.DisplayObject} The first child that was removed.\n */\n removeChild(...children: T): T[0]\n {\n // if there is only one argument we can bypass looping through the them\n if (children.length > 1)\n {\n // loop through the arguments property and remove all children\n for (let i = 0; i < children.length; i++)\n {\n this.removeChild(children[i]);\n }\n }\n else\n {\n const child = children[0];\n const index = this.children.indexOf(child);\n\n if (index === -1) return null;\n\n child.parent = null;\n // ensure child transform will be recalculated\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n }\n\n return children[0];\n }\n\n /**\n * Removes a child from the specified index position.\n *\n * @param {number} index - The index to get the child from\n * @return {PIXI.DisplayObject} The child that was removed.\n */\n removeChildAt(index: number): DisplayObject\n {\n const child = this.getChildAt(index);\n\n // ensure child transform will be recalculated..\n child.parent = null;\n child.transform._parentID = -1;\n removeItems(this.children, index, 1);\n\n // ensure bounds will be recalculated\n this._boundsID++;\n\n // TODO - lets either do all callbacks or all events.. not both!\n this.onChildrenChange(index);\n child.emit('removed', this);\n this.emit('childRemoved', child, this, index);\n\n return child;\n }\n\n /**\n * Removes all children from this container that are within the begin and end indexes.\n *\n * @param {number} [beginIndex=0] - The beginning position.\n * @param {number} [endIndex=this.children.length] - The ending position. Default value is size of the container.\n * @returns {PIXI.DisplayObject[]} List of removed children\n */\n removeChildren(beginIndex = 0, endIndex = this.children.length): DisplayObject[]\n {\n const begin = beginIndex;\n const end = endIndex;\n const range = end - begin;\n let removed;\n\n if (range > 0 && range <= end)\n {\n removed = this.children.splice(begin, range);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].parent = null;\n if (removed[i].transform)\n {\n removed[i].transform._parentID = -1;\n }\n }\n\n this._boundsID++;\n\n this.onChildrenChange(beginIndex);\n\n for (let i = 0; i < removed.length; ++i)\n {\n removed[i].emit('removed', this);\n this.emit('childRemoved', removed[i], this, i);\n }\n\n return removed;\n }\n else if (range === 0 && this.children.length === 0)\n {\n return [];\n }\n\n throw new RangeError('removeChildren: numeric values are outside the acceptable range.');\n }\n\n /**\n * Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex.\n */\n sortChildren(): void\n {\n let sortRequired = false;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n child._lastSortedIndex = i;\n\n if (!sortRequired && child.zIndex !== 0)\n {\n sortRequired = true;\n }\n }\n\n if (sortRequired && this.children.length > 1)\n {\n this.children.sort(sortChildren);\n }\n\n this.sortDirty = false;\n }\n\n /**\n * Updates the transform on all children of this container for rendering\n */\n updateTransform(): void\n {\n if (this.sortableChildren && this.sortDirty)\n {\n this.sortChildren();\n }\n\n this._boundsID++;\n\n this.transform.updateTransform(this.parent.transform);\n\n // TODO: check render flags, how to process stuff here\n this.worldAlpha = this.alpha * this.parent.worldAlpha;\n\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n /**\n * Recalculates the bounds of the container.\n *\n * This implementation will automatically fit the children's bounds into the calculation. Each child's bounds\n * is limited to its mask's bounds or filterArea, if any is applied.\n */\n calculateBounds(): void\n {\n this._bounds.clear();\n\n this._calculateBounds();\n\n for (let i = 0; i < this.children.length; i++)\n {\n const child = this.children[i];\n\n if (!child.visible || !child.renderable)\n {\n continue;\n }\n\n child.calculateBounds();\n\n // TODO: filter+mask, need to mask both somehow\n if (child._mask)\n {\n const maskObject = ((child._mask as MaskData).maskObject || child._mask) as Container;\n\n maskObject.calculateBounds();\n this._bounds.addBoundsMask(child._bounds, maskObject._bounds);\n }\n else if (child.filterArea)\n {\n this._bounds.addBoundsArea(child._bounds, child.filterArea);\n }\n else\n {\n this._bounds.addBounds(child._bounds);\n }\n }\n\n this._bounds.updateID = this._boundsID;\n }\n\n /**\n * Retrieves the local bounds of the displayObject as a rectangle object.\n *\n * Calling `getLocalBounds` may invalidate the `_bounds` of the whole subtree below. If using it inside a render()\n * call, it is advised to call `getBounds()` immediately after to recalculate the world bounds of the subtree.\n *\n * @param {PIXI.Rectangle} [rect] - Optional rectangle to store the result of the bounds calculation.\n * @param {boolean} [skipChildrenUpdate=false] - Setting to `true` will stop re-calculation of children transforms,\n * it was default behaviour of pixi 4.0-5.2 and caused many problems to users.\n * @return {PIXI.Rectangle} The rectangular bounding area.\n */\n public getLocalBounds(rect?: Rectangle, skipChildrenUpdate = false): Rectangle\n {\n const result = super.getLocalBounds(rect);\n\n if (!skipChildrenUpdate)\n {\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n const child = this.children[i];\n\n if (child.visible)\n {\n child.updateTransform();\n }\n }\n }\n\n return result;\n }\n\n /**\n * Recalculates the content bounds of this object. This should be overriden to\n * calculate the bounds of this specific object (not including children).\n *\n * @protected\n */\n protected _calculateBounds(): void\n {\n // FILL IN//\n }\n\n /**\n * Renders the object using the WebGL renderer.\n *\n * The [_render]{@link PIXI.Container#_render} method is be overriden for rendering the contents of the\n * container itself. This `render` method will invoke it, and also invoke the `render` methods of all\n * children afterward.\n *\n * If `renderable` or `visible` is false or if `worldAlpha` is not positive, this implementation will entirely\n * skip rendering. See {@link PIXI.DisplayObject} for choosing between `renderable` or `visible`. Generally,\n * setting alpha to zero is not recommended for purely skipping rendering.\n *\n * When your scene becomes large (especially when it is larger than can be viewed in a single screen), it is\n * advised to employ **culling** to automatically skip rendering objects outside of the current screen. The\n * [@pixi-essentials/cull]{@link https://www.npmjs.com/package/@pixi-essentials/cull} and\n * [pixi-cull]{@link https://www.npmjs.com/package/pixi-cull} packages do this out of the box.\n *\n * The [renderAdvanced]{@link PIXI.Container#renderAdvanced} method is internally used when when masking or\n * filtering is applied on a container. This does, however, break batching and can affect performance when\n * masking and filtering is applied extensively throughout the scene graph.\n *\n * @param {PIXI.Renderer} renderer - The renderer\n */\n render(renderer: Renderer): void\n {\n // if the object is not visible or the alpha is 0 then no need to render this element\n if (!this.visible || this.worldAlpha <= 0 || !this.renderable)\n {\n return;\n }\n\n // do a quick check to see if this element has a mask or a filter.\n if (this._mask || (this.filters && this.filters.length))\n {\n this.renderAdvanced(renderer);\n }\n else\n {\n this._render(renderer);\n\n // simple render children!\n for (let i = 0, j = this.children.length; i < j; ++i)\n {\n this.children[i].render(renderer);\n }\n }\n }\n\n /**\n * Render the object using the WebGL renderer and advanced features.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected renderAdvanced(renderer: Renderer): void\n {\n const filters = this.filters;\n const mask = this._mask as MaskData;\n\n // push filter first as we need to ensure the stencil buffer is correct for any masking\n if (filters)\n {\n if (!this._enabledFilters)\n {\n this._enabledFilters = [];\n }\n\n this._enabledFilters.length = 0;\n\n for (let i = 0; i < filters.length; i++)\n {\n if (filters[i].enabled)\n {\n this._enabledFilters.push(filters[i]);\n }\n }\n }\n\n const flush = (filters && this._enabledFilters && this._enabledFilters.length)\n || (mask && (!mask.isMaskData\n || (mask.enabled && (mask.autoDetect || mask.type !== MASK_TYPES.NONE))));\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.push(this, this._enabledFilters);\n }\n\n if (mask)\n {\n renderer.mask.push(this, this._mask);\n }\n\n // add this object to the batch, only rendered if it has a texture.\n this._render(renderer);\n\n // now loop through the children and make sure they get rendered\n for (let i = 0, j = this.children.length; i < j; i++)\n {\n this.children[i].render(renderer);\n }\n\n if (flush)\n {\n renderer.batch.flush();\n }\n\n if (mask)\n {\n renderer.mask.pop(this);\n }\n\n if (filters && this._enabledFilters && this._enabledFilters.length)\n {\n renderer.filter.pop();\n }\n }\n\n /**\n * To be overridden by the subclasses.\n *\n * @protected\n * @param {PIXI.Renderer} renderer - The renderer\n */\n protected _render(_renderer: Renderer): void // eslint-disable-line no-unused-vars\n {\n // this is where content itself gets rendered...\n }\n\n /**\n * Removes all internal references and listeners as well as removes children from the display list.\n * Do not use a Container after calling `destroy`.\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] - Only used for child Sprites if options.children is set to true\n * Should it destroy the texture of the child sprite\n * @param {boolean} [options.baseTexture=false] - Only used for child Sprites if options.children is set to true\n * Should it destroy the base texture of the child sprite\n */\n destroy(options?: IDestroyOptions|boolean): void\n {\n super.destroy();\n\n this.sortDirty = false;\n\n const destroyChildren = typeof options === 'boolean' ? options : options && options.children;\n\n const oldChildren = this.removeChildren(0, this.children.length);\n\n if (destroyChildren)\n {\n for (let i = 0; i < oldChildren.length; ++i)\n {\n oldChildren[i].destroy(options);\n }\n }\n }\n\n /**\n * The width of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get width(): number\n {\n return this.scale.x * this.getLocalBounds().width;\n }\n\n set width(value: number)\n {\n const width = this.getLocalBounds().width;\n\n if (width !== 0)\n {\n this.scale.x = value / width;\n }\n else\n {\n this.scale.x = 1;\n }\n\n this._width = value;\n }\n\n /**\n * The height of the Container, setting this will actually modify the scale to achieve the value set\n *\n * @member {number}\n */\n get height(): number\n {\n return this.scale.y * this.getLocalBounds().height;\n }\n\n set height(value: number)\n {\n const height = this.getLocalBounds().height;\n\n if (height !== 0)\n {\n this.scale.y = value / height;\n }\n else\n {\n this.scale.y = 1;\n }\n\n this._height = value;\n }\n}\n\n/**\n * Container default updateTransform, does update children of container.\n * Will crash if there's no parent element.\n *\n * @memberof PIXI.Container#\n * @method containerUpdateTransform\n */\nContainer.prototype.containerUpdateTransform = Container.prototype.updateTransform;\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar punycode = require('punycode');\nvar util = require('./util');\n\nexports.parse = urlParse;\nexports.resolve = urlResolve;\nexports.resolveObject = urlResolveObject;\nexports.format = urlFormat;\n\nexports.Url = Url;\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 querystring = require('querystring');\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\nfunction urlResolveObject(source, relative) {\n if (!source) return relative;\n return urlParse(source, false, true).resolveObject(relative);\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","/*! https://mths.be/punycode v1.4.1 by @mathias */\n;(function(root) {\n\n\t/** Detect free variables */\n\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t!exports.nodeType && exports;\n\tvar freeModule = typeof module == 'object' && module &&\n\t\t!module.nodeType && module;\n\tvar freeGlobal = typeof global == 'object' && global;\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 new 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 * https://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.4.1',\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 (\n\t\ttypeof define == 'function' &&\n\t\ttypeof define.amd == 'object' &&\n\t\tdefine.amd\n\t) {\n\t\tdefine('punycode', function() {\n\t\t\treturn punycode;\n\t\t});\n\t} else if (freeExports && freeModule) {\n\t\tif (module.exports == freeExports) {\n\t\t\t// in Node.js, io.js, or RingoJS v0.8.0+\n\t\t\tfreeModule.exports = punycode;\n\t\t} else {\n\t\t\t// 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 {\n\t\t// in Rhino or a web browser\n\t\troot.punycode = punycode;\n\t}\n\n}(this));\n","'use strict';\n\nmodule.exports = {\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","'use strict';\n\nexports.decode = exports.parse = require('./decode');\nexports.encode = exports.stringify = require('./encode');\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\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\nmodule.exports = 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 (isArray(obj[k])) {\n obj[k].push(v);\n } else {\n obj[k] = [obj[k], v];\n }\n }\n\n return obj;\n};\n\nvar isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\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\nmodule.exports = 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 map(objectKeys(obj), function(k) {\n var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n if (isArray(obj[k])) {\n return map(obj[k], 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 isArray = Array.isArray || function (xs) {\n return Object.prototype.toString.call(xs) === '[object Array]';\n};\n\nfunction map (xs, f) {\n if (xs.map) return xs.map(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n res.push(f(xs[i], i));\n }\n return res;\n}\n\nvar objectKeys = Object.keys || function (obj) {\n var res = [];\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);\n }\n return res;\n};\n"],"sourceRoot":""}