frost-sequence-camera-orbit

ISSUES FOUND max severity CRITICALSkillSpector Do not install 99 registry heygen-com last scanned 1 scan

13 findings (3 critical, 4 medium, 5 low, 1 info), mainly command injection, supply chain attack, unauthorized tool use. Most recent scan 2026-10-22.

Second scanner: NVIDIA SkillSpector

Independent static run, no language model, over the same files as the Cisco scan above. How the two scanners compare across the whole corpus: Two scanners, one corpus.

What this skill does

An orbiting camera follows an ice logo as it breaks apart, reforms into two text moments, and fades. HyperFrames block, 1920×1080, 22.5s, 216 variables.

Package
83 files, 2.7 MB
SKILL.md
3679 words, 6 sections
Code
TypeScript (55), JavaScript (6)

SKILL.md covers: Frost Sequence Camera Orbit · Files · Install · Variables · Runtime contract · Editing rules (from the source project)

Findings

CRITICAL Dangerous code execution functions that can execute arbitrary code Command Injectionstatic

Pattern detected: compile(

assets/frost.js:41

Reason: ${e.reason}`),Ce(t),this._isDeviceLost=!0}_onError(e){let t=`WebGPURenderer: Uncaptured ${e.api} ${e.type}`;e.message&&(t+=`: ${e.message}`),Ce(t)}_bundleNeedsUpdate(e,t){return t.bundleGPU===void 0||e.version!==t.version}_renderBundle(e,t,r){let{bundleGroup:i,camera:s,renderList:a}=e,n=this._currentRenderContext,o=this._bundles.get(i,s,n),l=this.backend.get(o);if(this._bundleNeedsUpdate(i,l)){this.backend.beginBundle(n),this._currentRenderBundle=o;let{transparentDoublePass:u,transparent:h,opaque:d}=a;this.opaque===!0&&d.length>0&&this._renderObjects(d,s,t,r),this.transparent===!0&&h.length>0&&this._renderTransparents(h,u,s,t,r),this._currentRenderBundle=null,this.backend.finishBundle(n,o),l.version=i.version}else{let{renderObjects:u}=l;for(let h=0,d=u.length;h<d;h++){let c=u[h];this._nodes.needsRefresh(c)&&(this._nodes.updateBefore(c),this._geometries.updateForRender(c),this._nodes.updateForRender(c),this._bindings.updateForRender(c),this._nodes.updateAfter(c))}}this.backend.addBundle(n,o)}render(e,t){if(this._initialized===!1)throw new Error('THREE.Renderer: .render() called before the backend is initialized. Use "await renderer.init();" before rendering.');this._renderScene(e,t)}get initialized(){return this._initialized}_renderOutputLayers(e,t){if(t.texture.isArrayTexture!==!0||t.texture.image.depth<=1){this._renderScene(e,e.camera,!1);return}let r=this._activeCubeFace;try{for(let i=0;i<t.texture.image.depth;i++)this._nodes.setOutputLayerIndex(i),this._activeCubeFace=i,this._renderScene(e,e.camera,!1)}finally{this._nodes.setOutputLayerIndex(0),this._activeCubeFace=r}}_getFrameBufferTarget(){let{currentToneMapping:e,currentColorSpace:t}=this,r=e!==eo,i=t!==Gt.workingColorSpace;if(r===!1&&i===!1)return null;let{width:s,height:a}=this.getDrawingBufferSize(zd),{depth:n,stencil:o}=this,l=this._outputRenderTarget||this._canvasTarget,u=this._frameBufferTargets.get(l);if(u===void 0){u=new er(s,a,{depthBuffer:n,stencilBuffer:o,type:this._outputBufferType,format:pi,colorSpace:Gt.workingColorSpace,generateMipmaps:!1,minFilter:lr,magFilter:lr,samples:this.samples}),u.isPostProcessingRenderTarget=!0;let y=()=>{l.removeEventListener("dispose",y),u.dispose(),this._frameBufferTargets.delete(l)};l.addEventListener("dispose",y),this._frameBufferTargets.set(l,u)}let h=this.getOutputRenderTarget();u.depthBuffer=n,u.stencilBuffer=o,h!==null?u.setSize(h.width,h.height,h.depth):u.setSize(s,a,1);let d=this._outputRenderTarget?this._outputRenderTarget.viewport:l._viewport,c=this._outputRenderTarget?this._outputRenderTarget.scissor:l._scissor,m=this._outputRenderTarget?1:l._pixelRatio,g=this._outputRenderTarget?this._outputRenderTarget.scissorTest:l._scissorTest;return u.viewport.copy(d),u.scissor.copy(c),u.viewport.multiplyScalar(m),u.scissor.multiplyScalar(m),u.scissorTest=g,u.multiview=h!==null?h.multiview:!1,u.useArrayDepthTexture=h!==null?h.useArrayDepthTexture:!1,u.resolveDepthBuffer=h!==null?h.resolveDepthBuffer:!0,u._autoAllocateDepthBuffer=h!==null?h._autoAllocateDepthBuffer:!1,u}_renderScene(e,t,r=!0){if(this._isDeviceLost===!0)return;let i=r?this._getFrameBufferTarget():null,s=this._nodes.nodeFrame,a=s.renderId,n=this._currentRenderContext,o=this._currentRenderObjectFunction,l=this._handleObjectFunction;this.lighting.beginRender(e),this._callDepth++;let u=e.isScene===!0?e:F3,h=this._renderTarget||this._outputRenderTarget,d=this._activeCubeFace,c=this._activeMipmapLevel,m;if(i!==null?(m=i,this.setRenderTarget(m)):m=h,m!==null&&m.depthBuffer===!0){let L=this._textures.get(m);L.depthInitialized!==!0&&((this.autoClear===!1||this.autoClear===!0&&this.autoClearDepth===!1)&&this.clearDepth(),L.depthInitialized=!0)}let g=this._renderContexts.get(m,this._mrt,this._callDepth);this._currentRenderContext=g,this._currentRenderObjectFunction=this._renderObjectFunction||this.renderObject,this._handleObjectFunction=this._renderObjectDirect,this.info.calls++,this.info.render.calls++,this.info.render.frameCalls++,s.renderId=this.info.calls,this.backend.updateTimeStampUID(g),this.inspector.beginRender(this.backend.getTimestampUID(g),e,t,m),e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t=this._updateCamera(t);let y=this._canvasTarget,b=y._viewport,v=y._scissor,S=y._pixelRatio;m!==null&&(b=m.viewport,v=m.scissor,S=1),this.getDrawingBufferSize(zd),JS.set(0,0,zd.width,zd.height);let T=b.minDepth===void 0?0:b.minDepth,w=b.maxDepth===void 0?1:b.maxDepth;g.viewportValue.copy(b).multiplyScalar(S).floor(),g.viewportValue.width>>=c,g.viewportValue.height>>=c,g.viewportValue.minDepth=T,g.viewportValue.maxDepth=w,g.viewport=g.viewportValue.equals(JS)===!1,g.scissorValue.copy(v).multiplyScalar(S).floor(),g.scissor=y._scissorTest&&g.scissorValue.equals(JS)===!1,g.scissorValue.width>>=c,g.scissorValue.height>>=c,g.clippingContext||(g.clippingContext=new A3),g.clippingContext.updateGlobal(u,t),u.onBeforeRender(this,e,t,m);let N=t.isArrayCamera?My:wy;t.isArrayCamera?N.setFromArrayCamera(t):(Vd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),N.setFromProjectionMatrix(Vd,t.coordinateSystem,t.reversedDepth));let C=this._renderLists.get(e,t);if(C.begin(),this._projectObject(e,t,0,C,g.clippingContext),C.finish(),this.sortObjects===!0&&C.sort(this._opaqueSort,this._transparentSort,t.reversedDepth),m!==null){this._textures.updateRenderTarget(m,c);let L=this._textures.get(m);g.textures=L.textures,g.depthTexture=L.depthTexture,g.width=L.width,g.height=L.height,g.renderTarget=m,g.depth=m.depthBuffer,g.stencil=m.stencilBuffer}else g.textures=null,g.depthTexture=null,g.width=zd.width,g.height=zd.height,g.depth=this.depth,g.stencil=this.stencil;g.width>>=c,g.height>>=c,g.activeCubeFace=d,g.activeMipmapLevel=c,g.occlusionQueryCount=C.occlusionQueryCount,g.scissorValue.max(No.set(0,0,0,0)),g.scissorValue.x+g.scissorValue.width>g.width&&(g.scissorValue.width=Math.max(g.width-g.scissorValue.x,0)),g.scissorValue.y+g.scissorValue.height>g.height&&(g.scissorValue.height=Math.max(g.height-g.scissorValue.y,0)),this._background.update(u,C,g),g.camera=t,this.backend.beginRender(g);let{bundles:R,lightsNode:E,transparentDoublePass:P,transparent:I,opaque:O}=C;return R.length>0&&this._renderBundles(R,u,E),this.opaque===!0&&O.length>0&&this._renderObjects(O,t,u,E),this.transparent===!0&&I.length>0&&this._renderTransparents(I,P,t,u,E),this.backend.finishRender(g),s.renderId=a,this._currentRenderContext=n,this._currentRenderObjectFunction=o,this._handleObjectFunction=l,this.lighting.finishRender(e),this._callDepth--,i!==null&&(this.setRenderTarget(h,d,c),this._renderOutput(m)),u.onAfterRender(this,e,t,m),this.inspector.finishRender(this.backend.getTimestampUID(g)),g}_setXRLayerSize(e,t){this._canvasTarget._width=e,this._canvasTarget._height=t,this.setViewport(0,0,e,t)}_renderOutput(e){let t=this._nodes.getOutputCacheKey(),r=this._quadCache.get(e.texture),i;if(r===void 0){i=new Wa(new Pt),i.name="Output Color Transform",i.material.name="outputColorTransform",i.material.fragmentNode=this._nodes.getOutputNode(e.texture),r={quad:i,cacheKey:t},this._quadCache.set(e.texture,r);let n=()=>{i.material.dispose(),this._quadCache.delete(e.texture),e.texture.removeEventListener("dispose",n)};e.texture.addEventListener("dispose",n)}else i=r.quad,r.cacheKey!==t&&(i.material.fragmentNode=this._nodes.getOutputNode(e.texture),i.material.needsUpdate=!0,r.cacheKey=t);let s=this.autoClear,a=this.xr.enabled;this.autoClear=!1,this.xr.enabled=!1,this._renderOutputLayers(i,e),this.autoClear=s,this.xr.enabled=a}getMaxAnisotropy(){return this.backend.capabilities.getMaxAnisotropy()}getActiveCubeFace(){return this._activeCubeFace}getActiveMipmapLevel(){return this._activeMipmapLevel}async setAnimationLoop(e){this._initialized===!1&&await this.init(),this._animation.setAnimationLoop(e)}getAnimationLoop(){return this._animation.getAnimationLoop()}async getArrayBufferAsync(e,t=null,r=0,i=-1){if(t!==null&&t.isReadbackBuffer&&this.info.memoryMap.has(t)===!1){this.info.createReadbackBuffer(t);let s=()=>{t.removeEventListener("dispose",s),this.info.destroyReadbackBuffer(t)};t.addEventListener("dispose",s)}if(r%4!==0||i>0&&i%4!==0)throw new Error('THREE.Renderer: "getArrayBufferAsync()" offset and count must be a multiple of 4.');return await this.backend.getArrayBufferAsync(e,t,r,i)}getContext(){return this.backend.getContext()}getPixelRatio(){return this._canvasTarget.getPixelRatio()}getDrawingBufferSize(e){return this._canvasTarget.getDrawingBufferSize(e)}getSize(e){return this._canvasTarget.getSize(e)}setPixelRatio(e=1){this._canvasTarget.setPixelRatio(e)}setDrawingBufferSize(e,t,r){this.xr&&this.xr.isPresenting||this._canvasTarget.setDrawingBufferSize(e,t,r)}setSize(e,t,r=!0){this.xr&&this.xr.isPresenting||this._canvasTarget.setSize(e,t,r)}setOpaqueSort(e){this._opaqueSort=e}setTransparentSort(e){this._transparentSort=e}getScissor(e){return this._canvasTarget.getScissor(e)}setScissor(e,t,r,i){this._canvasTarget.setScissor(e,t,r,i)}getScissorTest(){return this._canvasTarget.getScissorTest()}setScissorTest(e){this._canvasTarget.setScissorTest(e),this.backend.setScissorTest(e)}getViewport(e){return this._canvasTarget.getViewport(e)}setViewport(e,t,r,i,s=0,a=1){this._canvasTarget.setViewport(e,t,r,i,s,a)}getClearColor(e){return e.copy(this._clearColor)}setClearColor(e,t=1){this._clearColor.set(e),this._clearColor.a=t}getClearAlpha(){return this._clearColor.a}setClearAlpha(e){this._clearColor.a=e}getClearDepth(){return this.reversedDepthBuffer===!0?1-this._clearDepth:this._clearDepth}setClearDepth(e){this._clearDepth=e}getClearStencil(){return this._clearStencil}setClearStencil(e){this._clearStencil=e}isOccluded(e){let t=this._currentRenderContext;return t&&this.backend.isOccluded(t,e)}clear(e=!0,t=!0,r=!0){if(this._initialized===!1)throw new Error('THREE.Renderer: .clear() called before the backend is initialized. Use "await renderer.init();" before using this method.');let i=this._renderTarget||this._getFrameBufferTarget(),s=null;if(i!==null){this._textures.updateRenderTarget(i);let a=this._textures.get(i);s=this._renderContexts.get(i,null,-1),s.textures=a.textures,s.depthTexture=a.depthTexture,s.width=a.width,s.height=a.height,s.renderTarget=i,s.depth=i.depthBuffer,s.stencil=i.stencilBuffer;let n=this.backend.getClearColor();s.clearColorValue.r=n.r,s.clearColorValue.g=n.g,s.clearColorValue.b=n.b,s.clearColorValue.a=n.a,s.clearDepthValue=this.getClearDepth(),s.clearStencilValue=this.getClearStencil(),s.activeCubeFace=this.getActiveCubeFace(),s.activeMipmapLevel=this.getActiveMipmapLevel(),i.depthBuffer===!0&&(a.depthInitialized=!0)}this.backend.clear(e,t,r,s),i!==null&&this._renderTarget===null&&this._renderOutput(i)}clearColor(){this.clear(!0,!1,!1)}clearDepth(){this.clear(!1,!0,!1)}clearStencil(){this.clear(!1,!1,!0)}async clearAsync(e=!0,t=!0,r=!0){Et('Renderer: "clearAsync()" has been deprecated. Use "clear()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.clear(e,t,r)}async clearColorAsync(){Et('Renderer: "clearColorAsync()" has been deprecated. Use "clearColor()" and "await renderer.init();" when creating the renderer.'),this.clear(!0,!1,!1)}async clearDepthAsync(){Et('Renderer: "clearDepthAsync()" has been deprecated. Use "clearDepth()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!0,!1)}async clearStencilAsync(){Et('Renderer: "clearStencilAsync()" has been deprecated. Use "clearStencil()" and "await renderer.init();" when creating the renderer.'),this.clear(!1,!1,!0)}get needsFrameBufferTarget(){let e=this.currentToneMapping!==eo,t=this.currentColorSpace!==Gt.workingColorSpace;return e||t}get samples(){return this._samples}get currentSamples(){let e=this._samples;return this._renderTarget!==null?e=this._renderTarget.samples:this.needsFrameBufferTarget&&(e=0),e}get currentToneMapping(){return this.isOutputTarget?this.toneMapping:eo}get currentColorSpace(){return this.isOutputTarget?this.outputColorSpace:Gt.workingColorSpace}get isOutputTarget(){return this._renderTarget===this._outputRenderTarget||this._renderTarget===null}dispose(){if(this._initialized===!0){this.info.dispose(),this.backend.dispose(),this._animation.dispose(),this._objects.dispose(),this._geometries.dispose(),this._pipelines.dispose(),this._nodes.dispose(),this._bindings.dispose(),this._renderLists.dispose(),this._renderContexts.dispose(),this._textures.dispose();for(let e of this._frameBufferTargets.keys())e.dispose();Object.values(this.backend.timestampQueryPool).forEach(e=>{e!==null&&e.dispose()})}this.setRenderTarget(null),this.setAnimationLoop(null)}setRenderTarget(e,t=0,r=0){this._renderTarget=e,this._activeCubeFace=t,this._activeMipmapLevel=r}getRenderTarget(){return this._renderTarget}setOutputRenderTarget(e){this._outputRenderTarget=e}getOutputRenderTarget(){return this._outputRenderTarget}setCanvasTarget(e){this._canvasTarget.removeEventListener("resize",this._onCanvasTargetResize),this._canvasTarget=e,this._canvasTarget.addEventListener("resize",this._onCanvasTargetResize)}getCanvasTarget(){return this._canvasTarget}_resetXRState(){this.backend.setXRTarget(null),this.setOutputRenderTarget(null),this.setRenderTarget(null);for(let e of this._frameBufferTargets.keys())e.dispose()}setRenderObjectFunction(e){this._renderObjectFunction=e}getRenderObjectFunction(){return this._renderObjectFunction}compute(e,t=null){if(this._isDeviceLost===!0)return;if(this._initialized===!1)return Ue("Renderer: .compute() called before the backend is initialized. Try using .computeAsync() instead."),this.computeAsync(e,t);let r=this._nodes.nodeFrame,i=r.renderId;this.info.calls++,this.info.compute.calls++,this.info.compute.frameCalls++,r.renderId=this.info.calls,this.backend.updateTimeStampUID(e),this.inspector.beginCompute(this.backend.getTimestampUID(e),e);let s=this.backend,a=this._pipelines,n=this._bindings,o=this._nodes,l=Array.isArray(e)?e:[e];if(l[0]===void 0||l[0].isComputeNode!==!0)throw new Error("THREE.Renderer: .compute() expects a ComputeNode.");s.beginCompute(e);for(let u of l){if(a.has(u)===!1){let c=()=>{u.removeEventListener("dispose",c),a.delete(u),n.deleteForCompute(u),o.delete(u)};u.addEventListener("dispose",c);let m=u.onInitFunction;m!==null&&m.call(u,{renderer:this})}o.updateForCompute(u),n.updateForCompute(u);let h=n.getForCompute(u),d=a.getForCompute(u,h);s.compute(e,u,h,d,t)}s.finishCompute(e),r.renderId=i,this.inspector.finishCompute(this.backend.getTimestampUID(e))}async computeAsync(e,t=null){this._initialized===!1&&await this.init(),this.compute(e,t)}async hasFeatureAsync(e){return Et('Renderer: "hasFeatureAsync()" has been deprecated. Use "hasFeature()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.hasFeature(e)}async resolveTimestampsAsync(e="render"){return this._initialized===!1&&await this.init(),this.backend.resolveTimestampsAsync(e)}hasFeature(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasFeature() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasFeature(e)}hasInitialized(){return this._initialized}async initTextureAsync(e){Et('Renderer: "initTextureAsync()" has been deprecated. Use "initTexture()" and "await renderer.init();" when creating the renderer.'),await this.init(),this.initTexture(e)}initTexture(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initTexture() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateTexture(e)}initRenderTarget(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .initRenderTarget() called before the backend is initialized. Use "await renderer.init();" before using this method.');this._textures.updateRenderTarget(e);let t=this._textures.get(e),r=this._renderContexts.get(e);r.textures=t.textures,r.depthTexture=t.depthTexture,r.width=t.width,r.height=t.height,r.renderTarget=e,r.depth=e.depthBuffer,r.stencil=e.stencilBuffer,this.backend.initRenderTarget(r)}copyFramebufferToTexture(e,t=null){if(t!==null)if(t.isVector2)t=No.set(t.x,t.y,e.image.width,e.image.height).floor();else if(t.isVector4)t=No.copy(t).floor();else{Ce("Renderer.copyFramebufferToTexture: Invalid rectangle.");return}else t=No.set(0,0,e.image.width,e.image.height);let r=this._currentRenderContext,i;r!==null?i=r.renderTarget:(i=this._renderTarget||this._getFrameBufferTarget(),i!==null&&(this._textures.updateRenderTarget(i),r=this._textures.get(i))),this._textures.updateTexture(e,{renderTarget:i}),this.backend.copyFramebufferToTexture(e,r,t),this._inspector.copyFramebufferToTexture(e)}copyTextureToTexture(e,t,r=null,i=null,s=0,a=0){this._textures.updateTexture(e),this._textures.updateTexture(t),this.backend.copyTextureToTexture(e,t,r,i,s,a),this._inspector.copyTextureToTexture(e,t)}async readRenderTargetPixelsAsync(e,t,r,i,s,a=0,n=0){return this.backend.copyTextureToBuffer(e.textures[a],t,r,i,s,n)}_projectObject(e,t,r,i,s){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)r=e.renderOrder,e.isClippingGroup&&e.enabled&&(s=s.getGroupContext(e));else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)i.pushLight(e);else if(e.isSprite){let n=t.isArrayCamera?My:wy;if(!e.frustumCulled||n.intersectsSprite(e)){this.sortObjects===!0&&No.setFromMatrixPosition(e.matrixWorld).applyMatrix4(Vd);let{geometry:o,material:l}=e;l.visible&&i.push(e,o,l,r,No.z,null,s)}}else if(e.isLineLoop)Ce("Renderer: Objects of type THREE.LineLoop are not supported. Please use THREE.Line or THREE.LineSegments.");else if(e.isMesh||e.isLine||e.isPoints){let n=t.isArrayCamera?My:wy;if(!e.frustumCulled||n.intersectsObject(e)){let{geometry:o,material:l}=e;if(this.sortObjects===!0&&(o.boundingSphere===null&&o.computeBoundingSphere(),No.copy(o.boundingSphere.center).applyMatrix4(e.matrixWorld).applyMatrix4(Vd)),Array.isArray(l)){let u=o.groups;for(let h=0,d=u.length;h<d;h++){let c=u[h],m=l[c.materialIndex];m&&m.visible&&i.push(e,o,m,r,No.z,c,s)}}else l.visible&&i.push(e,o,l,r,No.z,null,s)}}}if(e.isBundleGroup===!0&&this.backend.beginBundle!==void 0){let n=i;i=this._renderLists.get(e,t);let o=this._bundles.get(e,t,this._currentRenderContext),l=this.backend.get(o);if(this._bundleNeedsUpdate(e,l)){i.begin(),l.renderObjects===void 0?l.renderObjects=[]:l.renderObjects.length=0;let u=e.children;for(let h=0,d=u.length;h<d;h++)this._projectObject(u[h],t,r,i,s);i.finish()}n.pushBundle({bundleGroup:e,camera:t,renderList:i});return}let a=e.children;for(let n=0,o=a.length;n<o;n++)this._projectObject(a[n],t,r,i,s)}_renderBundles(e,t,r){for(let i of e)this._renderBundle(i,t,r)}_renderTransparents(e,t,r,i,s){if(t.length>0){for(let{material:a}of t)a.side=ii;this._renderObjects(t,r,i,s,"backSide");for(let{material:a}of t)a.side=Cs;this._renderObjects(e,r,i,s);for(let{material:a}of t)a.side=hs}else this._renderObjects(e,r,i,s)}_renderObjects(e,t,r,i,s=null){for(let a=0,n=e.length;a<n;a++){let{object:o,geometry:l,material:u,group:h,clippingContext:d}=e[a];this._currentRenderObjectFunction(o,r,t,l,u,h,i,d,s)}}_getShadowNodes(e){let t=e.version,r=this._cacheShadowNodes.get(e);if(r===void 0||r.version!==t){let i=e.map&&e.map.isTexture,s=e.colorNode&&e.colorNode.isNode,a=e.castShadowNode&&e.castShadowNode.isNode,n=e.maskShadowNode&&e.maskShadowNode.isNode||e.maskNode&&e.maskNode.isNode,o=null,l=null,u=null;if(i||s||a||n){let h,d;if(a?(h=e.castShadowNode.rgb,d=e.castShadowNode.a,this.shadowMap.transmitted!==!0&&Et("Renderer: `shadowMap.transmitted` needs to be set to `true` when using `material.castShadowNode`.")):(h=K(0),d=D(1)),i&&(d=d.mul(cr("map","texture",e).a)),s&&(d=d.mul(e.colorNode.a)),l=Ve(h,d),n){let c=e.maskShadowNode||e.maskNode;l=Q(([m])=>(c.not().discard(),m))(l)}}e.depthNode&&e.depthNode.isNode&&(u=e.depthNode),e.castShadowPositionNode&&e.castShadowPositionNode.isNode?o=e.castShadowPositionNode:e.positionNode&&e.positionNode.isNode&&(o=e.positionNode),r={version:t,colorNode:l,depthNode:u,positionNode:o},this._cacheShadowNodes.set(e,r)}return r}_updateCamera(e){let t=this.xr;if(t.isPresenting===!1){let r=!1;if(this.reversedDepthBuffer===!0&&e.reversedDepth!==!0){if(e._reversedDepth=!0,e.isArrayCamera)for(let s of e.cameras)s._reversedDepth=!0;r=!0}let i=this.coordinateSystem;if(e.coordinateSystem!==i){if(e.coordinateSystem=i,e.isArrayCamera)for(let s of e.cameras)s.coordinateSystem=i;r=!0}if(r===!0&&(e.updateProjectionMatrix(),e.isArrayCamera))for(let s of e.cameras)s.updateProjectionMatrix()}return e.parent===null&&e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.enabled===!0&&t.isPresenting===!0&&(t.cameraAutoUpdate===!0&&t.updateCamera(e),e=t.getCamera()),e}renderObject(e,t,r,i,s,a,n,o=null,l=null){let u=!1,h,d,c,m,g,y,b,v=this._currentSourceMaterial;if(e.onBeforeRender(this,t,r,i,s,a),s.allowOverride===!0&&t.overrideMaterial!==null){this._currentSourceMaterial=s;let S=t.overrideMaterial;if(u=!0,h=S.isNodeMaterial?S.colorNode:null,d=S.isNodeMaterial?S.depthNode:null,c=S.isNodeMaterial?S.positionNode:null,m=t.overrideMaterial.side,g=S.displacementMap,y=S.displacementScale,b=S.displacementBias,s.positionNode&&s.positionNode.isNode&&(S.positionNode=s.positionNode),S.alphaTest=s.alphaTest,S.alphaMap=s.alphaMap,S.displacementMap=s.displacementMap,S.displacementScale=s.displacementScale,S.displacementBias=s.displacementBias,S.transparent=s.transparent||s.transmission>0||s.transmissionNode&&s.transmissionNode.isNode||s.backdropNode&&s.backdropNode.isNode,S.isShadowPassMaterial){let{colorNode:T,depthNode:w,positionNode:N}=this._getShadowNodes(s);this.shadowMap.type===Lh?S.side=s.shadowSide!==null?s.shadowSide:s.side:S.side=s.shadowSide!==null?s.shadowSide:DH[s.side],T!==null&&(S.colorNode=T),w!==null&&(S.depthNode=w),N!==null&&(S.positionNode=N)}s=S}s.transparent===!0&&s.side===hs&&s.forceSinglePass===!1?(s.side=ii,this._handleObjectFunction(e,s,t,r,n,a,o,"backSide"),s.side=Cs,this._handleObjectFunction(e,s,t,r,n,a,o,l),s.side=hs):this._handleObjectFunction(e,s,t,r,n,a,o,l),u&&(t.overrideMaterial.colorNode=h,t.overrideMaterial.depthNode=d,t.overrideMaterial.positionNode=c,t.overrideMaterial.side=m,t.overrideMaterial.displacementMap=g,t.overrideMaterial.displacementScale=y,t.overrideMaterial.displacementBias=b),this._currentSourceMaterial=v,e.onAfterRender(this,t,r,i,s,a)}hasCompatibility(e){if(this._initialized===!1)throw new Error('THREE.Renderer: .hasCompatibility() called before the backend is initialized. Use "await renderer.init();" before using this method.');return this.backend.hasCompatibility(e)}_renderObjectDirect(e,t,r,i,s,a,n,o){let l=this._objects.get(e,t,r,i,s,this._currentRenderContext,n,o);l.drawRange=e.geometry.drawRange,l.group=a,this._currentRenderBundle!==null&&(this.backend.get(this._currentRenderBundle).renderObjects.push(l),l.bundle=this._currentRenderBundle.bundleGroup);let u=this._nodes.needsRefresh(l);u&&(this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l)),this._pipelines.updateForRender(l),this._pipelines.isReady(l)&&(this.backend.draw(l,this.info),u&&this._nodes.updateAfter(l))}_createObjectPipeline(e,t,r,i,s,a,n,o){if(this._compilationPromises!==null){this._compilationPromises.push({object:e,material:t,scene:r,camera:i,lightsNode:s,group:a,clippingContext:n,passId:o,renderContext:this._currentRenderContext});return}let l=this._objects.get(e,t,r,i,s,this._currentRenderContext,n,o);l.drawRange=e.geometry.drawRange,l.group=a,this._nodes.updateBefore(l),this._geometries.updateForRender(l),this._nodes.updateForRender(l),this._bindings.updateForRender(l),this._pipelines.getForRender(l,this._compilationPromises),this._nodes.updateAfter(l)}_onCanvasTargetResize(){this._initialized&&this.backend.updateSize()}get compile(){return this.compileAsync}},L3=class{constructor(e=""){this.name=e,this.visibility=0}setVisibility(e){this.visibility|=e}getVisibility(){return this.visibility}clone(){return Object.assign(new this.constructor,this)}};function k3(e){return e+(Al-e%Al)%Al}var D3=class extends L3{constructor(e,t=null){super(e),this.isBuffer=!0,this.bytesPerElement=Float32Array.BYTES_PER_ELEMENT,this._buffer=t,this._updateRanges=[]}get updateRanges(){return this._updateRanges}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}get byteLength(){return k3(this._buffer.byteLength)}get buffer(){return this._buffer}update(){return!0}release(){this._buffer=null}},O3=class extends D3{constructor(e,t=null){super(e,t),this.isUniformBuffer=!0}},UH=0,U3=class extends O3{constructor(e,t){super("UniformBuffer_"+UH++,e?e.value:null),this.nodeUniform=e,this.groupNode=t,this.isNodeUniformBuffer=!0}set updateRanges(e){this.nodeUniform.updateRanges=e}get updateRanges(){return this.nodeUniform.updateRanges}addUpdateRange(e,t){this.nodeUniform.addUpdateRange(e,t)}clearUpdateRanges(){this.nodeUniform.clearUpdateRanges()}get byteLength(){return k3(this.buffer.byteLength)}get buffer(){return this.nodeUniform.value}},zH=class extends O3{constructor(e){super(e),this.isUniformsGroup=!0,this._values=null,this.uniforms=[],this._updateRangeCache=new Map,this._addedIndices=new Set}addUniformUpdateRange(e){let t=e.index;if(this._addedIndices.has(t))return;let r=this._updateRangeCache.get(t);r===void 0&&(r={start:0,count:0},this._updateRangeCache.set(t,r)),r.start=e.offset,r.count=e.itemSize,this._addedIndices.add(t),this.updateRanges.push(r)}clearUpdateRanges(){this._addedIndices.clear(),super.clearUpdateRanges()}addUniform(e){return this.uniforms.push(e),this}removeUniform(e){let t=this.uniforms.indexOf(e);return t!==-1&&this.uniforms.splice(t,1),this}get values(){return this._values===null&&(this._values=Array.from(this.buffer)),this._values}get buffer(){let e=this._buffer;if(e===null){let t=this.byteLength;e=new Float32Array(new ArrayBuffer(t)),this._buffer=e}return e}get byteLength(){let e=this.bytesPerElement,t=0;for(let r=0,i=this.uniforms.length;r<i;r++){let s=this.uniforms[r],a=s.boundary,n=s.itemSize*e,o=t%Al,l=o%a,u=o+l;t+=l,u!==0&&Al-u<n&&(t+=Al-u),s.offset=t/e,s.index=r,t+=n}return Math.ceil(t/Al)*Al}update(){let e=!1;for(let t of this.uniforms)this.updateByType(t)===!0&&(e=!0);return e}release(){super.release(),this._values=null}updateByType(e){if(e.isNumberUniform)return this.updateNumber(e);if(e.isVector2Uniform)return this.updateVector2(e);if(e.isVector3Uniform)return this.updateVector3(e);if(e.isVector4Uniform)return this.updateVector4(e);if(e.isColorUniform)return this.updateColor(e);if(e.isMatrix3Uniform)return this.updateMatrix3(e);if(e.isMatrix4Uniform)return this.updateMatrix4(e);Ce("WebGPUUniformsGroup: Unsupported uniform type.",e)}updateNumber(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset,a=e.getType();if(r[s]!==i){let n=this._getBufferForType(a);n[s]=r[s]=i,t=!0,this.addUniformUpdateRange(e)}return t}updateVector2(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset,a=e.getType();if(r[s+0]!==i.x||r[s+1]!==i.y){let n=this._getBufferForType(a);n[s+0]=r[s+0]=i.x,n[s+1]=r[s+1]=i.y,t=!0,this.addUniformUpdateRange(e)}return t}updateVector3(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset,a=e.getType();if(r[s+0]!==i.x||r[s+1]!==i.y||r[s+2]!==i.z){let n=this._getBufferForType(a);n[s+0]=r[s+0]=i.x,n[s+1]=r[s+1]=i.y,n[s+2]=r[s+2]=i.z,t=!0,this.addUniformUpdateRange(e)}return t}updateVector4(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset,a=e.getType();if(r[s+0]!==i.x||r[s+1]!==i.y||r[s+2]!==i.z||r[s+3]!==i.w){let n=this._getBufferForType(a);n[s+0]=r[s+0]=i.x,n[s+1]=r[s+1]=i.y,n[s+2]=r[s+2]=i.z,n[s+3]=r[s+3]=i.w,t=!0,this.addUniformUpdateRange(e)}return t}updateColor(e){let t=!1,r=this.values,i=e.getValue(),s=e.offset;if(r[s+0]!==i.r||r[s+1]!==i.g||r[s+2]!==i.b){let a=this.buffer;a[s+0]=r[s+0]=i.r,a[s+1]=r[s+1]=i.g,a[s+2]=r[s+2]=i.b,t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix3(e){let t=!1,r=this.values,i=e.getValue().elements,s=e.offset;if(r[s+0]!==i[0]||r[s+1]!==i[1]||r[s+2]!==i[2]||r[s+4]!==i[3]||r[s+5]!==i[4]||r[s+6]!==i[5]||r[s+8]!==i[6]||r[s+9]!==i[7]||r[s+10]!==i[8]){let a=this.buffer;a[s+0]=r[s+0]=i[0],a[s+1]=r[s+1]=i[1],a[s+2]=r[s+2]=i[2],a[s+4]=r[s+4]=i[3],a[s+5]=r[s+5]=i[4],a[s+6]=r[s+6]=i[5],a[s+8]=r[s+8]=i[6],a[s+9]=r[s+9]=i[7],a[s+10]=r[s+10]=i[8],t=!0,this.addUniformUpdateRange(e)}return t}updateMatrix4(e){let t=!1,r=this.values,i=e.getValue().elements,s=e.offset;return GH(r,i,s)===!1&&(this.buffer.set(i,s),VH(r,i,s),t=!0,this.addUniformUpdateRange(e)),t}_getBufferForType(e){return e==="int"||e==="ivec2"||e==="ivec3"||e==="ivec4"?new Int32Array(this.buffer.buffer):e==="uint"||e==="uvec2"||e==="uvec3"||e==="uvec4"?new Uint32Array(this.buffer.buffer):this.buffer}};function VH(e,t,r){for(let i=0,s=t.length;i<s;i++)e[r+i]=t[i]}function GH(e,t,r){for(let i=0,s=t.length;i<s;i++)if(e[r+i]!==t[i])return!1;return!0}var WH=0,z3=class extends zH{constructor(e,t){super(e),this.id=WH++,this.groupNode=t,this.isNodeUniformsGroup=!0}},V3=class extends L3{constructor(e,t){super(e),this._texture=t,this.version=-1,this.generation=null,this.samplerKey="",this.isSampler=!0}set texture(e){this._texture!==e&&(this._texture=e,this.reset())}get texture(){return this._texture}update(){let{texture:e,version:t}=this;return t!==e.version?(this.version=e.version,!0):!1}reset(){this.generation=null,this.version=-1}release(){this._texture=null}},jH=0,HH=class extends V3{constructor(e,t){super(e,t),this.id=jH++,this.store=!1,this.mipLevel=0,this.isSampledTexture=!0}},Ny=class extends HH{constructor(e,t,r,i=null){super(e,t?t.value:null),this.textureNode=t,this.groupNode=r,this.access=i}update(){let{textureNode:e}=this;return this.texture!==e.value?(this.texture=e.value,!0):super.update()}},G3=class extends Ny{constructor(e,t,r,i=null){super(e,t,r,i),this.isSampledCubeTexture=!0}},QS=class extends Ny{constructor(e,t,r,i=null){super(e,t,r,i),this.isSampledTexture3D=!0}},W3={bitcast_int_uint:new pr("uint tsl_bitcast_int_to_uint ( int x ) { return floatBitsToUint( intBitsToFloat ( x ) ); }"),bitcast_uint_int:new pr("uint tsl_bitcast_uint_to_int ( uint x ) { return floatBitsToInt( uintBitsToFloat ( x ) ); }"),textureGather:new pr(`
Remediation: Avoid eval(), exec(), and compile(). Use safer alternatives like ast.literal_eval() or operator module
CRITICAL Node.js child_process module usage for shell command execution Command Injectionstatic

Pattern detected: from "node:child_process"

source/tools/run-shard-compile.mjs:4

import { spawnSync } from "node:child_process";
Remediation: Avoid child_process. If required, use execFile with explicit arguments instead of exec with shell strings
CRITICAL Node.js child_process module usage for shell command execution Command Injectionstatic

Pattern detected: spawnSync(

source/tools/run-shard-compile.mjs:23

const result = spawnSync(process.execPath, [outfile], { stdio: "inherit" });
Remediation: Avoid child_process. If required, use execFile with explicit arguments instead of exec with shell strings
MEDIUM Large hex-encoded blob (possible obfuscation) Obfuscationstatic

Pattern detected: \xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC

assets/frost.js:1063

${t}`}},hh=koe;function Pw(e,t=0){let r=3735928559^t,i=1103547991^t;if(Array.isArray(e))for(let s=0,a;s<e.length;s++)a=e[s],r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);else for(let s=0,a;s<e.length;s++)a=e.charCodeAt(s),r=Math.imul(r^a,2654435761),i=Math.imul(i^a,1597334677);return r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(r^r>>>13,3266489909),4294967296*(2097151&i)+(r>>>0)}var Doe=e=>Pw(e),Ooe=e=>Pw(e),Uoe=(...e)=>Pw(e);function Bw(e){if(e==null)return null;let t=typeof e;return e.isNode===!0?"node":t==="number"?"float":t==="boolean"?"bool":t==="string"?"string":t==="function"?"shader":e.isVector2===!0?"vec2":e.isVector3===!0?"vec3":e.isVector4===!0?"vec4":e.isMatrix2===!0?"mat2":e.isMatrix3===!0?"mat3":e.isMatrix4===!0?"mat4":e.isColor===!0?"color":e instanceof ArrayBuffer?"ArrayBuffer":null}function CI(e,...t){let r=e?e.slice(-4):void 0;return t.length===1&&(r==="vec2"?t=[t[0],t[0]]:r==="vec3"?t=[t[0],t[0],t[0]]:r==="vec4"&&(t=[t[0],t[0],t[0],t[0]])),e==="color"?new Rw(...t):r==="vec2"?new Boe(...t):r==="vec3"?new Zl(...t):r==="vec4"?new Ioe(...t):r==="mat2"?new Coe(...t):r==="mat3"?new X1(...t):r==="mat4"?new AI(...t):e==="bool"?t[0]||!1:e==="float"||e==="int"||e==="uint"?t[0]||0:e==="string"?t[0]||"":e==="ArrayBuffer"?Voe(t[0]):null}function zoe(e){let t="",r=new Uint8Array(e);for(let i=0;i<r.length;i++)t+=String.fromCharCode(r[i]);return btoa(t)}function Voe(e){return Uint8Array.from(atob(e),t=>t.charCodeAt(0)).buffer}var Goe=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){let r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){let r=this._listeners;if(r===void 0)return;let i=r[e];if(i!==void 0){let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let r=t[e.type];if(r!==void 0){e.target=this;let i=r.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}},Woe={analyze:"setup",generate:"analyze"},joe=0,RI=class dD extends Goe{static get type(){return"Node"}constructor(t=null){super(),this.nodeType=t,this.updateType=pc.NONE,this.updateBeforeType=pc.NONE,this.updateAfterType=pc.NONE,this.version=0,this.name="",this.global=!1,this.parents=!1,this.isNode=!0,this._beforeNodes=null,this._cacheKey=null,this._uuid=null,this._cacheKeyVersion=0,this.id=joe++,this.stackTrace=null,dD.captureStackTrace===!0&&(this.stackTrace=new hh)}set needsUpdate(t){t===!0&&this.version++}get uuid(){return this._uuid===null&&(this._uuid=Noe.generateUUID()),this._uuid}get type(){return this.constructor.type}onUpdate(t,r){return this.updateType=r,this.update=t.bind(this),this}onFrameUpdate(t){return this.onUpdate(t,pc.FRAME)}onRenderUpdate(t){return this.onUpdate(t,pc.RENDER)}onObjectUpdate(t){return this.onUpdate(t,pc.OBJECT)}onReference(t){return this.updateReference=t.bind(this),this}updateReference(){return this}isGlobal(){return this.global}*getChildren(){for(let{childNode:t}of this._getChildren())yield t}dispose(){this.dispatchEvent({type:"dispose"})}traverse(t){t(this);for(let r of this.getChildren())r.traverse(t)}_getChildren(t=new Set){let r=[];t.add(this);for(let i of Object.getOwnPropertyNames(this)){let s=this[i];if(!(i.startsWith("_")===!0||t.has(s))){if(Array.isArray(s)===!0)for(let a=0;a<s.length;a++){let n=s[a];n&&n.isNode===!0&&r.push({property:i,index:a,childNode:n})}else if(s&&s.isNode===!0)r.push({property:i,childNode:s});else if(s&&Object.getPrototypeOf(s)===Object.prototype)for(let a in s){if(a.startsWith("_")===!0)continue;let n=s[a];n&&n.isNode===!0&&r.push({property:i,index:a,childNode:n})}}}return r}getCacheKey(t=!1,r=null){if(t=t||this.version!==this._cacheKeyVersion,t===!0||this._cacheKey===null){r===null&&(r=new Set);let i=[];for(let{property:s,childNode:a}of this._getChildren(r))i.push(Doe(s.slice(0,-4)),a.getCacheKey(t,r));this._cacheKey=Uoe(Ooe(i),this.customCacheKey()),this._cacheKeyVersion=this.version}return this._cacheKey}customCacheKey(){return this.id}getScope(){return this}getHash(){return String(this.id)}getUpdateType(){return this.updateType}getUpdateBeforeType(){return this.updateBeforeType}getUpdateAfterType(){return this.updateAfterType}getElementType(t){let r=this.getNodeType(t);return t.getElementType(r)}getMemberType(){return"void"}getNodeType(t,r=null){let i=t.getDataFromNode(this),s;return r!==null?(i.typeFromOutput=i.typeFromOutput||{},s=i.typeFromOutput[r],s===void 0&&(s=this.generateNodeType(t,r),i.typeFromOutput[r]=s)):(s=i.type,s===void 0&&(s=this.generateNodeType(t),i.type=s)),s}generateNodeType(t,r=null){let i=t.getNodeProperties(this);return i.outputNode?i.outputNode.getNodeType(t,r):this.nodeType}getShared(t){let r=this.getHash(t),i=t.getNodeFromHash(r),s=null;if(i&&i!==this)s=i;else if(t.context.overrideNodes){let a=t.context.overrideNodes.get(this);if(a){let n=t.getDataFromNode(this);n.isOverwritten!==!0?(n.isOverwritten=!0,s=a(t).overrideNode(this,null),n.sharedNode=s):s=n.sharedNode}}return s||this}getArrayCount(){return null}setup(t){let r=t.getNodeProperties(this),i=0;for(let s of this.getChildren())r["node"+i++]=s;return r.outputNode||null}analyze(t,r=null){let i=t.increaseUsage(this);if(this.parents===!0){let s=t.getDataFromNode(this,"any");s.stages=s.stages||{},s.stages[t.shaderStage]=s.stages[t.shaderStage]||[],s.stages[t.shaderStage].push(r)}if(i===1){let s=t.getNodeProperties(this);for(let a of Object.values(s))a&&a.isNode===!0&&a.build(t,this)}}generate(t,r){let{outputNode:i}=t.getNodeProperties(this);if(i&&i.isNode===!0)return i.build(t,r)}updateBefore(){ns("Abstract function.")}updateAfter(){ns("Abstract function.")}update(){ns("Abstract function.")}before(t){return this._beforeNodes===null&&(this._beforeNodes=[]),this._beforeNodes.push(t),this}build(t,r=null){let i=this.getShared(t);if(this!==i)return i.build(t,r);if(this._beforeNodes!==null){let l=this._beforeNodes;this._beforeNodes=null;for(let u of l)u.build(t,r);this._beforeNodes=l}let s=t.getDataFromNode(this);s.buildStages=s.buildStages||{},s.buildStages[t.buildStage]=!0;let a=Woe[t.buildStage];if(a&&s.buildStages[a]!==!0){let l=t.getBuildStage();t.setBuildStage(a),this.build(t),t.setBuildStage(l)}t.addChain(this);let n=null,o=t.getBuildStage();if(o==="setup"){t.addNode(this),this.updateReference(t);let l=t.getNodeProperties(this);if(l.initialized!==!0){l.initialized=!0,l.outputNode=this.setup(t)||l.outputNode||null;for(let u of Object.values(l))if(u&&u.isNode===!0){if(u.parents===!0){let h=t.getNodeProperties(u);h.parents=h.parents||[],h.parents.push(this)}u.build(t)}t.addSequentialNode(this)}n=l.outputNode}else if(o==="analyze")this.analyze(t,r);else if(o==="generate"){if(this.generate.length<2){let l=this.getNodeType(t),u=t.getDataFromNode(this);n=u.snippet,n===void 0?u.generated===void 0?(u.generated=!0,n=this.generate(t)||"",u.snippet=n):(ns("Node: Recursion detected.",this),n="/* Recursion detected. */"):u.flowCodes!==void 0&&t.context.nodeBlock!==void 0&&t.addFlowCodeHierarchy(this,t.context.nodeBlock),n=t.format(n,l,r)}else n=this.generate(t,r)||"";n===""&&r!==null&&r!=="void"&&r!=="OutputType"&&(Uo(`TSL: Invalid generated code, expected a "${r}".`),n=t.generateConst(r))}return t.removeChain(this),n}getSerializeChildren(){return this._getChildren()}serialize(t){let r=this.getSerializeChildren(),i={};for(let{property:s,index:a,childNode:n}of r)a!==void 0?(i[s]===void 0&&(i[s]=Number.isInteger(a)?[]:{}),i[s][a]=n.toJSON(t.meta).uuid):i[s]=n.toJSON(t.meta).uuid;Object.keys(i).length>0&&(t.inputNodes=i)}deserialize(t){if(t.inputNodes!==void 0){let r=t.meta.nodes;for(let i in t.inputNodes)if(Array.isArray(t.inputNodes[i])){let s=[];for(let a of t.inputNodes[i])s.push(r[a]);this[i]=s}else if(typeof t.inputNodes[i]=="object"){let s={};for(let a in t.inputNodes[i]){let n=t.inputNodes[i][a];s[a]=r[n]}this[i]=s}else{let s=t.inputNodes[i];this[i]=r[s]}}}toJSON(t){let{uuid:r,type:i}=this,s=t===void 0||typeof t=="string";s&&(t={textures:{},images:{},nodes:{}});let a=t.nodes[r];a===void 0&&(a={uuid:r,type:i,meta:t,metadata:{version:4.7,type:"Node",generator:"Node.toJSON"}},s!==!0&&(t.nodes[a.uuid]=a),this.serialize(a),delete a.meta);function n(o){let l=[];for(let u in o){let h=o[u];delete h.metadata,l.push(h)}return l}if(s){let o=n(t.textures),l=n(t.images),u=n(t.nodes);o.length>0&&(a.textures=o),l.length>0&&(a.images=l),u.length>0&&(a.nodes=u)}return a}};RI.captureStackTrace=!1;var Hr=RI,Hoe=class extends Hr{static get type(){return"TempNode"}constructor(e=null){super(e),this.isTempNode=!0}hasDependencies(e){return e.getDataFromNode(this).usageCount>1}build(e,t){if(e.getBuildStage()==="generate"){let r=e.getVectorType(this.getNodeType(e,t)),i=e.getDataFromNode(this);if(i.propertyName!==void 0)return e.format(i.propertyName,r,t);if(r!=="void"&&t!=="void"&&this.hasDependencies(e)){let s=super.build(e,r),a=e.getVarFromNode(this,null,r),n=e.getPropertyName(a);return e.addLineFlowCode(`${n} = ${s}`,this),i.snippet=s,i.propertyName=n,e.format(i.propertyName,r,t)}}return super.build(e,t)}},Um=Hoe,Xoe=class extends Hr{static get type(){return"ArrayElementNode"}constructor(e,t){super(),this.node=e,this.indexNode=t,this.isArrayElementNode=!0}generateNodeType(e){return this.node.getElementType(e)}getMemberType(e,t){return this.node.getMemberType(e,t)}generate(e){let t=this.indexNode.getNodeType(e),r=this.node.build(e),i=this.indexNode.build(e,!e.isVector(t)&&e.isInteger(t)?t:"uint");return`${r}[ ${i} ]`}},EI=Xoe,$oe=class extends Hr{static get type(){return"ConvertNode"}constructor(e,t){super(),this.node=e,this.convertTo=t}generateNodeType(e){let t=this.node.getNodeType(e),r=null;for(let i of this.convertTo.split("|"))(r===null||e.getTypeLength(t)===e.getTypeLength(i))&&(r=i);return r}serialize(e){super.serialize(e),e.convertTo=this.convertTo}deserialize(e){super.deserialize(e),this.convertTo=e.convertTo}generate(e,t){let r=this.node,i=this.getNodeType(e),s=r.build(e,i);return e.format(s,i,t)}},PI=$oe,qoe=class extends Um{static get type(){return"JoinNode"}constructor(e=[],t=null){super(t),this.nodes=e}generateNodeType(e){return this.nodeType!==null?e.getVectorType(this.nodeType):e.getTypeFromLength(this.nodes.reduce((t,r)=>t+e.getTypeLength(r.getNodeType(e)),0))}generate(e,t){let r=this.getNodeType(e),i=e.getTypeLength(r),s=this.nodes,a=e.getComponentType(r),n=[],o=0;for(let u of s){if(o>=i){Uo(`TSL: Length of parameters exceeds maximum length of function '${r}()' type.`,this.stackTrace);break}let h=u.getNodeType(e),d=e.getTypeLength(h),c;if(o+d>i&&(Uo(`TSL: Length of '${r}()' data exceeds maximum length of output type.`,this.stackTrace),d=i-o,h=e.getTypeFromLength(d)),o+=d,c=u.build(e,h),e.getComponentType(h)!==a){let m=e.getTypeFromLength(d,a);c=e.format(c,h,m)}n.push(c)}let l=`${e.getType(r)}( ${n.join(", ")} )`;return e.format(l,r,t)}},Yoe=qoe,Zoe=j1.join(""),Joe=class extends Hr{static get type(){return"SplitNode"}constructor(e,t="x"){super(),this.node=e,this.components=t,this.isSplitNode=!0}getVectorLength(){let e=this.components.length;for(let t of this.components)e=Math.max(j1.indexOf(t)+1,e);return e}getComponentType(e){return e.getComponentType(this.node.getNodeType(e))}generateNodeType(e){return e.getTypeFromLength(this.components.length,this.getComponentType(e))}getScope(){return this.node.getScope()}generate(e,t){let r=this.node,i=e.getTypeLength(r.getNodeType(e)),s=null;if(i>1){let a=null;this.getVectorLength()>=i&&(a=e.getTypeFromLength(this.getVectorLength(),this.getComponentType(e)));let n=r.build(e,a);this.components.length===i&&this.components===Zoe.slice(0,this.components.length)?s=e.format(n,a,t):s=e.format(`${n}.${this.components}`,this.getNodeType(e),t)}else s=r.build(e,t);return s}serialize(e){super.serialize(e),e.components=this.components}deserialize(e){super.deserialize(e),this.components=e.components}},Qoe=Joe,Koe=class extends Um{static get type(){return"SetNode"}constructor(e,t,r){super(),this.sourceNode=e,this.components=t,this.targetNode=r}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{sourceNode:t,components:r,targetNode:i}=this,s=this.getNodeType(e),a=e.getComponentType(i.getNodeType(e)),n=e.getTypeFromLength(r.length,a),o=i.build(e,n),l=t.build(e,s),u=e.getTypeLength(s),h=[];for(let d=0;d<u;d++){let c=j1[d];c===r[0]?(h.push(o),d+=r.length-1):h.push(l+"."+c)}return`${e.getType(s)}( ${h.join(", ")} )`}},ele=Koe,tle=class extends Um{static get type(){return"FlipNode"}constructor(e,t){super(),this.sourceNode=e,this.components=t}generateNodeType(e){return this.sourceNode.getNodeType(e)}generate(e){let{components:t,sourceNode:r}=this,i=this.getNodeType(e),s=r.build(e),a=e.getVarFromNode(this),n=e.getPropertyName(a);e.addLineFlowCode(n+" = "+s,this);let o=e.getTypeLength(i),l=[],u=0;for(let h=0;h<o;h++){let d=j1[h];d===t[u]?(l.push("1.0 - "+(n+"."+d)),u++):l.push(n+"."+d)}return`${e.getType(i)}( ${l.join(", ")} )`}},rle=tle,ile=class extends Hr{static get type(){return"InputNode"}constructor(e,t=null){super(t),this.isInputNode=!0,this.value=e,this.precision=null}generateNodeType(){return this.nodeType===null?Bw(this.value):this.nodeType}getInputType(e){return this.getNodeType(e)}setPrecision(e){return this.precision=e,this}serialize(e){super.serialize(e),e.value=this.value,this.value&&this.value.toArray&&(e.value=this.value.toArray()),e.valueType=Bw(this.value),e.nodeType=this.nodeType,e.valueType==="ArrayBuffer"&&(e.value=zoe(e.value)),e.precision=this.precision}deserialize(e){super.deserialize(e),this.nodeType=e.nodeType,this.value=Array.isArray(e.value)?CI(e.valueType,...e.value):e.value,this.precision=e.precision||null,this.value&&this.value.fromArray&&(this.value=this.value.fromArray(e.value))}generate(){ns("Abstract function.")}},sle=ile,BI=/float|u?int/,ale=class extends sle{static get type(){return"ConstNode"}constructor(e,t=null){super(e,t),this.isConstNode=!0}generateConst(e){return e.generateConst(this.getNodeType(e),this.value)}generate(e,t){let r=this.getNodeType(e);return BI.test(r)&&BI.test(t)?e.generateConst(t,this.value):e.format(this.generateConst(e),r,t)}},Vn=ale,nle=class extends Hr{static get type(){return"MemberNode"}constructor(e,t){super(),this.structNode=e,this.property=t,this.isMemberNode=!0}hasMember(e){return this.structNode.isMemberNode&&this.structNode.hasMember(e)===!1?!1:this.structNode.getMemberType(e,this.property)!=="void"}generateNodeType(e){return this.hasMember(e)===!1?"float":this.structNode.getMemberType(e,this.property)}getMemberType(e,t){if(this.hasMember(e)===!1)return"float";let r=this.getNodeType(e);return e.getStructTypeNode(r).getMemberType(e,t)}generate(e){if(this.hasMember(e)===!1){ns(`TSL: Member "${this.property}" does not exist in struct.`,this.stackTrace);let t=this.getNodeType(e);return e.generateConst(t)}return this.structNode.build(e)+"."+this.property}},ole=nle,Y1=null,Iw=new Map;function Re(e,t){if(Iw.has(e)){ns(`TSL: Redefinition of method chaining '${e}'.`);return}if(typeof t!="function")throw new Error(`THREE.TSL: Node element ${e} is not a function`);Iw.set(e,t),e!=="assign"&&(Hr.prototype[e]=function(...r){return this.isStackNode?this.addToStack(t(...r)):t(this,...r)},Hr.prototype[e+"Assign"]=function(...r){return this.isStackNode?this.assign(r[0],t(...r)):this.assign(t(this,...r))})}var lle=e=>e.replace(/r|s/g,"x").replace(/g|t/g,"y").replace(/b|p/g,"z").replace(/a|q/g,"w"),II=e=>lle(e).split("").sort().join("");Hr.prototype.assign=function(...e){if(this.isStackNode!==!0)return Y1!==null?Y1.assign(this,...e):Uo("TSL: No stack defined for assign operation. Make sure the assign is inside a Fn().",new hh),this;{let t=Iw.get("assign");return this.addToStack(t(...e))}},Hr.prototype.toVarIntent=function(){return this},Hr.prototype.get=function(e){return new ole(this,e)};var zm={};function Z1(e,t,r){zm[e]=zm[t]=zm[r]={get(){this._cache=this._cache||{};let n=this._cache[e];return n===void 0&&(n=new Qoe(this,e),this._cache[e]=n),n},set(n){this[e].assign(zi(n))}};let i=e.toUpperCase(),s=t.toUpperCase(),a=r.toUpperCase();Hr.prototype["set"+i]=Hr.prototype["set"+s]=Hr.prototype["set"+a]=function(n){let o=II(e);return new ele(this,o,zi(n))},Hr.prototype["flip"+i]=Hr.prototype["flip"+s]=Hr.prototype["flip"+a]=function(){let n=II(e);return new rle(this,n)}}var Gn=["x","y","z","w"],Wn=["r","g","b","a"],jn=["s","t","p","q"];for(let e=0;e<4;e++){let t=Gn[e],r=Wn[e],i=jn[e];Z1(t,r,i);for(let s=0;s<4;s++){t=Gn[e]+Gn[s],r=Wn[e]+Wn[s],i=jn[e]+jn[s],Z1(t,r,i);for(let a=0;a<4;a++){t=Gn[e]+Gn[s]+Gn[a],r=Wn[e]+Wn[s]+Wn[a],i=jn[e]+jn[s]+jn[a],Z1(t,r,i);for(let n=0;n<4;n++)t=Gn[e]+Gn[s]+Gn[a]+Gn[n],r=Wn[e]+Wn[s]+Wn[a]+Wn[n],i=jn[e]+jn[s]+jn[a]+jn[n],Z1(t,r,i)}}}for(let e=0;e<32;e++)zm[e]={get(){this._cache=this._cache||{};let t=this._cache[e];return t===void 0&&(t=new EI(this,new Vn(e,"uint")),this._cache[e]=t),t},set(t){this[e].assign(zi(t))}};Object.defineProperties(Hr.prototype,zm);var ule=function(e,t=null){let r=Bw(e);return r==="node"?e:t===null&&(r==="float"||r==="boolean")||r&&r!=="shader"&&r!=="string"?zi(Dw(e,t)):r==="shader"?e.isFn?e:dh(e):e},hle=function(e,t=null){for(let r in e)e[r]=zi(e[r],t);return e},dle=function(e,t=null){let r=e.length;for(let i=0;i<r;i++)e[i]=zi(e[i],t);return e},FI=function(e,t=null,r=null,i=null){function s(h){return i!==null?(h=zi(Object.assign(h,i)),i.intent===!0&&(h=h.toVarIntent())):h=zi(h),h}let a,n=t,o,l;function u(h){let d;return n?d=/[a-z]/i.test(n)?n+"()":n:d=e.type,o!==void 0&&h.length<o?(Uo(`TSL: "${d}" parameter length is less than minimum required.`,new hh),h.concat(new Array(o-h.length).fill(0))):l!==void 0&&h.length>l?(Uo(`TSL: "${d}" parameter length exceeds limit.`,new hh),h.slice(0,l)):h}return t===null?a=(...h)=>s(new e(...Ow(u(h)))):r!==null?(r=zi(r),a=(...h)=>s(new e(t,...Ow(u(h)),r))):a=(...h)=>s(new e(t,...Ow(u(h)))),a.setParameterLength=(...h)=>(h.length===1?o=l=h[0]:h.length===2&&([o,l]=h),a),a.setName=h=>(n=h,a),a},cle=class extends Hr{constructor(e,t){super(),this.shaderNode=e,this.rawInputs=t,this.isShaderCallNodeInternal=!0}generateNodeType(e){return this.shaderNode.nodeType||this.getOutputNode(e).getNodeType(e)}getElementType(e){return this.getOutputNode(e).getElementType(e)}getMemberType(e,t){return this.getOutputNode(e).getMemberType(e,t)}call(e){let{shaderNode:t,rawInputs:r}=this,i=e.getNodeProperties(t),s=e.getClosestSubBuild(t.subBuilds)||"",a=s||"default";if(i[a])return i[a];let n=e.subBuildFn,o=e.fnCall;e.subBuildFn=s,e.fnCall=this;let l=null;if(t.layout){if(r){let d=t.layout.inputs;if(LI(r)){let c=r;for(let m=0;m<d.length;m++){let g=c[m];g&&g.isNode&&g.build(e)}}else{let c=r[0];for(let m of d){let g=c[m.name];g&&g.isNode&&g.build(e)}}}let u=e.buildFunctionNode(t);e.addInclude(u);let h=r?ple(r):null;l=u.call(h)}else{let u=new Proxy(e,{get:(g,y,b)=>{let v;return Symbol.iterator===y?v=function*(){yield void 0}:v=Reflect.get(g,y,b),v}}),h=r?mle(r):null,d=Array.isArray(r)?r.length>0:r!==null,c=t.jsFunc,m=d||c.length>1?c(h,u):c(u);l=zi(m)}return e.subBuildFn=n,e.fnCall=o,t.once&&(i[a]=l),l}setupOutput(e){return e.addStack(),e.stack.outputNode=this.call(e),e.removeStack()}getOutputNode(e){let t=e.getNodeProperties(this),r=e.getSubBuildOutput(this);return t[r]=t[r]||this.setupOutput(e),t[r].subBuild=e.getClosestSubBuild(this),t[r]}build(e,t=null){let r=null,i=e.getBuildStage(),s=e.getNodeProperties(this),a=e.getSubBuildOutput(this),n=this.getOutputNode(e),o=e.fnCall;if(e.fnCall=this,i==="setup"){let l=e.getSubBuildProperty("initialized",this);if(s[l]!==!0&&(s[l]=!0,s[a]=this.getOutputNode(e),s[a].build(e),this.shaderNode.subBuilds))for(let u of e.chaining){let h=e.getDataFromNode(u,"any");h.subBuilds=h.subBuilds||new Set;for(let d of this.shaderNode.subBuilds)h.subBuilds.add(d)}r=s[a]}else i==="analyze"?n.build(e,t):i==="generate"&&(r=n.build(e,t)||"");return e.fnCall=o,r}};function LI(e){return e[0]&&(e[0].isNode||Object.getPrototypeOf(e[0])!==Object.prototype)}function ple(e){let t;return OI(e),LI(e)?t=[...e]:t=e[0],t}function mle(e){let t=0;return OI(e),new Proxy(e,{get:(r,i,s)=>{let a;if(i==="length")return a=e.length,a;if(Symbol.iterator===i)a=function*(){for(let n of e)yield zi(n)};else{if(e.length>0)if(Object.getPrototypeOf(e[0])===Object.prototype){let n=e[0];n[i]===void 0?a=n[t++]:a=Reflect.get(n,i,s)}else e[0]instanceof Hr&&(e[i]===void 0?a=e[t++]:a=Reflect.get(e,i,s));else a=Reflect.get(r,i,s);a=zi(a)}return a}})}var fle=class extends Hr{constructor(e,t){super(t),this.jsFunc=e,this.layout=null,this.global=!0,this.once=!1}setLayout(e){return this.layout=e,this}getLayout(){return this.layout}call(e=null){return new cle(this,e)}setup(){return this.call()}},gle=[!1,!0],yle=[0,1,2,3],xle=[-1,-2],kI=[.5,1.5,1/3,1e-6,1e6,Math.PI,Math.PI*2,1/Math.PI,2/Math.PI,1/(Math.PI*2),Math.PI/2],Fw=new Map;for(let e of gle)Fw.set(e,new Vn(e));var Lw=new Map;for(let e of yle)Lw.set(e,new Vn(e,"uint"));var kw=new Map([...Lw].map(e=>new Vn(e.value,"int")));for(let e of xle)kw.set(e,new Vn(e,"int"));var J1=new Map([...kw].map(e=>new Vn(e.value)));for(let e of kI)J1.set(e,new Vn(e));for(let e of kI)J1.set(-e,new Vn(-e));var Q1={bool:Fw,uint:Lw,ints:kw,float:J1},DI=new Map([...Fw,...J1]),Dw=(e,t)=>DI.has(e)?DI.get(e):e.isNode===!0?e:new Vn(e,t),hi=function(e,t=null){return(...r)=>{for(let s of r)if(s===void 0)return Uo(`TSL: Invalid parameter for the type "${e}".`,new hh),new Vn(0,e);if((r.length===0||!["bool","float","int","uint"].includes(e)&&r.every(s=>{let a=typeof s;return a!=="object"&&a!=="function"}))&&(r=[CI(e,...r)]),r.length===1&&t!==null&&t.has(r[0]))return K1(t.get(r[0]));if(r.length===1){let s=Dw(r[0],e);return s.nodeType===e?K1(s):K1(new PI(s,e))}let i=r.map(s=>Dw(s));return K1(new Yoe(i,e))}};function vle(e,t){return new fle(e,t)}var zi=(e,t=null)=>ule(e,t),K1=(e,t=null)=>zi(e,t).toVarIntent(),OI=(e,t=null)=>new hle(e,t),Ow=(e,t=null)=>new dle(e,t),ble=(e,t=null,r=null,i=null)=>new FI(e,t,r,i),qe=(e,t=null,r=null,i={})=>new FI(e,t,r,{...i,intent:!0}),Tle=0,Sle=class extends Hr{constructor(e,t=null){super();let r=null;t!==null&&(typeof t=="object"?r=t.return:(typeof t=="string"?r=t:Uo("TSL: Invalid layout type.",new hh),t=null)),this.shaderNode=new vle(e,r),t!==null&&this.setLayout(t),this.isFn=!0}setLayout(e){let t=this.shaderNode.nodeType;if(typeof e.inputs!="object"){let r={name:"fn"+Tle++,type:t,inputs:[]};for(let i in e)i!=="return"&&r.inputs.push({name:i,type:e[i]});e=r}return this.shaderNode.setLayout(e),this}generateNodeType(e){return this.shaderNode.getNodeType(e)||"float"}call(...e){let t=this.shaderNode.call(e);return this.shaderNode.nodeType==="void"&&t.toStack(),t.toVarIntent()}once(e=null){return this.shaderNode.once=!0,this.shaderNode.subBuilds=e,this}generate(e){let t=this.getNodeType(e);return Uo('TSL: "Fn()" was declared but not invoked. Try calling it like "Fn()( ...params )".',this.stackTrace),e.generateConst(t)}};function dh(e,t=null){let r=new Sle(e,t);return new Proxy(()=>{},{apply(i,s,a){return r.call(...a)},get(i,s,a){return Reflect.get(r,s,a)},set(i,s,a,n){return Reflect.set(r,s,a,n)}})}function UI(e){return Y1&&Y1.addToStack(e),e}Re("toStack",UI);var _le=new hi("color"),Vm=new hi("float",Q1.float),Uw=new hi("int",Q1.ints),wle=new hi("uint",Q1.uint),Mle=new hi("bool",Q1.bool),zI=new hi("vec2"),Nle=new hi("ivec2"),Ale=new hi("uvec2"),Cle=new hi("bvec2"),ex=new hi("vec3"),Rle=new hi("ivec3"),Ele=new hi("uvec3"),Ple=new hi("bvec3"),tx=new hi("vec4"),Ble=new hi("ivec4"),Ile=new hi("uvec4"),Fle=new hi("bvec4"),Lle=new hi("mat2"),kle=new hi("mat3"),Dle=new hi("mat4");Re("toColor",_le),Re("toFloat",Vm),Re("toInt",Uw),Re("toUint",wle),Re("toBool",Mle),Re("toVec2",zI),Re("toIVec2",Nle),Re("toUVec2",Ale),Re("toBVec2",Cle),Re("toVec3",ex),Re("toIVec3",Rle),Re("toUVec3",Ele),Re("toBVec3",Ple),Re("toVec4",tx),Re("toIVec4",Ble),Re("toUVec4",Ile),Re("toBVec4",Fle),Re("toMat2",Lle),Re("toMat3",kle),Re("toMat4",Dle);var Ole=ble(EI).setParameterLength(2),Ule=(e,t)=>new PI(zi(e),t);Re("element",Ole),Re("convert",Ule),Re("append",e=>(ns("TSL: .append() has been renamed to .toStack().",new hh),UI(e)));var zle={"==":"equal","!=":"notEqual","<":"lessThan",">":"greaterThan","<=":"lessThanEqual",">=":"greaterThanEqual","%":"mod"},Kr=class cM extends Um{static get type(){return"OperatorNode"}constructor(t,r,i,...s){if(super(),s.length>0){let a=new cM(t,r,i);for(let n=0;n<s.length-1;n++)a=new cM(t,a,s[n]);r=a,i=s[s.length-1]}this.op=t,this.aNode=r,this.bNode=i,this.isOperatorNode=!0}getOperatorMethod(t,r){return t.getMethod(zle[this.op],r)}generateNodeType(t,r=null){let i=this.op,s=this.aNode,a=this.bNode,n=s.getNodeType(t),o=a?a.getNodeType(t):null;if(n==="void"||o==="void")return r||"void";if(i==="%")return n;if(i==="~"||i==="&"||i==="|"||i==="^"||i===">>"||i==="<<")return t.getIntegerType(n);if(i==="&&"||i==="||"||i==="^^")return"bool";if(i==="!"){let l=t.getTypeLength(n);return l>1?`bvec${l}`:"bool"}else if(i==="=="||i==="!="||i==="<"||i===">"||i==="<="||i===">="){let l=Math.max(t.getTypeLength(n),t.getTypeLength(o));return l>1?`bvec${l}`:"bool"}else{if(t.isMatrix(n)){if(o==="float")return n;if(t.isVector(o))return t.getVectorFromMatrix(n);if(t.isMatrix(o))return n}else if(t.isMatrix(o)){if(n==="float")return o;if(t.isVector(n))return t.getVectorFromMatrix(o)}return t.getTypeLength(o)>t.getTypeLength(n)?o:n}}generate(t,r){let i=this.op,{aNode:s,bNode:a}=this,n=this.getNodeType(t,r),o=null,l=null;n!=="void"?(o=s.getNodeType(t),l=a?a.getNodeType(t):null,i==="<"||i===">"||i==="<="||i===">="||i==="=="||i==="!="?t.isVector(o)?l=o:t.isVector(l)?o=l:o!==l&&(o=l="float"):i===">>"||i==="<<"?(o=n,l=t.changeComponentType(l,"uint")):i==="%"?(o=n,l=t.isInteger(o)&&t.isInteger(l)?l:o):t.isMatrix(o)?l==="float"?l="float":t.isVector(l)?l=t.getVectorFromMatrix(o):t.isMatrix(l)||(o=l=n):t.isMatrix(l)?o==="float"?o="float":t.isVector(o)?o=t.getVectorFromMatrix(l):o=l=n:o=l=n):o=l=n;let u=s.build(t,o),h=a?a.build(t,l):null,d=t.getFunctionOperator(i);if(r!=="void"){let c=t.renderer.coordinateSystem===uh;if(i==="=="||i==="!="||i==="<"||i===">"||i==="<="||i===">=")return c?t.isVector(o)?t.format(`${this.getOperatorMethod(t,r)}( ${u}, ${h} )`,n,r):t.format(`( ${u} ${i} ${h} )`,n,r):t.format(`( ${u} ${i} ${h} )`,n,r);if(i==="%")return t.isInteger(l)?t.format(`( ${u} % ${h} )`,n,r):t.format(`${this.getOperatorMethod(t,n)}( ${u}, ${h} )`,n,r);if(i==="!")return c&&t.isVector(o)?t.format(`not( ${u} )`,r):t.format(`( ${i} ${u} )`,o,r);if(i==="~")return t.format(`( ${i} ${u} )`,o,r);if(d)return t.format(`${d}( ${u}, ${h} )`,n,r);if(t.isMatrix(o)&&l==="float")return t.format(`( ${h} ${i} ${u} )`,n,r);if(o==="float"&&t.isMatrix(l))return t.format(`${u} ${i} ${h}`,n,r);{let m=`( ${u} ${i} ${h} )`;return!c&&n==="bool"&&t.isVector(o)&&t.isVector(l)&&(m=`all${m}`),t.format(m,n,r)}}else if(o!=="void")return d?t.format(`${d}( ${u}, ${h} )`,n,r):t.isMatrix(o)&&l==="float"?t.format(`${h} ${i} ${u}`,n,r):t.format(`${u} ${i} ${h}`,n,r)}serialize(t){super.serialize(t),t.op=this.op}deserialize(t){super.deserialize(t),this.op=t.op}},Vle=qe(Kr,"+").setParameterLength(2,1/0).setName("add"),zw=qe(Kr,"-").setParameterLength(2,1/0).setName("sub"),ch=qe(Kr,"*").setParameterLength(2,1/0).setName("mul"),VI=qe(Kr,"/").setParameterLength(2,1/0).setName("div"),GI=qe(Kr,"%").setParameterLength(2).setName("mod"),Gle=qe(Kr,"==").setParameterLength(2).setName("equal"),Wle=qe(Kr,"!=").setParameterLength(2).setName("notEqual"),jle=qe(Kr,"<").setParameterLength(2).setName("lessThan"),Hle=qe(Kr,">").setParameterLength(2).setName("greaterThan"),Xle=qe(Kr,"<=").setParameterLength(2).setName("lessThanEqual"),$le=qe(Kr,">=").setParameterLength(2).setName("greaterThanEqual"),qle=qe(Kr,"&&").setParameterLength(2,1/0).setName("and"),Yle=qe(Kr,"||").setParameterLength(2,1/0).setName("or"),Zle=qe(Kr,"!").setParameterLength(1).setName("not"),Jle=qe(Kr,"^^").setParameterLength(2).setName("xor"),Qle=qe(Kr,"&").setParameterLength(2).setName("bitAnd"),Kle=qe(Kr,"~").setParameterLength(1).setName("bitNot"),eue=qe(Kr,"|").setParameterLength(2).setName("bitOr"),tue=qe(Kr,"^").setParameterLength(2).setName("bitXor"),rue=qe(Kr,"<<").setParameterLength(2).setName("shiftLeft"),iue=qe(Kr,">>").setParameterLength(2).setName("shiftRight"),sue=dh(([e])=>(e.addAssign(1),e)),aue=dh(([e])=>(e.subAssign(1),e)),nue=dh(([e])=>{let t=Uw(e).toConst();return e.addAssign(1),t}),oue=dh(([e])=>{let t=Uw(e).toConst();return e.subAssign(1),t});Re("add",Vle),Re("sub",zw),Re("mul",ch),Re("div",VI),Re("mod",GI),Re("equal",Gle),Re("notEqual",Wle),Re("lessThan",jle),Re("greaterThan",Hle),Re("lessThanEqual",Xle),Re("greaterThanEqual",$le),Re("and",qle),Re("or",Yle),Re("not",Zle),Re("xor",Jle),Re("bitAnd",Qle),Re("bitNot",Kle),Re("bitOr",eue),Re("bitXor",tue),Re("shiftLeft",rue),Re("shiftRight",iue),Re("incrementBefore",sue),Re("decrementBefore",aue),Re("increment",nue),Re("decrement",oue);var de=class _r extends Um{static get type(){return"MathNode"}constructor(t,r,i=null,s=null){if(super(),(t===_r.MAX||t===_r.MIN)&&arguments.length>3){let a=new _r(t,r,i);for(let n=3;n<arguments.length-1;n++)a=new _r(t,a,arguments[n]);r=a,i=arguments[arguments.length-1],s=null}this.method=t,this.aNode=r,this.bNode=i,this.cNode=s,this.isMathNode=!0}getInputType(t){let r=this.aNode.getNodeType(t),i=this.bNode?this.bNode.getNodeType(t):null,s=this.cNode?this.cNode.getNodeType(t):null,a=t.isMatrix(r)?0:t.getTypeLength(r),n=t.isMatrix(i)?0:t.getTypeLength(i),o=t.isMatrix(s)?0:t.getTypeLength(s);return a>n&&a>o?r:n>o?i:o>a?s:r}generateNodeType(t){let r=this.method;return r===_r.LENGTH||r===_r.DISTANCE||r===_r.DOT?"float":r===_r.CROSS?"vec3":r===_r.ALL||r===_r.ANY?"bool":r===_r.EQUALS?t.changeComponentType(this.aNode.getNodeType(t),"bool"):this.getInputType(t)}setup(t){let{aNode:r,bNode:i,method:s}=this,a=null;if(s===_r.ONE_MINUS)a=zw(1,r);else if(s===_r.RECIPROCAL)a=VI(1,r);else if(s===_r.DIFFERENCE)a=Vw(zw(r,i));else if(s===_r.TRANSFORM_DIRECTION){let n,o;t.isMatrix(r.getNodeType(t))?(n=r,o=i):(n=i,o=r),a=rx(ch(n,tx(ex(o),0)).xyz)}return a!==null?a:super.setup(t)}generate(t,r){if(t.getNodeProperties(this).outputNode)return super.generate(t,r);let i=this.method,s=this.getNodeType(t),a=this.getInputType(t),n=this.aNode,o=this.bNode,l=this.cNode,u=t.renderer.coordinateSystem;if(i===_r.NEGATE)return t.format("( - "+n.build(t,a)+" )",s,r);{let h=[];return i===_r.CROSS?h.push(n.build(t,s),o.build(t,s)):u===uh&&i===_r.STEP?h.push(n.build(t,t.getTypeLength(n.getNodeType(t))===1?"float":a),o.build(t,a)):u===uh&&(i===_r.MIN||i===_r.MAX)?h.push(n.build(t,a),o.build(t,t.getTypeLength(o.getNodeType(t))===1?"float":a)):i===_r.REFRACT?h.push(n.build(t,a),o.build(t,a),l.build(t,"float")):i===_r.MIX?h.push(n.build(t,a),o.build(t,a),l.build(t,t.getTypeLength(l.getNodeType(t))===1?"float":a)):(u===Mw&&i===_r.ATAN&&o!==null&&(i="atan2"),t.shaderStage!=="fragment"&&(i===_r.DFDX||i===_r.DFDY)&&(ns(`TSL: '${i}' is not supported in the ${t.shaderStage} stage.`,this.stackTrace),i="/*"+i+"*/"),h.push(n.build(t,a)),o!==null&&h.push(o.build(t,a)),l!==null&&h.push(l.build(t,a))),t.format(`${t.getMethod(i,s)}( ${h.join(", ")} )`,s,r)}}serialize(t){super.serialize(t),t.method=this.method}deserialize(t){super.deserialize(t),this.method=t.method}};de.ALL="all",de.ANY="any",de.RADIANS="radians",de.DEGREES="degrees",de.EXP="exp",de.EXP2="exp2",de.LOG="log",de.LOG2="log2",de.SQRT="sqrt",de.INVERSE_SQRT="inversesqrt",de.FLOOR="floor",de.CEIL="ceil",de.NORMALIZE="normalize",de.FRACT="fract",de.SIN="sin",de.SINH="sinh",de.COS="cos",de.COSH="cosh",de.TAN="tan",de.TANH="tanh",de.ASIN="asin",de.ASINH="asinh",de.ACOS="acos",de.ACOSH="acosh",de.ATAN="atan",de.ATANH="atanh",de.ABS="abs",de.SIGN="sign",de.LENGTH="length",de.NEGATE="negate",de.ONE_MINUS="oneMinus",de.DFDX="dFdx",de.DFDY="dFdy",de.ROUND="round",de.RECIPROCAL="reciprocal",de.TRUNC="trunc",de.FWIDTH="fwidth",de.TRANSPOSE="transpose",de.DETERMINANT="determinant",de.INVERSE="inverse",de.EQUALS="equals",de.MIN="min",de.MAX="max",de.STEP="step",de.REFLECT="reflect",de.DISTANCE="distance",de.DIFFERENCE="difference",de.DOT="dot",de.CROSS="cross",de.POW="pow",de.TRANSFORM_DIRECTION="transformDirection",de.MIX="mix",de.CLAMP="clamp",de.REFRACT="refract",de.SMOOTHSTEP="smoothstep",de.FACEFORWARD="faceforward";var lue=Vm(Math.PI),X0e=Vm(Math.PI*2),$0e=Vm(Math.PI*2),q0e=Vm(Math.PI*.5),uue=qe(de,de.ALL).setParameterLength(1),hue=qe(de,de.ANY).setParameterLength(1),due=qe(de,de.RADIANS).setParameterLength(1),cue=qe(de,de.DEGREES).setParameterLength(1),pue=qe(de,de.EXP).setParameterLength(1),mue=qe(de,de.EXP2).setParameterLength(1),fue=qe(de,de.LOG).setParameterLength(1),gue=qe(de,de.LOG2).setParameterLength(1),yue=qe(de,de.SQRT).setParameterLength(1),xue=qe(de,de.INVERSE_SQRT).setParameterLength(1),vue=qe(de,de.FLOOR).setParameterLength(1),bue=qe(de,de.CEIL).setParameterLength(1),rx=qe(de,de.NORMALIZE).setParameterLength(1),WI=qe(de,de.FRACT).setParameterLength(1),jI=qe(de,de.SIN).setParameterLength(1),Tue=qe(de,de.SINH).setParameterLength(1),Sue=qe(de,de.COS).setParameterLength(1),_ue=qe(de,de.COSH).setParameterLength(1),wue=qe(de,de.TAN).setParameterLength(1),Mue=qe(de,de.TANH).setParameterLength(1),Nue=qe(de,de.ASIN).setParameterLength(1),Aue=qe(de,de.ASINH).setParameterLength(1),Cue=qe(de,de.ACOS).setParameterLength(1),Rue=qe(de,de.ACOSH).setParameterLength(1),Eue=qe(de,de.ATAN).setParameterLength(1,2),Pue=qe(de,de.ATANH).setParameterLength(1),Vw=qe(de,de.ABS).setParameterLength(1),HI=qe(de,de.SIGN).setParameterLength(1),Bue=qe(de,de.LENGTH).setParameterLength(1),Iue=qe(de,de.NEGATE).setParameterLength(1),Fue=qe(de,de.ONE_MINUS).setParameterLength(1),Lue=qe(de,de.DFDX).setParameterLength(1),kue=qe(de,de.DFDY).setParameterLength(1),Due=qe(de,de.ROUND).setParameterLength(1),Oue=qe(de,de.RECIPROCAL).setParameterLength(1),Uue=qe(de,de.TRUNC).setParameterLength(1),zue=qe(de,de.FWIDTH).setParameterLength(1),Vue=qe(de,de.TRANSPOSE).setParameterLength(1),Gue=qe(de,de.DETERMINANT).setParameterLength(1),Wue=qe(de,de.INVERSE).setParameterLength(1),jue=qe(de,de.MIN).setParameterLength(2,1/0),Hue=qe(de,de.MAX).setParameterLength(2,1/0),Xue=qe(de,de.STEP).setParameterLength(2),$ue=qe(de,de.REFLECT).setParameterLength(2),que=qe(de,de.DISTANCE).setParameterLength(2),Yue=qe(de,de.DIFFERENCE).setParameterLength(2),Gw=qe(de,de.DOT).setParameterLength(2),Zue=qe(de,de.CROSS).setParameterLength(2),XI=qe(de,de.POW).setParameterLength(2),Jue=e=>ch(e,e),Que=e=>ch(e,e,e),Kue=e=>ch(e,e,e,e),ehe=qe(de,de.TRANSFORM_DIRECTION).setParameterLength(2),the=(e,t)=>rx(ch(t,tx(ex(e),0)).xyz),rhe=(e,t)=>rx(tx(ex(e),0).mul(t).xyz),ihe=e=>ch(HI(e),XI(Vw(e),1/3)),she=e=>Gw(e,e),$I=qe(de,de.MIX).setParameterLength(3),qI=(e,t=0,r=1)=>new de(de.CLAMP,zi(e),zi(t),zi(r)),ahe=e=>qI(e),nhe=qe(de,de.REFRACT).setParameterLength(3),ohe=qe(de,de.SMOOTHSTEP).setParameterLength(3),lhe=qe(de,de.FACEFORWARD).setParameterLength(3),uhe=dh(([e])=>{let t=43758.5453,r=Gw(e.xy,zI(12.9898,78.233)),i=GI(r,lue);return WI(jI(i).mul(t))}),hhe=(e,t,r)=>$I(t,r,e),dhe=(e,t,r)=>ohe(t,r,e),che=(e,t)=>Xue(t,e);Re("all",uue),Re("any",hue),Re("radians",due),Re("degrees",cue),Re("exp",pue),Re("exp2",mue),Re("log",fue),Re("log2",gue),Re("sqrt",yue),Re("inverseSqrt",xue),Re("floor",vue),Re("ceil",bue),Re("normalize",rx),Re("fract",WI),Re("sin",jI),Re("sinh",Tue),Re("cos",Sue),Re("cosh",_ue),Re("tan",wue),Re("tanh",Mue),Re("asin",Nue),Re("asinh",Aue),Re("acos",Cue),Re("acosh",Rue),Re("atan",Eue),Re("atanh",Pue),Re("abs",Vw),Re("sign",HI),Re("length",Bue),Re("lengthSq",she),Re("negate",Iue),Re("oneMinus",Fue),Re("dFdx",Lue),Re("dFdy",kue),Re("round",Due),Re("reciprocal",Oue),Re("trunc",Uue),Re("fwidth",zue),Re("min",jue),Re("max",Hue),Re("step",che),Re("reflect",$ue),Re("distance",que),Re("dot",Gw),Re("cross",Zue),Re("pow",XI),Re("pow2",Jue),Re("pow3",Que),Re("pow4",Kue),Re("transformDirection",ehe),Re("transformNormalByViewMatrix",the),Re("transformNormalByInverseViewMatrix",rhe),Re("mix",hhe),Re("clamp",qI),Re("refract",nhe),Re("smoothstep",dhe),Re("faceForward",lhe),Re("difference",Yue),Re("saturate",ahe),Re("cbrt",ihe),Re("transpose",Vue),Re("determinant",Gue),Re("inverse",Wue),Re("rand",uhe);var phe=dh(([e])=>{let t=e.pow(.41666).mul(1.055).sub(.055),r=e.mul(12.92),i=e.lessThanEqual(.0031308);return $I(t,r,i)}).setLayout({name:"sRGBTransferOETF",type:"vec3",inputs:[{name:"color",type:"vec3"}]}),{rtt:YI,Fn:mhe,pass:fhe,mrt:ghe,output:yhe,velocity:xhe,vec2:ix,vec3:zo,vec4:vhe,float:yc,uniform:Lr,texture:sx,screenUV:ZI,screenCoordinate:ax,screenSize:JI,mix:Ww,luminance:QI,smoothstep:jw,length:bhe,max:KI,clamp:Hw,agxToneMapping:The,acesFilmicToneMapping:She,neutralToneMapping:_he,linearToneMapping:whe,floor:eF,step:Mhe}=Jr;function Nhe(e){let t={exposure:Lr(1),contrast:Lr(1.08),blackLift:Lr(.02),monochrome:Lr(1),vignette:Lr(.2),vignetteSoft:Lr(.7),vignetteRadius:Lr(.85),grain:Lr(.03),grainSize:Lr(1),grainSeed:Lr(new fe),grainShadow:Lr(.8),bgGrain:Lr(0),bgGrainSize:Lr(2),bgGrainSeed:Lr(new fe),dither:Lr(1),focus:Lr(12.4),focusRange:Lr(3),aperture:Lr(.9),bloomStrength:Lr(.15),bloomRadius:Lr(.15),bloomThreshold:Lr(1.2),sceneFade:Lr(1),hazeIntensity:Lr(.22),upscaleSharpness:Lr(.2)},r=new(TB??YX)(e.renderer);r.outputColorTransform=!1;let i={aa:"",tonemap:"",dof:!0,haze:!1,upscaler:"",sharpen:!1},s=null,a=null,n=-1,o=null,l=1,u=-1,h=[];function d(v){i={...v};let S=h,T=[],w=L=>(L&&typeof L.dispose=="function"&&T.push(L),L);s=w(fhe(e.scene,e.camera,{type:Dt,samples:0})),s.setMRT(ghe({output:yhe,velocity:xhe}));let N=s.getTextureNode("output"),C=s.getTextureNode("depth"),R=s.getTextureNode("velocity"),E=s.getViewZNode(),P;a=null,v.upscaler==="taau"?P=a=w(jne(N,C,R,e.camera)):(P=v.aa==="traa"?a=w(Vne(N,C,R,e.camera)):N,v.upscaler==="fsr1"?P=w(Xne(P,yc(2).sub(t.upscaleSharpness.mul(2)),!0)):v.upscaler==="bilinear"&&(P=w(YI(P)))),v.sharpen&&(v.upscaler==="taau"||v.upscaler==="bilinear")&&(P=w(qne(P,yc(2).sub(t.upscaleSharpness.mul(2)),!0))),o=null,e.haze&&v.haze&&(o=w(YI(e.haze(C,E))),o.setResolutionScale(l),P=P.add(o.mul(t.hazeIntensity))),v.dof&&(P=w(Qne(P,E,t.focus,t.focusRange,t.aperture)));let I=w(soe(P,t.bloomStrength,t.bloomRadius,t.bloomThreshold));I.smoothWidth.value=.35,P=P.add(I);let O=mhe(()=>{let L=zo(P).mul(t.sceneFade).toVar(),X=QI(L);L.assign(Ww(L,zo(X),t.monochrome));let z=v.tonemap==="aces"?She(L,t.exposure):v.tonemap==="neutral"?_he(L,t.exposure):v.tonemap==="linear"?whe(L,t.exposure):The(L,t.exposure),H=Hw(zo(z),0,1).toVar(),ue=yc(.18);H.assign(Hw(ue.add(H.sub(ue).mul(t.contrast)),0,1));let ne=H.mul(H).mul(yc(3).sub(H.mul(2)));H.assign(Ww(H,ne,Hw(t.contrast.sub(1).mul(1.5),0,.6))),H.assign(H.mul(t.blackLift.oneMinus()).add(t.blackLift));let re=JI.x.div(JI.y),ce=ix(ZI.x.sub(.5).mul(re),ZI.y.sub(.5)),ge=bhe(ce).div(t.vignetteRadius),ye=jw(yc(1).sub(t.vignetteSoft),1.0001,ge).mul(t.vignette);H.assign(H.mul(ye.oneMinus()));let oe=zo(phe(H)).toVar(),Ae=eF(ax.xy.div(t.grainSize)).div(64).add(t.grainSeed),Ie=sx(e.blueNoise,Ae).r.sub(.5),Xe=sx(e.blueNoise,Ae.add(ix(.37,.61))).r.sub(.5),at=Ie.add(Xe),W=QI(oe),j=Ww(yc(1),jw(1,.05,W),t.grainShadow),G=t.grain.mul(j).mul(jw(0,.08,W).mul(.85).add(.15));oe.addAssign(zo(at.mul(G)));let ae=Mhe(.9999995,C.r),be=eF(ax.xy.div(KI(t.bgGrainSize,1))),Be=Po(zo(be,t.bgGrainSeed.x.mul(97))),$=Po(zo(be.add(ix(17.3,5.1)),t.bgGrainSeed.y.mul(53)));oe.addAssign(zo(Be.add($).sub(1).mul(t.bgGrain).mul(ae)));let U=sx(e.blueNoise,ax.xy.div(64).add(t.grainSeed.yx)).r.sub(.5),J=sx(e.blueNoise,ax.xy.div(64).add(ix(.5,.25)).add(t.grainSeed)).r.sub(.5);return oe.addAssign(zo(U.add(J).mul(t.dither).div(255))),vhe(KI(oe,0),1)})();r.outputNode=O,r.needsUpdate=!0,h=T;for(let L of S)L.dispose()}d({aa:e.initial?.aaMode??"traa",tonemap:e.initial?.tonemap??"agx",dof:e.initial?.dof.enabled??!0,haze:!!e.haze&&(e.initialHaze??!0),upscaler:e.initialPerformance?.nativePostEffects?e.initialPerformance.upscaler:"native",sharpen:!!e.initialPerformance?.nativePostEffects&&!!e.initialPerformance.upscaleSharpness&&(e.initialPerformance.upscaler==="taau"||e.initialPerformance.upscaler==="bilinear")});function c(v,S,T,w,N,C,R){let E=!!e.haze&&N!==0,P=S.nativePostEffects?S.upscaler:"native",I=S.nativePostEffects&&S.upscaleSharpness>0&&(P==="taau"||P==="bilinear");(R!==u||E!==i.haze)&&(u=R,(v.aaMode!==i.aa||v.tonemap!==i.tonemap||v.dof.enabled!==i.dof||E!==i.haze||P!==i.upscaler||I!==i.sharpen)&&d({aa:v.aaMode,tonemap:v.tonemap,dof:v.dof.enabled,haze:E,upscaler:P,sharpen:I}),t.exposure.value=v.exposure,t.contrast.value=v.contrast,t.blackLift.value=v.blackLift,t.monochrome.value=v.monochrome,t.vignette.value=v.vignette.strength,t.vignetteSoft.value=v.vignette.softness,t.vignetteRadius.value=v.vignette.radius,t.grain.value=v.grain.strength,t.grainSize.value=v.grain.size,t.grainShadow.value=v.grain.shadowWeight,t.bgGrain.value=v.grain.backgroundStrength,t.bgGrainSize.value=v.grain.backgroundSize,t.dither.value=v.dither?1:0,t.focusRange.value=v.dof.range,t.aperture.value=v.dof.aperture,t.bloomStrength.value=v.bloom.intensity,t.bloomRadius.value=v.bloom.radius,t.bloomThreshold.value=v.bloom.threshold,t.upscaleSharpness.value=S.upscaleSharpness);let O=v.grain.backgroundSpeed>0?Math.floor(C*24*v.grain.backgroundSpeed):0;t.bgGrainSeed.value.set(O*.7548776662%1+.1,O*.5698402909%1+.1);let L=v.grain.speed>0?Math.floor(C*24*v.grain.speed):0;t.grainSeed.value.set(L*.7548776662%1,L*.5698402909%1),t.focus.value=T+v.dof.focusBias,t.sceneFade.value=w,t.hazeIntensity.value=N}function m(v){v!==l&&(l=v,o&&o.setResolutionScale(v))}function g(v){s&&s.setResolutionScale(v)}function y(v){a&&(a._jitterIndex=(v%31+31)%31,v!==n+1&&a._historyRenderTarget.setSize(1,1)),n=v}function b(){for(let v of h)v.dispose();h=[],r.dispose()}return{post:r,uniforms:t,update:c,setHazeResolution:m,setSceneResolution:g,setFrame:y,dispose:b,get scenePass(){return s}}}var{normalize:Xw,cross:tF,select:Ahe,abs:Che,vec3:rF,texture:Rhe,equirectUV:Ehe,pmremTexture:Phe}=Jr;function $w(e,t,r,i){if(qa.environment)return Phe(e,r,i).rgb.mul(t);let s=Xw(r),a=Xw(tF(s,Ahe(Che(s.y).lessThan(.95),rF(0,1,0),rF(1,0,0)))),n=tF(s,a),o=i.mul(i).mul(.32),l=u=>Rhe(e,Ehe(Xw(u))).level(0).rgb;return l(s).mul(.4).add(l(s.add(a.mul(o))).mul(.15)).add(l(s.sub(a.mul(o))).mul(.15)).add(l(s.add(n.mul(o))).mul(.15)).add(l(s.sub(n.mul(o))).mul(.15)).mul(t)}var{normalize:iF,mat3:Bhe,vec3:Ihe,float:nx,dot:sF,select:Fhe,pow:aF,clamp:Lhe,reflect:khe,refract:Dhe,exp:Ohe,log:Uhe,max:qw}=Jr;function zhe({ray:e,normal:t,environment:r,u:i,f:s,roughness:a,path:n}){let o=Fhe(sF(t,e).greaterThan(0),t.negate(),t),l=qw(i.ior,1.001),u=g=>iF(Bhe(i.model).mul(g)),h=g=>$w(r,i.envStrength,u(g),a),d=aF(l.sub(1).div(l.add(1)),2),c=d.add(nx(1).sub(d).mul(aF(nx(1).sub(Lhe(sF(o,e.negate()),0,1)),5))),m=Ohe(Uhe(qw(i.attColor,Ihe(.001))).mul(n.mul(i.thicknessScale).div(qw(i.attDist,.01))).mul(s.absorption));return{reflected:h(khe(e,o)).mul(c).mul(s.reflections),transmitted:h(iF(Dhe(e,o,nx(1).div(l)))).mul(nx(1).sub(c)).mul(i.backlight).mul(m)}}var{Fn:Hn,vec3:tn,vec4:Gm,float:Ns,uniform:mr,uniformArray:Vhe,instanceIndex:ox,texture3D:xc,textureStore:vc,uvec3:Ghe,ivec3:$t,int:nF,uint:kr,If:Vi,Loop:oF,max:Vo,min:ph,length:Whe,dot:lF,clamp:bc,smoothstep:lx,mix:uF,abs:Y0e,select:Wm,instancedArray:jhe,atomicAdd:hF,atomicMax:dF,atomicStore:jm,atomicLoad:ux}=Jr,Tc=12,hx=class Kx{constructor(t,r,i,s,a,n,o,l){if(this.renderer=t,this.shape=r,this.cellOffset=o,this.flightOffset=l,this.atomics=a,this.healOffset=n,!Number.isInteger(n))throw new Error("ErosionField: healOffset must be an integer");this.res=i,this.bound=r.bound,this.u.seed.value=s;let u=()=>{let h=new d_(i,i,i);return h.type=Dt,h.format=pi,h.minFilter=lr,h.magFilter=lr,h.wrapS=h.wrapT=h.wrapR=Ti,h.generateMipmaps=!1,h};this.tex=u(),this.scratch=u(),this.crackTex=u(),this.cellTex=u(),this.texNode=xc(this.tex),this.buildComputes()}static extraShell=0;res;bound;tex;scratch;crackTex;cellTex;u={reconstruct:mr(0),dt:mr(0),time:mr(0),heal:mr(0),healRate:mr(.6),healGap:mr(.12),fallbackHeal:mr(.04),fallbackOn:mr(0),refrostTime:mr(4),cellRestore:mr(30),growEdges:mr(1),breakup:mr(.7),breakupScale:mr(10),crumbleRate:mr(1.6),crumbleCrackBias:mr(2.5),crumbleUntil:mr(-1),brushNoise:mr(.55),brushNoiseScale:mr(9),brushSoftness:mr(.5),segCount:mr(0),seed:mr(0),crackScale:mr(2.2),crackWarp:mr(.45),crackWarpScale:mr(1.4),crackCoverage:mr(.55),breakScale:mr(3),cellSnap:mr(.85)};segments=Vhe(Array.from({length:Tc*2},()=>new Wt));stepNode;copyNode;cellClearNode;flightClearNode;clearNode;fillNode;healClearNode;bakeNode;statsNode;statsClearNode;statsBuf;statsPending=!1;stats={max:0,over50:0,over90:0,refrost:0};statsReadT=-1;statsIssuedT=-1;baked=!1;skipBake=!1;texNode;lastCrackSig="";settingsVersion=-1;atomics;healOffset;cellOffset;flightOffset;uvw(t){return tn(t).div(this.bound*2).add(.5)}sample(t){return this.texNode.sample(this.uvw(t)).level(0)}sampleCrack(t){return xc(this.crackTex).sample(this.uvw(t)).level(0)}static warpDomain(t,r,i,s){return tn(t).mul(i).add(tn(r).mul(s))}buildComputes(){let t=this.res,r=t*t*t,i=this.bound,s=this.u,a=i*2/t,n=Math.max(a*1.5,Kx.extraShell),o=ox,l=()=>{let g=o.mod(kr(t)),y=o.div(kr(t)).mod(kr(t)),b=o.div(kr(t*t));return Ghe(g,y,b)},u=g=>tn(g).add(.5).div(t).sub(.5).mul(i*2),h=xc(this.tex),d=xc(this.scratch),c=xc(this.crackTex),m=xc(this.cellTex);this.stepNode=Hn(()=>{let g=l(),y=u(g).toVar(),b=this.shape.sdfNode(y).toVar(),v=h.load($t(g)).level(0).toVar(),S=v.r.toVar(),T=v.g.toVar(),w=v.b.toVar(),N=Vo(0,v.a.sub(s.dt.div(.2))).toVar(),C=c.load($t(g)).level(0).w,R=ws(y.mul(s.breakupScale).add(s.seed.mul(1.7).add(11))).mul(.5).add(.5),E=uF(Ns(1),Ns(.15).add(gi(R).mul(1.7)),s.breakup).toVar();Vi(s.time.lessThan(s.crumbleUntil),()=>{let ne=Ns(0).toVar(),re=[$t(1,0,0),$t(-1,0,0),$t(0,1,0),$t(0,-1,0),$t(0,0,1),$t(0,0,-1)];for(let oe of re){let Ae=bc($t(g).add(oe),$t(0),$t(t-1));ne.assign(Vo(ne,h.load(Ae).level(0).r))}let ce=lx(.02,-.02,b),ge=s.crumbleRate.mul(Ns(1).add(C.mul(s.crumbleCrackBias))).mul(ce),ye=ne.mul(.92).sub(.06);Vi(ye.greaterThan(S),()=>{S.assign(ph(ye,S.add(ye.sub(S).mul(gi(ge.mul(s.dt))))))})});let P=m.load($t(g)).level(0).toVar();oF({start:nF(0),end:nF(s.segCount),type:"int",condition:"<"},({i:ne})=>{let re=this.segments.element(ne.mul(2)),ce=this.segments.element(ne.mul(2).add(1)),ge=re.xyz,ye=ce.xyz,oe=re.w,Ae=ce.w,Ie=ye.sub(ge),Xe=$=>{let U=bc(lF($.sub(ge),Ie).div(Vo(lF(Ie,Ie),1e-6)),0,1);return Whe($.sub(ge.add(Ie.mul(U))))},at=ws(y.mul(s.brushNoiseScale).add(s.seed)).mul(.5).add(ws(y.mul(s.brushNoiseScale.mul(2.7)).add(s.seed.add(3.1))).mul(.25)),W=oe.mul(Ns(1).add(at.mul(s.brushNoise))),j=W.mul(Ns(1).sub(s.brushSoftness)),G=lx(W,j,Xe(y)),ae=oe.mul(Ns(1).add(P.w.sub(.5).mul(s.brushNoise).mul(.6))),be=lx(ae,ae.mul(Ns(1).sub(s.brushSoftness)),Xe(P.xyz)),Be=uF(G,be,s.cellSnap);S.assign(ph(1,S.add(Be.mul(Ae).mul(s.dt)))),Vi(Be.greaterThan(.02),()=>{N.assign(1)})});let I=kr(this.healOffset).add(o),O=Ns(ux(this.atomics.element(I))).toVar(),L=kr(bc(P.w.mul(65535),0,65535)),X=ux(this.atomics.element(kr(this.flightOffset).add(L))).equal(kr(0));Vi(O.greaterThan(.5).and(X.or(s.reconstruct.greaterThan(.5))),()=>{jm(this.atomics.element(I),kr(0)),T.assign(ph(1,T.add(S.mul(2.5)))),S.assign(0),w.assign(1)});let z=kr(bc(P.w.mul(65535),0,65535)),H=Ns(ux(this.atomics.element(kr(this.cellOffset).add(z)))),ue=ux(this.atomics.element(kr(this.flightOffset).add(z))).equal(kr(0));Vi(H.greaterThan(.5).and(S.greaterThan(0)),()=>{w.assign(2)}),Vi(w.greaterThan(1.5).and(S.greaterThan(0)).and(ue).and(s.reconstruct.lessThan(.5)),()=>{let ne=Ns(1).toVar();Vi(s.growEdges.greaterThan(.5),()=>{ne.assign(0);let re=[$t(1,0,0),$t(-1,0,0),$t(0,1,0),$t(0,-1,0),$t(0,0,1),$t(0,0,-1)];for(let ce of re){let ge=bc($t(g).add(ce),$t(0),$t(t-1));Vi(h.load(ge).level(0).r.lessThan(.5),()=>{ne.assign(1)})}}),Vi(ne.greaterThan(.5),()=>{let re=S,ce=Vo(0,S.sub(s.cellRestore.mul(E).mul(s.dt)));T.assign(ph(1,T.add(re.sub(ce).mul(2.5)))),S.assign(ce)})}),Vi(s.heal.greaterThan(.5).and(ue.or(s.reconstruct.greaterThan(.5))),()=>{let ne=Ns(8).toVar(),re=Ns(0).toVar(),ce=[$t(1,0,0),$t(-1,0,0),$t(0,1,0),$t(0,-1,0),$t(0,0,1),$t(0,0,-1)];for(let oe of ce){let Ae=bc($t(g).add(oe),$t(0),$t(t-1)),Ie=h.load(Ae).level(0);Vi(Ie.b.greaterThan(.5),()=>{ne.assign(ph(ne,Ie.r)),re.assign(1)})}let ge=s.reconstruct.greaterThan(.5),ye=Wm(ge,Wm(ne.lessThan(.05),Ns(0),Ns(1)),ne.add(s.healGap));Vi(re.greaterThan(.5).and(ye.lessThan(S)),()=>{let oe=Wm(ge,Vo(s.cellRestore.mul(s.fallbackHeal),s.healRate),s.healRate),Ae=Vo(ye,S.sub(oe.mul(E).mul(s.dt)));T.assign(ph(1,T.add(S.sub(Ae).mul(3)))),S.assign(Ae),Vi(Ae.lessThanEqual(ye.add(.001)),()=>{w.assign(1)})}),Vi(s.fallbackOn.greaterThan(.5).and(ge.not()),()=>{let oe=Vo(0,S.sub(s.fallbackHeal.mul(E).mul(s.dt)));T.assign(ph(1,T.add(S.sub(oe).mul(3)))),S.assign(oe)})}),Vi(S.greaterThan(v.r.add(5e-4)),()=>{w.assign(0)}),T.assign(Vo(0,T.sub(s.dt.mul(E).div(Vo(s.refrostTime,.01))))),S.assign(Wm(b.greaterThan(n),0,S)),vc(this.scratch,g,Gm(S,T,w,N)).toWriteOnly()})().compute(r,[64]),this.cellClearNode=Hn(()=>{jm(this.atomics.element(kr(this.cellOffset).add(ox)),kr(0))})().compute(65536,[64]),this.flightClearNode=Hn(()=>{jm(this.atomics.element(kr(this.flightOffset).add(ox)),kr(0))})().compute(65536,[64]),this.copyNode=Hn(()=>{let g=l(),y=d.load($t(g)).level(0);vc(this.tex,g,y).toWriteOnly()})().compute(r,[64]),this.statsBuf=jhe(4,"uint").toAtomic(),this.statsClearNode=Hn(()=>{oF(4,({i:g})=>{jm(this.statsBuf.element(g),kr(0))})})().compute(1,[1]),this.statsNode=Hn(()=>{let g=l(),y=h.load($t(g)).level(0),b=y.r;dF(this.statsBuf.element(0),kr(b.mul(65535))),dF(this.statsBuf.element(3),kr(y.g.mul(65535))),Vi(b.greaterThan(.5),()=>{hF(this.statsBuf.element(1),kr(1))}),Vi(b.greaterThan(.9),()=>{hF(this.statsBuf.element(2),kr(1))})})().compute(r,[64]),this.clearNode=Hn(()=>{let g=l();vc(this.tex,g,Gm(0)).toWriteOnly()})().compute(r,[64]),this.fillNode=Hn(()=>{let g=l(),y=this.shape.sdfNode(u(g));vc(this.tex,g,Gm(Wm(y.greaterThan(n),0,1),0,0,0)).toWriteOnly()})().compute(r,[64]),this.healClearNode=Hn(()=>{jm(this.atomics.element(kr(this.healOffset).add(ox)),kr(0))})().compute(r,[64]),this.bakeNode=Hn(()=>{let g=l(),y=u(g).toVar(),b=y.mul(s.crackWarpScale).add(s.seed.mul(.11)),v=tn(ws(b).mul(.6).add(ws(b.mul(2.1).add(tn(7.3,1.9,4.4))).mul(.4)),ws(b.add(tn(13.7,5.1,9.9))).mul(.6).add(ws(b.mul(2.1).add(tn(2.2,8.8,6.1))).mul(.4)),ws(b.add(tn(3.3,17.1,12.5))).mul(.6).add(ws(b.mul(2.1).add(tn(9.7,4.4,1.1))).mul(.4))),S=Kx.warpDomain(y,v,s.crackScale,s.crackWarp),T=bm(S,s.seed,s.crackCoverage).w.div(s.crackScale),w=lx(a*2.5,0,T),N=Po(tn(g)).mul(.15);vc(this.crackTex,g,Gm(v,gi(w.add(N.mul(w))))).toWriteOnly();let C=Kx.warpDomain(y,v,s.breakScale,s.crackWarp),R=A_(C,s.seed.add(3)),E=R.xyz.sub(v.mul(s.crackWarp)).div(s.breakScale);vc(this.cellTex,g,Gm(E,Po(R.xyz.add(s.seed)))).toWriteOnly()})().compute(r,[64])}clear(t){t.compute(this.clearNode),t.compute(this.cellClearNode),t.compute(this.flightClearNode)}rebake(t,r){let i=this.u,s=le.erosion,a=le.ice.cracks;i.crackScale.value=a.largeScale,i.crackWarp.value=a.warp,i.crackWarpScale.value=a.warpScale,i.crackCoverage.value=a.coverage,i.breakScale.value=s.breakCellScale;let n=`${a.largeScale}|${a.warp}|${a.warpScale}|${a.coverage}|${s.breakCellScale}`;(!this.baked||n!==this.lastCrackSig)&&!this.skipBake&&t.compute(this.bakeNode),this.lastCrackSig=n,this.baked=!0,i.reconstruct.value=r?1:0,t.compute(r?this.fillNode:this.clearNode),t.compute(this.cellClearNode),t.compute(this.flightClearNode),t.compute(this.healClearNode),this.crumbleUntil=-1,i.crumbleUntil.value=-1}readStats(t,r=0){this.statsPending||(this.statsPending=!0,this.statsIssuedT=r,t.compute(this.statsClearNode),t.compute(this.statsNode),t.getArrayBufferAsync(this.statsBuf.value).then(i=>{let s=new Uint32Array(i);this.stats.max=s[0]/65535,this.stats.over50=s[1],this.stats.over90=s[2],this.stats.refrost=s[3]/65535,this.statsReadT=this.statsIssuedT,this.statsPending=!1}).catch(()=>{this.statsPending=!1}))}crumbleUntil=-1;step(t,r,i,s,a,n=!0){let o=le.erosion,l=le.healing,u=this.u;if(u.dt.value=Math.min(i,1/30),u.time.value=r,le.version!==this.settingsVersion){this.settingsVersion=le.version;let d=le.ice.cracks,c=`${d.largeScale}|${d.warp}|${d.warpScale}|${d.coverage}|${o.breakCellScale}`;(!this.baked||c!==this.lastCrackSig)&&(u.crackScale.value=d.largeScale,u.crackWarp.value=d.warp,u.crackWarpScale.value=d.warpScale,u.crackCoverage.value=d.coverage,u.breakScale.value=o.breakCellScale,this.skipBake||t.compute(this.bakeNode),this.baked||t.compute(this.clearNode),this.baked=!0,this.lastCrackSig=c),u.healRate.value=l.healRate,u.healGap.value=l.healGap,u.fallbackHeal.value=l.fallbackHeal,u.refrostTime.value=l.refrostTime,u.cellRestore.value=l.cellRestore,u.growEdges.value=l.growFromEdges?1:0,u.breakup.value=l.breakup,u.breakupScale.value=l.breakupScale,u.crumbleRate.value=o.crumbleRate,u.crumbleCrackBias.value=o.crumbleCrackBias,u.brushNoise.value=o.brushNoise,u.brushNoiseScale.value=o.brushNoiseScale,u.cellSnap.value=o.cellSnap,u.brushSoftness.value=Math.max(o.brushSoftness,.02)}a>0&&(pt.lastStrokeT=r,u.crumbleUntil.value=r+o.crumbleDuration,this.crumbleUntil=r+o.crumbleDuration);let h=r-pt.lastStrokeT>l.healDelay;if(pt.healing=h,u.heal.value=h?1:0,u.fallbackOn.value=r-pt.lastStrokeT>l.healDelay+l.waveTime+l.waveJitter+Math.max(l.returnDuration,l.returnAfter)+1?1:0,u.segCount.value=a,a>0){let d=this.segments.array;for(let c=0;c<a*2;c++)d[c].copy(s[c])}!n||u.reconstruct.value>.5||(t.compute(this.stepNode),t.compute(this.cellClearNode),t.compute(this.copyNode))}commitAssembly(t){t.compute(this.copyNode)}dispose(){this.tex.dispose(),this.scratch.dispose(),this.crackTex.dispose(),this.cellTex.dispose()}},Hm="photographic",{Fn:Hhe,vec2:Xhe,vec3:Xn,vec4:dx,float:Pa,int:Z0e,Loop:cF,If:Yw,Break:pF,normalize:Xm,length:mF,max:Sc,min:$he,abs:fF,dot:cx,pow:Zw,exp:qhe,log:Yhe,mix:J0e,clamp:px,refract:gF,reflect:Jw,select:mx,mat3:yF,texture:Q0e,equirectUV:K0e,cameraViewMatrix:xF,cameraProjectionMatrix:Zhe,cross:Jhe}=Jr;function Qhe(e){let{shape:t,erosion:r,p:i,ray:s,normal:a,environment:n,backdrop:o,u:l,f:u,roughness:h}=e,d=t.bound,c=Math.max(.001,d/1500),m=oe=>Xm(yF(l.model).mul(oe)),g=(oe,Ae)=>$w(n,l.envStrength,oe,Ae),y=oe=>{let Ae=t.voxelSize?t.voxelSize.mul(.75):Pa(d/240),Ie=Xn(t.sdfNode(oe.add(Xn(Ae,0,0))).sub(t.sdfNode(oe.sub(Xn(Ae,0,0)))),t.sdfNode(oe.add(Xn(0,Ae,0))).sub(t.sdfNode(oe.sub(Xn(0,Ae,0)))),t.sdfNode(oe.add(Xn(0,0,Ae))).sub(t.sdfNode(oe.sub(Xn(0,0,Ae)))));return Ie.div(Sc(mF(Ie),1e-5))},b=Sc(l.ior,1.001),v=mx(cx(a,s).greaterThan(0),a.negate(),a),S=Xm(gF(s,v,Pa(1).div(b))),T=Hhe(()=>{let oe=Pa(c*2).toVar(),Ae=Pa(0).toVar();return cF(64,()=>{let Ie=i.add(S.mul(oe)),Xe=t.sdfNode(Ie),at=r.sample(Ie).r;Yw(oe.greaterThan(c*4).and(Xe.greaterThan(0).or(at.greaterThan(l.cutThreshold))),()=>{pF()}),Ae.assign(oe),oe.addAssign(px(fF(Xe).mul(.7),c,d/12)),Yw(oe.greaterThan(d*2),()=>{pF()})}),cF(5,()=>{let Ie=Ae.add(oe).mul(.5),Xe=i.add(S.mul(Ie));Yw(t.sdfNode(Xe).lessThan(0).and(r.sample(Xe).r.lessThan(l.cutThreshold)),()=>{Ae.assign(Ie)}).Else(()=>{oe.assign(Ie)})}),dx(i.add(S.mul(oe)),oe)})(),w=y(T.xyz),N=mx(cx(w,S).lessThan(0),w.negate(),w),C=gF(S,N.negate(),b),R=mF(C).lessThan(1e-4),E=mx(R,Jw(S,N),C),P=l.model.mul(dx(T.xyz,1)).xyz,I=oe=>{let Ae=m(oe),Ie=xF.mul(dx(P,1)).xyz,Xe=yF(xF).mul(Ae),at=Pa(-35).sub(Ie.z).div($he(Xe.z,-.001)),W=Ie.add(Xe.mul(px(at,0,150))),j=Zhe.mul(dx(W,1)),G=Xhe(j.x.div(Sc(j.w,.001)).mul(.5).add(.5),j.y.div(Sc(j.w,.001)).mul(-.5).add(.5));return z1(o,px(G,0,1)).add(g(Ae,h).mul(l.backlight))},O=l.dispersion.mul(u.dispersion).mul(.025),L=Xm(Jhe(S,N).add(Xn(1e-5,0,0))),X=Xn(I(Xm(E.add(L.mul(O)))).r,I(E).g,I(Xm(E.sub(L.mul(O)))).b),z=Zw(b.sub(1).div(b.add(1)),2),H=z.add(Pa(1).sub(z).mul(Zw(Pa(1).sub(px(cx(v,s.negate()),0,1)),5))).mul(u.reflections),ue=mx(R,Pa(1),z.add(Pa(1).sub(z).mul(Zw(Pa(1).sub(fF(cx(N,S))),5)))),ne=T.w.mul(l.thicknessScale),re=qhe(Yhe(Sc(l.attColor,Xn(.001))).mul(ne.div(Sc(l.attDist,.01))).mul(u.absorption)),ce=g(m(Jw(s,v)),h),ge=g(m(Jw(S,N)),h),ye=X.mul(Pa(1).sub(ue)).add(ge.mul(ue)).mul(re);return{reflected:ce.mul(H),transmitted:ye.mul(Pa(1).sub(H)),distance:ne}}var{Fn:Khe,Loop:ede,int:vF,exp:tde,clamp:rde,vec2:$m,vec3:ide,float:fx,texture:Qw,abs:sde,pow:Kw,max:ade,smoothstep:nde}=Jr;function e2(e,t,r,i,s=fx(0)){if(!e)return fx(0);let a=Kw(sde(r),ide(6)),n=a.div(ade(a.x.add(a.y).add(a.z),.001)),o=(l,u)=>$m(l.x.mul(.932).sub(l.y.mul(.362)),l.x.mul(.362).add(l.y.mul(.932))).mul(i).add(u).add($m(s.mul(.217),s.mul(.371)));return Qw(e,o(t.yz,$m(.317,.173))).r.mul(n.x).add(Qw(e,o(t.zx,$m(.619,.431))).r.mul(n.y)).add(Qw(e,o(t.xy,$m(0))).r.mul(n.z))}function ode(e,t,r,i,s){let a=Zy(Bo(e.mul(r).add(t.mul(2)),3).mul(.5).add(.5),i,s),n=Bo(e.mul(r.mul(32)).add(t.mul(3.1)),3).mul(.5).add(.5);return Kw(a,1.5).mul(nde(.3,.69,n))}function bF(e,t,r,i,s,a,n){return Khe(()=>{let o=fx(0).toVar();return ede({start:vF(0),end:vF(3),type:"int",condition:"<"},({i:l})=>{let u=fx(l).add(.5).div(3),h=t.add(i.mul(s).mul(u));o.addAssign(Kw(e2(e,h,r,a,u),1.6).mul(tde(u.mul(-.7))))}),rde(o.div(3).mul(n),0,.45)})()}var{Fn:lde,If:ude,vec3:TF,vec4:SF,float:Ql,dot:hde,smoothstep:_c,normalize:dde,clamp:cde,dFdx:pde,dFdy:mde,length:_F,max:fde}=Jr;function wF(e){let t=Lm(e+11);return[0,1,2].map(()=>{let r=new F(t()*2-1,t()*2-1,t()*2-1).normalize();return TF(r.x,r.y,r.z)})}function MF(e,t,r,i,s,a,n,o=!1){let l=ne=>o?Ql(1).sub(_c(.35,1.25,fde(_F(pde(e.mul(ne))),_F(mde(e.mul(ne)))))):Ql(1),u=ode(e,r,a.frostScale,a.frostThreshold,a.frostSoftness),h=gi(u.add(a.interiorFrost)).mul(n.frost),d=(ne,re)=>ne.sub(re.mul(hde(ne,re)).mul(Ql(1).sub(Ql(1).div(a.smudgeAniso)))),c=SF(ws(d(e.mul(a.smudgeScale),i[0]).add(r.mul(3))),ws(d(e.mul(a.smudgeScale),i[1]).add(r.mul(4))),ws(d(e.mul(a.smudgeScale),i[2]).add(r.mul(5))),ws(e.mul(a.smudgeScale.mul(1.7)).add(r.mul(7)))),m=_c(.45,.85,c.x.mul(.5).add(.5)).add(_c(.45,.85,c.y.mul(.5).add(.5))).add(_c(.45,.85,c.z.mul(.5).add(.5))),g=_c(.6,.72,c.w.mul(.5).add(.5)),y=TF(Bo(e.mul(a.smudgeMaskScale).add(r.mul(21)),2).mul(.5).add(.5),Bo(e.mul(a.bumpMaskScale).add(r.mul(27)),2).mul(.5).add(.5),Bo(e.mul(a.regionScale).add(r.mul(33)),2).mul(.5).add(.5)),b=Zy(y.x,Ql(1).sub(a.smudgeCoverage),.35),v=Zy(y.y,Ql(1).sub(a.microCoverage),.35),S=Zy(y.z,Ql(1).sub(a.regionCoverage),.45),T=gi(m.div(3).add(g.mul(.6)).mul(a.smudgeAmount).mul(b)).mul(n.smudges),w=s.sampleCrack(e),N=hx.warpDomain(e,w.xyz,a.crackLarge,a.crackWarp).add(r.mul(.37)),C=lde(()=>{let ne=SF(0,0,1,1).toVar();return ude(n.cracks.greaterThan(.5),()=>{ne.assign(s.materialPlanes?s.materialPlanes.sample(N):bm(N,a.seed,a.crackCoverage))}),ne})(),R=C.w.div(a.crackLarge),E=Ql(1).sub(a.veinContrast.mul(Bo(e.mul(a.veinScale).add(r.mul(41)),2).mul(.5).add(.5))),P=_c(a.crackWidth.mul(5),0,R).mul(a.surfaceCrack).mul(S).mul(E).mul(n.cracks),I=gi(t.y.mul(.5).add(.5)),O=Na(e.mul(a.crystalScale).add(r)).mul(a.crystalBump).mul(.6).mul(n.crystals).mul(l(a.crystalScale)),L=Na(e.mul(a.edgeBumpScale).add(r.mul(13))).mul(a.edgeBump).mul(.5).mul(n.grain).mul(l(a.edgeBumpScale)),X=Na(e.mul(a.microScale).add(r.mul(5))).mul(a.microBump).mul(v).mul(n.micro).mul(l(a.microScale)),z=Na(e.mul(a.rippleScale).add(r.mul(9))).mul(a.rippleBump).mul(I).mul(n.ripples).mul(l(a.rippleScale)),H=O.add(L).sub(X).sub(z).sub(C.xyz.mul(P).mul(.6)),ue=dde(t.add(H.mul(n.surfaceBumps)));return{frost:h,smudge:T,surfCrack:P,nSurface:ue,regionMask:S,roughness:cde(a.baseRough.add(h.mul(a.frostRough)).add(T.mul(a.smudgeRough)).add(P.mul(.12)),.015,.8)}}var{Fn:Kl,vec3:ei,vec4:$n,float:yi,uniform:je,varying:gde,texture:yde,vec2:gx,positionLocal:xde,normalLocal:NF,cameraPosition:vde,transformNormalToView:AF,normalize:yx,dot:bde,length:wc,max:As,min:xx,abs:CF,pow:eye,exp:Tde,mix:vx,smoothstep:mh,clamp:qm,reflect:tye,select:RF,If:fh,Loop:EF,Break:PF,int:BF,output:t2,screenUV:r2}=Jr,Sde=0,i2=-1;function s2(e){i2=e}function _de({shape:e,erosion:t,seed:r,environment:i,fractureDetail:s,backdrop:a,meshEntry:n,glassMatcap:o,voronoiCells:l="27"}){let u=l==="8"?ase:A_,h=Lm(r+11),d={model:je(new We),envStrength:je(1),backlight:je(.4),inclusionAmount:je(.3),inclusionScale:je(.4),baseColor:je(new gt("#f8f8f8")),ior:je(1.36),dispersion:je(.02),thicknessScale:je(1),attDist:je(.9),attColor:je(new gt("#cfd2d4")),baseRough:je(.05),frostScale:je(1.6),frostThreshold:je(.5),frostSoftness:je(.28),frostRough:je(.65),frostDiffuse:je(.55),crystalBump:je(.12),crystalScale:je(28),crackLarge:je(1.6),crackWarp:je(.45),crackCoverage:je(.55),regionScale:je(.8),regionCoverage:je(.7),veinScale:je(5),veinContrast:je(.7),crackFine:je(5.5),crackFineAmount:je(.45),fineCoverage:je(.35),fineNearLarge:je(.75),crackWidth:je(.004),crackBright:je(.4),crackDark:je(.5),crackRefr:je(.02),surfaceCrack:je(.35),crackSteps:je(14),smudgeAmount:je(.6),smudgeCoverage:je(.55),smudgeMaskScale:je(1.2),smudgeAniso:je(6),smudgeRough:je(.35),smudgeWhite:je(.08),smudgeScale:je(3.2),microBump:je(.25),microScale:je(60),microCoverage:je(.6),rippleBump:je(.3),rippleScale:je(9),bumpMaskScale:je(1.5),clearcoat:je(.3),clearcoatRough:je(.08),specularIntensity:je(1),interiorScatter:je(.25),deformAmp:je(.045),deformFreq:je(1.1),seed:je(r),edgeWidth:je(.35),edgeInset:je(.06),edgeBump:je(.6),edgeBumpScale:je(55),refrostStrength:je(1),cutThreshold:je(.7),cutSoft:je(.04),interiorSteps:je(24),interiorFrost:je(0),crumbleGlow:je(.15),edgeWhite:je(.5),lightDir:je(new F(0,1,0)),modelInv:je(new We),jitter:je(new fe),adaptiveSteps:je(0),powderTone:je(new gt("#dcdcdc")),keyIntensity:je(3.2),keyColor:je(new gt("#ffffff")),hover:je(0)},c=Object.fromEntries(Object.keys(Qd).map(V=>[V,je(Number(Qd[V]))])),m=ei(r*.731,r*.137,r*.529),g=wF(r),y=qa.matcap?new Pd:new mS,b=new F,v=new si,S=-1;y.side=ii,y.transparent=!1,y.metalness=0,y.transmission=1;let T=V=>Bo(V.mul(d.deformFreq).add(m),3).mul(d.deformAmp),w=V=>mh(d.cutThreshold.sub(d.edgeWidth),d.cutThreshold.sub(d.edgeWidth.mul(.15)),V),N=Kl(()=>{let V=xde,Oe=NF,tt=T(V),Je=t.sample(V).r,ct=w(Je),_e=t.sampleCrack(V).w.mul(d.surfaceCrack).mul(c.cracks).mul(c.surfaceBumps).mul(.012);return V.add(Oe.mul(tt.sub(ct.mul(d.edgeInset)).sub(_e)))})();y.positionNode=N;let C=gde(N),R=d.modelInv.mul($n(vde,1)).xyz,E=yx(C.sub(R)),P=d.lightDir,I=n?.position.sample(r2),O=n?.normal.sample(r2).xyz,L=n?n.depth.sample(r2).r.lessThan(.999999).and(t.sample(I.xyz).r.lessThan(d.cutThreshold)):null,X=Kl(()=>{let V=R,Oe=it=>RF(it.greaterThanEqual(0),yi(1),yi(-1)).div(As(CF(it),1e-6)),tt=ei(Oe(E.x),Oe(E.y),Oe(E.z)),Je=ei(-e.bound).sub(V).mul(tt),ct=ei(e.bound).sub(V).mul(tt),_e=xx(Je,ct),nt=As(Je,ct),dt=As(As(_e.x,As(_e.y,_e.z)),0),ft=xx(xx(nt.x,xx(nt.y,nt.z)),wc(C.sub(R))),Fe=$n(C,-1).toVar();return n&&fh(L,()=>{Fe.assign($n(I.xyz,wc(I.xyz.sub(R))))}),fh(ft.greaterThan(dt).and(Fe.w.lessThan(0)),()=>{let it=yi(2*t.bound/t.res),Rt=e.voxelSize??it,Ft=Rt.mul(.4),Ze=dt.toVar();EF(192,()=>{fh(Ze.greaterThan(ft),()=>{PF()});let ht=V.add(E.mul(Ze)),Yt=e.sdfNode(ht);fh(Yt.lessThanEqual(.001).and(t.sample(ht).r.lessThan(d.cutThreshold)),()=>{Fe.assign($n(ht,Ze)),PF()}),Ze.addAssign(As(Yt.sub(Ft).mul(.7),Rt.mul(.35)))}),fh(Fe.w.lessThan(0).and(t.sample(C).r.lessThan(d.cutThreshold)),()=>{Fe.assign($n(C,ft))})}),Fe})(),z=X.w,H=X.xyz,ue=.02,ne=ei(t.sample(H.add(ei(ue,0,0))).r.sub(t.sample(H.sub(ei(ue,0,0))).r),t.sample(H.add(ei(0,ue,0))).r.sub(t.sample(H.sub(ei(0,ue,0))).r),t.sample(H.add(ei(0,0,ue))).r.sub(t.sample(H.sub(ei(0,0,ue))).r)),re=wc(ne),ce=e.voxelSize?e.voxelSize.mul(.75):yi(ue),ge=ei(e.sdfNode(H.add(ei(ce,0,0))).sub(e.sdfNode(H.sub(ei(ce,0,0)))),e.sdfNode(H.add(ei(0,ce,0))).sub(e.sdfNode(H.sub(ei(0,ce,0)))),e.sdfNode(H.add(ei(0,0,ce))).sub(e.sdfNode(H.sub(ei(0,0,ce))))),ye=()=>RF(wc(ge).greaterThan(1e-5),ge.div(As(wc(ge),1e-5)),NF.negate()),oe=n?Kl(()=>{let V=ei(0).toVar();return fh(L,()=>V.assign(yx(O))).Else(()=>V.assign(ye())),V})():ye(),Ae=yx(vx(oe,ne.div(As(re,1e-5)),mh(.02,.15,re).mul(c.cutNormals))),Ie=H,{frost:Xe,smudge:at,surfCrack:W,nSurface:j,regionMask:G,roughness:ae}=MF(Ie,Ae,m,g,t,d,c,qa.aa);y.normalNode=AF(j.negate());let be=wc(C.sub(H)),Be=Kl(()=>{let V=yi(0).toVar(),Oe=qm(d.crackSteps.div(4).floor(),2,6).toVar();EF({start:BF(0),end:BF(Oe),type:"int",condition:"<"},({i:Je})=>{let ct=yi(Je).add(.5).div(Oe),_e=H.add(E.mul(be).mul(ct)).toVar(),nt=t.sampleCrack(_e),dt=hx.warpDomain(_e,nt.xyz,d.crackLarge,d.crackWarp).add(m.mul(.37)),ft=t.materialPlanes?t.materialPlanes.sample(dt):bm(dt,d.seed,d.crackCoverage),Fe=As(d.crackWidth.mul(d.crackLarge),.001),it=yi(1).sub(mh(Fe,Fe.mul(2.5),ft.w)),Rt=yi(1).sub(d.veinContrast.mul(Bo(_e.mul(d.veinScale).add(m.mul(41)),2).mul(.5).add(.5))),Ft=t.materialPlanes?t.materialPlanes.sample(dt.mul(d.crackFine.div(d.crackLarge)).add(m),!0):bm(dt.mul(d.crackFine.div(d.crackLarge)).add(m),d.seed.add(7),d.fineCoverage),Ze=As(d.crackWidth.mul(d.crackFine).mul(.35),.001),ht=yi(1).sub(mh(Ze,Ze.mul(2.5),Ft.w)),Yt=vx(yi(1),yi(1).sub(mh(.03,.25,ft.w)),d.fineNearLarge),Tr=mh(.24,.68,Bo(_e.mul(38).add(m),2).mul(.5).add(.5)),Gi=it.mul(Tr).add(ht.mul(d.crackFineAmount).mul(Yt)),na=mh(.85,.35,t.sample(_e).r),lu=CF(bde(ft.xyz,P)).mul(.6).add(.4);V.addAssign(Gi.mul(Rt).mul(G).mul(na).mul(lu).mul(Tde(ct.mul(be).div(As(d.attDist,.01)).negate())))});let tt=qm(V.div(Oe),0,1);return $n(tt.mul(d.crackBright),yi(1).sub(tt.mul(d.crackDark).mul(.15)),0,0)})(),$=Kl(()=>{let V=$n(0,1,0,0).toVar();return fh(c.cracks.greaterThan(.5),()=>{V.assign(Be)}),V})(),U=As(be.mul(d.thicknessScale),.001),J=(V,Oe)=>e2(s,V,Ae,d.inclusionScale,Oe),q=Hm==="photographic"?bF(s,Ie,Ae,E,be,d.inclusionScale,d.inclusionAmount).mul(c.scatter):yi(0),se=qm(Xe.mul(d.frostDiffuse).add(at.mul(d.smudgeWhite)).add(q.mul(.65)),0,.65),pe=Hm==="photographic"?J(Ie,yi(0)).mul(c.frost):yi(0);y.roughnessNode=qm(ae.add(pe.mul(.22)),.015,.8),y.iorNode=d.ior,y.dispersionNode=d.dispersion.mul(c.dispersion),y.thicknessNode=U,y.attenuationDistanceNode=As(d.attDist,.01),y.attenuationColorNode=vx(ei(1),d.attColor,c.absorption),y.colorNode=d.baseColor,y.clearcoatNode=d.clearcoat.mul(c.clearcoat),y.clearcoatRoughnessNode=d.clearcoatRough,y.specularIntensityNode=d.specularIntensity.mul(c.reflections);let Te=$.x.add(W.mul(.3)).mul(d.keyIntensity).mul(.3),we=se.mul(d.interiorScatter).mul(c.scatter);if(y.emissiveNode=d.keyColor.mul(Te.add(we.mul(.3))),qa.matcap){let V=yx(AF(j)),Oe=V.xy.mul(.495).add(.5),tt=ae.mul(ae).mul(.06),Je=_e=>yde(o,qm(_e,.002,.998)).rgb,ct=Je(Oe).mul(.4).add(Je(Oe.add(gx(tt,0))).mul(.15)).add(Je(Oe.sub(gx(tt,0))).mul(.15)).add(Je(Oe.add(gx(0,tt))).mul(.15)).add(Je(Oe.sub(gx(0,tt))).mul(.15)).mul(d.envStrength);y.outputNode=Kl(()=>{z.lessThan(0).discard();let _e=As(se,yi(1).sub(c.transmission)),nt=d.baseColor.mul(ct.mul(.5).add(ei(.2)).mul(d.keyIntensity));return $n(vx(ct.mul($.y),nt,_e).add(d.keyColor.mul(Te)).add(d.keyColor.mul(q.mul(d.backlight).mul(.8))),1)})()}else if(Hm==="physical")y.transmissionNode=c.transmission.mul(yi(1).sub(se)),y.outputNode=Kl(()=>(z.lessThan(0).discard(),$n(t2.rgb.mul($.y),t2.a)))();else{let V=qa.fast?zhe({ray:E,normal:j,environment:i,u:d,f:c,roughness:ae,path:be}):Qhe({shape:e,erosion:t,p:Ie,ray:E,normal:j,environment:i,backdrop:a,u:d,f:c,roughness:ae});y.transmission=0,y.transmissionNode=null,y.outputNode=Kl(()=>{z.lessThan(0).discard();let Oe=V.reflected.add(V.transmitted.mul($.y)),tt=As(se,yi(1).sub(c.transmission)),Je=Oe.mul(yi(1).sub(tt)).add(t2.rgb.mul(tt)),ct=d.keyColor.mul(q.mul(d.backlight).mul(.8));return $n(Je.add(ct).add(d.keyColor.mul(Te)),1)})()}function ie(V,Oe,tt,Je){if(le.version!==S){S=le.version;let _e=le.ice,nt=le.erosion,dt=le.shape,ft=le.healing;for(let it of Object.keys(c))c[it].value=Number(_e.features?.[it]??Qd[it]);d.baseColor.value.set(_e.baseColor??"#ffffff"),d.envStrength.value=_e.envIntensity,d.backlight.value=_e.backlight??.4,d.inclusionAmount.value=_e.inclusionAmount??.3,d.inclusionScale.value=_e.inclusionScale??.4,d.ior.value=_e.ior,d.dispersion.value=_e.dispersion,d.thicknessScale.value=_e.thicknessScale,d.attDist.value=_e.attenuationDistance,d.attColor.value.set(_e.attenuationColor),d.baseRough.value=_e.baseRoughness,d.frostScale.value=_e.frost.scale,d.frostThreshold.value=_e.frost.threshold,d.frostSoftness.value=_e.frost.softness,d.frostRough.value=_e.frost.roughness,d.frostDiffuse.value=_e.frost.diffuse,d.crystalBump.value=_e.frost.crystalBump,d.crystalScale.value=_e.frost.crystalScale;let Fe=_e.cracks;d.crackLarge.value=Fe.largeScale,d.crackWarp.value=Fe.warp,d.crackCoverage.value=Fe.coverage,d.regionScale.value=Fe.regionScale,d.regionCoverage.value=Fe.regionCoverage,d.veinScale.value=Fe.veinScale,d.veinContrast.value=Fe.veinContrast,d.crackFine.value=Fe.fineScale,d.crackFineAmount.value=Fe.fineAmount,d.fineCoverage.value=Fe.fineCoverage,d.fineNearLarge.value=Fe.fineNearLarge,d.crackWidth.value=Fe.width,d.crackBright.value=Fe.brightness,d.crackDark.value=Fe.darkness,d.crackRefr.value=Fe.refraction,d.surfaceCrack.value=Fe.surfaceStrength,d.crackSteps.value=Fe.steps,d.adaptiveSteps.value=le.performance.adaptiveSteps?1:0,d.smudgeAmount.value=_e.smudges.amount,d.smudgeCoverage.value=_e.smudges.coverage,d.smudgeMaskScale.value=_e.smudges.maskScale,d.smudgeAniso.value=_e.smudges.anisotropy,d.smudgeRough.value=_e.smudges.roughness,d.smudgeWhite.value=_e.smudges.whiteness,d.smudgeScale.value=_e.smudges.scale,d.microBump.value=_e.bumps.microBump,d.microScale.value=_e.bumps.microScale,d.microCoverage.value=_e.bumps.microCoverage,d.rippleBump.value=_e.bumps.rippleBump,d.rippleScale.value=_e.bumps.rippleScale,d.bumpMaskScale.value=_e.bumps.maskScale,d.clearcoat.value=_e.clearcoat,d.clearcoatRough.value=_e.clearcoatRoughness,d.specularIntensity.value=_e.specularIntensity,d.interiorScatter.value=_e.interiorScatter,d.deformAmp.value=dt.deformAmplitude,d.deformFreq.value=dt.deformFrequency,d.edgeWidth.value=nt.edgeWidth,d.cutThreshold.value=nt.cutThreshold,d.cutSoft.value=nt.cutSoftness,d.edgeInset.value=nt.edgeInset,d.interiorSteps.value=nt.interiorSteps,d.interiorFrost.value=nt.interiorFrost,d.crumbleGlow.value=_e.crumbleGlow,d.edgeWhite.value=_e.edgeWhiteness,d.edgeBump.value=nt.edgeBump,d.edgeBumpScale.value=nt.edgeBumpScale,d.refrostStrength.value=ft.refrostStrength,d.powderTone.value.set(le.powder.baseTone),d.keyIntensity.value=le.lighting.key.intensity,d.keyColor.value.set(le.lighting.key.color)}b.copy(tt.position).sub(tt.target.position).normalize(),Je.getWorldQuaternion(v).invert(),d.lightDir.value.copy(b.applyQuaternion(v)),d.model.value.copy(Je.matrixWorld),d.modelInv.value.copy(Je.matrixWorld).invert();let ct=i2>=0?i2:++Sde;d.jitter.value.set(ct*.7548776662%1,ct*.5698402909%1)}return{material:y,uniforms:d,features:c,update:ie}}var wde=typeof window<"u"&&window.__frostAssetBase||"assets/",a2=e=>wde+e,Mde=a2("shards-atlas.png"),Ym=4,Nde=[[.8035,.94],[.94,.8055],[.7254,.94],[.94,.8764],[.94,.9233],[.7478,.94],[.94,.8079],[.6781,.94],[.94,.8965],[.94,.8612],[.7025,.94],[.8094,.94],[.94,.903],[.8238,.94],[.94,.7249],[.8374,.94]],{Fn:Zm,instancedArray:n2,instanceIndex:Ade,uint:Is,int:IF,float:Jm,ivec3:gh,vec3:FF,vec4:LF,If:Qm,Loop:Cde,atomicStore:Rde,atomicLoad:Ede,atomicMin:Pde,clamp:kF,floor:Bde,length:DF,dot:Ide,select:Fde,texture3D:Lde,textureStore:kde}=Jr,Km=32,OF=e=>4*e/Km,bx=4294967295,Dde=class{constructor(e,t,r,i){this.erosion=e;let s=Km,a=s**3,n=Ade,o=e.bound,l=(T,w)=>gh(T.mod(Is(w)),T.div(Is(w)).mod(Is(w)),T.div(Is(w*w))),u=T=>Is(T.x).add(Is(T.y).mul(Is(s))).add(Is(T.z).mul(Is(s*s))),h=T=>kF(gh(Bde(T.div(2*o).add(.5).mul(s))),gh(0),gh(s-1)),d=T=>FF(T).add(.5).div(s).sub(.5).mul(2*o),c=Zm(()=>{Rde(this.seeds.element(n),Is(bx))})().compute(a,[64]),m=Zm(()=>{let T=r.meta.element(n).x;Qm(T.greaterThan(.5).and(T.lessThan(2.5)),()=>{Pde(this.seeds.element(u(h(r.rest.element(n).xyz))),Is(n))})})().compute(t,[64]),g=Zm(()=>{this.owners[0].element(n).assign(Ede(this.seeds.element(n)))})().compute(a,[64]);this.prepareNodes=[c,m,g];let y=0;for(let T of[16,8,4,2,1,1]){let w=this.owners[y],N=this.owners[1-y];this.prepareNodes.push(Zm(()=>{let C=l(n,s).toVar(),R=d(C).toVar(),E=Is(bx).toVar(),P=Jm(1e30).toVar(),I={start:IF(-1),end:IF(1),condition:"<="};Cde(I,I,I,({i:O,j:L,k:X})=>{let z=kF(C.add(gh(O,L,X).mul(T)),gh(0),gh(s-1)),H=w.element(u(z)).toVar();Qm(H.notEqual(Is(bx)),()=>{let ue=r.rest.element(H).xyz.sub(R),ne=Ide(ue,ue).toVar();Qm(ne.lessThan(P).or(ne.equal(P).and(H.lessThan(E))),()=>{E.assign(H),P.assign(ne)})})}),N.element(n).assign(E)})().compute(a,[64])),y=1-y}let b=this.owners[y],v=e.res,S=Lde(e.tex);this.updateNode=Zm(()=>{let T=l(n,v).toVar(),w=FF(T).add(.5).div(v).sub(.5).mul(2*o).toVar(),N=b.element(u(h(w))).toVar(),C=S.load(T).level(0).toVar().r.toVar();Qm(N.notEqual(Is(bx)),()=>{let R=r.rest.element(N).xyz.toVar(),E=i.model.mul(LF(R,1)).xyz,P=DF(r.pos.element(N).xyz.sub(E)),I=r.meta.element(N).x,O=DF(w.sub(R)),L=i.landRadius.add(Jm(OF(o)).div(Jm(1).add(O.div(2*o/s)))),X=I.greaterThan(1.5).and(I.lessThan(2.5)).or(I.greaterThan(4.5)).or(I.lessThan(.5));Qm(X.and(P.lessThanEqual(L)),()=>{C.assign(0)})}),kde(e.scratch,T,LF(C,0,Fde(C.lessThan(.5),Jm(1),Jm(0)),0)).toWriteOnly()})().compute(v**3,[64])}seeds=n2(Km**3,"uint").toAtomic();owners=[n2(Km**3,"uint"),n2(Km**3,"uint")];prepareNodes;updateNode;prepare(e){for(let t of this.prepareNodes)e.compute(t)}update(e){e.compute(this.updateNode),this.erosion.commitAssembly(e)}dispose(){for(let e of[this.seeds,...this.owners])e.value.dispose?.()}},{refract:Ode,log:Ude,output:o2,attribute:zde,positionView:Vde,reflect:Gde,vec2:UF,Fn:Go,vec3:vr,vec4:xi,float:De,uniform:Se,instancedArray:Mc,storage:ef,instanceIndex:Tx,If:Nt,Loop:Sx,int:yh,uint:vt,uvec3:Wde,ivec3:br,atomicAdd:Nc,atomicSub:jde,atomicLoad:Hde,atomicStore:zF,max:Xt,min:Wo,abs:Ac,dot:xh,length:Bi,normalize:Fs,exp:vh,mix:ti,smoothstep:jo,clamp:Ls,select:qt,floor:bh,fract:rye,sin:tf,cos:l2,sqrt:VF,texture3D:u2,textureStore:Xde,positionLocal:h2,normalLocal:$de,transformNormalToView:GF,varying:eu,cameraPosition:qde,screenUV:_x,mat3:Cc,mat4:iye,pow:Th,Break:sye,Continue:aye,cross:rf,step:WF,negate:nye,uv:Yde,texture:Zde,uniformArray:Jde,cameraViewMatrix:Qde}=Jr,d2=null;function Kde(){if(!d2){let e=new tb().load(Mde);e.flipY=!1,e.colorSpace=Fa,e.wrapS=e.wrapT=Ti,e.minFilter=Ia,e.magFilter=lr,e.generateMipmaps=!0,e.anisotropy=4,d2=e}return d2}var Ho=0,ece=1,jF=2,tce=3,rce=4,HF=5,ice=class{constructor(e){this.o=e;let{count:t,strays:r,rand:i,shape:s}=e;this.total=t+r;let a=this.total,n=le.powder,o=rI(s,t,n.nearSurfaceFraction,n.nearSurfaceDepth,i),l=new Float32Array(a*4),u=new Float32Array(a*4),h=new Float32Array(a*4),d=new Float32Array(a*4),c=new Float32Array(a*4),m=[n.grainSizes.tinyDustRatio,n.grainSizes.smallGrainRatio,n.grainSizes.mediumClumpRatio,.01],g=m.reduce((R,E)=>R+E,0),y=[m[0]/g,(m[0]+m[1])/g,(m[0]+m[1]+m[2])/g],b=Math.cbrt(8*s.bound**3/Math.max(100,e.clumpCount)),v=Math.ceil(s.bound/b)+1,S=v*2+1,T=new Map;for(let R=0;R<t;R++){let E=R*3,P=R*4,I=o.positions[E],O=o.positions[E+1],L=o.positions[E+2],X=o.depths[R],z=i(),H=z<y[0]?0:z<y[1]?1:z<y[2]?2:3;H===3&&X>.2&&(H=2);let ue=Math.floor(I/b)+v,ne=Math.floor(O/b)+v,re=Math.floor(L/b)+v,ce=ue+ne*S+re*S*S,ge=T.get(ce);ge===void 0&&(ge=R,T.set(ce,R)),h[P]=I,h[P+1]=O,h[P+2]=L,h[P+3]=.35+i()*.4,l[P]=I,l[P+1]=O,l[P+2]=L,d[P]=Ho,d[P+1]=i(),d[P+2]=H,d[P+3]=ge}for(let R=0;R<r;R++){let E=t+R,P=i()*Math.PI*2,I=s.name==="torus"?(s.size-s.size*s.tubeRatio)*(.15+i()*.75):s.bound*(1.05+i()*.35),O=Math.cos(P)*I,L=Math.sin(P)*I,X=(i()-.5)*s.thickness*1.2,z=E*4;h[z]=O,h[z+1]=L,h[z+2]=X,h[z+3]=2,l[z]=O,l[z+1]=L,l[z+2]=X,l[z+3]=.01,u[z+3]=i()*10,d[z]=tce,d[z+1]=i(),d[z+2]=i()<.8?0:1,d[z+3]=E}this.count=t,this.restInit=h.slice();let w=this.buffers;w.pos=Mc(l,"vec4"),w.vel=Mc(u,"vec4"),w.rest=Mc(h,"vec4"),w.meta=Mc(d,"vec4"),w.heal=Mc(c,"vec4"),w.leaders=Mc(a,"vec4");let N=e.variants,C=e.densityRes;w.atomics=e.atomics,this.densityTex=new d_(C,C,C),this.densityTex.type=Dt,this.densityTex.format=pi,this.densityTex.minFilter=this.densityTex.magFilter=lr,this.densityTex.wrapS=this.densityTex.wrapT=this.densityTex.wrapR=Ti,this.u.bound.value=s.bound,this.u.holeRadius.value=s.name==="torus"?s.size-s.size*s.tubeRatio:s.bound,e.enabled!==!1&&(this.buildCompute(),this.assembly=new Dde(e.erosion,t,w,this.u),this.buildMeshes(),e.scene.add(this.group)),this.prevModel.copy(e.objectGroup.matrixWorld)}total;count;restInit;meshes=[];group=new pn;densityTex;assembly;assemblyEnabled=!0;beforeIntegrate;beforeAssembly;buffers={};nodes={};material;prevModel=new We;inversePrevModel=new We;statsTimer=0;densityDirty=!0;fragmentShadowMap=!0;settingsVersion=-1;u={rigEnabled:Se(0),rigStrength:Se(1),surfaceFrost:Se(1),surfaceDetail:Se(1),dt:Se(0),time:Se(0),model:Se(new We),previousModel:Se(new We),modelDelta:Se(new We),normalMat:Se(new Dr),strokeDir:Se(new F(1,0,0)),strokeSpeed:Se(0),heal:Se(0),ejectSpeed:Se(1.1),ejectSpread:Se(.5),ejectTurb:Se(.8),backwardRatio:Se(.25),clumpJitter:Se(.5),drag:Se(1.4),gravity:Se(.12),turbulence:Se(.9),turbScale:Se(1.8),turbDecay:Se(.6),cohesion:Se(2.4),settleTime:Se(3.2),settledDrift:Se(.012),tumble:Se(2.5),returnDuration:Se(2.4),returnCurve:Se(.35),inherit:Se(1),inheritTime:Se(.22),straySpeed:Se(.06),fade:Se(1),sizeMul:Se(1),amount:Se(.3),dustScale:Se(.0055),grainScale:Se(.011),clumpScale:Se(.022),fragmentScale:Se(.05),sizeJitter:Se(.45),densityExtent:Se(4.2),densityScale:Se(.03),shadowStrength:Se(.75),aoStrength:Se(.55),lightDir:Se(new F(0,1,0)),tone:Se(new gt("#dcdcdc")),wrap:Se(.45),keyIntensity:Se(3.2),keyColor:Se(new gt("#ffffff")),colorByState:Se(0),colorBySize:Se(0),colorByAge:Se(0),camPos:Se(new F),invProj:Se(new We),camWorld:Se(new We),hazeSteps:Se(28),strayBase:Se(1),holeRadius:Se(.55),bound:Se(1.5),fieldActive:Se(1),hazeOn:Se(1),waveTime:Se(2),waveJitter:Se(.6),minEject:Se(1),minPixel:Se(1.5),pixelWorld:Se(.001),ghostDist:Se(0),ghostFrac:Se(.45),waveReach:Se(3),depositRadius:Se(2),returnMode:Se(1),springK:Se(6),springDamp:Se(.9),springRamp:Se(.6),landRadius:Se(.03),returnAfter:Se(3),maxSpeed:Se(8),returnDrag:Se(.25),returnMaxSpeed:Se(12),lostRadius:Se(30),stragglers:Se(0),spriteSee:Se(0),frontDuration:Se(3.2),frontX:Se(-.65),frontY:Se(.55),frontAngle:Se(-35),frontSpread:Se(.65),frontNoise:Se(.35),speedVariation:Se(.65),pathBend:Se(1.2),pathSwirl:Se(1.1),landingVariation:Se(.8),groupNoise:Se(2),assemblyEnd:Se(0),groupStagger:Se(0),groupScale:Se(.65),groupSeed:Se(7),alignAmt:Se(1),alignDist:Se(.6),alignCurve:Se(1),landedFade:Se(.25),landShrink:Se(0),translucency:Se(.6),throughTint:Se(new gt("#aeb6bb")),fresnelPower:Se(3),fragRough:Se(.32),fragClearcoat:Se(.6),fragSpecular:Se(1),sparkle:Se(.6),sparkleFraction:Se(.35),sparkleSpread:Se(.5),lightDirView:Se(new F(0,1,0)),spriteSize:Se(1.4),spriteTilt:Se(.5),spriteNormal:Se(1),spriteFrost:Se(1),spriteFrostBoost:Se(.35),spriteFrostRough:Se(.7),spriteEdge:Se(.6),spriteCut:Se(.2),repel:Se(0),repelStrength:Se(6),repelRange:Se(.35),repelRadial:Se(12),repelRadialRange:Se(1.6),modelInv:Se(new We)};buildCompute(){let{count:e,shape:t,erosion:r,variants:i}=this.o,s=this.total,a=this.u,n=this.buffers,o=this.o.densityRes,l=Tx,u=this.o.countersOffset,h=this.o.healOffset,d=this.o.cellOffset,c=this.o.flightOffset,m=this.o.fieldRes,g=u2(r.cellTex),y=I=>n.atomics.element(vt(u).add(vt(I))),b=I=>n.atomics.element(I),v=I=>n.atomics.element(vt(h).add(I)),S=I=>qt(I.lessThan(.5),a.dustScale,qt(I.lessThan(1.5),a.grainScale,qt(I.lessThan(2.5),a.clumpScale,a.fragmentScale))),T=I=>qt(I.lessThan(.5),vt(1),qt(I.lessThan(1.5),vt(2),qt(I.lessThan(2.5),vt(5),vt(12))));this.nodes.snapshotLeaders=Go(()=>{n.leaders.element(l).assign(xi(n.pos.element(l).xyz,n.meta.element(l).x))})().compute(s,[64]);let w=I=>{let O=Ls(I,0,1);return qt(O.lessThan(.5),Th(2,O.mul(20).sub(10)).div(2),De(2).sub(Th(2,O.mul(-20).add(10))).div(2))};this.nodes.resetCounters=Go(()=>{Sx(8,({i:I})=>{zF(y(I),vt(0))})})().compute(1,[1]);let N=this.o.turbulence==="fast"?I=>rf(Na(I),Na(I.add(vr(31.7,11.3,57.9)))).mul(1.6):I=>sse(I),C=I=>I.div(Xt(Bi(I),1e-6)),R=(I,O)=>Go(()=>{let L=I,X=n.pos.element(L),z=n.vel.element(L),H=n.rest.element(L),ue=n.meta.element(L),ne=n.heal.element(L),re=ue.x.toVar(),ce=ue.y.toVar(),ge=ue.z.toVar(),ye=ue.w.toVar(),oe=X.xyz.toVar(),Ae=X.w.toVar(),Ie=z.xyz.toVar(),Xe=z.w.toVar(),at=H.xyz.toVar(),W=H.w.toVar(),j=ea(ce,1).toVar(),G=ea(ce,2).toVar(),ae=ea(ce,3).toVar(),be=S(ge).mul(De(1).sub(a.sizeJitter.mul(.5)).add(a.sizeJitter.mul(j))).mul(a.sizeMul).toVar(),Be=a.model.mul(xi(at,1)).xyz.toVar(),$=C(a.normalMat.mul(G1(t,at,.004))).toVar(),U=a.model.mul(xi(0,0,0,1)).xyz.toVar(),J=r.sample(at).toVar(),q=J.r.toVar(),se=J.a.greaterThan(.01),pe=N_(ce.mul(211.7).add(5)).lessThan(a.amount),Te=ne.w.greaterThan(.5),we=()=>{let _e=br(bh(r.uvw(at).mul(De(m)))),nt=g.load(Ls(_e,br(0),br(m-1))).level(0).w;return vt(Ls(nt.mul(65535),0,65535))},ie=()=>{Nc(n.atomics.element(vt(c).add(we())),vt(1))},V=_e=>{let nt=we().toVar(),dt=jde(n.atomics.element(vt(c).add(nt)),vt(1)).toVar();Nt(_e.and(dt.lessThanEqual(vt(1).add(vt(a.stragglers)))),()=>{Nc(n.atomics.element(vt(d).add(nt)),vt(1))})},Oe=()=>{let _e=at.add(this.o.erosion.bound).div(this.o.erosion.bound*2).mul(De(m)),nt=br(bh(_e)).toVar(),dt=a.depositRadius.toVar(),ft=yh(dt.ceil()).toVar(),Fe={start:ft.negate(),end:ft,condition:"<="};Sx(Fe,Fe,Fe,({i:it,j:Rt,k:Ft})=>{let Ze=nt.add(br(it,Rt,Ft)),ht=De(it.mul(it).add(Rt.mul(Rt)).add(Ft.mul(Ft))).lessThanEqual(dt.mul(dt).add(.01));Nt(ht.and(Ze.x.greaterThanEqual(0)).and(Ze.y.greaterThanEqual(0)).and(Ze.z.greaterThanEqual(0)).and(Ze.x.lessThan(m)).and(Ze.y.lessThan(m)).and(Ze.z.lessThan(m)),()=>{let Yt=vt(Ze.x).add(vt(Ze.y).mul(vt(m))).add(vt(Ze.z).mul(vt(m*m)));Nc(v(Yt),vt(1))})})},tt=()=>{let _e=Bi(oe.sub(Be)),nt=Ls(_e.div(a.waveReach),0,1).mul(a.waveTime),dt=r.u.reconstruct.greaterThan(.5).and(a.groupNoise.greaterThan(.5)),ft=qt(dt,ae.mul(a.waveJitter).mul(.04),ae.mul(a.waveJitter)),Fe=nt.add(ft),it=a.groupNoise.greaterThan(1.5),Rt=De(0).toVar();return Nt(r.u.reconstruct.greaterThan(.5).and(a.groupStagger.greaterThan(0).or(it)),()=>{let Ft=qt(a.returnMode.greaterThan(.5),mse(_e,Bi(Ie),a),a.returnDuration.add(.2)),Ze=Xt(0,a.assemblyEnd.sub(a.time).sub(Fe).sub(Ft));Rt.assign(Wo(qt(it,a.frontDuration,a.groupStagger),Ze).mul(qt(a.rigEnabled.greaterThan(.5),C_(at,a),Xt(0,W.sub(2)))))}),a.time.add(nt).add(ft).add(Rt)},Je=()=>a.time.add(j.mul(a.waveTime)).add(ae.mul(a.waveJitter)),ct=()=>{let _e=Be,nt=$,dt=n.meta.element(vt(ye)).y,ft=De(1).sub(a.clumpJitter.mul(.5)).add(a.clumpJitter.mul(N_(dt.mul(77.7)))),Fe=qt(N_(dt.mul(31.3).add(1)).lessThan(a.backwardRatio),De(-1),De(1)),it=Xt(a.strokeSpeed,a.minEject),Rt=a.strokeDir.mul(Fe),Ft=N(_e.mul(a.turbScale).add(a.time.mul(.2))),Ze=Rt.mul(it.mul(a.ejectSpeed).mul(ft)).add(nt.mul(a.ejectSpread).mul(De(.5).add(G)).mul(it.mul(.4))).add(Ft.mul(a.ejectTurb).mul(it.mul(.25)).mul(ae.add(.5))),ht=qt(ge.greaterThan(2.5),De(.35),De(1));Ie.assign(Ze.mul(ht)),oe.assign(_e.add(nt.mul(.002))),Xe.assign(0),Ae.assign(be),re.assign(ece),ne.w.assign(0),ie()};Nt(re.lessThan(.5),()=>{Nt(a.fieldActive.greaterThan(.5),()=>{Nt(q.greaterThan(W),()=>{Nt(pe,()=>{ct()}).Else(()=>{re.assign(rce),ne.w.assign(0)})})})}).ElseIf(re.lessThan(1.5),()=>{Xe.addAssign(a.dt);let _e=jo(a.settleTime.mul(.45),a.settleTime,Xe),nt=N(oe.mul(a.turbScale).add(a.time.mul(.15))).mul(a.turbulence).mul(vh(Xe.mul(a.turbDecay).negate())),dt=n.leaders.element(vt(ye)),ft=dt.w,Fe=qt(ft.greaterThan(.5).and(ft.lessThan(1.5)),dt.xyz.sub(oe).mul(a.cohesion).mul(De(1).sub(_e)),vr(0)),it=vr(0).toVar();Nt(a.repel.greaterThan(.5),()=>{let Ze=a.modelInv.mul(xi(oe,1)).xyz.toVar(),ht=t.sdfNode(Ze).toVar();Nt(ht.lessThan(a.repelRange),()=>{let Gi=gi(De(1).sub(ht.div(a.repelRange))),na=C(a.normalMat.mul(G1(t,Ze,.004)));it.assign(na.mul(a.repelStrength).mul(Gi.mul(Gi)))});let Yt=oe.sub(U),Tr=Bi(Yt).div(a.bound.mul(a.repelRadialRange));Nt(Tr.lessThan(1),()=>{let Gi=De(1).sub(Tr.mul(Tr)),na=C(Yt.add(vr(j.sub(.5),G.sub(.5),ae.sub(.5)).mul(.05)));it.addAssign(na.mul(a.repelRadial).mul(Gi.mul(Gi)))})}),Ie.addAssign(nt.add(Fe).add(it).add(vr(0,a.gravity.negate(),0)).mul(a.dt)),Ie.mulAssign(vh(a.drag.mul(a.dt).negate())),Ie.mulAssign(De(1).sub(_e.mul(Wo(1,a.dt.mul(3))))),oe.addAssign(Ie.mul(a.dt)),oe.addAssign(N(oe.mul(.9).add(a.time.mul(.05))).mul(a.settledDrift).mul(_e).mul(a.dt)),Nt(a.inherit.greaterThan(.5).and(Xe.lessThan(a.inheritTime)),()=>{let Ze=De(1).sub(jo(a.inheritTime.mul(.75),Xt(a.inheritTime,.001),Xe));oe.assign(ti(oe,a.modelDelta.mul(xi(oe,1)).xyz,Ze)),Ie.assign(ti(Ie,Cc(a.modelDelta).mul(Ie),Ze))});let Rt=Bi(Ie);Nt(Rt.greaterThan(a.maxSpeed),()=>{Ie.mulAssign(a.maxSpeed.div(Rt))});let Ft=a.returnAfter.greaterThan(.001).and(Xe.greaterThan(a.returnAfter));Nt(a.heal.greaterThan(.5).or(Ft),()=>{Nt(Te.not(),()=>{ne.w.assign(tt())}),Nt(ne.w.greaterThan(.5).and(a.time.greaterThanEqual(ne.w)),()=>{re.assign(jF),ne.xyz.assign(oe),ne.w.assign(a.time)})}).Else(()=>{ne.w.assign(0)})}).ElseIf(re.lessThan(2.5),()=>{let _e=ne.w.lessThan(-.5),nt=qt(_e,Xe,ne.w).toVar();Nt(_e.not(),()=>{Xe.addAssign(a.dt)});let dt=ne.xyz,ft=Be,Fe=$;Nt(a.returnMode.greaterThan(.5),()=>{let it=a.time.sub(nt),Rt=jo(0,Xt(a.springRamp,.001),it),Ft=a.inherit.mul(De(1).sub(Rt)).mul(De(1).sub(jo(a.inheritTime.mul(.75),Xt(a.inheritTime,.001),Xe)));oe.assign(ti(oe,a.modelDelta.mul(xi(oe,1)).xyz,Ft)),Ie.assign(ti(Ie,Cc(a.modelDelta).mul(Ie),Ft));let Ze=ft.sub(oe),ht=Bi(Ze).toVar(),Yt=qt(r.u.reconstruct.greaterThan(.5).and(a.groupNoise.greaterThan(1.5)),De(1),De(0)),Tr=ti(De(1),ti(De(.55),De(1.8),j),a.speedVariation.mul(Yt)),Gi=a.springK.mul(a.rigStrength).mul(Tr.mul(Tr)).mul(Rt),na=VF(a.springK.mul(a.rigStrength)).mul(Tr).mul(2).mul(a.springDamp).mul(Rt),lu=Bi(ft.sub(dt)),uu=Ls(ht.div(Xt(lu,.05)),0,1),Ch=De(1).sub(jo(.5,2.4,it.mul(Tr))),Fc=C(rf(Fe,vr(G,ae,j).sub(.5)).add(.001)),Lc=rf(Fe,Fc),Rh=it.mul(a.pathSwirl).mul(G.mul(2).sub(1)).add(ae.mul(6.283185)),kc=Fc.mul(l2(Rh)).add(Lc.mul(tf(Rh))).add(Fe.mul(G.sub(.5))).mul(Wo(lu,3)).mul(a.pathBend).mul(.5).mul(uu.mul(.3).add(tf(uu.mul(Math.PI)).mul(.7))).mul(Ch).mul(Yt),xf=a.previousModel.mul(xi(at,1)).xyz,Eh=ft.sub(xf).div(Xt(a.dt,1e-5)),Ph=Ze.add(kc).mul(Gi).sub(Ie.sub(Eh).mul(na)).add(vr(0,a.gravity.negate().mul(De(1).sub(Rt)),0));Ie.addAssign(Ph.mul(a.dt)),Ie.mulAssign(vh(a.drag.mul(a.returnDrag).mul(a.dt).negate()));let Dc=Bi(Ie),Oc=a.returnMaxSpeed.mul(Tr);Nt(Dc.greaterThan(Oc),()=>{Ie.mulAssign(Oc.div(Dc))});let Uc=Ie.mul(a.dt),vf=Bi(Uc);oe.addAssign(qt(vf.greaterThan(ht),Ze,Uc)),Ae.assign(be.mul(qt(a.landShrink.greaterThan(.001),gi(ht.div(Xt(a.landShrink,.001))),De(1))).mul(qt(_e,jo(0,.25,it),De(1))));let bf=ht.lessThan(a.landRadius);Nt(bf,()=>{Nt(_e.not(),()=>{V(se.not().and(r.u.reconstruct.lessThan(.5))),Nt(se.not().and(r.u.reconstruct.lessThan(.5)),()=>{Oe()})}),re.assign(qt(_e,De(Ho),De(HF))),oe.assign(ft),Ie.assign(vr(0)),ne.w.assign(0),Ae.assign(qt(_e.or(r.u.reconstruct.greaterThan(.5)),De(0),be))})}).Else(()=>{let it=Ls(a.time.sub(nt).div(Xt(a.returnDuration,.05)),0,1).toVar(),Rt=Ls(a.time.sub(a.dt).sub(nt).div(Xt(a.returnDuration,.05)),0,1),Ft=w(it),Ze=ti(dt,ft,.5).add(Fe.mul(a.returnCurve).mul(Bi(ft.sub(dt))).mul(.5)).add(vr(G,ae,j).sub(.5).mul(a.returnCurve).mul(.4)),ht=ti(dt,Ze,Ft),Yt=ti(Ze,ft,Ft);oe.assign(ti(ht,Yt,Ft));let Tr=qt(_e,jo(De(1).sub(a.ghostFrac),De(1).sub(a.ghostFrac).add(.08),it),De(1));Ae.assign(be.mul(De(1).sub(jo(.82,1,it))).mul(Tr)),Nt(Rt.lessThan(.85).and(it.greaterThanEqual(.85)).and(_e.not()),()=>{V(se.not().and(r.u.reconstruct.lessThan(.5))),Nt(se.not().and(r.u.reconstruct.lessThan(.5)),()=>{Oe()})}),Nt(it.greaterThanEqual(1),()=>{re.assign(qt(_e,De(Ho),De(HF))),oe.assign(ft),ne.w.assign(0)})}),Nt(r.u.reconstruct.greaterThan(.5).and(_e.not()),()=>{let it=qt(a.groupNoise.greaterThan(1.5),a.landingVariation,De(0)),Rt=De(OF(r.bound)).mul(ti(De(1),ti(De(.35),De(1.65),G),it)),Ft=jo(a.landRadius,Xt(a.landRadius.add(.001),Rt),Bi(ft.sub(oe)));Ae.assign(be.mul(Th(Ft,ti(De(1),ti(De(.45),De(2.2),ae),it)))),Nt(re.greaterThan(4.5),()=>{H.w.assign(2)})})}).ElseIf(re.lessThan(3.5),()=>{let _e=a.time.mul(a.straySpeed).mul(De(.5).add(j)).add(ce.mul(6.2831)),nt=Bi(at.xy),dt=at.z.add(tf(a.time.mul(.3).add(ce.mul(12))).mul(.05)),ft=vr(l2(_e).mul(nt),tf(_e).mul(nt),dt);oe.assign(a.model.mul(xi(ft,1)).xyz),Ae.assign(S(ge).mul(.9).mul(a.sizeMul)),Xe.assign(Xe.add(a.dt))}).ElseIf(re.lessThan(4.5),()=>{Nt(a.heal.greaterThan(.5),()=>{Nt(Te.not(),()=>{ne.w.assign(Je().add(a.returnDuration.mul(De(1).sub(a.ghostFrac))))}),Nt(ne.w.greaterThan(.5).and(a.time.greaterThanEqual(ne.w)),()=>{Nt(a.ghostDist.greaterThan(.001),()=>{let _e=$,nt=C(rf(_e,vr(j.sub(.5),G.sub(.5),ae.sub(.5)).add(.001))),dt=Be.add(_e.mul(a.ghostDist).mul(De(.4).add(j.mul(.6)))).add(nt.mul(a.ghostDist).mul(G.sub(.5)).mul(.8));ne.xyz.assign(dt),ne.w.assign(-1),oe.assign(dt),Xe.assign(a.time.sub(a.returnDuration.mul(De(1).sub(a.ghostFrac)))),Ae.assign(0),re.assign(jF)}).Else(()=>{re.assign(Ho),ne.w.assign(0)})})}).Else(()=>{ne.w.assign(0)})}).Else(()=>{oe.assign(Be),Nt(r.u.reconstruct.greaterThan(.5),()=>{re.assign(Ho),ne.w.assign(0),Ae.assign(0)}).ElseIf(q.lessThan(W),()=>{Nt(ne.w.lessThan(.5),()=>{ne.w.assign(a.time)});let _e=gi(a.time.sub(ne.w).div(Xt(a.landedFade,.01)));Ae.assign(be.mul(De(1).sub(_e))),Nt(_e.greaterThanEqual(1),()=>{re.assign(Ho),ne.w.assign(0),Ae.assign(0)})}).Else(()=>{Ae.assign(be),ne.w.assign(0),Nt(se.and(a.fieldActive.greaterThan(.5)),()=>{ct()})})}),Nt(re.greaterThan(.5).and(re.lessThan(2.5)),()=>{let _e=Ac(oe.x).lessThan(1e30).and(Ac(oe.y).lessThan(1e30)).and(Ac(oe.z).lessThan(1e30)).and(Ac(Ie.x).lessThan(1e30)).and(Ac(Ie.y).lessThan(1e30)).and(Ac(Ie.z).lessThan(1e30)),nt=Bi(oe.sub(U)).greaterThan(a.lostRadius);Nt(_e.not().or(nt),()=>{oe.assign(Be.add($.mul(.05))),Ie.assign(vr(0))})}),X.xyz.assign(oe),X.w.assign(Ae),z.xyz.assign(Ie),z.w.assign(Xe),ue.x.assign(re),Nt(re.greaterThan(.5).and(re.lessThan(3.5)).or(re.greaterThan(4.5)),()=>{let _e=vt(bh(ce.mul(1e3))).mod(vt(i));Nc(y(_e),vt(1));let nt=oe.add(a.densityExtent).div(a.densityExtent.mul(2)).mul(De(o)),dt=br(bh(nt));Nt(dt.x.greaterThanEqual(0).and(dt.y.greaterThanEqual(0)).and(dt.z.greaterThanEqual(0)).and(dt.x.lessThan(o)).and(dt.y.lessThan(o)).and(dt.z.lessThan(o)),()=>{let ft=vt(dt.x).add(vt(dt.y).mul(vt(o))).add(vt(dt.z).mul(vt(o*o)));Nc(b(ft),T(ge))})})})().compute(O,[64]);this.nodes.update=R(Tx,s),this.nodes.updateStrays=this.o.strays>0?R(Tx.add(vt(e)),this.o.strays):null;let E=()=>Wde(l.mod(vt(o)),l.div(vt(o)).mod(vt(o)),l.div(vt(o*o))),P=I=>{let O=Ls(br(I),br(0),br(o-1)),L=vt(O.x).add(vt(O.y).mul(vt(o))).add(vt(O.z).mul(vt(o*o)));return De(Hde(b(L))).mul(a.densityScale)};this.nodes.resolve=Go(()=>{let I=E(),O=P(br(I)).toVar(),L=De(1).sub(vh(O.negate())),X=a.lightDir.mul(De(o)).div(a.densityExtent.mul(2)).toVar(),z=De(0).toVar(),H=vr(I).add(.5).toVar();Sx(6,()=>{H.addAssign(X.mul(.9)),z.addAssign(P(br(bh(H))))});let ue=vh(z.mul(.9).negate()),ne=P(br(I).add(br(1,0,0))).add(P(br(I).add(br(-1,0,0)))).add(P(br(I).add(br(0,1,0)))).add(P(br(I).add(br(0,-1,0)))).add(P(br(I).add(br(0,0,1)))).add(P(br(I).add(br(0,0,-1)))),re=De(1).sub(vh(ne.div(6).add(O).mul(1.2).negate()));Xde(this.densityTex,I,xi(L,ue,re,1)).toWriteOnly()})().compute(o*o*o,[64]),this.nodes.clearDensity=Go(()=>{zF(b(l),vt(0))})().compute(o*o*o,[64]),this.nodes.retargetCount=Go(()=>{let I=n.meta.element(l),O=n.rest.element(l),L=n.pos.element(l),X=I.x.toVar();Nt(X.greaterThan(4.5),()=>{I.x.assign(Ho),L.w.assign(0),n.heal.element(l).assign(xi(0)),X.assign(Ho)}),Nt(X.greaterThan(.5).and(X.lessThan(2.5)),()=>{Nt(r.u.reconstruct.greaterThan(.5).and(a.groupStagger.greaterThan(0).or(a.groupNoise.greaterThan(1.5))),()=>{O.w.assign(De(2).add(qt(a.groupNoise.greaterThan(1.5),C_(O.xyz,a),pse(O.xyz,a.groupScale,a.groupSeed,a.groupNoise))))});let z=br(bh(r.uvw(O.xyz).mul(De(m)))),H=g.load(Ls(z,br(0),br(m-1))).level(0).w;Nc(n.atomics.element(vt(c).add(vt(Ls(H.mul(65535),0,65535)))),vt(1))}).ElseIf(X.lessThan(.5).or(X.greaterThan(3.5).and(X.lessThan(4.5))),()=>{O.w.assign(2)})})().compute(s,[64]),this.nodes.reset=Go(()=>{let I=n.meta.element(l),O=n.vel.element(l),L=n.pos.element(l),X=n.rest.element(l);Nt(I.x.lessThan(2.5).or(I.x.greaterThan(3.5)),()=>{I.x.assign(Ho),O.assign(xi(0)),L.assign(xi(X.xyz,0)),n.heal.element(l).assign(xi(0))})})().compute(s,[64])}buildMeshes(){let{variants:e,rand:t}=this.o,r=this.total,i=this.u,s=this.buffers,a=le.powder.sprites,n=!!a.enabled,o=n?Array.from({length:e},()=>new Kv(2,2)):One(e,t,le.powder.facetedGrains),l=n?Kde():null,u=n?Jde(Nde.map(b=>new fe(b[0],b[1]))):null,h=ef(s.pos.value,"vec4",r).toReadOnly(),d=ef(s.vel.value,"vec4",r).toReadOnly(),c=ef(s.meta.value,"vec4",r).toReadOnly(),m=ef(s.rest.value,"vec4",r).toReadOnly(),g=ef(s.heal.value,"vec4",r).toReadOnly(),y=u2(this.densityTex);for(let b=0;b<e;b++){let v=new iU().copy(o[b]);v.instanceCount=Math.max(0,Math.ceil((r-b)/e));let S=new mS;S.metalness=0,S.side=hs,S.forceSinglePass=!0;let T=Tx.mul(vt(e)).add(vt(b)),w=h.element(T),N=d.element(T),C=c.element(T),R=C.y,E=C.z,P=C.x,I=N.w,O=Fs(vr(ea(R,11),ea(R,12),ea(R,13)).sub(.5)),L=ea(R,14).mul(6.2831).add(I.mul(i.tumble).mul(De(.4).add(ea(R,15)))),X=Bi(w.xyz.sub(qde)),z=P.greaterThan(.5).and(P.lessThan(3.5)).or(P.greaterThan(4.5)),H=qt(z.and(w.w.greaterThan(1e-5)),Xt(w.w,X.mul(i.pixelWorld).mul(i.minPixel)),De(0)).mul(i.fade),ue=w.xyz.add(i.densityExtent).div(i.densityExtent.mul(2)),ne=eu(y.sample(ue).level(0)),re=ti(De(1),ne.g,i.shadowStrength),ce=De(1).sub(ne.b.mul(i.aoStrength)),ge,ye=this.o.iceUniforms,oe=this.o.iceFeatures,Ae={...oe,surfaceBumps:De(1),frost:oe.frost.mul(oe.shardFrost),crystals:oe.crystals.mul(oe.shardNormals),grain:oe.grain.mul(oe.shardNormals),micro:oe.micro.mul(oe.shardNormals),ripples:oe.ripples.mul(oe.shardNormals)},Ie=G1(this.o.shape,m.element(T).xyz,.02),Xe=eu(xi(qt(Bi(Ie).greaterThan(.001),Ie,vr(0,0,1)),H)),at=Xe.xyz,W=eu(m.element(T).xyz.add(zde("position","vec3").mul(H))),j=vr(this.o.seed*.731,this.o.seed*.137,this.o.seed*.529),G=MF(W,at,j,wF(this.o.seed),this.o.erosion,ye,Ae),ae=G.frost,be=Hm==="photographic"?bF(this.o.fractureDetail,W,at,at.negate(),Xe.w,ye.inclusionScale,ye.inclusionAmount).mul(i.surfaceDetail):De(0),Be=Fs(Vde.negate()),$,U,J=De(0),q=De(1);if(n){let Ze=yh(bh(ea(R,31).mul(Ym*Ym))),ht=u.element(Ze),Yt=qt(ea(R,32).lessThan(.5),De(-1),De(1)),Tr=qt(ea(R,33).lessThan(.5),De(-1),De(1)),Gi=ea(R,34).mul(i.spriteTilt),na=ea(R,35).mul(6.2831),lu=vr(l2(na),tf(na),0),uu=vi=>Jy(Jy(vi,vr(0,0,1),L),lu,Gi),Ch=uu(vr(Yt,0,0)),Fc=uu(vr(0,0,1)),Lc=m.element(T),Rh=i.model.mul(xi(Lc.xyz,1)).xyz,kc=i.normalMat.mul(G1(this.o.shape,Lc.xyz,.004)),xf=kc.div(Xt(Bi(kc),1e-6)),Eh=Fs(Cc(Qde).mul(xf).add(vr(0,0,1e-4))),Ph=qt(Eh.z.lessThan(0),Eh.negate(),Eh),Dc=P.greaterThan(1.5).and(P.lessThan(2.5)),Oc=P.greaterThan(4.5),Uc=Bi(Rh.sub(w.xyz)),vf=g.element(T),bf=Xt(Bi(Rh.sub(vf.xyz)),.05),Y2=gi(De(1).sub(Uc.div(bf))),Wx=qt(Oc,De(1),qt(Dc,Th(Y2,i.alignCurve),De(0))).mul(i.alignAmt),Z2=Fs(Ch.sub(Ph.mul(xh(Ch,Ph))).add(vr(1e-4,0,0))),zc=Fs(ti(Fc,Ph,Wx)),jx=Fs(ti(Ch,Z2,Wx)),Tf=Fs(jx.sub(zc.mul(xh(jx,zc)))),Hx=rf(zc,Tf).mul(Yt.mul(Tr)),J2=Tf.mul(h2.x.mul(ht.x).mul(Yt)).add(Hx.mul(h2.y.mul(ht.y).mul(Tr))).mul(H).mul(i.spriteSize);S.positionNode=w.xyz.add(Cc(i.camWorld).mul(J2));let Xx=eu(Tf),$x=eu(Hx),hu=eu(zc),Bh=eu(xi(De(Ze),Yt,Tr,R)),Q2=Bh.x,K2=Bh.y,eM=Bh.z;ge=Bh.w;let Vc=Yde(),tM=ti(Vc.x,De(1).sub(Vc.x),WF(K2,0)),du=ti(Vc.y,De(1).sub(Vc.y),WF(eM,0)),Sf=yh(Q2.add(.5)),rM=De(Sf.mod(yh(Ym))),iM=De(Sf.div(yh(Ym))),qx=u.element(Sf),sM=UF(rM.add(.5).add(tM.sub(.5).mul(qx.x)),iM.add(.5).add(du.sub(.5).mul(qx.y))).div(Ym),_f=Zde(l,sM),Gc=_f.rg.mul(2).sub(1).mul(i.spriteNormal),aM=VF(gi(De(1).sub(xh(Gc,Gc))));$=Fs(Xx.mul(Gc.x).add($x.mul(Gc.y)).add(hu.mul(aM)));let wf=G.nSurface.sub(at);if($=Fs($.add(Xx.mul(wf.x)).add($x.mul(wf.y)).add(hu.mul(wf.z))),S.normalNode=$,S.maskNode=_f.a.greaterThan(i.spriteCut),J=Ls(ae.mul(ye.frostDiffuse).add(G.smudge.mul(ye.smudgeWhite)).add(be.mul(.65)),0,.65),q=gi(_f.a.sub(.35).div(.65)),a.seeThrough>0){S.transparent=!0,S.depthWrite=!1;let vi=Th(gi(De(1).sub(gi(xh($,Be)))),i.fresnelPower),nM=ti(De(.42),De(.85),J).add(vi.mul(.45)).add(De(1).sub(q).mul(.18));S.opacityNode=ti(De(1),gi(nM),i.spriteSee.mul(oe.transmission).mul(oe.shardTransmission))}U=gi(xh($,i.lightDirView).add(i.wrap).div(De(1).add(i.wrap)))}else{ge=eu(R);let Ze=Jy(h2.mul(H),O,L);S.positionNode=w.xyz.add(Ze);let ht=Jy($de,O,L);S.normalNode=GF(ht),$=Fs(GF(ht)),U=gi(xh(Fs(ht),i.lightDir).add(i.wrap).div(De(1).add(i.wrap)))}n||(J=Ls(ae.mul(ye.frostDiffuse).add(G.smudge.mul(ye.smudgeWhite)).add(be.mul(.65)),0,.65));let se=Th(ye.ior.sub(1).div(ye.ior.add(1)),2),pe=se.add(De(1).sub(se).mul(Th(gi(De(1).sub(gi(xh($,Be)))),5))),Te=Hm==="photographic"?e2(this.o.fractureDetail,W,at,ye.inclusionScale).mul(Ae.frost):De(0),we=Ls(G.roughness.add(Te.mul(.22)),.015,.8);S.roughnessNode=we,S.iorNode=ye.ior,S.clearcoatNode=ye.clearcoat.mul(oe.clearcoat).mul(oe.shardReflections),S.clearcoatRoughnessNode=ye.clearcoatRough,S.specularIntensityNode=ye.specularIntensity.mul(oe.reflections).mul(oe.shardReflections);let ie=oe.reflections.mul(oe.shardReflections),V=oe.transmission.mul(oe.shardTransmission),Oe=Ze=>Fs(Cc(i.camWorld).mul(Ze)),tt=Ze=>$w(this.o.environment,ye.envStrength,Ze,we),Je=Be.negate(),ct=Ode(Je,$,De(1).div(Xt(ye.ior,1.001))),_e=Xt(Xe.w.mul(q).mul(ye.thicknessScale),.001),nt=vh(Ude(Xt(ye.attColor,vr(.001))).mul(_e.div(Xt(ye.attDist,.01))).mul(oe.absorption)),dt=Ls(_x.add(ct.xy.sub(Je.xy).mul(_e).mul(.08)),0,1),ft=z1(this.o.backdrop,dt).add(tt(Oe(ct)).mul(ye.backlight)).mul(nt),Fe=tt(Oe(Gde(Je,$))).mul(pe).mul(ie).mul(ye.specularIntensity),it=Xt(J,De(1).sub(V)),Rt=ye.keyColor.mul(G.surfCrack.mul(ye.crackBright).mul(.3).add(be.mul(ye.backlight).mul(.8))).mul(oe.scatter);S.colorNode=ye.baseColor,S.emissiveNode=ye.keyColor.mul(it.mul(ye.interiorScatter).mul(.3)).mul(oe.scatter),S.outputNode=Go(()=>{let Ze=Fe.add(ft.mul(De(1).sub(pe.mul(ie)))).mul(De(1).sub(it)).add(o2.rgb.mul(it)).add(Rt),ht=Xt(o2.a,.001),Yt=z1(this.o.backdrop,_x);return xi(Xt(Ze.sub(Yt.mul(De(1).sub(ht))),vr(0)).div(ht),o2.a)})();let Ft=new Mi(v,S);Ft.frustumCulled=!1,Ft.castShadow=!0,Ft.receiveShadow=!0,this.meshes.push(Ft),this.group.add(Ft),b===0&&(this.material=S)}}hazeNode(e,t,r){let i=this.u,s=u2(this.densityTex);return Go(()=>{let a=_x.mul(2).sub(1),n=UF(a.x,a.y.negate()),o=i.invProj.mul(xi(n.x,n.y,1,1)),l=o.xyz.div(o.w),u=Fs(l),h=Fs(Cc(i.camWorld).mul(u)),d=i.camPos,c=i.densityExtent,m=vr(1).div(h),g=c.negate().sub(d).mul(m),y=c.sub(d).mul(m),b=Xt(Xt(Wo(g.x,y.x),Wo(g.y,y.y)),Wo(g.z,y.z)),v=Wo(Wo(Xt(g.x,y.x),Xt(g.y,y.y)),Xt(g.z,y.z)),S=De(1).div(Xt(u.z.negate(),1e-4)),T=t.negate().mul(S),w=Wo(v,T),N=De(0).toVar();Nt(w.greaterThan(Xt(b,0)).and(i.hazeOn.greaterThan(.5)),()=>{let R=Xt(b,0),E=Xt(i.hazeSteps,4),P=w.sub(R).div(E),I=Po(vr(_x.mul(1234),i.time)).mul(P),O=R.add(I).toVar();Sx({start:yh(0),end:yh(E),type:"int",condition:"<"},()=>{let L=d.add(h.mul(O)).add(c).div(c.mul(2)),X=s.sample(L).level(0);N.addAssign(X.r.mul(X.g).mul(P)),O.addAssign(P)})});let C=i.tone.mul(i.keyColor).mul(i.keyIntensity).mul(N).mul(.35);return xi(C,0)})()}step(e,t,r,i,s,a){let n=le.powder,o=le.healing,l=this.u;l.fieldActive.value=a.fieldActive?1:0,l.hazeOn.value=a.powderActive?1:0,l.dt.value=Math.min(r,1/30),l.time.value=t;let u=this.o.objectGroup.matrixWorld;if(l.model.value.copy(u),l.previousModel.value.copy(this.prevModel),l.normalMat.value.getNormalMatrix(u),l.modelDelta.value.copy(u).multiply(this.inversePrevModel.copy(this.prevModel).invert()),this.prevModel.copy(u),l.strokeDir.value.copy(i.strokeDir),l.strokeSpeed.value=i.strokeSpeed,l.heal.value=pt.healing?1:0,l.fade.value=pt.fade,l.lightDir.value.copy(s.position).sub(s.target.position).normalize(),l.modelInv.value.copy(u).invert(),le.version!==this.settingsVersion){this.settingsVersion=le.version,l.ejectSpeed.value=n.ejectSpeed,l.ejectSpread.value=n.ejectSpread,l.ejectTurb.value=n.ejectTurbulence,l.backwardRatio.value=n.backwardRatio,l.clumpJitter.value=n.clumpSpeedJitter,l.drag.value=n.drag,l.gravity.value=n.gravity,l.turbulence.value=n.turbulence,l.turbScale.value=n.turbulenceScale,l.turbDecay.value=n.turbulenceDecay,l.cohesion.value=n.clumpCohesion,l.settleTime.value=n.settleTime,l.settledDrift.value=n.settledDrift,l.tumble.value=n.tumble,l.returnDuration.value=o.returnDuration,l.returnCurve.value=o.returnCurve,l.inherit.value=n.inheritRotation?1:0,l.inheritTime.value=n.inheritTime/1e3,l.straySpeed.value=n.straySpeed,l.dustScale.value=n.grainSizes.tinyDustSize,l.grainScale.value=n.grainSizes.smallGrainSize,l.clumpScale.value=n.grainSizes.mediumClumpSize,l.fragmentScale.value=n.grainSizes.largeFragmentSize,l.sizeJitter.value=n.grainSizes.sizeJitter,l.sizeMul.value=n.grainSizeMultiplier,l.amount.value=n.amount,l.minEject.value=n.minEjectSpeed,l.minPixel.value=n.minPixelSize,l.waveTime.value=o.waveTime,l.waveJitter.value=o.waveJitter,l.ghostDist.value=o.ghostReturnDistance,l.ghostFrac.value=o.ghostFlightFraction,l.waveReach.value=o.waveReach,l.depositRadius.value=o.depositRadius,l.returnMode.value=o.returnMode==="spring"?1:0,l.springK.value=o.returnSpring,l.springDamp.value=o.returnDamping,l.springRamp.value=o.returnRamp,l.landRadius.value=o.landRadius,l.returnAfter.value=o.returnAfter,l.maxSpeed.value=n.maxSpeed,l.returnDrag.value=o.returnDrag,l.returnMaxSpeed.value=o.returnMaxSpeed,l.lostRadius.value=n.lostRadius,l.stragglers.value=o.cellStragglers,l.spriteSee.value=n.sprites.seeThrough,l.alignAmt.value=o.alignToSurface,l.alignDist.value=o.alignDistance,l.alignCurve.value=o.alignCurve??1,l.landedFade.value=o.landedFade,l.landShrink.value=o.landShrink,l.densityExtent.value=n.densityExtent,l.shadowStrength.value=n.densityShadowStrength,l.aoStrength.value=n.densityAOStrength,l.densityScale.value=.02*(this.o.densityRes/64)**3*(1e6/this.total)**.5,l.tone.value.set(n.baseTone),l.wrap.value=n.wrap,l.keyIntensity.value=le.lighting.key.intensity,l.keyColor.value.set(le.lighting.key.color);let h=n.fragments;l.translucency.value=h.translucency,l.throughTint.value.set(h.throughTint),l.fresnelPower.value=h.fresnelPower,l.fragRough.value=h.roughness,l.fragClearcoat.value=h.clearcoat,l.fragSpecular.value=h.specular,l.sparkle.value=h.sparkle,l.sparkleFraction.value=h.sparkleFraction,l.sparkleSpread.value=h.sparkleSpread;let d=n.sprites;l.spriteSize.value=d.sizeScale,l.spriteTilt.value=Bt.degToRad(d.tilt),l.spriteNormal.value=d.normalStrength,l.spriteFrost.value=d.frostFromAtlas,l.spriteFrostBoost.value=d.frostBoost,l.spriteFrostRough.value=d.frostRoughness,l.spriteEdge.value=d.edgeLight,l.spriteCut.value=d.alphaCut;let c=le.ice.features;if(l.surfaceFrost.value=Number(c.shardFrost&&c.frost),l.surfaceDetail.value=Number(c.shardFrost&&c.scatter),c.shardNormals||(l.spriteNormal.value=0),c.shardFrost||(l.spriteFrost.value=0,l.spriteFrostBoost.value=0),c.shardTransmission||(l.translucency.value=0,l.spriteSee.value=0),c.shardReflections||(l.fragSpecular.value=0,l.fragClearcoat.value=0),c.shardSparkle||(l.sparkle.value=0),c.shardEdges||(l.spriteEdge.value=0),l.repel.value=n.repelFromObject?1:0,l.repelStrength.value=n.repelStrength,l.repelRange.value=n.repelRange,l.repelRadial.value=n.repelRadial,l.repelRadialRange.value=n.repelRadialRange,l.colorByState.value=le.debug.colorByState?1:0,l.colorBySize.value=le.debug.colorBySize?1:0,l.colorByAge.value=le.debug.colorByAge?1:0,l.hazeSteps.value=n.hazeSteps,n.fragmentShadowMap!==this.fragmentShadowMap){this.fragmentShadowMap=n.fragmentShadowMap;for(let m of this.meshes)m.castShadow=n.fragmentShadowMap}}if(this.beforeIntegrate?.(),!(r<=0)&&(e.compute(this.nodes.resetCounters),a.powderActive||a.fieldActive||!this.nodes.updateStrays?(e.compute(this.nodes.snapshotLeaders),e.compute(this.nodes.update),e.compute(this.nodes.resolve),e.compute(this.nodes.clearDensity),this.densityDirty=!0):(e.compute(this.nodes.updateStrays),this.densityDirty&&(e.compute(this.nodes.resolve),e.compute(this.nodes.clearDensity),this.densityDirty=!1)),this.beforeAssembly?.(),this.assemblyEnabled&&this.o.erosion.u.reconstruct.value>.5&&a.fieldActive&&this.assembly?.update(e),this.statsTimer+=r,this.statsTimer>.5&&(le.debug.stats||le.performance.idleSkip))){this.statsTimer=0;let h=this.o.countersOffset;e.getArrayBufferAsync(this.buffers.atomics.value,null,h*4,64).then(d=>{let c=new Uint32Array(d),m=0;for(let g=0;g<this.o.variants;g++)m+=c[g];pt.counts.total=this.total,pt.counts.active=Math.max(0,m-this.o.strays),pt.counts.dormant=Math.max(0,this.total-m)}).catch(()=>{})}}updateCamera(e,t){this.u.pixelWorld.value=2*Math.tan(Bt.degToRad(e.fov/2))/Math.max(1,t),this.u.lightDirView.value.copy(this.u.lightDir.value).transformDirection(e.matrixWorldInverse),this.u.camPos.value.copy(e.position),this.u.invProj.value.copy(e.projectionMatrixInverse),this.u.camWorld.value.copy(e.matrixWorld)}reset(e){e.compute(this.nodes.reset)}syncModel(){this.prevModel.copy(this.o.objectGroup.matrixWorld)}retarget(e,t){let r=this.buffers.rest.value;r.array.set(t),this.upload(e,r),this.u.groupNoise.value=Number(le.healing.returnNoiseAmount??2),this.u.frontDuration.value=Number(le.healing.assemblyFrontDuration??Bs.assemblyFrontDuration),this.u.frontX.value=Number(le.healing.assemblyOriginX??Bs.assemblyOriginX),this.u.frontY.value=Number(le.healing.assemblyOriginY??Bs.assemblyOriginY),this.u.frontAngle.value=Number(le.healing.assemblyAngle??Bs.assemblyAngle),this.u.frontSpread.value=Number(le.healing.assemblySpread??Bs.assemblySpread),this.u.frontNoise.value=Number(le.healing.assemblyFrontNoise??Bs.assemblyFrontNoise),this.u.speedVariation.value=Number(le.healing.assemblySpeedVariation??Bs.assemblySpeedVariation),this.u.pathBend.value=Number(le.healing.assemblyBend??Bs.assemblyBend),this.u.pathSwirl.value=Number(le.healing.assemblySwirl??Bs.assemblySwirl),this.u.landingVariation.value=Number(le.healing.assemblyLandingVariation??Bs.assemblyLandingVariation),this.u.groupStagger.value=le.healing.returnGroupStagger??Bs.returnGroupStagger,this.u.groupScale.value=le.healing.returnGroupScale??Bs.returnGroupScale,this.u.groupSeed.value=le.healing.returnGroupSeed??Bs.returnGroupSeed,e.compute(this.nodes.retargetCount),this.o.erosion.u.reconstruct.value>.5&&this.assembly?.prepare(e)}prepareAssembly(e){this.assembly?.prepare(e)}restoreThresholds(e){let t=this.buffers.rest.value,r=t.array;for(let i=3;i<r.length;i+=4)r[i]=this.restInit[i];this.upload(e,t)}upload(e,t){t.needsUpdate=!0;let r=e.backend,i=r?.get?.(t);i?.buffer&&r.device&&r.device.queue.writeBuffer(i.buffer,0,t.array.buffer,t.array.byteOffset,t.array.byteLength)}dispose(){this.o.scene.remove(this.group);for(let e of this.meshes)e.geometry.dispose(),e.material.dispose();this.densityTex.dispose(),this.assembly?.dispose();for(let e of Object.keys(this.buffers)){let t=this.buffers[e];t?.value?.dispose&&t.value.dispose?.()}}},wx=4,sce=typeof location<"u"&&new URLSearchParams(location.search).has("stroke"),ace=typeof location<"u"?parseInt(new URLSearchParams(location.search).get("strokeFrames")||"1000000",10):1e6,nce=typeof location<"u"?parseInt(new URLSearchParams(location.search).get("strokeStart")||"0",10):0,XF=class{constructor(e,t,r,i,s,a){this.shape=e,this.objectGroup=t,this.camera=r,this.erosion=i,this.powder=s,this.onReset=a}strokeSegments=Array.from({length:Tc*2},()=>new Wt);strokeCount=0;strokeVel=new F;strokeDir=new F(1,.4,0).normalize();strokeSpeed=0;hitEntry=new F;hitExit=new F;hasHit=!1;prevEntry=new F;prevExit=new F;prevEntryWorld=new F;prevHit=!1;prevX=0;prevY=0;scripted=[];scrollP=-1;scrollPath={from:new F(-1,-.6,0),to:new F(1,.6,0)};ray=new ld;inv=new We;tmp=new F;objectRayOrigin=new F;objectRayDirection=new F;workA=new F;workB=new F;workDirection=new F;velocity=new F;rayHit={entry:new F,exit:new F,tEntry:0,tExit:0};resetDone=!0;sweep(e={}){let t=this.shape.bound,r=e.from??[-1,-.55,0],i=e.to??[1,.55,0];this.scripted.push({kind:"sweep",from:new F(r[0]*t,r[1]*t,r[2]*t),to:new F(i[0]*t,i[1]*t,i[2]*t),t0:-1,delay:e.delay??0,duration:e.duration??.7,radius:e.radius??le.erosion.brushRadius,strength:e.strength??le.erosion.brushStrength*1.5,through:e.through??!0,prevT:0})}front(e){let t=this.shape.bound,[r,i]=e.from,[s,a]=e.to,n=s-r,o=a-i,l=Math.hypot(n,o)||1,u=n/l*.5,h=o/l*.5;this.scripted.push({kind:"front",from:new F((r-u)*t,(i-h)*t,0),to:new F((s+u)*t,(a+h)*t,0),normal:new F(-o/l,n/l,0),reach:(e.reach??1.3)*t,t0:-1,delay:e.delay??0,duration:e.duration??1.5,radius:e.radius??le.erosion.brushRadius,strength:e.strength??le.erosion.brushStrength*1.5,through:!0,prevT:0})}clearScripted(){this.scripted.length=0}burst(e,t,r,i=.18){let s=new We().copy(this.objectGroup.matrixWorld).invert(),a=e.clone().applyMatrix4(s);this.scripted.push({from:a,to:a.clone(),t0:-1,delay:0,duration:i,radius:t,strength:r,through:!1,prevT:0});let n=new F().setFromMatrixPosition(this.objectGroup.matrixWorld),o=e.clone().sub(n);o.lengthSq()<1e-6&&o.set(0,1,0),this.strokeDir.copy(o.normalize()),this.strokeSpeed=le.erosion.brushSpeedRef*1.5}sweepTo(e){this.scrollP=Math.max(0,Math.min(1,e))}pushScripted(e,t){if(this.scripted.length===0)return!1;let r=!1;for(let i of this.scripted){if(i.t0<0&&(i.t0=e+i.delay),e<i.t0)continue;let s=Math.min(1,(e-i.t0)/Math.max(.01,i.duration)),a=this.shape.bound;if(i.kind==="front"){let u=y=>1-(1-y)*(1-y),h=i.reach*u(i.prevT),d=i.reach*u(s),c=Math.max(i.radius,(d-h)*1.5),m=this.shape.thickness,g=m<=c*.9?[0]:[-m,0,m];if(this.strokeCount+g.length*2>Tc)break;for(let y of[1,-1]){let b=this.workA.copy(i.from).addScaledVector(i.normal,y*d),v=this.workB.copy(i.to).addScaledVector(i.normal,y*d);for(let S of g)this.strokeSegments[this.strokeCount*2].set(b.x,b.y,S,c),this.strokeSegments[this.strokeCount*2+1].set(v.x,v.y,S,i.strength),this.strokeCount++}this.strokeSpeed=Math.max(this.strokeSpeed,i.reach/i.duration*.6),i.prevT=s,r=!0;continue}let n=this.workA.copy(i.from).lerp(i.to,i.prevT),o=this.workB.copy(i.from).lerp(i.to,s),l=i.through?3:1;if(this.strokeCount+l>Tc)break;for(let u=0;u<l;u++){let h=i.through?-a+2*a*(u+.5)/l:0;this.strokeSegments[this.strokeCount*2].set(n.x,n.y,i.through?h-a/l:n.z,i.radius),this.strokeSegments[this.strokeCount*2+1].set(o.x,o.y,i.through?h+a/l:o.z,i.strength),this.strokeCount++}if(i.from.distanceToSquared(i.to)>1e-6){let u=this.workDirection.copy(i.to).sub(i.from).transformDirection(this.objectGroup.matrixWorld);this.strokeDir.copy(u.normalize()),this.strokeSpeed=Math.max(this.strokeSpeed,i.from.distanceTo(i.to)/i.duration*.6)}i.prevT=s,r=!0}return this.scripted=this.scripted.filter(i=>i.prevT<1),r}pushScroll(e){if(this.scrollP<0)return!1;let t=this.scrollP;if(this.prevScrollP<0)return this.prevScrollP=t,!1;let r=t-this.prevScrollP;if(Math.abs(r)<5e-4)return!1;let i=this.shape.bound,s=this.workA.copy(this.scrollPath.from).lerp(this.scrollPath.to,this.prevScrollP).multiplyScalar(i),a=this.workB.copy(this.scrollPath.from).lerp(this.scrollPath.to,t).multiplyScalar(i);if(r>0){for(let o=0;o<3&&this.strokeCount<Tc;o++){let l=-i+2*i*(o+.5)/3;this.strokeSegments[this.strokeCount*2].set(s.x,s.y,l-i/3,le.erosion.brushRadius),this.strokeSegments[this.strokeCount*2+1].set(a.x,a.y,l+i/3,le.erosion.brushStrength*2.5),this.strokeCount++}let n=this.workDirection.copy(a).sub(s).transformDirection(this.objectGroup.matrixWorld);n.lengthSq()>1e-8&&this.strokeDir.copy(n.normalize()),this.strokeSpeed=Math.max(this.strokeSpeed,Math.min(6,Math.abs(r)*2*i/Math.max(e,1/120)))}return this.prevScrollP=t,r>0}prevScrollP=-1;update(e,t){this.strokeCount=0;let r=le.erosion;if(pt.resetRequestedAt>=0){let n=(e-pt.resetRequestedAt)/Math.max(.05,le.healing.resetFade/1e3);pt.fade=Math.max(0,1-n),n>=1&&(this.erosion&&this.erosion.clear(this.erosion.renderer),this.powder&&this.erosion&&this.powder.reset(this.erosion.renderer),this.onReset?.(),pt.resetRequestedAt=-1,pt.lastStrokeT=-1e9,pt.fade=1)}else pt.fade=Oo(pt.fade,1,.15,t);let i=Ui.x!==this.prevX||Ui.y!==this.prevY,s=null;if(Ui.inside){this.tmp.set(Ui.x,Ui.y,.5).unproject(this.camera),this.ray.origin.copy(this.camera.position),this.ray.direction.copy(this.tmp).sub(this.camera.position).normalize(),this.inv.copy(this.objectGroup.matrixWorld).invert();let n=this.objectRayOrigin.copy(this.ray.origin).applyMatrix4(this.inv),o=this.objectRayDirection.copy(this.ray.direction).transformDirection(this.inv);s=kne(this.shape,n,o,60,this.rayHit)}pt.overObject=!!s,this.hasHit=!!s,s&&(this.hitEntry.copy(s.entry).applyMatrix4(this.objectGroup.matrixWorld),this.hitExit.copy(s.exit).applyMatrix4(this.objectGroup.matrixWorld));let a=!1;if(t>0&&this.pushScripted(e,t)&&(a=!0),t>0&&this.pushScroll(t)&&(a=!0),(!Ht.enabled||Ht.cursorErodes)&&s&&this.prevHit&&i&&t>0&&this.strokeCount+wx<=Tc){let n=this.hitEntry,o=this.velocity.copy(n).sub(this.prevEntryWorld).divideScalar(t),l=o.length();if(l>.02){a=!0,this.strokeVel.lerp(o,.5),this.strokeSpeed=Oo(this.strokeSpeed,Math.min(l,r.brushSpeedRef*3),.08,t),this.strokeVel.lengthSq()>1e-6&&this.strokeDir.copy(this.strokeVel).normalize();let u=Bt.clamp(l/r.brushSpeedRef,.12,2.5),h=r.brushStrength*u,d=r.brushRadius*(.72+.28*Math.min(1,u));for(let c=0;c<wx;c++){let m=c/(wx-1)*r.throughDepth,g=this.strokeCount+c;this.strokeSegments[g*2].set(Bt.lerp(this.prevEntry.x,this.prevExit.x,m),Bt.lerp(this.prevEntry.y,this.prevExit.y,m),Bt.lerp(this.prevEntry.z,this.prevExit.z,m),d),this.strokeSegments[g*2+1].set(Bt.lerp(s.entry.x,s.exit.x,m),Bt.lerp(s.entry.y,s.exit.y,m),Bt.lerp(s.entry.z,s.exit.z,m),h)}this.strokeCount+=wx}}if((le.debug.forceStroke||sce&&ta.frame>=nce&&ta.frame<ace)&&t>0){let n=e*.25%1,o=this.shape.bound*.9,l=-o+n*2*o,u=-o*.7+n*1.4*o,h=l+.15,d=u+.1;this.strokeSegments[0].set(l,u,-o,r.brushRadius),this.strokeSegments[1].set(h,d,o,r.brushStrength),this.strokeCount=1,this.strokeDir.set(1,.7,0).normalize(),this.strokeSpeed=r.brushSpeedRef,a=!0}a||(this.strokeSpeed=Oo(this.strokeSpeed,0,1.2,t)),pt.strokeActive=a,Ht.enabled&&Ht.healSuspended&&(pt.lastStrokeT=e),s&&(this.prevEntry.copy(s.entry),this.prevExit.copy(s.exit),this.prevEntryWorld.copy(this.hitEntry)),this.prevHit=!!s,this.prevX=Ui.x,this.prevY=Ui.y,this.resetDone}},{vec3:oce,vec4:$F,uniform:lce,uv:uce,texture3D:hce,float:oye}=Jr,dce=class{constructor(e,t,r){this.camera=e;let i=(a,n)=>{let o=new Pd,l=hce(a).sample(oce(uce(),this.uSlice)).level(0);o.colorNode=n==="erosion"?$F(l.r,l.r.mul(.6).add(l.g.mul(.8)),l.r.mul(.6),1):$F(l.r.mul(2),l.g,l.b,1),o.depthTest=!1,o.depthWrite=!1,o.transparent=!1;let u=new Mi(new Kv(1,1),o);return u.renderOrder=1e3,u.frustumCulled=!1,u};this.erosionQuad=i(t.tex,"erosion"),this.densityQuad=i(r.densityTex,"density");let s=new eb(.03,12,8);this.hitEntry=new Mi(s,new Pd({color:"#ff4040"})),this.hitExit=new Mi(s,new Pd({color:"#40a0ff"})),this.group.add(this.hitEntry,this.hitExit),e.add(this.erosionQuad,this.densityQuad)}group=new pn;erosionQuad;densityQuad;hitEntry;hitExit;uSlice=lce(.5);update(e){let t=le.debug;this.uSlice.value=t.erosionSliceZ;let r=this.camera,i=3,s=2*i*Math.tan(Bt.degToRad(r.fov/2)),a=s*r.aspect,n=s*.28;this.erosionQuad.visible=t.showErosionSlice,this.erosionQuad.scale.set(n,n,1),this.erosionQuad.position.set(-a/2+n*.6,-s/2+n*.6,-i),this.densityQuad.visible=t.showDensityGrid,this.densityQuad.scale.set(n,n,1),this.densityQuad.position.set(-a/2+n*(t.showErosionSlice?1.75:.6),-s/2+n*.6,-i);let o=t.showHitPoints&&e.hasHit;this.hitEntry.visible=o,this.hitExit.visible=o,o&&(this.hitEntry.position.copy(e.hitEntry),this.hitExit.position.copy(e.hitExit))}dispose(){this.camera.remove(this.erosionQuad,this.densityQuad),this.erosionQuad.geometry.dispose(),this.densityQuad.geometry.dispose(),this.erosionQuad.material.dispose(),this.densityQuad.material.dispose()}},cce=class{ratio=0;frameMs=0;frames=0;lastAdjust=0;update(e,t,r,i,s,a,n){let o=Math.max(.5,Math.min(r||1,i)),l=Math.min(o,Math.max(.5,n));(!this.ratio||!s)&&(this.ratio=o),this.ratio=Math.min(o,Math.max(l,this.ratio));let u=Math.min(50,Math.max(1,t));if(this.frameMs=this.frames===0?u:this.frameMs+(u-this.frameMs)*.08,this.frames++,!s||this.frames<45||e-this.lastAdjust<.5)return this.ratio;let h=1e3/Math.max(30,a),d=this.ratio;if(this.frameMs>h*1.08&&this.ratio>l){let c=this.ratio*Math.sqrt(h/this.frameMs)*.98;d=Math.min(this.ratio-.05,c),d=Math.floor(d*20)/20}else this.frameMs<h*.82&&this.ratio<o&&(d=Math.ceil((this.ratio+.05)*20)/20);return d=Math.min(o,Math.max(l,d)),d!==this.ratio&&(this.ratio=d,this.frameMs=h,this.lastAdjust=e),this.ratio}updateScene(e,t,r,i,s,a,n,o,l,u){let h=Math.max(.5,Math.min(r||1,i)),d=Math.max(.25,Math.min(1,o)),c=Math.max(.5,h*d),m=h*Math.max(.25,Math.min(d,l)),g=Math.min(c,Math.max(.5,n,m)),y=this.update(e,t,c,c,s,a,g);return{sourceRatio:y,outputRatio:u?h:y,sceneScale:u?y/h:1}}},pce=()=>({logoId:mce,shape:Ht.enabled&&Ht.shape?Ht.shape:le.shape.shape,seed:le.shape.seed,particleCount:le.powder.particleCount,resolution:le.erosion.resolution,densityGrid:le.powder.densityGrid,size:le.shape.size,tubeRatio:le.shape.tubeRatio,segments:le.shape.segments,variants:le.powder.grainVariants,faceted:le.powder.facetedGrains,sprites:le.powder.sprites.enabled,spriteBlend:le.powder.sprites.seeThrough>0,strays:le.powder.strayCount,clumps:le.powder.clumpCount,dispersion:!0,voronoiCells:le.performance.voronoiCells,turbulence:le.performance.turbulence}),mce=0,Xo=new Set(typeof location<"u"?[...new URLSearchParams(location.search).keys()]:[]),qF=65536,fce={"100k":1e5,"250k":25e4,"500k":5e5,"1M":1e6,"2M":2e6},gce=class{constructor(e,t,r,i,s,a){this.renderer=e,this.scene=t,this.camera=r,this.blueNoise=i,this.logo=s,this.fractureDetail=a,this.motionGroup.add(this.objectGroup),t.add(this.motionGroup,this.lights.group,r),t.backgroundNode=this.backdrop.node,t.environment=this.env.texture,this.build(),this.post=Nhe({scene:t,camera:r,renderer:e,blueNoise:i,haze:(n,o)=>this.powder.hazeNode(n,o,r),initial:le.post,initialPerformance:le.performance,initialHaze:le.powder.hazeIntensity!==0})}motionGroup=new pn;objectGroup=new pn;backdrop=Ane();env=Cne();lights=new Rne;rig=new K5;post;shape;mesh;meshEntry;glassMatcap;materialPlanes;ice;erosion;powder;interaction;debugViews;pixelRatio=0;frozenByDial=!1;statsTimer=0;buildCount=0;timersPending=!1;fieldMaybeNonZero=!0;lastActivityT=0;idleState(e){let t=this.interaction.strokeCount>0;t&&(this.fieldMaybeNonZero=!0,this.lastActivityT=e);let r=this.erosion.stats;this.fieldMaybeNonZero&&this.erosion.statsReadT>pt.lastStrokeT+.6&&r.max<.002&&r.refrost<.002&&(this.fieldMaybeNonZero=!1);let i=pt.healing&&this.fieldMaybeNonZero,s=this.fieldMaybeNonZero&&r.refrost>.002,a=!le.performance.idleSkip||t||e<this.erosion.crumbleUntil||i||s,n=!le.performance.idleSkip||a||pt.counts.active>0||e-this.lastActivityT<1.5||pt.resetRequestedAt>=0;return pt.fieldActive=a,pt.powderActive=n,{fieldActive:a,powderActive:n}}envSig="";backdropSig="";frameTimes=new Float64Array(30);frameTimeSum=0;frameTimeCount=0;frameTimeIndex=0;lastFrameStart=0;gpuPending=!1;gpuTimerLast=-1/0;renderSize=new fe;adaptiveResolution=new cce;offscreenRT=Xo.has("offscreen")?new er(16,16,{depthBuffer:!1,type:Si,format:pi}):null;build(){this.buildCount++;let e=pce(),t=Lm(e.seed+1),r=Ht.enabled&&Ht.shape?Ht.shape:le.shape.shape,i=r==="logo"&&!this.logo?"torus":r;this.shape=cw(i,e.size,e.tubeRatio,this.logo?.sdf);let s=Dne(this.shape,e.segments,this.logo?.geometry),a=parseInt(e.densityGrid,10),n=parseInt(e.resolution,10),o=a*a*a,l=o+16,u=l+n*n*n,h=u+qF,d=Jr.instancedArray(h+qF,"uint").toAtomic();if(this.erosion=new hx(this.renderer,this.shape,n,e.seed,d,l,u,h),qa.materials&&(this.materialPlanes=new mne(this.renderer,this.shape.bound,e.seed),this.erosion.materialPlanes=this.materialPlanes),this.erosion.skipBake=Xo.has("nobake"),qa.mesh&&(this.meshEntry=vne(s,this.camera)),qa.matcap&&(this.env.update(le.lighting),this.glassMatcap=bne(this.env.texture)),this.ice=_de({meshEntry:this.meshEntry,glassMatcap:this.glassMatcap,shape:this.shape,erosion:this.erosion,seed:e.seed,blueNoise:this.blueNoise,environment:this.env.texture,fractureDetail:this.fractureDetail,backdrop:this.backdrop.uniforms,dispersion:e.dispersion,voronoiCells:e.voronoiCells}),Xo.has("noice")){let c=new pS;c.roughness=.3,c.color.set("#bbbbbb"),this.ice.material=c}this.meshEntry&&(this.meshEntry.material.positionNode=this.ice.material.positionNode),this.mesh=new Mi(s,this.ice.material),this.mesh.castShadow=!0,this.mesh.receiveShadow=!0,this.mesh.frustumCulled=!1,this.objectGroup.add(this.mesh),this.powder=new ice({enabled:!Xo.has("nopowder"),renderer:this.renderer,scene:this.scene,shape:this.shape,erosion:this.erosion,seed:e.seed,rand:t,count:fce[e.particleCount]??1e6,variants:e.variants,strays:e.strays,densityRes:a,clumpCount:e.clumps,objectGroup:this.objectGroup,turbulence:e.turbulence,atomics:d,countersOffset:o,healOffset:l,cellOffset:u,flightOffset:h,fieldRes:n,backdrop:this.backdrop.uniforms,fractureDetail:this.fractureDetail,iceUniforms:this.ice.uniforms,iceFeatures:this.ice.features,environment:this.env.texture}),this.interaction=new XF(this.shape,this.objectGroup,this.camera,this.erosion,this.powder),this.debugViews=new dce(this.camera,this.erosion,this.powder),this.scene.add(this.debugViews.group)}disposeBuilt(){this.materialPlanes?.dispose(),this.materialPlanes=void 0,this.meshEntry?.dispose(),this.meshEntry=void 0,this.glassMatcap?.dispose(),this.glassMatcap=void 0,this.debugViews.dispose(),this.scene.remove(this.debugViews.group),this.objectGroup.remove(this.mesh),this.mesh.geometry.dispose(),this.ice.material.dispose(),this.erosion.dispose(),this.powder.dispose()}rebuild(){this.disposeBuilt(),this.build(),this.post.post.needsUpdate=!0}updateEnvironment(){let e=le.lighting,t=JSON.stringify([e.envSoftbox,e.envRim,e.envFill,e.key,e.fill,e.fillColor,e.fillGroundColor,e.fillReflectionStrength,e.rimColor,e.rimElevation,e.rimAzimuth,e.rimSize,e.accentCool,e.accentWarm]);t!==this.envSig&&(this.envSig=t,this.env.update(e)),this.scene.environmentIntensity=le.ice.envIntensity}updateBackdrop(e){let t=le.lighting.backdrop,r=Ht.enabled?Ht.backdrop:null,i=this.backdrop.uniforms,s=r?.top??t.top,a=r?.mid??t.mid,n=r?.bottom??t.bottom,o=r?.centerX??t.centerX,l=r?.centerY??t.centerY,u=r?.radius??t.radius,h=r?.falloff??t.falloff,d=`${s}|${a}|${n}|${o}|${l}|${u}|${h}|${t.noise}`;d!==this.backdropSig&&(this.backdropSig=d,i.uTop.value.set(s),i.uMid.value.set(a),i.uBottom.value.set(n),i.uCenter.value.set(o,l),i.uRadius.value=u,i.uFalloff.value=h,i.uNoise.value=t.noise),i.uTime.value=e}onBeforeRender=null;onBeforeSimulation=null;onObjectTransform=null;onCameraTransform=null;frame(e,t,r=!0){ta.t=e,ta.dt=t,ta.frame++;let i=e*1e3,s=1e3/le.performance.targetFps,a=!Xo.has("nopost")&&le.performance.nativePostEffects&&le.performance.upscaler!=="native",n=this.adaptiveResolution.updateScene(e,s,window.devicePixelRatio||1,le.post.pixelRatioCap,le.performance.adaptiveResolution&&le.performance.dynamicSceneResolution,le.performance.targetFps,le.performance.minPixelRatio,le.performance.sceneResolutionScale,le.performance.minSceneResolutionScale,a);if(pt.pixelRatio=n.sourceRatio,pt.outputPixelRatio=n.outputRatio,pt.sceneResolutionScale=n.sceneScale,n.outputRatio!==this.pixelRatio||this.renderer.getPixelRatio()!==n.outputRatio){this.pixelRatio=n.outputRatio,this.renderer.setPixelRatio(n.outputRatio);let h=this.renderer.getSize(this.renderSize);this.renderer.setSize(h.x,h.y,!1)}this.onCameraTransform||this.rig.update(this.camera,this.objectGroup,e,t),Ht.enabled&&Ht.framing?this.motionGroup.position.set(Ht.objectX,Ht.objectY,Ht.objectZ):this.motionGroup.position.set(le.shape.offsetX,le.shape.offsetY,le.shape.offsetZ),this.objectGroup.position.set(0,0,0),this.onObjectTransform&&this.onObjectTransform(e),this.motionGroup.updateMatrixWorld(!0),this.onCameraTransform?.(e),this.updateEnvironment(),this.updateBackdrop(e),pt.hoverAmount=Oo(pt.hoverAmount,pt.overObject?1:0,.4/3,t),this.lights.update(e,pt.hoverAmount),this.interaction.update(e,t),this.onBeforeSimulation?.(e,t),this.debugViews.update(this.interaction),Xo.has("noice")||(this.ice.update(e,t,this.lights.key,this.objectGroup),this.ice.uniforms.hover.value=pt.hoverAmount);let o=performance.now(),l=this.idleState(e);if(t>0&&(Xo.has("noerosion")||this.erosion.step(this.renderer,e,t,this.interaction.strokeSegments,this.interaction.strokeCount,l.fieldActive)),Xo.has("nopowder")||this.powder.step(this.renderer,e,t,this.interaction,this.lights.key,l),pt.computeMs=performance.now()-o,le.debug.stats||le.performance.idleSkip){this.statsTimer+=Math.max(t,1/120);let h=this.fieldMaybeNonZero?.25:.4;(this.statsTimer>h||this.offscreenRT)&&(this.statsTimer=0,this.erosion.readStats(this.renderer,e),pt.erosion=this.erosion.stats)}this.camera.updateMatrixWorld(),this.onBeforeRender&&this.onBeforeRender(e),this.powder.updateCamera(this.camera,this.renderer.getSize(this.renderSize).y*n.sourceRatio);let u=this.camera.position.distanceTo(this.rig.lookAt);if(this.post.update(le.post,le.performance,u,pt.sceneFade,le.powder.hazeIntensity,e,le.version),this.materialPlanes?.update(),this.post.setSceneResolution(n.sceneScale),this.meshEntry?.update(this.mesh,n.sceneScale),this.mesh.material.wireframe=le.debug.wireframe,this.offscreenRT){let h=this.renderer.getSize(this.renderSize),d=this.renderer.getPixelRatio(),c=Math.max(1,Math.floor(h.x*d)),m=Math.max(1,Math.floor(h.y*d));(this.offscreenRT.width!==c||this.offscreenRT.height!==m)&&this.offscreenRT.setSize(c,m),this.renderer.setRenderTarget(this.offscreenRT)}if(this.post.setHazeResolution(le.performance.hazeResolution==="quarter"?.25:le.performance.hazeResolution==="half"?.5:1),r&&(this.renderer._nodes.nodeFrame.update(),this.post.setFrame(Math.round(e*60)),Xo.has("nopost")?this.renderer.render(this.scene,this.camera):this.post.post.render()),this.offscreenRT&&this.renderer.setRenderTarget(null),le.performance.gpuTimers&&!this.timersPending&&e-this.gpuTimerLast>=.25){let h=this.renderer;h.backend?.trackTimestamp&&(this.timersPending=!0,this.gpuTimerLast=e,Promise.all([h.resolveTimestampsAsync("render"),h.resolveTimestampsAsync("compute")]).then(()=>{pt.gpuRenderMs=h.info.render.timestamp||0,pt.gpuComputeMs=h.info.compute.timestamp||0,this.timersPending=!1}).catch(()=>{this.timersPending=!1}))}if(this.offscreenRT&&!this.gpuPending){let h=this.renderer.backend?.device?.queue;h?.onSubmittedWorkDone&&(this.gpuPending=!0,h.onSubmittedWorkDone().then(()=>{pt.gpuFrames++,this.gpuPending=!1}).catch(()=>{this.gpuPending=!1}))}}resetSim(){this.erosion.clear(this.renderer),this.erosion.crumbleUntil=-1,this.erosion.u.crumbleUntil.value=-1,this.powder.reset(this.renderer),this.interaction=new XF(this.shape,this.objectGroup,this.camera,this.erosion,this.powder),this.rig=new K5,this.mesh.visible=!0,pt.strokeActive=!1,pt.overObject=!1,pt.lastStrokeT=-1e9,pt.healing=!1,pt.resetRequestedAt=-1,pt.fade=1,pt.sceneFade=1,pt.hoverAmount=0,pt.fieldActive=!0,pt.powderActive=!0,this.fieldMaybeNonZero=!0,this.lastActivityT=0,this.statsTimer=0,ta.t=0,ta.dt=1/60,ta.frame=0,ta.paused=!1}async dumpShader(){return this.renderer.debug.getShaderAsync(this.scene,this.camera,this.mesh)}async readback(){if(!this.offscreenRT)return null;let e=this.offscreenRT,t=e.width,r=e.height,i=await this.renderer.readRenderTargetPixelsAsync(e,0,0,t,r),s=i.length>=Math.ceil(t*4/256)*256*r?Math.ceil(t*4/256)*256:t*4,a=0,n=0,o=document.createElement("canvas");o.width=t,o.height=r;let l=o.getContext("2d"),u=l.createImageData(t,r);for(let h=0;h<r;h++)for(let d=0;d<t;d++){let c=h*s+d*4,m=(h*t+d)*4;u.data[m]=i[c],u.data[m+1]=i[c+1],u.data[m+2]=i[c+2],u.data[m+3]=255;let g=.2126*i[c]+.7152*i[c+1]+.0722*i[c+2];a+=g,g>n&&(n=g)}return l.putImageData(u,0,0),{mean:a/(t*r),max:n,png:o.toDataURL("image/png"),w:t,h:r}}dispose(){this.disposeBuilt(),this.post.dispose(),this.scene.remove(this.motionGroup,this.lights.group),this.scene.backgroundNode=null,this.scene.environment=null,this.env.texture.dispose(),this.fractureDetail?.dispose()}},Mx={ice:{ior:1.445,dispersion:.155,thicknessScale:2.41,attenuationDistance:4.47,attenuationColor:"#524c4c",baseRoughness:.5,frost:{scale:.2,threshold:1,softness:.36,roughness:0,diffuse:.56,crystalBump:.37,crystalScale:67},cracks:{largeScale:8,warp:0,warpScale:2.2,coverage:.01,regionScale:1.35,regionCoverage:0,veinScale:20,veinContrast:.57,width:.0175,brightness:.25,darkness:1,refraction:.008,surfaceStrength:0,steps:21,fineCracks:!0,fineScale:10.4,fineAmount:0,fineCoverage:.45,fineNearLarge:1},smudges:{amount:0,coverage:.29,maskScale:3.1,anisotropy:5.5,roughness:.02,whiteness:.035,scale:.5},bumps:{microBump:.32,microScale:121,microCoverage:.76,rippleBump:.45,rippleScale:2.5,maskScale:3.6},crumbleGlow:.16,edgeWhiteness:.09,clearcoat:0,clearcoatRoughness:.085,envIntensity:.28,specularIntensity:.65,interiorScatter:.05},performance:{adaptiveResolution:!0,targetFps:60,minPixelRatio:.75,sceneResolutionScale:1,dynamicSceneResolution:!0,minSceneResolutionScale:.35,upscaler:"taau",upscaleSharpness:.2,nativePostEffects:!0,idleSkip:!0,adaptiveSteps:!0,voronoiCells:"27",hazeResolution:"quarter",turbulence:"fast",gpuTimers:!0},lighting:{key:{color:"#ffffff",intensity:12,elevation:62,azimuth:-10.5,size:3,hoverBoost:.3},fill:1.5,fillColor:"#ffffff",fillGroundColor:"#07a4a6",rim:5,rimColor:"#0b82ea",rimElevation:9.5,shadow:{intensity:0,softness:6,samples:1,mapSize:"1024",bias:-6e-4},sway:{amplitude:.118,period:35},backdrop:{top:"#212121",mid:"#171717",bottom:"#030303",centerX:.19,centerY:1.5,radius:.78,falloff:4,noise:0},envSoftbox:1.22,envRim:2.43,envFill:1,rimAzimuth:-180,rimAngle:81,rimSize:2.05,fillReflectionStrength:2,accentCool:{intensity:4,reflection:3,elevation:25,azimuth:-65,size:2.85,color:"#c7ddff"},accentWarm:{intensity:3.64,reflection:3,elevation:34,azimuth:127,size:3,color:"#ff0000"}},post:{dof:{enabled:!1,focusBias:-.43,aperture:4,range:12},bloom:{threshold:.28,intensity:0,radius:.11},monochrome:0,tonemap:"aces",exposure:1.3,contrast:1.15,blackLift:0,vignette:{strength:.325,softness:1.175,radius:1.11},grain:{strength:0,size:1,speed:0,shadowWeight:.28,backgroundStrength:.035,backgroundSize:2,backgroundSpeed:0},dither:!0,aaMode:"traa",pixelRatioCap:2}},yce=()=>({version:1,name:"Untitled shot",orientation:"target",anchorSpace:"local",objectMotion:"existing",keys:[]});function c2(e){if(e==null||e==="")return yce();let t=typeof e=="string"?JSON.parse(e):e;if(t?.version!==1||!Array.isArray(t.keys)||t.keys.length>64)throw Error("Camera track must be version 1 with at most 64 keys.");let r=(o,l,u)=>{if(!l.includes(o))throw Error("Invalid "+u);return o},i=(o,l,u,h)=>{if(typeof o!="number"||!Number.isFinite(o)||o<l||o>u)throw Error("Invalid "+h);return o},s=(o,l,u)=>{if(!Array.isArray(o)||o.length!==l)throw Error("Invalid "+u);return o.map(h=>i(h,-1e4,1e4,u))},a={version:1,name:String(t.name||"Untitled shot").slice(0,100),orientation:r(t.orientation,["target","free"],"orientation"),anchorSpace:r(t.anchorSpace,["world","local"],"anchor space"),objectMotion:r(t.objectMotion,["existing","stationary"],"object motion"),keys:t.keys.map(o=>{let l=s(o.quaternion,4,"quaternion");if(Math.abs(Math.hypot(...l)-1)>.001)throw Error("Camera quaternion must be normalized.");return{id:String(o.id).slice(0,100),time:i(o.time,0,120,"key time"),position:s(o.position,3,"position"),target:s(o.target,3,"target"),quaternion:l,fov:i(o.fov,5,120,"FOV"),zoom:i(o.zoom,.1,10,"zoom"),roll:i(o.roll,-720,720,"roll"),ease:r(o.ease,["flow","linear","ease-in-out"],"ease")}}).sort((o,l)=>o.time-l.time)},n=new Set;for(let o=0;o<a.keys.length;o++){let l=a.keys[o];if(!l.id||n.has(l.id))throw Error("Camera key IDs must be unique.");if(n.add(l.id),o&&l.time-a.keys[o-1].time<.004166666666666667)throw Error("Camera keys need distinct times (at least 1/240 second apart).")}return a}function xce(){let e=new gs(29.5,1.7777777777777777,.5,80);return e.position.set(0,1.2,13.45),e.lookAt(0,.05,0),e.updateMatrixWorld(),e}function YF(e,t,r=new We){let i=e.keys;if(!i.length){let g=xce();return{position:g.position,quaternion:g.quaternion,target:new F(0,.05,0),fov:29.5,zoom:1,roll:0}}t=Math.max(i[0].time,Math.min(i.at(-1).time,t));let s=0;for(;s<i.length-2&&i[s+1].time<t;)s++;let a=i[s],n=i[Math.min(s+1,i.length-1)],o=n.time-a.time,l=o>0?(t-a.time)/o:0,u=a.ease==="ease-in-out"?l*l*(3-2*l):l,h=g=>{if(!o)return g(a);if(a.ease!=="flow")return Bt.lerp(g(a),g(n),u);let y=i[Math.max(0,s-1)],b=i[Math.min(i.length-1,s+2)],v=(g(n)-g(y))/Math.max(n.time-y.time,1e-6),S=(g(b)-g(a))/Math.max(b.time-a.time,1e-6);return(2*u**3-3*u*u+1)*g(a)+(u**3-2*u*u+u)*o*v+(-2*u**3+3*u*u)*g(n)+(u**3-u*u)*o*S},d=new F(...[0,1,2].map(g=>h(y=>y.position[g]))),c=new F(...[0,1,2].map(g=>h(y=>y.target[g])));e.anchorSpace==="local"&&c.applyMatrix4(r);let m=e.orientation==="target"?new si().setFromRotationMatrix(new We().lookAt(d,c,new F(0,1,0))):new si(...a.quaternion).slerp(new si(...n.quaternion),u);return m.multiply(new si().setFromAxisAngle(new F(0,0,1),Bt.degToRad(h(g=>g.roll)))),{position:d,quaternion:m,target:c,roll:h(g=>g.roll),fov:Bt.clamp(h(g=>g.fov),5,120),zoom:Bt.clamp(h(g=>g.zoom),.1,10)}}function vce(e,t,r,i,s){let a=YF(t,r,i);return e.position.copy(a.position),e.quaternion.copy(a.quaternion),e.fov=a.fov,e.zoom=a.zoom,e.updateProjectionMatrix(),e.updateMatrixWorld(!0),s.copy(a.target),a}var bce=e=>Math.max(0,Math.min(1,e));function p2(e,t){let r=l=>(l=bce(l),l*l*l*(l*(l*6-15)+10)),i=(l,u)=>l<=u?r(l/Math.max(u,1e-6)):1-r((l-u)/Math.max(1-u,1e-6)),s=[{t0:e.logoBreak-.65,tBreakEnd:e.form1,t1:e.form1+2.8,yaw:t.turnYaw,pitch:t.turnPitch,z:t.approach,keep:!1},{t0:e.break1-.65,tBreakEnd:e.form2,t1:e.form2+2.8,yaw:t.turnYaw2,pitch:t.turnPitch2,z:-t.retreat,keep:!1},{t0:e.break2-.65,tBreakEnd:e.fadeOut+1.5,t1:e.fadeOut+1.5,yaw:t.finalYaw,pitch:t.finalPitch,z:t.approach+t.zoomIn,keep:!0}];function a(l){let u=0,h=0,d=0;for(let c of s){let m=(l-c.t0)/Math.max(c.t1-c.t0,1e-6);if(m<=0)continue;u+=c.yaw*r(m);let g=(c.tBreakEnd-c.t0)/Math.max(c.t1-c.t0,1e-6),y=c.keep?r(m):i(m,g);h+=c.pitch*y,d+=c.z*y}return{yaw:u,pitch:h,z:d}}let n=l=>t.driftYaw*l,o=l=>t.idleYaw*Math.sin(2*Math.PI*l/9);return function(l){let u=a(l),h=t.driftSway*Math.sin(2*Math.PI*l/11);return{yaw:u.yaw+n(l)+o(l),pitch:u.pitch+h,z:u.z+.0875*t.driftSway*Math.sin(2*Math.PI*l/11)}}}var Tce=(e,t)=>e<t.form1?0:e<t.form2?1:2;function Sce(e,t,r,i=Tce(e,t),s=!1){let a=p2(t,r),n=a(e),o=d=>{let c=a(d);return new si().setFromEuler(new cn(c.pitch*Math.PI/180,c.yaw*Math.PI/180,0,"YXZ"))},l=s?new si:o(e),u=s||i===0?new si:o((i===1?t.form1:t.form2)+2.8).invert(),h=new F(0,.05,s?0:n.z);return{rotation:l,facing:u,position:h,matrix:new We().compose(h,l.clone().multiply(u),new F(1,1,1))}}var{lerp:Sh}=Bt,us=[151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180];for(let e=0;e<256;e++)us[256+e]=us[e];function m2(e){return e*e*e*(e*(e*6-15)+10)}function tu(e,t,r,i){let s=e&15,a=s<8?t:r,n=s<4?r:s==12||s==14?t:i;return((s&1)==0?a:-a)+((s&2)==0?n:-n)}var _ce=class{noise(e,t,r){let i=Math.floor(e),s=Math.floor(t),a=Math.floor(r),n=i&255,o=s&255,l=a&255;e-=i,t-=s,r-=a;let u=e-1,h=t-1,d=r-1,c=m2(e),m=m2(t),g=m2(r),y=us[n]+o,b=us[y]+l,v=us[y+1]+l,S=us[n+1]+o,T=us[S]+l,w=us[S+1]+l;return Sh(Sh(Sh(tu(us[b],e,t,r),tu(us[T],u,t,r),c),Sh(tu(us[v],e,h,r),tu(us[w],u,h,r),c),m),Sh(Sh(tu(us[b+1],e,t,d),tu(us[T+1],u,t,d),c),Sh(tu(us[v+1],e,h,d),tu(us[w+1],u,h,d),c),m),g)}},wce=Io.textMeshDetail;function f2(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(4,Math.round(e))):wce}function Mce(e,t){let r=f2(t);return{maxEdge:e/(2*r),extraTriangles:16e4*r}}function Nce(e,t,r,i){let s=[],a=new Map,n=[],o=r*r,l=t.length/3+i,u=t.length/3,h=(v,S)=>v<S?`${v}:${S}`:`${S}:${v}`,d=(v,S)=>v.length2>S.length2||v.length2===S.length2&&(v.a<S.a||v.a===S.a&&v.b<S.b);function c(v){let S=n.length;for(n.push(v);S>0;){let T=S-1>>1;if(!d(v,n[T]))break;n[S]=n[T],S=T}n[S]=v}function m(){let v=n[0],S=n.pop();if(n.length){let T=0;for(;T*2+1<n.length;){let w=T*2+1;if(w+1<n.length&&d(n[w+1],n[w])&&w++,!d(n[w],S))break;n[T]=n[w],T=w}n[T]=S}return v}function g(v,S,T){let w=s.length;s.push([v,S,T]);for(let[N,C]of[[v,S],[S,T],[T,v]]){let R=h(N,C),E=a.get(R);if(!E){let P=e[N*3]-e[C*3],I=e[N*3+1]-e[C*3+1],O=e[N*3+2]-e[C*3+2];E={a:Math.min(N,C),b:Math.max(N,C),length2:P*P+I*I+O*O,faces:new Set},a.set(R,E),E.length2>o&&c(E)}E.faces.add(w)}}function y(v){let S=s[v];s[v]=null;for(let T=0;T<3;T++){let w=h(S[T],S[(T+1)%3]),N=a.get(w);N.faces.delete(v),N.faces.size||a.delete(w)}}for(let v=0;v<t.length;v+=3)g(t[v],t[v+1],t[v+2]);for(;n.length&&u<l;){let v=m();if(a.get(h(v.a,v.b))!==v)continue;let S=[...v.faces];if(u+S.length>l)continue;let T=e.length/3;e.push((e[v.a*3]+e[v.b*3])/2,(e[v.a*3+1]+e[v.b*3+1])/2,(e[v.a*3+2]+e[v.b*3+2])/2);let w=S.map(N=>s[N]);for(let N of S)y(N);for(let N of w){let C=N.findIndex((I,O)=>h(I,N[(O+1)%3])===h(v.a,v.b)),R=N[C],E=N[(C+1)%3],P=N[(C+2)%3];g(R,T,P),g(T,E,P)}u+=S.length}let b=[];for(let v of s)v&&b.push(v[0],v[1],v[2]);return b}function Ace(e,t){let r=[];for(let u=0;u<t.length;u+=3){let[h,d,c]=t.slice(u,u+3);h!==d&&d!==c&&c!==h&&r.push(h,d,c)}let i=new Map;for(let u=0;u<r.length;u+=3)for(let[h,d]of[[r[u],r[u+1]],[r[u+1],r[u+2]],[r[u+2],r[u]]]){let c=h<d?`${h}:${d}`:`${d}:${h}`,m=i.get(c);m?m.count++:i.set(c,{a:h,b:d,count:1})}let s=new Set;for(let u of i.values())u.count===1&&(s.add(u.a),s.add(u.b));let a=1e-5,n=new Map,o=new Map;for(let u of[...s].sort((h,d)=>h-d)){let h=e[u*3],d=e[u*3+1],c=e[u*3+2],m=Math.floor(h/a),g=Math.floor(d/a),y=Math.floor(c/a),b=u;for(let v=-1;v<=1;v++)for(let S=-1;S<=1;S++)for(let T=-1;T<=1;T++)for(let w of n.get(`${m+v}:${g+S}:${y+T}`)||[])Math.hypot(h-e[w*3],d-e[w*3+1],c-e[w*3+2])<=a&&(b=Math.min(b,w));if(o.set(u,b),b===u){let v=`${m}:${g}:${y}`,S=n.get(v)||[];S.push(u),n.set(v,S)}}let l=[];for(let u=0;u<r.length;u+=3){let[h,d,c]=r.slice(u,u+3).map(m=>o.get(m)??m);h!==d&&d!==c&&c!==h&&l.push(h,d,c)}return l}var Cce=Io.logoMeshDetail;function g2(e){return typeof e=="number"&&Number.isFinite(e)?Math.max(1,Math.min(4,Math.round(e))):Cce}function Rce(e,t){e.computeBoundingBox();let r=e.boundingBox,i=Math.max(r.max.x-r.min.x,r.max.y-r.min.y,r.max.z-r.min.z,.001),s=g2(t);return{maxEdge:i/(32*s),extraTriangles:16e4*s}}var ZF=Object.freeze({strength:Io.deformStrength,scale:Io.deformScale,seed:Io.deformSeed});function JF(e){if(!Number.isFinite(e)||e<.001||e>.5)throw new RangeError(`Noise feature size ${e} is outside 0.001\u20130.5. Edit this value to load the preset; other settings have not been changed.`);return e}function Nx(e){let t=(r,i,s)=>{let a=e?.[r];return typeof a=="number"&&Number.isFinite(a)?Math.max(i,Math.min(s,a)):ZF[r]};return{strength:t("strength",0,.08),scale:JF(e?.scale??ZF.scale),seed:Math.round(t("seed",0,65535))}}function Ece(e){let{strength:t,scale:r,seed:i}=Nx(e),s=new _ce,a=Lm(i),n=Array.from({length:3},()=>[a()*256,a()*256,a()*256]);function o(l,u,h){let d=n[h],c=l/r+d[0],m=u/r+d[1],g=d[2],y=0,b=1;for(let v=0;v<3;v++)y+=b*s.noise(c,m,g),c=c*2+17.3,m=m*2+9.1,g=g*2+31.7,b*=.5;return y/1.75}return(l,u,h)=>t===0?[l,u,h]:(l+=t*o(u,h,0),u+=t*o(h,l,1),h+=t*o(l,u,2),[l,u,h])}function Pce(e,t,r){let i=t,s=t.length/3+6e3,a=r*r,n=(o,l)=>o<l?`${o}:${l}`:`${l}:${o}`;for(let o=0;o<8;o++){let l=new Map,u=0;for(let d=0;d<i.length;d+=3){let c=i[d],m=i[d+1],g=i[d+2];for(let[y,b]of[[c,m],[m,g],[g,c]]){let v=e[y*3]-e[b*3],S=e[y*3+1]-e[b*3+1],T=e[y*3+2]-e[b*3+2];v*v+S*S+T*T>a&&(l.set(n(y,b),-1),u++)}}if(!l.size||i.length/3+u>s)break;for(let[d]of l){let[c,m]=d.split(":").map(Number),g=e.length/3;e.push((e[c*3]+e[m*3])/2,(e[c*3+1]+e[m*3+1])/2,(e[c*3+2]+e[m*3+2])/2),l.set(d,g)}let h=[];for(let d=0;d<i.length;d+=3){let c=i[d],m=i[d+1],g=i[d+2],y=l.get(n(c,m)),b=l.get(n(m,g)),v=l.get(n(g,c));y!==void 0&&b!==void 0&&v!==void 0?h.push(c,y,v,y,m,b,v,b,g,y,b,v):y!==void 0&&b!==void 0?h.push(m,b,y,c,y,g,y,b,g):b!==void 0&&v!==void 0?h.push(g,v,b,m,b,c,b,v,c):v!==void 0&&y!==void 0?h.push(c,y,v,g,v,m,v,y,m):y!==void 0?h.push(c,y,g,y,m,g):b!==void 0?h.push(m,b,c,b,g,c):v!==void 0?h.push(g,v,m,v,c,m):h.push(c,m,g)}i=h}return i}function Bce(e,t,r=40,i,s){let a=Nx(t);if(a.strength===0)return e;let n=e.clone();for(let y of Object.keys(n.attributes))y!=="position"&&n.deleteAttribute(y);n.clearGroups();let o=U5(n,1e-7);n.dispose();let l=Array.from(o.getAttribute("position").array),u=Array.from(o.index.array);o.dispose();let h=i!==void 0?Mce(a.scale,i):s!==void 0?Rce(e,s):null,d=h?Nce(l,Ace(l,u),h.maxEdge,h.extraTriangles):Pce(l,u,a.scale*.3),c=Ece(a);for(let y=0;y<l.length;y+=3){let b=c(l[y],l[y+1],l[y+2]);l[y]=b[0],l[y+1]=b[1],l[y+2]=b[2]}let m=new ps;m.setAttribute("position",new tr(l,3)),m.setIndex(d);let g=z5(m,Bt.degToRad(r));return g!==m&&m.dispose(),g.center(),g.computeBoundingBox(),g.computeBoundingSphere(),g}var QF=1.5,Ice=Object.freeze({logoBreak:1.5,form1:3.8,break1:10.375,form2:12.675,break2:18.5,fadeOut:22}),y2=e=>e.fadeOut+QF;function Fce(e,t){let r=.3+t+.6,i=e.logoBreak,s=Math.max(e.form1,i+r),a=Math.max(e.break1,s+2.8+.65),n=Math.max(e.form2,a+r),o=Math.max(e.break2,n+2.8+.65),l=Math.max(e.fadeOut,o+r);return{logoBreak:i,form1:s,break1:a,form2:n,break2:o,fadeOut:l}}String.prototype.codePointAt||(function(){var e=(function(){try{var r={},i=Object.defineProperty,s=i(r,r,r)&&i}catch{}return s})(),t=function(r){if(this==null)throw TypeError();var i=String(this),s=i.length,a=r?Number(r):0;if(a!=a&&(a=0),!(a<0||a>=s)){var n=i.charCodeAt(a),o;return n>=55296&&n<=56319&&s>a+1&&(o=i.charCodeAt(a+1),o>=56320&&o<=57343)?(n-55296)*1024+o-56320+65536:n}};e?e(String.prototype,"codePointAt",{value:t,configurable:!0,writable:!0}):String.prototype.codePointAt=t})();var x2=0,KF=-3;function sf(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Lce(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new sf,this.dtree=new sf}var eL=new sf,tL=new sf,v2=new Uint8Array(30),b2=new Uint16Array(30),rL=new Uint8Array(30),iL=new Uint16Array(30),kce=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sL=new sf,qn=new Uint8Array(320);function aL(e,t,r,i){var s,a;for(s=0;s<r;++s)e[s]=0;for(s=0;s<30-r;++s)e[s+r]=s/r|0;for(a=i,s=0;s<30;++s)t[s]=a,a+=1<<e[s]}function Dce(e,t){var r;for(r=0;r<7;++r)e.table[r]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,r=0;r<24;++r)e.trans[r]=256+r;for(r=0;r<144;++r)e.trans[24+r]=r;for(r=0;r<8;++r)e.trans[168+r]=280+r;for(r=0;r<112;++r)e.trans[176+r]=144+r;for(r=0;r<5;++r)t.table[r]=0;for(t.table[5]=32,r=0;r<32;++r)t.trans[r]=r}var nL=new Uint16Array(16);function T2(e,t,r,i){var s,a;for(s=0;s<16;++s)e.table[s]=0;for(s=0;s<i;++s)e.table[t[r+s]]++;for(e.table[0]=0,a=0,s=0;s<16;++s)nL[s]=a,a+=e.table[s];for(s=0;s<i;++s)t[r+s]&&(e.trans[nL[t[r+s]]++]=s)}function Oce(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=e.tag&1;return e.tag>>>=1,t}function Yn(e,t,r){if(!t)return r;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var i=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,i+r}function S2(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=0,i=0,s=0,a=e.tag;do i=2*i+(a&1),a>>>=1,++s,r+=t.table[s],i-=t.table[s];while(i>=0);return e.tag=a,e.bitcount-=s,t.trans[r+i]}function Uce(e,t,r){var i,s,a,n,o,l;for(i=Yn(e,5,257),s=Yn(e,5,1),a=Yn(e,4,4),n=0;n<19;++n)qn[n]=0;for(n=0;n<a;++n){var u=Yn(e,3,0);qn[kce[n]]=u}for(T2(sL,qn,0,19),o=0;o<i+s;){var h=S2(e,sL);switch(h){case 16:var d=qn[o-1];for(l=Yn(e,2,3);l;--l)qn[o++]=d;break;case 17:for(l=Yn(e,3,3);l;--l)qn[o++]=0;break;case 18:for(l=Yn(e,7,11);l;--l)qn[o++]=0;break;default:qn[o++]=h;break}}T2(t,qn,0,i),T2(r,qn,i,s)}function oL(e,t,r){for(;;){var i=S2(e,t);if(i===256)return x2;if(i<256)e.dest[e.destLen++]=i;else{var s,a,n,o;for(i-=257,s=Yn(e,v2[i],b2[i]),a=S2(e,r),n=e.destLen-Yn(e,rL[a],iL[a]),o=n;o<n+s;++o)e.dest[e.destLen++]=e.dest[o]}}}function zce(e){for(var t,r,i;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if(t=e.source[e.sourceIndex+1],t=256*t+e.source[e.sourceIndex],r=e.source[e.sourceIndex+3],r=256*r+e.source[e.sourceIndex+2],t!==(~r&65535))return KF;for(e.sourceIndex+=4,i=t;i;--i)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,x2}function Vce(e,t){var r=new Lce(e,t),i,s,a;do{switch(i=Oce(r),s=Yn(r,2,0),s){case 0:a=zce(r);break;case 1:a=oL(r,eL,tL);break;case 2:Uce(r,r.ltree,r.dtree),a=oL(r,r.ltree,r.dtree);break;default:a=KF}if(a!==x2)throw new Error("Data error")}while(!i);return r.destLen<r.dest.length?typeof r.dest.slice=="function"?r.dest.slice(0,r.destLen):r.dest.subarray(0,r.destLen):r.dest}Dce(eL,tL),aL(v2,b2,4,3),aL(rL,iL,2,1),v2[28]=0,b2[28]=258;var Gce=Vce;function Rc(e,t,r,i,s){return Math.pow(1-s,3)*e+3*Math.pow(1-s,2)*s*t+3*(1-s)*Math.pow(s,2)*r+Math.pow(s,3)*i}function $o(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}$o.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},$o.prototype.addPoint=function(e,t){typeof e=="number"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),typeof t=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))},$o.prototype.addX=function(e){this.addPoint(e,null)},$o.prototype.addY=function(e){this.addPoint(null,e)},$o.prototype.addBezier=function(e,t,r,i,s,a,n,o){var l=[e,t],u=[r,i],h=[s,a],d=[n,o];this.addPoint(e,t),this.addPoint(n,o);for(var c=0;c<=1;c++){var m=6*l[c]-12*u[c]+6*h[c],g=-3*l[c]+9*u[c]-9*h[c]+3*d[c],y=3*u[c]-3*l[c];if(g===0){if(m===0)continue;var b=-y/m;0<b&&b<1&&(c===0&&this.addX(Rc(l[c],u[c],h[c],d[c],b)),c===1&&this.addY(Rc(l[c],u[c],h[c],d[c],b)));continue}var v=Math.pow(m,2)-4*y*g;if(!(v<0)){var S=(-m+Math.sqrt(v))/(2*g);0<S&&S<1&&(c===0&&this.addX(Rc(l[c],u[c],h[c],d[c],S)),c===1&&this.addY(Rc(l[c],u[c],h[c],d[c],S)));var T=(-m-Math.sqrt(v))/(2*g);0<T&&T<1&&(c===0&&this.addX(Rc(l[c],u[c],h[c],d[c],T)),c===1&&this.addY(Rc(l[c],u[c],h[c],d[c],T)))}}},$o.prototype.addQuad=function(e,t,r,i,s,a){var n=e+.6666666666666666*(r-e),o=t+2/3*(i-t),l=n+1/3*(s-e),u=o+1/3*(a-t);this.addBezier(e,t,n,o,l,u,s,a)};function di(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}di.prototype.moveTo=function(e,t){this.commands.push({type:"M",x:e,y:t})},di.prototype.lineTo=function(e,t){this.commands.push({type:"L",x:e,y:t})},di.prototype.curveTo=di.prototype.bezierCurveTo=function(e,t,r,i,s,a){this.commands.push({type:"C",x1:e,y1:t,x2:r,y2:i,x:s,y:a})},di.prototype.quadTo=di.prototype.quadraticCurveTo=function(e,t,r,i){this.commands.push({type:"Q",x1:e,y1:t,x:r,y:i})},di.prototype.close=di.prototype.closePath=function(){this.commands.push({type:"Z"})},di.prototype.extend=function(e){if(e.commands)e=e.commands;else if(e instanceof $o){var t=e;this.moveTo(t.x1,t.y1),this.lineTo(t.x2,t.y1),this.lineTo(t.x2,t.y2),this.lineTo(t.x1,t.y2),this.close();return}Array.prototype.push.apply(this.commands,e)},di.prototype.getBoundingBox=function(){for(var e=new $o,t=0,r=0,i=0,s=0,a=0;a<this.commands.length;a++){var n=this.commands[a];switch(n.type){case"M":e.addPoint(n.x,n.y),t=i=n.x,r=s=n.y;break;case"L":e.addPoint(n.x,n.y),i=n.x,s=n.y;break;case"Q":e.addQuad(i,s,n.x1,n.y1,n.x,n.y),i=n.x,s=n.y;break;case"C":e.addBezier(i,s,n.x1,n.y1,n.x2,n.y2,n.x,n.y),i=n.x,s=n.y;break;case"Z":i=t,s=r;break;default:throw new Error("Unexpected path command "+n.type)}}return e.isEmpty()&&e.addPoint(0,0),e},di.prototype.draw=function(e){e.beginPath();for(var t=0;t<this.commands.length;t+=1){var r=this.commands[t];r.type==="M"?e.moveTo(r.x,r.y):r.type==="L"?e.lineTo(r.x,r.y):r.type==="C"?e.bezierCurveTo(r.x1,r.y1,r.x2,r.y2,r.x,r.y):r.type==="Q"?e.quadraticCurveTo(r.x1,r.y1,r.x,r.y):r.type==="Z"&&e.closePath()}this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.stroke())},di.prototype.toPathData=function(e){e=e!==void 0?e:2;function t(n){return Math.round(n)===n?""+Math.round(n):n.toFixed(e)}function r(){for(var n=arguments,o="",l=0;l<arguments.length;l+=1){var u=n[l];u>=0&&l>0&&(o+=" "),o+=t(u)}return o}for(var i="",s=0;s<this.commands.length;s+=1){var a=this.commands[s];a.type==="M"?i+="M"+r(a.x,a.y):a.type==="L"?i+="L"+r(a.x,a.y):a.type==="C"?i+="C"+r(a.x1,a.y1,a.x2,a.y2,a.x,a.y):a.type==="Q"?i+="Q"+r(a.x1,a.y1,a.x,a.y):a.type==="Z"&&(i+="Z")}return i},di.prototype.toSVG=function(e){var t='<path d="';return t+=this.toPathData(e),t+='"',this.fill&&this.fill!=="black"&&(this.fill===null?t+=' fill="none"':t+=' fill="'+this.fill+'"'),this.stroke&&(t+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),t+="/>",t},di.prototype.toDOMElement=function(e){var t=this.toPathData(e),r=document.createElementNS("http://www.w3.org/2000/svg","path");return r.setAttribute("d",t),r};function lL(e){throw new Error(e)}function uL(e,t){e||lL(t)}var bt={fail:lL,argument:uL,assert:uL},hL=32768,dL=2147483648,Ec={},He={},wt={};function rn(e){return function(){return e}}He.BYTE=function(e){return bt.argument(e>=0&&e<=255,"Byte value should be between 0 and 255."),[e]},wt.BYTE=rn(1),He.CHAR=function(e){return[e.charCodeAt(0)]},wt.CHAR=rn(1),He.CHARARRAY=function(e){typeof e>"u"&&(e="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var t=[],r=0;r<e.length;r+=1)t[r]=e.charCodeAt(r);return t},wt.CHARARRAY=function(e){return typeof e>"u"?0:e.length},He.USHORT=function(e){return[e>>8&255,e&255]},wt.USHORT=rn(2),He.SHORT=function(e){return e>=hL&&(e=-(2*hL-e)),[e>>8&255,e&255]},wt.SHORT=rn(2),He.UINT24=function(e){return[e>>16&255,e>>8&255,e&255]},wt.UINT24=rn(3),He.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]},wt.ULONG=rn(4),He.LONG=function(e){return e>=dL&&(e=-(2*dL-e)),[e>>24&255,e>>16&255,e>>8&255,e&255]},wt.LONG=rn(4),He.FIXED=He.ULONG,wt.FIXED=wt.ULONG,He.FWORD=He.SHORT,wt.FWORD=wt.SHORT,He.UFWORD=He.USHORT,wt.UFWORD=wt.USHORT,He.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,e&255]},wt.LONGDATETIME=rn(8),He.TAG=function(e){return bt.argument(e.length===4,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},wt.TAG=rn(4),He.Card8=He.BYTE,wt.Card8=wt.BYTE,He.Card16=He.USHORT,wt.Card16=wt.USHORT,He.OffSize=He.BYTE,wt.OffSize=wt.BYTE,He.SID=He.USHORT,wt.SID=wt.USHORT,He.NUMBER=function(e){return e>=-107&&e<=107?[e+139]:e>=108&&e<=1131?(e=e-108,[(e>>8)+247,e&255]):e>=-1131&&e<=-108?(e=-e-108,[(e>>8)+251,e&255]):e>=-32768&&e<=32767?He.NUMBER16(e):He.NUMBER32(e)},wt.NUMBER=function(e){return He.NUMBER(e).length},He.NUMBER16=function(e){return[28,e>>8&255,e&255]},wt.NUMBER16=rn(3),He.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,e&255]},wt.NUMBER32=rn(5),He.REAL=function(e){var t=e.toString(),r=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(r){var i=parseFloat("1e"+((r[2]?+r[2]:0)+r[1].length));t=(Math.round(e*i)/i).toString()}for(var s="",a=0,n=t.length;a<n;a+=1){var o=t[a];o==="e"?s+=t[++a]==="-"?"c":"b":o==="."?s+="a":o==="-"?s+="e":s+=o}s+=s.length&1?"f":"ff";for(var l=[30],u=0,h=s.length;u<h;u+=2)l.push(parseInt(s.substr(u,2),16));return l},wt.REAL=function(e){return He.REAL(e).length},He.NAME=He.CHARARRAY,wt.NAME=wt.CHARARRAY,He.STRING=He.CHARARRAY,wt.STRING=wt.CHARARRAY,Ec.UTF8=function(e,t,r){for(var i=[],s=r,a=0;a<s;a++,t+=1)i[a]=e.getUint8(t);return String.fromCharCode.apply(null,i)},Ec.UTF16=function(e,t,r){for(var i=[],s=r/2,a=0;a<s;a++,t+=2)i[a]=e.getUint16(t);return String.fromCharCode.apply(null,i)},He.UTF16=function(e){for(var t=[],r=0;r<e.length;r+=1){var i=e.charCodeAt(r);t[t.length]=i>>8&255,t[t.length]=i&255}return t},wt.UTF16=function(e){return e.length*2};var _2={"x-mac-croatian":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\u0160\u2122\xB4\xA8\u2260\u017D\xD8\u221E\xB1\u2264\u2265\u2206\xB5\u2202\u2211\u220F\u0161\u222B\xAA\xBA\u03A9\u017E\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u0106\xAB\u010C\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u0110\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\uF8FF\xA9\u2044\u20AC\u2039\u203A\xC6\xBB\u2013\xB7\u201A\u201E\u2030\xC2\u0107\xC1\u010D\xC8\xCD\xCE\xCF\xCC\xD3\xD4\u0111\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u03C0\xCB\u02DA\xB8\xCA\xE6\u02C7","x-mac-cyrillic":"\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u2020\xB0\u0490\xA3\xA7\u2022\xB6\u0406\xAE\xA9\u2122\u0402\u0452\u2260\u0403\u0453\u221E\xB1\u2264\u2265\u0456\xB5\u0491\u0408\u0404\u0454\u0407\u0457\u0409\u0459\u040A\u045A\u0458\u0405\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\u040B\u045B\u040C\u045C\u0455\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u201E\u040E\u045E\u040F\u045F\u2116\u0401\u0451\u044F\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E","x-mac-gaelic":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u1E02\xB1\u2264\u2265\u1E03\u010A\u010B\u1E0A\u1E0B\u1E1E\u1E1F\u0120\u0121\u1E40\xE6\xF8\u1E41\u1E56\u1E57\u027C\u0192\u017F\u1E60\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\u1E61\u1E9B\xFF\u0178\u1E6A\u20AC\u2039\u203A\u0176\u0177\u1E6B\xB7\u1EF2\u1EF3\u204A\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\u2663\xD2\xDA\xDB\xD9\u0131\xDD\xFD\u0174\u0175\u1E84\u1E85\u1E80\u1E81\u1E82\u1E83","x-mac-greek":"\xC4\xB9\xB2\xC9\xB3\xD6\xDC\u0385\xE0\xE2\xE4\u0384\xA8\xE7\xE9\xE8\xEA\xEB\xA3\u2122\xEE\xEF\u2022\xBD\u2030\xF4\xF6\xA6\u20AC\xF9\xFB\xFC\u2020\u0393\u0394\u0398\u039B\u039E\u03A0\xDF\xAE\xA9\u03A3\u03AA\xA7\u2260\xB0\xB7\u0391\xB1\u2264\u2265\xA5\u0392\u0395\u0396\u0397\u0399\u039A\u039C\u03A6\u03AB\u03A8\u03A9\u03AC\u039D\xAC\u039F\u03A1\u2248\u03A4\xAB\xBB\u2026\xA0\u03A5\u03A7\u0386\u0388\u0153\u2013\u2015\u201C\u201D\u2018\u2019\xF7\u0389\u038A\u038C\u038E\u03AD\u03AE\u03AF\u03CC\u038F\u03CD\u03B1\u03B2\u03C8\u03B4\u03B5\u03C6\u03B3\u03B7\u03B9\u03BE\u03BA\u03BB\u03BC\u03BD\u03BF\u03C0\u03CE\u03C1\u03C3\u03C4\u03B8\u03C9\u03C2\u03C7\u03C5\u03B6\u03CA\u03CB\u0390\u03B0\xAD","x-mac-icelandic":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\xDD\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\xD0\xF0\xDE\xFE\xFD\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-inuit":"\u1403\u1404\u1405\u1406\u140A\u140B\u1431\u1432\u1433\u1434\u1438\u1439\u1449\u144E\u144F\u1450\u1451\u1455\u1456\u1466\u146D\u146E\u146F\u1470\u1472\u1473\u1483\u148B\u148C\u148D\u148E\u1490\u1491\xB0\u14A1\u14A5\u14A6\u2022\xB6\u14A7\xAE\xA9\u2122\u14A8\u14AA\u14AB\u14BB\u14C2\u14C3\u14C4\u14C5\u14C7\u14C8\u14D0\u14EF\u14F0\u14F1\u14F2\u14F4\u14F5\u1505\u14D5\u14D6\u14D7\u14D8\u14DA\u14DB\u14EA\u1528\u1529\u152A\u152B\u152D\u2026\xA0\u152E\u153E\u1555\u1556\u1557\u2013\u2014\u201C\u201D\u2018\u2019\u1558\u1559\u155A\u155D\u1546\u1547\u1548\u1549\u154B\u154C\u1550\u157F\u1580\u1581\u1582\u1583\u1584\u1585\u158F\u1590\u1591\u1592\u1593\u1594\u1595\u1671\u1672\u1673\u1674\u1675\u1676\u1596\u15A0\u15A1\u15A2\u15A3\u15A4\u15A5\u15A6\u157C\u0141\u0142","x-mac-ce":"\xC4\u0100\u0101\xC9\u0104\xD6\xDC\xE1\u0105\u010C\xE4\u010D\u0106\u0107\xE9\u0179\u017A\u010E\xED\u010F\u0112\u0113\u0116\xF3\u0117\xF4\xF6\xF5\xFA\u011A\u011B\xFC\u2020\xB0\u0118\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\u0119\xA8\u2260\u0123\u012E\u012F\u012A\u2264\u2265\u012B\u0136\u2202\u2211\u0142\u013B\u013C\u013D\u013E\u0139\u013A\u0145\u0146\u0143\xAC\u221A\u0144\u0147\u2206\xAB\xBB\u2026\xA0\u0148\u0150\xD5\u0151\u014C\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\u014D\u0154\u0155\u0158\u2039\u203A\u0159\u0156\u0157\u0160\u201A\u201E\u0161\u015A\u015B\xC1\u0164\u0165\xCD\u017D\u017E\u016A\xD3\xD4\u016B\u016E\xDA\u016F\u0170\u0171\u0172\u0173\xDD\xFD\u0137\u017B\u0141\u017C\u0122\u02C7",macintosh:"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\u2039\u203A\uFB01\uFB02\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-romanian":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\u0102\u0218\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\u0103\u0219\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u2044\u20AC\u2039\u203A\u021A\u021B\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\u0131\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7","x-mac-turkish":"\xC4\xC5\xC7\xC9\xD1\xD6\xDC\xE1\xE0\xE2\xE4\xE3\xE5\xE7\xE9\xE8\xEA\xEB\xED\xEC\xEE\xEF\xF1\xF3\xF2\xF4\xF6\xF5\xFA\xF9\xFB\xFC\u2020\xB0\xA2\xA3\xA7\u2022\xB6\xDF\xAE\xA9\u2122\xB4\xA8\u2260\xC6\xD8\u221E\xB1\u2264\u2265\xA5\xB5\u2202\u2211\u220F\u03C0\u222B\xAA\xBA\u03A9\xE6\xF8\xBF\xA1\xAC\u221A\u0192\u2248\u2206\xAB\xBB\u2026\xA0\xC0\xC3\xD5\u0152\u0153\u2013\u2014\u201C\u201D\u2018\u2019\xF7\u25CA\xFF\u0178\u011E\u011F\u0130\u0131\u015E\u015F\u2021\xB7\u201A\u201E\u2030\xC2\xCA\xC1\xCB\xC8\xCD\xCE\xCF\xCC\xD3\xD4\uF8FF\xD2\xDA\xDB\xD9\uF8A0\u02C6\u02DC\xAF\u02D8\u02D9\u02DA\xB8\u02DD\u02DB\u02C7"};Ec.MACSTRING=function(e,t,r,i){var s=_2[i];if(s!==void 0){for(var a="",n=0;n<r;n++){var o=e.getUint8(t+n);o<=127?a+=String.fromCharCode(o):a+=s[o&127]}return a}};var Ax=typeof WeakMap=="function"&&new WeakMap,Cx,Wce=function(e){if(!Cx){Cx={};for(var t in _2)Cx[t]=new String(t)}var r=Cx[e];if(r!==void 0){if(Ax){var i=Ax.get(r);if(i!==void 0)return i}var s=_2[e];if(s!==void 0){for(var a={},n=0;n<s.length;n++)a[s.charCodeAt(n)]=n+128;return Ax&&Ax.set(r,a),a}}};He.MACSTRING=function(e,t){var r=Wce(t);if(r!==void 0){for(var i=[],s=0;s<e.length;s++){var a=e.charCodeAt(s);if(a>=128&&(a=r[a],a===void 0))return;i[s]=a}return i}},wt.MACSTRING=function(e,t){var r=He.MACSTRING(e,t);return r!==void 0?r.length:0};function w2(e){return e>=-128&&e<=127}function jce(e,t,r){for(var i=0,s=e.length;t<s&&i<64&&e[t]===0;)++t,++i;return r.push(128|i-1),t}function Hce(e,t,r){for(var i=0,s=e.length,a=t;a<s&&i<64;){var n=e[a];if(!w2(n)||n===0&&a+1<s&&e[a+1]===0)break;++a,++i}r.push(i-1);for(var o=t;o<a;++o)r.push(e[o]+256&255);return a}function Xce(e,t,r){for(var i=0,s=e.length,a=t;a<s&&i<64;){var n=e[a];if(n===0||w2(n)&&a+1<s&&w2(e[a+1]))break;++a,++i}r.push(64|i-1);for(var o=t;o<a;++o){var l=e[o];r.push(l+65536>>8&255,l+256&255)}return a}He.VARDELTAS=function(e){for(var t=0,r=[];t<e.length;){var i=e[t];i===0?t=jce(e,t,r):i>=-128&&i<=127?t=Hce(e,t,r):t=Xce(e,t,r)}return r},He.INDEX=function(e){for(var t=1,r=[t],i=[],s=0;s<e.length;s+=1){var a=He.OBJECT(e[s]);Array.prototype.push.apply(i,a),t+=a.length,r.push(t)}if(i.length===0)return[0,0];for(var n=[],o=1+Math.floor(Math.log(t)/Math.log(2))/8|0,l=[void 0,He.BYTE,He.USHORT,He.UINT24,He.ULONG][o],u=0;u<r.length;u+=1){var h=l(r[u]);Array.prototype.push.apply(n,h)}return Array.prototype.concat(He.Card16(e.length),He.OffSize(o),n,i)},wt.INDEX=function(e){return He.INDEX(e).length},He.DICT=function(e){for(var t=[],r=Object.keys(e),i=r.length,s=0;s<i;s+=1){var a=parseInt(r[s],0),n=e[a];t=t.concat(He.OPERAND(n.value,n.type)),t=t.concat(He.OPERATOR(a))}return t},wt.DICT=function(e){return He.DICT(e).length},He.OPERATOR=function(e){return e<1200?[e]:[12,e-1200]},He.OPERAND=function(e,t){var r=[];if(Array.isArray(t))for(var i=0;i<t.length;i+=1)bt.argument(e.length===t.length,"Not enough arguments given for type"+t),r=r.concat(He.OPERAND(e[i],t[i]));else if(t==="SID")r=r.concat(He.NUMBER(e));else if(t==="offset")r=r.concat(He.NUMBER32(e));else if(t==="number")r=r.concat(He.NUMBER(e));else if(t==="real")r=r.concat(He.REAL(e));else throw new Error("Unknown operand type "+t);return r},He.OP=He.BYTE,wt.OP=wt.BYTE;var Rx=typeof WeakMap=="function"&&new WeakMap;He.CHARSTRING=function(e){if(Rx){var t=Rx.get(e);if(t!==void 0)return t}for(var r=[],i=e.length,s=0;s<i;s+=1){var a=e[s];r=r.concat(He[a.type](a.value))}return Rx&&Rx.set(e,r),r},wt.CHARSTRING=function(e){return He.CHARSTRING(e).length},He.OBJECT=function(e){var t=He[e.type];return bt.argument(t!==void 0,"No encoding function for type "+e.type),t(e.value)},wt.OBJECT=function(e){var t=wt[e.type];return bt.argument(t!==void 0,"No sizeOf function for type "+e.type),t(e.value)},He.TABLE=function(e){for(var t=[],r=e.fields.length,i=[],s=[],a=0;a<r;a+=1){var n=e.fields[a],o=He[n.type];bt.argument(o!==void 0,"No encoding function for field type "+n.type+" ("+n.name+")");var l=e[n.name];l===void 0&&(l=n.value);var u=o(l);n.type==="TABLE"?(s.push(t.length),t=t.concat([0,0]),i.push(u)):t=t.concat(u)}for(var h=0;h<i.length;h+=1){var d=s[h],c=t.length;bt.argument(c<65536,"Table "+e.tableName+" too big."),t[d]=c>>8,t[d+1]=c&255,t=t.concat(i[h])}return t},wt.TABLE=function(e){for(var t=0,r=e.fields.length,i=0;i<r;i+=1){var s=e.fields[i],a=wt[s.type];bt.argument(a!==void 0,"No sizeOf function for field type "+s.type+" ("+s.name+")");var n=e[s.name];n===void 0&&(n=s.value),t+=a(n),s.type==="TABLE"&&(t+=2)}return t},He.RECORD=He.TABLE,wt.RECORD=wt.TABLE,He.LITERAL=function(e){return e},wt.LITERAL=function(e){return e.length};function Ii(e,t,r){if(t.length&&(t[0].name!=="coverageFormat"||t[0].value===1))for(var i=0;i<t.length;i+=1){var s=t[i];this[s.name]=s.value}if(this.tableName=e,this.fields=t,r)for(var a=Object.keys(r),n=0;n<a.length;n+=1){var o=a[n],l=r[o];this[o]!==void 0&&(this[o]=l)}}Ii.prototype.encode=function(){return He.TABLE(this)},Ii.prototype.sizeOf=function(){return wt.TABLE(this)};function af(e,t,r){r===void 0&&(r=t.length);var i=new Array(t.length+1);i[0]={name:e+"Count",type:"USHORT",value:r};for(var s=0;s<t.length;s++)i[s+1]={name:e+s,type:"USHORT",value:t[s]};return i}function M2(e,t,r){var i=t.length,s=new Array(i+1);s[0]={name:e+"Count",type:"USHORT",value:i};for(var a=0;a<i;a++)s[a+1]={name:e+a,type:"TABLE",value:r(t[a],a)};return s}function nf(e,t,r){var i=t.length,s=[];s[0]={name:e+"Count",type:"USHORT",value:i};for(var a=0;a<i;a++)s=s.concat(r(t[a],a));return s}function Ex(e){e.format===1?Ii.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(af("glyph",e.glyphs))):e.format===2?Ii.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:2}].concat(nf("rangeRecord",e.ranges,function(t){return[{name:"startGlyphID",type:"USHORT",value:t.start},{name:"endGlyphID",type:"USHORT",value:t.end},{name:"startCoverageIndex",type:"USHORT",value:t.index}]}))):bt.assert(!1,"Coverage format must be 1 or 2.")}Ex.prototype=Object.create(Ii.prototype),Ex.prototype.constructor=Ex;function Px(e){Ii.call(this,"scriptListTable",nf("scriptRecord",e,function(t,r){var i=t.script,s=i.defaultLangSys;return bt.assert(!!s,"Unable to write GSUB: script "+t.tag+" has no default language system."),[{name:"scriptTag"+r,type:"TAG",value:t.tag},{name:"script"+r,type:"TABLE",value:new Ii("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new Ii("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:s.reqFeatureIndex}].concat(af("featureIndex",s.featureIndexes)))}].concat(nf("langSys",i.langSysRecords,function(a,n){var o=a.langSys;return[{name:"langSysTag"+n,type:"TAG",value:a.tag},{name:"langSys"+n,type:"TABLE",value:new Ii("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:o.reqFeatureIndex}].concat(af("featureIndex",o.featureIndexes)))}]})))}]}))}Px.prototype=Object.create(Ii.prototype),Px.prototype.constructor=Px;function Bx(e){Ii.call(this,"featureListTable",nf("featureRecord",e,function(t,r){var i=t.feature;return[{name:"featureTag"+r,type:"TAG",value:t.tag},{name:"feature"+r,type:"TABLE",value:new Ii("featureTable",[{name:"featureParams",type:"USHORT",value:i.featureParams}].concat(af("lookupListIndex",i.lookupListIndexes)))}]}))}Bx.prototype=Object.create(Ii.prototype),Bx.prototype.constructor=Bx;function Ix(e,t){Ii.call(this,"lookupListTable",M2("lookup",e,function(r){var i=t[r.lookupType];return bt.assert(!!i,"Unable to write GSUB lookup type "+r.lookupType+" tables."),new Ii("lookupTable",[{name:"lookupType",type:"USHORT",value:r.lookupType},{name:"lookupFlag",type:"USHORT",value:r.lookupFlag}].concat(M2("subtable",r.subtables,i)))}))}Ix.prototype=Object.create(Ii.prototype),Ix.prototype.constructor=Ix;var rt={Table:Ii,Record:Ii,Coverage:Ex,ScriptList:Px,FeatureList:Bx,LookupList:Ix,ushortList:af,tableList:M2,recordList:nf};function cL(e,t){return e.getUint8(t)}function Fx(e,t){return e.getUint16(t,!1)}function $ce(e,t){return e.getInt16(t,!1)}function N2(e,t){return e.getUint32(t,!1)}function pL(e,t){var r=e.getInt16(t,!1),i=e.getUint16(t+2,!1);return r+i/65535}function qce(e,t){for(var r="",i=t;i<t+4;i+=1)r+=String.fromCharCode(e.getInt8(i));return r}function Yce(e,t,r){for(var i=0,s=0;s<r;s+=1)i<<=8,i+=e.getUint8(t+s);return i}function Zce(e,t,r){for(var i=[],s=t;s<r;s+=1)i.push(e.getUint8(s));return i}function Jce(e){for(var t="",r=0;r<e.length;r+=1)t+=String.fromCharCode(e[r]);return t}var Qce={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function ve(e,t){this.data=e,this.offset=t,this.relativeOffset=0}ve.prototype.parseByte=function(){var e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},ve.prototype.parseChar=function(){var e=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},ve.prototype.parseCard8=ve.prototype.parseByte,ve.prototype.parseUShort=function(){var e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},ve.prototype.parseCard16=ve.prototype.parseUShort,ve.prototype.parseSID=ve.prototype.parseUShort,ve.prototype.parseOffset16=ve.prototype.parseUShort,ve.prototype.parseShort=function(){var e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},ve.prototype.parseF2Dot14=function(){var e=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,e},ve.prototype.parseULong=function(){var e=N2(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},ve.prototype.parseOffset32=ve.prototype.parseULong,ve.prototype.parseFixed=function(){var e=pL(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},ve.prototype.parseString=function(e){var t=this.data,r=this.offset+this.relativeOffset,i="";this.relativeOffset+=e;for(var s=0;s<e;s++)i+=String.fromCharCode(t.getUint8(r+s));return i},ve.prototype.parseTag=function(){return this.parseString(4)},ve.prototype.parseLongDateTime=function(){var e=N2(this.data,this.offset+this.relativeOffset+4);return e-=2082844800,this.relativeOffset+=8,e},ve.prototype.parseVersion=function(e){var t=Fx(this.data,this.offset+this.relativeOffset),r=Fx(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,e===void 0&&(e=4096),t+r/e/10},ve.prototype.skip=function(e,t){t===void 0&&(t=1),this.relativeOffset+=Qce[e]*t},ve.prototype.parseULongList=function(e){e===void 0&&(e=this.parseULong());for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,s=0;s<e;s++)t[s]=r.getUint32(i),i+=4;return this.relativeOffset+=e*4,t},ve.prototype.parseOffset16List=ve.prototype.parseUShortList=function(e){e===void 0&&(e=this.parseUShort());for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,s=0;s<e;s++)t[s]=r.getUint16(i),i+=2;return this.relativeOffset+=e*2,t},ve.prototype.parseShortList=function(e){for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,s=0;s<e;s++)t[s]=r.getInt16(i),i+=2;return this.relativeOffset+=e*2,t},ve.prototype.parseByteList=function(e){for(var t=new Array(e),r=this.data,i=this.offset+this.relativeOffset,s=0;s<e;s++)t[s]=r.getUint8(i++);return this.relativeOffset+=e,t},ve.prototype.parseList=function(e,t){t||(t=e,e=this.parseUShort());for(var r=new Array(e),i=0;i<e;i++)r[i]=t.call(this);return r},ve.prototype.parseList32=function(e,t){t||(t=e,e=this.parseULong());for(var r=new Array(e),i=0;i<e;i++)r[i]=t.call(this);return r},ve.prototype.parseRecordList=function(e,t){t||(t=e,e=this.parseUShort());for(var r=new Array(e),i=Object.keys(t),s=0;s<e;s++){for(var a={},n=0;n<i.length;n++){var o=i[n],l=t[o];a[o]=l.call(this)}r[s]=a}return r},ve.prototype.parseRecordList32=function(e,t){t||(t=e,e=this.parseULong());for(var r=new Array(e),i=Object.keys(t),s=0;s<e;s++){for(var a={},n=0;n<i.length;n++){var o=i[n],l=t[o];a[o]=l.call(this)}r[s]=a}return r},ve.prototype.parseStruct=function(e){if(typeof e=="function")return e.call(this);for(var t=Object.keys(e),r={},i=0;i<t.length;i++){var s=t[i],a=e[s];r[s]=a.call(this)}return r},ve.prototype.parseValueRecord=function(e){if(e===void 0&&(e=this.parseUShort()),e!==0){var t={};return e&1&&(t.xPlacement=this.parseShort()),e&2&&(t.yPlacement=this.parseShort()),e&4&&(t.xAdvance=this.parseShort()),e&8&&(t.yAdvance=this.parseShort()),e&16&&(t.xPlaDevice=void 0,this.parseShort()),e&32&&(t.yPlaDevice=void 0,this.parseShort()),e&64&&(t.xAdvDevice=void 0,this.parseShort()),e&128&&(t.yAdvDevice=void 0,this.parseShort()),t}},ve.prototype.parseValueRecordList=function(){for(var e=this.parseUShort(),t=this.parseUShort(),r=new Array(t),i=0;i<t;i++)r[i]=this.parseValueRecord(e);return r},ve.prototype.parsePointer=function(e){var t=this.parseOffset16();if(t>0)return new ve(this.data,this.offset+t).parseStruct(e)},ve.prototype.parsePointer32=function(e){var t=this.parseOffset32();if(t>0)return new ve(this.data,this.offset+t).parseStruct(e)},ve.prototype.parseListOfLists=function(e){for(var t=this.parseOffset16List(),r=t.length,i=this.relativeOffset,s=new Array(r),a=0;a<r;a++){var n=t[a];if(n===0){s[a]=void 0;continue}if(this.relativeOffset=n,e){for(var o=this.parseOffset16List(),l=new Array(o.length),u=0;u<o.length;u++)this.relativeOffset=n+o[u],l[u]=e.call(this);s[a]=l}else s[a]=this.parseUShortList()}return this.relativeOffset=i,s},ve.prototype.parseCoverage=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort(),r=this.parseUShort();if(t===1)return{format:1,glyphs:this.parseUShortList(r)};if(t===2){for(var i=new Array(r),s=0;s<r;s++)i[s]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:i}}throw new Error("0x"+e.toString(16)+": Coverage format must be 1 or 2.")},ve.prototype.parseClassDef=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(t===2)return{format:2,ranges:this.parseRecordList({start:ve.uShort,end:ve.uShort,classId:ve.uShort})};throw new Error("0x"+e.toString(16)+": ClassDef format must be 1 or 2.")},ve.list=function(e,t){return function(){return this.parseList(e,t)}},ve.list32=function(e,t){return function(){return this.parseList32(e,t)}},ve.recordList=function(e,t){return function(){return this.parseRecordList(e,t)}},ve.recordList32=function(e,t){return function(){return this.parseRecordList32(e,t)}},ve.pointer=function(e){return function(){return this.parsePointer(e)}},ve.pointer32=function(e){return function(){return this.parsePointer32(e)}},ve.tag=ve.prototype.parseTag,ve.byte=ve.prototype.parseByte,ve.uShort=ve.offset16=ve.prototype.parseUShort,ve.uShortList=ve.prototype.parseUShortList,ve.uLong=ve.offset32=ve.prototype.parseULong,ve.uLongList=ve.prototype.parseULongList,ve.struct=ve.prototype.parseStruct,ve.coverage=ve.prototype.parseCoverage,ve.classDef=ve.prototype.parseClassDef;var mL={reserved:ve.uShort,reqFeatureIndex:ve.uShort,featureIndexes:ve.uShortList};ve.prototype.parseScriptList=function(){return this.parsePointer(ve.recordList({tag:ve.tag,script:ve.pointer({defaultLangSys:ve.pointer(mL),langSysRecords:ve.recordList({tag:ve.tag,langSys:ve.pointer(mL)})})}))||[]},ve.prototype.parseFeatureList=function(){return this.parsePointer(ve.recordList({tag:ve.tag,feature:ve.pointer({featureParams:ve.offset16,lookupListIndexes:ve.uShortList})}))||[]},ve.prototype.parseLookupList=function(e){return this.parsePointer(ve.list(ve.pointer(function(){var t=this.parseUShort();bt.argument(1<=t&&t<=9,"GPOS/GSUB lookup type "+t+" unknown.");var r=this.parseUShort(),i=r&16;return{lookupType:t,lookupFlag:r,subtables:this.parseList(ve.pointer(e[t])),markFilteringSet:i?this.parseUShort():void 0}})))||[]},ve.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var e=this.parseUShort(),t=this.parseUShort();bt.argument(e===1&&t<1,"GPOS/GSUB feature variations table unknown.");var r=this.parseRecordList32({conditionSetOffset:ve.offset32,featureTableSubstitutionOffset:ve.offset32});return r})||[]};var ot={getByte:cL,getCard8:cL,getUShort:Fx,getCard16:Fx,getShort:$ce,getULong:N2,getFixed:pL,getTag:qce,getOffset:Yce,getBytes:Zce,bytesToString:Jce,Parser:ve};function Kce(e,t){t.parseUShort(),e.length=t.parseULong(),e.language=t.parseULong();var r;e.groupCount=r=t.parseULong(),e.glyphIndexMap={};for(var i=0;i<r;i+=1)for(var s=t.parseULong(),a=t.parseULong(),n=t.parseULong(),o=s;o<=a;o+=1)e.glyphIndexMap[o]=n,n++}function epe(e,t,r,i,s){e.length=t.parseUShort(),e.language=t.parseUShort();var a;e.segCount=a=t.parseUShort()>>1,t.skip("uShort",3),e.glyphIndexMap={};for(var n=new ot.Parser(r,i+s+14),o=new ot.Parser(r,i+s+16+a*2),l=new ot.Parser(r,i+s+16+a*4),u=new ot.Parser(r,i+s+16+a*6),h=i+s+16+a*8,d=0;d<a-1;d+=1)for(var c=void 0,m=n.parseUShort(),g=o.parseUShort(),y=l.parseShort(),b=u.parseUShort(),v=g;v<=m;v+=1)b!==0?(h=u.offset+u.relativeOffset-2,h+=b,h+=(v-g)*2,c=ot.getUShort(r,h),c!==0&&(c=c+y&65535)):c=v+y&65535,e.glyphIndexMap[v]=c}function tpe(e,t){var r={};r.version=ot.getUShort(e,t),bt.argument(r.version===0,"cmap table version should be 0."),r.numTables=ot.getUShort(e,t+2);for(var i=-1,s=r.numTables-1;s>=0;s-=1){var a=ot.getUShort(e,t+4+s*8),n=ot.getUShort(e,t+4+s*8+2);if(a===3&&(n===0||n===1||n===10)||a===0&&(n===0||n===1||n===2||n===3||n===4)){i=ot.getULong(e,t+4+s*8+4);break}}if(i===-1)throw new Error("No valid cmap sub-tables found.");var o=new ot.Parser(e,t+i);if(r.format=o.parseUShort(),r.format===12)Kce(r,o);else if(r.format===4)epe(r,o,e,t,i);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+r.format+").");return r}function rpe(e,t,r){e.segments.push({end:t,start:t,delta:-(t-r),offset:0,glyphIndex:r})}function ipe(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}function spe(e){var t=!0,r;for(r=e.length-1;r>0;r-=1){var i=e.get(r);if(i.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),t=!1;break}}var s=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:t?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:t?12:20}];t||(s=s.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),s=s.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var a=new rt.Table("cmap",s);for(a.segments=[],r=0;r<e.length;r+=1){for(var n=e.get(r),o=0;o<n.unicodes.length;o+=1)rpe(a,n.unicodes[o],r);a.segments=a.segments.sort(function(S,T){return S.start-T.start})}ipe(a);var l=a.segments.length,u=0,h=[],d=[],c=[],m=[],g=[],y=[];for(r=0;r<l;r+=1){var b=a.segments[r];b.end<=65535&&b.start<=65535?(h=h.concat({name:"end_"+r,type:"USHORT",value:b.end}),d=d.concat({name:"start_"+r,type:"USHORT",value:b.start}),c=c.concat({name:"idDelta_"+r,type:"SHORT",value:b.delta}),m=m.concat({name:"idRangeOffset_"+r,type:"USHORT",value:b.offset}),b.glyphId!==void 0&&(g=g.concat({name:"glyph_"+r,type:"USHORT",value:b.glyphId}))):u+=1,!t&&b.glyphIndex!==void 0&&(y=y.concat({name:"cmap12Start_"+r,type:"ULONG",value:b.start}),y=y.concat({name:"cmap12End_"+r,type:"ULONG",value:b.end}),y=y.concat({name:"cmap12Glyph_"+r,type:"ULONG",value:b.glyphIndex}))}if(a.segCountX2=(l-u)*2,a.searchRange=Math.pow(2,Math.floor(Math.log(l-u)/Math.log(2)))*2,a.entrySelector=Math.log(a.searchRange/2)/Math.log(2),a.rangeShift=a.segCountX2-a.searchRange,a.fields=a.fields.concat(h),a.fields.push({name:"reservedPad",type:"USHORT",value:0}),a.fields=a.fields.concat(d),a.fields=a.fields.concat(c),a.fields=a.fields.concat(m),a.fields=a.fields.concat(g),a.cmap4Length=14+h.length*2+2+d.length*2+c.length*2+m.length*2+g.length*2,!t){var v=16+y.length*4;a.cmap12Offset=20+a.cmap4Length,a.fields=a.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:v},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:y.length/3}]),a.fields=a.fields.concat(y)}return a}var fL={parse:tpe,make:spe},Lx=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],ape=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],npe=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],_h=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function gL(e){this.font=e}gL.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),r=this.font.glyphs;if(r){for(var i=0;i<r.length;i+=1)for(var s=r.get(i),a=0;a<s.unicodes.length;a+=1)if(s.unicodes[a]===t)return i}return null};function yL(e){this.cmap=e}yL.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.codePointAt(0)]||0};function kx(e,t){this.encoding=e,this.charset=t}kx.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),r=this.encoding[t];return this.charset.indexOf(r)};function A2(e){switch(e.version){case 1:this.names=_h.slice();break;case 2:this.names=new Array(e.numberOfGlyphs);for(var t=0;t<e.numberOfGlyphs;t++)e.glyphNameIndex[t]<_h.length?this.names[t]=_h[e.glyphNameIndex[t]]:this.names[t]=e.names[e.glyphNameIndex[t]-_h.length];break;case 2.5:this.names=new Array(e.numberOfGlyphs);for(var r=0;r<e.numberOfGlyphs;r++)this.names[r]=_h[r+e.glyphNameIndex[r]];break;case 3:this.names=[];break;default:this.names=[];break}}A2.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)},A2.prototype.glyphIndexToName=function(e){return this.names[e]};function ope(e){for(var t,r=e.tables.cmap.glyphIndexMap,i=Object.keys(r),s=0;s<i.length;s+=1){var a=i[s],n=r[a];t=e.glyphs.get(n),t.addUnicode(parseInt(a))}for(var o=0;o<e.glyphs.length;o+=1)t=e.glyphs.get(o),e.cffEncoding?e.isCIDFont?t.name="gid"+o:t.name=e.cffEncoding.charset[o]:e.glyphNames.names&&(t.name=e.glyphNames.glyphIndexToName(o))}function lpe(e){e._IndexToUnicodeMap={};for(var t=e.tables.cmap.glyphIndexMap,r=Object.keys(t),i=0;i<r.length;i+=1){var s=r[i],a=t[s];e._IndexToUnicodeMap[a]===void 0?e._IndexToUnicodeMap[a]={unicodes:[parseInt(s)]}:e._IndexToUnicodeMap[a].unicodes.push(parseInt(s))}}function upe(e,t){t.lowMemory?lpe(e):ope(e)}function hpe(e,t,r,i,s){e.beginPath(),e.moveTo(t,r),e.lineTo(i,s),e.stroke()}var wh={line:hpe};function dpe(e,t){var r=t||new di;return{configurable:!0,get:function(){return typeof r=="function"&&(r=r()),r},set:function(i){r=i}}}function ia(e){this.bindConstructorValues(e)}ia.prototype.bindConstructorValues=function(e){this.index=e.index||0,this.name=e.name||null,this.unicode=e.unicode||void 0,this.unicodes=e.unicodes||e.unicode!==void 0?[e.unicode]:[],"xMin"in e&&(this.xMin=e.xMin),"yMin"in e&&(this.yMin=e.yMin),"xMax"in e&&(this.xMax=e.xMax),"yMax"in e&&(this.yMax=e.yMax),"advanceWidth"in e&&(this.advanceWidth=e.advanceWidth),Object.defineProperty(this,"path",dpe(this,e.path))},ia.prototype.addUnicode=function(e){this.unicodes.length===0&&(this.unicode=e),this.unicodes.push(e)},ia.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},ia.prototype.getPath=function(e,t,r,i,s){e=e!==void 0?e:0,t=t!==void 0?t:0,r=r!==void 0?r:72;var a,n;i||(i={});var o=i.xScale,l=i.yScale;if(i.hinting&&s&&s.hinting&&(n=this.path&&s.hinting.exec(this,r)),n)a=s.hinting.getCommands(n),e=Math.round(e),t=Math.round(t),o=l=1;else{a=this.path.commands;var u=1/(this.path.unitsPerEm||1e3)*r;o===void 0&&(o=u),l===void 0&&(l=u)}for(var h=new di,d=0;d<a.length;d+=1){var c=a[d];c.type==="M"?h.moveTo(e+c.x*o,t+-c.y*l):c.type==="L"?h.lineTo(e+c.x*o,t+-c.y*l):c.type==="Q"?h.quadraticCurveTo(e+c.x1*o,t+-c.y1*l,e+c.x*o,t+-c.y*l):c.type==="C"?h.curveTo(e+c.x1*o,t+-c.y1*l,e+c.x2*o,t+-c.y2*l,e+c.x*o,t+-c.y*l):c.type==="Z"&&h.closePath()}return h},ia.prototype.getContours=function(){if(this.points===void 0)return[];for(var e=[],t=[],r=0;r<this.points.length;r+=1){var i=this.points[r];t.push(i),i.lastPointOfContour&&(e.push(t),t=[])}return bt.argument(t.length===0,"There are still points left in the current contour."),e},ia.prototype.getMetrics=function(){for(var e=this.path.commands,t=[],r=[],i=0;i<e.length;i+=1){var s=e[i];s.type!=="Z"&&(t.push(s.x),r.push(s.y)),(s.type==="Q"||s.type==="C")&&(t.push(s.x1),r.push(s.y1)),s.type==="C"&&(t.push(s.x2),r.push(s.y2))}var a={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,t),yMax:Math.max.apply(null,r),leftSideBearing:this.leftSideBearing};return isFinite(a.xMin)||(a.xMin=0),isFinite(a.xMax)||(a.xMax=this.advanceWidth),isFinite(a.yMin)||(a.yMin=0),isFinite(a.yMax)||(a.yMax=0),a.rightSideBearing=this.advanceWidth-a.leftSideBearing-(a.xMax-a.xMin),a},ia.prototype.draw=function(e,t,r,i,s){this.getPath(t,r,i,s).draw(e)},ia.prototype.drawPoints=function(e,t,r,i){function s(d,c,m,g){e.beginPath();for(var y=0;y<d.length;y+=1)e.moveTo(c+d[y].x*g,m+d[y].y*g),e.arc(c+d[y].x*g,m+d[y].y*g,2,0,Math.PI*2,!1);e.closePath(),e.fill()}t=t!==void 0?t:0,r=r!==void 0?r:0,i=i!==void 0?i:24;for(var a=1/this.path.unitsPerEm*i,n=[],o=[],l=this.path,u=0;u<l.commands.length;u+=1){var h=l.commands[u];h.x!==void 0&&n.push({x:h.x,y:-h.y}),h.x1!==void 0&&o.push({x:h.x1,y:-h.y1}),h.x2!==void 0&&o.push({x:h.x2,y:-h.y2})}e.fillStyle="blue",s(n,t,r,a),e.fillStyle="red",s(o,t,r,a)},ia.prototype.drawMetrics=function(e,t,r,i){var s;t=t!==void 0?t:0,r=r!==void 0?r:0,i=i!==void 0?i:24,s=1/this.path.unitsPerEm*i,e.lineWidth=1,e.strokeStyle="black",wh.line(e,t,-1e4,t,1e4),wh.line(e,-1e4,r,1e4,r);var a=this.xMin||0,n=this.yMin||0,o=this.xMax||0,l=this.yMax||0,u=this.advanceWidth||0;e.strokeStyle="blue",wh.line(e,t+a*s,-1e4,t+a*s,1e4),wh.line(e,t+o*s,-1e4,t+o*s,1e4),wh.line(e,-1e4,r+-n*s,1e4,r+-n*s),wh.line(e,-1e4,r+-l*s,1e4,r+-l*s),e.strokeStyle="green",wh.line(e,t+u*s,-1e4,t+u*s,1e4)};function Dx(e,t,r){Object.defineProperty(e,t,{get:function(){return e.path,e[r]},set:function(i){e[r]=i},enumerable:!0,configurable:!0})}function C2(e,t){if(this.font=e,this.glyphs={},Array.isArray(t))for(var r=0;r<t.length;r++){var i=t[r];i.path.unitsPerEm=e.unitsPerEm,this.glyphs[r]=i}this.length=t&&t.length||0}C2.prototype.get=function(e){if(this.glyphs[e]===void 0){this.font._push(e),typeof this.glyphs[e]=="function"&&(this.glyphs[e]=this.glyphs[e]());var t=this.glyphs[e],r=this.font._IndexToUnicodeMap[e];if(r)for(var i=0;i<r.unicodes.length;i++)t.addUnicode(r.unicodes[i]);this.font.cffEncoding?this.font.isCIDFont?t.name="gid"+e:t.name=this.font.cffEncoding.charset[e]:this.font.glyphNames.names&&(t.name=this.font.glyphNames.glyphIndexToName(e)),this.glyphs[e].advanceWidth=this.font._hmtxTableData[e].advanceWidth,this.glyphs[e].leftSideBearing=this.font._hmtxTableData[e].leftSideBearing}else typeof this.glyphs[e]=="function"&&(this.glyphs[e]=this.glyphs[e]());return this.glyphs[e]},C2.prototype.push=function(e,t){this.glyphs[e]=t,this.length++};function cpe(e,t){return new ia({index:t,font:e})}function ppe(e,t,r,i,s,a){return function(){var n=new ia({index:t,font:e});return n.path=function(){r(n,i,s);var o=a(e.glyphs,n);return o.unitsPerEm=e.unitsPerEm,o},Dx(n,"xMin","_xMin"),Dx(n,"xMax","_xMax"),Dx(n,"yMin","_yMin"),Dx(n,"yMax","_yMax"),n}}function mpe(e,t,r,i){return function(){var s=new ia({index:t,font:e});return s.path=function(){var a=r(e,s,i);return a.unitsPerEm=e.unitsPerEm,a},s}}var Zn={GlyphSet:C2,glyphLoader:cpe,ttfGlyphLoader:ppe,cffGlyphLoader:mpe};function xL(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var r=0;r<e.length;r+=1)if(!xL(e[r],t[r]))return!1;return!0}else return!1}function R2(e){var t;return e.length<1240?t=107:e.length<33900?t=1131:t=32768,t}function ru(e,t,r){var i=[],s=[],a=ot.getCard16(e,t),n,o;if(a!==0){var l=ot.getByte(e,t+2);n=t+(a+1)*l+2;for(var u=t+3,h=0;h<a+1;h+=1)i.push(ot.getOffset(e,u,l)),u+=l;o=n+i[a]}else o=t+2;for(var d=0;d<i.length-1;d+=1){var c=ot.getBytes(e,n+i[d],n+i[d+1]);r&&(c=r(c)),s.push(c)}return{objects:s,startOffset:t,endOffset:o}}function fpe(e,t){var r=[],i=ot.getCard16(e,t),s,a;if(i!==0){var n=ot.getByte(e,t+2);s=t+(i+1)*n+2;for(var o=t+3,l=0;l<i+1;l+=1)r.push(ot.getOffset(e,o,n)),o+=n;a=s+r[i]}else a=t+2;return{offsets:r,startOffset:t,endOffset:a}}function gpe(e,t,r,i,s){var a=ot.getCard16(r,i),n=0;if(a!==0){var o=ot.getByte(r,i+2);n=i+(a+1)*o+2}var l=ot.getBytes(r,n+t[e],n+t[e+1]);return s&&(l=s(l)),l}function ype(e){for(var t="",r=15,i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var s=e.parseByte(),a=s>>4,n=s&15;if(a===r||(t+=i[a],n===r))break;t+=i[n]}return parseFloat(t)}function xpe(e,t){var r,i,s,a;if(t===28)return r=e.parseByte(),i=e.parseByte(),r<<8|i;if(t===29)return r=e.parseByte(),i=e.parseByte(),s=e.parseByte(),a=e.parseByte(),r<<24|i<<16|s<<8|a;if(t===30)return ype(e);if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return r=e.parseByte(),(t-247)*256+r+108;if(t>=251&&t<=254)return r=e.parseByte(),-(t-251)*256-r-108;throw new Error("Invalid b0 "+t)}function vpe(e){for(var t={},r=0;r<e.length;r+=1){var i=e[r][0],s=e[r][1],a=void 0;if(s.length===1?a=s[0]:a=s,t.hasOwnProperty(i)&&!isNaN(t[i]))throw new Error("Object "+t+" already has key "+i);t[i]=a}return t}function vL(e,t,r){t=t!==void 0?t:0;var i=new ot.Parser(e,t),s=[],a=[];for(r=r!==void 0?r:e.length;i.relativeOffset<r;){var n=i.parseByte();n<=21?(n===12&&(n=1200+i.parseByte()),s.push([n,a]),a=[]):a.push(xpe(i,n))}return vpe(s)}function of(e,t){return t<=390?t=Lx[t]:t=e[t-391],t}function bL(e,t,r){for(var i={},s,a=0;a<t.length;a+=1){var n=t[a];if(Array.isArray(n.type)){var o=[];o.length=n.type.length;for(var l=0;l<n.type.length;l++)s=e[n.op]!==void 0?e[n.op][l]:void 0,s===void 0&&(s=n.value!==void 0&&n.value[l]!==void 0?n.value[l]:null),n.type[l]==="SID"&&(s=of(r,s)),o[l]=s;i[n.name]=o}else s=e[n.op],s===void 0&&(s=n.value!==void 0?n.value:null),n.type==="SID"&&(s=of(r,s)),i[n.name]=s}return i}function bpe(e,t){var r={};return r.formatMajor=ot.getCard8(e,t),r.formatMinor=ot.getCard8(e,t+1),r.size=ot.getCard8(e,t+2),r.offsetSize=ot.getCard8(e,t+3),r.startOffset=t,r.endOffset=t+4,r}var TL=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],SL=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function Tpe(e,t){var r=vL(e,0,e.byteLength);return bL(r,TL,t)}function _L(e,t,r,i){var s=vL(e,t,r);return bL(s,SL,i)}function wL(e,t,r,i){for(var s=[],a=0;a<r.length;a+=1){var n=new DataView(new Uint8Array(r[a]).buffer),o=Tpe(n,i);o._subrs=[],o._subrsBias=0,o._defaultWidthX=0,o._nominalWidthX=0;var l=o.private[0],u=o.private[1];if(l!==0&&u!==0){var h=_L(e,u+t,l,i);if(o._defaultWidthX=h.defaultWidthX,o._nominalWidthX=h.nominalWidthX,h.subrs!==0){var d=u+h.subrs,c=ru(e,d+t);o._subrs=c.objects,o._subrsBias=R2(o._subrs)}o._privateDict=h}s.push(o)}return s}function Spe(e,t,r,i){var s,a,n=new ot.Parser(e,t);r-=1;var o=[".notdef"],l=n.parseCard8();if(l===0)for(var u=0;u<r;u+=1)s=n.parseSID(),o.push(of(i,s));else if(l===1)for(;o.length<=r;){s=n.parseSID(),a=n.parseCard8();for(var h=0;h<=a;h+=1)o.push(of(i,s)),s+=1}else if(l===2)for(;o.length<=r;){s=n.parseSID(),a=n.parseCard16();for(var d=0;d<=a;d+=1)o.push(of(i,s)),s+=1}else throw new Error("Unknown charset format "+l);return o}function _pe(e,t,r){var i,s={},a=new ot.Parser(e,t),n=a.parseCard8();if(n===0)for(var o=a.parseCard8(),l=0;l<o;l+=1)i=a.parseCard8(),s[i]=l;else if(n===1){var u=a.parseCard8();i=1;for(var h=0;h<u;h+=1)for(var d=a.parseCard8(),c=a.parseCard8(),m=d;m<=d+c;m+=1)s[m]=i,i+=1}else throw new Error("Unknown encoding format "+n);return new kx(s,r)}function ML(e,t,r){var i,s,a,n,o=new di,l=[],u=0,h=!1,d=!1,c=0,m=0,g,y,b,v;if(e.isCIDFont){var S=e.tables.cff.topDict._fdSelect[t.index],T=e.tables.cff.topDict._fdArray[S];g=T._subrs,y=T._subrsBias,b=T._defaultWidthX,v=T._nominalWidthX}else g=e.tables.cff.topDict._subrs,y=e.tables.cff.topDict._subrsBias,b=e.tables.cff.topDict._defaultWidthX,v=e.tables.cff.topDict._nominalWidthX;var w=b;function N(E,P){d&&o.closePath(),o.moveTo(E,P),d=!0}function C(){var E;E=l.length%2!==0,E&&!h&&(w=l.shift()+v),u+=l.length>>1,l.length=0,h=!0}function R(E){for(var P,I,O,L,X,z,H,ue,ne,re,ce,ge,ye=0;ye<E.length;){var oe=E[ye];switch(ye+=1,oe){case 1:C();break;case 3:C();break;case 4:l.length>1&&!h&&(w=l.shift()+v,h=!0),m+=l.pop(),N(c,m);break;case 5:for(;l.length>0;)c+=l.shift(),m+=l.shift(),o.lineTo(c,m);break;case 6:for(;l.length>0&&(c+=l.shift(),o.lineTo(c,m),l.length!==0);)m+=l.shift(),o.lineTo(c,m);break;case 7:for(;l.length>0&&(m+=l.shift(),o.lineTo(c,m),l.length!==0);)c+=l.shift(),o.lineTo(c,m);break;case 8:for(;l.length>0;)i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+l.shift(),o.curveTo(i,s,a,n,c,m);break;case 10:X=l.pop()+y,z=g[X],z&&R(z);break;case 11:return;case 12:switch(oe=E[ye],ye+=1,oe){case 35:i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),H=a+l.shift(),ue=n+l.shift(),ne=H+l.shift(),re=ue+l.shift(),ce=ne+l.shift(),ge=re+l.shift(),c=ce+l.shift(),m=ge+l.shift(),l.shift(),o.curveTo(i,s,a,n,H,ue),o.curveTo(ne,re,ce,ge,c,m);break;case 34:i=c+l.shift(),s=m,a=i+l.shift(),n=s+l.shift(),H=a+l.shift(),ue=n,ne=H+l.shift(),re=n,ce=ne+l.shift(),ge=m,c=ce+l.shift(),o.curveTo(i,s,a,n,H,ue),o.curveTo(ne,re,ce,ge,c,m);break;case 36:i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),H=a+l.shift(),ue=n,ne=H+l.shift(),re=n,ce=ne+l.shift(),ge=re+l.shift(),c=ce+l.shift(),o.curveTo(i,s,a,n,H,ue),o.curveTo(ne,re,ce,ge,c,m);break;case 37:i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),H=a+l.shift(),ue=n+l.shift(),ne=H+l.shift(),re=ue+l.shift(),ce=ne+l.shift(),ge=re+l.shift(),Math.abs(ce-c)>Math.abs(ge-m)?c=ce+l.shift():m=ge+l.shift(),o.curveTo(i,s,a,n,H,ue),o.curveTo(ne,re,ce,ge,c,m);break;default:console.log("Glyph "+t.index+": unknown operator 1200"+oe),l.length=0}break;case 14:l.length>0&&!h&&(w=l.shift()+v,h=!0),d&&(o.closePath(),d=!1);break;case 18:C();break;case 19:case 20:C(),ye+=u+7>>3;break;case 21:l.length>2&&!h&&(w=l.shift()+v,h=!0),m+=l.pop(),c+=l.pop(),N(c,m);break;case 22:l.length>1&&!h&&(w=l.shift()+v,h=!0),c+=l.pop(),N(c,m);break;case 23:C();break;case 24:for(;l.length>2;)i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+l.shift(),o.curveTo(i,s,a,n,c,m);c+=l.shift(),m+=l.shift(),o.lineTo(c,m);break;case 25:for(;l.length>6;)c+=l.shift(),m+=l.shift(),o.lineTo(c,m);i=c+l.shift(),s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+l.shift(),o.curveTo(i,s,a,n,c,m);break;case 26:for(l.length%2&&(c+=l.shift());l.length>0;)i=c,s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a,m=n+l.shift(),o.curveTo(i,s,a,n,c,m);break;case 27:for(l.length%2&&(m+=l.shift());l.length>0;)i=c+l.shift(),s=m,a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n,o.curveTo(i,s,a,n,c,m);break;case 28:P=E[ye],I=E[ye+1],l.push((P<<24|I<<16)>>16),ye+=2;break;case 29:X=l.pop()+e.gsubrsBias,z=e.gsubrs[X],z&&R(z);break;case 30:for(;l.length>0&&(i=c,s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+(l.length===1?l.shift():0),o.curveTo(i,s,a,n,c,m),l.length!==0);)i=c+l.shift(),s=m,a=i+l.shift(),n=s+l.shift(),m=n+l.shift(),c=a+(l.length===1?l.shift():0),o.curveTo(i,s,a,n,c,m);break;case 31:for(;l.length>0&&(i=c+l.shift(),s=m,a=i+l.shift(),n=s+l.shift(),m=n+l.shift(),c=a+(l.length===1?l.shift():0),o.curveTo(i,s,a,n,c,m),l.length!==0);)i=c,s=m+l.shift(),a=i+l.shift(),n=s+l.shift(),c=a+l.shift(),m=n+(l.length===1?l.shift():0),o.curveTo(i,s,a,n,c,m);break;default:oe<32?console.log("Glyph "+t.index+": unknown operator "+oe):oe<247?l.push(oe-139):oe<251?(P=E[ye],ye+=1,l.push((oe-247)*256+P+108)):oe<255?(P=E[ye],ye+=1,l.push(-(oe-251)*256-P-108)):(P=E[ye],I=E[ye+1],O=E[ye+2],L=E[ye+3],ye+=4,l.push((P<<24|I<<16|O<<8|L)/65536))}}}return R(r),t.advanceWidth=w,o}function wpe(e,t,r,i){var s=[],a,n=new ot.Parser(e,t),o=n.parseCard8();if(o===0)for(var l=0;l<r;l++){if(a=n.parseCard8(),a>=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+a+" (FD count "+i+")");s.push(a)}else if(o===3){var u=n.parseCard16(),h=n.parseCard16();if(h!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+h);for(var d,c=0;c<u;c++){if(a=n.parseCard8(),d=n.parseCard16(),a>=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+a+" (FD count "+i+")");if(d>r)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+d);for(;h<d;h++)s.push(a);h=d}if(d!==r)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+d)}else throw new Error("CFF Table CID Font FDSelect table has unsupported format "+o);return s}function Mpe(e,t,r,i){r.tables.cff={};var s=bpe(e,t),a=ru(e,s.endOffset,ot.bytesToString),n=ru(e,a.endOffset),o=ru(e,n.endOffset,ot.bytesToString),l=ru(e,o.endOffset);r.gsubrs=l.objects,r.gsubrsBias=R2(r.gsubrs);var u=wL(e,t,n.objects,o.objects);if(u.length!==1)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+u.length);var h=u[0];if(r.tables.cff.topDict=h,h._privateDict&&(r.defaultWidthX=h._privateDict.defaultWidthX,r.nominalWidthX=h._privateDict.nominalWidthX),h.ros[0]!==void 0&&h.ros[1]!==void 0&&(r.isCIDFont=!0),r.isCIDFont){var d=h.fdArray,c=h.fdSelect;if(d===0||c===0)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");d+=t;var m=ru(e,d),g=wL(e,t,m.objects,o.objects);h._fdArray=g,c+=t,h._fdSelect=wpe(e,c,r.numGlyphs,g.length)}var y=t+h.private[1],b=_L(e,y,h.private[0],o.objects);if(r.defaultWidthX=b.defaultWidthX,r.nominalWidthX=b.nominalWidthX,b.subrs!==0){var v=y+b.subrs,S=ru(e,v);r.subrs=S.objects,r.subrsBias=R2(r.subrs)}else r.subrs=[],r.subrsBias=0;var T;i.lowMemory?(T=fpe(e,t+h.charStrings),r.nGlyphs=T.offsets.length):(T=ru(e,t+h.charStrings),r.nGlyphs=T.objects.length);var w=Spe(e,t+h.charset,r.nGlyphs,o.objects);if(h.encoding===0?r.cffEncoding=new kx(ape,w):h.encoding===1?r.cffEncoding=new kx(npe,w):r.cffEncoding=_pe(e,t+h.encoding,w),r.encoding=r.encoding||r.cffEncoding,r.glyphs=new Zn.GlyphSet(r),i.lowMemory)r._push=function(R){var E=gpe(R,T.offsets,e,t+h.charStrings);r.glyphs.push(R,Zn.cffGlyphLoader(r,R,ML,E))};else for(var N=0;N<r.nGlyphs;N+=1){var C=T.objects[N];r.glyphs.push(N,Zn.cffGlyphLoader(r,N,ML,C))}}function NL(e,t){var r,i=Lx.indexOf(e);return i>=0&&(r=i),i=t.indexOf(e),i>=0?r=i+Lx.length:(r=Lx.length+t.length,t.push(e)),r}function Npe(){return new rt.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function Ape(e){var t=new rt.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);t.names=[];for(var r=0;r<e.length;r+=1)t.names.push({name:"name_"+r,type:"NAME",value:e[r]});return t}function AL(e,t,r){for(var i={},s=0;s<e.length;s+=1){var a=e[s],n=t[a.name];n!==void 0&&!xL(n,a.value)&&(a.type==="SID"&&(n=NL(n,r)),i[a.op]={name:a.name,type:a.type,value:n})}return i}function CL(e,t){var r=new rt.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=AL(TL,e,t),r}function RL(e){var t=new rt.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return t.topDicts=[{name:"topDict_0",type:"TABLE",value:e}],t}function Cpe(e){var t=new rt.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);t.strings=[];for(var r=0;r<e.length;r+=1)t.strings.push({name:"string_"+r,type:"STRING",value:e[r]});return t}function Rpe(){return new rt.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function Epe(e,t){for(var r=new rt.Record("Charsets",[{name:"format",type:"Card8",value:0}]),i=0;i<e.length;i+=1){var s=e[i],a=NL(s,t);r.fields.push({name:"glyph_"+i,type:"SID",value:a})}return r}function Ppe(e){var t=[],r=e.path;t.push({name:"width",type:"NUMBER",value:e.advanceWidth});for(var i=0,s=0,a=0;a<r.commands.length;a+=1){var n=void 0,o=void 0,l=r.commands[a];if(l.type==="Q"){var u=.3333333333333333,h=2/3;l={type:"C",x:l.x,y:l.y,x1:Math.round(u*i+h*l.x1),y1:Math.round(u*s+h*l.y1),x2:Math.round(u*l.x+h*l.x1),y2:Math.round(u*l.y+h*l.y1)}}if(l.type==="M")n=Math.round(l.x-i),o=Math.round(l.y-s),t.push({name:"dx",type:"NUMBER",value:n}),t.push({name:"dy",type:"NUMBER",value:o}),t.push({name:"rmoveto",type:"OP",value:21}),i=Math.round(l.x),s=Math.round(l.y);else if(l.type==="L")n=Math.round(l.x-i),o=Math.round(l.y-s),t.push({name:"dx",type:"NUMBER",value:n}),t.push({name:"dy",type:"NUMBER",value:o}),t.push({name:"rlineto",type:"OP",value:5}),i=Math.round(l.x),s=Math.round(l.y);else if(l.type==="C"){var d=Math.round(l.x1-i),c=Math.round(l.y1-s),m=Math.round(l.x2-l.x1),g=Math.round(l.y2-l.y1);n=Math.round(l.x-l.x2),o=Math.round(l.y-l.y2),t.push({name:"dx1",type:"NUMBER",value:d}),t.push({name:"dy1",type:"NUMBER",value:c}),t.push({name:"dx2",type:"NUMBER",value:m}),t.push({name:"dy2",type:"NUMBER",value:g}),t.push({name:"dx",type:"NUMBER",value:n}),t.push({name:"dy",type:"NUMBER",value:o}),t.push({name:"rrcurveto",type:"OP",value:8}),i=Math.round(l.x),s=Math.round(l.y)}}return t.push({name:"endchar",type:"OP",value:14}),t}function Bpe(e){for(var t=new rt.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),r=0;r<e.length;r+=1){var i=e.get(r),s=Ppe(i);t.charStrings.push({name:i.name,type:"CHARSTRING",value:s})}return t}function Ipe(e,t){var r=new rt.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return r.dict=AL(SL,e,t),r}function Fpe(e,t){for(var r=new rt.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),i=1/t.unitsPerEm,s={version:t.version,fullName:t.fullName,familyName:t.familyName,weight:t.weightName,fontBBox:t.fontBBox||[0,0,0,0],fontMatrix:[i,0,0,i,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},a={},n=[],o,l=1;l<e.length;l+=1)o=e.get(l),n.push(o.name);var u=[];r.header=Npe(),r.nameIndex=Ape([t.postScriptName]);var h=CL(s,u);r.topDictIndex=RL(h),r.globalSubrIndex=Rpe(),r.charsets=Epe(n,u),r.charStringsIndex=Bpe(e),r.privateDict=Ipe(a,u),r.stringIndex=Cpe(u);var d=r.header.sizeOf()+r.nameIndex.sizeOf()+r.topDictIndex.sizeOf()+r.stringIndex.sizeOf()+r.globalSubrIndex.sizeOf();return s.charset=d,s.encoding=0,s.charStrings=s.charset+r.charsets.sizeOf(),s.private[1]=s.charStrings+r.charStringsIndex.sizeOf(),h=CL(s,u),r.topDictIndex=RL(h),r}var EL={parse:Mpe,make:Fpe};function Lpe(e,t){var r={},i=new ot.Parser(e,t);return r.version=i.parseVersion(),r.fontRevision=Math.round(i.parseFixed()*1e3)/1e3,r.checkSumAdjustment=i.parseULong(),r.magicNumber=i.parseULong(),bt.argument(r.magicNumber===1594834165,"Font header has wrong magic number."),r.flags=i.parseUShort(),r.unitsPerEm=i.parseUShort(),r.created=i.parseLongDateTime(),r.modified=i.parseLongDateTime(),r.xMin=i.parseShort(),r.yMin=i.parseShort(),r.xMax=i.parseShort(),r.yMax=i.parseShort(),r.macStyle=i.parseUShort(),r.lowestRecPPEM=i.parseUShort(),r.fontDirectionHint=i.parseShort(),r.indexToLocFormat=i.parseShort(),r.glyphDataFormat=i.parseShort(),r}function kpe(e){var t=Math.round(new Date().getTime()/1e3)+2082844800,r=t;return e.createdTimestamp&&(r=e.createdTimestamp+2082844800),new rt.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:r},{name:"modified",type:"LONGDATETIME",value:t},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],e)}var PL={parse:Lpe,make:kpe};function Dpe(e,t){var r={},i=new ot.Parser(e,t);return r.version=i.parseVersion(),r.ascender=i.parseShort(),r.descender=i.parseShort(),r.lineGap=i.parseShort(),r.advanceWidthMax=i.parseUShort(),r.minLeftSideBearing=i.parseShort(),r.minRightSideBearing=i.parseShort(),r.xMaxExtent=i.parseShort(),r.caretSlopeRise=i.parseShort(),r.caretSlopeRun=i.parseShort(),r.caretOffset=i.parseShort(),i.relativeOffset+=8,r.metricDataFormat=i.parseShort(),r.numberOfHMetrics=i.parseUShort(),r}function Ope(e){return new rt.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],e)}var BL={parse:Dpe,make:Ope};function Upe(e,t,r,i,s){for(var a,n,o=new ot.Parser(e,t),l=0;l<i;l+=1){l<r&&(a=o.parseUShort(),n=o.parseShort());var u=s.get(l);u.advanceWidth=a,u.leftSideBearing=n}}function zpe(e,t,r,i,s){e._hmtxTableData={};for(var a,n,o=new ot.Parser(t,r),l=0;l<s;l+=1)l<i&&(a=o.parseUShort(),n=o.parseShort()),e._hmtxTableData[l]={advanceWidth:a,leftSideBearing:n}}function Vpe(e,t,r,i,s,a,n){n.lowMemory?zpe(e,t,r,i,s):Upe(t,r,i,s,a)}function Gpe(e){for(var t=new rt.Table("hmtx",[]),r=0;r<e.length;r+=1){var i=e.get(r),s=i.advanceWidth||0,a=i.leftSideBearing||0;t.fields.push({name:"advanceWidth_"+r,type:"USHORT",value:s}),t.fields.push({name:"leftSideBearing_"+r,type:"SHORT",value:a})}return t}var IL={parse:Vpe,make:Gpe};function Wpe(e){for(var t=new rt.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:e.length}]),r="",i=12+e.length*4,s=0;s<e.length;++s){var a=r.indexOf(e[s]);a<0&&(a=r.length,r+=e[s]),t.fields.push({name:"offset "+s,type:"USHORT",value:i+a}),t.fields.push({name:"length "+s,type:"USHORT",value:e[s].length})}return t.fields.push({name:"stringPool",type:"CHARARRAY",value:r}),t}function jpe(e,t){var r=new ot.Parser(e,t),i=r.parseULong();bt.argument(i===1,"Unsupported ltag table version."),r.skip("uLong",1);for(var s=r.parseULong(),a=[],n=0;n<s;n++){for(var o="",l=t+r.parseUShort(),u=r.parseUShort(),h=l;h<l+u;++h)o+=String.fromCharCode(e.getInt8(h));a.push(o)}return a}var FL={make:Wpe,parse:jpe};function Hpe(e,t){var r={},i=new ot.Parser(e,t);return r.version=i.parseVersion(),r.numGlyphs=i.parseUShort(),r.version===1&&(r.maxPoints=i.parseUShort(),r.maxContours=i.parseUShort(),r.maxCompositePoints=i.parseUShort(),r.maxCompositeContours=i.parseUShort(),r.maxZones=i.parseUShort(),r.maxTwilightPoints=i.parseUShort(),r.maxStorage=i.parseUShort(),r.maxFunctionDefs=i.parseUShort(),r.maxInstructionDefs=i.parseUShort(),r.maxStackElements=i.parseUShort(),r.maxSizeOfInstructions=i.parseUShort(),r.maxComponentElements=i.parseUShort(),r.maxComponentDepth=i.parseUShort()),r}function Xpe(e){return new rt.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:e}])}var LL={parse:Hpe,make:Xpe},kL=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],DL={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},$pe={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},OL={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function qpe(e,t,r){switch(e){case 0:if(t===65535)return"und";if(r)return r[t];break;case 1:return DL[t];case 3:return OL[t]}}var E2="utf-16",Ype={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},Zpe={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function UL(e,t,r){switch(e){case 0:return E2;case 1:return Zpe[r]||Ype[t];case 3:if(t===1||t===10)return E2;break}}function Jpe(e,t,r){for(var i={},s=new ot.Parser(e,t),a=s.parseUShort(),n=s.parseUShort(),o=s.offset+s.parseUShort(),l=0;l<n;l++){var u=s.parseUShort(),h=s.parseUShort(),d=s.parseUShort(),c=s.parseUShort(),m=kL[c]||c,g=s.parseUShort(),y=s.parseUShort(),b=qpe(u,d,r),v=UL(u,h,d);if(v!==void 0&&b!==void 0){var S=void 0;if(v===E2?S=Ec.UTF16(e,o+y,g):S=Ec.MACSTRING(e,o+y,g,v),S){var T=i[m];T===void 0&&(T=i[m]={}),T[b]=S}}}var w=0;return a===1&&(w=s.parseUShort()),i}function P2(e){var t={};for(var r in e)t[e[r]]=parseInt(r);return t}function zL(e,t,r,i,s,a){return new rt.Record("NameRecord",[{name:"platformID",type:"USHORT",value:e},{name:"encodingID",type:"USHORT",value:t},{name:"languageID",type:"USHORT",value:r},{name:"nameID",type:"USHORT",value:i},{name:"length",type:"USHORT",value:s},{name:"offset",type:"USHORT",value:a}])}function Qpe(e,t){var r=e.length,i=t.length-r+1;e:for(var s=0;s<i;s++)for(;s<i;s++){for(var a=0;a<r;a++)if(t[s+a]!==e[a])continue e;return s}return-1}function VL(e,t){var r=Qpe(e,t);if(r<0){r=t.length;for(var i=0,s=e.length;i<s;++i)t.push(e[i])}return r}function Kpe(e,t){var r,i=[],s={},a=P2(kL);for(var n in e){var o=a[n];if(o===void 0&&(o=n),r=parseInt(o),isNaN(r))throw new Error('Name table entry "'+n+'" does not exist, see nameTableNames for complete list.');s[r]=e[n],i.push(r)}for(var l=P2(DL),u=P2(OL),h=[],d=[],c=0;c<i.length;c++){r=i[c];var m=s[r];for(var g in m){var y=m[g],b=1,v=l[g],S=$pe[v],T=UL(b,S,v),w=He.MACSTRING(y,T);w===void 0&&(b=0,v=t.indexOf(g),v<0&&(v=t.length,t.push(g)),S=4,w=He.UTF16(y));var N=VL(w,d);h.push(zL(b,S,v,r,w.length,N));var C=u[g];if(C!==void 0){var R=He.UTF16(y),E=VL(R,d);h.push(zL(3,1,C,r,R.length,E))}}}h.sort(function(O,L){return O.platformID-L.platformID||O.encodingID-L.encodingID||O.languageID-L.languageID||O.nameID-L.nameID});for(var P=new rt.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:h.length},{name:"stringOffset",type:"USHORT",value:6+h.length*12}]),I=0;I<h.length;I++)P.fields.push({name:"record_"+I,type:"RECORD",value:h[I]});return P.fields.push({name:"strings",type:"LITERAL",value:d}),P}var GL={parse:Jpe,make:Kpe},B2=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];function eme(e){for(var t=0;t<B2.length;t+=1){var r=B2[t];if(e>=r.begin&&e<r.end)return t}return-1}function tme(e,t){var r={},i=new ot.Parser(e,t);r.version=i.parseUShort(),r.xAvgCharWidth=i.parseShort(),r.usWeightClass=i.parseUShort(),r.usWidthClass=i.parseUShort(),r.fsType=i.parseUShort(),r.ySubscriptXSize=i.parseShort(),r.ySubscriptYSize=i.parseShort(),r.ySubscriptXOffset=i.parseShort(),r.ySubscriptYOffset=i.parseShort(),r.ySuperscriptXSize=i.parseShort(),r.ySuperscriptYSize=i.parseShort(),r.ySuperscriptXOffset=i.parseShort(),r.ySuperscriptYOffset=i.parseShort(),r.yStrikeoutSize=i.parseShort(),r.yStrikeoutPosition=i.parseShort(),r.sFamilyClass=i.parseShort(),r.panose=[];for(var s=0;s<10;s++)r.panose[s]=i.parseByte();return r.ulUnicodeRange1=i.parseULong(),r.ulUnicodeRange2=i.parseULong(),r.ulUnicodeRange3=i.parseULong(),r.ulUnicodeRange4=i.parseULong(),r.achVendID=String.fromCharCode(i.parseByte(),i.parseByte(),i.parseByte(),i.parseByte()),r.fsSelection=i.parseUShort(),r.usFirstCharIndex=i.parseUShort(),r.usLastCharIndex=i.parseUShort(),r.sTypoAscender=i.parseShort(),r.sTypoDescender=i.parseShort(),r.sTypoLineGap=i.parseShort(),r.usWinAscent=i.parseUShort(),r.usWinDescent=i.parseUShort(),r.version>=1&&(r.ulCodePageRange1=i.parseULong(),r.ulCodePageRange2=i.parseULong()),r.version>=2&&(r.sxHeight=i.parseShort(),r.sCapHeight=i.parseShort(),r.usDefaultChar=i.parseUShort(),r.usBreakChar=i.parseUShort(),r.usMaxContent=i.parseUShort()),r}function rme(e){return new rt.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],e)}var I2={parse:tme,make:rme,unicodeRanges:B2,getUnicodeRange:eme};function ime(e,t){var r={},i=new ot.Parser(e,t);switch(r.version=i.parseVersion(),r.italicAngle=i.parseFixed(),r.underlinePosition=i.parseShort(),r.underlineThickness=i.parseShort(),r.isFixedPitch=i.parseULong(),r.minMemType42=i.parseULong(),r.maxMemType42=i.parseULong(),r.minMemType1=i.parseULong(),r.maxMemType1=i.parseULong(),r.version){case 1:r.names=_h.slice();break;case 2:r.numberOfGlyphs=i.parseUShort(),r.glyphNameIndex=new Array(r.numberOfGlyphs);for(var s=0;s<r.numberOfGlyphs;s++)r.glyphNameIndex[s]=i.parseUShort();r.names=[];for(var a=0;a<r.numberOfGlyphs;a++)if(r.glyphNameIndex[a]>=_h.length){var n=i.parseChar();r.names.push(i.parseString(n))}break;case 2.5:r.numberOfGlyphs=i.parseUShort(),r.offset=new Array(r.numberOfGlyphs);for(var o=0;o<r.numberOfGlyphs;o++)r.offset[o]=i.parseChar();break}return r}function sme(){return new rt.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}var WL={parse:ime,make:sme},sn=new Array(9);sn[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(ve.coverage),deltaGlyphId:this.parseUShort()};if(t===2)return{substFormat:2,coverage:this.parsePointer(ve.coverage),substitute:this.parseOffset16List()};bt.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},sn[2]=function(){var e=this.parseUShort();return bt.argument(e===1,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(ve.coverage),sequences:this.parseListOfLists()}},sn[3]=function(){var e=this.parseUShort();return bt.argument(e===1,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(ve.coverage),alternateSets:this.parseListOfLists()}},sn[4]=function(){var e=this.parseUShort();return bt.argument(e===1,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(ve.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var Pc={sequenceIndex:ve.uShort,lookupListIndex:ve.uShort};sn[5]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:t,coverage:this.parsePointer(ve.coverage),ruleSets:this.parseListOfLists(function(){var s=this.parseUShort(),a=this.parseUShort();return{input:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(a,Pc)}})};if(t===2)return{substFormat:t,coverage:this.parsePointer(ve.coverage),classDef:this.parsePointer(ve.classDef),classSets:this.parseListOfLists(function(){var s=this.parseUShort(),a=this.parseUShort();return{classes:this.parseUShortList(s-1),lookupRecords:this.parseRecordList(a,Pc)}})};if(t===3){var r=this.parseUShort(),i=this.parseUShort();return{substFormat:t,coverages:this.parseList(r,ve.pointer(ve.coverage)),lookupRecords:this.parseRecordList(i,Pc)}}bt.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},sn[6]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{substFormat:1,coverage:this.parsePointer(ve.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Pc)}})};if(t===2)return{substFormat:2,coverage:this.parsePointer(ve.coverage),backtrackClassDef:this.parsePointer(ve.classDef),inputClassDef:this.parsePointer(ve.classDef),lookaheadClassDef:this.parsePointer(ve.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(Pc)}})};if(t===3)return{substFormat:3,backtrackCoverage:this.parseList(ve.pointer(ve.coverage)),inputCoverage:this.parseList(ve.pointer(ve.coverage)),lookaheadCoverage:this.parseList(ve.pointer(ve.coverage)),lookupRecords:this.parseRecordList(Pc)};bt.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},sn[7]=function(){var e=this.parseUShort();bt.argument(e===1,"GSUB Extension Substitution subtable identifier-format must be 1");var t=this.parseUShort(),r=new ve(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:sn[t].call(r)}},sn[8]=function(){var e=this.parseUShort();return bt.argument(e===1,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(ve.coverage),backtrackCoverage:this.parseList(ve.pointer(ve.coverage)),lookaheadCoverage:this.parseList(ve.pointer(ve.coverage)),substitutes:this.parseUShortList()}};function ame(e,t){t=t||0;var r=new ve(e,t),i=r.parseVersion(1);return bt.argument(i===1||i===1.1,"Unsupported GSUB table version."),i===1?{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(sn)}:{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(sn),variations:r.parseFeatureVariationsList()}}var Bc=new Array(9);Bc[1]=function(e){return e.substFormat===1?new rt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new rt.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new rt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new rt.Coverage(e.coverage)}].concat(rt.ushortList("substitute",e.substitute)))},Bc[2]=function(e){return bt.assert(e.substFormat===1,"Lookup type 2 substFormat must be 1."),new rt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new rt.Coverage(e.coverage)}].concat(rt.tableList("seqSet",e.sequences,function(t){return new rt.Table("sequenceSetTable",rt.ushortList("sequence",t))})))},Bc[3]=function(e){return bt.assert(e.substFormat===1,"Lookup type 3 substFormat must be 1."),new rt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new rt.Coverage(e.coverage)}].concat(rt.tableList("altSet",e.alternateSets,function(t){return new rt.Table("alternateSetTable",rt.ushortList("alternate",t))})))},Bc[4]=function(e){return bt.assert(e.substFormat===1,"Lookup type 4 substFormat must be 1."),new rt.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new rt.Coverage(e.coverage)}].concat(rt.tableList("ligSet",e.ligatureSets,function(t){return new rt.Table("ligatureSetTable",rt.tableList("ligature",t,function(r){return new rt.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:r.ligGlyph}].concat(rt.ushortList("component",r.components,r.components.length+1)))}))})))},Bc[6]=function(e){if(e.substFormat===1){var t=new rt.Table("chainContextTable",[{name:"substFormat",type:"USHORT",value:e.substFormat},{name:"coverage",type:"TABLE",value:new rt.Coverage(e.coverage)}].concat(rt.tableList("chainRuleSet",e.chainRuleSets,function(s){return new rt.Table("chainRuleSetTable",rt.tableList("chainRule",s,function(a){var n=rt.ushortList("backtrackGlyph",a.backtrack,a.backtrack.length).concat(rt.ushortList("inputGlyph",a.input,a.input.length+1)).concat(rt.ushortList("lookaheadGlyph",a.lookahead,a.lookahead.length)).concat(rt.ushortList("substitution",[],a.lookupRecords.length));return a.lookupRecords.forEach(function(o,l){n=n.concat({name:"sequenceIndex"+l,type:"USHORT",value:o.sequenceIndex}).concat({name:"lookupListIndex"+l,type:"USHORT",value:o.lookupListIndex})}),new rt.Table("chainRuleTable",n)}))})));return t}else if(e.substFormat===2)bt.assert(!1,"lookup type 6 format 2 is not yet supported.");else if(e.substFormat===3){var r=[{name:"substFormat",type:"USHORT",value:e.substFormat}];r.push({name:"backtrackGlyphCount",type:"USHORT",value:e.backtrackCoverage.length}),e.backtrackCoverage.forEach(function(s,a){r.push({name:"backtrackCoverage"+a,type:"TABLE",value:new rt.Coverage(s)})}),r.push({name:"inputGlyphCount",type:"USHORT",value:e.inputCoverage.length}),e.inputCoverage.forEach(function(s,a){r.push({name:"inputCoverage"+a,type:"TABLE",value:new rt.Coverage(s)})}),r.push({name:"lookaheadGlyphCount",type:"USHORT",value:e.lookaheadCoverage.length}),e.lookaheadCoverage.forEach(function(s,a){r.push({name:"lookaheadCoverage"+a,type:"TABLE",value:new rt.Coverage(s)})}),r.push({name:"substitutionCount",type:"USHORT",value:e.lookupRecords.length}),e.lookupRecords.forEach(function(s,a){r=r.concat({name:"sequenceIndex"+a,type:"USHORT",value:s.sequenceIndex}).concat({name:"lookupListIndex"+a,type:"USHORT",value:s.lookupListIndex})});var i=new rt.Table("chainContextTable",r);return i}bt.assert(!1,"lookup type 6 format must be 1, 2 or 3.")};function nme(e){return new rt.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new rt.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new rt.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new rt.LookupList(e.lookups,Bc)}])}var jL={parse:ame,make:nme};function ome(e,t){var r=new ot.Parser(e,t),i=r.parseULong();bt.argument(i===1,"Unsupported META table version."),r.parseULong(),r.parseULong();for(var s=r.parseULong(),a={},n=0;n<s;n++){var o=r.parseTag(),l=r.parseULong(),u=r.parseULong(),h=Ec.UTF8(e,t+l,u);a[o]=h}return a}function lme(e){var t=Object.keys(e).length,r="",i=16+t*12,s=new rt.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:i},{name:"numTags",type:"ULONG",value:t}]);for(var a in e){var n=r.length;r+=e[a],s.fields.push({name:"tag "+a,type:"TAG",value:a}),s.fields.push({name:"offset "+a,type:"ULONG",value:i+n}),s.fields.push({name:"length "+a,type:"ULONG",value:e[a].length})}return s.fields.push({name:"stringPool",type:"CHARARRAY",value:r}),s}var HL={parse:ome,make:lme};function XL(e){return Math.log(e)/Math.log(2)|0}function F2(e){for(;e.length%4!==0;)e.push(0);for(var t=0,r=0;r<e.length;r+=4)t+=(e[r]<<24)+(e[r+1]<<16)+(e[r+2]<<8)+e[r+3];return t%=Math.pow(2,32),t}function $L(e,t,r,i){return new rt.Record("Table Record",[{name:"tag",type:"TAG",value:e!==void 0?e:""},{name:"checkSum",type:"ULONG",value:t!==void 0?t:0},{name:"offset",type:"ULONG",value:r!==void 0?r:0},{name:"length",type:"ULONG",value:i!==void 0?i:0}])}function qL(e){var t=new rt.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);t.tables=e,t.numTables=e.length;var r=Math.pow(2,XL(t.numTables));t.searchRange=16*r,t.entrySelector=XL(r),t.rangeShift=t.numTables*16-t.searchRange;for(var i=[],s=[],a=t.sizeOf()+$L().sizeOf()*t.numTables;a%4!==0;)a+=1,s.push({name:"padding",type:"BYTE",value:0});for(var n=0;n<e.length;n+=1){var o=e[n];bt.argument(o.tableName.length===4,"Table name"+o.tableName+" is invalid.");var l=o.sizeOf(),u=$L(o.tableName,F2(o.encode()),a,l);for(i.push({name:u.tag+" Table Record",type:"RECORD",value:u}),s.push({name:o.tableName+" table",type:"RECORD",value:o}),a+=l,bt.argument(!isNaN(a),"Something went wrong calculating the offset.");a%4!==0;)a+=1,s.push({name:"padding",type:"BYTE",value:0})}return i.sort(function(h,d){return h.value.tag>d.value.tag?1:-1}),t.fields=t.fields.concat(i),t.fields=t.fields.concat(s),t}function YL(e,t,r){for(var i=0;i<t.length;i+=1){var s=e.charToGlyphIndex(t[i]);if(s>0){var a=e.glyphs.get(s);return a.getMetrics()}}return r}function ume(e){for(var t=0,r=0;r<e.length;r+=1)t+=e[r];return t/e.length}function hme(e){for(var t=[],r=[],i=[],s=[],a=[],n=[],o=[],l,u=0,h=0,d=0,c=0,m=0,g=0;g<e.glyphs.length;g+=1){var y=e.glyphs.get(g),b=y.unicode|0;if(isNaN(y.advanceWidth))throw new Error("Glyph "+y.name+" ("+g+"): advanceWidth is not a number.");(l>b||l===void 0)&&b>0&&(l=b),u<b&&(u=b);var v=I2.getUnicodeRange(b);if(v<32)h|=1<<v;else if(v<64)d|=1<<v-32;else if(v<96)c|=1<<v-64;else if(v<123)m|=1<<v-96;else throw new Error("Unicode ranges bits > 123 are reserved for internal usage");if(y.name!==".notdef"){var S=y.getMetrics();t.push(S.xMin),r.push(S.yMin),i.push(S.xMax),s.push(S.yMax),n.push(S.leftSideBearing),o.push(S.rightSideBearing),a.push(y.advanceWidth)}}var T={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,r),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,s),advanceWidthMax:Math.max.apply(null,a),advanceWidthAvg:ume(a),minLeftSideBearing:Math.min.apply(null,n),maxLeftSideBearing:Math.max.apply(null,n),minRightSideBearing:Math.min.apply(null,o)};T.ascender=e.ascender,T.descender=e.descender;var w=PL.make({flags:3,unitsPerEm:e.unitsPerEm,xMin:T.xMin,yMin:T.yMin,xMax:T.xMax,yMax:T.yMax,lowestRecPPEM:3,createdTimestamp:e.createdTimestamp}),N=BL.make({ascender:T.ascender,descender:T.descender,advanceWidthMax:T.advanceWidthMax,minLeftSideBearing:T.minLeftSideBearing,minRightSideBearing:T.minRightSideBearing,xMaxExtent:T.maxLeftSideBearing+(T.xMax-T.xMin),numberOfHMetrics:e.glyphs.length}),C=LL.make(e.glyphs.length),R=I2.make(Object.assign({xAvgCharWidth:Math.round(T.advanceWidthAvg),usFirstCharIndex:l,usLastCharIndex:u,ulUnicodeRange1:h,ulUnicodeRange2:d,ulUnicodeRange3:c,ulUnicodeRange4:m,sTypoAscender:T.ascender,sTypoDescender:T.descender,sTypoLineGap:0,usWinAscent:T.yMax,usWinDescent:Math.abs(T.yMin),ulCodePageRange1:1,sxHeight:YL(e,"xyvw",{yMax:Math.round(T.ascender/2)}).yMax,sCapHeight:YL(e,"HIKLEFJMNTZBDPRAGOQSUVWXY",T).yMax,usDefaultChar:e.hasChar(" ")?32:0,usBreakChar:e.hasChar(" ")?32:0},e.tables.os2)),E=IL.make(e.glyphs),P=fL.make(e.glyphs),I=e.getEnglishName("fontFamily"),O=e.getEnglishName("fontSubfamily"),L=I+" "+O,X=e.getEnglishName("postScriptName");X||(X=I.replace(/\s/g,"")+"-"+O);var z={};for(var H in e.names)z[H]=e.names[H];z.uniqueID||(z.uniqueID={en:e.getEnglishName("manufacturer")+":"+L}),z.postScriptName||(z.postScriptName={en:X}),z.preferredFamily||(z.preferredFamily=e.names.fontFamily),z.preferredSubfamily||(z.preferredSubfamily=e.names.fontSubfamily);var ue=[],ne=GL.make(z,ue),re=ue.length>0?FL.make(ue):void 0,ce=WL.make(),ge=EL.make(e.glyphs,{version:e.getEnglishName("version"),fullName:L,familyName:I,weightName:O,postScriptName:X,unitsPerEm:e.unitsPerEm,fontBBox:[0,T.yMin,T.ascender,T.advanceWidthMax]}),ye=e.metas&&Object.keys(e.metas).length>0?HL.make(e.metas):void 0,oe=[w,N,C,R,ne,P,ce,ge,E];re&&oe.push(re),e.tables.gsub&&oe.push(jL.make(e.tables.gsub)),ye&&oe.push(ye);for(var Ae=qL(oe),Ie=Ae.encode(),Xe=F2(Ie),at=Ae.fields,W=!1,j=0;j<at.length;j+=1)if(at[j].name==="head table"){at[j].value.checkSumAdjustment=2981146554-Xe,W=!0;break}if(!W)throw new Error("Could not find head table with checkSum to adjust.");return Ae}var dme={make:qL,fontToTable:hme,computeCheckSum:F2};function L2(e,t){for(var r=0,i=e.length-1;r<=i;){var s=r+i>>>1,a=e[s].tag;if(a===t)return s;a<t?r=s+1:i=s-1}return-r-1}function ZL(e,t){for(var r=0,i=e.length-1;r<=i;){var s=r+i>>>1,a=e[s];if(a===t)return s;a<t?r=s+1:i=s-1}return-r-1}function JL(e,t){for(var r,i=0,s=e.length-1;i<=s;){var a=i+s>>>1;r=e[a];var n=r.start;if(n===t)return r;n<t?i=a+1:s=a-1}if(i>0)return r=e[i-1],t>r.end?0:r}function lf(e,t){this.font=e,this.tableName=t}lf.prototype={searchTag:L2,binSearch:ZL,getTable:function(e){var t=this.font.tables[this.tableName];return!t&&e&&(t=this.font.tables[this.tableName]=this.createDefaultTable()),t},getScriptNames:function(){var e=this.getTable();return e?e.scripts.map(function(t){return t.tag}):[]},getDefaultScriptName:function(){var e=this.getTable();if(e){for(var t=!1,r=0;r<e.scripts.length;r++){var i=e.scripts[r].tag;if(i==="DFLT")return i;i==="latn"&&(t=!0)}if(t)return"latn"}},getScriptTable:function(e,t){var r=this.getTable(t);if(r){e=e||"DFLT";var i=r.scripts,s=L2(r.scripts,e);if(s>=0)return i[s].script;if(t){var a={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-s,0,a),a.script}}},getLangSysTable:function(e,t,r){var i=this.getScriptTable(e,r);if(i){if(!t||t==="dflt"||t==="DFLT")return i.defaultLangSys;var s=L2(i.langSysRecords,t);if(s>=0)return i.langSysRecords[s].langSys;if(r){var a={tag:t,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-s,0,a),a.langSys}}},getFeatureTable:function(e,t,r,i){var s=this.getLangSysTable(e,t,i);if(s){for(var a,n=s.featureIndexes,o=this.font.tables[this.tableName].features,l=0;l<n.length;l++)if(a=o[n[l]],a.tag===r)return a.feature;if(i){var u=o.length;return bt.assert(u===0||r>=o[u-1].tag,"Features must be added in alphabetical order."),a={tag:r,feature:{params:0,lookupListIndexes:[]}},o.push(a),n.push(u),a.feature}}},getLookupTables:function(e,t,r,i,s){var a=this.getFeatureTable(e,t,r,s),n=[];if(a){for(var o,l=a.lookupListIndexes,u=this.font.tables[this.tableName].lookups,h=0;h<l.length;h++)o=u[l[h]],o.lookupType===i&&n.push(o);if(n.length===0&&s){o={lookupType:i,lookupFlag:0,subtables:[],markFilteringSet:void 0};var d=u.length;return u.push(o),l.push(d),[o]}}return n},getGlyphClass:function(e,t){switch(e.format){case 1:return e.startGlyph<=t&&t<e.startGlyph+e.classes.length?e.classes[t-e.startGlyph]:0;case 2:var r=JL(e.ranges,t);return r?r.classId:0}},getCoverageIndex:function(e,t){switch(e.format){case 1:var r=ZL(e.glyphs,t);return r>=0?r:-1;case 2:var i=JL(e.ranges,t);return i?i.index+t-i.start:-1}},expandCoverage:function(e){if(e.format===1)return e.glyphs;for(var t=[],r=e.ranges,i=0;i<r.length;i++)for(var s=r[i],a=s.start,n=s.end,o=a;o<=n;o++)t.push(o);return t}};function uf(e){lf.call(this,e,"gpos")}uf.prototype=lf.prototype,uf.prototype.init=function(){var e=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(e)},uf.prototype.getKerningValue=function(e,t,r){for(var i=0;i<e.length;i++)for(var s=e[i].subtables,a=0;a<s.length;a++){var n=s[a],o=this.getCoverageIndex(n.coverage,t);if(!(o<0))switch(n.posFormat){case 1:for(var l=n.pairSets[o],u=0;u<l.length;u++){var h=l[u];if(h.secondGlyph===r)return h.value1&&h.value1.xAdvance||0}break;case 2:var d=this.getGlyphClass(n.classDef1,t),c=this.getGlyphClass(n.classDef2,r),m=n.classRecords[d][c];return m.value1&&m.value1.xAdvance||0}}return 0},uf.prototype.getKerningTables=function(e,t){if(this.font.tables.gpos)return this.getLookupTables(e,t,"kern",2)};function sa(e){lf.call(this,e,"gsub")}function cme(e,t){var r=e.length;if(r!==t.length)return!1;for(var i=0;i<r;i++)if(e[i]!==t[i])return!1;return!0}function k2(e,t,r){for(var i=e.subtables,s=0;s<i.length;s++){var a=i[s];if(a.substFormat===t)return a}if(r)return i.push(r),r}sa.prototype=lf.prototype,sa.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},sa.prototype.getSingle=function(e,t,r){for(var i=[],s=this.getLookupTables(t,r,e,1),a=0;a<s.length;a++)for(var n=s[a].subtables,o=0;o<n.length;o++){var l=n[o],u=this.expandCoverage(l.coverage),h=void 0;if(l.substFormat===1){var d=l.deltaGlyphId;for(h=0;h<u.length;h++){var c=u[h];i.push({sub:c,by:c+d})}}else{var m=l.substitute;for(h=0;h<u.length;h++)i.push({sub:u[h],by:m[h]})}}return i},sa.prototype.getMultiple=function(e,t,r){for(var i=[],s=this.getLookupTables(t,r,e,2),a=0;a<s.length;a++)for(var n=s[a].subtables,o=0;o<n.length;o++){var l=n[o],u=this.expandCoverage(l.coverage),h=void 0;for(h=0;h<u.length;h++){var d=u[h],c=l.sequences[h];i.push({sub:d,by:c})}}return i},sa.prototype.getAlternates=function(e,t,r){for(var i=[],s=this.getLookupTables(t,r,e,3),a=0;a<s.length;a++)for(var n=s[a].subtables,o=0;o<n.length;o++)for(var l=n[o],u=this.expandCoverage(l.coverage),h=l.alternateSets,d=0;d<u.length;d++)i.push({sub:u[d],by:h[d]});return i},sa.prototype.getLigatures=function(e,t,r){for(var i=[],s=this.getLookupTables(t,r,e,4),a=0;a<s.length;a++)for(var n=s[a].subtables,o=0;o<n.length;o++)for(var l=n[o],u=this.expandCoverage(l.coverage),h=l.ligatureSets,d=0;d<u.length;d++)for(var c=u[d],m=h[d],g=0;g<m.length;g++){var y=m[g];i.push({sub:[c].concat(y.components),by:y.ligGlyph})}return i},sa.prototype.addSingle=function(e,t,r,i){var s=this.getLookupTables(r,i,e,1,!0)[0],a=k2(s,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});bt.assert(a.coverage.format===1,"Single: unable to modify coverage table format "+a.coverage.format);var n=t.sub,o=this.binSearch(a.coverage.glyphs,n);o<0&&(o=-1-o,a.coverage.glyphs.splice(o,0,n),a.substitute.splice(o,0,0)),a.substitute[o]=t.by},sa.prototype.addMultiple=function(e,t,r,i){bt.assert(t.by instanceof Array&&t.by.length>1,'Multiple: "by" must be an array of two or more ids');var s=this.getLookupTables(r,i,e,2,!0)[0],a=k2(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});bt.assert(a.coverage.format===1,"Multiple: unable to modify coverage table format "+a.coverage.format);var n=t.sub,o=this.binSearch(a.coverage.glyphs,n);o<0&&(o=-1-o,a.coverage.glyphs.splice(o,0,n),a.sequences.splice(o,0,0)),a.sequences[o]=t.by},sa.prototype.addAlternate=function(e,t,r,i){var s=this.getLookupTables(r,i,e,3,!0)[0],a=k2(s,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});bt.assert(a.coverage.format===1,"Alternate: unable to modify coverage table format "+a.coverage.format);var n=t.sub,o=this.binSearch(a.coverage.glyphs,n);o<0&&(o=-1-o,a.coverage.glyphs.splice(o,0,n),a.alternateSets.splice(o,0,0)),a.alternateSets[o]=t.by},sa.prototype.addLigature=function(e,t,r,i){var s=this.getLookupTables(r,i,e,4,!0)[0],a=s.subtables[0];a||(a={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},s.subtables[0]=a),bt.assert(a.coverage.format===1,"Ligature: unable to modify coverage table format "+a.coverage.format);var n=t.sub[0],o=t.sub.slice(1),l={ligGlyph:t.by,components:o},u=this.binSearch(a.coverage.glyphs,n);if(u>=0){for(var h=a.ligatureSets[u],d=0;d<h.length;d++)if(cme(h[d].components,o))return;h.push(l)}else u=-1-u,a.coverage.glyphs.splice(u,0,n),a.ligatureSets.splice(u,0,[l])},sa.prototype.getFeature=function(e,t,r){if(/ss\d\d/.test(e))return this.getSingle(e,t,r);switch(e){case"aalt":case"salt":return this.getSingle(e,t,r).concat(this.getAlternates(e,t,r));case"dlig":case"liga":case"rlig":return this.getLigatures(e,t,r);case"ccmp":return this.getMultiple(e,t,r).concat(this.getLigatures(e,t,r));case"stch":return this.getMultiple(e,t,r)}},sa.prototype.add=function(e,t,r,i){if(/ss\d\d/.test(e))return this.addSingle(e,t,r,i);switch(e){case"aalt":case"salt":return typeof t.by=="number"?this.addSingle(e,t,r,i):this.addAlternate(e,t,r,i);case"dlig":case"liga":case"rlig":return this.addLigature(e,t,r,i);case"ccmp":return t.by instanceof Array?this.addMultiple(e,t,r,i):this.addLigature(e,t,r,i)}};function pme(){return typeof window<"u"}function QL(e){for(var t=new ArrayBuffer(e.length),r=new Uint8Array(t),i=0;i<e.length;++i)r[i]=e[i];return t}function mme(e){for(var t=new Buffer(e.byteLength),r=new Uint8Array(e),i=0;i<t.length;++i)t[i]=r[i];return t}function hf(e,t){if(!e)throw t}function KL(e,t,r,i,s){var a;return(t&i)>0?(a=e.parseByte(),(t&s)===0&&(a=-a),a=r+a):(t&s)>0?a=r:a=r+e.parseShort(),a}function ek(e,t,r){var i=new ot.Parser(t,r);e.numberOfContours=i.parseShort(),e._xMin=i.parseShort(),e._yMin=i.parseShort(),e._xMax=i.parseShort(),e._yMax=i.parseShort();var s,a;if(e.numberOfContours>0){for(var n=e.endPointIndices=[],o=0;o<e.numberOfContours;o+=1)n.push(i.parseUShort());e.instructionLength=i.parseUShort(),e.instructions=[];for(var l=0;l<e.instructionLength;l+=1)e.instructions.push(i.parseByte());var u=n[n.length-1]+1;s=[];for(var h=0;h<u;h+=1)if(a=i.parseByte(),s.push(a),(a&8)>0)for(var d=i.parseByte(),c=0;c<d;c+=1)s.push(a),h+=1;if(bt.argument(s.length===u,"Bad flags."),n.length>0){var m=[],g;if(u>0){for(var y=0;y<u;y+=1)a=s[y],g={},g.onCurve=!!(a&1),g.lastPointOfContour=n.indexOf(y)>=0,m.push(g);for(var b=0,v=0;v<u;v+=1)a=s[v],g=m[v],g.x=KL(i,a,b,2,16),b=g.x;for(var S=0,T=0;T<u;T+=1)a=s[T],g=m[T],g.y=KL(i,a,S,4,32),S=g.y}e.points=m}else e.points=[]}else if(e.numberOfContours===0)e.points=[];else{e.isComposite=!0,e.points=[],e.components=[];for(var w=!0;w;){s=i.parseUShort();var N={glyphIndex:i.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(s&1)>0?(s&2)>0?(N.dx=i.parseShort(),N.dy=i.parseShort()):N.matchedPoints=[i.parseUShort(),i.parseUShort()]:(s&2)>0?(N.dx=i.parseChar(),N.dy=i.parseChar()):N.matchedPoints=[i.parseByte(),i.parseByte()],(s&8)>0?N.xScale=N.yScale=i.parseF2Dot14():(s&64)>0?(N.xScale=i.parseF2Dot14(),N.yScale=i.parseF2Dot14()):(s&128)>0&&(N.xScale=i.parseF2Dot14(),N.scale01=i.parseF2Dot14(),N.scale10=i.parseF2Dot14(),N.yScale=i.parseF2Dot14()),e.components.push(N),w=!!(s&32)}if(s&256){e.instructionLength=i.parseUShort(),e.instructions=[];for(var C=0;C<e.instructionLength;C+=1)e.instructions.push(i.parseByte())}}}function D2(e,t){for(var r=[],i=0;i<e.length;i+=1){var s=e[i],a={x:t.xScale*s.x+t.scale01*s.y+t.dx,y:t.scale10*s.x+t.yScale*s.y+t.dy,onCurve:s.onCurve,lastPointOfContour:s.lastPointOfContour};r.push(a)}return r}function fme(e){for(var t=[],r=[],i=0;i<e.length;i+=1){var s=e[i];r.push(s),s.lastPointOfContour&&(t.push(r),r=[])}return bt.argument(r.length===0,"There are still points left in the current contour."),t}function tk(e){var t=new di;if(!e)return t;for(var r=fme(e),i=0;i<r.length;++i){var s=r[i],a=null,n=s[s.length-1],o=s[0];if(n.onCurve)t.moveTo(n.x,n.y);else if(o.onCurve)t.moveTo(o.x,o.y);else{var l={x:(n.x+o.x)*.5,y:(n.y+o.y)*.5};t.moveTo(l.x,l.y)}for(var u=0;u<s.length;++u)if(a=n,n=o,o=s[(u+1)%s.length],n.onCurve)t.lineTo(n.x,n.y);else{var h=a,d=o;a.onCurve||(h={x:(n.x+a.x)*.5,y:(n.y+a.y)*.5}),o.onCurve||(d={x:(n.x+o.x)*.5,y:(n.y+o.y)*.5}),t.quadraticCurveTo(n.x,n.y,d.x,d.y)}t.closePath()}return t}function rk(e,t){if(t.isComposite)for(var r=0;r<t.components.length;r+=1){var i=t.components[r],s=e.get(i.glyphIndex);if(s.getPath(),s.points){var a=void 0;if(i.matchedPoints===void 0)a=D2(s.points,i);else{if(i.matchedPoints[0]>t.points.length-1||i.matchedPoints[1]>s.points.length-1)throw Error("Matched points out of range in "+t.name);var n=t.points[i.matchedPoints[0]],o=s.points[i.matchedPoints[1]],l={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};o=D2([o],l)[0],l.dx=n.x-o.x,l.dy=n.y-o.y,a=D2(s.points,l)}t.points=t.points.concat(a)}}return tk(t.points)}function gme(e,t,r,i){for(var s=new Zn.GlyphSet(i),a=0;a<r.length-1;a+=1){var n=r[a],o=r[a+1];n!==o?s.push(a,Zn.ttfGlyphLoader(i,a,ek,e,t+n,rk)):s.push(a,Zn.glyphLoader(i,a))}return s}function yme(e,t,r,i){var s=new Zn.GlyphSet(i);return i._push=function(a){var n=r[a],o=r[a+1];n!==o?s.push(a,Zn.ttfGlyphLoader(i,a,ek,e,t+n,rk)):s.push(a,Zn.glyphLoader(i,a))},s}function xme(e,t,r,i,s){return s.lowMemory?yme(e,t,r,i):gme(e,t,r,i)}var ik={getPath:tk,parse:xme},sk,Mh,ak,O2;function nk(e){this.font=e,this.getCommands=function(t){return ik.getPath(t).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function vme(e){return e}function ok(e){return Math.sign(e)*Math.round(Math.abs(e))}function bme(e){return Math.sign(e)*Math.round(Math.abs(e*2))/2}function Tme(e){return Math.sign(e)*(Math.round(Math.abs(e)+.5)-.5)}function Sme(e){return Math.sign(e)*Math.ceil(Math.abs(e))}function _me(e){return Math.sign(e)*Math.floor(Math.abs(e))}var lk=function(e){var t=this.srPeriod,r=this.srPhase,i=this.srThreshold,s=1;return e<0&&(e=-e,s=-1),e+=i-r,e=Math.trunc(e/t)*t,e+=r,e<0?r*s:e*s},Jn={x:1,y:0,axis:"x",distance:function(e,t,r,i){return(r?e.xo:e.x)-(i?t.xo:t.x)},interpolate:function(e,t,r,i){var s,a,n,o,l,u,h;if(!i||i===this){if(s=e.xo-t.xo,a=e.xo-r.xo,l=t.x-t.xo,u=r.x-r.xo,n=Math.abs(s),o=Math.abs(a),h=n+o,h===0){e.x=e.xo+(l+u)/2;return}e.x=e.xo+(l*o+u*n)/h;return}if(s=i.distance(e,t,!0,!0),a=i.distance(e,r,!0,!0),l=i.distance(t,t,!1,!0),u=i.distance(r,r,!1,!0),n=Math.abs(s),o=Math.abs(a),h=n+o,h===0){Jn.setRelative(e,e,(l+u)/2,i,!0);return}Jn.setRelative(e,e,(l*o+u*n)/h,i,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(e,t,r,i,s){if(!i||i===this){e.x=(s?t.xo:t.x)+r;return}var a=s?t.xo:t.x,n=s?t.yo:t.y,o=a+r*i.x,l=n+r*i.y;e.x=o+(e.y-l)/i.normalSlope},slope:0,touch:function(e){e.xTouched=!0},touched:function(e){return e.xTouched},untouch:function(e){e.xTouched=!1}},qo={x:0,y:1,axis:"y",distance:function(e,t,r,i){return(r?e.yo:e.y)-(i?t.yo:t.y)},interpolate:function(e,t,r,i){var s,a,n,o,l,u,h;if(!i||i===this){if(s=e.yo-t.yo,a=e.yo-r.yo,l=t.y-t.yo,u=r.y-r.yo,n=Math.abs(s),o=Math.abs(a),h=n+o,h===0){e.y=e.yo+(l+u)/2;return}e.y=e.yo+(l*o+u*n)/h;return}if(s=i.distance(e,t,!0,!0),a=i.distance(e,r,!0,!0),l=i.distance(t,t,!1,!0),u=i.distance(r,r,!1,!0),n=Math.abs(s),o=Math.abs(a),h=n+o,h===0){qo.setRelative(e,e,(l+u)/2,i,!0);return}qo.setRelative(e,e,(l*o+u*n)/h,i,!0)},normalSlope:0,setRelative:function(e,t,r,i,s){if(!i||i===this){e.y=(s?t.yo:t.y)+r;return}var a=s?t.xo:t.x,n=s?t.yo:t.y,o=a+r*i.x,l=n+r*i.y;e.y=l+i.normalSlope*(e.x-o)},slope:Number.POSITIVE_INFINITY,touch:function(e){e.yTouched=!0},touched:function(e){return e.yTouched},untouch:function(e){e.yTouched=!1}};Object.freeze(Jn),Object.freeze(qo);function df(e,t){this.x=e,this.y=t,this.axis=void 0,this.slope=t/e,this.normalSlope=-e/t,Object.freeze(this)}df.prototype.distance=function(e,t,r,i){return this.x*Jn.distance(e,t,r,i)+this.y*qo.distance(e,t,r,i)},df.prototype.interpolate=function(e,t,r,i){var s,a,n,o,l,u,h;if(n=i.distance(e,t,!0,!0),o=i.distance(e,r,!0,!0),s=i.distance(t,t,!1,!0),a=i.distance(r,r,!1,!0),l=Math.abs(n),u=Math.abs(o),h=l+u,h===0){this.setRelative(e,e,(s+a)/2,i,!0);return}this.setRelative(e,e,(s*u+a*l)/h,i,!0)},df.prototype.setRelative=function(e,t,r,i,s){i=i||this;var a=s?t.xo:t.x,n=s?t.yo:t.y,o=a+r*i.x,l=n+r*i.y,u=i.normalSlope,h=this.slope,d=e.x,c=e.y;e.x=(h*d-u*o+l-c)/(h-u),e.y=h*(e.x-d)+c},df.prototype.touch=function(e){e.xTouched=!0,e.yTouched=!0};function cf(e,t){var r=Math.sqrt(e*e+t*t);return e/=r,t/=r,e===1&&t===0?Jn:e===0&&t===1?qo:new df(e,t)}function Yo(e,t,r,i){this.x=this.xo=Math.round(e*64)/64,this.y=this.yo=Math.round(t*64)/64,this.lastPointOfContour=r,this.onCurve=i,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Yo.prototype.nextTouched=function(e){for(var t=this.nextPointOnContour;!e.touched(t)&&t!==this;)t=t.nextPointOnContour;return t},Yo.prototype.prevTouched=function(e){for(var t=this.prevPointOnContour;!e.touched(t)&&t!==this;)t=t.prevPointOnContour;return t};var pf=Object.freeze(new Yo(0,0)),wme={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function iu(e,t){switch(this.env=e,this.stack=[],this.prog=t,e){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Jn,this.round=ok}}nk.prototype.exec=function(e,t){if(typeof t!="number")throw new Error("Point size is not a number!");if(!(this._errorState>2)){var r=this.font,i=this._prepState;if(!i||i.ppem!==t){var s=this._fpgmState;if(!s){iu.prototype=wme,s=this._fpgmState=new iu("fpgm",r.tables.fpgm),s.funcs=[],s.font=r,exports.DEBUG&&(console.log("---EXEC FPGM---"),s.step=-1);try{Mh(s)}catch(u){console.log("Hinting error in FPGM:"+u),this._errorState=3;return}}iu.prototype=s,i=this._prepState=new iu("prep",r.tables.prep),i.ppem=t;var a=r.tables.cvt;if(a)for(var n=i.cvt=new Array(a.length),o=t/r.unitsPerEm,l=0;l<a.length;l++)n[l]=a[l]*o;else i.cvt=[];exports.DEBUG&&(console.log("---EXEC PREP---"),i.step=-1);try{Mh(i)}catch(u){this._errorState<2&&console.log("Hinting error in PREP:"+u),this._errorState=2}}if(!(this._errorState>1))try{return ak(e,i)}catch(u){this._errorState<1&&(console.log("Hinting error:"+u),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}},ak=function(e,t){var r=t.ppem/t.font.unitsPerEm,i=r,s=e.components,a,n,o;if(iu.prototype=t,!s)o=new iu("glyf",e.instructions),exports.DEBUG&&(console.log("---EXEC GLYPH---"),o.step=-1),O2(e,o,r,i),n=o.gZone;else{var l=t.font;n=[],a=[];for(var u=0;u<s.length;u++){var h=s[u],d=l.glyphs.get(h.glyphIndex);o=new iu("glyf",d.instructions),exports.DEBUG&&(console.log("---EXEC COMP "+u+"---"),o.step=-1),O2(d,o,r,i);for(var c=Math.round(h.dx*r),m=Math.round(h.dy*i),g=o.gZone,y=o.contours,b=0;b<g.length;b++){var v=g[b];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+c,v.yo=v.y=v.y+m}var S=n.length;n.push.apply(n,g);for(var T=0;T<y.length;T++)a.push(y[T]+S)}e.instructions&&!o.inhibitGridFit&&(o=new iu("glyf",e.instructions),o.gZone=o.z0=o.z1=o.z2=n,o.contours=a,n.push(new Yo(0,0),new Yo(Math.round(e.advanceWidth*r),0)),exports.DEBUG&&(console.log("---EXEC COMPOSITE---"),o.step=-1),Mh(o),n.length-=2)}return n},O2=function(e,t,r,i){for(var s=e.points||[],a=s.length,n=t.gZone=t.z0=t.z1=t.z2=[],o=t.contours=[],l,u=0;u<a;u++)l=s[u],n[u]=new Yo(l.x*r,l.y*i,l.lastPointOfContour,l.onCurve);for(var h,d,c=0;c<a;c++)l=n[c],h||(h=l,o.push(c)),l.lastPointOfContour?(l.nextPointOnContour=h,h.prevPointOnContour=l,h=void 0):(d=n[c+1],l.nextPointOnContour=d,d.prevPointOnContour=l);if(!t.inhibitGridFit){if(exports.DEBUG){console.log("PROCESSING GLYPH",t.stack);for(var m=0;m<a;m++)console.log(m,n[m].x,n[m].y)}if(n.push(new Yo(0,0),new Yo(Math.round(e.advanceWidth*r),0)),Mh(t),n.length-=2,exports.DEBUG){console.log("FINISHED GLYPH",t.stack);for(var g=0;g<a;g++)console.log(g,n[g].x,n[g].y)}}},Mh=function(e){var t=e.prog;if(t){var r=t.length,i;for(e.ip=0;e.ip<r;e.ip++){if(exports.DEBUG&&e.step++,i=sk[t[e.ip]],!i)throw new Error("unknown instruction: 0x"+Number(t[e.ip]).toString(16));i(e)}}};function Ox(e){for(var t=e.tZone=new Array(e.gZone.length),r=0;r<t.length;r++)t[r]=new Yo(0,0)}function uk(e,t){var r=e.prog,i=e.ip,s=1,a;do if(a=r[++i],a===88)s++;else if(a===89)s--;else if(a===64)i+=r[i+1]+1;else if(a===65)i+=2*r[i+1]+1;else if(a>=176&&a<=183)i+=a-176+1;else if(a>=184&&a<=191)i+=(a-184+1)*2;else if(t&&s===1&&a===27)break;while(s>0);e.ip=i}function hk(e,t){exports.DEBUG&&console.log(t.step,"SVTCA["+e.axis+"]"),t.fv=t.pv=t.dpv=e}function dk(e,t){exports.DEBUG&&console.log(t.step,"SPVTCA["+e.axis+"]"),t.pv=t.dpv=e}function ck(e,t){exports.DEBUG&&console.log(t.step,"SFVTCA["+e.axis+"]"),t.fv=e}function pk(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z2[i],n=t.z1[s];exports.DEBUG&&console.log("SPVTL["+e+"]",i,s);var o,l;e?(o=a.y-n.y,l=n.x-a.x):(o=n.x-a.x,l=n.y-a.y),t.pv=t.dpv=cf(o,l)}function mk(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z2[i],n=t.z1[s];exports.DEBUG&&console.log("SFVTL["+e+"]",i,s);var o,l;e?(o=a.y-n.y,l=n.x-a.x):(o=n.x-a.x,l=n.y-a.y),t.fv=cf(o,l)}function Mme(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"SPVFS[]",r,i),e.pv=e.dpv=cf(i,r)}function Nme(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"SPVFS[]",r,i),e.fv=cf(i,r)}function Ame(e){var t=e.stack,r=e.pv;exports.DEBUG&&console.log(e.step,"GPV[]"),t.push(r.x*16384),t.push(r.y*16384)}function Cme(e){var t=e.stack,r=e.fv;exports.DEBUG&&console.log(e.step,"GFV[]"),t.push(r.x*16384),t.push(r.y*16384)}function Rme(e){e.fv=e.pv,exports.DEBUG&&console.log(e.step,"SFVTPV[]")}function Eme(e){var t=e.stack,r=t.pop(),i=t.pop(),s=t.pop(),a=t.pop(),n=t.pop(),o=e.z0,l=e.z1,u=o[r],h=o[i],d=l[s],c=l[a],m=e.z2[n];exports.DEBUG&&console.log("ISECT[], ",r,i,s,a,n);var g=u.x,y=u.y,b=h.x,v=h.y,S=d.x,T=d.y,w=c.x,N=c.y,C=(g-b)*(T-N)-(y-v)*(S-w),R=g*v-y*b,E=S*N-T*w;m.x=(R*(S-w)-E*(g-b))/C,m.y=(R*(T-N)-E*(y-v))/C}function Pme(e){e.rp0=e.stack.pop(),exports.DEBUG&&console.log(e.step,"SRP0[]",e.rp0)}function Bme(e){e.rp1=e.stack.pop(),exports.DEBUG&&console.log(e.step,"SRP1[]",e.rp1)}function Ime(e){e.rp2=e.stack.pop(),exports.DEBUG&&console.log(e.step,"SRP2[]",e.rp2)}function Fme(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"SZP0[]",t),e.zp0=t,t){case 0:e.tZone||Ox(e),e.z0=e.tZone;break;case 1:e.z0=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function Lme(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"SZP1[]",t),e.zp1=t,t){case 0:e.tZone||Ox(e),e.z1=e.tZone;break;case 1:e.z1=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function kme(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"SZP2[]",t),e.zp2=t,t){case 0:e.tZone||Ox(e),e.z2=e.tZone;break;case 1:e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function Dme(e){var t=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"SZPS[]",t),e.zp0=e.zp1=e.zp2=t,t){case 0:e.tZone||Ox(e),e.z0=e.z1=e.z2=e.tZone;break;case 1:e.z0=e.z1=e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}}function Ome(e){e.loop=e.stack.pop(),exports.DEBUG&&console.log(e.step,"SLOOP[]",e.loop)}function Ume(e){exports.DEBUG&&console.log(e.step,"RTG[]"),e.round=ok}function zme(e){exports.DEBUG&&console.log(e.step,"RTHG[]"),e.round=Tme}function Vme(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SMD[]",t),e.minDis=t/64}function Gme(e){exports.DEBUG&&console.log(e.step,"ELSE[]"),uk(e,!1)}function Wme(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"JMPR[]",t),e.ip+=t-1}function jme(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SCVTCI[]",t),e.cvCutIn=t/64}function Hme(e){var t=e.stack;exports.DEBUG&&console.log(e.step,"DUP[]"),t.push(t[t.length-1])}function U2(e){exports.DEBUG&&console.log(e.step,"POP[]"),e.stack.pop()}function Xme(e){exports.DEBUG&&console.log(e.step,"CLEAR[]"),e.stack.length=0}function $me(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"SWAP[]"),t.push(r),t.push(i)}function qme(e){var t=e.stack;exports.DEBUG&&console.log(e.step,"DEPTH[]"),t.push(t.length)}function Yme(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"LOOPCALL[]",r,i);var s=e.ip,a=e.prog;e.prog=e.funcs[r];for(var n=0;n<i;n++)Mh(e),exports.DEBUG&&console.log(++e.step,n+1<i?"next loopcall":"done loopcall",n);e.ip=s,e.prog=a}function Zme(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"CALL[]",t);var r=e.ip,i=e.prog;e.prog=e.funcs[t],Mh(e),e.ip=r,e.prog=i,exports.DEBUG&&console.log(++e.step,"returning from",t)}function Jme(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"CINDEX[]",r),t.push(t[t.length-r])}function Qme(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"MINDEX[]",r),t.push(t.splice(t.length-r,1)[0])}function Kme(e){if(e.env!=="fpgm")throw new Error("FDEF not allowed here");var t=e.stack,r=e.prog,i=e.ip,s=t.pop(),a=i;for(exports.DEBUG&&console.log(e.step,"FDEF[]",s);r[++i]!==45;);e.ip=i,e.funcs[s]=r.slice(a+1,i)}function fk(e,t){var r=t.stack.pop(),i=t.z0[r],s=t.fv,a=t.pv;exports.DEBUG&&console.log(t.step,"MDAP["+e+"]",r);var n=a.distance(i,pf);e&&(n=t.round(n)),s.setRelative(i,pf,n,a),s.touch(i),t.rp0=t.rp1=r}function gk(e,t){var r=t.z2,i=r.length-2,s,a,n;exports.DEBUG&&console.log(t.step,"IUP["+e.axis+"]");for(var o=0;o<i;o++)s=r[o],!e.touched(s)&&(a=s.prevTouched(e),a!==s&&(n=s.nextTouched(e),a===n&&e.setRelative(s,s,e.distance(a,a,!1,!0),e,!0),e.interpolate(s,a,n,e)))}function yk(e,t){for(var r=t.stack,i=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[i],a=t.fv,n=t.pv,o=t.loop,l=t.z2;o--;){var u=r.pop(),h=l[u],d=n.distance(s,s,!1,!0);a.setRelative(h,h,d,n),a.touch(h),exports.DEBUG&&console.log(t.step,(t.loop>1?"loop "+(t.loop-o)+": ":"")+"SHP["+(e?"rp1":"rp2")+"]",u)}t.loop=1}function xk(e,t){var r=t.stack,i=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[i],a=t.fv,n=t.pv,o=r.pop(),l=t.z2[t.contours[o]],u=l;exports.DEBUG&&console.log(t.step,"SHC["+e+"]",o);var h=n.distance(s,s,!1,!0);do u!==s&&a.setRelative(u,u,h,n),u=u.nextPointOnContour;while(u!==l)}function vk(e,t){var r=t.stack,i=e?t.rp1:t.rp2,s=(e?t.z0:t.z1)[i],a=t.fv,n=t.pv,o=r.pop();exports.DEBUG&&console.log(t.step,"SHZ["+e+"]",o);var l;switch(o){case 0:l=t.tZone;break;case 1:l=t.gZone;break;default:throw new Error("Invalid zone")}for(var u,h=n.distance(s,s,!1,!0),d=l.length-2,c=0;c<d;c++)u=l[c],a.setRelative(u,u,h,n)}function efe(e){for(var t=e.stack,r=e.loop,i=e.fv,s=t.pop()/64,a=e.z2;r--;){var n=t.pop(),o=a[n];exports.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-r)+": ":"")+"SHPIX[]",n,s),i.setRelative(o,o,s),i.touch(o)}e.loop=1}function tfe(e){for(var t=e.stack,r=e.rp1,i=e.rp2,s=e.loop,a=e.z0[r],n=e.z1[i],o=e.fv,l=e.dpv,u=e.z2;s--;){var h=t.pop(),d=u[h];exports.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-s)+": ":"")+"IP[]",h,r,"<->",i),o.interpolate(d,a,n,l),o.touch(d)}e.loop=1}function bk(e,t){var r=t.stack,i=r.pop()/64,s=r.pop(),a=t.z1[s],n=t.z0[t.rp0],o=t.fv,l=t.pv;o.setRelative(a,n,i,l),o.touch(a),exports.DEBUG&&console.log(t.step,"MSIRP["+e+"]",i,s),t.rp1=t.rp0,t.rp2=s,e&&(t.rp0=s)}function rfe(e){for(var t=e.stack,r=e.rp0,i=e.z0[r],s=e.loop,a=e.fv,n=e.pv,o=e.z1;s--;){var l=t.pop(),u=o[l];exports.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-s)+": ":"")+"ALIGNRP[]",l),a.setRelative(u,i,0,n),a.touch(u)}e.loop=1}function ife(e){exports.DEBUG&&console.log(e.step,"RTDG[]"),e.round=bme}function Tk(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z0[s],n=t.fv,o=t.pv,l=t.cvt[i];exports.DEBUG&&console.log(t.step,"MIAP["+e+"]",i,"(",l,")",s);var u=o.distance(a,pf);e&&(Math.abs(u-l)<t.cvCutIn&&(u=l),u=t.round(u)),n.setRelative(a,pf,u,o),t.zp0===0&&(a.xo=a.x,a.yo=a.y),n.touch(a),t.rp0=t.rp1=s}function sfe(e){var t=e.prog,r=e.ip,i=e.stack,s=t[++r];exports.DEBUG&&console.log(e.step,"NPUSHB[]",s);for(var a=0;a<s;a++)i.push(t[++r]);e.ip=r}function afe(e){var t=e.ip,r=e.prog,i=e.stack,s=r[++t];exports.DEBUG&&console.log(e.step,"NPUSHW[]",s);for(var a=0;a<s;a++){var n=r[++t]<<8|r[++t];n&32768&&(n=-((n^65535)+1)),i.push(n)}e.ip=t}function nfe(e){var t=e.stack,r=e.store;r||(r=e.store=[]);var i=t.pop(),s=t.pop();exports.DEBUG&&console.log(e.step,"WS",i,s),r[s]=i}function ofe(e){var t=e.stack,r=e.store,i=t.pop();exports.DEBUG&&console.log(e.step,"RS",i);var s=r&&r[i]||0;t.push(s)}function lfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"WCVTP",r,i),e.cvt[i]=r/64}function ufe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"RCVT",r),t.push(e.cvt[r]*64)}function Sk(e,t){var r=t.stack,i=r.pop(),s=t.z2[i];exports.DEBUG&&console.log(t.step,"GC["+e+"]",i),r.push(t.dpv.distance(s,pf,e,!1)*64)}function _k(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z1[i],n=t.z0[s],o=t.dpv.distance(n,a,e,e);exports.DEBUG&&console.log(t.step,"MD["+e+"]",i,s,"->",o),t.stack.push(Math.round(o*64))}function hfe(e){exports.DEBUG&&console.log(e.step,"MPPEM[]"),e.stack.push(e.ppem)}function dfe(e){exports.DEBUG&&console.log(e.step,"FLIPON[]"),e.autoFlip=!0}function cfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"LT[]",r,i),t.push(i<r?1:0)}function pfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"LTEQ[]",r,i),t.push(i<=r?1:0)}function mfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"GT[]",r,i),t.push(i>r?1:0)}function ffe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"GTEQ[]",r,i),t.push(i>=r?1:0)}function gfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"EQ[]",r,i),t.push(r===i?1:0)}function yfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"NEQ[]",r,i),t.push(r!==i?1:0)}function xfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"ODD[]",r),t.push(Math.trunc(r)%2?1:0)}function vfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"EVEN[]",r),t.push(Math.trunc(r)%2?0:1)}function bfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"IF[]",t),t||(uk(e,!0),exports.DEBUG&&console.log(e.step,"EIF[]"))}function Tfe(e){exports.DEBUG&&console.log(e.step,"EIF[]")}function Sfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"AND[]",r,i),t.push(r&&i?1:0)}function _fe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"OR[]",r,i),t.push(r||i?1:0)}function wfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"NOT[]",r),t.push(r?0:1)}function z2(e,t){var r=t.stack,i=r.pop(),s=t.fv,a=t.pv,n=t.ppem,o=t.deltaBase+(e-1)*16,l=t.deltaShift,u=t.z0;exports.DEBUG&&console.log(t.step,"DELTAP["+e+"]",i,r);for(var h=0;h<i;h++){var d=r.pop(),c=r.pop(),m=o+((c&240)>>4);if(m===n){var g=(c&15)-8;g>=0&&g++,exports.DEBUG&&console.log(t.step,"DELTAPFIX",d,"by",g*l);var y=u[d];s.setRelative(y,y,g*l,a)}}}function Mfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"SDB[]",r),e.deltaBase=r}function Nfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"SDS[]",r),e.deltaShift=Math.pow(.5,r)}function Afe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"ADD[]",r,i),t.push(i+r)}function Cfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"SUB[]",r,i),t.push(i-r)}function Rfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"DIV[]",r,i),t.push(i*64/r)}function Efe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"MUL[]",r,i),t.push(i*r/64)}function Pfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"ABS[]",r),t.push(Math.abs(r))}function Bfe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"NEG[]",r),t.push(-r)}function Ife(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"FLOOR[]",r),t.push(Math.floor(r/64)*64)}function Ffe(e){var t=e.stack,r=t.pop();exports.DEBUG&&console.log(e.step,"CEILING[]",r),t.push(Math.ceil(r/64)*64)}function Ux(e,t){var r=t.stack,i=r.pop();exports.DEBUG&&console.log(t.step,"ROUND[]"),r.push(t.round(i/64)*64)}function Lfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"WCVTF[]",r,i),e.cvt[i]=r*e.ppem/e.font.unitsPerEm}function V2(e,t){var r=t.stack,i=r.pop(),s=t.ppem,a=t.deltaBase+(e-1)*16,n=t.deltaShift;exports.DEBUG&&console.log(t.step,"DELTAC["+e+"]",i,r);for(var o=0;o<i;o++){var l=r.pop(),u=r.pop(),h=a+((u&240)>>4);if(h===s){var d=(u&15)-8;d>=0&&d++;var c=d*n;exports.DEBUG&&console.log(t.step,"DELTACFIX",l,"by",c),t.cvt[l]+=c}}}function kfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SROUND[]",t),e.round=lk;var r;switch(t&192){case 0:r=.5;break;case 64:r=1;break;case 128:r=2;break;default:throw new Error("invalid SROUND value")}switch(e.srPeriod=r,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*r;break;case 32:e.srPhase=.5*r;break;case 48:e.srPhase=.75*r;break;default:throw new Error("invalid SROUND value")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*r}function Dfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"S45ROUND[]",t),e.round=lk;var r;switch(t&192){case 0:r=Math.sqrt(2)/2;break;case 64:r=Math.sqrt(2);break;case 128:r=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(e.srPeriod=r,t&48){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*r;break;case 32:e.srPhase=.5*r;break;case 48:e.srPhase=.75*r;break;default:throw new Error("invalid S45ROUND value")}t&=15,t===0?e.srThreshold=0:e.srThreshold=(t/8-.5)*r}function Ofe(e){exports.DEBUG&&console.log(e.step,"ROFF[]"),e.round=vme}function Ufe(e){exports.DEBUG&&console.log(e.step,"RUTG[]"),e.round=Sme}function zfe(e){exports.DEBUG&&console.log(e.step,"RDTG[]"),e.round=_me}function Vfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SCANCTRL[]",t)}function wk(e,t){var r=t.stack,i=r.pop(),s=r.pop(),a=t.z2[i],n=t.z1[s];exports.DEBUG&&console.log(t.step,"SDPVTL["+e+"]",i,s);var o,l;e?(o=a.y-n.y,l=n.x-a.x):(o=n.x-a.x,l=n.y-a.y),t.dpv=cf(o,l)}function Gfe(e){var t=e.stack,r=t.pop(),i=0;exports.DEBUG&&console.log(e.step,"GETINFO[]",r),r&1&&(i=35),r&32&&(i|=4096),t.push(i)}function Wfe(e){var t=e.stack,r=t.pop(),i=t.pop(),s=t.pop();exports.DEBUG&&console.log(e.step,"ROLL[]"),t.push(i),t.push(r),t.push(s)}function jfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"MAX[]",r,i),t.push(Math.max(i,r))}function Hfe(e){var t=e.stack,r=t.pop(),i=t.pop();exports.DEBUG&&console.log(e.step,"MIN[]",r,i),t.push(Math.min(i,r))}function Xfe(e){var t=e.stack.pop();exports.DEBUG&&console.log(e.step,"SCANTYPE[]",t)}function $fe(e){var t=e.stack.pop(),r=e.stack.pop();switch(exports.DEBUG&&console.log(e.step,"INSTCTRL[]",t,r),t){case 1:e.inhibitGridFit=!!r;return;case 2:e.ignoreCvt=!!r;return;default:throw new Error("invalid INSTCTRL[] selector")}}function su(e,t){var r=t.stack,i=t.prog,s=t.ip;exports.DEBUG&&console.log(t.step,"PUSHB["+e+"]");for(var a=0;a<e;a++)r.push(i[++s]);t.ip=s}function au(e,t){var r=t.ip,i=t.prog,s=t.stack;exports.DEBUG&&console.log(t.ip,"PUSHW["+e+"]");for(var a=0;a<e;a++){var n=i[++r]<<8|i[++r];n&32768&&(n=-((n^65535)+1)),s.push(n)}t.ip=r}function lt(e,t,r,i,s,a){var n=a.stack,o=e&&n.pop(),l=n.pop(),u=a.rp0,h=a.z0[u],d=a.z1[l],c=a.minDis,m=a.fv,g=a.dpv,y,b,v,S;b=y=g.distance(d,h,!0,!0),v=b>=0?1:-1,b=Math.abs(b),e&&(S=a.cvt[o],i&&Math.abs(b-S)<a.cvCutIn&&(b=S)),r&&b<c&&(b=c),i&&(b=a.round(b)),m.setRelative(d,h,v*b,g),m.touch(d),exports.DEBUG&&console.log(a.step,(e?"MIRP[":"MDRP[")+(t?"M":"m")+(r?">":"_")+(i?"R":"_")+(s===0?"Gr":s===1?"Bl":s===2?"Wh":"")+"]",e?o+"("+a.cvt[o]+","+S+")":"",l,"(d =",y,"->",v*b,")"),a.rp1=a.rp0,a.rp2=l,t&&(a.rp0=l)}sk=[hk.bind(void 0,qo),hk.bind(void 0,Jn),dk.bind(void 0,qo),dk.bind(void 0,Jn),ck.bind(void 0,qo),ck.bind(void 0,Jn),pk.bind(void 0,0),pk.bind(void 0,1),mk.bind(void 0,0),mk.bind(void 0,1),Mme,Nme,Ame,Cme,Rme,Eme,Pme,Bme,Ime,Fme,Lme,kme,Dme,Ome,Ume,zme,Vme,Gme,Wme,jme,void 0,void 0,Hme,U2,Xme,$me,qme,Jme,Qme,void 0,void 0,void 0,Yme,Zme,Kme,void 0,fk.bind(void 0,0),fk.bind(void 0,1),gk.bind(void 0,qo),gk.bind(void 0,Jn),yk.bind(void 0,0),yk.bind(void 0,1),xk.bind(void 0,0),xk.bind(void 0,1),vk.bind(void 0,0),vk.bind(void 0,1),efe,tfe,bk.bind(void 0,0),bk.bind(void 0,1),rfe,ife,Tk.bind(void 0,0),Tk.bind(void 0,1),sfe,afe,nfe,ofe,lfe,ufe,Sk.bind(void 0,0),Sk.bind(void 0,1),void 0,_k.bind(void 0,0),_k.bind(void 0,1),hfe,void 0,dfe,void 0,void 0,cfe,pfe,mfe,ffe,gfe,yfe,xfe,vfe,bfe,Tfe,Sfe,_fe,wfe,z2.bind(void 0,1),Mfe,Nfe,Afe,Cfe,Rfe,Efe,Pfe,Bfe,Ife,Ffe,Ux.bind(void 0,0),Ux.bind(void 0,1),Ux.bind(void 0,2),Ux.bind(void 0,3),void 0,void 0,void 0,void 0,Lfe,z2.bind(void 0,2),z2.bind(void 0,3),V2.bind(void 0,1),V2.bind(void 0,2),V2.bind(void 0,3),kfe,Dfe,void 0,void 0,Ofe,void 0,Ufe,zfe,U2,U2,void 0,void 0,void 0,void 0,void 0,Vfe,wk.bind(void 0,0),wk.bind(void 0,1),Gfe,void 0,Wfe,jfe,Hfe,Xfe,$fe,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,su.bind(void 0,1),su.bind(void 0,2),su.bind(void 0,3),su.bind(void 0,4),su.bind(void 0,5),su.bind(void 0,6),su.bind(void 0,7),su.bind(void 0,8),au.bind(void 0,1),au.bind(void 0,2),au.bind(void 0,3),au.bind(void 0,4),au.bind(void 0,5),au.bind(void 0,6),au.bind(void 0,7),au.bind(void 0,8),lt.bind(void 0,0,0,0,0,0),lt.bind(void 0,0,0,0,0,1),lt.bind(void 0,0,0,0,0,2),lt.bind(void 0,0,0,0,0,3),lt.bind(void 0,0,0,0,1,0),lt.bind(void 0,0,0,0,1,1),lt.bind(void 0,0,0,0,1,2),lt.bind(void 0,0,0,0,1,3),lt.bind(void 0,0,0,1,0,0),lt.bind(void 0,0,0,1,0,1),lt.bind(void 0,0,0,1,0,2),lt.bind(void 0,0,0,1,0,3),lt.bind(void 0,0,0,1,1,0),lt.bind(void 0,0,0,1,1,1),lt.bind(void 0,0,0,1,1,2),lt.bind(void 0,0,0,1,1,3),lt.bind(void 0,0,1,0,0,0),lt.bind(void 0,0,1,0,0,1),lt.bind(void 0,0,1,0,0,2),lt.bind(void 0,0,1,0,0,3),lt.bind(void 0,0,1,0,1,0),lt.bind(void 0,0,1,0,1,1),lt.bind(void 0,0,1,0,1,2),lt.bind(void 0,0,1,0,1,3),lt.bind(void 0,0,1,1,0,0),lt.bind(void 0,0,1,1,0,1),lt.bind(void 0,0,1,1,0,2),lt.bind(void 0,0,1,1,0,3),lt.bind(void 0,0,1,1,1,0),lt.bind(void 0,0,1,1,1,1),lt.bind(void 0,0,1,1,1,2),lt.bind(void 0,0,1,1,1,3),lt.bind(void 0,1,0,0,0,0),lt.bind(void 0,1,0,0,0,1),lt.bind(void 0,1,0,0,0,2),lt.bind(void 0,1,0,0,0,3),lt.bind(void 0,1,0,0,1,0),lt.bind(void 0,1,0,0,1,1),lt.bind(void 0,1,0,0,1,2),lt.bind(void 0,1,0,0,1,3),lt.bind(void 0,1,0,1,0,0),lt.bind(void 0,1,0,1,0,1),lt.bind(void 0,1,0,1,0,2),lt.bind(void 0,1,0,1,0,3),lt.bind(void 0,1,0,1,1,0),lt.bind(void 0,1,0,1,1,1),lt.bind(void 0,1,0,1,1,2),lt.bind(void 0,1,0,1,1,3),lt.bind(void 0,1,1,0,0,0),lt.bind(void 0,1,1,0,0,1),lt.bind(void 0,1,1,0,0,2),lt.bind(void 0,1,1,0,0,3),lt.bind(void 0,1,1,0,1,0),lt.bind(void 0,1,1,0,1,1),lt.bind(void 0,1,1,0,1,2),lt.bind(void 0,1,1,0,1,3),lt.bind(void 0,1,1,1,0,0),lt.bind(void 0,1,1,1,0,1),lt.bind(void 0,1,1,1,0,2),lt.bind(void 0,1,1,1,0,3),lt.bind(void 0,1,1,1,1,0),lt.bind(void 0,1,1,1,1,1),lt.bind(void 0,1,1,1,1,2),lt.bind(void 0,1,1,1,1,3)];function Ic(e){this.char=e,this.state={},this.activeState=null}function G2(e,t,r){this.contextName=r,this.startIndex=e,this.endOffset=t}function qfe(e,t,r){this.contextName=e,this.openRange=null,this.ranges=[],this.checkStart=t,this.checkEnd=r}function an(e,t){this.context=e,this.index=t,this.length=e.length,this.current=e[t],this.backtrack=e.slice(0,t),this.lookahead=e.slice(t+1)}function zx(e){this.eventId=e,this.subscribers=[]}function Yfe(e){var t=this,r=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];r.forEach(function(s){Object.defineProperty(t.events,s,{value:new zx(s)})}),e&&r.forEach(function(s){var a=e[s];typeof a=="function"&&t.events[s].subscribe(a)});var i=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];i.forEach(function(s){t.events[s].subscribe(t.updateContextsRanges)})}function Xr(e){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],Yfe.call(this,e)}Ic.prototype.setState=function(e,t){return this.state[e]=t,this.activeState={key:e,value:this.state[e]},this.activeState},Ic.prototype.getState=function(e){return this.state[e]||null},Xr.prototype.inboundIndex=function(e){return e>=0&&e<this.tokens.length},Xr.prototype.composeRUD=function(e){var t=this,r=!0,i=e.map(function(a){return t[a[0]].apply(t,a.slice(1).concat(r))}),s=function(a){return typeof a=="object"&&a.hasOwnProperty("FAIL")};if(i.every(s))return{FAIL:"composeRUD: one or more operations hasn't completed successfully",report:i.filter(s)};this.dispatch("composeRUD",[i.filter(function(a){return!s(a)})])},Xr.prototype.replaceRange=function(e,t,r,i){t=t!==null?t:this.tokens.length;var s=r.every(function(n){return n instanceof Ic});if(!isNaN(e)&&this.inboundIndex(e)&&s){var a=this.tokens.splice.apply(this.tokens,[e,t].concat(r));return i||this.dispatch("replaceToken",[e,t,r]),[a,r]}else return{FAIL:"replaceRange: invalid tokens or startIndex."}},Xr.prototype.replaceToken=function(e,t,r){if(!isNaN(e)&&this.inboundIndex(e)&&t instanceof Ic){var i=this.tokens.splice(e,1,t);return r||this.dispatch("replaceToken",[e,t]),[i[0],t]}else return{FAIL:"replaceToken: invalid token or index."}},Xr.prototype.removeRange=function(e,t,r){t=isNaN(t)?this.tokens.length:t;var i=this.tokens.splice(e,t);return r||this.dispatch("removeRange",[i,e,t]),i},Xr.prototype.removeToken=function(e,t){if(!isNaN(e)&&this.inboundIndex(e)){var r=this.tokens.splice(e,1);return t||this.dispatch("removeToken",[r,e]),r}else return{FAIL:"removeToken: invalid token index."}},Xr.prototype.insertToken=function(e,t,r){var i=e.every(function(s){return s instanceof Ic});return i?(this.tokens.splice.apply(this.tokens,[t,0].concat(e)),r||this.dispatch("insertToken",[e,t]),e):{FAIL:"insertToken: invalid token(s)."}},Xr.prototype.registerModifier=function(e,t,r){this.events.newToken.subscribe(function(i,s){var a=[i,s],n=t===null||t.apply(this,a)===!0,o=[i,s];if(n){var l=r.apply(this,o);i.setState(e,l)}}),this.registeredModifiers.push(e)},zx.prototype.subscribe=function(e){return typeof e=="function"?this.subscribers.push(e)-1:{FAIL:"invalid '"+this.eventId+"' event handler"}},zx.prototype.unsubscribe=function(e){this.subscribers.splice(e,1)},an.prototype.setCurrentIndex=function(e){this.index=e,this.current=this.context[e],this.backtrack=this.context.slice(0,e),this.lookahead=this.context.slice(e+1)},an.prototype.get=function(e){switch(!0){case e===0:return this.current;case(e<0&&Math.abs(e)<=this.backtrack.length):return this.backtrack.slice(e)[0];case(e>0&&e<=this.lookahead.length):return this.lookahead[e-1];default:return null}},Xr.prototype.rangeToText=function(e){if(e instanceof G2)return this.getRangeTokens(e).map(function(t){return t.char}).join("")},Xr.prototype.getText=function(){return this.tokens.map(function(e){return e.char}).join("")},Xr.prototype.getContext=function(e){var t=this.registeredContexts[e];return t||null},Xr.prototype.on=function(e,t){var r=this.events[e];return r?r.subscribe(t):null},Xr.prototype.dispatch=function(e,t){var r=this,i=this.events[e];i instanceof zx&&i.subscribers.forEach(function(s){s.apply(r,t||[])})},Xr.prototype.registerContextChecker=function(e,t,r){if(this.getContext(e))return{FAIL:"context name '"+e+"' is already registered."};if(typeof t!="function")return{FAIL:"missing context start check."};if(typeof r!="function")return{FAIL:"missing context end check."};var i=new qfe(e,t,r);return this.registeredContexts[e]=i,this.contextCheckers.push(i),i},Xr.prototype.getRangeTokens=function(e){var t=e.startIndex+e.endOffset;return[].concat(this.tokens.slice(e.startIndex,t))},Xr.prototype.getContextRanges=function(e){var t=this.getContext(e);return t?t.ranges:{FAIL:"context checker '"+e+"' is not registered."}},Xr.prototype.resetContextsRanges=function(){var e=this.registeredContexts;for(var t in e)if(e.hasOwnProperty(t)){var r=e[t];r.ranges=[]}},Xr.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var e=this.tokens.map(function(i){return i.char}),t=0;t<e.length;t++){var r=new an(e,t);this.runContextCheck(r)}this.dispatch("updateContextsRanges",[this.registeredContexts])},Xr.prototype.setEndOffset=function(e,t){var r=this.getContext(t).openRange.startIndex,i=new G2(r,e,t),s=this.getContext(t).ranges;return i.rangeId=t+"."+s.length,s.push(i),this.getContext(t).openRange=null,i},Xr.prototype.runContextCheck=function(e){var t=this,r=e.index;this.contextCheckers.forEach(function(i){var s=i.contextName,a=t.getContext(s).openRange;if(!a&&i.checkStart(e)&&(a=new G2(r,null,s),t.getContext(s).openRange=a,t.dispatch("contextStart",[s,r])),a&&i.checkEnd(e)){var n=r-a.startIndex+1,o=t.setEndOffset(n,s);t.dispatch("contextEnd",[s,o])}})},Xr.prototype.tokenize=function(e){this.tokens=[],this.resetContextsRanges();var t=Array.from(e);this.dispatch("start");for(var r=0;r<t.length;r++){var i=t[r],s=new an(t,r);this.dispatch("next",[s]),this.runContextCheck(s);var a=new Ic(i);this.tokens.push(a),this.dispatch("newToken",[a,s])}return this.dispatch("end",[this.tokens]),this.tokens};function nu(e){return/[\u0600-\u065F\u066A-\u06D2\u06FA-\u06FF]/.test(e)}function Mk(e){return/[\u0630\u0690\u0621\u0631\u0661\u0671\u0622\u0632\u0672\u0692\u06C2\u0623\u0673\u0693\u06C3\u0624\u0694\u06C4\u0625\u0675\u0695\u06C5\u06E5\u0676\u0696\u06C6\u0627\u0677\u0697\u06C7\u0648\u0688\u0698\u06C8\u0689\u0699\u06C9\u068A\u06CA\u066B\u068B\u06CB\u068C\u068D\u06CD\u06FD\u068E\u06EE\u06FE\u062F\u068F\u06CF\u06EF]/.test(e)}function ou(e){return/[\u0600-\u0605\u060C-\u060E\u0610-\u061B\u061E\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED]/.test(e)}function Vx(e){return/[A-z]/.test(e)}function Zfe(e){return/\s/.test(e)}function aa(e){this.font=e,this.features={}}function Nh(e){this.id=e.id,this.tag=e.tag,this.substitution=e.substitution}function mf(e,t){if(!e)return-1;switch(t.format){case 1:return t.glyphs.indexOf(e);case 2:for(var r=t.ranges,i=0;i<r.length;i++){var s=r[i];if(e>=s.start&&e<=s.end){var a=e-s.start;return s.index+a}}break;default:return-1}return-1}function Jfe(e,t){var r=mf(e,t.coverage);return r===-1?null:e+t.deltaGlyphId}function Qfe(e,t){var r=mf(e,t.coverage);return r===-1?null:t.substitute[r]}function W2(e,t){for(var r=[],i=0;i<e.length;i++){var s=e[i],a=t.current;a=Array.isArray(a)?a[0]:a;var n=mf(a,s);n!==-1&&r.push(n)}return r.length!==e.length?-1:r}function Kfe(e,t){var r=t.inputCoverage.length+t.lookaheadCoverage.length+t.backtrackCoverage.length;if(e.context.length<r)return[];var i=W2(t.inputCoverage,e);if(i===-1)return[];var s=t.inputCoverage.length-1;if(e.lookahead.length<t.lookaheadCoverage.length)return[];for(var a=e.lookahead.slice(s);a.length&&ou(a[0].char);)a.shift();var n=new an(a,0),o=W2(t.lookaheadCoverage,n),l=[].concat(e.backtrack);for(l.reverse();l.length&&ou(l[0].char);)l.shift();if(l.length<t.backtrackCoverage.length)return[];var u=new an(l,0),h=W2(t.backtrackCoverage,u),d=i.length===t.inputCoverage.length&&o.length===t.lookaheadCoverage.length&&h.length===t.backtrackCoverage.length,c=[];if(d)for(var m=0;m<t.lookupRecords.length;m++)for(var g=t.lookupRecords[m],y=g.lookupListIndex,b=this.getLookupByIndex(y),v=0;v<b.subtables.length;v++){var S=b.subtables[v],T=this.getLookupMethod(b,S),w=this.getSubstitutionType(b,S);if(w==="12")for(var N=0;N<i.length;N++){var C=e.get(N),R=T(C);R&&c.push(R)}}return c}function ege(e,t){var r=e.current,i=mf(r,t.coverage);if(i===-1)return null;for(var s,a=t.ligatureSets[i],n=0;n<a.length;n++){s=a[n];for(var o=0;o<s.components.length;o++){var l=e.lookahead[o],u=s.components[o];if(l!==u)break;if(o===s.components.length-1)return s}}return null}function tge(e,t){var r=mf(e,t.coverage);return r===-1?null:t.sequences[r]}aa.prototype.getDefaultScriptFeaturesIndexes=function(){for(var e=this.font.tables.gsub.scripts,t=0;t<e.length;t++){var r=e[t];if(r.tag==="DFLT")return r.script.defaultLangSys.featureIndexes}return[]},aa.prototype.getScriptFeaturesIndexes=function(e){var t=this.font.tables;if(!t.gsub)return[];if(!e)return this.getDefaultScriptFeaturesIndexes();for(var r=this.font.tables.gsub.scripts,i=0;i<r.length;i++){var s=r[i];if(s.tag===e&&s.script.defaultLangSys)return s.script.defaultLangSys.featureIndexes;var a=s.langSysRecords;if(a)for(var n=0;n<a.length;n++){var o=a[n];if(o.tag===e){var l=o.langSys;return l.featureIndexes}}}return this.getDefaultScriptFeaturesIndexes()},aa.prototype.mapTagsToFeatures=function(e,t){for(var r={},i=0;i<e.length;i++){var s=e[i].tag,a=e[i].feature;r[s]=a}this.features[t].tags=r},aa.prototype.getScriptFeatures=function(e){var t=this.features[e];if(this.features.hasOwnProperty(e))return t;var r=this.getScriptFeaturesIndexes(e);if(!r)return null;var i=this.font.tables.gsub;return t=r.map(function(s){return i.features[s]}),this.features[e]=t,this.mapTagsToFeatures(t,e),t},aa.prototype.getSubstitutionType=function(e,t){var r=e.lookupType.toString(),i=t.substFormat.toString();return r+i},aa.prototype.getLookupMethod=function(e,t){var r=this,i=this.getSubstitutionType(e,t);switch(i){case"11":return function(s){return Jfe.apply(r,[s,t])};case"12":return function(s){return Qfe.apply(r,[s,t])};case"63":return function(s){return Kfe.apply(r,[s,t])};case"41":return function(s){return ege.apply(r,[s,t])};case"21":return function(s){return tge.apply(r,[s,t])};default:throw new Error("lookupType: "+e.lookupType+" - substFormat: "+t.substFormat+" is not yet supported")}},aa.prototype.lookupFeature=function(e){var t=e.contextParams,r=t.index,i=this.getFeature({tag:e.tag,script:e.script});if(!i)return new Error("font '"+this.font.names.fullName.en+"' doesn't support feature '"+e.tag+"' for script '"+e.script+"'.");for(var s=this.getFeatureLookups(i),a=[].concat(t.context),n=0;n<s.length;n++)for(var o=s[n],l=this.getLookupSubtables(o),u=0;u<l.length;u++){var h=l[u],d=this.getSubstitutionType(o,h),c=this.getLookupMethod(o,h),m=void 0;switch(d){case"11":m=c(t.current),m&&a.splice(r,1,new Nh({id:11,tag:e.tag,substitution:m}));break;case"12":m=c(t.current),m&&a.splice(r,1,new Nh({id:12,tag:e.tag,substitution:m}));break;case"63":m=c(t),Array.isArray(m)&&m.length&&a.splice(r,1,new Nh({id:63,tag:e.tag,substitution:m}));break;case"41":m=c(t),m&&a.splice(r,1,new Nh({id:41,tag:e.tag,substitution:m}));break;case"21":m=c(t.current),m&&a.splice(r,1,new Nh({id:21,tag:e.tag,substitution:m}));break}t=new an(a,r),!(Array.isArray(m)&&!m.length)&&(m=null)}return a.length?a:null},aa.prototype.supports=function(e){if(!e.script)return!1;this.getScriptFeatures(e.script);var t=this.features.hasOwnProperty(e.script);if(!e.tag)return t;var r=this.features[e.script].some(function(i){return i.tag===e.tag});return t&&r},aa.prototype.getLookupSubtables=function(e){return e.subtables||null},aa.prototype.getLookupByIndex=function(e){var t=this.font.tables.gsub.lookups;return t[e]||null},aa.prototype.getFeatureLookups=function(e){return e.lookupListIndexes.map(this.getLookupByIndex.bind(this))},aa.prototype.getFeature=function(e){if(!this.font)return{FAIL:"No font was found"};this.features.hasOwnProperty(e.script)||this.getScriptFeatures(e.script);var t=this.features[e.script];return t?t.tags[e.tag]?this.features[e.script].tags[e.tag]:null:{FAIL:"No feature for script "+e.script}};function rge(e){var t=e.current,r=e.get(-1);return r===null&&nu(t)||!nu(r)&&nu(t)}function ige(e){var t=e.get(1);return t===null||!nu(t)}var sge={startCheck:rge,endCheck:ige};function age(e){var t=e.current,r=e.get(-1);return(nu(t)||ou(t))&&!nu(r)}function nge(e){var t=e.get(1);switch(!0){case t===null:return!0;case(!nu(t)&&!ou(t)):var r=Zfe(t);if(!r)return!0;if(r){var i=!1;if(i=e.lookahead.some(function(s){return nu(s)||ou(s)}),!i)return!0}break;default:return!1}}var oge={startCheck:age,endCheck:nge};function lge(e,t,r){t[r].setState(e.tag,e.substitution)}function uge(e,t,r){t[r].setState(e.tag,e.substitution)}function hge(e,t,r){e.substitution.forEach(function(i,s){var a=t[r+s];a.setState(e.tag,i)})}function dge(e,t,r){var i=t[r];i.setState(e.tag,e.substitution.ligGlyph);for(var s=e.substitution.components.length,a=0;a<s;a++)i=t[r+a+1],i.setState("deleted",!0)}var Nk={11:lge,12:uge,63:hge,41:dge};function j2(e,t,r){e instanceof Nh&&Nk[e.id]&&Nk[e.id](e,t,r)}function cge(e){for(var t=[].concat(e.backtrack),r=t.length-1;r>=0;r--){var i=t[r],s=Mk(i),a=ou(i);if(!s&&!a)return!0;if(s)return!1}return!1}function pge(e){if(Mk(e.current))return!1;for(var t=0;t<e.lookahead.length;t++){var r=e.lookahead[t],i=ou(r);if(!i)return!0}return!1}function mge(e){var t=this,r="arab",i=this.featuresTags[r],s=this.tokenizer.getRangeTokens(e);if(s.length!==1){var a=new an(s.map(function(o){return o.getState("glyphIndex")}),0),n=new an(s.map(function(o){return o.char}),0);s.forEach(function(o,l){if(!ou(o.char)){a.setCurrentIndex(l),n.setCurrentIndex(l);var u=0;cge(n)&&(u|=1),pge(n)&&(u|=2);var h;switch(u){case 1:h="fina";break;case 2:h="init";break;case 3:h="medi";break}if(i.indexOf(h)!==-1){var d=t.query.lookupFeature({tag:h,script:r,contextParams:a});if(d instanceof Error)return console.info(d.message);d.forEach(function(c,m){c instanceof Nh&&(j2(c,s,m),a.context[m]=c.substitution)})}}})}}function Ak(e,t){var r=e.map(function(i){return i.activeState.value});return new an(r,t||0)}function fge(e){var t=this,r="arab",i=this.tokenizer.getRangeTokens(e),s=Ak(i);s.context.forEach(function(a,n){s.setCurrentIndex(n);var o=t.query.lookupFeature({tag:"rlig",script:r,contextParams:s});o.length&&(o.forEach(function(l){return j2(l,i,n)}),s=Ak(i))})}function gge(e){var t=e.current,r=e.get(-1);return r===null&&Vx(t)||!Vx(r)&&Vx(t)}function yge(e){var t=e.get(1);return t===null||!Vx(t)}var xge={startCheck:gge,endCheck:yge};function Ck(e,t){var r=e.map(function(i){return i.activeState.value});return new an(r,t||0)}function vge(e){var t=this,r="latn",i=this.tokenizer.getRangeTokens(e),s=Ck(i);s.context.forEach(function(a,n){s.setCurrentIndex(n);var o=t.query.lookupFeature({tag:"liga",script:r,contextParams:s});o.length&&(o.forEach(function(l){return j2(l,i,n)}),s=Ck(i))})}function nn(e){this.baseDir=e||"ltr",this.tokenizer=new Xr,this.featuresTags={}}nn.prototype.setText=function(e){this.text=e},nn.prototype.contextChecks={latinWordCheck:xge,arabicWordCheck:sge,arabicSentenceCheck:oge};function H2(e){var t=this.contextChecks[e+"Check"];return this.tokenizer.registerContextChecker(e,t.startCheck,t.endCheck)}function bge(){return H2.call(this,"latinWord"),H2.call(this,"arabicWord"),H2.call(this,"arabicSentence"),this.tokenizer.tokenize(this.text)}function Tge(){var e=this,t=this.tokenizer.getContextRanges("arabicSentence");t.forEach(function(r){var i=e.tokenizer.getRangeTokens(r);e.tokenizer.replaceRange(r.startIndex,r.endOffset,i.reverse())})}nn.prototype.registerFeatures=function(e,t){var r=this,i=t.filter(function(s){return r.query.supports({script:e,tag:s})});this.featuresTags.hasOwnProperty(e)?this.featuresTags[e]=this.featuresTags[e].concat(i):this.featuresTags[e]=i},nn.prototype.applyFeatures=function(e,t){if(!e)throw new Error("No valid font was provided to apply features");this.query||(this.query=new aa(e));for(var r=0;r<t.length;r++){var i=t[r];this.query.supports({script:i.script})&&this.registerFeatures(i.script,i.tags)}},nn.prototype.registerModifier=function(e,t,r){this.tokenizer.registerModifier(e,t,r)};function X2(){if(this.tokenizer.registeredModifiers.indexOf("glyphIndex")===-1)throw new Error("glyphIndex modifier is required to apply arabic presentation features.")}function Sge(){var e=this,t="arab";if(this.featuresTags.hasOwnProperty(t)){X2.call(this);var r=this.tokenizer.getContextRanges("arabicWord");r.forEach(function(i){mge.call(e,i)})}}function _ge(){var e=this,t="arab";if(this.featuresTags.hasOwnProperty(t)){var r=this.featuresTags[t];if(r.indexOf("rlig")!==-1){X2.call(this);var i=this.tokenizer.getContextRanges("arabicWord");i.forEach(function(s){fge.call(e,s)})}}}function wge(){var e=this,t="latn";if(this.featuresTags.hasOwnProperty(t)){var r=this.featuresTags[t];if(r.indexOf("liga")!==-1){X2.call(this);var i=this.tokenizer.getContextRanges("latinWord");i.forEach(function(s){vge.call(e,s)})}}}nn.prototype.checkContextReady=function(e){return!!this.tokenizer.getContext(e)},nn.prototype.applyFeaturesToContexts=function(){this.checkContextReady("arabicWord")&&(Sge.call(this),_ge.call(this)),this.checkContextReady("latinWord")&&wge.call(this),this.checkContextReady("arabicSentence")&&Tge.call(this)},nn.prototype.processText=function(e){(!this.text||this.text!==e)&&(this.setText(e),bge.call(this),this.applyFeaturesToContexts())},nn.prototype.getBidiText=function(e){return this.processText(e),this.tokenizer.getText()},nn.prototype.getTextGlyphs=function(e){this.processText(e);for(var t=[],r=0;r<this.tokenizer.tokens.length;r++){var i=this.tokenizer.tokens[r];if(!i.state.deleted){var s=i.activeState.value;t.push(Array.isArray(s)?s[0]:s)}}return t};function dr(e){e=e||{},e.tables=e.tables||{},e.empty||(hf(e.familyName,"When creating a new Font object, familyName is required."),hf(e.styleName,"When creating a new Font object, styleName is required."),hf(e.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),hf(e.ascender,"When creating a new Font object, ascender is required."),hf(e.descender<=0,"When creating a new Font object, negative descender value is required."),this.names={fontFamily:{en:e.familyName||" "},fontSubfamily:{en:e.styleName||" "},fullName:{en:e.fullName||e.familyName+" "+e.styleName},postScriptName:{en:e.postScriptName||(e.familyName+e.styleName).replace(/\s/g,"")},designer:{en:e.designer||" "},designerURL:{en:e.designerURL||" "},manufacturer:{en:e.manufacturer||" "},manufacturerURL:{en:e.manufacturerURL||" "},license:{en:e.license||" "},licenseURL:{en:e.licenseURL||" "},version:{en:e.version||"Version 0.1"},description:{en:e.description||" "},copyright:{en:e.copyright||" "},trademark:{en:e.trademark||" "}},this.unitsPerEm=e.unitsPerEm||1e3,this.ascender=e.ascender,this.descender=e.descender,this.createdTimestamp=e.createdTimestamp,this.tables=Object.assign(e.tables,{os2:Object.assign({usWeightClass:e.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:e.widthClass||this.usWidthClasses.MEDIUM,fsSelection:e.fsSelection||this.fsSelectionValues.REGULAR},e.tables.os2)})),this.supported=!0,this.glyphs=new Zn.GlyphSet(this,e.glyphs||[]),this.encoding=new gL(this),this.position=new uf(this),this.substitution=new sa(this),this.tables=this.tables||{},this._push=null,this._hmtxTableData={},Object.defineProperty(this,"hinting",{get:function(){if(this._hinting)return this._hinting;if(this.outlinesFormat==="truetype")return this._hinting=new nk(this)}})}dr.prototype.hasChar=function(e){return this.encoding.charToGlyphIndex(e)!==null},dr.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)},dr.prototype.charToGlyph=function(e){var t=this.charToGlyphIndex(e),r=this.glyphs.get(t);return r||(r=this.glyphs.get(0)),r},dr.prototype.updateFeatures=function(e){return this.defaultRenderOptions.features.map(function(t){return t.script==="latn"?{script:"latn",tags:t.tags.filter(function(r){return e[r]})}:t})},dr.prototype.stringToGlyphs=function(e,t){var r=this,i=new nn,s=function(d){return r.charToGlyphIndex(d.char)};i.registerModifier("glyphIndex",null,s);var a=t?this.updateFeatures(t.features):this.defaultRenderOptions.features;i.applyFeatures(this,a);for(var n=i.getTextGlyphs(e),o=n.length,l=new Array(o),u=this.glyphs.get(0),h=0;h<o;h+=1)l[h]=this.glyphs.get(n[h])||u;return l},dr.prototype.nameToGlyphIndex=function(e){return this.glyphNames.nameToGlyphIndex(e)},dr.prototype.nameToGlyph=function(e){var t=this.nameToGlyphIndex(e),r=this.glyphs.get(t);return r||(r=this.glyphs.get(0)),r},dr.prototype.glyphIndexToName=function(e){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(e):""},dr.prototype.getKerningValue=function(e,t){e=e.index||e,t=t.index||t;var r=this.position.defaultKerningTables;return r?this.position.getKerningValue(r,e,t):this.kerningPairs[e+","+t]||0},dr.prototype.defaultRenderOptions={kerning:!0,features:[{script:"arab",tags:["init","medi","fina","rlig"]},{script:"latn",tags:["liga","rlig"]}]},dr.prototype.forEachGlyph=function(e,t,r,i,s,a){t=t!==void 0?t:0,r=r!==void 0?r:0,i=i!==void 0?i:72,s=Object.assign({},this.defaultRenderOptions,s);var n=1/this.unitsPerEm*i,o=this.stringToGlyphs(e,s),l;if(s.kerning){var u=s.script||this.position.getDefaultScriptName();l=this.position.getKerningTables(u,s.language)}for(var h=0;h<o.length;h+=1){var d=o[h];if(a.call(this,d,t,r,i,s),d.advanceWidth&&(t+=d.advanceWidth*n),s.kerning&&h<o.length-1){var c=l?this.position.getKerningValue(l,d.index,o[h+1].index):this.getKerningValue(d,o[h+1]);t+=c*n}s.letterSpacing?t+=s.letterSpacing*i:s.tracking&&(t+=s.tracking/1e3*i)}return t},dr.prototype.getPath=function(e,t,r,i,s){var a=new di;return this.forEachGlyph(e,t,r,i,s,function(n,o,l,u){var h=n.getPath(o,l,u,s,this);a.extend(h)}),a},dr.prototype.getPaths=function(e,t,r,i,s){var a=[];return this.forEachGlyph(e,t,r,i,s,function(n,o,l,u){var h=n.getPath(o,l,u,s,this);a.push(h)}),a},dr.prototype.getAdvanceWidth=function(e,t,r){return this.forEachGlyph(e,0,0,t,r,function(){})},dr.prototype.draw=function(e,t,r,i,s,a){this.getPath(t,r,i,s,a).draw(e)},dr.prototype.drawPoints=function(e,t,r,i,s,a){this.forEachGlyph(t,r,i,s,a,function(n,o,l,u){n.drawPoints(e,o,l,u)})},dr.prototype.drawMetrics=function(e,t,r,i,s,a){this.forEachGlyph(t,r,i,s,a,function(n,o,l,u){n.drawMetrics(e,o,l,u)})},dr.prototype.getEnglishName=function(e){var t=this.names[e];if(t)return t.en},dr.prototype.validate=function(){var e=this;function t(i,s){}function r(i){var s=e.getEnglishName(i);s&&s.trim().length>0}r("fontFamily"),r("weightName"),r("manufacturer"),r("copyright"),r("version"),this.unitsPerEm>0},dr.prototype.toTables=function(){return dme.fontToTable(this)},dr.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},dr.prototype.toArrayBuffer=function(){for(var e=this.toTables(),t=e.encode(),r=new ArrayBuffer(t.length),i=new Uint8Array(r),s=0;s<t.length;s++)i[s]=t[s];return r},dr.prototype.download=function(e){var t=this.getEnglishName("fontFamily"),r=this.getEnglishName("fontSubfamily");e=e||t.replace(/\s/g,"")+"-"+r+".otf";var i=this.toArrayBuffer();if(pme())if(window.URL=window.URL||window.webkitURL,window.URL){var s=new DataView(i),a=new Blob([s],{type:"font/opentype"}),n=document.createElement("a");n.href=window.URL.createObjectURL(a),n.download=e;var o=document.createEvent("MouseEvents");o.initEvent("click",!0,!1),n.dispatchEvent(o)}else console.warn("Font file could not be downloaded. Try using a different browser.");else{var l=ev(),u=mme(i);l.writeFileSync(e,u)}},dr.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},dr.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},dr.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};function Rk(e,t){var r=JSON.stringify(e),i=256;for(var s in t){var a=parseInt(s);if(!(!a||a<256)){if(JSON.stringify(t[s])===r)return a;i<=a&&(i=a+1)}}return t[i]=e,i}function Mge(e,t,r){var i=Rk(t.name,r);return[{name:"tag_"+e,type:"TAG",value:t.tag},{name:"minValue_"+e,type:"FIXED",value:t.minValue<<16},{name:"defaultValue_"+e,type:"FIXED",value:t.defaultValue<<16},{name:"maxValue_"+e,type:"FIXED",value:t.maxValue<<16},{name:"flags_"+e,type:"USHORT",value:0},{name:"nameID_"+e,type:"USHORT",value:i}]}function Nge(e,t,r){var i={},s=new ot.Parser(e,t);return i.tag=s.parseTag(),i.minValue=s.parseFixed(),i.defaultValue=s.parseFixed(),i.maxValue=s.parseFixed(),s.skip("uShort",1),i.name=r[s.parseUShort()]||{},i}function Age(e,t,r,i){for(var s=Rk(t.name,i),a=[{name:"nameID_"+e,type:"USHORT",value:s},{name:"flags_"+e,type:"USHORT",value:0}],n=0;n<r.length;++n){var o=r[n].tag;a.push({name:"axis_"+e+" "+o,type:"FIXED",value:t.coordinates[o]<<16})}return a}function Cge(e,t,r,i){var s={},a=new ot.Parser(e,t);s.name=i[a.parseUShort()]||{},a.skip("uShort",1),s.coordinates={};for(var n=0;n<r.length;++n)s.coordinates[r[n].tag]=a.parseFixed();return s}function Rge(e,t){var r=new rt.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:e.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:e.instances.length},{name:"instanceSize",type:"USHORT",value:4+e.axes.length*4}]);r.offsetToData=r.sizeOf();for(var i=0;i<e.axes.length;i++)r.fields=r.fields.concat(Mge(i,e.axes[i],t));for(var s=0;s<e.instances.length;s++)r.fields=r.fields.concat(Age(s,e.instances[s],e.axes,t));return r}function Ege(e,t,r){var i=new ot.Parser(e,t),s=i.parseULong();bt.argument(s===65536,"Unsupported fvar table version.");var a=i.parseOffset16();i.skip("uShort",1);for(var n=i.parseUShort(),o=i.parseUShort(),l=i.parseUShort(),u=i.parseUShort(),h=[],d=0;d<n;d++)h.push(Nge(e,t+a+d*o,r));for(var c=[],m=t+a+n*o,g=0;g<l;g++)c.push(Cge(e,m+g*u,h,r));return{axes:h,instances:c}}var Pge={make:Rge,parse:Ege},Bge=function(){return{coverage:this.parsePointer(ve.coverage),attachPoints:this.parseList(ve.pointer(ve.uShortList))}},Ige=function(){var e=this.parseUShort();if(bt.argument(e===1||e===2||e===3,"Unsupported CaretValue table version."),e===1)return{coordinate:this.parseShort()};if(e===2)return{pointindex:this.parseShort()};if(e===3)return{coordinate:this.parseShort()}},Fge=function(){return this.parseList(ve.pointer(Ige))},Lge=function(){return{coverage:this.parsePointer(ve.coverage),ligGlyphs:this.parseList(ve.pointer(Fge))}},kge=function(){return this.parseUShort(),this.parseList(ve.pointer(ve.coverage))};function Dge(e,t){t=t||0;var r=new ve(e,t),i=r.parseVersion(1);bt.argument(i===1||i===1.2||i===1.3,"Unsupported GDEF table version.");var s={version:i,classDef:r.parsePointer(ve.classDef),attachList:r.parsePointer(Bge),ligCaretList:r.parsePointer(Lge),markAttachClassDef:r.parsePointer(ve.classDef)};return i>=1.2&&(s.markGlyphSets=r.parsePointer(kge)),s}var Oge={parse:Dge},on=new Array(10);on[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(t===1)return{posFormat:1,coverage:this.parsePointer(ve.coverage),value:this.parseValueRecord()};if(t===2)return{posFormat:2,coverage:this.parsePointer(ve.coverage),values:this.parseValueRecordList()};bt.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},on[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();bt.assert(t===1||t===2,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var r=this.parsePointer(ve.coverage),i=this.parseUShort(),s=this.parseUShort();if(t===1)return{posFormat:t,coverage:r,valueFormat1:i,valueFormat2:s,pairSets:this.parseList(ve.pointer(ve.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(i),value2:this.parseValueRecord(s)}})))};if(t===2){var a=this.parsePointer(ve.classDef),n=this.parsePointer(ve.classDef),o=this.parseUShort(),l=this.parseUShort();return{posFormat:t,coverage:r,valueFormat1:i,valueFormat2:s,classDef1:a,classDef2:n,class1Count:o,class2Count:l,classRecords:this.parseList(o,ve.list(l,function(){return{value1:this.parseValueRecord(i),value2:this.parseValueRecord(s)}}))}}},on[3]=function(){return{error:"GPOS Lookup 3 not supported"}},on[4]=function(){return{error:"GPOS Lookup 4 not supported"}},on[5]=function(){return{error:"GPOS Lookup 5 not supported"}},on[6]=function(){return{error:"GPOS Lookup 6 not supported"}},on[7]=function(){return{error:"GPOS Lookup 7 not supported"}},on[8]=function(){return{error:"GPOS Lookup 8 not supported"}},on[9]=function(){return{error:"GPOS Lookup 9 not supported"}};function Uge(e,t){t=t||0;var r=new ve(e,t),i=r.parseVersion(1);return bt.argument(i===1||i===1.1,"Unsupported GPOS table version "+i),i===1?{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(on)}:{version:i,scripts:r.parseScriptList(),features:r.parseFeatureList(),lookups:r.parseLookupList(on),variations:r.parseFeatureVariationsList()}}var zge=new Array(10);function Vge(e){return new rt.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new rt.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new rt.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new rt.LookupList(e.lookups,zge)}])}var Gge={parse:Uge,make:Vge};function Wge(e){var t={};e.skip("uShort");var r=e.parseUShort();bt.argument(r===0,"Unsupported kern sub-table version."),e.skip("uShort",2);var i=e.parseUShort();e.skip("uShort",3);for(var s=0;s<i;s+=1){var a=e.parseUShort(),n=e.parseUShort(),o=e.parseShort();t[a+","+n]=o}return t}function jge(e){var t={};e.skip("uShort");var r=e.parseULong();r>1&&console.warn("Only the first kern subtable is supported."),e.skip("uLong");var i=e.parseUShort(),s=i&255;if(e.skip("uShort"),s===0){var a=e.parseUShort();e.skip("uShort",3);for(var n=0;n<a;n+=1){var o=e.parseUShort(),l=e.parseUShort(),u=e.parseShort();t[o+","+l]=u}}return t}function Hge(e,t){var r=new ot.Parser(e,t),i=r.parseUShort();if(i===0)return Wge(r);if(i===1)return jge(r);throw new Error("Unsupported kern table version ("+i+").")}var Xge={parse:Hge};function $ge(e,t,r,i){for(var s=new ot.Parser(e,t),a=i?s.parseUShort:s.parseULong,n=[],o=0;o<r+1;o+=1){var l=a.call(s);i&&(l*=2),n.push(l)}return n}var qge={parse:$ge};function Yge(e,t){var r=ev();r.readFile(e,function(i,s){if(i)return t(i.message);t(null,QL(s))})}function Zge(e,t){var r=new XMLHttpRequest;r.open("get",e,!0),r.responseType="arraybuffer",r.onload=function(){return r.response?t(null,r.response):t("Font could not be loaded: "+r.statusText)},r.onerror=function(){t("Font could not be loaded")},r.send()}function Ek(e,t){for(var r=[],i=12,s=0;s<t;s+=1){var a=ot.getTag(e,i),n=ot.getULong(e,i+4),o=ot.getULong(e,i+8),l=ot.getULong(e,i+12);r.push({tag:a,checksum:n,offset:o,length:l,compression:!1}),i+=16}return r}function Jge(e,t){for(var r=[],i=44,s=0;s<t;s+=1){var a=ot.getTag(e,i),n=ot.getULong(e,i+4),o=ot.getULong(e,i+8),l=ot.getULong(e,i+12),u=void 0;o<l?u="WOFF":u=!1,r.push({tag:a,offset:n,compression:u,compressedLength:o,length:l}),i+=20}return r}function ri(e,t){if(t.compression==="WOFF"){var r=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),i=new Uint8Array(t.length);if(Gce(r,i),i.byteLength!==t.length)throw new Error("Decompression error: "+t.tag+" decompressed length doesn't match recorded length");var s=new DataView(i.buffer,0);return{data:s,offset:0}}else return{data:e,offset:t.offset}}function $2(e,t){t=t??{};var r,i,s=new dr({empty:!0}),a=new DataView(e,0),n,o=[],l=ot.getTag(a,0);if(l==="\0\0\0"||l==="true"||l==="typ1")s.outlinesFormat="truetype",n=ot.getUShort(a,4),o=Ek(a,n);else if(l==="OTTO")s.outlinesFormat="cff",n=ot.getUShort(a,4),o=Ek(a,n);else if(l==="wOFF"){var u=ot.getTag(a,4);if(u==="\0\0\0")s.outlinesFormat="truetype";else if(u==="OTTO")s.outlinesFormat="cff";else throw new Error("Unsupported OpenType flavor "+l);n=ot.getUShort(a,12),o=Jge(a,n)}else throw new Error("Unsupported OpenType signature "+l);for(var h,d,c,m,g,y,b,v,S,T,w,N,C=0;C<n;C+=1){var R=o[C],E=void 0;switch(R.tag){case"cmap":E=ri(a,R),s.tables.cmap=fL.parse(E.data,E.offset),s.encoding=new yL(s.tables.cmap);break;case"cvt ":E=ri(a,R),N=new ot.Parser(E.data,E.offset),s.tables.cvt=N.parseShortList(R.length/2);break;case"fvar":d=R;break;case"fpgm":E=ri(a,R),N=new ot.Parser(E.data,E.offset),s.tables.fpgm=N.parseByteList(R.length);break;case"head":E=ri(a,R),s.tables.head=PL.parse(E.data,E.offset),s.unitsPerEm=s.tables.head.unitsPerEm,r=s.tables.head.indexToLocFormat;break;case"hhea":E=ri(a,R),s.tables.hhea=BL.parse(E.data,E.offset),s.ascender=s.tables.hhea.ascender,s.descender=s.tables.hhea.descender,s.numberOfHMetrics=s.tables.hhea.numberOfHMetrics;break;case"hmtx":b=R;break;case"ltag":E=ri(a,R),i=FL.parse(E.data,E.offset);break;case"maxp":E=ri(a,R),s.tables.maxp=LL.parse(E.data,E.offset),s.numGlyphs=s.tables.maxp.numGlyphs;break;case"name":T=R;break;case"OS/2":E=ri(a,R),s.tables.os2=I2.parse(E.data,E.offset);break;case"post":E=ri(a,R),s.tables.post=WL.parse(E.data,E.offset),s.glyphNames=new A2(s.tables.post);break;case"prep":E=ri(a,R),N=new ot.Parser(E.data,E.offset),s.tables.prep=N.parseByteList(R.length);break;case"glyf":c=R;break;case"loca":S=R;break;case"CFF ":h=R;break;case"kern":v=R;break;case"GDEF":m=R;break;case"GPOS":g=R;break;case"GSUB":y=R;break;case"meta":w=R;break}}var P=ri(a,T);if(s.tables.name=GL.parse(P.data,P.offset,i),s.names=s.tables.name,c&&S){var I=r===0,O=ri(a,S),L=qge.parse(O.data,O.offset,s.numGlyphs,I),X=ri(a,c);s.glyphs=ik.parse(X.data,X.offset,L,s,t)}else if(h){var z=ri(a,h);EL.parse(z.data,z.offset,s,t)}else throw new Error("Font doesn't contain TrueType or CFF outlines.");var H=ri(a,b);if(IL.parse(s,H.data,H.offset,s.numberOfHMetrics,s.numGlyphs,s.glyphs,t),upe(s,t),v){var ue=ri(a,v);s.kerningPairs=Xge.parse(ue.data,ue.offset)}else s.kerningPairs={};if(m){var ne=ri(a,m);s.tables.gdef=Oge.parse(ne.data,ne.offset)}if(g){var re=ri(a,g);s.tables.gpos=Gge.parse(re.data,re.offset),s.position.init()}if(y){var ce=ri(a,y);s.tables.gsub=jL.parse(ce.data,ce.offset)}if(d){var ge=ri(a,d);s.tables.fvar=Pge.parse(ge.data,ge.offset,s.names)}if(w){var ye=ri(a,w);s.tables.meta=HL.parse(ye.data,ye.offset),s.metas=s.tables.meta}return s}function Qge(e,t,r){r=r??{};var i=typeof window>"u",s=i&&!r.isUrl?Yge:Zge;return new Promise(function(a,n){s(e,function(o,l){if(o){if(t)return t(o);n(o)}var u;try{u=$2(l,r)}catch(h){if(t)return t(h,null);n(h)}if(t)return t(null,u);a(u)})})}function Kge(e,t){var r=ev(),i=r.readFileSync(e);return $2(QL(i),t)}var e0e=Object.freeze({__proto__:null,Font:dr,Glyph:ia,Path:di,BoundingBox:$o,_parse:ot,parse:$2,load:Qge,loadSync:Kge}),t0e=e0e,Pk=new Map;function r0e(e){let t=Pk.get(e);return t||(t=fetch(e).then(r=>{if(!r.ok)throw new Error(`typeface: ${r.status}`);return r.arrayBuffer()}).then(r=>t0e.parse(r)),Pk.set(e,t)),t}function i0e(e,t,r=0){return e.getAdvanceWidth(t,1,{kerning:!0,letterSpacing:r})}function s0e(e,t,r,i,s=0){let a=r/e.unitsPerEm,n=(e.tables?.os2?.sCapHeight??e.ascender*.72)*a,o=i*r,l=o*(t.length-1)+n,u=[];return t.forEach((h,d)=>{let c=e.getAdvanceWidth(h,r,{kerning:!0,letterSpacing:s}),m=l/2-n-d*o,g=e.getPath(h,-c/2,0,r,{kerning:!0,letterSpacing:s}),y=new nl,b=v=>m-v;for(let v of g.commands)v.type==="M"?y.moveTo(v.x,b(v.y)):v.type==="L"?y.lineTo(v.x,b(v.y)):v.type==="Q"?y.quadraticCurveTo(v.x1,b(v.y1),v.x,b(v.y)):v.type==="C"?y.bezierCurveTo(v.x1,b(v.y1),v.x2,b(v.y2),v.x,b(v.y)):v.type==="Z"&&y.currentPath?.closePath();u.push(...k5.createShapes(y))}),u}var a0e="frost-build-cache",ff="builds",n0e=1,o0e="frost-build-10-planar-cap-normals";function Bk(){return new Promise(e=>{try{if(typeof indexedDB>"u")return e(null);let t=indexedDB.open(a0e,n0e);t.onupgradeneeded=()=>{t.result.createObjectStore(ff)},t.onsuccess=()=>e(t.result),t.onerror=()=>e(null)}catch{e(null)}})}async function l0e(e){let t=await Bk();return t?new Promise(r=>{try{let i=t.transaction(ff,"readonly").objectStore(ff).get(e);i.onsuccess=()=>r(i.result??null),i.onerror=()=>r(null)}catch{r(null)}}):null}async function u0e(e,t){let r=await Bk();r&&await new Promise(i=>{try{let s=r.transaction(ff,"readwrite"),a=s.objectStore(ff);a.clear(),a.put(t,e),s.oncomplete=()=>i(),s.onerror=()=>i()}catch{i()}})}function h0e(e){let t=r=>e.attributes[r]?e.attributes[r].array:null;return{position:t("position"),normal:t("normal"),uv:t("uv"),index:e.index?new Uint32Array(e.index.array):null}}function d0e(e){let t=new ps;return t.setAttribute("position",new tr(e.position,3)),t.setAttribute("normal",new tr(e.normal,3)),e.uv&&t.setAttribute("uv",new tr(e.uv,2)),e.index&&t.setIndex(new _i(e.index,1)),t.computeBoundingBox(),t}var Ah=1/60,c0e=y2(Ice),p0e="frost-ice-textured-r1-reference-optics",Ik=12,Gx={turbulenceScale:{path:["powder","turbulenceScale"],replay:!0},clumpCohesion:{path:["powder","clumpCohesion"],replay:!0},repelStrength:{path:["powder","repelStrength"],replay:!0},repelRange:{path:["powder","repelRange"],replay:!0},repelRadial:{path:["powder","repelRadial"],replay:!0},repelRadialRange:{path:["powder","repelRadialRange"],replay:!0},wrap:{path:["powder","wrap"],replay:!1},turbulenceDecay:{path:["powder","turbulenceDecay"],replay:!0},settledDrift:{path:["powder","settledDrift"],replay:!0},tumble:{path:["powder","tumble"],replay:!1},assemblyFrontDuration:{path:["healing","assemblyFrontDuration"],replay:!0},assemblyOriginX:{path:["healing","assemblyOriginX"],replay:!0},assemblyOriginY:{path:["healing","assemblyOriginY"],replay:!0},assemblyAngle:{path:["healing","assemblyAngle"],replay:!0},assemblySpread:{path:["healing","assemblySpread"],replay:!0},assemblyFrontNoise:{path:["healing","assemblyFrontNoise"],replay:!0},assemblySpeedVariation:{path:["healing","assemblySpeedVariation"],replay:!0},assemblyBend:{path:["healing","assemblyBend"],replay:!0},assemblySwirl:{path:["healing","assemblySwirl"],replay:!0},assemblyLandingVariation:{path:["healing","assemblyLandingVariation"],replay:!0},returnNoiseAmount:{path:["healing","returnNoiseAmount"],replay:!0},returnGroupStagger:{path:["healing","returnGroupStagger"],replay:!0},returnGroupScale:{path:["healing","returnGroupScale"],replay:!0},returnGroupSeed:{path:["healing","returnGroupSeed"],replay:!0},formJitter:{path:["healing","waveJitter"],replay:!0},waveReach:{path:["healing","waveReach"],replay:!0},alignToSurface:{path:["healing","alignToSurface"],replay:!1},alignCurve:{path:["healing","alignCurve"],replay:!1},rimAzimuth:{path:["lighting","rimAzimuth"],replay:!1},rimAngle:{path:["lighting","rimAngle"],replay:!1},rimSize:{path:["lighting","rimSize"],replay:!1},fillReflectionStrength:{path:["lighting","fillReflectionStrength"],replay:!1},accentCoolIntensity:{path:["lighting","accentCool","intensity"],replay:!1},accentCoolReflection:{path:["lighting","accentCool","reflection"],replay:!1},accentCoolElevation:{path:["lighting","accentCool","elevation"],replay:!1},accentCoolAzimuth:{path:["lighting","accentCool","azimuth"],replay:!1},accentCoolSize:{path:["lighting","accentCool","size"],replay:!1},accentCoolColor:{path:["lighting","accentCool","color"],replay:!1},accentWarmIntensity:{path:["lighting","accentWarm","intensity"],replay:!1},accentWarmReflection:{path:["lighting","accentWarm","reflection"],replay:!1},accentWarmElevation:{path:["lighting","accentWarm","elevation"],replay:!1},accentWarmAzimuth:{path:["lighting","accentWarm","azimuth"],replay:!1},accentWarmSize:{path:["lighting","accentWarm","size"],replay:!1},accentWarmColor:{path:["lighting","accentWarm","color"],replay:!1},keyColor:{path:["lighting","key","color"],replay:!1},keyIntensity:{path:["lighting","key","intensity"],replay:!1},keyElevation:{path:["lighting","key","elevation"],replay:!1},keyAzimuth:{path:["lighting","key","azimuth"],replay:!1},keySize:{path:["lighting","key","size"],replay:!1},fill:{path:["lighting","fill"],replay:!1},fillColor:{path:["lighting","fillColor"],replay:!1},fillGroundColor:{path:["lighting","fillGroundColor"],replay:!1},rim:{path:["lighting","rim"],replay:!1},rimColor:{path:["lighting","rimColor"],replay:!1},rimElevation:{path:["lighting","rimElevation"],replay:!1},swayAmplitude:{path:["lighting","sway","amplitude"],replay:!1},swayPeriod:{path:["lighting","sway","period"],replay:!1},envSoftbox:{path:["lighting","envSoftbox"],replay:!1},envRim:{path:["lighting","envRim"],replay:!1},envFill:{path:["lighting","envFill"],replay:!1},backdropTop:{path:["lighting","backdrop","top"],replay:!1},backdropMid:{path:["lighting","backdrop","mid"],replay:!1},backdropBottom:{path:["lighting","backdrop","bottom"],replay:!1},backdropCenterX:{path:["lighting","backdrop","centerX"],replay:!1},backdropCenterY:{path:["lighting","backdrop","centerY"],replay:!1},backdropRadius:{path:["lighting","backdrop","radius"],replay:!1},backdropFalloff:{path:["lighting","backdrop","falloff"],replay:!1},backdropNoise:{path:["lighting","backdrop","noise"],replay:!1},...Object.fromEntries(Object.keys(Qd).map(e=>[$ie(e),{path:["ice","features",e],replay:!1}])),materialBacklight:{path:["ice","backlight"],replay:!1},materialInclusionAmount:{path:["ice","inclusionAmount"],replay:!1},materialInclusionScale:{path:["ice","inclusionScale"],replay:!1},materialBaseColor:{path:["ice","baseColor"],replay:!1},materialInteriorFrost:{path:["erosion","interiorFrost"],replay:!1},materialGrainAmount:{path:["erosion","edgeBump"],replay:!1},materialGrainScale:{path:["erosion","edgeBumpScale"],replay:!1},ior:{path:["ice","ior"],replay:!1},dispersion:{path:["ice","dispersion"],replay:!1},thicknessScale:{path:["ice","thicknessScale"],replay:!1},attenuationDistance:{path:["ice","attenuationDistance"],replay:!1},attenuationColor:{path:["ice","attenuationColor"],replay:!1},baseRoughness:{path:["ice","baseRoughness"],replay:!1},crumbleGlow:{path:["ice","crumbleGlow"],replay:!1},edgeWhiteness:{path:["ice","edgeWhiteness"],replay:!1},clearcoat:{path:["ice","clearcoat"],replay:!1},clearcoatRoughness:{path:["ice","clearcoatRoughness"],replay:!1},envIntensity:{path:["ice","envIntensity"],replay:!1},specularIntensity:{path:["ice","specularIntensity"],replay:!1},interiorScatter:{path:["ice","interiorScatter"],replay:!1},frostScale:{path:["ice","frost","scale"],replay:!1},frostThreshold:{path:["ice","frost","threshold"],replay:!1},frostSoftness:{path:["ice","frost","softness"],replay:!1},frostRoughness:{path:["ice","frost","roughness"],replay:!1},frostDiffuse:{path:["ice","frost","diffuse"],replay:!1},crystalBump:{path:["ice","frost","crystalBump"],replay:!1},crystalScale:{path:["ice","frost","crystalScale"],replay:!1},crackLargeScale:{path:["ice","cracks","largeScale"],replay:!1},crackWarp:{path:["ice","cracks","warp"],replay:!1},crackWarpScale:{path:["ice","cracks","warpScale"],replay:!1},crackCoverage:{path:["ice","cracks","coverage"],replay:!1},crackRegionScale:{path:["ice","cracks","regionScale"],replay:!1},crackRegionCoverage:{path:["ice","cracks","regionCoverage"],replay:!1},veinScale:{path:["ice","cracks","veinScale"],replay:!1},veinContrast:{path:["ice","cracks","veinContrast"],replay:!1},crackWidth:{path:["ice","cracks","width"],replay:!1},crackBrightness:{path:["ice","cracks","brightness"],replay:!1},crackDarkness:{path:["ice","cracks","darkness"],replay:!1},crackRefraction:{path:["ice","cracks","refraction"],replay:!1},crackSurfaceStrength:{path:["ice","cracks","surfaceStrength"],replay:!1},fineScale:{path:["ice","cracks","fineScale"],replay:!1},fineAmount:{path:["ice","cracks","fineAmount"],replay:!1},fineCoverage:{path:["ice","cracks","fineCoverage"],replay:!1},smudgeAmount:{path:["ice","smudges","amount"],replay:!1},smudgeCoverage:{path:["ice","smudges","coverage"],replay:!1},smudgeMaskScale:{path:["ice","smudges","maskScale"],replay:!1},smudgeAnisotropy:{path:["ice","smudges","anisotropy"],replay:!1},smudgeRoughness:{path:["ice","smudges","roughness"],replay:!1},smudgeWhiteness:{path:["ice","smudges","whiteness"],replay:!1},smudgeScale:{path:["ice","smudges","scale"],replay:!1},microBump:{path:["ice","bumps","microBump"],replay:!1},microScale:{path:["ice","bumps","microScale"],replay:!1},microCoverage:{path:["ice","bumps","microCoverage"],replay:!1},rippleBump:{path:["ice","bumps","rippleBump"],replay:!1},rippleScale:{path:["ice","bumps","rippleScale"],replay:!1},bumpMaskScale:{path:["ice","bumps","maskScale"],replay:!1},baseTone:{path:["powder","baseTone"],replay:!1},fragTranslucency:{path:["powder","fragments","translucency"],replay:!1},fragThroughTint:{path:["powder","fragments","throughTint"],replay:!1},fragFresnelPower:{path:["powder","fragments","fresnelPower"],replay:!1},fragRoughness:{path:["powder","fragments","roughness"],replay:!1},fragClearcoat:{path:["powder","fragments","clearcoat"],replay:!1},fragSpecular:{path:["powder","fragments","specular"],replay:!1},sparkle:{path:["powder","fragments","sparkle"],replay:!1},sparkleFraction:{path:["powder","fragments","sparkleFraction"],replay:!1},spriteTilt:{path:["powder","sprites","tilt"],replay:!1},spriteNormal:{path:["powder","sprites","normalStrength"],replay:!1},spriteFrost:{path:["powder","sprites","frostFromAtlas"],replay:!1},spriteFrostBoost:{path:["powder","sprites","frostBoost"],replay:!1},spriteFrostRoughness:{path:["powder","sprites","frostRoughness"],replay:!1},spriteEdgeLight:{path:["powder","sprites","edgeLight"],replay:!1},spriteAlphaCut:{path:["powder","sprites","alphaCut"],replay:!1},spriteSeeThrough:{path:["powder","sprites","seeThrough"],replay:!1},bloomThreshold:{path:["post","bloom","threshold"],replay:!1},bloomIntensity:{path:["post","bloom","intensity"],replay:!1},bloomRadius:{path:["post","bloom","radius"],replay:!1},monochrome:{path:["post","monochrome"],replay:!1},tonemap:{path:["post","tonemap"],replay:!1},exposure:{path:["post","exposure"],replay:!1},contrast:{path:["post","contrast"],replay:!1},blackLift:{path:["post","blackLift"],replay:!1},vignetteStrength:{path:["post","vignette","strength"],replay:!1},vignetteSoftness:{path:["post","vignette","softness"],replay:!1},vignetteRadius:{path:["post","vignette","radius"],replay:!1},grainStrength:{path:["post","grain","strength"],replay:!1},cutThreshold:{path:["erosion","cutThreshold"],replay:!1},cutSoftness:{path:["erosion","cutSoftness"],replay:!1},edgeWidth:{path:["erosion","edgeWidth"],replay:!1},edgeInset:{path:["erosion","edgeInset"],replay:!1},brushSoftness:{path:["erosion","brushSoftness"],replay:!0},brushNoise:{path:["erosion","brushNoise"],replay:!0},crumbleRate:{path:["erosion","crumbleRate"],replay:!0},crumbleCrackBias:{path:["erosion","crumbleCrackBias"],replay:!0},crumbleDuration:{path:["erosion","crumbleDuration"],replay:!0},ejectSpeed:{path:["powder","ejectSpeed"],replay:!0},ejectSpread:{path:["powder","ejectSpread"],replay:!0},ejectTurbulence:{path:["powder","ejectTurbulence"],replay:!0},drag:{path:["powder","drag"],replay:!0},gravity:{path:["powder","gravity"],replay:!0},turbulence:{path:["powder","turbulence"],replay:!0},settleTime:{path:["powder","settleTime"],replay:!0},maxSpeed:{path:["powder","maxSpeed"],replay:!0},minPixelSize:{path:["powder","minPixelSize"],replay:!1},grainSizeMultiplier:{path:["powder","grainSizeMultiplier"],replay:!1},spriteSize:{path:["powder","sprites","sizeScale"],replay:!1},returnSpring:{path:["healing","returnSpring"],replay:!0},returnDamping:{path:["healing","returnDamping"],replay:!0},returnRamp:{path:["healing","returnRamp"],replay:!0},returnMaxSpeed:{path:["healing","returnMaxSpeed"],replay:!0},healRate:{path:["healing","healRate"],replay:!0},cellRestore:{path:["healing","cellRestore"],replay:!0},landedFade:{path:["healing","landedFade"],replay:!0},refrostTime:{path:["healing","refrostTime"],replay:!0}},q2=Object.freeze(Object.fromEntries(Object.entries(Gx).filter(([e,t])=>e.startsWith("material")||["ice","lighting","post"].includes(t.path[0])||["baseTone","wrap","sparkle","sparkleFraction"].includes(e)||e.startsWith("frag")||e.startsWith("sprite")).map(([e])=>[e,Io[e]]))),gf=[-1,.3,0],yf=[1,-.3,0];function Fk(e){return JSON.stringify([e.headlines,{...e.text,meshDetail:f2(e.text.meshDetail)},Nx(e.deformation),e.quality,e.upscaler,e.renderScale,e.shapeResolution??"256",e.erosionResolution,e.particleCount,e.logoUrl,g2(e.logoMeshDetail),e.shards.strayDust,Number(e.tune.spriteSeeThrough??q2.spriteSeeThrough)>0])}function m0e(e){e={...e,logoMeshDetail:g2(e.logoMeshDetail),text:{...e.text,meshDetail:f2(e.text.meshDetail)}};let t=null,r=null,i=!1,s=-1,a=-1,n=0,o=null,l=0,u=null,h=U=>{th.stages.push([U,performance.now()-th.start]),e.onProgress?.(U)},d=e.schedule,c=e.pose,m=e.shards,g=c2(e.cameraTrack),y=()=>e.cameraMode==="authored"&&g.keys.length>0,b=()=>y()&&g.objectMotion==="stationary";function v(){t&&(t.onCameraTransform=y()?U=>{t&&vce(t.camera,g,U,t.objectGroup.matrixWorld,t.rig.lookAt)}:null,y()||(t.camera.zoom=1,t.camera.updateProjectionMatrix()))}let S=Fk(e),T=[],w=[],N=[],C=null,R=-1,E=null,P=(U,J)=>{let q=le;for(let se=0;se<U.length-1;se++)q=q[U[se]];q[U[U.length-1]]=J};function I(U){for(let[J,q]of Object.entries({...q2,...Bs,...U})){let se=Gx[J];se&&(typeof q=="string"||typeof q=="boolean"||Number.isFinite(q))&&P(se.path,q)}}function O(){Ht.enabled=!0,Ht.clickResets=!0,Ht.shape="logo",Ht.cursorErodes=!0,Ht.hud=!1,Ht.framing=!0,Object.assign(Ht,{distance:13.45,height:1.2,lookAtX:0,lookAtY:.05,fov:29.5,objectX:0,objectY:.05,objectZ:0,baseYaw:0,basePitch:0,rotateYaw:40,rotatePitch:45,parallaxRange:15}),Ht.cameraOverride=null,le.shape.deformAmplitude=0,le.camera.idleAmplitude=0;let U=le.performance;U.adaptiveResolution=!1,U.dynamicSceneResolution=!1,U.sceneResolutionScale=Math.max(.25,Math.min(1,e.renderScale)),U.minSceneResolutionScale=U.sceneResolutionScale,U.upscaler=e.upscaler,U.nativePostEffects=!0,U.upscaleSharpness=1,U.minPixelRatio=e.previewPixelRatio??2,le.post.pixelRatioCap=e.previewPixelRatio??2,U.idleSkip=!1,U.gpuTimers=!1,le.debug.stats=!1,le.debug.freeze=!1,le.debug.forceStroke=!1,le.shape.logo.sdfRes=[128,256,384].includes(Number(e.shapeResolution))?Number(e.shapeResolution):256,le.erosion.resolution=e.erosionResolution,le.powder.particleCount=e.particleCount,le.powder.amount=m.amount,le.powder.lostRadius=80,le.powder.strayCount=Math.round(m.strayDust),le.powder.inheritRotation=!0,le.powder.inheritTime=m.followObject*1e3,le.ice={...structuredClone(Mx.ice),features:{...Qd}},le.lighting=structuredClone(Mx.lighting),le.post=structuredClone(Mx.post),le.post.pixelRatioCap=e.previewPixelRatio??2,le.post.grain.backgroundStrength=0,le.powder.hazeIntensity=0,le.ice.cracks.steps=18,le.erosion.interiorSteps=48,U.adaptiveSteps=Mx.performance.adaptiveSteps,I(e.tune),e.quality==="lite"&&(le.shape.segments=96,le.ice.cracks.steps=6,le.ice.cracks.fineCracks=!1,le.erosion.resolution="64",le.powder.particleCount="100k",le.powder.densityGrid="32",le.powder.hazeSteps=8),L()}function L(){le.healing.healDelay=1e9,le.healing.returnAfter=0,le.healing.waveTime=0,le.version++}function X(){le.healing.healDelay=0,le.healing.returnAfter=0,le.healing.waveTime=m.formSpread,le.healing.fallbackHeal=m.formFill,le.version++}let z=(async()=>{if(await new Promise(Fe=>setTimeout(Fe,250)),i)return;let U=navigator;if(!U.gpu)throw new Error("Frost: navigator.gpu is unavailable (WebGPU required)");if(!await U.gpu.requestAdapter().catch(()=>null))throw new Error("Frost: no WebGPU adapter");h("webgpu adapter"),O();let J=new qX({canvas:e.canvas,antialias:!1,forceWebGL:!1,powerPreference:"high-performance",trackTimestamp:!1});if(await J.init(),J.backend?.isWebGLBackend)throw new Error("Frost: WebGPU backend unavailable, WebGL fallback is not supported");J.toneMapping=eo,J.outputColorSpace=ds,J.shadowMap.enabled=le.lighting.shadow.intensity>0,J.shadowMap.type=Lh,J.setPixelRatio(1),J.setSize(e.width,e.height,!1),r=J,h("renderer");let q=new bg,se=new gs(30,e.width/e.height,.5,80);se.position.set(0,1.2,13.5);let pe=le.shape.logo,Te=le.powder,we={"100k":1e5,"250k":25e4,"500k":5e5,"1M":1e6}[Te.particleCount]??1e5,ie=Nx(e.deformation),V=!!e.rig&&!e.rig.sequence,Oe=JSON.stringify([o0e,V,ie,e.headlines,e.text,e.logoUrl,e.logoMeshDetail,pe,we,Te.nearSurfaceFraction,Te.nearSurfaceDepth,le.shape.seed,le.shape.size]),tt=await new tb().loadAsync(a2("textures/bluenoise64.png")).then(Fe=>(Fe.wrapS=Fe.wrapT=to,Fe.minFilter=Fe.magFilter=or,Fe.generateMipmaps=!1,Fe.colorSpace=Fa,Fe)),Je=await new tb().loadAsync(a2("textures/ice-inclusions-generated.png")).then(Fe=>(Fe.wrapS=Fe.wrapT=Qo,Fe.minFilter=Ia,Fe.magFilter=lr,Fe.generateMipmaps=!0,Fe.colorSpace=Fa,Fe)),ct=0,_e=new URLSearchParams(location.search).has("fresh")?null:await l0e(Oe).catch(()=>null);if(_e&&_e.geometries.length===(V?1:3)&&_e.sdfs.length===(V?1:3)&&_e.rests.length===(V?0:2)){for(let Fe of _e.geometries)T.push(d0e(Fe));for(let Fe of _e.sdfs)w.push(F1(Fe.data,Fe.res,Fe.bound,Fe.thickness,Fe.sampleBound));ct=_e.sdfs[0].bound,h("shapes (cached)")}else{let Fe=e.fontUrl.replace(/Geist-[A-Za-z]+\.ttf$/,`Geist-${e.text.weight===400?"Regular":e.text.weight===600?"SemiBold":"Bold"}.ttf`),[it,Rt]=await Promise.all([Qae(e.logoUrl,pe),V?Promise.resolve(null):r0e(Fe)]);if(i)return;if(!it.length)throw new Error("Frost: the logo SVG produced no shapes");h("assets"),T.push(G5(it,pe,pe.width));let Ft={...pe,depth:e.text.depth,bevelThickness:e.text.bevel,bevelSize:e.text.bevel*.8,bevelOffset:0,cornerRadius:e.text.corner,curveSegments:10,bevelSegments:4};for(let Ze of V?[]:e.headlines){let ht=Ze.map(Gi=>Gi.trim()).filter(Boolean);ht.length||ht.push(" ");let Yt=Math.max(.001,...ht.map(Gi=>i0e(Rt,Gi,e.text.letterSpacing))),Tr=e.text.width/Yt;T.push(G5(s0e(Rt,ht,Tr,e.text.lineHeight,e.text.letterSpacing),Ft,Tr))}for(let Ze=0;Ze<T.length;Ze++){let ht=T[Ze];if(h(Ze===0?"logo geometry":`text mesh ${Ze}/2 \xB7 detail ${e.text.meshDetail}`),await new Promise(Yt=>setTimeout(Yt,0)),i)return;T[Ze]=Bce(ht,ie,pe.creaseAngle,Ze===0?void 0:e.text.meshDetail,Ze===0?e.logoMeshDetail:void 0),Ze>0&&h(`text mesh ${Ze}/2 \xB7 ${T[Ze].getAttribute("position").count/3} triangles`),await new Promise(Yt=>setTimeout(Yt,0)),T[Ze]!==ht&&ht.dispose()}for(let Ze of T){let ht=Fm(Ze);ct=Math.max(ct,ht.x,ht.y,ht.z)}ct*=1.15;for(let Ze of T){let ht=Fm(Ze),Yt=Math.max(ht.x,ht.y,ht.z)*1.15;w.push(qa.gpu?await nne(J,Ze,ct,pe.sdfRes,Yt):Kae(Ze,ct,pe.sdfRes,Yt)),await new Promise(Tr=>setTimeout(Tr,0))}if(i)return;h("shapes")}C=F1(w[0].data.slice(),w[0].res,ct,w[0].thickness,w[0].sampleDomain.value),hx.extraShell=2*ct/pe.sdfRes*2;let nt=le.shape.size,dt=T.slice();for(let Fe=0;Fe<T.length;Fe++){let it=T[Fe].clone();it.scale(nt,nt,nt),T[Fe]=it}t=new gce(J,q,se,tt,{sdf:C,geometry:T[0]},Je),t.onObjectTransform=Fe=>{if(!t)return;if(E){E.pose(Fe);return}let it=Sce(Fe,d,c,R,b());t.motionGroup.quaternion.copy(it.rotation),t.motionGroup.position.copy(it.position),t.objectGroup.quaternion.copy(it.facing)},R=0,v();let ft=t.powder;if(N.push(ft.restInit.slice()),_e&&_e.rests.length===2)for(let Fe of _e.rests){let it=ft.restInit.slice();it.set(Fe.subarray(0,ft.count*4)),N.push(it)}else{for(let Fe=1;Fe<T.length;Fe++){let it=cw("logo",le.shape.size,le.shape.tubeRatio,w[Fe]),Rt=Fm(dt[Fe]),Ft=rI(it,ft.count,Te.nearSurfaceFraction,Te.nearSurfaceDepth,Lm(le.shape.seed+101+Fe),[(Rt.x+.05)*nt,(Rt.y+.05)*nt,(Rt.z+.05)*nt]),Ze=ft.restInit.slice();for(let ht=0;ht<ft.count;ht++)Ze[ht*4]=Ft.positions[ht*3],Ze[ht*4+1]=Ft.positions[ht*3+1],Ze[ht*4+2]=Ft.positions[ht*3+2];N.push(Ze),await new Promise(ht=>setTimeout(ht,0))}new URLSearchParams(location.search).has("fresh")||u0e(Oe,{geometries:dt.map(h0e),sdfs:w.map(Fe=>({data:Fe.data,res:Fe.res,bound:Fe.bound,thickness:Fe.thickness,sampleBound:Fe.sampleDomain.value})),rests:N.slice(1).map(Fe=>Fe.slice(0,ft.count*4))}).catch(()=>{})}e.rig&&(E=new Tse(t,{...e.rig,retarget:Fe=>ge(Fe,!0)})),window.__fb={world:t,renderer:J,D:le,sim:pt,clock:ta};for(const Fe of[.25,.5,.75,0])G(Fe*y2(d)),await(async()=>{for(;o;)await o})();h("world")})(),H=p2(d,c);function ue(){H=p2(d,c)}let ne=U=>{let J=H(U);return new si().setFromEuler(new cn(Bt.degToRad(J.pitch),Bt.degToRad(J.yaw),0,"YXZ"))},re=new si;function ce(U){if(U===0||b())return new si;let J=U===1?d.form1+2.8:d.form2+2.8;return ne(J).invert()}function ge(U,J){if(!t||!r||!C)return;let q=w[U];U!==R&&(C.data.set(q.data),C.sampleDomain.value=q.sampleDomain.value,C.sampleBoundNode&&(C.sampleBoundNode.value=q.sampleDomain.value),C.texture.needsUpdate=!0,C.thickness=q.thickness,t.shape=cw("logo",le.shape.size,le.shape.tubeRatio,C),t.mesh.geometry=T[U],R=U),re.copy(e.rig?new si:ce(U)),t.objectGroup.quaternion.copy(re),t.motionGroup.updateMatrixWorld(!0),t.powder.syncModel(),t.erosion.rebake(r,J),t.powder.retarget(r,N[U])}function ye(U=!1){if(!t||!r)return;L(),t.erosion.u.reconstruct.value=0,le.powder.repelFromObject=!0;let J=U?m.finalEjectBoost:1;le.powder.ejectSpeed=Number(e.tune.ejectSpeed)*J,le.powder.maxSpeed=Number(e.tune.maxSpeed)*J,le.powder.minEjectSpeed=.66*J,le.version++,t.powder.restoreThresholds(r),t.interaction.sweep({from:gf,to:yf,duration:.7,radius:m.sliceRadius,strength:m.sliceStrength})}function oe(){if(!t)return;let U=t.shape.bound,J=yf[0]-gf[0],q=yf[1]-gf[1],se=Math.hypot(J,q),pe=-q/se,Te=J/se,we=Math.max(.15,m.shatterRadius*1.7)/U,ie=Math.max(1,Math.ceil(1.25/we)),V=m.breakDuration/(ie*2),Oe=0;for(let tt=1;tt<=ie;tt++)for(let Je of[1,-1]){let ct=Je*tt*we;t.interaction.sweep({from:[gf[0]+pe*ct,gf[1]+Te*ct,0],to:[yf[0]+pe*ct,yf[1]+Te*ct,0],duration:.5,delay:Oe*V,radius:m.shatterRadius,strength:m.shatterStrength}),Oe++}}function Ae(){!t||!r||(r.compute(t.erosion.fillNode),le.powder.repelFromObject=!1,le.version++)}function Ie(U){t&&(t.powder.u.assemblyEnd.value=(U===1?d.break1:d.break2)-.65,ge(U,!0),pt.lastStrokeT=ta.t,X())}function Xe(){t&&(L(),t.mesh.visible=!1,le.healing.resetFade=QF*1e3,pt.resetRequestedAt=ta.t)}function at(){t&&(a=-1,le.powder.repelFromObject=!0,t.resetSim(),t.interaction.clearScripted(),re.identity(),ge(0,!1),e.rig?.sequence&&r&&t.powder.reset(r),L(),le.healing.resetFade=50,Ui.inside=!1,Ui.x=0,Ui.y=0,Ui.lastMoveT=0,Ui.moved=!1,E?.reset(),s=0)}function W(U,J){if(!t)return;let q=U*Ah;if(E){s2(U),t.frame(q,Ah,J);return}ta.t=q;let se=pe=>Math.round(pe/Ah)===U;for(let pe of[d.logoBreak,d.break1,d.break2])se(pe)&&ye(pe===d.break2),se(pe+.3)&&oe(),se(pe+.3+m.breakDuration+.5)&&Ae();se(d.form1)&&Ie(1),se(d.form2)&&Ie(2),se(d.fadeOut)&&Xe(),s2(U),t.frame(q,Ah,J)}async function j(){let U=-1,J=0;for(;!i&&t&&r;){let q=l;(s<0||q<s)&&at(),q!==U&&(J=q-s>60?q-Ik:q,U=q);let se=Math.min(q,s+8);if(q===s&&a!==q){s2(q);let Te=e.rig&&q===0&&a<0?Ik:1;for(let we=0;we<Te;we++)t.frame(q*Ah,0,!0);a=q}for(;s<se;){s++;let Te=s===q||s>J;W(s,Te),Te&&(a=s)}let pe=r.backend?.device?.queue;if(pe?.onSubmittedWorkDone&&await pe.onSubmittedWorkDone(),i||s===l&&a===l)return;await new Promise(Te=>setTimeout(Te,0))}}function G(U){i||(n=Number.isFinite(U)?Math.max(0,Math.min(e.rig?.duration??y2(d),U)):0,l=Math.round(n/Ah),!(!t||!r||o)&&(u=null,o=Promise.resolve().then(j).catch(J=>{u=J,console.error("Frost seek failed",J)}).finally(()=>{o=null})))}function ae(){a=-1,G(n)}function be(U,J){if(J!==S)return"rebuild";let q=!1,se=(Te,we)=>JSON.stringify(Te)===JSON.stringify(we);(!se(U.schedule,d)||!se(U.pose,c))&&(q=!0);let pe=b();g=c2(U.cameraTrack),e.cameraTrack=g,e.cameraMode=U.cameraMode,pe!==b()&&(q=!0),v(),se(U.shards,m)||(q=!0);for(let[Te,we]of Object.entries(U.tune))if(e.tune[Te]!==we){let ie=Gx[Te];ie&&(P(ie.path,we),ie.replay&&(q=!0))}return e.schedule=d=U.schedule,e.pose=c=U.pose,e.shards=m=U.shards,e.tune={...U.tune},le.powder.amount=m.amount,le.powder.inheritTime=m.followObject*1e3,le.version++,ue(),t&&(q?(s=-1,a=-1,G(n)):ae()),"live"}async function Be(){for(await z;o;)await o;if(u)throw u}function $(){i=!0,t?.dispose(),t=null,E?.dispose();for(let U of w)U.texture.dispose();C?.texture.dispose(),C=null;for(let U of T)U.dispose();r&&(r.dispose(),r=null),Ht.enabled=!1,Ht.shape=null,Ht.cameraOverride=null,delete window.__fb}return{ready:z,renderAt:G,redraw:ae,invalidate:()=>{s=-1,a=-1},waitForGpu:Be,poseAt:U=>H(U),applyOptions:be,structuralKey:S,get world(){return t},get shape(){return R},dispose:$}}return xD(gM)})();
Remediation: Use clear code instead of hex encoding
MEDIUM File extension does not match actual content type Obfuscationstatic

File 'clock.ts' extension (.ts) suggests one format but Magika detected a different text format: JavaScript source (javascript). This may indicate content obfuscation or a misnamed file.

source/src/core/clock.ts

Remediation: Rename the file to match its actual content type, or remove it if it appears malicious.
MEDIUM Outbound network request primitives in JavaScript/TypeScript Data Exfiltrationstatic

Pattern detected: fetch(

source/src/shape/logo.ts:96

const text = await fetch(url).then((r) =>
Remediation: Ensure network operations are necessary and document allowed destinations
MEDIUM Outbound network request primitives in JavaScript/TypeScript Data Exfiltrationstatic

Pattern detected: fetch(

source/src/shape/text.ts:13

p = fetch(url)
Remediation: Ensure network operations are necessary and document allowed destinations
LOW Script contacts a destination the documentation never mentions Unauthorized Tool Usestatic

Script contacts or configures 'www.shadertoy.com' but the skill documentation never visibly mentions it. Undocumented network destinations can indicate behaviour the manifest and description do not disclose.

assets/frost.js:398

Remediation: Document the destination in SKILL.md (or the manifest description) if it is intended, or remove the undisclosed network access. Organizations can list internal hosts in llm_analysis.trusted_reference_domains.
LOW Script contacts a destination the documentation never mentions Unauthorized Tool Usestatic

Script contacts or configures 'gsap.com' but the skill documentation never visibly mentions it. Undocumented network destinations can indicate behaviour the manifest and description do not disclose.

assets/gsap-3.14.2.min.js:2096

Remediation: Document the destination in SKILL.md (or the manifest description) if it is intended, or remove the undisclosed network access. Organizations can list internal hosts in llm_analysis.trusted_reference_domains.
LOW Unpinned dependency Supply Chain Attackstatic

Dependency 'esbuild' has no exact version. Unpinned dependencies in a skill package allow a later, potentially malicious release to be installed automatically (supply-chain risk).

source/package.json:9

"esbuild": "^0.24.0"
Remediation: Pin the dependency to an exact version (e.g. '"package": "1.2.3"').
LOW Unpinned dependency Supply Chain Attackstatic

Dependency 'opentype.js' has no exact version. Unpinned dependencies in a skill package allow a later, potentially malicious release to be installed automatically (supply-chain risk).

source/package.json:10

"opentype.js": "^2.0.0"
Remediation: Pin the dependency to an exact version (e.g. '"package": "1.2.3"').
LOW Unpinned dependency Supply Chain Attackstatic

Dependency 'typescript' has no exact version. Unpinned dependencies in a skill package allow a later, potentially malicious release to be installed automatically (supply-chain risk).

source/package.json:13

"typescript": "5.7"
Remediation: Pin the dependency to an exact version (e.g. '"package": "1.2.3"').
INFO Skill does not specify a license Policy Violationstatic

Skill manifest does not include a 'license' field. Specifying a license helps users understand usage terms.

SKILL.md

Remediation: Add 'license' field to SKILL.md frontmatter (e.g., MIT, Apache-2.0)

What is in the package

83 files, 2.7 MB. Show the list.
FileKindSize
SKILL.mddoc38 KB
frost-sequence-camera-orbit.htmldata131 KB
registry-item.jsonconfig4.3 KB
assets/Clipper-LICENSE.txtdoc3.2 KB
assets/GSAP-NOTICE.txtdoc145 B
assets/OpentypeJS-LICENSE.txtdoc1.1 KB
assets/Three-LICENSE.txtdoc1.1 KB
assets/ThreeMeshBVH-LICENSE.txtdoc1.1 KB
assets/example-logo.svgdata107 B
assets/frost.jsscript1.5 MB
assets/gsap-3.14.2.min.jsscript128 KB
assets/logo.svgdata512 B
assets/test-mark.svgdata218 B
source/README.mddoc1.3 KB
source/build.mjsscript2.2 KB
source/package.jsonconfig303 B
assets/fonts/Geist-Bold.ttfbinary65 KB
assets/fonts/Geist-OFL.txtdoc4.3 KB
assets/fonts/Geist-Regular.ttfbinary65 KB
assets/fonts/Geist-SemiBold.ttfbinary65 KB
assets/textures/bluenoise64.pngimage12 KB
source/presets/approved-material.jsonconfig6.2 KB
source/presets/source-hero4-material.jsonconfig3.7 KB
source/src/World.tsscript21 KB
source/src/assets.tsscript392 B
source/src/cache.tsscript3.0 KB
source/src/frost.tsscript47 KB
source/src/rewrite.tsscript1.3 KB
source/tools/compile-preflight.mjsscript1.1 KB
source/tools/run-shard-compile.mjsscript946 B
source/tools/shard-compile-probe.tsscript5.0 KB
source/src/core/AdaptiveResolution.tsscript3.0 KB
source/src/core/clock.tsscript553 B
source/src/core/ease.tsscript640 B
source/src/core/interaction.tsscript15 KB
source/src/core/motion.tsscript2.3 KB
source/src/core/schedule.tsscript994 B
source/src/core/seed.tsscript364 B
source/src/core/state.tsscript2.8 KB
source/src/dials/baked.jsonconfig9.5 KB
source/src/dials/defaults.tsscript21 KB
source/src/dials/store.tsscript2.2 KB
source/src/erosion/AssemblyField.tsscript5.6 KB
source/src/erosion/ErosionField.tsscript24 KB
source/src/ice/CrackPlanes.tsscript3.0 KB
source/src/ice/EnvironmentSampling.tsscript943 B
source/src/ice/FastOptics.tsscript1.2 KB
source/src/ice/GlassMatcap.tsscript2.7 KB
source/src/ice/IceMaterial.tsscript22 KB
source/src/ice/MeshEntry.tsscript1.6 KB
source/src/ice/OpticalTransport.tsscript5.0 KB
source/src/ice/SharedSurface.tsscript5.0 KB
source/src/ice/SurfaceDetail.tsscript1.9 KB
source/src/ice/features.tsscript671 B
source/src/ice/optics.tsscript523 B
source/src/ice/variant.tsscript51 B
source/src/motion/editor.tsscript21 KB
source/src/motion/meshes.tsscript4.0 KB
source/src/motion/objectFrame.tsscript1.1 KB
source/src/motion/track.tsscript6.7 KB
source/src/post/Post.tsscript12 KB
source/src/powder/Powder.tsscript72 KB
source/src/powder/returnGroups.tsscript2.7 KB
source/src/powder/shardAtlas.tsscript775 B
source/src/rig/LogoRig.tsscript9.2 KB
source/src/scene/Backdrop.tsscript2.3 KB
source/src/scene/DebugViews.tsscript3.1 KB
source/src/scene/Environment.tsscript3.5 KB
source/src/scene/Lights.tsscript3.5 KB
source/src/scene/Rig.tsscript2.6 KB
source/src/shape/deform.tsscript7.2 KB
source/src/shape/geometry.tsscript5.4 KB
source/src/shape/gpuSdf.tsscript5.0 KB
source/src/shape/logo.tsscript12 KB
source/src/shape/logoRefine.tsscript912 B
source/src/shape/sdf.tsscript11 KB
source/src/shape/text.tsscript2.5 KB
source/src/shape/textRefine.tsscript6.4 KB
source/src/shape/unionOutlines.tsscript1.5 KB
source/src/tsl/noise.tsscript7.2 KB
source/src/tsl/t.tsscript270 B
source/src/vendor/clipper-README.mddoc1.8 KB
source/src/vendor/clipper.cjsscript214 KB

External hosts referenced

gsap.com jsperf.com sourceforge.net static.heygen.ai www.boost.org books.google.com jsclipper.sourceforge.net portal.acm.org www-cs-students.stanford.edu www.angusj.com www.me.berkeley.edu www.shadertoy.com citeseerx.ist.psu.edu digimapforschools.edina.ac.uk en.wikipedia.org github.com hyperframes.heygen.com mobilegeo.wordpress.com scripts.sil.org

Hostnames that appear in the skill's files. Referencing a host is not a finding; compare against the findings above and the skill's stated purpose.

Package contents recorded 2026-10-22 at commit 4371981b740d. The scan above ran against the version current at scan time; the two can differ if the skill has since been updated.

What we checked

What we did not check

Sources