From 22a3aeed702753d7dc2683914d959c5449b4e416 Mon Sep 17 00:00:00 2001 From: dcyoung Date: Sat, 19 Oct 2024 03:55:39 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20dcyoung/?= =?UTF-8?q?r3f-audio-visualizer@ceddd0a14cf4a3ef83299a85f3920128ddc4edff?= =?UTF-8?q?=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{Noise-eViT7niE.js => Noise-D5uvWl4i.js} | 16 +- assets/controls-ByeBQODT.js | 1 + assets/controls-CwyAXsj5.js | 1 + assets/controls-DogCyDae.js | 1 + assets/controls-tumpVwPC.js | 1 + assets/ground-DJZ6lP2l.js | 143 + assets/index-BDPfqLnQ.css | 1 + assets/index-Cghja_vb.js | 4304 ----------------- assets/index-DwhXMaNP.js | 4068 ++++++++++++++++ assets/index-zPQGFsGk.css | 1 - assets/reactive-3iPiwwNw.js | 1 + assets/reactive-B8Cs-xx5.js | 1 + assets/reactive-BCKqTRYY.js | 1 - assets/reactive-BYTUQiod.js | 2 + assets/reactive-BdX5JLG8.js | 1 + assets/reactive-BgYCCJBi.js | 1 - ...ctive-BeOWGcMZ.js => reactive-BoTxrBvq.js} | 2 +- assets/reactive-BphjmU22.js | 1 - assets/reactive-CeDCw1Du.js | 1 + assets/reactive-CgD5EBKP.js | 2 - assets/reactive-CmorMSwY.js | 1 - assets/reactive-Csss5IX3.js | 1 + assets/reactive-D3UpTtXe.js | 1 - assets/reactive-DD7TKsGV.js | 1 + assets/reactive-DShZioEa.js | 1 - assets/reactive-SpGdnhOu.js | 1 + assets/reactive-UZqlxOwl.js | 1 - assets/reactive-W3VVQsKw.js | 110 + index.html | 4 +- 29 files changed, 4346 insertions(+), 4325 deletions(-) rename assets/{Noise-eViT7niE.js => Noise-D5uvWl4i.js} (96%) create mode 100644 assets/controls-ByeBQODT.js create mode 100644 assets/controls-CwyAXsj5.js create mode 100644 assets/controls-DogCyDae.js create mode 100644 assets/controls-tumpVwPC.js create mode 100644 assets/ground-DJZ6lP2l.js create mode 100644 assets/index-BDPfqLnQ.css delete mode 100644 assets/index-Cghja_vb.js create mode 100644 assets/index-DwhXMaNP.js delete mode 100644 assets/index-zPQGFsGk.css create mode 100644 assets/reactive-3iPiwwNw.js create mode 100644 assets/reactive-B8Cs-xx5.js delete mode 100644 assets/reactive-BCKqTRYY.js create mode 100644 assets/reactive-BYTUQiod.js create mode 100644 assets/reactive-BdX5JLG8.js delete mode 100644 assets/reactive-BgYCCJBi.js rename assets/{reactive-BeOWGcMZ.js => reactive-BoTxrBvq.js} (66%) delete mode 100644 assets/reactive-BphjmU22.js create mode 100644 assets/reactive-CeDCw1Du.js delete mode 100644 assets/reactive-CgD5EBKP.js delete mode 100644 assets/reactive-CmorMSwY.js create mode 100644 assets/reactive-Csss5IX3.js delete mode 100644 assets/reactive-D3UpTtXe.js create mode 100644 assets/reactive-DD7TKsGV.js delete mode 100644 assets/reactive-DShZioEa.js create mode 100644 assets/reactive-SpGdnhOu.js delete mode 100644 assets/reactive-UZqlxOwl.js create mode 100644 assets/reactive-W3VVQsKw.js diff --git a/assets/Noise-eViT7niE.js b/assets/Noise-D5uvWl4i.js similarity index 96% rename from assets/Noise-eViT7niE.js rename to assets/Noise-D5uvWl4i.js index 1b0ee40a..23eba2a3 100644 --- a/assets/Noise-eViT7niE.js +++ b/assets/Noise-D5uvWl4i.js @@ -1,5 +1,5 @@ -import{l as M,U as A,m as S,D as Ne,n as Ie,o as ze,p as ke,W as U,q as oe,L as xe,N as Se,s as O,t as u,v as q,F as Oe,w as He,x as Te,y as ue,z as Le,A as Ge,I as Y,J as Z,K as j,O as w,P as Ve,R as Ee,X as Me,Y as N,Z as Be,_ as Ce,$ as We,a0 as ce,a1 as he,r as I,a2 as ie,a3 as Re,a as Ke,a4 as Ze,a5 as je,j as re,a6 as Xe,a7 as qe}from"./index-Cghja_vb.js";let V;function Ye(){var e;if(V!==void 0)return V;try{let t;const s=document.createElement("canvas");return V=!!(window.WebGL2RenderingContext&&(t=s.getContext("webgl2"))),t&&((e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext()),V}catch{return V=!1}}/** - * postprocessing v6.36.2 build Tue Sep 10 2024 +import{a as M,U as A,p as S,D as Ne,q as Ie,s as ze,t as ke,W as U,v as oe,w as xe,N as Se,x as O,y as u,z as q,F as Oe,A as He,C as Te,G as ue,I as Le,J as Ge,K as Y,O as Z,P as j,R as w,X as Ve,Y as Ee,Z as Me,_ as N,$ as Be,a0 as Ce,a1 as We,a2 as ce,a3 as he,r as I,a4 as ie,u as Re,b as Ke,a5 as Ze,a6 as je,j as re,a7 as Xe,a8 as qe}from"./index-DwhXMaNP.js";let V;function Ye(){var e;if(V!==void 0)return V;try{let t;const s=document.createElement("canvas");return V=!!(window.WebGL2RenderingContext&&(t=s.getContext("webgl2"))),t&&((e=t.getExtension("WEBGL_lose_context"))==null||e.loseContext()),V}catch{return V=!1}}/** + * postprocessing v6.36.3 build Thu Sep 26 2024 * https://github.com/pmndrs/postprocessing * Copyright 2015-2024 Raoul van Rüschen * @license Zlib @@ -13,14 +13,14 @@ uniform lowp sampler2D inputBuffer; uniform float opacity;varying vec2 vUv;void main(){vec4 texel=texture2D(inputBuffer,vUv);gl_FragColor=opacity*texel; #include #include -}`,K="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",ye=class extends w{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new u(null),opacity:new u(1)},blending:N,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:tt,vertexShader:K})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},st=class extends B{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new ye,this.needsSwap=!1,this.renderTarget=e,e===void 0&&(this.renderTarget=new U(1,1,{minFilter:Y,magFilter:Y,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,s,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,s){s!==void 0&&(this.renderTarget.texture.type=s,s!==A?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":e!==null&&e.outputColorSpace===S&&(this.renderTarget.texture.colorSpace=S))}},fe=new Te,be=class extends B{constructor(e=!0,t=!0,s=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=s,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,s){this.color=e,this.depth=t,this.stencil=s}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,s,i,r){const n=this.overrideClearColor,a=this.overrideClearAlpha,l=e.getClearAlpha(),o=n!==null,c=a>=0;o?(e.getClearColor(fe),e.setClearColor(n,c?a:l)):c&&e.setClearAlpha(a),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),o?e.setClearColor(fe,l):c&&e.setClearAlpha(l)}},it=class extends B{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new be(!1,!1,!0),this.inverse=!1}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,s,i,r){const n=e.getContext(),a=e.state.buffers,l=this.scene,o=this.camera,c=this.clearPass,h=this.inverted?0:1,d=1-h;a.color.setMask(!1),a.depth.setMask(!1),a.color.setLocked(!0),a.depth.setLocked(!0),a.stencil.setTest(!0),a.stencil.setOp(n.REPLACE,n.REPLACE,n.REPLACE),a.stencil.setFunc(n.ALWAYS,h,4294967295),a.stencil.setClear(d),a.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(e,null):(c.render(e,t),c.render(e,s))),this.renderToScreen?(e.setRenderTarget(null),e.render(l,o)):(e.setRenderTarget(t),e.render(l,o),e.setRenderTarget(s),e.render(l,o)),a.color.setLocked(!1),a.depth.setLocked(!1),a.stencil.setLocked(!1),a.stencil.setFunc(n.EQUAL,1,4294967295),a.stencil.setOp(n.KEEP,n.KEEP,n.KEEP),a.stencil.setLocked(!0)}},rt=class{constructor(t=null,{depthBuffer:s=!0,stencilBuffer:i=!1,multisampling:r=0,frameBufferType:n}={}){this.renderer=null,this.inputBuffer=this.createBuffer(s,i,n,r),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new st,this.depthTexture=null,this.passes=[],this.timer=new Qe,this.autoRenderToScreen=!0,this.setRenderer(t)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(t){const s=this.inputBuffer,i=this.multisampling;i>0&&t>0?(this.inputBuffer.samples=t,this.outputBuffer.samples=t,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==t&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(s.depthBuffer,s.stencilBuffer,s.texture.type,t),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(t){if(this.renderer=t,t!==null){const s=t.getSize(new M),i=t.getContext().getContextAttributes().alpha,r=this.inputBuffer.texture.type;r===A&&t.outputColorSpace===S&&(this.inputBuffer.texture.colorSpace=S,this.outputBuffer.texture.colorSpace=S,this.inputBuffer.dispose(),this.outputBuffer.dispose()),t.autoClear=!1,this.setSize(s.width,s.height);for(const n of this.passes)n.initialize(t,i,r)}}replaceRenderer(t,s=!0){const i=this.renderer,r=i.domElement.parentNode;return this.setRenderer(t),s&&r!==null&&(r.removeChild(i.domElement),r.appendChild(t.domElement)),i}createDepthTexture(){const t=this.depthTexture=new Ne;return this.inputBuffer.depthTexture=t,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(t.format=Ie,t.type=ze):t.type=ke,t}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const t of this.passes)t.setDepthTexture(null)}}createBuffer(t,s,i,r){const n=this.renderer,a=n===null?new M:n.getDrawingBufferSize(new M),l={minFilter:Y,magFilter:Y,stencilBuffer:s,depthBuffer:t,type:i},o=new U(a.width,a.height,l);return r>0&&(o.ignoreDepthForMultisampleCopy=!1,o.samples=r),i===A&&n!==null&&n.outputColorSpace===S&&(o.texture.colorSpace=S),o.texture.name="EffectComposer.Buffer",o.texture.generateMipmaps=!1,o}setMainScene(t){for(const s of this.passes)s.mainScene=t}setMainCamera(t){for(const s of this.passes)s.mainCamera=t}addPass(t,s){const i=this.passes,r=this.renderer,n=r.getDrawingBufferSize(new M),a=r.getContext().getContextAttributes().alpha,l=this.inputBuffer.texture.type;if(t.setRenderer(r),t.setSize(n.width,n.height),t.initialize(r,a,l),this.autoRenderToScreen&&(i.length>0&&(i[i.length-1].renderToScreen=!1),t.renderToScreen&&(this.autoRenderToScreen=!1)),s!==void 0?i.splice(s,0,t):i.push(t),this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!0),t.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){const o=this.createDepthTexture();for(t of i)t.setDepthTexture(o)}else t.setDepthTexture(this.depthTexture)}removePass(t){const s=this.passes,i=s.indexOf(t);if(i!==-1&&s.splice(i,1).length>0){if(this.depthTexture!==null){const a=(o,c)=>o||c.needsDepthTexture;s.reduce(a,!1)||(t.getDepthTexture()===this.depthTexture&&t.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&i===s.length&&(t.renderToScreen=!1,s.length>0&&(s[s.length-1].renderToScreen=!0))}}removeAllPasses(){const t=this.passes;this.deleteDepthTexture(),t.length>0&&(this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!1),this.passes=[])}render(t){const s=this.renderer,i=this.copyPass;let r=this.inputBuffer,n=this.outputBuffer,a=!1,l,o,c;t===void 0&&(this.timer.update(),t=this.timer.getDelta());for(const h of this.passes)h.enabled&&(h.render(s,r,n,t,a),h.needsSwap&&(a&&(i.renderToScreen=h.renderToScreen,l=s.getContext(),o=s.state.buffers.stencil,o.setFunc(l.NOTEQUAL,1,4294967295),i.render(s,r,n,t,a),o.setFunc(l.EQUAL,1,4294967295)),c=r,r=n,n=c),h instanceof it?a=!0:h instanceof et&&(a=!1))}setSize(t,s,i){const r=this.renderer,n=r.getSize(new M);(t===void 0||s===void 0)&&(t=n.width,s=n.height),(n.width!==t||n.height!==s)&&r.setSize(t,s,i);const a=r.getDrawingBufferSize(new M);this.inputBuffer.setSize(a.width,a.height),this.outputBuffer.setSize(a.width,a.height);for(const l of this.passes)l.setSize(a.width,a.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(const t of this.passes)t.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),B.fullscreenGeometry.dispose()}},F={NONE:0,DEPTH:1,CONVOLUTION:2},p={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},nt=class{constructor(){this.shaderParts=new Map([[p.FRAGMENT_HEAD,null],[p.FRAGMENT_MAIN_UV,null],[p.FRAGMENT_MAIN_IMAGE,null],[p.VERTEX_HEAD,null],[p.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=F.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=xe}},se=!1,de=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=t=>{if(t.isMesh){let s;if(t.material.flatShading)switch(t.material.side){case j:s=this.materialsFlatShadedDoubleSide;break;case Z:s=this.materialsFlatShadedBackSide;break;default:s=this.materialsFlatShaded;break}else switch(t.material.side){case j:s=this.materialsDoubleSide;break;case Z:s=this.materialsBackSide;break;default:s=this.materials;break}this.originalMaterials.set(t,t.material),t.isSkinnedMesh?t.material=s[2]:t.isInstancedMesh?t.material=s[1]:t.material=s[0],++this.meshCount}}}cloneMaterial(e){if(!(e instanceof w))return e.clone();const t=e.uniforms,s=new Map;for(const r in t){const n=t[r].value;n.isRenderTargetTexture&&(t[r].value=null,s.set(r,n))}const i=e.clone();for(const r of s)t[r[0]].value=r[1],i.uniforms[r[0]].value=r[1];return i}setMaterial(e){if(this.disposeMaterials(),this.material=e,e!==null){const t=this.materials=[this.cloneMaterial(e),this.cloneMaterial(e),this.cloneMaterial(e)];for(const s of t)s.uniforms=Object.assign({},e.uniforms),s.side=Ve;t[2].skinning=!0,this.materialsBackSide=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.side=Z,i}),this.materialsDoubleSide=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.side=j,i}),this.materialsFlatShaded=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=Z,i}),this.materialsFlatShadedDoubleSide=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=j,i})}}render(e,t,s){const i=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,se){const r=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,s);for(const n of r)n[0].material=n[1];this.meshCount!==r.size&&r.clear()}else{const r=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,s),t.overrideMaterial=r}e.shadowMap.enabled=i}disposeMaterials(){if(this.material!==null){const e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return se}static set workaroundEnabled(e){se=e}},k=-1,T=class extends oe{constructor(e,t=k,s=k,i=1){super(),this.resizable=e,this.baseSize=new M(1,1),this.preferredSize=new M(t,s),this.target=this.preferredSize,this.s=i,this.effectiveSize=new M,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){const e=this.baseSize,t=this.preferredSize,s=this.effectiveSize,i=this.scale;t.width!==k?s.width=t.width:t.height!==k?s.width=Math.round(t.height*(e.width/Math.max(e.height,1))):s.width=Math.round(e.width*i),t.height!==k?s.height=t.height:t.width!==k?s.height=Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):s.height=Math.round(e.height*i)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar(k),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){(this.baseSize.width!==e||this.baseSize.height!==t)&&(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){(this.preferredSize.width!==e||this.preferredSize.height!==t)&&(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return k}},f={SKIP:9,SET:30,ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},at="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}",ot="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}",lt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}",ut="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",ct="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}",ht="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}",ft="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}",dt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}",pt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}",vt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}",mt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}",gt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}",xt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}",St="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}",Tt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}",Et="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}",Mt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}",Bt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}",Ct="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}",Rt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",yt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}",bt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}",_t="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}",Ut="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}",wt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}",Dt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}",Pt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",Ft="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}",At="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}",Nt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}",It="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}",zt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}",kt=new Map([[f.ADD,at],[f.ALPHA,ot],[f.AVERAGE,lt],[f.COLOR,ut],[f.COLOR_BURN,ct],[f.COLOR_DODGE,ht],[f.DARKEN,ft],[f.DIFFERENCE,dt],[f.DIVIDE,pt],[f.DST,null],[f.EXCLUSION,vt],[f.HARD_LIGHT,mt],[f.HARD_MIX,gt],[f.HUE,xt],[f.INVERT,St],[f.INVERT_RGB,Tt],[f.LIGHTEN,Et],[f.LINEAR_BURN,Mt],[f.LINEAR_DODGE,Bt],[f.LINEAR_LIGHT,Ct],[f.LUMINOSITY,Rt],[f.MULTIPLY,yt],[f.NEGATION,bt],[f.NORMAL,_t],[f.OVERLAY,Ut],[f.PIN_LIGHT,wt],[f.REFLECT,Dt],[f.SATURATION,Pt],[f.SCREEN,Ft],[f.SOFT_LIGHT,At],[f.SRC,Nt],[f.SUBTRACT,It],[f.VIVID_LIGHT,zt]]),Ot=class extends oe{constructor(e,t=1){super(),this._blendFunction=e,this.opacity=new u(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return kt.get(this.blendFunction)}},$={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},Ht=`#ifdef FRAMEBUFFER_PRECISION_HIGH +}`,K="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}",be=class extends w{constructor(){super({name:"CopyMaterial",uniforms:{inputBuffer:new u(null),opacity:new u(1)},blending:N,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:tt,vertexShader:K})}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}getOpacity(e){return this.uniforms.opacity.value}setOpacity(e){this.uniforms.opacity.value=e}},st=class extends B{constructor(e,t=!0){super("CopyPass"),this.fullscreenMaterial=new be,this.needsSwap=!1,this.renderTarget=e,e===void 0&&(this.renderTarget=new U(1,1,{minFilter:Y,magFilter:Y,stencilBuffer:!1,depthBuffer:!1}),this.renderTarget.texture.name="CopyPass.Target"),this.autoResize=t}get resize(){return this.autoResize}set resize(e){this.autoResize=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}setAutoResizeEnabled(e){this.autoResize=e}render(e,t,s,i,r){this.fullscreenMaterial.inputBuffer=t.texture,e.setRenderTarget(this.renderToScreen?null:this.renderTarget),e.render(this.scene,this.camera)}setSize(e,t){this.autoResize&&this.renderTarget.setSize(e,t)}initialize(e,t,s){s!==void 0&&(this.renderTarget.texture.type=s,s!==A?this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1":e!==null&&e.outputColorSpace===S&&(this.renderTarget.texture.colorSpace=S))}},fe=new Te,ye=class extends B{constructor(e=!0,t=!0,s=!1){super("ClearPass",null,null),this.needsSwap=!1,this.color=e,this.depth=t,this.stencil=s,this.overrideClearColor=null,this.overrideClearAlpha=-1}setClearFlags(e,t,s){this.color=e,this.depth=t,this.stencil=s}getOverrideClearColor(){return this.overrideClearColor}setOverrideClearColor(e){this.overrideClearColor=e}getOverrideClearAlpha(){return this.overrideClearAlpha}setOverrideClearAlpha(e){this.overrideClearAlpha=e}render(e,t,s,i,r){const n=this.overrideClearColor,a=this.overrideClearAlpha,l=e.getClearAlpha(),o=n!==null,c=a>=0;o?(e.getClearColor(fe),e.setClearColor(n,c?a:l)):c&&e.setClearAlpha(a),e.setRenderTarget(this.renderToScreen?null:t),e.clear(this.color,this.depth,this.stencil),o?e.setClearColor(fe,l):c&&e.setClearAlpha(l)}},it=class extends B{constructor(e,t){super("MaskPass",e,t),this.needsSwap=!1,this.clearPass=new ye(!1,!1,!0),this.inverse=!1}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get inverted(){return this.inverse}set inverted(e){this.inverse=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getClearPass(){return this.clearPass}isInverted(){return this.inverted}setInverted(e){this.inverted=e}render(e,t,s,i,r){const n=e.getContext(),a=e.state.buffers,l=this.scene,o=this.camera,c=this.clearPass,h=this.inverted?0:1,d=1-h;a.color.setMask(!1),a.depth.setMask(!1),a.color.setLocked(!0),a.depth.setLocked(!0),a.stencil.setTest(!0),a.stencil.setOp(n.REPLACE,n.REPLACE,n.REPLACE),a.stencil.setFunc(n.ALWAYS,h,4294967295),a.stencil.setClear(d),a.stencil.setLocked(!0),this.clearPass.enabled&&(this.renderToScreen?c.render(e,null):(c.render(e,t),c.render(e,s))),this.renderToScreen?(e.setRenderTarget(null),e.render(l,o)):(e.setRenderTarget(t),e.render(l,o),e.setRenderTarget(s),e.render(l,o)),a.color.setLocked(!1),a.depth.setLocked(!1),a.stencil.setLocked(!1),a.stencil.setFunc(n.EQUAL,1,4294967295),a.stencil.setOp(n.KEEP,n.KEEP,n.KEEP),a.stencil.setLocked(!0)}},rt=class{constructor(t=null,{depthBuffer:s=!0,stencilBuffer:i=!1,multisampling:r=0,frameBufferType:n}={}){this.renderer=null,this.inputBuffer=this.createBuffer(s,i,n,r),this.outputBuffer=this.inputBuffer.clone(),this.copyPass=new st,this.depthTexture=null,this.passes=[],this.timer=new Qe,this.autoRenderToScreen=!0,this.setRenderer(t)}get multisampling(){return this.inputBuffer.samples||0}set multisampling(t){const s=this.inputBuffer,i=this.multisampling;i>0&&t>0?(this.inputBuffer.samples=t,this.outputBuffer.samples=t,this.inputBuffer.dispose(),this.outputBuffer.dispose()):i!==t&&(this.inputBuffer.dispose(),this.outputBuffer.dispose(),this.inputBuffer=this.createBuffer(s.depthBuffer,s.stencilBuffer,s.texture.type,t),this.inputBuffer.depthTexture=this.depthTexture,this.outputBuffer=this.inputBuffer.clone())}getTimer(){return this.timer}getRenderer(){return this.renderer}setRenderer(t){if(this.renderer=t,t!==null){const s=t.getSize(new M),i=t.getContext().getContextAttributes().alpha,r=this.inputBuffer.texture.type;r===A&&t.outputColorSpace===S&&(this.inputBuffer.texture.colorSpace=S,this.outputBuffer.texture.colorSpace=S,this.inputBuffer.dispose(),this.outputBuffer.dispose()),t.autoClear=!1,this.setSize(s.width,s.height);for(const n of this.passes)n.initialize(t,i,r)}}replaceRenderer(t,s=!0){const i=this.renderer,r=i.domElement.parentNode;return this.setRenderer(t),s&&r!==null&&(r.removeChild(i.domElement),r.appendChild(t.domElement)),i}createDepthTexture(){const t=this.depthTexture=new Ne;return this.inputBuffer.depthTexture=t,this.inputBuffer.dispose(),this.inputBuffer.stencilBuffer?(t.format=Ie,t.type=ze):t.type=ke,t}deleteDepthTexture(){if(this.depthTexture!==null){this.depthTexture.dispose(),this.depthTexture=null,this.inputBuffer.depthTexture=null,this.inputBuffer.dispose();for(const t of this.passes)t.setDepthTexture(null)}}createBuffer(t,s,i,r){const n=this.renderer,a=n===null?new M:n.getDrawingBufferSize(new M),l={minFilter:Y,magFilter:Y,stencilBuffer:s,depthBuffer:t,type:i},o=new U(a.width,a.height,l);return r>0&&(o.ignoreDepthForMultisampleCopy=!1,o.samples=r),i===A&&n!==null&&n.outputColorSpace===S&&(o.texture.colorSpace=S),o.texture.name="EffectComposer.Buffer",o.texture.generateMipmaps=!1,o}setMainScene(t){for(const s of this.passes)s.mainScene=t}setMainCamera(t){for(const s of this.passes)s.mainCamera=t}addPass(t,s){const i=this.passes,r=this.renderer,n=r.getDrawingBufferSize(new M),a=r.getContext().getContextAttributes().alpha,l=this.inputBuffer.texture.type;if(t.setRenderer(r),t.setSize(n.width,n.height),t.initialize(r,a,l),this.autoRenderToScreen&&(i.length>0&&(i[i.length-1].renderToScreen=!1),t.renderToScreen&&(this.autoRenderToScreen=!1)),s!==void 0?i.splice(s,0,t):i.push(t),this.autoRenderToScreen&&(i[i.length-1].renderToScreen=!0),t.needsDepthTexture||this.depthTexture!==null)if(this.depthTexture===null){const o=this.createDepthTexture();for(t of i)t.setDepthTexture(o)}else t.setDepthTexture(this.depthTexture)}removePass(t){const s=this.passes,i=s.indexOf(t);if(i!==-1&&s.splice(i,1).length>0){if(this.depthTexture!==null){const a=(o,c)=>o||c.needsDepthTexture;s.reduce(a,!1)||(t.getDepthTexture()===this.depthTexture&&t.setDepthTexture(null),this.deleteDepthTexture())}this.autoRenderToScreen&&i===s.length&&(t.renderToScreen=!1,s.length>0&&(s[s.length-1].renderToScreen=!0))}}removeAllPasses(){const t=this.passes;this.deleteDepthTexture(),t.length>0&&(this.autoRenderToScreen&&(t[t.length-1].renderToScreen=!1),this.passes=[])}render(t){const s=this.renderer,i=this.copyPass;let r=this.inputBuffer,n=this.outputBuffer,a=!1,l,o,c;t===void 0&&(this.timer.update(),t=this.timer.getDelta());for(const h of this.passes)h.enabled&&(h.render(s,r,n,t,a),h.needsSwap&&(a&&(i.renderToScreen=h.renderToScreen,l=s.getContext(),o=s.state.buffers.stencil,o.setFunc(l.NOTEQUAL,1,4294967295),i.render(s,r,n,t,a),o.setFunc(l.EQUAL,1,4294967295)),c=r,r=n,n=c),h instanceof it?a=!0:h instanceof et&&(a=!1))}setSize(t,s,i){const r=this.renderer,n=r.getSize(new M);(t===void 0||s===void 0)&&(t=n.width,s=n.height),(n.width!==t||n.height!==s)&&r.setSize(t,s,i);const a=r.getDrawingBufferSize(new M);this.inputBuffer.setSize(a.width,a.height),this.outputBuffer.setSize(a.width,a.height);for(const l of this.passes)l.setSize(a.width,a.height)}reset(){this.dispose(),this.autoRenderToScreen=!0}dispose(){for(const t of this.passes)t.dispose();this.passes=[],this.inputBuffer!==null&&this.inputBuffer.dispose(),this.outputBuffer!==null&&this.outputBuffer.dispose(),this.deleteDepthTexture(),this.copyPass.dispose(),this.timer.dispose(),B.fullscreenGeometry.dispose()}},F={NONE:0,DEPTH:1,CONVOLUTION:2},p={FRAGMENT_HEAD:"FRAGMENT_HEAD",FRAGMENT_MAIN_UV:"FRAGMENT_MAIN_UV",FRAGMENT_MAIN_IMAGE:"FRAGMENT_MAIN_IMAGE",VERTEX_HEAD:"VERTEX_HEAD",VERTEX_MAIN_SUPPORT:"VERTEX_MAIN_SUPPORT"},nt=class{constructor(){this.shaderParts=new Map([[p.FRAGMENT_HEAD,null],[p.FRAGMENT_MAIN_UV,null],[p.FRAGMENT_MAIN_IMAGE,null],[p.VERTEX_HEAD,null],[p.VERTEX_MAIN_SUPPORT,null]]),this.defines=new Map,this.uniforms=new Map,this.blendModes=new Map,this.extensions=new Set,this.attributes=F.NONE,this.varyings=new Set,this.uvTransformation=!1,this.readDepth=!1,this.colorSpace=xe}},se=!1,de=class{constructor(e=null){this.originalMaterials=new Map,this.material=null,this.materials=null,this.materialsBackSide=null,this.materialsDoubleSide=null,this.materialsFlatShaded=null,this.materialsFlatShadedBackSide=null,this.materialsFlatShadedDoubleSide=null,this.setMaterial(e),this.meshCount=0,this.replaceMaterial=t=>{if(t.isMesh){let s;if(t.material.flatShading)switch(t.material.side){case j:s=this.materialsFlatShadedDoubleSide;break;case Z:s=this.materialsFlatShadedBackSide;break;default:s=this.materialsFlatShaded;break}else switch(t.material.side){case j:s=this.materialsDoubleSide;break;case Z:s=this.materialsBackSide;break;default:s=this.materials;break}this.originalMaterials.set(t,t.material),t.isSkinnedMesh?t.material=s[2]:t.isInstancedMesh?t.material=s[1]:t.material=s[0],++this.meshCount}}}cloneMaterial(e){if(!(e instanceof w))return e.clone();const t=e.uniforms,s=new Map;for(const r in t){const n=t[r].value;n.isRenderTargetTexture&&(t[r].value=null,s.set(r,n))}const i=e.clone();for(const r of s)t[r[0]].value=r[1],i.uniforms[r[0]].value=r[1];return i}setMaterial(e){if(this.disposeMaterials(),this.material=e,e!==null){const t=this.materials=[this.cloneMaterial(e),this.cloneMaterial(e),this.cloneMaterial(e)];for(const s of t)s.uniforms=Object.assign({},e.uniforms),s.side=Ve;t[2].skinning=!0,this.materialsBackSide=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.side=Z,i}),this.materialsDoubleSide=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.side=j,i}),this.materialsFlatShaded=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i}),this.materialsFlatShadedBackSide=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=Z,i}),this.materialsFlatShadedDoubleSide=t.map(s=>{const i=this.cloneMaterial(s);return i.uniforms=Object.assign({},e.uniforms),i.flatShading=!0,i.side=j,i})}}render(e,t,s){const i=e.shadowMap.enabled;if(e.shadowMap.enabled=!1,se){const r=this.originalMaterials;this.meshCount=0,t.traverse(this.replaceMaterial),e.render(t,s);for(const n of r)n[0].material=n[1];this.meshCount!==r.size&&r.clear()}else{const r=t.overrideMaterial;t.overrideMaterial=this.material,e.render(t,s),t.overrideMaterial=r}e.shadowMap.enabled=i}disposeMaterials(){if(this.material!==null){const e=this.materials.concat(this.materialsBackSide).concat(this.materialsDoubleSide).concat(this.materialsFlatShaded).concat(this.materialsFlatShadedBackSide).concat(this.materialsFlatShadedDoubleSide);for(const t of e)t.dispose()}}dispose(){this.originalMaterials.clear(),this.disposeMaterials()}static get workaroundEnabled(){return se}static set workaroundEnabled(e){se=e}},k=-1,T=class extends oe{constructor(e,t=k,s=k,i=1){super(),this.resizable=e,this.baseSize=new M(1,1),this.preferredSize=new M(t,s),this.target=this.preferredSize,this.s=i,this.effectiveSize=new M,this.addEventListener("change",()=>this.updateEffectiveSize()),this.updateEffectiveSize()}updateEffectiveSize(){const e=this.baseSize,t=this.preferredSize,s=this.effectiveSize,i=this.scale;t.width!==k?s.width=t.width:t.height!==k?s.width=Math.round(t.height*(e.width/Math.max(e.height,1))):s.width=Math.round(e.width*i),t.height!==k?s.height=t.height:t.width!==k?s.height=Math.round(t.width/Math.max(e.width/Math.max(e.height,1),1)):s.height=Math.round(e.height*i)}get width(){return this.effectiveSize.width}set width(e){this.preferredWidth=e}get height(){return this.effectiveSize.height}set height(e){this.preferredHeight=e}getWidth(){return this.width}getHeight(){return this.height}get scale(){return this.s}set scale(e){this.s!==e&&(this.s=e,this.preferredSize.setScalar(k),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getScale(){return this.scale}setScale(e){this.scale=e}get baseWidth(){return this.baseSize.width}set baseWidth(e){this.baseSize.width!==e&&(this.baseSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseWidth(){return this.baseWidth}setBaseWidth(e){this.baseWidth=e}get baseHeight(){return this.baseSize.height}set baseHeight(e){this.baseSize.height!==e&&(this.baseSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getBaseHeight(){return this.baseHeight}setBaseHeight(e){this.baseHeight=e}setBaseSize(e,t){(this.baseSize.width!==e||this.baseSize.height!==t)&&(this.baseSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}get preferredWidth(){return this.preferredSize.width}set preferredWidth(e){this.preferredSize.width!==e&&(this.preferredSize.width=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredWidth(){return this.preferredWidth}setPreferredWidth(e){this.preferredWidth=e}get preferredHeight(){return this.preferredSize.height}set preferredHeight(e){this.preferredSize.height!==e&&(this.preferredSize.height=e,this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}getPreferredHeight(){return this.preferredHeight}setPreferredHeight(e){this.preferredHeight=e}setPreferredSize(e,t){(this.preferredSize.width!==e||this.preferredSize.height!==t)&&(this.preferredSize.set(e,t),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height))}copy(e){this.s=e.scale,this.baseSize.set(e.baseWidth,e.baseHeight),this.preferredSize.set(e.preferredWidth,e.preferredHeight),this.dispatchEvent({type:"change"}),this.resizable.setSize(this.baseSize.width,this.baseSize.height)}static get AUTO_SIZE(){return k}},f={SKIP:9,SET:30,ADD:0,ALPHA:1,AVERAGE:2,COLOR:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,DIVIDE:8,DST:9,EXCLUSION:10,HARD_LIGHT:11,HARD_MIX:12,HUE:13,INVERT:14,INVERT_RGB:15,LIGHTEN:16,LINEAR_BURN:17,LINEAR_DODGE:18,LINEAR_LIGHT:19,LUMINOSITY:20,MULTIPLY:21,NEGATION:22,NORMAL:23,OVERLAY:24,PIN_LIGHT:25,REFLECT:26,SATURATION:27,SCREEN:28,SOFT_LIGHT:29,SRC:30,SUBTRACT:31,VIVID_LIGHT:32},at="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y,opacity);}",ot="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,min(y.a,opacity));}",lt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y)*0.5,opacity);}",ut="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.rg,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",ct="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(step(0.0,y)*(1.0-min(vec4(1.0),(1.0-x)/y)),vec4(1.0),step(1.0,x));return mix(x,z,opacity);}",ht="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=step(0.0,x)*mix(min(vec4(1.0),x/max(1.0-y,1e-9)),vec4(1.0),step(1.0,y));return mix(x,z,opacity);}",ft="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x,y),opacity);}",dt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,abs(x-y),opacity);}",pt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x/max(y,1e-12),opacity);}",vt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,(x+y-2.0*x*y),opacity);}",mt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 a=min(x,1.0),b=min(y,1.0);vec4 z=mix(2.0*a*b,1.0-2.0*(1.0-a)*(1.0-b),step(0.5,y));return mix(x,z,opacity);}",gt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,step(1.0,x+y),opacity);}",xt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(yHSL.r,xHSL.gb));return vec4(mix(x.rgb,z,opacity),y.a);}",St="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-y,opacity);}",Tt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y*(1.0-x),opacity);}",Et="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x,y),opacity);}",Mt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(y+x-1.0,0.0,1.0),opacity);}",Bt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,min(x+y,1.0),opacity);}",Ct="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,clamp(2.0*y+x-1.0,0.0,1.0),opacity);}",Rt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.rg,yHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",bt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x*y,opacity);}",yt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,1.0-abs(1.0-x-y),opacity);}",_t="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,y,opacity);}",Ut="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(2.0*y*x,1.0-2.0*(1.0-y)*(1.0-x),step(0.5,x));return mix(x,z,opacity);}",wt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 z=mix(mix(y2,x,step(0.5*x,y)),max(vec4(0.0),y2-1.0),step(x,(y2-1.0)));return mix(x,z,opacity);}",Dt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(min(x*x/max(1.0-y,1e-12),1.0),y,step(1.0,y));return mix(x,z,opacity);}",Pt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec3 xHSL=RGBToHSL(x.rgb);vec3 yHSL=RGBToHSL(y.rgb);vec3 z=HSLToRGB(vec3(xHSL.r,yHSL.g,xHSL.b));return vec4(mix(x.rgb,z,opacity),y.a);}",Ft="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,x+y-min(x*y,1.0),opacity);}",At="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 y2=2.0*y;vec4 w=step(0.5,y);vec4 z=mix(x-(1.0-y2)*x*(1.0-x),mix(x+(y2-1.0)*(sqrt(x)-x),x+(y2-1.0)*x*((16.0*x-12.0)*x+3.0),w*(1.0-step(0.25,x))),w);return mix(x,z,opacity);}",Nt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return y;}",It="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){return mix(x,max(x+y-1.0,0.0),opacity);}",zt="vec4 blend(const in vec4 x,const in vec4 y,const in float opacity){vec4 z=mix(max(1.0-min((1.0-x)/(2.0*y),1.0),0.0),min(x/(2.0*(1.0-y)),1.0),step(0.5,y));return mix(x,z,opacity);}",kt=new Map([[f.ADD,at],[f.ALPHA,ot],[f.AVERAGE,lt],[f.COLOR,ut],[f.COLOR_BURN,ct],[f.COLOR_DODGE,ht],[f.DARKEN,ft],[f.DIFFERENCE,dt],[f.DIVIDE,pt],[f.DST,null],[f.EXCLUSION,vt],[f.HARD_LIGHT,mt],[f.HARD_MIX,gt],[f.HUE,xt],[f.INVERT,St],[f.INVERT_RGB,Tt],[f.LIGHTEN,Et],[f.LINEAR_BURN,Mt],[f.LINEAR_DODGE,Bt],[f.LINEAR_LIGHT,Ct],[f.LUMINOSITY,Rt],[f.MULTIPLY,bt],[f.NEGATION,yt],[f.NORMAL,_t],[f.OVERLAY,Ut],[f.PIN_LIGHT,wt],[f.REFLECT,Dt],[f.SATURATION,Pt],[f.SCREEN,Ft],[f.SOFT_LIGHT,At],[f.SRC,Nt],[f.SUBTRACT,It],[f.VIVID_LIGHT,zt]]),Ot=class extends oe{constructor(e,t=1){super(),this._blendFunction=e,this.opacity=new u(t)}getOpacity(){return this.opacity.value}setOpacity(e){this.opacity.value=e}get blendFunction(){return this._blendFunction}set blendFunction(e){this._blendFunction=e,this.dispatchEvent({type:"change"})}getBlendFunction(){return this.blendFunction}setBlendFunction(e){this.blendFunction=e}getShaderCode(){return kt.get(this.blendFunction)}},$={VERY_SMALL:0,SMALL:1,MEDIUM:2,LARGE:3,VERY_LARGE:4,HUGE:5},Ht=`#ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else uniform lowp sampler2D inputBuffer; #endif varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec4 sum=texture2D(inputBuffer,vUv0);sum+=texture2D(inputBuffer,vUv1);sum+=texture2D(inputBuffer,vUv2);sum+=texture2D(inputBuffer,vUv3);gl_FragColor=sum*0.25; #include -}`,Lt="uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",Gt=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],Vt=class extends w{constructor(e=new he){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new u(null),texelSize:new u(new he),scale:new u(1),kernel:new u(0)},blending:N,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:Ht,vertexShader:Lt}),this.setTexelSize(e.x,e.y),this.kernelSize=$.MEDIUM}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return Gt[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,e*.5,t*.5)}setSize(e,t){const s=1/e,i=1/t;this.uniforms.texelSize.value.set(s,i,s*.5,i*.5)}},_e=class extends B{constructor({kernelSize:e=$.MEDIUM,resolutionScale:t=.5,width:s=T.AUTO_SIZE,height:i=T.AUTO_SIZE,resolutionX:r=s,resolutionY:n=i}={}){super("KawaseBlurPass"),this.renderTargetA=new U(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const a=this.resolution=new T(this,r,n,t);a.addEventListener("change",l=>this.setSize(a.baseWidth,a.baseHeight)),this._blurMaterial=new Vt,this._blurMaterial.kernelSize=e,this.copyMaterial=new ye}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,s,i,r){const n=this.scene,a=this.camera,l=this.renderTargetA,o=this.renderTargetB,c=this.blurMaterial,h=c.kernelSequence;let d=t;this.fullscreenMaterial=c;for(let g=0,v=h.length;g +}`,Lt="uniform vec4 texelSize;uniform float kernel;uniform float scale;varying vec2 vUv0;varying vec2 vUv1;varying vec2 vUv2;varying vec2 vUv3;void main(){vec2 uv=position.xy*0.5+0.5;vec2 dUv=(texelSize.xy*vec2(kernel)+texelSize.zw)*scale;vUv0=vec2(uv.x-dUv.x,uv.y+dUv.y);vUv1=vec2(uv.x+dUv.x,uv.y+dUv.y);vUv2=vec2(uv.x+dUv.x,uv.y-dUv.y);vUv3=vec2(uv.x-dUv.x,uv.y-dUv.y);gl_Position=vec4(position.xy,1.0,1.0);}",Gt=[new Float32Array([0,0]),new Float32Array([0,1,1]),new Float32Array([0,1,1,2]),new Float32Array([0,1,2,2,3]),new Float32Array([0,1,2,3,4,4,5]),new Float32Array([0,1,2,3,4,5,7,8,9,10])],Vt=class extends w{constructor(e=new he){super({name:"KawaseBlurMaterial",uniforms:{inputBuffer:new u(null),texelSize:new u(new he),scale:new u(1),kernel:new u(0)},blending:N,toneMapped:!1,depthWrite:!1,depthTest:!1,fragmentShader:Ht,vertexShader:Lt}),this.setTexelSize(e.x,e.y),this.kernelSize=$.MEDIUM}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.inputBuffer=e}get kernelSequence(){return Gt[this.kernelSize]}get scale(){return this.uniforms.scale.value}set scale(e){this.uniforms.scale.value=e}getScale(){return this.uniforms.scale.value}setScale(e){this.uniforms.scale.value=e}getKernel(){return null}get kernel(){return this.uniforms.kernel.value}set kernel(e){this.uniforms.kernel.value=e}setKernel(e){this.kernel=e}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t,e*.5,t*.5)}setSize(e,t){const s=1/e,i=1/t;this.uniforms.texelSize.value.set(s,i,s*.5,i*.5)}},_e=class extends B{constructor({kernelSize:e=$.MEDIUM,resolutionScale:t=.5,width:s=T.AUTO_SIZE,height:i=T.AUTO_SIZE,resolutionX:r=s,resolutionY:n=i}={}){super("KawaseBlurPass"),this.renderTargetA=new U(1,1,{depthBuffer:!1}),this.renderTargetA.texture.name="Blur.Target.A",this.renderTargetB=this.renderTargetA.clone(),this.renderTargetB.texture.name="Blur.Target.B";const a=this.resolution=new T(this,r,n,t);a.addEventListener("change",l=>this.setSize(a.baseWidth,a.baseHeight)),this._blurMaterial=new Vt,this._blurMaterial.kernelSize=e,this.copyMaterial=new be}getResolution(){return this.resolution}get blurMaterial(){return this._blurMaterial}set blurMaterial(e){this._blurMaterial=e}get dithering(){return this.copyMaterial.dithering}set dithering(e){this.copyMaterial.dithering=e}get kernelSize(){return this.blurMaterial.kernelSize}set kernelSize(e){this.blurMaterial.kernelSize=e}get width(){return this.resolution.width}set width(e){this.resolution.preferredWidth=e}get height(){return this.resolution.height}set height(e){this.resolution.preferredHeight=e}get scale(){return this.blurMaterial.scale}set scale(e){this.blurMaterial.scale=e}getScale(){return this.blurMaterial.scale}setScale(e){this.blurMaterial.scale=e}getKernelSize(){return this.kernelSize}setKernelSize(e){this.kernelSize=e}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,s,i,r){const n=this.scene,a=this.camera,l=this.renderTargetA,o=this.renderTargetB,c=this.blurMaterial,h=c.kernelSequence;let d=t;this.fullscreenMaterial=c;for(let g=0,v=h.length;g #ifdef FRAMEBUFFER_PRECISION_HIGH uniform mediump sampler2D inputBuffer; #else @@ -165,7 +165,7 @@ vec2 cocNearFar=vec2(texture2D(nearCoCBuffer,uv).r,colorFar.a);cocNearFar.x=min( #else vec2 cocNearFar=vec2(texture2D(nearCoCBuffer,uv).r,texture2D(farCoCBuffer,uv).g);cocNearFar=min(cocNearFar*scale,1.0); #endif -vec4 result=inputColor*(1.0-cocNearFar.y)+colorFar;result=mix(result,colorNear,cocNearFar.x);outputColor=result;}`,Rs=class extends G{constructor(e,{blendFunction:t,worldFocusDistance:s,worldFocusRange:i,focusDistance:r=0,focalLength:n=.1,focusRange:a=n,bokehScale:l=1,resolutionScale:o=1,width:c=T.AUTO_SIZE,height:h=T.AUTO_SIZE,resolutionX:d=c,resolutionY:g=h}={}){super("DepthOfFieldEffect",os,{blendFunction:t,attributes:F.DEPTH,uniforms:new Map([["nearColorBuffer",new u(null)],["farColorBuffer",new u(null)],["nearCoCBuffer",new u(null)],["farCoCBuffer",new u(null)],["scale",new u(1)]])}),this.camera=e,this.renderTarget=new U(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.name="DoF.CoC",this.uniforms.get("farCoCBuffer").value=this.renderTargetCoC.texture,this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new L(new rs(e));const v=this.cocMaterial;v.focusDistance=r,v.focusRange=a,s!==void 0&&(v.worldFocusDistance=s),i!==void 0&&(v.worldFocusRange=i),this.blurPass=new _e({resolutionScale:o,resolutionX:d,resolutionY:g,kernelSize:$.MEDIUM}),this.maskPass=new L(new as(this.renderTargetCoC.texture));const R=this.maskPass.fullscreenMaterial;R.colorChannel=Ue.GREEN,this.maskFunction=we.MULTIPLY_RGB,this.bokehNearBasePass=new L(new X(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new L(new X(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new L(new X(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new L(new X(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null;const E=this.resolution=new T(this,d,g,o);E.addEventListener("change",z=>this.setSize(E.baseWidth,E.baseHeight)),this.bokehScale=l}set mainCamera(e){this.camera=e,this.cocMaterial.copyCameraSettings(e)}get cocTexture(){return this.renderTargetCoC.texture}get maskFunction(){return this.maskPass.fullscreenMaterial.maskFunction}set maskFunction(e){this.maskFunction!==e&&(this.defines.set("MASK_FUNCTION",e.toFixed(0)),this.maskPass.fullscreenMaterial.maskFunction=e,this.setChanged())}get cocMaterial(){return this.cocPass.fullscreenMaterial}get circleOfConfusionMaterial(){return this.cocMaterial}getCircleOfConfusionMaterial(){return this.cocMaterial}getBlurPass(){return this.blurPass}getResolution(){return this.resolution}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(e){this.bokehNearBasePass.fullscreenMaterial.scale=e,this.bokehNearFillPass.fullscreenMaterial.scale=e,this.bokehFarBasePass.fullscreenMaterial.scale=e,this.bokehFarFillPass.fullscreenMaterial.scale=e,this.maskPass.fullscreenMaterial.strength=e,this.uniforms.get("scale").value=e}getBokehScale(){return this.bokehScale}setBokehScale(e){this.bokehScale=e}getTarget(){return this.target}setTarget(e){this.target=e}calculateFocusDistance(e){const t=this.camera,s=t.position.distanceTo(e);return ae(-s,t.near,t.far)}setDepthTexture(e,t=O){this.cocMaterial.depthBuffer=e,this.cocMaterial.depthPacking=t}update(e,t,s){const i=this.renderTarget,r=this.renderTargetCoC,n=this.renderTargetCoCBlurred,a=this.renderTargetMasked;if(this.target!==null){const l=this.calculateFocusDistance(this.target);this.cocMaterial.focusDistance=l}this.cocPass.render(e,null,r),this.blurPass.render(e,r,n),this.maskPass.render(e,t,a),this.bokehFarBasePass.render(e,a,i),this.bokehFarFillPass.render(e,i,this.renderTargetFar),this.bokehNearBasePass.render(e,t,i),this.bokehNearFillPass.render(e,i,this.renderTargetNear)}setSize(e,t){const s=this.resolution;s.setBaseSize(e,t);const i=s.width,r=s.height;this.cocPass.setSize(e,t),this.blurPass.setSize(e,t),this.maskPass.setSize(e,t),this.renderTargetFar.setSize(e,t),this.renderTargetCoC.setSize(e,t),this.renderTargetMasked.setSize(e,t),this.renderTarget.setSize(i,r),this.renderTargetNear.setSize(i,r),this.renderTargetCoCBlurred.setSize(i,r),this.bokehNearBasePass.fullscreenMaterial.setSize(e,t),this.bokehNearFillPass.fullscreenMaterial.setSize(e,t),this.bokehFarBasePass.fullscreenMaterial.setSize(e,t),this.bokehFarFillPass.fullscreenMaterial.setSize(e,t)}initialize(e,t,s){this.cocPass.initialize(e,t,s),this.maskPass.initialize(e,t,s),this.bokehNearBasePass.initialize(e,t,s),this.bokehNearFillPass.initialize(e,t,s),this.bokehFarBasePass.initialize(e,t,s),this.bokehFarFillPass.initialize(e,t,s),this.blurPass.initialize(e,t,A),e.capabilities.logarithmicDepthBuffer&&(this.cocPass.fullscreenMaterial.defines.LOG_DEPTH="1"),s!==void 0&&(this.renderTarget.texture.type=s,this.renderTargetNear.texture.type=s,this.renderTargetFar.texture.type=s,this.renderTargetMasked.texture.type=s,e!==null&&e.outputColorSpace===S&&(this.renderTarget.texture.colorSpace=S,this.renderTargetNear.texture.colorSpace=S,this.renderTargetFar.texture.colorSpace=S,this.renderTargetMasked.texture.colorSpace=S))}},De=class extends B{constructor(e,t,s=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new be,this.overrideMaterialManager=s===null?null:new de(s),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){const e=this.overrideMaterialManager;return e!==null?e.material:null}set overrideMaterial(e){const t=this.overrideMaterialManager;e!==null?t!==null?t.setMaterial(e):this.overrideMaterialManager=new de(e):t!==null&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,s,i,r){const n=this.scene,a=this.camera,l=this.selection,o=a.layers.mask,c=n.background,h=e.shadowMap.autoUpdate,d=this.renderToScreen?null:t;l!==null&&a.layers.set(l.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(n.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(d),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(e,n,a):e.render(n,a),a.layers.mask=o,n.background=c,e.shadowMap.autoUpdate=h}},W={DEFAULT:0,ESKIL:1},ls=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*(1.0+time))); +vec4 result=inputColor*(1.0-cocNearFar.y)+colorFar;result=mix(result,colorNear,cocNearFar.x);outputColor=result;}`,Rs=class extends G{constructor(e,{blendFunction:t,worldFocusDistance:s,worldFocusRange:i,focusDistance:r=0,focalLength:n=.1,focusRange:a=n,bokehScale:l=1,resolutionScale:o=1,width:c=T.AUTO_SIZE,height:h=T.AUTO_SIZE,resolutionX:d=c,resolutionY:g=h}={}){super("DepthOfFieldEffect",os,{blendFunction:t,attributes:F.DEPTH,uniforms:new Map([["nearColorBuffer",new u(null)],["farColorBuffer",new u(null)],["nearCoCBuffer",new u(null)],["farCoCBuffer",new u(null)],["scale",new u(1)]])}),this.camera=e,this.renderTarget=new U(1,1,{depthBuffer:!1}),this.renderTarget.texture.name="DoF.Intermediate",this.renderTargetMasked=this.renderTarget.clone(),this.renderTargetMasked.texture.name="DoF.Masked.Far",this.renderTargetNear=this.renderTarget.clone(),this.renderTargetNear.texture.name="DoF.Bokeh.Near",this.uniforms.get("nearColorBuffer").value=this.renderTargetNear.texture,this.renderTargetFar=this.renderTarget.clone(),this.renderTargetFar.texture.name="DoF.Bokeh.Far",this.uniforms.get("farColorBuffer").value=this.renderTargetFar.texture,this.renderTargetCoC=this.renderTarget.clone(),this.renderTargetCoC.texture.name="DoF.CoC",this.uniforms.get("farCoCBuffer").value=this.renderTargetCoC.texture,this.renderTargetCoCBlurred=this.renderTargetCoC.clone(),this.renderTargetCoCBlurred.texture.name="DoF.CoC.Blurred",this.uniforms.get("nearCoCBuffer").value=this.renderTargetCoCBlurred.texture,this.cocPass=new L(new rs(e));const v=this.cocMaterial;v.focusDistance=r,v.focusRange=a,s!==void 0&&(v.worldFocusDistance=s),i!==void 0&&(v.worldFocusRange=i),this.blurPass=new _e({resolutionScale:o,resolutionX:d,resolutionY:g,kernelSize:$.MEDIUM}),this.maskPass=new L(new as(this.renderTargetCoC.texture));const R=this.maskPass.fullscreenMaterial;R.colorChannel=Ue.GREEN,this.maskFunction=we.MULTIPLY_RGB,this.bokehNearBasePass=new L(new X(!1,!0)),this.bokehNearBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehNearFillPass=new L(new X(!0,!0)),this.bokehNearFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoCBlurred.texture,this.bokehFarBasePass=new L(new X(!1,!1)),this.bokehFarBasePass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.bokehFarFillPass=new L(new X(!0,!1)),this.bokehFarFillPass.fullscreenMaterial.cocBuffer=this.renderTargetCoC.texture,this.target=null;const E=this.resolution=new T(this,d,g,o);E.addEventListener("change",z=>this.setSize(E.baseWidth,E.baseHeight)),this.bokehScale=l}set mainCamera(e){this.camera=e,this.cocMaterial.copyCameraSettings(e)}get cocTexture(){return this.renderTargetCoC.texture}get maskFunction(){return this.maskPass.fullscreenMaterial.maskFunction}set maskFunction(e){this.maskFunction!==e&&(this.defines.set("MASK_FUNCTION",e.toFixed(0)),this.maskPass.fullscreenMaterial.maskFunction=e,this.setChanged())}get cocMaterial(){return this.cocPass.fullscreenMaterial}get circleOfConfusionMaterial(){return this.cocMaterial}getCircleOfConfusionMaterial(){return this.cocMaterial}getBlurPass(){return this.blurPass}getResolution(){return this.resolution}get bokehScale(){return this.uniforms.get("scale").value}set bokehScale(e){this.bokehNearBasePass.fullscreenMaterial.scale=e,this.bokehNearFillPass.fullscreenMaterial.scale=e,this.bokehFarBasePass.fullscreenMaterial.scale=e,this.bokehFarFillPass.fullscreenMaterial.scale=e,this.maskPass.fullscreenMaterial.strength=e,this.uniforms.get("scale").value=e}getBokehScale(){return this.bokehScale}setBokehScale(e){this.bokehScale=e}getTarget(){return this.target}setTarget(e){this.target=e}calculateFocusDistance(e){const t=this.camera,s=t.position.distanceTo(e);return ae(-s,t.near,t.far)}setDepthTexture(e,t=O){this.cocMaterial.depthBuffer=e,this.cocMaterial.depthPacking=t}update(e,t,s){const i=this.renderTarget,r=this.renderTargetCoC,n=this.renderTargetCoCBlurred,a=this.renderTargetMasked;if(this.target!==null){const l=this.calculateFocusDistance(this.target);this.cocMaterial.focusDistance=l}this.cocPass.render(e,null,r),this.blurPass.render(e,r,n),this.maskPass.render(e,t,a),this.bokehFarBasePass.render(e,a,i),this.bokehFarFillPass.render(e,i,this.renderTargetFar),this.bokehNearBasePass.render(e,t,i),this.bokehNearFillPass.render(e,i,this.renderTargetNear)}setSize(e,t){const s=this.resolution;s.setBaseSize(e,t);const i=s.width,r=s.height;this.cocPass.setSize(e,t),this.blurPass.setSize(e,t),this.maskPass.setSize(e,t),this.renderTargetFar.setSize(e,t),this.renderTargetCoC.setSize(e,t),this.renderTargetMasked.setSize(e,t),this.renderTarget.setSize(i,r),this.renderTargetNear.setSize(i,r),this.renderTargetCoCBlurred.setSize(i,r),this.bokehNearBasePass.fullscreenMaterial.setSize(e,t),this.bokehNearFillPass.fullscreenMaterial.setSize(e,t),this.bokehFarBasePass.fullscreenMaterial.setSize(e,t),this.bokehFarFillPass.fullscreenMaterial.setSize(e,t)}initialize(e,t,s){this.cocPass.initialize(e,t,s),this.maskPass.initialize(e,t,s),this.bokehNearBasePass.initialize(e,t,s),this.bokehNearFillPass.initialize(e,t,s),this.bokehFarBasePass.initialize(e,t,s),this.bokehFarFillPass.initialize(e,t,s),this.blurPass.initialize(e,t,A),e.capabilities.logarithmicDepthBuffer&&(this.cocPass.fullscreenMaterial.defines.LOG_DEPTH="1"),s!==void 0&&(this.renderTarget.texture.type=s,this.renderTargetNear.texture.type=s,this.renderTargetFar.texture.type=s,this.renderTargetMasked.texture.type=s,e!==null&&e.outputColorSpace===S&&(this.renderTarget.texture.colorSpace=S,this.renderTargetNear.texture.colorSpace=S,this.renderTargetFar.texture.colorSpace=S,this.renderTargetMasked.texture.colorSpace=S))}},De=class extends B{constructor(e,t,s=null){super("RenderPass",e,t),this.needsSwap=!1,this.clearPass=new ye,this.overrideMaterialManager=s===null?null:new de(s),this.ignoreBackground=!1,this.skipShadowMapUpdate=!1,this.selection=null}set mainScene(e){this.scene=e}set mainCamera(e){this.camera=e}get renderToScreen(){return super.renderToScreen}set renderToScreen(e){super.renderToScreen=e,this.clearPass.renderToScreen=e}get overrideMaterial(){const e=this.overrideMaterialManager;return e!==null?e.material:null}set overrideMaterial(e){const t=this.overrideMaterialManager;e!==null?t!==null?t.setMaterial(e):this.overrideMaterialManager=new de(e):t!==null&&(t.dispose(),this.overrideMaterialManager=null)}getOverrideMaterial(){return this.overrideMaterial}setOverrideMaterial(e){this.overrideMaterial=e}get clear(){return this.clearPass.enabled}set clear(e){this.clearPass.enabled=e}getSelection(){return this.selection}setSelection(e){this.selection=e}isBackgroundDisabled(){return this.ignoreBackground}setBackgroundDisabled(e){this.ignoreBackground=e}isShadowMapDisabled(){return this.skipShadowMapUpdate}setShadowMapDisabled(e){this.skipShadowMapUpdate=e}getClearPass(){return this.clearPass}render(e,t,s,i,r){const n=this.scene,a=this.camera,l=this.selection,o=a.layers.mask,c=n.background,h=e.shadowMap.autoUpdate,d=this.renderToScreen?null:t;l!==null&&a.layers.set(l.getLayer()),this.skipShadowMapUpdate&&(e.shadowMap.autoUpdate=!1),(this.ignoreBackground||this.clearPass.overrideClearColor!==null)&&(n.background=null),this.clearPass.enabled&&this.clearPass.render(e,t),e.setRenderTarget(d),this.overrideMaterialManager!==null?this.overrideMaterialManager.render(e,n,a):e.render(n,a),a.layers.mask=o,n.background=c,e.shadowMap.autoUpdate=h}},W={DEFAULT:0,ESKIL:1},ls=`void mainImage(const in vec4 inputColor,const in vec2 uv,out vec4 outputColor){vec3 noise=vec3(rand(uv*(1.0+time))); #ifdef PREMULTIPLY outputColor=vec4(min(inputColor.rgb*noise,vec3(1.0)),inputColor.a); #else @@ -198,7 +198,7 @@ float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offse #else vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord)); #endif -outputColor=vec4(color,inputColor.a);}`,ys=class extends G{constructor({blendFunction:e,eskil:t=!1,technique:s=t?W.ESKIL:W.DEFAULT,offset:i=.5,darkness:r=.5}={}){super("VignetteEffect",ps,{blendFunction:e,defines:new Map([["VIGNETTE_TECHNIQUE",s.toFixed(0)]]),uniforms:new Map([["offset",new u(i)],["darkness",new u(r)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(e){this.technique!==e&&(this.defines.set("VIGNETTE_TECHNIQUE",e.toFixed(0)),this.setChanged())}get eskil(){return this.technique===W.ESKIL}set eskil(e){this.technique=e?W.ESKIL:W.DEFAULT}getTechnique(){return this.technique}setTechnique(e){this.technique=e}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}get darkness(){return this.uniforms.get("darkness").value}set darkness(e){this.uniforms.get("darkness").value=e}getDarkness(){return this.darkness}setDarkness(e){this.darkness=e}},vs=`#include +outputColor=vec4(color,inputColor.a);}`,bs=class extends G{constructor({blendFunction:e,eskil:t=!1,technique:s=t?W.ESKIL:W.DEFAULT,offset:i=.5,darkness:r=.5}={}){super("VignetteEffect",ps,{blendFunction:e,defines:new Map([["VIGNETTE_TECHNIQUE",s.toFixed(0)]]),uniforms:new Map([["offset",new u(i)],["darkness",new u(r)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(e){this.technique!==e&&(this.defines.set("VIGNETTE_TECHNIQUE",e.toFixed(0)),this.setChanged())}get eskil(){return this.technique===W.ESKIL}set eskil(e){this.technique=e?W.ESKIL:W.DEFAULT}getTechnique(){return this.technique}setTechnique(e){this.technique=e}get offset(){return this.uniforms.get("offset").value}set offset(e){this.uniforms.get("offset").value=e}getOffset(){return this.offset}setOffset(e){this.offset=e}get darkness(){return this.uniforms.get("darkness").value}set darkness(e){this.uniforms.get("darkness").value=e}getDarkness(){return this.darkness}setDarkness(e){this.darkness=e}},vs=`#include #include #include #define packFloatToRGBA(v) packDepthToRGBA(v) @@ -235,7 +235,7 @@ return orthographicDepthToViewZ(depth,cameraNear,cameraFar); }`,ms="uniform vec2 resolution;uniform vec2 texelSize;uniform float cameraNear;uniform float cameraFar;uniform float aspect;uniform float time;varying vec2 vUv;VERTEX_HEAD void main(){vUv=position.xy*0.5+0.5;VERTEX_MAIN_SUPPORT gl_Position=vec4(position.xy,1.0,1.0);}",gs=class extends w{constructor(e,t,s,i,r=!1){super({name:"EffectMaterial",defines:{THREE_REVISION:Ce.replace(/\D+/g,""),DEPTH_PACKING:"0",ENCODE_OUTPUT:"1"},uniforms:{inputBuffer:new u(null),depthBuffer:new u(null),resolution:new u(new M),texelSize:new u(new M),cameraNear:new u(.3),cameraFar:new u(1e3),aspect:new u(1),time:new u(0)},blending:N,toneMapped:!1,depthWrite:!1,depthTest:!1,dithering:r}),e&&this.setShaderParts(e),t&&this.setDefines(t),s&&this.setUniforms(s),this.copyCameraSettings(i)}set inputBuffer(e){this.uniforms.inputBuffer.value=e}setInputBuffer(e){this.uniforms.inputBuffer.value=e}get depthBuffer(){return this.uniforms.depthBuffer.value}set depthBuffer(e){this.uniforms.depthBuffer.value=e}get depthPacking(){return Number(this.defines.DEPTH_PACKING)}set depthPacking(e){this.defines.DEPTH_PACKING=e.toFixed(0),this.needsUpdate=!0}setDepthBuffer(e,t=O){this.depthBuffer=e,this.depthPacking=t}setShaderData(e){this.setShaderParts(e.shaderParts),this.setDefines(e.defines),this.setUniforms(e.uniforms),this.setExtensions(e.extensions)}setShaderParts(e){return this.fragmentShader=vs.replace(p.FRAGMENT_HEAD,e.get(p.FRAGMENT_HEAD)||"").replace(p.FRAGMENT_MAIN_UV,e.get(p.FRAGMENT_MAIN_UV)||"").replace(p.FRAGMENT_MAIN_IMAGE,e.get(p.FRAGMENT_MAIN_IMAGE)||""),this.vertexShader=ms.replace(p.VERTEX_HEAD,e.get(p.VERTEX_HEAD)||"").replace(p.VERTEX_MAIN_SUPPORT,e.get(p.VERTEX_MAIN_SUPPORT)||""),this.needsUpdate=!0,this}setDefines(e){for(const t of e.entries())this.defines[t[0]]=t[1];return this.needsUpdate=!0,this}setUniforms(e){for(const t of e.entries())this.uniforms[t[0]]=t[1];return this}setExtensions(e){this.extensions={};for(const t of e)this.extensions[t]=!0;return this}get encodeOutput(){return this.defines.ENCODE_OUTPUT!==void 0}set encodeOutput(e){this.encodeOutput!==e&&(e?this.defines.ENCODE_OUTPUT="1":delete this.defines.ENCODE_OUTPUT,this.needsUpdate=!0)}isOutputEncodingEnabled(e){return this.encodeOutput}setOutputEncodingEnabled(e){this.encodeOutput=e}get time(){return this.uniforms.time.value}set time(e){this.uniforms.time.value=e}setDeltaTime(e){this.uniforms.time.value+=e}adoptCameraSettings(e){this.copyCameraSettings(e)}copyCameraSettings(e){e&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far,e instanceof Be?this.defines.PERSPECTIVE_CAMERA="1":delete this.defines.PERSPECTIVE_CAMERA,this.needsUpdate=!0)}setSize(e,t){const s=this.uniforms;s.resolution.value.set(e,t),s.texelSize.value.set(1/e,1/t),s.aspect.value=e/t}static get Section(){return p}};function ve(e,t,s){for(const i of t){const r="$1"+e+i.charAt(0).toUpperCase()+i.slice(1),n=new RegExp("([^\\.])(\\b"+i+"\\b)","g");for(const a of s.entries())a[1]!==null&&s.set(a[0],a[1].replace(n,r))}}function xs(e,t,s){let i=t.getFragmentShader(),r=t.getVertexShader();const n=i!==void 0&&/mainImage/.test(i),a=i!==void 0&&/mainUv/.test(i);if(s.attributes|=t.getAttributes(),i===void 0)throw new Error(`Missing fragment shader (${t.name})`);if(a&&s.attributes&F.CONVOLUTION)throw new Error(`Effects that transform UVs are incompatible with convolution effects (${t.name})`);if(!n&&!a)throw new Error(`Could not find mainImage or mainUv function (${t.name})`);{const l=/\w+\s+(\w+)\([\w\s,]*\)\s*{/g,o=s.shaderParts;let c=o.get(p.FRAGMENT_HEAD)||"",h=o.get(p.FRAGMENT_MAIN_UV)||"",d=o.get(p.FRAGMENT_MAIN_IMAGE)||"",g=o.get(p.VERTEX_HEAD)||"",v=o.get(p.VERTEX_MAIN_SUPPORT)||"";const R=new Set,E=new Set;if(a&&(h+=` ${e}MainUv(UV); `,s.uvTransformation=!0),r!==null&&/mainSupport/.test(r)){const x=/mainSupport *\([\w\s]*?uv\s*?\)/.test(r);v+=` ${e}MainSupport(`,v+=x?`vUv); `:`); -`;for(const m of r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const b of m[1].split(/\s*,\s*/))s.varyings.add(b),R.add(b),E.add(b);for(const m of r.matchAll(l))E.add(m[1])}for(const x of i.matchAll(l))E.add(x[1]);for(const x of t.defines.keys())E.add(x.replace(/\([\w\s,]*\)/g,""));for(const x of t.uniforms.keys())E.add(x);E.delete("while"),E.delete("for"),E.delete("if"),t.uniforms.forEach((x,m)=>s.uniforms.set(e+m.charAt(0).toUpperCase()+m.slice(1),x)),t.defines.forEach((x,m)=>s.defines.set(e+m.charAt(0).toUpperCase()+m.slice(1),x));const z=new Map([["fragment",i],["vertex",r]]);ve(e,E,s.defines),ve(e,E,z),i=z.get("fragment"),r=z.get("vertex");const D=t.blendMode;if(s.blendModes.set(D.blendFunction,D),n){t.inputColorSpace!==null&&t.inputColorSpace!==s.colorSpace&&(d+=t.inputColorSpace===S?`color0 = sRGBTransferOETF(color0); +`;for(const m of r.matchAll(/(?:varying\s+\w+\s+([\S\s]*?);)/g))for(const y of m[1].split(/\s*,\s*/))s.varyings.add(y),R.add(y),E.add(y);for(const m of r.matchAll(l))E.add(m[1])}for(const x of i.matchAll(l))E.add(x[1]);for(const x of t.defines.keys())E.add(x.replace(/\([\w\s,]*\)/g,""));for(const x of t.uniforms.keys())E.add(x);E.delete("while"),E.delete("for"),E.delete("if"),t.uniforms.forEach((x,m)=>s.uniforms.set(e+m.charAt(0).toUpperCase()+m.slice(1),x)),t.defines.forEach((x,m)=>s.defines.set(e+m.charAt(0).toUpperCase()+m.slice(1),x));const z=new Map([["fragment",i],["vertex",r]]);ve(e,E,s.defines),ve(e,E,z),i=z.get("fragment"),r=z.get("vertex");const D=t.blendMode;if(s.blendModes.set(D.blendFunction,D),n){t.inputColorSpace!==null&&t.inputColorSpace!==s.colorSpace&&(d+=t.inputColorSpace===S?`color0 = sRGBTransferOETF(color0); `:`color0 = sRGBToLinear(color0); `),t.outputColorSpace!==Se?s.colorSpace=t.outputColorSpace:t.inputColorSpace!==null&&(s.colorSpace=t.inputColorSpace);const x=/MainImage *\([\w\s,]*?depth[\w\s,]*?\)/;d+=`${e}MainImage(color0, UV, `,s.attributes&F.DEPTH&&x.test(i)&&(d+="depth, ",s.readDepth=!0),d+=`color1); `;const m=e+"BlendOpacity";s.uniforms.set(m,D.opacity),d+=`color0 = blend${D.blendFunction}(color0, color1, ${m}); @@ -250,4 +250,4 @@ return orthographicDepthToViewZ(depth,cameraNear,cameraFar); `+i),this.needsDepthTexture=this.getDepthTexture()===null):this.needsDepthTexture=!1,e.colorSpace===S&&(i+=`color0 = sRGBToLinear(color0); `),e.uvTransformation?(r=`vec2 transformedUv = vUv; `+r,e.defines.set("UV","transformedUv")):e.defines.set("UV","vUv"),e.shaderParts.set(p.FRAGMENT_HEAD,s),e.shaderParts.set(p.FRAGMENT_MAIN_IMAGE,i),e.shaderParts.set(p.FRAGMENT_MAIN_UV,r);for(const[a,l]of e.shaderParts)l!==null&&e.shaderParts.set(a,l.trim().replace(/^#/,` -#`));this.skipRendering=t===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=O){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;for(const s of this.effects)s.setDepthTexture(e,t)}render(e,t,s,i,r){for(const n of this.effects)n.update(e,t,i);if(!this.skipRendering||this.renderToScreen){const n=this.fullscreenMaterial;n.inputBuffer=t.texture,n.time+=i*this.timeScale,e.setRenderTarget(this.renderToScreen?null:s),e.render(this.scene,this.camera)}}setSize(e,t){this.fullscreenMaterial.setSize(e,t);for(const s of this.effects)s.setSize(e,t)}initialize(e,t,s){this.renderer=e;for(const i of this.effects)i.initialize(e,t,s);this.updateMaterial(),s!==void 0&&s!==A&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const e of this.effects)e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){switch(e.type){case"change":this.recompile();break}}},Ts=class extends B{constructor(e,t,{renderTarget:s,resolutionScale:i=1,width:r=T.AUTO_SIZE,height:n=T.AUTO_SIZE,resolutionX:a=r,resolutionY:l=n}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new De(e,t,new He);const o=this.renderPass;o.ignoreBackground=!0,o.skipShadowMapUpdate=!0;const c=o.getClearPass();c.overrideClearColor=new Te(7829503),c.overrideClearAlpha=1,this.renderTarget=s,this.renderTarget===void 0&&(this.renderTarget=new U(1,1,{minFilter:q,magFilter:q}),this.renderTarget.texture.name="NormalPass.Target");const h=this.resolution=new T(this,a,l,i);h.addEventListener("change",d=>this.setSize(h.baseWidth,h.baseHeight))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,s,i,r){const n=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,n,n)}setSize(e,t){const s=this.resolution;s.setBaseSize(e,t),this.renderTarget.setSize(s.width,s.height)}};const Es=I.createContext(null),me=e=>(e.getAttributes()&F.CONVOLUTION)===F.CONVOLUTION,bs=ie.memo(I.forwardRef(({children:e,camera:t,scene:s,resolutionScale:i,enabled:r=!0,renderPriority:n=1,autoClear:a=!0,depthBuffer:l,enableNormalPass:o,stencilBuffer:c,multisampling:h=8,frameBufferType:d=Xe},g)=>{const{gl:v,scene:R,camera:E,size:z}=Re(),D=s||R,x=t||E,[m,b,H]=I.useMemo(()=>{const P=Ye(),y=new rt(v,{depthBuffer:l,stencilBuffer:c,multisampling:h>0&&P?h:0,frameBufferType:d});y.addPass(new De(D,x));let C=null,_=null;return o&&(_=new Ts(D,x),_.enabled=!1,y.addPass(_),i!==void 0&&P&&(C=new ds({normalBuffer:_.texture,resolutionScale:i}),C.enabled=!1,y.addPass(C))),[y,_,C]},[x,v,l,c,h,d,D,o,i]);I.useEffect(()=>m==null?void 0:m.setSize(z.width,z.height),[m,z]),Ke((P,y)=>{if(r){const C=v.autoClear;v.autoClear=a,c&&!a&&v.clearStencil(),m.render(y),v.autoClear=C}},r?n:0);const Q=I.useRef(null),J=Ze(Q);I.useLayoutEffect(()=>{const P=[];if(Q.current&&J.current&&m){const y=J.current.objects;for(let C=0;C{for(const y of P)m==null||m.removePass(y);b&&(b.enabled=!1),H&&(H.enabled=!1)}},[m,e,x,b,H,J]),I.useEffect(()=>{const P=v.toneMapping;return v.toneMapping=je,()=>{v.toneMapping=P}},[]);const Fe=I.useMemo(()=>({composer:m,normalPass:b,downSamplingPass:H,resolutionScale:i,camera:x,scene:D}),[m,b,H,i,x,D]);return I.useImperativeHandle(g,()=>m,[m]),re.jsx(Es.Provider,{value:Fe,children:re.jsx("group",{ref:Q,children:e})})}));let Ms=0;const ge=new WeakMap,Pe=(e,t)=>ie.forwardRef(function({blendFunction:i=t==null?void 0:t.blendFunction,opacity:r=t==null?void 0:t.opacity,...n},a){let l=ge.get(e);if(!l){const h=`@react-three/postprocessing/${e.name}-${Ms++}`;qe({[h]:e}),ge.set(e,l=h)}const o=Re(h=>h.camera),c=ie.useMemo(()=>{var h,d;return[...(h=t==null?void 0:t.args)!=null?h:[],...(d=n.args)!=null?d:[{...t,...n}]]},[JSON.stringify(n)]);return re.jsx(l,{camera:o,"blendMode-blendFunction":i,"blendMode-opacity-value":r,...n,ref:a,args:c})}),_s=Pe(ts,{blendFunction:f.ADD}),Us=Pe(us,{blendFunction:f.COLOR_DODGE});export{_s as B,Rs as D,bs as E,we as M,Us as N,ys as V,Es as a,Pe as w}; +#`));this.skipRendering=t===0,this.needsSwap=!this.skipRendering,this.fullscreenMaterial.setShaderData(e)}recompile(){this.updateMaterial()}getDepthTexture(){return this.fullscreenMaterial.depthBuffer}setDepthTexture(e,t=O){this.fullscreenMaterial.depthBuffer=e,this.fullscreenMaterial.depthPacking=t;for(const s of this.effects)s.setDepthTexture(e,t)}render(e,t,s,i,r){for(const n of this.effects)n.update(e,t,i);if(!this.skipRendering||this.renderToScreen){const n=this.fullscreenMaterial;n.inputBuffer=t.texture,n.time+=i*this.timeScale,e.setRenderTarget(this.renderToScreen?null:s),e.render(this.scene,this.camera)}}setSize(e,t){this.fullscreenMaterial.setSize(e,t);for(const s of this.effects)s.setSize(e,t)}initialize(e,t,s){this.renderer=e;for(const i of this.effects)i.initialize(e,t,s);this.updateMaterial(),s!==void 0&&s!==A&&(this.fullscreenMaterial.defines.FRAMEBUFFER_PRECISION_HIGH="1")}dispose(){super.dispose();for(const e of this.effects)e.removeEventListener("change",this.listener),e.dispose()}handleEvent(e){switch(e.type){case"change":this.recompile();break}}},Ts=class extends B{constructor(e,t,{renderTarget:s,resolutionScale:i=1,width:r=T.AUTO_SIZE,height:n=T.AUTO_SIZE,resolutionX:a=r,resolutionY:l=n}={}){super("NormalPass"),this.needsSwap=!1,this.renderPass=new De(e,t,new He);const o=this.renderPass;o.ignoreBackground=!0,o.skipShadowMapUpdate=!0;const c=o.getClearPass();c.overrideClearColor=new Te(7829503),c.overrideClearAlpha=1,this.renderTarget=s,this.renderTarget===void 0&&(this.renderTarget=new U(1,1,{minFilter:q,magFilter:q}),this.renderTarget.texture.name="NormalPass.Target");const h=this.resolution=new T(this,a,l,i);h.addEventListener("change",d=>this.setSize(h.baseWidth,h.baseHeight))}set mainScene(e){this.renderPass.mainScene=e}set mainCamera(e){this.renderPass.mainCamera=e}get texture(){return this.renderTarget.texture}getTexture(){return this.renderTarget.texture}getResolution(){return this.resolution}getResolutionScale(){return this.resolution.scale}setResolutionScale(e){this.resolution.scale=e}render(e,t,s,i,r){const n=this.renderToScreen?null:this.renderTarget;this.renderPass.render(e,n,n)}setSize(e,t){const s=this.resolution;s.setBaseSize(e,t),this.renderTarget.setSize(s.width,s.height)}};const Es=I.createContext(null),me=e=>(e.getAttributes()&F.CONVOLUTION)===F.CONVOLUTION,ys=ie.memo(I.forwardRef(({children:e,camera:t,scene:s,resolutionScale:i,enabled:r=!0,renderPriority:n=1,autoClear:a=!0,depthBuffer:l,enableNormalPass:o,stencilBuffer:c,multisampling:h=8,frameBufferType:d=Xe},g)=>{const{gl:v,scene:R,camera:E,size:z}=Re(),D=s||R,x=t||E,[m,y,H]=I.useMemo(()=>{const P=Ye(),b=new rt(v,{depthBuffer:l,stencilBuffer:c,multisampling:h>0&&P?h:0,frameBufferType:d});b.addPass(new De(D,x));let C=null,_=null;return o&&(_=new Ts(D,x),_.enabled=!1,b.addPass(_),i!==void 0&&P&&(C=new ds({normalBuffer:_.texture,resolutionScale:i}),C.enabled=!1,b.addPass(C))),[b,_,C]},[x,v,l,c,h,d,D,o,i]);I.useEffect(()=>m==null?void 0:m.setSize(z.width,z.height),[m,z]),Ke((P,b)=>{if(r){const C=v.autoClear;v.autoClear=a,c&&!a&&v.clearStencil(),m.render(b),v.autoClear=C}},r?n:0);const Q=I.useRef(null),J=Ze(Q);I.useLayoutEffect(()=>{const P=[];if(Q.current&&J.current&&m){const b=J.current.objects;for(let C=0;C{for(const b of P)m==null||m.removePass(b);y&&(y.enabled=!1),H&&(H.enabled=!1)}},[m,e,x,y,H,J]),I.useEffect(()=>{const P=v.toneMapping;return v.toneMapping=je,()=>{v.toneMapping=P}},[]);const Fe=I.useMemo(()=>({composer:m,normalPass:y,downSamplingPass:H,resolutionScale:i,camera:x,scene:D}),[m,y,H,i,x,D]);return I.useImperativeHandle(g,()=>m,[m]),re.jsx(Es.Provider,{value:Fe,children:re.jsx("group",{ref:Q,children:e})})}));let Ms=0;const ge=new WeakMap,Pe=(e,t)=>ie.forwardRef(function({blendFunction:i=t==null?void 0:t.blendFunction,opacity:r=t==null?void 0:t.opacity,...n},a){let l=ge.get(e);if(!l){const h=`@react-three/postprocessing/${e.name}-${Ms++}`;qe({[h]:e}),ge.set(e,l=h)}const o=Re(h=>h.camera),c=ie.useMemo(()=>{var h,d;return[...(h=t==null?void 0:t.args)!=null?h:[],...(d=n.args)!=null?d:[{...t,...n}]]},[JSON.stringify(n)]);return re.jsx(l,{camera:o,"blendMode-blendFunction":i,"blendMode-opacity-value":r,...n,ref:a,args:c})}),_s=Pe(ts,{blendFunction:f.ADD}),Us=Pe(us,{blendFunction:f.COLOR_DODGE});export{_s as B,Rs as D,ys as E,we as M,Us as N,bs as V,Es as a,Pe as w}; diff --git a/assets/controls-ByeBQODT.js b/assets/controls-ByeBQODT.js new file mode 100644 index 00000000..df3d88c7 --- /dev/null +++ b/assets/controls-ByeBQODT.js @@ -0,0 +1 @@ +import{j as e,L as l,B as d,e as o,S as n,f}from"./index-DwhXMaNP.js";import{useParams as x,useActions as j,usePresets as p}from"./reactive-SpGdnhOu.js";import"./ground-DJZ6lP2l.js";import"./Noise-D5uvWl4i.js";const P=()=>{const{radius:t,pointSize:a,mirrorEffects:c}=x(),{setParams:i,setPreset:u}=j(),{active:r,options:m}=p();return e.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[e.jsx(l,{children:"Diffused Ring Presets"}),e.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:[...Object.keys(m),"custom"].map(s=>e.jsx(d,{variant:"ghost","aria-selected":r===s,className:"p-2 aria-selected:bg-primary/20",onClick:()=>u(s==="custom"?void 0:s),children:s},`po_${s}`))}),!r&&e.jsxs(e.Fragment,{children:[e.jsx(o,{label:"Radius",value:t.toFixed(2)}),e.jsx(n,{defaultValue:[t],value:[t],min:.25,max:3,step:.25,onValueChange:s=>i({radius:s[0]})}),e.jsx(o,{label:"Point Size",value:a.toFixed(2)}),e.jsx(n,{defaultValue:[a],value:[a],min:.01,max:.25,step:.01,onValueChange:s=>i({pointSize:s[0]})}),e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx(l,{children:"Mirror Effects"}),e.jsx(f,{defaultChecked:c,onCheckedChange:s=>{i({mirrorEffects:s})}})]})]})]})};export{P as default}; diff --git a/assets/controls-CwyAXsj5.js b/assets/controls-CwyAXsj5.js new file mode 100644 index 00000000..9fdb435f --- /dev/null +++ b/assets/controls-CwyAXsj5.js @@ -0,0 +1 @@ +import{j as e,L as c,B as m,e as r,S as n}from"./index-DwhXMaNP.js";import{useParams as d,useActions as x,usePresets as j}from"./reactive-BdX5JLG8.js";import"./ground-DJZ6lP2l.js";const h=()=>{const{radius:a,nPoints:t}=d(),{setParams:l,setPreset:o}=x(),{active:i,options:u}=j();return e.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[e.jsx(c,{children:"Sphere Presets"}),e.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:[...Object.keys(u),"custom"].map(s=>e.jsx(m,{variant:"ghost","aria-selected":i===s,className:"p-2 aria-selected:bg-primary/20",onClick:()=>o(s==="custom"?void 0:s),children:s},`po_${s}`))}),!i&&e.jsxs(e.Fragment,{children:[e.jsx(r,{label:"Point Count",value:t}),e.jsx(n,{defaultValue:[t],value:[t],min:100,max:2e3,step:25,onValueChange:s=>l({nPoints:s[0]})}),e.jsx(r,{label:"Radius",value:a.toFixed(2)}),e.jsx(n,{defaultValue:[a],value:[a],min:.25,max:3,step:.25,onValueChange:s=>l({radius:s[0]})})]})]})};export{h as default}; diff --git a/assets/controls-DogCyDae.js b/assets/controls-DogCyDae.js new file mode 100644 index 00000000..8718457b --- /dev/null +++ b/assets/controls-DogCyDae.js @@ -0,0 +1 @@ +import{j as e,L as m,B as x,e as i,S as n}from"./index-DwhXMaNP.js";import{useParams as d,useActions as j,usePresets as p}from"./reactive-B8Cs-xx5.js";import"./ground-DJZ6lP2l.js";const b=()=>{const{nGridCols:a,nGridRows:t,cubeSpacingScalar:l}=d(),{setParams:r,setPreset:c}=j(),{active:o,options:u}=p();return e.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[e.jsx(m,{children:"Grid Presets"}),e.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:[...Object.keys(u),"custom"].map(s=>e.jsx(x,{variant:"ghost","aria-selected":o===s,className:"p-2 aria-selected:bg-primary/20",onClick:()=>c(s==="custom"?void 0:s),children:s},`po_${s}`))}),!o&&e.jsxs(e.Fragment,{children:[e.jsx(i,{label:"N x Rows",value:t}),e.jsx(n,{defaultValue:[t],value:[t],min:5,max:200,step:5,onValueChange:s=>r({nGridRows:s[0]})}),e.jsx(i,{label:"N x Cols",value:a}),e.jsx(n,{defaultValue:[a],value:[a],min:5,max:200,step:5,onValueChange:s=>r({nGridCols:s[0]})}),e.jsx(i,{label:"Grid Spacing",value:l.toFixed(2)}),e.jsx(n,{defaultValue:[l],value:[l],min:1,max:6,step:.5,onValueChange:s=>r({cubeSpacingScalar:s[0]})})]})]})};export{b as default}; diff --git a/assets/controls-tumpVwPC.js b/assets/controls-tumpVwPC.js new file mode 100644 index 00000000..67026e8b --- /dev/null +++ b/assets/controls-tumpVwPC.js @@ -0,0 +1 @@ +import{j as e,L as r,B as d,e as c,S as n,f as x}from"./index-DwhXMaNP.js";import{useParams as j,usePresets as f,useActions as p}from"./reactive-3iPiwwNw.js";import"./ground-DJZ6lP2l.js";const g=()=>{const{nPerSide:a,cubeSpacingScalar:t,volume:u}=j(),{active:i,options:o}=f(),{setParams:l,setPreset:m}=p();return e.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[e.jsx(r,{children:"Cube Presets"}),e.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:[...Object.keys(o),"custom"].map(s=>e.jsx(d,{variant:"ghost","aria-selected":i===s,className:"p-2 aria-selected:bg-primary/20",onClick:()=>m(s==="custom"?void 0:s),children:s},`po_${s}`))}),!i&&e.jsxs(e.Fragment,{children:[e.jsx(c,{label:"N x Per Side",value:a}),e.jsx(n,{defaultValue:[a],value:[a],min:3,max:20,step:1,onValueChange:s=>l({nPerSide:s[0]})}),e.jsx(c,{label:"Cube Spacing",value:t.toFixed(2)}),e.jsx(n,{defaultValue:[t],value:[t],min:0,max:.5,step:.1,onValueChange:s=>l({cubeSpacingScalar:s[0]})}),e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsx(r,{children:"Volume"}),e.jsx(x,{defaultChecked:u,onCheckedChange:s=>{l({volume:s})}})]})]})]})};export{g as default}; diff --git a/assets/ground-DJZ6lP2l.js b/assets/ground-DJZ6lP2l.js new file mode 100644 index 00000000..88aa63e9 --- /dev/null +++ b/assets/ground-DJZ6lP2l.js @@ -0,0 +1,143 @@ +import{a0 as ee,R as te,y as u,a as C,_ as re,W as O,K as k,a7 as J,G as ae,I as ie,a1 as ne,a2 as G,J as oe,ab as se,r,a8 as le,u as N,ac as ue,V as y,M as L,a3 as q,$ as he,D as me,ad as fe,ae as ve,b as ce,aa as de,j as H}from"./index-DwhXMaNP.js";const pe=()=>parseInt(ee.replace(/\D+/g,"")),xe=pe();class _e extends te{constructor(e=new C){super({uniforms:{inputBuffer:new u(null),depthBuffer:new u(null),resolution:new u(new C),texelSize:new u(new C),halfTexelSize:new u(new C),kernel:new u(0),scale:new u(1),cameraNear:new u(0),cameraFar:new u(1),minDepthThreshold:new u(0),maxDepthThreshold:new u(1),depthScale:new u(0),depthToBlurRatioBias:new u(.25)},fragmentShader:`#include + #include + uniform sampler2D inputBuffer; + uniform sampler2D depthBuffer; + uniform float cameraNear; + uniform float cameraFar; + uniform float minDepthThreshold; + uniform float maxDepthThreshold; + uniform float depthScale; + uniform float depthToBlurRatioBias; + varying vec2 vUv; + varying vec2 vUv0; + varying vec2 vUv1; + varying vec2 vUv2; + varying vec2 vUv3; + + void main() { + float depthFactor = 0.0; + + #ifdef USE_DEPTH + vec4 depth = texture2D(depthBuffer, vUv); + depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a)); + depthFactor *= depthScale; + depthFactor = max(0.0, min(1.0, depthFactor + 0.25)); + #endif + + vec4 sum = texture2D(inputBuffer, mix(vUv0, vUv, depthFactor)); + sum += texture2D(inputBuffer, mix(vUv1, vUv, depthFactor)); + sum += texture2D(inputBuffer, mix(vUv2, vUv, depthFactor)); + sum += texture2D(inputBuffer, mix(vUv3, vUv, depthFactor)); + gl_FragColor = sum * 0.25 ; + + #include + #include + #include <${xe>=154?"colorspace_fragment":"encodings_fragment"}> + }`,vertexShader:`uniform vec2 texelSize; + uniform vec2 halfTexelSize; + uniform float kernel; + uniform float scale; + varying vec2 vUv; + varying vec2 vUv0; + varying vec2 vUv1; + varying vec2 vUv2; + varying vec2 vUv3; + + void main() { + vec2 uv = position.xy * 0.5 + 0.5; + vUv = uv; + + vec2 dUv = (texelSize * vec2(kernel) + halfTexelSize) * scale; + vUv0 = vec2(uv.x - dUv.x, uv.y + dUv.y); + vUv1 = vec2(uv.x + dUv.x, uv.y + dUv.y); + vUv2 = vec2(uv.x + dUv.x, uv.y - dUv.y); + vUv3 = vec2(uv.x - dUv.x, uv.y - dUv.y); + + gl_Position = vec4(position.xy, 1.0, 1.0); + }`,blending:re,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,this.setTexelSize(e.x,e.y),this.kernel=new Float32Array([0,1,2,2,3])}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t),this.uniforms.halfTexelSize.value.set(e,t).multiplyScalar(.5)}setResolution(e){this.uniforms.resolution.value.copy(e)}}class ge{constructor({gl:e,resolution:t,width:i=500,height:f=500,minDepthThreshold:d=0,maxDepthThreshold:p=1,depthScale:x=0,depthToBlurRatioBias:S=.25}){this.renderToScreen=!1,this.renderTargetA=new O(t,t,{minFilter:k,magFilter:k,stencilBuffer:!1,depthBuffer:!1,type:J}),this.renderTargetB=this.renderTargetA.clone(),this.convolutionMaterial=new _e,this.convolutionMaterial.setTexelSize(1/i,1/f),this.convolutionMaterial.setResolution(new C(i,f)),this.scene=new ae,this.camera=new ie,this.convolutionMaterial.uniforms.minDepthThreshold.value=d,this.convolutionMaterial.uniforms.maxDepthThreshold.value=p,this.convolutionMaterial.uniforms.depthScale.value=x,this.convolutionMaterial.uniforms.depthToBlurRatioBias.value=S,this.convolutionMaterial.defines.USE_DEPTH=x>0;const m=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),_=new Float32Array([0,0,2,0,0,2]),h=new ne;h.setAttribute("position",new G(m,3)),h.setAttribute("uv",new G(_,2)),this.screen=new oe(h,this.convolutionMaterial),this.screen.frustumCulled=!1,this.scene.add(this.screen)}render(e,t,i){const f=this.scene,d=this.camera,p=this.renderTargetA,x=this.renderTargetB;let S=this.convolutionMaterial,m=S.uniforms;m.depthBuffer.value=t.depthTexture;const _=S.kernel;let h=t,U,g,P;for(g=0,P=_.length-1;g",`#include + my_vUv = textureMatrix * vec4( position, 1.0 ); + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );`),e.fragmentShader=` + uniform sampler2D tDiffuse; + uniform sampler2D tDiffuseBlur; + uniform sampler2D tDepth; + uniform sampler2D distortionMap; + uniform float distortion; + uniform float cameraNear; + uniform float cameraFar; + uniform bool hasBlur; + uniform float mixBlur; + uniform float mirror; + uniform float mixStrength; + uniform float minDepthThreshold; + uniform float maxDepthThreshold; + uniform float mixContrast; + uniform float depthScale; + uniform float depthToBlurRatioBias; + varying vec4 my_vUv; + ${e.fragmentShader}`,e.fragmentShader=e.fragmentShader.replace("#include ",`#include + + float distortionFactor = 0.0; + #ifdef USE_DISTORTION + distortionFactor = texture2D(distortionMap, vUv).r * distortion; + #endif + + vec4 new_vUv = my_vUv; + new_vUv.x += distortionFactor; + new_vUv.y += distortionFactor; + + vec4 base = texture2DProj(tDiffuse, new_vUv); + vec4 blur = texture2DProj(tDiffuseBlur, new_vUv); + + vec4 merge = base; + + #ifdef USE_NORMALMAP + vec2 normal_uv = vec2(0.0); + vec4 normalColor = texture2D(normalMap, vUv * normalScale); + vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) ); + vec3 coord = new_vUv.xyz / new_vUv.w; + normal_uv = coord.xy + coord.z * my_normal.xz * 0.05; + vec4 base_normal = texture2D(tDiffuse, normal_uv); + vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv); + merge = base_normal; + blur = blur_normal; + #endif + + float depthFactor = 0.0001; + float blurFactor = 0.0; + + #ifdef USE_DEPTH + vec4 depth = texture2DProj(tDepth, new_vUv); + depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a)); + depthFactor *= depthScale; + depthFactor = max(0.0001, min(1.0, depthFactor)); + + #ifdef USE_BLUR + blur = blur * min(1.0, depthFactor + depthToBlurRatioBias); + merge = merge * min(1.0, depthFactor + 0.5); + #else + merge = merge * depthFactor; + #endif + + #endif + + float reflectorRoughnessFactor = roughness; + #ifdef USE_ROUGHNESSMAP + vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv ); + reflectorRoughnessFactor *= reflectorTexelRoughness.g; + #endif + + #ifdef USE_BLUR + blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor); + merge = mix(merge, blur, blurFactor); + #endif + + vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0); + newMerge.r = (merge.r - 0.5) * mixContrast + 0.5; + newMerge.g = (merge.g - 0.5) * mixContrast + 0.5; + newMerge.b = (merge.b - 0.5) * mixContrast + 0.5; + + diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength); + `)}get tDiffuse(){return this._tDiffuse.value}set tDiffuse(e){this._tDiffuse.value=e}get tDepth(){return this._tDepth.value}set tDepth(e){this._tDepth.value=e}get distortionMap(){return this._distortionMap.value}set distortionMap(e){this._distortionMap.value=e}get tDiffuseBlur(){return this._tDiffuseBlur.value}set tDiffuseBlur(e){this._tDiffuseBlur.value=e}get textureMatrix(){return this._textureMatrix.value}set textureMatrix(e){this._textureMatrix.value=e}get hasBlur(){return this._hasBlur.value}set hasBlur(e){this._hasBlur.value=e}get mirror(){return this._mirror.value}set mirror(e){this._mirror.value=e}get mixBlur(){return this._mixBlur.value}set mixBlur(e){this._mixBlur.value=e}get mixStrength(){return this._blurStrength.value}set mixStrength(e){this._blurStrength.value=e}get minDepthThreshold(){return this._minDepthThreshold.value}set minDepthThreshold(e){this._minDepthThreshold.value=e}get maxDepthThreshold(){return this._maxDepthThreshold.value}set maxDepthThreshold(e){this._maxDepthThreshold.value=e}get depthScale(){return this._depthScale.value}set depthScale(e){this._depthScale.value=e}get depthToBlurRatioBias(){return this._depthToBlurRatioBias.value}set depthToBlurRatioBias(e){this._depthToBlurRatioBias.value=e}get distortion(){return this._distortion.value}set distortion(e){this._distortion.value=e}get mixContrast(){return this._mixContrast.value}set mixContrast(e){this._mixContrast.value=e}};const Se=r.forwardRef(({mixBlur:c=0,mixStrength:e=1,resolution:t=256,blur:i=[0,0],minDepthThreshold:f=.9,maxDepthThreshold:d=1,depthScale:p=0,depthToBlurRatioBias:x=.25,mirror:S=0,distortion:m=1,mixContrast:_=1,distortionMap:h,reflectorOffset:U=0,...g},P)=>{le({MeshReflectorMaterialImpl:De});const n=N(({gl:s})=>s),R=N(({camera:s})=>s),K=N(({scene:s})=>s);i=Array.isArray(i)?i:[i,i];const A=i[0]+i[1]>0,M=r.useRef(null);r.useImperativeHandle(P,()=>M.current,[]);const[B]=r.useState(()=>new ue),[D]=r.useState(()=>new y),[T]=r.useState(()=>new y),[V]=r.useState(()=>new y),[F]=r.useState(()=>new L),[j]=r.useState(()=>new y(0,0,-1)),[v]=r.useState(()=>new q),[b]=r.useState(()=>new y),[z]=r.useState(()=>new y),[E]=r.useState(()=>new q),[w]=r.useState(()=>new L),[l]=r.useState(()=>new he),X=r.useCallback(()=>{var s;const a=M.current.parent||((s=M.current)==null?void 0:s.__r3f.parent);if(!a||(T.setFromMatrixPosition(a.matrixWorld),V.setFromMatrixPosition(R.matrixWorld),F.extractRotation(a.matrixWorld),D.set(0,0,1),D.applyMatrix4(F),T.addScaledVector(D,U),b.subVectors(T,V),b.dot(D)>0))return;b.reflect(D).negate(),b.add(T),F.extractRotation(R.matrixWorld),j.set(0,0,-1),j.applyMatrix4(F),j.add(V),z.subVectors(T,j),z.reflect(D).negate(),z.add(T),l.position.copy(b),l.up.set(0,1,0),l.up.applyMatrix4(F),l.up.reflect(D),l.lookAt(z),l.far=R.far,l.updateMatrixWorld(),l.projectionMatrix.copy(R.projectionMatrix),w.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),w.multiply(l.projectionMatrix),w.multiply(l.matrixWorldInverse),w.multiply(a.matrixWorld),B.setFromNormalAndCoplanarPoint(D,T),B.applyMatrix4(l.matrixWorldInverse),v.set(B.normal.x,B.normal.y,B.normal.z,B.constant);const o=l.projectionMatrix;E.x=(Math.sign(v.x)+o.elements[8])/o.elements[0],E.y=(Math.sign(v.y)+o.elements[9])/o.elements[5],E.z=-1,E.w=(1+o.elements[10])/o.elements[14],v.multiplyScalar(2/v.dot(E)),o.elements[2]=v.x,o.elements[6]=v.y,o.elements[10]=v.z+1,o.elements[14]=v.w},[R,U]),[$,Q,Y,I]=r.useMemo(()=>{const s={minFilter:k,magFilter:k,type:J},a=new O(t,t,s);a.depthBuffer=!0,a.depthTexture=new me(t,t),a.depthTexture.format=fe,a.depthTexture.type=ve;const o=new O(t,t,s),W=new ge({gl:n,resolution:t,width:i[0],height:i[1],minDepthThreshold:f,maxDepthThreshold:d,depthScale:p,depthToBlurRatioBias:x}),Z={mirror:S,textureMatrix:w,mixBlur:c,tDiffuse:a.texture,tDepth:a.depthTexture,tDiffuseBlur:o.texture,hasBlur:A,mixStrength:e,minDepthThreshold:f,maxDepthThreshold:d,depthScale:p,depthToBlurRatioBias:x,distortion:m,distortionMap:h,mixContrast:_,"defines-USE_BLUR":A?"":void 0,"defines-USE_DEPTH":p>0?"":void 0,"defines-USE_DISTORTION":h?"":void 0};return[a,o,W,Z]},[n,i,w,t,S,A,c,e,f,d,p,x,m,h,_]);return ce(()=>{var s;const a=M.current.parent||((s=M.current)==null?void 0:s.__r3f.parent);if(!a)return;a.visible=!1;const o=n.xr.enabled,W=n.shadowMap.autoUpdate;X(),n.xr.enabled=!1,n.shadowMap.autoUpdate=!1,n.setRenderTarget($),n.state.buffers.depth.setMask(!0),n.autoClear||n.clear(),n.render(K,l),A&&Y.render(n,$,Q),n.xr.enabled=o,n.shadowMap.autoUpdate=W,a.visible=!0,n.setRenderTarget(null)}),r.createElement("meshReflectorMaterialImpl",de({attach:"material",key:"key"+I["defines-USE_BLUR"]+I["defines-USE_DEPTH"]+I["defines-USE_DISTORTION"],ref:M},I,g))}),Me=({size:c=250,...e})=>H.jsxs("mesh",{...e,children:[H.jsx("planeGeometry",{args:[c,c]}),H.jsx(Se,{mirror:1,blur:[500,100],resolution:1024,mixBlur:12,mixStrength:1.5,roughness:1,depthScale:1.2,minDepthThreshold:.4,maxDepthThreshold:1.4})]});export{Me as G}; diff --git a/assets/index-BDPfqLnQ.css b/assets/index-BDPfqLnQ.css new file mode 100644 index 00000000..c682c6eb --- /dev/null +++ b/assets/index-BDPfqLnQ.css @@ -0,0 +1 @@ +#info{position:absolute;pointer-events:none;z-index:10;padding:1.5em;color:#fff;text-shadow:1px 1px black;border-radius:1em}.contrast #info button{border-color:#000}.contrast #info button:hover{background-color:#505050;color:#fff}#info button{color:inherit;cursor:pointer;border:1px solid white;outline:none;background:none;border-radius:3px;padding:.5em 1em;margin-right:.5em;pointer-events:auto;text-shadow:1px 1px black;font-weight:700}#info button:hover{background-color:#b4b4b4;color:#000;text-shadow:none}#info a{pointer-events:auto}#info p:last-child{margin-bottom:0}.contrast #info *,.contrast footer *{text-shadow:none;color:#000}#info h1{font-family:Montserrat,sans-serif;margin-bottom:.5em;font-size:1.5rem}#info h2{font-family:Montserrat,sans-serif;font-size:1rem}#info p{margin-bottom:1em}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 20 14.3% 4.1%;--card: 0 0% 100%;--card-foreground: 20 14.3% 4.1%;--popover: 0 0% 100%;--popover-foreground: 20 14.3% 4.1%;--primary: 24 9.8% 10%;--primary-foreground: 60 9.1% 97.8%;--secondary: 60 4.8% 95.9%;--secondary-foreground: 24 9.8% 10%;--muted: 60 4.8% 95.9%;--muted-foreground: 25 5.3% 44.7%;--accent: 60 4.8% 95.9%;--accent-foreground: 24 9.8% 10%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 60 9.1% 97.8%;--border: 20 5.9% 90%;--input: 20 5.9% 90%;--ring: 20 14.3% 4.1%;--radius: .5rem}.dark{--background: 20 14.3% 4.1%;--foreground: 60 9.1% 97.8%;--card: 20 14.3% 4.1%;--card-foreground: 60 9.1% 97.8%;--popover: 20 14.3% 4.1%;--popover-foreground: 60 9.1% 97.8%;--primary: 60 9.1% 97.8%;--primary-foreground: 24 9.8% 10%;--secondary: 12 6.5% 15.1%;--secondary-foreground: 60 9.1% 97.8%;--muted: 12 6.5% 15.1%;--muted-foreground: 24 5.4% 63.9%;--accent: 12 6.5% 15.1%;--accent-foreground: 60 9.1% 97.8%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 60 9.1% 97.8%;--border: 12 6.5% 15.1%;--input: 12 6.5% 15.1%;--ring: 24 5.7% 82.9%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:.5rem}.right-0{right:0}.right-4{right:1rem}.top-0{top:0}.top-4{top:1rem}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mt-2{margin-top:.5rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[100dvh\]{height:100dvh}.h-\[1px\]{height:1px}.h-\[24px\]{height:24px}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-full{height:100%}.h-px{height:1px}.max-h-36{max-height:9rem}.w-0\.5{width:.125rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-2\.5{width:.625rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-\[100dvw\]{width:100dvw}.w-\[1px\]{width:1px}.w-\[240px\]{width:240px}.w-\[44px\]{width:44px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-64{max-width:16rem}.max-w-\[80\%\]{max-width:80%}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-ns-resize{cursor:ns-resize}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-stretch{justify-items:stretch}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-y-visible{overflow-y:visible}.overflow-x-scroll{overflow-x:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-\[6px\]{border-radius:6px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-\[\#4E4E4E\]{--tw-border-opacity: 1;border-color:rgb(78 78 78 / var(--tw-border-opacity))}.border-black\/5{border-color:#0000000d}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-transparent{border-color:transparent}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.border-opacity-10{--tw-border-opacity: .1}.bg-background{background-color:hsl(var(--background))}.bg-background\/70{background-color:hsl(var(--background) / .7)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\/25{background-color:#00000040}.bg-border{background-color:hsl(var(--border))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-muted{background-color:hsl(var(--muted))}.bg-neutral-50{--tw-bg-opacity: 1;background-color:rgb(250 250 250 / var(--tw-bg-opacity))}.bg-neutral-800\/10{background-color:#2626261a}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-white\/20{background-color:#fff3}.bg-opacity-90{--tw-bg-opacity: .9}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-slate-500{--tw-gradient-from: #64748b var(--tw-gradient-from-position);--tw-gradient-to: rgb(100 116 139 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-700{--tw-gradient-from: #334155 var(--tw-gradient-from-position);--tw-gradient-to: rgb(51 65 85 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white\/10{--tw-gradient-from: rgb(255 255 255 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-black{--tw-gradient-to: #000 var(--tw-gradient-to-position)}.to-white\/0{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position)}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-none{line-height:1}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.no-underline{text-decoration-line:none}.underline-offset-4{text-underline-offset:4px}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow-\[0_1px_0_0_rgba\(255\,255\,255\,0\.03\)_inset\,0_0_0_1px_rgba\(255\,255\,255\,0\.03\)_inset\,0_0_0_0px_rgba\(0\,0\,0\,0\.1\)\,0_2px_2px_0_rgba\(0\,0\,0\,0\.1\)\,0_4px_4px_0_rgba\(0\,0\,0\,0\.1\)\,0_8px_8px_0_rgba\(0\,0\,0\,0\.1\)\]{--tw-shadow: 0 1px 0 0 rgba(255,255,255,.03) inset,0 0 0 1px rgba(255,255,255,.03) inset,0 0 0 0px rgba(0,0,0,.1),0 2px 2px 0 rgba(0,0,0,.1),0 4px 4px 0 rgba(0,0,0,.1),0 8px 8px 0 rgba(0,0,0,.1);--tw-shadow-colored: inset 0 1px 0 0 var(--tw-shadow-color), inset 0 0 0 1px var(--tw-shadow-color), 0 0 0 0px var(--tw-shadow-color), 0 2px 2px 0 var(--tw-shadow-color), 0 4px 4px 0 var(--tw-shadow-color), 0 8px 8px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.brightness-90{--tw-brightness: brightness(.9);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}@keyframes scale{0%{scale:.25}}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-xs::-moz-placeholder{font-size:.75rem;line-height:1rem}.placeholder\:text-xs::placeholder{font-size:.75rem;line-height:1rem}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-150:hover{--tw-scale-x: 1.5;--tw-scale-y: 1.5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border:hover{border-width:1px}.hover\:border-white:hover{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-500\/20:hover{background-color:#64748b33}.hover\:bg-white\/50:hover{background-color:#ffffff80}.hover\:from-slate-500:hover{--tw-gradient-from: #64748b var(--tw-gradient-from-position);--tw-gradient-to: rgb(100 116 139 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-white\/15:hover{--tw-gradient-from: rgb(255 255 255 / .15) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-slate-900:hover{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground\/80:hover{color:hsl(var(--foreground) / .8)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.hover\:saturate-100:hover{--tw-saturate: saturate(1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}@keyframes pulse{50%{opacity:.5}}.aria-selected\:animate-pulse[aria-selected=true]{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.aria-selected\:border[aria-selected=true]{border-width:1px}.aria-selected\:border-white[aria-selected=true]{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.aria-selected\:bg-primary\/20[aria-selected=true]{background-color:hsl(var(--primary) / .2)}.aria-selected\:from-slate-100[aria-selected=true]{--tw-gradient-from: #f1f5f9 var(--tw-gradient-from-position);--tw-gradient-to: rgb(241 245 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.aria-selected\:to-slate-500[aria-selected=true]{--tw-gradient-to: #64748b var(--tw-gradient-to-position)}.aria-selected\:text-black[aria-selected=true]{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.aria-selected\:text-foreground[aria-selected=true]{color:hsl(var(--foreground))}.aria-selected\:ring-2[aria-selected=true]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.aria-selected\:ring-primary[aria-selected=true]{--tw-ring-color: hsl(var(--primary))}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.dark\:border-white\/5:is(.dark *){border-color:#ffffff0d}.dark\:bg-black:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.dark\:bg-neutral-100\/10:is(.dark *){background-color:#f5f5f51a}.dark\:bg-white:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}@media (min-width: 640px){.sm\:flex{display:flex}.sm\:w-\[430px\]{width:430px}.sm\:max-w-\[430px\]{max-width:430px}.sm\:max-w-sm{max-width:24rem}.sm\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:bg-black\/25{background-color:#00000040}.sm\:text-left{text-align:left}} diff --git a/assets/index-Cghja_vb.js b/assets/index-Cghja_vb.js deleted file mode 100644 index 8f87e8ba..00000000 --- a/assets/index-Cghja_vb.js +++ /dev/null @@ -1,4304 +0,0 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/reactive-UZqlxOwl.js","assets/easing-BzOxJDJb.js","assets/reactive-DShZioEa.js","assets/Noise-eViT7niE.js","assets/reactive-CmorMSwY.js","assets/reactive-CgD5EBKP.js"])))=>i.map(i=>d[i]); -var wz=Object.defineProperty;var CC=n=>{throw TypeError(n)};var Mz=(n,e,t)=>e in n?wz(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var st=(n,e,t)=>Mz(n,typeof e!="symbol"?e+"":e,t),n_=(n,e,t)=>e.has(n)||CC("Cannot "+t);var ee=(n,e,t)=>(n_(n,e,"read from private field"),t?t.call(n):e.get(n)),Tt=(n,e,t)=>e.has(n)?CC("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),tt=(n,e,t,r)=>(n_(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t),Yt=(n,e,t)=>(n_(n,e,"access private method"),t);var tg=(n,e,t,r)=>({set _(i){tt(n,e,i,t)},get _(){return ee(n,e,r)}});function Ez(n,e){for(var t=0;tr[i]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();function kp(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var NP={exports:{}},j0={},DP={exports:{}},Xt={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Up=Symbol.for("react.element"),bz=Symbol.for("react.portal"),Tz=Symbol.for("react.fragment"),Cz=Symbol.for("react.strict_mode"),Az=Symbol.for("react.profiler"),Rz=Symbol.for("react.provider"),Pz=Symbol.for("react.context"),Iz=Symbol.for("react.forward_ref"),Lz=Symbol.for("react.suspense"),Nz=Symbol.for("react.memo"),Dz=Symbol.for("react.lazy"),AC=Symbol.iterator;function Oz(n){return n===null||typeof n!="object"?null:(n=AC&&n[AC]||n["@@iterator"],typeof n=="function"?n:null)}var OP={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},kP=Object.assign,UP={};function Xd(n,e,t){this.props=n,this.context=e,this.refs=UP,this.updater=t||OP}Xd.prototype.isReactComponent={};Xd.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};Xd.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function FP(){}FP.prototype=Xd.prototype;function cM(n,e,t){this.props=n,this.context=e,this.refs=UP,this.updater=t||OP}var uM=cM.prototype=new FP;uM.constructor=cM;kP(uM,Xd.prototype);uM.isPureReactComponent=!0;var RC=Array.isArray,zP=Object.prototype.hasOwnProperty,dM={current:null},BP={key:!0,ref:!0,__self:!0,__source:!0};function VP(n,e,t){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)zP.call(e,r)&&!BP.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1{const[t,r]=T.useState((n==null?void 0:n.amplitude)??1),[i,s]=T.useState((n==null?void 0:n.octaveBandMode)??2),[o,a]=T.useState((n==null?void 0:n.energyMeasure)??"bass");return C.jsx(hM.Provider,{value:{config:{amplitude:t,octaveBandMode:i,energyMeasure:o},setters:{setAmplitude:r,setOctaveBand:s,setEnergyMeasure:a}},children:e})};function pM(){const n=T.useContext(hM);if(!n)throw new Error("useFFTAnalyzerContext must be used within a FFTAnalyzerContextProvider");return n.config}function Yz(){const n=T.useContext(hM);if(!n)throw new Error("useFFTAnalyzerContext must be used within a FFTAnalyzerContextProvider");return n.setters}const Zz={BASE_URL:"/r3f-audio-visualizer/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},IC=n=>{let e;const t=new Set,r=(f,h)=>{const p=typeof f=="function"?f(e):f;if(!Object.is(p,e)){const g=e;e=h??(typeof p!="object"||p===null)?p:Object.assign({},e,p),t.forEach(v=>v(e,g))}},i=()=>e,l={setState:r,getState:i,getInitialState:()=>u,subscribe:f=>(t.add(f),()=>t.delete(f)),destroy:()=>{(Zz?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),t.clear()}},u=e=n(r,i,l);return l},$z=n=>n?IC(n):IC;var GP={exports:{}},jP={},XP={exports:{}},qP={};/** - * @license React - * use-sync-external-store-shim.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ad=T;function Kz(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var Qz=typeof Object.is=="function"?Object.is:Kz,Jz=Ad.useState,eB=Ad.useEffect,tB=Ad.useLayoutEffect,nB=Ad.useDebugValue;function rB(n,e){var t=e(),r=Jz({inst:{value:t,getSnapshot:e}}),i=r[0].inst,s=r[1];return tB(function(){i.value=t,i.getSnapshot=e,i_(i)&&s({inst:i})},[n,t,e]),eB(function(){return i_(i)&&s({inst:i}),n(function(){i_(i)&&s({inst:i})})},[n]),nB(t),t}function i_(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!Qz(n,t)}catch{return!0}}function iB(n,e){return e()}var sB=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?iB:rB;qP.useSyncExternalStore=Ad.useSyncExternalStore!==void 0?Ad.useSyncExternalStore:sB;XP.exports=qP;var oB=XP.exports;/** - * @license React - * use-sync-external-store-shim/with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var X0=T,aB=oB;function lB(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var cB=typeof Object.is=="function"?Object.is:lB,uB=aB.useSyncExternalStore,dB=X0.useRef,fB=X0.useEffect,hB=X0.useMemo,pB=X0.useDebugValue;jP.useSyncExternalStoreWithSelector=function(n,e,t,r,i){var s=dB(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=hB(function(){function l(g){if(!u){if(u=!0,f=g,g=r(g),i!==void 0&&o.hasValue){var v=o.value;if(i(v,g))return h=v}return h=g}if(v=h,cB(f,g))return v;var _=r(g);return i!==void 0&&i(v,_)?v:(f=g,h=_)}var u=!1,f,h,p=t===void 0?null:t;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,t,r,i]);var a=uB(n,s[0],s[1]);return fB(function(){o.hasValue=!0,o.value=a},[a]),pB(a),a};GP.exports=jP;var mB=GP.exports;const gB=kp(mB),YP={BASE_URL:"/r3f-audio-visualizer/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},{useDebugValue:vB}=Do,{useSyncExternalStoreWithSelector:yB}=gB;let LC=!1;const xB=n=>n;function _B(n,e=xB,t){(YP?"production":void 0)!=="production"&&t&&!LC&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),LC=!0);const r=yB(n.subscribe,n.getState,n.getServerState||n.getInitialState,e,t);return vB(r),r}const NC=n=>{(YP?"production":void 0)!=="production"&&typeof n!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof n=="function"?$z(n):n,t=(r,i)=>_B(e,r,i);return Object.assign(t,e),t},SB=n=>n?NC(n):NC;/** - * @license - * Copyright 2010-2023 Three.js Authors - * SPDX-License-Identifier: MIT - */const Fp="161",Wl={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Gl={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ZP=0,VS=1,$P=2,wB=3,KP=0,q0=1,dh=2,ys=3,Yo=0,Jr=1,Js=2,io=0,fc=1,HS=2,WS=3,GS=4,QP=5,Ia=100,JP=101,eI=102,jS=103,XS=104,tI=200,nI=201,rI=202,iI=203,Gv=204,jv=205,sI=206,oI=207,aI=208,lI=209,cI=210,uI=211,dI=212,fI=213,hI=214,pI=0,mI=1,gI=2,Ch=3,vI=4,yI=5,xI=6,_I=7,zp=0,SI=1,wI=2,so=0,MI=1,EI=2,bI=3,mM=4,TI=5,CI=6,qS="attached",AI="detached",Y0=300,Zo=301,nl=302,Ah=303,Rh=304,qd=306,Ph=1e3,Ur=1001,Ih=1002,jn=1003,Xv=1004,MB=1004,Zl=1005,EB=1005,fn=1006,fh=1007,bB=1007,no=1008,TB=1008,oo=1009,RI=1010,PI=1011,Bp=1012,gM=1013,Bo=1014,is=1015,rl=1016,vM=1017,yM=1018,Wa=1020,II=1021,Fr=1023,LI=1024,NI=1025,Xo=1026,_c=1027,DI=1028,xM=1029,OI=1030,_M=1031,SM=1033,Mv=33776,Ev=33777,bv=33778,Tv=33779,YS=35840,ZS=35841,$S=35842,KS=35843,wM=36196,QS=37492,JS=37496,e1=37808,t1=37809,n1=37810,r1=37811,i1=37812,s1=37813,o1=37814,a1=37815,l1=37816,c1=37817,u1=37818,d1=37819,f1=37820,h1=37821,Cv=36492,p1=36494,m1=36495,kI=36283,g1=36284,v1=36285,y1=36286,UI=2200,FI=2201,zI=2202,Lh=2300,Nh=2301,Av=2302,Kl=2400,Ql=2401,Dh=2402,Z0=2500,MM=2501,CB=0,AB=1,RB=2,EM=3e3,Ga=3001,BI=3200,VI=3201,ml=0,HI=1,Ii="",zn="srgb",hi="srgb-linear",$0="display-p3",Vp="display-p3-linear",Oh="linear",mn="srgb",kh="rec709",Uh="p3",PB=0,jl=7680,IB=7681,LB=7682,NB=7683,DB=34055,OB=34056,kB=5386,UB=512,FB=513,zB=514,BB=515,VB=516,HB=517,WB=518,x1=519,WI=512,GI=513,jI=514,bM=515,XI=516,qI=517,YI=518,ZI=519,Fh=35044,GB=35048,jB=35040,XB=35045,qB=35049,YB=35041,ZB=35046,$B=35050,KB=35042,QB="100",_1="300 es",qv=1035,ro=2e3,zh=2001;class mo{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+Rr[n>>16&255]+Rr[n>>24&255]+"-"+Rr[e&255]+Rr[e>>8&255]+"-"+Rr[e>>16&15|64]+Rr[e>>24&255]+"-"+Rr[t&63|128]+Rr[t>>8&255]+"-"+Rr[t>>16&255]+Rr[t>>24&255]+Rr[r&255]+Rr[r>>8&255]+Rr[r>>16&255]+Rr[r>>24&255]).toLowerCase()}function Bn(n,e,t){return Math.max(e,Math.min(t,n))}function TM(n,e){return(n%e+e)%e}function JB(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function e4(n,e,t){return n!==e?(t-n)/(e-n):0}function hh(n,e,t){return(1-t)*n+t*e}function t4(n,e,t,r){return hh(n,e,1-Math.exp(-t*r))}function n4(n,e=1){return e-Math.abs(TM(n,e*2)-e)}function r4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function i4(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function s4(n,e){return n+Math.floor(Math.random()*(e-n+1))}function o4(n,e){return n+Math.random()*(e-n)}function a4(n){return n*(.5-Math.random())}function l4(n){n!==void 0&&(DC=n);let e=DC+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function c4(n){return n*hc}function u4(n){return n*Rd}function S1(n){return(n&n-1)===0&&n!==0}function d4(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Yv(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function f4(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),u=s((e+r)/2),f=o((e+r)/2),h=s((e-r)/2),p=o((e-r)/2),g=s((r-e)/2),v=o((r-e)/2);switch(i){case"XYX":n.set(a*f,l*h,l*p,a*u);break;case"YZY":n.set(l*p,a*f,l*h,a*u);break;case"ZXZ":n.set(l*h,l*p,a*f,a*u);break;case"XZX":n.set(a*f,l*v,l*g,a*u);break;case"YXY":n.set(l*g,a*f,l*v,a*u);break;case"ZYZ":n.set(l*v,l*g,a*f,a*u);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Qr(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Lt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const $I={DEG2RAD:hc,RAD2DEG:Rd,generateUUID:Di,clamp:Bn,euclideanModulo:TM,mapLinear:JB,inverseLerp:e4,lerp:hh,damp:t4,pingpong:n4,smoothstep:r4,smootherstep:i4,randInt:s4,randFloat:o4,randFloatSpread:a4,seededRandom:l4,degToRad:c4,radToDeg:u4,isPowerOfTwo:S1,ceilPowerOfTwo:d4,floorPowerOfTwo:Yv,setQuaternionFromProperEuler:f4,normalize:Lt,denormalize:Qr};class ge{constructor(e=0,t=0){ge.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(Bn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class zt{constructor(e,t,r,i,s,o,a,l,u){zt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,u)}set(e,t,r,i,s,o,a,l,u){const f=this.elements;return f[0]=e,f[1]=i,f[2]=a,f[3]=t,f[4]=s,f[5]=l,f[6]=r,f[7]=o,f[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],u=r[1],f=r[4],h=r[7],p=r[2],g=r[5],v=r[8],_=i[0],x=i[3],m=i[6],w=i[1],S=i[4],E=i[7],R=i[2],P=i[5],L=i[8];return s[0]=o*_+a*w+l*R,s[3]=o*x+a*S+l*P,s[6]=o*m+a*E+l*L,s[1]=u*_+f*w+h*R,s[4]=u*x+f*S+h*P,s[7]=u*m+f*E+h*L,s[2]=p*_+g*w+v*R,s[5]=p*x+g*S+v*P,s[8]=p*m+g*E+v*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],f=e[8];return t*o*f-t*a*u-r*s*f+r*a*l+i*s*u-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],f=e[8],h=f*o-a*u,p=a*l-f*s,g=u*s-o*l,v=t*h+r*p+i*g;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/v;return e[0]=h*_,e[1]=(i*u-f*r)*_,e[2]=(a*r-i*o)*_,e[3]=p*_,e[4]=(f*t-i*l)*_,e[5]=(i*s-a*t)*_,e[6]=g*_,e[7]=(r*l-u*t)*_,e[8]=(o*t-r*s)*_,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),u=Math.sin(s);return this.set(r*l,r*u,-r*(l*o+u*a)+o+e,-i*u,i*l,-i*(-u*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(s_.makeScale(e,t)),this}rotate(e){return this.premultiply(s_.makeRotation(-e)),this}translate(e,t){return this.premultiply(s_.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const s_=new zt;function KI(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const h4={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Fu(n,e){return new h4[n](e)}function Bh(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function QI(){const n=Bh("canvas");return n.style.display="block",n}const OC={};function pc(n){n in OC||(OC[n]=!0,console.warn(n))}const kC=new zt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),UC=new zt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),rg={[hi]:{transfer:Oh,primaries:kh,toReference:n=>n,fromReference:n=>n},[zn]:{transfer:mn,primaries:kh,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[Vp]:{transfer:Oh,primaries:Uh,toReference:n=>n.applyMatrix3(UC),fromReference:n=>n.applyMatrix3(kC)},[$0]:{transfer:mn,primaries:Uh,toReference:n=>n.convertSRGBToLinear().applyMatrix3(UC),fromReference:n=>n.applyMatrix3(kC).convertLinearToSRGB()}},p4=new Set([hi,Vp]),ln={enabled:!0,_workingColorSpace:hi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!p4.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const r=rg[e].toReference,i=rg[t].fromReference;return i(r(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return rg[n].primaries},getTransfer:function(n){return n===Ii?Oh:rg[n].transfer}};function rd(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function o_(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let lu;class CM{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{lu===void 0&&(lu=Bh("canvas")),lu.width=e.width,lu.height=e.height;const r=lu.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=lu}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Bh("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Y0)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Ph:e.x=e.x-Math.floor(e.x);break;case Ur:e.x=e.x<0?0:1;break;case Ih:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Ph:e.y=e.y-Math.floor(e.y);break;case Ur:e.y=e.y<0?0:1;break;case Ih:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return pc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===zn?Ga:EM}set encoding(e){pc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ga?zn:Ii}}In.DEFAULT_IMAGE=null;In.DEFAULT_MAPPING=Y0;In.DEFAULT_ANISOTROPY=1;class sn{constructor(e=0,t=0,r=0,i=1){sn.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,u=l[0],f=l[4],h=l[8],p=l[1],g=l[5],v=l[9],_=l[2],x=l[6],m=l[10];if(Math.abs(f-p)<.01&&Math.abs(h-_)<.01&&Math.abs(v-x)<.01){if(Math.abs(f+p)<.1&&Math.abs(h+_)<.1&&Math.abs(v+x)<.1&&Math.abs(u+g+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const S=(u+1)/2,E=(g+1)/2,R=(m+1)/2,P=(f+p)/4,L=(h+_)/4,D=(v+x)/4;return S>E&&S>R?S<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(S),i=P/r,s=L/r):E>R?E<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(E),r=P/i,s=D/i):R<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(R),r=L/s,i=D/s),this.set(r,i,s,t),this}let w=Math.sqrt((x-v)*(x-v)+(h-_)*(h-_)+(p-f)*(p-f));return Math.abs(w)<.001&&(w=1),this.x=(x-v)/w,this.y=(h-_)/w,this.z=(p-f)/w,this.w=Math.acos((u+g+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class JI extends mo{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new sn(0,0,e,t),this.scissorTest=!1,this.viewport=new sn(0,0,e,t);const i={width:e,height:t,depth:1};r.encoding!==void 0&&(pc("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=r.encoding===Ga?zn:Ii),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:fn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},r),this.texture=new In(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps,this.texture.internalFormat=r.internalFormat,this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Jl(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class yi extends JI{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class K0 extends In{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=jn,this.minFilter=jn,this.wrapR=Ur,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class v4 extends yi{constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=r,this.texture=new K0(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class AM extends In{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=jn,this.minFilter=jn,this.wrapR=Ur,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class y4 extends yi{constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=r,this.texture=new AM(null,e,t,r),this.texture.isRenderTargetTexture=!0}}class x4 extends yi{constructor(e=1,t=1,r=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,S=1-m*m;if(S>Number.EPSILON){const R=Math.sqrt(S),P=Math.atan2(R,m*w);x=Math.sin(x*P)/R,a=Math.sin(a*P)/R}const E=a*w;if(l=l*x+p*E,u=u*x+g*E,f=f*x+v*E,h=h*x+_*E,x===1-a){const R=1/Math.sqrt(l*l+u*u+f*f+h*h);l*=R,u*=R,f*=R,h*=R}}e[t]=l,e[t+1]=u,e[t+2]=f,e[t+3]=h}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],u=r[i+2],f=r[i+3],h=s[o],p=s[o+1],g=s[o+2],v=s[o+3];return e[t]=a*v+f*h+l*g-u*p,e[t+1]=l*v+f*p+u*h-a*g,e[t+2]=u*v+f*g+a*p-l*h,e[t+3]=f*v-a*h-l*p-u*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,u=a(r/2),f=a(i/2),h=a(s/2),p=l(r/2),g=l(i/2),v=l(s/2);switch(o){case"XYZ":this._x=p*f*h+u*g*v,this._y=u*g*h-p*f*v,this._z=u*f*v+p*g*h,this._w=u*f*h-p*g*v;break;case"YXZ":this._x=p*f*h+u*g*v,this._y=u*g*h-p*f*v,this._z=u*f*v-p*g*h,this._w=u*f*h+p*g*v;break;case"ZXY":this._x=p*f*h-u*g*v,this._y=u*g*h+p*f*v,this._z=u*f*v+p*g*h,this._w=u*f*h-p*g*v;break;case"ZYX":this._x=p*f*h-u*g*v,this._y=u*g*h+p*f*v,this._z=u*f*v-p*g*h,this._w=u*f*h+p*g*v;break;case"YZX":this._x=p*f*h+u*g*v,this._y=u*g*h+p*f*v,this._z=u*f*v-p*g*h,this._w=u*f*h-p*g*v;break;case"XZY":this._x=p*f*h-u*g*v,this._y=u*g*h-p*f*v,this._z=u*f*v+p*g*h,this._w=u*f*h+p*g*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],u=t[2],f=t[6],h=t[10],p=r+a+h;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(f-l)*g,this._y=(s-u)*g,this._z=(o-i)*g}else if(r>a&&r>h){const g=2*Math.sqrt(1+r-a-h);this._w=(f-l)/g,this._x=.25*g,this._y=(i+o)/g,this._z=(s+u)/g}else if(a>h){const g=2*Math.sqrt(1+a-r-h);this._w=(s-u)/g,this._x=(i+o)/g,this._y=.25*g,this._z=(l+f)/g}else{const g=2*Math.sqrt(1+h-r-a);this._w=(o-i)/g,this._x=(s+u)/g,this._y=(l+f)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Bn(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,u=t._z,f=t._w;return this._x=r*f+o*a+i*u-s*l,this._y=i*f+o*l+s*a-r*u,this._z=s*f+o*u+r*l-i*a,this._w=o*f-r*a-i*l-s*u,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const g=1-t;return this._w=g*o+t*this._w,this._x=g*r+t*this._x,this._y=g*i+t*this._y,this._z=g*s+t*this._z,this.normalize(),this}const u=Math.sqrt(l),f=Math.atan2(u,a),h=Math.sin((1-t)*f)/u,p=Math.sin(t*f)/u;return this._w=o*h+this._w*p,this._x=r*h+this._x*p,this._y=i*h+this._y*p,this._z=s*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(s),r*Math.cos(s),t*Math.sin(i))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class F{constructor(e=0,t=0,r=0){F.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(FC.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(FC.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,u=2*(o*i-a*r),f=2*(a*t-s*i),h=2*(s*r-o*t);return this.x=t+l*u+o*h-a*f,this.y=r+l*f+a*u-s*h,this.z=i+l*h+s*f-o*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return l_.copy(this).projectOnVector(e),this.sub(l_)}reflect(e){return this.sub(l_.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(Bn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const l_=new F,FC=new Br;class ei{constructor(e=new F(1/0,1/0,1/0),t=new F(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,hs),hs.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(If),sg.subVectors(this.max,If),cu.subVectors(e.a,If),uu.subVectors(e.b,If),du.subVectors(e.c,If),ga.subVectors(uu,cu),va.subVectors(du,uu),Nl.subVectors(cu,du);let t=[0,-ga.z,ga.y,0,-va.z,va.y,0,-Nl.z,Nl.y,ga.z,0,-ga.x,va.z,0,-va.x,Nl.z,0,-Nl.x,-ga.y,ga.x,0,-va.y,va.x,0,-Nl.y,Nl.x,0];return!c_(t,cu,uu,du,sg)||(t=[1,0,0,0,1,0,0,0,1],!c_(t,cu,uu,du,sg))?!1:(og.crossVectors(ga,va),t=[og.x,og.y,og.z],c_(t,cu,uu,du,sg))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,hs).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(hs).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(bo[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),bo[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),bo[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),bo[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),bo[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),bo[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),bo[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),bo[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(bo),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const bo=[new F,new F,new F,new F,new F,new F,new F,new F],hs=new F,ig=new ei,cu=new F,uu=new F,du=new F,ga=new F,va=new F,Nl=new F,If=new F,sg=new F,og=new F,Dl=new F;function c_(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){Dl.fromArray(n,s);const a=i.x*Math.abs(Dl.x)+i.y*Math.abs(Dl.y)+i.z*Math.abs(Dl.z),l=e.dot(Dl),u=t.dot(Dl),f=r.dot(Dl);if(Math.max(-Math.max(l,u,f),Math.min(l,u,f))>a)return!1}return!0}const _4=new ei,Lf=new F,u_=new F;class Vr{constructor(e=new F,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):_4.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Lf.subVectors(e,this.center);const t=Lf.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Lf,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(u_.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Lf.copy(e.center).add(u_)),this.expandByPoint(Lf.copy(e.center).sub(u_))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const To=new F,d_=new F,ag=new F,ya=new F,f_=new F,lg=new F,h_=new F;class Oc{constructor(e=new F,t=new F(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,To)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=To.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(To.copy(this.origin).addScaledVector(this.direction,t),To.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){d_.copy(e).add(t).multiplyScalar(.5),ag.copy(t).sub(e).normalize(),ya.copy(this.origin).sub(d_);const s=e.distanceTo(t)*.5,o=-this.direction.dot(ag),a=ya.dot(this.direction),l=-ya.dot(ag),u=ya.lengthSq(),f=Math.abs(1-o*o);let h,p,g,v;if(f>0)if(h=o*l-a,p=o*a-l,v=s*f,h>=0)if(p>=-v)if(p<=v){const _=1/f;h*=_,p*=_,g=h*(h+o*p+2*a)+p*(o*h+p+2*l)+u}else p=s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+u;else p=-s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+u;else p<=-v?(h=Math.max(0,-(-o*s+a)),p=h>0?-s:Math.min(Math.max(-s,-l),s),g=-h*h+p*(p+2*l)+u):p<=v?(h=0,p=Math.min(Math.max(-s,-l),s),g=p*(p+2*l)+u):(h=Math.max(0,-(o*s+a)),p=h>0?s:Math.min(Math.max(-s,-l),s),g=-h*h+p*(p+2*l)+u);else p=o>0?-s:s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+u;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(d_).addScaledVector(ag,p),g}intersectSphere(e,t){To.subVectors(e.center,this.origin);const r=To.dot(this.direction),i=To.dot(To)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const u=1/this.direction.x,f=1/this.direction.y,h=1/this.direction.z,p=this.origin;return u>=0?(r=(e.min.x-p.x)*u,i=(e.max.x-p.x)*u):(r=(e.max.x-p.x)*u,i=(e.min.x-p.x)*u),f>=0?(s=(e.min.y-p.y)*f,o=(e.max.y-p.y)*f):(s=(e.max.y-p.y)*f,o=(e.min.y-p.y)*f),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-p.z)*h,l=(e.max.z-p.z)*h):(a=(e.max.z-p.z)*h,l=(e.min.z-p.z)*h),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,To)!==null}intersectTriangle(e,t,r,i,s){f_.subVectors(t,e),lg.subVectors(r,e),h_.crossVectors(f_,lg);let o=this.direction.dot(h_),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;ya.subVectors(this.origin,e);const l=a*this.direction.dot(lg.crossVectors(ya,lg));if(l<0)return null;const u=a*this.direction.dot(f_.cross(ya));if(u<0||l+u>o)return null;const f=-a*ya.dot(h_);return f<0?null:this.at(f/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class yt{constructor(e,t,r,i,s,o,a,l,u,f,h,p,g,v,_,x){yt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,u,f,h,p,g,v,_,x)}set(e,t,r,i,s,o,a,l,u,f,h,p,g,v,_,x){const m=this.elements;return m[0]=e,m[4]=t,m[8]=r,m[12]=i,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=u,m[6]=f,m[10]=h,m[14]=p,m[3]=g,m[7]=v,m[11]=_,m[15]=x,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new yt().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/fu.setFromMatrixColumn(e,0).length(),s=1/fu.setFromMatrixColumn(e,1).length(),o=1/fu.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),u=Math.sin(i),f=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const p=o*f,g=o*h,v=a*f,_=a*h;t[0]=l*f,t[4]=-l*h,t[8]=u,t[1]=g+v*u,t[5]=p-_*u,t[9]=-a*l,t[2]=_-p*u,t[6]=v+g*u,t[10]=o*l}else if(e.order==="YXZ"){const p=l*f,g=l*h,v=u*f,_=u*h;t[0]=p+_*a,t[4]=v*a-g,t[8]=o*u,t[1]=o*h,t[5]=o*f,t[9]=-a,t[2]=g*a-v,t[6]=_+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*f,g=l*h,v=u*f,_=u*h;t[0]=p-_*a,t[4]=-o*h,t[8]=v+g*a,t[1]=g+v*a,t[5]=o*f,t[9]=_-p*a,t[2]=-o*u,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*f,g=o*h,v=a*f,_=a*h;t[0]=l*f,t[4]=v*u-g,t[8]=p*u+_,t[1]=l*h,t[5]=_*u+p,t[9]=g*u-v,t[2]=-u,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,g=o*u,v=a*l,_=a*u;t[0]=l*f,t[4]=_-p*h,t[8]=v*h+g,t[1]=h,t[5]=o*f,t[9]=-a*f,t[2]=-u*f,t[6]=g*h+v,t[10]=p-_*h}else if(e.order==="XZY"){const p=o*l,g=o*u,v=a*l,_=a*u;t[0]=l*f,t[4]=-h,t[8]=u*f,t[1]=p*h+_,t[5]=o*f,t[9]=g*h-v,t[2]=v*h-g,t[6]=a*f,t[10]=_*h+p}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(S4,e,w4)}lookAt(e,t,r){const i=this.elements;return bi.subVectors(e,t),bi.lengthSq()===0&&(bi.z=1),bi.normalize(),xa.crossVectors(r,bi),xa.lengthSq()===0&&(Math.abs(r.z)===1?bi.x+=1e-4:bi.z+=1e-4,bi.normalize(),xa.crossVectors(r,bi)),xa.normalize(),cg.crossVectors(bi,xa),i[0]=xa.x,i[4]=cg.x,i[8]=bi.x,i[1]=xa.y,i[5]=cg.y,i[9]=bi.y,i[2]=xa.z,i[6]=cg.z,i[10]=bi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],u=r[12],f=r[1],h=r[5],p=r[9],g=r[13],v=r[2],_=r[6],x=r[10],m=r[14],w=r[3],S=r[7],E=r[11],R=r[15],P=i[0],L=i[4],D=i[8],B=i[12],A=i[1],N=i[5],G=i[9],Q=i[13],V=i[2],Z=i[6],$=i[10],re=i[14],k=i[3],j=i[7],Y=i[11],K=i[15];return s[0]=o*P+a*A+l*V+u*k,s[4]=o*L+a*N+l*Z+u*j,s[8]=o*D+a*G+l*$+u*Y,s[12]=o*B+a*Q+l*re+u*K,s[1]=f*P+h*A+p*V+g*k,s[5]=f*L+h*N+p*Z+g*j,s[9]=f*D+h*G+p*$+g*Y,s[13]=f*B+h*Q+p*re+g*K,s[2]=v*P+_*A+x*V+m*k,s[6]=v*L+_*N+x*Z+m*j,s[10]=v*D+_*G+x*$+m*Y,s[14]=v*B+_*Q+x*re+m*K,s[3]=w*P+S*A+E*V+R*k,s[7]=w*L+S*N+E*Z+R*j,s[11]=w*D+S*G+E*$+R*Y,s[15]=w*B+S*Q+E*re+R*K,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],u=e[13],f=e[2],h=e[6],p=e[10],g=e[14],v=e[3],_=e[7],x=e[11],m=e[15];return v*(+s*l*h-i*u*h-s*a*p+r*u*p+i*a*g-r*l*g)+_*(+t*l*g-t*u*p+s*o*p-i*o*g+i*u*f-s*l*f)+x*(+t*u*h-t*a*g-s*o*h+r*o*g+s*a*f-r*u*f)+m*(-i*a*f-t*l*h+t*a*p+i*o*h-r*o*p+r*l*f)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],u=e[7],f=e[8],h=e[9],p=e[10],g=e[11],v=e[12],_=e[13],x=e[14],m=e[15],w=h*x*u-_*p*u+_*l*g-a*x*g-h*l*m+a*p*m,S=v*p*u-f*x*u-v*l*g+o*x*g+f*l*m-o*p*m,E=f*_*u-v*h*u+v*a*g-o*_*g-f*a*m+o*h*m,R=v*h*l-f*_*l-v*a*p+o*_*p+f*a*x-o*h*x,P=t*w+r*S+i*E+s*R;if(P===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/P;return e[0]=w*L,e[1]=(_*p*s-h*x*s-_*i*g+r*x*g+h*i*m-r*p*m)*L,e[2]=(a*x*s-_*l*s+_*i*u-r*x*u-a*i*m+r*l*m)*L,e[3]=(h*l*s-a*p*s-h*i*u+r*p*u+a*i*g-r*l*g)*L,e[4]=S*L,e[5]=(f*x*s-v*p*s+v*i*g-t*x*g-f*i*m+t*p*m)*L,e[6]=(v*l*s-o*x*s-v*i*u+t*x*u+o*i*m-t*l*m)*L,e[7]=(o*p*s-f*l*s+f*i*u-t*p*u-o*i*g+t*l*g)*L,e[8]=E*L,e[9]=(v*h*s-f*_*s-v*r*g+t*_*g+f*r*m-t*h*m)*L,e[10]=(o*_*s-v*a*s+v*r*u-t*_*u-o*r*m+t*a*m)*L,e[11]=(f*a*s-o*h*s-f*r*u+t*h*u+o*r*g-t*a*g)*L,e[12]=R*L,e[13]=(f*_*i-v*h*i+v*r*p-t*_*p-f*r*x+t*h*x)*L,e[14]=(v*a*i-o*_*i-v*r*l+t*_*l+o*r*x-t*a*x)*L,e[15]=(o*h*i-f*a*i+f*r*l-t*h*l-o*r*p+t*a*p)*L,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,u=s*o,f=s*a;return this.set(u*o+r,u*a-i*l,u*l+i*a,0,u*a+i*l,f*a+r,f*l-i*o,0,u*l-i*a,f*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,u=s+s,f=o+o,h=a+a,p=s*u,g=s*f,v=s*h,_=o*f,x=o*h,m=a*h,w=l*u,S=l*f,E=l*h,R=r.x,P=r.y,L=r.z;return i[0]=(1-(_+m))*R,i[1]=(g+E)*R,i[2]=(v-S)*R,i[3]=0,i[4]=(g-E)*P,i[5]=(1-(p+m))*P,i[6]=(x+w)*P,i[7]=0,i[8]=(v+S)*L,i[9]=(x-w)*L,i[10]=(1-(p+_))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=fu.set(i[0],i[1],i[2]).length();const o=fu.set(i[4],i[5],i[6]).length(),a=fu.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],ps.copy(this);const u=1/s,f=1/o,h=1/a;return ps.elements[0]*=u,ps.elements[1]*=u,ps.elements[2]*=u,ps.elements[4]*=f,ps.elements[5]*=f,ps.elements[6]*=f,ps.elements[8]*=h,ps.elements[9]*=h,ps.elements[10]*=h,t.setFromRotationMatrix(ps),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=ro){const l=this.elements,u=2*s/(t-e),f=2*s/(r-i),h=(t+e)/(t-e),p=(r+i)/(r-i);let g,v;if(a===ro)g=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===zh)g=-o/(o-s),v=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=f,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,r,i,s,o,a=ro){const l=this.elements,u=1/(t-e),f=1/(r-i),h=1/(o-s),p=(t+e)*u,g=(r+i)*f;let v,_;if(a===ro)v=(o+s)*h,_=-2*h;else if(a===zh)v=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*u,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*f,l[9]=0,l[13]=-g,l[2]=0,l[6]=0,l[10]=_,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const fu=new F,ps=new yt,S4=new F(0,0,0),w4=new F(1,1,1),xa=new F,cg=new F,bi=new F,zC=new yt,BC=new Br;class Hp{constructor(e=0,t=0,r=0,i=Hp.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],u=i[5],f=i[9],h=i[2],p=i[6],g=i[10];switch(t){case"XYZ":this._y=Math.asin(Bn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-f,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,u),this._z=0);break;case"YXZ":this._x=Math.asin(-Bn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(a,g),this._z=Math.atan2(l,u)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Bn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,g),this._z=Math.atan2(-o,u)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Bn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,u));break;case"YZX":this._z=Math.asin(Bn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-f,u),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,g));break;case"XZY":this._z=Math.asin(-Bn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,u),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-f,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return zC.makeRotationFromQuaternion(e),this.setFromRotationMatrix(zC,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return BC.setFromEuler(this),this.setFromQuaternion(BC,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Hp.DEFAULT_ORDER="XYZ";class mc{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxGeometryCount=this._maxGeometryCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let u=0,f=l.length;u0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),u.length>0&&(r.textures=u),f.length>0&&(r.images=f),h.length>0&&(r.shapes=h),p.length>0&&(r.skeletons=p),g.length>0&&(r.animations=g),v.length>0&&(r.nodes=v)}return r.object=i,r;function o(a){const l=[];for(const u in a){const f=a[u];delete f.metadata,l.push(f)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){ms.subVectors(i,t),Ao.subVectors(r,t),p_.subVectors(e,t);const o=ms.dot(ms),a=ms.dot(Ao),l=ms.dot(p_),u=Ao.dot(Ao),f=Ao.dot(p_),h=o*u-a*a;if(h===0)return s.set(0,0,0),null;const p=1/h,g=(u*l-a*f)*p,v=(o*f-a*l)*p;return s.set(1-g-v,v,g)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Ro)===null?!1:Ro.x>=0&&Ro.y>=0&&Ro.x+Ro.y<=1}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,Ro)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Ro.x),l.addScaledVector(o,Ro.y),l.addScaledVector(a,Ro.z),l)}static isFrontFacing(e,t,r,i){return ms.subVectors(r,t),Ao.subVectors(e,t),ms.cross(Ao).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return ms.subVectors(this.c,this.b),Ao.subVectors(this.a,this.b),ms.cross(Ao).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Li.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Li.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return Li.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Li.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Li.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;pu.subVectors(i,r),mu.subVectors(s,r),m_.subVectors(e,r);const l=pu.dot(m_),u=mu.dot(m_);if(l<=0&&u<=0)return t.copy(r);g_.subVectors(e,i);const f=pu.dot(g_),h=mu.dot(g_);if(f>=0&&h<=f)return t.copy(i);const p=l*h-f*u;if(p<=0&&l>=0&&f<=0)return o=l/(l-f),t.copy(r).addScaledVector(pu,o);v_.subVectors(e,s);const g=pu.dot(v_),v=mu.dot(v_);if(v>=0&&g<=v)return t.copy(s);const _=g*u-l*v;if(_<=0&&u>=0&&v<=0)return a=u/(u-v),t.copy(r).addScaledVector(mu,a);const x=f*v-g*h;if(x<=0&&h-f>=0&&g-v>=0)return jC.subVectors(s,i),a=(h-f)/(h-f+(g-v)),t.copy(i).addScaledVector(jC,a);const m=1/(x+_+p);return o=_*m,a=p*m,t.copy(r).addScaledVector(pu,o).addScaledVector(mu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const eL={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_a={h:0,s:0,l:0},dg={h:0,s:0,l:0};function y_(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class Fe{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=zn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=ln.workingColorSpace){return this.r=e,this.g=t,this.b=r,ln.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=ln.workingColorSpace){if(e=TM(e,1),t=Bn(t,0,1),r=Bn(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=y_(o,s,e+1/3),this.g=y_(o,s,e),this.b=y_(o,s,e-1/3)}return ln.toWorkingColorSpace(this,i),this}setStyle(e,t=zn){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=zn){const r=eL[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=rd(e.r),this.g=rd(e.g),this.b=rd(e.b),this}copyLinearToSRGB(e){return this.r=o_(e.r),this.g=o_(e.g),this.b=o_(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=zn){return ln.fromWorkingColorSpace(Pr.copy(this),e),Math.round(Bn(Pr.r*255,0,255))*65536+Math.round(Bn(Pr.g*255,0,255))*256+Math.round(Bn(Pr.b*255,0,255))}getHexString(e=zn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ln.workingColorSpace){ln.fromWorkingColorSpace(Pr.copy(this),t);const r=Pr.r,i=Pr.g,s=Pr.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,u;const f=(a+o)/2;if(a===o)l=0,u=0;else{const h=o-a;switch(u=f<=.5?h/(o+a):h/(2-o-a),o){case r:l=(i-s)/h+(i0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==fc&&(r.blending=this.blending),this.side!==Yo&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==Gv&&(r.blendSrc=this.blendSrc),this.blendDst!==jv&&(r.blendDst=this.blendDst),this.blendEquation!==Ia&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Ch&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==x1&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==jl&&(r.stencilFail=this.stencilFail),this.stencilZFail!==jl&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==jl&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class gl extends Er{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Fe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=zp,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const zo=R4();function R4(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const u=l-127;u<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):u<-14?(r[l]=1024>>-u-14,r[l|256]=1024>>-u-14|32768,i[l]=-u-1,i[l|256]=-u-1):u<=15?(r[l]=u+15<<10,r[l|256]=u+15<<10|32768,i[l]=13,i[l|256]=13):u<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let u=l<<13,f=0;for(;!(u&8388608);)u<<=1,f-=8388608;u&=-8388609,f+=947912704,s[l]=u|f}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function ci(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=Bn(n,-65504,65504),zo.floatView[0]=n;const e=zo.uint32View[0],t=e>>23&511;return zo.baseTable[t]+((e&8388607)>>zo.shiftTable[t])}function nh(n){const e=n>>10;return zo.uint32View[0]=zo.mantissaTable[zo.offsetTable[e]+(n&1023)]+zo.exponentTable[e],zo.floatView[0]}const P4={toHalfFloat:ci,fromHalfFloat:nh},Kn=new F,fg=new ge;class on{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=Fh,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=is,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return pc("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const u in l)l[u]!==void 0&&(e[u]=l[u]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const u=r[l];e.data.attributes[l]=u.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const u=this.morphAttributes[l],f=[];for(let h=0,p=u.length;h0&&(i[l]=f,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const u in i){const f=i[u];this.setAttribute(u,f.clone(t))}const s=e.morphAttributes;for(const u in s){const f=[],h=s[u];for(let p=0,g=h.length;p0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(XC.copy(s).invert(),Ol.copy(e.ray).applyMatrix4(XC),!(r.boundingBox!==null&&Ol.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,Ol)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,u=s.attributes.uv,f=s.attributes.uv1,h=s.attributes.normal,p=s.groups,g=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,_=p.length;v<_;v++){const x=p[v],m=o[x.materialIndex],w=Math.max(x.start,g.start),S=Math.min(a.count,Math.min(x.start+x.count,g.start+g.count));for(let E=w,R=S;Et.far?null:{distance:u,point:xg.clone(),object:n}}function _g(n,e,t,r,i,s,o,a,l,u){n.getVertexPosition(a,vu),n.getVertexPosition(l,yu),n.getVertexPosition(u,xu);const f=z4(n,e,t,r,vu,yu,xu,yg);if(f){i&&(mg.fromBufferAttribute(i,a),gg.fromBufferAttribute(i,l),vg.fromBufferAttribute(i,u),f.uv=Li.getInterpolation(yg,vu,yu,xu,mg,gg,vg,new ge)),s&&(mg.fromBufferAttribute(s,a),gg.fromBufferAttribute(s,l),vg.fromBufferAttribute(s,u),f.uv1=Li.getInterpolation(yg,vu,yu,xu,mg,gg,vg,new ge),f.uv2=f.uv1),o&&(YC.fromBufferAttribute(o,a),ZC.fromBufferAttribute(o,l),$C.fromBufferAttribute(o,u),f.normal=Li.getInterpolation(yg,vu,yu,xu,YC,ZC,$C,new F),f.normal.dot(r.direction)>0&&f.normal.multiplyScalar(-1));const h={a,b:l,c:u,normal:new F,materialIndex:0};Li.getNormal(vu,yu,xu,h.normal),f.face=h}return f}class kc extends Dt{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],u=[],f=[],h=[];let p=0,g=0;v("z","y","x",-1,-1,r,t,e,o,s,0),v("z","y","x",1,-1,r,t,-e,o,s,1),v("x","z","y",1,1,e,r,t,i,o,2),v("x","z","y",1,-1,e,r,-t,i,o,3),v("x","y","z",1,-1,e,t,r,i,s,4),v("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new nt(u,3)),this.setAttribute("normal",new nt(f,3)),this.setAttribute("uv",new nt(h,2));function v(_,x,m,w,S,E,R,P,L,D,B){const A=E/L,N=R/D,G=E/2,Q=R/2,V=P/2,Z=L+1,$=D+1;let re=0,k=0;const j=new F;for(let Y=0;Y<$;Y++){const K=Y*N-Q;for(let ae=0;ae0?1:-1,f.push(j.x,j.y,j.z),h.push(ae/L),h.push(1-Y/D),re+=1}}for(let Y=0;Y0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class Yd extends rn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new yt,this.projectionMatrix=new yt,this.projectionMatrixInverse=new yt,this.coordinateSystem=ro}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Sa=new F,KC=new ge,QC=new ge;class Rn extends Yd{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Rd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(hc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Rd*2*Math.atan(Math.tan(hc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){Sa.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Sa.x,Sa.y).multiplyScalar(-e/Sa.z),Sa.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Sa.x,Sa.y).multiplyScalar(-e/Sa.z)}getViewSize(e,t){return this.getViewBounds(e,KC,QC),t.subVectors(QC,KC)}setViewOffset(e,t,r,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(hc*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,u=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/u,i*=o.width/l,r*=o.height/u}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const _u=-90,Su=1;class rL extends rn{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Rn(_u,Su,e,t);i.layers=this.layers,this.add(i);const s=new Rn(_u,Su,e,t);s.layers=this.layers,this.add(s);const o=new Rn(_u,Su,e,t);o.layers=this.layers,this.add(o);const a=new Rn(_u,Su,e,t);a.layers=this.layers,this.add(a);const l=new Rn(_u,Su,e,t);l.layers=this.layers,this.add(l);const u=new Rn(_u,Su,e,t);u.layers=this.layers,this.add(u)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const u of t)this.remove(u);if(e===ro)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===zh)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const u of t)this.add(u),u.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,u,f]=this.children,h=e.getRenderTarget(),p=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const _=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(t,s),e.setRenderTarget(r,1,i),e.render(t,o),e.setRenderTarget(r,2,i),e.render(t,a),e.setRenderTarget(r,3,i),e.render(t,l),e.setRenderTarget(r,4,i),e.render(t,u),r.texture.generateMipmaps=_,e.setRenderTarget(r,5,i),e.render(t,f),e.setRenderTarget(h,p,g),e.xr.enabled=v,r.texture.needsPMREMUpdate=!0}}class Wp extends In{constructor(e,t,r,i,s,o,a,l,u,f){e=e!==void 0?e:[],t=t!==void 0?t:Zo,super(e,t,r,i,s,o,a,l,u,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class iL extends yi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];t.encoding!==void 0&&(pc("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Ga?zn:Ii),this.texture=new Wp(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:fn}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `,fragmentShader:` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `},i=new kc(5,5,5),s=new as({name:"CubemapFromEquirect",uniforms:Pd(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Jr,blending:io});s.uniforms.tEquirect.value=t;const o=new qn(i,s),a=t.minFilter;return t.minFilter===no&&(t.minFilter=fn),new rL(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,i);e.setRenderTarget(s)}}const S_=new F,W4=new F,G4=new zt;class Qs{constructor(e=new F(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=S_.subVectors(r,t).cross(W4.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta(S_),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||G4.getNormalMatrix(e),i=this.coplanarPoint(S_).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const kl=new Vr,Sg=new F;class Gp{constructor(e=new Qs,t=new Qs,r=new Qs,i=new Qs,s=new Qs,o=new Qs){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=ro){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],u=i[4],f=i[5],h=i[6],p=i[7],g=i[8],v=i[9],_=i[10],x=i[11],m=i[12],w=i[13],S=i[14],E=i[15];if(r[0].setComponents(l-s,p-u,x-g,E-m).normalize(),r[1].setComponents(l+s,p+u,x+g,E+m).normalize(),r[2].setComponents(l+o,p+f,x+v,E+w).normalize(),r[3].setComponents(l-o,p-f,x-v,E-w).normalize(),r[4].setComponents(l-a,p-h,x-_,E-S).normalize(),t===ro)r[5].setComponents(l+a,p+h,x+_,E+S).normalize();else if(t===zh)r[5].setComponents(a,h,_,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),kl.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),kl.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(kl)}intersectsSprite(e){return kl.center.set(0,0,0),kl.radius=.7071067811865476,kl.applyMatrix4(e.matrixWorld),this.intersectsSphere(kl)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)0?e.max.x:e.min.x,Sg.y=i.normal.y>0?e.max.y:e.min.y,Sg.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Sg)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function sL(){let n=null,e=!1,t=null,r=null;function i(s,o){t(s,o),r=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(r=n.requestAnimationFrame(i),e=!0)},stop:function(){n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function j4(n,e){const t=e.isWebGL2,r=new WeakMap;function i(u,f){const h=u.array,p=u.usage,g=h.byteLength,v=n.createBuffer();n.bindBuffer(f,v),n.bufferData(f,h,p),u.onUploadCallback();let _;if(h instanceof Float32Array)_=n.FLOAT;else if(h instanceof Uint16Array)if(u.isFloat16BufferAttribute)if(t)_=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)_=n.SHORT;else if(h instanceof Uint32Array)_=n.UNSIGNED_INT;else if(h instanceof Int32Array)_=n.INT;else if(h instanceof Int8Array)_=n.BYTE;else if(h instanceof Uint8Array)_=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)_=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:v,type:_,bytesPerElement:h.BYTES_PER_ELEMENT,version:u.version,size:g}}function s(u,f,h){const p=f.array,g=f._updateRange,v=f.updateRanges;if(n.bindBuffer(h,u),g.count===-1&&v.length===0&&n.bufferSubData(h,0,p),v.length!==0){for(let _=0,x=v.length;_ 0 - vec4 plane; - #ifdef ALPHA_TO_COVERAGE - float distanceToPlane, distanceGradient; - float clipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - if ( clipOpacity == 0.0 ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - float unionClipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - } - #pragma unroll_loop_end - clipOpacity *= 1.0 - unionClipOpacity; - #endif - diffuseColor.a *= clipOpacity; - if ( diffuseColor.a == 0.0 ) discard; - #else - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif - #endif -#endif`,l5=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,c5=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,u5=`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,d5=`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,f5=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,h5=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - varying vec3 vColor; -#endif`,p5=`#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif`,m5=`#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); -} -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; -}; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; -}; -#ifdef USE_ALPHAHASH - varying vec3 vPosition; -#endif -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); -} -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); -} -mat3 transposeMat3( const in mat3 m ) { - mat3 tmp; - tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); - tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); - tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); - return tmp; -} -float luminance( const in vec3 rgb ) { - const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); - return dot( weights, rgb ); -} -bool isPerspectiveMatrix( mat4 m ) { - return m[ 2 ][ 3 ] == - 1.0; -} -vec2 equirectUv( in vec3 dir ) { - float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; - float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; - return vec2( u, v ); -} -vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; -} -vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} -float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,g5=`#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define cubeUV_r0 1.0 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= cubeUV_r1 ) { - mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; - } else if ( roughness >= cubeUV_r4 ) { - mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; - } else if ( roughness >= cubeUV_r5 ) { - mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; - } else if ( roughness >= cubeUV_r6 ) { - mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`,v5=`vec3 transformedNormal = objectNormal; -#ifdef USE_TANGENT - vec3 transformedTangent = objectTangent; -#endif -#ifdef USE_BATCHING - mat3 bm = mat3( batchingMatrix ); - transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); - transformedNormal = bm * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = bm * transformedTangent; - #endif -#endif -#ifdef USE_INSTANCING - mat3 im = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); - transformedNormal = im * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = im * transformedTangent; - #endif -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`,y5=`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,x5=`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,_5=`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,S5=`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,w5="gl_FragColor = linearToOutputTexel( gl_FragColor );",M5=` -const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( - vec3( 0.8224621, 0.177538, 0.0 ), - vec3( 0.0331941, 0.9668058, 0.0 ), - vec3( 0.0170827, 0.0723974, 0.9105199 ) -); -const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( - vec3( 1.2249401, - 0.2249404, 0.0 ), - vec3( - 0.0420569, 1.0420571, 0.0 ), - vec3( - 0.0196376, - 0.0786361, 1.0982735 ) -); -vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { - return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); -} -vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { - return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); -} -vec4 LinearTransferOETF( in vec4 value ) { - return value; -} -vec4 sRGBTransferOETF( in vec4 value ) { - return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -} -vec4 LinearToLinear( in vec4 value ) { - return value; -} -vec4 LinearTosRGB( in vec4 value ) { - return sRGBTransferOETF( value ); -}`,E5=`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vec3 cameraToFrag; - if ( isOrthographic ) { - cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToFrag = normalize( vWorldPosition - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); - #else - vec4 envColor = vec4( 0.0 ); - #endif - #ifdef ENVMAP_BLENDING_MULTIPLY - outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_MIX ) - outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_ADD ) - outgoingLight += envColor.xyz * specularStrength * reflectivity; - #endif -#endif`,b5=`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,T5=`#ifdef USE_ENVMAP - uniform float reflectivity; - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - varying vec3 vWorldPosition; - uniform float refractionRatio; - #else - varying vec3 vReflect; - #endif -#endif`,C5=`#ifdef USE_ENVMAP - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - - varying vec3 vWorldPosition; - #else - varying vec3 vReflect; - uniform float refractionRatio; - #endif -#endif`,A5=`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vWorldPosition = worldPosition.xyz; - #else - vec3 cameraToVertex; - if ( isOrthographic ) { - cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`,R5=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,P5=`#ifdef USE_FOG - varying float vFogDepth; -#endif`,I5=`#ifdef USE_FOG - #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); - #else - float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); - #endif - gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,L5=`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,N5=`#ifdef USE_GRADIENTMAP - uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { - float dotNL = dot( normal, lightDirection ); - vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); - #ifdef USE_GRADIENTMAP - return vec3( texture2D( gradientMap, coord ).r ); - #else - vec2 fw = fwidth( coord ) * 0.5; - return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); - #endif -}`,D5=`#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,O5=`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,k5=`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,U5=`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,F5=`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -#if defined( USE_LIGHT_PROBES ) - uniform vec3 lightProbe[ 9 ]; -#endif -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - #if defined ( LEGACY_LIGHTS ) - if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { - return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); - } - return 1.0; - #else - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; - #endif -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometryPosition; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometryPosition; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif`,z5=`#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); - reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - #ifdef USE_ANISOTROPY - vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 bentNormal = cross( bitangent, viewDir ); - bentNormal = normalize( cross( bentNormal, bitangent ) ); - bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); - return getIBLRadiance( viewDir, bentNormal, roughness ); - #else - return vec3( 0.0 ); - #endif - } - #endif -#endif`,B5=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,V5=`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,H5=`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,W5=`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,G5=`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - material.ior = ior; - #ifdef USE_SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULAR_COLORMAP - specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEEN_COLORMAP - material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); - #ifdef USE_SHEEN_ROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; - #endif -#endif -#ifdef USE_ANISOTROPY - #ifdef USE_ANISOTROPYMAP - mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); - vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; - vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; - #else - vec2 anisotropyV = anisotropyVector; - #endif - material.anisotropy = length( anisotropyV ); - if( material.anisotropy == 0.0 ) { - anisotropyV = vec2( 1.0, 0.0 ); - } else { - anisotropyV /= material.anisotropy; - material.anisotropy = saturate( material.anisotropy ); - } - material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); - material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; - material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,j5=`struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif - #ifdef IOR - float ior; - #endif - #ifdef USE_TRANSMISSION - float transmission; - float transmissionAlpha; - float thickness; - float attenuationDistance; - vec3 attenuationColor; - #endif - #ifdef USE_ANISOTROPY - float anisotropy; - float alphaT; - vec3 anisotropyT; - vec3 anisotropyB; - #endif -}; -vec3 clearcoatSpecularDirect = vec3( 0.0 ); -vec3 clearcoatSpecularIndirect = vec3( 0.0 ); -vec3 sheenSpecularDirect = vec3( 0.0 ); -vec3 sheenSpecularIndirect = vec3(0.0 ); -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -#ifdef USE_ANISOTROPY - float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { - float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); - float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); - float v = 0.5 / ( gv + gl ); - return saturate(v); - } - float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { - float a2 = alphaT * alphaB; - highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); - highp float v2 = dot( v, v ); - float w2 = a2 / v2; - return RECIPROCAL_PI * a2 * pow2 ( w2 ); - } -#endif -#ifdef USE_CLEARCOAT - vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { - vec3 f0 = material.clearcoatF0; - float f90 = material.clearcoatF90; - float roughness = material.clearcoatRoughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); - } -#endif -vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { - vec3 f0 = material.specularColor; - float f90 = material.specularF90; - float roughness = material.roughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - #ifdef USE_IRIDESCENCE - F = mix( F, material.iridescenceFresnel, material.iridescence ); - #endif - #ifdef USE_ANISOTROPY - float dotTL = dot( material.anisotropyT, lightDir ); - float dotTV = dot( material.anisotropyT, viewDir ); - float dotTH = dot( material.anisotropyT, halfDir ); - float dotBL = dot( material.anisotropyB, lightDir ); - float dotBV = dot( material.anisotropyB, viewDir ); - float dotBH = dot( material.anisotropyB, halfDir ); - float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); - float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); - #else - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - #endif - return F * ( V * D ); -} -vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { - const float LUT_SIZE = 64.0; - const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; - const float LUT_BIAS = 0.5 / LUT_SIZE; - float dotNV = saturate( dot( N, V ) ); - vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); - uv = uv * LUT_SCALE + LUT_BIAS; - return uv; -} -float LTC_ClippedSphereFormFactor( const in vec3 f ) { - float l = length( f ); - return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); -} -vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { - float x = dot( v1, v2 ); - float y = abs( x ); - float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; - float b = 3.4175940 + ( 4.1616724 + y ) * y; - float v = a / b; - float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; - return cross( v1, v2 ) * theta_sintheta; -} -vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { - vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; - vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; - vec3 lightNormal = cross( v1, v2 ); - if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); - vec3 T1, T2; - T1 = normalize( V - N * dot( V, N ) ); - T2 = - cross( N, T1 ); - mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); - vec3 coords[ 4 ]; - coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); - coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); - coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); - coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); - coords[ 0 ] = normalize( coords[ 0 ] ); - coords[ 1 ] = normalize( coords[ 1 ] ); - coords[ 2 ] = normalize( coords[ 2 ] ); - coords[ 3 ] = normalize( coords[ 3 ] ); - vec3 vectorFormFactor = vec3( 0.0 ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); - float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); - return vec3( result ); -} -#if defined( USE_SHEEN ) -float D_Charlie( float roughness, float dotNH ) { - float alpha = pow2( roughness ); - float invAlpha = 1.0 / alpha; - float cos2h = dotNH * dotNH; - float sin2h = max( 1.0 - cos2h, 0.0078125 ); - return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); -} -float V_Neubelt( float dotNV, float dotNL ) { - return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); -} -vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float D = D_Charlie( sheenRoughness, dotNH ); - float V = V_Neubelt( dotNV, dotNL ); - return sheenColor * ( D * V ); -} -#endif -float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - float r2 = roughness * roughness; - float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; - float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; - float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); - return saturate( DG * RECIPROCAL_PI ); -} -vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); - const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); - vec4 r = roughness * c0 + c1; - float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; - return fab; -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - vec2 fab = DFGApprox( normal, viewDir, roughness ); - return specularColor * fab.x + specularF90 * fab.y; -} -#ifdef USE_IRIDESCENCE -void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#else -void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#endif - vec2 fab = DFGApprox( normal, viewDir, roughness ); - #ifdef USE_IRIDESCENCE - vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); - #else - vec3 Fr = specularColor; - #endif - vec3 FssEss = Fr * fab.x + specularF90 * fab.y; - float Ess = fab.x + fab.y; - float Ems = 1.0 - Ess; - vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); - singleScatter += FssEss; - multiScatter += Fms * Ems; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometryNormal; - vec3 viewDir = geometryViewDir; - vec3 position = geometryPosition; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); - #endif - vec3 totalScattering = singleScattering + multiScattering; - vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); - reflectedLight.indirectSpecular += radiance * singleScattering; - reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; - reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; -} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#define RE_IndirectSpecular RE_IndirectSpecular_Physical -float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { - return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,X5=` -vec3 geometryPosition = - vViewPosition; -vec3 geometryNormal = normal; -vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -vec3 geometryClearcoatNormal = vec3( 0.0 ); -#ifdef USE_CLEARCOAT - geometryClearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometryViewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometryPosition, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometryPosition, directLight ); - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - #if defined( USE_LIGHT_PROBES ) - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - #endif - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,q5=`#if defined( RE_IndirectDiffuse ) - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - irradiance += lightMapIrradiance; - #endif - #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getIBLIrradiance( geometryNormal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,Y5=`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,Z5=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,$5=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,K5=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - varying float vFragDepth; - varying float vIsPerspective; - #else - uniform float logDepthBufFC; - #endif -#endif`,Q5=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); - #else - if ( isPerspectiveMatrix( projectionMatrix ) ) { - gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; - gl_Position.z *= gl_Position.w; - } - #endif -#endif`,J5=`#ifdef USE_MAP - vec4 sampledDiffuseColor = texture2D( map, vMapUv ); - #ifdef DECODE_VIDEO_TEXTURE - sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); - - #endif - diffuseColor *= sampledDiffuseColor; -#endif`,eV=`#ifdef USE_MAP - uniform sampler2D map; -#endif`,tV=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - #if defined( USE_POINTS_UV ) - vec2 uv = vUv; - #else - vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; - #endif -#endif -#ifdef USE_MAP - diffuseColor *= texture2D( map, uv ); -#endif -#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,nV=`#if defined( USE_POINTS_UV ) - varying vec2 vUv; -#else - #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - uniform mat3 uvTransform; - #endif -#endif -#ifdef USE_MAP - uniform sampler2D map; -#endif -#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`,rV=`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,iV=`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,sV=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`,oV=`#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } - #else - objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; - objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; - objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; - objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; - #endif -#endif`,aV=`#ifdef USE_MORPHTARGETS - uniform float morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } - #else - #ifndef USE_MORPHNORMALS - uniform float morphTargetInfluences[ 8 ]; - #else - uniform float morphTargetInfluences[ 4 ]; - #endif - #endif -#endif`,lV=`#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - #ifdef MORPHTARGETS_TEXTURE - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } - #else - transformed += morphTarget0 * morphTargetInfluences[ 0 ]; - transformed += morphTarget1 * morphTargetInfluences[ 1 ]; - transformed += morphTarget2 * morphTargetInfluences[ 2 ]; - transformed += morphTarget3 * morphTargetInfluences[ 3 ]; - #ifndef USE_MORPHNORMALS - transformed += morphTarget4 * morphTargetInfluences[ 4 ]; - transformed += morphTarget5 * morphTargetInfluences[ 5 ]; - transformed += morphTarget6 * morphTargetInfluences[ 6 ]; - transformed += morphTarget7 * morphTargetInfluences[ 7 ]; - #endif - #endif -#endif`,cV=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; -#ifdef FLAT_SHADED - vec3 fdx = dFdx( vViewPosition ); - vec3 fdy = dFdy( vViewPosition ); - vec3 normal = normalize( cross( fdx, fdy ) ); -#else - vec3 normal = normalize( vNormal ); - #ifdef DOUBLE_SIDED - normal *= faceDirection; - #endif -#endif -#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) - #ifdef USE_TANGENT - mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn = getTangentFrame( - vViewPosition, normal, - #if defined( USE_NORMALMAP ) - vNormalMapUv - #elif defined( USE_CLEARCOAT_NORMALMAP ) - vClearcoatNormalMapUv - #else - vUv - #endif - ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn[0] *= faceDirection; - tbn[1] *= faceDirection; - #endif -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - #ifdef USE_TANGENT - mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - #endif -#endif -vec3 nonPerturbedNormal = normal;`,uV=`#ifdef USE_NORMALMAP_OBJECTSPACE - normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - #ifdef FLIP_SIDED - normal = - normal; - #endif - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - normal = normalize( normalMatrix * normal ); -#elif defined( USE_NORMALMAP_TANGENTSPACE ) - vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - normal = normalize( tbn * mapN ); -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,dV=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,fV=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,hV=`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,pV=`#ifdef USE_NORMALMAP - uniform sampler2D normalMap; - uniform vec2 normalScale; -#endif -#ifdef USE_NORMALMAP_OBJECTSPACE - uniform mat3 normalMatrix; -#endif -#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) - mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { - vec3 q0 = dFdx( eye_pos.xyz ); - vec3 q1 = dFdy( eye_pos.xyz ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - vec3 N = surf_norm; - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); - return mat3( T * scale, B * scale, N ); - } -#endif`,mV=`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,gV=`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,vV=`#ifdef USE_CLEARCOATMAP - uniform sampler2D clearcoatMap; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearcoatNormalMap; - uniform vec2 clearcoatNormalScale; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform sampler2D clearcoatRoughnessMap; -#endif`,yV=`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,xV=`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,_V=`vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; -const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); -const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); -const float ShiftRight8 = 1. / 256.; -vec4 packDepthToRGBA( const in float v ) { - vec4 r = vec4( fract( v * PackFactors ), v ); - r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors ); -} -vec2 packDepthToRG( in highp float v ) { - return packDepthToRGBA( v ).yx; -} -float unpackRGToDepth( const in highp vec2 v ) { - return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); -} -vec4 pack2HalfToRGBA( vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { - return depth * ( near - far ) - near; -} -float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { - return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); -} -float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { - return ( near * far ) / ( ( far - near ) * depth - far ); -}`,SV=`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,wV=`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_BATCHING - mvPosition = batchingMatrix * mvPosition; -#endif -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,MV=`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,EV=`#ifdef DITHERING - vec3 dithering( vec3 color ) { - float grid_position = rand( gl_FragCoord.xy ); - vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); - dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); - return color + dither_shift_RGB; - } -#endif`,bV=`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,TV=`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,CV=`#if NUM_SPOT_LIGHT_COORDS > 0 - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#if NUM_SPOT_LIGHT_MAPS > 0 - uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { - return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); - } - vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { - return unpackRGBATo2Half( texture2D( shadow, uv ) ); - } - float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ - float occlusion = 1.0; - vec2 distribution = texture2DDistribution( shadow, uv ); - float hard_shadow = step( compare , distribution.x ); - if (hard_shadow != 1.0 ) { - float distance = compare - distribution.x ; - float variance = max( 0.00000, distribution.y * distribution.y ); - float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); - } - return occlusion; - } - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; - bool frustumTest = inFrustum && shadowCoord.z <= 1.0; - if ( frustumTest ) { - #if defined( SHADOWMAP_TYPE_PCF ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx0 = - texelSize.x * shadowRadius; - float dy0 = - texelSize.y * shadowRadius; - float dx1 = + texelSize.x * shadowRadius; - float dy1 = + texelSize.y * shadowRadius; - float dx2 = dx0 / 2.0; - float dy2 = dy0 / 2.0; - float dx3 = dx1 / 2.0; - float dy3 = dy1 / 2.0; - shadow = ( - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) - ) * ( 1.0 / 17.0 ); - #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx = texelSize.x; - float dy = texelSize.y; - vec2 uv = shadowCoord.xy; - vec2 f = fract( uv * shadowMapSize + 0.5 ); - uv -= f * texelSize; - shadow = ( - texture2DCompare( shadowMap, uv, shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), - f.x ), - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), - f.x ), - f.y ) - ) * ( 1.0 / 9.0 ); - #elif defined( SHADOWMAP_TYPE_VSM ) - shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); - #else - shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); - #endif - } - return shadow; - } - vec2 cubeToUV( vec3 v, float texelSizeY ) { - vec3 absV = abs( v ); - float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); - absV *= scaleToCube; - v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); - vec2 planar = v.xy; - float almostATexel = 1.5 * texelSizeY; - float almostOne = 1.0 - almostATexel; - if ( absV.z >= almostOne ) { - if ( v.z > 0.0 ) - planar.x = 4.0 - v.x; - } else if ( absV.x >= almostOne ) { - float signX = sign( v.x ); - planar.x = v.z * signX + 2.0 * signX; - } else if ( absV.y >= almostOne ) { - float signY = sign( v.y ); - planar.x = v.x + 2.0 * signY + 2.0; - planar.y = v.z * signY - 2.0; - } - return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); - } - float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - vec3 lightToPosition = shadowCoord.xyz; - float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - return ( - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) - ) * ( 1.0 / 9.0 ); - #else - return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } -#endif`,AV=`#if NUM_SPOT_LIGHT_COORDS > 0 - uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`,RV=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) - vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - vec4 shadowWorldPosition; -#endif -#if defined( USE_SHADOWMAP ) - #if NUM_DIR_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); - vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); - vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif -#endif -#if NUM_SPOT_LIGHT_COORDS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { - shadowWorldPosition = worldPosition; - #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; - #endif - vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end -#endif`,PV=`float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`,IV=`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,LV=`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - mat4 getBoneMatrix( const in float i ) { - int size = textureSize( boneTexture, 0 ).x; - int j = int( i ) * 4; - int x = j % size; - int y = j / size; - vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); - vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); - vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); - vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); - return mat4( v1, v2, v3, v4 ); - } -#endif`,NV=`#ifdef USE_SKINNING - vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); - vec4 skinned = vec4( 0.0 ); - skinned += boneMatX * skinVertex * skinWeight.x; - skinned += boneMatY * skinVertex * skinWeight.y; - skinned += boneMatZ * skinVertex * skinWeight.z; - skinned += boneMatW * skinVertex * skinWeight.w; - transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,DV=`#ifdef USE_SKINNING - mat4 skinMatrix = mat4( 0.0 ); - skinMatrix += skinWeight.x * boneMatX; - skinMatrix += skinWeight.y * boneMatY; - skinMatrix += skinWeight.z * boneMatZ; - skinMatrix += skinWeight.w * boneMatW; - skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; - objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; - #ifdef USE_TANGENT - objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #endif -#endif`,OV=`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,kV=`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,UV=`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,FV=`#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return saturate( toneMappingExposure * color ); -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 OptimizedCineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -vec3 RRTAndODTFit( vec3 v ) { - vec3 a = v * ( v + 0.0245786 ) - 0.000090537; - vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; - return a / b; -} -vec3 ACESFilmicToneMapping( vec3 color ) { - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( - vec3( 1.6605, - 0.1246, - 0.0182 ), - vec3( - 0.5876, 1.1329, - 0.1006 ), - vec3( - 0.0728, - 0.0083, 1.1187 ) -); -const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( - vec3( 0.6274, 0.0691, 0.0164 ), - vec3( 0.3293, 0.9195, 0.0880 ), - vec3( 0.0433, 0.0113, 0.8956 ) -); -vec3 agxDefaultContrastApprox( vec3 x ) { - vec3 x2 = x * x; - vec3 x4 = x2 * x2; - return + 15.5 * x4 * x2 - - 40.14 * x4 * x - + 31.96 * x4 - - 6.868 * x2 * x - + 0.4298 * x2 - + 0.1191 * x - - 0.00232; -} -vec3 AgXToneMapping( vec3 color ) { - const mat3 AgXInsetMatrix = mat3( - vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), - vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), - vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) - ); - const mat3 AgXOutsetMatrix = mat3( - vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), - vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), - vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) - ); - const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; - color *= toneMappingExposure; - color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; - color = AgXInsetMatrix * color; - color = max( color, 1e-10 ); color = log2( color ); - color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); - color = clamp( color, 0.0, 1.0 ); - color = agxDefaultContrastApprox( color ); - color = AgXOutsetMatrix * color; - color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); - color = LINEAR_REC2020_TO_LINEAR_SRGB * color; - color = clamp( color, 0.0, 1.0 ); - return color; -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,zV=`#ifdef USE_TRANSMISSION - material.transmission = transmission; - material.transmissionAlpha = 1.0; - material.thickness = thickness; - material.attenuationDistance = attenuationDistance; - material.attenuationColor = attenuationColor; - #ifdef USE_TRANSMISSIONMAP - material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; - #endif - #ifdef USE_THICKNESSMAP - material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; - #endif - vec3 pos = vWorldPosition; - vec3 v = normalize( cameraPosition - pos ); - vec3 n = inverseTransformDirection( normal, viewMatrix ); - vec4 transmitted = getIBLVolumeRefraction( - n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,BV=`#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - float w0( float a ) { - return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); - } - float w1( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); - } - float w2( float a ){ - return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); - } - float w3( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * a ); - } - float g0( float a ) { - return w0( a ) + w1( a ); - } - float g1( float a ) { - return w2( a ) + w3( a ); - } - float h0( float a ) { - return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); - } - float h1( float a ) { - return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); - } - vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { - uv = uv * texelSize.zw + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - float g0x = g0( fuv.x ); - float g1x = g1( fuv.x ); - float h0x = h0( fuv.x ); - float h1x = h1( fuv.x ); - float h0y = h0( fuv.y ); - float h1y = h1( fuv.y ); - vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + - g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); - } - vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { - vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); - vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); - vec2 fLodSizeInv = 1.0 / fLodSize; - vec2 cLodSizeInv = 1.0 / cLodSize; - vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); - vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); - return mix( fSample, cSample, fract( lod ) ); - } - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); - } - vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( isinf( attenuationDistance ) ) { - return vec3( 1.0 ); - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - vec3 attenuatedColor = transmittance * transmittedLight.rgb; - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; - return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); - } -#endif`,VV=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - varying vec2 vNormalMapUv; -#endif -#ifdef USE_EMISSIVEMAP - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_SPECULARMAP - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,HV=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - uniform mat3 mapTransform; - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - uniform mat3 alphaMapTransform; - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - uniform mat3 lightMapTransform; - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - uniform mat3 aoMapTransform; - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - uniform mat3 bumpMapTransform; - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - uniform mat3 normalMapTransform; - varying vec2 vNormalMapUv; -#endif -#ifdef USE_DISPLACEMENTMAP - uniform mat3 displacementMapTransform; - varying vec2 vDisplacementMapUv; -#endif -#ifdef USE_EMISSIVEMAP - uniform mat3 emissiveMapTransform; - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - uniform mat3 metalnessMapTransform; - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - uniform mat3 roughnessMapTransform; - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - uniform mat3 anisotropyMapTransform; - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - uniform mat3 clearcoatMapTransform; - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform mat3 clearcoatNormalMapTransform; - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform mat3 clearcoatRoughnessMapTransform; - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - uniform mat3 sheenColorMapTransform; - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - uniform mat3 sheenRoughnessMapTransform; - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - uniform mat3 iridescenceMapTransform; - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform mat3 iridescenceThicknessMapTransform; - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SPECULARMAP - uniform mat3 specularMapTransform; - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - uniform mat3 specularColorMapTransform; - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - uniform mat3 specularIntensityMapTransform; - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,WV=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - vUv = vec3( uv, 1 ).xy; -#endif -#ifdef USE_MAP - vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ALPHAMAP - vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_LIGHTMAP - vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_AOMAP - vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_BUMPMAP - vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_NORMALMAP - vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_DISPLACEMENTMAP - vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_EMISSIVEMAP - vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_METALNESSMAP - vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ROUGHNESSMAP - vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ANISOTROPYMAP - vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOATMAP - vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCEMAP - vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_COLORMAP - vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULARMAP - vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_COLORMAP - vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_TRANSMISSIONMAP - vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_THICKNESSMAP - vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,GV=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 - vec4 worldPosition = vec4( transformed, 1.0 ); - #ifdef USE_BATCHING - worldPosition = batchingMatrix * worldPosition; - #endif - #ifdef USE_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`;const jV=`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,XV=`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,qV=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,YV=`#ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; -#elif defined( ENVMAP_TYPE_CUBE_UV ) - uniform sampler2D envMap; -#endif -uniform float flipEnvMap; -uniform float backgroundBlurriness; -uniform float backgroundIntensity; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,ZV=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,$V=`uniform samplerCube tCube; -uniform float tFlip; -uniform float opacity; -varying vec3 vWorldDirection; -void main() { - vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); - gl_FragColor = texColor; - gl_FragColor.a *= opacity; - #include - #include -}`,KV=`#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,QV=`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - vec4 diffuseColor = vec4( 1.0 ); - #include - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #endif -}`,JV=`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,eH=`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,tH=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,nH=`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,rH=`uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,iH=`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,sH=`#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,oH=`uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`,aH=`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,lH=`#define LAMBERT -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,cH=`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`,uH=`#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`,dH=`#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`,fH=`#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,hH=`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,pH=`#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,mH=`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,gH=`#define STANDARD -#ifdef PHYSICAL - #define IOR - #define USE_SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef USE_SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULAR_COLORMAP - uniform sampler2D specularColorMap; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEEN_COLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEEN_ROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -#ifdef USE_ANISOTROPY - uniform vec2 anisotropyVector; - #ifdef USE_ANISOTROPYMAP - uniform sampler2D anisotropyMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,vH=`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,yH=`#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,xH=`uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV - varying vec2 vUv; - uniform mat3 uvTransform; -#endif -void main() { - #ifdef USE_POINTS_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`,_H=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,SH=`#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,wH=`uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`,MH=`uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); - vec2 scale; - scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); - scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`,EH=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`,Ut={alphahash_fragment:X4,alphahash_pars_fragment:q4,alphamap_fragment:Y4,alphamap_pars_fragment:Z4,alphatest_fragment:$4,alphatest_pars_fragment:K4,aomap_fragment:Q4,aomap_pars_fragment:J4,batching_pars_vertex:e5,batching_vertex:t5,begin_vertex:n5,beginnormal_vertex:r5,bsdfs:i5,iridescence_fragment:s5,bumpmap_pars_fragment:o5,clipping_planes_fragment:a5,clipping_planes_pars_fragment:l5,clipping_planes_pars_vertex:c5,clipping_planes_vertex:u5,color_fragment:d5,color_pars_fragment:f5,color_pars_vertex:h5,color_vertex:p5,common:m5,cube_uv_reflection_fragment:g5,defaultnormal_vertex:v5,displacementmap_pars_vertex:y5,displacementmap_vertex:x5,emissivemap_fragment:_5,emissivemap_pars_fragment:S5,colorspace_fragment:w5,colorspace_pars_fragment:M5,envmap_fragment:E5,envmap_common_pars_fragment:b5,envmap_pars_fragment:T5,envmap_pars_vertex:C5,envmap_physical_pars_fragment:z5,envmap_vertex:A5,fog_vertex:R5,fog_pars_vertex:P5,fog_fragment:I5,fog_pars_fragment:L5,gradientmap_pars_fragment:N5,lightmap_fragment:D5,lightmap_pars_fragment:O5,lights_lambert_fragment:k5,lights_lambert_pars_fragment:U5,lights_pars_begin:F5,lights_toon_fragment:B5,lights_toon_pars_fragment:V5,lights_phong_fragment:H5,lights_phong_pars_fragment:W5,lights_physical_fragment:G5,lights_physical_pars_fragment:j5,lights_fragment_begin:X5,lights_fragment_maps:q5,lights_fragment_end:Y5,logdepthbuf_fragment:Z5,logdepthbuf_pars_fragment:$5,logdepthbuf_pars_vertex:K5,logdepthbuf_vertex:Q5,map_fragment:J5,map_pars_fragment:eV,map_particle_fragment:tV,map_particle_pars_fragment:nV,metalnessmap_fragment:rV,metalnessmap_pars_fragment:iV,morphcolor_vertex:sV,morphnormal_vertex:oV,morphtarget_pars_vertex:aV,morphtarget_vertex:lV,normal_fragment_begin:cV,normal_fragment_maps:uV,normal_pars_fragment:dV,normal_pars_vertex:fV,normal_vertex:hV,normalmap_pars_fragment:pV,clearcoat_normal_fragment_begin:mV,clearcoat_normal_fragment_maps:gV,clearcoat_pars_fragment:vV,iridescence_pars_fragment:yV,opaque_fragment:xV,packing:_V,premultiplied_alpha_fragment:SV,project_vertex:wV,dithering_fragment:MV,dithering_pars_fragment:EV,roughnessmap_fragment:bV,roughnessmap_pars_fragment:TV,shadowmap_pars_fragment:CV,shadowmap_pars_vertex:AV,shadowmap_vertex:RV,shadowmask_pars_fragment:PV,skinbase_vertex:IV,skinning_pars_vertex:LV,skinning_vertex:NV,skinnormal_vertex:DV,specularmap_fragment:OV,specularmap_pars_fragment:kV,tonemapping_fragment:UV,tonemapping_pars_fragment:FV,transmission_fragment:zV,transmission_pars_fragment:BV,uv_pars_fragment:VV,uv_pars_vertex:HV,uv_vertex:WV,worldpos_vertex:GV,background_vert:jV,background_frag:XV,backgroundCube_vert:qV,backgroundCube_frag:YV,cube_vert:ZV,cube_frag:$V,depth_vert:KV,depth_frag:QV,distanceRGBA_vert:JV,distanceRGBA_frag:eH,equirect_vert:tH,equirect_frag:nH,linedashed_vert:rH,linedashed_frag:iH,meshbasic_vert:sH,meshbasic_frag:oH,meshlambert_vert:aH,meshlambert_frag:lH,meshmatcap_vert:cH,meshmatcap_frag:uH,meshnormal_vert:dH,meshnormal_frag:fH,meshphong_vert:hH,meshphong_frag:pH,meshphysical_vert:mH,meshphysical_frag:gH,meshtoon_vert:vH,meshtoon_frag:yH,points_vert:xH,points_frag:_H,shadow_vert:SH,shadow_frag:wH,sprite_vert:MH,sprite_frag:EH},ze={common:{diffuse:{value:new Fe(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new zt},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new zt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new zt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new zt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new zt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new zt},normalScale:{value:new ge(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new zt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new zt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new zt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new zt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Fe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Fe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0},uvTransform:{value:new zt}},sprite:{diffuse:{value:new Fe(16777215)},opacity:{value:1},center:{value:new ge(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new zt},alphaMap:{value:null},alphaMapTransform:{value:new zt},alphaTest:{value:0}}},ws={basic:{uniforms:Yr([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.fog]),vertexShader:Ut.meshbasic_vert,fragmentShader:Ut.meshbasic_frag},lambert:{uniforms:Yr([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new Fe(0)}}]),vertexShader:Ut.meshlambert_vert,fragmentShader:Ut.meshlambert_frag},phong:{uniforms:Yr([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new Fe(0)},specular:{value:new Fe(1118481)},shininess:{value:30}}]),vertexShader:Ut.meshphong_vert,fragmentShader:Ut.meshphong_frag},standard:{uniforms:Yr([ze.common,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.roughnessmap,ze.metalnessmap,ze.fog,ze.lights,{emissive:{value:new Fe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ut.meshphysical_vert,fragmentShader:Ut.meshphysical_frag},toon:{uniforms:Yr([ze.common,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.gradientmap,ze.fog,ze.lights,{emissive:{value:new Fe(0)}}]),vertexShader:Ut.meshtoon_vert,fragmentShader:Ut.meshtoon_frag},matcap:{uniforms:Yr([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,{matcap:{value:null}}]),vertexShader:Ut.meshmatcap_vert,fragmentShader:Ut.meshmatcap_frag},points:{uniforms:Yr([ze.points,ze.fog]),vertexShader:Ut.points_vert,fragmentShader:Ut.points_frag},dashed:{uniforms:Yr([ze.common,ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ut.linedashed_vert,fragmentShader:Ut.linedashed_frag},depth:{uniforms:Yr([ze.common,ze.displacementmap]),vertexShader:Ut.depth_vert,fragmentShader:Ut.depth_frag},normal:{uniforms:Yr([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,{opacity:{value:1}}]),vertexShader:Ut.meshnormal_vert,fragmentShader:Ut.meshnormal_frag},sprite:{uniforms:Yr([ze.sprite,ze.fog]),vertexShader:Ut.sprite_vert,fragmentShader:Ut.sprite_frag},background:{uniforms:{uvTransform:{value:new zt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ut.background_vert,fragmentShader:Ut.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ut.backgroundCube_vert,fragmentShader:Ut.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ut.cube_vert,fragmentShader:Ut.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ut.equirect_vert,fragmentShader:Ut.equirect_frag},distanceRGBA:{uniforms:Yr([ze.common,ze.displacementmap,{referencePosition:{value:new F},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ut.distanceRGBA_vert,fragmentShader:Ut.distanceRGBA_frag},shadow:{uniforms:Yr([ze.lights,ze.fog,{color:{value:new Fe(0)},opacity:{value:1}}]),vertexShader:Ut.shadow_vert,fragmentShader:Ut.shadow_frag}};ws.physical={uniforms:Yr([ws.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new zt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new zt},clearcoatNormalScale:{value:new ge(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new zt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new zt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new zt},sheen:{value:0},sheenColor:{value:new Fe(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new zt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new zt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new zt},transmissionSamplerSize:{value:new ge},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new zt},attenuationDistance:{value:0},attenuationColor:{value:new Fe(0)},specularColor:{value:new Fe(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new zt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new zt},anisotropyVector:{value:new ge},anisotropyMap:{value:null},anisotropyMapTransform:{value:new zt}}]),vertexShader:Ut.meshphysical_vert,fragmentShader:Ut.meshphysical_frag};const wg={r:0,b:0,g:0};function bH(n,e,t,r,i,s,o){const a=new Fe(0);let l=s===!0?0:1,u,f,h=null,p=0,g=null;function v(x,m){let w=!1,S=m.isScene===!0?m.background:null;S&&S.isTexture&&(S=(m.backgroundBlurriness>0?t:e).get(S)),S===null?_(a,l):S&&S.isColor&&(_(S,1),w=!0);const E=n.xr.getEnvironmentBlendMode();E==="additive"?r.buffers.color.setClear(0,0,0,1,o):E==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(n.autoClear||w)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),S&&(S.isCubeTexture||S.mapping===qd)?(f===void 0&&(f=new qn(new kc(1,1,1),new as({name:"BackgroundCubeMaterial",uniforms:Pd(ws.backgroundCube.uniforms),vertexShader:ws.backgroundCube.vertexShader,fragmentShader:ws.backgroundCube.fragmentShader,side:Jr,depthTest:!1,depthWrite:!1,fog:!1})),f.geometry.deleteAttribute("normal"),f.geometry.deleteAttribute("uv"),f.onBeforeRender=function(R,P,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(f.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(f)),f.material.uniforms.envMap.value=S,f.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,f.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,f.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,f.material.toneMapped=ln.getTransfer(S.colorSpace)!==mn,(h!==S||p!==S.version||g!==n.toneMapping)&&(f.material.needsUpdate=!0,h=S,p=S.version,g=n.toneMapping),f.layers.enableAll(),x.unshift(f,f.geometry,f.material,0,0,null)):S&&S.isTexture&&(u===void 0&&(u=new qn(new Zd(2,2),new as({name:"BackgroundMaterial",uniforms:Pd(ws.background.uniforms),vertexShader:ws.background.vertexShader,fragmentShader:ws.background.fragmentShader,side:Yo,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),Object.defineProperty(u.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(u)),u.material.uniforms.t2D.value=S,u.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,u.material.toneMapped=ln.getTransfer(S.colorSpace)!==mn,S.matrixAutoUpdate===!0&&S.updateMatrix(),u.material.uniforms.uvTransform.value.copy(S.matrix),(h!==S||p!==S.version||g!==n.toneMapping)&&(u.material.needsUpdate=!0,h=S,p=S.version,g=n.toneMapping),u.layers.enableAll(),x.unshift(u,u.geometry,u.material,0,0,null))}function _(x,m){x.getRGB(wg,tL(n)),r.buffers.color.setClear(wg.r,wg.g,wg.b,m,o)}return{getClearColor:function(){return a},setClearColor:function(x,m=1){a.set(x),l=m,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(x){l=x,_(a,l)},render:v}}function TH(n,e,t,r){const i=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=x(null);let u=l,f=!1;function h(V,Z,$,re,k){let j=!1;if(o){const Y=_(re,$,Z);u!==Y&&(u=Y,g(u.object)),j=m(V,re,$,k),j&&w(V,re,$,k)}else{const Y=Z.wireframe===!0;(u.geometry!==re.id||u.program!==$.id||u.wireframe!==Y)&&(u.geometry=re.id,u.program=$.id,u.wireframe=Y,j=!0)}k!==null&&t.update(k,n.ELEMENT_ARRAY_BUFFER),(j||f)&&(f=!1,D(V,Z,$,re),k!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(k).buffer))}function p(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function g(V){return r.isWebGL2?n.bindVertexArray(V):s.bindVertexArrayOES(V)}function v(V){return r.isWebGL2?n.deleteVertexArray(V):s.deleteVertexArrayOES(V)}function _(V,Z,$){const re=$.wireframe===!0;let k=a[V.id];k===void 0&&(k={},a[V.id]=k);let j=k[Z.id];j===void 0&&(j={},k[Z.id]=j);let Y=j[re];return Y===void 0&&(Y=x(p()),j[re]=Y),Y}function x(V){const Z=[],$=[],re=[];for(let k=0;k=0){const ne=k[ae];let he=j[ae];if(he===void 0&&(ae==="instanceMatrix"&&V.instanceMatrix&&(he=V.instanceMatrix),ae==="instanceColor"&&V.instanceColor&&(he=V.instanceColor)),ne===void 0||ne.attribute!==he||he&&ne.data!==he.data)return!0;Y++}return u.attributesNum!==Y||u.index!==re}function w(V,Z,$,re){const k={},j=Z.attributes;let Y=0;const K=$.getAttributes();for(const ae in K)if(K[ae].location>=0){let ne=j[ae];ne===void 0&&(ae==="instanceMatrix"&&V.instanceMatrix&&(ne=V.instanceMatrix),ae==="instanceColor"&&V.instanceColor&&(ne=V.instanceColor));const he={};he.attribute=ne,ne&&ne.data&&(he.data=ne.data),k[ae]=he,Y++}u.attributes=k,u.attributesNum=Y,u.index=re}function S(){const V=u.newAttributes;for(let Z=0,$=V.length;Z<$;Z++)V[Z]=0}function E(V){R(V,0)}function R(V,Z){const $=u.newAttributes,re=u.enabledAttributes,k=u.attributeDivisors;$[V]=1,re[V]===0&&(n.enableVertexAttribArray(V),re[V]=1),k[V]!==Z&&((r.isWebGL2?n:e.get("ANGLE_instanced_arrays"))[r.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](V,Z),k[V]=Z)}function P(){const V=u.newAttributes,Z=u.enabledAttributes;for(let $=0,re=Z.length;$=0){let _e=k[K];if(_e===void 0&&(K==="instanceMatrix"&&V.instanceMatrix&&(_e=V.instanceMatrix),K==="instanceColor"&&V.instanceColor&&(_e=V.instanceColor)),_e!==void 0){const ne=_e.normalized,he=_e.itemSize,be=t.get(_e);if(be===void 0)continue;const me=be.buffer,Pe=be.type,Le=be.bytesPerElement,Ae=r.isWebGL2===!0&&(Pe===n.INT||Pe===n.UNSIGNED_INT||_e.gpuType===gM);if(_e.isInterleavedBufferAttribute){const Ce=_e.data,H=Ce.stride,xe=_e.offset;if(Ce.isInstancedInterleavedBuffer){for(let fe=0;fe0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";L="mediump"}return L==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const u=o||e.has("WEBGL_draw_buffers"),f=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=n.getParameter(n.MAX_TEXTURE_SIZE),v=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),_=n.getParameter(n.MAX_VERTEX_ATTRIBS),x=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),m=n.getParameter(n.MAX_VARYING_VECTORS),w=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),S=p>0,E=o||e.has("OES_texture_float"),R=S&&E,P=o?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:u,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:f,maxTextures:h,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:v,maxAttributes:_,maxVertexUniforms:x,maxVaryings:m,maxFragmentUniforms:w,vertexTextures:S,floatFragmentTextures:E,floatVertexTextures:R,maxSamples:P}}function RH(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new Qs,a=new zt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,p){const g=h.length!==0||p||r!==0||i;return i=p,r=h.length,g},this.beginShadows=function(){s=!0,f(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,p){t=f(h,p,0)},this.setState=function(h,p,g){const v=h.clippingPlanes,_=h.clipIntersection,x=h.clipShadows,m=n.get(h);if(!i||v===null||v.length===0||s&&!x)s?f(null):u();else{const w=s?0:r,S=w*4;let E=m.clippingState||null;l.value=E,E=f(v,p,S,g);for(let R=0;R!==S;++R)E[R]=t[R];m.clippingState=E,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=w}};function u(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function f(h,p,g,v){const _=h!==null?h.length:0;let x=null;if(_!==0){if(x=l.value,v!==!0||x===null){const m=g+_*4,w=p.matrixWorldInverse;a.getNormalMatrix(w),(x===null||x.length0){const u=new iL(l.height);return u.fromEquirectangularTexture(n,o),e.set(o,u),o.addEventListener("dispose",i),t(u.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class Vo extends Yd{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const u=(this.right-this.left)/this.view.fullWidth/this.zoom,f=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=u*this.view.offsetX,o=s+u*this.view.width,a-=f*this.view.offsetY,l=a-f*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const zu=4,JC=[.125,.215,.35,.446,.526,.582],$l=20,w_=new Vo,eA=new Fe;let M_=null,E_=0,b_=0;const Xl=(1+Math.sqrt(5))/2,wu=1/Xl,tA=[new F(1,1,1),new F(-1,1,1),new F(1,1,-1),new F(-1,1,-1),new F(0,Xl,wu),new F(0,Xl,-wu),new F(wu,0,Xl),new F(-wu,0,Xl),new F(Xl,wu,0),new F(-Xl,wu,0)];class w1{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100){M_=this._renderer.getRenderTarget(),E_=this._renderer.getActiveCubeFace(),b_=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=iA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=rA(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),f.setRenderTarget(i),_&&f.render(v,a),f.render(e,a)}v.geometry.dispose(),v.material.dispose(),f.toneMapping=p,f.autoClear=h,e.background=x}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Zo||e.mapping===nl;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=iA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=rA());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new qn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Mg(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,w_)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;i$l&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${x} samples when the maximum is set to ${$l}`);const m=[];let w=0;for(let L=0;L<$l;++L){const D=L/_,B=Math.exp(-D*D/2);m.push(B),L===0?w+=B:LS-zu?i-S+zu:0),P=4*(this._cubeSize-E);Mg(t,R,P,3*E,2*E),l.setRenderTarget(t),l.render(h,w_)}}function IH(n){const e=[],t=[],r=[];let i=n;const s=n-zu+1+JC.length;for(let o=0;on-zu?l=JC[o-n+zu-1]:o===0&&(l=0),r.push(l);const u=1/(a-2),f=-u,h=1+u,p=[f,f,h,f,h,h,f,f,h,h,f,h],g=6,v=6,_=3,x=2,m=1,w=new Float32Array(_*v*g),S=new Float32Array(x*v*g),E=new Float32Array(m*v*g);for(let P=0;P2?0:-1,B=[L,D,0,L+2/3,D,0,L+2/3,D+1,0,L,D,0,L+2/3,D+1,0,L,D+1,0];w.set(B,_*v*P),S.set(p,x*v*P);const A=[P,P,P,P,P,P];E.set(A,m*v*P)}const R=new Dt;R.setAttribute("position",new on(w,_)),R.setAttribute("uv",new on(S,x)),R.setAttribute("faceIndex",new on(E,m)),e.push(R),i>zu&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function nA(n,e,t){const r=new yi(n,e,t);return r.texture.mapping=qd,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Mg(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function LH(n,e,t){const r=new Float32Array($l),i=new F(0,1,0);return new as({name:"SphericalGaussianBlur",defines:{n:$l,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:IM(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - `,blending:io,depthTest:!1,depthWrite:!1})}function rA(){return new as({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:IM(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `,blending:io,depthTest:!1,depthWrite:!1})}function iA(){return new as({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:IM(),fragmentShader:` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - `,blending:io,depthTest:!1,depthWrite:!1})}function IM(){return` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - `}function NH(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,u=l===Ah||l===Rh,f=l===Zo||l===nl;if(u||f)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new w1(n)),h=u?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(u&&h&&h.height>0||f&&h&&i(h)){t===null&&(t=new w1(n));const p=u?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,p),a.addEventListener("dispose",s),p.texture}else return null}}}return a}function i(a){let l=0;const u=6;for(let f=0;fe.maxTextureSize&&(A=Math.ceil(B/e.maxTextureSize),B=e.maxTextureSize);const N=new Float32Array(B*A*4*v),G=new K0(N,B,A,v);G.type=is,G.needsUpdate=!0;const Q=D*4;for(let Z=0;Z0)return n;const i=e*t;let s=sA[i];if(s===void 0&&(s=new Float32Array(i),sA[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function rr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` -`)}function OW(n){const e=ln.getPrimaries(ln.workingColorSpace),t=ln.getPrimaries(n);let r;switch(e===t?r="":e===Uh&&t===kh?r="LinearDisplayP3ToLinearSRGB":e===kh&&t===Uh&&(r="LinearSRGBToLinearDisplayP3"),n){case hi:case Vp:return[r,"LinearTransferOETF"];case zn:case $0:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[r,"LinearTransferOETF"]}}function fA(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` - -`+i+` - -`+DW(n.getShaderSource(e),o)}else return i}function kW(n,e){const t=OW(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function UW(n,e){let t;switch(e){case MI:t="Linear";break;case EI:t="Reinhard";break;case bI:t="OptimizedCineon";break;case mM:t="ACESFilmic";break;case CI:t="AgX";break;case TI:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function FW(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.alphaToCoverage||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Bu).join(` -`)}function zW(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Bu).join(` -`)}function BW(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` -`)}function VW(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function M1(n){return n.replace(HW,GW)}const WW=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function GW(n,e){let t=Ut[e];if(t===void 0){const r=WW.get(e);if(r!==void 0)t=Ut[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return M1(t)}const jW=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function mA(n){return n.replace(jW,XW)}function XW(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(m+=` -`),w=[g,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_].filter(Bu).join(` -`),w.length>0&&(w+=` -`)):(m=[gA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+f:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(Bu).join(` -`),w=[g,gA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",t.envMap?"#define "+h:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==so?"#define TONE_MAPPING":"",t.toneMapping!==so?Ut.tonemapping_pars_fragment:"",t.toneMapping!==so?UW("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Ut.colorspace_pars_fragment,kW("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(Bu).join(` -`)),o=M1(o),o=hA(o,t),o=pA(o,t),a=M1(a),a=hA(a,t),a=pA(a,t),o=mA(o),a=mA(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(S=`#version 300 es -`,m=[v,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+m,w=["precision mediump sampler2DArray;","#define varying in",t.glslVersion===_1?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===_1?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` -`)+` -`+w);const E=S+m+o,R=S+w+a,P=dA(i,i.VERTEX_SHADER,E),L=dA(i,i.FRAGMENT_SHADER,R);i.attachShader(x,P),i.attachShader(x,L),t.index0AttributeName!==void 0?i.bindAttribLocation(x,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(x,0,"position"),i.linkProgram(x);function D(G){if(n.debug.checkShaderErrors){const Q=i.getProgramInfoLog(x).trim(),V=i.getShaderInfoLog(P).trim(),Z=i.getShaderInfoLog(L).trim();let $=!0,re=!0;if(i.getProgramParameter(x,i.LINK_STATUS)===!1)if($=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,x,P,L);else{const k=fA(i,P,"vertex"),j=fA(i,L,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(x,i.VALIDATE_STATUS)+` - -Material Name: `+G.name+` -Material Type: `+G.type+` - -Program Info Log: `+Q+` -`+k+` -`+j)}else Q!==""?console.warn("THREE.WebGLProgram: Program Info Log:",Q):(V===""||Z==="")&&(re=!1);re&&(G.diagnostics={runnable:$,programLog:Q,vertexShader:{log:V,prefix:m},fragmentShader:{log:Z,prefix:w}})}i.deleteShader(P),i.deleteShader(L),B=new Rv(i,x),A=VW(i,x)}let B;this.getUniforms=function(){return B===void 0&&D(this),B};let A;this.getAttributes=function(){return A===void 0&&D(this),A};let N=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return N===!1&&(N=i.getProgramParameter(x,LW)),N},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(x),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=NW++,this.cacheKey=e,this.usedTimes=1,this.program=x,this.vertexShader=P,this.fragmentShader=L,this}let JW=0;class eG{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new tG(e),t.set(e,r)),r}}class tG{constructor(e){this.id=JW++,this.code=e,this.usedTimes=0}}function nG(n,e,t,r,i,s,o){const a=new mc,l=new eG,u=new Set,f=[],h=i.isWebGL2,p=i.logarithmicDepthBuffer,g=i.vertexTextures;let v=i.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function x(A){return u.add(A),A===0?"uv":`uv${A}`}function m(A,N,G,Q,V){const Z=Q.fog,$=V.geometry,re=A.isMeshStandardMaterial?Q.environment:null,k=(A.isMeshStandardMaterial?t:e).get(A.envMap||re),j=k&&k.mapping===qd?k.image.height:null,Y=_[A.type];A.precision!==null&&(v=i.getMaxPrecision(A.precision),v!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",v,"instead."));const K=$.morphAttributes.position||$.morphAttributes.normal||$.morphAttributes.color,ae=K!==void 0?K.length:0;let _e=0;$.morphAttributes.position!==void 0&&(_e=1),$.morphAttributes.normal!==void 0&&(_e=2),$.morphAttributes.color!==void 0&&(_e=3);let ne,he,be,me;if(Y){const qt=ws[Y];ne=qt.vertexShader,he=qt.fragmentShader}else ne=A.vertexShader,he=A.fragmentShader,l.update(A),be=l.getVertexShaderID(A),me=l.getFragmentShaderID(A);const Pe=n.getRenderTarget(),Le=V.isInstancedMesh===!0,Ae=V.isBatchedMesh===!0,Ce=!!A.map,H=!!A.matcap,xe=!!k,fe=!!A.aoMap,Te=!!A.lightMap,ve=!!A.bumpMap,Xe=!!A.normalMap,Ue=!!A.displacementMap,U=!!A.emissiveMap,O=!!A.metalnessMap,ie=!!A.roughnessMap,Ee=A.anisotropy>0,we=A.clearcoat>0,Se=A.iridescence>0,Ze=A.sheen>0,Oe=A.transmission>0,Ve=Ee&&!!A.anisotropyMap,rt=we&&!!A.clearcoatMap,ht=we&&!!A.clearcoatNormalMap,Me=we&&!!A.clearcoatRoughnessMap,Ot=Se&&!!A.iridescenceMap,_t=Se&&!!A.iridescenceThicknessMap,dt=Ze&&!!A.sheenColorMap,Je=Ze&&!!A.sheenRoughnessMap,q=!!A.specularMap,ye=!!A.specularColorMap,Be=!!A.specularIntensityMap,it=Oe&&!!A.transmissionMap,at=Oe&&!!A.thicknessMap,Vt=!!A.gradientMap,X=!!A.alphaMap,ke=A.alphaTest>0,Ne=!!A.alphaHash,je=!!A.extensions;let et=so;A.toneMapped&&(Pe===null||Pe.isXRRenderTarget===!0)&&(et=n.toneMapping);const Gt={isWebGL2:h,shaderID:Y,shaderType:A.type,shaderName:A.name,vertexShader:ne,fragmentShader:he,defines:A.defines,customVertexShaderID:be,customFragmentShaderID:me,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:v,batching:Ae,instancing:Le,instancingColor:Le&&V.instanceColor!==null,supportsVertexTextures:g,outputColorSpace:Pe===null?n.outputColorSpace:Pe.isXRRenderTarget===!0?Pe.texture.colorSpace:hi,alphaToCoverage:!!A.alphaToCoverage,map:Ce,matcap:H,envMap:xe,envMapMode:xe&&k.mapping,envMapCubeUVHeight:j,aoMap:fe,lightMap:Te,bumpMap:ve,normalMap:Xe,displacementMap:g&&Ue,emissiveMap:U,normalMapObjectSpace:Xe&&A.normalMapType===HI,normalMapTangentSpace:Xe&&A.normalMapType===ml,metalnessMap:O,roughnessMap:ie,anisotropy:Ee,anisotropyMap:Ve,clearcoat:we,clearcoatMap:rt,clearcoatNormalMap:ht,clearcoatRoughnessMap:Me,iridescence:Se,iridescenceMap:Ot,iridescenceThicknessMap:_t,sheen:Ze,sheenColorMap:dt,sheenRoughnessMap:Je,specularMap:q,specularColorMap:ye,specularIntensityMap:Be,transmission:Oe,transmissionMap:it,thicknessMap:at,gradientMap:Vt,opaque:A.transparent===!1&&A.blending===fc&&A.alphaToCoverage===!1,alphaMap:X,alphaTest:ke,alphaHash:Ne,combine:A.combine,mapUv:Ce&&x(A.map.channel),aoMapUv:fe&&x(A.aoMap.channel),lightMapUv:Te&&x(A.lightMap.channel),bumpMapUv:ve&&x(A.bumpMap.channel),normalMapUv:Xe&&x(A.normalMap.channel),displacementMapUv:Ue&&x(A.displacementMap.channel),emissiveMapUv:U&&x(A.emissiveMap.channel),metalnessMapUv:O&&x(A.metalnessMap.channel),roughnessMapUv:ie&&x(A.roughnessMap.channel),anisotropyMapUv:Ve&&x(A.anisotropyMap.channel),clearcoatMapUv:rt&&x(A.clearcoatMap.channel),clearcoatNormalMapUv:ht&&x(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Me&&x(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Ot&&x(A.iridescenceMap.channel),iridescenceThicknessMapUv:_t&&x(A.iridescenceThicknessMap.channel),sheenColorMapUv:dt&&x(A.sheenColorMap.channel),sheenRoughnessMapUv:Je&&x(A.sheenRoughnessMap.channel),specularMapUv:q&&x(A.specularMap.channel),specularColorMapUv:ye&&x(A.specularColorMap.channel),specularIntensityMapUv:Be&&x(A.specularIntensityMap.channel),transmissionMapUv:it&&x(A.transmissionMap.channel),thicknessMapUv:at&&x(A.thicknessMap.channel),alphaMapUv:X&&x(A.alphaMap.channel),vertexTangents:!!$.attributes.tangent&&(Xe||Ee),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!$.attributes.color&&$.attributes.color.itemSize===4,pointsUvs:V.isPoints===!0&&!!$.attributes.uv&&(Ce||X),fog:!!Z,useFog:A.fog===!0,fogExp2:!!Z&&Z.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:p,skinning:V.isSkinnedMesh===!0,morphTargets:$.morphAttributes.position!==void 0,morphNormals:$.morphAttributes.normal!==void 0,morphColors:$.morphAttributes.color!==void 0,morphTargetsCount:ae,morphTextureStride:_e,numDirLights:N.directional.length,numPointLights:N.point.length,numSpotLights:N.spot.length,numSpotLightMaps:N.spotLightMap.length,numRectAreaLights:N.rectArea.length,numHemiLights:N.hemi.length,numDirLightShadows:N.directionalShadowMap.length,numPointLightShadows:N.pointShadowMap.length,numSpotLightShadows:N.spotShadowMap.length,numSpotLightShadowsWithMaps:N.numSpotLightShadowsWithMaps,numLightProbes:N.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:n.shadowMap.enabled&&G.length>0,shadowMapType:n.shadowMap.type,toneMapping:et,useLegacyLights:n._useLegacyLights,decodeVideoTexture:Ce&&A.map.isVideoTexture===!0&&ln.getTransfer(A.map.colorSpace)===mn,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===Js,flipSided:A.side===Jr,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:je&&A.extensions.derivatives===!0,extensionFragDepth:je&&A.extensions.fragDepth===!0,extensionDrawBuffers:je&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:je&&A.extensions.shaderTextureLOD===!0,extensionClipCullDistance:je&&A.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:je&&A.extensions.multiDraw===!0&&r.has("WEBGL_multi_draw"),rendererExtensionFragDepth:h||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||r.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return Gt.vertexUv1s=u.has(1),Gt.vertexUv2s=u.has(2),Gt.vertexUv3s=u.has(3),u.clear(),Gt}function w(A){const N=[];if(A.shaderID?N.push(A.shaderID):(N.push(A.customVertexShaderID),N.push(A.customFragmentShaderID)),A.defines!==void 0)for(const G in A.defines)N.push(G),N.push(A.defines[G]);return A.isRawShaderMaterial===!1&&(S(N,A),E(N,A),N.push(n.outputColorSpace)),N.push(A.customProgramCacheKey),N.join()}function S(A,N){A.push(N.precision),A.push(N.outputColorSpace),A.push(N.envMapMode),A.push(N.envMapCubeUVHeight),A.push(N.mapUv),A.push(N.alphaMapUv),A.push(N.lightMapUv),A.push(N.aoMapUv),A.push(N.bumpMapUv),A.push(N.normalMapUv),A.push(N.displacementMapUv),A.push(N.emissiveMapUv),A.push(N.metalnessMapUv),A.push(N.roughnessMapUv),A.push(N.anisotropyMapUv),A.push(N.clearcoatMapUv),A.push(N.clearcoatNormalMapUv),A.push(N.clearcoatRoughnessMapUv),A.push(N.iridescenceMapUv),A.push(N.iridescenceThicknessMapUv),A.push(N.sheenColorMapUv),A.push(N.sheenRoughnessMapUv),A.push(N.specularMapUv),A.push(N.specularColorMapUv),A.push(N.specularIntensityMapUv),A.push(N.transmissionMapUv),A.push(N.thicknessMapUv),A.push(N.combine),A.push(N.fogExp2),A.push(N.sizeAttenuation),A.push(N.morphTargetsCount),A.push(N.morphAttributeCount),A.push(N.numDirLights),A.push(N.numPointLights),A.push(N.numSpotLights),A.push(N.numSpotLightMaps),A.push(N.numHemiLights),A.push(N.numRectAreaLights),A.push(N.numDirLightShadows),A.push(N.numPointLightShadows),A.push(N.numSpotLightShadows),A.push(N.numSpotLightShadowsWithMaps),A.push(N.numLightProbes),A.push(N.shadowMapType),A.push(N.toneMapping),A.push(N.numClippingPlanes),A.push(N.numClipIntersection),A.push(N.depthPacking)}function E(A,N){a.disableAll(),N.isWebGL2&&a.enable(0),N.supportsVertexTextures&&a.enable(1),N.instancing&&a.enable(2),N.instancingColor&&a.enable(3),N.matcap&&a.enable(4),N.envMap&&a.enable(5),N.normalMapObjectSpace&&a.enable(6),N.normalMapTangentSpace&&a.enable(7),N.clearcoat&&a.enable(8),N.iridescence&&a.enable(9),N.alphaTest&&a.enable(10),N.vertexColors&&a.enable(11),N.vertexAlphas&&a.enable(12),N.vertexUv1s&&a.enable(13),N.vertexUv2s&&a.enable(14),N.vertexUv3s&&a.enable(15),N.vertexTangents&&a.enable(16),N.anisotropy&&a.enable(17),N.alphaHash&&a.enable(18),N.batching&&a.enable(19),A.push(a.mask),a.disableAll(),N.fog&&a.enable(0),N.useFog&&a.enable(1),N.flatShading&&a.enable(2),N.logarithmicDepthBuffer&&a.enable(3),N.skinning&&a.enable(4),N.morphTargets&&a.enable(5),N.morphNormals&&a.enable(6),N.morphColors&&a.enable(7),N.premultipliedAlpha&&a.enable(8),N.shadowMapEnabled&&a.enable(9),N.useLegacyLights&&a.enable(10),N.doubleSided&&a.enable(11),N.flipSided&&a.enable(12),N.useDepthPacking&&a.enable(13),N.dithering&&a.enable(14),N.transmission&&a.enable(15),N.sheen&&a.enable(16),N.opaque&&a.enable(17),N.pointsUvs&&a.enable(18),N.decodeVideoTexture&&a.enable(19),N.alphaToCoverage&&a.enable(20),A.push(a.mask)}function R(A){const N=_[A.type];let G;if(N){const Q=ws[N];G=nL.clone(Q.uniforms)}else G=A.uniforms;return G}function P(A,N){let G;for(let Q=0,V=f.length;Q0?r.push(m):g.transparent===!0?i.push(m):t.push(m)}function l(h,p,g,v,_,x){const m=o(h,p,g,v,_,x);g.transmission>0?r.unshift(m):g.transparent===!0?i.unshift(m):t.unshift(m)}function u(h,p){t.length>1&&t.sort(h||iG),r.length>1&&r.sort(p||vA),i.length>1&&i.sort(p||vA)}function f(){for(let h=e,p=n.length;h=s.length?(o=new yA,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function oG(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new F,color:new Fe};break;case"SpotLight":t={position:new F,direction:new F,color:new Fe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new F,color:new Fe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new F,skyColor:new Fe,groundColor:new Fe};break;case"RectAreaLight":t={color:new Fe,position:new F,halfWidth:new F,halfHeight:new F};break}return n[e.id]=t,t}}}function aG(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ge,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let lG=0;function cG(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function uG(n,e){const t=new oG,r=aG(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let f=0;f<9;f++)i.probe.push(new F);const s=new F,o=new yt,a=new yt;function l(f,h){let p=0,g=0,v=0;for(let G=0;G<9;G++)i.probe[G].set(0,0,0);let _=0,x=0,m=0,w=0,S=0,E=0,R=0,P=0,L=0,D=0,B=0;f.sort(cG);const A=h===!0?Math.PI:1;for(let G=0,Q=f.length;G0&&(e.isWebGL2?n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ze.LTC_FLOAT_1,i.rectAreaLTC2=ze.LTC_FLOAT_2):(i.rectAreaLTC1=ze.LTC_HALF_1,i.rectAreaLTC2=ze.LTC_HALF_2):n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ze.LTC_FLOAT_1,i.rectAreaLTC2=ze.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=ze.LTC_HALF_1,i.rectAreaLTC2=ze.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=p,i.ambient[1]=g,i.ambient[2]=v;const N=i.hash;(N.directionalLength!==_||N.pointLength!==x||N.spotLength!==m||N.rectAreaLength!==w||N.hemiLength!==S||N.numDirectionalShadows!==E||N.numPointShadows!==R||N.numSpotShadows!==P||N.numSpotMaps!==L||N.numLightProbes!==B)&&(i.directional.length=_,i.spot.length=m,i.rectArea.length=w,i.point.length=x,i.hemi.length=S,i.directionalShadow.length=E,i.directionalShadowMap.length=E,i.pointShadow.length=R,i.pointShadowMap.length=R,i.spotShadow.length=P,i.spotShadowMap.length=P,i.directionalShadowMatrix.length=E,i.pointShadowMatrix.length=R,i.spotLightMatrix.length=P+L-D,i.spotLightMap.length=L,i.numSpotLightShadowsWithMaps=D,i.numLightProbes=B,N.directionalLength=_,N.pointLength=x,N.spotLength=m,N.rectAreaLength=w,N.hemiLength=S,N.numDirectionalShadows=E,N.numPointShadows=R,N.numSpotShadows=P,N.numSpotMaps=L,N.numLightProbes=B,i.version=lG++)}function u(f,h){let p=0,g=0,v=0,_=0,x=0;const m=h.matrixWorldInverse;for(let w=0,S=f.length;w=a.length?(l=new xA(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class LM extends Er{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=BI,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class NM extends Er{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const fG=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,hG=`uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -void main() { - const float samples = float( VSM_SAMPLES ); - float mean = 0.0; - float squared_mean = 0.0; - float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); - float uvStart = samples <= 1.0 ? 0.0 : - 1.0; - for ( float i = 0.0; i < samples; i ++ ) { - float uvOffset = uvStart + i * uvStride; - #ifdef HORIZONTAL_PASS - vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( squared_mean - mean * mean ); - gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function pG(n,e,t){let r=new Gp;const i=new ge,s=new ge,o=new sn,a=new LM({depthPacking:VI}),l=new NM,u={},f=t.maxTextureSize,h={[Yo]:Jr,[Jr]:Yo,[Js]:Js},p=new as({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ge},radius:{value:4}},vertexShader:fG,fragmentShader:hG}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const v=new Dt;v.setAttribute("position",new on(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new qn(v,p),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=q0;let m=this.type;this.render=function(P,L,D){if(x.enabled===!1||x.autoUpdate===!1&&x.needsUpdate===!1||P.length===0)return;const B=n.getRenderTarget(),A=n.getActiveCubeFace(),N=n.getActiveMipmapLevel(),G=n.state;G.setBlending(io),G.buffers.color.setClear(1,1,1,1),G.buffers.depth.setTest(!0),G.setScissorTest(!1);const Q=m!==ys&&this.type===ys,V=m===ys&&this.type!==ys;for(let Z=0,$=P.length;Z<$;Z++){const re=P[Z],k=re.shadow;if(k===void 0){console.warn("THREE.WebGLShadowMap:",re,"has no shadow.");continue}if(k.autoUpdate===!1&&k.needsUpdate===!1)continue;i.copy(k.mapSize);const j=k.getFrameExtents();if(i.multiply(j),s.copy(k.mapSize),(i.x>f||i.y>f)&&(i.x>f&&(s.x=Math.floor(f/j.x),i.x=s.x*j.x,k.mapSize.x=s.x),i.y>f&&(s.y=Math.floor(f/j.y),i.y=s.y*j.y,k.mapSize.y=s.y)),k.map===null||Q===!0||V===!0){const K=this.type!==ys?{minFilter:jn,magFilter:jn}:{};k.map!==null&&k.map.dispose(),k.map=new yi(i.x,i.y,K),k.map.texture.name=re.name+".shadowMap",k.camera.updateProjectionMatrix()}n.setRenderTarget(k.map),n.clear();const Y=k.getViewportCount();for(let K=0;K0||L.map&&L.alphaTest>0){const G=A.uuid,Q=L.uuid;let V=u[G];V===void 0&&(V={},u[G]=V);let Z=V[Q];Z===void 0&&(Z=A.clone(),V[Q]=Z,L.addEventListener("dispose",R)),A=Z}if(A.visible=L.visible,A.wireframe=L.wireframe,B===ys?A.side=L.shadowSide!==null?L.shadowSide:L.side:A.side=L.shadowSide!==null?L.shadowSide:h[L.side],A.alphaMap=L.alphaMap,A.alphaTest=L.alphaTest,A.map=L.map,A.clipShadows=L.clipShadows,A.clippingPlanes=L.clippingPlanes,A.clipIntersection=L.clipIntersection,A.displacementMap=L.displacementMap,A.displacementScale=L.displacementScale,A.displacementBias=L.displacementBias,A.wireframeLinewidth=L.wireframeLinewidth,A.linewidth=L.linewidth,D.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const G=n.properties.get(A);G.light=D}return A}function E(P,L,D,B,A){if(P.visible===!1)return;if(P.layers.test(L.layers)&&(P.isMesh||P.isLine||P.isPoints)&&(P.castShadow||P.receiveShadow&&A===ys)&&(!P.frustumCulled||r.intersectsObject(P))){P.modelViewMatrix.multiplyMatrices(D.matrixWorldInverse,P.matrixWorld);const Q=e.update(P),V=P.material;if(Array.isArray(V)){const Z=Q.groups;for(let $=0,re=Z.length;$=1):Y.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),k=j>=2);let K=null,ae={};const _e=n.getParameter(n.SCISSOR_BOX),ne=n.getParameter(n.VIEWPORT),he=new sn().fromArray(_e),be=new sn().fromArray(ne);function me(X,ke,Ne,je){const et=new Uint8Array(4),Gt=n.createTexture();n.bindTexture(X,Gt),n.texParameteri(X,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(X,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let qt=0;qt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),f=new WeakMap;let h;const p=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(U,O){return g?new OffscreenCanvas(U,O):Bh("canvas")}function _(U,O,ie,Ee){let we=1;if((U.width>Ee||U.height>Ee)&&(we=Ee/Math.max(U.width,U.height)),we<1||O===!0)if(typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&U instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&U instanceof ImageBitmap){const Se=O?Yv:Math.floor,Ze=Se(we*U.width),Oe=Se(we*U.height);h===void 0&&(h=v(Ze,Oe));const Ve=ie?v(Ze,Oe):h;return Ve.width=Ze,Ve.height=Oe,Ve.getContext("2d").drawImage(U,0,0,Ze,Oe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+U.width+"x"+U.height+") to ("+Ze+"x"+Oe+")."),Ve}else return"data"in U&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+U.width+"x"+U.height+")."),U;return U}function x(U){return S1(U.width)&&S1(U.height)}function m(U){return a?!1:U.wrapS!==Ur||U.wrapT!==Ur||U.minFilter!==jn&&U.minFilter!==fn}function w(U,O){return U.generateMipmaps&&O&&U.minFilter!==jn&&U.minFilter!==fn}function S(U){n.generateMipmap(U)}function E(U,O,ie,Ee,we=!1){if(a===!1)return O;if(U!==null){if(n[U]!==void 0)return n[U];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let Se=O;if(O===n.RED&&(ie===n.FLOAT&&(Se=n.R32F),ie===n.HALF_FLOAT&&(Se=n.R16F),ie===n.UNSIGNED_BYTE&&(Se=n.R8)),O===n.RED_INTEGER&&(ie===n.UNSIGNED_BYTE&&(Se=n.R8UI),ie===n.UNSIGNED_SHORT&&(Se=n.R16UI),ie===n.UNSIGNED_INT&&(Se=n.R32UI),ie===n.BYTE&&(Se=n.R8I),ie===n.SHORT&&(Se=n.R16I),ie===n.INT&&(Se=n.R32I)),O===n.RG&&(ie===n.FLOAT&&(Se=n.RG32F),ie===n.HALF_FLOAT&&(Se=n.RG16F),ie===n.UNSIGNED_BYTE&&(Se=n.RG8)),O===n.RGBA){const Ze=we?Oh:ln.getTransfer(Ee);ie===n.FLOAT&&(Se=n.RGBA32F),ie===n.HALF_FLOAT&&(Se=n.RGBA16F),ie===n.UNSIGNED_BYTE&&(Se=Ze===mn?n.SRGB8_ALPHA8:n.RGBA8),ie===n.UNSIGNED_SHORT_4_4_4_4&&(Se=n.RGBA4),ie===n.UNSIGNED_SHORT_5_5_5_1&&(Se=n.RGB5_A1)}return(Se===n.R16F||Se===n.R32F||Se===n.RG16F||Se===n.RG32F||Se===n.RGBA16F||Se===n.RGBA32F)&&e.get("EXT_color_buffer_float"),Se}function R(U,O,ie){return w(U,ie)===!0||U.isFramebufferTexture&&U.minFilter!==jn&&U.minFilter!==fn?Math.log2(Math.max(O.width,O.height))+1:U.mipmaps!==void 0&&U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?O.mipmaps.length:1}function P(U){return U===jn||U===Xv||U===Zl?n.NEAREST:n.LINEAR}function L(U){const O=U.target;O.removeEventListener("dispose",L),B(O),O.isVideoTexture&&f.delete(O)}function D(U){const O=U.target;O.removeEventListener("dispose",D),N(O)}function B(U){const O=r.get(U);if(O.__webglInit===void 0)return;const ie=U.source,Ee=p.get(ie);if(Ee){const we=Ee[O.__cacheKey];we.usedTimes--,we.usedTimes===0&&A(U),Object.keys(Ee).length===0&&p.delete(ie)}r.remove(U)}function A(U){const O=r.get(U);n.deleteTexture(O.__webglTexture);const ie=U.source,Ee=p.get(ie);delete Ee[O.__cacheKey],o.memory.textures--}function N(U){const O=U.texture,ie=r.get(U),Ee=r.get(O);if(Ee.__webglTexture!==void 0&&(n.deleteTexture(Ee.__webglTexture),o.memory.textures--),U.depthTexture&&U.depthTexture.dispose(),U.isWebGLCubeRenderTarget)for(let we=0;we<6;we++){if(Array.isArray(ie.__webglFramebuffer[we]))for(let Se=0;Se=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+U+" texture units while this GPU supports only "+i.maxTextures),G+=1,U}function Z(U){const O=[];return O.push(U.wrapS),O.push(U.wrapT),O.push(U.wrapR||0),O.push(U.magFilter),O.push(U.minFilter),O.push(U.anisotropy),O.push(U.internalFormat),O.push(U.format),O.push(U.type),O.push(U.generateMipmaps),O.push(U.premultiplyAlpha),O.push(U.flipY),O.push(U.unpackAlignment),O.push(U.colorSpace),O.join()}function $(U,O){const ie=r.get(U);if(U.isVideoTexture&&Xe(U),U.isRenderTargetTexture===!1&&U.version>0&&ie.__version!==U.version){const Ee=U.image;if(Ee===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Ee.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{he(ie,U,O);return}}t.bindTexture(n.TEXTURE_2D,ie.__webglTexture,n.TEXTURE0+O)}function re(U,O){const ie=r.get(U);if(U.version>0&&ie.__version!==U.version){he(ie,U,O);return}t.bindTexture(n.TEXTURE_2D_ARRAY,ie.__webglTexture,n.TEXTURE0+O)}function k(U,O){const ie=r.get(U);if(U.version>0&&ie.__version!==U.version){he(ie,U,O);return}t.bindTexture(n.TEXTURE_3D,ie.__webglTexture,n.TEXTURE0+O)}function j(U,O){const ie=r.get(U);if(U.version>0&&ie.__version!==U.version){be(ie,U,O);return}t.bindTexture(n.TEXTURE_CUBE_MAP,ie.__webglTexture,n.TEXTURE0+O)}const Y={[Ph]:n.REPEAT,[Ur]:n.CLAMP_TO_EDGE,[Ih]:n.MIRRORED_REPEAT},K={[jn]:n.NEAREST,[Xv]:n.NEAREST_MIPMAP_NEAREST,[Zl]:n.NEAREST_MIPMAP_LINEAR,[fn]:n.LINEAR,[fh]:n.LINEAR_MIPMAP_NEAREST,[no]:n.LINEAR_MIPMAP_LINEAR},ae={[WI]:n.NEVER,[ZI]:n.ALWAYS,[GI]:n.LESS,[bM]:n.LEQUAL,[jI]:n.EQUAL,[YI]:n.GEQUAL,[XI]:n.GREATER,[qI]:n.NOTEQUAL};function _e(U,O,ie){if(O.type===is&&e.has("OES_texture_float_linear")===!1&&(O.magFilter===fn||O.magFilter===fh||O.magFilter===Zl||O.magFilter===no||O.minFilter===fn||O.minFilter===fh||O.minFilter===Zl||O.minFilter===no)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),ie?(n.texParameteri(U,n.TEXTURE_WRAP_S,Y[O.wrapS]),n.texParameteri(U,n.TEXTURE_WRAP_T,Y[O.wrapT]),(U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY)&&n.texParameteri(U,n.TEXTURE_WRAP_R,Y[O.wrapR]),n.texParameteri(U,n.TEXTURE_MAG_FILTER,K[O.magFilter]),n.texParameteri(U,n.TEXTURE_MIN_FILTER,K[O.minFilter])):(n.texParameteri(U,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(U,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(U===n.TEXTURE_3D||U===n.TEXTURE_2D_ARRAY)&&n.texParameteri(U,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(O.wrapS!==Ur||O.wrapT!==Ur)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(U,n.TEXTURE_MAG_FILTER,P(O.magFilter)),n.texParameteri(U,n.TEXTURE_MIN_FILTER,P(O.minFilter)),O.minFilter!==jn&&O.minFilter!==fn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),O.compareFunction&&(n.texParameteri(U,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(U,n.TEXTURE_COMPARE_FUNC,ae[O.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Ee=e.get("EXT_texture_filter_anisotropic");if(O.magFilter===jn||O.minFilter!==Zl&&O.minFilter!==no||O.type===is&&e.has("OES_texture_float_linear")===!1||a===!1&&O.type===rl&&e.has("OES_texture_half_float_linear")===!1)return;(O.anisotropy>1||r.get(O).__currentAnisotropy)&&(n.texParameterf(U,Ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,i.getMaxAnisotropy())),r.get(O).__currentAnisotropy=O.anisotropy)}}function ne(U,O){let ie=!1;U.__webglInit===void 0&&(U.__webglInit=!0,O.addEventListener("dispose",L));const Ee=O.source;let we=p.get(Ee);we===void 0&&(we={},p.set(Ee,we));const Se=Z(O);if(Se!==U.__cacheKey){we[Se]===void 0&&(we[Se]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ie=!0),we[Se].usedTimes++;const Ze=we[U.__cacheKey];Ze!==void 0&&(we[U.__cacheKey].usedTimes--,Ze.usedTimes===0&&A(O)),U.__cacheKey=Se,U.__webglTexture=we[Se].texture}return ie}function he(U,O,ie){let Ee=n.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(Ee=n.TEXTURE_2D_ARRAY),O.isData3DTexture&&(Ee=n.TEXTURE_3D);const we=ne(U,O),Se=O.source;t.bindTexture(Ee,U.__webglTexture,n.TEXTURE0+ie);const Ze=r.get(Se);if(Se.version!==Ze.__version||we===!0){t.activeTexture(n.TEXTURE0+ie);const Oe=ln.getPrimaries(ln.workingColorSpace),Ve=O.colorSpace===Ii?null:ln.getPrimaries(O.colorSpace),rt=O.colorSpace===Ii||Oe===Ve?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,O.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,O.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,rt);const ht=m(O)&&x(O.image)===!1;let Me=_(O.image,ht,!1,i.maxTextureSize);Me=Ue(O,Me);const Ot=x(Me)||a,_t=s.convert(O.format,O.colorSpace);let dt=s.convert(O.type),Je=E(O.internalFormat,_t,dt,O.colorSpace,O.isVideoTexture);_e(Ee,O,Ot);let q;const ye=O.mipmaps,Be=a&&O.isVideoTexture!==!0&&Je!==wM,it=Ze.__version===void 0||we===!0,at=Se.dataReady,Vt=R(O,Me,Ot);if(O.isDepthTexture)Je=n.DEPTH_COMPONENT,a?O.type===is?Je=n.DEPTH_COMPONENT32F:O.type===Bo?Je=n.DEPTH_COMPONENT24:O.type===Wa?Je=n.DEPTH24_STENCIL8:Je=n.DEPTH_COMPONENT16:O.type===is&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),O.format===Xo&&Je===n.DEPTH_COMPONENT&&O.type!==Bp&&O.type!==Bo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),O.type=Bo,dt=s.convert(O.type)),O.format===_c&&Je===n.DEPTH_COMPONENT&&(Je=n.DEPTH_STENCIL,O.type!==Wa&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),O.type=Wa,dt=s.convert(O.type))),it&&(Be?t.texStorage2D(n.TEXTURE_2D,1,Je,Me.width,Me.height):t.texImage2D(n.TEXTURE_2D,0,Je,Me.width,Me.height,0,_t,dt,null));else if(O.isDataTexture)if(ye.length>0&&Ot){Be&&it&&t.texStorage2D(n.TEXTURE_2D,Vt,Je,ye[0].width,ye[0].height);for(let X=0,ke=ye.length;X>=1,ke>>=1}}else if(ye.length>0&&Ot){Be&&it&&t.texStorage2D(n.TEXTURE_2D,Vt,Je,ye[0].width,ye[0].height);for(let X=0,ke=ye.length;X0&&at++,t.texStorage2D(n.TEXTURE_CUBE_MAP,at,q,Me[0].width,Me[0].height));for(let X=0;X<6;X++)if(ht){ye?it&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,Me[X].width,Me[X].height,dt,Je,Me[X].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,q,Me[X].width,Me[X].height,0,dt,Je,Me[X].data);for(let ke=0;ke>Se),Me=Math.max(1,O.height>>Se);we===n.TEXTURE_3D||we===n.TEXTURE_2D_ARRAY?t.texImage3D(we,Se,Ve,ht,Me,O.depth,0,Ze,Oe,null):t.texImage2D(we,Se,Ve,ht,Me,0,Ze,Oe,null)}t.bindFramebuffer(n.FRAMEBUFFER,U),ve(O)?l.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,Ee,we,r.get(ie).__webglTexture,0,Te(O)):(we===n.TEXTURE_2D||we>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&we<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Ee,we,r.get(ie).__webglTexture,Se),t.bindFramebuffer(n.FRAMEBUFFER,null)}function Pe(U,O,ie){if(n.bindRenderbuffer(n.RENDERBUFFER,U),O.depthBuffer&&!O.stencilBuffer){let Ee=a===!0?n.DEPTH_COMPONENT24:n.DEPTH_COMPONENT16;if(ie||ve(O)){const we=O.depthTexture;we&&we.isDepthTexture&&(we.type===is?Ee=n.DEPTH_COMPONENT32F:we.type===Bo&&(Ee=n.DEPTH_COMPONENT24));const Se=Te(O);ve(O)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Se,Ee,O.width,O.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,Se,Ee,O.width,O.height)}else n.renderbufferStorage(n.RENDERBUFFER,Ee,O.width,O.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,U)}else if(O.depthBuffer&&O.stencilBuffer){const Ee=Te(O);ie&&ve(O)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Ee,n.DEPTH24_STENCIL8,O.width,O.height):ve(O)?l.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Ee,n.DEPTH24_STENCIL8,O.width,O.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,O.width,O.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,U)}else{const Ee=O.isWebGLMultipleRenderTargets===!0?O.texture:[O.texture];for(let we=0;we0){ie.__webglFramebuffer[Oe]=[];for(let Ve=0;Ve0){ie.__webglFramebuffer=[];for(let Oe=0;Oe0&&ve(U)===!1){const Oe=Se?O:[O];ie.__webglMultisampledFramebuffer=n.createFramebuffer(),ie.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,ie.__webglMultisampledFramebuffer);for(let Ve=0;Ve0)for(let Ve=0;Ve0)for(let Ve=0;Ve0&&ve(U)===!1){const O=U.isWebGLMultipleRenderTargets?U.texture:[U.texture],ie=U.width,Ee=U.height;let we=n.COLOR_BUFFER_BIT;const Se=[],Ze=U.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Oe=r.get(U),Ve=U.isWebGLMultipleRenderTargets===!0;if(Ve)for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function Xe(U){const O=o.render.frame;f.get(U)!==O&&(f.set(U,O),U.update())}function Ue(U,O){const ie=U.colorSpace,Ee=U.format,we=U.type;return U.isCompressedTexture===!0||U.isVideoTexture===!0||U.format===qv||ie!==hi&&ie!==Ii&&(ln.getTransfer(ie)===mn?a===!1?e.has("EXT_sRGB")===!0&&Ee===Fr?(U.format=qv,U.minFilter=fn,U.generateMipmaps=!1):O=CM.sRGBToLinear(O):(Ee!==Fr||we!==oo)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ie)),O}this.allocateTextureUnit=V,this.resetTextureUnits=Q,this.setTexture2D=$,this.setTexture2DArray=re,this.setTexture3D=k,this.setTextureCube=j,this.rebindTextures=Ce,this.setupRenderTarget=H,this.updateRenderTargetMipmap=xe,this.updateMultisampleRenderTarget=fe,this.setupDepthRenderbuffer=Ae,this.setupFrameBufferTexture=me,this.useMultisampledRTT=ve}function dL(n,e,t){const r=t.isWebGL2;function i(s,o=Ii){let a;const l=ln.getTransfer(o);if(s===oo)return n.UNSIGNED_BYTE;if(s===vM)return n.UNSIGNED_SHORT_4_4_4_4;if(s===yM)return n.UNSIGNED_SHORT_5_5_5_1;if(s===RI)return n.BYTE;if(s===PI)return n.SHORT;if(s===Bp)return n.UNSIGNED_SHORT;if(s===gM)return n.INT;if(s===Bo)return n.UNSIGNED_INT;if(s===is)return n.FLOAT;if(s===rl)return r?n.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===II)return n.ALPHA;if(s===Fr)return n.RGBA;if(s===LI)return n.LUMINANCE;if(s===NI)return n.LUMINANCE_ALPHA;if(s===Xo)return n.DEPTH_COMPONENT;if(s===_c)return n.DEPTH_STENCIL;if(s===qv)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===DI)return n.RED;if(s===xM)return n.RED_INTEGER;if(s===OI)return n.RG;if(s===_M)return n.RG_INTEGER;if(s===SM)return n.RGBA_INTEGER;if(s===Mv||s===Ev||s===bv||s===Tv)if(l===mn)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Mv)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Ev)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===bv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Tv)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Mv)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Ev)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===bv)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Tv)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===YS||s===ZS||s===$S||s===KS)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===YS)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ZS)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===$S)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===KS)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===wM)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===QS||s===JS)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===QS)return l===mn?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===JS)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===e1||s===t1||s===n1||s===r1||s===i1||s===s1||s===o1||s===a1||s===l1||s===c1||s===u1||s===d1||s===f1||s===h1)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===e1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===t1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===n1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===r1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===i1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===s1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===o1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===a1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===l1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===c1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===u1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===d1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===f1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===h1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Cv||s===p1||s===m1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Cv)return l===mn?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===p1)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===m1)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===kI||s===g1||s===v1||s===y1)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Cv)return a.COMPRESSED_RED_RGTC1_EXT;if(s===g1)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===v1)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===y1)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Wa?r?n.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:i}}class fL extends Rn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Vu extends rn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vG={type:"move"};class C_{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Vu,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Vu,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new F,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new F),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Vu,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new F,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new F),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,u=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(u&&e.hand){o=!0;for(const _ of e.hand.values()){const x=t.getJointPose(_,r),m=this._getHandJoint(u,_);x!==null&&(m.matrix.fromArray(x.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=x.radius),m.visible=x!==null}const f=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],p=f.position.distanceTo(h.position),g=.02,v=.005;u.inputState.pinching&&p>g+v?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&p<=g-v&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(vG)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),u!==null&&(u.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Vu;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}const yG=` -void main() { - - gl_Position = vec4( position, 1.0 ); - -}`,xG=` -uniform sampler2DArray depthColor; -uniform float depthWidth; -uniform float depthHeight; - -void main() { - - vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); - - if ( coord.x >= 1.0 ) { - - gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; - - } else { - - gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; - - } - -}`;class _G{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,r){if(this.texture===null){const i=new In,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!=r.depthNear||t.depthFar!=r.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}render(e,t){if(this.texture!==null){if(this.mesh===null){const r=t.cameras[0].viewport,i=new as({extensions:{fragDepth:!0},vertexShader:yG,fragmentShader:xG,uniforms:{depthColor:{value:this.texture},depthWidth:{value:r.z},depthHeight:{value:r.w}}});this.mesh=new qn(new Zd(20,20),i)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}}class SG extends mo{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,u=null,f=null,h=null,p=null,g=null,v=null;const _=new _G,x=t.getContextAttributes();let m=null,w=null;const S=[],E=[],R=new ge;let P=null;const L=new Rn;L.layers.enable(1),L.viewport=new sn;const D=new Rn;D.layers.enable(2),D.viewport=new sn;const B=[L,D],A=new fL;A.layers.enable(1),A.layers.enable(2);let N=null,G=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ne){let he=S[ne];return he===void 0&&(he=new C_,S[ne]=he),he.getTargetRaySpace()},this.getControllerGrip=function(ne){let he=S[ne];return he===void 0&&(he=new C_,S[ne]=he),he.getGripSpace()},this.getHand=function(ne){let he=S[ne];return he===void 0&&(he=new C_,S[ne]=he),he.getHandSpace()};function Q(ne){const he=E.indexOf(ne.inputSource);if(he===-1)return;const be=S[he];be!==void 0&&(be.update(ne.inputSource,ne.frame,u||o),be.dispatchEvent({type:ne.type,data:ne.inputSource}))}function V(){i.removeEventListener("select",Q),i.removeEventListener("selectstart",Q),i.removeEventListener("selectend",Q),i.removeEventListener("squeeze",Q),i.removeEventListener("squeezestart",Q),i.removeEventListener("squeezeend",Q),i.removeEventListener("end",V),i.removeEventListener("inputsourceschange",Z);for(let ne=0;ne=0&&(E[me]=null,S[me].disconnect(be))}for(let he=0;he=E.length){E.push(be),me=Le;break}else if(E[Le]===null){E[Le]=be,me=Le;break}if(me===-1)break}const Pe=S[me];Pe&&Pe.connect(be)}}const $=new F,re=new F;function k(ne,he,be){$.setFromMatrixPosition(he.matrixWorld),re.setFromMatrixPosition(be.matrixWorld);const me=$.distanceTo(re),Pe=he.projectionMatrix.elements,Le=be.projectionMatrix.elements,Ae=Pe[14]/(Pe[10]-1),Ce=Pe[14]/(Pe[10]+1),H=(Pe[9]+1)/Pe[5],xe=(Pe[9]-1)/Pe[5],fe=(Pe[8]-1)/Pe[0],Te=(Le[8]+1)/Le[0],ve=Ae*fe,Xe=Ae*Te,Ue=me/(-fe+Te),U=Ue*-fe;he.matrixWorld.decompose(ne.position,ne.quaternion,ne.scale),ne.translateX(U),ne.translateZ(Ue),ne.matrixWorld.compose(ne.position,ne.quaternion,ne.scale),ne.matrixWorldInverse.copy(ne.matrixWorld).invert();const O=Ae+Ue,ie=Ce+Ue,Ee=ve-U,we=Xe+(me-U),Se=H*Ce/ie*O,Ze=xe*Ce/ie*O;ne.projectionMatrix.makePerspective(Ee,we,Se,Ze,O,ie),ne.projectionMatrixInverse.copy(ne.projectionMatrix).invert()}function j(ne,he){he===null?ne.matrixWorld.copy(ne.matrix):ne.matrixWorld.multiplyMatrices(he.matrixWorld,ne.matrix),ne.matrixWorldInverse.copy(ne.matrixWorld).invert()}this.updateCamera=function(ne){if(i===null)return;_.texture!==null&&(ne.near=_.depthNear,ne.far=_.depthFar),A.near=D.near=L.near=ne.near,A.far=D.far=L.far=ne.far,(N!==A.near||G!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),N=A.near,G=A.far,L.near=N,L.far=G,D.near=N,D.far=G,L.updateProjectionMatrix(),D.updateProjectionMatrix(),ne.updateProjectionMatrix());const he=ne.parent,be=A.cameras;j(A,he);for(let me=0;me0&&(x.alphaTest.value=m.alphaTest);const w=e.get(m).envMap;if(w&&(x.envMap.value=w,x.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,x.reflectivity.value=m.reflectivity,x.ior.value=m.ior,x.refractionRatio.value=m.refractionRatio),m.lightMap){x.lightMap.value=m.lightMap;const S=n._useLegacyLights===!0?Math.PI:1;x.lightMapIntensity.value=m.lightMapIntensity*S,t(m.lightMap,x.lightMapTransform)}m.aoMap&&(x.aoMap.value=m.aoMap,x.aoMapIntensity.value=m.aoMapIntensity,t(m.aoMap,x.aoMapTransform))}function o(x,m){x.diffuse.value.copy(m.color),x.opacity.value=m.opacity,m.map&&(x.map.value=m.map,t(m.map,x.mapTransform))}function a(x,m){x.dashSize.value=m.dashSize,x.totalSize.value=m.dashSize+m.gapSize,x.scale.value=m.scale}function l(x,m,w,S){x.diffuse.value.copy(m.color),x.opacity.value=m.opacity,x.size.value=m.size*w,x.scale.value=S*.5,m.map&&(x.map.value=m.map,t(m.map,x.uvTransform)),m.alphaMap&&(x.alphaMap.value=m.alphaMap,t(m.alphaMap,x.alphaMapTransform)),m.alphaTest>0&&(x.alphaTest.value=m.alphaTest)}function u(x,m){x.diffuse.value.copy(m.color),x.opacity.value=m.opacity,x.rotation.value=m.rotation,m.map&&(x.map.value=m.map,t(m.map,x.mapTransform)),m.alphaMap&&(x.alphaMap.value=m.alphaMap,t(m.alphaMap,x.alphaMapTransform)),m.alphaTest>0&&(x.alphaTest.value=m.alphaTest)}function f(x,m){x.specular.value.copy(m.specular),x.shininess.value=Math.max(m.shininess,1e-4)}function h(x,m){m.gradientMap&&(x.gradientMap.value=m.gradientMap)}function p(x,m){x.metalness.value=m.metalness,m.metalnessMap&&(x.metalnessMap.value=m.metalnessMap,t(m.metalnessMap,x.metalnessMapTransform)),x.roughness.value=m.roughness,m.roughnessMap&&(x.roughnessMap.value=m.roughnessMap,t(m.roughnessMap,x.roughnessMapTransform)),e.get(m).envMap&&(x.envMapIntensity.value=m.envMapIntensity)}function g(x,m,w){x.ior.value=m.ior,m.sheen>0&&(x.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),x.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(x.sheenColorMap.value=m.sheenColorMap,t(m.sheenColorMap,x.sheenColorMapTransform)),m.sheenRoughnessMap&&(x.sheenRoughnessMap.value=m.sheenRoughnessMap,t(m.sheenRoughnessMap,x.sheenRoughnessMapTransform))),m.clearcoat>0&&(x.clearcoat.value=m.clearcoat,x.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(x.clearcoatMap.value=m.clearcoatMap,t(m.clearcoatMap,x.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(x.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,t(m.clearcoatRoughnessMap,x.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(x.clearcoatNormalMap.value=m.clearcoatNormalMap,t(m.clearcoatNormalMap,x.clearcoatNormalMapTransform),x.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===Jr&&x.clearcoatNormalScale.value.negate())),m.iridescence>0&&(x.iridescence.value=m.iridescence,x.iridescenceIOR.value=m.iridescenceIOR,x.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],x.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(x.iridescenceMap.value=m.iridescenceMap,t(m.iridescenceMap,x.iridescenceMapTransform)),m.iridescenceThicknessMap&&(x.iridescenceThicknessMap.value=m.iridescenceThicknessMap,t(m.iridescenceThicknessMap,x.iridescenceThicknessMapTransform))),m.transmission>0&&(x.transmission.value=m.transmission,x.transmissionSamplerMap.value=w.texture,x.transmissionSamplerSize.value.set(w.width,w.height),m.transmissionMap&&(x.transmissionMap.value=m.transmissionMap,t(m.transmissionMap,x.transmissionMapTransform)),x.thickness.value=m.thickness,m.thicknessMap&&(x.thicknessMap.value=m.thicknessMap,t(m.thicknessMap,x.thicknessMapTransform)),x.attenuationDistance.value=m.attenuationDistance,x.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(x.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(x.anisotropyMap.value=m.anisotropyMap,t(m.anisotropyMap,x.anisotropyMapTransform))),x.specularIntensity.value=m.specularIntensity,x.specularColor.value.copy(m.specularColor),m.specularColorMap&&(x.specularColorMap.value=m.specularColorMap,t(m.specularColorMap,x.specularColorMapTransform)),m.specularIntensityMap&&(x.specularIntensityMap.value=m.specularIntensityMap,t(m.specularIntensityMap,x.specularIntensityMapTransform))}function v(x,m){m.matcap&&(x.matcap.value=m.matcap)}function _(x,m){const w=e.get(m).light;x.referencePosition.value.setFromMatrixPosition(w.matrixWorld),x.nearDistance.value=w.shadow.camera.near,x.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function MG(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(w,S){const E=S.program;r.uniformBlockBinding(w,E)}function u(w,S){let E=i[w.id];E===void 0&&(v(w),E=f(w),i[w.id]=E,w.addEventListener("dispose",x));const R=S.program;r.updateUBOMapping(w,R);const P=e.render.frame;s[w.id]!==P&&(p(w),s[w.id]=P)}function f(w){const S=h();w.__bindingPointIndex=S;const E=n.createBuffer(),R=w.__size,P=w.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,R,P),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,S,E),E}function h(){for(let w=0;w0&&(E+=R-P),w.__size=E,w.__cache={},this}function _(w){const S={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(S.boundary=4,S.storage=4):w.isVector2?(S.boundary=8,S.storage=8):w.isVector3||w.isColor?(S.boundary=16,S.storage=12):w.isVector4?(S.boundary=16,S.storage=16):w.isMatrix3?(S.boundary=48,S.storage=48):w.isMatrix4?(S.boundary=64,S.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),S}function x(w){const S=w.target;S.removeEventListener("dispose",x);const E=o.indexOf(S.__bindingPointIndex);o.splice(E,1),n.deleteBuffer(i[S.id]),delete i[S.id],delete s[S.id]}function m(){for(const w in i)n.deleteBuffer(i[w]);o=[],i={},s={}}return{bind:l,update:u,dispose:m}}class DM{constructor(e={}){const{canvas:t=QI(),context:r=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:u=!1,powerPreference:f="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let p;r!==null?p=r.getContextAttributes().alpha:p=o;const g=new Uint32Array(4),v=new Int32Array(4);let _=null,x=null;const m=[],w=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=zn,this._useLegacyLights=!1,this.toneMapping=so,this.toneMappingExposure=1;const S=this;let E=!1,R=0,P=0,L=null,D=-1,B=null;const A=new sn,N=new sn;let G=null;const Q=new Fe(0);let V=0,Z=t.width,$=t.height,re=1,k=null,j=null;const Y=new sn(0,0,Z,$),K=new sn(0,0,Z,$);let ae=!1;const _e=new Gp;let ne=!1,he=!1,be=null;const me=new yt,Pe=new ge,Le=new F,Ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ce(){return L===null?re:1}let H=r;function xe(z,se){for(let ce=0;ce{function qe(){if(ue.forEach(function(lt){Ue.get(lt).currentProgram.isReady()&&ue.delete(lt)}),ue.size===0){le(z);return}setTimeout(qe,10)}fe.get("KHR_parallel_shader_compile")!==null?qe():setTimeout(qe,10)})};let qt=null;function pn(z){qt&&qt(z)}function Yn(){hr.stop()}function un(){hr.start()}const hr=new sL;hr.setAnimationLoop(pn),typeof self<"u"&&hr.setContext(self),this.setAnimationLoop=function(z){qt=z,at.setAnimationLoop(z),z===null?hr.stop():hr.start()},at.addEventListener("sessionstart",Yn),at.addEventListener("sessionend",un),this.render=function(z,se){if(se!==void 0&&se.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(E===!0)return;z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),se.parent===null&&se.matrixWorldAutoUpdate===!0&&se.updateMatrixWorld(),at.enabled===!0&&at.isPresenting===!0&&(at.cameraAutoUpdate===!0&&at.updateCamera(se),se=at.getCamera()),z.isScene===!0&&z.onBeforeRender(S,z,se,L),x=rt.get(z,w.length),x.init(),w.push(x),me.multiplyMatrices(se.projectionMatrix,se.matrixWorldInverse),_e.setFromProjectionMatrix(me),he=this.localClippingEnabled,ne=ht.init(this.clippingPlanes,he),_=Ve.get(z,m.length),_.init(),m.push(_),Hi(z,se,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(k,j),this.info.render.frame++,ne===!0&&ht.beginShadows();const ce=x.state.shadowsArray;if(Me.render(ce,z,se),ne===!0&&ht.endShadows(),this.info.autoReset===!0&&this.info.reset(),(at.enabled===!1||at.isPresenting===!1||at.hasDepthSensing()===!1)&&Ot.render(_,z),x.setupLights(S._useLegacyLights),se.isArrayCamera){const ue=se.cameras;for(let le=0,qe=ue.length;le0?x=w[w.length-1]:x=null,m.pop(),m.length>0?_=m[m.length-1]:_=null};function Hi(z,se,ce,ue){if(z.visible===!1)return;if(z.layers.test(se.layers)){if(z.isGroup)ce=z.renderOrder;else if(z.isLOD)z.autoUpdate===!0&&z.update(se);else if(z.isLight)x.pushLight(z),z.castShadow&&x.pushShadow(z);else if(z.isSprite){if(!z.frustumCulled||_e.intersectsSprite(z)){ue&&Le.setFromMatrixPosition(z.matrixWorld).applyMatrix4(me);const lt=Se.update(z),pt=z.material;pt.visible&&_.push(z,lt,pt,ce,Le.z,null)}}else if((z.isMesh||z.isLine||z.isPoints)&&(!z.frustumCulled||_e.intersectsObject(z))){const lt=Se.update(z),pt=z.material;if(ue&&(z.boundingSphere!==void 0?(z.boundingSphere===null&&z.computeBoundingSphere(),Le.copy(z.boundingSphere.center)):(lt.boundingSphere===null&<.computeBoundingSphere(),Le.copy(lt.boundingSphere.center)),Le.applyMatrix4(z.matrixWorld).applyMatrix4(me)),Array.isArray(pt)){const mt=lt.groups;for(let Et=0,wt=mt.length;Et0&&df(le,qe,se,ce),ue&&ve.viewport(A.copy(ue)),le.length>0&&Xc(le,se,ce),qe.length>0&&Xc(qe,se,ce),lt.length>0&&Xc(lt,se,ce),ve.buffers.depth.setTest(!0),ve.buffers.depth.setMask(!0),ve.buffers.color.setMask(!0),ve.setPolygonOffset(!1)}function df(z,se,ce,ue){if((ce.isScene===!0?ce.overrideMaterial:null)!==null)return;const qe=Te.isWebGL2;be===null&&(be=new yi(1,1,{generateMipmaps:!0,type:fe.has("EXT_color_buffer_half_float")?rl:oo,minFilter:no,samples:qe?4:0})),S.getDrawingBufferSize(Pe),qe?be.setSize(Pe.x,Pe.y):be.setSize(Yv(Pe.x),Yv(Pe.y));const lt=S.getRenderTarget();S.setRenderTarget(be),S.getClearColor(Q),V=S.getClearAlpha(),V<1&&S.setClearColor(16777215,.5),S.clear();const pt=S.toneMapping;S.toneMapping=so,Xc(z,ce,ue),U.updateMultisampleRenderTarget(be),U.updateRenderTargetMipmap(be);let mt=!1;for(let Et=0,wt=se.length;Et0),bt=!!ce.morphAttributes.position,bn=!!ce.morphAttributes.normal,pr=!!ce.morphAttributes.color;let xn=so;ue.toneMapped&&(L===null||L.isXRRenderTarget===!0)&&(xn=S.toneMapping);const sr=ce.morphAttributes.position||ce.morphAttributes.normal||ce.morphAttributes.color,gt=sr!==void 0?sr.length:0,Ke=Ue.get(ue),Wi=x.state.lights;if(ne===!0&&(he===!0||z!==B)){const mr=z===B&&ue.id===D;ht.setState(ue,z,mr)}let Ht=!1;ue.version===Ke.__version?(Ke.needsLights&&Ke.lightsStateVersion!==Wi.state.version||Ke.outputColorSpace!==pt||le.isBatchedMesh&&Ke.batching===!1||!le.isBatchedMesh&&Ke.batching===!0||le.isInstancedMesh&&Ke.instancing===!1||!le.isInstancedMesh&&Ke.instancing===!0||le.isSkinnedMesh&&Ke.skinning===!1||!le.isSkinnedMesh&&Ke.skinning===!0||le.isInstancedMesh&&Ke.instancingColor===!0&&le.instanceColor===null||le.isInstancedMesh&&Ke.instancingColor===!1&&le.instanceColor!==null||Ke.envMap!==mt||ue.fog===!0&&Ke.fog!==qe||Ke.numClippingPlanes!==void 0&&(Ke.numClippingPlanes!==ht.numPlanes||Ke.numIntersection!==ht.numIntersection)||Ke.vertexAlphas!==Et||Ke.vertexTangents!==wt||Ke.morphTargets!==bt||Ke.morphNormals!==bn||Ke.morphColors!==pr||Ke.toneMapping!==xn||Te.isWebGL2===!0&&Ke.morphTargetsCount!==gt)&&(Ht=!0):(Ht=!0,Ke.__version=ue.version);let Dn=Ke.currentProgram;Ht===!0&&(Dn=qc(ue,se,le));let ks=!1,Gi=!1,or=!1;const Vn=Dn.getUniforms(),Us=Ke.uniforms;if(ve.useProgram(Dn.program)&&(ks=!0,Gi=!0,or=!0),ue.id!==D&&(D=ue.id,Gi=!0),ks||B!==z){Vn.setValue(H,"projectionMatrix",z.projectionMatrix),Vn.setValue(H,"viewMatrix",z.matrixWorldInverse);const mr=Vn.map.cameraPosition;mr!==void 0&&mr.setValue(H,Le.setFromMatrixPosition(z.matrixWorld)),Te.logarithmicDepthBuffer&&Vn.setValue(H,"logDepthBufFC",2/(Math.log(z.far+1)/Math.LN2)),(ue.isMeshPhongMaterial||ue.isMeshToonMaterial||ue.isMeshLambertMaterial||ue.isMeshBasicMaterial||ue.isMeshStandardMaterial||ue.isShaderMaterial)&&Vn.setValue(H,"isOrthographic",z.isOrthographicCamera===!0),B!==z&&(B=z,Gi=!0,or=!0)}if(le.isSkinnedMesh){Vn.setOptional(H,le,"bindMatrix"),Vn.setOptional(H,le,"bindMatrixInverse");const mr=le.skeleton;mr&&(Te.floatVertexTextures?(mr.boneTexture===null&&mr.computeBoneTexture(),Vn.setValue(H,"boneTexture",mr.boneTexture,U)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}le.isBatchedMesh&&(Vn.setOptional(H,le,"batchingTexture"),Vn.setValue(H,"batchingTexture",le._matricesTexture,U));const Yc=ce.morphAttributes;if((Yc.position!==void 0||Yc.normal!==void 0||Yc.color!==void 0&&Te.isWebGL2===!0)&&_t.update(le,ce,Dn),(Gi||Ke.receiveShadow!==le.receiveShadow)&&(Ke.receiveShadow=le.receiveShadow,Vn.setValue(H,"receiveShadow",le.receiveShadow)),ue.isMeshGouraudMaterial&&ue.envMap!==null&&(Us.envMap.value=mt,Us.flipEnvMap.value=mt.isCubeTexture&&mt.isRenderTargetTexture===!1?-1:1),Gi&&(Vn.setValue(H,"toneMappingExposure",S.toneMappingExposure),Ke.needsLights&&$y(Us,or),qe&&ue.fog===!0&&Oe.refreshFogUniforms(Us,qe),Oe.refreshMaterialUniforms(Us,ue,re,$,be),Rv.upload(H,om(Ke),Us,U)),ue.isShaderMaterial&&ue.uniformsNeedUpdate===!0&&(Rv.upload(H,om(Ke),Us,U),ue.uniformsNeedUpdate=!1),ue.isSpriteMaterial&&Vn.setValue(H,"center",le.center),Vn.setValue(H,"modelViewMatrix",le.modelViewMatrix),Vn.setValue(H,"normalMatrix",le.normalMatrix),Vn.setValue(H,"modelMatrix",le.matrixWorld),ue.isShaderMaterial||ue.isRawShaderMaterial){const mr=ue.uniformsGroups;for(let Zc=0,_i=mr.length;Zc<_i;Zc++)if(Te.isWebGL2){const lm=mr[Zc];Be.update(lm,Dn),Be.bind(lm,Dn)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Dn}function $y(z,se){z.ambientLightColor.needsUpdate=se,z.lightProbe.needsUpdate=se,z.directionalLights.needsUpdate=se,z.directionalLightShadows.needsUpdate=se,z.pointLights.needsUpdate=se,z.pointLightShadows.needsUpdate=se,z.spotLights.needsUpdate=se,z.spotLightShadows.needsUpdate=se,z.rectAreaLights.needsUpdate=se,z.hemisphereLights.needsUpdate=se}function Ky(z){return z.isMeshLambertMaterial||z.isMeshToonMaterial||z.isMeshPhongMaterial||z.isMeshStandardMaterial||z.isShadowMaterial||z.isShaderMaterial&&z.lights===!0}this.getActiveCubeFace=function(){return R},this.getActiveMipmapLevel=function(){return P},this.getRenderTarget=function(){return L},this.setRenderTargetTextures=function(z,se,ce){Ue.get(z.texture).__webglTexture=se,Ue.get(z.depthTexture).__webglTexture=ce;const ue=Ue.get(z);ue.__hasExternalTextures=!0,ue.__hasExternalTextures&&(ue.__autoAllocateDepthBuffer=ce===void 0,ue.__autoAllocateDepthBuffer||fe.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ue.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(z,se){const ce=Ue.get(z);ce.__webglFramebuffer=se,ce.__useDefaultFramebuffer=se===void 0},this.setRenderTarget=function(z,se=0,ce=0){L=z,R=se,P=ce;let ue=!0,le=null,qe=!1,lt=!1;if(z){const mt=Ue.get(z);mt.__useDefaultFramebuffer!==void 0?(ve.bindFramebuffer(H.FRAMEBUFFER,null),ue=!1):mt.__webglFramebuffer===void 0?U.setupRenderTarget(z):mt.__hasExternalTextures&&U.rebindTextures(z,Ue.get(z.texture).__webglTexture,Ue.get(z.depthTexture).__webglTexture);const Et=z.texture;(Et.isData3DTexture||Et.isDataArrayTexture||Et.isCompressedArrayTexture)&&(lt=!0);const wt=Ue.get(z).__webglFramebuffer;z.isWebGLCubeRenderTarget?(Array.isArray(wt[se])?le=wt[se][ce]:le=wt[se],qe=!0):Te.isWebGL2&&z.samples>0&&U.useMultisampledRTT(z)===!1?le=Ue.get(z).__webglMultisampledFramebuffer:Array.isArray(wt)?le=wt[ce]:le=wt,A.copy(z.viewport),N.copy(z.scissor),G=z.scissorTest}else A.copy(Y).multiplyScalar(re).floor(),N.copy(K).multiplyScalar(re).floor(),G=ae;if(ve.bindFramebuffer(H.FRAMEBUFFER,le)&&Te.drawBuffers&&ue&&ve.drawBuffers(z,le),ve.viewport(A),ve.scissor(N),ve.setScissorTest(G),qe){const mt=Ue.get(z.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+se,mt.__webglTexture,ce)}else if(lt){const mt=Ue.get(z.texture),Et=se||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,mt.__webglTexture,ce||0,Et)}D=-1},this.readRenderTargetPixels=function(z,se,ce,ue,le,qe,lt){if(!(z&&z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let pt=Ue.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&<!==void 0&&(pt=pt[lt]),pt){ve.bindFramebuffer(H.FRAMEBUFFER,pt);try{const mt=z.texture,Et=mt.format,wt=mt.type;if(Et!==Fr&&q.convert(Et)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const bt=wt===rl&&(fe.has("EXT_color_buffer_half_float")||Te.isWebGL2&&fe.has("EXT_color_buffer_float"));if(wt!==oo&&q.convert(wt)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(wt===is&&(Te.isWebGL2||fe.has("OES_texture_float")||fe.has("WEBGL_color_buffer_float")))&&!bt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}se>=0&&se<=z.width-ue&&ce>=0&&ce<=z.height-le&&H.readPixels(se,ce,ue,le,q.convert(Et),q.convert(wt),qe)}finally{const mt=L!==null?Ue.get(L).__webglFramebuffer:null;ve.bindFramebuffer(H.FRAMEBUFFER,mt)}}},this.copyFramebufferToTexture=function(z,se,ce=0){const ue=Math.pow(2,-ce),le=Math.floor(se.image.width*ue),qe=Math.floor(se.image.height*ue);U.setTexture2D(se,0),H.copyTexSubImage2D(H.TEXTURE_2D,ce,0,0,z.x,z.y,le,qe),ve.unbindTexture()},this.copyTextureToTexture=function(z,se,ce,ue=0){const le=se.image.width,qe=se.image.height,lt=q.convert(ce.format),pt=q.convert(ce.type);U.setTexture2D(ce,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,ce.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ce.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,ce.unpackAlignment),se.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,ue,z.x,z.y,le,qe,lt,pt,se.image.data):se.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,ue,z.x,z.y,se.mipmaps[0].width,se.mipmaps[0].height,lt,se.mipmaps[0].data):H.texSubImage2D(H.TEXTURE_2D,ue,z.x,z.y,lt,pt,se.image),ue===0&&ce.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),ve.unbindTexture()},this.copyTextureToTexture3D=function(z,se,ce,ue,le=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const qe=z.max.x-z.min.x+1,lt=z.max.y-z.min.y+1,pt=z.max.z-z.min.z+1,mt=q.convert(ue.format),Et=q.convert(ue.type);let wt;if(ue.isData3DTexture)U.setTexture3D(ue,0),wt=H.TEXTURE_3D;else if(ue.isDataArrayTexture||ue.isCompressedArrayTexture)U.setTexture2DArray(ue,0),wt=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,ue.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ue.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,ue.unpackAlignment);const bt=H.getParameter(H.UNPACK_ROW_LENGTH),bn=H.getParameter(H.UNPACK_IMAGE_HEIGHT),pr=H.getParameter(H.UNPACK_SKIP_PIXELS),xn=H.getParameter(H.UNPACK_SKIP_ROWS),sr=H.getParameter(H.UNPACK_SKIP_IMAGES),gt=ce.isCompressedTexture?ce.mipmaps[le]:ce.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,gt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,gt.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,z.min.x),H.pixelStorei(H.UNPACK_SKIP_ROWS,z.min.y),H.pixelStorei(H.UNPACK_SKIP_IMAGES,z.min.z),ce.isDataTexture||ce.isData3DTexture?H.texSubImage3D(wt,le,se.x,se.y,se.z,qe,lt,pt,mt,Et,gt.data):ce.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),H.compressedTexSubImage3D(wt,le,se.x,se.y,se.z,qe,lt,pt,mt,gt.data)):H.texSubImage3D(wt,le,se.x,se.y,se.z,qe,lt,pt,mt,Et,gt),H.pixelStorei(H.UNPACK_ROW_LENGTH,bt),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,bn),H.pixelStorei(H.UNPACK_SKIP_PIXELS,pr),H.pixelStorei(H.UNPACK_SKIP_ROWS,xn),H.pixelStorei(H.UNPACK_SKIP_IMAGES,sr),le===0&&ue.generateMipmaps&&H.generateMipmap(wt),ve.unbindTexture()},this.initTexture=function(z){z.isCubeTexture?U.setTextureCube(z,0):z.isData3DTexture?U.setTexture3D(z,0):z.isDataArrayTexture||z.isCompressedArrayTexture?U.setTexture2DArray(z,0):U.setTexture2D(z,0),ve.unbindTexture()},this.resetState=function(){R=0,P=0,L=null,ve.reset(),ye.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ro}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===$0?"display-p3":"srgb",t.unpackColorSpace=ln.workingColorSpace===Vp?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===zn?Ga:EM}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ga?zn:hi}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class hL extends DM{}hL.prototype.isWebGL1Renderer=!0;class ey{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Fe(e),this.density=t}clone(){return new ey(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class ty{constructor(e,t=1,r=1e3){this.isFog=!0,this.name="",this.color=new Fe(e),this.near=t,this.far=r}clone(){return new ty(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class Vh extends rn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}class ny{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Fh,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Di()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return pc("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;ie.far||t.push({distance:l,point:Of.clone(),uv:Li.getInterpolation(Of,Eg,Uf,bg,_A,A_,SA,new ge),face:null,object:this})}copy(e,t){return super.copy(e,t),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Tg(n,e,t,r,i,s){Tu.subVectors(n,t).addScalar(.5).multiply(r),i!==void 0?(kf.x=s*Tu.x-i*Tu.y,kf.y=i*Tu.x+s*Tu.y):kf.copy(Tu),n.copy(e),n.x+=kf.x,n.y+=kf.y,n.applyMatrix4(pL)}const Cg=new F,wA=new F;class gL extends rn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let r=0,i=t.length;r0){let r,i;for(r=1,i=t.length;r0){Cg.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Cg);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Cg.setFromMatrixPosition(e.matrixWorld),wA.setFromMatrixPosition(this.matrixWorld);const r=Cg.distanceTo(wA)/e.zoom;t[0].object.visible=!0;let i,s;for(i=1,s=t.length;i=o)t[i-1].object.visible=!1,t[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=r.length&&r.push({start:-1,count:-1,z:-1});const s=r[this.index];i.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=t}reset(){this.list.length=0,this.index=0}}const Au="batchId",wa=new yt,IA=new yt,PG=new yt,LA=new yt,I_=new Gp,Pg=new ei,Ul=new Vr,Bf=new F,L_=new RG,Ir=new qn,Ig=[];function IG(n,e,t=0){const r=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const i=n.count;for(let s=0;s65536?new Uint32Array(s):new Uint16Array(s);t.setIndex(new on(a,1))}const o=i>65536?new Uint32Array(r):new Uint16Array(r);t.setAttribute(Au,new on(o,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(Au))throw new Error(`BatchedMesh: Geometry cannot use attribute "${Au}"`);const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in t.attributes){if(r===Au)continue;if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=t.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new ei);const e=this._geometryCount,t=this.boundingBox,r=this._active;t.makeEmpty();for(let i=0;i=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const u=e.getIndex(),f=u!==null;if(f&&(r===-1?i.indexCount=u.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,p=this._active,g=this._matricesTexture,v=this._matricesTexture.image.data;h.push(!0),p.push(!0);const _=this._geometryCount;this._geometryCount++,PG.toArray(v,_*16),g.needsUpdate=!0,o.push(i),a.push({start:f?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new ei,sphereInitialized:!1,sphere:new Vr});const x=this.geometry.getAttribute(Au);for(let m=0;m=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,u=a.vertexCount;for(const g in r.attributes){if(g===Au)continue;const v=t.getAttribute(g),_=r.getAttribute(g);IG(v,_,l);const x=v.itemSize;for(let m=v.count,w=u;m=t.length||t[e]===!1?this:(t[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(this._active[e]===!1)return null;const i=this._bounds[e],s=i.box,o=this.geometry;if(i.boxInitialized===!1){s.makeEmpty();const a=o.index,l=o.attributes.position,u=this._drawRanges[e];for(let f=u.start,h=u.start+u.count;f=o||r[e]===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const r=this._active,i=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||r[e]===!1?null:t.fromArray(i,e*16)}setVisibleAt(e,t){const r=this._visibility,i=this._active,s=this._geometryCount;return e>=s||i[e]===!1||r[e]===t?this:(r[e]=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._visibility,r=this._active,i=this._geometryCount;return e>=i||r[e]===!1?!1:t[e]}raycast(e,t){const r=this._visibility,i=this._active,s=this._drawRanges,o=this._geometryCount,a=this.matrixWorld,l=this.geometry;Ir.material=this.material,Ir.geometry.index=l.index,Ir.geometry.attributes=l.attributes,Ir.geometry.boundingBox===null&&(Ir.geometry.boundingBox=new ei),Ir.geometry.boundingSphere===null&&(Ir.geometry.boundingSphere=new Vr);for(let u=0;u({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,t,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._active,u=this._visibility,f=this._multiDrawStarts,h=this._multiDrawCounts,p=this._drawRanges,g=this.perObjectFrustumCulled;g&&(LA.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),I_.setFromProjectionMatrix(LA,e.coordinateSystem));let v=0;if(this.sortObjects){IA.copy(this.matrixWorld).invert(),Bf.setFromMatrixPosition(r.matrixWorld).applyMatrix4(IA);for(let m=0,w=u.length;ml)continue;p.applyMatrix4(this.matrixWorld);const D=e.ray.origin.distanceTo(p);De.far||t.push({distance:D,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),w=Math.min(x.count,o.start+o.count);for(let S=m,E=w-1;Sl)continue;p.applyMatrix4(this.matrixWorld);const P=e.ray.origin.distanceTo(p);Pe.far||t.push({distance:P,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:u,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class LG extends In{constructor(e,t,r,i,s,o,a,l,u){super(e,t,r,i,s,o,a,l,u),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:fn,this.magFilter=s!==void 0?s:fn,this.generateMipmaps=!1;const f=this;function h(){f.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class NG extends In{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=jn,this.minFilter=jn,this.generateMipmaps=!1,this.needsUpdate=!0}}class iy extends In{constructor(e,t,r,i,s,o,a,l,u,f,h,p){super(null,o,a,l,u,f,i,s,h,p),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class DG extends iy{constructor(e,t,r,i,s,o){super(e,t,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Ur}}class OG extends iy{constructor(e,t,r){super(void 0,e[0].width,e[0].height,t,r,Zo),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class kG extends In{constructor(e,t,r,i,s,o,a,l,u){super(e,t,r,i,s,o,a,l,u),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Ns{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,u;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),u=r[i]-o,u<0)a=i+1;else if(u>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const f=r[i],p=r[i+1]-f,g=(o-f)/p;return(i+g)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new ge:new F);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new F,i=[],s=[],o=[],a=new F,l=new yt;for(let g=0;g<=e;g++){const v=g/e;i[g]=this.getTangentAt(v,new F)}s[0]=new F,o[0]=new F;let u=Number.MAX_VALUE;const f=Math.abs(i[0].x),h=Math.abs(i[0].y),p=Math.abs(i[0].z);f<=u&&(u=f,r.set(1,0,0)),h<=u&&(u=h,r.set(0,1,0)),p<=u&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),o[g]=o[g-1].clone(),a.crossVectors(i[g-1],i[g]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(Bn(i[g-1].dot(i[g]),-1,1));s[g].applyMatrix4(l.makeRotationAxis(a,v))}o[g].crossVectors(i[g],s[g])}if(t===!0){let g=Math.acos(Bn(s[0].dot(s[e]),-1,1));g/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(g=-g);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(i[v],g*v)),o[v].crossVectors(i[v],s[v])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class sy extends Ns{constructor(e=0,t=0,r=1,i=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const r=t||new ge,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)i;)s-=i;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let u,f;this.closed||a>0?u=i[(a-1)%s]:(Og.subVectors(i[0],i[1]).add(i[0]),u=Og);const h=i[a%s],p=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],h=i[o>i.length-3?i.length-1:o+2];return r.set(BA(a,l.x,u.x,f.x,h.x),BA(a,l.y,u.y,f.y,h.y)),r}copy(e){super.copy(e),this.points=[];for(let t=0,r=e.points.length;t=r){const o=i[s]-r,a=this.curves[s],l=a.getLength(),u=l===0?0:1-o/l;return a.getPointAt(u,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let r=0,i=this.curves.length;r1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,r=e.curves.length;t0){const h=u.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(u);const f=u.getPoint(1);return this.currentPoint.copy(f),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class jp extends Dt{constructor(e=[new ge(0,-.5),new ge(.5,0),new ge(0,.5)],t=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:r,phiLength:i},t=Math.floor(t),i=Bn(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],u=[],f=1/t,h=new F,p=new ge,g=new F,v=new F,_=new F;let x=0,m=0;for(let w=0;w<=e.length-1;w++)switch(w){case 0:x=e[w+1].x-e[w].x,m=e[w+1].y-e[w].y,g.x=m*1,g.y=-x,g.z=m*0,_.copy(g),g.normalize(),l.push(g.x,g.y,g.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:x=e[w+1].x-e[w].x,m=e[w+1].y-e[w].y,g.x=m*1,g.y=-x,g.z=m*0,v.copy(g),g.x+=_.x,g.y+=_.y,g.z+=_.z,g.normalize(),l.push(g.x,g.y,g.z),_.copy(v)}for(let w=0;w<=t;w++){const S=r+w*f*i,E=Math.sin(S),R=Math.cos(S);for(let P=0;P<=e.length-1;P++){h.x=e[P].x*E,h.y=e[P].y,h.z=e[P].x*R,o.push(h.x,h.y,h.z),p.x=w/t,p.y=P/(e.length-1),a.push(p.x,p.y);const L=l[3*P+0]*E,D=l[3*P+1],B=l[3*P+0]*R;u.push(L,D,B)}}for(let w=0;w0&&S(!0),t>0&&S(!1)),this.setIndex(f),this.setAttribute("position",new nt(h,3)),this.setAttribute("normal",new nt(p,3)),this.setAttribute("uv",new nt(g,2));function w(){const E=new F,R=new F;let P=0;const L=(t-e)/r;for(let D=0;D<=s;D++){const B=[],A=D/s,N=A*(t-e)+e;for(let G=0;G<=i;G++){const Q=G/i,V=Q*l+a,Z=Math.sin(V),$=Math.cos(V);R.x=N*Z,R.y=-A*r+x,R.z=N*$,h.push(R.x,R.y,R.z),E.set(Z,L,$).normalize(),p.push(E.x,E.y,E.z),g.push(Q,1-A),B.push(v++)}_.push(B)}for(let D=0;D.9&&L<.1&&(S<.2&&(o[w+0]+=1),E<.2&&(o[w+2]+=1),R<.2&&(o[w+4]+=1))}}function p(w){s.push(w.x,w.y,w.z)}function g(w,S){const E=w*3;S.x=e[E+0],S.y=e[E+1],S.z=e[E+2]}function v(){const w=new F,S=new F,E=new F,R=new F,P=new ge,L=new ge,D=new ge;for(let B=0,A=0;B80*t){a=u=n[0],l=f=n[1];for(let v=t;vu&&(u=h),p>f&&(f=p);g=Math.max(u-a,f-l),g=g!==0?32767/g:0}return Wh(s,o,t,a,l,g,0),o}};function AL(n,e,t,r,i){let s,o;if(i===o8(n,e,t,r)>0)for(s=e;s=e;s-=r)o=VA(s,n[s],n[s+1],o);return o&&uy(o,o.next)&&(jh(o),o=o.next),o}function wc(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(uy(t,t.next)||Pn(t.prev,t,t.next)===0)){if(jh(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Wh(n,e,t,r,i,s,o){if(!n)return;!o&&s&&e8(n,r,i,s);let a=n,l,u;for(;n.prev!==n.next;){if(l=n.prev,u=n.next,s?XG(n,r,i,s):jG(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(u.i/t|0),jh(n),n=u.next,a=u.next;continue}if(n=u,n===a){o?o===1?(n=qG(wc(n),e,t),Wh(n,e,t,r,i,s,2)):o===2&&YG(n,e,t,r,i,s):Wh(wc(n),e,t,r,i,s,1);break}}}function jG(n){const e=n.prev,t=n,r=n.next;if(Pn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,u=r.y,f=is?i>o?i:o:s>o?s:o,g=a>l?a>u?a:u:l>u?l:u;let v=r.next;for(;v!==e;){if(v.x>=f&&v.x<=p&&v.y>=h&&v.y<=g&&Hu(i,a,s,l,o,u,v.x,v.y)&&Pn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function XG(n,e,t,r){const i=n.prev,s=n,o=n.next;if(Pn(i,s,o)>=0)return!1;const a=i.x,l=s.x,u=o.x,f=i.y,h=s.y,p=o.y,g=al?a>u?a:u:l>u?l:u,x=f>h?f>p?f:p:h>p?h:p,m=b1(g,v,e,t,r),w=b1(_,x,e,t,r);let S=n.prevZ,E=n.nextZ;for(;S&&S.z>=m&&E&&E.z<=w;){if(S.x>=g&&S.x<=_&&S.y>=v&&S.y<=x&&S!==i&&S!==o&&Hu(a,f,l,h,u,p,S.x,S.y)&&Pn(S.prev,S,S.next)>=0||(S=S.prevZ,E.x>=g&&E.x<=_&&E.y>=v&&E.y<=x&&E!==i&&E!==o&&Hu(a,f,l,h,u,p,E.x,E.y)&&Pn(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;S&&S.z>=m;){if(S.x>=g&&S.x<=_&&S.y>=v&&S.y<=x&&S!==i&&S!==o&&Hu(a,f,l,h,u,p,S.x,S.y)&&Pn(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;E&&E.z<=w;){if(E.x>=g&&E.x<=_&&E.y>=v&&E.y<=x&&E!==i&&E!==o&&Hu(a,f,l,h,u,p,E.x,E.y)&&Pn(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function qG(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!uy(i,s)&&RL(i,r,r.next,s)&&Gh(i,s)&&Gh(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),jh(r),jh(r.next),r=n=s),r=r.next}while(r!==n);return wc(r)}function YG(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&r8(o,a)){let l=PL(o,a);o=wc(o,o.next),l=wc(l,l.next),Wh(o,e,t,r,i,s,0),Wh(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function ZG(n,e,t,r){const i=[];let s,o,a,l,u;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const p=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(p<=s&&p>r&&(r=p,i=t.x=t.x&&t.x>=l&&s!==t.x&&Hu(oi.x||t.x===i.x&&JG(i,t)))&&(i=t,f=h)),t=t.next;while(t!==a);return i}function JG(n,e){return Pn(n.prev,n,e.prev)<0&&Pn(e.next,n,n.next)<0}function e8(n,e,t,r){let i=n;do i.z===0&&(i.z=b1(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,t8(i)}function t8(n){let e,t,r,i,s,o,a,l,u=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(i=t,t=t.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;t=r}s.nextZ=null,u*=2}while(o>1);return n}function b1(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function n8(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function r8(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!i8(n,e)&&(Gh(n,e)&&Gh(e,n)&&s8(n,e)&&(Pn(n.prev,n,e.prev)||Pn(n,e.prev,e))||uy(n,e)&&Pn(n.prev,n,n.next)>0&&Pn(e.prev,e,e.next)>0)}function Pn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function uy(n,e){return n.x===e.x&&n.y===e.y}function RL(n,e,t,r){const i=Bg(Pn(n,e,t)),s=Bg(Pn(n,e,r)),o=Bg(Pn(t,r,n)),a=Bg(Pn(t,r,e));return!!(i!==s&&o!==a||i===0&&zg(n,t,e)||s===0&&zg(n,r,e)||o===0&&zg(t,n,r)||a===0&&zg(t,e,r))}function zg(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Bg(n){return n>0?1:n<0?-1:0}function i8(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&RL(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Gh(n,e){return Pn(n.prev,n,n.next)<0?Pn(n,e,n.next)>=0&&Pn(n,n.prev,e)>=0:Pn(n,e,n.prev)<0||Pn(n,n.next,e)<0}function s8(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function PL(n,e){const t=new T1(n.i,n.x,n.y),r=new T1(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function VA(n,e,t,r){const i=new T1(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function jh(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function T1(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function o8(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function WA(n,e){for(let t=0;tNumber.EPSILON){const Se=Math.sqrt(Ee),Ze=Math.sqrt(O*O+ie*ie),Oe=xe.x-U/Se,Ve=xe.y+Ue/Se,rt=fe.x-ie/Ze,ht=fe.y+O/Ze,Me=((rt-Oe)*ie-(ht-Ve)*O)/(Ue*ie-U*O);Te=Oe+Ue*Me-H.x,ve=Ve+U*Me-H.y;const Ot=Te*Te+ve*ve;if(Ot<=2)return new ge(Te,ve);Xe=Math.sqrt(Ot/2)}else{let Se=!1;Ue>Number.EPSILON?O>Number.EPSILON&&(Se=!0):Ue<-Number.EPSILON?O<-Number.EPSILON&&(Se=!0):Math.sign(U)===Math.sign(ie)&&(Se=!0),Se?(Te=-U,ve=Ue,Xe=Math.sqrt(Ee)):(Te=Ue,ve=U,Xe=Math.sqrt(Ee/2))}return new ge(Te/Xe,ve/Xe)}const j=[];for(let H=0,xe=V.length,fe=xe-1,Te=H+1;H=0;H--){const xe=H/x,fe=g*Math.cos(xe*Math.PI/2),Te=v*Math.sin(xe*Math.PI/2)+_;for(let ve=0,Xe=V.length;ve=0;){const Te=fe;let ve=fe-1;ve<0&&(ve=H.length-1);for(let Xe=0,Ue=f+x*2;Xe0)&&g.push(S,E,P),(m!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class OL extends Er{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Fe(16777215),this.specular=new Fe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=zp,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class kL extends Er{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Fe(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class UL extends Er{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class FL extends Er{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Fe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Fe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=zp,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class zL extends Er{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Fe(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=ml,this.normalScale=new ge(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class BL extends ii{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function ec(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function VL(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function HL(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function C1(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function GM(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}function u8(n,e,t,r,i=30){const s=n.clone();s.name=e;const o=[];for(let l=0;l=r)){h.push(u.times[g]);for(let _=0;_s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const m=v*h+f,w=m+h-f;_=a.values.slice(m,w)}else{const m=a.createInterpolant(),w=f,S=h-f;m.evaluate(s),_=m.resultBuffer.slice(w,S)}l==="quaternion"&&new Br().fromArray(_).normalize().conjugate().toArray(_);const x=u.times.length;for(let m=0;m=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&VL(i))for(let a=0,l=i.length;a!==l;++a){const u=i[a];if(isNaN(u)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,u),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===Av,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,u=0;u!==r;++u)t[l+u]=t[a+u];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*r)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Ds.prototype.TimeBufferType=Float32Array;Ds.prototype.ValueBufferType=Float32Array;Ds.prototype.DefaultInterpolation=Nh;class Uc extends Ds{}Uc.prototype.ValueTypeName="bool";Uc.prototype.ValueBufferType=Array;Uc.prototype.DefaultInterpolation=Lh;Uc.prototype.InterpolantFactoryMethodLinear=void 0;Uc.prototype.InterpolantFactoryMethodSmooth=void 0;class XM extends Ds{}XM.prototype.ValueTypeName="color";class Xh extends Ds{}Xh.prototype.ValueTypeName="number";class jL extends Yp{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let u=e*a;for(let f=u+a;u!==f;u+=4)Br.slerpFlat(s,0,o,u-a,o,u,l);return s}}class Qd extends Ds{InterpolantFactoryMethodLinear(e){return new jL(this.times,this.values,this.getValueSize(),e)}}Qd.prototype.ValueTypeName="quaternion";Qd.prototype.DefaultInterpolation=Nh;Qd.prototype.InterpolantFactoryMethodSmooth=void 0;class Fc extends Ds{}Fc.prototype.ValueTypeName="string";Fc.prototype.ValueBufferType=Array;Fc.prototype.DefaultInterpolation=Lh;Fc.prototype.InterpolantFactoryMethodLinear=void 0;Fc.prototype.InterpolantFactoryMethodSmooth=void 0;class qh extends Ds{}qh.prototype.ValueTypeName="vector";class Yh{constructor(e,t=-1,r,i=Z0){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Di(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(p8(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(Ds.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const h=f[1];let p=i[h];p||(i[h]=p=[]),p.push(u)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(h,p,g,v,_){if(g.length!==0){const x=[],m=[];GM(g,x,m,v),x.length!==0&&_.push(new h(p,x,m))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const u=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(Po[e]!==void 0){Po[e].push({onLoad:t,onProgress:r,onError:i});return}Po[e]=[],Po[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(u=>{if(u.status===200||u.status===0){if(u.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||u.body===void 0||u.body.getReader===void 0)return u;const f=Po[e],h=u.body.getReader(),p=u.headers.get("Content-Length")||u.headers.get("X-File-Size"),g=p?parseInt(p):0,v=g!==0;let _=0;const x=new ReadableStream({start(m){w();function w(){h.read().then(({done:S,value:E})=>{if(S)m.close();else{_+=E.byteLength;const R=new ProgressEvent("progress",{lengthComputable:v,loaded:_,total:g});for(let P=0,L=f.length;P{switch(l){case"arraybuffer":return u.arrayBuffer();case"blob":return u.blob();case"document":return u.text().then(f=>new DOMParser().parseFromString(f,a));case"json":return u.json();default:if(a===void 0)return u.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),p=h&&h[1]?h[1].toLowerCase():void 0,g=new TextDecoder(p);return u.arrayBuffer().then(v=>g.decode(v))}}}).then(u=>{Ho.add(e,u);const f=Po[e];delete Po[e];for(let h=0,p=f.length;h{const f=Po[e];if(f===void 0)throw this.manager.itemError(e),u;delete Po[e];for(let h=0,p=f.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class g8 extends xi{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new $o(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{t(s.parse(JSON.parse(a)))}catch(l){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const t=[];for(let r=0;r0:i.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(i.uniforms[s]={},o.type){case"t":i.uniforms[s].value=r(o.value);break;case"c":i.uniforms[s].value=new Fe().setHex(o.value);break;case"v2":i.uniforms[s].value=new ge().fromArray(o.value);break;case"v3":i.uniforms[s].value=new F().fromArray(o.value);break;case"v4":i.uniforms[s].value=new sn().fromArray(o.value);break;case"m3":i.uniforms[s].value=new zt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new yt().fromArray(o.value);break;default:i.uniforms[s].value=o.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(i.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)i.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(i.lights=e.lights),e.clipping!==void 0&&(i.clipping=e.clipping),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=r(e.map)),e.matcap!==void 0&&(i.matcap=r(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=r(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=r(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=r(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new ge().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=r(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=r(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=r(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=r(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=r(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=r(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=r(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=r(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=r(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=r(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=r(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=r(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=r(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=r(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new ge().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=r(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=r(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=r(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=r(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=r(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=r(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=r(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:LL,SpriteMaterial:OM,RawShaderMaterial:NL,ShaderMaterial:as,PointsMaterial:UM,MeshPhysicalMaterial:DL,MeshStandardMaterial:xy,MeshPhongMaterial:OL,MeshToonMaterial:kL,MeshNormalMaterial:UL,MeshLambertMaterial:FL,MeshDepthMaterial:LM,MeshDistanceMaterial:NM,MeshBasicMaterial:gl,MeshMatcapMaterial:zL,LineDashedMaterial:BL,LineBasicMaterial:ii,Material:Er};return new t[e]}}class A1{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r0){const l=new qM(t);s=new Zh(l),s.setCrossOrigin(this.crossOrigin);for(let u=0,f=e.length;u0){i=new Zh(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const x=new ei;x.min.fromArray(_.boxMin),x.max.fromArray(_.boxMax);const m=new Vr;return m.radius=_.sphereRadius,m.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:x,sphereInitialized:_.sphereInitialized,sphere:m}}),o._maxGeometryCount=e.maxGeometryCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=u(e.matricesTexture.uuid);break;case"LOD":o=new gL;break;case"Line":o=new il(a(e.geometry),l(e.material));break;case"LineLoop":o=new _L(a(e.geometry),l(e.material));break;case"LineSegments":o=new go(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new SL(a(e.geometry),l(e.material));break;case"Sprite":o=new mL(l(e.material));break;case"Group":o=new Vu;break;case"Bone":o=new kM;break;default:o=new rn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let g=0;g"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ho.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(u=>{t&&t(u),s.manager.itemEnd(e)}).catch(u=>{i&&i(u)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(u){return u.blob()}).then(function(u){return createImageBitmap(u,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(u){return Ho.add(e,u),t&&t(u),s.manager.itemEnd(e),u}).catch(function(u){i&&i(u),Ho.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Ho.add(e,l),s.manager.itemStart(e)}}let Vg;class ZM{static getContext(){return Vg===void 0&&(Vg=new(window.AudioContext||window.webkitAudioContext)),Vg}static setContext(e){Vg=e}}class C8 extends xi{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new $o(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const u=l.slice(0);ZM.getContext().decodeAudioData(u,function(h){t(h)}).catch(a)}catch(u){a(u)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const KA=new yt,QA=new yt,Fl=new yt;class A8{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Rn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Rn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,Fl.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(hc*t.fov*.5)/t.zoom;let a,l;QA.elements[12]=-i,KA.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,Fl.elements[0]=2*t.near/(l-a),Fl.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Fl),a=-o*t.aspect-s,l=o*t.aspect-s,Fl.elements[0]=2*t.near/(l-a),Fl.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Fl)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(QA),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(KA)}}class Zp{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=JA(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=JA();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function JA(){return(typeof performance>"u"?Date:performance).now()}const zl=new F,eR=new Br,R8=new F,Bl=new F;class P8 extends rn{constructor(){super(),this.type="AudioListener",this.context=ZM.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Zp}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(zl,eR,R8),Bl.set(0,0,-1).applyQuaternion(eR),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(zl.x,i),t.positionY.linearRampToValueAtTime(zl.y,i),t.positionZ.linearRampToValueAtTime(zl.z,i),t.forwardX.linearRampToValueAtTime(Bl.x,i),t.forwardY.linearRampToValueAtTime(Bl.y,i),t.forwardZ.linearRampToValueAtTime(Bl.z,i),t.upX.linearRampToValueAtTime(r.x,i),t.upY.linearRampToValueAtTime(r.y,i),t.upZ.linearRampToValueAtTime(r.z,i)}else t.setPosition(zl.x,zl.y,zl.z),t.setOrientation(Bl.x,Bl.y,Bl.z,r.x,r.y,r.z)}}let rN=class extends rn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let l=t,u=t+t;l!==u;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){Br.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;Br.multiplyQuaternionsFlat(e,o,e,t,e,r),Br.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const $M="\\[\\]\\.:\\/",D8=new RegExp("["+$M+"]","g"),KM="[^"+$M+"]",O8="[^"+$M.replace("\\.","")+"]",k8=/((?:WC+[\/:])*)/.source.replace("WC",KM),U8=/(WCOD+)?/.source.replace("WCOD",O8),F8=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",KM),z8=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",KM),B8=new RegExp("^"+k8+U8+F8+z8+"$"),V8=["material","materials","bones","map"];class H8{constructor(e,t,r){const i=r||Qt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class Qt{constructor(e,t,r){this.path=t,this.parsedPath=r||Qt.parseTrackName(t),this.node=Qt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new Qt.Composite(e,t,r):new Qt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(D8,"")}static parseTrackName(e){const t=B8.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);V8.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o=s){const h=s++,p=e[h];t[p.uuid]=f,e[f]=p,t[u]=h,e[h]=l;for(let g=0,v=i;g!==v;++g){const _=r[g],x=_[h],m=_[f];_[f]=x,_[h]=m}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,r=this._bindings,i=r.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const u=arguments[a],f=u.uuid,h=t[f];if(h!==void 0)if(delete t[f],h0&&(t[g.uuid]=h),e[h]=g,e.pop();for(let v=0,_=i;v!==_;++v){const x=r[v];x[h]=x[p],x.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const r=this._bindingsIndicesByPath;let i=r[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,u=l.length,f=this.nCachedObjects_,h=new Array(u);i=s.length,r[e]=i,o.push(e),a.push(t),s.push(h);for(let p=f,g=l.length;p!==g;++p){const v=l[p];h[p]=new Qt(v,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,r=t[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],u=e[a];t[u]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class sN{constructor(e,t,r=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=r,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:Kl,endingEnd:Kl};for(let u=0;u!==o;++u){const f=s[u].createInterpolant(null);a[u]=f,f.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=FI,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,r){if(e.fadeOut(t),this.fadeIn(t),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,t),this.warp(a,1,t)}return this}crossFadeTo(e,t,r){return e.crossFadeFrom(this,t,r)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,r){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,u=a.sampleValues;return l[0]=s,l[1]=s+r,u[0]=e/o,u[1]=t/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,r,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*r;l<0||r===0?t=0:(this._startTime=null,t=r*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,u=this._propertyBindings;switch(this.blendMode){case MM:for(let f=0,h=l.length;f!==h;++f)l[f].evaluate(o),u[f].accumulateAdditive(a);break;case Z0:default:for(let f=0,h=l.length;f!==h;++f)l[f].evaluate(o),u[f].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===zI;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===UI){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const u=e<0;this._setEndings(u,!u,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=Ql,i.endingEnd=Ql):(e?i.endingStart=this.zeroSlopeAtStart?Ql:Kl:i.endingStart=Dh,t?i.endingEnd=this.zeroSlopeAtEnd?Ql:Kl:i.endingEnd=Dh)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const G8=new Float32Array(1);class j8 extends mo{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,u=this._bindingsByRootAndName;let f=u[l];f===void 0&&(f={},u[l]=f);for(let h=0;h!==s;++h){const p=i[h],g=p.name;let v=f[g];if(v!==void 0)++v.referenceCount,o[h]=v;else{if(v=o[h],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,g));continue}const _=t&&t._propertyBindings[h].binding.parsedPath;v=new iN(Qt.create(r,g,_),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,g),o[h]=v}a[h].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let u=0;u!==r;++u)t[u]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let u=0;u!==l;++u)a[u].apply(o);return this}setTime(e){this.time=0;for(let t=0;tthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,rR).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const iR=new F,Hg=new F;class Q8{constructor(e=new F,t=new F){this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){iR.subVectors(e,this.start),Hg.subVectors(this.end,this.start);const r=Hg.dot(Hg);let s=Hg.dot(iR)/r;return t&&(s=Bn(s,0,1)),s}closestPointToPoint(e,t,r){const i=this.closestPointToPointParameter(e,t);return this.delta(r).multiplyScalar(i).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const sR=new F;class J8 extends rn{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const r=new Dt,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{uR.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(uR,t)}}setLength(e,t=e*.2,r=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(r,t,r),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class f6 extends go{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],r=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Dt;i.setAttribute("position",new nt(t,3)),i.setAttribute("color",new nt(r,3));const s=new ii({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,r){const i=new Fe,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(t),i.toArray(s,6),i.toArray(s,9),i.set(r),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class h6{constructor(){this.type="ShapePath",this.color=new Fe,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Hh,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,r,i){return this.currentPath.quadraticCurveTo(e,t,r,i),this}bezierCurveTo(e,t,r,i,s,o){return this.currentPath.bezierCurveTo(e,t,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(m){const w=[];for(let S=0,E=m.length;SNumber.EPSILON){if(A<0&&(L=w[P],B=-B,D=w[R],A=-A),m.yD.y)continue;if(m.y===L.y){if(m.x===L.x)return!0}else{const N=A*(m.x-L.x)-B*(m.y-L.y);if(N===0)return!0;if(N<0)continue;E=!E}}else{if(m.y!==L.y)continue;if(D.x<=m.x&&m.x<=L.x||L.x<=m.x&&m.x<=D.x)return!0}}return E}const i=ao.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const u=[];if(s.length===1)return a=s[0],l=new gc,l.curves=a.curves,u.push(l),u;let f=!i(s[0].getPoints());f=e?!f:f;const h=[],p=[];let g=[],v=0,_;p[v]=void 0,g[v]=[];for(let m=0,w=s.length;m1){let m=!1,w=0;for(let S=0,E=p.length;S0&&m===!1&&(g=h)}let x;for(let m=0,w=p.length;mthis.map[l][0]&&a<=this.map[l+1][0]){const u=this.map[l][0],f=this.map[l+1][0];i.setHex(this.map[l][1],hi),s.setHex(this.map[l+1][1],hi);const h=new Fe().lerpColors(i,s,(a-u)/(f-u));this.lut.push(h)}}return this.lut.push(new Fe(this.map[this.map.length-1][1])),this}copy(e){return this.lut=e.lut,this.map=e.map,this.n=e.n,this.minV=e.minV,this.maxV=e.maxV,this}getColor(e){e=$I.clamp(e,this.minV,this.maxV),e=(e-this.minV)/(this.maxV-this.minV);const t=Math.round(e*this.n);return this.lut[t]}addColorMap(e,t){return H_[e]=t,this}createCanvas(){const e=document.createElement("canvas");return e.width=1,e.height=this.n,this.updateCanvas(e),e}updateCanvas(e){const t=e.getContext("2d",{alpha:!1}),r=t.getImageData(0,0,1,this.n),i=r.data;let s=0;const o=1/this.n,a=new Fe,l=new Fe,u=new Fe;for(let f=1;f>=0;f-=o)for(let h=this.map.length-1;h>=0;h--)if(f=this.map[h-1][0]){const p=this.map[h-1][0],g=this.map[h][0];a.setHex(this.map[h-1][1],hi),l.setHex(this.map[h][1],hi),u.lerpColors(a,l,(f-p)/(g-p)),i[s*4]=Math.round(u.r*255),i[s*4+1]=Math.round(u.g*255),i[s*4+2]=Math.round(u.b*255),i[s*4+3]=255,s+=1}return t.putImageData(r,0,0),e}}const H_={rainbow:[[0,255],[.2,65535],[.5,65280],[.8,16776960],[1,16711680]],cooltowarm:[[0,3952322],[.2,10206463],[.5,14474460],[.8,16163717],[1,11797542]],blackbody:[[0,0],[.2,7864320],[.5,15086080],[.8,16776960],[1,16777215]],grayscale:[[0,0],[.2,4210752],[.5,8355712],[.8,12566463],[1,16777215]]},Ct={THREE_RAINBOW:"rainbow",THREE_COOL_TO_WARM:"cooltowarm",WARM:"Warm",WARM_2:"Warm_2",WARM_3:"Warm_3",SAND:"Sand",SAND_2:"Sand_2",SAND_3:"Sand_3",SAND_4:"Sand_4",SAND_5:"Sand_5",NATURAL:"Natural",NATURAL_2:"Natural_2",CIRCUS:"Circus",SEASIDE:"Seaside",DRAGON:"Dragon"},gh=[Ct.THREE_COOL_TO_WARM,Ct.THREE_RAINBOW,Ct.WARM,Ct.WARM_2,Ct.WARM_3,Ct.SAND,Ct.SAND_2,Ct.SAND_3,Ct.SAND_4,Ct.SAND_5,Ct.NATURAL,Ct.NATURAL_2,Ct.CIRCUS,Ct.SEASIDE,Ct.DRAGON],W_=(n,e,t)=>t<=0?n:t>=1?e:n+t*(e-n);class dR{constructor(e){st(this,"colors");st(this,"getAt",e=>{e=Math.min(1,Math.max(0,e));const t=Math.floor(e*this.colors.length*.9999),r=Math.min(this.colors.length-1,Math.max(0,t+1)),i=this.colors[t],s=this.colors[r],o=(e-t/this.colors.length)/(1/this.colors.length);return new Fe().setRGB(W_(i.r,s.r,o),W_(i.g,s.g,o),W_(i.b,s.b,o),zn)});this.colors=e.colors.map(t=>new Fe(t))}}class Gn{constructor(e,t){st(this,"name");st(this,"colors");st(this,"buildLut",()=>{const e=new g6;return e.addColorMap(this.name,this.colorsHex.map((t,r)=>[r/(this.nColors-1),t])),e.setColorMap(this.name),e});st(this,"calcBackgroundColor",(e=.5)=>{const r=new dR(this).getAt(e),i={h:0,s:0,l:0};return r.getHSL(i,zn),i.s=Math.min(i.s,.5),r.setHSL(i.h,i.s,i.l,zn),r});st(this,"lerpColor",e=>{const t=Math.min(1,Math.max(0,e));return new dR(this).getAt(t)});if(this.name=e,t.length<2)throw new Error("Not enough colors");this.colors=[...t]}get colorsHex(){return this.colors.map(e=>new Fe(e).getHex())}get nColors(){return this.colors.length}static getPalette(e){switch(e){case Ct.WARM:return new Gn(Ct.WARM,["#FF2000","#FF5900","#FE9100","#FEFDFC","#FEC194","#FE9F5B"]);case Ct.WARM_2:return new Gn("Warm_2",["#FFFEFE","#0D0211","#FBCEA0","#FFAD5D","#530E1D","#FE9232","#B93810","#907996"]);case Ct.WARM_3:return new Gn(Ct.WARM_3,["#EDEBE7","#13595A","#DE1408","#161814","#E1610A","#B7BDB3","#9F9772"]);case Ct.SAND:return new Gn(Ct.SAND,["#b8987a","#caa87f","#dfb98a","#ebc99c","#f3ddb0","#f9e6c1","#fff3d7"]);case Ct.SAND_2:return new Gn(Ct.SAND_2,["#f2ead6","#327172","#2d3e58","#f47e72","#f2cab1"]);case Ct.SAND_3:return new Gn(Ct.SAND_3,["#f1e2c3","#8595a4","#8d4f2a","#d86b28","#eca956"]);case Ct.SAND_4:return new Gn(Ct.SAND_4,["#242112","#684f27","#9a733a","#ac8f56","#e5a752","#fdbe6e","#ffd28f"]);case Ct.SAND_5:return new Gn(Ct.SAND_5,["#44200a","#75380c","#9e5922","#b96525","#da863d","#f5ad63","#fec37d"]);case Ct.NATURAL:return new Gn(Ct.NATURAL,["#FF6D00","#FBF8EB","#008B99","#F8E1A6","#FDA81F","#B80A01","#480D07"]);case Ct.NATURAL_2:return new Gn(Ct.NATURAL_2,["#EF2006","#350000","#A11104","#ED5910","#F1B52E","#7B5614","#F7F1AC"]);case Ct.CIRCUS:return new Gn(Ct.CIRCUS,["#F62D62","#FFFFFF","#FDB600","#F42D2D","#544C98","#ECACBC"]);case Ct.SEASIDE:return new Gn(Ct.SEASIDE,["#FEB019","#F46002","#E1E7F1","#0A1D69","#138FE2","#0652C4","#D23401","#B0A12F"]);case Ct.DRAGON:return new Gn(Ct.DRAGON,["#F2E9D9","#101010","#EA4B04","#B6AC9E","#5A5754","#837F7A","#E78E36","#552509"]);case Ct.THREE_RAINBOW:return new Gn(Ct.THREE_RAINBOW,["#0000FF","#00FFFF","#00FF00","#FFFF00","#FF0000"]);case Ct.THREE_COOL_TO_WARM:return new Gn(Ct.THREE_COOL_TO_WARM,["#3c4ec2","#9bbcff","#dcdcdc","#f6a385","#b40426"]);default:return e}}static random(e=gh){return Gn.getPalette(e[Math.floor(Math.random()*e.length)])}}const Jd=SB((n,e)=>({user:{canvasInteractionEventTracker:new m6},visual:{palette:Ct.THREE_COOL_TO_WARM},visualSourceData:{x:new Float32Array(121).fill(0),y:new Float32Array(121).fill(0)},energyInfo:{current:0},actions:{noteCanvasInteraction:()=>n(t=>(t.user.canvasInteractionEventTracker.addEvent(),{user:{canvasInteractionEventTracker:t.user.canvasInteractionEventTracker}})),setPalette:t=>n(r=>({visual:{palette:t}})),nextPalette:()=>n(t=>{const i=((gh.indexOf(t.visual.palette)??0)+1)%gh.length;return{visual:{palette:gh[i]}}}),resizeVisualSourceData:t=>n(r=>({visualSourceData:{x:new Float32Array(t).fill(0),y:new Float32Array(t).fill(0)}}))}})),v6=()=>Jd(n=>n.user),QM=()=>Jd(n=>n.visual.palette),Sy=()=>Jd(n=>n.visualSourceData.x),lN=()=>Jd(n=>n.visualSourceData.y),JM=()=>Jd(n=>n.energyInfo),ef=()=>Jd(n=>n.actions),cN=({analyzer:n})=>{const{octaveBandMode:e,energyMeasure:t}=pM(),r=Sy(),i=JM(),{resizeVisualSourceData:s}=ef(),o=T.useRef(null),a=T.useCallback(()=>{const l=n.getBars();if(r.length!=l.length){console.log(`Resizing ${l.length}`),s(l.length);return}i.current=n.getEnergy(t),l.forEach(({value:u},f)=>{r[f]=u})},[r,n,s,i,t]);return T.useEffect(()=>{o.current&&cancelAnimationFrame(o.current);const l=()=>{a(),o.current=requestAnimationFrame(l)};return o.current=requestAnimationFrame(l),()=>cancelAnimationFrame(o.current)},[r,t,a]),T.useEffect(()=>{n.mode=e},[e,n]),C.jsx(C.Fragment,{})},Jn={FILE_UPLOAD:"FILE_UPLOAD",MICROPHONE:"MICROPHONE",SOUNDCLOUD:"SOUNDCLOUD",SCREEN_SHARE:"SCREEN_SHARE"},uN=()=>{var n;return navigator.platform.toLowerCase().startsWith("ip")?!0:((n=navigator.userAgent)==null?void 0:n.toLowerCase().startsWith("mac"))&&"ontouchend"in document},dN=()=>[Jn.SOUNDCLOUD,Jn.MICROPHONE,Jn.FILE_UPLOAD,Jn.SCREEN_SHARE],fN=()=>{console.log("Building audio...");const n=new Audio;return n.crossOrigin="anonymous",n},y6=n=>new Promise(function(e,t){const r=["mousedown","touchstart","touchend"];if(n.state==="suspended"&&"ontouchstart"in window){const i=function(){n.resume().then(function(){r.forEach(s=>{document.body.removeEventListener(s,i)}),e(!0)},function(s){t(s)})};r.forEach(s=>{document.body.addEventListener(s,i,!1)})}else e(!1)}),hN=()=>{console.log("Building audioCtx...");const n=new window.AudioContext;return uN()&&(console.log("Attempting to unlock AudioContext"),y6(n).then(function(e){console.log(e?"Successfully unlocked AudioContext!":"No need to unlock AudioContext.")},function(e){console.error(e)})),n},x6=n=>{const[e,t]=T.useState(!1),[r,i]=T.useState(!1),s=null,o=T.useCallback(()=>{},[n,s]);return T.useEffect(()=>{console.log("Syncing, start w/ pause..."),n.pause(),t(!1);{i(!1);return}},[n,s,o]),{loaded:r,isPlaying:e,playAudio:o}},_6=({audio:n})=>{const{loaded:e,isPlaying:t,playAudio:r}=x6(n);return uN()?C.jsx("div",{id:"info",style:{top:"1rem",left:"1rem"},hidden:t,children:e?C.jsx("button",{disabled:!e||t,onClick:r,children:"Play Audio"}):C.jsxs(C.Fragment,{children:[C.jsx("h2",{children:"Load a file"}),C.jsx("p",{children:"Use the controls panel to upload an audio file."})]})}):C.jsx(C.Fragment,{})},At={WAVE_FORM:"WAVE_FORM",NOISE:"NOISE",AUDIO:"AUDIO",AUDIO_SCOPE:"AUDIO_SCOPE",PARTICLE_NOISE:"PARTICLE_NOISE"},S6=n=>{switch(n){case At.WAVE_FORM:case At.NOISE:case At.PARTICLE_NOISE:return!1;case At.AUDIO:case At.AUDIO_SCOPE:return!0;default:return n}},w6=()=>[At.WAVE_FORM,At.NOISE,At.AUDIO],M6=n=>{switch(n){case At.WAVE_FORM:case At.NOISE:case At.AUDIO:case At.PARTICLE_NOISE:return!0;case At.AUDIO_SCOPE:return!1;default:return n}},eE=T.createContext(null),E6=({children:n})=>{const[e,t]=T.useState(At.WAVE_FORM),[r,i]=T.useState(!0);return C.jsx(eE.Provider,{value:{config:{mode:e,showUI:r},setters:{setMode:t,setShowUI:i}},children:n})};function zc(){const n=T.useContext(eE);if(!n)throw new Error("useModeContext must be used within a ModeContextProvider");return n.config}function pN(){const n=T.useContext(eE);if(!n)throw new Error("useModeContext must be used within a ModeContextProvider");return n.setters}const tE=T.createContext(null),b6=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.track)??null);return C.jsx(tE.Provider,{value:{config:{track:t},setters:{setTrack:r}},children:e})};function T6(){const n=T.useContext(tE);if(!n)throw new Error("useSoundcloudContext must be used within a SoundcloudContextProvider");return n.config}function C6(){const n=T.useContext(tE);if(!n)throw new Error("useSoundcloudContext must be used within a SoundcloudContextProvider");return n.setters}var $t;(function(n){n.assertEqual=i=>i;function e(i){}n.assertIs=e;function t(i){throw new Error}n.assertNever=t,n.arrayToEnum=i=>{const s={};for(const o of i)s[o]=o;return s},n.getValidEnumValues=i=>{const s=n.objectKeys(i).filter(a=>typeof i[i[a]]!="number"),o={};for(const a of s)o[a]=i[a];return n.objectValues(o)},n.objectValues=i=>n.objectKeys(i).map(function(s){return i[s]}),n.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const s=[];for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&s.push(o);return s},n.find=(i,s)=>{for(const o of i)if(s(o))return o},n.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,s=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}n.joinValues=r,n.jsonStringifyReplacer=(i,s)=>typeof s=="bigint"?s.toString():s})($t||($t={}));var P1;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(P1||(P1={}));const Ye=$t.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),La=n=>{switch(typeof n){case"undefined":return Ye.undefined;case"string":return Ye.string;case"number":return isNaN(n)?Ye.nan:Ye.number;case"boolean":return Ye.boolean;case"function":return Ye.function;case"bigint":return Ye.bigint;case"symbol":return Ye.symbol;case"object":return Array.isArray(n)?Ye.array:n===null?Ye.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?Ye.promise:typeof Map<"u"&&n instanceof Map?Ye.map:typeof Set<"u"&&n instanceof Set?Ye.set:typeof Date<"u"&&n instanceof Date?Ye.date:Ye.object;default:return Ye.unknown}},Ie=$t.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),A6=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class Oi extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(s){return s.message},r={_errors:[]},i=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let a=r,l=0;for(;lt.message){const t={},r=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}Oi.create=n=>new Oi(n);const Ld=(n,e)=>{let t;switch(n.code){case Ie.invalid_type:n.received===Ye.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case Ie.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,$t.jsonStringifyReplacer)}`;break;case Ie.unrecognized_keys:t=`Unrecognized key(s) in object: ${$t.joinValues(n.keys,", ")}`;break;case Ie.invalid_union:t="Invalid input";break;case Ie.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${$t.joinValues(n.options)}`;break;case Ie.invalid_enum_value:t=`Invalid enum value. Expected ${$t.joinValues(n.options)}, received '${n.received}'`;break;case Ie.invalid_arguments:t="Invalid function arguments";break;case Ie.invalid_return_type:t="Invalid function return type";break;case Ie.invalid_date:t="Invalid date";break;case Ie.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:$t.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case Ie.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case Ie.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case Ie.custom:t="Invalid input";break;case Ie.invalid_intersection_types:t="Intersection results could not be merged";break;case Ie.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case Ie.not_finite:t="Number must be finite";break;default:t=e.defaultError,$t.assertNever(n)}return{message:t}};let mN=Ld;function R6(n){mN=n}function Kv(){return mN}const Qv=n=>{const{data:e,path:t,errorMaps:r,issueData:i}=n,s=[...t,...i.path||[]],o={...i,path:s};if(i.message!==void 0)return{...i,path:s,message:i.message};let a="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)a=u(o,{data:e,defaultError:a}).message;return{...i,path:s,message:a}},P6=[];function Ge(n,e){const t=Kv(),r=Qv({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Ld?void 0:Ld].filter(i=>!!i)});n.common.issues.push(r)}class Hr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const i of t){if(i.status==="aborted")return xt;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const i of t){const s=await i.key,o=await i.value;r.push({key:s,value:o})}return Hr.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const i of t){const{key:s,value:o}=i;if(s.status==="aborted"||o.status==="aborted")return xt;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}}const xt=Object.freeze({status:"aborted"}),Wu=n=>({status:"dirty",value:n}),ni=n=>({status:"valid",value:n}),I1=n=>n.status==="aborted",L1=n=>n.status==="dirty",$h=n=>n.status==="valid",Kh=n=>typeof Promise<"u"&&n instanceof Promise;function Jv(n,e,t,r){if(typeof e=="function"?n!==e||!r:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function gN(n,e,t,r,i){if(typeof e=="function"?n!==e||!i:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var ut;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(ut||(ut={}));var rh,ih;class fo{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const fR=(n,e)=>{if($h(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Oi(n.common.issues);return this._error=t,this._error}}};function Nt(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:r,description:i}=n;if(e&&(t||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,a)=>{var l,u;const{message:f}=n;return o.code==="invalid_enum_value"?{message:f??a.defaultError}:typeof a.data>"u"?{message:(l=f??r)!==null&&l!==void 0?l:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(u=f??t)!==null&&u!==void 0?u:a.defaultError}},description:i}}class Bt{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return La(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:La(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Hr,ctx:{common:e.parent.common,data:e.data,parsedType:La(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Kh(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const i={common:{issues:[],async:(r=t==null?void 0:t.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:La(e)},s=this._parseSync({data:e,path:i.path,parent:i});return fR(i,s)}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:La(e)},i=this._parse({data:e,path:r.path,parent:r}),s=await(Kh(i)?i:Promise.resolve(i));return fR(r,s)}refine(e,t){const r=i=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(i):t;return this._refinement((i,s)=>{const o=e(i),a=()=>s.addIssue({code:Ie.custom,...r(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,t){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof t=="function"?t(r,i):t),!1))}_refinement(e){return new Rs({schema:this,typeName:vt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return lo.create(this,this._def)}nullable(){return ll.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ts.create(this,this._def)}promise(){return Dd.create(this,this._def)}or(e){return tp.create([this,e],this._def)}and(e){return np.create(this,e,this._def)}transform(e){return new Rs({...Nt(this._def),schema:this,typeName:vt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new ap({...Nt(this._def),innerType:this,defaultValue:t,typeName:vt.ZodDefault})}brand(){return new nE({typeName:vt.ZodBranded,type:this,...Nt(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new lp({...Nt(this._def),innerType:this,catchValue:t,typeName:vt.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return $p.create(this,e)}readonly(){return cp.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const I6=/^c[^\s-]{8,}$/i,L6=/^[0-9a-z]+$/,N6=/^[0-9A-HJKMNP-TV-Z]{26}$/,D6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,O6=/^[a-z0-9_-]{21}$/i,k6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,U6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,F6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let G_;const z6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,B6=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,V6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,vN="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",H6=new RegExp(`^${vN}$`);function yN(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function W6(n){return new RegExp(`^${yN(n)}$`)}function xN(n){let e=`${vN}T${yN(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function G6(n,e){return!!((e==="v4"||!e)&&z6.test(n)||(e==="v6"||!e)&&B6.test(n))}class bs extends Bt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ye.string){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_type,expected:Ye.string,received:s.parsedType}),xt}const r=new Hr;let i;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(i=this._getOrReturnCtx(e,i),Ge(i,{code:Ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,a=e.data.lengthe.test(i),{validation:t,code:Ie.invalid_string,...ut.errToObj(r)})}_addCheck(e){return new bs({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...ut.errToObj(e)})}url(e){return this._addCheck({kind:"url",...ut.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...ut.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...ut.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...ut.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...ut.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...ut.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...ut.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...ut.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...ut.errToObj(e)})}datetime(e){var t,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...ut.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...ut.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...ut.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...ut.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...ut.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...ut.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...ut.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...ut.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...ut.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...ut.errToObj(t)})}nonempty(e){return this.min(1,ut.errToObj(e))}trim(){return new bs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new bs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new bs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new bs({checks:[],typeName:vt.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...Nt(n)})};function j6(n,e){const t=(n.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=t>r?t:r,s=parseInt(n.toFixed(i).replace(".","")),o=parseInt(e.toFixed(i).replace(".",""));return s%o/Math.pow(10,i)}class sl extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ye.number){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_type,expected:Ye.number,received:s.parsedType}),xt}let r;const i=new Hr;for(const s of this._def.checks)s.kind==="int"?$t.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ie.invalid_type,expected:"integer",received:"float",message:s.message}),i.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ie.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),i.dirty()):s.kind==="multipleOf"?j6(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ie.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ie.not_finite,message:s.message}),i.dirty()):$t.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ut.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ut.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ut.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ut.toString(t))}setLimit(e,t,r,i){return new sl({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ut.toString(i)}]})}_addCheck(e){return new sl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:ut.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ut.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ut.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ut.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ut.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ut.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:ut.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ut.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ut.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuee.kind==="int"||e.kind==="multipleOf"&&$t.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(t===null||r.value>t)&&(t=r.value):r.kind==="max"&&(e===null||r.valuenew sl({checks:[],typeName:vt.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1,...Nt(n)});class ol extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ye.bigint){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_type,expected:Ye.bigint,received:s.parsedType}),xt}let r;const i=new Hr;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ie.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),i.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ie.not_multiple_of,multipleOf:s.value,message:s.message}),i.dirty()):$t.assertNever(s);return{status:i.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,ut.toString(t))}gt(e,t){return this.setLimit("min",e,!1,ut.toString(t))}lte(e,t){return this.setLimit("max",e,!0,ut.toString(t))}lt(e,t){return this.setLimit("max",e,!1,ut.toString(t))}setLimit(e,t,r,i){return new ol({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:ut.toString(i)}]})}_addCheck(e){return new ol({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ut.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ut.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ut.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ut.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:ut.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value{var e;return new ol({checks:[],typeName:vt.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1,...Nt(n)})};class Qh extends Bt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ye.boolean){const r=this._getOrReturnCtx(e);return Ge(r,{code:Ie.invalid_type,expected:Ye.boolean,received:r.parsedType}),xt}return ni(e.data)}}Qh.create=n=>new Qh({typeName:vt.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1,...Nt(n)});class Mc extends Bt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ye.date){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_type,expected:Ye.date,received:s.parsedType}),xt}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_date}),xt}const r=new Hr;let i;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(i=this._getOrReturnCtx(e,i),Ge(i,{code:Ie.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):$t.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Mc({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:ut.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:ut.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.valuenew Mc({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:vt.ZodDate,...Nt(n)});class e0 extends Bt{_parse(e){if(this._getType(e)!==Ye.symbol){const r=this._getOrReturnCtx(e);return Ge(r,{code:Ie.invalid_type,expected:Ye.symbol,received:r.parsedType}),xt}return ni(e.data)}}e0.create=n=>new e0({typeName:vt.ZodSymbol,...Nt(n)});class Jh extends Bt{_parse(e){if(this._getType(e)!==Ye.undefined){const r=this._getOrReturnCtx(e);return Ge(r,{code:Ie.invalid_type,expected:Ye.undefined,received:r.parsedType}),xt}return ni(e.data)}}Jh.create=n=>new Jh({typeName:vt.ZodUndefined,...Nt(n)});class ep extends Bt{_parse(e){if(this._getType(e)!==Ye.null){const r=this._getOrReturnCtx(e);return Ge(r,{code:Ie.invalid_type,expected:Ye.null,received:r.parsedType}),xt}return ni(e.data)}}ep.create=n=>new ep({typeName:vt.ZodNull,...Nt(n)});class Nd extends Bt{constructor(){super(...arguments),this._any=!0}_parse(e){return ni(e.data)}}Nd.create=n=>new Nd({typeName:vt.ZodAny,...Nt(n)});class vc extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ni(e.data)}}vc.create=n=>new vc({typeName:vt.ZodUnknown,...Nt(n)});class Ko extends Bt{_parse(e){const t=this._getOrReturnCtx(e);return Ge(t,{code:Ie.invalid_type,expected:Ye.never,received:t.parsedType}),xt}}Ko.create=n=>new Ko({typeName:vt.ZodNever,...Nt(n)});class t0 extends Bt{_parse(e){if(this._getType(e)!==Ye.undefined){const r=this._getOrReturnCtx(e);return Ge(r,{code:Ie.invalid_type,expected:Ye.void,received:r.parsedType}),xt}return ni(e.data)}}t0.create=n=>new t0({typeName:vt.ZodVoid,...Nt(n)});class Ts extends Bt{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==Ye.array)return Ge(t,{code:Ie.invalid_type,expected:Ye.array,received:t.parsedType}),xt;if(i.exactLength!==null){const o=t.data.length>i.exactLength.value,a=t.data.lengthi.maxLength.value&&(Ge(t,{code:Ie.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((o,a)=>i.type._parseAsync(new fo(t,o,t.path,a)))).then(o=>Hr.mergeArray(r,o));const s=[...t.data].map((o,a)=>i.type._parseSync(new fo(t,o,t.path,a)));return Hr.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new Ts({...this._def,minLength:{value:e,message:ut.toString(t)}})}max(e,t){return new Ts({...this._def,maxLength:{value:e,message:ut.toString(t)}})}length(e,t){return new Ts({...this._def,exactLength:{value:e,message:ut.toString(t)}})}nonempty(e){return this.min(1,e)}}Ts.create=(n,e)=>new Ts({type:n,minLength:null,maxLength:null,exactLength:null,typeName:vt.ZodArray,...Nt(e)});function Ou(n){if(n instanceof Cn){const e={};for(const t in n.shape){const r=n.shape[t];e[t]=lo.create(Ou(r))}return new Cn({...n._def,shape:()=>e})}else return n instanceof Ts?new Ts({...n._def,type:Ou(n.element)}):n instanceof lo?lo.create(Ou(n.unwrap())):n instanceof ll?ll.create(Ou(n.unwrap())):n instanceof ho?ho.create(n.items.map(e=>Ou(e))):n}class Cn extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=$t.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==Ye.object){const u=this._getOrReturnCtx(e);return Ge(u,{code:Ie.invalid_type,expected:Ye.object,received:u.parsedType}),xt}const{status:r,ctx:i}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Ko&&this._def.unknownKeys==="strip"))for(const u in i.data)o.includes(u)||a.push(u);const l=[];for(const u of o){const f=s[u],h=i.data[u];l.push({key:{status:"valid",value:u},value:f._parse(new fo(i,h,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Ko){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of a)l.push({key:{status:"valid",value:f},value:{status:"valid",value:i.data[f]}});else if(u==="strict")a.length>0&&(Ge(i,{code:Ie.unrecognized_keys,keys:a}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of a){const h=i.data[f];l.push({key:{status:"valid",value:f},value:u._parse(new fo(i,h,i.path,f)),alwaysSet:f in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of l){const h=await f.key,p=await f.value;u.push({key:h,value:p,alwaysSet:f.alwaysSet})}return u}).then(u=>Hr.mergeObjectSync(r,u)):Hr.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return ut.errToObj,new Cn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var i,s,o,a;const l=(o=(s=(i=this._def).errorMap)===null||s===void 0?void 0:s.call(i,t,r).message)!==null&&o!==void 0?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(a=ut.errToObj(e).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Cn({...this._def,unknownKeys:"strip"})}passthrough(){return new Cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:vt.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Cn({...this._def,catchall:e})}pick(e){const t={};return $t.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new Cn({...this._def,shape:()=>t})}omit(e){const t={};return $t.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new Cn({...this._def,shape:()=>t})}deepPartial(){return Ou(this)}partial(e){const t={};return $t.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}),new Cn({...this._def,shape:()=>t})}required(e){const t={};return $t.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof lo;)s=s._def.innerType;t[r]=s}}),new Cn({...this._def,shape:()=>t})}keyof(){return _N($t.objectKeys(this.shape))}}Cn.create=(n,e)=>new Cn({shape:()=>n,unknownKeys:"strip",catchall:Ko.create(),typeName:vt.ZodObject,...Nt(e)});Cn.strictCreate=(n,e)=>new Cn({shape:()=>n,unknownKeys:"strict",catchall:Ko.create(),typeName:vt.ZodObject,...Nt(e)});Cn.lazycreate=(n,e)=>new Cn({shape:n,unknownKeys:"strip",catchall:Ko.create(),typeName:vt.ZodObject,...Nt(e)});class tp extends Bt{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;function i(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Oi(a.ctx.common.issues));return Ge(t,{code:Ie.invalid_union,unionErrors:o}),xt}if(t.common.async)return Promise.all(r.map(async s=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(i);{let s;const o=[];for(const l of r){const u={...t,common:{...t.common,issues:[]},parent:null},f=l._parseSync({data:t.data,path:t.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Oi(l));return Ge(t,{code:Ie.invalid_union,unionErrors:a}),xt}}get options(){return this._def.options}}tp.create=(n,e)=>new tp({options:n,typeName:vt.ZodUnion,...Nt(e)});const Lo=n=>n instanceof ip?Lo(n.schema):n instanceof Rs?Lo(n.innerType()):n instanceof sp?[n.value]:n instanceof al?n.options:n instanceof op?$t.objectValues(n.enum):n instanceof ap?Lo(n._def.innerType):n instanceof Jh?[void 0]:n instanceof ep?[null]:n instanceof lo?[void 0,...Lo(n.unwrap())]:n instanceof ll?[null,...Lo(n.unwrap())]:n instanceof nE||n instanceof cp?Lo(n.unwrap()):n instanceof lp?Lo(n._def.innerType):[];class wy extends Bt{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ye.object)return Ge(t,{code:Ie.invalid_type,expected:Ye.object,received:t.parsedType}),xt;const r=this.discriminator,i=t.data[r],s=this.optionsMap.get(i);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(Ge(t,{code:Ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),xt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const i=new Map;for(const s of t){const o=Lo(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(i.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);i.set(a,s)}}return new wy({typeName:vt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...Nt(r)})}}function N1(n,e){const t=La(n),r=La(e);if(n===e)return{valid:!0,data:n};if(t===Ye.object&&r===Ye.object){const i=$t.objectKeys(e),s=$t.objectKeys(n).filter(a=>i.indexOf(a)!==-1),o={...n,...e};for(const a of s){const l=N1(n[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(t===Ye.array&&r===Ye.array){if(n.length!==e.length)return{valid:!1};const i=[];for(let s=0;s{if(I1(s)||I1(o))return xt;const a=N1(s.value,o.value);return a.valid?((L1(s)||L1(o))&&t.dirty(),{status:t.value,value:a.data}):(Ge(r,{code:Ie.invalid_intersection_types}),xt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>i(s,o)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}np.create=(n,e,t)=>new np({left:n,right:e,typeName:vt.ZodIntersection,...Nt(t)});class ho extends Bt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.array)return Ge(r,{code:Ie.invalid_type,expected:Ye.array,received:r.parsedType}),xt;if(r.data.lengththis._def.items.length&&(Ge(r,{code:Ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const s=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new fo(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Hr.mergeArray(t,o)):Hr.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new ho({...this._def,rest:e})}}ho.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ho({items:n,typeName:vt.ZodTuple,rest:null,...Nt(e)})};class rp extends Bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.object)return Ge(r,{code:Ie.invalid_type,expected:Ye.object,received:r.parsedType}),xt;const i=[],s=this._def.keyType,o=this._def.valueType;for(const a in r.data)i.push({key:s._parse(new fo(r,a,r.path,a)),value:o._parse(new fo(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?Hr.mergeObjectAsync(t,i):Hr.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof Bt?new rp({keyType:e,valueType:t,typeName:vt.ZodRecord,...Nt(r)}):new rp({keyType:bs.create(),valueType:e,typeName:vt.ZodRecord,...Nt(t)})}}class n0 extends Bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.map)return Ge(r,{code:Ie.invalid_type,expected:Ye.map,received:r.parsedType}),xt;const i=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([a,l],u)=>({key:i._parse(new fo(r,a,r.path,[u,"key"])),value:s._parse(new fo(r,l,r.path,[u,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const u=await l.key,f=await l.value;if(u.status==="aborted"||f.status==="aborted")return xt;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),a.set(u.value,f.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const l of o){const u=l.key,f=l.value;if(u.status==="aborted"||f.status==="aborted")return xt;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),a.set(u.value,f.value)}return{status:t.value,value:a}}}}n0.create=(n,e,t)=>new n0({valueType:e,keyType:n,typeName:vt.ZodMap,...Nt(t)});class Ec extends Bt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.set)return Ge(r,{code:Ie.invalid_type,expected:Ye.set,received:r.parsedType}),xt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Ge(r,{code:Ie.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());const s=this._def.valueType;function o(l){const u=new Set;for(const f of l){if(f.status==="aborted")return xt;f.status==="dirty"&&t.dirty(),u.add(f.value)}return{status:t.value,value:u}}const a=[...r.data.values()].map((l,u)=>s._parse(new fo(r,l,r.path,u)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,t){return new Ec({...this._def,minSize:{value:e,message:ut.toString(t)}})}max(e,t){return new Ec({...this._def,maxSize:{value:e,message:ut.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ec.create=(n,e)=>new Ec({valueType:n,minSize:null,maxSize:null,typeName:vt.ZodSet,...Nt(e)});class id extends Bt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ye.function)return Ge(t,{code:Ie.invalid_type,expected:Ye.function,received:t.parsedType}),xt;function r(a,l){return Qv({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kv(),Ld].filter(u=>!!u),issueData:{code:Ie.invalid_arguments,argumentsError:l}})}function i(a,l){return Qv({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Kv(),Ld].filter(u=>!!u),issueData:{code:Ie.invalid_return_type,returnTypeError:l}})}const s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Dd){const a=this;return ni(async function(...l){const u=new Oi([]),f=await a._def.args.parseAsync(l,s).catch(g=>{throw u.addIssue(r(l,g)),u}),h=await Reflect.apply(o,this,f);return await a._def.returns._def.type.parseAsync(h,s).catch(g=>{throw u.addIssue(i(h,g)),u})})}else{const a=this;return ni(function(...l){const u=a._def.args.safeParse(l,s);if(!u.success)throw new Oi([r(l,u.error)]);const f=Reflect.apply(o,this,u.data),h=a._def.returns.safeParse(f,s);if(!h.success)throw new Oi([i(f,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new id({...this._def,args:ho.create(e).rest(vc.create())})}returns(e){return new id({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new id({args:e||ho.create([]).rest(vc.create()),returns:t||vc.create(),typeName:vt.ZodFunction,...Nt(r)})}}class ip extends Bt{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ip.create=(n,e)=>new ip({getter:n,typeName:vt.ZodLazy,...Nt(e)});class sp extends Bt{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ge(t,{received:t.data,code:Ie.invalid_literal,expected:this._def.value}),xt}return{status:"valid",value:e.data}}get value(){return this._def.value}}sp.create=(n,e)=>new sp({value:n,typeName:vt.ZodLiteral,...Nt(e)});function _N(n,e){return new al({values:n,typeName:vt.ZodEnum,...Nt(e)})}class al extends Bt{constructor(){super(...arguments),rh.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),r=this._def.values;return Ge(t,{expected:$t.joinValues(r),received:t.parsedType,code:Ie.invalid_type}),xt}if(Jv(this,rh)||gN(this,rh,new Set(this._def.values)),!Jv(this,rh).has(e.data)){const t=this._getOrReturnCtx(e),r=this._def.values;return Ge(t,{received:t.data,code:Ie.invalid_enum_value,options:r}),xt}return ni(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return al.create(e,{...this._def,...t})}exclude(e,t=this._def){return al.create(this.options.filter(r=>!e.includes(r)),{...this._def,...t})}}rh=new WeakMap;al.create=_N;class op extends Bt{constructor(){super(...arguments),ih.set(this,void 0)}_parse(e){const t=$t.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ye.string&&r.parsedType!==Ye.number){const i=$t.objectValues(t);return Ge(r,{expected:$t.joinValues(i),received:r.parsedType,code:Ie.invalid_type}),xt}if(Jv(this,ih)||gN(this,ih,new Set($t.getValidEnumValues(this._def.values))),!Jv(this,ih).has(e.data)){const i=$t.objectValues(t);return Ge(r,{received:r.data,code:Ie.invalid_enum_value,options:i}),xt}return ni(e.data)}get enum(){return this._def.values}}ih=new WeakMap;op.create=(n,e)=>new op({values:n,typeName:vt.ZodNativeEnum,...Nt(e)});class Dd extends Bt{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Ye.promise&&t.common.async===!1)return Ge(t,{code:Ie.invalid_type,expected:Ye.promise,received:t.parsedType}),xt;const r=t.parsedType===Ye.promise?t.data:Promise.resolve(t.data);return ni(r.then(i=>this._def.type.parseAsync(i,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Dd.create=(n,e)=>new Dd({type:n,typeName:vt.ZodPromise,...Nt(e)});class Rs extends Bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===vt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,s={addIssue:o=>{Ge(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),i.type==="preprocess"){const o=i.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async a=>{if(t.value==="aborted")return xt;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?xt:l.status==="dirty"||t.value==="dirty"?Wu(l.value):l});{if(t.value==="aborted")return xt;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?xt:a.status==="dirty"||t.value==="dirty"?Wu(a.value):a}}if(i.type==="refinement"){const o=a=>{const l=i.refinement(a,s);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?xt:(a.status==="dirty"&&t.dirty(),o(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?xt:(a.status==="dirty"&&t.dirty(),o(a.value).then(()=>({status:t.value,value:a.value}))))}if(i.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!$h(o))return o;const a=i.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>$h(o)?Promise.resolve(i.transform(o.value,s)).then(a=>({status:t.value,value:a})):o);$t.assertNever(i)}}Rs.create=(n,e,t)=>new Rs({schema:n,typeName:vt.ZodEffects,effect:e,...Nt(t)});Rs.createWithPreprocess=(n,e,t)=>new Rs({schema:e,effect:{type:"preprocess",transform:n},typeName:vt.ZodEffects,...Nt(t)});class lo extends Bt{_parse(e){return this._getType(e)===Ye.undefined?ni(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}lo.create=(n,e)=>new lo({innerType:n,typeName:vt.ZodOptional,...Nt(e)});class ll extends Bt{_parse(e){return this._getType(e)===Ye.null?ni(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ll.create=(n,e)=>new ll({innerType:n,typeName:vt.ZodNullable,...Nt(e)});class ap extends Bt{_parse(e){const{ctx:t}=this._processInputParams(e);let r=t.data;return t.parsedType===Ye.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ap.create=(n,e)=>new ap({innerType:n,typeName:vt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Nt(e)});class lp extends Bt{_parse(e){const{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Kh(i)?i.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Oi(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Oi(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}lp.create=(n,e)=>new lp({innerType:n,typeName:vt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Nt(e)});class r0 extends Bt{_parse(e){if(this._getType(e)!==Ye.nan){const r=this._getOrReturnCtx(e);return Ge(r,{code:Ie.invalid_type,expected:Ye.nan,received:r.parsedType}),xt}return{status:"valid",value:e.data}}}r0.create=n=>new r0({typeName:vt.ZodNaN,...Nt(n)});const X6=Symbol("zod_brand");class nE extends Bt{_parse(e){const{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class $p extends Bt{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?xt:s.status==="dirty"?(t.dirty(),Wu(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?xt:i.status==="dirty"?(t.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,t){return new $p({in:e,out:t,typeName:vt.ZodPipeline})}}class cp extends Bt{_parse(e){const t=this._def.innerType._parse(e),r=i=>($h(i)&&(i.value=Object.freeze(i.value)),i);return Kh(t)?t.then(i=>r(i)):r(t)}unwrap(){return this._def.innerType}}cp.create=(n,e)=>new cp({innerType:n,typeName:vt.ZodReadonly,...Nt(e)});function SN(n,e={},t){return n?Nd.create().superRefine((r,i)=>{var s,o;if(!n(r)){const a=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(o=(s=a.fatal)!==null&&s!==void 0?s:t)!==null&&o!==void 0?o:!0,u=typeof a=="string"?{message:a}:a;i.addIssue({code:"custom",...u,fatal:l})}}):Nd.create()}const q6={object:Cn.lazycreate};var vt;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(vt||(vt={}));const Y6=(n,e={message:`Input not instance of ${n.name}`})=>SN(t=>t instanceof n,e),wN=bs.create,MN=sl.create,Z6=r0.create,$6=ol.create,EN=Qh.create,K6=Mc.create,Q6=e0.create,J6=Jh.create,ej=ep.create,tj=Nd.create,nj=vc.create,rj=Ko.create,ij=t0.create,sj=Ts.create,oj=Cn.create,aj=Cn.strictCreate,lj=tp.create,cj=wy.create,uj=np.create,dj=ho.create,fj=rp.create,hj=n0.create,pj=Ec.create,mj=id.create,gj=ip.create,vj=sp.create,yj=al.create,xj=op.create,_j=Dd.create,hR=Rs.create,Sj=lo.create,wj=ll.create,Mj=Rs.createWithPreprocess,Ej=$p.create,bj=()=>wN().optional(),Tj=()=>MN().optional(),Cj=()=>EN().optional(),Aj={string:n=>bs.create({...n,coerce:!0}),number:n=>sl.create({...n,coerce:!0}),boolean:n=>Qh.create({...n,coerce:!0}),bigint:n=>ol.create({...n,coerce:!0}),date:n=>Mc.create({...n,coerce:!0})},Rj=xt;var fi=Object.freeze({__proto__:null,defaultErrorMap:Ld,setErrorMap:R6,getErrorMap:Kv,makeIssue:Qv,EMPTY_PATH:P6,addIssueToContext:Ge,ParseStatus:Hr,INVALID:xt,DIRTY:Wu,OK:ni,isAborted:I1,isDirty:L1,isValid:$h,isAsync:Kh,get util(){return $t},get objectUtil(){return P1},ZodParsedType:Ye,getParsedType:La,ZodType:Bt,datetimeRegex:xN,ZodString:bs,ZodNumber:sl,ZodBigInt:ol,ZodBoolean:Qh,ZodDate:Mc,ZodSymbol:e0,ZodUndefined:Jh,ZodNull:ep,ZodAny:Nd,ZodUnknown:vc,ZodNever:Ko,ZodVoid:t0,ZodArray:Ts,ZodObject:Cn,ZodUnion:tp,ZodDiscriminatedUnion:wy,ZodIntersection:np,ZodTuple:ho,ZodRecord:rp,ZodMap:n0,ZodSet:Ec,ZodFunction:id,ZodLazy:ip,ZodLiteral:sp,ZodEnum:al,ZodNativeEnum:op,ZodPromise:Dd,ZodEffects:Rs,ZodTransformer:Rs,ZodOptional:lo,ZodNullable:ll,ZodDefault:ap,ZodCatch:lp,ZodNaN:r0,BRAND:X6,ZodBranded:nE,ZodPipeline:$p,ZodReadonly:cp,custom:SN,Schema:Bt,ZodSchema:Bt,late:q6,get ZodFirstPartyTypeKind(){return vt},coerce:Aj,any:tj,array:sj,bigint:$6,boolean:EN,date:K6,discriminatedUnion:cj,effect:hR,enum:yj,function:mj,instanceof:Y6,intersection:uj,lazy:gj,literal:vj,map:hj,nan:Z6,nativeEnum:xj,never:rj,null:ej,nullable:wj,number:MN,object:oj,oboolean:Cj,onumber:Tj,optional:Sj,ostring:bj,pipeline:Ej,preprocess:Mj,promise:_j,record:fj,set:pj,strictObject:aj,string:wN,symbol:Q6,transformer:hR,tuple:dj,undefined:J6,union:lj,unknown:nj,void:ij,NEVER:Rj,ZodIssueCode:Ie,quotelessJson:A6,ZodError:Oi}),Pj=async(...n)=>{const e=await fetch(...n);if(!e.ok)throw new Error(`Request failed with status ${e.status}`);return e.json()};function Ij(n=Pj){return async(e,...t)=>{const r=await n(...t);return e.parse(r)}}const bN=fi.object({avatar_url:fi.string().nullable(),id:fi.number(),username:fi.string(),track_count:fi.number().optional().nullable()}),Lj=fi.object({id:fi.number(),title:fi.string(),artwork_url:fi.string().nullable(),playback_count:fi.number().nullable(),user:bN.optional()}),rE="https://soundcloud-api-proxy.fly.dev/proxy",iE=Ij(),Nj=async({query:n,limit:e=5})=>{const t=`${rE}/users?${new URLSearchParams({q:n,limit:e.toString()}).toString()}`;return await iE(fi.array(bN),t,{method:"GET"})},Dj=async({userId:n,limit:e=50})=>{const t=`${rE}/users/${n}/tracks?${new URLSearchParams({access:"playable",limit:e.toString()}).toString()}`;return(await iE(fi.array(Lj),t,{method:"GET"})).sort((i,s)=>(s.playback_count??Number.POSITIVE_INFINITY)-(i.playback_count??Number.POSITIVE_INFINITY))},Oj=async n=>{const{http_mp3_128_url:e}=await iE(fi.object({http_mp3_128_url:fi.string()}),`${rE}/tracks/${n}/streams`,{method:"GET"});return e};function TN(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(e=0;e{const e=zj(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:r}=n;return{getClassGroupId:o=>{const a=o.split(sE);return a[0]===""&&a.length!==1&&a.shift(),CN(a,e)||Fj(o)},getConflictingClassGroupIds:(o,a)=>{const l=t[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},CN=(n,e)=>{var o;if(n.length===0)return e.classGroupId;const t=n[0],r=e.nextPart.get(t),i=r?CN(n.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=n.join(sE);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},pR=/^\[(.+)\]$/,Fj=n=>{if(pR.test(n)){const e=pR.exec(n)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},zj=n=>{const{theme:e,prefix:t}=n,r={nextPart:new Map,validators:[]};return Vj(Object.entries(n.classGroups),t).forEach(([s,o])=>{D1(o,r,s,e)}),r},D1=(n,e,t,r)=>{n.forEach(i=>{if(typeof i=="string"){const s=i===""?e:mR(e,i);s.classGroupId=t;return}if(typeof i=="function"){if(Bj(i)){D1(i(r),e,t,r);return}e.validators.push({validator:i,classGroupId:t});return}Object.entries(i).forEach(([s,o])=>{D1(o,mR(e,s),t,r)})})},mR=(n,e)=>{let t=n;return e.split(sE).forEach(r=>{t.nextPart.has(r)||t.nextPart.set(r,{nextPart:new Map,validators:[]}),t=t.nextPart.get(r)}),t},Bj=n=>n.isThemeGetter,Vj=(n,e)=>e?n.map(([t,r])=>{const i=r.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[t,i]}):n,Hj=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,r=new Map;const i=(s,o)=>{t.set(s,o),e++,e>n&&(e=0,r=t,t=new Map)};return{get(s){let o=t.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){t.has(s)?t.set(s,o):i(s,o)}}},AN="!",Wj=n=>{const{separator:e,experimentalParseClassName:t}=n,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let u=0,f=0,h;for(let x=0;xf?h-f:void 0;return{modifiers:l,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:_}};return t?a=>t({className:a,parseClassName:o}):o},Gj=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(r=>{r[0]==="["?(e.push(...t.sort(),r),t=[]):t.push(r)}),e.push(...t.sort()),e},jj=n=>({cache:Hj(n.cacheSize),parseClassName:Wj(n),...Uj(n)}),Xj=/\s+/,qj=(n,e)=>{const{parseClassName:t,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=n.trim().split(Xj);let a="";for(let l=o.length-1;l>=0;l-=1){const u=o[l],{modifiers:f,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}=t(u);let v=!!g,_=r(v?p.substring(0,g):p);if(!_){if(!v){a=u+(a.length>0?" "+a:a);continue}if(_=r(p),!_){a=u+(a.length>0?" "+a:a);continue}v=!1}const x=Gj(f).join(":"),m=h?x+AN:x,w=m+_;if(s.includes(w))continue;s.push(w);const S=i(_,v);for(let E=0;E0?" "+a:a)}return a};function Yj(){let n=0,e,t,r="";for(;n{if(typeof n=="string")return n;let e,t="";for(let r=0;rh(f),n());return t=jj(u),r=t.cache.get,i=t.cache.set,s=a,a(l)}function a(l){const u=r(l);if(u)return u;const f=qj(l,t);return i(l,f),f}return function(){return s(Yj.apply(null,arguments))}}const _n=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},PN=/^\[(?:([a-z-]+):)?(.+)\]$/i,$j=/^\d+\/\d+$/,Kj=new Set(["px","full","screen"]),Qj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Jj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,e9=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,t9=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,n9=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Io=n=>sd(n)||Kj.has(n)||$j.test(n),Ea=n=>tf(n,"length",u9),sd=n=>!!n&&!Number.isNaN(Number(n)),j_=n=>tf(n,"number",sd),Hf=n=>!!n&&Number.isInteger(Number(n)),r9=n=>n.endsWith("%")&&sd(n.slice(0,-1)),kt=n=>PN.test(n),ba=n=>Qj.test(n),i9=new Set(["length","size","percentage"]),s9=n=>tf(n,i9,IN),o9=n=>tf(n,"position",IN),a9=new Set(["image","url"]),l9=n=>tf(n,a9,f9),c9=n=>tf(n,"",d9),Wf=()=>!0,tf=(n,e,t)=>{const r=PN.exec(n);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):t(r[2]):!1},u9=n=>Jj.test(n)&&!e9.test(n),IN=()=>!1,d9=n=>t9.test(n),f9=n=>n9.test(n),h9=()=>{const n=_n("colors"),e=_n("spacing"),t=_n("blur"),r=_n("brightness"),i=_n("borderColor"),s=_n("borderRadius"),o=_n("borderSpacing"),a=_n("borderWidth"),l=_n("contrast"),u=_n("grayscale"),f=_n("hueRotate"),h=_n("invert"),p=_n("gap"),g=_n("gradientColorStops"),v=_n("gradientColorStopPositions"),_=_n("inset"),x=_n("margin"),m=_n("opacity"),w=_n("padding"),S=_n("saturate"),E=_n("scale"),R=_n("sepia"),P=_n("skew"),L=_n("space"),D=_n("translate"),B=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],N=()=>["auto",kt,e],G=()=>[kt,e],Q=()=>["",Io,Ea],V=()=>["auto",sd,kt],Z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],re=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],k=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",kt],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],K=()=>[sd,kt];return{cacheSize:500,separator:":",theme:{colors:[Wf],spacing:[Io,Ea],blur:["none","",ba,kt],brightness:K(),borderColor:[n],borderRadius:["none","","full",ba,kt],borderSpacing:G(),borderWidth:Q(),contrast:K(),grayscale:j(),hueRotate:K(),invert:j(),gap:G(),gradientColorStops:[n],gradientColorStopPositions:[r9,Ea],inset:N(),margin:N(),opacity:K(),padding:G(),saturate:K(),scale:K(),sepia:j(),skew:K(),space:G(),translate:G()},classGroups:{aspect:[{aspect:["auto","square","video",kt]}],container:["container"],columns:[{columns:[ba]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Z(),kt]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[_]}],"inset-x":[{"inset-x":[_]}],"inset-y":[{"inset-y":[_]}],start:[{start:[_]}],end:[{end:[_]}],top:[{top:[_]}],right:[{right:[_]}],bottom:[{bottom:[_]}],left:[{left:[_]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Hf,kt]}],basis:[{basis:N()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",kt]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",Hf,kt]}],"grid-cols":[{"grid-cols":[Wf]}],"col-start-end":[{col:["auto",{span:["full",Hf,kt]},kt]}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":[Wf]}],"row-start-end":[{row:["auto",{span:[Hf,kt]},kt]}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",kt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",kt]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...k()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...k(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...k(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[L]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[L]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",kt,e]}],"min-w":[{"min-w":[kt,e,"min","max","fit"]}],"max-w":[{"max-w":[kt,e,"none","full","min","max","fit","prose",{screen:[ba]},ba]}],h:[{h:[kt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[kt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[kt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[kt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",ba,Ea]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",j_]}],"font-family":[{font:[Wf]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",kt]}],"line-clamp":[{"line-clamp":["none",sd,j_]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Io,kt]}],"list-image":[{"list-image":["none",kt]}],"list-style-type":[{list:["none","disc","decimal",kt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Io,Ea]}],"underline-offset":[{"underline-offset":["auto",Io,kt]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:G()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",kt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",kt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Z(),o9]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",s9]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},l9]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:$()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[Io,kt]}],"outline-w":[{outline:[Io,Ea]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:Q()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[Io,Ea]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",ba,c9]}],"shadow-color":[{shadow:[Wf]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...re(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":re()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ba,kt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[h]}],saturate:[{saturate:[S]}],sepia:[{sepia:[R]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[R]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",kt]}],duration:[{duration:K()}],ease:[{ease:["linear","in","out","in-out",kt]}],delay:[{delay:K()}],animate:[{animate:["none","spin","ping","pulse","bounce",kt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Hf,kt]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",kt]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",kt]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":G()}],"scroll-mx":[{"scroll-mx":G()}],"scroll-my":[{"scroll-my":G()}],"scroll-ms":[{"scroll-ms":G()}],"scroll-me":[{"scroll-me":G()}],"scroll-mt":[{"scroll-mt":G()}],"scroll-mr":[{"scroll-mr":G()}],"scroll-mb":[{"scroll-mb":G()}],"scroll-ml":[{"scroll-ml":G()}],"scroll-p":[{"scroll-p":G()}],"scroll-px":[{"scroll-px":G()}],"scroll-py":[{"scroll-py":G()}],"scroll-ps":[{"scroll-ps":G()}],"scroll-pe":[{"scroll-pe":G()}],"scroll-pt":[{"scroll-pt":G()}],"scroll-pr":[{"scroll-pr":G()}],"scroll-pb":[{"scroll-pb":G()}],"scroll-pl":[{"scroll-pl":G()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",kt]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[Io,Ea,j_]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},p9=Zj(h9);function jt(...n){return p9(kj(n))}var Kp=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Od=typeof window>"u"||"Deno"in globalThis;function ts(){}function m9(n,e){return typeof n=="function"?n(e):n}function O1(n){return typeof n=="number"&&n>=0&&n!==1/0}function LN(n,e){return Math.max(n+(e||0)-Date.now(),0)}function od(n,e){return typeof n=="function"?n(e):n}function Ms(n,e){return typeof n=="function"?n(e):n}function gR(n,e){const{type:t="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=n;if(o){if(r){if(e.queryHash!==oE(o,e.options))return!1}else if(!dp(e.queryKey,o))return!1}if(t!=="all"){const l=e.isActive();if(t==="active"&&!l||t==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||i&&i!==e.state.fetchStatus||s&&!s(e))}function vR(n,e){const{exact:t,status:r,predicate:i,mutationKey:s}=n;if(s){if(!e.options.mutationKey)return!1;if(t){if(up(e.options.mutationKey)!==up(s))return!1}else if(!dp(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function oE(n,e){return((e==null?void 0:e.queryKeyHashFn)||up)(n)}function up(n){return JSON.stringify(n,(e,t)=>U1(t)?Object.keys(t).sort().reduce((r,i)=>(r[i]=t[i],r),{}):t)}function dp(n,e){return n===e?!0:typeof n!=typeof e?!1:n&&e&&typeof n=="object"&&typeof e=="object"?!Object.keys(e).some(t=>!dp(n[t],e[t])):!1}function NN(n,e){if(n===e)return n;const t=yR(n)&&yR(e);if(t||U1(n)&&U1(e)){const r=t?n:Object.keys(n),i=r.length,s=t?e:Object.keys(e),o=s.length,a=t?[]:{};let l=0;for(let u=0;u{setTimeout(e,n)})}function F1(n,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(n,e):t.structuralSharing!==!1?NN(n,e):e}function v9(n,e,t=0){const r=[...n,e];return t&&r.length>t?r.slice(1):r}function y9(n,e,t=0){const r=[e,...n];return t&&r.length>t?r.slice(0,-1):r}var DN=Symbol();function ON(n,e){return!n.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!n.queryFn||n.queryFn===DN?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}var sc,Oa,md,EP,x9=(EP=class extends Kp{constructor(){super();Tt(this,sc);Tt(this,Oa);Tt(this,md);tt(this,md,e=>{if(!Od&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){ee(this,Oa)||this.setEventListener(ee(this,md))}onUnsubscribe(){var e;this.hasListeners()||((e=ee(this,Oa))==null||e.call(this),tt(this,Oa,void 0))}setEventListener(e){var t;tt(this,md,e),(t=ee(this,Oa))==null||t.call(this),tt(this,Oa,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ee(this,sc)!==e&&(tt(this,sc,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof ee(this,sc)=="boolean"?ee(this,sc):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},sc=new WeakMap,Oa=new WeakMap,md=new WeakMap,EP),aE=new x9,gd,ka,vd,bP,_9=(bP=class extends Kp{constructor(){super();Tt(this,gd,!0);Tt(this,ka);Tt(this,vd);tt(this,vd,e=>{if(!Od&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}})}onSubscribe(){ee(this,ka)||this.setEventListener(ee(this,vd))}onUnsubscribe(){var e;this.hasListeners()||((e=ee(this,ka))==null||e.call(this),tt(this,ka,void 0))}setEventListener(e){var t;tt(this,vd,e),(t=ee(this,ka))==null||t.call(this),tt(this,ka,e(this.setOnline.bind(this)))}setOnline(e){ee(this,gd)!==e&&(tt(this,gd,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ee(this,gd)}},gd=new WeakMap,ka=new WeakMap,vd=new WeakMap,bP),i0=new _9;function S9(n){return Math.min(1e3*2**n,3e4)}function kN(n){return(n??"online")==="online"?i0.isOnline():!0}var UN=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function X_(n){return n instanceof UN}function FN(n){let e=!1,t=0,r=!1,i,s,o;const a=new Promise((m,w)=>{s=m,o=w}),l=m=>{var w;r||(v(new UN(m)),(w=n.abort)==null||w.call(n))},u=()=>{e=!0},f=()=>{e=!1},h=()=>aE.isFocused()&&(n.networkMode==="always"||i0.isOnline())&&n.canRun(),p=()=>kN(n.networkMode)&&n.canRun(),g=m=>{var w;r||(r=!0,(w=n.onSuccess)==null||w.call(n,m),i==null||i(),s(m))},v=m=>{var w;r||(r=!0,(w=n.onError)==null||w.call(n,m),i==null||i(),o(m))},_=()=>new Promise(m=>{var w;i=S=>{(r||h())&&m(S)},(w=n.onPause)==null||w.call(n)}).then(()=>{var m;i=void 0,r||(m=n.onContinue)==null||m.call(n)}),x=()=>{if(r)return;let m;const w=t===0?n.initialPromise:void 0;try{m=w??n.fn()}catch(S){m=Promise.reject(S)}Promise.resolve(m).then(g).catch(S=>{var D;if(r)return;const E=n.retry??(Od?0:3),R=n.retryDelay??S9,P=typeof R=="function"?R(t,S):R,L=E===!0||typeof E=="number"&&th()?void 0:_()).then(()=>{e?v(S):x()})})};return{promise:a,cancel:l,continue:()=>(i==null||i(),a),cancelRetry:u,continueRetry:f,canStart:p,start:()=>(p()?x():_().then(x),a)}}function w9(){let n=[],e=0,t=a=>{a()},r=a=>{a()},i=a=>setTimeout(a,0);const s=a=>{e?n.push(a):i(()=>{t(a)})},o=()=>{const a=n;n=[],a.length&&i(()=>{r(()=>{a.forEach(l=>{t(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{t=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{i=a}}}var xr=w9(),oc,TP,zN=(TP=class{constructor(){Tt(this,oc)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),O1(this.gcTime)&&tt(this,oc,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(Od?1/0:5*60*1e3))}clearGcTimeout(){ee(this,oc)&&(clearTimeout(ee(this,oc)),tt(this,oc,void 0))}},oc=new WeakMap,TP),yd,xd,es,Or,Lp,ac,_s,No,CP,M9=(CP=class extends zN{constructor(e){super();Tt(this,_s);Tt(this,yd);Tt(this,xd);Tt(this,es);Tt(this,Or);Tt(this,Lp);Tt(this,ac);tt(this,ac,!1),tt(this,Lp,e.defaultOptions),this.setOptions(e.options),this.observers=[],tt(this,es,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,tt(this,yd,E9(this.options)),this.state=e.state??ee(this,yd),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ee(this,Or))==null?void 0:e.promise}setOptions(e){this.options={...ee(this,Lp),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ee(this,es).remove(this)}setData(e,t){const r=F1(this.state.data,e,this.options);return Yt(this,_s,No).call(this,{data:r,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),r}setState(e,t){Yt(this,_s,No).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var r,i;const t=(r=ee(this,Or))==null?void 0:r.promise;return(i=ee(this,Or))==null||i.cancel(e),t?t.then(ts).catch(ts):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ee(this,yd))}isActive(){return this.observers.some(e=>Ms(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!LN(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=ee(this,Or))==null||t.continue()}onOnline(){var t;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=ee(this,Or))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ee(this,es).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(ee(this,Or)&&(ee(this,ac)?ee(this,Or).cancel({revert:!0}):ee(this,Or).cancelRetry()),this.scheduleGc()),ee(this,es).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Yt(this,_s,No).call(this,{type:"invalidate"})}fetch(e,t){var l,u,f;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(ee(this,Or))return ee(this,Or).continueRetry(),ee(this,Or).promise}if(e&&this.setOptions(e),!this.options.queryFn){const h=this.observers.find(p=>p.options.queryFn);h&&this.setOptions(h.options)}const r=new AbortController,i=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(tt(this,ac,!0),r.signal)})},s=()=>{const h=ON(this.options,t),p={queryKey:this.queryKey,meta:this.meta};return i(p),tt(this,ac,!1),this.options.persister?this.options.persister(h,p,this):h(p)},o={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};i(o),(l=this.options.behavior)==null||l.onFetch(o,this),tt(this,xd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&Yt(this,_s,No).call(this,{type:"fetch",meta:(f=o.fetchOptions)==null?void 0:f.meta});const a=h=>{var p,g,v,_;X_(h)&&h.silent||Yt(this,_s,No).call(this,{type:"error",error:h}),X_(h)||((g=(p=ee(this,es).config).onError)==null||g.call(p,h,this),(_=(v=ee(this,es).config).onSettled)==null||_.call(v,this.state.data,h,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return tt(this,Or,FN({initialPromise:t==null?void 0:t.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:h=>{var p,g,v,_;if(h===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(h)}catch(x){a(x);return}(g=(p=ee(this,es).config).onSuccess)==null||g.call(p,h,this),(_=(v=ee(this,es).config).onSettled)==null||_.call(v,h,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:a,onFail:(h,p)=>{Yt(this,_s,No).call(this,{type:"failed",failureCount:h,error:p})},onPause:()=>{Yt(this,_s,No).call(this,{type:"pause"})},onContinue:()=>{Yt(this,_s,No).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),ee(this,Or).start()}},yd=new WeakMap,xd=new WeakMap,es=new WeakMap,Or=new WeakMap,Lp=new WeakMap,ac=new WeakMap,_s=new WeakSet,No=function(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...BN(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return X_(i)&&i.revert&&ee(this,xd)?{...ee(this,xd),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),xr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ee(this,es).notify({query:this,type:"updated",action:e})})},CP);function BN(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:kN(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function E9(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,r=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Ys,AP,b9=(AP=class extends Kp{constructor(e={}){super();Tt(this,Ys);this.config=e,tt(this,Ys,new Map)}build(e,t,r){const i=t.queryKey,s=t.queryHash??oE(i,t);let o=this.get(s);return o||(o=new M9({cache:this,queryKey:i,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){ee(this,Ys).has(e.queryHash)||(ee(this,Ys).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=ee(this,Ys).get(e.queryHash);t&&(e.destroy(),t===e&&ee(this,Ys).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){xr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ee(this,Ys).get(e)}getAll(){return[...ee(this,Ys).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>gR(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>gR(e,r)):t}notify(e){xr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xr.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xr.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ys=new WeakMap,AP),Zs,Zr,lc,$s,Ca,RP,T9=(RP=class extends zN{constructor(e){super();Tt(this,$s);Tt(this,Zs);Tt(this,Zr);Tt(this,lc);this.mutationId=e.mutationId,tt(this,Zr,e.mutationCache),tt(this,Zs,[]),this.state=e.state||C9(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ee(this,Zs).includes(e)||(ee(this,Zs).push(e),this.clearGcTimeout(),ee(this,Zr).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){tt(this,Zs,ee(this,Zs).filter(t=>t!==e)),this.scheduleGc(),ee(this,Zr).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ee(this,Zs).length||(this.state.status==="pending"?this.scheduleGc():ee(this,Zr).remove(this))}continue(){var e;return((e=ee(this,lc))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,s,o,a,l,u,f,h,p,g,v,_,x,m,w,S,E,R,P,L;tt(this,lc,FN({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(D,B)=>{Yt(this,$s,Ca).call(this,{type:"failed",failureCount:D,error:B})},onPause:()=>{Yt(this,$s,Ca).call(this,{type:"pause"})},onContinue:()=>{Yt(this,$s,Ca).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ee(this,Zr).canRun(this)}));const t=this.state.status==="pending",r=!ee(this,lc).canStart();try{if(!t){Yt(this,$s,Ca).call(this,{type:"pending",variables:e,isPaused:r}),await((s=(i=ee(this,Zr).config).onMutate)==null?void 0:s.call(i,e,this));const B=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e));B!==this.state.context&&Yt(this,$s,Ca).call(this,{type:"pending",context:B,variables:e,isPaused:r})}const D=await ee(this,lc).start();return await((u=(l=ee(this,Zr).config).onSuccess)==null?void 0:u.call(l,D,e,this.state.context,this)),await((h=(f=this.options).onSuccess)==null?void 0:h.call(f,D,e,this.state.context)),await((g=(p=ee(this,Zr).config).onSettled)==null?void 0:g.call(p,D,null,this.state.variables,this.state.context,this)),await((_=(v=this.options).onSettled)==null?void 0:_.call(v,D,null,e,this.state.context)),Yt(this,$s,Ca).call(this,{type:"success",data:D}),D}catch(D){try{throw await((m=(x=ee(this,Zr).config).onError)==null?void 0:m.call(x,D,e,this.state.context,this)),await((S=(w=this.options).onError)==null?void 0:S.call(w,D,e,this.state.context)),await((R=(E=ee(this,Zr).config).onSettled)==null?void 0:R.call(E,void 0,D,this.state.variables,this.state.context,this)),await((L=(P=this.options).onSettled)==null?void 0:L.call(P,void 0,D,e,this.state.context)),D}finally{Yt(this,$s,Ca).call(this,{type:"error",error:D})}}finally{ee(this,Zr).runNext(this)}}},Zs=new WeakMap,Zr=new WeakMap,lc=new WeakMap,$s=new WeakSet,Ca=function(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),xr.batch(()=>{ee(this,Zs).forEach(r=>{r.onMutationUpdate(e)}),ee(this,Zr).notify({mutation:this,type:"updated",action:e})})},RP);function C9(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ci,Np,PP,A9=(PP=class extends Kp{constructor(e={}){super();Tt(this,Ci);Tt(this,Np);this.config=e,tt(this,Ci,new Map),tt(this,Np,Date.now())}build(e,t,r){const i=new T9({mutationCache:this,mutationId:++tg(this,Np)._,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){const t=Yg(e),r=ee(this,Ci).get(t)??[];r.push(e),ee(this,Ci).set(t,r),this.notify({type:"added",mutation:e})}remove(e){var r;const t=Yg(e);if(ee(this,Ci).has(t)){const i=(r=ee(this,Ci).get(t))==null?void 0:r.filter(s=>s!==e);i&&(i.length===0?ee(this,Ci).delete(t):ee(this,Ci).set(t,i))}this.notify({type:"removed",mutation:e})}canRun(e){var r;const t=(r=ee(this,Ci).get(Yg(e)))==null?void 0:r.find(i=>i.state.status==="pending");return!t||t===e}runNext(e){var r;const t=(r=ee(this,Ci).get(Yg(e)))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(t==null?void 0:t.continue())??Promise.resolve()}clear(){xr.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...ee(this,Ci).values()].flat()}find(e){const t={exact:!0,...e};return this.getAll().find(r=>vR(t,r))}findAll(e={}){return this.getAll().filter(t=>vR(e,t))}notify(e){xr.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return xr.batch(()=>Promise.all(e.map(t=>t.continue().catch(ts))))}},Ci=new WeakMap,Np=new WeakMap,PP);function Yg(n){var e;return((e=n.options.scope)==null?void 0:e.id)??String(n.mutationId)}function _R(n){return{onFetch:(e,t)=>{var f,h,p,g,v;const r=e.options,i=(p=(h=(f=e.fetchOptions)==null?void 0:f.meta)==null?void 0:h.fetchMore)==null?void 0:p.direction,s=((g=e.state.data)==null?void 0:g.pages)||[],o=((v=e.state.data)==null?void 0:v.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let _=!1;const x=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(e.signal.aborted?_=!0:e.signal.addEventListener("abort",()=>{_=!0}),e.signal)})},m=ON(e.options,e.fetchOptions),w=async(S,E,R)=>{if(_)return Promise.reject();if(E==null&&S.pages.length)return Promise.resolve(S);const P={queryKey:e.queryKey,pageParam:E,direction:R?"backward":"forward",meta:e.options.meta};x(P);const L=await m(P),{maxPages:D}=e.options,B=R?y9:v9;return{pages:B(S.pages,L,D),pageParams:B(S.pageParams,E,D)}};if(i&&s.length){const S=i==="backward",E=S?R9:SR,R={pages:s,pageParams:o},P=E(r,R);a=await w(R,P,S)}else{const S=n??s.length;do{const E=l===0?o[0]??r.initialPageParam:SR(r,a);if(l>0&&E==null)break;a=await w(a,E),l++}while(l{var _,x;return(x=(_=e.options).persister)==null?void 0:x.call(_,u,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=u}}}function SR(n,{pages:e,pageParams:t}){const r=e.length-1;return e.length>0?n.getNextPageParam(e[r],e,t[r],t):void 0}function R9(n,{pages:e,pageParams:t}){var r;return e.length>0?(r=n.getPreviousPageParam)==null?void 0:r.call(n,e[0],e,t[0],t):void 0}var Un,Ua,Fa,_d,Sd,za,wd,Md,IP,P9=(IP=class{constructor(n={}){Tt(this,Un);Tt(this,Ua);Tt(this,Fa);Tt(this,_d);Tt(this,Sd);Tt(this,za);Tt(this,wd);Tt(this,Md);tt(this,Un,n.queryCache||new b9),tt(this,Ua,n.mutationCache||new A9),tt(this,Fa,n.defaultOptions||{}),tt(this,_d,new Map),tt(this,Sd,new Map),tt(this,za,0)}mount(){tg(this,za)._++,ee(this,za)===1&&(tt(this,wd,aE.subscribe(async n=>{n&&(await this.resumePausedMutations(),ee(this,Un).onFocus())})),tt(this,Md,i0.subscribe(async n=>{n&&(await this.resumePausedMutations(),ee(this,Un).onOnline())})))}unmount(){var n,e;tg(this,za)._--,ee(this,za)===0&&((n=ee(this,wd))==null||n.call(this),tt(this,wd,void 0),(e=ee(this,Md))==null||e.call(this),tt(this,Md,void 0))}isFetching(n){return ee(this,Un).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return ee(this,Ua).findAll({...n,status:"pending"}).length}getQueryData(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=ee(this,Un).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(n){const e=this.getQueryData(n.queryKey);if(e===void 0)return this.fetchQuery(n);{const t=this.defaultQueryOptions(n),r=ee(this,Un).build(this,t);return n.revalidateIfStale&&r.isStaleByTime(od(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(e)}}getQueriesData(n){return ee(this,Un).findAll(n).map(({queryKey:e,state:t})=>{const r=t.data;return[e,r]})}setQueryData(n,e,t){const r=this.defaultQueryOptions({queryKey:n}),i=ee(this,Un).get(r.queryHash),s=i==null?void 0:i.state.data,o=m9(e,s);if(o!==void 0)return ee(this,Un).build(this,r).setData(o,{...t,manual:!0})}setQueriesData(n,e,t){return xr.batch(()=>ee(this,Un).findAll(n).map(({queryKey:r})=>[r,this.setQueryData(r,e,t)]))}getQueryState(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=ee(this,Un).get(e.queryHash))==null?void 0:t.state}removeQueries(n){const e=ee(this,Un);xr.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=ee(this,Un),r={type:"active",...n};return xr.batch(()=>(t.findAll(n).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(n={},e={}){const t={revert:!0,...e},r=xr.batch(()=>ee(this,Un).findAll(n).map(i=>i.cancel(t)));return Promise.all(r).then(ts).catch(ts)}invalidateQueries(n={},e={}){return xr.batch(()=>{if(ee(this,Un).findAll(n).forEach(r=>{r.invalidate()}),n.refetchType==="none")return Promise.resolve();const t={...n,type:n.refetchType??n.type??"active"};return this.refetchQueries(t,e)})}refetchQueries(n={},e){const t={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=xr.batch(()=>ee(this,Un).findAll(n).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,t);return t.throwOnError||(s=s.catch(ts)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(ts)}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=ee(this,Un).build(this,e);return t.isStaleByTime(od(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(ts).catch(ts)}fetchInfiniteQuery(n){return n.behavior=_R(n.pages),this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(ts).catch(ts)}ensureInfiniteQueryData(n){return n.behavior=_R(n.pages),this.ensureQueryData(n)}resumePausedMutations(){return i0.isOnline()?ee(this,Ua).resumePausedMutations():Promise.resolve()}getQueryCache(){return ee(this,Un)}getMutationCache(){return ee(this,Ua)}getDefaultOptions(){return ee(this,Fa)}setDefaultOptions(n){tt(this,Fa,n)}setQueryDefaults(n,e){ee(this,_d).set(up(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...ee(this,_d).values()];let t={};return e.forEach(r=>{dp(n,r.queryKey)&&(t={...t,...r.defaultOptions})}),t}setMutationDefaults(n,e){ee(this,Sd).set(up(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...ee(this,Sd).values()];let t={};return e.forEach(r=>{dp(n,r.mutationKey)&&(t={...t,...r.defaultOptions})}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...ee(this,Fa).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=oE(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===DN&&(e.enabled=!1),e}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...ee(this,Fa).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){ee(this,Un).clear(),ee(this,Ua).clear()}},Un=new WeakMap,Ua=new WeakMap,Fa=new WeakMap,_d=new WeakMap,Sd=new WeakMap,za=new WeakMap,wd=new WeakMap,Md=new WeakMap,IP),ui,Zt,Dp,$r,cc,Ed,Ks,Op,bd,Td,uc,dc,Ba,Cd,an,sh,z1,B1,V1,H1,W1,G1,j1,VN,LP,I9=(LP=class extends Kp{constructor(e,t){super();Tt(this,an);Tt(this,ui);Tt(this,Zt);Tt(this,Dp);Tt(this,$r);Tt(this,cc);Tt(this,Ed);Tt(this,Ks);Tt(this,Op);Tt(this,bd);Tt(this,Td);Tt(this,uc);Tt(this,dc);Tt(this,Ba);Tt(this,Cd,new Set);this.options=t,tt(this,ui,e),tt(this,Ks,null),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(ee(this,Zt).addObserver(this),wR(ee(this,Zt),this.options)?Yt(this,an,sh).call(this):this.updateResult(),Yt(this,an,H1).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return X1(ee(this,Zt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return X1(ee(this,Zt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Yt(this,an,W1).call(this),Yt(this,an,G1).call(this),ee(this,Zt).removeObserver(this)}setOptions(e,t){const r=this.options,i=ee(this,Zt);if(this.options=ee(this,ui).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ms(this.options.enabled,ee(this,Zt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Yt(this,an,j1).call(this),ee(this,Zt).setOptions(this.options),r._defaulted&&!k1(this.options,r)&&ee(this,ui).getQueryCache().notify({type:"observerOptionsUpdated",query:ee(this,Zt),observer:this});const s=this.hasListeners();s&&MR(ee(this,Zt),i,this.options,r)&&Yt(this,an,sh).call(this),this.updateResult(t),s&&(ee(this,Zt)!==i||Ms(this.options.enabled,ee(this,Zt))!==Ms(r.enabled,ee(this,Zt))||od(this.options.staleTime,ee(this,Zt))!==od(r.staleTime,ee(this,Zt)))&&Yt(this,an,z1).call(this);const o=Yt(this,an,B1).call(this);s&&(ee(this,Zt)!==i||Ms(this.options.enabled,ee(this,Zt))!==Ms(r.enabled,ee(this,Zt))||o!==ee(this,Ba))&&Yt(this,an,V1).call(this,o)}getOptimisticResult(e){const t=ee(this,ui).getQueryCache().build(ee(this,ui),e),r=this.createResult(t,e);return N9(this,r)&&(tt(this,$r,r),tt(this,Ed,this.options),tt(this,cc,ee(this,Zt).state)),r}getCurrentResult(){return ee(this,$r)}trackResult(e,t){const r={};return Object.keys(e).forEach(i=>{Object.defineProperty(r,i,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(i),t==null||t(i),e[i])})}),r}trackProp(e){ee(this,Cd).add(e)}getCurrentQuery(){return ee(this,Zt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=ee(this,ui).defaultQueryOptions(e),r=ee(this,ui).getQueryCache().build(ee(this,ui),t);return r.isFetchingOptimistic=!0,r.fetch().then(()=>this.createResult(r,t))}fetch(e){return Yt(this,an,sh).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),ee(this,$r)))}createResult(e,t){var L;const r=ee(this,Zt),i=this.options,s=ee(this,$r),o=ee(this,cc),a=ee(this,Ed),u=e!==r?e.state:ee(this,Dp),{state:f}=e;let h={...f},p=!1,g;if(t._optimisticResults){const D=this.hasListeners(),B=!D&&wR(e,t),A=D&&MR(e,r,t,i);(B||A)&&(h={...h,...BN(f.data,e.options)}),t._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:v,errorUpdatedAt:_,status:x}=h;if(t.select&&h.data!==void 0)if(s&&h.data===(o==null?void 0:o.data)&&t.select===ee(this,Op))g=ee(this,bd);else try{tt(this,Op,t.select),g=t.select(h.data),g=F1(s==null?void 0:s.data,g,t),tt(this,bd,g),tt(this,Ks,null)}catch(D){tt(this,Ks,D)}else g=h.data;if(t.placeholderData!==void 0&&g===void 0&&x==="pending"){let D;if(s!=null&&s.isPlaceholderData&&t.placeholderData===(a==null?void 0:a.placeholderData))D=s.data;else if(D=typeof t.placeholderData=="function"?t.placeholderData((L=ee(this,Td))==null?void 0:L.state.data,ee(this,Td)):t.placeholderData,t.select&&D!==void 0)try{D=t.select(D),tt(this,Ks,null)}catch(B){tt(this,Ks,B)}D!==void 0&&(x="success",g=F1(s==null?void 0:s.data,D,t),p=!0)}ee(this,Ks)&&(v=ee(this,Ks),g=ee(this,bd),_=Date.now(),x="error");const m=h.fetchStatus==="fetching",w=x==="pending",S=x==="error",E=w&&m,R=g!==void 0;return{status:x,fetchStatus:h.fetchStatus,isPending:w,isSuccess:x==="success",isError:S,isInitialLoading:E,isLoading:E,data:g,dataUpdatedAt:h.dataUpdatedAt,error:v,errorUpdatedAt:_,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:m,isRefetching:m&&!w,isLoadingError:S&&!R,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:S&&R,isStale:lE(e,t),refetch:this.refetch}}updateResult(e){const t=ee(this,$r),r=this.createResult(ee(this,Zt),this.options);if(tt(this,cc,ee(this,Zt).state),tt(this,Ed,this.options),ee(this,cc).data!==void 0&&tt(this,Td,ee(this,Zt)),k1(r,t))return;tt(this,$r,r);const i={},s=()=>{if(!t)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!ee(this,Cd).size)return!0;const l=new Set(a??ee(this,Cd));return this.options.throwOnError&&l.add("error"),Object.keys(ee(this,$r)).some(u=>{const f=u;return ee(this,$r)[f]!==t[f]&&l.has(f)})};(e==null?void 0:e.listeners)!==!1&&s()&&(i.listeners=!0),Yt(this,an,VN).call(this,{...i,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Yt(this,an,H1).call(this)}},ui=new WeakMap,Zt=new WeakMap,Dp=new WeakMap,$r=new WeakMap,cc=new WeakMap,Ed=new WeakMap,Ks=new WeakMap,Op=new WeakMap,bd=new WeakMap,Td=new WeakMap,uc=new WeakMap,dc=new WeakMap,Ba=new WeakMap,Cd=new WeakMap,an=new WeakSet,sh=function(e){Yt(this,an,j1).call(this);let t=ee(this,Zt).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(ts)),t},z1=function(){Yt(this,an,W1).call(this);const e=od(this.options.staleTime,ee(this,Zt));if(Od||ee(this,$r).isStale||!O1(e))return;const r=LN(ee(this,$r).dataUpdatedAt,e)+1;tt(this,uc,setTimeout(()=>{ee(this,$r).isStale||this.updateResult()},r))},B1=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(ee(this,Zt)):this.options.refetchInterval)??!1},V1=function(e){Yt(this,an,G1).call(this),tt(this,Ba,e),!(Od||Ms(this.options.enabled,ee(this,Zt))===!1||!O1(ee(this,Ba))||ee(this,Ba)===0)&&tt(this,dc,setInterval(()=>{(this.options.refetchIntervalInBackground||aE.isFocused())&&Yt(this,an,sh).call(this)},ee(this,Ba)))},H1=function(){Yt(this,an,z1).call(this),Yt(this,an,V1).call(this,Yt(this,an,B1).call(this))},W1=function(){ee(this,uc)&&(clearTimeout(ee(this,uc)),tt(this,uc,void 0))},G1=function(){ee(this,dc)&&(clearInterval(ee(this,dc)),tt(this,dc,void 0))},j1=function(){const e=ee(this,ui).getQueryCache().build(ee(this,ui),this.options);if(e===ee(this,Zt))return;const t=ee(this,Zt);tt(this,Zt,e),tt(this,Dp,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))},VN=function(e){xr.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(ee(this,$r))}),ee(this,ui).getQueryCache().notify({query:ee(this,Zt),type:"observerResultsUpdated"})})},LP);function L9(n,e){return Ms(e.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&e.retryOnMount===!1)}function wR(n,e){return L9(n,e)||n.state.data!==void 0&&X1(n,e,e.refetchOnMount)}function X1(n,e,t){if(Ms(e.enabled,n)!==!1){const r=typeof t=="function"?t(n):t;return r==="always"||r!==!1&&lE(n,e)}return!1}function MR(n,e,t,r){return(n!==e||Ms(r.enabled,n)===!1)&&(!t.suspense||n.state.status!=="error")&&lE(n,t)}function lE(n,e){return Ms(e.enabled,n)!==!1&&n.isStaleByTime(od(e.staleTime,n))}function N9(n,e){return!k1(n.getCurrentResult(),e)}var HN=T.createContext(void 0),D9=n=>{const e=T.useContext(HN);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},O9=({client:n,children:e})=>(T.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),C.jsx(HN.Provider,{value:n,children:e})),WN=T.createContext(!1),k9=()=>T.useContext(WN);WN.Provider;function U9(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var F9=T.createContext(U9()),z9=()=>T.useContext(F9);function B9(n,e){return typeof n=="function"?n(...e):!!n}var V9=(n,e)=>{(n.suspense||n.throwOnError)&&(e.isReset()||(n.retryOnMount=!1))},H9=n=>{T.useEffect(()=>{n.clearReset()},[n])},W9=({result:n,errorResetBoundary:e,throwOnError:t,query:r})=>n.isError&&!e.isReset()&&!n.isFetching&&r&&B9(t,[n.error,r]),G9=(n,e)=>e.state.data===void 0,j9=n=>{n.suspense&&(typeof n.staleTime!="number"&&(n.staleTime=1e3),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3)))},X9=(n,e)=>(n==null?void 0:n.suspense)&&e.isPending,q9=(n,e,t)=>e.fetchOptimistic(n).catch(()=>{t.clearReset()});function Y9(n,e,t){var u,f,h,p;const r=D9(),i=k9(),s=z9(),o=r.defaultQueryOptions(n);(f=(u=r.getDefaultOptions().queries)==null?void 0:u._experimental_beforeQuery)==null||f.call(u,o),o._optimisticResults=i?"isRestoring":"optimistic",j9(o),V9(o,s),H9(s);const[a]=T.useState(()=>new e(r,o)),l=a.getOptimisticResult(o);if(T.useSyncExternalStore(T.useCallback(g=>{const v=i?()=>{}:a.subscribe(xr.batchCalls(g));return a.updateResult(),v},[a,i]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),T.useEffect(()=>{a.setOptions(o,{listeners:!1})},[o,a]),X9(o,l))throw q9(o,a,s);if(W9({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:r.getQueryCache().get(o.queryHash)}))throw l.error;return(p=(h=r.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||p.call(h,o,l),o.notifyOnChangeProps?l:a.trackResult(l)}function cE(n,e){return Y9({...n,enabled:!0,suspense:!0,throwOnError:G9,placeholderData:void 0},I9)}/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Z9=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),GN=(...n)=>n.filter((e,t,r)=>!!e&&r.indexOf(e)===t).join(" ");/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var $9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const K9=T.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>T.createElement("svg",{ref:l,...$9,width:e,height:e,stroke:n,strokeWidth:r?Number(t)*24/Number(e):t,className:GN("lucide",i),...a},[...o.map(([u,f])=>T.createElement(u,f)),...Array.isArray(s)?s:[s]]));/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hn=(n,e)=>{const t=T.forwardRef(({className:r,...i},s)=>T.createElement(K9,{ref:s,iconNode:e,className:GN(`lucide-${Z9(n)}`,r),...i}));return t.displayName=`${n}`,t};/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q9=hn("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const J9=hn("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const e7=hn("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const t7=hn("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const n7=hn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const r7=hn("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jN=hn("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const i7=hn("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const s7=hn("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o7=hn("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const a7=hn("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l7=hn("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c7=hn("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u7=hn("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const d7=hn("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const XN=hn("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f7=hn("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qN=hn("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h7=hn("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YN=hn("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const p7=hn("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const m7=hn("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g7=hn("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v7=hn("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y7=hn("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const x7=hn("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** - * @license lucide-react v0.445.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _7=hn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),S7=({audio:n,track:e,className:t,...r})=>{var l;const{showUI:i}=zc(),{data:s}=cE({queryKey:["soundcloud-stream-url",e.id],queryFn:async()=>await Oj(e.id)}),[o,a]=T.useState(!0);return T.useEffect(()=>{if(!s)n.pause();else{n.src=s;const u=n.play();u!==void 0&&u.then(()=>console.log(`Playing ${e.title}`)).catch(f=>{console.error(`Error playing ${e.title}`)})}return()=>{n.pause()}},[n,s,e]),T.useEffect(()=>{if(o){const u=n.play();u!==void 0&&u.then(()=>console.log("Playing...")).catch(f=>{console.error("Error playing!")})}else n.pause();return()=>{n.pause()}},[n,o]),C.jsxs("div",{className:jt("flex w-fit max-w-xs flex-row items-center justify-start gap-2 rounded-lg p-4 sm:bg-black/25",t,!i&&"hidden"),...r,children:[C.jsx("div",{className:"pointer-events-auto cursor-pointer rounded-full p-2 hover:scale-110",onClick:()=>a(u=>!u),children:o?C.jsx(i7,{}):C.jsx(s7,{})}),C.jsxs("div",{className:"hidden flex-col items-start justify-center gap-1 sm:flex",children:[C.jsx("span",{className:"w-64 max-w-64 truncate text-sm text-foreground",children:e.title}),C.jsx("span",{className:"truncate text-xs text-foreground/50",children:((l=e.user)==null?void 0:l.username)??"Unknown Artist"})]})]})},w7=({...n})=>{const{track:e}=T6();return e?C.jsx(S7,{track:e,...n}):C.jsx(C.Fragment,{})},M7=({audio:n,audioSource:e})=>{switch(e){case Jn.SOUNDCLOUD:return C.jsx(w7,{audio:n});case Jn.FILE_UPLOAD:return C.jsx(_6,{audio:n});default:return e}},E7=({audio:n,onDisabled:e,onStreamCreated:t})=>{const r=T.useRef(null);return T.useEffect(()=>(console.log("Disabling mic..."),e(),r!=null&&r.current&&(r.current=null),console.log("Enabling mic..."),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(t).catch(i=>{console.error(i),alert("Microphone access denied by user")}):alert("User mediaDevices not available"),()=>{n.pause(),r!=null&&r.current&&(r.current=null)}),[n,e,t]),C.jsx(C.Fragment,{})},b7=({audio:n,onDisabled:e,onStreamCreated:t})=>{const r=T.useRef(null);return T.useEffect(()=>(console.log("Disabling share..."),e(),r!=null&&r.current&&(r.current=null),console.log("Enabling share..."),navigator.mediaDevices?navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:1},audio:!0}).then(i=>{console.log(i.getAudioTracks()),t(i)}).catch(i=>{console.error(i),alert("Share access denied by user")}):alert("User mediaDevices not available"),()=>{n.pause(),r!=null&&r.current&&(r.current=null)}),[n,e,t]),C.jsx(C.Fragment,{})},uE=T.createContext(null),T7=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.audioSource)??dN()[0]);return C.jsx(uE.Provider,{value:{config:{audioSource:t},setters:{setAudioSource:r}},children:e})};function dE(){const n=T.useContext(uE);if(!n)throw new Error("useAudioSourceContext must be used within a AudioSourceContextProvider");return n.config}function C7(){const n=T.useContext(uE);if(!n)throw new Error("useAudioSourceContext must be used within a AudioSourceContextProvider");return n.setters}function A7(n,e){return{onDisabled:()=>{e.disconnectInputs()},onStreamCreated:t=>{n.pause();const r=e._audioCtx.createMediaStreamSource(t);e.connectInput(r),e.volume=0}}}const ER={1:"1/24th octave bands",2:"1/12th octave bands",3:"1/8th octave bands",4:"1/6th octave bands",5:"1/4th octave bands",6:"1/3rd octave bands",7:"Half octave bands",8:"Full octave bands"},R7=["overall","peak","bass","lowMid","mid","highMid","treble"],ZN=2**(1/24),P7=440*ZN**-114;class s0{constructor(e,t=void 0,r=1){st(this,"_analyzer");st(this,"_input");st(this,"_output");st(this,"_audioCtx");st(this,"_sources");st(this,"_outNodes");st(this,"_fftData");st(this,"_freqBinInfos",[]);st(this,"_energy",{val:0,peak:0,hold:0});st(this,"_minFreq",20);st(this,"_maxFreq",22e3);st(this,"_mode",2);st(this,"_runId");if(t===void 0?this._audioCtx=new window.AudioContext:this._audioCtx=t,!this._audioCtx.createGain)throw new Error("Provided audio context is not valid");this._analyzer=this._audioCtx.createAnalyser(),this._input=this._audioCtx.createGain(),this._output=this._audioCtx.createGain(),this._sources=[],this.connectInput(this._audioCtx.createMediaElementSource(e)),this._input.connect(this._analyzer),this._analyzer.connect(this._output),this._outNodes=[this._audioCtx.destination],this._output.connect(this._outNodes[0]),this._analyzer.smoothingTimeConstant=.5,this._analyzer.minDecibels=-85,this._analyzer.maxDecibels=-25,this._analyzer.fftSize=8192,this._fftData=new Uint8Array(this._analyzer.frequencyBinCount),this._updateFreqBins(),this.toggleAnalyzer(!0),this.volume=r}getBars(){return this._freqBinInfos}get mode(){return this._mode}set mode(e){this._mode=e,this._updateFreqBins()}get volume(){return this._output.gain.value}set volume(e){this._output.gain.value=e}get isOn(){return this._runId!==void 0}_updateFreqBins(){const e=[],t=o=>o*this._audioCtx.sampleRate/this._analyzer.fftSize||1,r=(o,a,l,u,f,h)=>e.push({binLo:o,binHi:a,freqLo:l,freqHi:u,ratioLo:f,ratioHi:h,value:0}),i=[];for(let o=0;o<11;o++)for(let a=0;a<24;a++){const l=P7*ZN**(o*24+a),u=this._freqToBin(l,!1),f=t(u),h=t(u+1),p=(l-f)/(h-f);i.push({freq:l,bin:u,ratio:p})}const s=[0,1,2,3,4,6,8,12,24][this._mode];for(let o=0;othis._maxFreq||h>=this._analyzer.fftSize/2){v.binHi++,v.ratioHi=0,v.freqHi=t(v.binHi);break}if(a>=this._minFreq){if(g>0){const _=l-v.binHi;_>1&&(v.binHi=l-(_>>1),v.ratioHi=0,v.freqHi=t(v.binHi),g>1&&v.binHi>v.binLo&&v.binLo>e[g-2].binHi&&(v.ratioLo=0,v.freqLo=t(v.binLo)),l=v.binHi+1),h>l&&l>v.binHi&&(u=0,a=t(l))}r(l,h,a,f,u,p)}}this._freqBinInfos=e}_freqToBin(e,t=!0){const r=this._analyzer.frequencyBinCount-1,i=(t?Math.round:Math.floor)(e*this._analyzer.fftSize/this._audioCtx.sampleRate);return it[s]+(t[s+1]-t[s])*o;let i=0;for(let s=0;sh&&(h=t[p]);h/=255,o.value=h,i+=h}this._energy.val=i/e,this._energy.val>=this._energy.peak?(this._energy.peak=this._energy.val,this._energy.hold=30):this._energy.hold>0?this._energy.hold--:this._energy.peak>0&&(this._energy.peak*=(30+this._energy.hold--)/30),this._runId=requestAnimationFrame(s=>this._analyze())}toggleAnalyzer(e=void 0){const t=this.isOn;return e===void 0&&(e=!t),t&&!e&&this._runId!==void 0?cancelAnimationFrame(this._runId):!t&&e&&(this._runId=requestAnimationFrame(r=>this._analyze())),this.isOn}getEnergy(e="overall"){if(e==="overall")return this._energy.val;if(e=="peak")return this._energy.peak;const t={bass:[20,250],lowMid:[250,500],mid:[500,2e3],highMid:[2e3,4e3],treble:[4e3,16e3]},[r,i]=t[e],s=this._freqToBin(r),o=i?this._freqToBin(i):s;let a=0;for(let l=s;l<=o;l++)a+=this._fftData[l];return a/(o-s+1)/1/255}connectInput(e){if(!e.connect)throw new Error("Audio source must be an instance of AudioNode");this._sources.includes(e)||(e.connect(this._input),this._sources.push(e))}disconnectInputs(){for(const e of Array.from(this._sources)){const t=this._sources.indexOf(e);t>=0&&(e.disconnect(this._input),this._sources.splice(t,1))}}}function bR(n,e){const t=n.createScriptProcessor(e.length,1,1);return t.onaudioprocess=r=>{r.inputBuffer.copyFromChannel(e,0)},t}function I7(n,e){e%2===0&&(e-=1);const t=new Float32Array(e),r=(e-1)/2|0;for(let l=0;l<=r;l++){const u=.53836+.46164*Math.cos(l*Math.PI/(r+1));if(l%2===1){const f=2/Math.PI/l;t[r+l]=u*f,t[r-l]=u*-f}}const i=n.createBuffer(2,e,n.sampleRate);i.copyToChannel(t,0),i.copyToChannel(t,1);const s=n.createConvolver();s.normalize=!1,s.buffer=i;const o=r/n.sampleRate,a=n.createDelay(o);return a.delayTime.value=o,[a,s]}class o0{constructor(e,t=void 0,r=512,i=1024){st(this,"_audioCtx");st(this,"timeSamples");st(this,"quadSamples");st(this,"_sources");st(this,"_inputs");st(this,"volume",1);t===void 0?this._audioCtx=new window.AudioContext:this._audioCtx=t,this.timeSamples=new Float32Array(r),this.quadSamples=new Float32Array(r);const[s,o]=I7(this._audioCtx,i-r);this._inputs=[s,o];const a=bR(this._audioCtx,this.timeSamples),l=bR(this._audioCtx,this.quadSamples),u=this._audioCtx.createMediaElementSource(e);this._sources=[],this.connectInput(u),o.connect(a),s.connect(l),a.connect(this._audioCtx.destination),l.connect(this._audioCtx.destination),u.connect(this._audioCtx.destination)}disconnectInputs(){for(const e of Array.from(this._sources)){const t=this._sources.indexOf(e);if(t>=0){for(const r of this._inputs)e.disconnect(r);this._sources.splice(t,1)}}}connectInput(e){if(!e.connect)throw new Error("Audio source must be an instance of AudioNode");if(!this._sources.includes(e)){for(const t of this._inputs)e.connect(t);this._sources.push(e)}}}const $N=({analyzer:n})=>{const e=Sy(),t=lN(),{resizeVisualSourceData:r}=ef(),i=T.useRef(null),s=T.useCallback(()=>{const o=n.quadSamples.length;if(e.length!==o||t.length!==o){console.log(`Resizing ${o}`),r(o);return}n.timeSamples.forEach((a,l)=>{e[l]=a}),n.quadSamples.forEach((a,l)=>{t[l]=a})},[e,t,n,r]);return T.useEffect(()=>{i.current&&cancelAnimationFrame(i.current);const o=()=>{s(),i.current=requestAnimationFrame(o)};return i.current=requestAnimationFrame(o),()=>cancelAnimationFrame(i.current)},[e,t,s]),C.jsx(C.Fragment,{})},L7=({mode:n,audioSource:e})=>{const t=T.useMemo(()=>hN(),[]),r=T.useMemo(()=>fN(),[]),i=T.useMemo(()=>{switch(console.log("Creating analyzer..."),n){case At.AUDIO:return new s0(r,t,1);case At.AUDIO_SCOPE:return new o0(r,t);default:return n}},[n,r,t]);return C.jsxs(C.Fragment,{children:[C.jsx(M7,{audio:r,audioSource:e}),i instanceof s0?C.jsx(cN,{analyzer:i}):i instanceof o0?C.jsx($N,{analyzer:i}):i]})},N7=({mode:n,audioSource:e})=>{const t=T.useMemo(()=>hN(),[]),r=T.useMemo(()=>fN(),[]),i=T.useMemo(()=>{switch(console.log("Creating analyzer..."),n){case At.AUDIO:return new s0(r,t,0);case At.AUDIO_SCOPE:return new o0(r,t);default:return n}},[r,t,n]),{onDisabled:s,onStreamCreated:o}=A7(r,i);return C.jsxs(C.Fragment,{children:[e===Jn.MICROPHONE?C.jsx(E7,{audio:r,onDisabled:s,onStreamCreated:o}):e===Jn.SCREEN_SHARE?C.jsx(b7,{audio:r,onDisabled:s,onStreamCreated:o}):e,i instanceof s0?C.jsx(cN,{analyzer:i}):i instanceof o0?C.jsx($N,{analyzer:i}):i]})},D7=({mode:n})=>{const{audioSource:e}=dE();switch(e){case Jn.SOUNDCLOUD:case Jn.FILE_UPLOAD:return C.jsx(L7,{mode:n,audioSource:e});case Jn.MICROPHONE:case Jn.SCREEN_SHARE:return C.jsx(N7,{mode:n,audioSource:e});default:return e}},vn={GRID:"grid",SPHERE:"sphere",CUBE:"cube",DIFFUSED_RING:"diffusedRing",DNA:"dna",BOXES:"boxes",RIBBONS:"ribbons",WALK:"walk"},KN=Object.values(vn),fE=T.createContext(null),O7=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.nPerSide)??10),[i,s]=T.useState((n==null?void 0:n.unitSideLength)??.5),[o,a]=T.useState((n==null?void 0:n.unitSpacingScalar)??.1),[l,u]=T.useState((n==null?void 0:n.volume)??!0);return C.jsx(fE.Provider,{value:{config:{nPerSide:t,unitSideLength:i,unitSpacingScalar:o,volume:l},setters:{setNPerSide:r,setUnitSideLength:s,setUnitSpacingScalar:a,setVolume:u,reset:()=>{r((n==null?void 0:n.nPerSide)??10),s((n==null?void 0:n.unitSideLength)??.5),a((n==null?void 0:n.unitSpacingScalar)??.1),u((n==null?void 0:n.volume)??!0)}}},children:e})};function k7(){const n=T.useContext(fE);if(!n)throw new Error("useCubeVisualConfigContext must be used within a CubeVisualConfigContextProvider");return n.config}function U7(){const n=T.useContext(fE);if(!n)throw new Error("useCubeVisualConfigContextSetters must be used within a CubeVisualConfigContextProvider");return n.setters}const hE=T.createContext(null),F7=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.radius)??2),[i,s]=T.useState((n==null?void 0:n.pointSize)??.2),[o,a]=T.useState((n==null?void 0:n.mirrorEffects)??!1);return C.jsx(hE.Provider,{value:{config:{radius:t,pointSize:i,mirrorEffects:o},setters:{setRadius:r,setPointSize:s,setMirrorEffects:a}},children:e})};function z7(){const n=T.useContext(hE);if(!n)throw new Error("useRingVisualConfigContext must be used within a RingVisualConfigContextProvider");return n.config}function B7(){const n=T.useContext(hE);if(!n)throw new Error("useRingVisualConfigContextSetters must be used within a RingVisualConfigContextProvider");return n.setters}const QN=T.createContext(null),V7=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.multi)??!0),[i,s]=T.useState((n==null?void 0:n.helixLength)??50),[o,a]=T.useState((n==null?void 0:n.helixRadius)??1),[l,u]=T.useState((n==null?void 0:n.helixWindingSeparation)??10),[f,h]=T.useState((n==null?void 0:n.strandRadius)??.1),[p,g]=T.useState((n==null?void 0:n.baseSpacing)??.35),[v,_]=T.useState((n==null?void 0:n.strandOffsetRad)??Math.PI/2),[x,m]=T.useState((n==null?void 0:n.mirrorEffects)??!0),[w,S]=T.useState((n==null?void 0:n.fixedBaseGap)??!1);return C.jsx(QN.Provider,{value:{config:{multi:t,helixLength:i,helixRadius:o,helixWindingSeparation:l,strandRadius:f,baseSpacing:p,strandOffsetRad:v,mirrorEffects:x,fixedBaseGap:w},setters:{setMulti:r,setHelixLength:s,setHelixRadius:a,setHelixWindingSeparation:u,setStrandRadius:h,setBaseSpacing:g,setStrandOffsetRad:_,setMirrorEffects:m,setFixedBaseGap:S}},children:e})};function fte(){const n=T.useContext(QN);if(!n)throw new Error("useDnaVisualConfigContext must be used within a DnaVisualConfigContextProvider");return n.config}const pE=T.createContext(null),H7=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.nCols)??100),[i,s]=T.useState((n==null?void 0:n.nRows)??100),[o,a]=T.useState((n==null?void 0:n.unitSideLength)??.025),[l,u]=T.useState((n==null?void 0:n.unitSpacingScalar)??5);return C.jsx(pE.Provider,{value:{config:{nCols:t,nRows:i,unitSideLength:o,unitSpacingScalar:l},setters:{setNCols:r,setNRows:s,setUnitSideLength:a,setUnitSpacingScalar:u,reset:()=>{r((n==null?void 0:n.nCols)??100),s((n==null?void 0:n.nRows)??100),a((n==null?void 0:n.unitSideLength)??.025),u((n==null?void 0:n.unitSpacingScalar)??5)}}},children:e})};function W7(){const n=T.useContext(pE);if(!n)throw new Error("useGridVisualConfigContext must be used within a GridVisualConfigContextProvider");return n.config}function G7(){const n=T.useContext(pE);if(!n)throw new Error("useGridVisualConfigContextSetters must be used within a GridVisualConfigContextProvider");return n.setters}const j7=T.createContext(null),X7=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.nRibbons)??5);return C.jsx(j7.Provider,{value:{config:{nRibbons:t},setters:{setNRibbons:r,reset:()=>{r((n==null?void 0:n.nRibbons)??5)}}},children:e})},mE=T.createContext(null),q7=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.radius)??2),[i,s]=T.useState((n==null?void 0:n.nPoints)??800),[o,a]=T.useState((n==null?void 0:n.unitSideLength)??.05);return C.jsx(mE.Provider,{value:{config:{radius:t,nPoints:i,unitSideLength:o},setters:{setRadius:r,setNPoints:s,setUnitSideLength:a}},children:e})};function Y7(){const n=T.useContext(mE);if(!n)throw new Error("useSphereVisualConfigContext must be used within a SphereVisualConfigContextProvider");return n.config}function Z7(){const n=T.useContext(mE);if(!n)throw new Error("useSphereVisualConfigContextSetters must be used within a SphereVisualConfigContextProvider");return n.setters}const gE=T.createContext(null),$7=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.maxAmplitude)??1),[i,s]=T.useState((n==null?void 0:n.waveformFrequenciesHz)??[2]),[o,a]=T.useState((n==null?void 0:n.amplitudeSplitRatio)??.75);return C.jsx(gE.Provider,{value:{config:{maxAmplitude:t,waveformFrequenciesHz:[...i],amplitudeSplitRatio:o},setters:{setMaxAmplitude:r,setWaveformFrequenciesHz:s,setAmplitudeSplitRatio:a,reset:()=>{r((n==null?void 0:n.maxAmplitude)??1),s((n==null?void 0:n.waveformFrequenciesHz)??[2]),a((n==null?void 0:n.amplitudeSplitRatio)??.75)}}},children:e})};function JN(){const n=T.useContext(gE);if(!n)throw new Error("useWaveGeneratorContext must be used within a WaveGeneratorContextProvider");return n.config}function e3(){const n=T.useContext(gE);if(!n)throw new Error("useWaveGeneratorContext must be used within a WaveGeneratorContextProvider");return n.setters}const vE=T.createContext(null),K7=({initial:n,children:e})=>{const{mode:t}=zc(),[r,i]=T.useState((n==null?void 0:n.visual)??KN[0]),[s,o]=T.useState((n==null?void 0:n.colorBackground)??!0),[a,l]=T.useState((n==null?void 0:n.paletteTrackEnergy)??!1),{setWaveformFrequenciesHz:u,setMaxAmplitude:f}=e3();return T.useEffect(()=>{if(t===At.WAVE_FORM)switch(r){case vn.DIFFUSED_RING:u([2,10]),f(1);break;default:u([2]),f(1);break}},[r,t,u,f]),T.useEffect(()=>{switch(t){case At.WAVE_FORM:case At.NOISE:case At.AUDIO_SCOPE:case At.PARTICLE_NOISE:l(!1);break;case At.AUDIO:l(!0);break;default:return t}},[t,l]),C.jsx(vE.Provider,{value:{config:{visual:r,colorBackground:s,paletteTrackEnergy:a},setters:{setVisual:i,setColorBackground:o,setPaletteTrackEnergy:l}},children:C.jsx(O7,{children:C.jsx(H7,{children:C.jsx(F7,{children:C.jsx(V7,{children:C.jsx(q7,{children:C.jsx(X7,{children:e})})})})})})})};function Bc(){const n=T.useContext(vE);if(!n)throw new Error("useVisualContext must be used within a VisualContextProvider");return n.config}function yE(){const n=T.useContext(vE);if(!n)throw new Error("useVisualContext must be used within a VisualContextProvider");return n.setters}const t3=()=>{const{colorBackground:n}=Bc(),e=QM();return n?Gn.getPalette(e).calcBackgroundColor(0):"#010204"},n3=()=>{const n=t3();return C.jsx("color",{attach:"background",args:[n]})},Q7=()=>{const n=t3();return C.jsx("fog",{attach:"fog",args:[n,0,100]})};var r3={exports:{}},Vc={};/** - * @license React - * react-reconciler-constants.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */Vc.ConcurrentRoot=1;Vc.ContinuousEventPriority=4;Vc.DefaultEventPriority=16;Vc.DiscreteEventPriority=1;Vc.IdleEventPriority=536870912;Vc.LegacyRoot=0;r3.exports=Vc;var Gu=r3.exports;function J7(n){let e;const t=new Set,r=(u,f)=>{const h=typeof u=="function"?u(e):u;if(h!==e){const p=e;e=f?h:Object.assign({},e,h),t.forEach(g=>g(e,p))}},i=()=>e,s=(u,f=i,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=f(e);function g(){const v=f(e);if(!h(p,v)){const _=p;u(p=v,_)}}return t.add(g),()=>t.delete(g)},l={setState:r,getState:i,subscribe:(u,f,h)=>f||h?s(u,f,h):(t.add(u),()=>t.delete(u)),destroy:()=>t.clear()};return e=n(r,i,l),l}const eX=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),TR=eX?T.useEffect:T.useLayoutEffect;function tX(n){const e=typeof n=="function"?J7(n):n,t=(r=e.getState,i=Object.is)=>{const[,s]=T.useReducer(x=>x+1,0),o=e.getState(),a=T.useRef(o),l=T.useRef(r),u=T.useRef(i),f=T.useRef(!1),h=T.useRef();h.current===void 0&&(h.current=r(o));let p,g=!1;(a.current!==o||l.current!==r||u.current!==i||f.current)&&(p=r(o),g=!i(h.current,p)),TR(()=>{g&&(h.current=p),a.current=o,l.current=r,u.current=i,f.current=!1});const v=T.useRef(o);TR(()=>{const x=()=>{try{const w=e.getState(),S=l.current(w);u.current(h.current,S)||(a.current=w,h.current=S,s())}catch{f.current=!0,s()}},m=e.subscribe(x);return e.getState()!==v.current&&x(),m},[]);const _=g?p:h.current;return T.useDebugValue(_),_};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[t,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},t}const nX=n=>typeof n=="object"&&typeof n.then=="function",tc=[];function i3(n,e,t=(r,i)=>r===i){if(n===e)return!0;if(!n||!e)return!1;const r=n.length;if(e.length!==r)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,r.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:r.equal,remove:()=>{const s=tc.indexOf(i);s!==-1&&tc.splice(s,1)},promise:(nX(n)?n:n(...e)).then(s=>{i.response=s,r.lifespan&&r.lifespan>0&&(i.timeout=setTimeout(i.remove,r.lifespan))}).catch(s=>i.error=s)};if(tc.push(i),!t)throw i.promise}const rX=(n,e,t)=>s3(n,e,!1,t),iX=(n,e,t)=>void s3(n,e,!0,t),sX=n=>{if(n===void 0||n.length===0)tc.splice(0,tc.length);else{const e=tc.find(t=>i3(n,t.keys,t.equal));e&&e.remove()}};var o3={exports:{}},a3={exports:{}},l3={};/** - * @license React - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */(function(n){function e(k,j){var Y=k.length;k.push(j);e:for(;0>>1,ae=k[K];if(0>>1;K<_e;){var ne=2*(K+1)-1,he=k[ne],be=ne+1,me=k[be];if(0>i(he,Y))bei(me,he)?(k[K]=me,k[be]=Y,K=be):(k[K]=he,k[ne]=Y,K=ne);else if(bei(me,Y))k[K]=me,k[be]=Y,K=be;else break e}}return j}function i(k,j){var Y=k.sortIndex-j.sortIndex;return Y!==0?Y:k.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],f=1,h=null,p=3,g=!1,v=!1,_=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(k){for(var j=t(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=k)r(u),j.sortIndex=j.expirationTime,e(l,j);else break;j=t(u)}}function E(k){if(_=!1,S(k),!v)if(t(l)!==null)v=!0,$(R);else{var j=t(u);j!==null&&re(E,j.startTime-k)}}function R(k,j){v=!1,_&&(_=!1,m(D),D=-1),g=!0;var Y=p;try{for(S(j),h=t(l);h!==null&&(!(h.expirationTime>j)||k&&!N());){var K=h.callback;if(typeof K=="function"){h.callback=null,p=h.priorityLevel;var ae=K(h.expirationTime<=j);j=n.unstable_now(),typeof ae=="function"?h.callback=ae:h===t(l)&&r(l),S(j)}else r(l);h=t(l)}if(h!==null)var _e=!0;else{var ne=t(u);ne!==null&&re(E,ne.startTime-j),_e=!1}return _e}finally{h=null,p=Y,g=!1}}var P=!1,L=null,D=-1,B=5,A=-1;function N(){return!(n.unstable_now()-Ak||125K?(k.sortIndex=Y,e(u,k),t(l)===null&&k===t(u)&&(_?(m(D),D=-1):_=!0,re(E,Y-K))):(k.sortIndex=ae,e(l,k),v||g||(v=!0,$(R))),k},n.unstable_shouldYield=N,n.unstable_wrapCallback=function(k){var j=p;return function(){var Y=p;p=j;try{return k.apply(this,arguments)}finally{p=Y}}}})(l3);a3.exports=l3;var q1=a3.exports;/** - * @license React - * react-reconciler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var oX=function(e){var t={},r=T,i=q1,s=Object.assign;function o(c){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+c,y=1;yJ||b[W]!==I[J]){var pe=` -`+b[W].replace(" at new "," at ");return c.displayName&&pe.includes("")&&(pe=pe.replace("",c.displayName)),pe}while(1<=W&&0<=J);break}}}finally{wt=!1,Error.prepareStackTrace=y}return(c=c?c.displayName||c.name:"")?Et(c):""}var bn=Object.prototype.hasOwnProperty,pr=[],xn=-1;function sr(c){return{current:c}}function gt(c){0>xn||(c.current=pr[xn],pr[xn]=null,xn--)}function Ke(c,d){xn++,pr[xn]=c.current,c.current=d}var Wi={},Ht=sr(Wi),Dn=sr(!1),ks=Wi;function Gi(c,d){var y=c.type.contextTypes;if(!y)return Wi;var M=c.stateNode;if(M&&M.__reactInternalMemoizedUnmaskedChildContext===d)return M.__reactInternalMemoizedMaskedChildContext;var b={},I;for(I in y)b[I]=d[I];return M&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=d,c.__reactInternalMemoizedMaskedChildContext=b),b}function or(c){return c=c.childContextTypes,c!=null}function Vn(){gt(Dn),gt(Ht)}function Us(c,d,y){if(Ht.current!==Wi)throw Error(o(168));Ke(Ht,d),Ke(Dn,y)}function Yc(c,d,y){var M=c.stateNode;if(d=d.childContextTypes,typeof M.getChildContext!="function")return y;M=M.getChildContext();for(var b in M)if(!(b in d))throw Error(o(108,D(c)||"Unknown",b));return s({},y,M)}function mr(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Wi,ks=Ht.current,Ke(Ht,c),Ke(Dn,Dn.current),!0}function Zc(c,d,y){var M=c.stateNode;if(!M)throw Error(o(169));y?(c=Yc(c,d,ks),M.__reactInternalMemoizedMergedChildContext=c,gt(Dn),gt(Ht),Ke(Ht,c)):gt(Dn),Ke(Dn,y)}var _i=Math.clz32?Math.clz32:NF,lm=Math.log,LF=Math.LN2;function NF(c){return c>>>=0,c===0?32:31-(lm(c)/LF|0)|0}var cm=64,um=4194304;function ff(c){switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function dm(c,d){var y=c.pendingLanes;if(y===0)return 0;var M=0,b=c.suspendedLanes,I=c.pingedLanes,W=y&268435455;if(W!==0){var J=W&~b;J!==0?M=ff(J):(I&=W,I!==0&&(M=ff(I)))}else W=y&~b,W!==0?M=ff(W):I!==0&&(M=ff(I));if(M===0)return 0;if(d!==0&&d!==M&&!(d&b)&&(b=M&-M,I=d&-d,b>=I||b===16&&(I&4194240)!==0))return d;if(M&4&&(M|=y&16),d=c.entangledLanes,d!==0)for(c=c.entanglements,d&=M;0y;y++)d.push(c);return d}function hf(c,d,y){c.pendingLanes|=d,d!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,d=31-_i(d),c[d]=y}function kF(c,d){var y=c.pendingLanes&~d;c.pendingLanes=d,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=d,c.mutableReadLanes&=d,c.entangledLanes&=d,d=c.entanglements;var M=c.eventTimes;for(c=c.expirationTimes;0>=W,b-=W,So=1<<32-_i(d)+b|y<tn?(cr=It,It=null):cr=It.sibling;var nn=ft(oe,It,de[tn],We);if(nn===null){It===null&&(It=cr);break}c&&It&&nn.alternate===null&&d(oe,It),te=I(nn,te,tn),Ft===null?ot=nn:Ft.sibling=nn,Ft=nn,It=cr}if(tn===de.length)return y(oe,It),Mn&&bl(oe,tn),ot;if(It===null){for(;tntn?(cr=It,It=null):cr=It.sibling;var ma=ft(oe,It,nn.value,We);if(ma===null){It===null&&(It=cr);break}c&&It&&ma.alternate===null&&d(oe,It),te=I(ma,te,tn),Ft===null?ot=ma:Ft.sibling=ma,Ft=ma,It=cr}if(nn.done)return y(oe,It),Mn&&bl(oe,tn),ot;if(It===null){for(;!nn.done;tn++,nn=de.next())nn=Pt(oe,nn.value,We),nn!==null&&(te=I(nn,te,tn),Ft===null?ot=nn:Ft.sibling=nn,Ft=nn);return Mn&&bl(oe,tn),ot}for(It=M(oe,It);!nn.done;tn++,nn=de.next())nn=dn(It,oe,tn,nn.value,We),nn!==null&&(c&&nn.alternate!==null&&It.delete(nn.key===null?tn:nn.key),te=I(nn,te,tn),Ft===null?ot=nn:Ft.sibling=nn,Ft=nn);return c&&It.forEach(function(Sz){return d(oe,Sz)}),Mn&&bl(oe,tn),ot}function Qi(oe,te,de,We){if(typeof de=="object"&&de!==null&&de.type===f&&de.key===null&&(de=de.props.children),typeof de=="object"&&de!==null){switch(de.$$typeof){case l:e:{for(var ot=de.key,Ft=te;Ft!==null;){if(Ft.key===ot){if(ot=de.type,ot===f){if(Ft.tag===7){y(oe,Ft.sibling),te=b(Ft,de.props.children),te.return=oe,oe=te;break e}}else if(Ft.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===S&&dT(ot)===Ft.type){y(oe,Ft.sibling),te=b(Ft,de.props),te.ref=gf(oe,Ft,de),te.return=oe,oe=te;break e}y(oe,Ft);break}else d(oe,Ft);Ft=Ft.sibling}de.type===f?(te=Ll(de.props.children,oe.mode,We,de.key),te.return=oe,oe=te):(We=Jm(de.type,de.key,de.props,null,oe.mode,We),We.ref=gf(oe,te,de),We.return=oe,oe=We)}return W(oe);case u:e:{for(Ft=de.key;te!==null;){if(te.key===Ft)if(te.tag===4&&te.stateNode.containerInfo===de.containerInfo&&te.stateNode.implementation===de.implementation){y(oe,te.sibling),te=b(te,de.children||[]),te.return=oe,oe=te;break e}else{y(oe,te);break}else d(oe,te);te=te.sibling}te=e_(de,oe.mode,We),te.return=oe,oe=te}return W(oe);case S:return Ft=de._init,Qi(oe,te,Ft(de._payload),We)}if(Z(de))return ct(oe,te,de,We);if(P(de))return Ar(oe,te,de,We);wm(oe,de)}return typeof de=="string"&&de!==""||typeof de=="number"?(de=""+de,te!==null&&te.tag===6?(y(oe,te.sibling),te=b(te,de),te.return=oe,oe=te):(y(oe,te),te=Jx(de,oe.mode,We),te.return=oe,oe=te),W(oe)):y(oe,te)}return Qi}var tu=fT(!0),hT=fT(!1),vf={},Yi=sr(vf),yf=sr(vf),nu=sr(vf);function Hs(c){if(c===vf)throw Error(o(174));return c}function vx(c,d){Ke(nu,d),Ke(yf,c),Ke(Yi,vf),c=re(d),gt(Yi),Ke(Yi,c)}function ru(){gt(Yi),gt(yf),gt(nu)}function pT(c){var d=Hs(nu.current),y=Hs(Yi.current);d=k(y,c.type,d),y!==d&&(Ke(yf,c),Ke(Yi,d))}function yx(c){yf.current===c&&(gt(Yi),gt(yf))}var Tn=sr(0);function Mm(c){for(var d=c;d!==null;){if(d.tag===13){var y=d.memoizedState;if(y!==null&&(y=y.dehydrated,y===null||uf(y)||df(y)))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if(d.flags&128)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===c)break;for(;d.sibling===null;){if(d.return===null||d.return===c)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var xx=[];function _x(){for(var c=0;cy?y:4,c(!0);var M=Zi.transition;Zi.transition={};try{c(!1),d()}finally{en=y,Zi.transition=M}}function AT(){return Ws().memoizedState}function YF(c,d,y){var M=fa(c);y={lane:M,action:y,hasEagerState:!1,eagerState:null,next:null},RT(c)?PT(d,y):(IT(c,d,y),y=Xr(),c=$i(c,M,y),c!==null&<(c,d,M))}function ZF(c,d,y){var M=fa(c),b={lane:M,action:y,hasEagerState:!1,eagerState:null,next:null};if(RT(c))PT(d,b);else{IT(c,d,b);var I=c.alternate;if(c.lanes===0&&(I===null||I.lanes===0)&&(I=d.lastRenderedReducer,I!==null))try{var W=d.lastRenderedState,J=I(W,y);if(b.hasEagerState=!0,b.eagerState=J,zs(J,W))return}catch{}finally{}y=Xr(),c=$i(c,M,y),c!==null&<(c,d,M)}}function RT(c){var d=c.alternate;return c===On||d!==null&&d===On}function PT(c,d){xf=bm=!0;var y=c.pending;y===null?d.next=d:(d.next=y.next,y.next=d),c.pending=d}function IT(c,d,y){Zn!==null&&c.mode&1&&!(Wt&2)?(c=d.interleaved,c===null?(y.next=y,Vs===null?Vs=[d]:Vs.push(d)):(y.next=c.next,c.next=y),d.interleaved=y):(c=d.pending,c===null?y.next=y:(y.next=c.next,c.next=y),d.pending=y)}function LT(c,d,y){if(y&4194240){var M=d.lanes;M&=c.pendingLanes,y|=M,d.lanes=y,ex(c,y)}}var Pm={readContext:ji,useCallback:Tr,useContext:Tr,useEffect:Tr,useImperativeHandle:Tr,useInsertionEffect:Tr,useLayoutEffect:Tr,useMemo:Tr,useReducer:Tr,useRef:Tr,useState:Tr,useDebugValue:Tr,useDeferredValue:Tr,useTransition:Tr,useMutableSource:Tr,useSyncExternalStore:Tr,useId:Tr,unstable_isNewReconciler:!1},$F={readContext:ji,useCallback:function(c,d){return Mo().memoizedState=[c,d===void 0?null:d],c},useContext:ji,useEffect:bx,useImperativeHandle:function(c,d,y){return y=y!=null?y.concat([c]):null,Am(4194308,4,ET.bind(null,d,c),y)},useLayoutEffect:function(c,d){return Am(4194308,4,c,d)},useInsertionEffect:function(c,d){return Am(4,2,c,d)},useMemo:function(c,d){var y=Mo();return d=d===void 0?null:d,c=c(),y.memoizedState=[c,d],c},useReducer:function(c,d,y){var M=Mo();return d=y!==void 0?y(d):d,M.memoizedState=M.baseState=d,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:d},M.queue=c,c=c.dispatch=YF.bind(null,On,c),[M.memoizedState,c]},useRef:function(c){var d=Mo();return c={current:c},d.memoizedState=c},useState:Ex,useDebugValue:Tx,useDeferredValue:function(c){var d=Ex(c),y=d[0],M=d[1];return bx(function(){var b=Zi.transition;Zi.transition={};try{M(c)}finally{Zi.transition=b}},[c]),y},useTransition:function(){var c=Ex(!1),d=c[0];return c=qF.bind(null,c[1]),Mo().memoizedState=c,[d,c]},useMutableSource:function(){},useSyncExternalStore:function(c,d,y){var M=On,b=Mo();if(Mn){if(y===void 0)throw Error(o(407));y=y()}else{if(y=d(),Zn===null)throw Error(o(349));iu&30||vT(M,d,y)}b.memoizedState=y;var I={value:y,getSnapshot:d};return b.queue=I,bx(xT.bind(null,M,I,c),[c]),M.flags|=2048,Sf(9,yT.bind(null,M,I,y,d),void 0,null),y},useId:function(){var c=Mo(),d=Zn.identifierPrefix;if(Mn){var y=wo,M=So;y=(M&~(1<<32-_i(M)-1)).toString(32)+y,d=":"+d+"R"+y,y=_f++,0jx&&(d.flags|=128,M=!0,bf(b,!1),d.lanes=4194304)}else{if(!M)if(c=Mm(I),c!==null){if(d.flags|=128,M=!0,c=c.updateQueue,c!==null&&(d.updateQueue=c,d.flags|=4),bf(b,!0),b.tail===null&&b.tailMode==="hidden"&&!I.alternate&&!Mn)return Cr(d),null}else 2*ar()-b.renderingStartTime>jx&&y!==1073741824&&(d.flags|=128,M=!0,bf(b,!1),d.lanes=4194304);b.isBackwards?(I.sibling=d.child,d.child=I):(c=b.last,c!==null?c.sibling=I:d.child=I,b.last=I)}return b.tail!==null?(d=b.tail,b.rendering=d,b.tail=d.sibling,b.renderingStartTime=ar(),d.sibling=null,c=Tn.current,Ke(Tn,M?c&1|2:c&1),d):(Cr(d),null);case 22:case 23:return $x(),M=d.memoizedState!==null,c!==null&&c.memoizedState!==null!==M&&(d.flags|=8192),M&&d.mode&1?Ei&1073741824&&(Cr(d),Ce&&d.subtreeFlags&6&&(d.flags|=8192)):Cr(d),null;case 24:return null;case 25:return null}throw Error(o(156,d.tag))}var tz=a.ReactCurrentOwner,Mi=!1;function jr(c,d,y,M){d.child=c===null?hT(d,null,y,M):tu(d,c.child,y,M)}function BT(c,d,y,M,b){y=y.render;var I=d.ref;return Kc(d,b),M=wx(c,d,y,M,I,b),y=Mx(),c!==null&&!Mi?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~b,Eo(c,d,b)):(Mn&&y&&fx(d),d.flags|=1,jr(c,d,M,b),d.child)}function VT(c,d,y,M,b){if(c===null){var I=y.type;return typeof I=="function"&&!Qx(I)&&I.defaultProps===void 0&&y.compare===null&&y.defaultProps===void 0?(d.tag=15,d.type=I,HT(c,d,I,M,b)):(c=Jm(y.type,null,M,d,d.mode,b),c.ref=d.ref,c.return=d,d.child=c)}if(I=c.child,!(c.lanes&b)){var W=I.memoizedProps;if(y=y.compare,y=y!==null?y:pm,y(W,M)&&c.ref===d.ref)return Eo(c,d,b)}return d.flags|=1,c=pa(I,M),c.ref=d.ref,c.return=d,d.child=c}function HT(c,d,y,M,b){if(c!==null&&pm(c.memoizedProps,M)&&c.ref===d.ref)if(Mi=!1,(c.lanes&b)!==0)c.flags&131072&&(Mi=!0);else return d.lanes=c.lanes,Eo(c,d,b);return Rx(c,d,y,M,b)}function WT(c,d,y){var M=d.pendingProps,b=M.children,I=c!==null?c.memoizedState:null;if(M.mode==="hidden")if(!(d.mode&1))d.memoizedState={baseLanes:0,cachePool:null},Ke(su,Ei),Ei|=y;else if(y&1073741824)d.memoizedState={baseLanes:0,cachePool:null},M=I!==null?I.baseLanes:y,Ke(su,Ei),Ei|=M;else return c=I!==null?I.baseLanes|y:y,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:c,cachePool:null},d.updateQueue=null,Ke(su,Ei),Ei|=c,null;else I!==null?(M=I.baseLanes|y,d.memoizedState=null):M=y,Ke(su,Ei),Ei|=M;return jr(c,d,b,y),d.child}function GT(c,d){var y=d.ref;(c===null&&y!==null||c!==null&&c.ref!==y)&&(d.flags|=512,d.flags|=2097152)}function Rx(c,d,y,M,b){var I=or(y)?ks:Ht.current;return I=Gi(d,I),Kc(d,b),y=wx(c,d,y,M,I,b),M=Mx(),c!==null&&!Mi?(d.updateQueue=c.updateQueue,d.flags&=-2053,c.lanes&=~b,Eo(c,d,b)):(Mn&&M&&fx(d),d.flags|=1,jr(c,d,y,b),d.child)}function jT(c,d,y,M,b){if(or(y)){var I=!0;mr(d)}else I=!1;if(Kc(d,b),d.stateNode===null)c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2),sT(d,y,M),dx(d,y,M,b),M=!0;else if(c===null){var W=d.stateNode,J=d.memoizedProps;W.props=J;var pe=W.context,De=y.contextType;typeof De=="object"&&De!==null?De=ji(De):(De=or(y)?ks:Ht.current,De=Gi(d,De));var Qe=y.getDerivedStateFromProps,Pt=typeof Qe=="function"||typeof W.getSnapshotBeforeUpdate=="function";Pt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(J!==M||pe!==De)&&oT(d,W,M,De),la=!1;var ft=d.memoizedState;W.state=ft,ym(d,M,W,b),pe=d.memoizedState,J!==M||ft!==pe||Dn.current||la?(typeof Qe=="function"&&(ux(d,y,Qe,M),pe=d.memoizedState),(J=la||iT(d,y,J,M,ft,pe,De))?(Pt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(d.flags|=4194308)):(typeof W.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=M,d.memoizedState=pe),W.props=M,W.state=pe,W.context=De,M=J):(typeof W.componentDidMount=="function"&&(d.flags|=4194308),M=!1)}else{W=d.stateNode,eT(c,d),J=d.memoizedProps,De=d.type===d.elementType?J:ds(d.type,J),W.props=De,Pt=d.pendingProps,ft=W.context,pe=y.contextType,typeof pe=="object"&&pe!==null?pe=ji(pe):(pe=or(y)?ks:Ht.current,pe=Gi(d,pe));var dn=y.getDerivedStateFromProps;(Qe=typeof dn=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(J!==Pt||ft!==pe)&&oT(d,W,M,pe),la=!1,ft=d.memoizedState,W.state=ft,ym(d,M,W,b);var ct=d.memoizedState;J!==Pt||ft!==ct||Dn.current||la?(typeof dn=="function"&&(ux(d,y,dn,M),ct=d.memoizedState),(De=la||iT(d,y,De,M,ft,ct,pe)||!1)?(Qe||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(M,ct,pe),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(M,ct,pe)),typeof W.componentDidUpdate=="function"&&(d.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof W.componentDidUpdate!="function"||J===c.memoizedProps&&ft===c.memoizedState||(d.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||J===c.memoizedProps&&ft===c.memoizedState||(d.flags|=1024),d.memoizedProps=M,d.memoizedState=ct),W.props=M,W.state=ct,W.context=pe,M=De):(typeof W.componentDidUpdate!="function"||J===c.memoizedProps&&ft===c.memoizedState||(d.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||J===c.memoizedProps&&ft===c.memoizedState||(d.flags|=1024),M=!1)}return Px(c,d,y,M,I,b)}function Px(c,d,y,M,b,I){GT(c,d);var W=(d.flags&128)!==0;if(!M&&!W)return b&&Zc(d,y,!1),Eo(c,d,I);M=d.stateNode,tz.current=d;var J=W&&typeof y.getDerivedStateFromError!="function"?null:M.render();return d.flags|=1,c!==null&&W?(d.child=tu(d,c.child,null,I),d.child=tu(d,null,J,I)):jr(c,d,J,I),d.memoizedState=M.state,b&&Zc(d,y,!0),d.child}function XT(c){var d=c.stateNode;d.pendingContext?Us(c,d.pendingContext,d.pendingContext!==d.context):d.context&&Us(c,d.context,!1),vx(c,d.containerInfo)}function qT(c,d,y,M,b){return eu(),gx(b),d.flags|=256,jr(c,d,y,M),d.child}var Nm={dehydrated:null,treeContext:null,retryLane:0};function Dm(c){return{baseLanes:c,cachePool:null}}function YT(c,d,y){var M=d.pendingProps,b=Tn.current,I=!1,W=(d.flags&128)!==0,J;if((J=W)||(J=c!==null&&c.memoizedState===null?!1:(b&2)!==0),J?(I=!0,d.flags&=-129):(c===null||c.memoizedState!==null)&&(b|=1),Ke(Tn,b&1),c===null)return mx(d),c=d.memoizedState,c!==null&&(c=c.dehydrated,c!==null)?(d.mode&1?df(c)?d.lanes=8:d.lanes=1073741824:d.lanes=1,null):(b=M.children,c=M.fallback,I?(M=d.mode,I=d.child,b={mode:"hidden",children:b},!(M&1)&&I!==null?(I.childLanes=0,I.pendingProps=b):I=eg(b,M,0,null),c=Ll(c,M,y,null),I.return=d,c.return=d,I.sibling=c,d.child=I,d.child.memoizedState=Dm(y),d.memoizedState=Nm,c):Ix(d,b));if(b=c.memoizedState,b!==null){if(J=b.dehydrated,J!==null){if(W)return d.flags&256?(d.flags&=-257,Om(c,d,y,Error(o(422)))):d.memoizedState!==null?(d.child=c.child,d.flags|=128,null):(I=M.fallback,b=d.mode,M=eg({mode:"visible",children:M.children},b,0,null),I=Ll(I,b,y,null),I.flags|=2,M.return=d,I.return=d,M.sibling=I,d.child=M,d.mode&1&&tu(d,c.child,null,y),d.child.memoizedState=Dm(y),d.memoizedState=Nm,I);if(!(d.mode&1))d=Om(c,d,y,null);else if(df(J))d=Om(c,d,y,Error(o(419)));else if(M=(y&c.childLanes)!==0,Mi||M){if(M=Zn,M!==null){switch(y&-y){case 4:I=2;break;case 16:I=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:I=32;break;case 536870912:I=268435456;break;default:I=0}M=I&(M.suspendedLanes|y)?0:I,M!==0&&M!==b.retryLane&&(b.retryLane=M,$i(c,M,-1))}Kx(),d=Om(c,d,y,Error(o(421)))}else uf(J)?(d.flags|=128,d.child=c.child,d=pz.bind(null,c),Xc(J,d),d=null):(y=b.treeContext,xe&&(wi=am(J),Si=d,Mn=!0,fs=null,pf=!1,y!==null&&(Xi[qi++]=So,Xi[qi++]=wo,Xi[qi++]=El,So=y.id,wo=y.overflow,El=d)),d=Ix(d,d.pendingProps.children),d.flags|=4096);return d}return I?(M=$T(c,d,M.children,M.fallback,y),I=d.child,b=c.child.memoizedState,I.memoizedState=b===null?Dm(y):{baseLanes:b.baseLanes|y,cachePool:null},I.childLanes=c.childLanes&~y,d.memoizedState=Nm,M):(y=ZT(c,d,M.children,y),d.memoizedState=null,y)}return I?(M=$T(c,d,M.children,M.fallback,y),I=d.child,b=c.child.memoizedState,I.memoizedState=b===null?Dm(y):{baseLanes:b.baseLanes|y,cachePool:null},I.childLanes=c.childLanes&~y,d.memoizedState=Nm,M):(y=ZT(c,d,M.children,y),d.memoizedState=null,y)}function Ix(c,d){return d=eg({mode:"visible",children:d},c.mode,0,null),d.return=c,c.child=d}function ZT(c,d,y,M){var b=c.child;return c=b.sibling,y=pa(b,{mode:"visible",children:y}),!(d.mode&1)&&(y.lanes=M),y.return=d,y.sibling=null,c!==null&&(M=d.deletions,M===null?(d.deletions=[c],d.flags|=16):M.push(c)),d.child=y}function $T(c,d,y,M,b){var I=d.mode;c=c.child;var W=c.sibling,J={mode:"hidden",children:y};return!(I&1)&&d.child!==c?(y=d.child,y.childLanes=0,y.pendingProps=J,d.deletions=null):(y=pa(c,J),y.subtreeFlags=c.subtreeFlags&14680064),W!==null?M=pa(W,M):(M=Ll(M,I,b,null),M.flags|=2),M.return=d,y.return=d,y.sibling=M,d.child=y,M}function Om(c,d,y,M){return M!==null&&gx(M),tu(d,c.child,null,y),c=Ix(d,d.pendingProps.children),c.flags|=2,d.memoizedState=null,c}function KT(c,d,y){c.lanes|=d;var M=c.alternate;M!==null&&(M.lanes|=d),lx(c.return,d,y)}function Lx(c,d,y,M,b){var I=c.memoizedState;I===null?c.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:M,tail:y,tailMode:b}:(I.isBackwards=d,I.rendering=null,I.renderingStartTime=0,I.last=M,I.tail=y,I.tailMode=b)}function QT(c,d,y){var M=d.pendingProps,b=M.revealOrder,I=M.tail;if(jr(c,d,M.children,y),M=Tn.current,M&2)M=M&1|2,d.flags|=128;else{if(c!==null&&c.flags&128)e:for(c=d.child;c!==null;){if(c.tag===13)c.memoizedState!==null&&KT(c,y,d);else if(c.tag===19)KT(c,y,d);else if(c.child!==null){c.child.return=c,c=c.child;continue}if(c===d)break e;for(;c.sibling===null;){if(c.return===null||c.return===d)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}M&=1}if(Ke(Tn,M),!(d.mode&1))d.memoizedState=null;else switch(b){case"forwards":for(y=d.child,b=null;y!==null;)c=y.alternate,c!==null&&Mm(c)===null&&(b=y),y=y.sibling;y=b,y===null?(b=d.child,d.child=null):(b=y.sibling,y.sibling=null),Lx(d,!1,b,y,I);break;case"backwards":for(y=null,b=d.child,d.child=null;b!==null;){if(c=b.alternate,c!==null&&Mm(c)===null){d.child=b;break}c=b.sibling,b.sibling=y,y=b,b=c}Lx(d,!0,y,null,I);break;case"together":Lx(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function Eo(c,d,y){if(c!==null&&(d.dependencies=c.dependencies),ou|=d.lanes,!(y&d.childLanes))return null;if(c!==null&&d.child!==c.child)throw Error(o(153));if(d.child!==null){for(c=d.child,y=pa(c,c.pendingProps),d.child=y,y.return=d;c.sibling!==null;)c=c.sibling,y=y.sibling=pa(c,c.pendingProps),y.return=d;y.sibling=null}return d.child}function nz(c,d,y){switch(d.tag){case 3:XT(d),eu();break;case 5:pT(d);break;case 1:or(d.type)&&mr(d);break;case 4:vx(d,d.stateNode.containerInfo);break;case 10:Jb(d,d.type._context,d.memoizedProps.value);break;case 13:var M=d.memoizedState;if(M!==null)return M.dehydrated!==null?(Ke(Tn,Tn.current&1),d.flags|=128,null):y&d.child.childLanes?YT(c,d,y):(Ke(Tn,Tn.current&1),c=Eo(c,d,y),c!==null?c.sibling:null);Ke(Tn,Tn.current&1);break;case 19:if(M=(y&d.childLanes)!==0,c.flags&128){if(M)return QT(c,d,y);d.flags|=128}var b=d.memoizedState;if(b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),Ke(Tn,Tn.current),M)break;return null;case 22:case 23:return d.lanes=0,WT(c,d,y)}return Eo(c,d,y)}function rz(c,d){switch(hx(d),d.tag){case 1:return or(d.type)&&Vn(),c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 3:return ru(),gt(Dn),gt(Ht),_x(),c=d.flags,c&65536&&!(c&128)?(d.flags=c&-65537|128,d):null;case 5:return yx(d),null;case 13:if(gt(Tn),c=d.memoizedState,c!==null&&c.dehydrated!==null){if(d.alternate===null)throw Error(o(340));eu()}return c=d.flags,c&65536?(d.flags=c&-65537|128,d):null;case 19:return gt(Tn),null;case 4:return ru(),null;case 10:return ax(d.type._context),null;case 22:case 23:return $x(),null;case 24:return null;default:return null}}var km=!1,Cl=!1,iz=typeof WeakSet=="function"?WeakSet:Set,He=null;function Um(c,d){var y=c.ref;if(y!==null)if(typeof y=="function")try{y(null)}catch(M){li(c,d,M)}else y.current=null}function Nx(c,d,y){try{y()}catch(M){li(c,d,M)}}var JT=!1;function sz(c,d){for(j(c.containerInfo),He=d;He!==null;)if(c=He,d=c.child,(c.subtreeFlags&1028)!==0&&d!==null)d.return=c,He=d;else for(;He!==null;){c=He;try{var y=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var M=y.memoizedProps,b=y.memoizedState,I=c.stateNode,W=I.getSnapshotBeforeUpdate(c.elementType===c.type?M:ds(c.type,M),b);I.__reactInternalSnapshotBeforeUpdate=W}break;case 3:Ce&&ke(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(J){li(c,c.return,J)}if(d=c.sibling,d!==null){d.return=c.return,He=d;break}He=c.return}return y=JT,JT=!1,y}function Al(c,d,y){var M=d.updateQueue;if(M=M!==null?M.lastEffect:null,M!==null){var b=M=M.next;do{if((b.tag&c)===c){var I=b.destroy;b.destroy=void 0,I!==void 0&&Nx(d,y,I)}b=b.next}while(b!==M)}}function Tf(c,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var y=d=d.next;do{if((y.tag&c)===c){var M=y.create;y.destroy=M()}y=y.next}while(y!==d)}}function Dx(c){var d=c.ref;if(d!==null){var y=c.stateNode;switch(c.tag){case 5:c=$(y);break;default:c=y}typeof d=="function"?d(c):d.current=c}}function eC(c,d,y){if(Fs&&typeof Fs.onCommitFiberUnmount=="function")try{Fs.onCommitFiberUnmount(fm,d)}catch{}switch(d.tag){case 0:case 11:case 14:case 15:if(c=d.updateQueue,c!==null&&(c=c.lastEffect,c!==null)){var M=c=c.next;do{var b=M,I=b.destroy;b=b.tag,I!==void 0&&(b&2||b&4)&&Nx(d,y,I),M=M.next}while(M!==c)}break;case 1:if(Um(d,y),c=d.stateNode,typeof c.componentWillUnmount=="function")try{c.props=d.memoizedProps,c.state=d.memoizedState,c.componentWillUnmount()}catch(W){li(d,y,W)}break;case 5:Um(d,y);break;case 4:Ce?oC(c,d,y):H&&H&&(d=d.stateNode.containerInfo,y=je(d),qt(d,y))}}function tC(c,d,y){for(var M=d;;)if(eC(c,M,y),M.child===null||Ce&&M.tag===4){if(M===d)break;for(;M.sibling===null;){if(M.return===null||M.return===d)return;M=M.return}M.sibling.return=M.return,M=M.sibling}else M.child.return=M,M=M.child}function nC(c){var d=c.alternate;d!==null&&(c.alternate=null,nC(d)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(d=c.stateNode,d!==null&&Xe(d)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function rC(c){return c.tag===5||c.tag===3||c.tag===4}function iC(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||rC(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function sC(c){if(Ce){e:{for(var d=c.return;d!==null;){if(rC(d))break e;d=d.return}throw Error(o(160))}var y=d;switch(y.tag){case 5:d=y.stateNode,y.flags&32&&(Be(d),y.flags&=-33),y=iC(c),kx(c,y,d);break;case 3:case 4:d=y.stateNode.containerInfo,y=iC(c),Ox(c,y,d);break;default:throw Error(o(161))}}}function Ox(c,d,y){var M=c.tag;if(M===5||M===6)c=c.stateNode,d?Je(y,c,d):ht(y,c);else if(M!==4&&(c=c.child,c!==null))for(Ox(c,d,y),c=c.sibling;c!==null;)Ox(c,d,y),c=c.sibling}function kx(c,d,y){var M=c.tag;if(M===5||M===6)c=c.stateNode,d?dt(y,c,d):rt(y,c);else if(M!==4&&(c=c.child,c!==null))for(kx(c,d,y),c=c.sibling;c!==null;)kx(c,d,y),c=c.sibling}function oC(c,d,y){for(var M=d,b=!1,I,W;;){if(!b){b=M.return;e:for(;;){if(b===null)throw Error(o(160));switch(I=b.stateNode,b.tag){case 5:W=!1;break e;case 3:I=I.containerInfo,W=!0;break e;case 4:I=I.containerInfo,W=!0;break e}b=b.return}b=!0}if(M.tag===5||M.tag===6)tC(c,M,y),W?ye(I,M.stateNode):q(I,M.stateNode);else if(M.tag===18)W?le(I,M.stateNode):ue(I,M.stateNode);else if(M.tag===4){if(M.child!==null){I=M.stateNode.containerInfo,W=!0,M.child.return=M,M=M.child;continue}}else if(eC(c,M,y),M.child!==null){M.child.return=M,M=M.child;continue}if(M===d)break;for(;M.sibling===null;){if(M.return===null||M.return===d)return;M=M.return,M.tag===4&&(b=!1)}M.sibling.return=M.return,M=M.sibling}}function Ux(c,d){if(Ce){switch(d.tag){case 0:case 11:case 14:case 15:Al(3,d,d.return),Tf(3,d),Al(5,d,d.return);return;case 1:return;case 5:var y=d.stateNode;if(y!=null){var M=d.memoizedProps;c=c!==null?c.memoizedProps:M;var b=d.type,I=d.updateQueue;d.updateQueue=null,I!==null&&_t(y,I,b,c,M,d)}return;case 6:if(d.stateNode===null)throw Error(o(162));y=d.memoizedProps,Me(d.stateNode,c!==null?c.memoizedProps:y,y);return;case 3:xe&&c!==null&&c.memoizedState.isDehydrated&&se(d.stateNode.containerInfo);return;case 12:return;case 13:Fm(d);return;case 19:Fm(d);return;case 17:return}throw Error(o(163))}switch(d.tag){case 0:case 11:case 14:case 15:Al(3,d,d.return),Tf(3,d),Al(5,d,d.return);return;case 12:return;case 13:Fm(d);return;case 19:Fm(d);return;case 3:xe&&c!==null&&c.memoizedState.isDehydrated&&se(d.stateNode.containerInfo);break;case 22:case 23:return}e:if(H){switch(d.tag){case 1:case 5:case 6:break e;case 3:case 4:d=d.stateNode,qt(d.containerInfo,d.pendingChildren);break e}throw Error(o(163))}}function Fm(c){var d=c.updateQueue;if(d!==null){c.updateQueue=null;var y=c.stateNode;y===null&&(y=c.stateNode=new iz),d.forEach(function(M){var b=mz.bind(null,c,M);y.has(M)||(y.add(M),M.then(b,b))})}}function oz(c,d){for(He=d;He!==null;){d=He;var y=d.deletions;if(y!==null)for(var M=0;M";case Bm:return":has("+(Bx(c)||"")+")";case Vm:return'[role="'+c.value+'"]';case Wm:return'"'+c.value+'"';case Hm:return'[data-testname="'+c.value+'"]';default:throw Error(o(365))}}function dC(c,d){var y=[];c=[c,0];for(var M=0;Mb&&(b=W),M&=~I}if(M=b,M=ar()-M,M=(120>M?120:480>M?480:1080>M?1080:1920>M?1920:3e3>M?3e3:4320>M?4320:1960*lz(M/1960))-M,10c?16:c,da===null)var M=!1;else{if(c=da,da=null,Ym=0,Wt&6)throw Error(o(331));var b=Wt;for(Wt|=4,He=c.current;He!==null;){var I=He,W=I.child;if(He.flags&16){var J=I.deletions;if(J!==null){for(var pe=0;pear()-Gx?Rl(c,0):Wx|=y),ai(c,d)}function _C(c,d){d===0&&(c.mode&1?(d=um,um<<=1,!(um&130023424)&&(um=4194304)):d=1);var y=Xr();c=Km(c,d),c!==null&&(hf(c,d,y),ai(c,y))}function pz(c){var d=c.memoizedState,y=0;d!==null&&(y=d.retryLane),_C(c,y)}function mz(c,d){var y=0;switch(c.tag){case 13:var M=c.stateNode,b=c.memoizedState;b!==null&&(y=b.retryLane);break;case 19:M=c.stateNode;break;default:throw Error(o(314))}M!==null&&M.delete(d),_C(c,y)}var SC;SC=function(c,d,y){if(c!==null)if(c.memoizedProps!==d.pendingProps||Dn.current)Mi=!0;else{if(!(c.lanes&y)&&!(d.flags&128))return Mi=!1,nz(c,d,y);Mi=!!(c.flags&131072)}else Mi=!1,Mn&&d.flags&1048576&&aT(d,Sm,d.index);switch(d.lanes=0,d.tag){case 2:var M=d.type;c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2),c=d.pendingProps;var b=Gi(d,Ht.current);Kc(d,y),b=wx(null,d,M,c,b,y);var I=Mx();return d.flags|=1,typeof b=="object"&&b!==null&&typeof b.render=="function"&&b.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,or(M)?(I=!0,mr(d)):I=!1,d.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,cx(d),b.updater=xm,d.stateNode=b,b._reactInternals=d,dx(d,M,c,y),d=Px(null,d,M,!0,I,y)):(d.tag=0,Mn&&I&&fx(d),jr(null,d,b,y),d=d.child),d;case 16:M=d.elementType;e:{switch(c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2),c=d.pendingProps,b=M._init,M=b(M._payload),d.type=M,b=d.tag=vz(M),c=ds(M,c),b){case 0:d=Rx(null,d,M,c,y);break e;case 1:d=jT(null,d,M,c,y);break e;case 11:d=BT(null,d,M,c,y);break e;case 14:d=VT(null,d,M,ds(M.type,c),y);break e}throw Error(o(306,M,""))}return d;case 0:return M=d.type,b=d.pendingProps,b=d.elementType===M?b:ds(M,b),Rx(c,d,M,b,y);case 1:return M=d.type,b=d.pendingProps,b=d.elementType===M?b:ds(M,b),jT(c,d,M,b,y);case 3:e:{if(XT(d),c===null)throw Error(o(387));M=d.pendingProps,I=d.memoizedState,b=I.element,eT(c,d),ym(d,M,null,y);var W=d.memoizedState;if(M=W.element,xe&&I.isDehydrated)if(I={element:M,isDehydrated:!1,cache:W.cache,transitions:W.transitions},d.updateQueue.baseState=I,d.memoizedState=I,d.flags&256){b=Error(o(423)),d=qT(c,d,M,y,b);break e}else if(M!==b){b=Error(o(424)),d=qT(c,d,M,y,b);break e}else for(xe&&(wi=om(d.stateNode.containerInfo),Si=d,Mn=!0,fs=null,pf=!1),y=hT(d,null,M,y),d.child=y;y;)y.flags=y.flags&-3|4096,y=y.sibling;else{if(eu(),M===b){d=Eo(c,d,y);break e}jr(c,d,M,y)}d=d.child}return d;case 5:return pT(d),c===null&&mx(d),M=d.type,b=d.pendingProps,I=c!==null?c.memoizedProps:null,W=b.children,he(M,b)?W=null:I!==null&&he(M,I)&&(d.flags|=32),GT(c,d),jr(c,d,W,y),d.child;case 6:return c===null&&mx(d),null;case 13:return YT(c,d,y);case 4:return vx(d,d.stateNode.containerInfo),M=d.pendingProps,c===null?d.child=tu(d,null,M,y):jr(c,d,M,y),d.child;case 11:return M=d.type,b=d.pendingProps,b=d.elementType===M?b:ds(M,b),BT(c,d,M,b,y);case 7:return jr(c,d,d.pendingProps,y),d.child;case 8:return jr(c,d,d.pendingProps.children,y),d.child;case 12:return jr(c,d,d.pendingProps.children,y),d.child;case 10:e:{if(M=d.type._context,b=d.pendingProps,I=d.memoizedProps,W=b.value,Jb(d,M,W),I!==null)if(zs(I.value,W)){if(I.children===b.children&&!Dn.current){d=Eo(c,d,y);break e}}else for(I=d.child,I!==null&&(I.return=d);I!==null;){var J=I.dependencies;if(J!==null){W=I.child;for(var pe=J.firstContext;pe!==null;){if(pe.context===M){if(I.tag===1){pe=_o(-1,y&-y),pe.tag=2;var De=I.updateQueue;if(De!==null){De=De.shared;var Qe=De.pending;Qe===null?pe.next=pe:(pe.next=Qe.next,Qe.next=pe),De.pending=pe}}I.lanes|=y,pe=I.alternate,pe!==null&&(pe.lanes|=y),lx(I.return,y,d),J.lanes|=y;break}pe=pe.next}}else if(I.tag===10)W=I.type===d.type?null:I.child;else if(I.tag===18){if(W=I.return,W===null)throw Error(o(341));W.lanes|=y,J=W.alternate,J!==null&&(J.lanes|=y),lx(W,y,d),W=I.sibling}else W=I.child;if(W!==null)W.return=I;else for(W=I;W!==null;){if(W===d){W=null;break}if(I=W.sibling,I!==null){I.return=W.return,W=I;break}W=W.return}I=W}jr(c,d,b.children,y),d=d.child}return d;case 9:return b=d.type,M=d.pendingProps.children,Kc(d,y),b=ji(b),M=M(b),d.flags|=1,jr(c,d,M,y),d.child;case 14:return M=d.type,b=ds(M,d.pendingProps),b=ds(M.type,b),VT(c,d,M,b,y);case 15:return HT(c,d,d.type,d.pendingProps,y);case 17:return M=d.type,b=d.pendingProps,b=d.elementType===M?b:ds(M,b),c!==null&&(c.alternate=null,d.alternate=null,d.flags|=2),d.tag=1,or(M)?(c=!0,mr(d)):c=!1,Kc(d,y),sT(d,M,b),dx(d,M,b,y),Px(null,d,M,!0,c,y);case 19:return QT(c,d,y);case 22:return WT(c,d,y)}throw Error(o(156,d.tag))};function wC(c,d){return tx(c,d)}function gz(c,d,y,M){this.tag=c,this.key=y,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=d,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=M,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ki(c,d,y,M){return new gz(c,d,y,M)}function Qx(c){return c=c.prototype,!(!c||!c.isReactComponent)}function vz(c){if(typeof c=="function")return Qx(c)?1:0;if(c!=null){if(c=c.$$typeof,c===_)return 11;if(c===w)return 14}return 2}function pa(c,d){var y=c.alternate;return y===null?(y=Ki(c.tag,d,c.key,c.mode),y.elementType=c.elementType,y.type=c.type,y.stateNode=c.stateNode,y.alternate=c,c.alternate=y):(y.pendingProps=d,y.type=c.type,y.flags=0,y.subtreeFlags=0,y.deletions=null),y.flags=c.flags&14680064,y.childLanes=c.childLanes,y.lanes=c.lanes,y.child=c.child,y.memoizedProps=c.memoizedProps,y.memoizedState=c.memoizedState,y.updateQueue=c.updateQueue,d=c.dependencies,y.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},y.sibling=c.sibling,y.index=c.index,y.ref=c.ref,y}function Jm(c,d,y,M,b,I){var W=2;if(M=c,typeof c=="function")Qx(c)&&(W=1);else if(typeof c=="string")W=5;else e:switch(c){case f:return Ll(y.children,b,I,d);case h:W=8,b|=8;break;case p:return c=Ki(12,y,d,b|2),c.elementType=p,c.lanes=I,c;case x:return c=Ki(13,y,d,b),c.elementType=x,c.lanes=I,c;case m:return c=Ki(19,y,d,b),c.elementType=m,c.lanes=I,c;case E:return eg(y,b,I,d);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case g:W=10;break e;case v:W=9;break e;case _:W=11;break e;case w:W=14;break e;case S:W=16,M=null;break e}throw Error(o(130,c==null?c:typeof c,""))}return d=Ki(W,y,d,b),d.elementType=c,d.type=M,d.lanes=I,d}function Ll(c,d,y,M){return c=Ki(7,c,M,d),c.lanes=y,c}function eg(c,d,y,M){return c=Ki(22,c,M,d),c.elementType=E,c.lanes=y,c.stateNode={},c}function Jx(c,d,y){return c=Ki(6,c,null,d),c.lanes=y,c}function e_(c,d,y){return d=Ki(4,c.children!==null?c.children:[],c.key,d),d.lanes=y,d.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},d}function yz(c,d,y,M,b){this.tag=d,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Le,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jy(0),this.expirationTimes=Jy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jy(0),this.identifierPrefix=M,this.onRecoverableError=b,xe&&(this.mutableSourceEagerHydrationData=null)}function MC(c,d,y,M,b,I,W,J,pe){return c=new yz(c,d,y,J,pe),d===1?(d=1,I===!0&&(d|=8)):d=0,I=Ki(3,null,null,d),c.current=I,I.stateNode=c,I.memoizedState={element:M,isDehydrated:y,cache:null,transitions:null},cx(I),c}function EC(c){if(!c)return Wi;c=c._reactInternals;e:{if(B(c)!==c||c.tag!==1)throw Error(o(170));var d=c;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(or(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(o(171))}if(c.tag===1){var y=c.type;if(or(y))return Yc(c,y,d)}return d}function bC(c){var d=c._reactInternals;if(d===void 0)throw typeof c.render=="function"?Error(o(188)):(c=Object.keys(c).join(","),Error(o(268,c)));return c=G(d),c===null?null:c.stateNode}function TC(c,d){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var y=c.retryLane;c.retryLane=y!==0&&y=De&&I>=Pt&&b<=Qe&&W<=ft){c.splice(d,1);break}else if(M!==De||y.width!==pe.width||ftW){if(!(I!==Pt||y.height!==pe.height||Qeb)){De>M&&(pe.width+=De-M,pe.x=M),QeI&&(pe.height+=Pt-I,pe.y=I),fty&&(y=W)),W ")+` - -No matching component was found for: - `)+c.join(" > ")}return null},t.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return $(c.child.stateNode);default:return c.child.stateNode}},t.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:xz,findFiberByHostInstance:c.findFiberByHostInstance||_z,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var d=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(d.isDisabled||!d.supportsFiber)c=!0;else{try{fm=d.inject(c),Fs=d}catch{}c=!!d.checkDCE}}return c},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(c,d,y,M){if(!O)throw Error(o(363));c=Vx(c,d);var b=Ve(c,y,M).disconnect;return{disconnect:function(){b()}}},t.registerMutableSourceForHydration=function(c,d){var y=d._getVersion;y=y(d._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[d,y]:c.mutableSourceEagerHydrationData.push(d,y)},t.runWithPriority=function(c,d){var y=en;try{return en=c,d()}finally{en=y}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(c,d,y,M){var b=d.current,I=Xr(),W=fa(b);return y=EC(y),d.context===null?d.context=y:d.pendingContext=y,d=_o(I,W),d.payload={element:c},M=M===void 0?null:M,M!==null&&(d.callback=M),ca(b,d),c=$i(b,W,I),c!==null&&vm(c,b,W),W},t};o3.exports=oX;var aX=o3.exports;const lX=kp(aX),xE={},c3=n=>void Object.assign(xE,n);function cX(n,e){function t(f,{args:h=[],attach:p,...g},v){let _=`${f[0].toUpperCase()}${f.slice(1)}`,x;if(f==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const m=g.object;x=ku(m,{type:f,root:v,attach:p,primitive:!0})}else{const m=xE[_];if(!m)throw new Error(`R3F: ${_} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");x=ku(new m(...h),{type:f,root:v,attach:p,memoizedProps:{args:h}})}return x.__r3f.attach===void 0&&(x instanceof Dt?x.__r3f.attach="geometry":x instanceof Er&&(x.__r3f.attach="material")),_!=="inject"&&Z_(x,g),x}function r(f,h){let p=!1;if(h){var g,v;(g=h.__r3f)!=null&&g.attach?Y_(f,h,h.__r3f.attach):h.isObject3D&&f.isObject3D&&(f.add(h),p=!0),p||(v=f.__r3f)==null||v.objects.push(h),h.__r3f||ku(h,{}),h.__r3f.parent=f,Z1(h),Uu(h)}}function i(f,h,p){let g=!1;if(h){var v,_;if((v=h.__r3f)!=null&&v.attach)Y_(f,h,h.__r3f.attach);else if(h.isObject3D&&f.isObject3D){h.parent=f,h.dispatchEvent({type:"added"}),f.dispatchEvent({type:"childadded",child:h});const x=f.children.filter(w=>w!==h),m=x.indexOf(p);f.children=[...x.slice(0,m),h,...x.slice(m)],g=!0}g||(_=f.__r3f)==null||_.objects.push(h),h.__r3f||ku(h,{}),h.__r3f.parent=f,Z1(h),Uu(h)}}function s(f,h,p=!1){f&&[...f].forEach(g=>o(h,g,p))}function o(f,h,p){if(h){var g,v,_;if(h.__r3f&&(h.__r3f.parent=null),(g=f.__r3f)!=null&&g.objects&&(f.__r3f.objects=f.__r3f.objects.filter(E=>E!==h)),(v=h.__r3f)!=null&&v.attach)IR(f,h,h.__r3f.attach);else if(h.isObject3D&&f.isObject3D){var x;f.remove(h),(x=h.__r3f)!=null&&x.root&&yX(Pv(h),h)}const w=(_=h.__r3f)==null?void 0:_.primitive,S=!w&&(p===void 0?h.dispose!==null:p);if(!w){var m;s((m=h.__r3f)==null?void 0:m.objects,h,S),s(h.children,h,S)}if(delete h.__r3f,S&&h.dispose&&h.type!=="Scene"){const E=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?q1.unstable_scheduleCallback(q1.unstable_IdlePriority,E):E()}Uu(f)}}function a(f,h,p,g){var v;const _=(v=f.__r3f)==null?void 0:v.parent;if(!_)return;const x=t(h,p,f.__r3f.root);if(f.children){for(const m of f.children)m.__r3f&&r(x,m);f.children=f.children.filter(m=>!m.__r3f)}f.__r3f.objects.forEach(m=>r(x,m)),f.__r3f.objects=[],f.__r3f.autoRemovedBeforeAppend||o(_,f),x.parent&&(x.__r3f.autoRemovedBeforeAppend=!0),r(_,x),x.raycast&&x.__r3f.eventCount&&Pv(x).getState().internal.interaction.push(x),[g,g.alternate].forEach(m=>{m!==null&&(m.stateNode=x,m.ref&&(typeof m.ref=="function"?m.ref(x):m.ref.current=x))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:lX({createInstance:t,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(f,h)=>{if(!h)return;const p=f.getState().scene;p.__r3f&&(p.__r3f.root=f,r(p,h))},removeChildFromContainer:(f,h)=>{h&&o(f.getState().scene,h)},insertInContainerBefore:(f,h,p)=>{if(!h||!p)return;const g=f.getState().scene;g.__r3f&&i(g,h,p)},getRootHostContext:()=>null,getChildHostContext:f=>f,finalizeInitialChildren(f){var h;return!!((h=f==null?void 0:f.__r3f)!=null?h:{}).handlers},prepareUpdate(f,h,p,g){var v;if(((v=f==null?void 0:f.__r3f)!=null?v:{}).primitive&&g.object&&g.object!==f)return[!0];{const{args:x=[],children:m,...w}=g,{args:S=[],children:E,...R}=p;if(!Array.isArray(x))throw new Error("R3F: the args prop must be an array!");if(x.some((L,D)=>L!==S[D]))return[!0];const P=g3(f,w,R,!0);return P.changes.length?[!1,P]:null}},commitUpdate(f,[h,p],g,v,_,x){h?a(f,g,_,x):Z_(f,p)},commitMount(f,h,p,g){var v;const _=(v=f.__r3f)!=null?v:{};f.raycast&&_.handlers&&_.eventCount&&Pv(f).getState().internal.interaction.push(f)},getPublicInstance:f=>f,prepareForCommit:()=>null,preparePortalMount:f=>ku(f.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(f){var h;const{attach:p,parent:g}=(h=f.__r3f)!=null?h:{};p&&g&&IR(g,f,p),f.isObject3D&&(f.visible=!1),Uu(f)},unhideInstance(f,h){var p;const{attach:g,parent:v}=(p=f.__r3f)!=null?p:{};g&&v&&Y_(v,f,g),(f.isObject3D&&h.visible==null||h.visible)&&(f.visible=!0),Uu(f)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Gu.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&gn.fun(performance.now)?performance.now:gn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:gn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:gn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Z_}}var CR,AR;const q_=n=>"colorSpace"in n||"outputColorSpace"in n,u3=()=>{var n;return(n=xE.ColorManagement)!=null?n:null},d3=n=>n&&n.isOrthographicCamera,uX=n=>n&&n.hasOwnProperty("current"),nf=typeof window<"u"&&((CR=window.document)!=null&&CR.createElement||((AR=window.navigator)==null?void 0:AR.product)==="ReactNative")?T.useLayoutEffect:T.useEffect;function f3(n){const e=T.useRef(n);return nf(()=>void(e.current=n),[n]),e}function dX({set:n}){return nf(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class h3 extends T.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}h3.getDerivedStateFromError=()=>({error:!0});const p3="__default",RR=new Map,fX=n=>n&&!!n.memoized&&!!n.changes;function m3(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const Gf=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()};function Pv(n){let e=n.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const gn={obj:n=>n===Object(n)&&!gn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:r="reference",strict:i=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(gn.str(n)||gn.num(n)||gn.boo(n))return n===e;const s=gn.obj(n);if(s&&r==="reference")return n===e;const o=gn.arr(n);if(o&&t==="reference")return n===e;if((o||s)&&n===e)return!0;let a;for(a in n)if(!(a in e))return!1;if(s&&t==="shallow"&&r==="shallow"){for(a in i?e:n)if(!gn.equ(n[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:n)if(n[a]!==e[a])return!1;if(gn.und(a)){if(o&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function hX(n){const e={nodes:{},materials:{}};return n&&n.traverse(t=>{t.name&&(e.nodes[t.name]=t),t.material&&!e.materials[t.material.name]&&(e.materials[t.material.name]=t.material)}),e}function pX(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function ku(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function Y1(n,e){let t=n;if(e.includes("-")){const r=e.split("-"),i=r.pop();return t=r.reduce((s,o)=>s[o],n),{target:t,key:i}}else return{target:t,key:e}}const PR=/-\d+$/;function Y_(n,e,t){if(gn.str(t)){if(PR.test(t)){const s=t.replace(PR,""),{target:o,key:a}=Y1(n,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=Y1(n,t);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=t(n,e)}function IR(n,e,t){var r,i;if(gn.str(t)){const{target:s,key:o}=Y1(n,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(n,e);(i=e.__r3f)==null||delete i.previousAttach}function g3(n,{children:e,key:t,ref:r,...i},{children:s,key:o,ref:a,...l}={},u=!1){const f=n.__r3f,h=Object.entries(i),p=[];if(u){const v=Object.keys(l);for(let _=0;_{var x;if((x=n.__r3f)!=null&&x.primitive&&v==="object"||gn.equ(_,l[v]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(v))return p.push([v,_,!0,[]]);let m=[];v.includes("-")&&(m=v.split("-")),p.push([v,_,!1,m]);for(const w in i){const S=i[w];w.startsWith(`${v}-`)&&p.push([w,S,!1,w.split("-")])}});const g={...i};return f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.args&&(g.args=f.memoizedProps.args),f!=null&&f.memoizedProps&&f!=null&&f.memoizedProps.attach&&(g.attach=f.memoizedProps.attach),{memoized:g,changes:p}}const mX=typeof process<"u"&&!1;function Z_(n,e){var t;const r=n.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=fX(e)?e:g3(n,e),l=r==null?void 0:r.eventCount;n.__r3f&&(n.__r3f.memoizedProps=o);for(let f=0;fm[w],n),!(x&&x.set))){const[m,...w]=v.reverse();_=w.reverse().reduce((S,E)=>S[E],n),h=m}if(p===p3+"remove")if(_.constructor){let m=RR.get(_.constructor);m||(m=new _.constructor,RR.set(_.constructor,m)),p=m[h]}else p=0;if(g&&r)p?r.handlers[h]=p:delete r.handlers[h],r.eventCount=Object.keys(r.handlers).length;else if(x&&x.set&&(x.copy||x instanceof mc)){if(Array.isArray(p))x.fromArray?x.fromArray(p):x.set(...p);else if(x.copy&&p&&p.constructor&&(mX?x.constructor.name===p.constructor.name:x.constructor===p.constructor))x.copy(p);else if(p!==void 0){const m=x instanceof Fe;!m&&x.setScalar?x.setScalar(p):x instanceof mc&&p instanceof mc?x.mask=p.mask:x.set(p),!u3()&&s&&!s.linear&&m&&x.convertSRGBToLinear()}}else if(_[h]=p,_[h]instanceof In&&_[h].format===Fr&&_[h].type===oo&&s){const m=_[h];q_(m)&&q_(s.gl)?m.colorSpace=s.gl.outputColorSpace:m.encoding=s.gl.outputEncoding}Uu(n)}if(r&&r.parent&&n.raycast&&l!==r.eventCount){const f=Pv(n).getState().internal,h=f.interaction.indexOf(n);h>-1&&f.interaction.splice(h,1),r.eventCount&&f.interaction.push(n)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(t=n.__r3f)!=null&&t.parent&&Z1(n),n}function Uu(n){var e,t;const r=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();r&&r.internal.frames===0&&r.invalidate()}function Z1(n){n.onUpdate==null||n.onUpdate(n)}function gX(n,e){n.manual||(d3(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function Zg(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function vX(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Gu.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Gu.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Gu.ContinuousEventPriority;default:return Gu.DefaultEventPriority}}function v3(n,e,t,r){const i=t.get(e);i&&(t.delete(e),t.size===0&&(n.delete(r),i.target.releasePointerCapture(r)))}function yX(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(r=>r!==e),t.initialHits=t.initialHits.filter(r=>r!==e),t.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((r,i)=>{v3(t.capturedMap,e,r,i)})}function xX(n){function e(l){const{internal:u}=n.getState(),f=l.offsetX-u.initialClick[0],h=l.offsetY-u.initialClick[1];return Math.round(Math.sqrt(f*f+h*h))}function t(l){return l.filter(u=>["Move","Over","Enter","Out","Leave"].some(f=>{var h;return(h=u.__r3f)==null?void 0:h.handlers["onPointer"+f]}))}function r(l,u){const f=n.getState(),h=new Set,p=[],g=u?u(f.internal.interaction):f.internal.interaction;for(let m=0;m{const S=Gf(m.object),E=Gf(w.object);return!S||!E?m.distance-w.distance:E.events.priority-S.events.priority||m.distance-w.distance}).filter(m=>{const w=Zg(m);return h.has(w)?!1:(h.add(w),!0)});f.events.filter&&(_=f.events.filter(_,f));for(const m of _){let w=m.object;for(;w;){var x;(x=w.__r3f)!=null&&x.eventCount&&p.push({...m,eventObject:w}),w=w.parent}}if("pointerId"in l&&f.internal.capturedMap.has(l.pointerId))for(let m of f.internal.capturedMap.get(l.pointerId).values())h.has(Zg(m.intersection))||p.push(m.intersection);return p}function i(l,u,f,h){const p=n.getState();if(l.length){const g={stopped:!1};for(const v of l){const _=Gf(v.object)||p,{raycaster:x,pointer:m,camera:w,internal:S}=_,E=new F(m.x,m.y,0).unproject(w),R=A=>{var N,G;return(N=(G=S.capturedMap.get(A))==null?void 0:G.has(v.eventObject))!=null?N:!1},P=A=>{const N={intersection:v,target:u.target};S.capturedMap.has(A)?S.capturedMap.get(A).set(v.eventObject,N):S.capturedMap.set(A,new Map([[v.eventObject,N]])),u.target.setPointerCapture(A)},L=A=>{const N=S.capturedMap.get(A);N&&v3(S.capturedMap,v.eventObject,N,A)};let D={};for(let A in u){let N=u[A];typeof N!="function"&&(D[A]=N)}let B={...v,...D,pointer:m,intersections:l,stopped:g.stopped,delta:f,unprojectedPoint:E,ray:x.ray,camera:w,stopPropagation(){const A="pointerId"in u&&S.capturedMap.get(u.pointerId);if((!A||A.has(v.eventObject))&&(B.stopped=g.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(N=>N.eventObject===v.eventObject))){const N=l.slice(0,l.indexOf(v));s([...N,v])}},target:{hasPointerCapture:R,setPointerCapture:P,releasePointerCapture:L},currentTarget:{hasPointerCapture:R,setPointerCapture:P,releasePointerCapture:L},nativeEvent:u};if(h(B),g.stopped===!0)break}}return l}function s(l){const{internal:u}=n.getState();for(const f of u.hovered.values())if(!l.length||!l.find(h=>h.object===f.object&&h.index===f.index&&h.instanceId===f.instanceId)){const p=f.eventObject.__r3f,g=p==null?void 0:p.handlers;if(u.hovered.delete(Zg(f)),p!=null&&p.eventCount){const v={...f,intersections:l};g.onPointerOut==null||g.onPointerOut(v),g.onPointerLeave==null||g.onPointerLeave(v)}}}function o(l,u){for(let f=0;fs([]);case"onLostPointerCapture":return u=>{const{internal:f}=n.getState();"pointerId"in u&&f.capturedMap.has(u.pointerId)&&requestAnimationFrame(()=>{f.capturedMap.has(u.pointerId)&&(f.capturedMap.delete(u.pointerId),s([]))})}}return function(f){const{onPointerMissed:h,internal:p}=n.getState();p.lastEvent.current=f;const g=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",x=r(f,g?t:void 0),m=v?e(f):0;l==="onPointerDown"&&(p.initialClick=[f.offsetX,f.offsetY],p.initialHits=x.map(S=>S.eventObject)),v&&!x.length&&m<=2&&(o(f,p.interaction),h&&h(f)),g&&s(x);function w(S){const E=S.eventObject,R=E.__r3f,P=R==null?void 0:R.handlers;if(R!=null&&R.eventCount)if(g){if(P.onPointerOver||P.onPointerEnter||P.onPointerOut||P.onPointerLeave){const L=Zg(S),D=p.hovered.get(L);D?D.stopped&&S.stopPropagation():(p.hovered.set(L,S),P.onPointerOver==null||P.onPointerOver(S),P.onPointerEnter==null||P.onPointerEnter(S))}P.onPointerMove==null||P.onPointerMove(S)}else{const L=P[l];L?(!v||p.initialHits.includes(E))&&(o(f,p.interaction.filter(D=>!p.initialHits.includes(D))),L(S)):v&&p.initialHits.includes(E)&&o(f,p.interaction.filter(D=>!p.initialHits.includes(D)))}}i(x,f,m,w)}}return{handlePointer:a}}const y3=n=>!!(n!=null&&n.render),x3=T.createContext(null),_X=(n,e)=>{const t=tX((a,l)=>{const u=new F,f=new F,h=new F;function p(m=l().camera,w=f,S=l().size){const{width:E,height:R,top:P,left:L}=S,D=E/R;w instanceof F?h.copy(w):h.set(...w);const B=m.getWorldPosition(u).distanceTo(h);if(d3(m))return{width:E/m.zoom,height:R/m.zoom,top:P,left:L,factor:1,distance:B,aspect:D};{const A=m.fov*Math.PI/180,N=2*Math.tan(A/2)*B,G=N*(E/R);return{width:G,height:N,top:P,left:L,factor:E/G,distance:B,aspect:D}}}let g;const v=m=>a(w=>({performance:{...w.performance,current:m}})),_=new ge;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(m=1)=>n(l(),m),advance:(m,w)=>e(m,w,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Zp,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const m=l();g&&clearTimeout(g),m.performance.current!==m.performance.min&&v(m.performance.min),g=setTimeout(()=>v(l().performance.max),m.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:m=>a(w=>({...w,events:{...w.events,...m}})),setSize:(m,w,S,E,R)=>{const P=l().camera,L={width:m,height:w,top:E||0,left:R||0,updateStyle:S};a(D=>({size:L,viewport:{...D.viewport,...p(P,f,L)}}))},setDpr:m=>a(w=>{const S=m3(m);return{viewport:{...w.viewport,dpr:S,initialDpr:w.viewport.initialDpr||S}}}),setFrameloop:(m="always")=>{const w=l().clock;w.stop(),w.elapsedTime=0,m!=="never"&&(w.start(),w.elapsedTime=0),a(()=>({frameloop:m}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:T.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(m,w,S)=>{const E=l().internal;return E.priority=E.priority+(w>0?1:0),E.subscribers.push({ref:m,priority:w,store:S}),E.subscribers=E.subscribers.sort((R,P)=>R.priority-P.priority),()=>{const R=l().internal;R!=null&&R.subscribers&&(R.priority=R.priority-(w>0?1:0),R.subscribers=R.subscribers.filter(P=>P.ref!==m))}}}}}),r=t.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:u,gl:f,set:h}=t.getState();if(l.width!==i.width||l.height!==i.height||u.dpr!==s){var p;i=l,s=u.dpr,gX(a,l),f.setPixelRatio(u.dpr);const g=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&f.domElement instanceof HTMLCanvasElement;f.setSize(l.width,l.height,g)}a!==o&&(o=a,h(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>n(a)),t};let $g,SX=new Set,wX=new Set,MX=new Set;function $_(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function jf(n,e){switch(n){case"before":return $_(SX,e);case"after":return $_(wX,e);case"tail":return $_(MX,e)}}let K_,Q_;function J_(n,e,t){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(r=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),K_=e.internal.subscribers,$g=0;$g0)&&!((f=s.gl.xr)!=null&&f.isPresenting)&&(r+=J_(u,s))}if(t=!1,jf("after",u),r===0)return jf("tail",u),e=!1,cancelAnimationFrame(i)}function a(u,f=1){var h;if(!u)return n.forEach(p=>a(p.store.getState(),f));(h=u.gl.xr)!=null&&h.isPresenting||!u.internal.active||u.frameloop==="never"||(f>1?u.internal.frames=Math.min(60,u.internal.frames+f):t?u.internal.frames=2:u.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(u,f=!0,h,p){if(f&&jf("before",u),h)J_(u,h,p);else for(const g of n.values())J_(u,g.store.getState());f&&jf("after",u)}return{loop:o,invalidate:a,advance:l}}function hte(n){const e=T.useRef(null);return nf(()=>void(e.current=n.current.__r3f),[n]),e}function _3(){const n=T.useContext(x3);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function Ai(n=t=>t,e){return _3()(n,e)}function Hc(n,e=0){const t=_3(),r=t.getState().internal.subscribe,i=f3(n);return nf(()=>r(i,e,t),[e,r,t]),null}const LR=new WeakMap;function S3(n,e){return function(t,...r){let i=LR.get(t);return i||(i=new t,LR.set(t,i)),n&&n(i),Promise.all(r.map(s=>new Promise((o,a)=>i.load(s,l=>{l.scene&&Object.assign(l,hX(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l==null?void 0:l.message}`))))))}}function w3(n,e,t,r){const i=Array.isArray(e)?e:[e],s=rX(S3(t,r),[n,...i],{equal:gn.equ});return Array.isArray(e)?s:s[0]}w3.preload=function(n,e,t){const r=Array.isArray(e)?e:[e];return iX(S3(t),[n,...r])};w3.clear=function(n,e){const t=Array.isArray(e)?e:[e];return sX([n,...t])};const kd=new Map,{invalidate:NR,advance:DR}=EX(kd),{reconciler:a0,applyProps:Ru}=cX(kd,vX),Pu={objects:"shallow",strict:!1},bX=(n,e)=>{const t=typeof n=="function"?n(e):n;return y3(t)?t:new DM({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function TX(n,e){const t=typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:o,updateStyle:a=t}=e;return{width:r,height:i,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:r,height:i,top:s,left:o}=n.parentElement.getBoundingClientRect();return{width:r,height:i,top:s,left:o,updateStyle:t}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0,updateStyle:t};return{width:0,height:0,top:0,left:0}}function CX(n){const e=kd.get(n),t=e==null?void 0:e.fiber,r=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const i=typeof reportError=="function"?reportError:console.error,s=r||_X(NR,DR),o=t||a0.createContainer(s,Gu.ConcurrentRoot,null,!1,null,"",i,null);e||kd.set(n,{fiber:o,store:s});let a,l=!1,u;return{configure(f={}){let{gl:h,size:p,scene:g,events:v,onCreated:_,shadows:x=!1,linear:m=!1,flat:w=!1,legacy:S=!1,orthographic:E=!1,frameloop:R="always",dpr:P=[1,2],performance:L,raycaster:D,camera:B,onPointerMissed:A}=f,N=s.getState(),G=N.gl;N.gl||N.set({gl:G=bX(h,n)});let Q=N.raycaster;Q||N.set({raycaster:Q=new oN});const{params:V,...Z}=D||{};if(gn.equ(Z,Q,Pu)||Ru(Q,{...Z}),gn.equ(V,Q.params,Pu)||Ru(Q,{params:{...Q.params,...V}}),!N.camera||N.camera===u&&!gn.equ(u,B,Pu)){u=B;const Y=B instanceof Yd,K=Y?B:E?new Vo(0,0,0,0,.1,1e3):new Rn(75,0,.1,1e3);Y||(K.position.z=5,B&&(Ru(K,B),("aspect"in B||"left"in B||"right"in B||"bottom"in B||"top"in B)&&(K.manual=!0,K.updateProjectionMatrix())),!N.camera&&!(B!=null&&B.rotation)&&K.lookAt(0,0,0)),N.set({camera:K}),Q.camera=K}if(!N.scene){let Y;g instanceof Vh?Y=g:(Y=new Vh,g&&Ru(Y,g)),N.set({scene:ku(Y)})}if(!N.xr){var $;const Y=(_e,ne)=>{const he=s.getState();he.frameloop!=="never"&&DR(_e,!0,he,ne)},K=()=>{const _e=s.getState();_e.gl.xr.enabled=_e.gl.xr.isPresenting,_e.gl.xr.setAnimationLoop(_e.gl.xr.isPresenting?Y:null),_e.gl.xr.isPresenting||NR(_e)},ae={connect(){const _e=s.getState().gl;_e.xr.addEventListener("sessionstart",K),_e.xr.addEventListener("sessionend",K)},disconnect(){const _e=s.getState().gl;_e.xr.removeEventListener("sessionstart",K),_e.xr.removeEventListener("sessionend",K)}};typeof(($=G.xr)==null?void 0:$.addEventListener)=="function"&&ae.connect(),N.set({xr:ae})}if(G.shadowMap){const Y=G.shadowMap.enabled,K=G.shadowMap.type;if(G.shadowMap.enabled=!!x,gn.boo(x))G.shadowMap.type=dh;else if(gn.str(x)){var re;const ae={basic:KP,percentage:q0,soft:dh,variance:ys};G.shadowMap.type=(re=ae[x])!=null?re:dh}else gn.obj(x)&&Object.assign(G.shadowMap,x);(Y!==G.shadowMap.enabled||K!==G.shadowMap.type)&&(G.shadowMap.needsUpdate=!0)}const k=u3();k&&("enabled"in k?k.enabled=!S:"legacyMode"in k&&(k.legacyMode=S)),l||Ru(G,{outputEncoding:m?3e3:3001,toneMapping:w?so:mM}),N.legacy!==S&&N.set(()=>({legacy:S})),N.linear!==m&&N.set(()=>({linear:m})),N.flat!==w&&N.set(()=>({flat:w})),h&&!gn.fun(h)&&!y3(h)&&!gn.equ(h,G,Pu)&&Ru(G,h),v&&!N.events.handlers&&N.set({events:v(s)});const j=TX(n,p);return gn.equ(j,N.size,Pu)||N.setSize(j.width,j.height,j.updateStyle,j.top,j.left),P&&N.viewport.dpr!==m3(P)&&N.setDpr(P),N.frameloop!==R&&N.setFrameloop(R),N.onPointerMissed||N.set({onPointerMissed:A}),L&&!gn.equ(L,N.performance,Pu)&&N.set(Y=>({performance:{...Y.performance,...L}})),a=_,l=!0,this},render(f){return l||this.configure(),a0.updateContainer(C.jsx(AX,{store:s,children:f,onCreated:a,rootElement:n}),o,null,()=>{}),s},unmount(){M3(n)}}}function AX({store:n,children:e,onCreated:t,rootElement:r}){return nf(()=>{const i=n.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),n.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),C.jsx(x3.Provider,{value:n,children:e})}function M3(n,e){const t=kd.get(n),r=t==null?void 0:t.fiber;if(r){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),a0.updateContainer(null,r,null,()=>{i&&setTimeout(()=>{try{var s,o,a,l;i.events.disconnect==null||i.events.disconnect(),(s=i.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=i.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=i.gl)!=null&&l.xr&&i.xr.disconnect(),pX(i),kd.delete(n)}catch{}},500)})}}a0.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:T.version});const eS={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function RX(n){const{handlePointer:e}=xX(n);return{priority:1,enabled:!0,compute(t,r,i){r.pointer.set(t.offsetX/r.size.width*2-1,-(t.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(eS).reduce((t,r)=>({...t,[r]:e(r)}),{}),update:()=>{var t;const{events:r,internal:i}=n.getState();(t=i.lastEvent)!=null&&t.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var r;const{set:i,events:s}=n.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:t}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,u]=eS[o];t.addEventListener(l,a,{passive:u})})},disconnect:()=>{const{set:t,events:r}=n.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=eS[s];r.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}function $1(n,e,t){var r,i,s,o,a;e==null&&(e=100);function l(){var f=Date.now()-o;f=0?r=setTimeout(l,e-f):(r=null,t||(a=n.apply(s,i),s=i=null))}var u=function(){s=this,i=arguments,o=Date.now();var f=t&&!r;return r||(r=setTimeout(l,e)),f&&(a=n.apply(s,i),s=i=null),a};return u.clear=function(){r&&(clearTimeout(r),r=null)},u.flush=function(){r&&(a=n.apply(s,i),s=i=null,clearTimeout(r),r=null)},u}$1.debounce=$1;var PX=$1;const OR=kp(PX);var IX=Object.defineProperty,LX=Object.defineProperties,NX=Object.getOwnPropertyDescriptors,kR=Object.getOwnPropertySymbols,DX=Object.prototype.hasOwnProperty,OX=Object.prototype.propertyIsEnumerable,UR=(n,e,t)=>e in n?IX(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,FR=(n,e)=>{for(var t in e||(e={}))DX.call(e,t)&&UR(n,t,e[t]);if(kR)for(var t of kR(e))OX.call(e,t)&&UR(n,t,e[t]);return n},kX=(n,e)=>LX(n,NX(e)),zR,BR;typeof window<"u"&&((zR=window.document)!=null&&zR.createElement||((BR=window.navigator)==null?void 0:BR.product)==="ReactNative")?T.useLayoutEffect:T.useEffect;function E3(n,e,t){if(!n)return;if(t(n)===!0)return n;let r=n.child;for(;r;){const i=E3(r,e,t);if(i)return i;r=r.sibling}}function b3(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const VR=console.error;console.error=function(){const n=[...arguments].join("");if(n!=null&&n.startsWith("Warning:")&&n.includes("useContext")){console.error=VR;return}return VR.apply(this,arguments)};const _E=b3(T.createContext(null));class T3 extends T.Component{render(){return T.createElement(_E.Provider,{value:this._reactInternals},this.props.children)}}function UX(){const n=T.useContext(_E);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=T.useId();return T.useMemo(()=>{for(const r of[n,n==null?void 0:n.alternate]){if(!r)continue;const i=E3(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[n,e])}function FX(){const n=UX(),[e]=T.useState(()=>new Map);e.clear();let t=n;for(;t;){if(t.type&&typeof t.type=="object"){const i=t.type._context===void 0&&t.type.Provider===t.type?t.type:t.type._context;i&&i!==_E&&!e.has(i)&&e.set(i,T.useContext(b3(i)))}t=t.return}return e}function zX(){const n=FX();return T.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>r=>T.createElement(e,null,T.createElement(t.Provider,kX(FR({},r),{value:n.get(t)}))),e=>T.createElement(T3,FR({},e))),[n])}function BX({debounce:n,scroll:e,polyfill:t,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||typeof window<"u"&&window.ResizeObserver,[s,o]=T.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0});if(!i)return s.width=1280,s.height=800,[()=>{},s,()=>{}];const a=T.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s}),l=n?typeof n=="number"?n:n.scroll:null,u=n?typeof n=="number"?n:n.resize:null,f=T.useRef(!1);T.useEffect(()=>(f.current=!0,()=>void(f.current=!1)));const[h,p,g]=T.useMemo(()=>{const m=()=>{if(!a.current.element)return;const{left:w,top:S,width:E,height:R,bottom:P,right:L,x:D,y:B}=a.current.element.getBoundingClientRect(),A={left:w,top:S,width:E,height:R,bottom:P,right:L,x:D,y:B};a.current.element instanceof HTMLElement&&r&&(A.height=a.current.element.offsetHeight,A.width=a.current.element.offsetWidth),Object.freeze(A),f.current&&!GX(a.current.lastBounds,A)&&o(a.current.lastBounds=A)};return[m,u?OR(m,u):m,l?OR(m,l):m]},[o,r,l,u]);function v(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(m=>m.removeEventListener("scroll",g,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null)}function _(){a.current.element&&(a.current.resizeObserver=new i(g),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(m=>m.addEventListener("scroll",g,{capture:!0,passive:!0})))}const x=m=>{!m||m===a.current.element||(v(),a.current.element=m,a.current.scrollContainers=C3(m),_())};return HX(g,!!e),VX(p),T.useEffect(()=>{v(),_()},[e,g,p]),T.useEffect(()=>v,[]),[x,s,h]}function VX(n){T.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function HX(n,e){T.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function C3(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:r,overflowY:i}=window.getComputedStyle(n);return[t,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...C3(n.parentElement)]}const WX=["x","y","top","bottom","left","right","width","height"],GX=(n,e)=>WX.every(t=>n[t]===e[t]),jX=T.forwardRef(function({children:e,fallback:t,resize:r,style:i,gl:s,events:o=RX,eventSource:a,eventPrefix:l,shadows:u,linear:f,flat:h,legacy:p,orthographic:g,frameloop:v,dpr:_,performance:x,raycaster:m,camera:w,scene:S,onPointerMissed:E,onCreated:R,...P},L){T.useMemo(()=>c3(p6),[]);const D=zX(),[B,A]=BX({scroll:!0,debounce:{scroll:50,resize:0},...r}),N=T.useRef(null),G=T.useRef(null);T.useImperativeHandle(L,()=>N.current);const Q=f3(E),[V,Z]=T.useState(!1),[$,re]=T.useState(!1);if(V)throw V;if($)throw $;const k=T.useRef(null);nf(()=>{const Y=N.current;A.width>0&&A.height>0&&Y&&(k.current||(k.current=CX(Y)),k.current.configure({gl:s,events:o,shadows:u,linear:f,flat:h,legacy:p,orthographic:g,frameloop:v,dpr:_,performance:x,raycaster:m,camera:w,scene:S,size:A,onPointerMissed:(...K)=>Q.current==null?void 0:Q.current(...K),onCreated:K=>{K.events.connect==null||K.events.connect(a?uX(a)?a.current:a:G.current),l&&K.setEvents({compute:(ae,_e)=>{const ne=ae[l+"X"],he=ae[l+"Y"];_e.pointer.set(ne/_e.size.width*2-1,-(he/_e.size.height)*2+1),_e.raycaster.setFromCamera(_e.pointer,_e.camera)}}),R==null||R(K)}}),k.current.render(C.jsx(D,{children:C.jsx(h3,{set:re,children:C.jsx(T.Suspense,{fallback:C.jsx(dX,{set:Z}),children:e})})})))}),T.useEffect(()=>{const Y=N.current;if(Y)return()=>M3(Y)},[]);const j=a?"none":"auto";return C.jsx("div",{ref:G,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:j,...i},...P,children:C.jsx("div",{ref:B,style:{width:"100%",height:"100%"},children:C.jsx("canvas",{ref:N,style:{display:"block"},children:t})})})}),A3=T.forwardRef(function(e,t){return C.jsx(T3,{children:C.jsx(jX,{...e,ref:t})})}),XX=` -precision mediump float; -uniform vec3 color; - -void main() { - gl_FragColor = vec4(color, 1.0); -} -`,qX=` -precision mediump float; - -uniform float max_amplitude; -uniform vec2 resolution; -uniform sampler2D samples; -uniform vec2 sample_scale; -uniform bool b_should_interpolate; - -attribute float index; - -float decode(vec2 c) { - float unscaled = (c.x * 255.0 * 256.0 + c.y * 255.0) / (256.0 * 256.0 - 1.0); - return (unscaled * 2.0 - 1.0) * max_amplitude; -} - -vec2 interpolate_sample(int i) { - // calculate the size of single pixel in normalized coords - float texture_size_x = float(textureSize(samples, 0).x); - float texel_size_x = 1.0 / texture_size_x; - - // normalize the input coordinate (range 0-1) - float norm_x = float(i) / sample_scale.x; - - float nearest_tex_x_below = 1.0 * floor(norm_x * texture_size_x); - vec2 tex_coord_below_norm = vec2(nearest_tex_x_below / texture_size_x, 0.0); - vec2 tex_coord_above_norm = tex_coord_below_norm + vec2(texel_size_x, 0.0); - - // Sample the 1D texture above and below - vec4 sample_below = texture2D(samples, tex_coord_below_norm); - vec4 sample_above = texture2D(samples, tex_coord_above_norm); - - // decode the byte structures into a 2D xy coordinate - vec2 nearest_below = vec2(decode(sample_below.rg), decode(sample_below.ba)); - vec2 nearest_above = vec2(decode(sample_above.rg), decode(sample_above.ba)); - - // Interpolate between the coords - float a = fract((norm_x - tex_coord_below_norm.x) / texel_size_x ); - return mix(nearest_below, nearest_above, a); -} - -vec2 get_sample(int i, bool interp) { - if (interp){ - return interpolate_sample(i); - } - // normalize the coordinate (range 0-1) and then sample the 1D texture - vec4 my_sample = texture2D(samples, vec2(i, 0.0) / sample_scale); - - // decode the byte structure into a 2D xy coordinate - return vec2(decode(my_sample.rg), decode(my_sample.ba)); -} - -const float t_max = 5.0; -const float t_min = 1.0; -const float t_flat = 0.005; - -void main() { - // Read off the row/col texture coordinates - int i = int(index); - int j = 0; - - // translate to screen x/y - vec2 pos = get_sample(i, b_should_interpolate); - - vec2 prev_pos = get_sample(i - 1, b_should_interpolate); - vec2 next_pos = get_sample(i + 1, b_should_interpolate); - - float prev_len = distance(pos, prev_pos); - float next_len = distance(pos, next_pos); - float avg_len = mix(prev_len, next_len, 0.5); - - float thickness = (t_max - t_min) * t_flat / (t_flat + avg_len) + t_min; - - vec2 delta = vec2(0.0, 0.0); - if (j == 0) { - delta = pos - prev_pos; - } else if (j == 1) { - delta = prev_pos - pos; - } else if (j == 2) { - delta = next_pos - pos; - } else if (j == 3) { - delta = pos - next_pos; - } - - float side = min(resolution.x, resolution.y); - - // pos = pos + thickness / side * normalize(vec2(-delta.y, delta.x)); - - gl_PointSize = 3.0 + 5.0 * thickness / side; - - if (resolution.x < resolution.y) { - pos = pos.yx; - } - gl_Position = vec4(pos / resolution * side, 0.0, 1.0); - - - // // Pass info to fragment shader - // relative_length = avg_len; - // norm_index = float(i) / sample_scale.x; - // vec2 diff = next_pos - prev_pos; - // // angle = ... -} -`;class YX{constructor(e,t){st(this,"samplesX");st(this,"samplesY");st(this,"maxAmplitude",4);st(this,"M",4);if(e.length!=t.length)throw new Error("sample size mismatch");this.samplesX=e,this.samplesY=t}updateTextureData(e){let r,i,s;for(let o=0;o>8,e[r+1]=i&255,e[r+2]=s>>8,e[r+3]=s&255}generateSupportedTextureAndData(){const e=new Uint8Array(this.samplesX.length*this.M);return{tex:new ja(e,this.samplesX.length,1,Fr),textureData:e}}}const ZX=({textureMapper:n,nParticles:e=512,usePoints:t=!0,interpolate:r=!1,color:i=new Fe("green")})=>{const{tex:s,textureData:o}=n.generateSupportedTextureAndData();s.needsUpdate=!0;const a=T.useRef(null),l=Ai(g=>g.size),u=T.useMemo(()=>new Float32Array(e).fill(0).map((g,v)=>v),[e]),f=T.useMemo(()=>new Float32Array(e*3).fill(0),[e]),h=T.useMemo(()=>({color:{value:new F},max_amplitude:{value:n.maxAmplitude},sample_scale:{value:new ge(e,1)},samples:{type:"t",value:s},resolution:{value:new ge(l.width,l.height)},b_should_interpolate:{value:r}}),[e,n,r,l,s]);Hc(()=>{n.updateTextureData(o),s.needsUpdate=!0,a.current.uniforms.max_amplitude.value=n.maxAmplitude,a.current.uniforms.samples.value=s}),T.useEffect(()=>{var g;(g=a.current)!=null&&g.uniforms&&(a.current.uniforms.resolution.value.x=l.width,a.current.uniforms.resolution.value.y=l.height)},[l]),T.useEffect(()=>{var g;(g=a.current)!=null&&g.uniforms&&(a.current.uniforms.b_should_interpolate.value=r,a.current.uniforms.color.value.x=i.r,a.current.uniforms.color.value.y=i.g,a.current.uniforms.color.value.z=i.b)},[r,i]),T.useEffect(()=>{var g;(g=a.current)!=null&&g.uniforms&&(a.current.uniforms.sample_scale.value.x=e,a.current.uniforms.sample_scale.value.y=1)},[e]);const p=C.jsxs(T.Fragment,{children:[C.jsxs("bufferGeometry",{children:[C.jsx("bufferAttribute",{attach:"attributes-position",count:e,array:f,itemSize:3}),C.jsx("bufferAttribute",{attach:"attributes-index",count:e,array:u,itemSize:1})]}),C.jsx("shaderMaterial",{ref:a,depthWrite:!1,fragmentShader:XX,vertexShader:qX,uniforms:h})]});return t?C.jsx("points",{children:p}):C.jsx("line",{children:p})},R3=({textureMapper:n})=>{const e=QM(),{setPalette:t}=ef(),{setColorBackground:r}=yE(),i=Gn.getPalette(e).lerpColor(.5),s=!0;return T.useEffect(()=>{t("rainbow"),r(!1)},[t,r]),C.jsx(ZX,{textureMapper:n,usePoints:s,interpolate:!1,color:i})},$X=Object.freeze(Object.defineProperty({__proto__:null,default:R3},Symbol.toStringTag,{value:"Module"})),KX=()=>{const n=Sy(),e=lN(),t=new YX(n,e);return C.jsx(T.Suspense,{fallback:null,children:C.jsx(R3,{textureMapper:t})})},QX=()=>C.jsxs(A3,{children:[C.jsx(n3,{}),C.jsx(KX,{})]}),P3=2*Math.PI,vh=Math.hypot(.5,.5),I3=Math.hypot(.5,.5,.5),JX=()=>{let n=0,e=0;for(;n===0;)n=Math.random();for(;e===0;)e=Math.random();const t=Math.sqrt(-2*Math.log(n))*Math.cos(P3*e)/10+.5;return t>1||t<0?JX():t},SE=(n,e,t,r=1)=>n==0||n==1?Math.hypot(e-.5,t-.5)/vh:e==0||e==1?Math.hypot(n-.5,n-.5)/vh:t==0||t==1?Math.hypot(n-.5,e-.5)/vh:r,Xf={CARTESIAN_1D:"Cartesian_1D",CARTESIAN_2D:"Cartesian_2D",CARTESIAN_3D:"Cartesian_3D",CARTESIAN_CUBE_FACES:"Cartesian_CubeFaces",POLAR:"Polar"};class wE{constructor(e=1){st(this,"amplitude");this.amplitude=e}map(e,t,r=0,i=0,s=0){switch(e){case Xf.CARTESIAN_1D:return this.map_1D(t,s);case Xf.CARTESIAN_2D:case Xf.POLAR:return this.map_2D(t,r,s);case Xf.CARTESIAN_3D:return this.map_3D(t,r,i,s);case Xf.CARTESIAN_CUBE_FACES:return this.map_3DFaces(t,r,i,s);default:return e}}}class eq extends wE{constructor(t=1,r){super(t);st(this,"data");this.data=r}interpolateValueForNormalizedCoord(t){if(this.data===void 0||!this.data||this.data.length===0)return 0;const r=t*(this.data.length-1),i=this.data[Math.floor(r)],s=this.data[Math.ceil(r)];return i+r%1*(s-i)}map_1D(t,r=0){return this.amplitude*this.interpolateValueForNormalizedCoord(t)}map_2D(t,r,i=0){const s=Math.hypot(t-.5,r-.5)/vh;return this.map_1D(s,i)}map_3D(t,r,i,s=0){const o=Math.hypot(t-.5,r-.5,i-.5)/I3;return this.map_1D(o,s)}map_3DFaces(t,r,i,s=0){const o=SE(t,r,i,1);return this.map_1D(o,s)}}class L3{constructor(e){st(this,"_energyInfo");this._energyInfo=e}getNormalizedValue(){return this._energyInfo.current}}const tq="modulepreload",nq=function(n){return"/r3f-audio-visualizer/"+n},HR={},gs=function(e,t,r){let i=Promise.resolve();if(t&&t.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(t.map(l=>{if(l=nq(l),l in HR)return;HR[l]=!0;const u=l.endsWith(".css"),f=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${f}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":tq,u||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),u)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},rq=(n,e,t)=>{const r=n[e];return r?typeof r=="function"?r():Promise.resolve(r):new Promise((i,s)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(s.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==t?". Note that variables only represent file names one level deep.":""))))})},iq=n=>T.useMemo(()=>T.lazy(async()=>await rq(Object.assign({"../components/visualizers/audioScope/reactive.tsx":()=>gs(()=>Promise.resolve().then(()=>$X),void 0),"../components/visualizers/boxes/reactive.tsx":()=>gs(()=>import("./reactive-UZqlxOwl.js"),__vite__mapDeps([0,1])),"../components/visualizers/cube/reactive.tsx":()=>gs(()=>import("./reactive-BphjmU22.js"),[]),"../components/visualizers/diffusedRing/reactive.tsx":()=>gs(()=>import("./reactive-DShZioEa.js"),__vite__mapDeps([2,3])),"../components/visualizers/dna/reactive.tsx":()=>gs(()=>import("./reactive-CmorMSwY.js"),__vite__mapDeps([4,3])),"../components/visualizers/grid/reactive.tsx":()=>gs(()=>import("./reactive-D3UpTtXe.js"),[]),"../components/visualizers/ribbons/reactive.tsx":()=>gs(()=>import("./reactive-BeOWGcMZ.js"),[]),"../components/visualizers/sphere/reactive.tsx":()=>gs(()=>import("./reactive-BgYCCJBi.js"),[]),"../components/visualizers/stencil/reactive.tsx":()=>gs(()=>import("./reactive-BCKqTRYY.js"),[]),"../components/visualizers/swarm/reactive.tsx":()=>gs(()=>Promise.resolve().then(()=>OZ),void 0),"../components/visualizers/walk/reactive.tsx":()=>gs(()=>import("./reactive-CgD5EBKP.js"),__vite__mapDeps([5,1]))}),`../components/visualizers/${n}/reactive.tsx`,5)),[n]),ME=({visual:n,coordinateMapper:e,scalarTracker:t})=>{const r=iq(n);return C.jsx(T.Suspense,{fallback:null,children:C.jsx(r,{coordinateMapper:e,scalarTracker:t})})},sq=({visual:n})=>{const e=Sy(),t=JM(),{amplitude:r}=pM(),i=new eq(r,e),s=new L3(t);return C.jsx(ME,{visual:n,coordinateMapper:i,scalarTracker:s})},EE=T.createContext(null),oq=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.amplitude)??1),[i,s]=T.useState((n==null?void 0:n.spatialScale)??2),[o,a]=T.useState((n==null?void 0:n.timeScale)??.5),[l,u]=T.useState((n==null?void 0:n.nIterations)??10);return C.jsx(EE.Provider,{value:{config:{amplitude:t,spatialScale:i,timeScale:o,nIterations:l},setters:{setAmplitude:r,setSpatialScale:s,setTimeScale:a,setNIterations:u,reset:()=>{r((n==null?void 0:n.amplitude)??1),s((n==null?void 0:n.spatialScale)??2),a((n==null?void 0:n.timeScale)??.5),u((n==null?void 0:n.nIterations)??10)}}},children:e})};function N3(){const n=T.useContext(EE);if(!n)throw new Error("useNoiseGeneratorContext must be used within a NoiseGeneratorContextProvider");return n.config}function aq(){const n=T.useContext(EE);if(!n)throw new Error("useNoiseGeneratorContext must be used within a NoiseGeneratorContextProvider");return n.setters}const D3=Math.sqrt(3),O3=Math.sqrt(5),lq=.5*(D3-1),qf=(3-D3)/6,cq=1/3,js=1/6,uq=(O3-1)/4,vr=(5-O3)/20,Wo=n=>Math.floor(n)|0,WR=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),tS=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),Kg=new Float64Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]);function dq(n=Math.random){const e=bE(n),t=new Float64Array(e).map(i=>WR[i%12*2]),r=new Float64Array(e).map(i=>WR[i%12*2+1]);return function(s,o){let a=0,l=0,u=0;const f=(s+o)*lq,h=Wo(s+f),p=Wo(o+f),g=(h+p)*qf,v=h-g,_=p-g,x=s-v,m=o-_;let w,S;x>m?(w=1,S=0):(w=0,S=1);const E=x-w+qf,R=m-S+qf,P=x-1+2*qf,L=m-1+2*qf,D=h&255,B=p&255;let A=.5-x*x-m*m;if(A>=0){const Q=D+e[B],V=t[Q],Z=r[Q];A*=A,a=A*A*(V*x+Z*m)}let N=.5-E*E-R*R;if(N>=0){const Q=D+w+e[B+S],V=t[Q],Z=r[Q];N*=N,l=N*N*(V*E+Z*R)}let G=.5-P*P-L*L;if(G>=0){const Q=D+1+e[B+1],V=t[Q],Z=r[Q];G*=G,u=G*G*(V*P+Z*L)}return 70*(a+l+u)}}function k3(n=Math.random){const e=bE(n),t=new Float64Array(e).map(s=>tS[s%12*3]),r=new Float64Array(e).map(s=>tS[s%12*3+1]),i=new Float64Array(e).map(s=>tS[s%12*3+2]);return function(o,a,l){let u,f,h,p;const g=(o+a+l)*cq,v=Wo(o+g),_=Wo(a+g),x=Wo(l+g),m=(v+_+x)*js,w=v-m,S=_-m,E=x-m,R=o-w,P=a-S,L=l-E;let D,B,A,N,G,Q;R>=P?P>=L?(D=1,B=0,A=0,N=1,G=1,Q=0):R>=L?(D=1,B=0,A=0,N=1,G=0,Q=1):(D=0,B=0,A=1,N=1,G=0,Q=1):PKg[o%32*4]),r=new Float64Array(e).map(o=>Kg[o%32*4+1]),i=new Float64Array(e).map(o=>Kg[o%32*4+2]),s=new Float64Array(e).map(o=>Kg[o%32*4+3]);return function(a,l,u,f){let h,p,g,v,_;const x=(a+l+u+f)*uq,m=Wo(a+x),w=Wo(l+x),S=Wo(u+x),E=Wo(f+x),R=(m+w+S+E)*vr,P=m-R,L=w-R,D=S-R,B=E-R,A=a-P,N=l-L,G=u-D,Q=f-B;let V=0,Z=0,$=0,re=0;A>N?V++:Z++,A>G?V++:$++,A>Q?V++:re++,N>G?Z++:$++,N>Q?Z++:re++,G>Q?$++:re++;const k=V>=3?1:0,j=Z>=3?1:0,Y=$>=3?1:0,K=re>=3?1:0,ae=V>=2?1:0,_e=Z>=2?1:0,ne=$>=2?1:0,he=re>=2?1:0,be=V>=1?1:0,me=Z>=1?1:0,Pe=$>=1?1:0,Le=re>=1?1:0,Ae=A-k+vr,Ce=N-j+vr,H=G-Y+vr,xe=Q-K+vr,fe=A-ae+2*vr,Te=N-_e+2*vr,ve=G-ne+2*vr,Xe=Q-he+2*vr,Ue=A-be+3*vr,U=N-me+3*vr,O=G-Pe+3*vr,ie=Q-Le+3*vr,Ee=A-1+4*vr,we=N-1+4*vr,Se=G-1+4*vr,Ze=Q-1+4*vr,Oe=m&255,Ve=w&255,rt=S&255,ht=E&255;let Me=.6-A*A-N*N-G*G-Q*Q;if(Me<0)h=0;else{const q=Oe+e[Ve+e[rt+e[ht]]];Me*=Me,h=Me*Me*(t[q]*A+r[q]*N+i[q]*G+s[q]*Q)}let Ot=.6-Ae*Ae-Ce*Ce-H*H-xe*xe;if(Ot<0)p=0;else{const q=Oe+k+e[Ve+j+e[rt+Y+e[ht+K]]];Ot*=Ot,p=Ot*Ot*(t[q]*Ae+r[q]*Ce+i[q]*H+s[q]*xe)}let _t=.6-fe*fe-Te*Te-ve*ve-Xe*Xe;if(_t<0)g=0;else{const q=Oe+ae+e[Ve+_e+e[rt+ne+e[ht+he]]];_t*=_t,g=_t*_t*(t[q]*fe+r[q]*Te+i[q]*ve+s[q]*Xe)}let dt=.6-Ue*Ue-U*U-O*O-ie*ie;if(dt<0)v=0;else{const q=Oe+be+e[Ve+me+e[rt+Pe+e[ht+Le]]];dt*=dt,v=dt*dt*(t[q]*Ue+r[q]*U+i[q]*O+s[q]*ie)}let Je=.6-Ee*Ee-we*we-Se*Se-Ze*Ze;if(Je<0)_=0;else{const q=Oe+1+e[Ve+1+e[rt+1+e[ht+1]]];Je*=Je,_=Je*Je*(t[q]*Ee+r[q]*we+i[q]*Se+s[q]*Ze)}return 27*(h+p+g+v+_)}}function bE(n){const t=new Uint8Array(512);for(let r=0;r<512/2;r++)t[r]=r;for(let r=0;r<512/2-1;r++){const i=r+~~(n()*(256-r)),s=t[r];t[r]=t[i],t[i]=s}for(let r=256;r<512;r++)t[r]=t[r-256];return t}class hq extends wE{constructor(t=1,r=1,i=1,s=1,o=.5){super(t);st(this,"noise2D");st(this,"noise3D");st(this,"noise4D");st(this,"spatialScale");st(this,"timeScale");st(this,"nIterations");st(this,"persistence");this.spatialScale=r,this.timeScale=i,this.nIterations=s,this.persistence=o,this.noise2D=dq(),this.noise3D=k3(),this.noise4D=fq()}map_1D(t,r=0){let i=0,s=0,o=this.amplitude,a=this.spatialScale;const l=this.timeScale;for(let u=0;u1?i/s:i}map_2D(t,r,i=0){let s=0,o=0,a=this.amplitude,l=this.spatialScale;const u=this.timeScale;for(let f=0;f1?s/o:s}map_3D(t,r,i,s=0){let o=0,a=0,l=this.amplitude,u=this.spatialScale;const f=this.timeScale;for(let h=0;h1?o/a:o}map_3DFaces(t,r,i,s=0){const o=SE(t,r,i,1);return this.map_1D(o,s)}}const pq=({visual:n})=>{const{amplitude:e,spatialScale:t,timeScale:r,nIterations:i}=N3(),s=new hq(e,t,r,i);return C.jsx(ME,{visual:n,coordinateMapper:s})};function l0(){return l0=Object.assign?Object.assign.bind():function(n){for(var e=1;e>>1,ae=k[K];if(0>>1;K<_e;){var ne=2*(K+1)-1,he=k[ne],be=ne+1,me=k[be];if(0>i(he,Y))bei(me,he)?(k[K]=me,k[be]=Y,K=be):(k[K]=he,k[ne]=Y,K=ne);else if(bei(me,Y))k[K]=me,k[be]=Y,K=be;else break e}}return j}function i(k,j){var Y=k.sortIndex-j.sortIndex;return Y!==0?Y:k.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],u=[],f=1,h=null,p=3,g=!1,v=!1,_=!1,x=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(k){for(var j=t(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=k)r(u),j.sortIndex=j.expirationTime,e(l,j);else break;j=t(u)}}function E(k){if(_=!1,S(k),!v)if(t(l)!==null)v=!0,$(R);else{var j=t(u);j!==null&&re(E,j.startTime-k)}}function R(k,j){v=!1,_&&(_=!1,m(D),D=-1),g=!0;var Y=p;try{for(S(j),h=t(l);h!==null&&(!(h.expirationTime>j)||k&&!N());){var K=h.callback;if(typeof K=="function"){h.callback=null,p=h.priorityLevel;var ae=K(h.expirationTime<=j);j=n.unstable_now(),typeof ae=="function"?h.callback=ae:h===t(l)&&r(l),S(j)}else r(l);h=t(l)}if(h!==null)var _e=!0;else{var ne=t(u);ne!==null&&re(E,ne.startTime-j),_e=!1}return _e}finally{h=null,p=Y,g=!1}}var P=!1,L=null,D=-1,B=5,A=-1;function N(){return!(n.unstable_now()-Ak||125K?(k.sortIndex=Y,e(u,k),t(l)===null&&k===t(u)&&(_?(m(D),D=-1):_=!0,re(E,Y-K))):(k.sortIndex=ae,e(l,k),v||g||(v=!0,$(R))),k},n.unstable_shouldYield=N,n.unstable_wrapCallback=function(k){var j=p;return function(){var Y=p;p=j;try{return k.apply(this,arguments)}finally{p=Y}}}})(z3);F3.exports=z3;var mq=F3.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var gq=T,zi=mq;function Re(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),K1=Object.prototype.hasOwnProperty,vq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,GR={},jR={};function yq(n){return K1.call(jR,n)?!0:K1.call(GR,n)?!1:vq.test(n)?jR[n]=!0:(GR[n]=!0,!1)}function xq(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function _q(n,e,t,r){if(e===null||typeof e>"u"||xq(n,e,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function si(n,e,t,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Mr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Mr[n]=new si(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Mr[e]=new si(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Mr[n]=new si(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Mr[n]=new si(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){Mr[n]=new si(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Mr[n]=new si(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Mr[n]=new si(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Mr[n]=new si(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Mr[n]=new si(n,5,!1,n.toLowerCase(),null,!1,!1)});var TE=/[\-:]([a-z])/g;function CE(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(TE,CE);Mr[e]=new si(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(TE,CE);Mr[e]=new si(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(TE,CE);Mr[e]=new si(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Mr[n]=new si(n,1,!1,n.toLowerCase(),null,!1,!1)});Mr.xlinkHref=new si("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Mr[n]=new si(n,1,!1,n.toLowerCase(),null,!0,!0)});function AE(n,e,t,r){var i=Mr.hasOwnProperty(e)?Mr[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{rS=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?oh(n):""}function Sq(n){switch(n.tag){case 5:return oh(n.type);case 16:return oh("Lazy");case 13:return oh("Suspense");case 19:return oh("SuspenseList");case 0:case 2:case 15:return n=iS(n.type,!1),n;case 11:return n=iS(n.type.render,!1),n;case 1:return n=iS(n.type,!0),n;default:return""}}function tw(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case Xu:return"Fragment";case ju:return"Portal";case Q1:return"Profiler";case RE:return"StrictMode";case J1:return"Suspense";case ew:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case H3:return(n.displayName||"Context")+".Consumer";case V3:return(n._context.displayName||"Context")+".Provider";case PE:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case IE:return e=n.displayName||null,e!==null?e:tw(n.type)||"Memo";case Ra:e=n._payload,n=n._init;try{return tw(n(e))}catch{}}return null}function wq(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return tw(e);case 8:return e===RE?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function cl(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function G3(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Mq(n){var e=G3(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Jg(n){n._valueTracker||(n._valueTracker=Mq(n))}function j3(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=G3(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function c0(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function nw(n,e){var t=e.checked;return Nn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function qR(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=cl(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function X3(n,e){e=e.checked,e!=null&&AE(n,"checked",e,!1)}function rw(n,e){X3(n,e);var t=cl(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?iw(n,e.type,t):e.hasOwnProperty("defaultValue")&&iw(n,e.type,cl(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function YR(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function iw(n,e,t){(e!=="number"||c0(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var ah=Array.isArray;function ad(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=ev.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function hp(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var yh={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Eq=["Webkit","ms","Moz","O"];Object.keys(yh).forEach(function(n){Eq.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),yh[e]=yh[n]})});function $3(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||yh.hasOwnProperty(n)&&yh[n]?(""+e).trim():e+"px"}function K3(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=$3(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var bq=Nn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function aw(n,e){if(e){if(bq[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Re(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Re(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Re(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Re(62))}}function lw(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var cw=null;function LE(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var uw=null,ld=null,cd=null;function KR(n){if(n=em(n)){if(typeof uw!="function")throw Error(Re(280));var e=n.stateNode;e&&(e=Cy(e),uw(n.stateNode,n.type,e))}}function Q3(n){ld?cd?cd.push(n):cd=[n]:ld=n}function J3(){if(ld){var n=ld,e=cd;if(cd=ld=null,KR(n),e)for(n=0;n>>=0,n===0?32:31-(kq(n)/Uq|0)|0}var tv=64,nv=4194304;function lh(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function h0(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=lh(a):(s&=o,s!==0&&(r=lh(s)))}else o=t&~i,o!==0?r=lh(o):s!==0&&(r=lh(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function Qp(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Cs(e),n[e]=t}function Vq(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0=_h),o2=" ",a2=!1;function xD(n,e){switch(n){case"keyup":return mY.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _D(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var qu=!1;function vY(n,e){switch(n){case"compositionend":return _D(e);case"keypress":return e.which!==32?null:(a2=!0,o2);case"textInput":return n=e.data,n===o2&&a2?null:n;default:return null}}function yY(n,e){if(qu)return n==="compositionend"||!BE&&xD(n,e)?(n=vD(),Lv=UE=Va=null,qu=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=d2(t)}}function ED(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?ED(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function bD(){for(var n=window,e=c0();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=c0(n.document)}return e}function VE(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function CY(n){var e=bD(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&ED(t.ownerDocument.documentElement,t)){if(r!==null&&VE(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=f2(t,s);var o=f2(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Yu=null,gw=null,wh=null,vw=!1;function h2(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;vw||Yu==null||Yu!==c0(r)||(r=Yu,"selectionStart"in r&&VE(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),wh&&xp(wh,r)||(wh=r,r=g0(gw,"onSelect"),0Ku||(n.current=Mw[Ku],Mw[Ku]=null,Ku--)}function yn(n,e){Ku++,Mw[Ku]=n.current,n.current=e}var ul={},Wr=_l(ul),mi=_l(!1),bc=ul;function Fd(n,e){var t=n.type.contextTypes;if(!t)return ul;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function gi(n){return n=n.childContextTypes,n!=null}function y0(){wn(mi),wn(Wr)}function _2(n,e,t){if(Wr.current!==ul)throw Error(Re(168));yn(Wr,e),yn(mi,t)}function DD(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Re(108,wq(n)||"Unknown",i));return Nn({},t,r)}function x0(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||ul,bc=Wr.current,yn(Wr,n),yn(mi,mi.current),!0}function S2(n,e,t){var r=n.stateNode;if(!r)throw Error(Re(169));t?(n=DD(n,e,bc),r.__reactInternalMemoizedMergedChildContext=n,wn(mi),wn(Wr),yn(Wr,n)):wn(mi),yn(mi,t)}var Uo=null,Ay=!1,yS=!1;function OD(n){Uo===null?Uo=[n]:Uo.push(n)}function zY(n){Ay=!0,OD(n)}function Sl(){if(!yS&&Uo!==null){yS=!0;var n=0,e=cn;try{var t=Uo;for(cn=1;n>=o,i-=o,Go=1<<32-Cs(e)+i|t<D?(B=L,L=null):B=L.sibling;var A=p(m,L,S[D],E);if(A===null){L===null&&(L=B);break}n&&L&&A.alternate===null&&e(m,L),w=s(A,w,D),P===null?R=A:P.sibling=A,P=A,L=B}if(D===S.length)return t(m,L),En&&ql(m,D),R;if(L===null){for(;DD?(B=L,L=null):B=L.sibling;var N=p(m,L,A.value,E);if(N===null){L===null&&(L=B);break}n&&L&&N.alternate===null&&e(m,L),w=s(N,w,D),P===null?R=N:P.sibling=N,P=N,L=B}if(A.done)return t(m,L),En&&ql(m,D),R;if(L===null){for(;!A.done;D++,A=S.next())A=h(m,A.value,E),A!==null&&(w=s(A,w,D),P===null?R=A:P.sibling=A,P=A);return En&&ql(m,D),R}for(L=r(m,L);!A.done;D++,A=S.next())A=g(L,m,D,A.value,E),A!==null&&(n&&A.alternate!==null&&L.delete(A.key===null?D:A.key),w=s(A,w,D),P===null?R=A:P.sibling=A,P=A);return n&&L.forEach(function(G){return e(m,G)}),En&&ql(m,D),R}function x(m,w,S,E){if(typeof S=="object"&&S!==null&&S.type===Xu&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Qg:e:{for(var R=S.key,P=w;P!==null;){if(P.key===R){if(R=S.type,R===Xu){if(P.tag===7){t(m,P.sibling),w=i(P,S.props.children),w.return=m,m=w;break e}}else if(P.elementType===R||typeof R=="object"&&R!==null&&R.$$typeof===Ra&&E2(R)===P.type){t(m,P.sibling),w=i(P,S.props),w.ref=Jf(m,P,S),w.return=m,m=w;break e}t(m,P);break}else e(m,P);P=P.sibling}S.type===Xu?(w=xc(S.props.children,m.mode,E,S.key),w.return=m,m=w):(E=Bv(S.type,S.key,S.props,null,m.mode,E),E.ref=Jf(m,w,S),E.return=m,m=E)}return o(m);case ju:e:{for(P=S.key;w!==null;){if(w.key===P)if(w.tag===4&&w.stateNode.containerInfo===S.containerInfo&&w.stateNode.implementation===S.implementation){t(m,w.sibling),w=i(w,S.children||[]),w.return=m,m=w;break e}else{t(m,w);break}else e(m,w);w=w.sibling}w=TS(S,m.mode,E),w.return=m,m=w}return o(m);case Ra:return P=S._init,x(m,w,P(S._payload),E)}if(ah(S))return v(m,w,S,E);if(Yf(S))return _(m,w,S,E);cv(m,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,w!==null&&w.tag===6?(t(m,w.sibling),w=i(w,S),w.return=m,m=w):(t(m,w),w=bS(S,m.mode,E),w.return=m,m=w),o(m)):t(m,w)}return x}var Bd=zD(!0),BD=zD(!1),w0=_l(null),M0=null,ed=null,jE=null;function XE(){jE=ed=M0=null}function qE(n){var e=w0.current;wn(w0),n._currentValue=e}function Tw(n,e,t){for(;n!==null;){var r=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),n===t)break;n=n.return}}function dd(n,e){M0=n,jE=ed=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(pi=!0),n.firstContext=null)}function ls(n){var e=n._currentValue;if(jE!==n)if(n={context:n,memoizedValue:e,next:null},ed===null){if(M0===null)throw Error(Re(308));ed=n,M0.dependencies={lanes:0,firstContext:n}}else ed=ed.next=n;return e}var rc=null;function YE(n){rc===null?rc=[n]:rc.push(n)}function VD(n,e,t,r){var i=e.interleaved;return i===null?(t.next=t,YE(e)):(t.next=i.next,i.next=t),e.interleaved=t,ea(n,r)}function ea(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Pa=!1;function ZE(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function HD(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function qo(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function $a(n,e,t){var r=n.updateQueue;if(r===null)return null;if(r=r.shared,Jt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ea(n,t)}return i=r.interleaved,i===null?(e.next=e,YE(r)):(e.next=i.next,i.next=e),r.interleaved=e,ea(n,t)}function Dv(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,DE(n,t)}}function b2(n,e){var t=n.updateQueue,r=n.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?i=s=e:s=s.next=e}else i=s=e;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function E0(n,e,t,r){var i=n.updateQueue;Pa=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,u=l.next;l.next=null,o===null?s=u:o.next=u,o=l;var f=n.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==o&&(a===null?f.firstBaseUpdate=u:a.next=u,f.lastBaseUpdate=l))}if(s!==null){var h=i.baseState;o=0,f=u=l=null,a=s;do{var p=a.lane,g=a.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=n,_=a;switch(p=e,g=t,_.tag){case 1:if(v=_.payload,typeof v=="function"){h=v.call(g,h,p);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=_.payload,p=typeof v=="function"?v.call(g,h,p):v,p==null)break e;h=Nn({},h,p);break e;case 2:Pa=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else g={eventTime:g,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(u=f=g,l=h):f=f.next=g,o|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(f===null&&(l=h),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=f,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Ac|=o,n.lanes=o,n.memoizedState=h}}function T2(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var r=_S.transition;_S.transition={};try{n(!1),e()}finally{cn=t,_S.transition=r}}function sO(){return cs().memoizedState}function WY(n,e,t){var r=Qa(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},oO(n))aO(e,t);else if(t=VD(n,e,t,r),t!==null){var i=ti();As(t,n,r,i),lO(t,e,r)}}function GY(n,e,t){var r=Qa(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(oO(n))aO(e,i);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,Ps(a,o)){var l=e.interleaved;l===null?(i.next=i,YE(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=VD(n,e,i,r),t!==null&&(i=ti(),As(t,n,r,i),lO(t,e,r))}}function oO(n){var e=n.alternate;return n===Ln||e!==null&&e===Ln}function aO(n,e){Mh=T0=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function lO(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,DE(n,t)}}var C0={readContext:ls,useCallback:Lr,useContext:Lr,useEffect:Lr,useImperativeHandle:Lr,useInsertionEffect:Lr,useLayoutEffect:Lr,useMemo:Lr,useReducer:Lr,useRef:Lr,useState:Lr,useDebugValue:Lr,useDeferredValue:Lr,useTransition:Lr,useMutableSource:Lr,useSyncExternalStore:Lr,useId:Lr,unstable_isNewReconciler:!1},jY={readContext:ls,useCallback:function(n,e){return qs().memoizedState=[n,e===void 0?null:e],n},useContext:ls,useEffect:A2,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,kv(4194308,4,eO.bind(null,e,n),t)},useLayoutEffect:function(n,e){return kv(4194308,4,n,e)},useInsertionEffect:function(n,e){return kv(4,2,n,e)},useMemo:function(n,e){var t=qs();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=qs();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=WY.bind(null,Ln,n),[r.memoizedState,n]},useRef:function(n){var e=qs();return n={current:n},e.memoizedState=n},useState:C2,useDebugValue:rb,useDeferredValue:function(n){return qs().memoizedState=n},useTransition:function(){var n=C2(!1),e=n[0];return n=HY.bind(null,n[1]),qs().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Ln,i=qs();if(En){if(t===void 0)throw Error(Re(407));t=t()}else{if(t=e(),fr===null)throw Error(Re(349));Cc&30||XD(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,A2(YD.bind(null,r,s,n),[n]),r.flags|=2048,Cp(9,qD.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=qs(),e=fr.identifierPrefix;if(En){var t=jo,r=Go;t=(r&~(1<<32-Cs(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=bp++,0<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[eo]=e,n[wp]=r,yO(n,e,!1,!1),e.stateNode=n;e:{switch(o=lw(t,r),t){case"dialog":Sn("cancel",n),Sn("close",n),i=r;break;case"iframe":case"object":case"embed":Sn("load",n),i=r;break;case"video":case"audio":for(i=0;iWd&&(e.flags|=128,r=!0,eh(s,!1),e.lanes=4194304)}else{if(!r)if(n=b0(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),eh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!En)return Nr(e),null}else 2*Xn()-s.renderingStartTime>Wd&&t!==1073741824&&(e.flags|=128,r=!0,eh(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Xn(),e.sibling=null,t=An.current,yn(An,r?t&1|2:t&1),e):(Nr(e),null);case 22:case 23:return cb(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Ri&1073741824&&(Nr(e),e.subtreeFlags&6&&(e.flags|=8192)):Nr(e),null;case 24:return null;case 25:return null}throw Error(Re(156,e.tag))}function JY(n,e){switch(WE(e),e.tag){case 1:return gi(e.type)&&y0(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Vd(),wn(mi),wn(Wr),QE(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return KE(e),null;case 13:if(wn(An),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Re(340));zd()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return wn(An),null;case 4:return Vd(),null;case 10:return qE(e.type._context),null;case 22:case 23:return cb(),null;case 24:return null;default:return null}}var dv=!1,kr=!1,eZ=typeof WeakSet=="function"?WeakSet:Set,$e=null;function td(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Fn(n,e,r)}else t.current=null}function Ow(n,e,t){try{t()}catch(r){Fn(n,e,r)}}var z2=!1;function tZ(n,e){if(yw=p0,n=bD(),VE(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,u=0,f=0,h=n,p=null;t:for(;;){for(var g;h!==t||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(g=h.firstChild)!==null;)p=h,h=g;for(;;){if(h===n)break t;if(p===t&&++u===i&&(a=o),p===s&&++f===r&&(l=o),(g=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=g}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(xw={focusedElem:n,selectionRange:t},p0=!1,$e=e;$e!==null;)if(e=$e,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,$e=n;else for(;$e!==null;){e=$e;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var _=v.memoizedProps,x=v.memoizedState,m=e.stateNode,w=m.getSnapshotBeforeUpdate(e.elementType===e.type?_:xs(e.type,_),x);m.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Re(163))}}catch(E){Fn(e,e.return,E)}if(n=e.sibling,n!==null){n.return=e.return,$e=n;break}$e=e.return}return v=z2,z2=!1,v}function Eh(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&Ow(e,t,s)}i=i.next}while(i!==r)}}function Iy(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function kw(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function SO(n){var e=n.alternate;e!==null&&(n.alternate=null,SO(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[eo],delete e[wp],delete e[ww],delete e[UY],delete e[FY])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function wO(n){return n.tag===5||n.tag===3||n.tag===4}function B2(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||wO(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Uw(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=v0));else if(r!==4&&(n=n.child,n!==null))for(Uw(n,e,t),n=n.sibling;n!==null;)Uw(n,e,t),n=n.sibling}function Fw(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(Fw(n,e,t),n=n.sibling;n!==null;)Fw(n,e,t),n=n.sibling}var yr=null,Ss=!1;function Ta(n,e,t){for(t=t.child;t!==null;)MO(n,e,t),t=t.sibling}function MO(n,e,t){if(co&&typeof co.onCommitFiberUnmount=="function")try{co.onCommitFiberUnmount(My,t)}catch{}switch(t.tag){case 5:kr||td(t,e);case 6:var r=yr,i=Ss;yr=null,Ta(n,e,t),yr=r,Ss=i,yr!==null&&(Ss?(n=yr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):yr.removeChild(t.stateNode));break;case 18:yr!==null&&(Ss?(n=yr,t=t.stateNode,n.nodeType===8?vS(n.parentNode,t):n.nodeType===1&&vS(n,t),vp(n)):vS(yr,t.stateNode));break;case 4:r=yr,i=Ss,yr=t.stateNode.containerInfo,Ss=!0,Ta(n,e,t),yr=r,Ss=i;break;case 0:case 11:case 14:case 15:if(!kr&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Ow(t,e,o),i=i.next}while(i!==r)}Ta(n,e,t);break;case 1:if(!kr&&(td(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Fn(t,e,a)}Ta(n,e,t);break;case 21:Ta(n,e,t);break;case 22:t.mode&1?(kr=(r=kr)||t.memoizedState!==null,Ta(n,e,t),kr=r):Ta(n,e,t);break;default:Ta(n,e,t)}}function V2(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new eZ),e.forEach(function(r){var i=uZ.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function vs(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Xn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*rZ(r/1960))-r,10n?16:n,Ha===null)var r=!1;else{if(n=Ha,Ha=null,P0=0,Jt&6)throw Error(Re(331));var i=Jt;for(Jt|=4,$e=n.current;$e!==null;){var s=$e,o=s.child;if($e.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lXn()-ab?yc(n,0):ob|=t),vi(n,e)}function IO(n,e){e===0&&(n.mode&1?(e=nv,nv<<=1,!(nv&130023424)&&(nv=4194304)):e=1);var t=ti();n=ea(n,e),n!==null&&(Qp(n,e,t),vi(n,t))}function cZ(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),IO(n,t)}function uZ(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(Re(314))}r!==null&&r.delete(e),IO(n,t)}var LO;LO=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||mi.current)pi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return pi=!1,KY(n,e,t);pi=!!(n.flags&131072)}else pi=!1,En&&e.flags&1048576&&kD(e,S0,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Uv(n,e),n=e.pendingProps;var i=Fd(e,Wr.current);dd(e,t),i=eb(null,e,r,n,i,t);var s=tb();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,gi(r)?(s=!0,x0(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ZE(e),i.updater=Py,e.stateNode=i,i._reactInternals=e,Aw(e,r,n,t),e=Iw(null,e,r,!0,s,t)):(e.tag=0,En&&s&&HE(e),Kr(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(Uv(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=fZ(r),n=xs(r,n),i){case 0:e=Pw(null,e,r,n,t);break e;case 1:e=k2(null,e,r,n,t);break e;case 11:e=D2(null,e,r,n,t);break e;case 14:e=O2(null,e,r,xs(r.type,n),t);break e}throw Error(Re(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:xs(r,i),Pw(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:xs(r,i),k2(n,e,r,i,t);case 3:e:{if(mO(e),n===null)throw Error(Re(387));r=e.pendingProps,s=e.memoizedState,i=s.element,HD(n,e),E0(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Hd(Error(Re(423)),e),e=U2(n,e,r,t,i);break e}else if(r!==i){i=Hd(Error(Re(424)),e),e=U2(n,e,r,t,i);break e}else for(Ni=Za(e.stateNode.containerInfo.firstChild),ki=e,En=!0,Es=null,t=BD(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(zd(),r===i){e=ta(n,e,t);break e}Kr(n,e,r,t)}e=e.child}return e;case 5:return WD(e),n===null&&bw(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,_w(r,i)?o=null:s!==null&&_w(r,s)&&(e.flags|=32),pO(n,e),Kr(n,e,o,t),e.child;case 6:return n===null&&bw(e),null;case 13:return gO(n,e,t);case 4:return $E(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=Bd(e,null,r,t):Kr(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:xs(r,i),D2(n,e,r,i,t);case 7:return Kr(n,e,e.pendingProps,t),e.child;case 8:return Kr(n,e,e.pendingProps.children,t),e.child;case 12:return Kr(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,yn(w0,r._currentValue),r._currentValue=o,s!==null)if(Ps(s.value,o)){if(s.children===i.children&&!mi.current){e=ta(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=qo(-1,t&-t),l.tag=2;var u=s.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?l.next=l:(l.next=f.next,f.next=l),u.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),Tw(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Re(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),Tw(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Kr(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,dd(e,t),i=ls(i),r=r(i),e.flags|=1,Kr(n,e,r,t),e.child;case 14:return r=e.type,i=xs(r,e.pendingProps),i=xs(r.type,i),O2(n,e,r,i,t);case 15:return fO(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:xs(r,i),Uv(n,e),e.tag=1,gi(r)?(n=!0,x0(e)):n=!1,dd(e,t),cO(e,r,i),Aw(e,r,i,t),Iw(null,e,r,!0,n,t);case 19:return vO(n,e,t);case 22:return hO(n,e,t)}throw Error(Re(156,e.tag))};function NO(n,e){return oD(n,e)}function dZ(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ss(n,e,t,r){return new dZ(n,e,t,r)}function db(n){return n=n.prototype,!(!n||!n.isReactComponent)}function fZ(n){if(typeof n=="function")return db(n)?1:0;if(n!=null){if(n=n.$$typeof,n===PE)return 11;if(n===IE)return 14}return 2}function Ja(n,e){var t=n.alternate;return t===null?(t=ss(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function Bv(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")db(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Xu:return xc(t.children,i,s,e);case RE:o=8,i|=8;break;case Q1:return n=ss(12,t,e,i|2),n.elementType=Q1,n.lanes=s,n;case J1:return n=ss(13,t,e,i),n.elementType=J1,n.lanes=s,n;case ew:return n=ss(19,t,e,i),n.elementType=ew,n.lanes=s,n;case W3:return Ny(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case V3:o=10;break e;case H3:o=9;break e;case PE:o=11;break e;case IE:o=14;break e;case Ra:o=16,r=null;break e}throw Error(Re(130,n==null?n:typeof n,""))}return e=ss(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function xc(n,e,t,r){return n=ss(7,n,r,e),n.lanes=t,n}function Ny(n,e,t,r){return n=ss(22,n,r,e),n.elementType=W3,n.lanes=t,n.stateNode={isHidden:!1},n}function bS(n,e,t){return n=ss(6,n,null,e),n.lanes=t,n}function TS(n,e,t){return e=ss(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function hZ(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=oS(0),this.expirationTimes=oS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=oS(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function fb(n,e,t,r,i,s,o,a,l){return n=new hZ(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=ss(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},ZE(s),n}function pZ(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(UO)}catch(n){console.error(n)}}UO(),U3.exports=Bi;var jc=U3.exports;const xZ=kp(jc);var FO,Z2=jc;FO=Z2.createRoot,Z2.hydrateRoot;var _Z=Object.defineProperty,SZ=(n,e,t)=>e in n?_Z(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,St=(n,e,t)=>(SZ(n,typeof e!="symbol"?e+"":e,t),t);const pv=new Oc,$2=new Qs,wZ=Math.cos(70*(Math.PI/180)),K2=(n,e)=>(n%e+e)%e;let MZ=class extends mo{constructor(e,t){super(),St(this,"object"),St(this,"domElement"),St(this,"enabled",!0),St(this,"target",new F),St(this,"minDistance",0),St(this,"maxDistance",1/0),St(this,"minZoom",0),St(this,"maxZoom",1/0),St(this,"minPolarAngle",0),St(this,"maxPolarAngle",Math.PI),St(this,"minAzimuthAngle",-1/0),St(this,"maxAzimuthAngle",1/0),St(this,"enableDamping",!1),St(this,"dampingFactor",.05),St(this,"enableZoom",!0),St(this,"zoomSpeed",1),St(this,"enableRotate",!0),St(this,"rotateSpeed",1),St(this,"enablePan",!0),St(this,"panSpeed",1),St(this,"screenSpacePanning",!0),St(this,"keyPanSpeed",7),St(this,"zoomToCursor",!1),St(this,"autoRotate",!1),St(this,"autoRotateSpeed",2),St(this,"reverseOrbit",!1),St(this,"reverseHorizontalOrbit",!1),St(this,"reverseVerticalOrbit",!1),St(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),St(this,"mouseButtons",{LEFT:Wl.ROTATE,MIDDLE:Wl.DOLLY,RIGHT:Wl.PAN}),St(this,"touches",{ONE:Gl.ROTATE,TWO:Gl.DOLLY_PAN}),St(this,"target0"),St(this,"position0"),St(this,"zoom0"),St(this,"_domElementKeyEvents",null),St(this,"getPolarAngle"),St(this,"getAzimuthalAngle"),St(this,"setPolarAngle"),St(this,"setAzimuthalAngle"),St(this,"getDistance"),St(this,"listenToKeyEvents"),St(this,"stopListenToKeyEvents"),St(this,"saveState"),St(this,"reset"),St(this,"update"),St(this,"connect"),St(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>f.phi,this.getAzimuthalAngle=()=>f.theta,this.setPolarAngle=q=>{let ye=K2(q,2*Math.PI),Be=f.phi;Be<0&&(Be+=2*Math.PI),ye<0&&(ye+=2*Math.PI);let it=Math.abs(ye-Be);2*Math.PI-it{let ye=K2(q,2*Math.PI),Be=f.theta;Be<0&&(Be+=2*Math.PI),ye<0&&(ye+=2*Math.PI);let it=Math.abs(ye-Be);2*Math.PI-itr.object.position.distanceTo(r.target),this.listenToKeyEvents=q=>{q.addEventListener("keydown",Ve),this._domElementKeyEvents=q},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Ve),this._domElementKeyEvents=null},this.saveState=()=>{r.target0.copy(r.target),r.position0.copy(r.object.position),r.zoom0=r.object.zoom},this.reset=()=>{r.target.copy(r.target0),r.object.position.copy(r.position0),r.object.zoom=r.zoom0,r.object.updateProjectionMatrix(),r.dispatchEvent(i),r.update(),l=a.NONE},this.update=(()=>{const q=new F,ye=new F(0,1,0),Be=new Br().setFromUnitVectors(e.up,ye),it=Be.clone().invert(),at=new F,Vt=new Br,X=2*Math.PI;return function(){const Ne=r.object.position;Be.setFromUnitVectors(e.up,ye),it.copy(Be).invert(),q.copy(Ne).sub(r.target),q.applyQuaternion(Be),f.setFromVector3(q),r.autoRotate&&l===a.NONE&&V(G()),r.enableDamping?(f.theta+=h.theta*r.dampingFactor,f.phi+=h.phi*r.dampingFactor):(f.theta+=h.theta,f.phi+=h.phi);let je=r.minAzimuthAngle,et=r.maxAzimuthAngle;isFinite(je)&&isFinite(et)&&(je<-Math.PI?je+=X:je>Math.PI&&(je-=X),et<-Math.PI?et+=X:et>Math.PI&&(et-=X),je<=et?f.theta=Math.max(je,Math.min(et,f.theta)):f.theta=f.theta>(je+et)/2?Math.max(je,f.theta):Math.min(et,f.theta)),f.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,f.phi)),f.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(g,r.dampingFactor):r.target.add(g),r.zoomToCursor&&B||r.object.isOrthographicCamera?f.radius=ae(f.radius):f.radius=ae(f.radius*p),q.setFromSpherical(f),q.applyQuaternion(it),Ne.copy(r.target).add(q),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(h.theta*=1-r.dampingFactor,h.phi*=1-r.dampingFactor,g.multiplyScalar(1-r.dampingFactor)):(h.set(0,0,0),g.set(0,0,0));let Gt=!1;if(r.zoomToCursor&&B){let qt=null;if(r.object instanceof Rn&&r.object.isPerspectiveCamera){const pn=q.length();qt=ae(pn*p);const Yn=pn-qt;r.object.position.addScaledVector(L,Yn),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const pn=new F(D.x,D.y,0);pn.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/p)),r.object.updateProjectionMatrix(),Gt=!0;const Yn=new F(D.x,D.y,0);Yn.unproject(r.object),r.object.position.sub(Yn).add(pn),r.object.updateMatrixWorld(),qt=q.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;qt!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(qt).add(r.object.position):(pv.origin.copy(r.object.position),pv.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(pv.direction))u||8*(1-Vt.dot(r.object.quaternion))>u?(r.dispatchEvent(i),at.copy(r.object.position),Vt.copy(r.object.quaternion),Gt=!1,!0):!1}})(),this.connect=q=>{r.domElement=q,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",Me),r.domElement.addEventListener("pointerdown",ie),r.domElement.addEventListener("pointercancel",we),r.domElement.addEventListener("wheel",Oe)},this.dispose=()=>{var q,ye,Be,it,at,Vt;r.domElement&&(r.domElement.style.touchAction="auto"),(q=r.domElement)==null||q.removeEventListener("contextmenu",Me),(ye=r.domElement)==null||ye.removeEventListener("pointerdown",ie),(Be=r.domElement)==null||Be.removeEventListener("pointercancel",we),(it=r.domElement)==null||it.removeEventListener("wheel",Oe),(at=r.domElement)==null||at.ownerDocument.removeEventListener("pointermove",Ee),(Vt=r.domElement)==null||Vt.ownerDocument.removeEventListener("pointerup",we),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",Ve)};const r=this,i={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const u=1e-6,f=new $v,h=new $v;let p=1;const g=new F,v=new ge,_=new ge,x=new ge,m=new ge,w=new ge,S=new ge,E=new ge,R=new ge,P=new ge,L=new F,D=new ge;let B=!1;const A=[],N={};function G(){return 2*Math.PI/60/60*r.autoRotateSpeed}function Q(){return Math.pow(.95,r.zoomSpeed)}function V(q){r.reverseOrbit||r.reverseHorizontalOrbit?h.theta+=q:h.theta-=q}function Z(q){r.reverseOrbit||r.reverseVerticalOrbit?h.phi+=q:h.phi-=q}const $=(()=>{const q=new F;return function(Be,it){q.setFromMatrixColumn(it,0),q.multiplyScalar(-Be),g.add(q)}})(),re=(()=>{const q=new F;return function(Be,it){r.screenSpacePanning===!0?q.setFromMatrixColumn(it,1):(q.setFromMatrixColumn(it,0),q.crossVectors(r.object.up,q)),q.multiplyScalar(Be),g.add(q)}})(),k=(()=>{const q=new F;return function(Be,it){const at=r.domElement;if(at&&r.object instanceof Rn&&r.object.isPerspectiveCamera){const Vt=r.object.position;q.copy(Vt).sub(r.target);let X=q.length();X*=Math.tan(r.object.fov/2*Math.PI/180),$(2*Be*X/at.clientHeight,r.object.matrix),re(2*it*X/at.clientHeight,r.object.matrix)}else at&&r.object instanceof Vo&&r.object.isOrthographicCamera?($(Be*(r.object.right-r.object.left)/r.object.zoom/at.clientWidth,r.object.matrix),re(it*(r.object.top-r.object.bottom)/r.object.zoom/at.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function j(q){r.object instanceof Rn&&r.object.isPerspectiveCamera||r.object instanceof Vo&&r.object.isOrthographicCamera?p/=q:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function Y(q){r.object instanceof Rn&&r.object.isPerspectiveCamera||r.object instanceof Vo&&r.object.isOrthographicCamera?p*=q:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function K(q){if(!r.zoomToCursor||!r.domElement)return;B=!0;const ye=r.domElement.getBoundingClientRect(),Be=q.clientX-ye.left,it=q.clientY-ye.top,at=ye.width,Vt=ye.height;D.x=Be/at*2-1,D.y=-(it/Vt)*2+1,L.set(D.x,D.y,1).unproject(r.object).sub(r.object.position).normalize()}function ae(q){return Math.max(r.minDistance,Math.min(r.maxDistance,q))}function _e(q){v.set(q.clientX,q.clientY)}function ne(q){K(q),E.set(q.clientX,q.clientY)}function he(q){m.set(q.clientX,q.clientY)}function be(q){_.set(q.clientX,q.clientY),x.subVectors(_,v).multiplyScalar(r.rotateSpeed);const ye=r.domElement;ye&&(V(2*Math.PI*x.x/ye.clientHeight),Z(2*Math.PI*x.y/ye.clientHeight)),v.copy(_),r.update()}function me(q){R.set(q.clientX,q.clientY),P.subVectors(R,E),P.y>0?j(Q()):P.y<0&&Y(Q()),E.copy(R),r.update()}function Pe(q){w.set(q.clientX,q.clientY),S.subVectors(w,m).multiplyScalar(r.panSpeed),k(S.x,S.y),m.copy(w),r.update()}function Le(q){K(q),q.deltaY<0?Y(Q()):q.deltaY>0&&j(Q()),r.update()}function Ae(q){let ye=!1;switch(q.code){case r.keys.UP:k(0,r.keyPanSpeed),ye=!0;break;case r.keys.BOTTOM:k(0,-r.keyPanSpeed),ye=!0;break;case r.keys.LEFT:k(r.keyPanSpeed,0),ye=!0;break;case r.keys.RIGHT:k(-r.keyPanSpeed,0),ye=!0;break}ye&&(q.preventDefault(),r.update())}function Ce(){if(A.length==1)v.set(A[0].pageX,A[0].pageY);else{const q=.5*(A[0].pageX+A[1].pageX),ye=.5*(A[0].pageY+A[1].pageY);v.set(q,ye)}}function H(){if(A.length==1)m.set(A[0].pageX,A[0].pageY);else{const q=.5*(A[0].pageX+A[1].pageX),ye=.5*(A[0].pageY+A[1].pageY);m.set(q,ye)}}function xe(){const q=A[0].pageX-A[1].pageX,ye=A[0].pageY-A[1].pageY,Be=Math.sqrt(q*q+ye*ye);E.set(0,Be)}function fe(){r.enableZoom&&xe(),r.enablePan&&H()}function Te(){r.enableZoom&&xe(),r.enableRotate&&Ce()}function ve(q){if(A.length==1)_.set(q.pageX,q.pageY);else{const Be=Je(q),it=.5*(q.pageX+Be.x),at=.5*(q.pageY+Be.y);_.set(it,at)}x.subVectors(_,v).multiplyScalar(r.rotateSpeed);const ye=r.domElement;ye&&(V(2*Math.PI*x.x/ye.clientHeight),Z(2*Math.PI*x.y/ye.clientHeight)),v.copy(_)}function Xe(q){if(A.length==1)w.set(q.pageX,q.pageY);else{const ye=Je(q),Be=.5*(q.pageX+ye.x),it=.5*(q.pageY+ye.y);w.set(Be,it)}S.subVectors(w,m).multiplyScalar(r.panSpeed),k(S.x,S.y),m.copy(w)}function Ue(q){const ye=Je(q),Be=q.pageX-ye.x,it=q.pageY-ye.y,at=Math.sqrt(Be*Be+it*it);R.set(0,at),P.set(0,Math.pow(R.y/E.y,r.zoomSpeed)),j(P.y),E.copy(R)}function U(q){r.enableZoom&&Ue(q),r.enablePan&&Xe(q)}function O(q){r.enableZoom&&Ue(q),r.enableRotate&&ve(q)}function ie(q){var ye,Be;r.enabled!==!1&&(A.length===0&&((ye=r.domElement)==null||ye.ownerDocument.addEventListener("pointermove",Ee),(Be=r.domElement)==null||Be.ownerDocument.addEventListener("pointerup",we)),Ot(q),q.pointerType==="touch"?rt(q):Se(q))}function Ee(q){r.enabled!==!1&&(q.pointerType==="touch"?ht(q):Ze(q))}function we(q){var ye,Be,it;_t(q),A.length===0&&((ye=r.domElement)==null||ye.releasePointerCapture(q.pointerId),(Be=r.domElement)==null||Be.ownerDocument.removeEventListener("pointermove",Ee),(it=r.domElement)==null||it.ownerDocument.removeEventListener("pointerup",we)),r.dispatchEvent(o),l=a.NONE}function Se(q){let ye;switch(q.button){case 0:ye=r.mouseButtons.LEFT;break;case 1:ye=r.mouseButtons.MIDDLE;break;case 2:ye=r.mouseButtons.RIGHT;break;default:ye=-1}switch(ye){case Wl.DOLLY:if(r.enableZoom===!1)return;ne(q),l=a.DOLLY;break;case Wl.ROTATE:if(q.ctrlKey||q.metaKey||q.shiftKey){if(r.enablePan===!1)return;he(q),l=a.PAN}else{if(r.enableRotate===!1)return;_e(q),l=a.ROTATE}break;case Wl.PAN:if(q.ctrlKey||q.metaKey||q.shiftKey){if(r.enableRotate===!1)return;_e(q),l=a.ROTATE}else{if(r.enablePan===!1)return;he(q),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function Ze(q){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;be(q);break;case a.DOLLY:if(r.enableZoom===!1)return;me(q);break;case a.PAN:if(r.enablePan===!1)return;Pe(q);break}}function Oe(q){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(q.preventDefault(),r.dispatchEvent(s),Le(q),r.dispatchEvent(o))}function Ve(q){r.enabled===!1||r.enablePan===!1||Ae(q)}function rt(q){switch(dt(q),A.length){case 1:switch(r.touches.ONE){case Gl.ROTATE:if(r.enableRotate===!1)return;Ce(),l=a.TOUCH_ROTATE;break;case Gl.PAN:if(r.enablePan===!1)return;H(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case Gl.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;fe(),l=a.TOUCH_DOLLY_PAN;break;case Gl.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Te(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function ht(q){switch(dt(q),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;ve(q),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;Xe(q),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;U(q),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;O(q),r.update();break;default:l=a.NONE}}function Me(q){r.enabled!==!1&&q.preventDefault()}function Ot(q){A.push(q)}function _t(q){delete N[q.pointerId];for(let ye=0;yeparseInt(Fp.replace(/\D+/g,"")),bZ=EZ(),TZ=T.forwardRef(({makeDefault:n,camera:e,regress:t,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...u},f)=>{const h=Ai(P=>P.invalidate),p=Ai(P=>P.camera),g=Ai(P=>P.gl),v=Ai(P=>P.events),_=Ai(P=>P.setEvents),x=Ai(P=>P.set),m=Ai(P=>P.get),w=Ai(P=>P.performance),S=e||p,E=r||v.connected||g.domElement,R=T.useMemo(()=>new MZ(S),[S]);return Hc(()=>{R.enabled&&R.update()},-1),T.useEffect(()=>(s&&R.connect(s===!0?E:s),R.connect(E),()=>void R.dispose()),[s,E,t,R,h]),T.useEffect(()=>{const P=B=>{h(),t&&w.regress(),o&&o(B)},L=B=>{a&&a(B)},D=B=>{l&&l(B)};return R.addEventListener("change",P),R.addEventListener("start",L),R.addEventListener("end",D),()=>{R.removeEventListener("start",L),R.removeEventListener("end",D),R.removeEventListener("change",P)}},[o,a,l,R,h,_]),T.useEffect(()=>{if(n){const P=m().controls;return x({controls:R}),()=>x({controls:P})}},[n,R]),T.createElement("primitive",l0({ref:f,object:R,enableDamping:i},u))});class CZ extends as{constructor(e=new ge){super({uniforms:{inputBuffer:new Dr(null),depthBuffer:new Dr(null),resolution:new Dr(new ge),texelSize:new Dr(new ge),halfTexelSize:new Dr(new ge),kernel:new Dr(0),scale:new Dr(1),cameraNear:new Dr(0),cameraFar:new Dr(1),minDepthThreshold:new Dr(0),maxDepthThreshold:new Dr(1),depthScale:new Dr(0),depthToBlurRatioBias:new Dr(.25)},fragmentShader:`#include - #include - uniform sampler2D inputBuffer; - uniform sampler2D depthBuffer; - uniform float cameraNear; - uniform float cameraFar; - uniform float minDepthThreshold; - uniform float maxDepthThreshold; - uniform float depthScale; - uniform float depthToBlurRatioBias; - varying vec2 vUv; - varying vec2 vUv0; - varying vec2 vUv1; - varying vec2 vUv2; - varying vec2 vUv3; - - void main() { - float depthFactor = 0.0; - - #ifdef USE_DEPTH - vec4 depth = texture2D(depthBuffer, vUv); - depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a)); - depthFactor *= depthScale; - depthFactor = max(0.0, min(1.0, depthFactor + 0.25)); - #endif - - vec4 sum = texture2D(inputBuffer, mix(vUv0, vUv, depthFactor)); - sum += texture2D(inputBuffer, mix(vUv1, vUv, depthFactor)); - sum += texture2D(inputBuffer, mix(vUv2, vUv, depthFactor)); - sum += texture2D(inputBuffer, mix(vUv3, vUv, depthFactor)); - gl_FragColor = sum * 0.25 ; - - #include - #include - #include <${bZ>=154?"colorspace_fragment":"encodings_fragment"}> - }`,vertexShader:`uniform vec2 texelSize; - uniform vec2 halfTexelSize; - uniform float kernel; - uniform float scale; - varying vec2 vUv; - varying vec2 vUv0; - varying vec2 vUv1; - varying vec2 vUv2; - varying vec2 vUv3; - - void main() { - vec2 uv = position.xy * 0.5 + 0.5; - vUv = uv; - - vec2 dUv = (texelSize * vec2(kernel) + halfTexelSize) * scale; - vUv0 = vec2(uv.x - dUv.x, uv.y + dUv.y); - vUv1 = vec2(uv.x + dUv.x, uv.y + dUv.y); - vUv2 = vec2(uv.x + dUv.x, uv.y - dUv.y); - vUv3 = vec2(uv.x - dUv.x, uv.y - dUv.y); - - gl_Position = vec4(position.xy, 1.0, 1.0); - }`,blending:io,depthWrite:!1,depthTest:!1}),this.toneMapped=!1,this.setTexelSize(e.x,e.y),this.kernel=new Float32Array([0,1,2,2,3])}setTexelSize(e,t){this.uniforms.texelSize.value.set(e,t),this.uniforms.halfTexelSize.value.set(e,t).multiplyScalar(.5)}setResolution(e){this.uniforms.resolution.value.copy(e)}}class AZ{constructor({gl:e,resolution:t,width:r=500,height:i=500,minDepthThreshold:s=0,maxDepthThreshold:o=1,depthScale:a=0,depthToBlurRatioBias:l=.25}){this.renderToScreen=!1,this.renderTargetA=new yi(t,t,{minFilter:fn,magFilter:fn,stencilBuffer:!1,depthBuffer:!1,type:rl}),this.renderTargetB=this.renderTargetA.clone(),this.convolutionMaterial=new CZ,this.convolutionMaterial.setTexelSize(1/r,1/i),this.convolutionMaterial.setResolution(new ge(r,i)),this.scene=new Vh,this.camera=new Yd,this.convolutionMaterial.uniforms.minDepthThreshold.value=s,this.convolutionMaterial.uniforms.maxDepthThreshold.value=o,this.convolutionMaterial.uniforms.depthScale.value=a,this.convolutionMaterial.uniforms.depthToBlurRatioBias.value=l,this.convolutionMaterial.defines.USE_DEPTH=a>0;const u=new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),f=new Float32Array([0,0,2,0,0,2]),h=new Dt;h.setAttribute("position",new on(u,3)),h.setAttribute("uv",new on(f,2)),this.screen=new qn(h,this.convolutionMaterial),this.screen.frustumCulled=!1,this.scene.add(this.screen)}render(e,t,r){const i=this.scene,s=this.camera,o=this.renderTargetA,a=this.renderTargetB;let l=this.convolutionMaterial,u=l.uniforms;u.depthBuffer.value=t.depthTexture;const f=l.kernel;let h=t,p,g,v;for(g=0,v=f.length-1;g",`#include - my_vUv = textureMatrix * vec4( position, 1.0 ); - gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );`),e.fragmentShader=` - uniform sampler2D tDiffuse; - uniform sampler2D tDiffuseBlur; - uniform sampler2D tDepth; - uniform sampler2D distortionMap; - uniform float distortion; - uniform float cameraNear; - uniform float cameraFar; - uniform bool hasBlur; - uniform float mixBlur; - uniform float mirror; - uniform float mixStrength; - uniform float minDepthThreshold; - uniform float maxDepthThreshold; - uniform float mixContrast; - uniform float depthScale; - uniform float depthToBlurRatioBias; - varying vec4 my_vUv; - ${e.fragmentShader}`,e.fragmentShader=e.fragmentShader.replace("#include ",`#include - - float distortionFactor = 0.0; - #ifdef USE_DISTORTION - distortionFactor = texture2D(distortionMap, vUv).r * distortion; - #endif - - vec4 new_vUv = my_vUv; - new_vUv.x += distortionFactor; - new_vUv.y += distortionFactor; - - vec4 base = texture2DProj(tDiffuse, new_vUv); - vec4 blur = texture2DProj(tDiffuseBlur, new_vUv); - - vec4 merge = base; - - #ifdef USE_NORMALMAP - vec2 normal_uv = vec2(0.0); - vec4 normalColor = texture2D(normalMap, vUv * normalScale); - vec3 my_normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) ); - vec3 coord = new_vUv.xyz / new_vUv.w; - normal_uv = coord.xy + coord.z * my_normal.xz * 0.05; - vec4 base_normal = texture2D(tDiffuse, normal_uv); - vec4 blur_normal = texture2D(tDiffuseBlur, normal_uv); - merge = base_normal; - blur = blur_normal; - #endif - - float depthFactor = 0.0001; - float blurFactor = 0.0; - - #ifdef USE_DEPTH - vec4 depth = texture2DProj(tDepth, new_vUv); - depthFactor = smoothstep(minDepthThreshold, maxDepthThreshold, 1.0-(depth.r * depth.a)); - depthFactor *= depthScale; - depthFactor = max(0.0001, min(1.0, depthFactor)); - - #ifdef USE_BLUR - blur = blur * min(1.0, depthFactor + depthToBlurRatioBias); - merge = merge * min(1.0, depthFactor + 0.5); - #else - merge = merge * depthFactor; - #endif - - #endif - - float reflectorRoughnessFactor = roughness; - #ifdef USE_ROUGHNESSMAP - vec4 reflectorTexelRoughness = texture2D( roughnessMap, vUv ); - reflectorRoughnessFactor *= reflectorTexelRoughness.g; - #endif - - #ifdef USE_BLUR - blurFactor = min(1.0, mixBlur * reflectorRoughnessFactor); - merge = mix(merge, blur, blurFactor); - #endif - - vec4 newMerge = vec4(0.0, 0.0, 0.0, 1.0); - newMerge.r = (merge.r - 0.5) * mixContrast + 0.5; - newMerge.g = (merge.g - 0.5) * mixContrast + 0.5; - newMerge.b = (merge.b - 0.5) * mixContrast + 0.5; - - diffuseColor.rgb = diffuseColor.rgb * ((1.0 - min(1.0, mirror)) + newMerge.rgb * mixStrength); - `)}get tDiffuse(){return this._tDiffuse.value}set tDiffuse(e){this._tDiffuse.value=e}get tDepth(){return this._tDepth.value}set tDepth(e){this._tDepth.value=e}get distortionMap(){return this._distortionMap.value}set distortionMap(e){this._distortionMap.value=e}get tDiffuseBlur(){return this._tDiffuseBlur.value}set tDiffuseBlur(e){this._tDiffuseBlur.value=e}get textureMatrix(){return this._textureMatrix.value}set textureMatrix(e){this._textureMatrix.value=e}get hasBlur(){return this._hasBlur.value}set hasBlur(e){this._hasBlur.value=e}get mirror(){return this._mirror.value}set mirror(e){this._mirror.value=e}get mixBlur(){return this._mixBlur.value}set mixBlur(e){this._mixBlur.value=e}get mixStrength(){return this._blurStrength.value}set mixStrength(e){this._blurStrength.value=e}get minDepthThreshold(){return this._minDepthThreshold.value}set minDepthThreshold(e){this._minDepthThreshold.value=e}get maxDepthThreshold(){return this._maxDepthThreshold.value}set maxDepthThreshold(e){this._maxDepthThreshold.value=e}get depthScale(){return this._depthScale.value}set depthScale(e){this._depthScale.value=e}get depthToBlurRatioBias(){return this._depthToBlurRatioBias.value}set depthToBlurRatioBias(e){this._depthToBlurRatioBias.value=e}get distortion(){return this._distortion.value}set distortion(e){this._distortion.value=e}get mixContrast(){return this._mixContrast.value}set mixContrast(e){this._mixContrast.value=e}};const PZ=T.forwardRef(({mixBlur:n=0,mixStrength:e=1,resolution:t=256,blur:r=[0,0],minDepthThreshold:i=.9,maxDepthThreshold:s=1,depthScale:o=0,depthToBlurRatioBias:a=.25,mirror:l=0,distortion:u=1,mixContrast:f=1,distortionMap:h,reflectorOffset:p=0,...g},v)=>{c3({MeshReflectorMaterialImpl:RZ});const _=Ai(({gl:K})=>K),x=Ai(({camera:K})=>K),m=Ai(({scene:K})=>K);r=Array.isArray(r)?r:[r,r];const w=r[0]+r[1]>0,S=T.useRef(null);T.useImperativeHandle(v,()=>S.current,[]);const[E]=T.useState(()=>new Qs),[R]=T.useState(()=>new F),[P]=T.useState(()=>new F),[L]=T.useState(()=>new F),[D]=T.useState(()=>new yt),[B]=T.useState(()=>new F(0,0,-1)),[A]=T.useState(()=>new sn),[N]=T.useState(()=>new F),[G]=T.useState(()=>new F),[Q]=T.useState(()=>new sn),[V]=T.useState(()=>new yt),[Z]=T.useState(()=>new Rn),$=T.useCallback(()=>{var K;const ae=S.current.parent||((K=S.current)==null?void 0:K.__r3f.parent);if(!ae||(P.setFromMatrixPosition(ae.matrixWorld),L.setFromMatrixPosition(x.matrixWorld),D.extractRotation(ae.matrixWorld),R.set(0,0,1),R.applyMatrix4(D),P.addScaledVector(R,p),N.subVectors(P,L),N.dot(R)>0))return;N.reflect(R).negate(),N.add(P),D.extractRotation(x.matrixWorld),B.set(0,0,-1),B.applyMatrix4(D),B.add(L),G.subVectors(P,B),G.reflect(R).negate(),G.add(P),Z.position.copy(N),Z.up.set(0,1,0),Z.up.applyMatrix4(D),Z.up.reflect(R),Z.lookAt(G),Z.far=x.far,Z.updateMatrixWorld(),Z.projectionMatrix.copy(x.projectionMatrix),V.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),V.multiply(Z.projectionMatrix),V.multiply(Z.matrixWorldInverse),V.multiply(ae.matrixWorld),E.setFromNormalAndCoplanarPoint(R,P),E.applyMatrix4(Z.matrixWorldInverse),A.set(E.normal.x,E.normal.y,E.normal.z,E.constant);const _e=Z.projectionMatrix;Q.x=(Math.sign(A.x)+_e.elements[8])/_e.elements[0],Q.y=(Math.sign(A.y)+_e.elements[9])/_e.elements[5],Q.z=-1,Q.w=(1+_e.elements[10])/_e.elements[14],A.multiplyScalar(2/A.dot(Q)),_e.elements[2]=A.x,_e.elements[6]=A.y,_e.elements[10]=A.z+1,_e.elements[14]=A.w},[x,p]),[re,k,j,Y]=T.useMemo(()=>{const K={minFilter:fn,magFilter:fn,type:rl},ae=new yi(t,t,K);ae.depthBuffer=!0,ae.depthTexture=new Q0(t,t),ae.depthTexture.format=Xo,ae.depthTexture.type=Bp;const _e=new yi(t,t,K),ne=new AZ({gl:_,resolution:t,width:r[0],height:r[1],minDepthThreshold:i,maxDepthThreshold:s,depthScale:o,depthToBlurRatioBias:a}),he={mirror:l,textureMatrix:V,mixBlur:n,tDiffuse:ae.texture,tDepth:ae.depthTexture,tDiffuseBlur:_e.texture,hasBlur:w,mixStrength:e,minDepthThreshold:i,maxDepthThreshold:s,depthScale:o,depthToBlurRatioBias:a,distortion:u,distortionMap:h,mixContrast:f,"defines-USE_BLUR":w?"":void 0,"defines-USE_DEPTH":o>0?"":void 0,"defines-USE_DISTORTION":h?"":void 0};return[ae,_e,ne,he]},[_,r,V,t,l,w,n,e,i,s,o,a,u,h,f]);return Hc(()=>{var K;const ae=S.current.parent||((K=S.current)==null?void 0:K.__r3f.parent);if(!ae)return;ae.visible=!1;const _e=_.xr.enabled,ne=_.shadowMap.autoUpdate;$(),_.xr.enabled=!1,_.shadowMap.autoUpdate=!1,_.setRenderTarget(re),_.state.buffers.depth.setMask(!0),_.autoClear||_.clear(),_.render(m,Z),w&&j.render(_,re,k),_.xr.enabled=_e,_.shadowMap.autoUpdate=ne,ae.visible=!0,_.setRenderTarget(null)}),T.createElement("meshReflectorMaterialImpl",l0({attach:"material",key:"key"+Y["defines-USE_BLUR"]+Y["defines-USE_DEPTH"]+Y["defines-USE_DISTORTION"],ref:S},Y,g))}),IZ=({size:n=250,...e})=>C.jsxs("mesh",{...e,children:[C.jsx("planeGeometry",{args:[n,n]}),C.jsx(PZ,{mirror:1,blur:[500,100],resolution:1024,mixBlur:12,mixStrength:1.5,roughness:1,depthScale:1.2,minDepthThreshold:.4,maxDepthThreshold:1.4})]}),LZ=T.createContext(null);function NZ(){const n=T.useContext(LZ);if(!n)throw new Error("useSwarmVisualConfigContext must be used within a SwarmVisualConfigContextProvider");return n.config}const DZ=({motionMapper:n,maxPoints:e=1e3,pointSize:t=.2,maxDim:r=2,color:i="white"})=>{const s=Math.max(1,Math.floor(Math.cbrt(e))),o=Math.pow(s,3),a=T.useRef(null),l=T.useMemo(()=>new F,[]),u=T.useMemo(()=>new F,[]);return T.useEffect(()=>{const f=a.current.geometry.attributes.position,h=r/s;let p=0;for(let g=0;g{const p=f.getElapsedTime(),g=a.current.geometry.attributes.position;for(let v=0;v{const{maxDim:e,pointSize:t}=NZ();return C.jsxs(C.Fragment,{children:[C.jsx(DZ,{motionMapper:n,maxDim:e,pointSize:t}),C.jsx(IZ,{position:new F(0,0,-1.5*e)})]})},OZ=Object.freeze(Object.defineProperty({__proto__:null,default:zO},Symbol.toStringTag,{value:"Module"}));class kZ{constructor(e=1,t=.5){st(this,"noise3D");st(this,"spatialScale");st(this,"curlAmount");st(this,"tmpVelocity");this.spatialScale=e,this.curlAmount=t,this.noise3D=k3(),this.tmpVelocity=new F}computeCurl(e,t,r,i){let o,a,l,u;o=this.noise3D(t,r+.001,i),a=this.noise3D(t,r-.001,i),l=(o-a)/(2*.001),o=this.noise3D(t,r,i+.001),a=this.noise3D(t,r,i-.001),u=(o-a)/(2*.001),e.x=l-u,o=this.noise3D(t,r,i+.001),a=this.noise3D(t,r,i-.001),l=(o-a)/(2*.001),o=this.noise3D(t+.001,r,i),a=this.noise3D(t-.001,r,i),u=(o-a)/(2*.001),e.y=l-u,o=this.noise3D(t+.001,r,i),a=this.noise3D(t-.001,r,i),l=(o-a)/(2*.001),o=this.noise3D(t,r+.001,i),a=this.noise3D(t,r-.001,i),u=(o-a)/(2*.001),e.z=l-u,e.normalize()}map(e,t,r,i=new F){return this.computeCurl(this.tmpVelocity,this.spatialScale*e.x,this.spatialScale*e.y,this.spatialScale*e.z),this.tmpVelocity.multiplyScalar(this.curlAmount*t),i.copy(e),i.add(this.tmpVelocity),i}}const UZ=()=>{const t=new kZ(2,.5);return C.jsx(zO,{motionMapper:t})};class FZ extends wE{constructor(t=1,r){super(t);st(this,"periodSec");st(this,"b");this.periodSec=1/r,this.b=P3/this.periodSec}map_1D(t,r=0){return this.amplitude*Math.sin(this.b*t+r)}map_2D(t,r,i=0){const s=Math.hypot(t-.5,r-.5)/vh;return this.amplitude*Math.sin(this.b*s+i)}map_3D(t,r,i,s=0){const o=Math.hypot(t-.5,r-.5,i-.5)/I3;return this.amplitude*Math.sin(this.b*o+s)}map_3DFaces(t,r,i,s=0){const o=SE(t,r,i,1);return this.amplitude*Math.sin(this.b*o+s)}}class zZ{constructor(e,t=1,r=.75){st(this,"mappers");st(this,"amplitude");this.amplitude=t,this.mappers=[];for(let i=0;i=e.length-1?t:r*t;t-=s,this.mappers.push(new FZ(s,e[i]))}}map(e,t,r=0,i=0,s=0){let o=0;for(const a of this.mappers)o+=a.map(e,t,r,i,s);return o}}const BZ=({visual:n})=>{const{maxAmplitude:e,waveformFrequenciesHz:t,amplitudeSplitRatio:r}=JN(),i=new zZ(t,e,r);return C.jsx(ME,{visual:n,coordinateMapper:i})},Fo={AUTO_ORBIT:"AUTO_ORBIT",ORBIT_CONTROLS:"ORBIT_CONTROLS"},gb=T.createContext(null),VZ=({initial:n=void 0,children:e})=>{const[t,r]=T.useState((n==null?void 0:n.mode)??Fo.ORBIT_CONTROLS),[i,s]=T.useState((n==null?void 0:n.autoOrbitAfterSleepMs)??1e4);return C.jsx(gb.Provider,{value:{config:{mode:t,autoOrbitAfterSleepMs:i},setters:{setMode:r,setAutoOrbitAfterSleepMs:s}},children:e})};function BO(){const n=T.useContext(gb);if(!n)throw new Error("useCameraControlsContext must be used within a CameraControlsContextProvider");return n.config}function VO(){const n=T.useContext(gb);if(!n)throw new Error("useCameraControlsContext must be used within a CameraControlsContextProvider");return n.setters}const HZ=(n,e)=>{const t=Math.sin(e.phi)*e.radius;return n.x=t*Math.sin(e.theta),n.z=Math.cos(e.phi)*e.radius,n.y=t*Math.cos(e.theta),n},WZ=()=>{const{visual:n}=Bc();switch(n){case vn.RIBBONS:return{rMin:10,rMax:15,rSpeed:.1,thetaMin:Math.PI/8,thetaMax:2*Math.PI-Math.PI/8,thetaSpeed:.025,phiMin:Math.PI/3,phiMax:Math.PI/2.1,phiSpeed:.25};case vn.SPHERE:return{rMin:10,rMax:15,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/3,phiMax:Math.PI/2,phiSpeed:.25};case vn.CUBE:return{rMin:12,rMax:20,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/4,phiMax:Math.PI/2,phiSpeed:.25};case vn.DIFFUSED_RING:return{rMin:10,rMax:18,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/8,phiMax:Math.PI/2.25,phiSpeed:.25};case vn.WALK:return{rMin:15,rMax:22,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/3.5,phiMax:Math.PI/2.25,phiSpeed:.25};case vn.BOXES:case vn.DNA:case vn.GRID:return{rMin:15,rMax:22,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/3,phiMax:Math.PI/2,phiSpeed:.25};default:return n}},GZ=()=>{const n=Ai(h=>h.camera),{rMin:e,rMax:t,rSpeed:r,thetaMin:i,thetaMax:s,thetaSpeed:o,phiMin:a,phiMax:l,phiSpeed:u}=WZ(),f=new $v;return Hc(({clock:h})=>{const p=h.elapsedTime,g=.5*(1+Math.sin(p*r)),v=e+g*(t-e),_=.5*(1+Math.cos(p*o)),x=i+_*(s-i),m=.5*(1+Math.cos(p*u)),w=a+m*(l-a);HZ(n.position,f.set(v,w,x)),n.lookAt(0,0,0)}),null};class jZ{constructor(e=.5,t=150,r=500){st(this,"clock",new Zp(!0));st(this,"bufferSize",1e3);st(this,"lastEventElapsedMs",0);st(this,"buffer",Array.from({length:this.bufferSize}).map(e=>({value:0,elapsedTimeMs:0})));st(this,"threshold");st(this,"windowSizeMs");st(this,"cooldownMs");st(this,"observationCount",0);this.threshold=e,this.windowSizeMs=t,this.cooldownMs=r}get timeSinceLastEventMs(){return this.clock.elapsedTime*1e3-this.lastEventElapsedMs}getBufferAvg(e){const t=e-this.windowSizeMs,r=e,i=this.buffer.reduce((s,o)=>o.elapsedTimeMsr?s:{sum:s.sum+o.value,count:s.count+1},{sum:0,count:0});return i.count>0?i.sum/i.count:0}step(e){const t=this.clock.getElapsedTime()*1e3,r=this.observationCount%this.bufferSize;return this.buffer[r].value=e,this.buffer[r].elapsedTimeMs=t,this.observationCount++,this.timeSinceLastEventMsthis.threshold?(this.lastEventElapsedMs=t,!0):!1}}const XZ=({scalarTracker:n})=>{const{paletteTrackEnergy:e}=Bc(),t=new jZ(.5,50,500),{nextPalette:r}=ef();return Hc(()=>{e&&t.step(n.getNormalizedValue())&&r()}),C.jsx(C.Fragment,{})},qZ=()=>{const n=JM(),e=new L3(n);return C.jsx(XZ,{scalarTracker:e})},YZ=({mode:n})=>{const{visual:e}=Bc();switch(n){case At.WAVE_FORM:return C.jsx(BZ,{visual:e});case At.NOISE:return C.jsx(pq,{visual:e});case At.PARTICLE_NOISE:return C.jsx(UZ,{});case At.AUDIO:return C.jsx(sq,{visual:e});default:return n}},ZZ=()=>{const{mode:n,autoOrbitAfterSleepMs:e}=BO(),{setMode:t}=VO(),{canvasInteractionEventTracker:r}=v6();switch(Hc(()=>{n===Fo.ORBIT_CONTROLS&&e>0&&r.msSinceLastEvent>e?t(Fo.AUTO_ORBIT):n===Fo.AUTO_ORBIT&&r.msSinceLastEventC.jsxs(A3,{camera:{fov:45,near:1,far:1e3,position:[-17,-6,6.5],up:[0,0,1]},linear:!0,children:[C.jsx(n3,{}),C.jsx("ambientLight",{intensity:Math.PI}),C.jsx(Q7,{}),C.jsx(YZ,{mode:n}),C.jsx(ZZ,{}),C.jsx(qZ,{})]}),N0=T.forwardRef(({className:n,...e},t)=>C.jsx("div",{ref:t,className:jt("grid size-10 flex-none grow cursor-pointer snap-center place-items-center rounded-sm bg-gradient-to-b from-slate-700 to-black text-white shadow-inner duration-300 ease-in-out hover:scale-110 hover:from-slate-500 hover:to-slate-900 aria-selected:from-slate-100 aria-selected:to-slate-500 aria-selected:text-black",n),...e}));N0.displayName="DockItem";const HO=({className:n,children:e,...t})=>C.jsx("div",{className:jt("pointer-events-auto flex h-full w-full snap-x snap-mandatory flex-row items-center justify-start gap-4 overflow-auto rounded-xl bg-gradient-to-t from-white/10 to-white/0 p-4 shadow-inner",n),...t,children:e}),WO=({className:n,children:e,...t})=>C.jsx("div",{className:jt("pointer-events-none h-fit overflow-hidden bg-transparent",n),...t,children:e}),KZ=({visual:n})=>{switch(n){case vn.GRID:return C.jsx(d7,{});case vn.CUBE:return C.jsx(J9,{});case vn.SPHERE:return C.jsx(u7,{});case vn.DIFFUSED_RING:return C.jsx(r7,{});case vn.DNA:return C.jsx(o7,{});case vn.BOXES:return C.jsx(e7,{});case vn.RIBBONS:return C.jsx(p7,{});case vn.WALK:return C.jsx(c7,{});default:return C.jsx(jN,{})}},QZ=({...n})=>{const{visual:e}=Bc(),{setVisual:t}=yE();return C.jsx(WO,{...n,children:C.jsx(HO,{children:KN.map(r=>C.jsx(N0,{"aria-selected":r===e,onClick:()=>t(r),children:C.jsx(KZ,{visual:r})},`dock_item_${r}`))})})};function Mt(n,e,{checkForDefaultPrevented:t=!0}={}){return function(i){if(n==null||n(i),t===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function JZ(n,e){typeof n=="function"?n(e):n!=null&&(n.current=e)}function GO(...n){return e=>n.forEach(t=>JZ(t,e))}function Kt(...n){return T.useCallback(GO(...n),n)}function e$(n,e){const t=T.createContext(e);function r(s){const{children:o,...a}=s,l=T.useMemo(()=>a,Object.values(a));return C.jsx(t.Provider,{value:l,children:o})}function i(s){const o=T.useContext(t);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${n}\``)}return r.displayName=n+"Provider",[r,i]}function sa(n,e=[]){let t=[];function r(s,o){const a=T.createContext(o),l=t.length;t=[...t,o];function u(h){const{scope:p,children:g,...v}=h,_=(p==null?void 0:p[n][l])||a,x=T.useMemo(()=>v,Object.values(v));return C.jsx(_.Provider,{value:x,children:g})}function f(h,p){const g=(p==null?void 0:p[n][l])||a,v=T.useContext(g);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return u.displayName=s+"Provider",[u,f]}const i=()=>{const s=t.map(o=>T.createContext(o));return function(a){const l=(a==null?void 0:a[n])||s;return T.useMemo(()=>({[`__scope${n}`]:{...a,[n]:l}}),[a,l])}};return i.scopeName=n,[r,t$(i,...e)]}function t$(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const r=n.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:u})=>{const h=l(s)[`__scope${u}`];return{...a,...h}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function _r(n){const e=T.useRef(n);return T.useEffect(()=>{e.current=n}),T.useMemo(()=>(...t)=>{var r;return(r=e.current)==null?void 0:r.call(e,...t)},[])}function Pc({prop:n,defaultProp:e,onChange:t=()=>{}}){const[r,i]=n$({defaultProp:e,onChange:t}),s=n!==void 0,o=s?n:r,a=_r(t),l=T.useCallback(u=>{if(s){const h=typeof u=="function"?u(n):u;h!==n&&a(h)}else i(u)},[s,n,i,a]);return[o,l]}function n$({defaultProp:n,onChange:e}){const t=T.useState(n),[r]=t,i=T.useRef(r),s=_r(e);return T.useEffect(()=>{i.current!==r&&(s(r),i.current=r)},[r,i,s]),t}function vb(n){const e=T.useRef({value:n,previous:n});return T.useMemo(()=>(e.current.value!==n&&(e.current.previous=e.current.value,e.current.value=n),e.current.previous),[n])}var Gr=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{};function yb(n){const[e,t]=T.useState(void 0);return Gr(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,u=Array.isArray(l)?l[0]:l;o=u.inlineSize,a=u.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}var Ic=T.forwardRef((n,e)=>{const{children:t,...r}=n,i=T.Children.toArray(t),s=i.find(i$);if(s){const o=s.props.children,a=i.map(l=>l===s?T.Children.count(o)>1?T.Children.only(null):T.isValidElement(o)?o.props.children:null:l);return C.jsx(Ww,{...r,ref:e,children:T.isValidElement(o)?T.cloneElement(o,void 0,a):null})}return C.jsx(Ww,{...r,ref:e,children:t})});Ic.displayName="Slot";var Ww=T.forwardRef((n,e)=>{const{children:t,...r}=n;if(T.isValidElement(t)){const i=o$(t);return T.cloneElement(t,{...s$(r,t.props),ref:e?GO(e,i):i})}return T.Children.count(t)>1?T.Children.only(null):null});Ww.displayName="SlotClone";var r$=({children:n})=>C.jsx(C.Fragment,{children:n});function i$(n){return T.isValidElement(n)&&n.type===r$}function s$(n,e){const t={...e};for(const r in e){const i=n[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?t[r]=(...a)=>{s(...a),i(...a)}:i&&(t[r]=i):r==="style"?t[r]={...i,...s}:r==="className"&&(t[r]=[i,s].filter(Boolean).join(" "))}return{...n,...t}}function o$(n){var r,i;let e=(r=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=(i=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var a$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Rt=a$.reduce((n,e)=>{const t=T.forwardRef((r,i)=>{const{asChild:s,...o}=r,a=s?Ic:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),C.jsx(a,{...o,ref:i})});return t.displayName=`Primitive.${e}`,{...n,[e]:t}},{});function l$(n,e){n&&jc.flushSync(()=>n.dispatchEvent(e))}var xb="Switch",[c$,gte]=sa(xb),[u$,d$]=c$(xb),jO=T.forwardRef((n,e)=>{const{__scopeSwitch:t,name:r,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:u,...f}=n,[h,p]=T.useState(null),g=Kt(e,w=>p(w)),v=T.useRef(!1),_=h?!!h.closest("form"):!0,[x=!1,m]=Pc({prop:i,defaultProp:s,onChange:u});return C.jsxs(u$,{scope:t,checked:x,disabled:a,children:[C.jsx(Rt.button,{type:"button",role:"switch","aria-checked":x,"aria-required":o,"data-state":YO(x),"data-disabled":a?"":void 0,disabled:a,value:l,...f,ref:g,onClick:Mt(n.onClick,w=>{m(S=>!S),_&&(v.current=w.isPropagationStopped(),v.current||w.stopPropagation())})}),_&&C.jsx(f$,{control:h,bubbles:!v.current,name:r,value:l,checked:x,required:o,disabled:a,style:{transform:"translateX(-100%)"}})]})});jO.displayName=xb;var XO="SwitchThumb",qO=T.forwardRef((n,e)=>{const{__scopeSwitch:t,...r}=n,i=d$(XO,t);return C.jsx(Rt.span,{"data-state":YO(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});qO.displayName=XO;var f$=n=>{const{control:e,checked:t,bubbles:r=!0,...i}=n,s=T.useRef(null),o=vb(t),a=yb(e);return T.useEffect(()=>{const l=s.current,u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==t&&h){const p=new Event("click",{bubbles:r});h.call(l,t),l.dispatchEvent(p)}},[o,t,r]),C.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...i,tabIndex:-1,ref:s,style:{...n.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function YO(n){return n?"checked":"unchecked"}var ZO=jO,h$=qO;const el=T.forwardRef(({className:n,...e},t)=>C.jsx(ZO,{className:jt("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",n),...e,ref:t,children:C.jsx(h$,{className:jt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));el.displayName=ZO.displayName;function Rp(n,[e,t]){return Math.min(t,Math.max(e,n))}function _b(n){const e=n+"CollectionProvider",[t,r]=sa(e),[i,s]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:v,children:_}=g,x=Do.useRef(null),m=Do.useRef(new Map).current;return C.jsx(i,{scope:v,itemMap:m,collectionRef:x,children:_})};o.displayName=e;const a=n+"CollectionSlot",l=Do.forwardRef((g,v)=>{const{scope:_,children:x}=g,m=s(a,_),w=Kt(v,m.collectionRef);return C.jsx(Ic,{ref:w,children:x})});l.displayName=a;const u=n+"CollectionItemSlot",f="data-radix-collection-item",h=Do.forwardRef((g,v)=>{const{scope:_,children:x,...m}=g,w=Do.useRef(null),S=Kt(v,w),E=s(u,_);return Do.useEffect(()=>(E.itemMap.set(w,{ref:w,...m}),()=>void E.itemMap.delete(w))),C.jsx(Ic,{[f]:"",ref:S,children:x})});h.displayName=u;function p(g){const v=s(n+"CollectionConsumer",g);return Do.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const m=Array.from(x.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((E,R)=>m.indexOf(E.ref.current)-m.indexOf(R.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:l,ItemSlot:h},p,r]}var p$=T.createContext(void 0);function nm(n){const e=T.useContext(p$);return n||e||"ltr"}function m$(n,e=globalThis==null?void 0:globalThis.document){const t=_r(n);T.useEffect(()=>{const r=i=>{i.key==="Escape"&&t(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[t,e])}var g$="DismissableLayer",Gw="dismissableLayer.update",v$="dismissableLayer.pointerDownOutside",y$="dismissableLayer.focusOutside",Q2,$O=T.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Sb=T.forwardRef((n,e)=>{const{disableOutsidePointerEvents:t=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=n,u=T.useContext($O),[f,h]=T.useState(null),p=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=T.useState({}),v=Kt(e,L=>h(L)),_=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),m=_.indexOf(x),w=f?_.indexOf(f):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,E=w>=m,R=S$(L=>{const D=L.target,B=[...u.branches].some(A=>A.contains(D));!E||B||(i==null||i(L),o==null||o(L),L.defaultPrevented||a==null||a())},p),P=w$(L=>{const D=L.target;[...u.branches].some(A=>A.contains(D))||(s==null||s(L),o==null||o(L),L.defaultPrevented||a==null||a())},p);return m$(L=>{w===u.layers.size-1&&(r==null||r(L),!L.defaultPrevented&&a&&(L.preventDefault(),a()))},p),T.useEffect(()=>{if(f)return t&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Q2=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(f)),u.layers.add(f),J2(),()=>{t&&u.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Q2)}},[f,p,t,u]),T.useEffect(()=>()=>{f&&(u.layers.delete(f),u.layersWithOutsidePointerEventsDisabled.delete(f),J2())},[f,u]),T.useEffect(()=>{const L=()=>g({});return document.addEventListener(Gw,L),()=>document.removeEventListener(Gw,L)},[]),C.jsx(Rt.div,{...l,ref:v,style:{pointerEvents:S?E?"auto":"none":void 0,...n.style},onFocusCapture:Mt(n.onFocusCapture,P.onFocusCapture),onBlurCapture:Mt(n.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Mt(n.onPointerDownCapture,R.onPointerDownCapture)})});Sb.displayName=g$;var x$="DismissableLayerBranch",_$=T.forwardRef((n,e)=>{const t=T.useContext($O),r=T.useRef(null),i=Kt(e,r);return T.useEffect(()=>{const s=r.current;if(s)return t.branches.add(s),()=>{t.branches.delete(s)}},[t.branches]),C.jsx(Rt.div,{...n,ref:i})});_$.displayName=x$;function S$(n,e=globalThis==null?void 0:globalThis.document){const t=_r(n),r=T.useRef(!1),i=T.useRef(()=>{});return T.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let l=function(){KO(v$,t,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",i.current)}},[e,t]),{onPointerDownCapture:()=>r.current=!0}}function w$(n,e=globalThis==null?void 0:globalThis.document){const t=_r(n),r=T.useRef(!1);return T.useEffect(()=>{const i=s=>{s.target&&!r.current&&KO(y$,t,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,t]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function J2(){const n=new CustomEvent(Gw);document.dispatchEvent(n)}function KO(n,e,t,{discrete:r}){const i=t.originalEvent.target,s=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:t});e&&i.addEventListener(n,e,{once:!0}),r?l$(i,s):i.dispatchEvent(s)}var CS=0;function QO(){T.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??eP()),document.body.insertAdjacentElement("beforeend",n[1]??eP()),CS++,()=>{CS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),CS--}},[])}function eP(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",n}var AS="focusScope.autoFocusOnMount",RS="focusScope.autoFocusOnUnmount",tP={bubbles:!1,cancelable:!0},M$="FocusScope",wb=T.forwardRef((n,e)=>{const{loop:t=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=n,[a,l]=T.useState(null),u=_r(i),f=_r(s),h=T.useRef(null),p=Kt(e,_=>l(_)),g=T.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;T.useEffect(()=>{if(r){let _=function(S){if(g.paused||!a)return;const E=S.target;a.contains(E)?h.current=E:Aa(h.current,{select:!0})},x=function(S){if(g.paused||!a)return;const E=S.relatedTarget;E!==null&&(a.contains(E)||Aa(h.current,{select:!0}))},m=function(S){if(document.activeElement===document.body)for(const R of S)R.removedNodes.length>0&&Aa(a)};document.addEventListener("focusin",_),document.addEventListener("focusout",x);const w=new MutationObserver(m);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",x),w.disconnect()}}},[r,a,g.paused]),T.useEffect(()=>{if(a){rP.add(g);const _=document.activeElement;if(!a.contains(_)){const m=new CustomEvent(AS,tP);a.addEventListener(AS,u),a.dispatchEvent(m),m.defaultPrevented||(E$(R$(JO(a)),{select:!0}),document.activeElement===_&&Aa(a))}return()=>{a.removeEventListener(AS,u),setTimeout(()=>{const m=new CustomEvent(RS,tP);a.addEventListener(RS,f),a.dispatchEvent(m),m.defaultPrevented||Aa(_??document.body,{select:!0}),a.removeEventListener(RS,f),rP.remove(g)},0)}}},[a,u,f,g]);const v=T.useCallback(_=>{if(!t&&!r||g.paused)return;const x=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,m=document.activeElement;if(x&&m){const w=_.currentTarget,[S,E]=b$(w);S&&E?!_.shiftKey&&m===E?(_.preventDefault(),t&&Aa(S,{select:!0})):_.shiftKey&&m===S&&(_.preventDefault(),t&&Aa(E,{select:!0})):m===w&&_.preventDefault()}},[t,r,g.paused]);return C.jsx(Rt.div,{tabIndex:-1,...o,ref:p,onKeyDown:v})});wb.displayName=M$;function E$(n,{select:e=!1}={}){const t=document.activeElement;for(const r of n)if(Aa(r,{select:e}),document.activeElement!==t)return}function b$(n){const e=JO(n),t=nP(e,n),r=nP(e.reverse(),n);return[t,r]}function JO(n){const e=[],t=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function nP(n,e){for(const t of n)if(!T$(t,{upTo:e}))return t}function T$(n,{upTo:e}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(e!==void 0&&n===e)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function C$(n){return n instanceof HTMLInputElement&&"select"in n}function Aa(n,{select:e=!1}={}){if(n&&n.focus){const t=document.activeElement;n.focus({preventScroll:!0}),n!==t&&C$(n)&&e&&n.select()}}var rP=A$();function A$(){let n=[];return{add(e){const t=n[0];e!==t&&(t==null||t.pause()),n=iP(n,e),n.unshift(e)},remove(e){var t;n=iP(n,e),(t=n[0])==null||t.resume()}}}function iP(n,e){const t=[...n],r=t.indexOf(e);return r!==-1&&t.splice(r,1),t}function R$(n){return n.filter(e=>e.tagName!=="A")}var P$=Bz.useId||(()=>{}),I$=0;function tl(n){const[e,t]=T.useState(P$());return Gr(()=>{t(r=>r??String(I$++))},[n]),e?`radix-${e}`:""}const L$=["top","right","bottom","left"],dl=Math.min,Pi=Math.max,D0=Math.round,mv=Math.floor,fl=n=>({x:n,y:n}),N$={left:"right",right:"left",bottom:"top",top:"bottom"},D$={start:"end",end:"start"};function jw(n,e,t){return Pi(n,dl(e,t))}function na(n,e){return typeof n=="function"?n(e):n}function ra(n){return n.split("-")[0]}function of(n){return n.split("-")[1]}function Mb(n){return n==="x"?"y":"x"}function Eb(n){return n==="y"?"height":"width"}function hl(n){return["top","bottom"].includes(ra(n))?"y":"x"}function bb(n){return Mb(hl(n))}function O$(n,e,t){t===void 0&&(t=!1);const r=of(n),i=bb(n),s=Eb(i);let o=i==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=O0(o)),[o,O0(o)]}function k$(n){const e=O0(n);return[Xw(n),e,Xw(e)]}function Xw(n){return n.replace(/start|end/g,e=>D$[e])}function U$(n,e,t){const r=["left","right"],i=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?i:r:e?r:i;case"left":case"right":return e?s:o;default:return[]}}function F$(n,e,t,r){const i=of(n);let s=U$(ra(n),t==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(Xw)))),s}function O0(n){return n.replace(/left|right|bottom|top/g,e=>N$[e])}function z$(n){return{top:0,right:0,bottom:0,left:0,...n}}function ek(n){return typeof n!="number"?z$(n):{top:n,right:n,bottom:n,left:n}}function k0(n){const{x:e,y:t,width:r,height:i}=n;return{width:r,height:i,top:t,left:e,right:e+r,bottom:t+i,x:e,y:t}}function sP(n,e,t){let{reference:r,floating:i}=n;const s=hl(e),o=bb(e),a=Eb(o),l=ra(e),u=s==="y",f=r.x+r.width/2-i.width/2,h=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let g;switch(l){case"top":g={x:f,y:r.y-i.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:h};break;case"left":g={x:r.x-i.width,y:h};break;default:g={x:r.x,y:r.y}}switch(of(e)){case"start":g[o]-=p*(t&&u?-1:1);break;case"end":g[o]+=p*(t&&u?-1:1);break}return g}const B$=async(n,e,t)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=t,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:n,floating:e,strategy:i}),{x:f,y:h}=sP(u,r,l),p=r,g={},v=0;for(let _=0;_({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:u,padding:f=0}=na(n,e)||{};if(u==null)return{};const h=ek(f),p={x:t,y:r},g=bb(i),v=Eb(g),_=await o.getDimensions(u),x=g==="y",m=x?"top":"left",w=x?"bottom":"right",S=x?"clientHeight":"clientWidth",E=s.reference[v]+s.reference[g]-p[g]-s.floating[v],R=p[g]-s.reference[g],P=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let L=P?P[S]:0;(!L||!await(o.isElement==null?void 0:o.isElement(P)))&&(L=a.floating[S]||s.floating[v]);const D=E/2-R/2,B=L/2-_[v]/2-1,A=dl(h[m],B),N=dl(h[w],B),G=A,Q=L-_[v]-N,V=L/2-_[v]/2+D,Z=jw(G,V,Q),$=!l.arrow&&of(i)!=null&&V!==Z&&s.reference[v]/2-(VV<=0)){var N,G;const V=(((N=s.flip)==null?void 0:N.index)||0)+1,Z=L[V];if(Z)return{data:{index:V,overflows:A},reset:{placement:Z}};let $=(G=A.filter(re=>re.overflows[0]<=0).sort((re,k)=>re.overflows[1]-k.overflows[1])[0])==null?void 0:G.placement;if(!$)switch(g){case"bestFit":{var Q;const re=(Q=A.filter(k=>{if(P){const j=hl(k.placement);return j===w||j==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(j=>j>0).reduce((j,Y)=>j+Y,0)]).sort((k,j)=>k[1]-j[1])[0])==null?void 0:Q[0];re&&($=re);break}case"initialPlacement":$=a;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function oP(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function aP(n){return L$.some(e=>n[e]>=0)}const W$=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...i}=na(n,e);switch(r){case"referenceHidden":{const s=await Pp(e,{...i,elementContext:"reference"}),o=oP(s,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:aP(o)}}}case"escaped":{const s=await Pp(e,{...i,altBoundary:!0}),o=oP(s,t.floating);return{data:{escapedOffsets:o,escaped:aP(o)}}}default:return{}}}}};async function G$(n,e){const{placement:t,platform:r,elements:i}=n,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ra(t),a=of(t),l=hl(t)==="y",u=["left","top"].includes(o)?-1:1,f=s&&l?-1:1,h=na(e,n);let{mainAxis:p,crossAxis:g,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*f,y:p*u}:{x:p*u,y:g*f}}const j$=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await G$(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},X$=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:x=>{let{x:m,y:w}=x;return{x:m,y:w}}},...l}=na(n,e),u={x:t,y:r},f=await Pp(e,l),h=hl(ra(i)),p=Mb(h);let g=u[p],v=u[h];if(s){const x=p==="y"?"top":"left",m=p==="y"?"bottom":"right",w=g+f[x],S=g-f[m];g=jw(w,g,S)}if(o){const x=h==="y"?"top":"left",m=h==="y"?"bottom":"right",w=v+f[x],S=v-f[m];v=jw(w,v,S)}const _=a.fn({...e,[p]:g,[h]:v});return{..._,data:{x:_.x-t,y:_.y-r,enabled:{[p]:s,[h]:o}}}}}},q$=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:i,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=na(n,e),f={x:t,y:r},h=hl(i),p=Mb(h);let g=f[p],v=f[h];const _=na(a,e),x=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(l){const S=p==="y"?"height":"width",E=s.reference[p]-s.floating[S]+x.mainAxis,R=s.reference[p]+s.reference[S]-x.mainAxis;gR&&(g=R)}if(u){var m,w;const S=p==="y"?"width":"height",E=["top","left"].includes(ra(i)),R=s.reference[h]-s.floating[S]+(E&&((m=o.offset)==null?void 0:m[h])||0)+(E?0:x.crossAxis),P=s.reference[h]+s.reference[S]+(E?0:((w=o.offset)==null?void 0:w[h])||0)-(E?x.crossAxis:0);vP&&(v=P)}return{[p]:g,[h]:v}}}},Y$=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...u}=na(n,e),f=await Pp(e,u),h=ra(i),p=of(i),g=hl(i)==="y",{width:v,height:_}=s.floating;let x,m;h==="top"||h==="bottom"?(x=h,m=p===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(m=h,x=p==="end"?"top":"bottom");const w=_-f.top-f.bottom,S=v-f.left-f.right,E=dl(_-f[x],w),R=dl(v-f[m],S),P=!e.middlewareData.shift;let L=E,D=R;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(D=S),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(L=w),P&&!p){const A=Pi(f.left,0),N=Pi(f.right,0),G=Pi(f.top,0),Q=Pi(f.bottom,0);g?D=v-2*(A!==0||N!==0?A+N:Pi(f.left,f.right)):L=_-2*(G!==0||Q!==0?G+Q:Pi(f.top,f.bottom))}await l({...e,availableWidth:D,availableHeight:L});const B=await o.getDimensions(a.floating);return v!==B.width||_!==B.height?{reset:{rects:!0}}:{}}}};function Fy(){return typeof window<"u"}function af(n){return tk(n)?(n.nodeName||"").toLowerCase():"#document"}function Ui(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function vo(n){var e;return(e=(tk(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function tk(n){return Fy()?n instanceof Node||n instanceof Ui(n).Node:!1}function Is(n){return Fy()?n instanceof Element||n instanceof Ui(n).Element:!1}function po(n){return Fy()?n instanceof HTMLElement||n instanceof Ui(n).HTMLElement:!1}function lP(n){return!Fy()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Ui(n).ShadowRoot}function rm(n){const{overflow:e,overflowX:t,overflowY:r,display:i}=Ls(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(i)}function Z$(n){return["table","td","th"].includes(af(n))}function zy(n){return[":popover-open",":modal"].some(e=>{try{return n.matches(e)}catch{return!1}})}function Tb(n){const e=Cb(),t=Is(n)?Ls(n):n;return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function $$(n){let e=pl(n);for(;po(e)&&!Gd(e);){if(Tb(e))return e;if(zy(e))return null;e=pl(e)}return null}function Cb(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Gd(n){return["html","body","#document"].includes(af(n))}function Ls(n){return Ui(n).getComputedStyle(n)}function By(n){return Is(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function pl(n){if(af(n)==="html")return n;const e=n.assignedSlot||n.parentNode||lP(n)&&n.host||vo(n);return lP(e)?e.host:e}function nk(n){const e=pl(n);return Gd(e)?n.ownerDocument?n.ownerDocument.body:n.body:po(e)&&rm(e)?e:nk(e)}function Ip(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=nk(n),s=i===((r=n.ownerDocument)==null?void 0:r.body),o=Ui(i);if(s){const a=qw(o);return e.concat(o,o.visualViewport||[],rm(i)?i:[],a&&t?Ip(a):[])}return e.concat(i,Ip(i,[],t))}function qw(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function rk(n){const e=Ls(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=po(n),s=i?n.offsetWidth:t,o=i?n.offsetHeight:r,a=D0(t)!==s||D0(r)!==o;return a&&(t=s,r=o),{width:t,height:r,$:a}}function Ab(n){return Is(n)?n:n.contextElement}function hd(n){const e=Ab(n);if(!po(e))return fl(1);const t=e.getBoundingClientRect(),{width:r,height:i,$:s}=rk(e);let o=(s?D0(t.width):t.width)/r,a=(s?D0(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const K$=fl(0);function ik(n){const e=Ui(n);return!Cb()||!e.visualViewport?K$:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Q$(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Ui(n)?!1:e}function Lc(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=n.getBoundingClientRect(),s=Ab(n);let o=fl(1);e&&(r?Is(r)&&(o=hd(r)):o=hd(n));const a=Q$(s,t,r)?ik(s):fl(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,f=i.width/o.x,h=i.height/o.y;if(s){const p=Ui(s),g=r&&Is(r)?Ui(r):r;let v=p,_=qw(v);for(;_&&r&&g!==v;){const x=hd(_),m=_.getBoundingClientRect(),w=Ls(_),S=m.left+(_.clientLeft+parseFloat(w.paddingLeft))*x.x,E=m.top+(_.clientTop+parseFloat(w.paddingTop))*x.y;l*=x.x,u*=x.y,f*=x.x,h*=x.y,l+=S,u+=E,v=Ui(_),_=qw(v)}}return k0({width:f,height:h,x:l,y:u})}function J$(n){let{elements:e,rect:t,offsetParent:r,strategy:i}=n;const s=i==="fixed",o=vo(r),a=e?zy(e.floating):!1;if(r===o||a&&s)return t;let l={scrollLeft:0,scrollTop:0},u=fl(1);const f=fl(0),h=po(r);if((h||!h&&!s)&&((af(r)!=="body"||rm(o))&&(l=By(r)),po(r))){const p=Lc(r);u=hd(r),f.x=p.x+r.clientLeft,f.y=p.y+r.clientTop}return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-l.scrollLeft*u.x+f.x,y:t.y*u.y-l.scrollTop*u.y+f.y}}function eK(n){return Array.from(n.getClientRects())}function Yw(n,e){const t=By(n).scrollLeft;return e?e.left+t:Lc(vo(n)).left+t}function tK(n){const e=vo(n),t=By(n),r=n.ownerDocument.body,i=Pi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Pi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+Yw(n);const a=-t.scrollTop;return Ls(r).direction==="rtl"&&(o+=Pi(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}function nK(n,e){const t=Ui(n),r=vo(n),i=t.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=Cb();(!u||u&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:s,height:o,x:a,y:l}}function rK(n,e){const t=Lc(n,!0,e==="fixed"),r=t.top+n.clientTop,i=t.left+n.clientLeft,s=po(n)?hd(n):fl(1),o=n.clientWidth*s.x,a=n.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:a,x:l,y:u}}function cP(n,e,t){let r;if(e==="viewport")r=nK(n,t);else if(e==="document")r=tK(vo(n));else if(Is(e))r=rK(e,t);else{const i=ik(n);r={...e,x:e.x-i.x,y:e.y-i.y}}return k0(r)}function sk(n,e){const t=pl(n);return t===e||!Is(t)||Gd(t)?!1:Ls(t).position==="fixed"||sk(t,e)}function iK(n,e){const t=e.get(n);if(t)return t;let r=Ip(n,[],!1).filter(a=>Is(a)&&af(a)!=="body"),i=null;const s=Ls(n).position==="fixed";let o=s?pl(n):n;for(;Is(o)&&!Gd(o);){const a=Ls(o),l=Tb(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||rm(o)&&!l&&sk(n,o))?r=r.filter(f=>f!==o):i=a,o=pl(o)}return e.set(n,r),r}function sK(n){let{element:e,boundary:t,rootBoundary:r,strategy:i}=n;const o=[...t==="clippingAncestors"?zy(e)?[]:iK(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((u,f)=>{const h=cP(e,f,i);return u.top=Pi(h.top,u.top),u.right=dl(h.right,u.right),u.bottom=dl(h.bottom,u.bottom),u.left=Pi(h.left,u.left),u},cP(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function oK(n){const{width:e,height:t}=rk(n);return{width:e,height:t}}function aK(n,e,t){const r=po(e),i=vo(e),s=t==="fixed",o=Lc(n,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=fl(0);if(r||!r&&!s)if((af(e)!=="body"||rm(i))&&(a=By(e)),r){const g=Lc(e,!0,s,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else i&&(l.x=Yw(i));let u=0,f=0;if(i&&!r&&!s){const g=i.getBoundingClientRect();f=g.top+a.scrollTop,u=g.left+a.scrollLeft-Yw(i,g)}const h=o.left+a.scrollLeft-l.x-u,p=o.top+a.scrollTop-l.y-f;return{x:h,y:p,width:o.width,height:o.height}}function PS(n){return Ls(n).position==="static"}function uP(n,e){if(!po(n)||Ls(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return vo(n)===t&&(t=t.ownerDocument.body),t}function ok(n,e){const t=Ui(n);if(zy(n))return t;if(!po(n)){let i=pl(n);for(;i&&!Gd(i);){if(Is(i)&&!PS(i))return i;i=pl(i)}return t}let r=uP(n,e);for(;r&&Z$(r)&&PS(r);)r=uP(r,e);return r&&Gd(r)&&PS(r)&&!Tb(r)?t:r||$$(n)||t}const lK=async function(n){const e=this.getOffsetParent||ok,t=this.getDimensions,r=await t(n.floating);return{reference:aK(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function cK(n){return Ls(n).direction==="rtl"}const uK={convertOffsetParentRelativeRectToViewportRelativeRect:J$,getDocumentElement:vo,getClippingRect:sK,getOffsetParent:ok,getElementRects:lK,getClientRects:eK,getDimensions:oK,getScale:hd,isElement:Is,isRTL:cK};function dK(n,e){let t=null,r;const i=vo(n);function s(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:u,top:f,width:h,height:p}=n.getBoundingClientRect();if(a||e(),!h||!p)return;const g=mv(f),v=mv(i.clientWidth-(u+h)),_=mv(i.clientHeight-(f+p)),x=mv(u),w={rootMargin:-g+"px "+-v+"px "+-_+"px "+-x+"px",threshold:Pi(0,dl(1,l))||1};let S=!0;function E(R){const P=R[0].intersectionRatio;if(P!==l){if(!S)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}S=!1}try{t=new IntersectionObserver(E,{...w,root:i.ownerDocument})}catch{t=new IntersectionObserver(E,w)}t.observe(n)}return o(!0),s}function fK(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Ab(n),f=i||s?[...u?Ip(u):[],...Ip(e)]:[];f.forEach(m=>{i&&m.addEventListener("scroll",t,{passive:!0}),s&&m.addEventListener("resize",t)});const h=u&&a?dK(u,t):null;let p=-1,g=null;o&&(g=new ResizeObserver(m=>{let[w]=m;w&&w.target===u&&g&&(g.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(e)})),t()}),u&&!l&&g.observe(u),g.observe(e));let v,_=l?Lc(n):null;l&&x();function x(){const m=Lc(n);_&&(m.x!==_.x||m.y!==_.y||m.width!==_.width||m.height!==_.height)&&t(),_=m,v=requestAnimationFrame(x)}return t(),()=>{var m;f.forEach(w=>{i&&w.removeEventListener("scroll",t),s&&w.removeEventListener("resize",t)}),h==null||h(),(m=g)==null||m.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const hK=j$,pK=X$,mK=H$,gK=Y$,vK=W$,dP=V$,yK=q$,xK=(n,e,t)=>{const r=new Map,i={platform:uK,...t},s={...i.platform,_c:r};return B$(n,e,{...i,platform:s})};var Vv=typeof document<"u"?T.useLayoutEffect:T.useEffect;function U0(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,i;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!U0(n[r],e[r]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=t;r--!==0;){const s=i[r];if(!(s==="_owner"&&n.$$typeof)&&!U0(n[s],e[s]))return!1}return!0}return n!==n&&e!==e}function ak(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function fP(n,e){const t=ak(n);return Math.round(e*t)/t}function IS(n){const e=T.useRef(n);return Vv(()=>{e.current=n}),e}function _K(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:u}=n,[f,h]=T.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[p,g]=T.useState(r);U0(p,r)||g(r);const[v,_]=T.useState(null),[x,m]=T.useState(null),w=T.useCallback(k=>{k!==P.current&&(P.current=k,_(k))},[]),S=T.useCallback(k=>{k!==L.current&&(L.current=k,m(k))},[]),E=s||v,R=o||x,P=T.useRef(null),L=T.useRef(null),D=T.useRef(f),B=l!=null,A=IS(l),N=IS(i),G=IS(u),Q=T.useCallback(()=>{if(!P.current||!L.current)return;const k={placement:e,strategy:t,middleware:p};N.current&&(k.platform=N.current),xK(P.current,L.current,k).then(j=>{const Y={...j,isPositioned:G.current!==!1};V.current&&!U0(D.current,Y)&&(D.current=Y,jc.flushSync(()=>{h(Y)}))})},[p,e,t,N,G]);Vv(()=>{u===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,h(k=>({...k,isPositioned:!1})))},[u]);const V=T.useRef(!1);Vv(()=>(V.current=!0,()=>{V.current=!1}),[]),Vv(()=>{if(E&&(P.current=E),R&&(L.current=R),E&&R){if(A.current)return A.current(E,R,Q);Q()}},[E,R,Q,A,B]);const Z=T.useMemo(()=>({reference:P,floating:L,setReference:w,setFloating:S}),[w,S]),$=T.useMemo(()=>({reference:E,floating:R}),[E,R]),re=T.useMemo(()=>{const k={position:t,left:0,top:0};if(!$.floating)return k;const j=fP($.floating,f.x),Y=fP($.floating,f.y);return a?{...k,transform:"translate("+j+"px, "+Y+"px)",...ak($.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:j,top:Y}},[t,a,$.floating,f.x,f.y]);return T.useMemo(()=>({...f,update:Q,refs:Z,elements:$,floatingStyles:re}),[f,Q,Z,$,re])}const SK=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:i}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?dP({element:r.current,padding:i}).fn(t):{}:r?dP({element:r,padding:i}).fn(t):{}}}},wK=(n,e)=>({...hK(n),options:[n,e]}),MK=(n,e)=>({...pK(n),options:[n,e]}),EK=(n,e)=>({...yK(n),options:[n,e]}),bK=(n,e)=>({...mK(n),options:[n,e]}),TK=(n,e)=>({...gK(n),options:[n,e]}),CK=(n,e)=>({...vK(n),options:[n,e]}),AK=(n,e)=>({...SK(n),options:[n,e]});var RK="Arrow",lk=T.forwardRef((n,e)=>{const{children:t,width:r=10,height:i=5,...s}=n;return C.jsx(Rt.svg,{...s,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:C.jsx("polygon",{points:"0,0 30,0 15,10"})})});lk.displayName=RK;var PK=lk,Rb="Popper",[ck,uk]=sa(Rb),[IK,dk]=ck(Rb),fk=n=>{const{__scopePopper:e,children:t}=n,[r,i]=T.useState(null);return C.jsx(IK,{scope:e,anchor:r,onAnchorChange:i,children:t})};fk.displayName=Rb;var hk="PopperAnchor",pk=T.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...i}=n,s=dk(hk,t),o=T.useRef(null),a=Kt(e,o);return T.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:C.jsx(Rt.div,{...i,ref:a})});pk.displayName=hk;var Pb="PopperContent",[LK,NK]=ck(Pb),mk=T.forwardRef((n,e)=>{var me,Pe,Le,Ae,Ce,H;const{__scopePopper:t,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:f=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:v,..._}=n,x=dk(Pb,t),[m,w]=T.useState(null),S=Kt(e,xe=>w(xe)),[E,R]=T.useState(null),P=yb(E),L=(P==null?void 0:P.width)??0,D=(P==null?void 0:P.height)??0,B=r+(s!=="center"?"-"+s:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},N=Array.isArray(u)?u:[u],G=N.length>0,Q={padding:A,boundary:N.filter(OK),altBoundary:G},{refs:V,floatingStyles:Z,placement:$,isPositioned:re,middlewareData:k}=_K({strategy:"fixed",placement:B,whileElementsMounted:(...xe)=>fK(...xe,{animationFrame:g==="always"}),elements:{reference:x.anchor},middleware:[wK({mainAxis:i+D,alignmentAxis:o}),l&&MK({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?EK():void 0,...Q}),l&&bK({...Q}),TK({...Q,apply:({elements:xe,rects:fe,availableWidth:Te,availableHeight:ve})=>{const{width:Xe,height:Ue}=fe.reference,U=xe.floating.style;U.setProperty("--radix-popper-available-width",`${Te}px`),U.setProperty("--radix-popper-available-height",`${ve}px`),U.setProperty("--radix-popper-anchor-width",`${Xe}px`),U.setProperty("--radix-popper-anchor-height",`${Ue}px`)}}),E&&AK({element:E,padding:a}),kK({arrowWidth:L,arrowHeight:D}),p&&CK({strategy:"referenceHidden",...Q})]}),[j,Y]=yk($),K=_r(v);Gr(()=>{re&&(K==null||K())},[re,K]);const ae=(me=k.arrow)==null?void 0:me.x,_e=(Pe=k.arrow)==null?void 0:Pe.y,ne=((Le=k.arrow)==null?void 0:Le.centerOffset)!==0,[he,be]=T.useState();return Gr(()=>{m&&be(window.getComputedStyle(m).zIndex)},[m]),C.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:re?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(Ae=k.transformOrigin)==null?void 0:Ae.x,(Ce=k.transformOrigin)==null?void 0:Ce.y].join(" "),...((H=k.hide)==null?void 0:H.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:C.jsx(LK,{scope:t,placedSide:j,onArrowChange:R,arrowX:ae,arrowY:_e,shouldHideArrow:ne,children:C.jsx(Rt.div,{"data-side":j,"data-align":Y,..._,ref:S,style:{..._.style,animation:re?void 0:"none"}})})})});mk.displayName=Pb;var gk="PopperArrow",DK={top:"bottom",right:"left",bottom:"top",left:"right"},vk=T.forwardRef(function(e,t){const{__scopePopper:r,...i}=e,s=NK(gk,r),o=DK[s.placedSide];return C.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:C.jsx(PK,{...i,ref:t,style:{...i.style,display:"block"}})})});vk.displayName=gk;function OK(n){return n!==null}var kK=n=>({name:"transformOrigin",options:n,fn(e){var x,m,w;const{placement:t,rects:r,middlewareData:i}=e,o=((x=i.arrow)==null?void 0:x.centerOffset)!==0,a=o?0:n.arrowWidth,l=o?0:n.arrowHeight,[u,f]=yk(t),h={start:"0%",center:"50%",end:"100%"}[f],p=(((m=i.arrow)==null?void 0:m.x)??0)+a/2,g=(((w=i.arrow)==null?void 0:w.y)??0)+l/2;let v="",_="";return u==="bottom"?(v=o?h:`${p}px`,_=`${-l}px`):u==="top"?(v=o?h:`${p}px`,_=`${r.floating.height+l}px`):u==="right"?(v=`${-l}px`,_=o?h:`${g}px`):u==="left"&&(v=`${r.floating.width+l}px`,_=o?h:`${g}px`),{data:{x:v,y:_}}}});function yk(n){const[e,t="center"]=n.split("-");return[e,t]}var UK=fk,FK=pk,zK=mk,BK=vk,VK="Portal",Ib=T.forwardRef((n,e)=>{var a;const{container:t,...r}=n,[i,s]=T.useState(!1);Gr(()=>s(!0),[]);const o=t||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?xZ.createPortal(C.jsx(Rt.div,{...r,ref:e}),o):null});Ib.displayName=VK;var HK="VisuallyHidden",Lb=T.forwardRef((n,e)=>C.jsx(Rt.span,{...n,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...n.style}}));Lb.displayName=HK;var WK=Lb,GK=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},Lu=new WeakMap,gv=new WeakMap,vv={},LS=0,xk=function(n){return n&&(n.host||xk(n.parentNode))},jK=function(n,e){return e.map(function(t){if(n.contains(t))return t;var r=xk(t);return r&&n.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",n,". Doing nothing"),null)}).filter(function(t){return!!t})},XK=function(n,e,t,r){var i=jK(e,Array.isArray(n)?n:[n]);vv[t]||(vv[t]=new WeakMap);var s=vv[t],o=[],a=new Set,l=new Set(i),u=function(h){!h||a.has(h)||(a.add(h),u(h.parentNode))};i.forEach(u);var f=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(p){if(a.has(p))f(p);else try{var g=p.getAttribute(r),v=g!==null&&g!=="false",_=(Lu.get(p)||0)+1,x=(s.get(p)||0)+1;Lu.set(p,_),s.set(p,x),o.push(p),_===1&&v&&gv.set(p,!0),x===1&&p.setAttribute(t,"true"),v||p.setAttribute(r,"true")}catch(m){console.error("aria-hidden: cannot operate on ",p,m)}})};return f(e),a.clear(),LS++,function(){o.forEach(function(h){var p=Lu.get(h)-1,g=s.get(h)-1;Lu.set(h,p),s.set(h,g),p||(gv.has(h)||h.removeAttribute(r),gv.delete(h)),g||h.removeAttribute(t)}),LS--,LS||(Lu=new WeakMap,Lu=new WeakMap,gv=new WeakMap,vv={})}},_k=function(n,e,t){t===void 0&&(t="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),i=GK(n);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),XK(r,i,t,"aria-hidden")):function(){return null}},to=function(){return to=Object.assign||function(e){for(var t,r=1,i=arguments.length;r"u")return cQ;var e=uQ(n),t=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-t+e[2]-e[0])}},fQ=Ek(),pd="data-scroll-locked",hQ=function(n,e,t,r){var i=n.left,s=n.top,o=n.right,a=n.gap;return t===void 0&&(t="margin"),` - .`.concat(YK,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(a,"px ").concat(r,`; - } - body[`).concat(pd,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(r,";"),t==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(s,`px; - padding-right: `).concat(o,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(a,"px ").concat(r,`; - `),t==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(Hv,` { - right: `).concat(a,"px ").concat(r,`; - } - - .`).concat(Wv,` { - margin-right: `).concat(a,"px ").concat(r,`; - } - - .`).concat(Hv," .").concat(Hv,` { - right: 0 `).concat(r,`; - } - - .`).concat(Wv," .").concat(Wv,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(pd,`] { - `).concat(ZK,": ").concat(a,`px; - } -`)},pP=function(){var n=parseInt(document.body.getAttribute(pd)||"0",10);return isFinite(n)?n:0},pQ=function(){T.useEffect(function(){return document.body.setAttribute(pd,(pP()+1).toString()),function(){var n=pP()-1;n<=0?document.body.removeAttribute(pd):document.body.setAttribute(pd,n.toString())}},[])},mQ=function(n){var e=n.noRelative,t=n.noImportant,r=n.gapMode,i=r===void 0?"margin":r;pQ();var s=T.useMemo(function(){return dQ(i)},[i]);return T.createElement(fQ,{styles:hQ(s,!e,i,t?"":"!important")})},Zw=!1;if(typeof window<"u")try{var yv=Object.defineProperty({},"passive",{get:function(){return Zw=!0,!0}});window.addEventListener("test",yv,yv),window.removeEventListener("test",yv,yv)}catch{Zw=!1}var Nu=Zw?{passive:!1}:!1,gQ=function(n){return n.tagName==="TEXTAREA"},bk=function(n,e){var t=window.getComputedStyle(n);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!gQ(n)&&t[e]==="visible")},vQ=function(n){return bk(n,"overflowY")},yQ=function(n){return bk(n,"overflowX")},mP=function(n,e){var t=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=Tk(n,r);if(i){var s=Ck(n,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==t.body);return!1},xQ=function(n){var e=n.scrollTop,t=n.scrollHeight,r=n.clientHeight;return[e,t,r]},_Q=function(n){var e=n.scrollLeft,t=n.scrollWidth,r=n.clientWidth;return[e,t,r]},Tk=function(n,e){return n==="v"?vQ(e):yQ(e)},Ck=function(n,e){return n==="v"?xQ(e):_Q(e)},SQ=function(n,e){return n==="h"&&e==="rtl"?-1:1},wQ=function(n,e,t,r,i){var s=SQ(n,window.getComputedStyle(e).direction),o=s*r,a=t.target,l=e.contains(a),u=!1,f=o>0,h=0,p=0;do{var g=Ck(n,a),v=g[0],_=g[1],x=g[2],m=_-x-s*v;(v||m)&&Tk(n,a)&&(h+=m,p+=v),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(f&&(Math.abs(h)<1||!i)||!f&&(Math.abs(p)<1||!i))&&(u=!0),u},xv=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},gP=function(n){return[n.deltaX,n.deltaY]},vP=function(n){return n&&"current"in n?n.current:n},MQ=function(n,e){return n[0]===e[0]&&n[1]===e[1]},EQ=function(n){return` - .block-interactivity-`.concat(n,` {pointer-events: none;} - .allow-interactivity-`).concat(n,` {pointer-events: all;} -`)},bQ=0,Du=[];function TQ(n){var e=T.useRef([]),t=T.useRef([0,0]),r=T.useRef(),i=T.useState(bQ++)[0],s=T.useState(Ek)[0],o=T.useRef(n);T.useEffect(function(){o.current=n},[n]),T.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(i));var _=qK([n.lockRef.current],(n.shards||[]).map(vP),!0).filter(Boolean);return _.forEach(function(x){return x.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),_.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(i))})}}},[n.inert,n.lockRef.current,n.shards]);var a=T.useCallback(function(_,x){if("touches"in _&&_.touches.length===2)return!o.current.allowPinchZoom;var m=xv(_),w=t.current,S="deltaX"in _?_.deltaX:w[0]-m[0],E="deltaY"in _?_.deltaY:w[1]-m[1],R,P=_.target,L=Math.abs(S)>Math.abs(E)?"h":"v";if("touches"in _&&L==="h"&&P.type==="range")return!1;var D=mP(L,P);if(!D)return!0;if(D?R=L:(R=L==="v"?"h":"v",D=mP(L,P)),!D)return!1;if(!r.current&&"changedTouches"in _&&(S||E)&&(r.current=R),!R)return!0;var B=r.current||R;return wQ(B,x,_,B==="h"?S:E,!0)},[]),l=T.useCallback(function(_){var x=_;if(!(!Du.length||Du[Du.length-1]!==s)){var m="deltaY"in x?gP(x):xv(x),w=e.current.filter(function(R){return R.name===x.type&&(R.target===x.target||x.target===R.shadowParent)&&MQ(R.delta,m)})[0];if(w&&w.should){x.cancelable&&x.preventDefault();return}if(!w){var S=(o.current.shards||[]).map(vP).filter(Boolean).filter(function(R){return R.contains(x.target)}),E=S.length>0?a(x,S[0]):!o.current.noIsolation;E&&x.cancelable&&x.preventDefault()}}},[]),u=T.useCallback(function(_,x,m,w){var S={name:_,delta:x,target:m,should:w,shadowParent:CQ(m)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(E){return E!==S})},1)},[]),f=T.useCallback(function(_){t.current=xv(_),r.current=void 0},[]),h=T.useCallback(function(_){u(_.type,gP(_),_.target,a(_,n.lockRef.current))},[]),p=T.useCallback(function(_){u(_.type,xv(_),_.target,a(_,n.lockRef.current))},[]);T.useEffect(function(){return Du.push(s),n.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",l,Nu),document.addEventListener("touchmove",l,Nu),document.addEventListener("touchstart",f,Nu),function(){Du=Du.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,Nu),document.removeEventListener("touchmove",l,Nu),document.removeEventListener("touchstart",f,Nu)}},[]);var g=n.removeScrollBar,v=n.inert;return T.createElement(T.Fragment,null,v?T.createElement(s,{styles:EQ(i)}):null,g?T.createElement(mQ,{gapMode:n.gapMode}):null)}function CQ(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const AQ=nQ(Mk,TQ);var Nb=T.forwardRef(function(n,e){return T.createElement(Vy,to({},n,{ref:e,sideCar:AQ}))});Nb.classNames=Vy.classNames;var RQ=[" ","Enter","ArrowUp","ArrowDown"],PQ=[" ","Enter"],im="Select",[Hy,Wy,IQ]=_b(im),[lf,vte]=sa(im,[IQ,uk]),Gy=uk(),[LQ,wl]=lf(im),[NQ,DQ]=lf(im),Ak=n=>{const{__scopeSelect:e,children:t,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:u,name:f,autoComplete:h,disabled:p,required:g}=n,v=Gy(e),[_,x]=T.useState(null),[m,w]=T.useState(null),[S,E]=T.useState(!1),R=nm(u),[P=!1,L]=Pc({prop:r,defaultProp:i,onChange:s}),[D,B]=Pc({prop:o,defaultProp:a,onChange:l}),A=T.useRef(null),N=_?!!_.closest("form"):!0,[G,Q]=T.useState(new Set),V=Array.from(G).map(Z=>Z.props.value).join(";");return C.jsx(UK,{...v,children:C.jsxs(LQ,{required:g,scope:e,trigger:_,onTriggerChange:x,valueNode:m,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:tl(),value:D,onValueChange:B,open:P,onOpenChange:L,dir:R,triggerPointerDownPosRef:A,disabled:p,children:[C.jsx(Hy.Provider,{scope:e,children:C.jsx(NQ,{scope:n.__scopeSelect,onNativeOptionAdd:T.useCallback(Z=>{Q($=>new Set($).add(Z))},[]),onNativeOptionRemove:T.useCallback(Z=>{Q($=>{const re=new Set($);return re.delete(Z),re})},[]),children:t})}),N?C.jsxs(Kk,{"aria-hidden":!0,required:g,tabIndex:-1,name:f,autoComplete:h,value:D,onChange:Z=>B(Z.target.value),disabled:p,children:[D===void 0?C.jsx("option",{value:""}):null,Array.from(G)]},V):null]})})};Ak.displayName=im;var Rk="SelectTrigger",Pk=T.forwardRef((n,e)=>{const{__scopeSelect:t,disabled:r=!1,...i}=n,s=Gy(t),o=wl(Rk,t),a=o.disabled||r,l=Kt(e,o.onTriggerChange),u=Wy(t),[f,h,p]=Qk(v=>{const _=u().filter(w=>!w.disabled),x=_.find(w=>w.value===o.value),m=Jk(_,v,x);m!==void 0&&o.onValueChange(m.value)}),g=()=>{a||(o.onOpenChange(!0),p())};return C.jsx(FK,{asChild:!0,...s,children:C.jsx(Rt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":$k(o.value)?"":void 0,...i,ref:l,onClick:Mt(i.onClick,v=>{v.currentTarget.focus()}),onPointerDown:Mt(i.onPointerDown,v=>{const _=v.target;_.hasPointerCapture(v.pointerId)&&_.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&(g(),o.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)},v.preventDefault())}),onKeyDown:Mt(i.onKeyDown,v=>{const _=f.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(_&&v.key===" ")&&RQ.includes(v.key)&&(g(),v.preventDefault())})})})});Pk.displayName=Rk;var Ik="SelectValue",Lk=T.forwardRef((n,e)=>{const{__scopeSelect:t,className:r,style:i,children:s,placeholder:o="",...a}=n,l=wl(Ik,t),{onValueNodeHasChildrenChange:u}=l,f=s!==void 0,h=Kt(e,l.onValueNodeChange);return Gr(()=>{u(f)},[u,f]),C.jsx(Rt.span,{...a,ref:h,style:{pointerEvents:"none"},children:$k(l.value)?C.jsx(C.Fragment,{children:o}):s})});Lk.displayName=Ik;var OQ="SelectIcon",Nk=T.forwardRef((n,e)=>{const{__scopeSelect:t,children:r,...i}=n;return C.jsx(Rt.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});Nk.displayName=OQ;var kQ="SelectPortal",Dk=n=>C.jsx(Ib,{asChild:!0,...n});Dk.displayName=kQ;var Nc="SelectContent",Ok=T.forwardRef((n,e)=>{const t=wl(Nc,n.__scopeSelect),[r,i]=T.useState();if(Gr(()=>{i(new DocumentFragment)},[]),!t.open){const s=r;return s?jc.createPortal(C.jsx(kk,{scope:n.__scopeSelect,children:C.jsx(Hy.Slot,{scope:n.__scopeSelect,children:C.jsx("div",{children:n.children})})}),s):null}return C.jsx(Uk,{...n,ref:e})});Ok.displayName=Nc;var ko=10,[kk,Ml]=lf(Nc),UQ="SelectContentImpl",Uk=T.forwardRef((n,e)=>{const{__scopeSelect:t,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:u,alignOffset:f,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:_,avoidCollisions:x,...m}=n,w=wl(Nc,t),[S,E]=T.useState(null),[R,P]=T.useState(null),L=Kt(e,me=>E(me)),[D,B]=T.useState(null),[A,N]=T.useState(null),G=Wy(t),[Q,V]=T.useState(!1),Z=T.useRef(!1);T.useEffect(()=>{if(S)return _k(S)},[S]),QO();const $=T.useCallback(me=>{const[Pe,...Le]=G().map(H=>H.ref.current),[Ae]=Le.slice(-1),Ce=document.activeElement;for(const H of me)if(H===Ce||(H==null||H.scrollIntoView({block:"nearest"}),H===Pe&&R&&(R.scrollTop=0),H===Ae&&R&&(R.scrollTop=R.scrollHeight),H==null||H.focus(),document.activeElement!==Ce))return},[G,R]),re=T.useCallback(()=>$([D,S]),[$,D,S]);T.useEffect(()=>{Q&&re()},[Q,re]);const{onOpenChange:k,triggerPointerDownPosRef:j}=w;T.useEffect(()=>{if(S){let me={x:0,y:0};const Pe=Ae=>{var Ce,H;me={x:Math.abs(Math.round(Ae.pageX)-(((Ce=j.current)==null?void 0:Ce.x)??0)),y:Math.abs(Math.round(Ae.pageY)-(((H=j.current)==null?void 0:H.y)??0))}},Le=Ae=>{me.x<=10&&me.y<=10?Ae.preventDefault():S.contains(Ae.target)||k(!1),document.removeEventListener("pointermove",Pe),j.current=null};return j.current!==null&&(document.addEventListener("pointermove",Pe),document.addEventListener("pointerup",Le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Pe),document.removeEventListener("pointerup",Le,{capture:!0})}}},[S,k,j]),T.useEffect(()=>{const me=()=>k(!1);return window.addEventListener("blur",me),window.addEventListener("resize",me),()=>{window.removeEventListener("blur",me),window.removeEventListener("resize",me)}},[k]);const[Y,K]=Qk(me=>{const Pe=G().filter(Ce=>!Ce.disabled),Le=Pe.find(Ce=>Ce.ref.current===document.activeElement),Ae=Jk(Pe,me,Le);Ae&&setTimeout(()=>Ae.ref.current.focus())}),ae=T.useCallback((me,Pe,Le)=>{const Ae=!Z.current&&!Le;(w.value!==void 0&&w.value===Pe||Ae)&&(B(me),Ae&&(Z.current=!0))},[w.value]),_e=T.useCallback(()=>S==null?void 0:S.focus(),[S]),ne=T.useCallback((me,Pe,Le)=>{const Ae=!Z.current&&!Le;(w.value!==void 0&&w.value===Pe||Ae)&&N(me)},[w.value]),he=r==="popper"?$w:Fk,be=he===$w?{side:a,sideOffset:l,align:u,alignOffset:f,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:_,avoidCollisions:x}:{};return C.jsx(kk,{scope:t,content:S,viewport:R,onViewportChange:P,itemRefCallback:ae,selectedItem:D,onItemLeave:_e,itemTextRefCallback:ne,focusSelectedItem:re,selectedItemText:A,position:r,isPositioned:Q,searchRef:Y,children:C.jsx(Nb,{as:Ic,allowPinchZoom:!0,children:C.jsx(wb,{asChild:!0,trapped:w.open,onMountAutoFocus:me=>{me.preventDefault()},onUnmountAutoFocus:Mt(i,me=>{var Pe;(Pe=w.trigger)==null||Pe.focus({preventScroll:!0}),me.preventDefault()}),children:C.jsx(Sb,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:me=>me.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:C.jsx(he,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:me=>me.preventDefault(),...m,...be,onPlaced:()=>V(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:Mt(m.onKeyDown,me=>{const Pe=me.ctrlKey||me.altKey||me.metaKey;if(me.key==="Tab"&&me.preventDefault(),!Pe&&me.key.length===1&&K(me.key),["ArrowUp","ArrowDown","Home","End"].includes(me.key)){let Ae=G().filter(Ce=>!Ce.disabled).map(Ce=>Ce.ref.current);if(["ArrowUp","End"].includes(me.key)&&(Ae=Ae.slice().reverse()),["ArrowUp","ArrowDown"].includes(me.key)){const Ce=me.target,H=Ae.indexOf(Ce);Ae=Ae.slice(H+1)}setTimeout(()=>$(Ae)),me.preventDefault()}})})})})})})});Uk.displayName=UQ;var FQ="SelectItemAlignedPosition",Fk=T.forwardRef((n,e)=>{const{__scopeSelect:t,onPlaced:r,...i}=n,s=wl(Nc,t),o=Ml(Nc,t),[a,l]=T.useState(null),[u,f]=T.useState(null),h=Kt(e,L=>f(L)),p=Wy(t),g=T.useRef(!1),v=T.useRef(!0),{viewport:_,selectedItem:x,selectedItemText:m,focusSelectedItem:w}=o,S=T.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&u&&_&&x&&m){const L=s.trigger.getBoundingClientRect(),D=u.getBoundingClientRect(),B=s.valueNode.getBoundingClientRect(),A=m.getBoundingClientRect();if(s.dir!=="rtl"){const Ce=A.left-D.left,H=B.left-Ce,xe=L.left-H,fe=L.width+xe,Te=Math.max(fe,D.width),ve=window.innerWidth-ko,Xe=Rp(H,[ko,ve-Te]);a.style.minWidth=fe+"px",a.style.left=Xe+"px"}else{const Ce=D.right-A.right,H=window.innerWidth-B.right-Ce,xe=window.innerWidth-L.right-H,fe=L.width+xe,Te=Math.max(fe,D.width),ve=window.innerWidth-ko,Xe=Rp(H,[ko,ve-Te]);a.style.minWidth=fe+"px",a.style.right=Xe+"px"}const N=p(),G=window.innerHeight-ko*2,Q=_.scrollHeight,V=window.getComputedStyle(u),Z=parseInt(V.borderTopWidth,10),$=parseInt(V.paddingTop,10),re=parseInt(V.borderBottomWidth,10),k=parseInt(V.paddingBottom,10),j=Z+$+Q+k+re,Y=Math.min(x.offsetHeight*5,j),K=window.getComputedStyle(_),ae=parseInt(K.paddingTop,10),_e=parseInt(K.paddingBottom,10),ne=L.top+L.height/2-ko,he=G-ne,be=x.offsetHeight/2,me=x.offsetTop+be,Pe=Z+$+me,Le=j-Pe;if(Pe<=ne){const Ce=x===N[N.length-1].ref.current;a.style.bottom="0px";const H=u.clientHeight-_.offsetTop-_.offsetHeight,xe=Math.max(he,be+(Ce?_e:0)+H+re),fe=Pe+xe;a.style.height=fe+"px"}else{const Ce=x===N[0].ref.current;a.style.top="0px";const xe=Math.max(ne,Z+_.offsetTop+(Ce?ae:0)+be)+Le;a.style.height=xe+"px",_.scrollTop=Pe-ne+_.offsetTop}a.style.margin=`${ko}px 0`,a.style.minHeight=Y+"px",a.style.maxHeight=G+"px",r==null||r(),requestAnimationFrame(()=>g.current=!0)}},[p,s.trigger,s.valueNode,a,u,_,x,m,s.dir,r]);Gr(()=>S(),[S]);const[E,R]=T.useState();Gr(()=>{u&&R(window.getComputedStyle(u).zIndex)},[u]);const P=T.useCallback(L=>{L&&v.current===!0&&(S(),w==null||w(),v.current=!1)},[S,w]);return C.jsx(BQ,{scope:t,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:P,children:C.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:C.jsx(Rt.div,{...i,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Fk.displayName=FQ;var zQ="SelectPopperPosition",$w=T.forwardRef((n,e)=>{const{__scopeSelect:t,align:r="start",collisionPadding:i=ko,...s}=n,o=Gy(t);return C.jsx(zK,{...o,...s,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});$w.displayName=zQ;var[BQ,Db]=lf(Nc,{}),Kw="SelectViewport",zk=T.forwardRef((n,e)=>{const{__scopeSelect:t,nonce:r,...i}=n,s=Ml(Kw,t),o=Db(Kw,t),a=Kt(e,s.onViewportChange),l=T.useRef(0);return C.jsxs(C.Fragment,{children:[C.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),C.jsx(Hy.Slot,{scope:t,children:C.jsx(Rt.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"auto",...i.style},onScroll:Mt(i.onScroll,u=>{const f=u.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:p}=o;if(p!=null&&p.current&&h){const g=Math.abs(l.current-f.scrollTop);if(g>0){const v=window.innerHeight-ko*2,_=parseFloat(h.style.minHeight),x=parseFloat(h.style.height),m=Math.max(_,x);if(m0?E:0,h.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});zk.displayName=Kw;var Bk="SelectGroup",[VQ,HQ]=lf(Bk),WQ=T.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n,i=tl();return C.jsx(VQ,{scope:t,id:i,children:C.jsx(Rt.div,{role:"group","aria-labelledby":i,...r,ref:e})})});WQ.displayName=Bk;var Vk="SelectLabel",Hk=T.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n,i=HQ(Vk,t);return C.jsx(Rt.div,{id:i.id,...r,ref:e})});Hk.displayName=Vk;var F0="SelectItem",[GQ,Wk]=lf(F0),Gk=T.forwardRef((n,e)=>{const{__scopeSelect:t,value:r,disabled:i=!1,textValue:s,...o}=n,a=wl(F0,t),l=Ml(F0,t),u=a.value===r,[f,h]=T.useState(s??""),[p,g]=T.useState(!1),v=Kt(e,m=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,m,r,i)}),_=tl(),x=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return C.jsx(GQ,{scope:t,value:r,disabled:i,textId:_,isSelected:u,onItemTextChange:T.useCallback(m=>{h(w=>w||((m==null?void 0:m.textContent)??"").trim())},[]),children:C.jsx(Hy.ItemSlot,{scope:t,value:r,disabled:i,textValue:f,children:C.jsx(Rt.div,{role:"option","aria-labelledby":_,"data-highlighted":p?"":void 0,"aria-selected":u&&p,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:v,onFocus:Mt(o.onFocus,()=>g(!0)),onBlur:Mt(o.onBlur,()=>g(!1)),onPointerUp:Mt(o.onPointerUp,x),onPointerMove:Mt(o.onPointerMove,m=>{var w;i?(w=l.onItemLeave)==null||w.call(l):m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Mt(o.onPointerLeave,m=>{var w;m.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Mt(o.onKeyDown,m=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&m.key===" "||(PQ.includes(m.key)&&x(),m.key===" "&&m.preventDefault())})})})})});Gk.displayName=F0;var uh="SelectItemText",jk=T.forwardRef((n,e)=>{const{__scopeSelect:t,className:r,style:i,...s}=n,o=wl(uh,t),a=Ml(uh,t),l=Wk(uh,t),u=DQ(uh,t),[f,h]=T.useState(null),p=Kt(e,m=>h(m),l.onItemTextChange,m=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,m,l.value,l.disabled)}),g=f==null?void 0:f.textContent,v=T.useMemo(()=>C.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:_,onNativeOptionRemove:x}=u;return Gr(()=>(_(v),()=>x(v)),[_,x,v]),C.jsxs(C.Fragment,{children:[C.jsx(Rt.span,{id:l.textId,...s,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?jc.createPortal(s.children,o.valueNode):null]})});jk.displayName=uh;var Xk="SelectItemIndicator",qk=T.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n;return Wk(Xk,t).isSelected?C.jsx(Rt.span,{"aria-hidden":!0,...r,ref:e}):null});qk.displayName=Xk;var Qw="SelectScrollUpButton",jQ=T.forwardRef((n,e)=>{const t=Ml(Qw,n.__scopeSelect),r=Db(Qw,n.__scopeSelect),[i,s]=T.useState(!1),o=Kt(e,r.onScrollButtonChange);return Gr(()=>{if(t.viewport&&t.isPositioned){let a=function(){const u=l.scrollTop>0;s(u)};const l=t.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[t.viewport,t.isPositioned]),i?C.jsx(Yk,{...n,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=t;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});jQ.displayName=Qw;var Jw="SelectScrollDownButton",XQ=T.forwardRef((n,e)=>{const t=Ml(Jw,n.__scopeSelect),r=Db(Jw,n.__scopeSelect),[i,s]=T.useState(!1),o=Kt(e,r.onScrollButtonChange);return Gr(()=>{if(t.viewport&&t.isPositioned){let a=function(){const u=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)l.removeEventListener("scroll",a)}},[t.viewport,t.isPositioned]),i?C.jsx(Yk,{...n,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=t;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});XQ.displayName=Jw;var Yk=T.forwardRef((n,e)=>{const{__scopeSelect:t,onAutoScroll:r,...i}=n,s=Ml("SelectScrollButton",t),o=T.useRef(null),a=Wy(t),l=T.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return T.useEffect(()=>()=>l(),[l]),Gr(()=>{var f;const u=a().find(h=>h.ref.current===document.activeElement);(f=u==null?void 0:u.ref.current)==null||f.scrollIntoView({block:"nearest"})},[a]),C.jsx(Rt.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Mt(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Mt(i.onPointerMove,()=>{var u;(u=s.onItemLeave)==null||u.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Mt(i.onPointerLeave,()=>{l()})})}),qQ="SelectSeparator",Zk=T.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n;return C.jsx(Rt.div,{"aria-hidden":!0,...r,ref:e})});Zk.displayName=qQ;var eM="SelectArrow",YQ=T.forwardRef((n,e)=>{const{__scopeSelect:t,...r}=n,i=Gy(t),s=wl(eM,t),o=Ml(eM,t);return s.open&&o.position==="popper"?C.jsx(BK,{...i,...r,ref:e}):null});YQ.displayName=eM;function $k(n){return n===""||n===void 0}var Kk=T.forwardRef((n,e)=>{const{value:t,...r}=n,i=T.useRef(null),s=Kt(e,i),o=vb(t);return T.useEffect(()=>{const a=i.current,l=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==t&&f){const h=new Event("change",{bubbles:!0});f.call(a,t),a.dispatchEvent(h)}},[o,t]),C.jsx(Lb,{asChild:!0,children:C.jsx("select",{...r,ref:s,defaultValue:t})})});Kk.displayName="BubbleSelect";function Qk(n){const e=_r(n),t=T.useRef(""),r=T.useRef(0),i=T.useCallback(o=>{const a=t.current+o;e(a),function l(u){t.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[e]),s=T.useCallback(()=>{t.current="",window.clearTimeout(r.current)},[]);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),[t,i,s]}function Jk(n,e,t){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,s=t?n.indexOf(t):-1;let o=ZQ(n,Math.max(s,0));i.length===1&&(o=o.filter(u=>u!==t));const l=o.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==t?l:void 0}function ZQ(n,e){return n.map((t,r)=>n[(e+r)%n.length])}var $Q=Ak,eU=Pk,KQ=Lk,QQ=Nk,JQ=Dk,tU=Ok,eJ=zk,nU=Hk,rU=Gk,tJ=jk,nJ=qk,iU=Zk;const tM=$Q,nM=KQ,z0=T.forwardRef(({className:n,children:e,...t},r)=>C.jsxs(eU,{ref:r,className:jt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",n),...t,children:[e,C.jsx(QQ,{asChild:!0,children:C.jsx(n7,{className:"h-4 w-4 opacity-50"})})]}));z0.displayName=eU.displayName;const B0=T.forwardRef(({className:n,children:e,position:t="popper",...r},i)=>C.jsx(JQ,{children:C.jsx(tU,{ref:i,className:jt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",t==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:t,...r,children:C.jsx(eJ,{className:jt("p-1",t==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e})})}));B0.displayName=tU.displayName;const rJ=T.forwardRef(({className:n,...e},t)=>C.jsx(nU,{ref:t,className:jt("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...e}));rJ.displayName=nU.displayName;const V0=T.forwardRef(({className:n,children:e,...t},r)=>C.jsxs(rU,{ref:r,className:jt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50","cursor-pointer text-foreground/50 hover:text-foreground/80 aria-selected:text-foreground",n),...t,children:[C.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:C.jsx(nJ,{children:C.jsx(t7,{className:"h-4 w-4"})})}),C.jsx(tJ,{children:e})]}));V0.displayName=rU.displayName;const iJ=T.forwardRef(({className:n,...e},t)=>C.jsx(iU,{ref:t,className:jt("-mx-1 my-1 h-px bg-muted",n),...e}));iJ.displayName=iU.displayName;var sJ="Separator",yP="horizontal",oJ=["horizontal","vertical"],sU=T.forwardRef((n,e)=>{const{decorative:t,orientation:r=yP,...i}=n,s=aJ(r)?r:yP,a=t?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return C.jsx(Rt.div,{"data-orientation":s,...a,...i,ref:e})});sU.displayName=sJ;function aJ(n){return oJ.includes(n)}var oU=sU;const Ob=T.forwardRef(({className:n,orientation:e="horizontal",decorative:t=!0,...r},i)=>C.jsx(oU,{ref:i,decorative:t,orientation:e,className:jt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",n),...r}));Ob.displayName=oU.displayName;function lJ(n,e){return T.useReducer((t,r)=>e[t][r]??t,n)}var oa=n=>{const{present:e,children:t}=n,r=cJ(e),i=typeof t=="function"?t({present:r.isPresent}):T.Children.only(t),s=Kt(r.ref,uJ(i));return typeof t=="function"||r.isPresent?T.cloneElement(i,{ref:s}):null};oa.displayName="Presence";function cJ(n){const[e,t]=T.useState(),r=T.useRef({}),i=T.useRef(n),s=T.useRef("none"),o=n?"mounted":"unmounted",[a,l]=lJ(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const u=_v(r.current);s.current=a==="mounted"?u:"none"},[a]),Gr(()=>{const u=r.current,f=i.current;if(f!==n){const p=s.current,g=_v(u);n?l("MOUNT"):g==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(f&&p!==g?"ANIMATION_OUT":"UNMOUNT"),i.current=n}},[n,l]),Gr(()=>{if(e){const u=h=>{const g=_v(r.current).includes(h.animationName);h.target===e&&g&&jc.flushSync(()=>l("ANIMATION_END"))},f=h=>{h.target===e&&(s.current=_v(r.current))};return e.addEventListener("animationstart",f),e.addEventListener("animationcancel",u),e.addEventListener("animationend",u),()=>{e.removeEventListener("animationstart",f),e.removeEventListener("animationcancel",u),e.removeEventListener("animationend",u)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:T.useCallback(u=>{u&&(r.current=getComputedStyle(u)),t(u)},[])}}function _v(n){return(n==null?void 0:n.animationName)||"none"}function uJ(n){var r,i;let e=(r=Object.getOwnPropertyDescriptor(n.props,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=(i=Object.getOwnPropertyDescriptor(n,"ref"))==null?void 0:i.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var kb="Dialog",[aU,yte]=sa(kb),[dJ,Os]=aU(kb),lU=n=>{const{__scopeDialog:e,children:t,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=n,a=T.useRef(null),l=T.useRef(null),[u=!1,f]=Pc({prop:r,defaultProp:i,onChange:s});return C.jsx(dJ,{scope:e,triggerRef:a,contentRef:l,contentId:tl(),titleId:tl(),descriptionId:tl(),open:u,onOpenChange:f,onOpenToggle:T.useCallback(()=>f(h=>!h),[f]),modal:o,children:t})};lU.displayName=kb;var cU="DialogTrigger",uU=T.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=Os(cU,t),s=Kt(e,i.triggerRef);return C.jsx(Rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":zb(i.open),...r,ref:s,onClick:Mt(n.onClick,i.onOpenToggle)})});uU.displayName=cU;var Ub="DialogPortal",[fJ,dU]=aU(Ub,{forceMount:void 0}),fU=n=>{const{__scopeDialog:e,forceMount:t,children:r,container:i}=n,s=Os(Ub,e);return C.jsx(fJ,{scope:e,forceMount:t,children:T.Children.map(r,o=>C.jsx(oa,{present:t||s.open,children:C.jsx(Ib,{asChild:!0,container:i,children:o})}))})};fU.displayName=Ub;var H0="DialogOverlay",hU=T.forwardRef((n,e)=>{const t=dU(H0,n.__scopeDialog),{forceMount:r=t.forceMount,...i}=n,s=Os(H0,n.__scopeDialog);return s.modal?C.jsx(oa,{present:r||s.open,children:C.jsx(hJ,{...i,ref:e})}):null});hU.displayName=H0;var hJ=T.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=Os(H0,t);return C.jsx(Nb,{as:Ic,allowPinchZoom:!0,shards:[i.contentRef],children:C.jsx(Rt.div,{"data-state":zb(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Dc="DialogContent",pU=T.forwardRef((n,e)=>{const t=dU(Dc,n.__scopeDialog),{forceMount:r=t.forceMount,...i}=n,s=Os(Dc,n.__scopeDialog);return C.jsx(oa,{present:r||s.open,children:s.modal?C.jsx(pJ,{...i,ref:e}):C.jsx(mJ,{...i,ref:e})})});pU.displayName=Dc;var pJ=T.forwardRef((n,e)=>{const t=Os(Dc,n.__scopeDialog),r=T.useRef(null),i=Kt(e,t.contentRef,r);return T.useEffect(()=>{const s=r.current;if(s)return _k(s)},[]),C.jsx(mU,{...n,ref:i,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Mt(n.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=t.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Mt(n.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:Mt(n.onFocusOutside,s=>s.preventDefault())})}),mJ=T.forwardRef((n,e)=>{const t=Os(Dc,n.__scopeDialog),r=T.useRef(!1),i=T.useRef(!1);return C.jsx(mU,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=n.onCloseAutoFocus)==null||o.call(n,s),s.defaultPrevented||(r.current||(a=t.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,u;(l=n.onInteractOutside)==null||l.call(n,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((u=t.triggerRef.current)==null?void 0:u.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),mU=T.forwardRef((n,e)=>{const{__scopeDialog:t,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=n,a=Os(Dc,t),l=T.useRef(null),u=Kt(e,l);return QO(),C.jsxs(C.Fragment,{children:[C.jsx(wb,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:C.jsx(Sb,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":zb(a.open),...o,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),C.jsxs(C.Fragment,{children:[C.jsx(gJ,{titleId:a.titleId}),C.jsx(yJ,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Fb="DialogTitle",gU=T.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=Os(Fb,t);return C.jsx(Rt.h2,{id:i.titleId,...r,ref:e})});gU.displayName=Fb;var vU="DialogDescription",yU=T.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=Os(vU,t);return C.jsx(Rt.p,{id:i.descriptionId,...r,ref:e})});yU.displayName=vU;var xU="DialogClose",_U=T.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,i=Os(xU,t);return C.jsx(Rt.button,{type:"button",...r,ref:e,onClick:Mt(n.onClick,()=>i.onOpenChange(!1))})});_U.displayName=xU;function zb(n){return n?"open":"closed"}var SU="DialogTitleWarning",[xte,wU]=e$(SU,{contentName:Dc,titleName:Fb,docsSlug:"dialog"}),gJ=({titleId:n})=>{const e=wU(SU),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return T.useEffect(()=>{n&&(document.getElementById(n)||console.error(t))},[t,n]),null},vJ="DialogDescriptionWarning",yJ=({contentRef:n,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wU(vJ).contentName}}.`;return T.useEffect(()=>{var s;const i=(s=n.current)==null?void 0:s.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,n,e]),null},xJ=lU,_J=uU,SJ=fU,MU=hU,EU=pU,bU=gU,TU=yU,wJ=_U;function CU(n){var e,t,r="";if(typeof n=="string"||typeof n=="number")r+=n;else if(typeof n=="object")if(Array.isArray(n))for(e=0;etypeof n=="boolean"?"".concat(n):n===0?"0":n,_P=MJ,Bb=(n,e)=>t=>{var r;if((e==null?void 0:e.variants)==null)return _P(n,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:i,defaultVariants:s}=e,o=Object.keys(i).map(u=>{const f=t==null?void 0:t[u],h=s==null?void 0:s[u];if(f===null)return null;const p=xP(f)||xP(h);return i[u][p]}),a=t&&Object.entries(t).reduce((u,f)=>{let[h,p]=f;return p===void 0||(u[h]=p),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,f)=>{let{class:h,className:p,...g}=f;return Object.entries(g).every(v=>{let[_,x]=v;return Array.isArray(x)?x.includes({...s,...a}[_]):{...s,...a}[_]===x})?[...u,h,p]:u},[]);return _P(n,o,l,t==null?void 0:t.class,t==null?void 0:t.className)},AU=xJ,RU=_J,EJ=SJ,SP=WK,PU=T.forwardRef(({className:n,...e},t)=>C.jsx(MU,{className:jt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/25",n),...e,ref:t}));PU.displayName=MU.displayName;const bJ=Bb("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Vb=T.forwardRef(({insertHidden:n,side:e="right",className:t,children:r,...i},s)=>C.jsxs(EJ,{children:[C.jsx(PU,{}),C.jsxs(EU,{ref:s,className:jt(bJ({side:e}),t),...i,children:[n&&C.jsxs(C.Fragment,{children:[C.jsx(IU,{children:C.jsx(SP,{children:"Nav Menu"})}),C.jsx(LU,{children:C.jsx(SP,{children:"Nav Menu"})})]}),r,C.jsxs(wJ,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[C.jsx(_7,{className:"h-4 w-4"}),C.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Vb.displayName=EU.displayName;const IU=T.forwardRef(({className:n,...e},t)=>C.jsx(bU,{ref:t,className:jt("text-lg font-semibold text-foreground",n),...e}));IU.displayName=bU.displayName;const LU=T.forwardRef(({className:n,...e},t)=>C.jsx(TU,{ref:t,className:jt("text-sm text-muted-foreground",n),...e}));LU.displayName=TU.displayName;var NU=["PageUp","PageDown"],DU=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],OU={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},cf="Slider",[rM,TJ,CJ]=_b(cf),[kU,_te]=sa(cf,[CJ]),[AJ,jy]=kU(cf),UU=T.forwardRef((n,e)=>{const{name:t,min:r=0,max:i=100,step:s=1,orientation:o="horizontal",disabled:a=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[r],value:f,onValueChange:h=()=>{},onValueCommit:p=()=>{},inverted:g=!1,...v}=n,_=T.useRef(new Set),x=T.useRef(0),w=o==="horizontal"?RJ:PJ,[S=[],E]=Pc({prop:f,defaultProp:u,onChange:A=>{var G;(G=[..._.current][x.current])==null||G.focus(),h(A)}}),R=T.useRef(S);function P(A){const N=OJ(S,A);B(A,N)}function L(A){B(A,x.current)}function D(){const A=R.current[x.current];S[x.current]!==A&&p(S)}function B(A,N,{commit:G}={commit:!1}){const Q=zJ(s),V=BJ(Math.round((A-r)/s)*s+r,Q),Z=Rp(V,[r,i]);E(($=[])=>{const re=NJ($,Z,N);if(FJ(re,l*s)){x.current=re.indexOf(Z);const k=String(re)!==String($);return k&&G&&p(re),k?re:$}else return $})}return C.jsx(AJ,{scope:n.__scopeSlider,name:t,disabled:a,min:r,max:i,valueIndexToChangeRef:x,thumbs:_.current,values:S,orientation:o,children:C.jsx(rM.Provider,{scope:n.__scopeSlider,children:C.jsx(rM.Slot,{scope:n.__scopeSlider,children:C.jsx(w,{"aria-disabled":a,"data-disabled":a?"":void 0,...v,ref:e,onPointerDown:Mt(v.onPointerDown,()=>{a||(R.current=S)}),min:r,max:i,inverted:g,onSlideStart:a?void 0:P,onSlideMove:a?void 0:L,onSlideEnd:a?void 0:D,onHomeKeyDown:()=>!a&&B(r,0,{commit:!0}),onEndKeyDown:()=>!a&&B(i,S.length-1,{commit:!0}),onStepKeyDown:({event:A,direction:N})=>{if(!a){const V=NU.includes(A.key)||A.shiftKey&&DU.includes(A.key)?10:1,Z=x.current,$=S[Z],re=s*V*N;B($+re,Z,{commit:!0})}}})})})})});UU.displayName=cf;var[FU,zU]=kU(cf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),RJ=T.forwardRef((n,e)=>{const{min:t,max:r,dir:i,inverted:s,onSlideStart:o,onSlideMove:a,onSlideEnd:l,onStepKeyDown:u,...f}=n,[h,p]=T.useState(null),g=Kt(e,S=>p(S)),v=T.useRef(),_=nm(i),x=_==="ltr",m=x&&!s||!x&&s;function w(S){const E=v.current||h.getBoundingClientRect(),R=[0,E.width],L=Hb(R,m?[t,r]:[r,t]);return v.current=E,L(S-E.left)}return C.jsx(FU,{scope:n.__scopeSlider,startEdge:m?"left":"right",endEdge:m?"right":"left",direction:m?1:-1,size:"width",children:C.jsx(BU,{dir:_,"data-orientation":"horizontal",...f,ref:g,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:S=>{const E=w(S.clientX);o==null||o(E)},onSlideMove:S=>{const E=w(S.clientX);a==null||a(E)},onSlideEnd:()=>{v.current=void 0,l==null||l()},onStepKeyDown:S=>{const R=OU[m?"from-left":"from-right"].includes(S.key);u==null||u({event:S,direction:R?-1:1})}})})}),PJ=T.forwardRef((n,e)=>{const{min:t,max:r,inverted:i,onSlideStart:s,onSlideMove:o,onSlideEnd:a,onStepKeyDown:l,...u}=n,f=T.useRef(null),h=Kt(e,f),p=T.useRef(),g=!i;function v(_){const x=p.current||f.current.getBoundingClientRect(),m=[0,x.height],S=Hb(m,g?[r,t]:[t,r]);return p.current=x,S(_-x.top)}return C.jsx(FU,{scope:n.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1,children:C.jsx(BU,{"data-orientation":"vertical",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:_=>{const x=v(_.clientY);s==null||s(x)},onSlideMove:_=>{const x=v(_.clientY);o==null||o(x)},onSlideEnd:()=>{p.current=void 0,a==null||a()},onStepKeyDown:_=>{const m=OU[g?"from-bottom":"from-top"].includes(_.key);l==null||l({event:_,direction:m?-1:1})}})})}),BU=T.forwardRef((n,e)=>{const{__scopeSlider:t,onSlideStart:r,onSlideMove:i,onSlideEnd:s,onHomeKeyDown:o,onEndKeyDown:a,onStepKeyDown:l,...u}=n,f=jy(cf,t);return C.jsx(Rt.span,{...u,ref:e,onKeyDown:Mt(n.onKeyDown,h=>{h.key==="Home"?(o(h),h.preventDefault()):h.key==="End"?(a(h),h.preventDefault()):NU.concat(DU).includes(h.key)&&(l(h),h.preventDefault())}),onPointerDown:Mt(n.onPointerDown,h=>{const p=h.target;p.setPointerCapture(h.pointerId),h.preventDefault(),f.thumbs.has(p)?p.focus():r(h)}),onPointerMove:Mt(n.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&i(h)}),onPointerUp:Mt(n.onPointerUp,h=>{const p=h.target;p.hasPointerCapture(h.pointerId)&&(p.releasePointerCapture(h.pointerId),s(h))})})}),VU="SliderTrack",HU=T.forwardRef((n,e)=>{const{__scopeSlider:t,...r}=n,i=jy(VU,t);return C.jsx(Rt.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});HU.displayName=VU;var iM="SliderRange",WU=T.forwardRef((n,e)=>{const{__scopeSlider:t,...r}=n,i=jy(iM,t),s=zU(iM,t),o=T.useRef(null),a=Kt(e,o),l=i.values.length,u=i.values.map(p=>jU(p,i.min,i.max)),f=l>1?Math.min(...u):0,h=100-Math.max(...u);return C.jsx(Rt.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:a,style:{...n.style,[s.startEdge]:f+"%",[s.endEdge]:h+"%"}})});WU.displayName=iM;var sM="SliderThumb",GU=T.forwardRef((n,e)=>{const t=TJ(n.__scopeSlider),[r,i]=T.useState(null),s=Kt(e,a=>i(a)),o=T.useMemo(()=>r?t().findIndex(a=>a.ref.current===r):-1,[t,r]);return C.jsx(IJ,{...n,ref:s,index:o})}),IJ=T.forwardRef((n,e)=>{const{__scopeSlider:t,index:r,name:i,...s}=n,o=jy(sM,t),a=zU(sM,t),[l,u]=T.useState(null),f=Kt(e,w=>u(w)),h=l?!!l.closest("form"):!0,p=yb(l),g=o.values[r],v=g===void 0?0:jU(g,o.min,o.max),_=DJ(r,o.values.length),x=p==null?void 0:p[a.size],m=x?kJ(x,v,a.direction):0;return T.useEffect(()=>{if(l)return o.thumbs.add(l),()=>{o.thumbs.delete(l)}},[l,o.thumbs]),C.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${v}% + ${m}px)`},children:[C.jsx(rM.ItemSlot,{scope:n.__scopeSlider,children:C.jsx(Rt.span,{role:"slider","aria-label":n["aria-label"]||_,"aria-valuemin":o.min,"aria-valuenow":g,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...s,ref:f,style:g===void 0?{display:"none"}:n.style,onFocus:Mt(n.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),h&&C.jsx(LJ,{name:i??(o.name?o.name+(o.values.length>1?"[]":""):void 0),value:g},r)]})});GU.displayName=sM;var LJ=n=>{const{value:e,...t}=n,r=T.useRef(null),i=vb(e);return T.useEffect(()=>{const s=r.current,o=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(o,"value").set;if(i!==e&&l){const u=new Event("input",{bubbles:!0});l.call(s,e),s.dispatchEvent(u)}},[i,e]),C.jsx("input",{style:{display:"none"},...t,ref:r,defaultValue:e})};function NJ(n=[],e,t){const r=[...n];return r[t]=e,r.sort((i,s)=>i-s)}function jU(n,e,t){const s=100/(t-e)*(n-e);return Rp(s,[0,100])}function DJ(n,e){return e>2?`Value ${n+1} of ${e}`:e===2?["Minimum","Maximum"][n]:void 0}function OJ(n,e){if(n.length===1)return 0;const t=n.map(i=>Math.abs(i-e)),r=Math.min(...t);return t.indexOf(r)}function kJ(n,e,t){const r=n/2,s=Hb([0,50],[0,r]);return(r-s(e)*t)*t}function UJ(n){return n.slice(0,-1).map((e,t)=>n[t+1]-e)}function FJ(n,e){if(e>0){const t=UJ(n);return Math.min(...t)>=e}return!0}function Hb(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function zJ(n){return(String(n).split(".")[1]||"").length}function BJ(n,e){const t=Math.pow(10,e);return Math.round(n*t)/t}var XU=UU,VJ=HU,HJ=WU,WJ=GU;const Sr=T.forwardRef(({className:n,...e},t)=>C.jsxs(XU,{ref:t,className:jt("relative flex w-full touch-none select-none items-center",n),...e,children:[C.jsx(VJ,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:C.jsx(HJ,{className:"absolute h-full bg-primary"})}),C.jsx(WJ,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Sr.displayName=XU.displayName;var kS="rovingFocusGroup.onEntryFocus",GJ={bubbles:!1,cancelable:!0},Xy="RovingFocusGroup",[oM,qU,jJ]=_b(Xy),[XJ,YU]=sa(Xy,[jJ]),[qJ,YJ]=XJ(Xy),ZU=T.forwardRef((n,e)=>C.jsx(oM.Provider,{scope:n.__scopeRovingFocusGroup,children:C.jsx(oM.Slot,{scope:n.__scopeRovingFocusGroup,children:C.jsx(ZJ,{...n,ref:e})})}));ZU.displayName=Xy;var ZJ=T.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:f=!1,...h}=n,p=T.useRef(null),g=Kt(e,p),v=nm(s),[_=null,x]=Pc({prop:o,defaultProp:a,onChange:l}),[m,w]=T.useState(!1),S=_r(u),E=qU(t),R=T.useRef(!1),[P,L]=T.useState(0);return T.useEffect(()=>{const D=p.current;if(D)return D.addEventListener(kS,S),()=>D.removeEventListener(kS,S)},[S]),C.jsx(qJ,{scope:t,orientation:r,dir:v,loop:i,currentTabStopId:_,onItemFocus:T.useCallback(D=>x(D),[x]),onItemShiftTab:T.useCallback(()=>w(!0),[]),onFocusableItemAdd:T.useCallback(()=>L(D=>D+1),[]),onFocusableItemRemove:T.useCallback(()=>L(D=>D-1),[]),children:C.jsx(Rt.div,{tabIndex:m||P===0?-1:0,"data-orientation":r,...h,ref:g,style:{outline:"none",...n.style},onMouseDown:Mt(n.onMouseDown,()=>{R.current=!0}),onFocus:Mt(n.onFocus,D=>{const B=!R.current;if(D.target===D.currentTarget&&B&&!m){const A=new CustomEvent(kS,GJ);if(D.currentTarget.dispatchEvent(A),!A.defaultPrevented){const N=E().filter($=>$.focusable),G=N.find($=>$.active),Q=N.find($=>$.id===_),Z=[G,Q,...N].filter(Boolean).map($=>$.ref.current);QU(Z,f)}}R.current=!1}),onBlur:Mt(n.onBlur,()=>w(!1))})})}),$U="RovingFocusGroupItem",KU=T.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,focusable:r=!0,active:i=!1,tabStopId:s,...o}=n,a=tl(),l=s||a,u=YJ($U,t),f=u.currentTabStopId===l,h=qU(t),{onFocusableItemAdd:p,onFocusableItemRemove:g}=u;return T.useEffect(()=>{if(r)return p(),()=>g()},[r,p,g]),C.jsx(oM.ItemSlot,{scope:t,id:l,focusable:r,active:i,children:C.jsx(Rt.span,{tabIndex:f?0:-1,"data-orientation":u.orientation,...o,ref:e,onMouseDown:Mt(n.onMouseDown,v=>{r?u.onItemFocus(l):v.preventDefault()}),onFocus:Mt(n.onFocus,()=>u.onItemFocus(l)),onKeyDown:Mt(n.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const _=QJ(v,u.orientation,u.dir);if(_!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let m=h().filter(w=>w.focusable).map(w=>w.ref.current);if(_==="last")m.reverse();else if(_==="prev"||_==="next"){_==="prev"&&m.reverse();const w=m.indexOf(v.currentTarget);m=u.loop?JJ(m,w+1):m.slice(w+1)}setTimeout(()=>QU(m))}})})})});KU.displayName=$U;var $J={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function KJ(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function QJ(n,e,t){const r=KJ(n.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return $J[r]}function QU(n,e=!1){const t=document.activeElement;for(const r of n)if(r===t||(r.focus({preventScroll:e}),document.activeElement!==t))return}function JJ(n,e){return n.map((t,r)=>n[(e+r)%n.length])}var eee=ZU,tee=KU,Wb="Tabs",[nee,Ste]=sa(Wb,[YU]),JU=YU(),[ree,Gb]=nee(Wb),eF=T.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,onValueChange:i,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...u}=n,f=nm(a),[h,p]=Pc({prop:r,onChange:i,defaultProp:s});return C.jsx(ree,{scope:t,baseId:tl(),value:h,onValueChange:p,orientation:o,dir:f,activationMode:l,children:C.jsx(Rt.div,{dir:f,"data-orientation":o,...u,ref:e})})});eF.displayName=Wb;var tF="TabsList",nF=T.forwardRef((n,e)=>{const{__scopeTabs:t,loop:r=!0,...i}=n,s=Gb(tF,t),o=JU(t);return C.jsx(eee,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:r,children:C.jsx(Rt.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:e})})});nF.displayName=tF;var rF="TabsTrigger",iF=T.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,disabled:i=!1,...s}=n,o=Gb(rF,t),a=JU(t),l=aF(o.baseId,r),u=lF(o.baseId,r),f=r===o.value;return C.jsx(tee,{asChild:!0,...a,focusable:!i,active:f,children:C.jsx(Rt.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":u,"data-state":f?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:e,onMouseDown:Mt(n.onMouseDown,h=>{!i&&h.button===0&&h.ctrlKey===!1?o.onValueChange(r):h.preventDefault()}),onKeyDown:Mt(n.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(r)}),onFocus:Mt(n.onFocus,()=>{const h=o.activationMode!=="manual";!f&&!i&&h&&o.onValueChange(r)})})})});iF.displayName=rF;var sF="TabsContent",oF=T.forwardRef((n,e)=>{const{__scopeTabs:t,value:r,forceMount:i,children:s,...o}=n,a=Gb(sF,t),l=aF(a.baseId,r),u=lF(a.baseId,r),f=r===a.value,h=T.useRef(f);return T.useEffect(()=>{const p=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(p)},[]),C.jsx(oa,{present:i||f,children:({present:p})=>C.jsx(Rt.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:u,tabIndex:0,...o,ref:e,style:{...n.style,animationDuration:h.current?"0s":void 0},children:p&&s})})});oF.displayName=sF;function aF(n,e){return`${n}-trigger-${e}`}function lF(n,e){return`${n}-content-${e}`}var iee=eF,cF=nF,uF=iF,dF=oF;const see=iee,fF=T.forwardRef(({className:n,...e},t)=>C.jsx(cF,{ref:t,className:jt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",n),...e}));fF.displayName=cF.displayName;const aM=T.forwardRef(({className:n,...e},t)=>C.jsx(uF,{ref:t,className:jt("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",n),...e}));aM.displayName=uF.displayName;const lM=T.forwardRef(({className:n,...e},t)=>C.jsx(dF,{ref:t,className:jt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",n),...e}));lM.displayName=dF.displayName;var oee="Label",hF=T.forwardRef((n,e)=>C.jsx(Rt.label,{...n,ref:e,onMouseDown:t=>{var i;t.target.closest("button, input, select, textarea")||((i=n.onMouseDown)==null||i.call(n,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));hF.displayName=oee;var pF=hF;const aee=Bb("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Fi=T.forwardRef(({className:n,...e},t)=>C.jsx(pF,{ref:t,className:jt(aee(),n),...e}));Fi.displayName=pF.displayName;const lee=()=>C.jsx(Fi,{children:"Not supported at this time."}),jb=T.createContext(null),cee=({initial:n=void 0,children:e})=>{const[t,r]=T.useState(n==null?void 0:n.query);return C.jsx(jb.Provider,{value:{filters:{query:t},setters:{setQuery:r}},children:e})};function uee(){const n=T.useContext(jb);if(!n)throw new Error("useSearchFiltersContext must be used within a SearchFiltersContextProvider");return n.filters}function dee(){const n=T.useContext(jb);if(!n)throw new Error("useSearchFiltersContextSetters must be used within a SearchFiltersContextProvider");return n.setters}const fee=(n,e=500)=>{const[t,r]=T.useState(n);return T.useEffect(()=>{const i=setTimeout(()=>r(n),e||500);return()=>{clearTimeout(i)}},[n,e]),t},hee=({placeholder:n="Search...",...e})=>{const[t,r]=T.useState(""),i=fee(t,500),{setQuery:s}=dee();return T.useEffect(()=>{s(i)},[i,s]),C.jsxs("div",{className:"flex flex-row items-center justify-start gap-2 rounded-[6px] border-[#4E4E4E] bg-background px-2",children:[C.jsx(g7,{}),C.jsx("input",{id:"search-filter-input",type:"search",placeholder:n,onChange:o=>{r(o.target.value)},className:jt("search-cancel:appearance-none search-cancel:cursor-pointer flex-grow bg-transparent text-sm text-foreground outline-none placeholder:text-xs placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e.className)})]})};function pee(n,e){return T.useReducer((t,r)=>e[t][r]??t,n)}var Xb="ScrollArea",[mF,wte]=sa(Xb),[mee,us]=mF(Xb),gF=T.forwardRef((n,e)=>{const{__scopeScrollArea:t,type:r="hover",dir:i,scrollHideDelay:s=600,...o}=n,[a,l]=T.useState(null),[u,f]=T.useState(null),[h,p]=T.useState(null),[g,v]=T.useState(null),[_,x]=T.useState(null),[m,w]=T.useState(0),[S,E]=T.useState(0),[R,P]=T.useState(!1),[L,D]=T.useState(!1),B=Kt(e,N=>l(N)),A=nm(i);return C.jsx(mee,{scope:t,type:r,dir:A,scrollHideDelay:s,scrollArea:a,viewport:u,onViewportChange:f,content:h,onContentChange:p,scrollbarX:g,onScrollbarXChange:v,scrollbarXEnabled:R,onScrollbarXEnabledChange:P,scrollbarY:_,onScrollbarYChange:x,scrollbarYEnabled:L,onScrollbarYEnabledChange:D,onCornerWidthChange:w,onCornerHeightChange:E,children:C.jsx(Rt.div,{dir:A,...o,ref:B,style:{position:"relative","--radix-scroll-area-corner-width":m+"px","--radix-scroll-area-corner-height":S+"px",...n.style}})})});gF.displayName=Xb;var vF="ScrollAreaViewport",yF=T.forwardRef((n,e)=>{const{__scopeScrollArea:t,children:r,nonce:i,...s}=n,o=us(vF,t),a=T.useRef(null),l=Kt(e,a,o.onViewportChange);return C.jsxs(C.Fragment,{children:[C.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),C.jsx(Rt.div,{"data-radix-scroll-area-viewport":"",...s,ref:l,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...n.style},children:C.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});yF.displayName=vF;var yo="ScrollAreaScrollbar",qb=T.forwardRef((n,e)=>{const{forceMount:t,...r}=n,i=us(yo,n.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=i,a=n.orientation==="horizontal";return T.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),i.type==="hover"?C.jsx(gee,{...r,ref:e,forceMount:t}):i.type==="scroll"?C.jsx(vee,{...r,ref:e,forceMount:t}):i.type==="auto"?C.jsx(xF,{...r,ref:e,forceMount:t}):i.type==="always"?C.jsx(Yb,{...r,ref:e}):null});qb.displayName=yo;var gee=T.forwardRef((n,e)=>{const{forceMount:t,...r}=n,i=us(yo,n.__scopeScrollArea),[s,o]=T.useState(!1);return T.useEffect(()=>{const a=i.scrollArea;let l=0;if(a){const u=()=>{window.clearTimeout(l),o(!0)},f=()=>{l=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return a.addEventListener("pointerenter",u),a.addEventListener("pointerleave",f),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",u),a.removeEventListener("pointerleave",f)}}},[i.scrollArea,i.scrollHideDelay]),C.jsx(oa,{present:t||s,children:C.jsx(xF,{"data-state":s?"visible":"hidden",...r,ref:e})})}),vee=T.forwardRef((n,e)=>{const{forceMount:t,...r}=n,i=us(yo,n.__scopeScrollArea),s=n.orientation==="horizontal",o=Yy(()=>l("SCROLL_END"),100),[a,l]=pee("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return T.useEffect(()=>{if(a==="idle"){const u=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[a,i.scrollHideDelay,l]),T.useEffect(()=>{const u=i.viewport,f=s?"scrollLeft":"scrollTop";if(u){let h=u[f];const p=()=>{const g=u[f];h!==g&&(l("SCROLL"),o()),h=g};return u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[i.viewport,s,l,o]),C.jsx(oa,{present:t||a!=="hidden",children:C.jsx(Yb,{"data-state":a==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Mt(n.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Mt(n.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),xF=T.forwardRef((n,e)=>{const t=us(yo,n.__scopeScrollArea),{forceMount:r,...i}=n,[s,o]=T.useState(!1),a=n.orientation==="horizontal",l=Yy(()=>{if(t.viewport){const u=t.viewport.offsetWidth{const{orientation:t="vertical",...r}=n,i=us(yo,n.__scopeScrollArea),s=T.useRef(null),o=T.useRef(0),[a,l]=T.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=EF(a.viewport,a.content),f={...r,sizes:a,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function h(p,g){return Mee(p,o.current,a,g)}return t==="horizontal"?C.jsx(yee,{...f,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollLeft,g=wP(p,a,i.dir);s.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollLeft=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollLeft=h(p,i.dir))}}):t==="vertical"?C.jsx(xee,{...f,ref:e,onThumbPositionChange:()=>{if(i.viewport&&s.current){const p=i.viewport.scrollTop,g=wP(p,a);s.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:p=>{i.viewport&&(i.viewport.scrollTop=p)},onDragScroll:p=>{i.viewport&&(i.viewport.scrollTop=h(p))}}):null}),yee=T.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...i}=n,s=us(yo,n.__scopeScrollArea),[o,a]=T.useState(),l=T.useRef(null),u=Kt(e,l,s.onScrollbarXChange);return T.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),C.jsx(SF,{"data-orientation":"horizontal",...i,ref:u,sizes:t,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qy(t)+"px",...n.style},onThumbPointerDown:f=>n.onThumbPointerDown(f.x),onDragScroll:f=>n.onDragScroll(f.x),onWheelScroll:(f,h)=>{if(s.viewport){const p=s.viewport.scrollLeft+f.deltaX;n.onWheelScroll(p),TF(p,h)&&f.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:G0(o.paddingLeft),paddingEnd:G0(o.paddingRight)}})}})}),xee=T.forwardRef((n,e)=>{const{sizes:t,onSizesChange:r,...i}=n,s=us(yo,n.__scopeScrollArea),[o,a]=T.useState(),l=T.useRef(null),u=Kt(e,l,s.onScrollbarYChange);return T.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),C.jsx(SF,{"data-orientation":"vertical",...i,ref:u,sizes:t,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qy(t)+"px",...n.style},onThumbPointerDown:f=>n.onThumbPointerDown(f.y),onDragScroll:f=>n.onDragScroll(f.y),onWheelScroll:(f,h)=>{if(s.viewport){const p=s.viewport.scrollTop+f.deltaY;n.onWheelScroll(p),TF(p,h)&&f.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:G0(o.paddingTop),paddingEnd:G0(o.paddingBottom)}})}})}),[_ee,_F]=mF(yo),SF=T.forwardRef((n,e)=>{const{__scopeScrollArea:t,sizes:r,hasThumb:i,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:f,onResize:h,...p}=n,g=us(yo,t),[v,_]=T.useState(null),x=Kt(e,B=>_(B)),m=T.useRef(null),w=T.useRef(""),S=g.viewport,E=r.content-r.viewport,R=_r(f),P=_r(l),L=Yy(h,10);function D(B){if(m.current){const A=B.clientX-m.current.left,N=B.clientY-m.current.top;u({x:A,y:N})}}return T.useEffect(()=>{const B=A=>{const N=A.target;(v==null?void 0:v.contains(N))&&R(A,E)};return document.addEventListener("wheel",B,{passive:!1}),()=>document.removeEventListener("wheel",B,{passive:!1})},[S,v,E,R]),T.useEffect(P,[r,P]),jd(v,L),jd(g.content,L),C.jsx(_ee,{scope:t,scrollbar:v,hasThumb:i,onThumbChange:_r(s),onThumbPointerUp:_r(o),onThumbPositionChange:P,onThumbPointerDown:_r(a),children:C.jsx(Rt.div,{...p,ref:x,style:{position:"absolute",...p.style},onPointerDown:Mt(n.onPointerDown,B=>{B.button===0&&(B.target.setPointerCapture(B.pointerId),m.current=v.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),D(B))}),onPointerMove:Mt(n.onPointerMove,D),onPointerUp:Mt(n.onPointerUp,B=>{const A=B.target;A.hasPointerCapture(B.pointerId)&&A.releasePointerCapture(B.pointerId),document.body.style.webkitUserSelect=w.current,g.viewport&&(g.viewport.style.scrollBehavior=""),m.current=null})})})}),W0="ScrollAreaThumb",wF=T.forwardRef((n,e)=>{const{forceMount:t,...r}=n,i=_F(W0,n.__scopeScrollArea);return C.jsx(oa,{present:t||i.hasThumb,children:C.jsx(See,{ref:e,...r})})}),See=T.forwardRef((n,e)=>{const{__scopeScrollArea:t,style:r,...i}=n,s=us(W0,t),o=_F(W0,t),{onThumbPositionChange:a}=o,l=Kt(e,h=>o.onThumbChange(h)),u=T.useRef(),f=Yy(()=>{u.current&&(u.current(),u.current=void 0)},100);return T.useEffect(()=>{const h=s.viewport;if(h){const p=()=>{if(f(),!u.current){const g=Eee(h,a);u.current=g,a()}};return a(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[s.viewport,f,a]),C.jsx(Rt.div,{"data-state":o.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Mt(n.onPointerDownCapture,h=>{const g=h.target.getBoundingClientRect(),v=h.clientX-g.left,_=h.clientY-g.top;o.onThumbPointerDown({x:v,y:_})}),onPointerUp:Mt(n.onPointerUp,o.onThumbPointerUp)})});wF.displayName=W0;var Zb="ScrollAreaCorner",MF=T.forwardRef((n,e)=>{const t=us(Zb,n.__scopeScrollArea),r=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&r?C.jsx(wee,{...n,ref:e}):null});MF.displayName=Zb;var wee=T.forwardRef((n,e)=>{const{__scopeScrollArea:t,...r}=n,i=us(Zb,t),[s,o]=T.useState(0),[a,l]=T.useState(0),u=!!(s&&a);return jd(i.scrollbarX,()=>{var h;const f=((h=i.scrollbarX)==null?void 0:h.offsetHeight)||0;i.onCornerHeightChange(f),l(f)}),jd(i.scrollbarY,()=>{var h;const f=((h=i.scrollbarY)==null?void 0:h.offsetWidth)||0;i.onCornerWidthChange(f),o(f)}),u?C.jsx(Rt.div,{...r,ref:e,style:{width:s,height:a,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...n.style}}):null});function G0(n){return n?parseInt(n,10):0}function EF(n,e){const t=n/e;return isNaN(t)?0:t}function qy(n){const e=EF(n.viewport,n.content),t=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,r=(n.scrollbar.size-t)*e;return Math.max(r,18)}function Mee(n,e,t,r="ltr"){const i=qy(t),s=i/2,o=e||s,a=i-o,l=t.scrollbar.paddingStart+o,u=t.scrollbar.size-t.scrollbar.paddingEnd-a,f=t.content-t.viewport,h=r==="ltr"?[0,f]:[f*-1,0];return bF([l,u],h)(n)}function wP(n,e,t="ltr"){const r=qy(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-i,o=e.content-e.viewport,a=s-r,l=t==="ltr"?[0,o]:[o*-1,0],u=Rp(n,l);return bF([0,o],[0,a])(u)}function bF(n,e){return t=>{if(n[0]===n[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(n[1]-n[0]);return e[0]+r*(t-n[0])}}function TF(n,e){return n>0&&n{})=>{let t={left:n.scrollLeft,top:n.scrollTop},r=0;return function i(){const s={left:n.scrollLeft,top:n.scrollTop},o=t.left!==s.left,a=t.top!==s.top;(o||a)&&e(),t=s,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function Yy(n,e){const t=_r(n),r=T.useRef(0);return T.useEffect(()=>()=>window.clearTimeout(r.current),[]),T.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(t,e)},[t,e])}function jd(n,e){const t=_r(e);Gr(()=>{let r=0;if(n){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(t)});return i.observe(n),()=>{window.cancelAnimationFrame(r),i.unobserve(n)}}},[n,t])}var CF=gF,bee=yF,Tee=MF;const AF=T.forwardRef(({className:n,children:e,...t},r)=>C.jsxs(CF,{ref:r,className:jt("relative overflow-hidden",n),...t,children:[C.jsx(bee,{className:"h-full w-full rounded-[inherit]",children:e}),C.jsx(RF,{}),C.jsx(Tee,{})]}));AF.displayName=CF.displayName;const RF=T.forwardRef(({className:n,orientation:e="vertical",...t},r)=>C.jsx(qb,{ref:r,orientation:e,className:jt("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",n),...t,children:C.jsx(wF,{className:"relative flex-1 rounded-full bg-border"})}));RF.displayName=qb.displayName;const Cee=({track:n,className:e,...t})=>{var r;return C.jsxs("div",{className:jt("flex cursor-pointer flex-row items-center justify-start gap-2 hover:scale-105 hover:bg-slate-500/20",e),...t,children:[n.artwork_url?C.jsx("img",{src:n.artwork_url,className:"h-8 w-8 rounded-lg",alt:"Artwork"}):C.jsx(XN,{}),C.jsxs("div",{className:"flex flex-col items-start justify-center gap-0.5",children:[C.jsx("span",{className:"truncate text-xs text-foreground",children:n.title}),C.jsxs("span",{className:"truncate text-xs text-foreground/50",children:["playcount:"," ",(r=n.playback_count)==null?void 0:r.toLocaleString("en-US",{maximumFractionDigits:0})]})]})]})},Aee=({tracks:n,onTrackSelected:e,className:t,...r})=>n.length===0?C.jsx("span",{className:"text-foreground",children:"This artist has no playable tracks."}):C.jsx(AF,{className:jt("no-scrollbar flex flex-col items-start justify-start gap-2",t),...r,children:n.map(i=>C.jsx(Cee,{track:i,onClick:()=>{e(i)}},i.id))}),Ree=({userId:n,limit:e=10,...t})=>{const{data:r}=cE({queryKey:["soundcloud-user-track-search",n],queryFn:async()=>await Dj({userId:n,limit:e})});return C.jsx(Aee,{tracks:r,...t})},Pee=({user:n,className:e,...t})=>C.jsxs("div",{className:jt("flex w-12 shrink-0 flex-col items-center justify-start gap-1 hover:border hover:border-white aria-selected:animate-pulse aria-selected:border aria-selected:border-white",e),...t,children:[n.avatar_url?C.jsx("img",{src:n.avatar_url,className:"aspect-square w-full rounded-full",alt:"User avatar"}):C.jsx(XN,{}),C.jsx("span",{className:"w-full truncate text-xs text-foreground",children:n.username})]}),Iee=({users:n,selectedUserId:e=void 0,onUserSelected:t,className:r,...i})=>C.jsx("div",{className:jt("no-scrollbar flex w-full cursor-pointer flex-row items-center justify-start gap-2 overflow-x-scroll",r),...i,children:n==null?void 0:n.map(s=>C.jsx(Pee,{"aria-selected":e===s.id,user:s,onClick:()=>{t(s)}},s.id))}),Lee=({query:n})=>{const{data:e}=cE({queryKey:["soundcloud-user-search",n],queryFn:async()=>await Nj({query:n,limit:20})}),[t,r]=T.useState(null),{setTrack:i}=C6();return C.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[C.jsx(Iee,{users:e.filter(s=>(s.track_count??0)>0),onUserSelected:r,selectedUserId:t==null?void 0:t.id}),t&&C.jsx(T.Suspense,{fallback:C.jsx("span",{children:"Loading..."}),children:C.jsx(Ree,{userId:t.id,onTrackSelected:i})})]})},Nee=()=>{const{query:n}=uee();return n?C.jsx(T.Suspense,{fallback:C.jsx("span",{className:"text-foreground",children:"Searching..."}),children:C.jsx(Lee,{query:n})}):C.jsx("span",{className:"text-foreground",children:"No results..."})},Dee=()=>C.jsxs(cee,{children:[C.jsx(hee,{placeholder:"Search Soundcloud users..."}),C.jsx(Nee,{})]}),Oee=()=>C.jsx(Dee,{}),zr=({label:n,value:e,className:t,...r})=>C.jsxs("div",{className:jt("flex w-full items-center justify-between",t),...r,children:[C.jsx(Fi,{children:n}),C.jsx("span",{className:"w-12 px-2 py-0.5 text-right text-sm text-muted-foreground",children:e})]}),kee=({audioSource:n,...e})=>{switch(n){case Jn.SOUNDCLOUD:return C.jsx(qN,{...e});case Jn.MICROPHONE:return C.jsx(f7,{...e});case Jn.SCREEN_SHARE:return C.jsx(m7,{...e});case Jn.FILE_UPLOAD:return C.jsx(l7,{...e});default:return n}},Uee=({className:n,...e})=>C.jsx("div",{className:jt("grid aspect-square w-full flex-none grow cursor-pointer place-content-center rounded-sm bg-gradient-to-b from-slate-700 to-black text-white shadow-inner duration-300 ease-in-out hover:scale-110 hover:from-slate-500 hover:to-slate-900 aria-selected:from-slate-100 aria-selected:to-slate-500 aria-selected:text-black",n),...e}),PF=({className:n,...e})=>{const{audioSource:t}=dE(),{setAudioSource:r}=C7(),i=T.useMemo(()=>dN(),[]);return C.jsx("div",{className:jt("grid w-full grid-cols-6 justify-items-stretch gap-2 sm:grid-cols-8",n),...e,children:i.map(s=>C.jsx(Uee,{onClick:()=>r(s),"aria-selected":t===s,children:C.jsx(kee,{audioSource:s})},`grid_icon_${s}`))})},IF=()=>{const{audioSource:n}=dE();switch(n){case Jn.SOUNDCLOUD:return C.jsx(Oee,{});case Jn.FILE_UPLOAD:return C.jsx(lee,{});case Jn.MICROPHONE:case Jn.SCREEN_SHARE:return null;default:return n}},Fee=()=>{const{amplitude:n,octaveBandMode:e,energyMeasure:t}=pM(),{setAmplitude:r,setOctaveBand:i,setEnergyMeasure:s}=Yz();return C.jsxs("div",{className:"w-full space-y-4",children:[C.jsx(zr,{label:"Amplitude",value:n.toFixed(2)}),C.jsx(Sr,{defaultValue:[n],value:[n],min:0,max:5,step:.01,onValueChange:o=>r(o[0])}),C.jsxs("div",{className:"flex w-full items-center justify-between",children:[C.jsx("span",{children:"Octave Band Mode"}),C.jsxs(tM,{onValueChange:o=>{i(Number(o))},children:[C.jsx(z0,{className:"max-w-1/2 w-[240px]",children:C.jsx(nM,{placeholder:ER[e],defaultValue:e,className:"w-full"})}),C.jsx(B0,{className:"max-h-36",children:Object.entries(ER).map(o=>C.jsx(V0,{value:o[0],"aria-selected":o[0]===e.toString(),children:o[1]},o[1]))})]})]}),C.jsxs("div",{className:"flex w-full items-center justify-between",children:[C.jsx("span",{children:"Energy Measure"}),C.jsxs(tM,{onValueChange:o=>{s(o)},children:[C.jsx(z0,{className:"max-w-1/2 w-[240px]",children:C.jsx(nM,{placeholder:t,defaultValue:t,className:"w-full"})}),C.jsx(B0,{className:"max-h-36",children:R7.map(o=>C.jsx(V0,{value:o,"aria-selected":o===t,children:o},o))})]})]})]})},zee=()=>C.jsxs(see,{defaultValue:"source",className:"w-full",children:[C.jsxs(fF,{className:"w-full",children:[C.jsx(aM,{value:"source",className:"grow",children:"Audio Source"}),C.jsx(aM,{value:"analyzer",className:"grow",children:"Audio Analyzer"})]}),C.jsxs(lM,{value:"source",className:"space-y-4 p-4",children:[C.jsx(PF,{}),C.jsx(IF,{})]}),C.jsx(lM,{value:"analyzer",children:C.jsx(Fee,{})})]}),Bee=()=>C.jsxs("div",{className:"space-y-4 p-4",children:[C.jsx(PF,{}),C.jsx(IF,{})]}),Vee=()=>{const{amplitude:n,spatialScale:e,timeScale:t,nIterations:r}=N3(),{setAmplitude:i,setSpatialScale:s,setTimeScale:o,setNIterations:a,reset:l}=aq();return C.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[C.jsxs("div",{className:"flex w-full items-center justify-between",children:[C.jsx("span",{children:"Noise"}),C.jsx(YN,{className:"pointer-events-auto cursor-pointer",onClick:()=>l()})]}),C.jsx(zr,{label:"Amplitude",value:n.toFixed(2)}),C.jsx(Sr,{defaultValue:[n],value:[n],min:0,max:5,step:.01,onValueChange:u=>i(u[0])}),C.jsx(zr,{label:"Spatial Scale",value:e.toFixed(2)}),C.jsx(Sr,{defaultValue:[e],value:[e],min:.1,max:5,step:.1,onValueChange:u=>s(u[0])}),C.jsx(zr,{label:"Time Scale",value:t.toFixed(2)}),C.jsx(Sr,{defaultValue:[t],value:[t],min:.01,max:2,step:.01,onValueChange:u=>o(u[0])}),C.jsx(zr,{label:"Iteration Count",value:r}),C.jsx(Sr,{defaultValue:[r],value:[r],min:1,max:16,step:1,onValueChange:u=>a(u[0])})]})},Hee=()=>{const{maxAmplitude:n,waveformFrequenciesHz:e}=JN(),{setMaxAmplitude:t,setWaveformFrequenciesHz:r,reset:i}=e3();return C.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[C.jsxs("div",{className:"flex w-full items-center justify-between",children:[C.jsx("span",{children:"Wave Form"}),C.jsx(YN,{className:"pointer-events-auto cursor-pointer",onClick:()=>i()})]}),C.jsxs("div",{className:"flex w-full items-center justify-between",children:[C.jsx(Fi,{children:"Double"}),C.jsx(el,{checked:e.length>1,defaultChecked:e.length>1,onCheckedChange:s=>{r(s?[2,10]:[2])}})]}),C.jsx(zr,{label:"Max Amplitude",value:n.toFixed(2)}),C.jsx(Sr,{defaultValue:[n],min:0,max:5,step:.01,onValueChange:s=>t(s[0])}),[...e].map((s,o)=>C.jsxs("div",{className:"w-full space-y-4",children:[C.jsx(zr,{label:`Wave #${o+1} - Freq (hz)`,value:s.toFixed(2)}),C.jsx(Sr,{defaultValue:[s],value:[s],min:2,max:o==0?10:30,step:.05,onValueChange:a=>r(l=>l.map((u,f)=>o==f?a[0]:u))},`slider_waveform_frequency_${o}`)]},`label_waveform_frequency_${o}`))]})},Wee=({mode:n})=>{switch(n){case"WAVE_FORM":return C.jsx(Q9,{});case"NOISE":return C.jsx(x7,{});case"AUDIO":return C.jsx(qN,{});case"AUDIO_SCOPE":return C.jsx(y7,{});case"PARTICLE_NOISE":return C.jsx(a7,{});default:return C.jsx(jN,{})}},MP=({mode:n})=>C.jsxs("div",{className:"flex w-full items-center justify-start gap-2",children:[C.jsx("div",{className:"w-4",children:S6(n)&&"🎧"}),C.jsx(Wee,{mode:n}),n]}),Gee=()=>{const{mode:n}=zc(),{setMode:e}=pN(),t=T.useMemo(()=>w6(),[]);return C.jsxs(tM,{onValueChange:r=>{e(r)},children:[C.jsx(z0,{children:C.jsx(nM,{placeholder:C.jsx(MP,{mode:n}),defaultValue:n,className:"w-full"})}),C.jsx(B0,{children:t.map(r=>C.jsx(V0,{value:r,"aria-selected":r===n,children:C.jsx(MP,{mode:r})},`select_item_${r}`))})]})},jee=({children:n})=>{const[e,t]=T.useState(!1),{mode:r}=zc();return C.jsxs(AU,{open:e,onOpenChange:t,children:[C.jsx(RU,{asChild:!0,children:n}),C.jsxs(Vb,{insertHidden:!0,side:"right",className:"no-scrollbar w-full max-w-full space-y-4 overflow-scroll bg-background/70 p-4 pt-16 sm:w-[540px] sm:max-w-[540px]",children:[C.jsxs("div",{className:"flex items-center justify-start gap-4",children:[C.jsx("span",{className:"text-xl font-bold",children:"MODE"}),C.jsx(Gee,{})]}),C.jsx(Ob,{}),r===At.WAVE_FORM&&C.jsx(Hee,{}),r===At.NOISE&&C.jsx(Vee,{}),r===At.AUDIO&&C.jsx(zee,{}),r===At.AUDIO_SCOPE&&C.jsx(Bee,{})]})]})},Xee=Bb("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),sm=T.forwardRef(({className:n,variant:e,size:t,asChild:r=!1,...i},s)=>{const o=r?Ic:"button";return C.jsx(o,{className:jt(Xee({variant:e,size:t,className:n})),ref:s,...i})});sm.displayName="Button";const US=[{name:"default",nPerSide:10,unitSpacingScalar:.1,volume:!0},{name:"custom"}],qee=()=>{const{nPerSide:n,unitSpacingScalar:e,volume:t}=k7(),{setNPerSide:r,setUnitSpacingScalar:i,setVolume:s}=U7(),[o,a]=T.useState(US.find(l=>l.name!=="custom"&&l.nPerSide===n&&l.volume===t&&l.unitSpacingScalar===e)??US[0]);return T.useEffect(()=>{o.name!=="custom"&&(r(o.nPerSide),i(o.unitSpacingScalar),s(o.volume))},[o,r,i,s]),C.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[C.jsx(Fi,{children:"Cube Presets"}),C.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:US.map(l=>C.jsx(sm,{variant:"ghost","aria-selected":l===o,className:"p-2 aria-selected:bg-primary/20",onClick:()=>a(l),children:l.name},`cube_preset_${l.name}`))}),o.name==="custom"&&C.jsxs(C.Fragment,{children:[C.jsx(zr,{label:"N x Per Side",value:n}),C.jsx(Sr,{defaultValue:[n],value:[n],min:3,max:20,step:1,onValueChange:l=>r(l[0])}),C.jsx(zr,{label:"Cube Spacing",value:e.toFixed(2)}),C.jsx(Sr,{defaultValue:[e],value:[e],min:0,max:.5,step:.1,onValueChange:l=>i(l[0])}),C.jsxs("div",{className:"flex w-full items-center justify-between",children:[C.jsx(Fi,{children:"Volume"}),C.jsx(el,{defaultChecked:t,onCheckedChange:l=>{s(l)}})]})]})]})},FS=[{name:"default",radius:2,pointSize:.2,mirrorEffects:!1},{name:"custom"}],Yee=()=>{const{radius:n,pointSize:e,mirrorEffects:t}=z7(),{setRadius:r,setPointSize:i,setMirrorEffects:s}=B7(),[o,a]=T.useState(FS.find(l=>l.name!=="custom"&&l.pointSize===e&&l.radius===n&&l.mirrorEffects===t)??FS[0]);return T.useEffect(()=>{o.name!=="custom"&&(r(o.radius),i(o.pointSize),s(o.mirrorEffects))},[o,r,i,s]),C.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[C.jsx(Fi,{children:"Diffused Ring Presets"}),C.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:FS.map(l=>C.jsx(sm,{variant:"ghost","aria-selected":l===o,className:"p-2 aria-selected:bg-primary/20",onClick:()=>a(l),children:l.name},`sphere_preset_${l.name}`))}),o.name==="custom"&&C.jsxs(C.Fragment,{children:[C.jsx(zr,{label:"Radius",value:n.toFixed(2)}),C.jsx(Sr,{defaultValue:[n],value:[n],min:.25,max:3,step:.25,onValueChange:l=>r(l[0])}),C.jsx(zr,{label:"Point Size",value:e.toFixed(2)}),C.jsx(Sr,{defaultValue:[e],value:[e],min:.01,max:.25,step:.01,onValueChange:l=>i(l[0])}),C.jsxs("div",{className:"flex w-full items-center justify-between",children:[C.jsx(Fi,{children:"Mirror Effects"}),C.jsx(el,{defaultChecked:t,onCheckedChange:l=>{s(l)}})]})]})]})},zS=[{name:"default",nRows:100,nCols:100,unitSpacingScalar:5},{name:"bands",nRows:5,nCols:200,unitSpacingScalar:1},{name:"custom"}],Zee=()=>{const{nCols:n,nRows:e,unitSpacingScalar:t}=W7(),{setNCols:r,setNRows:i,setUnitSpacingScalar:s}=G7(),[o,a]=T.useState(zS.find(l=>l.name!=="custom"&&l.nRows===e&&l.nCols===n&&l.unitSpacingScalar===t)??zS[0]);return T.useEffect(()=>{o.name!=="custom"&&(i(o.nRows),r(o.nCols),s(o.unitSpacingScalar))},[o,r,i,s]),C.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[C.jsx(Fi,{children:"Grid Presets"}),C.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:zS.map(l=>C.jsx(sm,{variant:"ghost","aria-selected":l===o,className:"p-2 aria-selected:bg-primary/20",onClick:()=>a(l),children:l.name},`grid_preset_${l.name}`))}),o.name==="custom"&&C.jsxs(C.Fragment,{children:[C.jsx(zr,{label:"N x Rows",value:e}),C.jsx(Sr,{defaultValue:[e],value:[e],min:5,max:200,step:5,onValueChange:l=>i(l[0])}),C.jsx(zr,{label:"N x Cols",value:n}),C.jsx(Sr,{defaultValue:[n],value:[n],min:5,max:200,step:5,onValueChange:l=>r(l[0])}),C.jsx(zr,{label:"Grid Spacing",value:t.toFixed(2)}),C.jsx(Sr,{defaultValue:[t],value:[t],min:1,max:6,step:.5,onValueChange:l=>s(l[0])})]})]})},BS=[{name:"default",radius:2,nPoints:800},{name:"custom"}],$ee=()=>{const{radius:n,nPoints:e}=Y7(),{setRadius:t,setNPoints:r}=Z7(),[i,s]=T.useState(BS.find(o=>o.name!=="custom"&&o.nPoints===e&&o.radius===n)??BS[0]);return T.useEffect(()=>{i.name!=="custom"&&(t(i.radius),r(i.nPoints))},[i,t,r]),C.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[C.jsx(Fi,{children:"Sphere Presets"}),C.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:BS.map(o=>C.jsx(sm,{variant:"ghost","aria-selected":o===i,className:"p-2 aria-selected:bg-primary/20",onClick:()=>s(o),children:o.name},`sphere_preset_${o.name}`))}),i.name==="custom"&&C.jsxs(C.Fragment,{children:[C.jsx(zr,{label:"Point Count",value:e}),C.jsx(Sr,{defaultValue:[e],value:[e],min:100,max:2e3,step:25,onValueChange:o=>r(o[0])}),C.jsx(zr,{label:"Radius",value:n.toFixed(2)}),C.jsx(Sr,{defaultValue:[n],value:[n],min:.25,max:3,step:.25,onValueChange:o=>t(o[0])})]})]})},Kee=({palette:n,className:e,...t})=>{const r=Gn.getPalette(n);return C.jsx("div",{className:jt("h-8 w-full rounded-sm",e),style:{background:`linear-gradient(0.25turn, ${r.colors.join(",")})`},...t})},Qee=({palette:n,className:e,...t})=>{const r=Gn.getPalette(n);return C.jsx("div",{className:jt("aspect-square cursor-pointer rounded-full transition-all duration-200 ease-in-out hover:ring-2 hover:ring-primary aria-selected:animate-pulse aria-selected:ring-2 aria-selected:ring-primary",e),style:{background:`linear-gradient(45deg, ${r.colors.join(",")})`},...t})},Jee=()=>{const{visual:n}=Bc();switch(n){case vn.CUBE:return qee();case vn.GRID:return Zee();case vn.SPHERE:return $ee();case vn.DIFFUSED_RING:return Yee();case vn.RIBBONS:case vn.DNA:case vn.BOXES:case vn.WALK:return null;default:return n}},ete=({children:n})=>{const[e,t]=T.useState(!1),{mode:r}=zc(),{colorBackground:i,paletteTrackEnergy:s}=Bc(),{setColorBackground:o,setPaletteTrackEnergy:a}=yE(),l=QM(),{setPalette:u}=ef(),{autoOrbitAfterSleepMs:f}=BO(),{setMode:h,setAutoOrbitAfterSleepMs:p}=VO();return C.jsxs(AU,{open:e,onOpenChange:t,children:[C.jsx(RU,{asChild:!0,children:n}),C.jsx(Vb,{insertHidden:!0,side:"right",className:"no-scrollbar w-full max-w-full overflow-scroll bg-background/70 sm:w-[540px] sm:max-w-[540px]",children:C.jsxs("div",{className:"space-y-4",children:[C.jsxs("div",{className:"space-y-4",children:[C.jsxs("div",{className:"space-y-2",children:[C.jsx("div",{className:"",children:"Palette"}),C.jsx(Kee,{palette:l}),C.jsx("div",{className:"grid w-full grid-cols-4 justify-items-stretch gap-2 sm:grid-cols-6",children:gh.map(g=>C.jsx(Qee,{palette:g,onClick:()=>u(g),"aria-selected":g===l},g))})]}),C.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C.jsx(Fi,{children:"Color Background"}),C.jsx(el,{defaultChecked:i,onCheckedChange:g=>{o(g)}})]}),C.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C.jsx(Fi,{children:"Colors Follow Music"}),C.jsx(el,{disabled:r!==At.AUDIO,defaultChecked:s,onCheckedChange:g=>{a(g)}})]}),C.jsxs("div",{className:"flex items-center justify-between gap-2",children:[C.jsx(Fi,{children:"Auto Orbit Camera"}),C.jsx(el,{disabled:!M6(r),defaultChecked:f>0,onCheckedChange:g=>{h(g?Fo.AUTO_ORBIT:Fo.ORBIT_CONTROLS),p(g?3500:0)}})]})]}),C.jsx(Ob,{}),C.jsx("div",{className:"space-y-4",children:C.jsx(Jee,{})})]})})]})},tte=({className:n,...e})=>C.jsx(WO,{...e,className:jt("max-h-4/5 w-fit sm:h-fit",n),children:C.jsxs(HO,{className:"snap-y flex-col bg-gradient-to-l sm:snap-x sm:flex-row sm:bg-gradient-to-t",children:[C.jsx(jee,{children:C.jsx(N0,{className:"rounded-full",children:C.jsx(v7,{})})}),C.jsx(ete,{children:C.jsx(N0,{className:"rounded-full",children:C.jsx(h7,{})})})]})}),nte=()=>{const{mode:n,showUI:e}=zc(),{setShowUI:t}=pN();return C.jsxs(C.Fragment,{children:[C.jsx("div",{className:"pointer-events-none absolute top-0 flex w-full flex-row items-center justify-end gap-2 p-4",children:C.jsx(el,{defaultChecked:e,className:"pointer-events-auto cursor-pointer",id:"controls-visible",onCheckedChange:r=>{t(r)}})}),e&&C.jsxs("div",{className:"pointer-events-none absolute bottom-0 flex w-full items-end justify-center gap-4 p-4",children:[n!==At.AUDIO_SCOPE&&C.jsx(QZ,{className:"sm:max-w-[60%]"}),C.jsx("div",{className:jt({"absolute bottom-24 right-0 sm:static sm:bottom-0":!0}),children:C.jsx(tte,{})})]})]})},rte=n=>{switch(n){case At.AUDIO:case At.AUDIO_SCOPE:return C.jsx(D7,{mode:n});case At.WAVE_FORM:case At.NOISE:case At.PARTICLE_NOISE:return null;default:return n}},ite=n=>{switch(n){case At.AUDIO_SCOPE:return C.jsx(QX,{});case At.WAVE_FORM:case At.NOISE:case At.AUDIO:case At.PARTICLE_NOISE:return C.jsx($Z,{mode:n});default:return n}},ste=()=>{const{mode:n}=zc(),{noteCanvasInteraction:e}=ef();return C.jsxs("main",{className:"relative h-[100dvh] w-[100dvw] bg-black",children:[C.jsx("div",{className:"absolute h-[100dvh] w-[100dvw]",onMouseDown:e,onTouchStart:e,children:C.jsx(T.Suspense,{fallback:C.jsx("span",{children:"loading..."}),children:ite(n)})}),C.jsx("div",{className:"pointer-events-none absolute h-[100dvh] w-[100dvw]",children:C.jsx(T.Suspense,{fallback:C.jsx("span",{children:"loading..."}),children:rte(n)})}),C.jsx(nte,{})]})},ote={theme:"system",setTheme:()=>null},ate=T.createContext(ote);function lte({children:n,defaultTheme:e="dark",storageKey:t="vite-ui-theme",...r}){const[i,s]=T.useState(e);T.useEffect(()=>{const a=window.document.documentElement;a.classList.remove("light","dark"),a.classList.add(i)},[i]);const o={theme:i,setTheme:a=>{localStorage.setItem(t,a),s(a)}};return C.jsx(ate.Provider,{...r,value:o,children:n})}const cte=new P9;FO(document.getElementById("root")).render(C.jsx(T.StrictMode,{children:C.jsx(O9,{client:cte,children:C.jsx(lte,{defaultTheme:"dark",storageKey:"vite-ui-theme",children:C.jsx(E6,{children:C.jsx($7,{children:C.jsx(oq,{children:C.jsx(qz,{children:C.jsx(T7,{children:C.jsx(b6,{children:C.jsx(VZ,{children:C.jsx(K7,{children:C.jsx(ste,{})})})})})})})})})})})}));export{Dt as $,qn as A,kc as B,Gn as C,Q0 as D,Hp as E,is as F,IZ as G,vh as H,fn as I,Jr as J,Js as K,hi as L,yt as M,Ii as N,as as O,Yo as P,Br as Q,Er as R,jZ as S,P3 as T,oo as U,F as V,yi as W,In as X,io as Y,Rn as Z,Fp as _,Hc as a,on as a0,sn as a1,Do as a2,Ai as a3,hte as a4,so as a5,rl as a6,c3 as a7,W7 as a8,l0 as a9,il as aA,_L as aB,SL as aC,Vu as aD,Vo as aE,ry as aF,Yh as aG,kM as aH,Nh as aI,Xv as aJ,fh as aK,Zl as aL,Ur as aM,Ih as aN,Lh as aO,Sc as aP,qh as aQ,Xh as aR,Qd as aS,ei as aT,Vr as aU,Yp as aV,w3 as aW,j8 as aX,Y7 as aa,ML as ab,CB as ac,RB as ad,AB as ae,xi as af,A1 as ag,$o as ah,YL as ai,ZL as aj,$L as ak,DL as al,yL as am,Id as an,rn as ao,_8 as ap,T8 as aq,ny as ar,no as as,Ph as at,UM as au,ii as av,xy as aw,Qt as ax,vL as ay,go as az,gl as b,Xf as c,k7 as d,z7 as e,yy as f,JX as g,$I as h,Ns as i,C as j,fte as k,ge as l,zn as m,_c as n,Wa as o,Bo as p,mo as q,T as r,BI as s,Dr as t,QM as u,jn as v,UL as w,Fe as x,Vh as y,Yd as z}; diff --git a/assets/index-DwhXMaNP.js b/assets/index-DwhXMaNP.js new file mode 100644 index 00000000..4cdb0fff --- /dev/null +++ b/assets/index-DwhXMaNP.js @@ -0,0 +1,4068 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/reactive-3iPiwwNw.js","assets/ground-DJZ6lP2l.js","assets/controls-tumpVwPC.js","assets/reactive-SpGdnhOu.js","assets/Noise-D5uvWl4i.js","assets/controls-ByeBQODT.js","assets/reactive-DD7TKsGV.js","assets/reactive-B8Cs-xx5.js","assets/controls-DogCyDae.js","assets/reactive-CeDCw1Du.js","assets/easing-BzOxJDJb.js","assets/reactive-BdX5JLG8.js","assets/controls-CwyAXsj5.js","assets/reactive-Csss5IX3.js","assets/reactive-BYTUQiod.js"])))=>i.map(i=>d[i]); +var SW=Object.defineProperty;var rR=t=>{throw TypeError(t)};var wW=(t,e,n)=>e in t?SW(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var ot=(t,e,n)=>wW(t,typeof e!="symbol"?e+"":e,n),kS=(t,e,n)=>e.has(t)||rR("Cannot "+n);var te=(t,e,n)=>(kS(t,e,"read from private field"),n?n.call(t):e.get(t)),Pt=(t,e,n)=>e.has(t)?rR("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),nt=(t,e,n,i)=>(kS(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),Zt=(t,e,n)=>(kS(t,e,"access private method"),n);var sv=(t,e,n,i)=>({set _(r){nt(t,e,r,n)},get _(){return te(t,e,i)}});function MW(t,e){for(var n=0;ni[r]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}})();function km(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var GN={exports:{}},ax={},jN={exports:{}},Xt={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Fm=Symbol.for("react.element"),EW=Symbol.for("react.portal"),bW=Symbol.for("react.fragment"),TW=Symbol.for("react.strict_mode"),AW=Symbol.for("react.profiler"),CW=Symbol.for("react.provider"),PW=Symbol.for("react.context"),RW=Symbol.for("react.forward_ref"),IW=Symbol.for("react.suspense"),LW=Symbol.for("react.memo"),DW=Symbol.for("react.lazy"),sR=Symbol.iterator;function NW(t){return t===null||typeof t!="object"?null:(t=sR&&t[sR]||t["@@iterator"],typeof t=="function"?t:null)}var XN={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},qN=Object.assign,$N={};function Nf(t,e,n){this.props=t,this.context=e,this.refs=$N,this.updater=n||XN}Nf.prototype.isReactComponent={};Nf.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Nf.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function YN(){}YN.prototype=Nf.prototype;function xb(t,e,n){this.props=t,this.context=e,this.refs=$N,this.updater=n||XN}var _b=xb.prototype=new YN;_b.constructor=xb;qN(_b,Nf.prototype);_b.isPureReactComponent=!0;var oR=Array.isArray,ZN=Object.prototype.hasOwnProperty,Sb={current:null},KN={key:!0,ref:!0,__self:!0,__source:!0};function QN(t,e,n){var i,r={},s=null,o=null;if(e!=null)for(i in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)ZN.call(e,i)&&!KN.hasOwnProperty(i)&&(r[i]=e[i]);var a=arguments.length-2;if(a===1)r.children=n;else if(1{var t;return navigator.platform.toLowerCase().startsWith("ip")?!0:((t=navigator.userAgent)==null?void 0:t.toLowerCase().startsWith("mac"))&&"ontouchend"in document},n3=()=>[Gn.SOUNDCLOUD,Gn.MICROPHONE,Gn.FILE_UPLOAD,Gn.SCREEN_SHARE],i3=()=>{console.log("Building audio...");const t=new Audio;return t.crossOrigin="anonymous",t},XW=t=>new Promise(function(e,n){const i=["mousedown","touchstart","touchend"];if(t.state==="suspended"&&"ontouchstart"in window){const r=function(){t.resume().then(function(){i.forEach(s=>{document.body.removeEventListener(s,r)}),e(!0)},function(s){n(s)})};i.forEach(s=>{document.body.addEventListener(s,r,!1)})}else e(!1)}),r3=()=>{console.log("Building audioCtx...");const t=new window.AudioContext;return t3()&&(console.log("Attempting to unlock AudioContext"),XW(t).then(function(e){console.log(e?"Successfully unlocked AudioContext!":"No need to unlock AudioContext.")},function(e){console.error(e)})),t},qW="modulepreload",$W=function(t){return"/r3f-audio-visualizer/"+t},lR={},wr=function(e,n,i){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(l=>{if(l=$W(l),l in lR)return;lR[l]=!0;const c=l.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":qW,c||(h.as="script"),h.crossOrigin="",h.href=l,a&&h.setAttribute("nonce",a),document.head.appendChild(h),c)return new Promise((p,g)=>{h.addEventListener("load",p),h.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${l}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return r.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},je={WAVE_FORM:"WAVE_FORM",NOISE:"NOISE",AUDIO:"AUDIO",AUDIO_SCOPE:"AUDIO_SCOPE",PARTICLE_NOISE:"PARTICLE_NOISE"},YW=t=>{switch(t){case je.WAVE_FORM:case je.NOISE:case je.PARTICLE_NOISE:return!1;case je.AUDIO:case je.AUDIO_SCOPE:return!0;default:return t}},ZW=()=>[je.WAVE_FORM,je.NOISE,je.AUDIO,je.PARTICLE_NOISE,je.AUDIO_SCOPE],KW=t=>{switch(t){case je.WAVE_FORM:case je.NOISE:case je.AUDIO:case je.PARTICLE_NOISE:return!0;case je.AUDIO_SCOPE:return!1;default:return t}};/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QW=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s3=(...t)=>t.filter((e,n,i)=>!!e&&i.indexOf(e)===n).join(" ");/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var JW={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eG=b.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:r="",children:s,iconNode:o,...a},l)=>b.createElement("svg",{ref:l,...JW,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:s3("lucide",r),...a},[...o.map(([c,d])=>b.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wn=(t,e)=>{const n=b.forwardRef(({className:i,...r},s)=>b.createElement(eG,{ref:s,iconNode:e,className:s3(`lucide-${QW(t)}`,i),...r}));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tG=wn("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nG=wn("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iG=wn("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rG=wn("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sG=wn("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oG=wn("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aG=wn("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lG=wn("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cG=wn("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uG=wn("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dG=wn("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fG=wn("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hG=wn("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pG=wn("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o3=wn("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mG=wn("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a3=wn("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gG=wn("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vG=wn("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yG=wn("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xG=wn("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l3=wn("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _G=wn("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SG=wn("Wind",[["path",{d:"M17.7 7.7a2.5 2.5 0 1 1 1.8 4.3H2",key:"1k4u03"}],["path",{d:"M9.6 4.6A2 2 0 1 1 11 8H2",key:"b7d0fd"}],["path",{d:"M12.6 19.4A2 2 0 1 0 14 16H2",key:"1p5cb3"}]]);/** + * @license lucide-react v0.445.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wG=wn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),MG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-W3VVQsKw.js"),[])),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},cR={id:"scope",icon:l3,ReactiveComponent:MG,ControlsComponent:null,supportedApplicationModes:[je.AUDIO_SCOPE]},EG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-3iPiwwNw.js"),__vite__mapDeps([0,1]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},bG=()=>{const t=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./controls-tumpVwPC.js"),__vite__mapDeps([2,0,1]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(t,{})})},uR={id:"cube",icon:nG,ReactiveComponent:EG,ControlsComponent:bG,supportedApplicationModes:[je.WAVE_FORM,je.NOISE,je.AUDIO]},TG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-SpGdnhOu.js"),__vite__mapDeps([3,1,4]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},AG=()=>{const t=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./controls-ByeBQODT.js"),__vite__mapDeps([5,3,1,4]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(t,{})})},dR={id:"diffusedRing",icon:oG,ReactiveComponent:TG,ControlsComponent:AG,supportedApplicationModes:[je.WAVE_FORM,je.NOISE,je.AUDIO]},CG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-DD7TKsGV.js"),__vite__mapDeps([6,4]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},fR={id:"dna",icon:cG,ReactiveComponent:CG,ControlsComponent:null,supportedApplicationModes:[je.WAVE_FORM,je.NOISE,je.AUDIO]},PG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-B8Cs-xx5.js"),__vite__mapDeps([7,1]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},RG=()=>{const t=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./controls-DogCyDae.js"),__vite__mapDeps([8,7,1]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(t,{})})},hR={id:"grid",icon:pG,ReactiveComponent:PG,ControlsComponent:RG,supportedApplicationModes:[je.WAVE_FORM,je.NOISE,je.AUDIO]},IG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-CeDCw1Du.js"),__vite__mapDeps([9,1,10]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},pR={id:"movingBoxes",icon:iG,ReactiveComponent:IG,ControlsComponent:null,supportedApplicationModes:[je.WAVE_FORM,je.NOISE,je.AUDIO]},LG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-BoTxrBvq.js"),[])),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},mR={id:"ribbons",icon:gG,ReactiveComponent:LG,ControlsComponent:null,supportedApplicationModes:[je.WAVE_FORM,je.NOISE,je.AUDIO]},DG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-BdX5JLG8.js"),__vite__mapDeps([11,1]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},NG=()=>{const t=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./controls-CwyAXsj5.js"),__vite__mapDeps([12,11,1]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(t,{})})},gR={id:"sphere",icon:hG,ReactiveComponent:DG,ControlsComponent:NG,supportedApplicationModes:[je.WAVE_FORM,je.NOISE,je.AUDIO]},OG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-Csss5IX3.js"),__vite__mapDeps([13,1]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},vR={id:"swarm",icon:uG,ReactiveComponent:OG,ControlsComponent:null,supportedApplicationModes:[je.PARTICLE_NOISE]},kG=t=>{const e=b.useMemo(()=>b.lazy(async()=>await wr(()=>import("./reactive-BYTUQiod.js"),__vite__mapDeps([14,10]))),[]);return P.jsx(b.Suspense,{fallback:null,children:P.jsx(e,{...t})})},yR={id:"treadmill",icon:fG,ReactiveComponent:kG,ControlsComponent:null,supportedApplicationModes:[je.WAVE_FORM,je.NOISE,je.AUDIO]},I0={[cR.id]:cR,[hR.id]:hR,[uR.id]:uR,[gR.id]:gR,[dR.id]:dR,[fR.id]:fR,[pR.id]:pR,[mR.id]:mR,[yR.id]:yR,[vR.id]:vR},FG={BASE_URL:"/r3f-audio-visualizer/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},xR=t=>{let e;const n=new Set,i=(d,h)=>{const p=typeof d=="function"?d(e):d;if(!Object.is(p,e)){const g=e;e=h??(typeof p!="object"||p===null)?p:Object.assign({},e,p),n.forEach(v=>v(e,g))}},r=()=>e,l={setState:i,getState:r,getInitialState:()=>c,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(FG?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=e=t(i,r,l);return l},UG=t=>t?xR(t):xR;var c3={exports:{}},u3={},d3={exports:{}},f3={};/** + * @license React + * use-sync-external-store-shim.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var af=b;function zG(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var BG=typeof Object.is=="function"?Object.is:zG,VG=af.useState,HG=af.useEffect,WG=af.useLayoutEffect,GG=af.useDebugValue;function jG(t,e){var n=e(),i=VG({inst:{value:n,getSnapshot:e}}),r=i[0].inst,s=i[1];return WG(function(){r.value=n,r.getSnapshot=e,US(r)&&s({inst:r})},[t,n,e]),HG(function(){return US(r)&&s({inst:r}),t(function(){US(r)&&s({inst:r})})},[t]),GG(n),n}function US(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!BG(t,n)}catch{return!0}}function XG(t,e){return e()}var qG=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?XG:jG;f3.useSyncExternalStore=af.useSyncExternalStore!==void 0?af.useSyncExternalStore:qG;d3.exports=f3;var $G=d3.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var lx=b,YG=$G;function ZG(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var KG=typeof Object.is=="function"?Object.is:ZG,QG=YG.useSyncExternalStore,JG=lx.useRef,ej=lx.useEffect,tj=lx.useMemo,nj=lx.useDebugValue;u3.useSyncExternalStoreWithSelector=function(t,e,n,i,r){var s=JG(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=tj(function(){function l(g){if(!c){if(c=!0,d=g,g=i(g),r!==void 0&&o.hasValue){var v=o.value;if(r(v,g))return h=v}return h=g}if(v=h,KG(d,g))return v;var _=i(g);return r!==void 0&&r(v,_)?v:(d=g,h=_)}var c=!1,d,h,p=n===void 0?null:n;return[function(){return l(e())},p===null?void 0:function(){return l(p())}]},[e,n,i,r]);var a=QG(t,s[0],s[1]);return ej(function(){o.hasValue=!0,o.value=a},[a]),nj(a),a};c3.exports=u3;var ij=c3.exports;const rj=km(ij),h3={BASE_URL:"/r3f-audio-visualizer/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},{useDebugValue:sj}=Xo,{useSyncExternalStoreWithSelector:oj}=rj;let _R=!1;const aj=t=>t;function lj(t,e=aj,n){(h3?"production":void 0)!=="production"&&n&&!_R&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),_R=!0);const i=oj(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return sj(i),i}const SR=t=>{(h3?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?UG(t):t,n=(i,r)=>lj(e,i,r);return Object.assign(n,e),n},Mb=t=>t?SR(t):SR;/** + * @license + * Copyright 2010-2023 Three.js Authors + * SPDX-License-Identifier: MIT + */const cx="161",fc={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},hc={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},p3=0,I1=1,m3=2,cj=3,g3=0,ux=1,np=2,ws=3,ua=0,ir=1,oo=2,ra=0,zc=1,L1=2,D1=3,N1=4,v3=5,qa=100,y3=101,x3=102,O1=103,k1=104,_3=200,S3=201,w3=202,M3=203,ny=204,iy=205,E3=206,b3=207,T3=208,A3=209,C3=210,P3=211,R3=212,I3=213,L3=214,D3=0,N3=1,O3=2,Mp=3,k3=4,F3=5,U3=6,z3=7,Um=0,B3=1,V3=2,fo=0,H3=1,W3=2,G3=3,Eb=4,j3=5,X3=6,F1="attached",q3="detached",dx=300,da=301,xl=302,Ep=303,bp=304,Of=306,Tp=1e3,Vi=1001,Ap=1002,$n=1003,ry=1004,uj=1004,_c=1005,dj=1005,Pn=1006,ip=1007,fj=1007,co=1008,hj=1008,ho=1009,$3=1010,Y3=1011,fx=1012,bb=1013,Ko=1014,cs=1015,lf=1016,Tb=1017,Ab=1018,ol=1020,Z3=1021,Hi=1023,K3=1024,Q3=1025,al=1026,Yc=1027,J3=1028,Cb=1029,eO=1030,Pb=1031,Rb=1033,L0=33776,D0=33777,N0=33778,O0=33779,U1=35840,z1=35841,B1=35842,V1=35843,Ib=36196,H1=37492,W1=37496,G1=37808,j1=37809,X1=37810,q1=37811,$1=37812,Y1=37813,Z1=37814,K1=37815,Q1=37816,J1=37817,eM=37818,tM=37819,nM=37820,iM=37821,k0=36492,rM=36494,sM=36495,tO=36283,oM=36284,aM=36285,lM=36286,nO=2200,iO=2201,rO=2202,Cp=2300,Pp=2301,F0=2302,wc=2400,Mc=2401,Rp=2402,hx=2500,Lb=2501,pj=0,mj=1,gj=2,Db=3e3,ll=3001,sO=3200,oO=3201,Nl=0,aO=1,Nr="",Vn="srgb",vr="srgb-linear",px="display-p3",zm="display-p3-linear",Ip="linear",mn="srgb",Lp="rec709",Dp="p3",vj=0,pc=7680,yj=7681,xj=7682,_j=7683,Sj=34055,wj=34056,Mj=5386,Ej=512,bj=513,Tj=514,Aj=515,Cj=516,Pj=517,Rj=518,cM=519,lO=512,cO=513,uO=514,Nb=515,dO=516,fO=517,hO=518,pO=519,Np=35044,Ij=35048,Lj=35040,Dj=35045,Nj=35049,Oj=35041,kj=35046,Fj=35050,Uj=35042,zj="100",uM="300 es",sy=1035,uo=2e3,Op=2001;class bo{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(n)===-1&&i[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(n);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,o=r.length;s>8&255]+Di[t>>16&255]+Di[t>>24&255]+"-"+Di[e&255]+Di[e>>8&255]+"-"+Di[e>>16&15|64]+Di[e>>24&255]+"-"+Di[n&63|128]+Di[n>>8&255]+"-"+Di[n>>16&255]+Di[n>>24&255]+Di[i&255]+Di[i>>8&255]+Di[i>>16&255]+Di[i>>24&255]).toLowerCase()}function Hn(t,e,n){return Math.max(e,Math.min(n,t))}function Ob(t,e){return(t%e+e)%e}function Bj(t,e,n,i,r){return i+(t-e)*(r-i)/(n-e)}function Vj(t,e,n){return t!==e?(n-t)/(e-t):0}function rp(t,e,n){return(1-n)*t+n*e}function Hj(t,e,n,i){return rp(t,e,1-Math.exp(-n*i))}function Wj(t,e=1){return e-Math.abs(Ob(t,e*2)-e)}function Gj(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function jj(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Xj(t,e){return t+Math.floor(Math.random()*(e-t+1))}function qj(t,e){return t+Math.random()*(e-t)}function $j(t){return t*(.5-Math.random())}function Yj(t){t!==void 0&&(wR=t);let e=wR+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Zj(t){return t*Bc}function Kj(t){return t*cf}function dM(t){return(t&t-1)===0&&t!==0}function Qj(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function oy(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Jj(t,e,n,i,r){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+i)/2),d=o((e+i)/2),h=s((e-i)/2),p=o((e-i)/2),g=s((i-e)/2),v=o((i-e)/2);switch(r){case"XYX":t.set(a*d,l*h,l*p,a*c);break;case"YZY":t.set(l*p,a*d,l*h,a*c);break;case"ZXZ":t.set(l*h,l*p,a*d,a*c);break;case"XZX":t.set(a*d,l*v,l*g,a*c);break;case"YXY":t.set(l*g,a*d,l*v,a*c);break;case"ZYZ":t.set(l*v,l*g,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function nr(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Dt(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const mO={DEG2RAD:Bc,RAD2DEG:cf,generateUUID:Fr,clamp:Hn,euclideanModulo:Ob,mapLinear:Bj,inverseLerp:Vj,lerp:rp,damp:Hj,pingpong:Wj,smoothstep:Gj,smootherstep:jj,randInt:Xj,randFloat:qj,randFloatSpread:$j,seededRandom:Yj,degToRad:Zj,radToDeg:Kj,isPowerOfTwo:dM,ceilPowerOfTwo:Qj,floorPowerOfTwo:oy,setQuaternionFromProperEuler:Jj,normalize:Dt,denormalize:nr};class ye{constructor(e=0,n=0){ye.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,i=this.y,r=e.elements;return this.x=r[0]*n+r[3]*i+r[6],this.y=r[1]*n+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Hn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y;return n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const i=Math.cos(n),r=Math.sin(n),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Bt{constructor(e,n,i,r,s,o,a,l,c){Bt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,i,r,s,o,a,l,c)}set(e,n,i,r,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=r,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=i,d[7]=o,d[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],this}extractBasis(e,n,i){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],d=i[4],h=i[7],p=i[2],g=i[5],v=i[8],_=r[0],y=r[3],m=r[6],w=r[1],S=r[4],E=r[7],C=r[2],R=r[5],I=r[8];return s[0]=o*_+a*w+l*C,s[3]=o*y+a*S+l*R,s[6]=o*m+a*E+l*I,s[1]=c*_+d*w+h*C,s[4]=c*y+d*S+h*R,s[7]=c*m+d*E+h*I,s[2]=p*_+g*w+v*C,s[5]=p*y+g*S+v*R,s[8]=p*m+g*E+v*I,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8];return n*o*d-n*a*c-i*s*d+i*a*l+r*s*c-r*o*l}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=d*o-a*c,p=a*l-d*s,g=c*s-o*l,v=n*h+i*p+r*g;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const _=1/v;return e[0]=h*_,e[1]=(r*c-d*i)*_,e[2]=(a*i-r*o)*_,e[3]=p*_,e[4]=(d*n-r*l)*_,e[5]=(r*s-a*n)*_,e[6]=g*_,e[7]=(i*l-c*n)*_,e[8]=(o*n-i*s)*_,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,i,r,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-r*c,r*l,-r*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(zS.makeScale(e,n)),this}rotate(e){return this.premultiply(zS.makeRotation(-e)),this}translate(e,n){return this.premultiply(zS.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,i,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<9;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<9;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const zS=new Bt;function gO(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const e8={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ud(t,e){return new e8[t](e)}function kp(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function vO(){const t=kp("canvas");return t.style.display="block",t}const MR={};function Vc(t){t in MR||(MR[t]=!0,console.warn(t))}const ER=new Bt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),bR=new Bt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),av={[vr]:{transfer:Ip,primaries:Lp,toReference:t=>t,fromReference:t=>t},[Vn]:{transfer:mn,primaries:Lp,toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[zm]:{transfer:Ip,primaries:Dp,toReference:t=>t.applyMatrix3(bR),fromReference:t=>t.applyMatrix3(ER)},[px]:{transfer:mn,primaries:Dp,toReference:t=>t.convertSRGBToLinear().applyMatrix3(bR),fromReference:t=>t.applyMatrix3(ER).convertLinearToSRGB()}},t8=new Set([vr,zm]),ln={enabled:!0,_workingColorSpace:vr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!t8.has(t))throw new Error(`Unsupported working color space, "${t}".`);this._workingColorSpace=t},convert:function(t,e,n){if(this.enabled===!1||e===n||!e||!n)return t;const i=av[e].toReference,r=av[n].fromReference;return r(i(t))},fromWorkingColorSpace:function(t,e){return this.convert(t,this._workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this._workingColorSpace)},getPrimaries:function(t){return av[t].primaries},getTransfer:function(t){return t===Nr?Ip:av[t].transfer}};function Nd(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function BS(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Nu;class kb{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Nu===void 0&&(Nu=kp("canvas")),Nu.width=e.width,Nu.height=e.height;const i=Nu.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=Nu}return n.width>2048||n.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),n.toDataURL("image/jpeg",.6)):n.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=kp("canvas");n.width=e.width,n.height=e.height;const i=n.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o0&&(i.userData=this.userData),n||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==dx)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Tp:e.x=e.x-Math.floor(e.x);break;case Vi:e.x=e.x<0?0:1;break;case Ap:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Tp:e.y=e.y-Math.floor(e.y);break;case Vi:e.y=e.y<0?0:1;break;case Ap:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return Vc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Vn?ll:Db}set encoding(e){Vc("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===ll?Vn:Nr}}Ln.DEFAULT_IMAGE=null;Ln.DEFAULT_MAPPING=dx;Ln.DEFAULT_ANISOTROPY=1;class cn{constructor(e=0,n=0,i=0,r=1){cn.prototype.isVector4=!0,this.x=e,this.y=n,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,i,r){return this.x=e,this.y=n,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*n+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*n+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*n+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,i,r,s;const l=e.elements,c=l[0],d=l[4],h=l[8],p=l[1],g=l[5],v=l[9],_=l[2],y=l[6],m=l[10];if(Math.abs(d-p)<.01&&Math.abs(h-_)<.01&&Math.abs(v-y)<.01){if(Math.abs(d+p)<.1&&Math.abs(h+_)<.1&&Math.abs(v+y)<.1&&Math.abs(c+g+m-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const S=(c+1)/2,E=(g+1)/2,C=(m+1)/2,R=(d+p)/4,I=(h+_)/4,N=(v+y)/4;return S>E&&S>C?S<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(S),r=R/i,s=I/i):E>C?E<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),i=R/r,s=N/r):C<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(C),i=I/s,r=N/s),this.set(i,r,s,n),this}let w=Math.sqrt((y-v)*(y-v)+(h-_)*(h-_)+(p-d)*(p-d));return Math.abs(w)<.001&&(w=1),this.x=(y-v)/w,this.y=(h-_)/w,this.z=(p-d)/w,this.w=Math.acos((c+g+m-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this.w=Math.max(e.w,Math.min(n.w,this.w)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this.w=Math.max(e,Math.min(n,this.w)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this.w=e.w+(n.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class yO extends bo{constructor(e=1,n=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new cn(0,0,e,n),this.scissorTest=!1,this.viewport=new cn(0,0,e,n);const r={width:e,height:n,depth:1};i.encoding!==void 0&&(Vc("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===ll?Vn:Nr),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Pn,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},i),this.texture=new Ln(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps,this.texture.internalFormat=i.internalFormat,this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}setSize(e,n,i=1){(this.width!==e||this.height!==n||this.depth!==i)&&(this.width=e,this.height=n,this.depth=i,this.texture.image.width=e,this.texture.image.height=n,this.texture.image.depth=i,this.dispose()),this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const n=Object.assign({},e.texture.image);return this.texture.source=new Ec(n),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ds extends yO{constructor(e=1,n=1,i={}){super(e,n,i),this.isWebGLRenderTarget=!0}}class mx extends Ln{constructor(e=null,n=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=$n,this.minFilter=$n,this.wrapR=Vi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class r8 extends Ds{constructor(e=1,n=1,i=1,r={}){super(e,n,r),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new mx(null,e,n,i),this.texture.isRenderTargetTexture=!0}}class Fb extends Ln{constructor(e=null,n=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:i,depth:r},this.magFilter=$n,this.minFilter=$n,this.wrapR=Vi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class s8 extends Ds{constructor(e=1,n=1,i=1,r={}){super(e,n,r),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Fb(null,e,n,i),this.texture.isRenderTargetTexture=!0}}class o8 extends Ds{constructor(e=1,n=1,i=1,r={}){super(e,n,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,S=1-m*m;if(S>Number.EPSILON){const C=Math.sqrt(S),R=Math.atan2(C,m*w);y=Math.sin(y*R)/C,a=Math.sin(a*R)/C}const E=a*w;if(l=l*y+p*E,c=c*y+g*E,d=d*y+v*E,h=h*y+_*E,y===1-a){const C=1/Math.sqrt(l*l+c*c+d*d+h*h);l*=C,c*=C,d*=C,h*=C}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=h}static multiplyQuaternionsFlat(e,n,i,r,s,o){const a=i[r],l=i[r+1],c=i[r+2],d=i[r+3],h=s[o],p=s[o+1],g=s[o+2],v=s[o+3];return e[n]=a*v+d*h+l*g-c*p,e[n+1]=l*v+d*p+c*h-a*g,e[n+2]=c*v+d*g+a*p-l*h,e[n+3]=d*v-a*h-l*p-c*g,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,i,r){return this._x=e,this._y=n,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),d=a(r/2),h=a(s/2),p=l(i/2),g=l(r/2),v=l(s/2);switch(o){case"XYZ":this._x=p*d*h+c*g*v,this._y=c*g*h-p*d*v,this._z=c*d*v+p*g*h,this._w=c*d*h-p*g*v;break;case"YXZ":this._x=p*d*h+c*g*v,this._y=c*g*h-p*d*v,this._z=c*d*v-p*g*h,this._w=c*d*h+p*g*v;break;case"ZXY":this._x=p*d*h-c*g*v,this._y=c*g*h+p*d*v,this._z=c*d*v+p*g*h,this._w=c*d*h-p*g*v;break;case"ZYX":this._x=p*d*h-c*g*v,this._y=c*g*h+p*d*v,this._z=c*d*v-p*g*h,this._w=c*d*h+p*g*v;break;case"YZX":this._x=p*d*h+c*g*v,this._y=c*g*h+p*d*v,this._z=c*d*v-p*g*h,this._w=c*d*h-p*g*v;break;case"XZY":this._x=p*d*h-c*g*v,this._y=c*g*h-p*d*v,this._z=c*d*v+p*g*h,this._w=c*d*h+p*g*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const i=n/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,i=n[0],r=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],h=n[10],p=i+a+h;if(p>0){const g=.5/Math.sqrt(p+1);this._w=.25/g,this._x=(d-l)*g,this._y=(s-c)*g,this._z=(o-r)*g}else if(i>a&&i>h){const g=2*Math.sqrt(1+i-a-h);this._w=(d-l)/g,this._x=.25*g,this._y=(r+o)/g,this._z=(s+c)/g}else if(a>h){const g=2*Math.sqrt(1+a-i-h);this._w=(s-c)/g,this._x=(r+o)/g,this._y=.25*g,this._z=(l+d)/g}else{const g=2*Math.sqrt(1+h-i-a);this._w=(o-r)/g,this._x=(s+c)/g,this._y=(l+d)/g,this._z=.25*g}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let i=e.dot(n)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Hn(this.dot(e),-1,1)))}rotateTowards(e,n){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,n/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const i=e._x,r=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=i*d+o*a+r*c-s*l,this._y=r*d+o*l+s*a-i*c,this._z=s*d+o*c+i*l-r*a,this._w=o*d-i*a-r*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,o=this._w;let a=o*e._w+i*e._x+r*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=r,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const g=1-n;return this._w=g*o+n*this._w,this._x=g*i+n*this._x,this._y=g*r+n*this._y,this._z=g*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),h=Math.sin((1-n)*d)/c,p=Math.sin(n*d)/c;return this._w=o*h+this._w*p,this._x=i*h+this._x*p,this._y=r*h+this._y*p,this._z=s*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,n,i){return this.copy(e).slerp(n,i)}random(){const e=Math.random(),n=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(n*Math.cos(r),i*Math.sin(s),i*Math.cos(s),n*Math.sin(r))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class B{constructor(e=0,n=0,i=0){B.prototype.isVector3=!0,this.x=e,this.y=n,this.z=i}set(e,n,i){return i===void 0&&(i=this.z),this.x=e,this.y=n,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(TR.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(TR.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[3]*i+s[6]*r,this.y=s[1]*n+s[4]*i+s[7]*r,this.z=s[2]*n+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*n+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*n+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*n+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*n+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){const n=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*r-a*i),d=2*(a*n-s*r),h=2*(s*i-o*n);return this.x=n+l*c+o*h-a*d,this.y=i+l*d+a*c-s*h,this.z=r+l*h+s*d-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*n+s[4]*i+s[8]*r,this.y=s[1]*n+s[5]*i+s[9]*r,this.z=s[2]*n+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Math.max(e.x,Math.min(n.x,this.x)),this.y=Math.max(e.y,Math.min(n.y,this.y)),this.z=Math.max(e.z,Math.min(n.z,this.z)),this}clampScalar(e,n){return this.x=Math.max(e,Math.min(n,this.x)),this.y=Math.max(e,Math.min(n,this.y)),this.z=Math.max(e,Math.min(n,this.z)),this}clampLength(e,n){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(n,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,i){return this.x=e.x+(n.x-e.x)*i,this.y=e.y+(n.y-e.y)*i,this.z=e.z+(n.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const i=e.x,r=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=r*l-s*a,this.y=s*o-i*l,this.z=i*a-r*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const i=e.dot(this)/n;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return HS.copy(this).projectOnVector(e),this.sub(HS)}reflect(e){return this.sub(HS.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const i=this.dot(e)/n;return Math.acos(Hn(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return n*n+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,i){const r=Math.sin(n)*e;return this.x=r*Math.sin(i),this.y=Math.cos(n)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,i){return this.x=e*Math.sin(n),this.y=i,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=i,this.z=r,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,n=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(n),this.y=i*Math.sin(n),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const HS=new B,TR=new Wi;class rr{constructor(e=new B(1/0,1/0,1/0),n=new B(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,i=e.length;nthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,vs),vs.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,i;return e.normal.x>0?(n=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),n<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(xh),cv.subVectors(this.max,xh),Ou.subVectors(e.a,xh),ku.subVectors(e.b,xh),Fu.subVectors(e.c,xh),Ia.subVectors(ku,Ou),La.subVectors(Fu,ku),tc.subVectors(Ou,Fu);let n=[0,-Ia.z,Ia.y,0,-La.z,La.y,0,-tc.z,tc.y,Ia.z,0,-Ia.x,La.z,0,-La.x,tc.z,0,-tc.x,-Ia.y,Ia.x,0,-La.y,La.x,0,-tc.y,tc.x,0];return!WS(n,Ou,ku,Fu,cv)||(n=[1,0,0,0,1,0,0,0,1],!WS(n,Ou,ku,Fu,cv))?!1:(uv.crossVectors(Ia,La),n=[uv.x,uv.y,uv.z],WS(n,Ou,ku,Fu,cv))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,vs).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(vs).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ko[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ko[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ko[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ko[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ko[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ko[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ko[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ko[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ko),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ko=[new B,new B,new B,new B,new B,new B,new B,new B],vs=new B,lv=new rr,Ou=new B,ku=new B,Fu=new B,Ia=new B,La=new B,tc=new B,xh=new B,cv=new B,uv=new B,nc=new B;function WS(t,e,n,i,r){for(let s=0,o=t.length-3;s<=o;s+=3){nc.fromArray(t,s);const a=r.x*Math.abs(nc.x)+r.y*Math.abs(nc.y)+r.z*Math.abs(nc.z),l=e.dot(nc),c=n.dot(nc),d=i.dot(nc);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const a8=new rr,_h=new B,GS=new B;class Gi{constructor(e=new B,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const i=this.center;n!==void 0?i.copy(n):a8.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;_h.subVectors(e,this.center);const n=_h.lengthSq();if(n>this.radius*this.radius){const i=Math.sqrt(n),r=(i-this.radius)*.5;this.center.addScaledVector(_h,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(GS.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(_h.copy(e.center).add(GS)),this.expandByPoint(_h.copy(e.center).sub(GS))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Fo=new B,jS=new B,dv=new B,Da=new B,XS=new B,fv=new B,qS=new B;class uu{constructor(e=new B,n=new B(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Fo)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const i=n.dot(this.direction);return i<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Fo.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Fo.copy(this.origin).addScaledVector(this.direction,n),Fo.distanceToSquared(e))}distanceSqToSegment(e,n,i,r){jS.copy(e).add(n).multiplyScalar(.5),dv.copy(n).sub(e).normalize(),Da.copy(this.origin).sub(jS);const s=e.distanceTo(n)*.5,o=-this.direction.dot(dv),a=Da.dot(this.direction),l=-Da.dot(dv),c=Da.lengthSq(),d=Math.abs(1-o*o);let h,p,g,v;if(d>0)if(h=o*l-a,p=o*a-l,v=s*d,h>=0)if(p>=-v)if(p<=v){const _=1/d;h*=_,p*=_,g=h*(h+o*p+2*a)+p*(o*h+p+2*l)+c}else p=s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+c;else p=-s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+c;else p<=-v?(h=Math.max(0,-(-o*s+a)),p=h>0?-s:Math.min(Math.max(-s,-l),s),g=-h*h+p*(p+2*l)+c):p<=v?(h=0,p=Math.min(Math.max(-s,-l),s),g=p*(p+2*l)+c):(h=Math.max(0,-(o*s+a)),p=h>0?s:Math.min(Math.max(-s,-l),s),g=-h*h+p*(p+2*l)+c);else p=o>0?-s:s,h=Math.max(0,-(o*p+a)),g=-h*h+p*(p+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(jS).addScaledVector(dv,p),g}intersectSphere(e,n){Fo.subVectors(e.center,this.origin);const i=Fo.dot(this.direction),r=Fo.dot(Fo)-i*i,s=e.radius*e.radius;if(r>s)return null;const o=Math.sqrt(s-r),a=i-o,l=i+o;return l<0?null:a<0?this.at(l,n):this.at(a,n)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/n;return i>=0?i:null}intersectPlane(e,n){const i=this.distanceToPlane(e);return i===null?null:this.at(i,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let i,r,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,h=1/this.direction.z,p=this.origin;return c>=0?(i=(e.min.x-p.x)*c,r=(e.max.x-p.x)*c):(i=(e.max.x-p.x)*c,r=(e.min.x-p.x)*c),d>=0?(s=(e.min.y-p.y)*d,o=(e.max.y-p.y)*d):(s=(e.max.y-p.y)*d,o=(e.min.y-p.y)*d),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o=0?(a=(e.min.z-p.z)*h,l=(e.max.z-p.z)*h):(a=(e.max.z-p.z)*h,l=(e.min.z-p.z)*h),i>l||a>r)||((a>i||i!==i)&&(i=a),(l=0?i:r,n)}intersectsBox(e){return this.intersectBox(e,Fo)!==null}intersectTriangle(e,n,i,r,s){XS.subVectors(n,e),fv.subVectors(i,e),qS.crossVectors(XS,fv);let o=this.direction.dot(qS),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Da.subVectors(this.origin,e);const l=a*this.direction.dot(fv.crossVectors(Da,fv));if(l<0)return null;const c=a*this.direction.dot(XS.cross(Da));if(c<0||l+c>o)return null;const d=-a*Da.dot(qS);return d<0?null:this.at(d/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Et{constructor(e,n,i,r,s,o,a,l,c,d,h,p,g,v,_,y){Et.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,i,r,s,o,a,l,c,d,h,p,g,v,_,y)}set(e,n,i,r,s,o,a,l,c,d,h,p,g,v,_,y){const m=this.elements;return m[0]=e,m[4]=n,m[8]=i,m[12]=r,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=c,m[6]=d,m[10]=h,m[14]=p,m[3]=g,m[7]=v,m[11]=_,m[15]=y,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Et().fromArray(this.elements)}copy(e){const n=this.elements,i=e.elements;return n[0]=i[0],n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[5]=i[5],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[10]=i[10],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14],n[15]=i[15],this}copyPosition(e){const n=this.elements,i=e.elements;return n[12]=i[12],n[13]=i[13],n[14]=i[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,i){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,n,i){return this.set(e.x,n.x,i.x,0,e.y,n.y,i.y,0,e.z,n.z,i.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,i=e.elements,r=1/Uu.setFromMatrixColumn(e,0).length(),s=1/Uu.setFromMatrixColumn(e,1).length(),o=1/Uu.setFromMatrixColumn(e,2).length();return n[0]=i[0]*r,n[1]=i[1]*r,n[2]=i[2]*r,n[3]=0,n[4]=i[4]*s,n[5]=i[5]*s,n[6]=i[6]*s,n[7]=0,n[8]=i[8]*o,n[9]=i[9]*o,n[10]=i[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(r),c=Math.sin(r),d=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const p=o*d,g=o*h,v=a*d,_=a*h;n[0]=l*d,n[4]=-l*h,n[8]=c,n[1]=g+v*c,n[5]=p-_*c,n[9]=-a*l,n[2]=_-p*c,n[6]=v+g*c,n[10]=o*l}else if(e.order==="YXZ"){const p=l*d,g=l*h,v=c*d,_=c*h;n[0]=p+_*a,n[4]=v*a-g,n[8]=o*c,n[1]=o*h,n[5]=o*d,n[9]=-a,n[2]=g*a-v,n[6]=_+p*a,n[10]=o*l}else if(e.order==="ZXY"){const p=l*d,g=l*h,v=c*d,_=c*h;n[0]=p-_*a,n[4]=-o*h,n[8]=v+g*a,n[1]=g+v*a,n[5]=o*d,n[9]=_-p*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const p=o*d,g=o*h,v=a*d,_=a*h;n[0]=l*d,n[4]=v*c-g,n[8]=p*c+_,n[1]=l*h,n[5]=_*c+p,n[9]=g*c-v,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const p=o*l,g=o*c,v=a*l,_=a*c;n[0]=l*d,n[4]=_-p*h,n[8]=v*h+g,n[1]=h,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=g*h+v,n[10]=p-_*h}else if(e.order==="XZY"){const p=o*l,g=o*c,v=a*l,_=a*c;n[0]=l*d,n[4]=-h,n[8]=c*d,n[1]=p*h+_,n[5]=o*d,n[9]=g*h-v,n[2]=v*h-g,n[6]=a*d,n[10]=_*h+p}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(l8,e,c8)}lookAt(e,n,i){const r=this.elements;return Pr.subVectors(e,n),Pr.lengthSq()===0&&(Pr.z=1),Pr.normalize(),Na.crossVectors(i,Pr),Na.lengthSq()===0&&(Math.abs(i.z)===1?Pr.x+=1e-4:Pr.z+=1e-4,Pr.normalize(),Na.crossVectors(i,Pr)),Na.normalize(),hv.crossVectors(Pr,Na),r[0]=Na.x,r[4]=hv.x,r[8]=Pr.x,r[1]=Na.y,r[5]=hv.y,r[9]=Pr.y,r[2]=Na.z,r[6]=hv.z,r[10]=Pr.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const i=e.elements,r=n.elements,s=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],d=i[1],h=i[5],p=i[9],g=i[13],v=i[2],_=i[6],y=i[10],m=i[14],w=i[3],S=i[7],E=i[11],C=i[15],R=r[0],I=r[4],N=r[8],F=r[12],A=r[1],D=r[5],j=r[9],K=r[13],V=r[2],Z=r[6],Y=r[10],J=r[14],k=r[3],W=r[7],$=r[11],Q=r[15];return s[0]=o*R+a*A+l*V+c*k,s[4]=o*I+a*D+l*Z+c*W,s[8]=o*N+a*j+l*Y+c*$,s[12]=o*F+a*K+l*J+c*Q,s[1]=d*R+h*A+p*V+g*k,s[5]=d*I+h*D+p*Z+g*W,s[9]=d*N+h*j+p*Y+g*$,s[13]=d*F+h*K+p*J+g*Q,s[2]=v*R+_*A+y*V+m*k,s[6]=v*I+_*D+y*Z+m*W,s[10]=v*N+_*j+y*Y+m*$,s[14]=v*F+_*K+y*J+m*Q,s[3]=w*R+S*A+E*V+C*k,s[7]=w*I+S*D+E*Z+C*W,s[11]=w*N+S*j+E*Y+C*$,s[15]=w*F+S*K+E*J+C*Q,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],h=e[6],p=e[10],g=e[14],v=e[3],_=e[7],y=e[11],m=e[15];return v*(+s*l*h-r*c*h-s*a*p+i*c*p+r*a*g-i*l*g)+_*(+n*l*g-n*c*p+s*o*p-r*o*g+r*c*d-s*l*d)+y*(+n*c*h-n*a*g-s*o*h+i*o*g+s*a*d-i*c*d)+m*(-r*a*d-n*l*h+n*a*p+r*o*h-i*o*p+i*l*d)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=n,r[14]=i),this}invert(){const e=this.elements,n=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],h=e[9],p=e[10],g=e[11],v=e[12],_=e[13],y=e[14],m=e[15],w=h*y*c-_*p*c+_*l*g-a*y*g-h*l*m+a*p*m,S=v*p*c-d*y*c-v*l*g+o*y*g+d*l*m-o*p*m,E=d*_*c-v*h*c+v*a*g-o*_*g-d*a*m+o*h*m,C=v*h*l-d*_*l-v*a*p+o*_*p+d*a*y-o*h*y,R=n*w+i*S+r*E+s*C;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const I=1/R;return e[0]=w*I,e[1]=(_*p*s-h*y*s-_*r*g+i*y*g+h*r*m-i*p*m)*I,e[2]=(a*y*s-_*l*s+_*r*c-i*y*c-a*r*m+i*l*m)*I,e[3]=(h*l*s-a*p*s-h*r*c+i*p*c+a*r*g-i*l*g)*I,e[4]=S*I,e[5]=(d*y*s-v*p*s+v*r*g-n*y*g-d*r*m+n*p*m)*I,e[6]=(v*l*s-o*y*s-v*r*c+n*y*c+o*r*m-n*l*m)*I,e[7]=(o*p*s-d*l*s+d*r*c-n*p*c-o*r*g+n*l*g)*I,e[8]=E*I,e[9]=(v*h*s-d*_*s-v*i*g+n*_*g+d*i*m-n*h*m)*I,e[10]=(o*_*s-v*a*s+v*i*c-n*_*c-o*i*m+n*a*m)*I,e[11]=(d*a*s-o*h*s-d*i*c+n*h*c+o*i*g-n*a*g)*I,e[12]=C*I,e[13]=(d*_*r-v*h*r+v*i*p-n*_*p-d*i*y+n*h*y)*I,e[14]=(v*a*r-o*_*r-v*i*l+n*_*l+o*i*y-n*a*y)*I,e[15]=(o*h*r-d*a*r+d*i*l-n*h*l-o*i*p+n*a*p)*I,this}scale(e){const n=this.elements,i=e.x,r=e.y,s=e.z;return n[0]*=i,n[4]*=r,n[8]*=s,n[1]*=i,n[5]*=r,n[9]*=s,n[2]*=i,n[6]*=r,n[10]*=s,n[3]*=i,n[7]*=r,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,i,r))}makeTranslation(e,n,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,i,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,n,-i,0,0,i,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,0,i,0,0,1,0,0,-i,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),i=Math.sin(e);return this.set(n,-i,0,0,i,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const i=Math.cos(n),r=Math.sin(n),s=1-i,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+i,c*a-r*l,c*l+r*a,0,c*a+r*l,d*a+i,d*l-r*o,0,c*l-r*a,d*l+r*o,s*l*l+i,0,0,0,0,1),this}makeScale(e,n,i){return this.set(e,0,0,0,0,n,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,n,i,r,s,o){return this.set(1,i,s,0,e,1,o,0,n,r,1,0,0,0,0,1),this}compose(e,n,i){const r=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,h=a+a,p=s*c,g=s*d,v=s*h,_=o*d,y=o*h,m=a*h,w=l*c,S=l*d,E=l*h,C=i.x,R=i.y,I=i.z;return r[0]=(1-(_+m))*C,r[1]=(g+E)*C,r[2]=(v-S)*C,r[3]=0,r[4]=(g-E)*R,r[5]=(1-(p+m))*R,r[6]=(y+w)*R,r[7]=0,r[8]=(v+S)*I,r[9]=(y-w)*I,r[10]=(1-(p+_))*I,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,n,i){const r=this.elements;let s=Uu.set(r[0],r[1],r[2]).length();const o=Uu.set(r[4],r[5],r[6]).length(),a=Uu.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],ys.copy(this);const c=1/s,d=1/o,h=1/a;return ys.elements[0]*=c,ys.elements[1]*=c,ys.elements[2]*=c,ys.elements[4]*=d,ys.elements[5]*=d,ys.elements[6]*=d,ys.elements[8]*=h,ys.elements[9]*=h,ys.elements[10]*=h,n.setFromRotationMatrix(ys),i.x=s,i.y=o,i.z=a,this}makePerspective(e,n,i,r,s,o,a=uo){const l=this.elements,c=2*s/(n-e),d=2*s/(i-r),h=(n+e)/(n-e),p=(i+r)/(i-r);let g,v;if(a===uo)g=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===Op)g=-o/(o-s),v=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=d,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=g,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,i,r,s,o,a=uo){const l=this.elements,c=1/(n-e),d=1/(i-r),h=1/(o-s),p=(n+e)*c,g=(i+r)*d;let v,_;if(a===uo)v=(o+s)*h,_=-2*h;else if(a===Op)v=s*h,_=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-p,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-g,l[2]=0,l[6]=0,l[10]=_,l[14]=-v,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,i=e.elements;for(let r=0;r<16;r++)if(n[r]!==i[r])return!1;return!0}fromArray(e,n=0){for(let i=0;i<16;i++)this.elements[i]=e[i+n];return this}toArray(e=[],n=0){const i=this.elements;return e[n]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3],e[n+4]=i[4],e[n+5]=i[5],e[n+6]=i[6],e[n+7]=i[7],e[n+8]=i[8],e[n+9]=i[9],e[n+10]=i[10],e[n+11]=i[11],e[n+12]=i[12],e[n+13]=i[13],e[n+14]=i[14],e[n+15]=i[15],e}}const Uu=new B,ys=new Et,l8=new B(0,0,0),c8=new B(1,1,1),Na=new B,hv=new B,Pr=new B,AR=new Et,CR=new Wi;class Bm{constructor(e=0,n=0,i=0,r=Bm.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,i,r=this._order){return this._x=e,this._y=n,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,i=!0){const r=e.elements,s=r[0],o=r[4],a=r[8],l=r[1],c=r[5],d=r[9],h=r[2],p=r[6],g=r[10];switch(n){case"XYZ":this._y=Math.asin(Hn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,g),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Hn(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,g),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Hn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,g),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Hn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,g),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Hn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,g));break;case"XZY":this._z=Math.asin(-Hn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,g),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,i){return AR.makeRotationFromQuaternion(e),this.setFromRotationMatrix(AR,n,i)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return CR.setFromEuler(this),this.setFromQuaternion(CR,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Bm.DEFAULT_ORDER="XYZ";class Hc{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){for(let i=0;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,d=l.length;c0){r.children=[];for(let a=0;a0){r.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),d.length>0&&(i.images=d),h.length>0&&(i.shapes=h),p.length>0&&(i.skeletons=p),g.length>0&&(i.animations=g),v.length>0&&(i.nodes=v)}return i.object=r,i;function o(a){const l=[];for(const c in a){const d=a[c];delete d.metadata,l.push(d)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,n,i,r,s){xs.subVectors(r,n),zo.subVectors(i,n),$S.subVectors(e,n);const o=xs.dot(xs),a=xs.dot(zo),l=xs.dot($S),c=zo.dot(zo),d=zo.dot($S),h=o*c-a*a;if(h===0)return s.set(0,0,0),null;const p=1/h,g=(c*l-a*d)*p,v=(o*d-a*l)*p;return s.set(1-g-v,v,g)}static containsPoint(e,n,i,r){return this.getBarycoord(e,n,i,r,Bo)===null?!1:Bo.x>=0&&Bo.y>=0&&Bo.x+Bo.y<=1}static getInterpolation(e,n,i,r,s,o,a,l){return this.getBarycoord(e,n,i,r,Bo)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,Bo.x),l.addScaledVector(o,Bo.y),l.addScaledVector(a,Bo.z),l)}static isFrontFacing(e,n,i,r){return xs.subVectors(i,n),zo.subVectors(e,n),xs.cross(zo).dot(r)<0}set(e,n,i){return this.a.copy(e),this.b.copy(n),this.c.copy(i),this}setFromPointsAndIndices(e,n,i,r){return this.a.copy(e[n]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,n,i,r){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return xs.subVectors(this.c,this.b),zo.subVectors(this.a,this.b),xs.cross(zo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Or.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return Or.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,i,r,s){return Or.getInterpolation(e,this.a,this.b,this.c,n,i,r,s)}containsPoint(e){return Or.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Or.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const i=this.a,r=this.b,s=this.c;let o,a;Bu.subVectors(r,i),Vu.subVectors(s,i),YS.subVectors(e,i);const l=Bu.dot(YS),c=Vu.dot(YS);if(l<=0&&c<=0)return n.copy(i);ZS.subVectors(e,r);const d=Bu.dot(ZS),h=Vu.dot(ZS);if(d>=0&&h<=d)return n.copy(r);const p=l*h-d*c;if(p<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(i).addScaledVector(Bu,o);KS.subVectors(e,s);const g=Bu.dot(KS),v=Vu.dot(KS);if(v>=0&&g<=v)return n.copy(s);const _=g*c-l*v;if(_<=0&&c>=0&&v<=0)return a=c/(c-v),n.copy(i).addScaledVector(Vu,a);const y=d*v-g*h;if(y<=0&&h-d>=0&&g-v>=0)return DR.subVectors(s,r),a=(h-d)/(h-d+(g-v)),n.copy(r).addScaledVector(DR,a);const m=1/(y+_+p);return o=_*m,a=p*m,n.copy(i).addScaledVector(Bu,o).addScaledVector(Vu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const xO={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Oa={h:0,s:0,l:0},mv={h:0,s:0,l:0};function QS(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class ze{constructor(e,n,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,i)}set(e,n,i){if(n===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,n,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=Vn){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ln.toWorkingColorSpace(this,n),this}setRGB(e,n,i,r=ln.workingColorSpace){return this.r=e,this.g=n,this.b=i,ln.toWorkingColorSpace(this,r),this}setHSL(e,n,i,r=ln.workingColorSpace){if(e=Ob(e,1),n=Hn(n,0,1),i=Hn(i,0,1),n===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+n):i+n-i*n,o=2*i-s;this.r=QS(o,s,e+1/3),this.g=QS(o,s,e),this.b=QS(o,s,e-1/3)}return ln.toWorkingColorSpace(this,r),this}setStyle(e,n=Vn){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,n);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,n);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,n);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,n);if(o===6)return this.setHex(parseInt(s,16),n);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=Vn){const i=xO[e.toLowerCase()];return i!==void 0?this.setHex(i,n):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Nd(e.r),this.g=Nd(e.g),this.b=Nd(e.b),this}copyLinearToSRGB(e){return this.r=BS(e.r),this.g=BS(e.g),this.b=BS(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Vn){return ln.fromWorkingColorSpace(Ni.copy(this),e),Math.round(Hn(Ni.r*255,0,255))*65536+Math.round(Hn(Ni.g*255,0,255))*256+Math.round(Hn(Ni.b*255,0,255))}getHexString(e=Vn){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=ln.workingColorSpace){ln.fromWorkingColorSpace(Ni.copy(this),n);const i=Ni.r,r=Ni.g,s=Ni.b,o=Math.max(i,r,s),a=Math.min(i,r,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=d<=.5?h/(o+a):h/(2-o-a),o){case i:l=(r-s)/h+(r0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const i=e[n];if(i===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const r=this[n];if(r===void 0){console.warn(`THREE.Material: '${n}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[n]=i}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==zc&&(i.blending=this.blending),this.side!==ua&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==ny&&(i.blendSrc=this.blendSrc),this.blendDst!==iy&&(i.blendDst=this.blendDst),this.blendEquation!==qa&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Mp&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==cM&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==pc&&(i.stencilFail=this.stencilFail),this.stencilZFail!==pc&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==pc&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(n){const s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let i=null;if(n!==null){const r=n.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=n[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class Ol extends Ci{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Um,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Zo=g8();function g8(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(i[l]=0,i[l|256]=32768,r[l]=24,r[l|256]=24):c<-14?(i[l]=1024>>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,d=0;for(;!(c&8388608);)c<<=1,d-=8388608;c&=-8388609,d+=947912704,s[l]=c|d}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:o,offsetTable:a}}function hr(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Hn(t,-65504,65504),Zo.floatView[0]=t;const e=Zo.uint32View[0],n=e>>23&511;return Zo.baseTable[n]+((e&8388607)>>Zo.shiftTable[n])}function jh(t){const e=t>>10;return Zo.uint32View[0]=Zo.mantissaTable[Zo.offsetTable[e]+(t&1023)]+Zo.exponentTable[e],Zo.floatView[0]}const v8={toHalfFloat:hr,fromHalfFloat:jh},Jn=new B,gv=new ye;class un{constructor(e,n,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=i,this.usage=Np,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=cs,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Vc("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,i){e*=this.itemSize,i*=n.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let h=0,p=c.length;h0&&(r[l]=d,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(n));const r=e.attributes;for(const c in r){const d=r[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],h=s[c];for(let p=0,g=h.length;p0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s(e.far-e.near)**2))&&(NR.copy(s).invert(),ic.copy(e.ray).applyMatrix4(NR),!(i.boundingBox!==null&&ic.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,n,ic)))}_computeIntersections(e,n,i){let r;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,h=s.attributes.normal,p=s.groups,g=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,_=p.length;v<_;v++){const y=p[v],m=o[y.materialIndex],w=Math.max(y.start,g.start),S=Math.min(a.count,Math.min(y.start+y.count,g.start+g.count));for(let E=w,C=S;En.far?null:{distance:c,point:Mv.clone(),object:t}}function Ev(t,e,n,i,r,s,o,a,l,c){t.getVertexPosition(a,Wu),t.getVertexPosition(l,Gu),t.getVertexPosition(c,ju);const d=T8(t,e,n,i,Wu,Gu,ju,wv);if(d){r&&(xv.fromBufferAttribute(r,a),_v.fromBufferAttribute(r,l),Sv.fromBufferAttribute(r,c),d.uv=Or.getInterpolation(wv,Wu,Gu,ju,xv,_v,Sv,new ye)),s&&(xv.fromBufferAttribute(s,a),_v.fromBufferAttribute(s,l),Sv.fromBufferAttribute(s,c),d.uv1=Or.getInterpolation(wv,Wu,Gu,ju,xv,_v,Sv,new ye),d.uv2=d.uv1),o&&(kR.fromBufferAttribute(o,a),FR.fromBufferAttribute(o,l),UR.fromBufferAttribute(o,c),d.normal=Or.getInterpolation(wv,Wu,Gu,ju,kR,FR,UR,new B),d.normal.dot(i.direction)>0&&d.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new B,materialIndex:0};Or.getNormal(Wu,Gu,ju,h.normal),d.face=h}return d}class du extends Ut{constructor(e=1,n=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};const a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],d=[],h=[];let p=0,g=0;v("z","y","x",-1,-1,i,n,e,o,s,0),v("z","y","x",1,-1,i,n,-e,o,s,1),v("x","z","y",1,1,e,i,n,r,o,2),v("x","z","y",1,-1,e,i,-n,r,o,3),v("x","y","z",1,-1,e,n,i,r,s,4),v("x","y","z",-1,-1,e,n,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new it(c,3)),this.setAttribute("normal",new it(d,3)),this.setAttribute("uv",new it(h,2));function v(_,y,m,w,S,E,C,R,I,N,F){const A=E/I,D=C/N,j=E/2,K=C/2,V=R/2,Z=I+1,Y=N+1;let J=0,k=0;const W=new B;for(let $=0;$0?1:-1,d.push(W.x,W.y,W.z),h.push(de/I),h.push(1-$/N),J+=1}}for(let $=0;$0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(n.extensions=i),n}}class Vm extends sn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Et,this.projectionMatrix=new Et,this.projectionMatrixInverse=new Et,this.coordinateSystem=uo}copy(e,n){return super.copy(e,n),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,n){super.updateWorldMatrix(e,n),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const ka=new B,zR=new ye,BR=new ye;class Wn extends Vm{constructor(e=50,n=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=n,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const n=.5*this.getFilmHeight()/e;this.fov=cf*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Bc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return cf*2*Math.atan(Math.tan(Bc*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,n,i){ka.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ka.x,ka.y).multiplyScalar(-e/ka.z),ka.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(ka.x,ka.y).multiplyScalar(-e/ka.z)}getViewSize(e,n){return this.getViewBounds(e,zR,BR),n.subVectors(BR,zR)}setViewOffset(e,n,i,r,s,o){this.aspect=e/n,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let n=e*Math.tan(Bc*.5*this.fov)/this.zoom,i=2*n,r=this.aspect*i,s=-.5*r;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*r/l,n-=o.offsetY*i/c,r*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,n,n-i,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.fov=this.fov,n.object.zoom=this.zoom,n.object.near=this.near,n.object.far=this.far,n.object.focus=this.focus,n.object.aspect=this.aspect,this.view!==null&&(n.object.view=Object.assign({},this.view)),n.object.filmGauge=this.filmGauge,n.object.filmOffset=this.filmOffset,n}}const Xu=-90,qu=1;class wO extends sn{constructor(e,n,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const r=new Wn(Xu,qu,e,n);r.layers=this.layers,this.add(r);const s=new Wn(Xu,qu,e,n);s.layers=this.layers,this.add(s);const o=new Wn(Xu,qu,e,n);o.layers=this.layers,this.add(o);const a=new Wn(Xu,qu,e,n);a.layers=this.layers,this.add(a);const l=new Wn(Xu,qu,e,n);l.layers=this.layers,this.add(l);const c=new Wn(Xu,qu,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[i,r,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===uo)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Op)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of n)this.add(c),c.updateMatrixWorld()}update(e,n){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,d]=this.children,h=e.getRenderTarget(),p=e.getActiveCubeFace(),g=e.getActiveMipmapLevel(),v=e.xr.enabled;e.xr.enabled=!1;const _=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0,r),e.render(n,s),e.setRenderTarget(i,1,r),e.render(n,o),e.setRenderTarget(i,2,r),e.render(n,a),e.setRenderTarget(i,3,r),e.render(n,l),e.setRenderTarget(i,4,r),e.render(n,c),i.texture.generateMipmaps=_,e.setRenderTarget(i,5,r),e.render(n,d),e.setRenderTarget(h,p,g),e.xr.enabled=v,i.texture.needsPMREMUpdate=!0}}class Hm extends Ln{constructor(e,n,i,r,s,o,a,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:da,super(e,n,i,r,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class MO extends Ds{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];n.encoding!==void 0&&(Vc("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===ll?Vn:Nr),this.texture=new Hm(r,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Pn}fromEquirectangularTexture(e,n){this.texture.type=n.type,this.texture.colorSpace=n.colorSpace,this.texture.generateMipmaps=n.generateMipmaps,this.texture.minFilter=n.minFilter,this.texture.magFilter=n.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new du(5,5,5),s=new Ns({name:"CubemapFromEquirect",uniforms:uf(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:ir,blending:ra});s.uniforms.tEquirect.value=n;const o=new ni(r,s),a=n.minFilter;return n.minFilter===co&&(n.minFilter=Pn),new wO(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,i,r){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,i,r);e.setRenderTarget(s)}}const tw=new B,R8=new B,I8=new Bt;class $o{constructor(e=new B(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,i,r){return this.normal.set(e,n,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,i){const r=tw.subVectors(i,n).cross(R8.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const i=e.delta(tw),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:n.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return n<0&&i>0||i<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const i=n||I8.getNormalMatrix(e),r=this.coplanarPoint(tw).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const rc=new Gi,bv=new B;class Wm{constructor(e=new $o,n=new $o,i=new $o,r=new $o,s=new $o,o=new $o){this.planes=[e,n,i,r,s,o]}set(e,n,i,r,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(i),a[3].copy(r),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let i=0;i<6;i++)n[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,n=uo){const i=this.planes,r=e.elements,s=r[0],o=r[1],a=r[2],l=r[3],c=r[4],d=r[5],h=r[6],p=r[7],g=r[8],v=r[9],_=r[10],y=r[11],m=r[12],w=r[13],S=r[14],E=r[15];if(i[0].setComponents(l-s,p-c,y-g,E-m).normalize(),i[1].setComponents(l+s,p+c,y+g,E+m).normalize(),i[2].setComponents(l+o,p+d,y+v,E+w).normalize(),i[3].setComponents(l-o,p-d,y-v,E-w).normalize(),i[4].setComponents(l-a,p-h,y-_,E-S).normalize(),n===uo)i[5].setComponents(l+a,p+h,y+_,E+S).normalize();else if(n===Op)i[5].setComponents(a,h,_,S).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),rc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),rc.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(rc)}intersectsSprite(e){return rc.center.set(0,0,0),rc.radius=.7071067811865476,rc.applyMatrix4(e.matrixWorld),this.intersectsSphere(rc)}intersectsSphere(e){const n=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(i)0?e.max.x:e.min.x,bv.y=r.normal.y>0?e.max.y:e.min.y,bv.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(bv)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let i=0;i<6;i++)if(n[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function EO(){let t=null,e=!1,n=null,i=null;function r(s,o){n(s,o),i=t.requestAnimationFrame(r)}return{start:function(){e!==!0&&n!==null&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function L8(t,e){const n=e.isWebGL2,i=new WeakMap;function r(c,d){const h=c.array,p=c.usage,g=h.byteLength,v=t.createBuffer();t.bindBuffer(d,v),t.bufferData(d,h,p),c.onUploadCallback();let _;if(h instanceof Float32Array)_=t.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(n)_=t.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=t.UNSIGNED_SHORT;else if(h instanceof Int16Array)_=t.SHORT;else if(h instanceof Uint32Array)_=t.UNSIGNED_INT;else if(h instanceof Int32Array)_=t.INT;else if(h instanceof Int8Array)_=t.BYTE;else if(h instanceof Uint8Array)_=t.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)_=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:v,type:_,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version,size:g}}function s(c,d,h){const p=d.array,g=d._updateRange,v=d.updateRanges;if(t.bindBuffer(h,c),g.count===-1&&v.length===0&&t.bufferSubData(h,0,p),v.length!==0){for(let _=0,y=v.length;_ 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,Y8=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,Z8=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,K8=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,Q8=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,J8=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,e6=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + varying vec3 vColor; +#endif`,t6=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif`,n6=`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +float luminance( const in vec3 rgb ) { + const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); + return dot( weights, rgb ); +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,i6=`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,r6=`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,s6=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,o6=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,a6=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,l6=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,c6="gl_FragColor = linearToOutputTexel( gl_FragColor );",u6=` +const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( + vec3( 0.8224621, 0.177538, 0.0 ), + vec3( 0.0331941, 0.9668058, 0.0 ), + vec3( 0.0170827, 0.0723974, 0.9105199 ) +); +const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3( + vec3( 1.2249401, - 0.2249404, 0.0 ), + vec3( - 0.0420569, 1.0420571, 0.0 ), + vec3( - 0.0196376, - 0.0786361, 1.0982735 ) +); +vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) { + return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a ); +} +vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) { + return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a ); +} +vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +} +vec4 LinearToLinear( in vec4 value ) { + return value; +} +vec4 LinearTosRGB( in vec4 value ) { + return sRGBTransferOETF( value ); +}`,d6=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,f6=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,h6=`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,p6=`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,m6=`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,g6=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,v6=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,y6=`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,x6=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,_6=`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,S6=`#ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + reflectedLight.indirectDiffuse += lightMapIrradiance; +#endif`,w6=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,M6=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,E6=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,b6=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + #if defined ( LEGACY_LIGHTS ) + if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) { + return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent ); + } + return 1.0; + #else + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; + #endif +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,T6=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,A6=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,C6=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,P6=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,R6=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,I6=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,L6=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,D6=` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,N6=`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,O6=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,k6=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,F6=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,U6=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + varying float vFragDepth; + varying float vIsPerspective; + #else + uniform float logDepthBufFC; + #endif +#endif`,z6=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); + #else + if ( isPerspectiveMatrix( projectionMatrix ) ) { + gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; + gl_Position.z *= gl_Position.w; + } + #endif +#endif`,B6=`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); + + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,V6=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,H6=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,W6=`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,G6=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,j6=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,X6=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,q6=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } + #else + objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; + objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; + objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; + objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; + #endif +#endif`,$6=`#ifdef USE_MORPHTARGETS + uniform float morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } + #else + #ifndef USE_MORPHNORMALS + uniform float morphTargetInfluences[ 8 ]; + #else + uniform float morphTargetInfluences[ 4 ]; + #endif + #endif +#endif`,Y6=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + #ifdef MORPHTARGETS_TEXTURE + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } + #else + transformed += morphTarget0 * morphTargetInfluences[ 0 ]; + transformed += morphTarget1 * morphTargetInfluences[ 1 ]; + transformed += morphTarget2 * morphTargetInfluences[ 2 ]; + transformed += morphTarget3 * morphTargetInfluences[ 3 ]; + #ifndef USE_MORPHNORMALS + transformed += morphTarget4 * morphTargetInfluences[ 4 ]; + transformed += morphTarget5 * morphTargetInfluences[ 5 ]; + transformed += morphTarget6 * morphTargetInfluences[ 6 ]; + transformed += morphTarget7 * morphTargetInfluences[ 7 ]; + #endif + #endif +#endif`,Z6=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,K6=`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,Q6=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,J6=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,e9=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,t9=`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,n9=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,i9=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,r9=`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,s9=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,o9=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,a9=`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.; +const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. ); +const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. ); +const float ShiftRight8 = 1. / 256.; +vec4 packDepthToRGBA( const in float v ) { + vec4 r = vec4( fract( v * PackFactors ), v ); + r.yzw -= r.xyz * ShiftRight8; return r * PackUpscale; +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors ); +} +vec2 packDepthToRG( in highp float v ) { + return packDepthToRGBA( v ).yx; +} +float unpackRGToDepth( const in highp vec2 v ) { + return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) ); +} +vec4 pack2HalfToRGBA( vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,l9=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,c9=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,u9=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,d9=`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,f9=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,h9=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,p9=`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return shadow; + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + vec3 lightToPosition = shadowCoord.xyz; + float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + return ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } +#endif`,m9=`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,g9=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,v9=`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,y9=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,x9=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,_9=`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,S9=`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,w9=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,M9=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,E9=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,b9=`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 OptimizedCineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,T9=`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,A9=`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,C9=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,P9=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,R9=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,I9=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const L9=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,D9=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,N9=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,O9=`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,k9=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,F9=`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,U9=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,z9=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #endif +}`,B9=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,V9=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,H9=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,W9=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,G9=`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,j9=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,X9=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,q9=`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,$9=`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Y9=`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,Z9=`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,K9=`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,Q9=`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,J9=`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,e7=`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,t7=`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,n7=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,i7=`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,r7=`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,s7=`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,o7=`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,a7=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,l7=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,c7=`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,u7=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,d7=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Ft={alphahash_fragment:D8,alphahash_pars_fragment:N8,alphamap_fragment:O8,alphamap_pars_fragment:k8,alphatest_fragment:F8,alphatest_pars_fragment:U8,aomap_fragment:z8,aomap_pars_fragment:B8,batching_pars_vertex:V8,batching_vertex:H8,begin_vertex:W8,beginnormal_vertex:G8,bsdfs:j8,iridescence_fragment:X8,bumpmap_pars_fragment:q8,clipping_planes_fragment:$8,clipping_planes_pars_fragment:Y8,clipping_planes_pars_vertex:Z8,clipping_planes_vertex:K8,color_fragment:Q8,color_pars_fragment:J8,color_pars_vertex:e6,color_vertex:t6,common:n6,cube_uv_reflection_fragment:i6,defaultnormal_vertex:r6,displacementmap_pars_vertex:s6,displacementmap_vertex:o6,emissivemap_fragment:a6,emissivemap_pars_fragment:l6,colorspace_fragment:c6,colorspace_pars_fragment:u6,envmap_fragment:d6,envmap_common_pars_fragment:f6,envmap_pars_fragment:h6,envmap_pars_vertex:p6,envmap_physical_pars_fragment:T6,envmap_vertex:m6,fog_vertex:g6,fog_pars_vertex:v6,fog_fragment:y6,fog_pars_fragment:x6,gradientmap_pars_fragment:_6,lightmap_fragment:S6,lightmap_pars_fragment:w6,lights_lambert_fragment:M6,lights_lambert_pars_fragment:E6,lights_pars_begin:b6,lights_toon_fragment:A6,lights_toon_pars_fragment:C6,lights_phong_fragment:P6,lights_phong_pars_fragment:R6,lights_physical_fragment:I6,lights_physical_pars_fragment:L6,lights_fragment_begin:D6,lights_fragment_maps:N6,lights_fragment_end:O6,logdepthbuf_fragment:k6,logdepthbuf_pars_fragment:F6,logdepthbuf_pars_vertex:U6,logdepthbuf_vertex:z6,map_fragment:B6,map_pars_fragment:V6,map_particle_fragment:H6,map_particle_pars_fragment:W6,metalnessmap_fragment:G6,metalnessmap_pars_fragment:j6,morphcolor_vertex:X6,morphnormal_vertex:q6,morphtarget_pars_vertex:$6,morphtarget_vertex:Y6,normal_fragment_begin:Z6,normal_fragment_maps:K6,normal_pars_fragment:Q6,normal_pars_vertex:J6,normal_vertex:e9,normalmap_pars_fragment:t9,clearcoat_normal_fragment_begin:n9,clearcoat_normal_fragment_maps:i9,clearcoat_pars_fragment:r9,iridescence_pars_fragment:s9,opaque_fragment:o9,packing:a9,premultiplied_alpha_fragment:l9,project_vertex:c9,dithering_fragment:u9,dithering_pars_fragment:d9,roughnessmap_fragment:f9,roughnessmap_pars_fragment:h9,shadowmap_pars_fragment:p9,shadowmap_pars_vertex:m9,shadowmap_vertex:g9,shadowmask_pars_fragment:v9,skinbase_vertex:y9,skinning_pars_vertex:x9,skinning_vertex:_9,skinnormal_vertex:S9,specularmap_fragment:w9,specularmap_pars_fragment:M9,tonemapping_fragment:E9,tonemapping_pars_fragment:b9,transmission_fragment:T9,transmission_pars_fragment:A9,uv_pars_fragment:C9,uv_pars_vertex:P9,uv_vertex:R9,worldpos_vertex:I9,background_vert:L9,background_frag:D9,backgroundCube_vert:N9,backgroundCube_frag:O9,cube_vert:k9,cube_frag:F9,depth_vert:U9,depth_frag:z9,distanceRGBA_vert:B9,distanceRGBA_frag:V9,equirect_vert:H9,equirect_frag:W9,linedashed_vert:G9,linedashed_frag:j9,meshbasic_vert:X9,meshbasic_frag:q9,meshlambert_vert:$9,meshlambert_frag:Y9,meshmatcap_vert:Z9,meshmatcap_frag:K9,meshnormal_vert:Q9,meshnormal_frag:J9,meshphong_vert:e7,meshphong_frag:t7,meshphysical_vert:n7,meshphysical_frag:i7,meshtoon_vert:r7,meshtoon_frag:s7,points_vert:o7,points_frag:a7,shadow_vert:l7,shadow_frag:c7,sprite_vert:u7,sprite_frag:d7},Ue={common:{diffuse:{value:new ze(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Bt},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Bt}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Bt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Bt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Bt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Bt},normalScale:{value:new ye(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Bt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Bt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Bt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Bt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ze(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ze(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0},uvTransform:{value:new Bt}},sprite:{diffuse:{value:new ze(16777215)},opacity:{value:1},center:{value:new ye(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Bt},alphaMap:{value:null},alphaMapTransform:{value:new Bt},alphaTest:{value:0}}},Ts={basic:{uniforms:Qi([Ue.common,Ue.specularmap,Ue.envmap,Ue.aomap,Ue.lightmap,Ue.fog]),vertexShader:Ft.meshbasic_vert,fragmentShader:Ft.meshbasic_frag},lambert:{uniforms:Qi([Ue.common,Ue.specularmap,Ue.envmap,Ue.aomap,Ue.lightmap,Ue.emissivemap,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.fog,Ue.lights,{emissive:{value:new ze(0)}}]),vertexShader:Ft.meshlambert_vert,fragmentShader:Ft.meshlambert_frag},phong:{uniforms:Qi([Ue.common,Ue.specularmap,Ue.envmap,Ue.aomap,Ue.lightmap,Ue.emissivemap,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.fog,Ue.lights,{emissive:{value:new ze(0)},specular:{value:new ze(1118481)},shininess:{value:30}}]),vertexShader:Ft.meshphong_vert,fragmentShader:Ft.meshphong_frag},standard:{uniforms:Qi([Ue.common,Ue.envmap,Ue.aomap,Ue.lightmap,Ue.emissivemap,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.roughnessmap,Ue.metalnessmap,Ue.fog,Ue.lights,{emissive:{value:new ze(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Ft.meshphysical_vert,fragmentShader:Ft.meshphysical_frag},toon:{uniforms:Qi([Ue.common,Ue.aomap,Ue.lightmap,Ue.emissivemap,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.gradientmap,Ue.fog,Ue.lights,{emissive:{value:new ze(0)}}]),vertexShader:Ft.meshtoon_vert,fragmentShader:Ft.meshtoon_frag},matcap:{uniforms:Qi([Ue.common,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,Ue.fog,{matcap:{value:null}}]),vertexShader:Ft.meshmatcap_vert,fragmentShader:Ft.meshmatcap_frag},points:{uniforms:Qi([Ue.points,Ue.fog]),vertexShader:Ft.points_vert,fragmentShader:Ft.points_frag},dashed:{uniforms:Qi([Ue.common,Ue.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ft.linedashed_vert,fragmentShader:Ft.linedashed_frag},depth:{uniforms:Qi([Ue.common,Ue.displacementmap]),vertexShader:Ft.depth_vert,fragmentShader:Ft.depth_frag},normal:{uniforms:Qi([Ue.common,Ue.bumpmap,Ue.normalmap,Ue.displacementmap,{opacity:{value:1}}]),vertexShader:Ft.meshnormal_vert,fragmentShader:Ft.meshnormal_frag},sprite:{uniforms:Qi([Ue.sprite,Ue.fog]),vertexShader:Ft.sprite_vert,fragmentShader:Ft.sprite_frag},background:{uniforms:{uvTransform:{value:new Bt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Ft.background_vert,fragmentShader:Ft.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Ft.backgroundCube_vert,fragmentShader:Ft.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ft.cube_vert,fragmentShader:Ft.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ft.equirect_vert,fragmentShader:Ft.equirect_frag},distanceRGBA:{uniforms:Qi([Ue.common,Ue.displacementmap,{referencePosition:{value:new B},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ft.distanceRGBA_vert,fragmentShader:Ft.distanceRGBA_frag},shadow:{uniforms:Qi([Ue.lights,Ue.fog,{color:{value:new ze(0)},opacity:{value:1}}]),vertexShader:Ft.shadow_vert,fragmentShader:Ft.shadow_frag}};Ts.physical={uniforms:Qi([Ts.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Bt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Bt},clearcoatNormalScale:{value:new ye(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Bt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Bt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Bt},sheen:{value:0},sheenColor:{value:new ze(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Bt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Bt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Bt},transmissionSamplerSize:{value:new ye},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Bt},attenuationDistance:{value:0},attenuationColor:{value:new ze(0)},specularColor:{value:new ze(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Bt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Bt},anisotropyVector:{value:new ye},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Bt}}]),vertexShader:Ft.meshphysical_vert,fragmentShader:Ft.meshphysical_frag};const Tv={r:0,b:0,g:0};function f7(t,e,n,i,r,s,o){const a=new ze(0);let l=s===!0?0:1,c,d,h=null,p=0,g=null;function v(y,m){let w=!1,S=m.isScene===!0?m.background:null;S&&S.isTexture&&(S=(m.backgroundBlurriness>0?n:e).get(S)),S===null?_(a,l):S&&S.isColor&&(_(S,1),w=!0);const E=t.xr.getEnvironmentBlendMode();E==="additive"?i.buffers.color.setClear(0,0,0,1,o):E==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,o),(t.autoClear||w)&&t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil),S&&(S.isCubeTexture||S.mapping===Of)?(d===void 0&&(d=new ni(new du(1,1,1),new Ns({name:"BackgroundCubeMaterial",uniforms:uf(Ts.backgroundCube.uniforms),vertexShader:Ts.backgroundCube.vertexShader,fragmentShader:Ts.backgroundCube.fragmentShader,side:ir,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(C,R,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(d)),d.material.uniforms.envMap.value=S,d.material.uniforms.flipEnvMap.value=S.isCubeTexture&&S.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,d.material.toneMapped=ln.getTransfer(S.colorSpace)!==mn,(h!==S||p!==S.version||g!==t.toneMapping)&&(d.material.needsUpdate=!0,h=S,p=S.version,g=t.toneMapping),d.layers.enableAll(),y.unshift(d,d.geometry,d.material,0,0,null)):S&&S.isTexture&&(c===void 0&&(c=new ni(new kf(2,2),new Ns({name:"BackgroundMaterial",uniforms:uf(Ts.background.uniforms),vertexShader:Ts.background.vertexShader,fragmentShader:Ts.background.fragmentShader,side:ua,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=S,c.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,c.material.toneMapped=ln.getTransfer(S.colorSpace)!==mn,S.matrixAutoUpdate===!0&&S.updateMatrix(),c.material.uniforms.uvTransform.value.copy(S.matrix),(h!==S||p!==S.version||g!==t.toneMapping)&&(c.material.needsUpdate=!0,h=S,p=S.version,g=t.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function _(y,m){y.getRGB(Tv,_O(t)),i.buffers.color.setClear(Tv.r,Tv.g,Tv.b,m,o)}return{getClearColor:function(){return a},setClearColor:function(y,m=1){a.set(y),l=m,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,_(a,l)},render:v}}function h7(t,e,n,i){const r=t.getParameter(t.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||s!==null,a={},l=y(null);let c=l,d=!1;function h(V,Z,Y,J,k){let W=!1;if(o){const $=_(J,Y,Z);c!==$&&(c=$,g(c.object)),W=m(V,J,Y,k),W&&w(V,J,Y,k)}else{const $=Z.wireframe===!0;(c.geometry!==J.id||c.program!==Y.id||c.wireframe!==$)&&(c.geometry=J.id,c.program=Y.id,c.wireframe=$,W=!0)}k!==null&&n.update(k,t.ELEMENT_ARRAY_BUFFER),(W||d)&&(d=!1,N(V,Z,Y,J),k!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,n.get(k).buffer))}function p(){return i.isWebGL2?t.createVertexArray():s.createVertexArrayOES()}function g(V){return i.isWebGL2?t.bindVertexArray(V):s.bindVertexArrayOES(V)}function v(V){return i.isWebGL2?t.deleteVertexArray(V):s.deleteVertexArrayOES(V)}function _(V,Z,Y){const J=Y.wireframe===!0;let k=a[V.id];k===void 0&&(k={},a[V.id]=k);let W=k[Z.id];W===void 0&&(W={},k[Z.id]=W);let $=W[J];return $===void 0&&($=y(p()),W[J]=$),$}function y(V){const Z=[],Y=[],J=[];for(let k=0;k=0){const ie=k[de];let he=W[de];if(he===void 0&&(de==="instanceMatrix"&&V.instanceMatrix&&(he=V.instanceMatrix),de==="instanceColor"&&V.instanceColor&&(he=V.instanceColor)),ie===void 0||ie.attribute!==he||he&&ie.data!==he.data)return!0;$++}return c.attributesNum!==$||c.index!==J}function w(V,Z,Y,J){const k={},W=Z.attributes;let $=0;const Q=Y.getAttributes();for(const de in Q)if(Q[de].location>=0){let ie=W[de];ie===void 0&&(de==="instanceMatrix"&&V.instanceMatrix&&(ie=V.instanceMatrix),de==="instanceColor"&&V.instanceColor&&(ie=V.instanceColor));const he={};he.attribute=ie,ie&&ie.data&&(he.data=ie.data),k[de]=he,$++}c.attributes=k,c.attributesNum=$,c.index=J}function S(){const V=c.newAttributes;for(let Z=0,Y=V.length;Z=0){let be=k[Q];if(be===void 0&&(Q==="instanceMatrix"&&V.instanceMatrix&&(be=V.instanceMatrix),Q==="instanceColor"&&V.instanceColor&&(be=V.instanceColor)),be!==void 0){const ie=be.normalized,he=be.itemSize,Ee=n.get(be);if(Ee===void 0)continue;const me=Ee.buffer,Re=Ee.type,Le=Ee.bytesPerElement,Ce=i.isWebGL2===!0&&(Re===t.INT||Re===t.UNSIGNED_INT||be.gpuType===bb);if(be.isInterleavedBufferAttribute){const Ae=be.data,H=Ae.stride,xe=be.offset;if(Ae.isInstancedInterleavedBuffer){for(let fe=0;fe0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&t.constructor.name==="WebGL2RenderingContext";let a=n.precision!==void 0?n.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),d=n.logarithmicDepthBuffer===!0,h=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),p=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),g=t.getParameter(t.MAX_TEXTURE_SIZE),v=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),_=t.getParameter(t.MAX_VERTEX_ATTRIBS),y=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),m=t.getParameter(t.MAX_VARYING_VECTORS),w=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),S=p>0,E=o||e.has("OES_texture_float"),C=S&&E,R=o?t.getParameter(t.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:d,maxTextures:h,maxVertexTextures:p,maxTextureSize:g,maxCubemapSize:v,maxAttributes:_,maxVertexUniforms:y,maxVaryings:m,maxFragmentUniforms:w,vertexTextures:S,floatFragmentTextures:E,floatVertexTextures:C,maxSamples:R}}function g7(t){const e=this;let n=null,i=0,r=!1,s=!1;const o=new $o,a=new Bt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,p){const g=h.length!==0||p||i!==0||r;return r=p,i=h.length,g},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,p){n=d(h,p,0)},this.setState=function(h,p,g){const v=h.clippingPlanes,_=h.clipIntersection,y=h.clipShadows,m=t.get(h);if(!r||v===null||v.length===0||s&&!y)s?d(null):c();else{const w=s?0:i,S=w*4;let E=m.clippingState||null;l.value=E,E=d(v,p,S,g);for(let C=0;C!==S;++C)E[C]=n[C];m.clippingState=E,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=w}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function d(h,p,g,v){const _=h!==null?h.length:0;let y=null;if(_!==0){if(y=l.value,v!==!0||y===null){const m=g+_*4,w=p.matrixWorldInverse;a.getNormalMatrix(w),(y===null||y.length0){const c=new MO(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",r),n(c.texture,o.mapping)}else return null}}return o}function r(o){const a=o.target;a.removeEventListener("dispose",r);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class Qo extends Vm{constructor(e=-1,n=1,i=1,r=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=n,this.top=i,this.bottom=r,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,n){return super.copy(e,n),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,n,i,r,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=r,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),n=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,o=i+e,a=r+n,l=r-n;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=d*this.view.offsetY,l=a-d*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const n=super.toJSON(e);return n.object.zoom=this.zoom,n.object.left=this.left,n.object.right=this.right,n.object.top=this.top,n.object.bottom=this.bottom,n.object.near=this.near,n.object.far=this.far,this.view!==null&&(n.object.view=Object.assign({},this.view)),n}}const dd=4,VR=[.125,.215,.35,.446,.526,.582],Sc=20,nw=new Qo,HR=new ze;let iw=null,rw=0,sw=0;const mc=(1+Math.sqrt(5))/2,$u=1/mc,WR=[new B(1,1,1),new B(-1,1,1),new B(1,1,-1),new B(-1,1,-1),new B(0,mc,$u),new B(0,mc,-$u),new B($u,0,mc),new B(-$u,0,mc),new B(mc,$u,0),new B(-mc,$u,0)];class fM{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,n=0,i=.1,r=100){iw=this._renderer.getRenderTarget(),rw=this._renderer.getActiveCubeFace(),sw=this._renderer.getActiveMipmapLevel(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,s),n>0&&this._blur(s,0,0,n),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,n=null){return this._fromTexture(e,n)}fromCubemap(e,n=null){return this._fromTexture(e,n)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=XR(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=jR(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?S:0,S,S),d.setRenderTarget(r),_&&d.render(v,a),d.render(e,a)}v.geometry.dispose(),v.material.dispose(),d.toneMapping=p,d.autoClear=h,e.background=y}_textureToCubeUV(e,n){const i=this._renderer,r=e.mapping===da||e.mapping===xl;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=XR()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=jR());const s=r?this._cubemapMaterial:this._equirectMaterial,o=new ni(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Av(n,0,0,3*l,2*l),i.setRenderTarget(n),i.render(o,nw)}_applyPMREM(e){const n=this._renderer,i=n.autoClear;n.autoClear=!1;for(let r=1;rSc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${Sc}`);const m=[];let w=0;for(let I=0;IS-dd?r-S+dd:0),R=4*(this._cubeSize-E);Av(n,C,R,3*E,2*E),l.setRenderTarget(n),l.render(h,nw)}}function y7(t){const e=[],n=[],i=[];let r=t;const s=t-dd+1+VR.length;for(let o=0;ot-dd?l=VR[o-t+dd-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),d=-c,h=1+c,p=[d,d,h,d,h,h,d,d,h,h,d,h],g=6,v=6,_=3,y=2,m=1,w=new Float32Array(_*v*g),S=new Float32Array(y*v*g),E=new Float32Array(m*v*g);for(let R=0;R2?0:-1,F=[I,N,0,I+2/3,N,0,I+2/3,N+1,0,I,N,0,I+2/3,N+1,0,I,N+1,0];w.set(F,_*v*R),S.set(p,y*v*R);const A=[R,R,R,R,R,R];E.set(A,m*v*R)}const C=new Ut;C.setAttribute("position",new un(w,_)),C.setAttribute("uv",new un(S,y)),C.setAttribute("faceIndex",new un(E,m)),e.push(C),r>dd&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}function GR(t,e,n){const i=new Ds(t,e,n);return i.texture.mapping=Of,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function Av(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function x7(t,e,n){const i=new Float32Array(Sc),r=new B(0,1,0);return new Ns({name:"SphericalGaussianBlur",defines:{n:Sc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Bb(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:ra,depthTest:!1,depthWrite:!1})}function jR(){return new Ns({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Bb(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:ra,depthTest:!1,depthWrite:!1})}function XR(){return new Ns({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Bb(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:ra,depthTest:!1,depthWrite:!1})}function Bb(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function _7(t){let e=new WeakMap,n=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===Ep||l===bp,d=l===da||l===xl;if(c||d)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return n===null&&(n=new fM(t)),h=c?n.fromEquirectangular(a,h):n.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||d&&h&&r(h)){n===null&&(n=new fM(t));const p=c?n.fromEquirectangular(a):n.fromCubemap(a);return e.set(a,p),a.addEventListener("dispose",s),p.texture}else return null}}}return a}function r(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(A=Math.ceil(F/e.maxTextureSize),F=e.maxTextureSize);const D=new Float32Array(F*A*4*v),j=new mx(D,F,A,v);j.type=cs,j.needsUpdate=!0;const K=N*4;for(let Z=0;Z0)return t;const r=e*n;let s=qR[r];if(s===void 0&&(s=new Float32Array(r),qR[r]=s),e!==0){i.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function ai(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n":" "} ${a}: ${n[o]}`)}return i.join(` +`)}function wX(t){const e=ln.getPrimaries(ln.workingColorSpace),n=ln.getPrimaries(t);let i;switch(e===n?i="":e===Dp&&n===Lp?i="LinearDisplayP3ToLinearSRGB":e===Lp&&n===Dp&&(i="LinearSRGBToLinearDisplayP3"),t){case vr:case zm:return[i,"LinearTransferOETF"];case Vn:case px:return[i,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[i,"LinearTransferOETF"]}}function e2(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const o=parseInt(s[1]);return n.toUpperCase()+` + +`+r+` + +`+SX(t.getShaderSource(e),o)}else return r}function MX(t,e){const n=wX(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function EX(t,e){let n;switch(e){case H3:n="Linear";break;case W3:n="Reinhard";break;case G3:n="OptimizedCineon";break;case Eb:n="ACESFilmic";break;case X3:n="AgX";break;case j3:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function bX(t){return[t.extensionDerivatives||t.envMapCubeUVHeight||t.bumpMap||t.normalMapTangentSpace||t.clearcoatNormalMap||t.flatShading||t.alphaToCoverage||t.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(t.extensionFragDepth||t.logarithmicDepthBuffer)&&t.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",t.extensionDrawBuffers&&t.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(t.extensionShaderTextureLOD||t.envMap||t.transmission)&&t.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(fd).join(` +`)}function TX(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(fd).join(` +`)}function AX(t){const e=[];for(const n in t){const i=t[n];i!==!1&&e.push("#define "+n+" "+i)}return e.join(` +`)}function CX(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function hM(t){return t.replace(PX,IX)}const RX=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function IX(t,e){let n=Ft[e];if(n===void 0){const i=RX.get(e);if(i!==void 0)n=Ft[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return hM(n)}const LX=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function i2(t){return t.replace(LX,DX)}function DX(t,e,n,i){let r="";for(let s=parseInt(e);s0&&(m+=` +`),w=[g,"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_].filter(fd).join(` +`),w.length>0&&(w+=` +`)):(m=[r2(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+d:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&n.flatShading===!1?"#define USE_MORPHNORMALS":"",n.morphColors&&n.isWebGL2?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0&&n.isWebGL2?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(fd).join(` +`),w=[g,r2(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,_,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+d:"",n.envMap?"#define "+h:"",p?"#define CUBEUV_TEXEL_WIDTH "+p.texelWidth:"",p?"#define CUBEUV_TEXEL_HEIGHT "+p.texelHeight:"",p?"#define CUBEUV_MAX_MIP "+p.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&n.flatShading===!1?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.useLegacyLights?"#define LEGACY_LIGHTS":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.logarithmicDepthBuffer&&n.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==fo?"#define TONE_MAPPING":"",n.toneMapping!==fo?Ft.tonemapping_pars_fragment:"",n.toneMapping!==fo?EX("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",Ft.colorspace_pars_fragment,MX("linearToOutputTexel",n.outputColorSpace),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` +`].filter(fd).join(` +`)),o=hM(o),o=t2(o,n),o=n2(o,n),a=hM(a),a=t2(a,n),a=n2(a,n),o=i2(o),a=i2(a),n.isWebGL2&&n.isRawShaderMaterial!==!0&&(S=`#version 300 es +`,m=[v,"precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+m,w=["precision mediump sampler2DArray;","#define varying in",n.glslVersion===uM?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===uM?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`)+` +`+w);const E=S+m+o,C=S+w+a,R=JR(r,r.VERTEX_SHADER,E),I=JR(r,r.FRAGMENT_SHADER,C);r.attachShader(y,R),r.attachShader(y,I),n.index0AttributeName!==void 0?r.bindAttribLocation(y,0,n.index0AttributeName):n.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y);function N(j){if(t.debug.checkShaderErrors){const K=r.getProgramInfoLog(y).trim(),V=r.getShaderInfoLog(R).trim(),Z=r.getShaderInfoLog(I).trim();let Y=!0,J=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(Y=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(r,y,R,I);else{const k=e2(r,R,"vertex"),W=e2(r,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+` + +Material Name: `+j.name+` +Material Type: `+j.type+` + +Program Info Log: `+K+` +`+k+` +`+W)}else K!==""?console.warn("THREE.WebGLProgram: Program Info Log:",K):(V===""||Z==="")&&(J=!1);J&&(j.diagnostics={runnable:Y,programLog:K,vertexShader:{log:V,prefix:m},fragmentShader:{log:Z,prefix:w}})}r.deleteShader(R),r.deleteShader(I),F=new U0(r,y),A=CX(r,y)}let F;this.getUniforms=function(){return F===void 0&&N(this),F};let A;this.getAttributes=function(){return A===void 0&&N(this),A};let D=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return D===!1&&(D=r.getProgramParameter(y,xX)),D},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=_X++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=R,this.fragmentShader=I,this}let BX=0;class VX{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(n),s=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(r)===!1&&(o.add(r),r.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const n=this.materialCache.get(e);for(const i of n)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const n=this.materialCache;let i=n.get(e);return i===void 0&&(i=new Set,n.set(e,i)),i}_getShaderStage(e){const n=this.shaderCache;let i=n.get(e);return i===void 0&&(i=new HX(e),n.set(e,i)),i}}class HX{constructor(e){this.id=BX++,this.code=e,this.usedTimes=0}}function WX(t,e,n,i,r,s,o){const a=new Hc,l=new VX,c=new Set,d=[],h=r.isWebGL2,p=r.logarithmicDepthBuffer,g=r.vertexTextures;let v=r.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(A){return c.add(A),A===0?"uv":`uv${A}`}function m(A,D,j,K,V){const Z=K.fog,Y=V.geometry,J=A.isMeshStandardMaterial?K.environment:null,k=(A.isMeshStandardMaterial?n:e).get(A.envMap||J),W=k&&k.mapping===Of?k.image.height:null,$=_[A.type];A.precision!==null&&(v=r.getMaxPrecision(A.precision),v!==A.precision&&console.warn("THREE.WebGLProgram.getParameters:",A.precision,"not supported, using",v,"instead."));const Q=Y.morphAttributes.position||Y.morphAttributes.normal||Y.morphAttributes.color,de=Q!==void 0?Q.length:0;let be=0;Y.morphAttributes.position!==void 0&&(be=1),Y.morphAttributes.normal!==void 0&&(be=2),Y.morphAttributes.color!==void 0&&(be=3);let ie,he,Ee,me;if($){const Yt=Ts[$];ie=Yt.vertexShader,he=Yt.fragmentShader}else ie=A.vertexShader,he=A.fragmentShader,l.update(A),Ee=l.getVertexShaderID(A),me=l.getFragmentShaderID(A);const Re=t.getRenderTarget(),Le=V.isInstancedMesh===!0,Ce=V.isBatchedMesh===!0,Ae=!!A.map,H=!!A.matcap,xe=!!k,fe=!!A.aoMap,Te=!!A.lightMap,ge=!!A.bumpMap,qe=!!A.normalMap,Fe=!!A.displacementMap,U=!!A.emissiveMap,O=!!A.metalnessMap,re=!!A.roughnessMap,Me=A.anisotropy>0,Se=A.clearcoat>0,_e=A.iridescence>0,Ze=A.sheen>0,Oe=A.transmission>0,Ve=Me&&!!A.anisotropyMap,rt=Se&&!!A.clearcoatMap,mt=Se&&!!A.clearcoatNormalMap,we=Se&&!!A.clearcoatRoughnessMap,Ot=_e&&!!A.iridescenceMap,wt=_e&&!!A.iridescenceThicknessMap,ft=Ze&&!!A.sheenColorMap,et=Ze&&!!A.sheenRoughnessMap,q=!!A.specularMap,ve=!!A.specularColorMap,Be=!!A.specularIntensityMap,st=Oe&&!!A.transmissionMap,lt=Oe&&!!A.thicknessMap,Ht=!!A.gradientMap,X=!!A.alphaMap,ke=A.alphaTest>0,De=!!A.alphaHash,Xe=!!A.extensions;let tt=fo;A.toneMapped&&(Re===null||Re.isXRRenderTarget===!0)&&(tt=t.toneMapping);const jt={isWebGL2:h,shaderID:$,shaderType:A.type,shaderName:A.name,vertexShader:ie,fragmentShader:he,defines:A.defines,customVertexShaderID:Ee,customFragmentShaderID:me,isRawShaderMaterial:A.isRawShaderMaterial===!0,glslVersion:A.glslVersion,precision:v,batching:Ce,instancing:Le,instancingColor:Le&&V.instanceColor!==null,supportsVertexTextures:g,outputColorSpace:Re===null?t.outputColorSpace:Re.isXRRenderTarget===!0?Re.texture.colorSpace:vr,alphaToCoverage:!!A.alphaToCoverage,map:Ae,matcap:H,envMap:xe,envMapMode:xe&&k.mapping,envMapCubeUVHeight:W,aoMap:fe,lightMap:Te,bumpMap:ge,normalMap:qe,displacementMap:g&&Fe,emissiveMap:U,normalMapObjectSpace:qe&&A.normalMapType===aO,normalMapTangentSpace:qe&&A.normalMapType===Nl,metalnessMap:O,roughnessMap:re,anisotropy:Me,anisotropyMap:Ve,clearcoat:Se,clearcoatMap:rt,clearcoatNormalMap:mt,clearcoatRoughnessMap:we,iridescence:_e,iridescenceMap:Ot,iridescenceThicknessMap:wt,sheen:Ze,sheenColorMap:ft,sheenRoughnessMap:et,specularMap:q,specularColorMap:ve,specularIntensityMap:Be,transmission:Oe,transmissionMap:st,thicknessMap:lt,gradientMap:Ht,opaque:A.transparent===!1&&A.blending===zc&&A.alphaToCoverage===!1,alphaMap:X,alphaTest:ke,alphaHash:De,combine:A.combine,mapUv:Ae&&y(A.map.channel),aoMapUv:fe&&y(A.aoMap.channel),lightMapUv:Te&&y(A.lightMap.channel),bumpMapUv:ge&&y(A.bumpMap.channel),normalMapUv:qe&&y(A.normalMap.channel),displacementMapUv:Fe&&y(A.displacementMap.channel),emissiveMapUv:U&&y(A.emissiveMap.channel),metalnessMapUv:O&&y(A.metalnessMap.channel),roughnessMapUv:re&&y(A.roughnessMap.channel),anisotropyMapUv:Ve&&y(A.anisotropyMap.channel),clearcoatMapUv:rt&&y(A.clearcoatMap.channel),clearcoatNormalMapUv:mt&&y(A.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:we&&y(A.clearcoatRoughnessMap.channel),iridescenceMapUv:Ot&&y(A.iridescenceMap.channel),iridescenceThicknessMapUv:wt&&y(A.iridescenceThicknessMap.channel),sheenColorMapUv:ft&&y(A.sheenColorMap.channel),sheenRoughnessMapUv:et&&y(A.sheenRoughnessMap.channel),specularMapUv:q&&y(A.specularMap.channel),specularColorMapUv:ve&&y(A.specularColorMap.channel),specularIntensityMapUv:Be&&y(A.specularIntensityMap.channel),transmissionMapUv:st&&y(A.transmissionMap.channel),thicknessMapUv:lt&&y(A.thicknessMap.channel),alphaMapUv:X&&y(A.alphaMap.channel),vertexTangents:!!Y.attributes.tangent&&(qe||Me),vertexColors:A.vertexColors,vertexAlphas:A.vertexColors===!0&&!!Y.attributes.color&&Y.attributes.color.itemSize===4,pointsUvs:V.isPoints===!0&&!!Y.attributes.uv&&(Ae||X),fog:!!Z,useFog:A.fog===!0,fogExp2:!!Z&&Z.isFogExp2,flatShading:A.flatShading===!0,sizeAttenuation:A.sizeAttenuation===!0,logarithmicDepthBuffer:p,skinning:V.isSkinnedMesh===!0,morphTargets:Y.morphAttributes.position!==void 0,morphNormals:Y.morphAttributes.normal!==void 0,morphColors:Y.morphAttributes.color!==void 0,morphTargetsCount:de,morphTextureStride:be,numDirLights:D.directional.length,numPointLights:D.point.length,numSpotLights:D.spot.length,numSpotLightMaps:D.spotLightMap.length,numRectAreaLights:D.rectArea.length,numHemiLights:D.hemi.length,numDirLightShadows:D.directionalShadowMap.length,numPointLightShadows:D.pointShadowMap.length,numSpotLightShadows:D.spotShadowMap.length,numSpotLightShadowsWithMaps:D.numSpotLightShadowsWithMaps,numLightProbes:D.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:A.dithering,shadowMapEnabled:t.shadowMap.enabled&&j.length>0,shadowMapType:t.shadowMap.type,toneMapping:tt,useLegacyLights:t._useLegacyLights,decodeVideoTexture:Ae&&A.map.isVideoTexture===!0&&ln.getTransfer(A.map.colorSpace)===mn,premultipliedAlpha:A.premultipliedAlpha,doubleSided:A.side===oo,flipSided:A.side===ir,useDepthPacking:A.depthPacking>=0,depthPacking:A.depthPacking||0,index0AttributeName:A.index0AttributeName,extensionDerivatives:Xe&&A.extensions.derivatives===!0,extensionFragDepth:Xe&&A.extensions.fragDepth===!0,extensionDrawBuffers:Xe&&A.extensions.drawBuffers===!0,extensionShaderTextureLOD:Xe&&A.extensions.shaderTextureLOD===!0,extensionClipCullDistance:Xe&&A.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:Xe&&A.extensions.multiDraw===!0&&i.has("WEBGL_multi_draw"),rendererExtensionFragDepth:h||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:h||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:h||i.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:A.customProgramCacheKey()};return jt.vertexUv1s=c.has(1),jt.vertexUv2s=c.has(2),jt.vertexUv3s=c.has(3),c.clear(),jt}function w(A){const D=[];if(A.shaderID?D.push(A.shaderID):(D.push(A.customVertexShaderID),D.push(A.customFragmentShaderID)),A.defines!==void 0)for(const j in A.defines)D.push(j),D.push(A.defines[j]);return A.isRawShaderMaterial===!1&&(S(D,A),E(D,A),D.push(t.outputColorSpace)),D.push(A.customProgramCacheKey),D.join()}function S(A,D){A.push(D.precision),A.push(D.outputColorSpace),A.push(D.envMapMode),A.push(D.envMapCubeUVHeight),A.push(D.mapUv),A.push(D.alphaMapUv),A.push(D.lightMapUv),A.push(D.aoMapUv),A.push(D.bumpMapUv),A.push(D.normalMapUv),A.push(D.displacementMapUv),A.push(D.emissiveMapUv),A.push(D.metalnessMapUv),A.push(D.roughnessMapUv),A.push(D.anisotropyMapUv),A.push(D.clearcoatMapUv),A.push(D.clearcoatNormalMapUv),A.push(D.clearcoatRoughnessMapUv),A.push(D.iridescenceMapUv),A.push(D.iridescenceThicknessMapUv),A.push(D.sheenColorMapUv),A.push(D.sheenRoughnessMapUv),A.push(D.specularMapUv),A.push(D.specularColorMapUv),A.push(D.specularIntensityMapUv),A.push(D.transmissionMapUv),A.push(D.thicknessMapUv),A.push(D.combine),A.push(D.fogExp2),A.push(D.sizeAttenuation),A.push(D.morphTargetsCount),A.push(D.morphAttributeCount),A.push(D.numDirLights),A.push(D.numPointLights),A.push(D.numSpotLights),A.push(D.numSpotLightMaps),A.push(D.numHemiLights),A.push(D.numRectAreaLights),A.push(D.numDirLightShadows),A.push(D.numPointLightShadows),A.push(D.numSpotLightShadows),A.push(D.numSpotLightShadowsWithMaps),A.push(D.numLightProbes),A.push(D.shadowMapType),A.push(D.toneMapping),A.push(D.numClippingPlanes),A.push(D.numClipIntersection),A.push(D.depthPacking)}function E(A,D){a.disableAll(),D.isWebGL2&&a.enable(0),D.supportsVertexTextures&&a.enable(1),D.instancing&&a.enable(2),D.instancingColor&&a.enable(3),D.matcap&&a.enable(4),D.envMap&&a.enable(5),D.normalMapObjectSpace&&a.enable(6),D.normalMapTangentSpace&&a.enable(7),D.clearcoat&&a.enable(8),D.iridescence&&a.enable(9),D.alphaTest&&a.enable(10),D.vertexColors&&a.enable(11),D.vertexAlphas&&a.enable(12),D.vertexUv1s&&a.enable(13),D.vertexUv2s&&a.enable(14),D.vertexUv3s&&a.enable(15),D.vertexTangents&&a.enable(16),D.anisotropy&&a.enable(17),D.alphaHash&&a.enable(18),D.batching&&a.enable(19),A.push(a.mask),a.disableAll(),D.fog&&a.enable(0),D.useFog&&a.enable(1),D.flatShading&&a.enable(2),D.logarithmicDepthBuffer&&a.enable(3),D.skinning&&a.enable(4),D.morphTargets&&a.enable(5),D.morphNormals&&a.enable(6),D.morphColors&&a.enable(7),D.premultipliedAlpha&&a.enable(8),D.shadowMapEnabled&&a.enable(9),D.useLegacyLights&&a.enable(10),D.doubleSided&&a.enable(11),D.flipSided&&a.enable(12),D.useDepthPacking&&a.enable(13),D.dithering&&a.enable(14),D.transmission&&a.enable(15),D.sheen&&a.enable(16),D.opaque&&a.enable(17),D.pointsUvs&&a.enable(18),D.decodeVideoTexture&&a.enable(19),D.alphaToCoverage&&a.enable(20),A.push(a.mask)}function C(A){const D=_[A.type];let j;if(D){const K=Ts[D];j=SO.clone(K.uniforms)}else j=A.uniforms;return j}function R(A,D){let j;for(let K=0,V=d.length;K0?i.push(m):g.transparent===!0?r.push(m):n.push(m)}function l(h,p,g,v,_,y){const m=o(h,p,g,v,_,y);g.transmission>0?i.unshift(m):g.transparent===!0?r.unshift(m):n.unshift(m)}function c(h,p){n.length>1&&n.sort(h||jX),i.length>1&&i.sort(p||s2),r.length>1&&r.sort(p||s2)}function d(){for(let h=e,p=t.length;h=s.length?(o=new o2,s.push(o)):o=s[r],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function qX(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new B,color:new ze};break;case"SpotLight":n={position:new B,direction:new B,color:new ze,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new B,color:new ze,distance:0,decay:0};break;case"HemisphereLight":n={direction:new B,skyColor:new ze,groundColor:new ze};break;case"RectAreaLight":n={color:new ze,position:new B,halfWidth:new B,halfHeight:new B};break}return t[e.id]=n,n}}}function $X(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye};break;case"SpotLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye};break;case"PointLight":n={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ye,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let YX=0;function ZX(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function KX(t,e){const n=new qX,i=$X(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let d=0;d<9;d++)r.probe.push(new B);const s=new B,o=new Et,a=new Et;function l(d,h){let p=0,g=0,v=0;for(let j=0;j<9;j++)r.probe[j].set(0,0,0);let _=0,y=0,m=0,w=0,S=0,E=0,C=0,R=0,I=0,N=0,F=0;d.sort(ZX);const A=h===!0?Math.PI:1;for(let j=0,K=d.length;j0&&(e.isWebGL2?t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Ue.LTC_FLOAT_1,r.rectAreaLTC2=Ue.LTC_FLOAT_2):(r.rectAreaLTC1=Ue.LTC_HALF_1,r.rectAreaLTC2=Ue.LTC_HALF_2):t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Ue.LTC_FLOAT_1,r.rectAreaLTC2=Ue.LTC_FLOAT_2):t.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Ue.LTC_HALF_1,r.rectAreaLTC2=Ue.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=p,r.ambient[1]=g,r.ambient[2]=v;const D=r.hash;(D.directionalLength!==_||D.pointLength!==y||D.spotLength!==m||D.rectAreaLength!==w||D.hemiLength!==S||D.numDirectionalShadows!==E||D.numPointShadows!==C||D.numSpotShadows!==R||D.numSpotMaps!==I||D.numLightProbes!==F)&&(r.directional.length=_,r.spot.length=m,r.rectArea.length=w,r.point.length=y,r.hemi.length=S,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=C,r.pointShadowMap.length=C,r.spotShadow.length=R,r.spotShadowMap.length=R,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=C,r.spotLightMatrix.length=R+I-N,r.spotLightMap.length=I,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=F,D.directionalLength=_,D.pointLength=y,D.spotLength=m,D.rectAreaLength=w,D.hemiLength=S,D.numDirectionalShadows=E,D.numPointShadows=C,D.numSpotShadows=R,D.numSpotMaps=I,D.numLightProbes=F,r.version=YX++)}function c(d,h){let p=0,g=0,v=0,_=0,y=0;const m=h.matrixWorldInverse;for(let w=0,S=d.length;w=a.length?(l=new a2(t,e),a.push(l)):l=a[o],l}function r(){n=new WeakMap}return{get:i,dispose:r}}class Hb extends Ci{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=sO,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Wb extends Ci{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const JX=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,eq=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function tq(t,e,n){let i=new Wm;const r=new ye,s=new ye,o=new cn,a=new Hb({depthPacking:oO}),l=new Wb,c={},d=n.maxTextureSize,h={[ua]:ir,[ir]:ua,[oo]:oo},p=new Ns({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ye},radius:{value:4}},vertexShader:JX,fragmentShader:eq}),g=p.clone();g.defines.HORIZONTAL_PASS=1;const v=new Ut;v.setAttribute("position",new un(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new ni(v,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ux;let m=this.type;this.render=function(R,I,N){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||R.length===0)return;const F=t.getRenderTarget(),A=t.getActiveCubeFace(),D=t.getActiveMipmapLevel(),j=t.state;j.setBlending(ra),j.buffers.color.setClear(1,1,1,1),j.buffers.depth.setTest(!0),j.setScissorTest(!1);const K=m!==ws&&this.type===ws,V=m===ws&&this.type!==ws;for(let Z=0,Y=R.length;Zd||r.y>d)&&(r.x>d&&(s.x=Math.floor(d/W.x),r.x=s.x*W.x,k.mapSize.x=s.x),r.y>d&&(s.y=Math.floor(d/W.y),r.y=s.y*W.y,k.mapSize.y=s.y)),k.map===null||K===!0||V===!0){const Q=this.type!==ws?{minFilter:$n,magFilter:$n}:{};k.map!==null&&k.map.dispose(),k.map=new Ds(r.x,r.y,Q),k.map.texture.name=J.name+".shadowMap",k.camera.updateProjectionMatrix()}t.setRenderTarget(k.map),t.clear();const $=k.getViewportCount();for(let Q=0;Q<$;Q++){const de=k.getViewport(Q);o.set(s.x*de.x,s.y*de.y,s.x*de.z,s.y*de.w),j.viewport(o),k.updateMatrices(J,Q),i=k.getFrustum(),E(I,N,k.camera,J,this.type)}k.isPointLightShadow!==!0&&this.type===ws&&w(k,N),k.needsUpdate=!1}m=this.type,y.needsUpdate=!1,t.setRenderTarget(F,A,D)};function w(R,I){const N=e.update(_);p.defines.VSM_SAMPLES!==R.blurSamples&&(p.defines.VSM_SAMPLES=R.blurSamples,g.defines.VSM_SAMPLES=R.blurSamples,p.needsUpdate=!0,g.needsUpdate=!0),R.mapPass===null&&(R.mapPass=new Ds(r.x,r.y)),p.uniforms.shadow_pass.value=R.map.texture,p.uniforms.resolution.value=R.mapSize,p.uniforms.radius.value=R.radius,t.setRenderTarget(R.mapPass),t.clear(),t.renderBufferDirect(I,null,N,p,_,null),g.uniforms.shadow_pass.value=R.mapPass.texture,g.uniforms.resolution.value=R.mapSize,g.uniforms.radius.value=R.radius,t.setRenderTarget(R.map),t.clear(),t.renderBufferDirect(I,null,N,g,_,null)}function S(R,I,N,F){let A=null;const D=N.isPointLight===!0?R.customDistanceMaterial:R.customDepthMaterial;if(D!==void 0)A=D;else if(A=N.isPointLight===!0?l:a,t.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0){const j=A.uuid,K=I.uuid;let V=c[j];V===void 0&&(V={},c[j]=V);let Z=V[K];Z===void 0&&(Z=A.clone(),V[K]=Z,I.addEventListener("dispose",C)),A=Z}if(A.visible=I.visible,A.wireframe=I.wireframe,F===ws?A.side=I.shadowSide!==null?I.shadowSide:I.side:A.side=I.shadowSide!==null?I.shadowSide:h[I.side],A.alphaMap=I.alphaMap,A.alphaTest=I.alphaTest,A.map=I.map,A.clipShadows=I.clipShadows,A.clippingPlanes=I.clippingPlanes,A.clipIntersection=I.clipIntersection,A.displacementMap=I.displacementMap,A.displacementScale=I.displacementScale,A.displacementBias=I.displacementBias,A.wireframeLinewidth=I.wireframeLinewidth,A.linewidth=I.linewidth,N.isPointLight===!0&&A.isMeshDistanceMaterial===!0){const j=t.properties.get(A);j.light=N}return A}function E(R,I,N,F,A){if(R.visible===!1)return;if(R.layers.test(I.layers)&&(R.isMesh||R.isLine||R.isPoints)&&(R.castShadow||R.receiveShadow&&A===ws)&&(!R.frustumCulled||i.intersectsObject(R))){R.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,R.matrixWorld);const K=e.update(R),V=R.material;if(Array.isArray(V)){const Z=K.groups;for(let Y=0,J=Z.length;Y=1):$.indexOf("OpenGL ES")!==-1&&(W=parseFloat(/^OpenGL ES (\d)/.exec($)[1]),k=W>=2);let Q=null,de={};const be=t.getParameter(t.SCISSOR_BOX),ie=t.getParameter(t.VIEWPORT),he=new cn().fromArray(be),Ee=new cn().fromArray(ie);function me(X,ke,De,Xe){const tt=new Uint8Array(4),jt=t.createTexture();t.bindTexture(X,jt),t.texParameteri(X,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(X,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Yt=0;Yt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),d=new WeakMap;let h;const p=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function v(U,O){return g?new OffscreenCanvas(U,O):kp("canvas")}function _(U,O,re,Me){let Se=1;if((U.width>Me||U.height>Me)&&(Se=Me/Math.max(U.width,U.height)),Se<1||O===!0)if(typeof HTMLImageElement<"u"&&U instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&U instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&U instanceof ImageBitmap){const _e=O?oy:Math.floor,Ze=_e(Se*U.width),Oe=_e(Se*U.height);h===void 0&&(h=v(Ze,Oe));const Ve=re?v(Ze,Oe):h;return Ve.width=Ze,Ve.height=Oe,Ve.getContext("2d").drawImage(U,0,0,Ze,Oe),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+U.width+"x"+U.height+") to ("+Ze+"x"+Oe+")."),Ve}else return"data"in U&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+U.width+"x"+U.height+")."),U;return U}function y(U){return dM(U.width)&&dM(U.height)}function m(U){return a?!1:U.wrapS!==Vi||U.wrapT!==Vi||U.minFilter!==$n&&U.minFilter!==Pn}function w(U,O){return U.generateMipmaps&&O&&U.minFilter!==$n&&U.minFilter!==Pn}function S(U){t.generateMipmap(U)}function E(U,O,re,Me,Se=!1){if(a===!1)return O;if(U!==null){if(t[U]!==void 0)return t[U];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+U+"'")}let _e=O;if(O===t.RED&&(re===t.FLOAT&&(_e=t.R32F),re===t.HALF_FLOAT&&(_e=t.R16F),re===t.UNSIGNED_BYTE&&(_e=t.R8)),O===t.RED_INTEGER&&(re===t.UNSIGNED_BYTE&&(_e=t.R8UI),re===t.UNSIGNED_SHORT&&(_e=t.R16UI),re===t.UNSIGNED_INT&&(_e=t.R32UI),re===t.BYTE&&(_e=t.R8I),re===t.SHORT&&(_e=t.R16I),re===t.INT&&(_e=t.R32I)),O===t.RG&&(re===t.FLOAT&&(_e=t.RG32F),re===t.HALF_FLOAT&&(_e=t.RG16F),re===t.UNSIGNED_BYTE&&(_e=t.RG8)),O===t.RGBA){const Ze=Se?Ip:ln.getTransfer(Me);re===t.FLOAT&&(_e=t.RGBA32F),re===t.HALF_FLOAT&&(_e=t.RGBA16F),re===t.UNSIGNED_BYTE&&(_e=Ze===mn?t.SRGB8_ALPHA8:t.RGBA8),re===t.UNSIGNED_SHORT_4_4_4_4&&(_e=t.RGBA4),re===t.UNSIGNED_SHORT_5_5_5_1&&(_e=t.RGB5_A1)}return(_e===t.R16F||_e===t.R32F||_e===t.RG16F||_e===t.RG32F||_e===t.RGBA16F||_e===t.RGBA32F)&&e.get("EXT_color_buffer_float"),_e}function C(U,O,re){return w(U,re)===!0||U.isFramebufferTexture&&U.minFilter!==$n&&U.minFilter!==Pn?Math.log2(Math.max(O.width,O.height))+1:U.mipmaps!==void 0&&U.mipmaps.length>0?U.mipmaps.length:U.isCompressedTexture&&Array.isArray(U.image)?O.mipmaps.length:1}function R(U){return U===$n||U===ry||U===_c?t.NEAREST:t.LINEAR}function I(U){const O=U.target;O.removeEventListener("dispose",I),F(O),O.isVideoTexture&&d.delete(O)}function N(U){const O=U.target;O.removeEventListener("dispose",N),D(O)}function F(U){const O=i.get(U);if(O.__webglInit===void 0)return;const re=U.source,Me=p.get(re);if(Me){const Se=Me[O.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&A(U),Object.keys(Me).length===0&&p.delete(re)}i.remove(U)}function A(U){const O=i.get(U);t.deleteTexture(O.__webglTexture);const re=U.source,Me=p.get(re);delete Me[O.__cacheKey],o.memory.textures--}function D(U){const O=U.texture,re=i.get(U),Me=i.get(O);if(Me.__webglTexture!==void 0&&(t.deleteTexture(Me.__webglTexture),o.memory.textures--),U.depthTexture&&U.depthTexture.dispose(),U.isWebGLCubeRenderTarget)for(let Se=0;Se<6;Se++){if(Array.isArray(re.__webglFramebuffer[Se]))for(let _e=0;_e=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+U+" texture units while this GPU supports only "+r.maxTextures),j+=1,U}function Z(U){const O=[];return O.push(U.wrapS),O.push(U.wrapT),O.push(U.wrapR||0),O.push(U.magFilter),O.push(U.minFilter),O.push(U.anisotropy),O.push(U.internalFormat),O.push(U.format),O.push(U.type),O.push(U.generateMipmaps),O.push(U.premultiplyAlpha),O.push(U.flipY),O.push(U.unpackAlignment),O.push(U.colorSpace),O.join()}function Y(U,O){const re=i.get(U);if(U.isVideoTexture&&qe(U),U.isRenderTargetTexture===!1&&U.version>0&&re.__version!==U.version){const Me=U.image;if(Me===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Me.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{he(re,U,O);return}}n.bindTexture(t.TEXTURE_2D,re.__webglTexture,t.TEXTURE0+O)}function J(U,O){const re=i.get(U);if(U.version>0&&re.__version!==U.version){he(re,U,O);return}n.bindTexture(t.TEXTURE_2D_ARRAY,re.__webglTexture,t.TEXTURE0+O)}function k(U,O){const re=i.get(U);if(U.version>0&&re.__version!==U.version){he(re,U,O);return}n.bindTexture(t.TEXTURE_3D,re.__webglTexture,t.TEXTURE0+O)}function W(U,O){const re=i.get(U);if(U.version>0&&re.__version!==U.version){Ee(re,U,O);return}n.bindTexture(t.TEXTURE_CUBE_MAP,re.__webglTexture,t.TEXTURE0+O)}const $={[Tp]:t.REPEAT,[Vi]:t.CLAMP_TO_EDGE,[Ap]:t.MIRRORED_REPEAT},Q={[$n]:t.NEAREST,[ry]:t.NEAREST_MIPMAP_NEAREST,[_c]:t.NEAREST_MIPMAP_LINEAR,[Pn]:t.LINEAR,[ip]:t.LINEAR_MIPMAP_NEAREST,[co]:t.LINEAR_MIPMAP_LINEAR},de={[lO]:t.NEVER,[pO]:t.ALWAYS,[cO]:t.LESS,[Nb]:t.LEQUAL,[uO]:t.EQUAL,[hO]:t.GEQUAL,[dO]:t.GREATER,[fO]:t.NOTEQUAL};function be(U,O,re){if(O.type===cs&&e.has("OES_texture_float_linear")===!1&&(O.magFilter===Pn||O.magFilter===ip||O.magFilter===_c||O.magFilter===co||O.minFilter===Pn||O.minFilter===ip||O.minFilter===_c||O.minFilter===co)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),re?(t.texParameteri(U,t.TEXTURE_WRAP_S,$[O.wrapS]),t.texParameteri(U,t.TEXTURE_WRAP_T,$[O.wrapT]),(U===t.TEXTURE_3D||U===t.TEXTURE_2D_ARRAY)&&t.texParameteri(U,t.TEXTURE_WRAP_R,$[O.wrapR]),t.texParameteri(U,t.TEXTURE_MAG_FILTER,Q[O.magFilter]),t.texParameteri(U,t.TEXTURE_MIN_FILTER,Q[O.minFilter])):(t.texParameteri(U,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(U,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),(U===t.TEXTURE_3D||U===t.TEXTURE_2D_ARRAY)&&t.texParameteri(U,t.TEXTURE_WRAP_R,t.CLAMP_TO_EDGE),(O.wrapS!==Vi||O.wrapT!==Vi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),t.texParameteri(U,t.TEXTURE_MAG_FILTER,R(O.magFilter)),t.texParameteri(U,t.TEXTURE_MIN_FILTER,R(O.minFilter)),O.minFilter!==$n&&O.minFilter!==Pn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),O.compareFunction&&(t.texParameteri(U,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(U,t.TEXTURE_COMPARE_FUNC,de[O.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Me=e.get("EXT_texture_filter_anisotropic");if(O.magFilter===$n||O.minFilter!==_c&&O.minFilter!==co||O.type===cs&&e.has("OES_texture_float_linear")===!1||a===!1&&O.type===lf&&e.has("OES_texture_half_float_linear")===!1)return;(O.anisotropy>1||i.get(O).__currentAnisotropy)&&(t.texParameterf(U,Me.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(O.anisotropy,r.getMaxAnisotropy())),i.get(O).__currentAnisotropy=O.anisotropy)}}function ie(U,O){let re=!1;U.__webglInit===void 0&&(U.__webglInit=!0,O.addEventListener("dispose",I));const Me=O.source;let Se=p.get(Me);Se===void 0&&(Se={},p.set(Me,Se));const _e=Z(O);if(_e!==U.__cacheKey){Se[_e]===void 0&&(Se[_e]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,re=!0),Se[_e].usedTimes++;const Ze=Se[U.__cacheKey];Ze!==void 0&&(Se[U.__cacheKey].usedTimes--,Ze.usedTimes===0&&A(O)),U.__cacheKey=_e,U.__webglTexture=Se[_e].texture}return re}function he(U,O,re){let Me=t.TEXTURE_2D;(O.isDataArrayTexture||O.isCompressedArrayTexture)&&(Me=t.TEXTURE_2D_ARRAY),O.isData3DTexture&&(Me=t.TEXTURE_3D);const Se=ie(U,O),_e=O.source;n.bindTexture(Me,U.__webglTexture,t.TEXTURE0+re);const Ze=i.get(_e);if(_e.version!==Ze.__version||Se===!0){n.activeTexture(t.TEXTURE0+re);const Oe=ln.getPrimaries(ln.workingColorSpace),Ve=O.colorSpace===Nr?null:ln.getPrimaries(O.colorSpace),rt=O.colorSpace===Nr||Oe===Ve?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,O.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,O.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,rt);const mt=m(O)&&y(O.image)===!1;let we=_(O.image,mt,!1,r.maxTextureSize);we=Fe(O,we);const Ot=y(we)||a,wt=s.convert(O.format,O.colorSpace);let ft=s.convert(O.type),et=E(O.internalFormat,wt,ft,O.colorSpace,O.isVideoTexture);be(Me,O,Ot);let q;const ve=O.mipmaps,Be=a&&O.isVideoTexture!==!0&&et!==Ib,st=Ze.__version===void 0||Se===!0,lt=_e.dataReady,Ht=C(O,we,Ot);if(O.isDepthTexture)et=t.DEPTH_COMPONENT,a?O.type===cs?et=t.DEPTH_COMPONENT32F:O.type===Ko?et=t.DEPTH_COMPONENT24:O.type===ol?et=t.DEPTH24_STENCIL8:et=t.DEPTH_COMPONENT16:O.type===cs&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),O.format===al&&et===t.DEPTH_COMPONENT&&O.type!==fx&&O.type!==Ko&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),O.type=Ko,ft=s.convert(O.type)),O.format===Yc&&et===t.DEPTH_COMPONENT&&(et=t.DEPTH_STENCIL,O.type!==ol&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),O.type=ol,ft=s.convert(O.type))),st&&(Be?n.texStorage2D(t.TEXTURE_2D,1,et,we.width,we.height):n.texImage2D(t.TEXTURE_2D,0,et,we.width,we.height,0,wt,ft,null));else if(O.isDataTexture)if(ve.length>0&&Ot){Be&&st&&n.texStorage2D(t.TEXTURE_2D,Ht,et,ve[0].width,ve[0].height);for(let X=0,ke=ve.length;X>=1,ke>>=1}}else if(ve.length>0&&Ot){Be&&st&&n.texStorage2D(t.TEXTURE_2D,Ht,et,ve[0].width,ve[0].height);for(let X=0,ke=ve.length;X0&<++,n.texStorage2D(t.TEXTURE_CUBE_MAP,lt,q,we[0].width,we[0].height));for(let X=0;X<6;X++)if(mt){ve?st&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,0,0,we[X].width,we[X].height,ft,et,we[X].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+X,0,q,we[X].width,we[X].height,0,ft,et,we[X].data);for(let ke=0;ke>_e),we=Math.max(1,O.height>>_e);Se===t.TEXTURE_3D||Se===t.TEXTURE_2D_ARRAY?n.texImage3D(Se,_e,Ve,mt,we,O.depth,0,Ze,Oe,null):n.texImage2D(Se,_e,Ve,mt,we,0,Ze,Oe,null)}n.bindFramebuffer(t.FRAMEBUFFER,U),ge(O)?l.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Me,Se,i.get(re).__webglTexture,0,Te(O)):(Se===t.TEXTURE_2D||Se>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Se<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Me,Se,i.get(re).__webglTexture,_e),n.bindFramebuffer(t.FRAMEBUFFER,null)}function Re(U,O,re){if(t.bindRenderbuffer(t.RENDERBUFFER,U),O.depthBuffer&&!O.stencilBuffer){let Me=a===!0?t.DEPTH_COMPONENT24:t.DEPTH_COMPONENT16;if(re||ge(O)){const Se=O.depthTexture;Se&&Se.isDepthTexture&&(Se.type===cs?Me=t.DEPTH_COMPONENT32F:Se.type===Ko&&(Me=t.DEPTH_COMPONENT24));const _e=Te(O);ge(O)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,_e,Me,O.width,O.height):t.renderbufferStorageMultisample(t.RENDERBUFFER,_e,Me,O.width,O.height)}else t.renderbufferStorage(t.RENDERBUFFER,Me,O.width,O.height);t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.RENDERBUFFER,U)}else if(O.depthBuffer&&O.stencilBuffer){const Me=Te(O);re&&ge(O)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,Me,t.DEPTH24_STENCIL8,O.width,O.height):ge(O)?l.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Me,t.DEPTH24_STENCIL8,O.width,O.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,O.width,O.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.RENDERBUFFER,U)}else{const Me=O.isWebGLMultipleRenderTargets===!0?O.texture:[O.texture];for(let Se=0;Se0){re.__webglFramebuffer[Oe]=[];for(let Ve=0;Ve0){re.__webglFramebuffer=[];for(let Oe=0;Oe0&&ge(U)===!1){const Oe=_e?O:[O];re.__webglMultisampledFramebuffer=t.createFramebuffer(),re.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,re.__webglMultisampledFramebuffer);for(let Ve=0;Ve0)for(let Ve=0;Ve0)for(let Ve=0;Ve0&&ge(U)===!1){const O=U.isWebGLMultipleRenderTargets?U.texture:[U.texture],re=U.width,Me=U.height;let Se=t.COLOR_BUFFER_BIT;const _e=[],Ze=U.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Oe=i.get(U),Ve=U.isWebGLMultipleRenderTargets===!0;if(Ve)for(let rt=0;rt0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&O.__useRenderToTexture!==!1}function qe(U){const O=o.render.frame;d.get(U)!==O&&(d.set(U,O),U.update())}function Fe(U,O){const re=U.colorSpace,Me=U.format,Se=U.type;return U.isCompressedTexture===!0||U.isVideoTexture===!0||U.format===sy||re!==vr&&re!==Nr&&(ln.getTransfer(re)===mn?a===!1?e.has("EXT_sRGB")===!0&&Me===Hi?(U.format=sy,U.minFilter=Pn,U.generateMipmaps=!1):O=kb.sRGBToLinear(O):(Me!==Hi||Se!==ho)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",re)),O}this.allocateTextureUnit=V,this.resetTextureUnits=K,this.setTexture2D=Y,this.setTexture2DArray=J,this.setTexture3D=k,this.setTextureCube=W,this.rebindTextures=Ae,this.setupRenderTarget=H,this.updateRenderTargetMipmap=xe,this.updateMultisampleRenderTarget=fe,this.setupDepthRenderbuffer=Ce,this.setupFrameBufferTexture=me,this.useMultisampledRTT=ge}function RO(t,e,n){const i=n.isWebGL2;function r(s,o=Nr){let a;const l=ln.getTransfer(o);if(s===ho)return t.UNSIGNED_BYTE;if(s===Tb)return t.UNSIGNED_SHORT_4_4_4_4;if(s===Ab)return t.UNSIGNED_SHORT_5_5_5_1;if(s===$3)return t.BYTE;if(s===Y3)return t.SHORT;if(s===fx)return t.UNSIGNED_SHORT;if(s===bb)return t.INT;if(s===Ko)return t.UNSIGNED_INT;if(s===cs)return t.FLOAT;if(s===lf)return i?t.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Z3)return t.ALPHA;if(s===Hi)return t.RGBA;if(s===K3)return t.LUMINANCE;if(s===Q3)return t.LUMINANCE_ALPHA;if(s===al)return t.DEPTH_COMPONENT;if(s===Yc)return t.DEPTH_STENCIL;if(s===sy)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===J3)return t.RED;if(s===Cb)return t.RED_INTEGER;if(s===eO)return t.RG;if(s===Pb)return t.RG_INTEGER;if(s===Rb)return t.RGBA_INTEGER;if(s===L0||s===D0||s===N0||s===O0)if(l===mn)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===L0)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===D0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===N0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===O0)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===L0)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===D0)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===N0)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===O0)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===U1||s===z1||s===B1||s===V1)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===U1)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===z1)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===B1)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===V1)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Ib)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===H1||s===W1)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===H1)return l===mn?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===W1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===G1||s===j1||s===X1||s===q1||s===$1||s===Y1||s===Z1||s===K1||s===Q1||s===J1||s===eM||s===tM||s===nM||s===iM)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===G1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===j1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===X1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===q1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===$1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Y1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Z1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===K1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Q1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===J1)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===eM)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===tM)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===nM)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===iM)return l===mn?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===k0||s===rM||s===sM)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===k0)return l===mn?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(s===rM)return a.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(s===sM)return a.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(s===tO||s===oM||s===aM||s===lM)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===k0)return a.COMPRESSED_RED_RGTC1_EXT;if(s===oM)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===aM)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===lM)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===ol?i?t.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):t[s]!==void 0?t[s]:null}return{convert:r}}class IO extends Wn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class hd extends sn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const rq={type:"move"};class aw{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new hd,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new hd,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new B,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new B),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new hd,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new B,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new B),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const i of e.hand.values())this._getHandJoint(n,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,i){let r=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const y=n.getJointPose(_,i),m=this._getHandJoint(c,_);y!==null&&(m.matrix.fromArray(y.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.matrixWorldNeedsUpdate=!0,m.jointRadius=y.radius),m.visible=y!==null}const d=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],p=d.position.distanceTo(h.position),g=.02,v=.005;c.inputState.pinching&&p>g+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=g-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(r=n.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(a.matrix.fromArray(r.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,r.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(r.linearVelocity)):a.hasLinearVelocity=!1,r.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(r.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(rq)))}return a!==null&&(a.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const i=new hd;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[n.jointName]=i,e.add(i)}return e.joints[n.jointName]}}const sq=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,oq=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class aq{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,i){if(this.texture===null){const r=new Ln,s=e.properties.get(r);s.__webglTexture=n.texture,(n.depthNear!=i.depthNear||n.depthFar!=i.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=r}}render(e,n){if(this.texture!==null){if(this.mesh===null){const i=n.cameras[0].viewport,r=new Ns({extensions:{fragDepth:!0},vertexShader:sq,fragmentShader:oq,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new ni(new kf(20,20),r)}e.render(this.mesh,n)}}reset(){this.texture=null,this.mesh=null}}class lq extends bo{constructor(e,n){super();const i=this;let r=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,h=null,p=null,g=null,v=null;const _=new aq,y=n.getContextAttributes();let m=null,w=null;const S=[],E=[],C=new ye;let R=null;const I=new Wn;I.layers.enable(1),I.viewport=new cn;const N=new Wn;N.layers.enable(2),N.viewport=new cn;const F=[I,N],A=new IO;A.layers.enable(1),A.layers.enable(2);let D=null,j=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ie){let he=S[ie];return he===void 0&&(he=new aw,S[ie]=he),he.getTargetRaySpace()},this.getControllerGrip=function(ie){let he=S[ie];return he===void 0&&(he=new aw,S[ie]=he),he.getGripSpace()},this.getHand=function(ie){let he=S[ie];return he===void 0&&(he=new aw,S[ie]=he),he.getHandSpace()};function K(ie){const he=E.indexOf(ie.inputSource);if(he===-1)return;const Ee=S[he];Ee!==void 0&&(Ee.update(ie.inputSource,ie.frame,c||o),Ee.dispatchEvent({type:ie.type,data:ie.inputSource}))}function V(){r.removeEventListener("select",K),r.removeEventListener("selectstart",K),r.removeEventListener("selectend",K),r.removeEventListener("squeeze",K),r.removeEventListener("squeezestart",K),r.removeEventListener("squeezeend",K),r.removeEventListener("end",V),r.removeEventListener("inputsourceschange",Z);for(let ie=0;ie=0&&(E[me]=null,S[me].disconnect(Ee))}for(let he=0;he=E.length){E.push(Ee),me=Le;break}else if(E[Le]===null){E[Le]=Ee,me=Le;break}if(me===-1)break}const Re=S[me];Re&&Re.connect(Ee)}}const Y=new B,J=new B;function k(ie,he,Ee){Y.setFromMatrixPosition(he.matrixWorld),J.setFromMatrixPosition(Ee.matrixWorld);const me=Y.distanceTo(J),Re=he.projectionMatrix.elements,Le=Ee.projectionMatrix.elements,Ce=Re[14]/(Re[10]-1),Ae=Re[14]/(Re[10]+1),H=(Re[9]+1)/Re[5],xe=(Re[9]-1)/Re[5],fe=(Re[8]-1)/Re[0],Te=(Le[8]+1)/Le[0],ge=Ce*fe,qe=Ce*Te,Fe=me/(-fe+Te),U=Fe*-fe;he.matrixWorld.decompose(ie.position,ie.quaternion,ie.scale),ie.translateX(U),ie.translateZ(Fe),ie.matrixWorld.compose(ie.position,ie.quaternion,ie.scale),ie.matrixWorldInverse.copy(ie.matrixWorld).invert();const O=Ce+Fe,re=Ae+Fe,Me=ge-U,Se=qe+(me-U),_e=H*Ae/re*O,Ze=xe*Ae/re*O;ie.projectionMatrix.makePerspective(Me,Se,_e,Ze,O,re),ie.projectionMatrixInverse.copy(ie.projectionMatrix).invert()}function W(ie,he){he===null?ie.matrixWorld.copy(ie.matrix):ie.matrixWorld.multiplyMatrices(he.matrixWorld,ie.matrix),ie.matrixWorldInverse.copy(ie.matrixWorld).invert()}this.updateCamera=function(ie){if(r===null)return;_.texture!==null&&(ie.near=_.depthNear,ie.far=_.depthFar),A.near=N.near=I.near=ie.near,A.far=N.far=I.far=ie.far,(D!==A.near||j!==A.far)&&(r.updateRenderState({depthNear:A.near,depthFar:A.far}),D=A.near,j=A.far,I.near=D,I.far=j,N.near=D,N.far=j,I.updateProjectionMatrix(),N.updateProjectionMatrix(),ie.updateProjectionMatrix());const he=ie.parent,Ee=A.cameras;W(A,he);for(let me=0;me0&&(y.alphaTest.value=m.alphaTest);const w=e.get(m).envMap;if(w&&(y.envMap.value=w,y.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=m.reflectivity,y.ior.value=m.ior,y.refractionRatio.value=m.refractionRatio),m.lightMap){y.lightMap.value=m.lightMap;const S=t._useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=m.lightMapIntensity*S,n(m.lightMap,y.lightMapTransform)}m.aoMap&&(y.aoMap.value=m.aoMap,y.aoMapIntensity.value=m.aoMapIntensity,n(m.aoMap,y.aoMapTransform))}function o(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,m.map&&(y.map.value=m.map,n(m.map,y.mapTransform))}function a(y,m){y.dashSize.value=m.dashSize,y.totalSize.value=m.dashSize+m.gapSize,y.scale.value=m.scale}function l(y,m,w,S){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.size.value=m.size*w,y.scale.value=S*.5,m.map&&(y.map.value=m.map,n(m.map,y.uvTransform)),m.alphaMap&&(y.alphaMap.value=m.alphaMap,n(m.alphaMap,y.alphaMapTransform)),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest)}function c(y,m){y.diffuse.value.copy(m.color),y.opacity.value=m.opacity,y.rotation.value=m.rotation,m.map&&(y.map.value=m.map,n(m.map,y.mapTransform)),m.alphaMap&&(y.alphaMap.value=m.alphaMap,n(m.alphaMap,y.alphaMapTransform)),m.alphaTest>0&&(y.alphaTest.value=m.alphaTest)}function d(y,m){y.specular.value.copy(m.specular),y.shininess.value=Math.max(m.shininess,1e-4)}function h(y,m){m.gradientMap&&(y.gradientMap.value=m.gradientMap)}function p(y,m){y.metalness.value=m.metalness,m.metalnessMap&&(y.metalnessMap.value=m.metalnessMap,n(m.metalnessMap,y.metalnessMapTransform)),y.roughness.value=m.roughness,m.roughnessMap&&(y.roughnessMap.value=m.roughnessMap,n(m.roughnessMap,y.roughnessMapTransform)),e.get(m).envMap&&(y.envMapIntensity.value=m.envMapIntensity)}function g(y,m,w){y.ior.value=m.ior,m.sheen>0&&(y.sheenColor.value.copy(m.sheenColor).multiplyScalar(m.sheen),y.sheenRoughness.value=m.sheenRoughness,m.sheenColorMap&&(y.sheenColorMap.value=m.sheenColorMap,n(m.sheenColorMap,y.sheenColorMapTransform)),m.sheenRoughnessMap&&(y.sheenRoughnessMap.value=m.sheenRoughnessMap,n(m.sheenRoughnessMap,y.sheenRoughnessMapTransform))),m.clearcoat>0&&(y.clearcoat.value=m.clearcoat,y.clearcoatRoughness.value=m.clearcoatRoughness,m.clearcoatMap&&(y.clearcoatMap.value=m.clearcoatMap,n(m.clearcoatMap,y.clearcoatMapTransform)),m.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=m.clearcoatRoughnessMap,n(m.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),m.clearcoatNormalMap&&(y.clearcoatNormalMap.value=m.clearcoatNormalMap,n(m.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(m.clearcoatNormalScale),m.side===ir&&y.clearcoatNormalScale.value.negate())),m.iridescence>0&&(y.iridescence.value=m.iridescence,y.iridescenceIOR.value=m.iridescenceIOR,y.iridescenceThicknessMinimum.value=m.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=m.iridescenceThicknessRange[1],m.iridescenceMap&&(y.iridescenceMap.value=m.iridescenceMap,n(m.iridescenceMap,y.iridescenceMapTransform)),m.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=m.iridescenceThicknessMap,n(m.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),m.transmission>0&&(y.transmission.value=m.transmission,y.transmissionSamplerMap.value=w.texture,y.transmissionSamplerSize.value.set(w.width,w.height),m.transmissionMap&&(y.transmissionMap.value=m.transmissionMap,n(m.transmissionMap,y.transmissionMapTransform)),y.thickness.value=m.thickness,m.thicknessMap&&(y.thicknessMap.value=m.thicknessMap,n(m.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=m.attenuationDistance,y.attenuationColor.value.copy(m.attenuationColor)),m.anisotropy>0&&(y.anisotropyVector.value.set(m.anisotropy*Math.cos(m.anisotropyRotation),m.anisotropy*Math.sin(m.anisotropyRotation)),m.anisotropyMap&&(y.anisotropyMap.value=m.anisotropyMap,n(m.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=m.specularIntensity,y.specularColor.value.copy(m.specularColor),m.specularColorMap&&(y.specularColorMap.value=m.specularColorMap,n(m.specularColorMap,y.specularColorMapTransform)),m.specularIntensityMap&&(y.specularIntensityMap.value=m.specularIntensityMap,n(m.specularIntensityMap,y.specularIntensityMapTransform))}function v(y,m){m.matcap&&(y.matcap.value=m.matcap)}function _(y,m){const w=e.get(m).light;y.referencePosition.value.setFromMatrixPosition(w.matrixWorld),y.nearDistance.value=w.shadow.camera.near,y.farDistance.value=w.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function uq(t,e,n,i){let r={},s={},o=[];const a=n.isWebGL2?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(w,S){const E=S.program;i.uniformBlockBinding(w,E)}function c(w,S){let E=r[w.id];E===void 0&&(v(w),E=d(w),r[w.id]=E,w.addEventListener("dispose",y));const C=S.program;i.updateUBOMapping(w,C);const R=e.render.frame;s[w.id]!==R&&(p(w),s[w.id]=R)}function d(w){const S=h();w.__bindingPointIndex=S;const E=t.createBuffer(),C=w.__size,R=w.usage;return t.bindBuffer(t.UNIFORM_BUFFER,E),t.bufferData(t.UNIFORM_BUFFER,C,R),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,S,E),E}function h(){for(let w=0;w0&&(E+=C-R),w.__size=E,w.__cache={},this}function _(w){const S={boundary:0,storage:0};return typeof w=="number"||typeof w=="boolean"?(S.boundary=4,S.storage=4):w.isVector2?(S.boundary=8,S.storage=8):w.isVector3||w.isColor?(S.boundary=16,S.storage=12):w.isVector4?(S.boundary=16,S.storage=16):w.isMatrix3?(S.boundary=48,S.storage=48):w.isMatrix4?(S.boundary=64,S.storage=64):w.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",w),S}function y(w){const S=w.target;S.removeEventListener("dispose",y);const E=o.indexOf(S.__bindingPointIndex);o.splice(E,1),t.deleteBuffer(r[S.id]),delete r[S.id],delete s[S.id]}function m(){for(const w in r)t.deleteBuffer(r[w]);o=[],r={},s={}}return{bind:l,update:c,dispose:m}}class Gb{constructor(e={}){const{canvas:n=vO(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let p;i!==null?p=i.getContextAttributes().alpha:p=o;const g=new Uint32Array(4),v=new Int32Array(4);let _=null,y=null;const m=[],w=[];this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Vn,this._useLegacyLights=!1,this.toneMapping=fo,this.toneMappingExposure=1;const S=this;let E=!1,C=0,R=0,I=null,N=-1,F=null;const A=new cn,D=new cn;let j=null;const K=new ze(0);let V=0,Z=n.width,Y=n.height,J=1,k=null,W=null;const $=new cn(0,0,Z,Y),Q=new cn(0,0,Z,Y);let de=!1;const be=new Wm;let ie=!1,he=!1,Ee=null;const me=new Et,Re=new ye,Le=new B,Ce={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Ae(){return I===null?J:1}let H=i;function xe(z,se){for(let le=0;le{function $e(){if(ce.forEach(function(ct){Fe.get(ct).currentProgram.isReady()&&ce.delete(ct)}),ce.size===0){ae(z);return}setTimeout($e,10)}fe.get("KHR_parallel_shader_compile")!==null?$e():setTimeout($e,10)})};let Yt=null;function pn(z){Yt&&Yt(z)}function Zn(){yi.stop()}function fn(){yi.start()}const yi=new EO;yi.setAnimationLoop(pn),typeof self<"u"&&yi.setContext(self),this.setAnimationLoop=function(z){Yt=z,lt.setAnimationLoop(z),z===null?yi.stop():yi.start()},lt.addEventListener("sessionstart",Zn),lt.addEventListener("sessionend",fn),this.render=function(z,se){if(se!==void 0&&se.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(E===!0)return;z.matrixWorldAutoUpdate===!0&&z.updateMatrixWorld(),se.parent===null&&se.matrixWorldAutoUpdate===!0&&se.updateMatrixWorld(),lt.enabled===!0&<.isPresenting===!0&&(lt.cameraAutoUpdate===!0&<.updateCamera(se),se=lt.getCamera()),z.isScene===!0&&z.onBeforeRender(S,z,se,I),y=rt.get(z,w.length),y.init(),w.push(y),me.multiplyMatrices(se.projectionMatrix,se.matrixWorldInverse),be.setFromProjectionMatrix(me),he=this.localClippingEnabled,ie=mt.init(this.clippingPlanes,he),_=Ve.get(z,m.length),_.init(),m.push(_),jr(z,se,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(k,W),this.info.render.frame++,ie===!0&&mt.beginShadows();const le=y.state.shadowsArray;if(we.render(le,z,se),ie===!0&&mt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(lt.enabled===!1||lt.isPresenting===!1||lt.hasDepthSensing()===!1)&&Ot.render(_,z),y.setupLights(S._useLegacyLights),se.isArrayCamera){const ce=se.cameras;for(let ae=0,$e=ce.length;ae<$e;ae++){const ct=ce[ae];Qf(_,z,ct,ct.viewport)}}else Qf(_,z,se);I!==null&&(U.updateMultisampleRenderTarget(I),U.updateRenderTargetMipmap(I)),z.isScene===!0&&z.onAfterRender(S,z,se),ve.resetDefaultState(),N=-1,F=null,w.pop(),w.length>0?y=w[w.length-1]:y=null,m.pop(),m.length>0?_=m[m.length-1]:_=null};function jr(z,se,le,ce){if(z.visible===!1)return;if(z.layers.test(se.layers)){if(z.isGroup)le=z.renderOrder;else if(z.isLOD)z.autoUpdate===!0&&z.update(se);else if(z.isLight)y.pushLight(z),z.castShadow&&y.pushShadow(z);else if(z.isSprite){if(!z.frustumCulled||be.intersectsSprite(z)){ce&&Le.setFromMatrixPosition(z.matrixWorld).applyMatrix4(me);const ct=_e.update(z),gt=z.material;gt.visible&&_.push(z,ct,gt,le,Le.z,null)}}else if((z.isMesh||z.isLine||z.isPoints)&&(!z.frustumCulled||be.intersectsObject(z))){const ct=_e.update(z),gt=z.material;if(ce&&(z.boundingSphere!==void 0?(z.boundingSphere===null&&z.computeBoundingSphere(),Le.copy(z.boundingSphere.center)):(ct.boundingSphere===null&&ct.computeBoundingSphere(),Le.copy(ct.boundingSphere.center)),Le.applyMatrix4(z.matrixWorld).applyMatrix4(me)),Array.isArray(gt)){const yt=ct.groups;for(let At=0,bt=yt.length;At0&&Jf(ae,$e,se,le),ce&&ge.viewport(A.copy(ce)),ae.length>0&&yu(ae,se,le),$e.length>0&&yu($e,se,le),ct.length>0&&yu(ct,se,le),ge.buffers.depth.setTest(!0),ge.buffers.depth.setMask(!0),ge.buffers.color.setMask(!0),ge.setPolygonOffset(!1)}function Jf(z,se,le,ce){if((le.isScene===!0?le.overrideMaterial:null)!==null)return;const $e=Te.isWebGL2;Ee===null&&(Ee=new Ds(1,1,{generateMipmaps:!0,type:fe.has("EXT_color_buffer_half_float")?lf:ho,minFilter:co,samples:$e?4:0})),S.getDrawingBufferSize(Re),$e?Ee.setSize(Re.x,Re.y):Ee.setSize(oy(Re.x),oy(Re.y));const ct=S.getRenderTarget();S.setRenderTarget(Ee),S.getClearColor(K),V=S.getClearAlpha(),V<1&&S.setClearColor(16777215,.5),S.clear();const gt=S.toneMapping;S.toneMapping=fo,yu(z,le,ce),U.updateMultisampleRenderTarget(Ee),U.updateRenderTargetMipmap(Ee);let yt=!1;for(let At=0,bt=se.length;At0),Ct=!!le.morphAttributes.position,Tn=!!le.morphAttributes.normal,xi=!!le.morphAttributes.color;let yn=fo;ce.toneMapped&&(I===null||I.isXRRenderTarget===!0)&&(yn=S.toneMapping);const ci=le.morphAttributes.position||le.morphAttributes.normal||le.morphAttributes.color,xt=ci!==void 0?ci.length:0,Qe=Fe.get(ce),Xr=y.state.lights;if(ie===!0&&(he===!0||z!==F)){const _i=z===F&&ce.id===N;mt.setState(ce,z,_i)}let Wt=!1;ce.version===Qe.__version?(Qe.needsLights&&Qe.lightsStateVersion!==Xr.state.version||Qe.outputColorSpace!==gt||ae.isBatchedMesh&&Qe.batching===!1||!ae.isBatchedMesh&&Qe.batching===!0||ae.isInstancedMesh&&Qe.instancing===!1||!ae.isInstancedMesh&&Qe.instancing===!0||ae.isSkinnedMesh&&Qe.skinning===!1||!ae.isSkinnedMesh&&Qe.skinning===!0||ae.isInstancedMesh&&Qe.instancingColor===!0&&ae.instanceColor===null||ae.isInstancedMesh&&Qe.instancingColor===!1&&ae.instanceColor!==null||Qe.envMap!==yt||ce.fog===!0&&Qe.fog!==$e||Qe.numClippingPlanes!==void 0&&(Qe.numClippingPlanes!==mt.numPlanes||Qe.numIntersection!==mt.numIntersection)||Qe.vertexAlphas!==At||Qe.vertexTangents!==bt||Qe.morphTargets!==Ct||Qe.morphNormals!==Tn||Qe.morphColors!==xi||Qe.toneMapping!==yn||Te.isWebGL2===!0&&Qe.morphTargetsCount!==xt)&&(Wt=!0):(Wt=!0,Qe.__version=ce.version);let On=Qe.currentProgram;Wt===!0&&(On=xu(ce,se,ae));let Gs=!1,qr=!1,ui=!1;const jn=On.getUniforms(),js=Qe.uniforms;if(ge.useProgram(On.program)&&(Gs=!0,qr=!0,ui=!0),ce.id!==N&&(N=ce.id,qr=!0),Gs||F!==z){jn.setValue(H,"projectionMatrix",z.projectionMatrix),jn.setValue(H,"viewMatrix",z.matrixWorldInverse);const _i=jn.map.cameraPosition;_i!==void 0&&_i.setValue(H,Le.setFromMatrixPosition(z.matrixWorld)),Te.logarithmicDepthBuffer&&jn.setValue(H,"logDepthBufFC",2/(Math.log(z.far+1)/Math.LN2)),(ce.isMeshPhongMaterial||ce.isMeshToonMaterial||ce.isMeshLambertMaterial||ce.isMeshBasicMaterial||ce.isMeshStandardMaterial||ce.isShaderMaterial)&&jn.setValue(H,"isOrthographic",z.isOrthographicCamera===!0),F!==z&&(F=z,qr=!0,ui=!0)}if(ae.isSkinnedMesh){jn.setOptional(H,ae,"bindMatrix"),jn.setOptional(H,ae,"bindMatrixInverse");const _i=ae.skeleton;_i&&(Te.floatVertexTextures?(_i.boneTexture===null&&_i.computeBoneTexture(),jn.setValue(H,"boneTexture",_i.boneTexture,U)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}ae.isBatchedMesh&&(jn.setOptional(H,ae,"batchingTexture"),jn.setValue(H,"batchingTexture",ae._matricesTexture,U));const _u=le.morphAttributes;if((_u.position!==void 0||_u.normal!==void 0||_u.color!==void 0&&Te.isWebGL2===!0)&&wt.update(ae,le,On),(qr||Qe.receiveShadow!==ae.receiveShadow)&&(Qe.receiveShadow=ae.receiveShadow,jn.setValue(H,"receiveShadow",ae.receiveShadow)),ce.isMeshGouraudMaterial&&ce.envMap!==null&&(js.envMap.value=yt,js.flipEnvMap.value=yt.isCubeTexture&&yt.isRenderTargetTexture===!1?-1:1),qr&&(jn.setValue(H,"toneMappingExposure",S.toneMappingExposure),Qe.needsLights&&R_(js,ui),$e&&ce.fog===!0&&Oe.refreshFogUniforms(js,$e),Oe.refreshMaterialUniforms(js,ce,J,Y,Ee),U0.upload(H,ug(Qe),js,U)),ce.isShaderMaterial&&ce.uniformsNeedUpdate===!0&&(U0.upload(H,ug(Qe),js,U),ce.uniformsNeedUpdate=!1),ce.isSpriteMaterial&&jn.setValue(H,"center",ae.center),jn.setValue(H,"modelViewMatrix",ae.modelViewMatrix),jn.setValue(H,"normalMatrix",ae.normalMatrix),jn.setValue(H,"modelMatrix",ae.matrixWorld),ce.isShaderMaterial||ce.isRawShaderMaterial){const _i=ce.uniformsGroups;for(let Su=0,Er=_i.length;Su0&&U.useMultisampledRTT(z)===!1?ae=Fe.get(z).__webglMultisampledFramebuffer:Array.isArray(bt)?ae=bt[le]:ae=bt,A.copy(z.viewport),D.copy(z.scissor),j=z.scissorTest}else A.copy($).multiplyScalar(J).floor(),D.copy(Q).multiplyScalar(J).floor(),j=de;if(ge.bindFramebuffer(H.FRAMEBUFFER,ae)&&Te.drawBuffers&&ce&&ge.drawBuffers(z,ae),ge.viewport(A),ge.scissor(D),ge.setScissorTest(j),$e){const yt=Fe.get(z.texture);H.framebufferTexture2D(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,H.TEXTURE_CUBE_MAP_POSITIVE_X+se,yt.__webglTexture,le)}else if(ct){const yt=Fe.get(z.texture),At=se||0;H.framebufferTextureLayer(H.FRAMEBUFFER,H.COLOR_ATTACHMENT0,yt.__webglTexture,le||0,At)}N=-1},this.readRenderTargetPixels=function(z,se,le,ce,ae,$e,ct){if(!(z&&z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let gt=Fe.get(z).__webglFramebuffer;if(z.isWebGLCubeRenderTarget&&ct!==void 0&&(gt=gt[ct]),gt){ge.bindFramebuffer(H.FRAMEBUFFER,gt);try{const yt=z.texture,At=yt.format,bt=yt.type;if(At!==Hi&&q.convert(At)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ct=bt===lf&&(fe.has("EXT_color_buffer_half_float")||Te.isWebGL2&&fe.has("EXT_color_buffer_float"));if(bt!==ho&&q.convert(bt)!==H.getParameter(H.IMPLEMENTATION_COLOR_READ_TYPE)&&!(bt===cs&&(Te.isWebGL2||fe.has("OES_texture_float")||fe.has("WEBGL_color_buffer_float")))&&!Ct){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}se>=0&&se<=z.width-ce&&le>=0&&le<=z.height-ae&&H.readPixels(se,le,ce,ae,q.convert(At),q.convert(bt),$e)}finally{const yt=I!==null?Fe.get(I).__webglFramebuffer:null;ge.bindFramebuffer(H.FRAMEBUFFER,yt)}}},this.copyFramebufferToTexture=function(z,se,le=0){const ce=Math.pow(2,-le),ae=Math.floor(se.image.width*ce),$e=Math.floor(se.image.height*ce);U.setTexture2D(se,0),H.copyTexSubImage2D(H.TEXTURE_2D,le,0,0,z.x,z.y,ae,$e),ge.unbindTexture()},this.copyTextureToTexture=function(z,se,le,ce=0){const ae=se.image.width,$e=se.image.height,ct=q.convert(le.format),gt=q.convert(le.type);U.setTexture2D(le,0),H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,le.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,le.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,le.unpackAlignment),se.isDataTexture?H.texSubImage2D(H.TEXTURE_2D,ce,z.x,z.y,ae,$e,ct,gt,se.image.data):se.isCompressedTexture?H.compressedTexSubImage2D(H.TEXTURE_2D,ce,z.x,z.y,se.mipmaps[0].width,se.mipmaps[0].height,ct,se.mipmaps[0].data):H.texSubImage2D(H.TEXTURE_2D,ce,z.x,z.y,ct,gt,se.image),ce===0&&le.generateMipmaps&&H.generateMipmap(H.TEXTURE_2D),ge.unbindTexture()},this.copyTextureToTexture3D=function(z,se,le,ce,ae=0){if(S.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const $e=z.max.x-z.min.x+1,ct=z.max.y-z.min.y+1,gt=z.max.z-z.min.z+1,yt=q.convert(ce.format),At=q.convert(ce.type);let bt;if(ce.isData3DTexture)U.setTexture3D(ce,0),bt=H.TEXTURE_3D;else if(ce.isDataArrayTexture||ce.isCompressedArrayTexture)U.setTexture2DArray(ce,0),bt=H.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}H.pixelStorei(H.UNPACK_FLIP_Y_WEBGL,ce.flipY),H.pixelStorei(H.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ce.premultiplyAlpha),H.pixelStorei(H.UNPACK_ALIGNMENT,ce.unpackAlignment);const Ct=H.getParameter(H.UNPACK_ROW_LENGTH),Tn=H.getParameter(H.UNPACK_IMAGE_HEIGHT),xi=H.getParameter(H.UNPACK_SKIP_PIXELS),yn=H.getParameter(H.UNPACK_SKIP_ROWS),ci=H.getParameter(H.UNPACK_SKIP_IMAGES),xt=le.isCompressedTexture?le.mipmaps[ae]:le.image;H.pixelStorei(H.UNPACK_ROW_LENGTH,xt.width),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,xt.height),H.pixelStorei(H.UNPACK_SKIP_PIXELS,z.min.x),H.pixelStorei(H.UNPACK_SKIP_ROWS,z.min.y),H.pixelStorei(H.UNPACK_SKIP_IMAGES,z.min.z),le.isDataTexture||le.isData3DTexture?H.texSubImage3D(bt,ae,se.x,se.y,se.z,$e,ct,gt,yt,At,xt.data):le.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),H.compressedTexSubImage3D(bt,ae,se.x,se.y,se.z,$e,ct,gt,yt,xt.data)):H.texSubImage3D(bt,ae,se.x,se.y,se.z,$e,ct,gt,yt,At,xt),H.pixelStorei(H.UNPACK_ROW_LENGTH,Ct),H.pixelStorei(H.UNPACK_IMAGE_HEIGHT,Tn),H.pixelStorei(H.UNPACK_SKIP_PIXELS,xi),H.pixelStorei(H.UNPACK_SKIP_ROWS,yn),H.pixelStorei(H.UNPACK_SKIP_IMAGES,ci),ae===0&&ce.generateMipmaps&&H.generateMipmap(bt),ge.unbindTexture()},this.initTexture=function(z){z.isCubeTexture?U.setTextureCube(z,0):z.isData3DTexture?U.setTexture3D(z,0):z.isDataArrayTexture||z.isCompressedArrayTexture?U.setTexture2DArray(z,0):U.setTexture2D(z,0),ge.unbindTexture()},this.resetState=function(){C=0,R=0,I=null,ge.reset(),ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return uo}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===px?"display-p3":"srgb",n.unpackColorSpace=ln.workingColorSpace===zm?"display-p3":"srgb"}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Vn?ll:Db}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===ll?Vn:vr}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}class LO extends Gb{}LO.prototype.isWebGL1Renderer=!0;class vx{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ze(e),this.density=n}clone(){return new vx(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class yx{constructor(e,n=1,i=1e3){this.isFog=!0,this.name="",this.color=new ze(e),this.near=n,this.far=i}clone(){return new yx(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class ay extends sn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n}}class xx{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=Np,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.version=0,this.uuid=Fr()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return Vc("THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,n,i){e*=this.stride,i*=n.stride;for(let r=0,s=this.stride;re.far||n.push({distance:l,point:Mh.clone(),uv:Or.getInterpolation(Mh,Cv,bh,Pv,l2,lw,c2,new ye),face:null,object:this})}copy(e,n){return super.copy(e,n),e.center!==void 0&&this.center.copy(e.center),this.material=e.material,this}}function Rv(t,e,n,i,r,s){Qu.subVectors(t,n).addScalar(.5).multiply(i),r!==void 0?(Eh.x=s*Qu.x-r*Qu.y,Eh.y=r*Qu.x+s*Qu.y):Eh.copy(Qu),t.copy(e),t.x+=Eh.x,t.y+=Eh.y,t.applyMatrix4(DO)}const Iv=new B,u2=new B;class OO extends sn{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const n=e.levels;for(let i=0,r=n.length;i0){let i,r;for(i=1,r=n.length;i0){Iv.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(Iv);this.getObjectForDistance(r).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){Iv.setFromMatrixPosition(e.matrixWorld),u2.setFromMatrixPosition(this.matrixWorld);const i=Iv.distanceTo(u2)/e.zoom;n[0].object.visible=!0;let r,s;for(r=1,s=n.length;r=o)n[r-1].object.visible=!1,n[r].object.visible=!0;else break}for(this._currentLevel=r-1;r=i.length&&i.push({start:-1,count:-1,z:-1});const s=i[this.index];r.push(s),this.index++,s.start=e.start,s.count=e.count,s.z=n}reset(){this.list.length=0,this.index=0}}const ed="batchId",Fa=new Et,x2=new Et,vq=new Et,_2=new Et,dw=new Wm,Nv=new rr,sc=new Gi,Ch=new B,fw=new gq,Oi=new ni,Ov=[];function yq(t,e,n=0){const i=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const r=t.count;for(let s=0;s65536?new Uint32Array(s):new Uint16Array(s);n.setIndex(new un(a,1))}const o=r>65536?new Uint32Array(i):new Uint16Array(i);n.setAttribute(ed,new un(o,1)),this._geometryInitialized=!0}}_validateGeometry(e){if(e.getAttribute(ed))throw new Error(`BatchedMesh: Geometry cannot use attribute "${ed}"`);const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const i in n.attributes){if(i===ed)continue;if(!e.hasAttribute(i))throw new Error(`BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const r=e.getAttribute(i),s=n.getAttribute(i);if(r.itemSize!==s.itemSize||r.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new rr);const e=this._geometryCount,n=this.boundingBox,i=this._active;n.makeEmpty();for(let r=0;r=this._maxGeometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");const r={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),n===-1?r.vertexCount=e.getAttribute("position").count:r.vertexCount=n,s===null?r.vertexStart=0:r.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(i===-1?r.indexCount=c.count:r.indexCount=i,s===null?r.indexStart=0:r.indexStart=s.indexStart+s.indexCount),r.indexStart!==-1&&r.indexStart+r.indexCount>this._maxIndexCount||r.vertexStart+r.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const h=this._visibility,p=this._active,g=this._matricesTexture,v=this._matricesTexture.image.data;h.push(!0),p.push(!0);const _=this._geometryCount;this._geometryCount++,vq.toArray(v,_*16),g.needsUpdate=!0,o.push(r),a.push({start:d?r.indexStart:r.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new rr,sphereInitialized:!1,sphere:new Gi});const y=this.geometry.getAttribute(ed);for(let m=0;m=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const i=this.geometry,r=i.getIndex()!==null,s=i.getIndex(),o=n.getIndex(),a=this._reservedRanges[e];if(r&&o.count>a.indexCount||n.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const g in i.attributes){if(g===ed)continue;const v=n.getAttribute(g),_=i.getAttribute(g);yq(v,_,l);const y=v.itemSize;for(let m=v.count,w=c;m=n.length||n[e]===!1?this:(n[e]=!1,this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(this._active[e]===!1)return null;const r=this._bounds[e],s=r.box,o=this.geometry;if(r.boxInitialized===!1){s.makeEmpty();const a=o.index,l=o.attributes.position,c=this._drawRanges[e];for(let d=c.start,h=c.start+c.count;d=o||i[e]===!1?this:(n.toArray(s,e*16),r.needsUpdate=!0,this)}getMatrixAt(e,n){const i=this._active,r=this._matricesTexture.image.data,s=this._geometryCount;return e>=s||i[e]===!1?null:n.fromArray(r,e*16)}setVisibleAt(e,n){const i=this._visibility,r=this._active,s=this._geometryCount;return e>=s||r[e]===!1||i[e]===n?this:(i[e]=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._visibility,i=this._active,r=this._geometryCount;return e>=r||i[e]===!1?!1:n[e]}raycast(e,n){const i=this._visibility,r=this._active,s=this._drawRanges,o=this._geometryCount,a=this.matrixWorld,l=this.geometry;Oi.material=this.material,Oi.geometry.index=l.index,Oi.geometry.attributes=l.attributes,Oi.geometry.boundingBox===null&&(Oi.geometry.boundingBox=new rr),Oi.geometry.boundingSphere===null&&(Oi.geometry.boundingSphere=new Gi);for(let c=0;c({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._visibility=e._visibility.slice(),this._active=e._active.slice(),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxGeometryCount=e._maxGeometryCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.slice(),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this}onBeforeRender(e,n,i,r,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=r.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._active,c=this._visibility,d=this._multiDrawStarts,h=this._multiDrawCounts,p=this._drawRanges,g=this.perObjectFrustumCulled;g&&(_2.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),dw.setFromProjectionMatrix(_2,e.coordinateSystem));let v=0;if(this.sortObjects){x2.copy(this.matrixWorld).invert(),Ch.setFromMatrixPosition(i.matrixWorld).applyMatrix4(x2);for(let m=0,w=c.length;ml)continue;p.applyMatrix4(this.matrixWorld);const N=e.ray.origin.distanceTo(p);Ne.far||n.push({distance:N,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),w=Math.min(y.count,o.start+o.count);for(let S=m,E=w-1;Sl)continue;p.applyMatrix4(this.matrixWorld);const R=e.ray.origin.distanceTo(p);Re.far||n.push({distance:R,point:h.clone().applyMatrix4(this.matrixWorld),index:S,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const n=this.geometry.morphAttributes,i=Object.keys(n);if(i.length>0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s0){const r=n[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class xq extends Ln{constructor(e,n,i,r,s,o,a,l,c){super(e,n,i,r,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Pn,this.magFilter=s!==void 0?s:Pn,this.generateMipmaps=!1;const d=this;function h(){d.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class _q extends Ln{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=$n,this.minFilter=$n,this.generateMipmaps=!1,this.needsUpdate=!0}}class Sx extends Ln{constructor(e,n,i,r,s,o,a,l,c,d,h,p){super(null,o,a,l,c,d,r,s,h,p),this.isCompressedTexture=!0,this.image={width:n,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Sq extends Sx{constructor(e,n,i,r,s,o){super(e,n,i,s,o),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=Vi}}class wq extends Sx{constructor(e,n,i){super(void 0,e[0].width,e[0].height,n,i,da),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Mq extends Ln{constructor(e,n,i,r,s,o,a,l,c){super(e,n,i,r,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Bs{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const i=this.getUtoTmapping(e);return this.getPoint(i,n)}getPoints(e=5){const n=[];for(let i=0;i<=e;i++)n.push(this.getPoint(i/e));return n}getSpacedPoints(e=5){const n=[];for(let i=0;i<=e;i++)n.push(this.getPointAt(i/e));return n}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const n=[];let i,r=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),n.push(s),r=i;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const i=this.getLengths();let r=0;const s=i.length;let o;n?o=n:o=e*i[s-1];let a=0,l=s-1,c;for(;a<=l;)if(r=Math.floor(a+(l-a)/2),c=i[r]-o,c<0)a=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===o)return r/(s-1);const d=i[r],p=i[r+1]-d,g=(o-d)/p;return(r+g)/(s-1)}getTangent(e,n){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const o=this.getPoint(r),a=this.getPoint(s),l=n||(o.isVector2?new ye:new B);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const i=this.getUtoTmapping(e);return this.getTangent(i,n)}computeFrenetFrames(e,n){const i=new B,r=[],s=[],o=[],a=new B,l=new Et;for(let g=0;g<=e;g++){const v=g/e;r[g]=this.getTangentAt(v,new B)}s[0]=new B,o[0]=new B;let c=Number.MAX_VALUE;const d=Math.abs(r[0].x),h=Math.abs(r[0].y),p=Math.abs(r[0].z);d<=c&&(c=d,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),p<=c&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let g=1;g<=e;g++){if(s[g]=s[g-1].clone(),o[g]=o[g-1].clone(),a.crossVectors(r[g-1],r[g]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(Hn(r[g-1].dot(r[g]),-1,1));s[g].applyMatrix4(l.makeRotationAxis(a,v))}o[g].crossVectors(r[g],s[g])}if(n===!0){let g=Math.acos(Hn(s[0].dot(s[e]),-1,1));g/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(g=-g);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(r[v],g*v)),o[v].crossVectors(r[v],s[v])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class wx extends Bs{constructor(e=0,n=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=n,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n){const i=n||new ye,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const o=Math.abs(s)r;)s-=r;s0?0:(Math.floor(Math.abs(a)/s)+1)*s:l===0&&a===s-1&&(a=s-2,l=1);let c,d;this.closed||a>0?c=r[(a-1)%s]:(zv.subVectors(r[0],r[1]).add(r[0]),c=zv);const h=r[a%s],p=r[(a+1)%s];if(this.closed||a+2r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(C2(a,l.x,c.x,d.x,h.x),C2(a,l.y,c.y,d.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let n=0,i=e.points.length;n=i){const o=r[s]-i,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,n)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let n=0;for(let i=0,r=this.curves.length;i1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,i=e.curves.length;n0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const d=c.getPoint(1);return this.currentPoint.copy(d),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class Gm extends Ut{constructor(e=[new ye(0,-.5),new ye(.5,0),new ye(0,.5)],n=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:i,phiLength:r},n=Math.floor(n),r=Hn(r,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,h=new B,p=new ye,g=new B,v=new B,_=new B;let y=0,m=0;for(let w=0;w<=e.length-1;w++)switch(w){case 0:y=e[w+1].x-e[w].x,m=e[w+1].y-e[w].y,g.x=m*1,g.y=-y,g.z=m*0,_.copy(g),g.normalize(),l.push(g.x,g.y,g.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:y=e[w+1].x-e[w].x,m=e[w+1].y-e[w].y,g.x=m*1,g.y=-y,g.z=m*0,v.copy(g),g.x+=_.x,g.y+=_.y,g.z+=_.z,g.normalize(),l.push(g.x,g.y,g.z),_.copy(v)}for(let w=0;w<=n;w++){const S=i+w*d*r,E=Math.sin(S),C=Math.cos(S);for(let R=0;R<=e.length-1;R++){h.x=e[R].x*E,h.y=e[R].y,h.z=e[R].x*C,o.push(h.x,h.y,h.z),p.x=w/n,p.y=R/(e.length-1),a.push(p.x,p.y);const I=l[3*R+0]*E,N=l[3*R+1],F=l[3*R+0]*C;c.push(I,N,F)}}for(let w=0;w0&&S(!0),n>0&&S(!1)),this.setIndex(d),this.setAttribute("position",new it(h,3)),this.setAttribute("normal",new it(p,3)),this.setAttribute("uv",new it(g,2));function w(){const E=new B,C=new B;let R=0;const I=(n-e)/i;for(let N=0;N<=s;N++){const F=[],A=N/s,D=A*(n-e)+e;for(let j=0;j<=r;j++){const K=j/r,V=K*l+a,Z=Math.sin(V),Y=Math.cos(V);C.x=D*Z,C.y=-A*i+y,C.z=D*Y,h.push(C.x,C.y,C.z),E.set(Z,I,Y).normalize(),p.push(E.x,E.y,E.z),g.push(K,1-A),F.push(v++)}_.push(F)}for(let N=0;N.9&&I<.1&&(S<.2&&(o[w+0]+=1),E<.2&&(o[w+2]+=1),C<.2&&(o[w+4]+=1))}}function p(w){s.push(w.x,w.y,w.z)}function g(w,S){const E=w*3;S.x=e[E+0],S.y=e[E+1],S.z=e[E+2]}function v(){const w=new B,S=new B,E=new B,C=new B,R=new ye,I=new ye,N=new ye;for(let F=0,A=0;F80*n){a=c=t[0],l=d=t[1];for(let v=n;vc&&(c=h),p>d&&(d=p);g=Math.max(c-a,d-l),g=g!==0?32767/g:0}return Up(s,o,n,a,l,g,0),o}};function qO(t,e,n,i,r){let s,o;if(r===qq(t,e,n,i)>0)for(s=e;s=e;s-=i)o=P2(s,t[s],t[s+1],o);return o&&Ax(o,o.next)&&(Bp(o),o=o.next),o}function Kc(t,e){if(!t)return t;e||(e=t);let n=t,i;do if(i=!1,!n.steiner&&(Ax(n,n.next)||In(n.prev,n,n.next)===0)){if(Bp(n),n=e=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==e);return e}function Up(t,e,n,i,r,s,o){if(!t)return;!o&&s&&Vq(t,i,r,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?Dq(t,i,r,s):Lq(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),Bp(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=Nq(Kc(t),e,n),Up(t,e,n,i,r,s,2)):o===2&&Oq(t,e,n,i,r,s):Up(Kc(t),e,n,i,r,s,1);break}}}function Lq(t){const e=t.prev,n=t,i=t.next;if(In(e,n,i)>=0)return!1;const r=e.x,s=n.x,o=i.x,a=e.y,l=n.y,c=i.y,d=rs?r>o?r:o:s>o?s:o,g=a>l?a>c?a:c:l>c?l:c;let v=i.next;for(;v!==e;){if(v.x>=d&&v.x<=p&&v.y>=h&&v.y<=g&&pd(r,a,s,l,o,c,v.x,v.y)&&In(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function Dq(t,e,n,i){const r=t.prev,s=t,o=t.next;if(In(r,s,o)>=0)return!1;const a=r.x,l=s.x,c=o.x,d=r.y,h=s.y,p=o.y,g=al?a>c?a:c:l>c?l:c,y=d>h?d>p?d:p:h>p?h:p,m=mM(g,v,e,n,i),w=mM(_,y,e,n,i);let S=t.prevZ,E=t.nextZ;for(;S&&S.z>=m&&E&&E.z<=w;){if(S.x>=g&&S.x<=_&&S.y>=v&&S.y<=y&&S!==r&&S!==o&&pd(a,d,l,h,c,p,S.x,S.y)&&In(S.prev,S,S.next)>=0||(S=S.prevZ,E.x>=g&&E.x<=_&&E.y>=v&&E.y<=y&&E!==r&&E!==o&&pd(a,d,l,h,c,p,E.x,E.y)&&In(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;S&&S.z>=m;){if(S.x>=g&&S.x<=_&&S.y>=v&&S.y<=y&&S!==r&&S!==o&&pd(a,d,l,h,c,p,S.x,S.y)&&In(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;E&&E.z<=w;){if(E.x>=g&&E.x<=_&&E.y>=v&&E.y<=y&&E!==r&&E!==o&&pd(a,d,l,h,c,p,E.x,E.y)&&In(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function Nq(t,e,n){let i=t;do{const r=i.prev,s=i.next.next;!Ax(r,s)&&$O(r,i,i.next,s)&&zp(r,s)&&zp(s,r)&&(e.push(r.i/n|0),e.push(i.i/n|0),e.push(s.i/n|0),Bp(i),Bp(i.next),i=t=s),i=i.next}while(i!==t);return Kc(i)}function Oq(t,e,n,i,r,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Gq(o,a)){let l=YO(o,a);o=Kc(o,o.next),l=Kc(l,l.next),Up(o,e,n,i,r,s,0),Up(l,e,n,i,r,s,0);return}a=a.next}o=o.next}while(o!==t)}function kq(t,e,n,i){const r=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const p=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(p<=s&&p>i&&(i=p,r=n.x=n.x&&n.x>=l&&s!==n.x&&pd(or.x||n.x===r.x&&Bq(r,n)))&&(r=n,d=h)),n=n.next;while(n!==a);return r}function Bq(t,e){return In(t.prev,t,e.prev)<0&&In(e.next,t,t.next)<0}function Vq(t,e,n,i){let r=t;do r.z===0&&(r.z=mM(r.x,r.y,e,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,Hq(r)}function Hq(t){let e,n,i,r,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,i=n,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||n.z<=i.z)?(r=n,n=n.nextZ,a--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:t=r,r.prevZ=s,s=r;n=i}s.nextZ=null,c*=2}while(o>1);return t}function mM(t,e,n,i,r){return t=(t-n)*r|0,e=(e-i)*r|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function Wq(t){let e=t,n=t;do(e.x=(t-o)*(s-a)&&(t-o)*(i-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(r-o)*(i-a)}function Gq(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!jq(t,e)&&(zp(t,e)&&zp(e,t)&&Xq(t,e)&&(In(t.prev,t,e.prev)||In(t,e.prev,e))||Ax(t,e)&&In(t.prev,t,t.next)>0&&In(e.prev,e,e.next)>0)}function In(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Ax(t,e){return t.x===e.x&&t.y===e.y}function $O(t,e,n,i){const r=Gv(In(t,e,n)),s=Gv(In(t,e,i)),o=Gv(In(n,i,t)),a=Gv(In(n,i,e));return!!(r!==s&&o!==a||r===0&&Wv(t,n,e)||s===0&&Wv(t,i,e)||o===0&&Wv(n,t,i)||a===0&&Wv(n,e,i))}function Wv(t,e,n){return e.x<=Math.max(t.x,n.x)&&e.x>=Math.min(t.x,n.x)&&e.y<=Math.max(t.y,n.y)&&e.y>=Math.min(t.y,n.y)}function Gv(t){return t>0?1:t<0?-1:0}function jq(t,e){let n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&$O(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function zp(t,e){return In(t.prev,t,t.next)<0?In(t,e,t.next)>=0&&In(t,t.prev,e)>=0:In(t,e,t.prev)<0||In(t,t.next,e)<0}function Xq(t,e){let n=t,i=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&r<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==t);return i}function YO(t,e){const n=new gM(t.i,t.x,t.y),i=new gM(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=r,r.prev=n,i.next=n,n.prev=i,s.next=i,i.prev=s,i}function P2(t,e,n,i){const r=new gM(t,e,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Bp(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function gM(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function qq(t,e,n,i){let r=0;for(let s=e,o=n-i;s2&&t[e-1].equals(t[0])&&t.pop()}function I2(t,e){for(let n=0;nNumber.EPSILON){const _e=Math.sqrt(Me),Ze=Math.sqrt(O*O+re*re),Oe=xe.x-U/_e,Ve=xe.y+Fe/_e,rt=fe.x-re/Ze,mt=fe.y+O/Ze,we=((rt-Oe)*re-(mt-Ve)*O)/(Fe*re-U*O);Te=Oe+Fe*we-H.x,ge=Ve+U*we-H.y;const Ot=Te*Te+ge*ge;if(Ot<=2)return new ye(Te,ge);qe=Math.sqrt(Ot/2)}else{let _e=!1;Fe>Number.EPSILON?O>Number.EPSILON&&(_e=!0):Fe<-Number.EPSILON?O<-Number.EPSILON&&(_e=!0):Math.sign(U)===Math.sign(re)&&(_e=!0),_e?(Te=-U,ge=Fe,qe=Math.sqrt(Me)):(Te=Fe,ge=U,qe=Math.sqrt(Me/2))}return new ye(Te/qe,ge/qe)}const W=[];for(let H=0,xe=V.length,fe=xe-1,Te=H+1;H=0;H--){const xe=H/y,fe=g*Math.cos(xe*Math.PI/2),Te=v*Math.sin(xe*Math.PI/2)+_;for(let ge=0,qe=V.length;ge=0;){const Te=fe;let ge=fe-1;ge<0&&(ge=H.length-1);for(let qe=0,Fe=d+y*2;qe0)&&g.push(S,E,R),(m!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class ek extends Ci{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ze(16777215),this.specular=new ze(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nl,this.normalScale=new ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Um,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class tk extends Ci{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ze(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nl,this.normalScale=new ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class nk extends Ci{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nl,this.normalScale=new ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class ik extends Ci{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ze(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ze(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nl,this.normalScale=new ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Um,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class rk extends Ci{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ze(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Nl,this.normalScale=new ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.flatShading=e.flatShading,this.fog=e.fog,this}}class sk extends lr{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function bc(t,e,n){return!t||!n&&t.constructor===e?t:typeof e.BYTES_PER_ELEMENT=="number"?new e(t):Array.prototype.slice.call(t)}function ok(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ak(t){function e(r,s){return t[r]-t[s]}const n=t.length,i=new Array(n);for(let r=0;r!==n;++r)i[r]=r;return i.sort(e),i}function vM(t,e,n){const i=t.length,r=new t.constructor(i);for(let s=0,o=0;o!==i;++s){const a=n[s]*e;for(let l=0;l!==e;++l)r[o++]=t[a+l]}return r}function tT(t,e,n,i){let r=1,s=t[0];for(;s!==void 0&&s[i]===void 0;)s=t[r++];if(s===void 0)return;let o=s[i];if(o!==void 0)if(Array.isArray(o))do o=s[i],o!==void 0&&(e.push(s.time),n.push.apply(n,o)),s=t[r++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[i],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[r++];while(s!==void 0);else do o=s[i],o!==void 0&&(e.push(s.time),n.push(o)),s=t[r++];while(s!==void 0)}function Kq(t,e,n,i,r=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l=i)){h.push(c.times[g]);for(let _=0;_s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const m=v*h+d,w=m+h-d;_=a.values.slice(m,w)}else{const m=a.createInterpolant(),w=d,S=h-d;m.evaluate(s),_=m.resultBuffer.slice(w,S)}l==="quaternion"&&new Wi().fromArray(_).normalize().conjugate().toArray(_);const y=c.times.length;for(let m=0;m=s)){const a=n[1];e=s)break t}o=i,i=0;break n}break e}for(;i>>1;en;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const n=this.getValueSize();n-Math.floor(n)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(r!==void 0&&ok(r))for(let a=0,l=r.length;a!==l;++a){const c=r[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),n=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===F0,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*i,l=o*i,c=0;c!==i;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*i)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),i=this.constructor,r=new i(this.name,e,n);return r.createInterpolant=this.createInterpolant,r}}Vs.prototype.TimeBufferType=Float32Array;Vs.prototype.ValueBufferType=Float32Array;Vs.prototype.DefaultInterpolation=Pp;class fu extends Vs{}fu.prototype.ValueTypeName="bool";fu.prototype.ValueBufferType=Array;fu.prototype.DefaultInterpolation=Cp;fu.prototype.InterpolantFactoryMethodLinear=void 0;fu.prototype.InterpolantFactoryMethodSmooth=void 0;class iT extends Vs{}iT.prototype.ValueTypeName="color";class Vp extends Vs{}Vp.prototype.ValueTypeName="number";class uk extends qm{constructor(e,n,i,r){super(e,n,i,r)}interpolate_(e,n,i,r){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-n)/(r-n);let c=e*a;for(let d=c+a;c!==d;c+=4)Wi.slerpFlat(s,0,o,c-a,o,c,l);return s}}class zf extends Vs{InterpolantFactoryMethodLinear(e){return new uk(this.times,this.values,this.getValueSize(),e)}}zf.prototype.ValueTypeName="quaternion";zf.prototype.DefaultInterpolation=Pp;zf.prototype.InterpolantFactoryMethodSmooth=void 0;class hu extends Vs{}hu.prototype.ValueTypeName="string";hu.prototype.ValueBufferType=Array;hu.prototype.DefaultInterpolation=Cp;hu.prototype.InterpolantFactoryMethodLinear=void 0;hu.prototype.InterpolantFactoryMethodSmooth=void 0;class Hp extends Vs{}Hp.prototype.ValueTypeName="vector";class Wp{constructor(e,n=-1,i,r=hx){this.name=e,this.tracks=i,this.duration=n,this.blendMode=r,this.uuid=Fr(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],i=e.tracks,r=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)n.push(t$(i[o]).scale(r));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=i.length;s!==o;++s)n.push(Vs.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,n,i,r){const s=n.length,o=[];for(let a=0;a1){const h=d[1];let p=r[h];p||(r[h]=p=[]),p.push(c)}}const o=[];for(const a in r)o.push(this.CreateFromMorphTargetSequence(a,r[a],n,i));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,p,g,v,_){if(g.length!==0){const y=[],m=[];tT(g,y,m,v),y.length!==0&&_.push(new h(p,y,m))}},r=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h{n&&n(s),this.manager.itemEnd(e)},0),s;if(Vo[e]!==void 0){Vo[e].push({onLoad:n,onProgress:i,onError:r});return}Vo[e]=[],Vo[e].push({onLoad:n,onProgress:i,onError:r});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const d=Vo[e],h=c.body.getReader(),p=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),g=p?parseInt(p):0,v=g!==0;let _=0;const y=new ReadableStream({start(m){w();function w(){h.read().then(({done:S,value:E})=>{if(S)m.close();else{_+=E.byteLength;const C=new ProgressEvent("progress",{lengthComputable:v,loaded:_,total:g});for(let R=0,I=d.length;R{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(d=>new DOMParser().parseFromString(d,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),p=h&&h[1]?h[1].toLowerCase():void 0,g=new TextDecoder(p);return c.arrayBuffer().then(v=>g.decode(v))}}}).then(c=>{Jo.add(e,c);const d=Vo[e];delete Vo[e];for(let h=0,p=d.length;h{const d=Vo[e];if(d===void 0)throw this.manager.itemError(e),c;delete Vo[e];for(let h=0,p=d.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class i$ extends Mr{constructor(e){super(e)}load(e,n,i,r){const s=this,o=new fa(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(a){try{n(s.parse(JSON.parse(a)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const n=[];for(let i=0;i0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const o=e.uniforms[s];switch(r.uniforms[s]={},o.type){case"t":r.uniforms[s].value=i(o.value);break;case"c":r.uniforms[s].value=new ze().setHex(o.value);break;case"v2":r.uniforms[s].value=new ye().fromArray(o.value);break;case"v3":r.uniforms[s].value=new B().fromArray(o.value);break;case"v4":r.uniforms[s].value=new cn().fromArray(o.value);break;case"m3":r.uniforms[s].value=new Bt().fromArray(o.value);break;case"m4":r.uniforms[s].value=new Et().fromArray(o.value);break;default:r.uniforms[s].value=o.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new ye().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new ye().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const n={ShadowMaterial:KO,SpriteMaterial:jb,RawShaderMaterial:QO,ShaderMaterial:Ns,PointsMaterial:qb,MeshPhysicalMaterial:JO,MeshStandardMaterial:eT,MeshPhongMaterial:ek,MeshToonMaterial:tk,MeshNormalMaterial:nk,MeshLambertMaterial:ik,MeshDepthMaterial:Hb,MeshDistanceMaterial:Wb,MeshBasicMaterial:Ol,MeshMatcapMaterial:rk,LineDashedMaterial:sk,LineBasicMaterial:lr,Material:Ci};return new n[e]}}class yM{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let i=0,r=e.length;i0){const l=new rT(n);s=new Gp(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){r=new Gp(this.manager),r.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const y=new rr;y.min.fromArray(_.boxMin),y.max.fromArray(_.boxMax);const m=new Gi;return m.radius=_.sphereRadius,m.center.fromArray(_.sphereCenter),{boxInitialized:_.boxInitialized,box:y,sphereInitialized:_.sphereInitialized,sphere:m}}),o._maxGeometryCount=e.maxGeometryCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid);break;case"LOD":o=new OO;break;case"Line":o=new _l(a(e.geometry),l(e.material));break;case"LineLoop":o=new zO(a(e.geometry),l(e.material));break;case"LineSegments":o=new To(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new BO(a(e.geometry),l(e.material));break;case"Sprite":o=new NO(l(e.material));break;case"Group":o=new hd;break;case"Bone":o=new Xb;break;default:o=new sn}if(o.uuid=e.uuid,e.name!==void 0&&(o.name=e.name),e.matrix!==void 0?(o.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(o.matrixAutoUpdate=e.matrixAutoUpdate),o.matrixAutoUpdate&&o.matrix.decompose(o.position,o.quaternion,o.scale)):(e.position!==void 0&&o.position.fromArray(e.position),e.rotation!==void 0&&o.rotation.fromArray(e.rotation),e.quaternion!==void 0&&o.quaternion.fromArray(e.quaternion),e.scale!==void 0&&o.scale.fromArray(e.scale)),e.up!==void 0&&o.up.fromArray(e.up),e.castShadow!==void 0&&(o.castShadow=e.castShadow),e.receiveShadow!==void 0&&(o.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(o.shadow.bias=e.shadow.bias),e.shadow.normalBias!==void 0&&(o.shadow.normalBias=e.shadow.normalBias),e.shadow.radius!==void 0&&(o.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&o.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(o.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(o.visible=e.visible),e.frustumCulled!==void 0&&(o.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(o.renderOrder=e.renderOrder),e.userData!==void 0&&(o.userData=e.userData),e.layers!==void 0&&(o.layers.mask=e.layers),e.children!==void 0){const p=e.children;for(let g=0;g"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,n,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Jo.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{n&&n(c),s.manager.itemEnd(e)}).catch(c=>{r&&r(c)});return}return setTimeout(function(){n&&n(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Jo.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){r&&r(c),Jo.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Jo.add(e,l),s.manager.itemStart(e)}}let jv;class oT{static getContext(){return jv===void 0&&(jv=new(window.AudioContext||window.webkitAudioContext)),jv}static setContext(e){jv=e}}class p$ extends Mr{constructor(e){super(e)}load(e,n,i,r){const s=this,o=new fa(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(l){try{const c=l.slice(0);oT.getContext().decodeAudioData(c,function(h){n(h)}).catch(a)}catch(c){a(c)}},i,r);function a(l){r?r(l):console.error(l),s.manager.itemError(e)}}}const z2=new Et,B2=new Et,oc=new Et;class m${constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Wn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Wn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const n=this._cache;if(n.focus!==e.focus||n.fov!==e.fov||n.aspect!==e.aspect*this.aspect||n.near!==e.near||n.far!==e.far||n.zoom!==e.zoom||n.eyeSep!==this.eyeSep){n.focus=e.focus,n.fov=e.fov,n.aspect=e.aspect*this.aspect,n.near=e.near,n.far=e.far,n.zoom=e.zoom,n.eyeSep=this.eyeSep,oc.copy(e.projectionMatrix);const r=n.eyeSep/2,s=r*n.near/n.focus,o=n.near*Math.tan(Bc*n.fov*.5)/n.zoom;let a,l;B2.elements[12]=-r,z2.elements[12]=r,a=-o*n.aspect+s,l=o*n.aspect+s,oc.elements[0]=2*n.near/(l-a),oc.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(oc),a=-o*n.aspect-s,l=o*n.aspect-s,oc.elements[0]=2*n.near/(l-a),oc.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(oc)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(B2),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(z2)}}class $m{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=V2(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const n=V2();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function V2(){return(typeof performance>"u"?Date:performance).now()}const ac=new B,H2=new Wi,g$=new B,lc=new B;class v$ extends sn{constructor(){super(),this.type="AudioListener",this.context=oT.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new $m}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);const n=this.context.listener,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(ac,H2,g$),lc.set(0,0,-1).applyQuaternion(H2),n.positionX){const r=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(ac.x,r),n.positionY.linearRampToValueAtTime(ac.y,r),n.positionZ.linearRampToValueAtTime(ac.z,r),n.forwardX.linearRampToValueAtTime(lc.x,r),n.forwardY.linearRampToValueAtTime(lc.y,r),n.forwardZ.linearRampToValueAtTime(lc.z,r),n.upX.linearRampToValueAtTime(i.x,r),n.upY.linearRampToValueAtTime(i.y,r),n.upZ.linearRampToValueAtTime(i.z,r)}else n.setPosition(ac.x,ac.y,ac.z),n.setOrientation(lc.x,lc.y,lc.z,i.x,i.y,i.z)}}let wk=class extends sn{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;const n=this.context.createBufferSource();return n.buffer=this.buffer,n.loop=this.loop,n.loopStart=this.loopStart,n.loopEnd=this.loopEnd,n.onended=this.onEnded.bind(this),n.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=n,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,this.source!==null&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,n=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,n=this.filters.length;e0&&this._mixBufferRegionAdditive(i,r,this._addIndex*n,1,n);for(let l=n,c=n+n;l!==c;++l)if(i[l]!==i[l+n]){a.setValue(i,r);break}}saveOriginalState(){const e=this.binding,n=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(n,r);for(let s=i,o=r;s!==o;++s)n[s]=n[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,n=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==s;++o)e[n+o]=e[i+o]}_slerp(e,n,i,r){Wi.slerpFlat(e,n,e,n,e,i,r)}_slerpAdditive(e,n,i,r,s){const o=this._workIndex*s;Wi.multiplyQuaternionsFlat(e,o,e,n,e,i),Wi.slerpFlat(e,n,e,n,e,o,r)}_lerp(e,n,i,r,s){const o=1-r;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[i+a]*r}}_lerpAdditive(e,n,i,r,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[i+o]*r}}}const aT="\\[\\]\\.:\\/",S$=new RegExp("["+aT+"]","g"),lT="[^"+aT+"]",w$="[^"+aT.replace("\\.","")+"]",M$=/((?:WC+[\/:])*)/.source.replace("WC",lT),E$=/(WCOD+)?/.source.replace("WCOD",w$),b$=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",lT),T$=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",lT),A$=new RegExp("^"+M$+E$+b$+T$+"$"),C$=["material","materials","bones","map"];class P${constructor(e,n,i){const r=i||Jt.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,r)}getValue(e,n){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,n)}setValue(e,n){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,i=e.length;n!==i;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,i=e.length;n!==i;++n)e[n].unbind()}}class Jt{constructor(e,n,i){this.path=n,this.parsedPath=i||Jt.parseTrackName(n),this.node=Jt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,i){return e&&e.isAnimationObjectGroup?new Jt.Composite(e,n,i):new Jt(e,n,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(S$,"")}static parseTrackName(e){const n=A$.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);C$.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(n);if(i!==void 0)return i}if(e.children){const i=function(s){for(let o=0;o=s){const h=s++,p=e[h];n[p.uuid]=d,e[d]=p,n[c]=h,e[h]=l;for(let g=0,v=r;g!==v;++g){const _=i[g],y=_[h],m=_[d];_[d]=y,_[h]=m}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],d=c.uuid,h=n[d];if(h!==void 0)if(delete n[d],h0&&(n[g.uuid]=h),e[h]=g,e.pop();for(let v=0,_=r;v!==_;++v){const y=i[v];y[h]=y[p],y.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,d=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,o.push(e),a.push(n),s.push(h);for(let p=d,g=l.length;p!==g;++p){const v=l[p];h[p]=new Jt(v,e,n)}return h}unsubscribe_(e){const n=this._bindingsIndicesByPath,i=n[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=i,o[i]=l,o.pop(),s[i]=s[a],s.pop(),r[i]=r[a],r.pop()}}}class Ek{constructor(e,n,i=null,r=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=i,this.blendMode=r;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:wc,endingEnd:wc};for(let c=0;c!==o;++c){const d=s[c].createInterpolant(null);a[c]=d,d.settings=l}this._interpolantSettings=l,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=iO,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,n){return this.loop=e,this.repetitions=n,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,n,i){if(e.fadeOut(n),this.fadeIn(n),i){const r=this._clip.duration,s=e._clip.duration,o=s/r,a=r/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,i){return e.crossFadeFrom(this,n,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,n,i){const r=this._mixer,s=r.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=r._lendControlInterpolant(),this._timeScaleInterpolant=a);const l=a.parameterPositions,c=a.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/o,c[1]=n/o,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,n,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?n=0:(this._startTime=null,n=i*l)}n*=this._updateTimeScale(e);const o=this._updateTime(n),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Lb:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case hx:default:for(let d=0,h=l.length;d!==h;++d)l[d].evaluate(o),c[d].accumulate(r,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];n*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];n*=r,e>i.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const o=i===rO;if(e===0)return s===-1?r:o&&(s&1)===1?n-r:r;if(i===nO){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=n)r=n;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),r>=n||r<0){const a=Math.floor(r/n);r-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?n:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=r;if(o&&(s&1)===1)return n-r}return r}_setEndings(e,n,i){const r=this._interpolantSettings;i?(r.endingStart=Mc,r.endingEnd=Mc):(e?r.endingStart=this.zeroSlopeAtStart?Mc:wc:r.endingStart=Rp,n?r.endingEnd=this.zeroSlopeAtEnd?Mc:wc:r.endingEnd=Rp)}_scheduleFading(e,n,i){const r=this._mixer,s=r.time;let o=this._weightInterpolant;o===null&&(o=r._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=n,a[1]=s+e,l[1]=i,this}}const I$=new Float32Array(1);class L$ extends bo{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let h=0;h!==s;++h){const p=r[h],g=p.name;let v=d[g];if(v!==void 0)++v.referenceCount,o[h]=v;else{if(v=o[h],v!==void 0){v._cacheIndex===null&&(++v.referenceCount,this._addInactiveBinding(v,l,g));continue}const _=n&&n._propertyBindings[h].binding.parsedPath;v=new Mk(Jt.create(i,g,_),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,g),o[h]=v}a[h].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const n=e._propertyBindings;for(let i=0,r=n.length;i!==r;++i){const s=n[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let i=0,r=n.length;i!==r;++i){const s=n[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const n=e._cacheIndex;return n!==null&&n=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const n=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)n[c]._update(r,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let n=0;nthis.max.x||e.ythis.max.y)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,j2).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const X2=new B,Xv=new B;class z${constructor(e=new B,n=new B){this.start=e,this.end=n}set(e,n){return this.start.copy(e),this.end.copy(n),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,n){return this.delta(n).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,n){X2.subVectors(e,this.start),Xv.subVectors(this.end,this.start);const i=Xv.dot(Xv);let s=Xv.dot(X2)/i;return n&&(s=Hn(s,0,1)),s}closestPointToPoint(e,n,i){const r=this.closestPointToPointParameter(e,n);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const q2=new B;class B$ extends sn{constructor(e,n){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const i=new Ut,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let o=0,a=1,l=32;o1)for(let h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{Q2.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(Q2,n)}}setLength(e,n=e*.2,i=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(i,n,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class J$ extends To{constructor(e=1){const n=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Ut;r.setAttribute("position",new it(n,3)),r.setAttribute("color",new it(i,3));const s=new lr({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,n,i){const r=new ze,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(n),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class eY{constructor(){this.type="ShapePath",this.color=new ze,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new Fp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,i,r){return this.currentPath.quadraticCurveTo(e,n,i,r),this}bezierCurveTo(e,n,i,r,s,o){return this.currentPath.bezierCurveTo(e,n,i,r,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(m){const w=[];for(let S=0,E=m.length;SNumber.EPSILON){if(A<0&&(I=w[R],F=-F,N=w[C],A=-A),m.yN.y)continue;if(m.y===I.y){if(m.x===I.x)return!0}else{const D=A*(m.x-I.x)-F*(m.y-I.y);if(D===0)return!0;if(D<0)continue;E=!E}}else{if(m.y!==I.y)continue;if(N.x<=m.x&&m.x<=I.x||I.x<=m.x&&m.x<=N.x)return!0}}return E}const r=po.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,l;const c=[];if(s.length===1)return a=s[0],l=new Wc,l.curves=a.curves,c.push(l),c;let d=!r(s[0].getPoints());d=e?!d:d;const h=[],p=[];let g=[],v=0,_;p[v]=void 0,g[v]=[];for(let m=0,w=s.length;m1){let m=!1,w=0;for(let S=0,E=p.length;S0&&m===!1&&(g=h)}let y;for(let m=0,w=p.length;m{let t=0,e=0;for(;t===0;)t=Math.random();for(;e===0;)e=Math.random();const n=Math.sqrt(-2*Math.log(t))*Math.cos(Ak*e)/10+.5;return n>1||n<0?iY():n},uT=(t,e,n,i=1)=>t==0||t==1?Math.hypot(e-.5,n-.5)/ap:e==0||e==1?Math.hypot(t-.5,t-.5)/ap:n==0||n==1?Math.hypot(t-.5,e-.5)/ap:i,Rh={CARTESIAN_1D:"Cartesian_1D",CARTESIAN_2D:"Cartesian_2D",CARTESIAN_3D:"Cartesian_3D",CARTESIAN_CUBE_FACES:"Cartesian_CubeFaces",POLAR:"Polar"};class dT{constructor(e=1){ot(this,"amplitude");this.amplitude=e}map(e,n,i=0,r=0,s=0){switch(e){case Rh.CARTESIAN_1D:return this.map_1D(n,s);case Rh.CARTESIAN_2D:case Rh.POLAR:return this.map_2D(n,i,s);case Rh.CARTESIAN_3D:return this.map_3D(n,i,r,s);case Rh.CARTESIAN_CUBE_FACES:return this.map_3DFaces(n,i,r,s);default:return e}}}class ff extends dT{constructor(n=ff.PRESETS.DEFAULT){super(n.amplitude);ot(this,"_params");ot(this,"data");this._params=n,this.data=new Float32Array(n.size).fill(0)}static get PRESETS(){return{DEFAULT:{amplitude:1,size:121}}}clone(n){return new ff({...this._params,...n})}get params(){return this._params}interpolateValueForNormalizedCoord(n){if(this.data===void 0||!this.data||this.data.length===0)return 0;const i=n*(this.data.length-1),r=this.data[Math.floor(i)],s=this.data[Math.ceil(i)];return r+i%1*(s-r)}map_1D(n,i=0){return this.amplitude*this.interpolateValueForNormalizedCoord(n)}map_2D(n,i,r=0){const s=Math.hypot(n-.5,i-.5)/ap;return this.map_1D(s,r)}map_3D(n,i,r,s=0){const o=Math.hypot(n-.5,i-.5,r-.5)/Ck;return this.map_1D(o,s)}map_3DFaces(n,i,r,s=0){const o=uT(n,i,r,1);return this.map_1D(o,s)}}const Pk=Math.sqrt(3),Rk=Math.sqrt(5),rY=.5*(Pk-1),Ih=(3-Pk)/6,sY=1/3,Js=1/6,oY=(Rk-1)/4,wi=(5-Rk)/20,ea=t=>Math.floor(t)|0,J2=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),ww=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),Qv=new Float64Array([0,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,1,0,1,1,1,0,1,-1,1,0,-1,1,1,0,-1,-1,-1,0,1,1,-1,0,1,-1,-1,0,-1,1,-1,0,-1,-1,1,1,0,1,1,1,0,-1,1,-1,0,1,1,-1,0,-1,-1,1,0,1,-1,1,0,-1,-1,-1,0,1,-1,-1,0,-1,1,1,1,0,1,1,-1,0,1,-1,1,0,1,-1,-1,0,-1,1,1,0,-1,1,-1,0,-1,-1,1,0,-1,-1,-1,0]);function aY(t=Math.random){const e=fT(t),n=new Float64Array(e).map(r=>J2[r%12*2]),i=new Float64Array(e).map(r=>J2[r%12*2+1]);return function(s,o){let a=0,l=0,c=0;const d=(s+o)*rY,h=ea(s+d),p=ea(o+d),g=(h+p)*Ih,v=h-g,_=p-g,y=s-v,m=o-_;let w,S;y>m?(w=1,S=0):(w=0,S=1);const E=y-w+Ih,C=m-S+Ih,R=y-1+2*Ih,I=m-1+2*Ih,N=h&255,F=p&255;let A=.5-y*y-m*m;if(A>=0){const K=N+e[F],V=n[K],Z=i[K];A*=A,a=A*A*(V*y+Z*m)}let D=.5-E*E-C*C;if(D>=0){const K=N+w+e[F+S],V=n[K],Z=i[K];D*=D,l=D*D*(V*E+Z*C)}let j=.5-R*R-I*I;if(j>=0){const K=N+1+e[F+1],V=n[K],Z=i[K];j*=j,c=j*j*(V*R+Z*I)}return 70*(a+l+c)}}function Ik(t=Math.random){const e=fT(t),n=new Float64Array(e).map(s=>ww[s%12*3]),i=new Float64Array(e).map(s=>ww[s%12*3+1]),r=new Float64Array(e).map(s=>ww[s%12*3+2]);return function(o,a,l){let c,d,h,p;const g=(o+a+l)*sY,v=ea(o+g),_=ea(a+g),y=ea(l+g),m=(v+_+y)*Js,w=v-m,S=_-m,E=y-m,C=o-w,R=a-S,I=l-E;let N,F,A,D,j,K;C>=R?R>=I?(N=1,F=0,A=0,D=1,j=1,K=0):C>=I?(N=1,F=0,A=0,D=1,j=0,K=1):(N=0,F=0,A=1,D=1,j=0,K=1):RQv[o%32*4]),i=new Float64Array(e).map(o=>Qv[o%32*4+1]),r=new Float64Array(e).map(o=>Qv[o%32*4+2]),s=new Float64Array(e).map(o=>Qv[o%32*4+3]);return function(a,l,c,d){let h,p,g,v,_;const y=(a+l+c+d)*oY,m=ea(a+y),w=ea(l+y),S=ea(c+y),E=ea(d+y),C=(m+w+S+E)*wi,R=m-C,I=w-C,N=S-C,F=E-C,A=a-R,D=l-I,j=c-N,K=d-F;let V=0,Z=0,Y=0,J=0;A>D?V++:Z++,A>j?V++:Y++,A>K?V++:J++,D>j?Z++:Y++,D>K?Z++:J++,j>K?Y++:J++;const k=V>=3?1:0,W=Z>=3?1:0,$=Y>=3?1:0,Q=J>=3?1:0,de=V>=2?1:0,be=Z>=2?1:0,ie=Y>=2?1:0,he=J>=2?1:0,Ee=V>=1?1:0,me=Z>=1?1:0,Re=Y>=1?1:0,Le=J>=1?1:0,Ce=A-k+wi,Ae=D-W+wi,H=j-$+wi,xe=K-Q+wi,fe=A-de+2*wi,Te=D-be+2*wi,ge=j-ie+2*wi,qe=K-he+2*wi,Fe=A-Ee+3*wi,U=D-me+3*wi,O=j-Re+3*wi,re=K-Le+3*wi,Me=A-1+4*wi,Se=D-1+4*wi,_e=j-1+4*wi,Ze=K-1+4*wi,Oe=m&255,Ve=w&255,rt=S&255,mt=E&255;let we=.6-A*A-D*D-j*j-K*K;if(we<0)h=0;else{const q=Oe+e[Ve+e[rt+e[mt]]];we*=we,h=we*we*(n[q]*A+i[q]*D+r[q]*j+s[q]*K)}let Ot=.6-Ce*Ce-Ae*Ae-H*H-xe*xe;if(Ot<0)p=0;else{const q=Oe+k+e[Ve+W+e[rt+$+e[mt+Q]]];Ot*=Ot,p=Ot*Ot*(n[q]*Ce+i[q]*Ae+r[q]*H+s[q]*xe)}let wt=.6-fe*fe-Te*Te-ge*ge-qe*qe;if(wt<0)g=0;else{const q=Oe+de+e[Ve+be+e[rt+ie+e[mt+he]]];wt*=wt,g=wt*wt*(n[q]*fe+i[q]*Te+r[q]*ge+s[q]*qe)}let ft=.6-Fe*Fe-U*U-O*O-re*re;if(ft<0)v=0;else{const q=Oe+Ee+e[Ve+me+e[rt+Re+e[mt+Le]]];ft*=ft,v=ft*ft*(n[q]*Fe+i[q]*U+r[q]*O+s[q]*re)}let et=.6-Me*Me-Se*Se-_e*_e-Ze*Ze;if(et<0)_=0;else{const q=Oe+1+e[Ve+1+e[rt+1+e[mt+1]]];et*=et,_=et*et*(n[q]*Me+i[q]*Se+r[q]*_e+s[q]*Ze)}return 27*(h+p+g+v+_)}}function fT(t){const n=new Uint8Array(512);for(let i=0;i<512/2;i++)n[i]=i;for(let i=0;i<512/2-1;i++){const r=i+~~(t()*(256-i)),s=n[i];n[i]=n[r],n[r]=s}for(let i=256;i<512;i++)n[i]=n[i-256];return n}class hf extends dT{constructor(n=hf.PRESETS.DEFAULT){super(n.amplitude);ot(this,"_params");ot(this,"noise2D");ot(this,"noise3D");ot(this,"noise4D");this._params=n,this.noise2D=aY(),this.noise3D=Ik(),this.noise4D=lY()}static get PRESETS(){return{DEFAULT:{amplitude:1,spatialScale:2,timeScale:.5,nIterations:10,persistence:.5}}}clone(n){return new hf({...this._params,...n})}get params(){return this._params}map_1D(n,i=0){let r=0,s=0,o=this.amplitude,a=this._params.spatialScale;const l=this._params.timeScale;for(let c=0;c1?r/s:r}map_2D(n,i,r=0){let s=0,o=0,a=this.amplitude,l=this._params.spatialScale;const c=this._params.timeScale;for(let d=0;d1?s/o:s}map_3D(n,i,r,s=0){let o=0,a=0,l=this.amplitude,c=this._params.spatialScale;const d=this._params.timeScale;for(let h=0;h1?o/a:o}map_3DFaces(n,i,r,s=0){const o=uT(n,i,r,1);return this.map_1D(o,s)}}class cY extends dT{constructor(n=1,i){super(n);ot(this,"frequencyHz");ot(this,"periodSec");ot(this,"b");this.frequencyHz=i,this.periodSec=1/i,this.b=Ak/this.periodSec}map_1D(n,i=0){return this.amplitude*Math.sin(this.b*n+i)}map_2D(n,i,r=0){const s=Math.hypot(n-.5,i-.5)/ap;return this.amplitude*Math.sin(this.b*s+r)}map_3D(n,i,r,s=0){const o=Math.hypot(n-.5,i-.5,r-.5)/Ck;return this.amplitude*Math.sin(this.b*o+s)}map_3DFaces(n,i,r,s=0){const o=uT(n,i,r,1);return this.amplitude*Math.sin(this.b*o+s)}}class Gc{constructor(e=Gc.PRESETS.DEFAULT){ot(this,"mappers");ot(this,"_params");this._params=e,this.mappers=Gc.genMappersForParams(this.params)}static get PRESETS(){return{DEFAULT:{waveformFrequenciesHz:[2],maxAmplitude:1,amplitudeSplitRatio:.75},DOUBLE:{waveformFrequenciesHz:[2,10],maxAmplitude:1,amplitudeSplitRatio:.75},CUSTOM:{}}}clone(e){return new Gc({...this._params,...e})}get params(){return this._params}get amplitude(){return this.params.maxAmplitude}static genMappersForParams(e){let n=e.maxAmplitude;return Array.from({length:e.waveformFrequenciesHz.length}).map((i,r)=>{const s=r>=e.waveformFrequenciesHz.length-1?n:e.amplitudeSplitRatio*n;return n-=s,new cY(s,e.waveformFrequenciesHz[r])})}map(e,n,i=0,r=0,s=0){let o=0;for(const a of this.mappers)o+=a.map(e,n,i,r,s);return o}}class uY{constructor(e=1,n=.5){ot(this,"noise3D");ot(this,"spatialScale");ot(this,"curlAmount");ot(this,"tmpVelocity");this.spatialScale=e,this.curlAmount=n,this.noise3D=Ik(),this.tmpVelocity=new B}computeCurl(e,n,i,r){let o,a,l,c;o=this.noise3D(n,i+.001,r),a=this.noise3D(n,i-.001,r),l=(o-a)/(2*.001),o=this.noise3D(n,i,r+.001),a=this.noise3D(n,i,r-.001),c=(o-a)/(2*.001),e.x=l-c,o=this.noise3D(n,i,r+.001),a=this.noise3D(n,i,r-.001),l=(o-a)/(2*.001),o=this.noise3D(n+.001,i,r),a=this.noise3D(n-.001,i,r),c=(o-a)/(2*.001),e.y=l-c,o=this.noise3D(n+.001,i,r),a=this.noise3D(n-.001,i,r),l=(o-a)/(2*.001),o=this.noise3D(n,i+.001,r),a=this.noise3D(n,i-.001,r),c=(o-a)/(2*.001),e.z=l-c,e.normalize()}map(e,n,i,r=new B){return this.computeCurl(this.tmpVelocity,this.spatialScale*e.x,this.spatialScale*e.y,this.spatialScale*e.z),this.tmpVelocity.multiplyScalar(this.curlAmount*n),r.copy(e),r.add(this.tmpVelocity),r}}class jp{constructor(e=jp.PRESETS.DEFAULT){ot(this,"_params");ot(this,"samplesX");ot(this,"samplesY");ot(this,"maxAmplitude",4);ot(this,"M",4);this._params=e,this.samplesX=new Float32Array(e.size).fill(0),this.samplesY=new Float32Array(e.size).fill(0)}static get PRESETS(){return{DEFAULT:{size:512}}}clone(e){return new jp({...this._params,...e})}get params(){return{...this.params}}updateParams(e){this._params={...this._params,...e},this.samplesX=new Float32Array(this._params.size).fill(0),this.samplesY=new Float32Array(this._params.size).fill(0)}updateTextureData(e){let i,r,s;for(let o=0;o>8,e[i+1]=r&255,e[i+2]=s>>8,e[i+3]=s&255}generateSupportedTextureAndData(){const e=new Uint8Array(this.samplesX.length*this.M);return{tex:new cl(e,this.samplesX.length,1,Hi),textureData:e}}}const dY={set:()=>{},get:()=>0};class eI{constructor(e){ot(this,"_energyInfo");this._energyInfo=e}set(e){this._energyInfo=e}get(){return this._energyInfo}}class fY{constructor(e,n=32){this.isLut=!0,this.lut=[],this.map=[],this.n=0,this.minV=0,this.maxV=1,this.setColorMap(e,n)}set(e){return e.isLut===!0&&this.copy(e),this}setMin(e){return this.minV=e,this}setMax(e){return this.maxV=e,this}setColorMap(e,n=32){this.map=Mw[e]||Mw.rainbow,this.n=n;const i=1/this.n,r=new ze,s=new ze;this.lut.length=0,this.lut.push(new ze(this.map[0][1]));for(let o=1;othis.map[l][0]&&a<=this.map[l+1][0]){const c=this.map[l][0],d=this.map[l+1][0];r.setHex(this.map[l][1],vr),s.setHex(this.map[l+1][1],vr);const h=new ze().lerpColors(r,s,(a-c)/(d-c));this.lut.push(h)}}return this.lut.push(new ze(this.map[this.map.length-1][1])),this}copy(e){return this.lut=e.lut,this.map=e.map,this.n=e.n,this.minV=e.minV,this.maxV=e.maxV,this}getColor(e){e=mO.clamp(e,this.minV,this.maxV),e=(e-this.minV)/(this.maxV-this.minV);const n=Math.round(e*this.n);return this.lut[n]}addColorMap(e,n){return Mw[e]=n,this}createCanvas(){const e=document.createElement("canvas");return e.width=1,e.height=this.n,this.updateCanvas(e),e}updateCanvas(e){const n=e.getContext("2d",{alpha:!1}),i=n.getImageData(0,0,1,this.n),r=i.data;let s=0;const o=1/this.n,a=new ze,l=new ze,c=new ze;for(let d=1;d>=0;d-=o)for(let h=this.map.length-1;h>=0;h--)if(d=this.map[h-1][0]){const p=this.map[h-1][0],g=this.map[h][0];a.setHex(this.map[h-1][1],vr),l.setHex(this.map[h][1],vr),c.lerpColors(a,l,(d-p)/(g-p)),r[s*4]=Math.round(c.r*255),r[s*4+1]=Math.round(c.g*255),r[s*4+2]=Math.round(c.b*255),r[s*4+3]=255,s+=1}return n.putImageData(i,0,0),e}}const Mw={rainbow:[[0,255],[.2,65535],[.5,65280],[.8,16776960],[1,16711680]],cooltowarm:[[0,3952322],[.2,10206463],[.5,14474460],[.8,16163717],[1,11797542]],blackbody:[[0,0],[.2,7864320],[.5,15086080],[.8,16776960],[1,16777215]],grayscale:[[0,0],[.2,4210752],[.5,8355712],[.8,12566463],[1,16777215]]},Rt={THREE_RAINBOW:"rainbow",THREE_COOL_TO_WARM:"cooltowarm",WARM:"Warm",WARM_2:"Warm_2",WARM_3:"Warm_3",SAND:"Sand",SAND_2:"Sand_2",SAND_3:"Sand_3",SAND_4:"Sand_4",SAND_5:"Sand_5",NATURAL:"Natural",NATURAL_2:"Natural_2",CIRCUS:"Circus",SEASIDE:"Seaside",DRAGON:"Dragon"},lp=[Rt.THREE_COOL_TO_WARM,Rt.THREE_RAINBOW,Rt.WARM,Rt.WARM_2,Rt.WARM_3,Rt.SAND,Rt.SAND_2,Rt.SAND_3,Rt.SAND_4,Rt.SAND_5,Rt.NATURAL,Rt.NATURAL_2,Rt.CIRCUS,Rt.SEASIDE,Rt.DRAGON],Ew=(t,e,n)=>n<=0?t:n>=1?e:t+n*(e-t);class tI{constructor(e){ot(this,"colors");ot(this,"getAt",e=>{e=Math.min(1,Math.max(0,e));const n=Math.floor(e*this.colors.length*.9999),i=Math.min(this.colors.length-1,Math.max(0,n+1)),r=this.colors[n],s=this.colors[i],o=(e-n/this.colors.length)/(1/this.colors.length);return new ze().setRGB(Ew(r.r,s.r,o),Ew(r.g,s.g,o),Ew(r.b,s.b,o),Vn)});this.colors=e.colors.map(n=>new ze(n))}}class ei{constructor(e,n){ot(this,"name");ot(this,"colors");ot(this,"buildLut",()=>{const e=new fY;return e.addColorMap(this.name,this.colorsHex.map((n,i)=>[i/(this.nColors-1),n])),e.setColorMap(this.name),e});ot(this,"calcBackgroundColor",(e=.5)=>{const i=new tI(this).getAt(e),r={h:0,s:0,l:0};return i.getHSL(r,Vn),r.s=Math.min(r.s,.5),i.setHSL(r.h,r.s,r.l,Vn),i});ot(this,"lerpColor",e=>{const n=Math.min(1,Math.max(0,e));return new tI(this).getAt(n)});if(this.name=e,n.length<2)throw new Error("Not enough colors");this.colors=[...n]}get colorsHex(){return this.colors.map(e=>new ze(e).getHex())}get nColors(){return this.colors.length}static getPalette(e){switch(e){case Rt.WARM:return new ei(Rt.WARM,["#FF2000","#FF5900","#FE9100","#FEFDFC","#FEC194","#FE9F5B"]);case Rt.WARM_2:return new ei("Warm_2",["#FFFEFE","#0D0211","#FBCEA0","#FFAD5D","#530E1D","#FE9232","#B93810","#907996"]);case Rt.WARM_3:return new ei(Rt.WARM_3,["#EDEBE7","#13595A","#DE1408","#161814","#E1610A","#B7BDB3","#9F9772"]);case Rt.SAND:return new ei(Rt.SAND,["#b8987a","#caa87f","#dfb98a","#ebc99c","#f3ddb0","#f9e6c1","#fff3d7"]);case Rt.SAND_2:return new ei(Rt.SAND_2,["#f2ead6","#327172","#2d3e58","#f47e72","#f2cab1"]);case Rt.SAND_3:return new ei(Rt.SAND_3,["#f1e2c3","#8595a4","#8d4f2a","#d86b28","#eca956"]);case Rt.SAND_4:return new ei(Rt.SAND_4,["#242112","#684f27","#9a733a","#ac8f56","#e5a752","#fdbe6e","#ffd28f"]);case Rt.SAND_5:return new ei(Rt.SAND_5,["#44200a","#75380c","#9e5922","#b96525","#da863d","#f5ad63","#fec37d"]);case Rt.NATURAL:return new ei(Rt.NATURAL,["#FF6D00","#FBF8EB","#008B99","#F8E1A6","#FDA81F","#B80A01","#480D07"]);case Rt.NATURAL_2:return new ei(Rt.NATURAL_2,["#EF2006","#350000","#A11104","#ED5910","#F1B52E","#7B5614","#F7F1AC"]);case Rt.CIRCUS:return new ei(Rt.CIRCUS,["#F62D62","#FFFFFF","#FDB600","#F42D2D","#544C98","#ECACBC"]);case Rt.SEASIDE:return new ei(Rt.SEASIDE,["#FEB019","#F46002","#E1E7F1","#0A1D69","#138FE2","#0652C4","#D23401","#B0A12F"]);case Rt.DRAGON:return new ei(Rt.DRAGON,["#F2E9D9","#101010","#EA4B04","#B6AC9E","#5A5754","#837F7A","#E78E36","#552509"]);case Rt.THREE_RAINBOW:return new ei(Rt.THREE_RAINBOW,["#0000FF","#00FFFF","#00FF00","#FFFF00","#FF0000"]);case Rt.THREE_COOL_TO_WARM:return new ei(Rt.THREE_COOL_TO_WARM,["#3c4ec2","#9bbcff","#dcdcdc","#f6a385","#b40426"]);default:return e}}static random(e=lp){return ei.getPalette(e[Math.floor(Math.random()*e.length)])}}const Ao=Mb(t=>({user:{canvasInteractionEventTracker:new nY},visual:I0.grid,appearance:{palette:Rt.THREE_COOL_TO_WARM,colorBackground:!0,paletteTrackEnergy:!1,showUI:!0},camera:{mode:"ORBIT_CONTROLS",autoOrbitAfterSleepMs:1e4},analyzers:{fft:{octaveBandMode:2,energyMeasure:"bass"}},mode:je.WAVE_FORM,mappers:{textureMapper:new jp,coordinateMapperWaveform:new Gc,coordinateMapperNoise:new hf,coordinateMapperData:new ff,energyTracker:new eI(0),motionMapper:new uY(2,.5)},audio:{source:n3()[0]},actions:{setVisual:e=>t(n=>{const i=I0[e];return[...i.supportedApplicationModes].includes(n.mode)?{visual:i,mappers:{...n.mappers,textureMapper:new jp}}:{}}),noteCanvasInteraction:()=>t(e=>(e.user.canvasInteractionEventTracker.addEvent(),{user:{canvasInteractionEventTracker:e.user.canvasInteractionEventTracker}})),setAppearance:e=>t(n=>({appearance:{...n.appearance,...e}})),nextPalette:()=>t(e=>{const i=((lp.indexOf(e.appearance.palette)??0)+1)%lp.length;return{appearance:{...e.appearance,palette:lp[i]}}}),setMode:e=>t(n=>({mode:e,...[...n.visual.supportedApplicationModes].includes(e)?{}:{visual:Object.values(I0).find(i=>[...i.supportedApplicationModes].includes(e))},mappers:{...n.mappers,energyTracker:e===je.AUDIO?new eI(0):dY},appearance:{...n.appearance,paletteTrackEnergy:e===je.AUDIO,...e===je.AUDIO_SCOPE?{palette:"rainbow"}:{}}})),setMappers:e=>t(n=>({mappers:{...n.mappers,...e}})),setAudio:e=>t(n=>({audio:{...n.audio,...e}})),setCamera:e=>t(n=>({camera:{...n.camera,...e}})),setAnalyzerFFT:e=>t(n=>({analyzers:{...n.analyzers,fft:{...n.analyzers.fft,...e}}}))}})),Lk=()=>Ao(t=>t.analyzers.fft),Dk=()=>Ao(t=>t.camera),Fx=()=>Ao(t=>t.visual),Ym=()=>Ao(t=>t.appearance),hY=()=>Ao(t=>t.appearance.palette),Bf=()=>Ao(t=>t.mode),pY=()=>Ao(t=>t.user),Ux=()=>Ao(t=>t.mappers),hT=()=>Ao(t=>t.audio),Os=()=>Ao(t=>t.actions),mY=()=>null;function Vde(t){const e=Mb()(n=>({presets:{active:"default",options:t},params:{...t.default},actions:{setParams:i=>n(r=>({params:{...r.params,...i}})),setPreset:i=>n(r=>({presets:{...r.presets,active:i},...!!i&&{params:{...r.params,...r.presets.options[i]}}}))}}));return{useStore:e,usePresets:()=>e(n=>n.presets),useParams:()=>e(n=>n.params),useActions:()=>e(n=>n.actions)}}function pT(t,e){const n=Mb()(i=>({presets:{active:"default",options:e},instance:t,actions:{setParams:r=>i(s=>({instance:s.instance.clone(r)})),setPreset:r=>i(s=>({presets:{...s.presets,active:r},...!!r&&{instance:s.instance.clone(s.presets.options[r])}}))}}));return{useStore:n,usePresets:()=>n(i=>i.presets),useInstance:()=>n(i=>i.instance),useActions:()=>n(i=>i.actions)}}const{useActions:gY,useInstance:vY,usePresets:yY}=pT(new ff,{default:ff.PRESETS.DEFAULT}),nI={id:"data",ControlsComponent:mY,hooks:{useActions:gY,useInstance:vY,usePresets:yY}};function Nk(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var r=t.length;for(e=0;e{const e=wY(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:o=>{const a=o.split(mT);return a[0]===""&&a.length!==1&&a.shift(),Ok(a,e)||SY(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&i[o]?[...l,...i[o]]:l}}},Ok=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],i=e.nextPart.get(n),r=i?Ok(t.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;const s=t.join(mT);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},iI=/^\[(.+)\]$/,SY=t=>{if(iI.test(t)){const e=iI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},wY=t=>{const{theme:e,prefix:n}=t,i={nextPart:new Map,validators:[]};return EY(Object.entries(t.classGroups),n).forEach(([s,o])=>{_M(o,i,s,e)}),i},_M=(t,e,n,i)=>{t.forEach(r=>{if(typeof r=="string"){const s=r===""?e:rI(e,r);s.classGroupId=n;return}if(typeof r=="function"){if(MY(r)){_M(r(i),e,n,i);return}e.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([s,o])=>{_M(o,rI(e,s),n,i)})})},rI=(t,e)=>{let n=t;return e.split(mT).forEach(i=>{n.nextPart.has(i)||n.nextPart.set(i,{nextPart:new Map,validators:[]}),n=n.nextPart.get(i)}),n},MY=t=>t.isThemeGetter,EY=(t,e)=>e?t.map(([n,i])=>{const r=i.map(s=>typeof s=="string"?e+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([o,a])=>[e+o,a])):s);return[n,r]}):t,bY=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,i=new Map;const r=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,i=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=i.get(s))!==void 0)return r(s,o),o},set(s,o){n.has(s)?n.set(s,o):r(s,o)}}},kk="!",TY=t=>{const{separator:e,experimentalParseClassName:n}=t,i=e.length===1,r=e[0],s=e.length,o=a=>{const l=[];let c=0,d=0,h;for(let y=0;yd?h-d:void 0;return{modifiers:l,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:_}};return n?a=>n({className:a,parseClassName:o}):o},AY=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(i=>{i[0]==="["?(e.push(...n.sort(),i),n=[]):n.push(i)}),e.push(...n.sort()),e},CY=t=>({cache:bY(t.cacheSize),parseClassName:TY(t),..._Y(t)}),PY=/\s+/,RY=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:r}=e,s=[],o=t.trim().split(PY);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:h,baseClassName:p,maybePostfixModifierPosition:g}=n(c);let v=!!g,_=i(v?p.substring(0,g):p);if(!_){if(!v){a=c+(a.length>0?" "+a:a);continue}if(_=i(p),!_){a=c+(a.length>0?" "+a:a);continue}v=!1}const y=AY(d).join(":"),m=h?y+kk:y,w=m+_;if(s.includes(w))continue;s.push(w);const S=r(_,v);for(let E=0;E0?" "+a:a)}return a};function IY(){let t=0,e,n,i="";for(;t{if(typeof t=="string")return t;let e,n="";for(let i=0;ih(d),t());return n=CY(c),i=n.cache.get,r=n.cache.set,s=a,a(l)}function a(l){const c=i(l);if(c)return c;const d=RY(l,n);return r(l,d),d}return function(){return s(IY.apply(null,arguments))}}const xn=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},Uk=/^\[(?:([a-z-]+):)?(.+)\]$/i,DY=/^\d+\/\d+$/,NY=new Set(["px","full","screen"]),OY=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kY=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,FY=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,UY=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,zY=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ho=t=>Od(t)||NY.has(t)||DY.test(t),za=t=>Vf(t,"length",qY),Od=t=>!!t&&!Number.isNaN(Number(t)),bw=t=>Vf(t,"number",Od),Lh=t=>!!t&&Number.isInteger(Number(t)),BY=t=>t.endsWith("%")&&Od(t.slice(0,-1)),kt=t=>Uk.test(t),Ba=t=>OY.test(t),VY=new Set(["length","size","percentage"]),HY=t=>Vf(t,VY,zk),WY=t=>Vf(t,"position",zk),GY=new Set(["image","url"]),jY=t=>Vf(t,GY,YY),XY=t=>Vf(t,"",$Y),Dh=()=>!0,Vf=(t,e,n)=>{const i=Uk.exec(t);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):n(i[2]):!1},qY=t=>kY.test(t)&&!FY.test(t),zk=()=>!1,$Y=t=>UY.test(t),YY=t=>zY.test(t),ZY=()=>{const t=xn("colors"),e=xn("spacing"),n=xn("blur"),i=xn("brightness"),r=xn("borderColor"),s=xn("borderRadius"),o=xn("borderSpacing"),a=xn("borderWidth"),l=xn("contrast"),c=xn("grayscale"),d=xn("hueRotate"),h=xn("invert"),p=xn("gap"),g=xn("gradientColorStops"),v=xn("gradientColorStopPositions"),_=xn("inset"),y=xn("margin"),m=xn("opacity"),w=xn("padding"),S=xn("saturate"),E=xn("scale"),C=xn("sepia"),R=xn("skew"),I=xn("space"),N=xn("translate"),F=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",kt,e],j=()=>[kt,e],K=()=>["",Ho,za],V=()=>["auto",Od,kt],Z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Y=()=>["solid","dashed","dotted","double","none"],J=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],k=()=>["start","end","center","between","around","evenly","stretch"],W=()=>["","0",kt],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[Od,kt];return{cacheSize:500,separator:":",theme:{colors:[Dh],spacing:[Ho,za],blur:["none","",Ba,kt],brightness:Q(),borderColor:[t],borderRadius:["none","","full",Ba,kt],borderSpacing:j(),borderWidth:K(),contrast:Q(),grayscale:W(),hueRotate:Q(),invert:W(),gap:j(),gradientColorStops:[t],gradientColorStopPositions:[BY,za],inset:D(),margin:D(),opacity:Q(),padding:j(),saturate:Q(),scale:Q(),sepia:W(),skew:Q(),space:j(),translate:j()},classGroups:{aspect:[{aspect:["auto","square","video",kt]}],container:["container"],columns:[{columns:[Ba]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Z(),kt]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[_]}],"inset-x":[{"inset-x":[_]}],"inset-y":[{"inset-y":[_]}],start:[{start:[_]}],end:[{end:[_]}],top:[{top:[_]}],right:[{right:[_]}],bottom:[{bottom:[_]}],left:[{left:[_]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Lh,kt]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",kt]}],grow:[{grow:W()}],shrink:[{shrink:W()}],order:[{order:["first","last","none",Lh,kt]}],"grid-cols":[{"grid-cols":[Dh]}],"col-start-end":[{col:["auto",{span:["full",Lh,kt]},kt]}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":[Dh]}],"row-start-end":[{row:["auto",{span:[Lh,kt]},kt]}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",kt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",kt]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...k()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...k(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...k(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[I]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[I]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",kt,e]}],"min-w":[{"min-w":[kt,e,"min","max","fit"]}],"max-w":[{"max-w":[kt,e,"none","full","min","max","fit","prose",{screen:[Ba]},Ba]}],h:[{h:[kt,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[kt,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[kt,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[kt,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ba,za]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",bw]}],"font-family":[{font:[Dh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",kt]}],"line-clamp":[{"line-clamp":["none",Od,bw]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ho,kt]}],"list-image":[{"list-image":["none",kt]}],"list-style-type":[{list:["none","disc","decimal",kt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[m]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[m]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ho,za]}],"underline-offset":[{"underline-offset":["auto",Ho,kt]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",kt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",kt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[m]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Z(),WY]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",HY]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jY]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[m]}],"border-style":[{border:[...Y(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[m]}],"divide-style":[{divide:Y()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...Y()]}],"outline-offset":[{"outline-offset":[Ho,kt]}],"outline-w":[{outline:[Ho,za]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[m]}],"ring-offset-w":[{"ring-offset":[Ho,za]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ba,XY]}],"shadow-color":[{shadow:[Dh]}],opacity:[{opacity:[m]}],"mix-blend":[{"mix-blend":[...J(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":J()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[i]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Ba,kt]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[h]}],saturate:[{saturate:[S]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[m]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",kt]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",kt]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",kt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[Lh,kt]}],"translate-x":[{"translate-x":[N]}],"translate-y":[{"translate-y":[N]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",kt]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",kt]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",kt]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Ho,za,bw]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},KY=LY(ZY);function qt(...t){return KY(xY(t))}var Bk={exports:{}},Wr={},Vk={exports:{}},Hk={};/** + * @license React + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */(function(t){function e(k,W){var $=k.length;k.push(W);e:for(;0<$;){var Q=$-1>>>1,de=k[Q];if(0>>1;Qr(he,$))Eer(me,he)?(k[Q]=me,k[Ee]=$,Q=Ee):(k[Q]=he,k[ie]=$,Q=ie);else if(Eer(me,$))k[Q]=me,k[Ee]=$,Q=Ee;else break e}}return W}function r(k,W){var $=k.sortIndex-W.sortIndex;return $!==0?$:k.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,h=null,p=3,g=!1,v=!1,_=!1,y=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(k){for(var W=n(c);W!==null;){if(W.callback===null)i(c);else if(W.startTime<=k)i(c),W.sortIndex=W.expirationTime,e(l,W);else break;W=n(c)}}function E(k){if(_=!1,S(k),!v)if(n(l)!==null)v=!0,Y(C);else{var W=n(c);W!==null&&J(E,W.startTime-k)}}function C(k,W){v=!1,_&&(_=!1,m(N),N=-1),g=!0;var $=p;try{for(S(W),h=n(l);h!==null&&(!(h.expirationTime>W)||k&&!D());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,p=h.priorityLevel;var de=Q(h.expirationTime<=W);W=t.unstable_now(),typeof de=="function"?h.callback=de:h===n(l)&&i(l),S(W)}else i(l);h=n(l)}if(h!==null)var be=!0;else{var ie=n(c);ie!==null&&J(E,ie.startTime-W),be=!1}return be}finally{h=null,p=$,g=!1}}var R=!1,I=null,N=-1,F=5,A=-1;function D(){return!(t.unstable_now()-Ak||125Q?(k.sortIndex=$,e(c,k),n(l)===null&&k===n(c)&&(_?(m(N),N=-1):_=!0,J(E,$-Q))):(k.sortIndex=de,e(l,k),v||g||(v=!0,Y(C))),k},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(k){var W=p;return function(){var $=p;p=W;try{return k.apply(this,arguments)}finally{p=$}}}})(Hk);Vk.exports=Hk;var QY=Vk.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var JY=b,Vr=QY;function Pe(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),SM=Object.prototype.hasOwnProperty,eZ=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,sI={},oI={};function tZ(t){return SM.call(oI,t)?!0:SM.call(sI,t)?!1:eZ.test(t)?oI[t]=!0:(sI[t]=!0,!1)}function nZ(t,e,n,i){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return i?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function iZ(t,e,n,i){if(e===null||typeof e>"u"||nZ(t,e,n,i))return!0;if(i)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function cr(t,e,n,i,r,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Ai={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ai[t]=new cr(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ai[e]=new cr(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ai[t]=new cr(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ai[t]=new cr(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Ai[t]=new cr(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ai[t]=new cr(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ai[t]=new cr(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ai[t]=new cr(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ai[t]=new cr(t,5,!1,t.toLowerCase(),null,!1,!1)});var gT=/[\-:]([a-z])/g;function vT(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(gT,vT);Ai[e]=new cr(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(gT,vT);Ai[e]=new cr(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(gT,vT);Ai[e]=new cr(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ai[t]=new cr(t,1,!1,t.toLowerCase(),null,!1,!1)});Ai.xlinkHref=new cr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ai[t]=new cr(t,1,!1,t.toLowerCase(),null,!0,!0)});function yT(t,e,n,i){var r=Ai.hasOwnProperty(e)?Ai[e]:null;(r!==null?r.type!==0:i||!(2a||r[o]!==s[a]){var l=` +`+r[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{Aw=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Xh(t):""}function rZ(t){switch(t.tag){case 5:return Xh(t.type);case 16:return Xh("Lazy");case 13:return Xh("Suspense");case 19:return Xh("SuspenseList");case 0:case 2:case 15:return t=Cw(t.type,!1),t;case 11:return t=Cw(t.type.render,!1),t;case 1:return t=Cw(t.type,!0),t;default:return""}}function bM(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case gd:return"Fragment";case md:return"Portal";case wM:return"Profiler";case xT:return"StrictMode";case MM:return"Suspense";case EM:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case jk:return(t.displayName||"Context")+".Consumer";case Gk:return(t._context.displayName||"Context")+".Provider";case _T:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ST:return e=t.displayName||null,e!==null?e:bM(t.type)||"Memo";case ja:e=t._payload,t=t._init;try{return bM(t(e))}catch{}}return null}function sZ(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return bM(e);case 8:return e===xT?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Sl(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function qk(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function oZ(t){var e=qk(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),i=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var r=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return r.call(this)},set:function(o){i=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return i},setValue:function(o){i=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function e0(t){t._valueTracker||(t._valueTracker=oZ(t))}function $k(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=qk(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function uy(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function TM(t,e){var n=e.checked;return Nn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function lI(t,e){var n=e.defaultValue==null?"":e.defaultValue,i=e.checked!=null?e.checked:e.defaultChecked;n=Sl(e.value!=null?e.value:n),t._wrapperState={initialChecked:i,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Yk(t,e){e=e.checked,e!=null&&yT(t,"checked",e,!1)}function AM(t,e){Yk(t,e);var n=Sl(e.value),i=e.type;if(n!=null)i==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(i==="submit"||i==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?CM(t,e.type,n):e.hasOwnProperty("defaultValue")&&CM(t,e.type,Sl(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function cI(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var i=e.type;if(!(i!=="submit"&&i!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function CM(t,e,n){(e!=="number"||uy(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var qh=Array.isArray;function kd(t,e,n,i){if(t=t.options,e){e={};for(var r=0;r"+e.valueOf().toString()+"",e=t0.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function qp(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var cp={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},aZ=["Webkit","ms","Moz","O"];Object.keys(cp).forEach(function(t){aZ.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),cp[e]=cp[t]})});function Jk(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||cp.hasOwnProperty(t)&&cp[t]?(""+e).trim():e+"px"}function eF(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var i=n.indexOf("--")===0,r=Jk(n,e[n],i);n==="float"&&(n="cssFloat"),i?t.setProperty(n,r):t[n]=r}}var lZ=Nn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function IM(t,e){if(e){if(lZ[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Pe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Pe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Pe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Pe(62))}}function LM(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var DM=null;function wT(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var NM=null,Fd=null,Ud=null;function fI(t){if(t=Qm(t)){if(typeof NM!="function")throw Error(Pe(280));var e=t.stateNode;e&&(e=Wx(e),NM(t.stateNode,t.type,e))}}function tF(t){Fd?Ud?Ud.push(t):Ud=[t]:Fd=t}function nF(){if(Fd){var t=Fd,e=Ud;if(Ud=Fd=null,fI(t),e)for(t=0;t>>=0,t===0?32:31-(xZ(t)/_Z|0)|0}var n0=64,i0=4194304;function $h(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function py(t,e){var n=t.pendingLanes;if(n===0)return 0;var i=0,r=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~r;a!==0?i=$h(a):(s&=o,s!==0&&(i=$h(s)))}else o=n&~r,o!==0?i=$h(o):s!==0&&(i=$h(s));if(i===0)return 0;if(e!==0&&e!==i&&!(e&r)&&(r=i&-i,s=e&-e,r>=s||r===16&&(s&4194240)!==0))return e;if(i&4&&(i|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=i;0n;n++)e.push(t);return e}function Zm(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Rs(e),t[e]=n}function EZ(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var i=t.eventTimes;for(t=t.expirationTimes;0=dp),SI=" ",wI=!1;function wF(t,e){switch(t){case"keyup":return QZ.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function MF(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var vd=!1;function eK(t,e){switch(t){case"compositionend":return MF(e);case"keypress":return e.which!==32?null:(wI=!0,SI);case"textInput":return t=e.data,t===SI&&wI?null:t;default:return null}}function tK(t,e){if(vd)return t==="compositionend"||!RT&&wF(t,e)?(t=_F(),B0=AT=il=null,vd=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=i}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=TI(n)}}function AF(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?AF(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function CF(){for(var t=window,e=uy();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=uy(t.document)}return e}function IT(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function uK(t){var e=CF(),n=t.focusedElem,i=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&AF(n.ownerDocument.documentElement,n)){if(i!==null&&IT(n)){if(e=i.start,t=i.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var r=n.textContent.length,s=Math.min(i.start,r);i=i.end===void 0?s:Math.min(i.end,r),!t.extend&&s>i&&(r=i,i=s,s=r),r=AI(n,s);var o=AI(n,i);r&&o&&(t.rangeCount!==1||t.anchorNode!==r.node||t.anchorOffset!==r.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(r.node,r.offset),t.removeAllRanges(),s>i?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,yd=null,BM=null,hp=null,VM=!1;function CI(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;VM||yd==null||yd!==uy(i)||(i=yd,"selectionStart"in i&&IT(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),hp&&Jp(hp,i)||(hp=i,i=vy(BM,"onSelect"),0Sd||(t.current=qM[Sd],qM[Sd]=null,Sd--)}function vn(t,e){Sd++,qM[Sd]=t.current,t.current=e}var wl={},Xi=zl(wl),xr=zl(!1),Qc=wl;function mf(t,e){var n=t.type.contextTypes;if(!n)return wl;var i=t.stateNode;if(i&&i.__reactInternalMemoizedUnmaskedChildContext===e)return i.__reactInternalMemoizedMaskedChildContext;var r={},s;for(s in n)r[s]=e[s];return i&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=r),r}function _r(t){return t=t.childContextTypes,t!=null}function xy(){Sn(xr),Sn(Xi)}function OI(t,e,n){if(Xi.current!==wl)throw Error(Pe(168));vn(Xi,e),vn(xr,n)}function FF(t,e,n){var i=t.stateNode;if(e=e.childContextTypes,typeof i.getChildContext!="function")return n;i=i.getChildContext();for(var r in i)if(!(r in e))throw Error(Pe(108,sZ(t)||"Unknown",r));return Nn({},n,i)}function _y(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||wl,Qc=Xi.current,vn(Xi,t),vn(xr,xr.current),!0}function kI(t,e,n){var i=t.stateNode;if(!i)throw Error(Pe(169));n?(t=FF(t,e,Qc),i.__reactInternalMemoizedMergedChildContext=t,Sn(xr),Sn(Xi),vn(Xi,t)):Sn(xr),vn(xr,n)}var Yo=null,Gx=!1,Hw=!1;function UF(t){Yo===null?Yo=[t]:Yo.push(t)}function wK(t){Gx=!0,UF(t)}function Bl(){if(!Hw&&Yo!==null){Hw=!0;var t=0,e=dn;try{var n=Yo;for(dn=1;t>=o,r-=o,ta=1<<32-Rs(e)+r|n<N?(F=I,I=null):F=I.sibling;var A=p(m,I,S[N],E);if(A===null){I===null&&(I=F);break}t&&I&&A.alternate===null&&e(m,I),w=s(A,w,N),R===null?C=A:R.sibling=A,R=A,I=F}if(N===S.length)return n(m,I),En&&gc(m,N),C;if(I===null){for(;NN?(F=I,I=null):F=I.sibling;var D=p(m,I,A.value,E);if(D===null){I===null&&(I=F);break}t&&I&&D.alternate===null&&e(m,I),w=s(D,w,N),R===null?C=D:R.sibling=D,R=D,I=F}if(A.done)return n(m,I),En&&gc(m,N),C;if(I===null){for(;!A.done;N++,A=S.next())A=h(m,A.value,E),A!==null&&(w=s(A,w,N),R===null?C=A:R.sibling=A,R=A);return En&&gc(m,N),C}for(I=i(m,I);!A.done;N++,A=S.next())A=g(I,m,N,A.value,E),A!==null&&(t&&A.alternate!==null&&I.delete(A.key===null?N:A.key),w=s(A,w,N),R===null?C=A:R.sibling=A,R=A);return t&&I.forEach(function(j){return e(m,j)}),En&&gc(m,N),C}function y(m,w,S,E){if(typeof S=="object"&&S!==null&&S.type===gd&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Jv:e:{for(var C=S.key,R=w;R!==null;){if(R.key===C){if(C=S.type,C===gd){if(R.tag===7){n(m,R.sibling),w=r(R,S.props.children),w.return=m,m=w;break e}}else if(R.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ja&&zI(C)===R.type){n(m,R.sibling),w=r(R,S.props),w.ref=zh(m,R,S),w.return=m,m=w;break e}n(m,R);break}else e(m,R);R=R.sibling}S.type===gd?(w=Xc(S.props.children,m.mode,E,S.key),w.return=m,m=w):(E=$0(S.type,S.key,S.props,null,m.mode,E),E.ref=zh(m,w,S),E.return=m,m=E)}return o(m);case md:e:{for(R=S.key;w!==null;){if(w.key===R)if(w.tag===4&&w.stateNode.containerInfo===S.containerInfo&&w.stateNode.implementation===S.implementation){n(m,w.sibling),w=r(w,S.children||[]),w.return=m,m=w;break e}else{n(m,w);break}else e(m,w);w=w.sibling}w=Zw(S,m.mode,E),w.return=m,m=w}return o(m);case ja:return R=S._init,y(m,w,R(S._payload),E)}if(qh(S))return v(m,w,S,E);if(Nh(S))return _(m,w,S,E);u0(m,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,w!==null&&w.tag===6?(n(m,w.sibling),w=r(w,S),w.return=m,m=w):(n(m,w),w=Yw(S,m.mode,E),w.return=m,m=w),o(m)):n(m,w)}return y}var vf=HF(!0),WF=HF(!1),My=zl(null),Ey=null,Ed=null,OT=null;function kT(){OT=Ed=Ey=null}function FT(t){var e=My.current;Sn(My),t._currentValue=e}function ZM(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function Bd(t,e){Ey=t,OT=Ed=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(yr=!0),t.firstContext=null)}function fs(t){var e=t._currentValue;if(OT!==t)if(t={context:t,memoizedValue:e,next:null},Ed===null){if(Ey===null)throw Error(Pe(308));Ed=t,Ey.dependencies={lanes:0,firstContext:t}}else Ed=Ed.next=t;return e}var Ac=null;function UT(t){Ac===null?Ac=[t]:Ac.push(t)}function GF(t,e,n,i){var r=e.interleaved;return r===null?(n.next=n,UT(e)):(n.next=r.next,r.next=n),e.interleaved=n,ma(t,i)}function ma(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Xa=!1;function zT(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jF(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function sa(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function pl(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,en&2){var r=i.pending;return r===null?e.next=e:(e.next=r.next,r.next=e),i.pending=e,ma(t,n)}return r=i.interleaved,r===null?(e.next=e,UT(i)):(e.next=r.next,r.next=e),i.interleaved=e,ma(t,n)}function H0(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,ET(t,n)}}function BI(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var r=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?r=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?r=s=e:s=s.next=e}else r=s=e;n={baseState:i.baseState,firstBaseUpdate:r,lastBaseUpdate:s,shared:i.shared,effects:i.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function by(t,e,n,i){var r=t.updateQueue;Xa=!1;var s=r.firstBaseUpdate,o=r.lastBaseUpdate,a=r.shared.pending;if(a!==null){r.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(s!==null){var h=r.baseState;o=0,d=c=l=null,a=s;do{var p=a.lane,g=a.eventTime;if((i&p)===p){d!==null&&(d=d.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=t,_=a;switch(p=e,g=n,_.tag){case 1:if(v=_.payload,typeof v=="function"){h=v.call(g,h,p);break e}h=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=_.payload,p=typeof v=="function"?v.call(g,h,p):v,p==null)break e;h=Nn({},h,p);break e;case 2:Xa=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,p=r.effects,p===null?r.effects=[a]:p.push(a))}else g={eventTime:g,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=g,l=h):d=d.next=g,o|=p;if(a=a.next,a===null){if(a=r.shared.pending,a===null)break;p=a,a=p.next,p.next=null,r.lastBaseUpdate=p,r.shared.pending=null}}while(!0);if(d===null&&(l=h),r.baseState=l,r.firstBaseUpdate=c,r.lastBaseUpdate=d,e=r.shared.interleaved,e!==null){r=e;do o|=r.lane,r=r.next;while(r!==e)}else s===null&&(r.shared.lanes=0);tu|=o,t.lanes=o,t.memoizedState=h}}function VI(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var i=Gw.transition;Gw.transition={};try{t(!1),e()}finally{dn=n,Gw.transition=i}}function lU(){return hs().memoizedState}function TK(t,e,n){var i=gl(t);if(n={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null},cU(t))uU(e,n);else if(n=GF(t,e,n,i),n!==null){var r=sr();Is(n,t,i,r),dU(n,e,i)}}function AK(t,e,n){var i=gl(t),r={lane:i,action:n,hasEagerState:!1,eagerState:null,next:null};if(cU(t))uU(e,r);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(r.hasEagerState=!0,r.eagerState=a,ks(a,o)){var l=e.interleaved;l===null?(r.next=r,UT(e)):(r.next=l.next,l.next=r),e.interleaved=r;return}}catch{}finally{}n=GF(t,e,r,i),n!==null&&(r=sr(),Is(n,t,i,r),dU(n,e,i))}}function cU(t){var e=t.alternate;return t===Dn||e!==null&&e===Dn}function uU(t,e){pp=Ay=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function dU(t,e,n){if(n&4194240){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,ET(t,n)}}var Cy={readContext:fs,useCallback:ki,useContext:ki,useEffect:ki,useImperativeHandle:ki,useInsertionEffect:ki,useLayoutEffect:ki,useMemo:ki,useReducer:ki,useRef:ki,useState:ki,useDebugValue:ki,useDeferredValue:ki,useTransition:ki,useMutableSource:ki,useSyncExternalStore:ki,useId:ki,unstable_isNewReconciler:!1},CK={readContext:fs,useCallback:function(t,e){return to().memoizedState=[t,e===void 0?null:e],t},useContext:fs,useEffect:WI,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,G0(4194308,4,iU.bind(null,e,t),n)},useLayoutEffect:function(t,e){return G0(4194308,4,t,e)},useInsertionEffect:function(t,e){return G0(4,2,t,e)},useMemo:function(t,e){var n=to();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var i=to();return e=n!==void 0?n(e):e,i.memoizedState=i.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},i.queue=t,t=t.dispatch=TK.bind(null,Dn,t),[i.memoizedState,t]},useRef:function(t){var e=to();return t={current:t},e.memoizedState=t},useState:HI,useDebugValue:qT,useDeferredValue:function(t){return to().memoizedState=t},useTransition:function(){var t=HI(!1),e=t[0];return t=bK.bind(null,t[1]),to().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var i=Dn,r=to();if(En){if(n===void 0)throw Error(Pe(407));n=n()}else{if(n=e(),vi===null)throw Error(Pe(349));eu&30||YF(i,e,n)}r.memoizedState=n;var s={value:n,getSnapshot:e};return r.queue=s,WI(KF.bind(null,i,s,t),[t]),i.flags|=2048,am(9,ZF.bind(null,i,s,n,e),void 0,null),n},useId:function(){var t=to(),e=vi.identifierPrefix;if(En){var n=na,i=ta;n=(i&~(1<<32-Rs(i)-1)).toString(32)+n,e=":"+e+"R"+n,n=sm++,0<\/script>",t=t.removeChild(t.firstChild)):typeof i.is=="string"?t=o.createElement(n,{is:i.is}):(t=o.createElement(n),n==="select"&&(o=t,i.multiple?o.multiple=!0:i.size&&(o.size=i.size))):t=o.createElementNS(t,n),t[ao]=e,t[nm]=i,SU(t,e,!1,!1),e.stateNode=t;e:{switch(o=LM(n,i),n){case"dialog":_n("cancel",t),_n("close",t),r=i;break;case"iframe":case"object":case"embed":_n("load",t),r=i;break;case"video":case"audio":for(r=0;r_f&&(e.flags|=128,i=!0,Bh(s,!1),e.lanes=4194304)}else{if(!i)if(t=Ty(o),t!==null){if(e.flags|=128,i=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Bh(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!En)return Fi(e),null}else 2*Yn()-s.renderingStartTime>_f&&n!==1073741824&&(e.flags|=128,i=!0,Bh(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Yn(),e.sibling=null,n=Rn.current,vn(Rn,i?n&1|2:n&1),e):(Fi(e),null);case 22:case 23:return JT(),i=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==i&&(e.flags|=8192),i&&e.mode&1?Lr&1073741824&&(Fi(e),e.subtreeFlags&6&&(e.flags|=8192)):Fi(e),null;case 24:return null;case 25:return null}throw Error(Pe(156,e.tag))}function kK(t,e){switch(DT(e),e.tag){case 1:return _r(e.type)&&xy(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return yf(),Sn(xr),Sn(Xi),HT(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return VT(e),null;case 13:if(Sn(Rn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Pe(340));gf()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Sn(Rn),null;case 4:return yf(),null;case 10:return FT(e.type._context),null;case 22:case 23:return JT(),null;case 24:return null;default:return null}}var f0=!1,Bi=!1,FK=typeof WeakSet=="function"?WeakSet:Set,Ke=null;function bd(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(i){Bn(t,e,i)}else n.current=null}function sE(t,e,n){try{n()}catch(i){Bn(t,e,i)}}var eL=!1;function UK(t,e){if(HM=my,t=CF(),IT(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var r=i.anchorOffset,s=i.focusNode;i=i.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,d=0,h=t,p=null;t:for(;;){for(var g;h!==n||r!==0&&h.nodeType!==3||(a=o+r),h!==s||i!==0&&h.nodeType!==3||(l=o+i),h.nodeType===3&&(o+=h.nodeValue.length),(g=h.firstChild)!==null;)p=h,h=g;for(;;){if(h===t)break t;if(p===n&&++c===r&&(a=o),p===s&&++d===i&&(l=o),(g=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(WM={focusedElem:t,selectionRange:n},my=!1,Ke=e;Ke!==null;)if(e=Ke,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Ke=t;else for(;Ke!==null;){e=Ke;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var _=v.memoizedProps,y=v.memoizedState,m=e.stateNode,w=m.getSnapshotBeforeUpdate(e.elementType===e.type?_:Ms(e.type,_),y);m.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Pe(163))}}catch(E){Bn(e,e.return,E)}if(t=e.sibling,t!==null){t.return=e.return,Ke=t;break}Ke=e.return}return v=eL,eL=!1,v}function mp(t,e,n){var i=e.updateQueue;if(i=i!==null?i.lastEffect:null,i!==null){var r=i=i.next;do{if((r.tag&t)===t){var s=r.destroy;r.destroy=void 0,s!==void 0&&sE(e,n,s)}r=r.next}while(r!==i)}}function qx(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var i=n.create;n.destroy=i()}n=n.next}while(n!==e)}}function oE(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function EU(t){var e=t.alternate;e!==null&&(t.alternate=null,EU(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ao],delete e[nm],delete e[XM],delete e[_K],delete e[SK])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function bU(t){return t.tag===5||t.tag===3||t.tag===4}function tL(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||bU(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function aE(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=yy));else if(i!==4&&(t=t.child,t!==null))for(aE(t,e,n),t=t.sibling;t!==null;)aE(t,e,n),t=t.sibling}function lE(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(t=t.child,t!==null))for(lE(t,e,n),t=t.sibling;t!==null;)lE(t,e,n),t=t.sibling}var Mi=null,bs=!1;function Va(t,e,n){for(n=n.child;n!==null;)TU(t,e,n),n=n.sibling}function TU(t,e,n){if(mo&&typeof mo.onCommitFiberUnmount=="function")try{mo.onCommitFiberUnmount(zx,n)}catch{}switch(n.tag){case 5:Bi||bd(n,e);case 6:var i=Mi,r=bs;Mi=null,Va(t,e,n),Mi=i,bs=r,Mi!==null&&(bs?(t=Mi,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Mi.removeChild(n.stateNode));break;case 18:Mi!==null&&(bs?(t=Mi,n=n.stateNode,t.nodeType===8?Vw(t.parentNode,n):t.nodeType===1&&Vw(t,n),Kp(t)):Vw(Mi,n.stateNode));break;case 4:i=Mi,r=bs,Mi=n.stateNode.containerInfo,bs=!0,Va(t,e,n),Mi=i,bs=r;break;case 0:case 11:case 14:case 15:if(!Bi&&(i=n.updateQueue,i!==null&&(i=i.lastEffect,i!==null))){r=i=i.next;do{var s=r,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&sE(n,e,o),r=r.next}while(r!==i)}Va(t,e,n);break;case 1:if(!Bi&&(bd(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"))try{i.props=n.memoizedProps,i.state=n.memoizedState,i.componentWillUnmount()}catch(a){Bn(n,e,a)}Va(t,e,n);break;case 21:Va(t,e,n);break;case 22:n.mode&1?(Bi=(i=Bi)||n.memoizedState!==null,Va(t,e,n),Bi=i):Va(t,e,n);break;default:Va(t,e,n)}}function nL(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new FK),e.forEach(function(i){var r=qK.bind(null,t,i);n.has(i)||(n.add(i),i.then(r,r))})}}function _s(t,e){var n=e.deletions;if(n!==null)for(var i=0;ir&&(r=o),i&=~s}if(i=r,i=Yn()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*BK(i/1960))-i,10t?16:t,rl===null)var i=!1;else{if(t=rl,rl=null,Iy=0,en&6)throw Error(Pe(331));var r=en;for(en|=4,Ke=t.current;Ke!==null;){var s=Ke,o=s.child;if(Ke.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lYn()-KT?jc(t,0):ZT|=n),Sr(t,e)}function NU(t,e){e===0&&(t.mode&1?(e=i0,i0<<=1,!(i0&130023424)&&(i0=4194304)):e=1);var n=sr();t=ma(t,e),t!==null&&(Zm(t,e,n),Sr(t,n))}function XK(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),NU(t,n)}function qK(t,e){var n=0;switch(t.tag){case 13:var i=t.stateNode,r=t.memoizedState;r!==null&&(n=r.retryLane);break;case 19:i=t.stateNode;break;default:throw Error(Pe(314))}i!==null&&i.delete(e),NU(t,n)}var OU;OU=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||xr.current)yr=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return yr=!1,NK(t,e,n);yr=!!(t.flags&131072)}else yr=!1,En&&e.flags&1048576&&zF(e,wy,e.index);switch(e.lanes=0,e.tag){case 2:var i=e.type;j0(t,e),t=e.pendingProps;var r=mf(e,Xi.current);Bd(e,n),r=GT(null,e,i,t,r,n);var s=jT();return e.flags|=1,typeof r=="object"&&r!==null&&typeof r.render=="function"&&r.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,_r(i)?(s=!0,_y(e)):s=!1,e.memoizedState=r.state!==null&&r.state!==void 0?r.state:null,zT(e),r.updater=Xx,e.stateNode=r,r._reactInternals=e,QM(e,i,t,n),e=tE(null,e,i,!0,s,n)):(e.tag=0,En&&s&<(e),tr(null,e,r,n),e=e.child),e;case 16:i=e.elementType;e:{switch(j0(t,e),t=e.pendingProps,r=i._init,i=r(i._payload),e.type=i,r=e.tag=YK(i),t=Ms(i,t),r){case 0:e=eE(null,e,i,t,n);break e;case 1:e=KI(null,e,i,t,n);break e;case 11:e=YI(null,e,i,t,n);break e;case 14:e=ZI(null,e,i,Ms(i.type,t),n);break e}throw Error(Pe(306,i,""))}return e;case 0:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Ms(i,r),eE(t,e,i,r,n);case 1:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Ms(i,r),KI(t,e,i,r,n);case 3:e:{if(yU(e),t===null)throw Error(Pe(387));i=e.pendingProps,s=e.memoizedState,r=s.element,jF(t,e),by(e,i,null,n);var o=e.memoizedState;if(i=o.element,s.isDehydrated)if(s={element:i,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){r=xf(Error(Pe(423)),e),e=QI(t,e,i,n,r);break e}else if(i!==r){r=xf(Error(Pe(424)),e),e=QI(t,e,i,n,r);break e}else for(kr=hl(e.stateNode.containerInfo.firstChild),Ur=e,En=!0,As=null,n=WF(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(gf(),i===r){e=ga(t,e,n);break e}tr(t,e,i,n)}e=e.child}return e;case 5:return XF(e),t===null&&YM(e),i=e.type,r=e.pendingProps,s=t!==null?t.memoizedProps:null,o=r.children,GM(i,r)?o=null:s!==null&&GM(i,s)&&(e.flags|=32),vU(t,e),tr(t,e,o,n),e.child;case 6:return t===null&&YM(e),null;case 13:return xU(t,e,n);case 4:return BT(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=vf(e,null,i,n):tr(t,e,i,n),e.child;case 11:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Ms(i,r),YI(t,e,i,r,n);case 7:return tr(t,e,e.pendingProps,n),e.child;case 8:return tr(t,e,e.pendingProps.children,n),e.child;case 12:return tr(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(i=e.type._context,r=e.pendingProps,s=e.memoizedProps,o=r.value,vn(My,i._currentValue),i._currentValue=o,s!==null)if(ks(s.value,o)){if(s.children===r.children&&!xr.current){e=ga(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===i){if(s.tag===1){l=sa(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),ZM(s.return,n,e),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Pe(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),ZM(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}tr(t,e,r.children,n),e=e.child}return e;case 9:return r=e.type,i=e.pendingProps.children,Bd(e,n),r=fs(r),i=i(r),e.flags|=1,tr(t,e,i,n),e.child;case 14:return i=e.type,r=Ms(i,e.pendingProps),r=Ms(i.type,r),ZI(t,e,i,r,n);case 15:return mU(t,e,e.type,e.pendingProps,n);case 17:return i=e.type,r=e.pendingProps,r=e.elementType===i?r:Ms(i,r),j0(t,e),e.tag=1,_r(i)?(t=!0,_y(e)):t=!1,Bd(e,n),fU(e,i,r),QM(e,i,r,n),tE(null,e,i,!0,t,n);case 19:return _U(t,e,n);case 22:return gU(t,e,n)}throw Error(Pe(156,e.tag))};function kU(t,e){return cF(t,e)}function $K(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function us(t,e,n,i){return new $K(t,e,n,i)}function tA(t){return t=t.prototype,!(!t||!t.isReactComponent)}function YK(t){if(typeof t=="function")return tA(t)?1:0;if(t!=null){if(t=t.$$typeof,t===_T)return 11;if(t===ST)return 14}return 2}function vl(t,e){var n=t.alternate;return n===null?(n=us(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function $0(t,e,n,i,r,s){var o=2;if(i=t,typeof t=="function")tA(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case gd:return Xc(n.children,r,s,e);case xT:o=8,r|=8;break;case wM:return t=us(12,n,e,r|2),t.elementType=wM,t.lanes=s,t;case MM:return t=us(13,n,e,r),t.elementType=MM,t.lanes=s,t;case EM:return t=us(19,n,e,r),t.elementType=EM,t.lanes=s,t;case Xk:return Yx(n,r,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Gk:o=10;break e;case jk:o=9;break e;case _T:o=11;break e;case ST:o=14;break e;case ja:o=16,i=null;break e}throw Error(Pe(130,t==null?t:typeof t,""))}return e=us(o,n,e,r),e.elementType=t,e.type=i,e.lanes=s,e}function Xc(t,e,n,i){return t=us(7,t,i,e),t.lanes=n,t}function Yx(t,e,n,i){return t=us(22,t,i,e),t.elementType=Xk,t.lanes=n,t.stateNode={isHidden:!1},t}function Yw(t,e,n){return t=us(6,t,null,e),t.lanes=n,t}function Zw(t,e,n){return e=us(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function ZK(t,e,n,i,r){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rw(0),this.expirationTimes=Rw(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rw(0),this.identifierPrefix=i,this.onRecoverableError=r,this.mutableSourceEagerHydrationData=null}function nA(t,e,n,i,r,s,o,a,l){return t=new ZK(t,e,n,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=us(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:i,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},zT(s),t}function KK(t,e,n){var i=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(BU)}catch(t){console.error(t)}}BU(),Bk.exports=Wr;var Gf=Bk.exports;const nQ=km(Gf);function iQ(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function VU(...t){return e=>t.forEach(n=>iQ(n,e))}function $t(...t){return b.useCallback(VU(...t),t)}var Ml=b.forwardRef((t,e)=>{const{children:n,...i}=t,r=b.Children.toArray(n),s=r.find(sQ);if(s){const o=s.props.children,a=r.map(l=>l===s?b.Children.count(o)>1?b.Children.only(null):b.isValidElement(o)?o.props.children:null:l);return P.jsx(hE,{...i,ref:e,children:b.isValidElement(o)?b.cloneElement(o,void 0,a):null})}return P.jsx(hE,{...i,ref:e,children:n})});Ml.displayName="Slot";var hE=b.forwardRef((t,e)=>{const{children:n,...i}=t;if(b.isValidElement(n)){const r=aQ(n);return b.cloneElement(n,{...oQ(i,n.props),ref:e?VU(e,r):r})}return b.Children.count(n)>1?b.Children.only(null):null});hE.displayName="SlotClone";var rQ=({children:t})=>P.jsx(P.Fragment,{children:t});function sQ(t){return b.isValidElement(t)&&t.type===rQ}function oQ(t,e){const n={...e};for(const i in e){const r=t[i],s=e[i];/^on[A-Z]/.test(i)?r&&s?n[i]=(...a)=>{s(...a),r(...a)}:r&&(n[i]=r):i==="style"?n[i]={...r,...s}:i==="className"&&(n[i]=[r,s].filter(Boolean).join(" "))}return{...t,...n}}function aQ(t){var i,r;let e=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var lQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Tt=lQ.reduce((t,e)=>{const n=b.forwardRef((i,r)=>{const{asChild:s,...o}=i,a=s?Ml:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),P.jsx(a,{...o,ref:r})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function cQ(t,e){t&&Gf.flushSync(()=>t.dispatchEvent(e))}var uQ="Label",HU=b.forwardRef((t,e)=>P.jsx(Tt.label,{...t,ref:e,onMouseDown:n=>{var r;n.target.closest("button, input, select, textarea")||((r=t.onMouseDown)==null||r.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));HU.displayName=uQ;var WU=HU;function GU(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;etypeof t=="boolean"?"".concat(t):t===0?"0":t,dL=dQ,oA=(t,e)=>n=>{var i;if((e==null?void 0:e.variants)==null)return dL(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:s}=e,o=Object.keys(r).map(c=>{const d=n==null?void 0:n[c],h=s==null?void 0:s[c];if(d===null)return null;const p=uL(d)||uL(h);return r[c][p]}),a=n&&Object.entries(n).reduce((c,d)=>{let[h,p]=d;return p===void 0||(c[h]=p),c},{}),l=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((c,d)=>{let{class:h,className:p,...g}=d;return Object.entries(g).every(v=>{let[_,y]=v;return Array.isArray(y)?y.includes({...s,...a}[_]):{...s,...a}[_]===y})?[...c,h,p]:c},[]);return dL(t,o,l,n==null?void 0:n.class,n==null?void 0:n.className)},fQ=oA("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),oa=b.forwardRef(({className:t,...e},n)=>P.jsx(WU,{ref:n,className:qt(fQ(),t),...e}));oa.displayName=WU.displayName;function ht(t,e,{checkForDefaultPrevented:n=!0}={}){return function(r){if(t==null||t(r),n===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}function hQ(t,e){const n=b.createContext(e),i=s=>{const{children:o,...a}=s,l=b.useMemo(()=>a,Object.values(a));return P.jsx(n.Provider,{value:l,children:o})};i.displayName=t+"Provider";function r(s){const o=b.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${s}\` must be used within \`${t}\``)}return[i,r]}function gu(t,e=[]){let n=[];function i(s,o){const a=b.createContext(o),l=n.length;n=[...n,o];const c=h=>{var m;const{scope:p,children:g,...v}=h,_=((m=p==null?void 0:p[t])==null?void 0:m[l])||a,y=b.useMemo(()=>v,Object.values(v));return P.jsx(_.Provider,{value:y,children:g})};c.displayName=s+"Provider";function d(h,p){var _;const g=((_=p==null?void 0:p[t])==null?void 0:_[l])||a,v=b.useContext(g);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return[c,d]}const r=()=>{const s=n.map(o=>b.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return r.scopeName=t,[i,pQ(r,...e)]}function pQ(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const i=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function bi(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var i;return(i=e.current)==null?void 0:i.call(e,...n)},[])}function mQ(t,e=globalThis==null?void 0:globalThis.document){const n=bi(t);b.useEffect(()=>{const i=r=>{r.key==="Escape"&&n(r)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[n,e])}var gQ="DismissableLayer",pE="dismissableLayer.update",vQ="dismissableLayer.pointerDownOutside",yQ="dismissableLayer.focusOutside",fL,jU=b.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),e_=b.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:r,onFocusOutside:s,onInteractOutside:o,onDismiss:a,...l}=t,c=b.useContext(jU),[d,h]=b.useState(null),p=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=b.useState({}),v=$t(e,I=>h(I)),_=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),m=_.indexOf(y),w=d?_.indexOf(d):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,E=w>=m,C=SQ(I=>{const N=I.target,F=[...c.branches].some(A=>A.contains(N));!E||F||(r==null||r(I),o==null||o(I),I.defaultPrevented||a==null||a())},p),R=wQ(I=>{const N=I.target;[...c.branches].some(A=>A.contains(N))||(s==null||s(I),o==null||o(I),I.defaultPrevented||a==null||a())},p);return mQ(I=>{w===c.layers.size-1&&(i==null||i(I),!I.defaultPrevented&&a&&(I.preventDefault(),a()))},p),b.useEffect(()=>{if(d)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(fL=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(d)),c.layers.add(d),hL(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=fL)}},[d,p,n,c]),b.useEffect(()=>()=>{d&&(c.layers.delete(d),c.layersWithOutsidePointerEventsDisabled.delete(d),hL())},[d,c]),b.useEffect(()=>{const I=()=>g({});return document.addEventListener(pE,I),()=>document.removeEventListener(pE,I)},[]),P.jsx(Tt.div,{...l,ref:v,style:{pointerEvents:S?E?"auto":"none":void 0,...t.style},onFocusCapture:ht(t.onFocusCapture,R.onFocusCapture),onBlurCapture:ht(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:ht(t.onPointerDownCapture,C.onPointerDownCapture)})});e_.displayName=gQ;var xQ="DismissableLayerBranch",_Q=b.forwardRef((t,e)=>{const n=b.useContext(jU),i=b.useRef(null),r=$t(e,i);return b.useEffect(()=>{const s=i.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),P.jsx(Tt.div,{...t,ref:r})});_Q.displayName=xQ;function SQ(t,e=globalThis==null?void 0:globalThis.document){const n=bi(t),i=b.useRef(!1),r=b.useRef(()=>{});return b.useEffect(()=>{const s=a=>{if(a.target&&!i.current){let l=function(){XU(vQ,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(e.removeEventListener("click",r.current),r.current=l,e.addEventListener("click",r.current,{once:!0})):l()}else e.removeEventListener("click",r.current);i.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",s),e.removeEventListener("click",r.current)}},[e,n]),{onPointerDownCapture:()=>i.current=!0}}function wQ(t,e=globalThis==null?void 0:globalThis.document){const n=bi(t),i=b.useRef(!1);return b.useEffect(()=>{const r=s=>{s.target&&!i.current&&XU(yQ,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",r),()=>e.removeEventListener("focusin",r)},[e,n]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function hL(){const t=new CustomEvent(pE);document.dispatchEvent(t)}function XU(t,e,n,{discrete:i}){const r=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),i?cQ(r,s):r.dispatchEvent(s)}var Kw=0;function aA(){b.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??pL()),document.body.insertAdjacentElement("beforeend",t[1]??pL()),Kw++,()=>{Kw===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Kw--}},[])}function pL(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Qw="focusScope.autoFocusOnMount",Jw="focusScope.autoFocusOnUnmount",mL={bubbles:!1,cancelable:!0},MQ="FocusScope",t_=b.forwardRef((t,e)=>{const{loop:n=!1,trapped:i=!1,onMountAutoFocus:r,onUnmountAutoFocus:s,...o}=t,[a,l]=b.useState(null),c=bi(r),d=bi(s),h=b.useRef(null),p=$t(e,_=>l(_)),g=b.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;b.useEffect(()=>{if(i){let _=function(S){if(g.paused||!a)return;const E=S.target;a.contains(E)?h.current=E:Ha(h.current,{select:!0})},y=function(S){if(g.paused||!a)return;const E=S.relatedTarget;E!==null&&(a.contains(E)||Ha(h.current,{select:!0}))},m=function(S){if(document.activeElement===document.body)for(const C of S)C.removedNodes.length>0&&Ha(a)};document.addEventListener("focusin",_),document.addEventListener("focusout",y);const w=new MutationObserver(m);return a&&w.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",y),w.disconnect()}}},[i,a,g.paused]),b.useEffect(()=>{if(a){vL.add(g);const _=document.activeElement;if(!a.contains(_)){const m=new CustomEvent(Qw,mL);a.addEventListener(Qw,c),a.dispatchEvent(m),m.defaultPrevented||(EQ(PQ(qU(a)),{select:!0}),document.activeElement===_&&Ha(a))}return()=>{a.removeEventListener(Qw,c),setTimeout(()=>{const m=new CustomEvent(Jw,mL);a.addEventListener(Jw,d),a.dispatchEvent(m),m.defaultPrevented||Ha(_??document.body,{select:!0}),a.removeEventListener(Jw,d),vL.remove(g)},0)}}},[a,c,d,g]);const v=b.useCallback(_=>{if(!n&&!i||g.paused)return;const y=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,m=document.activeElement;if(y&&m){const w=_.currentTarget,[S,E]=bQ(w);S&&E?!_.shiftKey&&m===E?(_.preventDefault(),n&&Ha(S,{select:!0})):_.shiftKey&&m===S&&(_.preventDefault(),n&&Ha(E,{select:!0})):m===w&&_.preventDefault()}},[n,i,g.paused]);return P.jsx(Tt.div,{tabIndex:-1,...o,ref:p,onKeyDown:v})});t_.displayName=MQ;function EQ(t,{select:e=!1}={}){const n=document.activeElement;for(const i of t)if(Ha(i,{select:e}),document.activeElement!==n)return}function bQ(t){const e=qU(t),n=gL(e,t),i=gL(e.reverse(),t);return[n,i]}function qU(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const r=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||r?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function gL(t,e){for(const n of t)if(!TQ(n,{upTo:e}))return n}function TQ(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function AQ(t){return t instanceof HTMLInputElement&&"select"in t}function Ha(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&AQ(t)&&e&&t.select()}}var vL=CQ();function CQ(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=yL(t,e),t.unshift(e)},remove(e){var n;t=yL(t,e),(n=t[0])==null||n.resume()}}}function yL(t,e){const n=[...t],i=n.indexOf(e);return i!==-1&&n.splice(i,1),n}function PQ(t){return t.filter(e=>e.tagName!=="A")}var qi=globalThis!=null&&globalThis.document?b.useLayoutEffect:()=>{},RQ=zW.useId||(()=>{}),IQ=0;function yl(t){const[e,n]=b.useState(RQ());return qi(()=>{n(i=>i??String(IQ++))},[t]),e?`radix-${e}`:""}const LQ=["top","right","bottom","left"],El=Math.min,Dr=Math.max,Ny=Math.round,m0=Math.floor,bl=t=>({x:t,y:t}),DQ={left:"right",right:"left",bottom:"top",top:"bottom"},NQ={start:"end",end:"start"};function mE(t,e,n){return Dr(t,El(e,n))}function va(t,e){return typeof t=="function"?t(e):t}function ya(t){return t.split("-")[0]}function jf(t){return t.split("-")[1]}function lA(t){return t==="x"?"y":"x"}function cA(t){return t==="y"?"height":"width"}function Tl(t){return["top","bottom"].includes(ya(t))?"y":"x"}function uA(t){return lA(Tl(t))}function OQ(t,e,n){n===void 0&&(n=!1);const i=jf(t),r=uA(t),s=cA(r);let o=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=Oy(o)),[o,Oy(o)]}function kQ(t){const e=Oy(t);return[gE(t),e,gE(e)]}function gE(t){return t.replace(/start|end/g,e=>NQ[e])}function FQ(t,e,n){const i=["left","right"],r=["right","left"],s=["top","bottom"],o=["bottom","top"];switch(t){case"top":case"bottom":return n?e?r:i:e?i:r;case"left":case"right":return e?s:o;default:return[]}}function UQ(t,e,n,i){const r=jf(t);let s=FQ(ya(t),n==="start",i);return r&&(s=s.map(o=>o+"-"+r),e&&(s=s.concat(s.map(gE)))),s}function Oy(t){return t.replace(/left|right|bottom|top/g,e=>DQ[e])}function zQ(t){return{top:0,right:0,bottom:0,left:0,...t}}function $U(t){return typeof t!="number"?zQ(t):{top:t,right:t,bottom:t,left:t}}function ky(t){const{x:e,y:n,width:i,height:r}=t;return{width:i,height:r,top:n,left:e,right:e+i,bottom:n+r,x:e,y:n}}function xL(t,e,n){let{reference:i,floating:r}=t;const s=Tl(e),o=uA(e),a=cA(o),l=ya(e),c=s==="y",d=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,p=i[a]/2-r[a]/2;let g;switch(l){case"top":g={x:d,y:i.y-r.height};break;case"bottom":g={x:d,y:i.y+i.height};break;case"right":g={x:i.x+i.width,y:h};break;case"left":g={x:i.x-r.width,y:h};break;default:g={x:i.x,y:i.y}}switch(jf(e)){case"start":g[o]-=p*(n&&c?-1:1);break;case"end":g[o]+=p*(n&&c?-1:1);break}return g}const BQ=async(t,e,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:t,floating:e,strategy:r}),{x:d,y:h}=xL(c,i,l),p=i,g={},v=0;for(let _=0;_({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:r,rects:s,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=va(t,e)||{};if(c==null)return{};const h=$U(d),p={x:n,y:i},g=uA(r),v=cA(g),_=await o.getDimensions(c),y=g==="y",m=y?"top":"left",w=y?"bottom":"right",S=y?"clientHeight":"clientWidth",E=s.reference[v]+s.reference[g]-p[g]-s.floating[v],C=p[g]-s.reference[g],R=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let I=R?R[S]:0;(!I||!await(o.isElement==null?void 0:o.isElement(R)))&&(I=a.floating[S]||s.floating[v]);const N=E/2-C/2,F=I/2-_[v]/2-1,A=El(h[m],F),D=El(h[w],F),j=A,K=I-_[v]-D,V=I/2-_[v]/2+N,Z=mE(j,V,K),Y=!l.arrow&&jf(r)!=null&&V!==Z&&s.reference[v]/2-(VV<=0)){var D,j;const V=(((D=s.flip)==null?void 0:D.index)||0)+1,Z=I[V];if(Z)return{data:{index:V,overflows:A},reset:{placement:Z}};let Y=(j=A.filter(J=>J.overflows[0]<=0).sort((J,k)=>J.overflows[1]-k.overflows[1])[0])==null?void 0:j.placement;if(!Y)switch(g){case"bestFit":{var K;const J=(K=A.filter(k=>{if(R){const W=Tl(k.placement);return W===w||W==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(W=>W>0).reduce((W,$)=>W+$,0)]).sort((k,W)=>k[1]-W[1])[0])==null?void 0:K[0];J&&(Y=J);break}case"initialPlacement":Y=a;break}if(r!==Y)return{reset:{placement:Y}}}return{}}}};function _L(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function SL(t){return LQ.some(e=>t[e]>=0)}const WQ=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:i="referenceHidden",...r}=va(t,e);switch(i){case"referenceHidden":{const s=await cm(e,{...r,elementContext:"reference"}),o=_L(s,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:SL(o)}}}case"escaped":{const s=await cm(e,{...r,altBoundary:!0}),o=_L(s,n.floating);return{data:{escapedOffsets:o,escaped:SL(o)}}}default:return{}}}}};async function GQ(t,e){const{placement:n,platform:i,elements:r}=t,s=await(i.isRTL==null?void 0:i.isRTL(r.floating)),o=ya(n),a=jf(n),l=Tl(n)==="y",c=["left","top"].includes(o)?-1:1,d=s&&l?-1:1,h=va(e,t);let{mainAxis:p,crossAxis:g,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*d,y:p*c}:{x:p*c,y:g*d}}const jQ=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:r,y:s,placement:o,middlewareData:a}=e,l=await GQ(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:r+l.x,y:s+l.y,data:{...l,placement:o}}}}},XQ=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:r}=e,{mainAxis:s=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:m,y:w}=y;return{x:m,y:w}}},...l}=va(t,e),c={x:n,y:i},d=await cm(e,l),h=Tl(ya(r)),p=lA(h);let g=c[p],v=c[h];if(s){const y=p==="y"?"top":"left",m=p==="y"?"bottom":"right",w=g+d[y],S=g-d[m];g=mE(w,g,S)}if(o){const y=h==="y"?"top":"left",m=h==="y"?"bottom":"right",w=v+d[y],S=v-d[m];v=mE(w,v,S)}const _=a.fn({...e,[p]:g,[h]:v});return{..._,data:{x:_.x-n,y:_.y-i,enabled:{[p]:s,[h]:o}}}}}},qQ=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:i,placement:r,rects:s,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=va(t,e),d={x:n,y:i},h=Tl(r),p=lA(h);let g=d[p],v=d[h];const _=va(a,e),y=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(l){const S=p==="y"?"height":"width",E=s.reference[p]-s.floating[S]+y.mainAxis,C=s.reference[p]+s.reference[S]-y.mainAxis;gC&&(g=C)}if(c){var m,w;const S=p==="y"?"width":"height",E=["top","left"].includes(ya(r)),C=s.reference[h]-s.floating[S]+(E&&((m=o.offset)==null?void 0:m[h])||0)+(E?0:y.crossAxis),R=s.reference[h]+s.reference[S]+(E?0:((w=o.offset)==null?void 0:w[h])||0)-(E?y.crossAxis:0);vR&&(v=R)}return{[p]:g,[h]:v}}}},$Q=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;const{placement:r,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...c}=va(t,e),d=await cm(e,c),h=ya(r),p=jf(r),g=Tl(r)==="y",{width:v,height:_}=s.floating;let y,m;h==="top"||h==="bottom"?(y=h,m=p===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(m=h,y=p==="end"?"top":"bottom");const w=_-d.top-d.bottom,S=v-d.left-d.right,E=El(_-d[y],w),C=El(v-d[m],S),R=!e.middlewareData.shift;let I=E,N=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(N=S),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(I=w),R&&!p){const A=Dr(d.left,0),D=Dr(d.right,0),j=Dr(d.top,0),K=Dr(d.bottom,0);g?N=v-2*(A!==0||D!==0?A+D:Dr(d.left,d.right)):I=_-2*(j!==0||K!==0?j+K:Dr(d.top,d.bottom))}await l({...e,availableWidth:N,availableHeight:I});const F=await o.getDimensions(a.floating);return v!==F.width||_!==F.height?{reset:{rects:!0}}:{}}}};function n_(){return typeof window<"u"}function Xf(t){return YU(t)?(t.nodeName||"").toLowerCase():"#document"}function zr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Co(t){var e;return(e=(YU(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function YU(t){return n_()?t instanceof Node||t instanceof zr(t).Node:!1}function Fs(t){return n_()?t instanceof Element||t instanceof zr(t).Element:!1}function wo(t){return n_()?t instanceof HTMLElement||t instanceof zr(t).HTMLElement:!1}function wL(t){return!n_()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof zr(t).ShadowRoot}function eg(t){const{overflow:e,overflowX:n,overflowY:i,display:r}=Us(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!["inline","contents"].includes(r)}function YQ(t){return["table","td","th"].includes(Xf(t))}function i_(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function dA(t){const e=fA(),n=Fs(t)?Us(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(i=>(n.willChange||"").includes(i))||["paint","layout","strict","content"].some(i=>(n.contain||"").includes(i))}function ZQ(t){let e=Al(t);for(;wo(e)&&!Sf(e);){if(dA(e))return e;if(i_(e))return null;e=Al(e)}return null}function fA(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Sf(t){return["html","body","#document"].includes(Xf(t))}function Us(t){return zr(t).getComputedStyle(t)}function r_(t){return Fs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Al(t){if(Xf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||wL(t)&&t.host||Co(t);return wL(e)?e.host:e}function ZU(t){const e=Al(t);return Sf(e)?t.ownerDocument?t.ownerDocument.body:t.body:wo(e)&&eg(e)?e:ZU(e)}function um(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const r=ZU(t),s=r===((i=t.ownerDocument)==null?void 0:i.body),o=zr(r);if(s){const a=vE(o);return e.concat(o,o.visualViewport||[],eg(r)?r:[],a&&n?um(a):[])}return e.concat(r,um(r,[],n))}function vE(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function KU(t){const e=Us(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=wo(t),s=r?t.offsetWidth:n,o=r?t.offsetHeight:i,a=Ny(n)!==s||Ny(i)!==o;return a&&(n=s,i=o),{width:n,height:i,$:a}}function hA(t){return Fs(t)?t:t.contextElement}function Hd(t){const e=hA(t);if(!wo(e))return bl(1);const n=e.getBoundingClientRect(),{width:i,height:r,$:s}=KU(e);let o=(s?Ny(n.width):n.width)/i,a=(s?Ny(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const KQ=bl(0);function QU(t){const e=zr(t);return!fA()||!e.visualViewport?KQ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function QQ(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==zr(t)?!1:e}function iu(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=t.getBoundingClientRect(),s=hA(t);let o=bl(1);e&&(i?Fs(i)&&(o=Hd(i)):o=Hd(t));const a=QQ(s,n,i)?QU(s):bl(0);let l=(r.left+a.x)/o.x,c=(r.top+a.y)/o.y,d=r.width/o.x,h=r.height/o.y;if(s){const p=zr(s),g=i&&Fs(i)?zr(i):i;let v=p,_=vE(v);for(;_&&i&&g!==v;){const y=Hd(_),m=_.getBoundingClientRect(),w=Us(_),S=m.left+(_.clientLeft+parseFloat(w.paddingLeft))*y.x,E=m.top+(_.clientTop+parseFloat(w.paddingTop))*y.y;l*=y.x,c*=y.y,d*=y.x,h*=y.y,l+=S,c+=E,v=zr(_),_=vE(v)}}return ky({width:d,height:h,x:l,y:c})}function JQ(t){let{elements:e,rect:n,offsetParent:i,strategy:r}=t;const s=r==="fixed",o=Co(i),a=e?i_(e.floating):!1;if(i===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=bl(1);const d=bl(0),h=wo(i);if((h||!h&&!s)&&((Xf(i)!=="body"||eg(o))&&(l=r_(i)),wo(i))){const p=iu(i);c=Hd(i),d.x=p.x+i.clientLeft,d.y=p.y+i.clientTop}return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+d.x,y:n.y*c.y-l.scrollTop*c.y+d.y}}function eJ(t){return Array.from(t.getClientRects())}function yE(t,e){const n=r_(t).scrollLeft;return e?e.left+n:iu(Co(t)).left+n}function tJ(t){const e=Co(t),n=r_(t),i=t.ownerDocument.body,r=Dr(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),s=Dr(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let o=-n.scrollLeft+yE(t);const a=-n.scrollTop;return Us(i).direction==="rtl"&&(o+=Dr(e.clientWidth,i.clientWidth)-r),{width:r,height:s,x:o,y:a}}function nJ(t,e){const n=zr(t),i=Co(t),r=n.visualViewport;let s=i.clientWidth,o=i.clientHeight,a=0,l=0;if(r){s=r.width,o=r.height;const c=fA();(!c||c&&e==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:s,height:o,x:a,y:l}}function iJ(t,e){const n=iu(t,!0,e==="fixed"),i=n.top+t.clientTop,r=n.left+t.clientLeft,s=wo(t)?Hd(t):bl(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=r*s.x,c=i*s.y;return{width:o,height:a,x:l,y:c}}function ML(t,e,n){let i;if(e==="viewport")i=nJ(t,n);else if(e==="document")i=tJ(Co(t));else if(Fs(e))i=iJ(e,n);else{const r=QU(t);i={...e,x:e.x-r.x,y:e.y-r.y}}return ky(i)}function JU(t,e){const n=Al(t);return n===e||!Fs(n)||Sf(n)?!1:Us(n).position==="fixed"||JU(n,e)}function rJ(t,e){const n=e.get(t);if(n)return n;let i=um(t,[],!1).filter(a=>Fs(a)&&Xf(a)!=="body"),r=null;const s=Us(t).position==="fixed";let o=s?Al(t):t;for(;Fs(o)&&!Sf(o);){const a=Us(o),l=dA(o);!l&&a.position==="fixed"&&(r=null),(s?!l&&!r:!l&&a.position==="static"&&!!r&&["absolute","fixed"].includes(r.position)||eg(o)&&!l&&JU(t,o))?i=i.filter(d=>d!==o):r=a,o=Al(o)}return e.set(t,i),i}function sJ(t){let{element:e,boundary:n,rootBoundary:i,strategy:r}=t;const o=[...n==="clippingAncestors"?i_(e)?[]:rJ(e,this._c):[].concat(n),i],a=o[0],l=o.reduce((c,d)=>{const h=ML(e,d,r);return c.top=Dr(h.top,c.top),c.right=El(h.right,c.right),c.bottom=El(h.bottom,c.bottom),c.left=Dr(h.left,c.left),c},ML(e,a,r));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function oJ(t){const{width:e,height:n}=KU(t);return{width:e,height:n}}function aJ(t,e,n){const i=wo(e),r=Co(e),s=n==="fixed",o=iu(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=bl(0);if(i||!i&&!s)if((Xf(e)!=="body"||eg(r))&&(a=r_(e)),i){const g=iu(e,!0,s,e);l.x=g.x+e.clientLeft,l.y=g.y+e.clientTop}else r&&(l.x=yE(r));let c=0,d=0;if(r&&!i&&!s){const g=r.getBoundingClientRect();d=g.top+a.scrollTop,c=g.left+a.scrollLeft-yE(r,g)}const h=o.left+a.scrollLeft-l.x-c,p=o.top+a.scrollTop-l.y-d;return{x:h,y:p,width:o.width,height:o.height}}function e1(t){return Us(t).position==="static"}function EL(t,e){if(!wo(t)||Us(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Co(t)===n&&(n=n.ownerDocument.body),n}function ez(t,e){const n=zr(t);if(i_(t))return n;if(!wo(t)){let r=Al(t);for(;r&&!Sf(r);){if(Fs(r)&&!e1(r))return r;r=Al(r)}return n}let i=EL(t,e);for(;i&&YQ(i)&&e1(i);)i=EL(i,e);return i&&Sf(i)&&e1(i)&&!dA(i)?n:i||ZQ(t)||n}const lJ=async function(t){const e=this.getOffsetParent||ez,n=this.getDimensions,i=await n(t.floating);return{reference:aJ(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function cJ(t){return Us(t).direction==="rtl"}const uJ={convertOffsetParentRelativeRectToViewportRelativeRect:JQ,getDocumentElement:Co,getClippingRect:sJ,getOffsetParent:ez,getElementRects:lJ,getClientRects:eJ,getDimensions:oJ,getScale:Hd,isElement:Fs,isRTL:cJ};function dJ(t,e){let n=null,i;const r=Co(t);function s(){var a;clearTimeout(i),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const{left:c,top:d,width:h,height:p}=t.getBoundingClientRect();if(a||e(),!h||!p)return;const g=m0(d),v=m0(r.clientWidth-(c+h)),_=m0(r.clientHeight-(d+p)),y=m0(c),w={rootMargin:-g+"px "+-v+"px "+-_+"px "+-y+"px",threshold:Dr(0,El(1,l))||1};let S=!0;function E(C){const R=C[0].intersectionRatio;if(R!==l){if(!S)return o();R?o(!1,R):i=setTimeout(()=>{o(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(E,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(E,w)}n.observe(t)}return o(!0),s}function fJ(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,c=hA(t),d=r||s?[...c?um(c):[],...um(e)]:[];d.forEach(m=>{r&&m.addEventListener("scroll",n,{passive:!0}),s&&m.addEventListener("resize",n)});const h=c&&a?dJ(c,n):null;let p=-1,g=null;o&&(g=new ResizeObserver(m=>{let[w]=m;w&&w.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(e)})),n()}),c&&!l&&g.observe(c),g.observe(e));let v,_=l?iu(t):null;l&&y();function y(){const m=iu(t);_&&(m.x!==_.x||m.y!==_.y||m.width!==_.width||m.height!==_.height)&&n(),_=m,v=requestAnimationFrame(y)}return n(),()=>{var m;d.forEach(w=>{r&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),h==null||h(),(m=g)==null||m.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const hJ=jQ,pJ=XQ,mJ=HQ,gJ=$Q,vJ=WQ,bL=VQ,yJ=qQ,xJ=(t,e,n)=>{const i=new Map,r={platform:uJ,...n},s={...r.platform,_c:i};return BQ(t,e,{...r,platform:s})};var Y0=typeof document<"u"?b.useLayoutEffect:b.useEffect;function Fy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,r;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!Fy(t[i],e[i]))return!1;return!0}if(r=Object.keys(t),n=r.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=n;i--!==0;){const s=r[i];if(!(s==="_owner"&&t.$$typeof)&&!Fy(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function tz(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function TL(t,e){const n=tz(t);return Math.round(e*n)/n}function t1(t){const e=b.useRef(t);return Y0(()=>{e.current=t}),e}function _J(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=t,[d,h]=b.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[p,g]=b.useState(i);Fy(p,i)||g(i);const[v,_]=b.useState(null),[y,m]=b.useState(null),w=b.useCallback(k=>{k!==R.current&&(R.current=k,_(k))},[]),S=b.useCallback(k=>{k!==I.current&&(I.current=k,m(k))},[]),E=s||v,C=o||y,R=b.useRef(null),I=b.useRef(null),N=b.useRef(d),F=l!=null,A=t1(l),D=t1(r),j=t1(c),K=b.useCallback(()=>{if(!R.current||!I.current)return;const k={placement:e,strategy:n,middleware:p};D.current&&(k.platform=D.current),xJ(R.current,I.current,k).then(W=>{const $={...W,isPositioned:j.current!==!1};V.current&&!Fy(N.current,$)&&(N.current=$,Gf.flushSync(()=>{h($)}))})},[p,e,n,D,j]);Y0(()=>{c===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,h(k=>({...k,isPositioned:!1})))},[c]);const V=b.useRef(!1);Y0(()=>(V.current=!0,()=>{V.current=!1}),[]),Y0(()=>{if(E&&(R.current=E),C&&(I.current=C),E&&C){if(A.current)return A.current(E,C,K);K()}},[E,C,K,A,F]);const Z=b.useMemo(()=>({reference:R,floating:I,setReference:w,setFloating:S}),[w,S]),Y=b.useMemo(()=>({reference:E,floating:C}),[E,C]),J=b.useMemo(()=>{const k={position:n,left:0,top:0};if(!Y.floating)return k;const W=TL(Y.floating,d.x),$=TL(Y.floating,d.y);return a?{...k,transform:"translate("+W+"px, "+$+"px)",...tz(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:$}},[n,a,Y.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:K,refs:Z,elements:Y,floatingStyles:J}),[d,K,Z,Y,J])}const SJ=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:i,padding:r}=typeof t=="function"?t(n):t;return i&&e(i)?i.current!=null?bL({element:i.current,padding:r}).fn(n):{}:i?bL({element:i,padding:r}).fn(n):{}}}},wJ=(t,e)=>({...hJ(t),options:[t,e]}),MJ=(t,e)=>({...pJ(t),options:[t,e]}),EJ=(t,e)=>({...yJ(t),options:[t,e]}),bJ=(t,e)=>({...mJ(t),options:[t,e]}),TJ=(t,e)=>({...gJ(t),options:[t,e]}),AJ=(t,e)=>({...vJ(t),options:[t,e]}),CJ=(t,e)=>({...SJ(t),options:[t,e]});var PJ="Arrow",nz=b.forwardRef((t,e)=>{const{children:n,width:i=10,height:r=5,...s}=t;return P.jsx(Tt.svg,{...s,ref:e,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:P.jsx("polygon",{points:"0,0 30,0 15,10"})})});nz.displayName=PJ;var RJ=nz;function pA(t,e=[]){let n=[];function i(s,o){const a=b.createContext(o),l=n.length;n=[...n,o];function c(h){const{scope:p,children:g,...v}=h,_=(p==null?void 0:p[t][l])||a,y=b.useMemo(()=>v,Object.values(v));return P.jsx(_.Provider,{value:y,children:g})}function d(h,p){const g=(p==null?void 0:p[t][l])||a,v=b.useContext(g);if(v)return v;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,d]}const r=()=>{const s=n.map(o=>b.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return b.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return r.scopeName=t,[i,IJ(r,...e)]}function IJ(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const i=t.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(s){const o=i.reduce((a,{useScope:l,scopeName:c})=>{const h=l(s)[`__scope${c}`];return{...a,...h}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function mA(t){const[e,n]=b.useState(void 0);return qi(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const s=r[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=t.offsetWidth,a=t.offsetHeight;n({width:o,height:a})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else n(void 0)},[t]),e}var gA="Popper",[iz,s_]=pA(gA),[LJ,rz]=iz(gA),sz=t=>{const{__scopePopper:e,children:n}=t,[i,r]=b.useState(null);return P.jsx(LJ,{scope:e,anchor:i,onAnchorChange:r,children:n})};sz.displayName=gA;var oz="PopperAnchor",az=b.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:i,...r}=t,s=rz(oz,n),o=b.useRef(null),a=$t(e,o);return b.useEffect(()=>{s.onAnchorChange((i==null?void 0:i.current)||o.current)}),i?null:P.jsx(Tt.div,{...r,ref:a})});az.displayName=oz;var vA="PopperContent",[DJ,NJ]=iz(vA),lz=b.forwardRef((t,e)=>{var me,Re,Le,Ce,Ae,H;const{__scopePopper:n,side:i="bottom",sideOffset:r=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:d=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:v,..._}=t,y=rz(vA,n),[m,w]=b.useState(null),S=$t(e,xe=>w(xe)),[E,C]=b.useState(null),R=mA(E),I=(R==null?void 0:R.width)??0,N=(R==null?void 0:R.height)??0,F=i+(s!=="center"?"-"+s:""),A=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},D=Array.isArray(c)?c:[c],j=D.length>0,K={padding:A,boundary:D.filter(kJ),altBoundary:j},{refs:V,floatingStyles:Z,placement:Y,isPositioned:J,middlewareData:k}=_J({strategy:"fixed",placement:F,whileElementsMounted:(...xe)=>fJ(...xe,{animationFrame:g==="always"}),elements:{reference:y.anchor},middleware:[wJ({mainAxis:r+N,alignmentAxis:o}),l&&MJ({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?EJ():void 0,...K}),l&&bJ({...K}),TJ({...K,apply:({elements:xe,rects:fe,availableWidth:Te,availableHeight:ge})=>{const{width:qe,height:Fe}=fe.reference,U=xe.floating.style;U.setProperty("--radix-popper-available-width",`${Te}px`),U.setProperty("--radix-popper-available-height",`${ge}px`),U.setProperty("--radix-popper-anchor-width",`${qe}px`),U.setProperty("--radix-popper-anchor-height",`${Fe}px`)}}),E&&CJ({element:E,padding:a}),FJ({arrowWidth:I,arrowHeight:N}),p&&AJ({strategy:"referenceHidden",...K})]}),[W,$]=dz(Y),Q=bi(v);qi(()=>{J&&(Q==null||Q())},[J,Q]);const de=(me=k.arrow)==null?void 0:me.x,be=(Re=k.arrow)==null?void 0:Re.y,ie=((Le=k.arrow)==null?void 0:Le.centerOffset)!==0,[he,Ee]=b.useState();return qi(()=>{m&&Ee(window.getComputedStyle(m).zIndex)},[m]),P.jsx("div",{ref:V.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:J?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(Ce=k.transformOrigin)==null?void 0:Ce.x,(Ae=k.transformOrigin)==null?void 0:Ae.y].join(" "),...((H=k.hide)==null?void 0:H.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:P.jsx(DJ,{scope:n,placedSide:W,onArrowChange:C,arrowX:de,arrowY:be,shouldHideArrow:ie,children:P.jsx(Tt.div,{"data-side":W,"data-align":$,..._,ref:S,style:{..._.style,animation:J?void 0:"none"}})})})});lz.displayName=vA;var cz="PopperArrow",OJ={top:"bottom",right:"left",bottom:"top",left:"right"},uz=b.forwardRef(function(e,n){const{__scopePopper:i,...r}=e,s=NJ(cz,i),o=OJ[s.placedSide];return P.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:P.jsx(RJ,{...r,ref:n,style:{...r.style,display:"block"}})})});uz.displayName=cz;function kJ(t){return t!==null}var FJ=t=>({name:"transformOrigin",options:t,fn(e){var y,m,w;const{placement:n,rects:i,middlewareData:r}=e,o=((y=r.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:t.arrowWidth,l=o?0:t.arrowHeight,[c,d]=dz(n),h={start:"0%",center:"50%",end:"100%"}[d],p=(((m=r.arrow)==null?void 0:m.x)??0)+a/2,g=(((w=r.arrow)==null?void 0:w.y)??0)+l/2;let v="",_="";return c==="bottom"?(v=o?h:`${p}px`,_=`${-l}px`):c==="top"?(v=o?h:`${p}px`,_=`${i.floating.height+l}px`):c==="right"?(v=`${-l}px`,_=o?h:`${g}px`):c==="left"&&(v=`${i.floating.width+l}px`,_=o?h:`${g}px`),{data:{x:v,y:_}}}});function dz(t){const[e,n="center"]=t.split("-");return[e,n]}var UJ=sz,yA=az,fz=lz,hz=uz,zJ="Portal",o_=b.forwardRef((t,e)=>{var a;const{container:n,...i}=t,[r,s]=b.useState(!1);qi(()=>s(!0),[]);const o=n||r&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?nQ.createPortal(P.jsx(Tt.div,{...i,ref:e}),o):null});o_.displayName=zJ;function BJ(t,e){return b.useReducer((n,i)=>e[n][i]??n,t)}var Hs=t=>{const{present:e,children:n}=t,i=VJ(e),r=typeof n=="function"?n({present:i.isPresent}):b.Children.only(n),s=$t(i.ref,HJ(r));return typeof n=="function"||i.isPresent?b.cloneElement(r,{ref:s}):null};Hs.displayName="Presence";function VJ(t){const[e,n]=b.useState(),i=b.useRef({}),r=b.useRef(t),s=b.useRef("none"),o=t?"mounted":"unmounted",[a,l]=BJ(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return b.useEffect(()=>{const c=g0(i.current);s.current=a==="mounted"?c:"none"},[a]),qi(()=>{const c=i.current,d=r.current;if(d!==t){const p=s.current,g=g0(c);t?l("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&p!==g?"ANIMATION_OUT":"UNMOUNT"),r.current=t}},[t,l]),qi(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,h=g=>{const _=g0(i.current).includes(g.animationName);if(g.target===e&&_&&(l("ANIMATION_END"),!r.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},p=g=>{g.target===e&&(s.current=g0(i.current))};return e.addEventListener("animationstart",p),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",p),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:b.useCallback(c=>{c&&(i.current=getComputedStyle(c)),n(c)},[])}}function g0(t){return(t==null?void 0:t.animationName)||"none"}function HJ(t){var i,r;let e=(i=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(r=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function ru({prop:t,defaultProp:e,onChange:n=()=>{}}){const[i,r]=WJ({defaultProp:e,onChange:n}),s=t!==void 0,o=s?t:i,a=bi(n),l=b.useCallback(c=>{if(s){const h=typeof c=="function"?c(t):c;h!==t&&a(h)}else r(c)},[s,t,r,a]);return[o,l]}function WJ({defaultProp:t,onChange:e}){const n=b.useState(t),[i]=n,r=b.useRef(i),s=bi(e);return b.useEffect(()=>{r.current!==i&&(s(i),r.current=i)},[i,r,s]),n}var GJ=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},nd=new WeakMap,v0=new WeakMap,y0={},n1=0,pz=function(t){return t&&(t.host||pz(t.parentNode))},jJ=function(t,e){return e.map(function(n){if(t.contains(n))return n;var i=pz(n);return i&&t.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},XJ=function(t,e,n,i){var r=jJ(e,Array.isArray(t)?t:[t]);y0[n]||(y0[n]=new WeakMap);var s=y0[n],o=[],a=new Set,l=new Set(r),c=function(h){!h||a.has(h)||(a.add(h),c(h.parentNode))};r.forEach(c);var d=function(h){!h||l.has(h)||Array.prototype.forEach.call(h.children,function(p){if(a.has(p))d(p);else try{var g=p.getAttribute(i),v=g!==null&&g!=="false",_=(nd.get(p)||0)+1,y=(s.get(p)||0)+1;nd.set(p,_),s.set(p,y),o.push(p),_===1&&v&&v0.set(p,!0),y===1&&p.setAttribute(n,"true"),v||p.setAttribute(i,"true")}catch(m){console.error("aria-hidden: cannot operate on ",p,m)}})};return d(e),a.clear(),n1++,function(){o.forEach(function(h){var p=nd.get(h)-1,g=s.get(h)-1;nd.set(h,p),s.set(h,g),p||(v0.has(h)||h.removeAttribute(i),v0.delete(h)),g||h.removeAttribute(n)}),n1--,n1||(nd=new WeakMap,nd=new WeakMap,v0=new WeakMap,y0={})}},xA=function(t,e,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(t)?t:[t]),r=GJ(t);return r?(i.push.apply(i,Array.from(r.querySelectorAll("[aria-live]"))),XJ(i,r,n,"aria-hidden")):function(){return null}},lo=function(){return lo=Object.assign||function(e){for(var n,i=1,r=arguments.length;i"u")return cee;var e=uee(t),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,i-n+e[2]-e[0])}},fee=yz(),Wd="data-scroll-locked",hee=function(t,e,n,i){var r=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),` + .`.concat($J,` { + overflow: hidden `).concat(i,`; + padding-right: `).concat(a,"px ").concat(i,`; + } + body[`).concat(Wd,`] { + overflow: hidden `).concat(i,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(i,";"),n==="margin"&&` + padding-left: `.concat(r,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(a,"px ").concat(i,`; + `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(i,";")].filter(Boolean).join(""),` + } + + .`).concat(Z0,` { + right: `).concat(a,"px ").concat(i,`; + } + + .`).concat(K0,` { + margin-right: `).concat(a,"px ").concat(i,`; + } + + .`).concat(Z0," .").concat(Z0,` { + right: 0 `).concat(i,`; + } + + .`).concat(K0," .").concat(K0,` { + margin-right: 0 `).concat(i,`; + } + + body[`).concat(Wd,`] { + `).concat(YJ,": ").concat(a,`px; + } +`)},CL=function(){var t=parseInt(document.body.getAttribute(Wd)||"0",10);return isFinite(t)?t:0},pee=function(){b.useEffect(function(){return document.body.setAttribute(Wd,(CL()+1).toString()),function(){var t=CL()-1;t<=0?document.body.removeAttribute(Wd):document.body.setAttribute(Wd,t.toString())}},[])},mee=function(t){var e=t.noRelative,n=t.noImportant,i=t.gapMode,r=i===void 0?"margin":i;pee();var s=b.useMemo(function(){return dee(r)},[r]);return b.createElement(fee,{styles:hee(s,!e,r,n?"":"!important")})},xE=!1;if(typeof window<"u")try{var x0=Object.defineProperty({},"passive",{get:function(){return xE=!0,!0}});window.addEventListener("test",x0,x0),window.removeEventListener("test",x0,x0)}catch{xE=!1}var id=xE?{passive:!1}:!1,gee=function(t){return t.tagName==="TEXTAREA"},xz=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!gee(t)&&n[e]==="visible")},vee=function(t){return xz(t,"overflowY")},yee=function(t){return xz(t,"overflowX")},PL=function(t,e){var n=e.ownerDocument,i=e;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var r=_z(t,i);if(r){var s=Sz(t,i),o=s[1],a=s[2];if(o>a)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},xee=function(t){var e=t.scrollTop,n=t.scrollHeight,i=t.clientHeight;return[e,n,i]},_ee=function(t){var e=t.scrollLeft,n=t.scrollWidth,i=t.clientWidth;return[e,n,i]},_z=function(t,e){return t==="v"?vee(e):yee(e)},Sz=function(t,e){return t==="v"?xee(e):_ee(e)},See=function(t,e){return t==="h"&&e==="rtl"?-1:1},wee=function(t,e,n,i,r){var s=See(t,window.getComputedStyle(e).direction),o=s*i,a=n.target,l=e.contains(a),c=!1,d=o>0,h=0,p=0;do{var g=Sz(t,a),v=g[0],_=g[1],y=g[2],m=_-y-s*v;(v||m)&&_z(t,a)&&(h+=m,p+=v),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&(Math.abs(h)<1||!r)||!d&&(Math.abs(p)<1||!r))&&(c=!0),c},_0=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},RL=function(t){return[t.deltaX,t.deltaY]},IL=function(t){return t&&"current"in t?t.current:t},Mee=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Eee=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},bee=0,rd=[];function Tee(t){var e=b.useRef([]),n=b.useRef([0,0]),i=b.useRef(),r=b.useState(bee++)[0],s=b.useState(yz)[0],o=b.useRef(t);b.useEffect(function(){o.current=t},[t]),b.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(r));var _=qJ([t.lockRef.current],(t.shards||[]).map(IL),!0).filter(Boolean);return _.forEach(function(y){return y.classList.add("allow-interactivity-".concat(r))}),function(){document.body.classList.remove("block-interactivity-".concat(r)),_.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(r))})}}},[t.inert,t.lockRef.current,t.shards]);var a=b.useCallback(function(_,y){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!o.current.allowPinchZoom;var m=_0(_),w=n.current,S="deltaX"in _?_.deltaX:w[0]-m[0],E="deltaY"in _?_.deltaY:w[1]-m[1],C,R=_.target,I=Math.abs(S)>Math.abs(E)?"h":"v";if("touches"in _&&I==="h"&&R.type==="range")return!1;var N=PL(I,R);if(!N)return!0;if(N?C=I:(C=I==="v"?"h":"v",N=PL(I,R)),!N)return!1;if(!i.current&&"changedTouches"in _&&(S||E)&&(i.current=C),!C)return!0;var F=i.current||C;return wee(F,y,_,F==="h"?S:E,!0)},[]),l=b.useCallback(function(_){var y=_;if(!(!rd.length||rd[rd.length-1]!==s)){var m="deltaY"in y?RL(y):_0(y),w=e.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&Mee(C.delta,m)})[0];if(w&&w.should){y.cancelable&&y.preventDefault();return}if(!w){var S=(o.current.shards||[]).map(IL).filter(Boolean).filter(function(C){return C.contains(y.target)}),E=S.length>0?a(y,S[0]):!o.current.noIsolation;E&&y.cancelable&&y.preventDefault()}}},[]),c=b.useCallback(function(_,y,m,w){var S={name:_,delta:y,target:m,should:w,shadowParent:Aee(m)};e.current.push(S),setTimeout(function(){e.current=e.current.filter(function(E){return E!==S})},1)},[]),d=b.useCallback(function(_){n.current=_0(_),i.current=void 0},[]),h=b.useCallback(function(_){c(_.type,RL(_),_.target,a(_,t.lockRef.current))},[]),p=b.useCallback(function(_){c(_.type,_0(_),_.target,a(_,t.lockRef.current))},[]);b.useEffect(function(){return rd.push(s),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:p}),document.addEventListener("wheel",l,id),document.addEventListener("touchmove",l,id),document.addEventListener("touchstart",d,id),function(){rd=rd.filter(function(_){return _!==s}),document.removeEventListener("wheel",l,id),document.removeEventListener("touchmove",l,id),document.removeEventListener("touchstart",d,id)}},[]);var g=t.removeScrollBar,v=t.inert;return b.createElement(b.Fragment,null,v?b.createElement(s,{styles:Eee(r)}):null,g?b.createElement(mee,{gapMode:t.gapMode}):null)}function Aee(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Cee=nee(vz,Tee);var l_=b.forwardRef(function(t,e){return b.createElement(a_,lo({},t,{ref:e,sideCar:Cee}))});l_.classNames=a_.classNames;var wz="Popover",[Mz,Hde]=gu(wz,[s_]),c_=s_(),[Wde,Vl]=Mz(wz),Ez="PopoverAnchor",Pee=b.forwardRef((t,e)=>{const{__scopePopover:n,...i}=t,r=Vl(Ez,n),s=c_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=r;return b.useEffect(()=>(o(),()=>a()),[o,a]),P.jsx(yA,{...s,...i,ref:e})});Pee.displayName=Ez;var bz="PopoverTrigger",Ree=b.forwardRef((t,e)=>{const{__scopePopover:n,...i}=t,r=Vl(bz,n),s=c_(n),o=$t(e,r.triggerRef),a=P.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":Rz(r.open),...i,ref:o,onClick:ht(t.onClick,r.onOpenToggle)});return r.hasCustomAnchor?a:P.jsx(yA,{asChild:!0,...s,children:a})});Ree.displayName=bz;var _A="PopoverPortal",[Iee,Lee]=Mz(_A,{forceMount:void 0}),Tz=t=>{const{__scopePopover:e,forceMount:n,children:i,container:r}=t,s=Vl(_A,e);return P.jsx(Iee,{scope:e,forceMount:n,children:P.jsx(Hs,{present:n||s.open,children:P.jsx(o_,{asChild:!0,container:r,children:i})})})};Tz.displayName=_A;var wf="PopoverContent",Az=b.forwardRef((t,e)=>{const n=Lee(wf,t.__scopePopover),{forceMount:i=n.forceMount,...r}=t,s=Vl(wf,t.__scopePopover);return P.jsx(Hs,{present:i||s.open,children:s.modal?P.jsx(Dee,{...r,ref:e}):P.jsx(Nee,{...r,ref:e})})});Az.displayName=wf;var Dee=b.forwardRef((t,e)=>{const n=Vl(wf,t.__scopePopover),i=b.useRef(null),r=$t(e,i),s=b.useRef(!1);return b.useEffect(()=>{const o=i.current;if(o)return xA(o)},[]),P.jsx(l_,{as:Ml,allowPinchZoom:!0,children:P.jsx(Cz,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ht(t.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ht(t.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ht(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Nee=b.forwardRef((t,e)=>{const n=Vl(wf,t.__scopePopover),i=b.useRef(!1),r=b.useRef(!1);return P.jsx(Cz,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(i.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),i.current=!1,r.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(i.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),Cz=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:d,...h}=t,p=Vl(wf,n),g=c_(n);return aA(),P.jsx(t_,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:s,children:P.jsx(e_,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:P.jsx(fz,{"data-state":Rz(p.open),role:"dialog",id:p.contentId,...g,...h,ref:e,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Pz="PopoverClose",Oee=b.forwardRef((t,e)=>{const{__scopePopover:n,...i}=t,r=Vl(Pz,n);return P.jsx(Tt.button,{type:"button",...i,ref:e,onClick:ht(t.onClick,()=>r.onOpenChange(!1))})});Oee.displayName=Pz;var kee="PopoverArrow",Fee=b.forwardRef((t,e)=>{const{__scopePopover:n,...i}=t,r=c_(n);return P.jsx(hz,{...r,...i,ref:e})});Fee.displayName=kee;function Rz(t){return t?"open":"closed"}var Uee=Tz,Iz=Az;const zee=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...i},r)=>P.jsx(Uee,{children:P.jsx(Iz,{ref:r,align:e,sideOffset:n,className:qt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none",t),...i})}));zee.displayName=Iz.displayName;const Pc=({label:t,value:e,className:n,...i})=>P.jsxs("div",{className:qt("flex w-full items-center justify-between",n),...i,children:[P.jsx(oa,{children:t}),P.jsx("span",{className:"w-12 px-2 py-0.5 text-right text-sm text-muted-foreground",children:e})]}),Bee=oA("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),SA=b.forwardRef(({className:t,variant:e,size:n,asChild:i=!1,...r},s)=>{const o=i?Ml:"button";return P.jsx(o,{className:qt(Bee({variant:e,size:n,className:t})),ref:s,...r})});SA.displayName="Button";function dm(t,[e,n]){return Math.min(n,Math.max(e,t))}var Vee=b.createContext(void 0);function tg(t){const e=b.useContext(Vee);return t||e||"ltr"}function wA(t){const e=b.useRef({value:t,previous:t});return b.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function MA(t){const e=t+"CollectionProvider",[n,i]=pA(e),[r,s]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:v,children:_}=g,y=Xo.useRef(null),m=Xo.useRef(new Map).current;return P.jsx(r,{scope:v,itemMap:m,collectionRef:y,children:_})};o.displayName=e;const a=t+"CollectionSlot",l=Xo.forwardRef((g,v)=>{const{scope:_,children:y}=g,m=s(a,_),w=$t(v,m.collectionRef);return P.jsx(Ml,{ref:w,children:y})});l.displayName=a;const c=t+"CollectionItemSlot",d="data-radix-collection-item",h=Xo.forwardRef((g,v)=>{const{scope:_,children:y,...m}=g,w=Xo.useRef(null),S=$t(v,w),E=s(c,_);return Xo.useEffect(()=>(E.itemMap.set(w,{ref:w,...m}),()=>void E.itemMap.delete(w))),P.jsx(Ml,{[d]:"",ref:S,children:y})});h.displayName=c;function p(g){const v=s(t+"CollectionConsumer",g);return Xo.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const m=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((E,C)=>m.indexOf(E.ref.current)-m.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:l,ItemSlot:h},p,i]}var Lz=["PageUp","PageDown"],Dz=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Nz={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},qf="Slider",[_E,Hee,Wee]=MA(qf),[Oz,Gde]=gu(qf,[Wee]),[Gee,u_]=Oz(qf),kz=b.forwardRef((t,e)=>{const{name:n,min:i=0,max:r=100,step:s=1,orientation:o="horizontal",disabled:a=!1,minStepsBetweenThumbs:l=0,defaultValue:c=[i],value:d,onValueChange:h=()=>{},onValueCommit:p=()=>{},inverted:g=!1,form:v,..._}=t,y=b.useRef(new Set),m=b.useRef(0),S=o==="horizontal"?jee:Xee,[E=[],C]=ru({prop:d,defaultProp:c,onChange:D=>{var K;(K=[...y.current][m.current])==null||K.focus(),h(D)}}),R=b.useRef(E);function I(D){const j=Kee(E,D);A(D,j)}function N(D){A(D,m.current)}function F(){const D=R.current[m.current];E[m.current]!==D&&p(E)}function A(D,j,{commit:K}={commit:!1}){const V=tte(s),Z=nte(Math.round((D-i)/s)*s+i,V),Y=dm(Z,[i,r]);C((J=[])=>{const k=Yee(J,Y,j);if(ete(k,l*s)){m.current=k.indexOf(Y);const W=String(k)!==String(J);return W&&K&&p(k),W?k:J}else return J})}return P.jsx(Gee,{scope:t.__scopeSlider,name:n,disabled:a,min:i,max:r,valueIndexToChangeRef:m,thumbs:y.current,values:E,orientation:o,form:v,children:P.jsx(_E.Provider,{scope:t.__scopeSlider,children:P.jsx(_E.Slot,{scope:t.__scopeSlider,children:P.jsx(S,{"aria-disabled":a,"data-disabled":a?"":void 0,..._,ref:e,onPointerDown:ht(_.onPointerDown,()=>{a||(R.current=E)}),min:i,max:r,inverted:g,onSlideStart:a?void 0:I,onSlideMove:a?void 0:N,onSlideEnd:a?void 0:F,onHomeKeyDown:()=>!a&&A(i,0,{commit:!0}),onEndKeyDown:()=>!a&&A(r,E.length-1,{commit:!0}),onStepKeyDown:({event:D,direction:j})=>{if(!a){const Z=Lz.includes(D.key)||D.shiftKey&&Dz.includes(D.key)?10:1,Y=m.current,J=E[Y],k=s*Z*j;A(J+k,Y,{commit:!0})}}})})})})});kz.displayName=qf;var[Fz,Uz]=Oz(qf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),jee=b.forwardRef((t,e)=>{const{min:n,max:i,dir:r,inverted:s,onSlideStart:o,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...d}=t,[h,p]=b.useState(null),g=$t(e,S=>p(S)),v=b.useRef(),_=tg(r),y=_==="ltr",m=y&&!s||!y&&s;function w(S){const E=v.current||h.getBoundingClientRect(),C=[0,E.width],I=EA(C,m?[n,i]:[i,n]);return v.current=E,I(S-E.left)}return P.jsx(Fz,{scope:t.__scopeSlider,startEdge:m?"left":"right",endEdge:m?"right":"left",direction:m?1:-1,size:"width",children:P.jsx(zz,{dir:_,"data-orientation":"horizontal",...d,ref:g,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:S=>{const E=w(S.clientX);o==null||o(E)},onSlideMove:S=>{const E=w(S.clientX);a==null||a(E)},onSlideEnd:()=>{v.current=void 0,l==null||l()},onStepKeyDown:S=>{const C=Nz[m?"from-left":"from-right"].includes(S.key);c==null||c({event:S,direction:C?-1:1})}})})}),Xee=b.forwardRef((t,e)=>{const{min:n,max:i,inverted:r,onSlideStart:s,onSlideMove:o,onSlideEnd:a,onStepKeyDown:l,...c}=t,d=b.useRef(null),h=$t(e,d),p=b.useRef(),g=!r;function v(_){const y=p.current||d.current.getBoundingClientRect(),m=[0,y.height],S=EA(m,g?[i,n]:[n,i]);return p.current=y,S(_-y.top)}return P.jsx(Fz,{scope:t.__scopeSlider,startEdge:g?"bottom":"top",endEdge:g?"top":"bottom",size:"height",direction:g?1:-1,children:P.jsx(zz,{"data-orientation":"vertical",...c,ref:h,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:_=>{const y=v(_.clientY);s==null||s(y)},onSlideMove:_=>{const y=v(_.clientY);o==null||o(y)},onSlideEnd:()=>{p.current=void 0,a==null||a()},onStepKeyDown:_=>{const m=Nz[g?"from-bottom":"from-top"].includes(_.key);l==null||l({event:_,direction:m?-1:1})}})})}),zz=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:i,onSlideMove:r,onSlideEnd:s,onHomeKeyDown:o,onEndKeyDown:a,onStepKeyDown:l,...c}=t,d=u_(qf,n);return P.jsx(Tt.span,{...c,ref:e,onKeyDown:ht(t.onKeyDown,h=>{h.key==="Home"?(o(h),h.preventDefault()):h.key==="End"?(a(h),h.preventDefault()):Lz.concat(Dz).includes(h.key)&&(l(h),h.preventDefault())}),onPointerDown:ht(t.onPointerDown,h=>{const p=h.target;p.setPointerCapture(h.pointerId),h.preventDefault(),d.thumbs.has(p)?p.focus():i(h)}),onPointerMove:ht(t.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&r(h)}),onPointerUp:ht(t.onPointerUp,h=>{const p=h.target;p.hasPointerCapture(h.pointerId)&&(p.releasePointerCapture(h.pointerId),s(h))})})}),Bz="SliderTrack",Vz=b.forwardRef((t,e)=>{const{__scopeSlider:n,...i}=t,r=u_(Bz,n);return P.jsx(Tt.span,{"data-disabled":r.disabled?"":void 0,"data-orientation":r.orientation,...i,ref:e})});Vz.displayName=Bz;var SE="SliderRange",Hz=b.forwardRef((t,e)=>{const{__scopeSlider:n,...i}=t,r=u_(SE,n),s=Uz(SE,n),o=b.useRef(null),a=$t(e,o),l=r.values.length,c=r.values.map(p=>Gz(p,r.min,r.max)),d=l>1?Math.min(...c):0,h=100-Math.max(...c);return P.jsx(Tt.span,{"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,...i,ref:a,style:{...t.style,[s.startEdge]:d+"%",[s.endEdge]:h+"%"}})});Hz.displayName=SE;var wE="SliderThumb",Wz=b.forwardRef((t,e)=>{const n=Hee(t.__scopeSlider),[i,r]=b.useState(null),s=$t(e,a=>r(a)),o=b.useMemo(()=>i?n().findIndex(a=>a.ref.current===i):-1,[n,i]);return P.jsx(qee,{...t,ref:s,index:o})}),qee=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:i,name:r,...s}=t,o=u_(wE,n),a=Uz(wE,n),[l,c]=b.useState(null),d=$t(e,w=>c(w)),h=l?o.form||!!l.closest("form"):!0,p=mA(l),g=o.values[i],v=g===void 0?0:Gz(g,o.min,o.max),_=Zee(i,o.values.length),y=p==null?void 0:p[a.size],m=y?Qee(y,v,a.direction):0;return b.useEffect(()=>{if(l)return o.thumbs.add(l),()=>{o.thumbs.delete(l)}},[l,o.thumbs]),P.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[a.startEdge]:`calc(${v}% + ${m}px)`},children:[P.jsx(_E.ItemSlot,{scope:t.__scopeSlider,children:P.jsx(Tt.span,{role:"slider","aria-label":t["aria-label"]||_,"aria-valuemin":o.min,"aria-valuenow":g,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...s,ref:d,style:g===void 0?{display:"none"}:t.style,onFocus:ht(t.onFocus,()=>{o.valueIndexToChangeRef.current=i})})}),h&&P.jsx($ee,{name:r??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:g},i)]})});Wz.displayName=wE;var $ee=t=>{const{value:e,...n}=t,i=b.useRef(null),r=wA(e);return b.useEffect(()=>{const s=i.current,o=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(o,"value").set;if(r!==e&&l){const c=new Event("input",{bubbles:!0});l.call(s,e),s.dispatchEvent(c)}},[r,e]),P.jsx("input",{style:{display:"none"},...n,ref:i,defaultValue:e})};function Yee(t=[],e,n){const i=[...t];return i[n]=e,i.sort((r,s)=>r-s)}function Gz(t,e,n){const s=100/(n-e)*(t-e);return dm(s,[0,100])}function Zee(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Kee(t,e){if(t.length===1)return 0;const n=t.map(r=>Math.abs(r-e)),i=Math.min(...n);return n.indexOf(i)}function Qee(t,e,n){const i=t/2,s=EA([0,50],[0,i]);return(i-s(e)*n)*n}function Jee(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function ete(t,e){if(e>0){const n=Jee(t);return Math.min(...n)>=e}return!0}function EA(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(t[1]-t[0]);return e[0]+i*(n-t[0])}}function tte(t){return(String(t).split(".")[1]||"").length}function nte(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var jz=kz,ite=Vz,rte=Hz,ste=Wz;const sl=b.forwardRef(({className:t,...e},n)=>P.jsxs(jz,{ref:n,className:qt("relative flex w-full touch-none select-none items-center",t),...e,children:[P.jsx(ite,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:P.jsx(rte,{className:"absolute h-full bg-primary"})}),P.jsx(ste,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));sl.displayName=jz.displayName;const{useActions:Xz,useInstance:qz,usePresets:$z}=pT(new hf,{default:hf.PRESETS.DEFAULT}),ote=()=>{const t=qz(),{active:e,options:n}=$z(),{setPreset:i,setParams:r}=Xz(),s=t.params;return P.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[P.jsx(oa,{children:"Noise"}),P.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:[...Object.keys(n),"custom"].map(o=>P.jsx(SA,{variant:"ghost","aria-selected":e===o,className:"p-2 aria-selected:bg-primary/20",onClick:()=>i(o==="custom"?void 0:o),children:o},`po_${o}`))}),!e&&P.jsxs(P.Fragment,{children:[P.jsx(Pc,{label:"Amplitude",value:s.amplitude.toFixed(2)}),P.jsx(sl,{defaultValue:[s.amplitude],value:[s.amplitude],min:0,max:5,step:.01,onValueChange:o=>r({amplitude:o[0]})}),P.jsx(Pc,{label:"Spatial Scale",value:s.spatialScale.toFixed(2)}),P.jsx(sl,{defaultValue:[s.spatialScale],value:[s.spatialScale],min:.1,max:5,step:.1,onValueChange:o=>r({spatialScale:o[0]})}),P.jsx(Pc,{label:"Time Scale",value:s.timeScale.toFixed(2)}),P.jsx(sl,{defaultValue:[s.timeScale],value:[s.timeScale],min:.01,max:2,step:.01,onValueChange:o=>({timeScale:o[0]})}),P.jsx(Pc,{label:"Iteration Count",value:s.nIterations}),P.jsx(sl,{defaultValue:[s.nIterations],value:[s.nIterations],min:1,max:16,step:1,onValueChange:o=>({nIterations:o[0]})})]})]})},LL={id:"noise",ControlsComponent:ote,hooks:{useActions:Xz,useInstance:qz,usePresets:$z}};var bA="Switch",[ate,jde]=gu(bA),[lte,cte]=ate(bA),Yz=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:i,checked:r,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,form:d,...h}=t,[p,g]=b.useState(null),v=$t(e,S=>g(S)),_=b.useRef(!1),y=p?d||!!p.closest("form"):!0,[m=!1,w]=ru({prop:r,defaultProp:s,onChange:c});return P.jsxs(lte,{scope:n,checked:m,disabled:a,children:[P.jsx(Tt.button,{type:"button",role:"switch","aria-checked":m,"aria-required":o,"data-state":Qz(m),"data-disabled":a?"":void 0,disabled:a,value:l,...h,ref:v,onClick:ht(t.onClick,S=>{w(E=>!E),y&&(_.current=S.isPropagationStopped(),_.current||S.stopPropagation())})}),y&&P.jsx(ute,{control:p,bubbles:!_.current,name:i,value:l,checked:m,required:o,disabled:a,form:d,style:{transform:"translateX(-100%)"}})]})});Yz.displayName=bA;var Zz="SwitchThumb",Kz=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...i}=t,r=cte(Zz,n);return P.jsx(Tt.span,{"data-state":Qz(r.checked),"data-disabled":r.disabled?"":void 0,...i,ref:e})});Kz.displayName=Zz;var ute=t=>{const{control:e,checked:n,bubbles:i=!0,...r}=t,s=b.useRef(null),o=wA(n),a=mA(e);return b.useEffect(()=>{const l=s.current,c=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(c,"checked").set;if(o!==n&&h){const p=new Event("click",{bubbles:i});h.call(l,n),l.dispatchEvent(p)}},[o,n,i]),P.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...r,tabIndex:-1,ref:s,style:{...t.style,...a,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Qz(t){return t?"checked":"unchecked"}var Jz=Yz,dte=Kz;const Gd=b.forwardRef(({className:t,...e},n)=>P.jsx(Jz,{className:qt("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:P.jsx(dte,{className:qt("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Gd.displayName=Jz.displayName;const{useActions:eB,useInstance:tB,usePresets:nB}=pT(new Gc,{default:Gc.PRESETS.DEFAULT}),fte=()=>{const t=tB(),{active:e,options:n}=nB(),{setPreset:i,setParams:r}=eB(),s=t.params;return P.jsxs("div",{className:"flex w-full flex-col items-start justify-start gap-4",children:[P.jsx(oa,{children:"Wave Form"}),P.jsx("div",{className:"flex w-full items-center justify-start gap-2",children:[...Object.keys(n),"custom"].map(o=>P.jsx(SA,{variant:"ghost","aria-selected":e===o,className:"p-2 aria-selected:bg-primary/20",onClick:()=>i(o==="custom"?void 0:o),children:o},`po_${o}`))}),!e&&P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:"flex w-full items-center justify-between",children:[P.jsx(oa,{children:"Double"}),P.jsx(Gd,{checked:s.waveformFrequenciesHz.length>1,defaultChecked:s.waveformFrequenciesHz.length>1,onCheckedChange:o=>{r({waveformFrequenciesHz:o?[2,10]:[2]})}})]}),P.jsx(Pc,{label:"Max Amplitude",value:s.maxAmplitude.toFixed(2)}),P.jsx(sl,{defaultValue:[s.maxAmplitude],value:[s.maxAmplitude],min:0,max:5,step:.01,onValueChange:o=>r({maxAmplitude:o[0]})}),s.waveformFrequenciesHz.map((o,a)=>P.jsxs("div",{className:"w-full space-y-4",children:[P.jsx(Pc,{label:`Wave #${a+1} - Freq (hz)`,value:o.toFixed(2)}),P.jsx(sl,{defaultValue:[o],value:[o],min:2,max:a==0?10:30,step:.05,onValueChange:l=>r({waveformFrequenciesHz:s.waveformFrequenciesHz.map((c,d)=>a==d?l[0]:c)})},`slider_waveform_frequency_${a}`)]},`label_waveform_frequency_${a}`))]})]})},DL={id:"waveform",ControlsComponent:fte,hooks:{useActions:eB,useInstance:tB,usePresets:nB}},aa={[nI.id]:nI,[LL.id]:LL,[DL.id]:DL},hte=({analyzer:t})=>{const{octaveBandMode:e,energyMeasure:n}=Lk(),{energyTracker:i}=Ux(),r=aa.data.hooks.useInstance(),{setParams:s}=aa.data.hooks.useActions(),o=b.useRef(null),a=b.useCallback(()=>{const l=t.getBars();if(r.data.length!=l.length){console.log(`Resizing ${l.length}`),s({size:l.length});return}i==null||i.set(t.getEnergy(n)),l.forEach(({value:c},d)=>{r.data[d]=c})},[r,t,i,n,s]);return b.useEffect(()=>{o.current&&cancelAnimationFrame(o.current);const l=()=>{a(),o.current=requestAnimationFrame(l)};return o.current=requestAnimationFrame(l),()=>cancelAnimationFrame(o.current)},[r,n,a]),b.useEffect(()=>{t.mode=e},[e,t]),P.jsx(P.Fragment,{})},pte=t=>{const[e,n]=b.useState(!1),[i,r]=b.useState(!1),s=null,o=b.useCallback(()=>{},[t,s]);return b.useEffect(()=>{console.log("Syncing, start w/ pause..."),t.pause(),n(!1);{r(!1);return}},[t,s,o]),{loaded:i,isPlaying:e,playAudio:o}},mte=({audio:t})=>{const{loaded:e,isPlaying:n,playAudio:i}=pte(t);return t3()?P.jsx("div",{id:"info",style:{top:"1rem",left:"1rem"},hidden:n,children:e?P.jsx("button",{disabled:!e||n,onClick:i,children:"Play Audio"}):P.jsxs(P.Fragment,{children:[P.jsx("h2",{children:"Load a file"}),P.jsx("p",{children:"Use the controls panel to upload an audio file."})]})}):P.jsx(P.Fragment,{})},TA=b.createContext(null),gte=({initial:t=void 0,children:e})=>{const[n,i]=b.useState((t==null?void 0:t.track)??null);return P.jsx(TA.Provider,{value:{config:{track:n},setters:{setTrack:i}},children:e})};function vte(){const t=b.useContext(TA);if(!t)throw new Error("useSoundcloudContext must be used within a SoundcloudContextProvider");return t.config}function yte(){const t=b.useContext(TA);if(!t)throw new Error("useSoundcloudContext must be used within a SoundcloudContextProvider");return t.setters}var Qt;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function n(r){throw new Error}t.assertNever=n,t.arrayToEnum=r=>{const s={};for(const o of r)s[o]=o;return s},t.getValidEnumValues=r=>{const s=t.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),o={};for(const a of s)o[a]=r[a];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(s){return r[s]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const s=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},t.find=(r,s)=>{for(const o of r)if(s(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function i(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}t.joinValues=i,t.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s})(Qt||(Qt={}));var ME;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(ME||(ME={}));const Ye=Qt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Za=t=>{switch(typeof t){case"undefined":return Ye.undefined;case"string":return Ye.string;case"number":return isNaN(t)?Ye.nan:Ye.number;case"boolean":return Ye.boolean;case"function":return Ye.function;case"bigint":return Ye.bigint;case"symbol":return Ye.symbol;case"object":return Array.isArray(t)?Ye.array:t===null?Ye.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ye.promise:typeof Map<"u"&&t instanceof Map?Ye.map:typeof Set<"u"&&t instanceof Set?Ye.set:typeof Date<"u"&&t instanceof Date?Ye.date:Ye.object;default:return Ye.unknown}},Ie=Qt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),xte=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class Br extends Error{constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(s){return s.message},i={_errors:[]},r=s=>{for(const o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)i._errors.push(n(o));else{let a=i,l=0;for(;ln.message){const n={},i=[];for(const r of this.issues)r.path.length>0?(n[r.path[0]]=n[r.path[0]]||[],n[r.path[0]].push(e(r))):i.push(e(r));return{formErrors:i,fieldErrors:n}}get formErrors(){return this.flatten()}}Br.create=t=>new Br(t);const Mf=(t,e)=>{let n;switch(t.code){case Ie.invalid_type:t.received===Ye.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Ie.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,Qt.jsonStringifyReplacer)}`;break;case Ie.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qt.joinValues(t.keys,", ")}`;break;case Ie.invalid_union:n="Invalid input";break;case Ie.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qt.joinValues(t.options)}`;break;case Ie.invalid_enum_value:n=`Invalid enum value. Expected ${Qt.joinValues(t.options)}, received '${t.received}'`;break;case Ie.invalid_arguments:n="Invalid function arguments";break;case Ie.invalid_return_type:n="Invalid function return type";break;case Ie.invalid_date:n="Invalid date";break;case Ie.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:Qt.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Ie.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case Ie.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case Ie.custom:n="Invalid input";break;case Ie.invalid_intersection_types:n="Intersection results could not be merged";break;case Ie.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Ie.not_finite:n="Number must be finite";break;default:n=e.defaultError,Qt.assertNever(t)}return{message:n}};let iB=Mf;function _te(t){iB=t}function Uy(){return iB}const zy=t=>{const{data:e,path:n,errorMaps:i,issueData:r}=t,s=[...n,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return{...r,path:s,message:r.message};let a="";const l=i.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:e,defaultError:a}).message;return{...r,path:s,message:a}},Ste=[];function Ge(t,e){const n=Uy(),i=zy({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Mf?void 0:Mf].filter(r=>!!r)});t.common.issues.push(i)}class $i{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const i=[];for(const r of n){if(r.status==="aborted")return St;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,n){const i=[];for(const r of n){const s=await r.key,o=await r.value;i.push({key:s,value:o})}return $i.mergeObjectSync(e,i)}static mergeObjectSync(e,n){const i={};for(const r of n){const{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return St;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(i[s.value]=o.value)}return{status:e.value,value:i}}}const St=Object.freeze({status:"aborted"}),Ad=t=>({status:"dirty",value:t}),or=t=>({status:"valid",value:t}),EE=t=>t.status==="aborted",bE=t=>t.status==="dirty",fm=t=>t.status==="valid",hm=t=>typeof Promise<"u"&&t instanceof Promise;function By(t,e,n,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function rB(t,e,n,i,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var dt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(dt||(dt={}));var Zh,Kh;class Mo{constructor(e,n,i,r){this._cachedPath=[],this.parent=e,this.data=n,this._path=i,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const NL=(t,e)=>{if(fm(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Br(t.common.issues);return this._error=n,this._error}}};function Nt(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:i,description:r}=t;if(e&&(n||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,a)=>{var l,c;const{message:d}=t;return o.code==="invalid_enum_value"?{message:d??a.defaultError}:typeof a.data>"u"?{message:(l=d??i)!==null&&l!==void 0?l:a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:(c=d??n)!==null&&c!==void 0?c:a.defaultError}},description:r}}class Vt{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return Za(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Za(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new $i,ctx:{common:e.parent.common,data:e.data,parsedType:Za(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(hm(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const i=this.safeParse(e,n);if(i.success)return i.data;throw i.error}safeParse(e,n){var i;const r={common:{issues:[],async:(i=n==null?void 0:n.async)!==null&&i!==void 0?i:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Za(e)},s=this._parseSync({data:e,path:r.path,parent:r});return NL(r,s)}async parseAsync(e,n){const i=await this.safeParseAsync(e,n);if(i.success)return i.data;throw i.error}async safeParseAsync(e,n){const i={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Za(e)},r=this._parse({data:e,path:i.path,parent:i}),s=await(hm(r)?r:Promise.resolve(r));return NL(i,s)}refine(e,n){const i=r=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(r):n;return this._refinement((r,s)=>{const o=e(r),a=()=>s.addIssue({code:Ie.custom,...i(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(e,n){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof n=="function"?n(i,r):n),!1))}_refinement(e){return new zs({schema:this,typeName:_t.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return vo.create(this,this._def)}nullable(){return Il.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ls.create(this,this._def)}promise(){return bf.create(this,this._def)}or(e){return vm.create([this,e],this._def)}and(e){return ym.create(this,e,this._def)}transform(e){return new zs({...Nt(this._def),schema:this,typeName:_t.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Mm({...Nt(this._def),innerType:this,defaultValue:n,typeName:_t.ZodDefault})}brand(){return new AA({typeName:_t.ZodBranded,type:this,...Nt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Em({...Nt(this._def),innerType:this,catchValue:n,typeName:_t.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return ng.create(this,e)}readonly(){return bm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const wte=/^c[^\s-]{8,}$/i,Mte=/^[0-9a-z]+$/,Ete=/^[0-9A-HJKMNP-TV-Z]{26}$/,bte=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Tte=/^[a-z0-9_-]{21}$/i,Ate=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Cte=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Pte="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let o1;const Rte=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ite=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Lte=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sB="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Dte=new RegExp(`^${sB}$`);function oB(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Nte(t){return new RegExp(`^${oB(t)}$`)}function aB(t){let e=`${sB}T${oB(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ote(t,e){return!!((e==="v4"||!e)&&Rte.test(t)||(e==="v6"||!e)&&Ite.test(t))}class Ps extends Vt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ye.string){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_type,expected:Ye.string,received:s.parsedType}),St}const i=new $i;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.lengths.value&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ie.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if(s.kind==="length"){const o=e.data.length>s.value,a=e.data.lengthe.test(r),{validation:n,code:Ie.invalid_string,...dt.errToObj(i)})}_addCheck(e){return new Ps({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...dt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...dt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...dt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...dt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...dt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...dt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...dt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...dt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...dt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...dt.errToObj(e)})}datetime(e){var n,i;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(i=e==null?void 0:e.local)!==null&&i!==void 0?i:!1,...dt.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...dt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...dt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...dt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...dt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...dt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...dt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...dt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...dt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...dt.errToObj(n)})}nonempty(e){return this.min(1,dt.errToObj(e))}trim(){return new Ps({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ps({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ps({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Ps({checks:[],typeName:_t.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Nt(t)})};function kte(t,e){const n=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=n>i?n:i,s=parseInt(t.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return s%o/Math.pow(10,r)}class Cl extends Vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ye.number){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_type,expected:Ye.number,received:s.parsedType}),St}let i;const r=new $i;for(const s of this._def.checks)s.kind==="int"?Qt.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Ge(i,{code:Ie.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Ge(i,{code:Ie.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?kte(e.data,s.value)!==0&&(i=this._getOrReturnCtx(e,i),Ge(i,{code:Ie.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Ge(i,{code:Ie.not_finite,message:s.message}),r.dirty()):Qt.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,dt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,dt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,dt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,dt.toString(n))}setLimit(e,n,i,r){return new Cl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:dt.toString(r)}]})}_addCheck(e){return new Cl({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:dt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:dt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:dt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:dt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:dt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:dt.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&Qt.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(n===null||i.value>n)&&(n=i.value):i.kind==="max"&&(e===null||i.valuenew Cl({checks:[],typeName:_t.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Nt(t)});class Pl extends Vt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ye.bigint){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_type,expected:Ye.bigint,received:s.parsedType}),St}let i;const r=new $i;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.datas.value:e.data>=s.value)&&(i=this._getOrReturnCtx(e,i),Ge(i,{code:Ie.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Ge(i,{code:Ie.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):Qt.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,dt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,dt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,dt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,dt.toString(n))}setLimit(e,n,i,r){return new Pl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:i,message:dt.toString(r)}]})}_addCheck(e){return new Pl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:dt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:dt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:dt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:dt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:dt.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Pl({checks:[],typeName:_t.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Nt(t)})};class pm extends Vt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ye.boolean){const i=this._getOrReturnCtx(e);return Ge(i,{code:Ie.invalid_type,expected:Ye.boolean,received:i.parsedType}),St}return or(e.data)}}pm.create=t=>new pm({typeName:_t.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Nt(t)});class su extends Vt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ye.date){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_type,expected:Ye.date,received:s.parsedType}),St}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return Ge(s,{code:Ie.invalid_date}),St}const i=new $i;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()s.value&&(r=this._getOrReturnCtx(e,r),Ge(r,{code:Ie.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):Qt.assertNever(s);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new su({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:dt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:dt.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew su({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:_t.ZodDate,...Nt(t)});class Vy extends Vt{_parse(e){if(this._getType(e)!==Ye.symbol){const i=this._getOrReturnCtx(e);return Ge(i,{code:Ie.invalid_type,expected:Ye.symbol,received:i.parsedType}),St}return or(e.data)}}Vy.create=t=>new Vy({typeName:_t.ZodSymbol,...Nt(t)});class mm extends Vt{_parse(e){if(this._getType(e)!==Ye.undefined){const i=this._getOrReturnCtx(e);return Ge(i,{code:Ie.invalid_type,expected:Ye.undefined,received:i.parsedType}),St}return or(e.data)}}mm.create=t=>new mm({typeName:_t.ZodUndefined,...Nt(t)});class gm extends Vt{_parse(e){if(this._getType(e)!==Ye.null){const i=this._getOrReturnCtx(e);return Ge(i,{code:Ie.invalid_type,expected:Ye.null,received:i.parsedType}),St}return or(e.data)}}gm.create=t=>new gm({typeName:_t.ZodNull,...Nt(t)});class Ef extends Vt{constructor(){super(...arguments),this._any=!0}_parse(e){return or(e.data)}}Ef.create=t=>new Ef({typeName:_t.ZodAny,...Nt(t)});class qc extends Vt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return or(e.data)}}qc.create=t=>new qc({typeName:_t.ZodUnknown,...Nt(t)});class xa extends Vt{_parse(e){const n=this._getOrReturnCtx(e);return Ge(n,{code:Ie.invalid_type,expected:Ye.never,received:n.parsedType}),St}}xa.create=t=>new xa({typeName:_t.ZodNever,...Nt(t)});class Hy extends Vt{_parse(e){if(this._getType(e)!==Ye.undefined){const i=this._getOrReturnCtx(e);return Ge(i,{code:Ie.invalid_type,expected:Ye.void,received:i.parsedType}),St}return or(e.data)}}Hy.create=t=>new Hy({typeName:_t.ZodVoid,...Nt(t)});class Ls extends Vt{_parse(e){const{ctx:n,status:i}=this._processInputParams(e),r=this._def;if(n.parsedType!==Ye.array)return Ge(n,{code:Ie.invalid_type,expected:Ye.array,received:n.parsedType}),St;if(r.exactLength!==null){const o=n.data.length>r.exactLength.value,a=n.data.lengthr.maxLength.value&&(Ge(n,{code:Ie.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>r.type._parseAsync(new Mo(n,o,n.path,a)))).then(o=>$i.mergeArray(i,o));const s=[...n.data].map((o,a)=>r.type._parseSync(new Mo(n,o,n.path,a)));return $i.mergeArray(i,s)}get element(){return this._def.type}min(e,n){return new Ls({...this._def,minLength:{value:e,message:dt.toString(n)}})}max(e,n){return new Ls({...this._def,maxLength:{value:e,message:dt.toString(n)}})}length(e,n){return new Ls({...this._def,exactLength:{value:e,message:dt.toString(n)}})}nonempty(e){return this.min(1,e)}}Ls.create=(t,e)=>new Ls({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_t.ZodArray,...Nt(e)});function ad(t){if(t instanceof Cn){const e={};for(const n in t.shape){const i=t.shape[n];e[n]=vo.create(ad(i))}return new Cn({...t._def,shape:()=>e})}else return t instanceof Ls?new Ls({...t._def,type:ad(t.element)}):t instanceof vo?vo.create(ad(t.unwrap())):t instanceof Il?Il.create(ad(t.unwrap())):t instanceof Eo?Eo.create(t.items.map(e=>ad(e))):t}class Cn extends Vt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=Qt.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==Ye.object){const c=this._getOrReturnCtx(e);return Ge(c,{code:Ie.invalid_type,expected:Ye.object,received:c.parsedType}),St}const{status:i,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof xa&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const d=s[c],h=r.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new Mo(r,h,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof xa){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of a)l.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(c==="strict")a.length>0&&(Ge(r,{code:Ie.unrecognized_keys,keys:a}),i.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of a){const h=r.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new Mo(r,h,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const h=await d.key,p=await d.value;c.push({key:h,value:p,alwaysSet:d.alwaysSet})}return c}).then(c=>$i.mergeObjectSync(i,c)):$i.mergeObjectSync(i,l)}get shape(){return this._def.shape()}strict(e){return dt.errToObj,new Cn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,i)=>{var r,s,o,a;const l=(o=(s=(r=this._def).errorMap)===null||s===void 0?void 0:s.call(r,n,i).message)!==null&&o!==void 0?o:i.defaultError;return n.code==="unrecognized_keys"?{message:(a=dt.errToObj(e).message)!==null&&a!==void 0?a:l}:{message:l}}}:{}})}strip(){return new Cn({...this._def,unknownKeys:"strip"})}passthrough(){return new Cn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Cn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Cn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_t.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Cn({...this._def,catchall:e})}pick(e){const n={};return Qt.objectKeys(e).forEach(i=>{e[i]&&this.shape[i]&&(n[i]=this.shape[i])}),new Cn({...this._def,shape:()=>n})}omit(e){const n={};return Qt.objectKeys(this.shape).forEach(i=>{e[i]||(n[i]=this.shape[i])}),new Cn({...this._def,shape:()=>n})}deepPartial(){return ad(this)}partial(e){const n={};return Qt.objectKeys(this.shape).forEach(i=>{const r=this.shape[i];e&&!e[i]?n[i]=r:n[i]=r.optional()}),new Cn({...this._def,shape:()=>n})}required(e){const n={};return Qt.objectKeys(this.shape).forEach(i=>{if(e&&!e[i])n[i]=this.shape[i];else{let s=this.shape[i];for(;s instanceof vo;)s=s._def.innerType;n[i]=s}}),new Cn({...this._def,shape:()=>n})}keyof(){return lB(Qt.objectKeys(this.shape))}}Cn.create=(t,e)=>new Cn({shape:()=>t,unknownKeys:"strip",catchall:xa.create(),typeName:_t.ZodObject,...Nt(e)});Cn.strictCreate=(t,e)=>new Cn({shape:()=>t,unknownKeys:"strict",catchall:xa.create(),typeName:_t.ZodObject,...Nt(e)});Cn.lazycreate=(t,e)=>new Cn({shape:t,unknownKeys:"strip",catchall:xa.create(),typeName:_t.ZodObject,...Nt(e)});class vm extends Vt{_parse(e){const{ctx:n}=this._processInputParams(e),i=this._def.options;function r(s){for(const a of s)if(a.result.status==="valid")return a.result;for(const a of s)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=s.map(a=>new Br(a.ctx.common.issues));return Ge(n,{code:Ie.invalid_union,unionErrors:o}),St}if(n.common.async)return Promise.all(i.map(async s=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await s._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(r);{let s;const o=[];for(const l of i){const c={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!s&&(s={result:d,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(s)return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(l=>new Br(l));return Ge(n,{code:Ie.invalid_union,unionErrors:a}),St}}get options(){return this._def.options}}vm.create=(t,e)=>new vm({options:t,typeName:_t.ZodUnion,...Nt(e)});const Wo=t=>t instanceof _m?Wo(t.schema):t instanceof zs?Wo(t.innerType()):t instanceof Sm?[t.value]:t instanceof Rl?t.options:t instanceof wm?Qt.objectValues(t.enum):t instanceof Mm?Wo(t._def.innerType):t instanceof mm?[void 0]:t instanceof gm?[null]:t instanceof vo?[void 0,...Wo(t.unwrap())]:t instanceof Il?[null,...Wo(t.unwrap())]:t instanceof AA||t instanceof bm?Wo(t.unwrap()):t instanceof Em?Wo(t._def.innerType):[];class d_ extends Vt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.object)return Ge(n,{code:Ie.invalid_type,expected:Ye.object,received:n.parsedType}),St;const i=this.discriminator,r=n.data[i],s=this.optionsMap.get(r);return s?n.common.async?s._parseAsync({data:n.data,path:n.path,parent:n}):s._parseSync({data:n.data,path:n.path,parent:n}):(Ge(n,{code:Ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),St)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,i){const r=new Map;for(const s of n){const o=Wo(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of o){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,s)}}return new d_({typeName:_t.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:r,...Nt(i)})}}function TE(t,e){const n=Za(t),i=Za(e);if(t===e)return{valid:!0,data:t};if(n===Ye.object&&i===Ye.object){const r=Qt.objectKeys(e),s=Qt.objectKeys(t).filter(a=>r.indexOf(a)!==-1),o={...t,...e};for(const a of s){const l=TE(t[a],e[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===Ye.array&&i===Ye.array){if(t.length!==e.length)return{valid:!1};const r=[];for(let s=0;s{if(EE(s)||EE(o))return St;const a=TE(s.value,o.value);return a.valid?((bE(s)||bE(o))&&n.dirty(),{status:n.value,value:a.data}):(Ge(i,{code:Ie.invalid_intersection_types}),St)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}ym.create=(t,e,n)=>new ym({left:t,right:e,typeName:_t.ZodIntersection,...Nt(n)});class Eo extends Vt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ye.array)return Ge(i,{code:Ie.invalid_type,expected:Ye.array,received:i.parsedType}),St;if(i.data.lengththis._def.items.length&&(Ge(i,{code:Ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...i.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Mo(i,o,i.path,a)):null}).filter(o=>!!o);return i.common.async?Promise.all(s).then(o=>$i.mergeArray(n,o)):$i.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Eo({...this._def,rest:e})}}Eo.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Eo({items:t,typeName:_t.ZodTuple,rest:null,...Nt(e)})};class xm extends Vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ye.object)return Ge(i,{code:Ie.invalid_type,expected:Ye.object,received:i.parsedType}),St;const r=[],s=this._def.keyType,o=this._def.valueType;for(const a in i.data)r.push({key:s._parse(new Mo(i,a,i.path,a)),value:o._parse(new Mo(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?$i.mergeObjectAsync(n,r):$i.mergeObjectSync(n,r)}get element(){return this._def.valueType}static create(e,n,i){return n instanceof Vt?new xm({keyType:e,valueType:n,typeName:_t.ZodRecord,...Nt(i)}):new xm({keyType:Ps.create(),valueType:e,typeName:_t.ZodRecord,...Nt(n)})}}class Wy extends Vt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ye.map)return Ge(i,{code:Ie.invalid_type,expected:Ye.map,received:i.parsedType}),St;const r=this._def.keyType,s=this._def.valueType,o=[...i.data.entries()].map(([a,l],c)=>({key:r._parse(new Mo(i,a,i.path,[c,"key"])),value:s._parse(new Mo(i,l,i.path,[c,"value"]))}));if(i.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return St;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(c.value,d.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return St;(c.status==="dirty"||d.status==="dirty")&&n.dirty(),a.set(c.value,d.value)}return{status:n.value,value:a}}}}Wy.create=(t,e,n)=>new Wy({valueType:e,keyType:t,typeName:_t.ZodMap,...Nt(n)});class ou extends Vt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.parsedType!==Ye.set)return Ge(i,{code:Ie.invalid_type,expected:Ye.set,received:i.parsedType}),St;const r=this._def;r.minSize!==null&&i.data.sizer.maxSize.value&&(Ge(i,{code:Ie.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),n.dirty());const s=this._def.valueType;function o(l){const c=new Set;for(const d of l){if(d.status==="aborted")return St;d.status==="dirty"&&n.dirty(),c.add(d.value)}return{status:n.value,value:c}}const a=[...i.data.values()].map((l,c)=>s._parse(new Mo(i,l,i.path,c)));return i.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(e,n){return new ou({...this._def,minSize:{value:e,message:dt.toString(n)}})}max(e,n){return new ou({...this._def,maxSize:{value:e,message:dt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}ou.create=(t,e)=>new ou({valueType:t,minSize:null,maxSize:null,typeName:_t.ZodSet,...Nt(e)});class jd extends Vt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.function)return Ge(n,{code:Ie.invalid_type,expected:Ye.function,received:n.parsedType}),St;function i(a,l){return zy({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Uy(),Mf].filter(c=>!!c),issueData:{code:Ie.invalid_arguments,argumentsError:l}})}function r(a,l){return zy({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Uy(),Mf].filter(c=>!!c),issueData:{code:Ie.invalid_return_type,returnTypeError:l}})}const s={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof bf){const a=this;return or(async function(...l){const c=new Br([]),d=await a._def.args.parseAsync(l,s).catch(g=>{throw c.addIssue(i(l,g)),c}),h=await Reflect.apply(o,this,d);return await a._def.returns._def.type.parseAsync(h,s).catch(g=>{throw c.addIssue(r(h,g)),c})})}else{const a=this;return or(function(...l){const c=a._def.args.safeParse(l,s);if(!c.success)throw new Br([i(l,c.error)]);const d=Reflect.apply(o,this,c.data),h=a._def.returns.safeParse(d,s);if(!h.success)throw new Br([r(d,h.error)]);return h.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new jd({...this._def,args:Eo.create(e).rest(qc.create())})}returns(e){return new jd({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,i){return new jd({args:e||Eo.create([]).rest(qc.create()),returns:n||qc.create(),typeName:_t.ZodFunction,...Nt(i)})}}class _m extends Vt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}_m.create=(t,e)=>new _m({getter:t,typeName:_t.ZodLazy,...Nt(e)});class Sm extends Vt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Ge(n,{received:n.data,code:Ie.invalid_literal,expected:this._def.value}),St}return{status:"valid",value:e.data}}get value(){return this._def.value}}Sm.create=(t,e)=>new Sm({value:t,typeName:_t.ZodLiteral,...Nt(e)});function lB(t,e){return new Rl({values:t,typeName:_t.ZodEnum,...Nt(e)})}class Rl extends Vt{constructor(){super(...arguments),Zh.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),i=this._def.values;return Ge(n,{expected:Qt.joinValues(i),received:n.parsedType,code:Ie.invalid_type}),St}if(By(this,Zh)||rB(this,Zh,new Set(this._def.values)),!By(this,Zh).has(e.data)){const n=this._getOrReturnCtx(e),i=this._def.values;return Ge(n,{received:n.data,code:Ie.invalid_enum_value,options:i}),St}return or(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Rl.create(e,{...this._def,...n})}exclude(e,n=this._def){return Rl.create(this.options.filter(i=>!e.includes(i)),{...this._def,...n})}}Zh=new WeakMap;Rl.create=lB;class wm extends Vt{constructor(){super(...arguments),Kh.set(this,void 0)}_parse(e){const n=Qt.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==Ye.string&&i.parsedType!==Ye.number){const r=Qt.objectValues(n);return Ge(i,{expected:Qt.joinValues(r),received:i.parsedType,code:Ie.invalid_type}),St}if(By(this,Kh)||rB(this,Kh,new Set(Qt.getValidEnumValues(this._def.values))),!By(this,Kh).has(e.data)){const r=Qt.objectValues(n);return Ge(i,{received:i.data,code:Ie.invalid_enum_value,options:r}),St}return or(e.data)}get enum(){return this._def.values}}Kh=new WeakMap;wm.create=(t,e)=>new wm({values:t,typeName:_t.ZodNativeEnum,...Nt(e)});class bf extends Vt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.promise&&n.common.async===!1)return Ge(n,{code:Ie.invalid_type,expected:Ye.promise,received:n.parsedType}),St;const i=n.parsedType===Ye.promise?n.data:Promise.resolve(n.data);return or(i.then(r=>this._def.type.parseAsync(r,{path:n.path,errorMap:n.common.contextualErrorMap})))}}bf.create=(t,e)=>new bf({type:t,typeName:_t.ZodPromise,...Nt(e)});class zs extends Vt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_t.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:i}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:o=>{Ge(i,o),o.fatal?n.abort():n.dirty()},get path(){return i.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){const o=r.transform(i.data,s);if(i.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return St;const l=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return l.status==="aborted"?St:l.status==="dirty"||n.value==="dirty"?Ad(l.value):l});{if(n.value==="aborted")return St;const a=this._def.schema._parseSync({data:o,path:i.path,parent:i});return a.status==="aborted"?St:a.status==="dirty"||n.value==="dirty"?Ad(a.value):a}}if(r.type==="refinement"){const o=a=>{const l=r.refinement(a,s);if(i.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?St:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?St:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){const o=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!fm(o))return o;const a=r.transform(o.value,s);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(o=>fm(o)?Promise.resolve(r.transform(o.value,s)).then(a=>({status:n.value,value:a})):o);Qt.assertNever(r)}}zs.create=(t,e,n)=>new zs({schema:t,typeName:_t.ZodEffects,effect:e,...Nt(n)});zs.createWithPreprocess=(t,e,n)=>new zs({schema:e,effect:{type:"preprocess",transform:t},typeName:_t.ZodEffects,...Nt(n)});class vo extends Vt{_parse(e){return this._getType(e)===Ye.undefined?or(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}vo.create=(t,e)=>new vo({innerType:t,typeName:_t.ZodOptional,...Nt(e)});class Il extends Vt{_parse(e){return this._getType(e)===Ye.null?or(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Il.create=(t,e)=>new Il({innerType:t,typeName:_t.ZodNullable,...Nt(e)});class Mm extends Vt{_parse(e){const{ctx:n}=this._processInputParams(e);let i=n.data;return n.parsedType===Ye.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Mm.create=(t,e)=>new Mm({innerType:t,typeName:_t.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Nt(e)});class Em extends Vt{_parse(e){const{ctx:n}=this._processInputParams(e),i={...n,common:{...n.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return hm(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Br(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new Br(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}Em.create=(t,e)=>new Em({innerType:t,typeName:_t.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Nt(e)});class Gy extends Vt{_parse(e){if(this._getType(e)!==Ye.nan){const i=this._getOrReturnCtx(e);return Ge(i,{code:Ie.invalid_type,expected:Ye.nan,received:i.parsedType}),St}return{status:"valid",value:e.data}}}Gy.create=t=>new Gy({typeName:_t.ZodNaN,...Nt(t)});const Fte=Symbol("zod_brand");class AA extends Vt{_parse(e){const{ctx:n}=this._processInputParams(e),i=n.data;return this._def.type._parse({data:i,path:n.path,parent:n})}unwrap(){return this._def.type}}class ng extends Vt{_parse(e){const{status:n,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const s=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return s.status==="aborted"?St:s.status==="dirty"?(n.dirty(),Ad(s.value)):this._def.out._parseAsync({data:s.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?St:r.status==="dirty"?(n.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,n){return new ng({in:e,out:n,typeName:_t.ZodPipeline})}}class bm extends Vt{_parse(e){const n=this._def.innerType._parse(e),i=r=>(fm(r)&&(r.value=Object.freeze(r.value)),r);return hm(n)?n.then(r=>i(r)):i(n)}unwrap(){return this._def.innerType}}bm.create=(t,e)=>new bm({innerType:t,typeName:_t.ZodReadonly,...Nt(e)});function cB(t,e={},n){return t?Ef.create().superRefine((i,r)=>{var s,o;if(!t(i)){const a=typeof e=="function"?e(i):typeof e=="string"?{message:e}:e,l=(o=(s=a.fatal)!==null&&s!==void 0?s:n)!==null&&o!==void 0?o:!0,c=typeof a=="string"?{message:a}:a;r.addIssue({code:"custom",...c,fatal:l})}}):Ef.create()}const Ute={object:Cn.lazycreate};var _t;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(_t||(_t={}));const zte=(t,e={message:`Input not instance of ${t.name}`})=>cB(n=>n instanceof t,e),uB=Ps.create,dB=Cl.create,Bte=Gy.create,Vte=Pl.create,fB=pm.create,Hte=su.create,Wte=Vy.create,Gte=mm.create,jte=gm.create,Xte=Ef.create,qte=qc.create,$te=xa.create,Yte=Hy.create,Zte=Ls.create,Kte=Cn.create,Qte=Cn.strictCreate,Jte=vm.create,ene=d_.create,tne=ym.create,nne=Eo.create,ine=xm.create,rne=Wy.create,sne=ou.create,one=jd.create,ane=_m.create,lne=Sm.create,cne=Rl.create,une=wm.create,dne=bf.create,OL=zs.create,fne=vo.create,hne=Il.create,pne=zs.createWithPreprocess,mne=ng.create,gne=()=>uB().optional(),vne=()=>dB().optional(),yne=()=>fB().optional(),xne={string:t=>Ps.create({...t,coerce:!0}),number:t=>Cl.create({...t,coerce:!0}),boolean:t=>pm.create({...t,coerce:!0}),bigint:t=>Pl.create({...t,coerce:!0}),date:t=>su.create({...t,coerce:!0})},_ne=St;var gr=Object.freeze({__proto__:null,defaultErrorMap:Mf,setErrorMap:_te,getErrorMap:Uy,makeIssue:zy,EMPTY_PATH:Ste,addIssueToContext:Ge,ParseStatus:$i,INVALID:St,DIRTY:Ad,OK:or,isAborted:EE,isDirty:bE,isValid:fm,isAsync:hm,get util(){return Qt},get objectUtil(){return ME},ZodParsedType:Ye,getParsedType:Za,ZodType:Vt,datetimeRegex:aB,ZodString:Ps,ZodNumber:Cl,ZodBigInt:Pl,ZodBoolean:pm,ZodDate:su,ZodSymbol:Vy,ZodUndefined:mm,ZodNull:gm,ZodAny:Ef,ZodUnknown:qc,ZodNever:xa,ZodVoid:Hy,ZodArray:Ls,ZodObject:Cn,ZodUnion:vm,ZodDiscriminatedUnion:d_,ZodIntersection:ym,ZodTuple:Eo,ZodRecord:xm,ZodMap:Wy,ZodSet:ou,ZodFunction:jd,ZodLazy:_m,ZodLiteral:Sm,ZodEnum:Rl,ZodNativeEnum:wm,ZodPromise:bf,ZodEffects:zs,ZodTransformer:zs,ZodOptional:vo,ZodNullable:Il,ZodDefault:Mm,ZodCatch:Em,ZodNaN:Gy,BRAND:Fte,ZodBranded:AA,ZodPipeline:ng,ZodReadonly:bm,custom:cB,Schema:Vt,ZodSchema:Vt,late:Ute,get ZodFirstPartyTypeKind(){return _t},coerce:xne,any:Xte,array:Zte,bigint:Vte,boolean:fB,date:Hte,discriminatedUnion:ene,effect:OL,enum:cne,function:one,instanceof:zte,intersection:tne,lazy:ane,literal:lne,map:rne,nan:Bte,nativeEnum:une,never:$te,null:jte,nullable:hne,number:dB,object:Kte,oboolean:yne,onumber:vne,optional:fne,ostring:gne,pipeline:mne,preprocess:pne,promise:dne,record:ine,set:sne,strictObject:Qte,string:uB,symbol:Wte,transformer:OL,tuple:nne,undefined:Gte,union:Jte,unknown:qte,void:Yte,NEVER:_ne,ZodIssueCode:Ie,quotelessJson:xte,ZodError:Br}),Sne=async(...t)=>{const e=await fetch(...t);if(!e.ok)throw new Error(`Request failed with status ${e.status}`);return e.json()};function wne(t=Sne){return async(e,...n)=>{const i=await t(...n);return e.parse(i)}}const hB=gr.object({avatar_url:gr.string().nullable(),id:gr.number(),username:gr.string(),track_count:gr.number().optional().nullable()}),Mne=gr.object({id:gr.number(),title:gr.string(),artwork_url:gr.string().nullable(),playback_count:gr.number().nullable(),user:hB.optional()}),CA="https://soundcloud-api-proxy.fly.dev/proxy",PA=wne(),Ene=async({query:t,limit:e=5})=>{const n=`${CA}/users?${new URLSearchParams({q:t,limit:e.toString()}).toString()}`;return await PA(gr.array(hB),n,{method:"GET"})},bne=async({userId:t,limit:e=50})=>{const n=`${CA}/users/${t}/tracks?${new URLSearchParams({access:"playable",limit:e.toString()}).toString()}`;return(await PA(gr.array(Mne),n,{method:"GET"})).sort((r,s)=>(s.playback_count??Number.POSITIVE_INFINITY)-(r.playback_count??Number.POSITIVE_INFINITY))},Tne=async t=>{const{http_mp3_128_url:e}=await PA(gr.object({http_mp3_128_url:gr.string()}),`${CA}/tracks/${t}/streams`,{method:"GET"});return e};var ig=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Tf=typeof window>"u"||"Deno"in globalThis;function os(){}function Ane(t,e){return typeof t=="function"?t(e):t}function AE(t){return typeof t=="number"&&t>=0&&t!==1/0}function pB(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Xd(t,e){return typeof t=="function"?t(e):t}function Cs(t,e){return typeof t=="function"?t(e):t}function kL(t,e){const{type:n="all",exact:i,fetchStatus:r,predicate:s,queryKey:o,stale:a}=t;if(o){if(i){if(e.queryHash!==RA(o,e.options))return!1}else if(!Am(e.queryKey,o))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&e.isStale()!==a||r&&r!==e.state.fetchStatus||s&&!s(e))}function FL(t,e){const{exact:n,status:i,predicate:r,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(Tm(e.options.mutationKey)!==Tm(s))return!1}else if(!Am(e.options.mutationKey,s))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function RA(t,e){return((e==null?void 0:e.queryKeyHashFn)||Tm)(t)}function Tm(t){return JSON.stringify(t,(e,n)=>PE(n)?Object.keys(n).sort().reduce((i,r)=>(i[r]=n[r],i),{}):n)}function Am(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!Am(t[n],e[n])):!1}function mB(t,e){if(t===e)return t;const n=UL(t)&&UL(e);if(n||PE(t)&&PE(e)){const i=n?t:Object.keys(t),r=i.length,s=n?e:Object.keys(e),o=s.length,a=n?[]:{};let l=0;for(let c=0;c{setTimeout(e,t)})}function RE(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?mB(t,e):e}function Pne(t,e,n=0){const i=[...t,e];return n&&i.length>n?i.slice(1):i}function Rne(t,e,n=0){const i=[e,...t];return n&&i.length>n?i.slice(0,-1):i}var gB=Symbol();function vB(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===gB?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Lc,Ka,qd,ON,Ine=(ON=class extends ig{constructor(){super();Pt(this,Lc);Pt(this,Ka);Pt(this,qd);nt(this,qd,e=>{if(!Tf&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){te(this,Ka)||this.setEventListener(te(this,qd))}onUnsubscribe(){var e;this.hasListeners()||((e=te(this,Ka))==null||e.call(this),nt(this,Ka,void 0))}setEventListener(e){var n;nt(this,qd,e),(n=te(this,Ka))==null||n.call(this),nt(this,Ka,e(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(e){te(this,Lc)!==e&&(nt(this,Lc,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof te(this,Lc)=="boolean"?te(this,Lc):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Lc=new WeakMap,Ka=new WeakMap,qd=new WeakMap,ON),IA=new Ine,$d,Qa,Yd,kN,Lne=(kN=class extends ig{constructor(){super();Pt(this,$d,!0);Pt(this,Qa);Pt(this,Yd);nt(this,Yd,e=>{if(!Tf&&window.addEventListener){const n=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",i)}}})}onSubscribe(){te(this,Qa)||this.setEventListener(te(this,Yd))}onUnsubscribe(){var e;this.hasListeners()||((e=te(this,Qa))==null||e.call(this),nt(this,Qa,void 0))}setEventListener(e){var n;nt(this,Yd,e),(n=te(this,Qa))==null||n.call(this),nt(this,Qa,e(this.setOnline.bind(this)))}setOnline(e){te(this,$d)!==e&&(nt(this,$d,e),this.listeners.forEach(i=>{i(e)}))}isOnline(){return te(this,$d)}},$d=new WeakMap,Qa=new WeakMap,Yd=new WeakMap,kN),jy=new Lne;function Dne(t){return Math.min(1e3*2**t,3e4)}function yB(t){return(t??"online")==="online"?jy.isOnline():!0}var xB=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function a1(t){return t instanceof xB}function _B(t){let e=!1,n=0,i=!1,r,s,o;const a=new Promise((m,w)=>{s=m,o=w}),l=m=>{var w;i||(v(new xB(m)),(w=t.abort)==null||w.call(t))},c=()=>{e=!0},d=()=>{e=!1},h=()=>IA.isFocused()&&(t.networkMode==="always"||jy.isOnline())&&t.canRun(),p=()=>yB(t.networkMode)&&t.canRun(),g=m=>{var w;i||(i=!0,(w=t.onSuccess)==null||w.call(t,m),r==null||r(),s(m))},v=m=>{var w;i||(i=!0,(w=t.onError)==null||w.call(t,m),r==null||r(),o(m))},_=()=>new Promise(m=>{var w;r=S=>{(i||h())&&m(S)},(w=t.onPause)==null||w.call(t)}).then(()=>{var m;r=void 0,i||(m=t.onContinue)==null||m.call(t)}),y=()=>{if(i)return;let m;const w=n===0?t.initialPromise:void 0;try{m=w??t.fn()}catch(S){m=Promise.reject(S)}Promise.resolve(m).then(g).catch(S=>{var N;if(i)return;const E=t.retry??(Tf?0:3),C=t.retryDelay??Dne,R=typeof C=="function"?C(n,S):C,I=E===!0||typeof E=="number"&&nh()?void 0:_()).then(()=>{e?v(S):y()})})};return{promise:a,cancel:l,continue:()=>(r==null||r(),a),cancelRetry:c,continueRetry:d,canStart:p,start:()=>(p()?y():_().then(y),a)}}function Nne(){let t=[],e=0,n=a=>{a()},i=a=>{a()},r=a=>setTimeout(a,0);const s=a=>{e?t.push(a):r(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&r(()=>{i(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;e++;try{l=a()}finally{e--,e||o()}return l},batchCalls:a=>(...l)=>{s(()=>{a(...l)})},schedule:s,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{i=a},setScheduler:a=>{r=a}}}var Ei=Nne(),Dc,FN,SB=(FN=class{constructor(){Pt(this,Dc)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),AE(this.gcTime)&&nt(this,Dc,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Tf?1/0:5*60*1e3))}clearGcTimeout(){te(this,Dc)&&(clearTimeout(te(this,Dc)),nt(this,Dc,void 0))}},Dc=new WeakMap,FN),Zd,Kd,ss,Ui,Lm,Nc,Es,Go,UN,One=(UN=class extends SB{constructor(e){super();Pt(this,Es);Pt(this,Zd);Pt(this,Kd);Pt(this,ss);Pt(this,Ui);Pt(this,Lm);Pt(this,Nc);nt(this,Nc,!1),nt(this,Lm,e.defaultOptions),this.setOptions(e.options),this.observers=[],nt(this,ss,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,nt(this,Zd,kne(this.options)),this.state=e.state??te(this,Zd),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=te(this,Ui))==null?void 0:e.promise}setOptions(e){this.options={...te(this,Lm),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&te(this,ss).remove(this)}setData(e,n){const i=RE(this.state.data,e,this.options);return Zt(this,Es,Go).call(this,{data:i,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),i}setState(e,n){Zt(this,Es,Go).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var i,r;const n=(i=te(this,Ui))==null?void 0:i.promise;return(r=te(this,Ui))==null||r.cancel(e),n?n.then(os).catch(os):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(te(this,Zd))}isActive(){return this.observers.some(e=>Cs(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!pB(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(i=>i.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=te(this,Ui))==null||n.continue()}onOnline(){var n;const e=this.observers.find(i=>i.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=te(this,Ui))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),te(this,ss).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(te(this,Ui)&&(te(this,Nc)?te(this,Ui).cancel({revert:!0}):te(this,Ui).cancelRetry()),this.scheduleGc()),te(this,ss).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Zt(this,Es,Go).call(this,{type:"invalidate"})}fetch(e,n){var l,c,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(te(this,Ui))return te(this,Ui).continueRetry(),te(this,Ui).promise}if(e&&this.setOptions(e),!this.options.queryFn){const h=this.observers.find(p=>p.options.queryFn);h&&this.setOptions(h.options)}const i=new AbortController,r=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(nt(this,Nc,!0),i.signal)})},s=()=>{const h=vB(this.options,n),p={queryKey:this.queryKey,meta:this.meta};return r(p),nt(this,Nc,!1),this.options.persister?this.options.persister(h,p,this):h(p)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:s};r(o),(l=this.options.behavior)==null||l.onFetch(o,this),nt(this,Kd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((c=o.fetchOptions)==null?void 0:c.meta))&&Zt(this,Es,Go).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const a=h=>{var p,g,v,_;a1(h)&&h.silent||Zt(this,Es,Go).call(this,{type:"error",error:h}),a1(h)||((g=(p=te(this,ss).config).onError)==null||g.call(p,h,this),(_=(v=te(this,ss).config).onSettled)==null||_.call(v,this.state.data,h,this)),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return nt(this,Ui,_B({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:i.abort.bind(i),onSuccess:h=>{var p,g,v,_;if(h===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(h)}catch(y){a(y);return}(g=(p=te(this,ss).config).onSuccess)==null||g.call(p,h,this),(_=(v=te(this,ss).config).onSettled)==null||_.call(v,h,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1},onError:a,onFail:(h,p)=>{Zt(this,Es,Go).call(this,{type:"failed",failureCount:h,error:p})},onPause:()=>{Zt(this,Es,Go).call(this,{type:"pause"})},onContinue:()=>{Zt(this,Es,Go).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),te(this,Ui).start()}},Zd=new WeakMap,Kd=new WeakMap,ss=new WeakMap,Ui=new WeakMap,Lm=new WeakMap,Nc=new WeakMap,Es=new WeakSet,Go=function(e){const n=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...wB(i.data,this.options),fetchMeta:e.meta??null};case"success":return{...i,data:e.data,dataUpdateCount:i.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=e.error;return a1(r)&&r.revert&&te(this,Kd)?{...te(this,Kd),fetchStatus:"idle"}:{...i,error:r,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=n(this.state),Ei.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),te(this,ss).notify({query:this,type:"updated",action:e})})},UN);function wB(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:yB(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function kne(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,i=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var no,zN,Fne=(zN=class extends ig{constructor(e={}){super();Pt(this,no);this.config=e,nt(this,no,new Map)}build(e,n,i){const r=n.queryKey,s=n.queryHash??RA(r,n);let o=this.get(s);return o||(o=new One({cache:this,queryKey:r,queryHash:s,options:e.defaultQueryOptions(n),state:i,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){te(this,no).has(e.queryHash)||(te(this,no).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=te(this,no).get(e.queryHash);n&&(e.destroy(),n===e&&te(this,no).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ei.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return te(this,no).get(e)}getAll(){return[...te(this,no).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(i=>kL(n,i))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(i=>kL(e,i)):n}notify(e){Ei.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Ei.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ei.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},no=new WeakMap,zN),io,Ji,Oc,ro,Wa,BN,Une=(BN=class extends SB{constructor(e){super();Pt(this,ro);Pt(this,io);Pt(this,Ji);Pt(this,Oc);this.mutationId=e.mutationId,nt(this,Ji,e.mutationCache),nt(this,io,[]),this.state=e.state||zne(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){te(this,io).includes(e)||(te(this,io).push(e),this.clearGcTimeout(),te(this,Ji).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){nt(this,io,te(this,io).filter(n=>n!==e)),this.scheduleGc(),te(this,Ji).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){te(this,io).length||(this.state.status==="pending"?this.scheduleGc():te(this,Ji).remove(this))}continue(){var e;return((e=te(this,Oc))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var r,s,o,a,l,c,d,h,p,g,v,_,y,m,w,S,E,C,R,I;nt(this,Oc,_B({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(N,F)=>{Zt(this,ro,Wa).call(this,{type:"failed",failureCount:N,error:F})},onPause:()=>{Zt(this,ro,Wa).call(this,{type:"pause"})},onContinue:()=>{Zt(this,ro,Wa).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>te(this,Ji).canRun(this)}));const n=this.state.status==="pending",i=!te(this,Oc).canStart();try{if(!n){Zt(this,ro,Wa).call(this,{type:"pending",variables:e,isPaused:i}),await((s=(r=te(this,Ji).config).onMutate)==null?void 0:s.call(r,e,this));const F=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e));F!==this.state.context&&Zt(this,ro,Wa).call(this,{type:"pending",context:F,variables:e,isPaused:i})}const N=await te(this,Oc).start();return await((c=(l=te(this,Ji).config).onSuccess)==null?void 0:c.call(l,N,e,this.state.context,this)),await((h=(d=this.options).onSuccess)==null?void 0:h.call(d,N,e,this.state.context)),await((g=(p=te(this,Ji).config).onSettled)==null?void 0:g.call(p,N,null,this.state.variables,this.state.context,this)),await((_=(v=this.options).onSettled)==null?void 0:_.call(v,N,null,e,this.state.context)),Zt(this,ro,Wa).call(this,{type:"success",data:N}),N}catch(N){try{throw await((m=(y=te(this,Ji).config).onError)==null?void 0:m.call(y,N,e,this.state.context,this)),await((S=(w=this.options).onError)==null?void 0:S.call(w,N,e,this.state.context)),await((C=(E=te(this,Ji).config).onSettled)==null?void 0:C.call(E,void 0,N,this.state.variables,this.state.context,this)),await((I=(R=this.options).onSettled)==null?void 0:I.call(R,void 0,N,e,this.state.context)),N}finally{Zt(this,ro,Wa).call(this,{type:"error",error:N})}}finally{te(this,Ji).runNext(this)}}},io=new WeakMap,Ji=new WeakMap,Oc=new WeakMap,ro=new WeakSet,Wa=function(e){const n=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Ei.batch(()=>{te(this,io).forEach(i=>{i.onMutationUpdate(e)}),te(this,Ji).notify({mutation:this,type:"updated",action:e})})},BN);function zne(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ir,Dm,VN,Bne=(VN=class extends ig{constructor(e={}){super();Pt(this,Ir);Pt(this,Dm);this.config=e,nt(this,Ir,new Map),nt(this,Dm,Date.now())}build(e,n,i){const r=new Une({mutationCache:this,mutationId:++sv(this,Dm)._,options:e.defaultMutationOptions(n),state:i});return this.add(r),r}add(e){const n=S0(e),i=te(this,Ir).get(n)??[];i.push(e),te(this,Ir).set(n,i),this.notify({type:"added",mutation:e})}remove(e){var i;const n=S0(e);if(te(this,Ir).has(n)){const r=(i=te(this,Ir).get(n))==null?void 0:i.filter(s=>s!==e);r&&(r.length===0?te(this,Ir).delete(n):te(this,Ir).set(n,r))}this.notify({type:"removed",mutation:e})}canRun(e){var i;const n=(i=te(this,Ir).get(S0(e)))==null?void 0:i.find(r=>r.state.status==="pending");return!n||n===e}runNext(e){var i;const n=(i=te(this,Ir).get(S0(e)))==null?void 0:i.find(r=>r!==e&&r.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){Ei.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...te(this,Ir).values()].flat()}find(e){const n={exact:!0,...e};return this.getAll().find(i=>FL(n,i))}findAll(e={}){return this.getAll().filter(n=>FL(e,n))}notify(e){Ei.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Ei.batch(()=>Promise.all(e.map(n=>n.continue().catch(os))))}},Ir=new WeakMap,Dm=new WeakMap,VN);function S0(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function BL(t){return{onFetch:(e,n)=>{var d,h,p,g,v;const i=e.options,r=(p=(h=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:h.fetchMore)==null?void 0:p.direction,s=((g=e.state.data)==null?void 0:g.pages)||[],o=((v=e.state.data)==null?void 0:v.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let _=!1;const y=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(e.signal.aborted?_=!0:e.signal.addEventListener("abort",()=>{_=!0}),e.signal)})},m=vB(e.options,e.fetchOptions),w=async(S,E,C)=>{if(_)return Promise.reject();if(E==null&&S.pages.length)return Promise.resolve(S);const R={queryKey:e.queryKey,pageParam:E,direction:C?"backward":"forward",meta:e.options.meta};y(R);const I=await m(R),{maxPages:N}=e.options,F=C?Rne:Pne;return{pages:F(S.pages,I,N),pageParams:F(S.pageParams,E,N)}};if(r&&s.length){const S=r==="backward",E=S?Vne:VL,C={pages:s,pageParams:o},R=E(i,C);a=await w(C,R,S)}else{const S=t??s.length;do{const E=l===0?o[0]??i.initialPageParam:VL(i,a);if(l>0&&E==null)break;a=await w(a,E),l++}while(l{var _,y;return(y=(_=e.options).persister)==null?void 0:y.call(_,c,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function VL(t,{pages:e,pageParams:n}){const i=e.length-1;return e.length>0?t.getNextPageParam(e[i],e,n[i],n):void 0}function Vne(t,{pages:e,pageParams:n}){var i;return e.length>0?(i=t.getPreviousPageParam)==null?void 0:i.call(t,e[0],e,n[0],n):void 0}var Un,Ja,el,Qd,Jd,tl,ef,tf,HN,Hne=(HN=class{constructor(t={}){Pt(this,Un);Pt(this,Ja);Pt(this,el);Pt(this,Qd);Pt(this,Jd);Pt(this,tl);Pt(this,ef);Pt(this,tf);nt(this,Un,t.queryCache||new Fne),nt(this,Ja,t.mutationCache||new Bne),nt(this,el,t.defaultOptions||{}),nt(this,Qd,new Map),nt(this,Jd,new Map),nt(this,tl,0)}mount(){sv(this,tl)._++,te(this,tl)===1&&(nt(this,ef,IA.subscribe(async t=>{t&&(await this.resumePausedMutations(),te(this,Un).onFocus())})),nt(this,tf,jy.subscribe(async t=>{t&&(await this.resumePausedMutations(),te(this,Un).onOnline())})))}unmount(){var t,e;sv(this,tl)._--,te(this,tl)===0&&((t=te(this,ef))==null||t.call(this),nt(this,ef,void 0),(e=te(this,tf))==null||e.call(this),nt(this,tf,void 0))}isFetching(t){return te(this,Un).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return te(this,Ja).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=te(this,Un).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const n=this.defaultQueryOptions(t),i=te(this,Un).build(this,n);return t.revalidateIfStale&&i.isStaleByTime(Xd(n.staleTime,i))&&this.prefetchQuery(n),Promise.resolve(e)}}getQueriesData(t){return te(this,Un).findAll(t).map(({queryKey:e,state:n})=>{const i=n.data;return[e,i]})}setQueryData(t,e,n){const i=this.defaultQueryOptions({queryKey:t}),r=te(this,Un).get(i.queryHash),s=r==null?void 0:r.state.data,o=Ane(e,s);if(o!==void 0)return te(this,Un).build(this,i).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Ei.batch(()=>te(this,Un).findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=te(this,Un).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=te(this,Un);Ei.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=te(this,Un),i={type:"active",...t};return Ei.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries(i,e)))}cancelQueries(t={},e={}){const n={revert:!0,...e},i=Ei.batch(()=>te(this,Un).findAll(t).map(r=>r.cancel(n)));return Promise.all(i).then(os).catch(os)}invalidateQueries(t={},e={}){return Ei.batch(()=>{if(te(this,Un).findAll(t).forEach(i=>{i.invalidate()}),t.refetchType==="none")return Promise.resolve();const n={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(n,e)})}refetchQueries(t={},e){const n={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},i=Ei.batch(()=>te(this,Un).findAll(t).filter(r=>!r.isDisabled()).map(r=>{let s=r.fetch(void 0,n);return n.throwOnError||(s=s.catch(os)),r.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(i).then(os)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=te(this,Un).build(this,e);return n.isStaleByTime(Xd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(os).catch(os)}fetchInfiniteQuery(t){return t.behavior=BL(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(os).catch(os)}ensureInfiniteQueryData(t){return t.behavior=BL(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return jy.isOnline()?te(this,Ja).resumePausedMutations():Promise.resolve()}getQueryCache(){return te(this,Un)}getMutationCache(){return te(this,Ja)}getDefaultOptions(){return te(this,el)}setDefaultOptions(t){nt(this,el,t)}setQueryDefaults(t,e){te(this,Qd).set(Tm(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...te(this,Qd).values()];let n={};return e.forEach(i=>{Am(t,i.queryKey)&&(n={...n,...i.defaultOptions})}),n}setMutationDefaults(t,e){te(this,Jd).set(Tm(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...te(this,Jd).values()];let n={};return e.forEach(i=>{Am(t,i.mutationKey)&&(n={...n,...i.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...te(this,el).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=RA(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===gB&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...te(this,el).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){te(this,Un).clear(),te(this,Ja).clear()}},Un=new WeakMap,Ja=new WeakMap,el=new WeakMap,Qd=new WeakMap,Jd=new WeakMap,tl=new WeakMap,ef=new WeakMap,tf=new WeakMap,HN),pr,Kt,Nm,er,kc,nf,so,Om,rf,sf,Fc,Uc,nl,of,an,Qh,IE,LE,DE,NE,OE,kE,FE,MB,WN,Wne=(WN=class extends ig{constructor(e,n){super();Pt(this,an);Pt(this,pr);Pt(this,Kt);Pt(this,Nm);Pt(this,er);Pt(this,kc);Pt(this,nf);Pt(this,so);Pt(this,Om);Pt(this,rf);Pt(this,sf);Pt(this,Fc);Pt(this,Uc);Pt(this,nl);Pt(this,of,new Set);this.options=n,nt(this,pr,e),nt(this,so,null),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(te(this,Kt).addObserver(this),HL(te(this,Kt),this.options)?Zt(this,an,Qh).call(this):this.updateResult(),Zt(this,an,NE).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return UE(te(this,Kt),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return UE(te(this,Kt),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Zt(this,an,OE).call(this),Zt(this,an,kE).call(this),te(this,Kt).removeObserver(this)}setOptions(e,n){const i=this.options,r=te(this,Kt);if(this.options=te(this,pr).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Cs(this.options.enabled,te(this,Kt))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Zt(this,an,FE).call(this),te(this,Kt).setOptions(this.options),i._defaulted&&!CE(this.options,i)&&te(this,pr).getQueryCache().notify({type:"observerOptionsUpdated",query:te(this,Kt),observer:this});const s=this.hasListeners();s&&WL(te(this,Kt),r,this.options,i)&&Zt(this,an,Qh).call(this),this.updateResult(n),s&&(te(this,Kt)!==r||Cs(this.options.enabled,te(this,Kt))!==Cs(i.enabled,te(this,Kt))||Xd(this.options.staleTime,te(this,Kt))!==Xd(i.staleTime,te(this,Kt)))&&Zt(this,an,IE).call(this);const o=Zt(this,an,LE).call(this);s&&(te(this,Kt)!==r||Cs(this.options.enabled,te(this,Kt))!==Cs(i.enabled,te(this,Kt))||o!==te(this,nl))&&Zt(this,an,DE).call(this,o)}getOptimisticResult(e){const n=te(this,pr).getQueryCache().build(te(this,pr),e),i=this.createResult(n,e);return jne(this,i)&&(nt(this,er,i),nt(this,nf,this.options),nt(this,kc,te(this,Kt).state)),i}getCurrentResult(){return te(this,er)}trackResult(e,n){const i={};return Object.keys(e).forEach(r=>{Object.defineProperty(i,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),n==null||n(r),e[r])})}),i}trackProp(e){te(this,of).add(e)}getCurrentQuery(){return te(this,Kt)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=te(this,pr).defaultQueryOptions(e),i=te(this,pr).getQueryCache().build(te(this,pr),n);return i.isFetchingOptimistic=!0,i.fetch().then(()=>this.createResult(i,n))}fetch(e){return Zt(this,an,Qh).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),te(this,er)))}createResult(e,n){var I;const i=te(this,Kt),r=this.options,s=te(this,er),o=te(this,kc),a=te(this,nf),c=e!==i?e.state:te(this,Nm),{state:d}=e;let h={...d},p=!1,g;if(n._optimisticResults){const N=this.hasListeners(),F=!N&&HL(e,n),A=N&&WL(e,i,n,r);(F||A)&&(h={...h,...wB(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:v,errorUpdatedAt:_,status:y}=h;if(n.select&&h.data!==void 0)if(s&&h.data===(o==null?void 0:o.data)&&n.select===te(this,Om))g=te(this,rf);else try{nt(this,Om,n.select),g=n.select(h.data),g=RE(s==null?void 0:s.data,g,n),nt(this,rf,g),nt(this,so,null)}catch(N){nt(this,so,N)}else g=h.data;if(n.placeholderData!==void 0&&g===void 0&&y==="pending"){let N;if(s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))N=s.data;else if(N=typeof n.placeholderData=="function"?n.placeholderData((I=te(this,sf))==null?void 0:I.state.data,te(this,sf)):n.placeholderData,n.select&&N!==void 0)try{N=n.select(N),nt(this,so,null)}catch(F){nt(this,so,F)}N!==void 0&&(y="success",g=RE(s==null?void 0:s.data,N,n),p=!0)}te(this,so)&&(v=te(this,so),g=te(this,rf),_=Date.now(),y="error");const m=h.fetchStatus==="fetching",w=y==="pending",S=y==="error",E=w&&m,C=g!==void 0;return{status:y,fetchStatus:h.fetchStatus,isPending:w,isSuccess:y==="success",isError:S,isInitialLoading:E,isLoading:E,data:g,dataUpdatedAt:h.dataUpdatedAt,error:v,errorUpdatedAt:_,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:m,isRefetching:m&&!w,isLoadingError:S&&!C,isPaused:h.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:S&&C,isStale:LA(e,n),refetch:this.refetch}}updateResult(e){const n=te(this,er),i=this.createResult(te(this,Kt),this.options);if(nt(this,kc,te(this,Kt).state),nt(this,nf,this.options),te(this,kc).data!==void 0&&nt(this,sf,te(this,Kt)),CE(i,n))return;nt(this,er,i);const r={},s=()=>{if(!n)return!0;const{notifyOnChangeProps:o}=this.options,a=typeof o=="function"?o():o;if(a==="all"||!a&&!te(this,of).size)return!0;const l=new Set(a??te(this,of));return this.options.throwOnError&&l.add("error"),Object.keys(te(this,er)).some(c=>{const d=c;return te(this,er)[d]!==n[d]&&l.has(d)})};(e==null?void 0:e.listeners)!==!1&&s()&&(r.listeners=!0),Zt(this,an,MB).call(this,{...r,...e})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Zt(this,an,NE).call(this)}},pr=new WeakMap,Kt=new WeakMap,Nm=new WeakMap,er=new WeakMap,kc=new WeakMap,nf=new WeakMap,so=new WeakMap,Om=new WeakMap,rf=new WeakMap,sf=new WeakMap,Fc=new WeakMap,Uc=new WeakMap,nl=new WeakMap,of=new WeakMap,an=new WeakSet,Qh=function(e){Zt(this,an,FE).call(this);let n=te(this,Kt).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(os)),n},IE=function(){Zt(this,an,OE).call(this);const e=Xd(this.options.staleTime,te(this,Kt));if(Tf||te(this,er).isStale||!AE(e))return;const i=pB(te(this,er).dataUpdatedAt,e)+1;nt(this,Fc,setTimeout(()=>{te(this,er).isStale||this.updateResult()},i))},LE=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(te(this,Kt)):this.options.refetchInterval)??!1},DE=function(e){Zt(this,an,kE).call(this),nt(this,nl,e),!(Tf||Cs(this.options.enabled,te(this,Kt))===!1||!AE(te(this,nl))||te(this,nl)===0)&&nt(this,Uc,setInterval(()=>{(this.options.refetchIntervalInBackground||IA.isFocused())&&Zt(this,an,Qh).call(this)},te(this,nl)))},NE=function(){Zt(this,an,IE).call(this),Zt(this,an,DE).call(this,Zt(this,an,LE).call(this))},OE=function(){te(this,Fc)&&(clearTimeout(te(this,Fc)),nt(this,Fc,void 0))},kE=function(){te(this,Uc)&&(clearInterval(te(this,Uc)),nt(this,Uc,void 0))},FE=function(){const e=te(this,pr).getQueryCache().build(te(this,pr),this.options);if(e===te(this,Kt))return;const n=te(this,Kt);nt(this,Kt,e),nt(this,Nm,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},MB=function(e){Ei.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(te(this,er))}),te(this,pr).getQueryCache().notify({query:te(this,Kt),type:"observerResultsUpdated"})})},WN);function Gne(t,e){return Cs(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function HL(t,e){return Gne(t,e)||t.state.data!==void 0&&UE(t,e,e.refetchOnMount)}function UE(t,e,n){if(Cs(e.enabled,t)!==!1){const i=typeof n=="function"?n(t):n;return i==="always"||i!==!1&&LA(t,e)}return!1}function WL(t,e,n,i){return(t!==e||Cs(i.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&LA(t,n)}function LA(t,e){return Cs(e.enabled,t)!==!1&&t.isStaleByTime(Xd(e.staleTime,t))}function jne(t,e){return!CE(t.getCurrentResult(),e)}var EB=b.createContext(void 0),Xne=t=>{const e=b.useContext(EB);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},qne=({client:t,children:e})=>(b.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),P.jsx(EB.Provider,{value:t,children:e})),bB=b.createContext(!1),$ne=()=>b.useContext(bB);bB.Provider;function Yne(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var Zne=b.createContext(Yne()),Kne=()=>b.useContext(Zne);function Qne(t,e){return typeof t=="function"?t(...e):!!t}var Jne=(t,e)=>{(t.suspense||t.throwOnError)&&(e.isReset()||(t.retryOnMount=!1))},eie=t=>{b.useEffect(()=>{t.clearReset()},[t])},tie=({result:t,errorResetBoundary:e,throwOnError:n,query:i})=>t.isError&&!e.isReset()&&!t.isFetching&&i&&Qne(n,[t.error,i]),nie=(t,e)=>e.state.data===void 0,iie=t=>{t.suspense&&(typeof t.staleTime!="number"&&(t.staleTime=1e3),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3)))},rie=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,sie=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function oie(t,e,n){var c,d,h,p;const i=Xne(),r=$ne(),s=Kne(),o=i.defaultQueryOptions(t);(d=(c=i.getDefaultOptions().queries)==null?void 0:c._experimental_beforeQuery)==null||d.call(c,o),o._optimisticResults=r?"isRestoring":"optimistic",iie(o),Jne(o,s),eie(s);const[a]=b.useState(()=>new e(i,o)),l=a.getOptimisticResult(o);if(b.useSyncExternalStore(b.useCallback(g=>{const v=r?()=>{}:a.subscribe(Ei.batchCalls(g));return a.updateResult(),v},[a,r]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),b.useEffect(()=>{a.setOptions(o,{listeners:!1})},[o,a]),rie(o,l))throw sie(o,a,s);if(tie({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash)}))throw l.error;return(p=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_afterQuery)==null||p.call(h,o,l),o.notifyOnChangeProps?l:a.trackResult(l)}function DA(t,e){return oie({...t,enabled:!0,suspense:!0,throwOnError:nie,placeholderData:void 0},Wne)}const aie=({audio:t,track:e,className:n,...i})=>{var l;const{showUI:r}=Ym(),{data:s}=DA({queryKey:["soundcloud-stream-url",e.id],queryFn:async()=>await Tne(e.id)}),[o,a]=b.useState(!0);return b.useEffect(()=>{if(!s)t.pause();else{t.src=s;const c=t.play();c!==void 0&&c.then(()=>console.log(`Playing ${e.title}`)).catch(d=>{console.error(`Error playing ${e.title}`)})}return()=>{t.pause()}},[t,s,e]),b.useEffect(()=>{if(o){const c=t.play();c!==void 0&&c.then(()=>console.log("Playing...")).catch(d=>{console.error("Error playing!")})}else t.pause();return()=>{t.pause()}},[t,o]),P.jsxs("div",{className:qt("flex w-fit max-w-xs flex-row items-center justify-start gap-2 rounded-lg p-4 sm:bg-black/25",n,!r&&"hidden"),...i,children:[P.jsx("div",{className:"pointer-events-auto cursor-pointer rounded-full p-2 hover:scale-110",onClick:()=>a(c=>!c),children:o?P.jsx(aG,{}):P.jsx(lG,{})}),P.jsxs("div",{className:"hidden flex-col items-start justify-center gap-1 sm:flex",children:[P.jsx("span",{className:"w-64 max-w-64 truncate text-sm text-foreground",children:e.title}),P.jsx("span",{className:"truncate text-xs text-foreground/50",children:((l=e.user)==null?void 0:l.username)??"Unknown Artist"})]})]})},lie=({...t})=>{const{track:e}=vte();return e?P.jsx(aie,{track:e,...t}):P.jsx(P.Fragment,{})},cie=({audio:t,audioSource:e})=>{switch(e){case Gn.SOUNDCLOUD:return P.jsx(lie,{audio:t});case Gn.FILE_UPLOAD:return P.jsx(mte,{audio:t});default:return e}},uie=({audio:t,onDisabled:e,onStreamCreated:n})=>{const i=b.useRef(null);return b.useEffect(()=>(console.log("Disabling mic..."),e(),i!=null&&i.current&&(i.current=null),console.log("Enabling mic..."),navigator.mediaDevices?navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then(n).catch(r=>{console.error(r),alert("Microphone access denied by user")}):alert("User mediaDevices not available"),()=>{t.pause(),i!=null&&i.current&&(i.current=null)}),[t,e,n]),P.jsx(P.Fragment,{})},die=({audio:t,onDisabled:e,onStreamCreated:n})=>{const i=b.useRef(null);return b.useEffect(()=>(console.log("Disabling share..."),e(),i!=null&&i.current&&(i.current=null),console.log("Enabling share..."),navigator.mediaDevices?navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser",width:1},audio:!0}).then(r=>{console.log(r.getAudioTracks()),n(r)}).catch(r=>{console.error(r),alert("Share access denied by user")}):alert("User mediaDevices not available"),()=>{t.pause(),i!=null&&i.current&&(i.current=null)}),[t,e,n]),P.jsx(P.Fragment,{})};function TB(t,e){return{onDisabled:()=>{e.disconnectInputs()},onStreamCreated:n=>{t.pause();const i=e._audioCtx.createMediaStreamSource(n);e.connectInput(i),e.volume=0}}}const GL={1:"1/24th octave bands",2:"1/12th octave bands",3:"1/8th octave bands",4:"1/6th octave bands",5:"1/4th octave bands",6:"1/3rd octave bands",7:"Half octave bands",8:"Full octave bands"},fie=["overall","peak","bass","lowMid","mid","highMid","treble"],AB=2**(1/24),hie=440*AB**-114;class CB{constructor(e,n=void 0,i=1){ot(this,"_analyzer");ot(this,"_input");ot(this,"_output");ot(this,"_audioCtx");ot(this,"_sources");ot(this,"_outNodes");ot(this,"_fftData");ot(this,"_freqBinInfos",[]);ot(this,"_energy",{val:0,peak:0,hold:0});ot(this,"_minFreq",20);ot(this,"_maxFreq",22e3);ot(this,"_mode",2);ot(this,"_runId");if(n===void 0?this._audioCtx=new window.AudioContext:this._audioCtx=n,!this._audioCtx.createGain)throw new Error("Provided audio context is not valid");this._analyzer=this._audioCtx.createAnalyser(),this._input=this._audioCtx.createGain(),this._output=this._audioCtx.createGain(),this._sources=[],this.connectInput(this._audioCtx.createMediaElementSource(e)),this._input.connect(this._analyzer),this._analyzer.connect(this._output),this._outNodes=[this._audioCtx.destination],this._output.connect(this._outNodes[0]),this._analyzer.smoothingTimeConstant=.5,this._analyzer.minDecibels=-85,this._analyzer.maxDecibels=-25,this._analyzer.fftSize=8192,this._fftData=new Uint8Array(this._analyzer.frequencyBinCount),this._updateFreqBins(),this.toggleAnalyzer(!0),this.volume=i}getBars(){return this._freqBinInfos}get mode(){return this._mode}set mode(e){this._mode=e,this._updateFreqBins()}get volume(){return this._output.gain.value}set volume(e){this._output.gain.value=e}get isOn(){return this._runId!==void 0}_updateFreqBins(){const e=[],n=o=>o*this._audioCtx.sampleRate/this._analyzer.fftSize||1,i=(o,a,l,c,d,h)=>e.push({binLo:o,binHi:a,freqLo:l,freqHi:c,ratioLo:d,ratioHi:h,value:0}),r=[];for(let o=0;o<11;o++)for(let a=0;a<24;a++){const l=hie*AB**(o*24+a),c=this._freqToBin(l,!1),d=n(c),h=n(c+1),p=(l-d)/(h-d);r.push({freq:l,bin:c,ratio:p})}const s=[0,1,2,3,4,6,8,12,24][this._mode];for(let o=0;othis._maxFreq||h>=this._analyzer.fftSize/2){v.binHi++,v.ratioHi=0,v.freqHi=n(v.binHi);break}if(a>=this._minFreq){if(g>0){const _=l-v.binHi;_>1&&(v.binHi=l-(_>>1),v.ratioHi=0,v.freqHi=n(v.binHi),g>1&&v.binHi>v.binLo&&v.binLo>e[g-2].binHi&&(v.ratioLo=0,v.freqLo=n(v.binLo)),l=v.binHi+1),h>l&&l>v.binHi&&(c=0,a=n(l))}i(l,h,a,d,c,p)}}this._freqBinInfos=e}_freqToBin(e,n=!0){const i=this._analyzer.frequencyBinCount-1,r=(n?Math.round:Math.floor)(e*this._analyzer.fftSize/this._audioCtx.sampleRate);return rn[s]+(n[s+1]-n[s])*o;let r=0;for(let s=0;sh&&(h=n[p]);h/=255,o.value=h,r+=h}this._energy.val=r/e,this._energy.val>=this._energy.peak?(this._energy.peak=this._energy.val,this._energy.hold=30):this._energy.hold>0?this._energy.hold--:this._energy.peak>0&&(this._energy.peak*=(30+this._energy.hold--)/30),this._runId=requestAnimationFrame(s=>this._analyze())}toggleAnalyzer(e=void 0){const n=this.isOn;return e===void 0&&(e=!n),n&&!e&&this._runId!==void 0?cancelAnimationFrame(this._runId):!n&&e&&(this._runId=requestAnimationFrame(i=>this._analyze())),this.isOn}getEnergy(e="overall"){if(e==="overall")return this._energy.val;if(e=="peak")return this._energy.peak;const n={bass:[20,250],lowMid:[250,500],mid:[500,2e3],highMid:[2e3,4e3],treble:[4e3,16e3]},[i,r]=n[e],s=this._freqToBin(i),o=r?this._freqToBin(r):s;let a=0;for(let l=s;l<=o;l++)a+=this._fftData[l];return a/(o-s+1)/1/255}connectInput(e){if(!e.connect)throw new Error("Audio source must be an instance of AudioNode");this._sources.includes(e)||(e.connect(this._input),this._sources.push(e))}disconnectInputs(){for(const e of Array.from(this._sources)){const n=this._sources.indexOf(e);n>=0&&(e.disconnect(this._input),this._sources.splice(n,1))}}}function jL(t,e){const n=t.createScriptProcessor(e.length,1,1);return n.onaudioprocess=i=>{i.inputBuffer.copyFromChannel(e,0)},n}function pie(t,e){e%2===0&&(e-=1);const n=new Float32Array(e),i=(e-1)/2|0;for(let l=0;l<=i;l++){const c=.53836+.46164*Math.cos(l*Math.PI/(i+1));if(l%2===1){const d=2/Math.PI/l;n[i+l]=c*d,n[i-l]=c*-d}}const r=t.createBuffer(2,e,t.sampleRate);r.copyToChannel(n,0),r.copyToChannel(n,1);const s=t.createConvolver();s.normalize=!1,s.buffer=r;const o=i/t.sampleRate,a=t.createDelay(o);return a.delayTime.value=o,[a,s]}class PB{constructor(e,n=void 0,i=512,r=1024){ot(this,"_audioCtx");ot(this,"timeSamples");ot(this,"quadSamples");ot(this,"_sources");ot(this,"_inputs");ot(this,"volume",1);n===void 0?this._audioCtx=new window.AudioContext:this._audioCtx=n,this.timeSamples=new Float32Array(i),this.quadSamples=new Float32Array(i);const[s,o]=pie(this._audioCtx,r-i);this._inputs=[s,o];const a=jL(this._audioCtx,this.timeSamples),l=jL(this._audioCtx,this.quadSamples),c=this._audioCtx.createMediaElementSource(e);this._sources=[],this.connectInput(c),o.connect(a),s.connect(l),a.connect(this._audioCtx.destination),l.connect(this._audioCtx.destination),c.connect(this._audioCtx.destination)}disconnectInputs(){for(const e of Array.from(this._sources)){const n=this._sources.indexOf(e);if(n>=0){for(const i of this._inputs)e.disconnect(i);this._sources.splice(n,1)}}}connectInput(e){if(!e.connect)throw new Error("Audio source must be an instance of AudioNode");if(!this._sources.includes(e)){for(const n of this._inputs)e.connect(n);this._sources.push(e)}}}const mie=({analyzer:t})=>{const{textureMapper:e}=Ux(),{setMappers:n}=Os(),i=b.useRef(null),r=b.useCallback(()=>{const s=e.samplesX,o=e.samplesY,a=t.quadSamples.length;if(s.length!==a||o.length!==a){console.log(`Resizing ${a}`),n({textureMapper:e.clone({size:a})});return}t.timeSamples.forEach((l,c)=>{s[c]=l}),t.quadSamples.forEach((l,c)=>{o[c]=l})},[t,n,e]);return b.useEffect(()=>{i.current&&cancelAnimationFrame(i.current);const s=()=>{r(),i.current=requestAnimationFrame(s)};return i.current=requestAnimationFrame(s),()=>cancelAnimationFrame(i.current)},[e,r]),P.jsx(P.Fragment,{})},gie=()=>{const t=r3(),e=i3();return{audio:e,analyzer:new PB(e,t)}},vie=t=>{const e=r3(),n=i3();return{audio:n,analyzer:new CB(n,e,t)}},yie=({audio:t,analyzer:e})=>{const{onDisabled:n,onStreamCreated:i}=TB(t,e);return P.jsx(uie,{audio:t,onDisabled:n,onStreamCreated:i})},xie=({audio:t,analyzer:e})=>{const{onDisabled:n,onStreamCreated:i}=TB(t,e);return P.jsx(die,{audio:t,onDisabled:n,onStreamCreated:i})},_ie=t=>{switch(t){case Gn.MICROPHONE:case Gn.SCREEN_SHARE:return!0;case Gn.SOUNDCLOUD:case Gn.FILE_UPLOAD:return!1;default:return t}},Sie=({mode:t,audioSource:e})=>{const{audio:n,analyzer:i}=b.useMemo(()=>{switch(t){case je.AUDIO:return vie(_ie(e)?0:1);case je.AUDIO_SCOPE:return gie();default:return t}},[t,e]);return P.jsxs(P.Fragment,{children:[e===Gn.MICROPHONE?P.jsx(yie,{audio:n,analyzer:i}):e===Gn.SCREEN_SHARE?P.jsx(xie,{audio:n,analyzer:i}):e===Gn.SOUNDCLOUD||e===Gn.FILE_UPLOAD?P.jsx(cie,{audio:n,audioSource:e}):e,i instanceof CB?P.jsx(hte,{analyzer:i}):i instanceof PB?P.jsx(mie,{analyzer:i}):i]})},wie=({mode:t})=>{const{source:e}=hT();return P.jsx(Sie,{mode:t,audioSource:e})};var RB={exports:{}},vu={};/** + * @license React + * react-reconciler-constants.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */vu.ConcurrentRoot=1;vu.ContinuousEventPriority=4;vu.DefaultEventPriority=16;vu.DiscreteEventPriority=1;vu.IdleEventPriority=536870912;vu.LegacyRoot=0;RB.exports=vu;var Cd=RB.exports;function Mie(t){let e;const n=new Set,i=(c,d)=>{const h=typeof c=="function"?c(e):c;if(h!==e){const p=e;e=d?h:Object.assign({},e,h),n.forEach(g=>g(e,p))}},r=()=>e,s=(c,d=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=d(e);function g(){const v=d(e);if(!h(p,v)){const _=p;c(p=v,_)}}return n.add(g),()=>n.delete(g)},l={setState:i,getState:r,subscribe:(c,d,h)=>d||h?s(c,d,h):(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return e=t(i,r,l),l}const Eie=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),XL=Eie?b.useEffect:b.useLayoutEffect;function bie(t){const e=typeof t=="function"?Mie(t):t,n=(i=e.getState,r=Object.is)=>{const[,s]=b.useReducer(y=>y+1,0),o=e.getState(),a=b.useRef(o),l=b.useRef(i),c=b.useRef(r),d=b.useRef(!1),h=b.useRef();h.current===void 0&&(h.current=i(o));let p,g=!1;(a.current!==o||l.current!==i||c.current!==r||d.current)&&(p=i(o),g=!r(h.current,p)),XL(()=>{g&&(h.current=p),a.current=o,l.current=i,c.current=r,d.current=!1});const v=b.useRef(o);XL(()=>{const y=()=>{try{const w=e.getState(),S=l.current(w);c.current(h.current,S)||(a.current=w,h.current=S,s())}catch{d.current=!0,s()}},m=e.subscribe(y);return e.getState()!==v.current&&y(),m},[]);const _=g?p:h.current;return b.useDebugValue(_),_};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[n,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},n}const Tie=t=>typeof t=="object"&&typeof t.then=="function",Rc=[];function IB(t,e,n=(i,r)=>i===r){if(t===e)return!0;if(!t||!e)return!1;const i=t.length;if(e.length!==i)return!1;for(let r=0;r0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!n)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=Rc.indexOf(r);s!==-1&&Rc.splice(s,1)},promise:(Tie(t)?t:t(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(Rc.push(r),!n)throw r.promise}const Aie=(t,e,n)=>LB(t,e,!1,n),Cie=(t,e,n)=>void LB(t,e,!0,n),Pie=t=>{if(t===void 0||t.length===0)Rc.splice(0,Rc.length);else{const e=Rc.find(n=>IB(t,n.keys,n.equal));e&&e.remove()}};var DB={exports:{}},NB={exports:{}},OB={};/** + * @license React + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */(function(t){function e(k,W){var $=k.length;k.push(W);e:for(;0<$;){var Q=$-1>>>1,de=k[Q];if(0>>1;Qr(he,$))Eer(me,he)?(k[Q]=me,k[Ee]=$,Q=Ee):(k[Q]=he,k[ie]=$,Q=ie);else if(Eer(me,$))k[Q]=me,k[Ee]=$,Q=Ee;else break e}}return W}function r(k,W){var $=k.sortIndex-W.sortIndex;return $!==0?$:k.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,h=null,p=3,g=!1,v=!1,_=!1,y=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(k){for(var W=n(c);W!==null;){if(W.callback===null)i(c);else if(W.startTime<=k)i(c),W.sortIndex=W.expirationTime,e(l,W);else break;W=n(c)}}function E(k){if(_=!1,S(k),!v)if(n(l)!==null)v=!0,Y(C);else{var W=n(c);W!==null&&J(E,W.startTime-k)}}function C(k,W){v=!1,_&&(_=!1,m(N),N=-1),g=!0;var $=p;try{for(S(W),h=n(l);h!==null&&(!(h.expirationTime>W)||k&&!D());){var Q=h.callback;if(typeof Q=="function"){h.callback=null,p=h.priorityLevel;var de=Q(h.expirationTime<=W);W=t.unstable_now(),typeof de=="function"?h.callback=de:h===n(l)&&i(l),S(W)}else i(l);h=n(l)}if(h!==null)var be=!0;else{var ie=n(c);ie!==null&&J(E,ie.startTime-W),be=!1}return be}finally{h=null,p=$,g=!1}}var R=!1,I=null,N=-1,F=5,A=-1;function D(){return!(t.unstable_now()-Ak||125Q?(k.sortIndex=$,e(c,k),n(l)===null&&k===n(c)&&(_?(m(N),N=-1):_=!0,J(E,$-Q))):(k.sortIndex=de,e(l,k),v||g||(v=!0,Y(C))),k},t.unstable_shouldYield=D,t.unstable_wrapCallback=function(k){var W=p;return function(){var $=p;p=W;try{return k.apply(this,arguments)}finally{p=$}}}})(OB);NB.exports=OB;var zE=NB.exports;/** + * @license React + * react-reconciler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Rie=function(e){var n={},i=b,r=zE,s=Object.assign;function o(u){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+u,x=1;xee||T[G]!==L[ee]){var pe=` +`+T[G].replace(" at new "," at ");return u.displayName&&pe.includes("")&&(pe=pe.replace("",u.displayName)),pe}while(1<=G&&0<=ee);break}}}finally{bt=!1,Error.prepareStackTrace=x}return(u=u?u.displayName||u.name:"")?At(u):""}var Tn=Object.prototype.hasOwnProperty,xi=[],yn=-1;function ci(u){return{current:u}}function xt(u){0>yn||(u.current=xi[yn],xi[yn]=null,yn--)}function Qe(u,f){yn++,xi[yn]=u.current,u.current=f}var Xr={},Wt=ci(Xr),On=ci(!1),Gs=Xr;function qr(u,f){var x=u.type.contextTypes;if(!x)return Xr;var M=u.stateNode;if(M&&M.__reactInternalMemoizedUnmaskedChildContext===f)return M.__reactInternalMemoizedMaskedChildContext;var T={},L;for(L in x)T[L]=f[L];return M&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=f,u.__reactInternalMemoizedMaskedChildContext=T),T}function ui(u){return u=u.childContextTypes,u!=null}function jn(){xt(On),xt(Wt)}function js(u,f,x){if(Wt.current!==Xr)throw Error(o(168));Qe(Wt,f),Qe(On,x)}function _u(u,f,x){var M=u.stateNode;if(f=f.childContextTypes,typeof M.getChildContext!="function")return x;M=M.getChildContext();for(var T in M)if(!(T in f))throw Error(o(108,N(u)||"Unknown",T));return s({},x,M)}function _i(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||Xr,Gs=Wt.current,Qe(Wt,u),Qe(On,On.current),!0}function Su(u,f,x){var M=u.stateNode;if(!M)throw Error(o(169));x?(u=_u(u,f,Gs),M.__reactInternalMemoizedMergedChildContext=u,xt(On),xt(Wt),Qe(Wt,u)):xt(On),Qe(On,x)}var Er=Math.clz32?Math.clz32:LH,fg=Math.log,IH=Math.LN2;function LH(u){return u>>>=0,u===0?32:31-(fg(u)/IH|0)|0}var hg=64,pg=4194304;function eh(u){switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return u&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return u&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return u}}function mg(u,f){var x=u.pendingLanes;if(x===0)return 0;var M=0,T=u.suspendedLanes,L=u.pingedLanes,G=x&268435455;if(G!==0){var ee=G&~T;ee!==0?M=eh(ee):(L&=G,L!==0&&(M=eh(L)))}else G=x&~T,G!==0?M=eh(G):L!==0&&(M=eh(L));if(M===0)return 0;if(f!==0&&f!==M&&!(f&T)&&(T=M&-M,L=f&-f,T>=L||T===16&&(L&4194240)!==0))return f;if(M&4&&(M|=x&16),f=u.entangledLanes,f!==0)for(u=u.entanglements,f&=M;0x;x++)f.push(u);return f}function th(u,f,x){u.pendingLanes|=f,f!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,f=31-Er(f),u[f]=x}function OH(u,f){var x=u.pendingLanes&~f;u.pendingLanes=f,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=f,u.mutableReadLanes&=f,u.entangledLanes&=f,f=u.entanglements;var M=u.eventTimes;for(u=u.expirationTimes;0>=G,T-=G,Lo=1<<32-Er(f)+T|x<nn?(hi=Lt,Lt=null):hi=Lt.sibling;var rn=pt(oe,Lt,ue[nn],We);if(rn===null){Lt===null&&(Lt=hi);break}u&&Lt&&rn.alternate===null&&f(oe,Lt),ne=L(rn,ne,nn),zt===null?at=rn:zt.sibling=rn,zt=rn,Lt=hi}if(nn===ue.length)return x(oe,Lt),Mn&&ql(oe,nn),at;if(Lt===null){for(;nnnn?(hi=Lt,Lt=null):hi=Lt.sibling;var Ra=pt(oe,Lt,rn.value,We);if(Ra===null){Lt===null&&(Lt=hi);break}u&&Lt&&Ra.alternate===null&&f(oe,Lt),ne=L(Ra,ne,nn),zt===null?at=Ra:zt.sibling=Ra,zt=Ra,Lt=hi}if(rn.done)return x(oe,Lt),Mn&&ql(oe,nn),at;if(Lt===null){for(;!rn.done;nn++,rn=ue.next())rn=It(oe,rn.value,We),rn!==null&&(ne=L(rn,ne,nn),zt===null?at=rn:zt.sibling=rn,zt=rn);return Mn&&ql(oe,nn),at}for(Lt=M(oe,Lt);!rn.done;nn++,rn=ue.next())rn=hn(Lt,oe,nn,rn.value,We),rn!==null&&(u&&rn.alternate!==null&&Lt.delete(rn.key===null?nn:rn.key),ne=L(rn,ne,nn),zt===null?at=rn:zt.sibling=rn,zt=rn);return u&&Lt.forEach(function(_W){return f(oe,_W)}),Mn&&ql(oe,nn),at}function ts(oe,ne,ue,We){if(typeof ue=="object"&&ue!==null&&ue.type===d&&ue.key===null&&(ue=ue.props.children),typeof ue=="object"&&ue!==null){switch(ue.$$typeof){case l:e:{for(var at=ue.key,zt=ne;zt!==null;){if(zt.key===at){if(at=ue.type,at===d){if(zt.tag===7){x(oe,zt.sibling),ne=T(zt,ue.props.children),ne.return=oe,oe=ne;break e}}else if(zt.elementType===at||typeof at=="object"&&at!==null&&at.$$typeof===S&&HC(at)===zt.type){x(oe,zt.sibling),ne=T(zt,ue.props),ne.ref=rh(oe,zt,ue),ne.return=oe,oe=ne;break e}x(oe,zt);break}else f(oe,zt);zt=zt.sibling}ue.type===d?(ne=ec(ue.props.children,oe.mode,We,ue.key),ne.return=oe,oe=ne):(We=iv(ue.type,ue.key,ue.props,null,oe.mode,We),We.ref=rh(oe,ne,ue),We.return=oe,oe=We)}return G(oe);case c:e:{for(zt=ue.key;ne!==null;){if(ne.key===zt)if(ne.tag===4&&ne.stateNode.containerInfo===ue.containerInfo&&ne.stateNode.implementation===ue.implementation){x(oe,ne.sibling),ne=T(ne,ue.children||[]),ne.return=oe,oe=ne;break e}else{x(oe,ne);break}else f(oe,ne);ne=ne.sibling}ne=NS(ue,oe.mode,We),ne.return=oe,oe=ne}return G(oe);case S:return zt=ue._init,ts(oe,ne,zt(ue._payload),We)}if(Z(ue))return ut(oe,ne,ue,We);if(R(ue))return Li(oe,ne,ue,We);Tg(oe,ue)}return typeof ue=="string"&&ue!==""||typeof ue=="number"?(ue=""+ue,ne!==null&&ne.tag===6?(x(oe,ne.sibling),ne=T(ne,ue),ne.return=oe,oe=ne):(x(oe,ne),ne=DS(ue,oe.mode,We),ne.return=oe,oe=ne),G(oe)):x(oe,ne)}return ts}var Au=WC(!0),GC=WC(!1),sh={},Kr=ci(sh),oh=ci(sh),Cu=ci(sh);function Zs(u){if(u===sh)throw Error(o(174));return u}function K_(u,f){Qe(Cu,f),Qe(oh,u),Qe(Kr,sh),u=J(f),xt(Kr),Qe(Kr,u)}function Pu(){xt(Kr),xt(oh),xt(Cu)}function jC(u){var f=Zs(Cu.current),x=Zs(Kr.current);f=k(x,u.type,f),x!==f&&(Qe(oh,u),Qe(Kr,f))}function Q_(u){oh.current===u&&(xt(Kr),xt(oh))}var An=ci(0);function Ag(u){for(var f=u;f!==null;){if(f.tag===13){var x=f.memoizedState;if(x!==null&&(x=x.dehydrated,x===null||Qf(x)||Jf(x)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===u)break;for(;f.sibling===null;){if(f.return===null||f.return===u)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var J_=[];function eS(){for(var u=0;ux?x:4,u(!0);var M=Qr.transition;Qr.transition={};try{u(!1),f()}finally{tn=x,Qr.transition=M}}function sP(){return Ks().memoizedState}function qH(u,f,x){var M=Aa(u);x={lane:M,action:x,hasEagerState:!1,eagerState:null,next:null},oP(u)?aP(f,x):(lP(u,f,x),x=Zi(),u=Jr(u,M,x),u!==null&&cP(u,f,M))}function $H(u,f,x){var M=Aa(u),T={lane:M,action:x,hasEagerState:!1,eagerState:null,next:null};if(oP(u))aP(f,T);else{lP(u,f,T);var L=u.alternate;if(u.lanes===0&&(L===null||L.lanes===0)&&(L=f.lastRenderedReducer,L!==null))try{var G=f.lastRenderedState,ee=L(G,x);if(T.hasEagerState=!0,T.eagerState=ee,qs(ee,G))return}catch{}finally{}x=Zi(),u=Jr(u,M,x),u!==null&&cP(u,f,M)}}function oP(u){var f=u.alternate;return u===kn||f!==null&&f===kn}function aP(u,f){ah=Pg=!0;var x=u.pending;x===null?f.next=f:(f.next=x.next,x.next=f),u.pending=f}function lP(u,f,x){Kn!==null&&u.mode&1&&!(Gt&2)?(u=f.interleaved,u===null?(x.next=x,Ys===null?Ys=[f]:Ys.push(f)):(x.next=u.next,u.next=x),f.interleaved=x):(u=f.pending,u===null?x.next=x:(x.next=u.next,u.next=x),f.pending=x)}function cP(u,f,x){if(x&4194240){var M=f.lanes;M&=u.pendingLanes,x|=M,f.lanes=x,N_(u,x)}}var Ng={readContext:$r,useCallback:Ri,useContext:Ri,useEffect:Ri,useImperativeHandle:Ri,useInsertionEffect:Ri,useLayoutEffect:Ri,useMemo:Ri,useReducer:Ri,useRef:Ri,useState:Ri,useDebugValue:Ri,useDeferredValue:Ri,useTransition:Ri,useMutableSource:Ri,useSyncExternalStore:Ri,useId:Ri,unstable_isNewReconciler:!1},YH={readContext:$r,useCallback:function(u,f){return No().memoizedState=[u,f===void 0?null:f],u},useContext:$r,useEffect:sS,useImperativeHandle:function(u,f,x){return x=x!=null?x.concat([u]):null,Lg(4194308,4,tP.bind(null,f,u),x)},useLayoutEffect:function(u,f){return Lg(4194308,4,u,f)},useInsertionEffect:function(u,f){return Lg(4,2,u,f)},useMemo:function(u,f){var x=No();return f=f===void 0?null:f,u=u(),x.memoizedState=[u,f],u},useReducer:function(u,f,x){var M=No();return f=x!==void 0?x(f):f,M.memoizedState=M.baseState=f,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:f},M.queue=u,u=u.dispatch=qH.bind(null,kn,u),[M.memoizedState,u]},useRef:function(u){var f=No();return u={current:u},f.memoizedState=u},useState:rS,useDebugValue:oS,useDeferredValue:function(u){var f=rS(u),x=f[0],M=f[1];return sS(function(){var T=Qr.transition;Qr.transition={};try{M(u)}finally{Qr.transition=T}},[u]),x},useTransition:function(){var u=rS(!1),f=u[0];return u=XH.bind(null,u[1]),No().memoizedState=u,[f,u]},useMutableSource:function(){},useSyncExternalStore:function(u,f,x){var M=kn,T=No();if(Mn){if(x===void 0)throw Error(o(407));x=x()}else{if(x=f(),Kn===null)throw Error(o(349));Ru&30||$C(M,f,x)}T.memoizedState=x;var L={value:x,getSnapshot:f};return T.queue=L,sS(ZC.bind(null,M,L,u),[u]),M.flags|=2048,ch(9,YC.bind(null,M,L,x,f),void 0,null),x},useId:function(){var u=No(),f=Kn.identifierPrefix;if(Mn){var x=Do,M=Lo;x=(M&~(1<<32-Er(M)-1)).toString(32)+x,f=":"+f+"R"+x,x=lh++,0bS&&(f.flags|=128,M=!0,hh(T,!1),f.lanes=4194304)}else{if(!M)if(u=Ag(L),u!==null){if(f.flags|=128,M=!0,u=u.updateQueue,u!==null&&(f.updateQueue=u,f.flags|=4),hh(T,!0),T.tail===null&&T.tailMode==="hidden"&&!L.alternate&&!Mn)return Ii(f),null}else 2*di()-T.renderingStartTime>bS&&x!==1073741824&&(f.flags|=128,M=!0,hh(T,!1),f.lanes=4194304);T.isBackwards?(L.sibling=f.child,f.child=L):(u=T.last,u!==null?u.sibling=L:f.child=L,T.last=L)}return T.tail!==null?(f=T.tail,T.rendering=f,T.tail=f.sibling,T.renderingStartTime=di(),f.sibling=null,u=An.current,Qe(An,M?u&1|2:u&1),f):(Ii(f),null);case 22:case 23:return RS(),M=f.memoizedState!==null,u!==null&&u.memoizedState!==null!==M&&(f.flags|=8192),M&&f.mode&1?Cr&1073741824&&(Ii(f),Ae&&f.subtreeFlags&6&&(f.flags|=8192)):Ii(f),null;case 24:return null;case 25:return null}throw Error(o(156,f.tag))}var eW=a.ReactCurrentOwner,Ar=!1;function Yi(u,f,x,M){f.child=u===null?GC(f,null,x,M):Au(f,u.child,x,M)}function vP(u,f,x,M,T){x=x.render;var L=f.ref;return Mu(f,T),M=nS(u,f,x,M,L,T),x=iS(),u!==null&&!Ar?(f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~T,Oo(u,f,T)):(Mn&&x&&X_(f),f.flags|=1,Yi(u,f,M,T),f.child)}function yP(u,f,x,M,T){if(u===null){var L=x.type;return typeof L=="function"&&!LS(L)&&L.defaultProps===void 0&&x.compare===null&&x.defaultProps===void 0?(f.tag=15,f.type=L,xP(u,f,L,M,T)):(u=iv(x.type,null,M,f,f.mode,T),u.ref=f.ref,u.return=f,f.child=u)}if(L=u.child,!(u.lanes&T)){var G=L.memoizedProps;if(x=x.compare,x=x!==null?x:yg,x(G,M)&&u.ref===f.ref)return Oo(u,f,T)}return f.flags|=1,u=Pa(L,M),u.ref=f.ref,u.return=f,f.child=u}function xP(u,f,x,M,T){if(u!==null&&yg(u.memoizedProps,M)&&u.ref===f.ref)if(Ar=!1,(u.lanes&T)!==0)u.flags&131072&&(Ar=!0);else return f.lanes=u.lanes,Oo(u,f,T);return cS(u,f,x,M,T)}function _P(u,f,x){var M=f.pendingProps,T=M.children,L=u!==null?u.memoizedState:null;if(M.mode==="hidden")if(!(f.mode&1))f.memoizedState={baseLanes:0,cachePool:null},Qe(Iu,Cr),Cr|=x;else if(x&1073741824)f.memoizedState={baseLanes:0,cachePool:null},M=L!==null?L.baseLanes:x,Qe(Iu,Cr),Cr|=M;else return u=L!==null?L.baseLanes|x:x,f.lanes=f.childLanes=1073741824,f.memoizedState={baseLanes:u,cachePool:null},f.updateQueue=null,Qe(Iu,Cr),Cr|=u,null;else L!==null?(M=L.baseLanes|x,f.memoizedState=null):M=x,Qe(Iu,Cr),Cr|=M;return Yi(u,f,T,x),f.child}function SP(u,f){var x=f.ref;(u===null&&x!==null||u!==null&&u.ref!==x)&&(f.flags|=512,f.flags|=2097152)}function cS(u,f,x,M,T){var L=ui(x)?Gs:Wt.current;return L=qr(f,L),Mu(f,T),x=nS(u,f,x,M,L,T),M=iS(),u!==null&&!Ar?(f.updateQueue=u.updateQueue,f.flags&=-2053,u.lanes&=~T,Oo(u,f,T)):(Mn&&M&&X_(f),f.flags|=1,Yi(u,f,x,T),f.child)}function wP(u,f,x,M,T){if(ui(x)){var L=!0;_i(f)}else L=!1;if(Mu(f,T),f.stateNode===null)u!==null&&(u.alternate=null,f.alternate=null,f.flags|=2),kC(f,x,M),j_(f,x,M,T),M=!0;else if(u===null){var G=f.stateNode,ee=f.memoizedProps;G.props=ee;var pe=G.context,Ne=x.contextType;typeof Ne=="object"&&Ne!==null?Ne=$r(Ne):(Ne=ui(x)?Gs:Wt.current,Ne=qr(f,Ne));var Je=x.getDerivedStateFromProps,It=typeof Je=="function"||typeof G.getSnapshotBeforeUpdate=="function";It||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(ee!==M||pe!==Ne)&&FC(f,G,M,Ne),Ma=!1;var pt=f.memoizedState;G.state=pt,wg(f,M,G,T),pe=f.memoizedState,ee!==M||pt!==pe||On.current||Ma?(typeof Je=="function"&&(G_(f,x,Je,M),pe=f.memoizedState),(ee=Ma||OC(f,x,ee,M,pt,pe,Ne))?(It||typeof G.UNSAFE_componentWillMount!="function"&&typeof G.componentWillMount!="function"||(typeof G.componentWillMount=="function"&&G.componentWillMount(),typeof G.UNSAFE_componentWillMount=="function"&&G.UNSAFE_componentWillMount()),typeof G.componentDidMount=="function"&&(f.flags|=4194308)):(typeof G.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=M,f.memoizedState=pe),G.props=M,G.state=pe,G.context=Ne,M=ee):(typeof G.componentDidMount=="function"&&(f.flags|=4194308),M=!1)}else{G=f.stateNode,IC(u,f),ee=f.memoizedProps,Ne=f.type===f.elementType?ee:ms(f.type,ee),G.props=Ne,It=f.pendingProps,pt=G.context,pe=x.contextType,typeof pe=="object"&&pe!==null?pe=$r(pe):(pe=ui(x)?Gs:Wt.current,pe=qr(f,pe));var hn=x.getDerivedStateFromProps;(Je=typeof hn=="function"||typeof G.getSnapshotBeforeUpdate=="function")||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(ee!==It||pt!==pe)&&FC(f,G,M,pe),Ma=!1,pt=f.memoizedState,G.state=pt,wg(f,M,G,T);var ut=f.memoizedState;ee!==It||pt!==ut||On.current||Ma?(typeof hn=="function"&&(G_(f,x,hn,M),ut=f.memoizedState),(Ne=Ma||OC(f,x,Ne,M,pt,ut,pe)||!1)?(Je||typeof G.UNSAFE_componentWillUpdate!="function"&&typeof G.componentWillUpdate!="function"||(typeof G.componentWillUpdate=="function"&&G.componentWillUpdate(M,ut,pe),typeof G.UNSAFE_componentWillUpdate=="function"&&G.UNSAFE_componentWillUpdate(M,ut,pe)),typeof G.componentDidUpdate=="function"&&(f.flags|=4),typeof G.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof G.componentDidUpdate!="function"||ee===u.memoizedProps&&pt===u.memoizedState||(f.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||ee===u.memoizedProps&&pt===u.memoizedState||(f.flags|=1024),f.memoizedProps=M,f.memoizedState=ut),G.props=M,G.state=ut,G.context=pe,M=Ne):(typeof G.componentDidUpdate!="function"||ee===u.memoizedProps&&pt===u.memoizedState||(f.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||ee===u.memoizedProps&&pt===u.memoizedState||(f.flags|=1024),M=!1)}return uS(u,f,x,M,L,T)}function uS(u,f,x,M,T,L){SP(u,f);var G=(f.flags&128)!==0;if(!M&&!G)return T&&Su(f,x,!1),Oo(u,f,L);M=f.stateNode,eW.current=f;var ee=G&&typeof x.getDerivedStateFromError!="function"?null:M.render();return f.flags|=1,u!==null&&G?(f.child=Au(f,u.child,null,L),f.child=Au(f,null,ee,L)):Yi(u,f,ee,L),f.memoizedState=M.state,T&&Su(f,x,!0),f.child}function MP(u){var f=u.stateNode;f.pendingContext?js(u,f.pendingContext,f.pendingContext!==f.context):f.context&&js(u,f.context,!1),K_(u,f.containerInfo)}function EP(u,f,x,M,T){return Tu(),Z_(T),f.flags|=256,Yi(u,f,x,M),f.child}var Fg={dehydrated:null,treeContext:null,retryLane:0};function Ug(u){return{baseLanes:u,cachePool:null}}function bP(u,f,x){var M=f.pendingProps,T=An.current,L=!1,G=(f.flags&128)!==0,ee;if((ee=G)||(ee=u!==null&&u.memoizedState===null?!1:(T&2)!==0),ee?(L=!0,f.flags&=-129):(u===null||u.memoizedState!==null)&&(T|=1),Qe(An,T&1),u===null)return Y_(f),u=f.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?(f.mode&1?Jf(u)?f.lanes=8:f.lanes=1073741824:f.lanes=1,null):(T=M.children,u=M.fallback,L?(M=f.mode,L=f.child,T={mode:"hidden",children:T},!(M&1)&&L!==null?(L.childLanes=0,L.pendingProps=T):L=rv(T,M,0,null),u=ec(u,M,x,null),L.return=f,u.return=f,L.sibling=u,f.child=L,f.child.memoizedState=Ug(x),f.memoizedState=Fg,u):dS(f,T));if(T=u.memoizedState,T!==null){if(ee=T.dehydrated,ee!==null){if(G)return f.flags&256?(f.flags&=-257,zg(u,f,x,Error(o(422)))):f.memoizedState!==null?(f.child=u.child,f.flags|=128,null):(L=M.fallback,T=f.mode,M=rv({mode:"visible",children:M.children},T,0,null),L=ec(L,T,x,null),L.flags|=2,M.return=f,L.return=f,M.sibling=L,f.child=M,f.mode&1&&Au(f,u.child,null,x),f.child.memoizedState=Ug(x),f.memoizedState=Fg,L);if(!(f.mode&1))f=zg(u,f,x,null);else if(Jf(ee))f=zg(u,f,x,Error(o(419)));else if(M=(x&u.childLanes)!==0,Ar||M){if(M=Kn,M!==null){switch(x&-x){case 4:L=2;break;case 16:L=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:L=32;break;case 536870912:L=268435456;break;default:L=0}M=L&(M.suspendedLanes|x)?0:L,M!==0&&M!==T.retryLane&&(T.retryLane=M,Jr(u,M,-1))}IS(),f=zg(u,f,x,Error(o(421)))}else Qf(ee)?(f.flags|=128,f.child=u.child,f=hW.bind(null,u),yu(ee,f),f=null):(x=T.treeContext,xe&&(Tr=dg(ee),br=f,Mn=!0,gs=null,nh=!1,x!==null&&(Yr[Zr++]=Lo,Yr[Zr++]=Do,Yr[Zr++]=Xl,Lo=x.id,Do=x.overflow,Xl=f)),f=dS(f,f.pendingProps.children),f.flags|=4096);return f}return L?(M=AP(u,f,M.children,M.fallback,x),L=f.child,T=u.child.memoizedState,L.memoizedState=T===null?Ug(x):{baseLanes:T.baseLanes|x,cachePool:null},L.childLanes=u.childLanes&~x,f.memoizedState=Fg,M):(x=TP(u,f,M.children,x),f.memoizedState=null,x)}return L?(M=AP(u,f,M.children,M.fallback,x),L=f.child,T=u.child.memoizedState,L.memoizedState=T===null?Ug(x):{baseLanes:T.baseLanes|x,cachePool:null},L.childLanes=u.childLanes&~x,f.memoizedState=Fg,M):(x=TP(u,f,M.children,x),f.memoizedState=null,x)}function dS(u,f){return f=rv({mode:"visible",children:f},u.mode,0,null),f.return=u,u.child=f}function TP(u,f,x,M){var T=u.child;return u=T.sibling,x=Pa(T,{mode:"visible",children:x}),!(f.mode&1)&&(x.lanes=M),x.return=f,x.sibling=null,u!==null&&(M=f.deletions,M===null?(f.deletions=[u],f.flags|=16):M.push(u)),f.child=x}function AP(u,f,x,M,T){var L=f.mode;u=u.child;var G=u.sibling,ee={mode:"hidden",children:x};return!(L&1)&&f.child!==u?(x=f.child,x.childLanes=0,x.pendingProps=ee,f.deletions=null):(x=Pa(u,ee),x.subtreeFlags=u.subtreeFlags&14680064),G!==null?M=Pa(G,M):(M=ec(M,L,T,null),M.flags|=2),M.return=f,x.return=f,x.sibling=M,f.child=x,M}function zg(u,f,x,M){return M!==null&&Z_(M),Au(f,u.child,null,x),u=dS(f,f.pendingProps.children),u.flags|=2,f.memoizedState=null,u}function CP(u,f,x){u.lanes|=f;var M=u.alternate;M!==null&&(M.lanes|=f),H_(u.return,f,x)}function fS(u,f,x,M,T){var L=u.memoizedState;L===null?u.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:M,tail:x,tailMode:T}:(L.isBackwards=f,L.rendering=null,L.renderingStartTime=0,L.last=M,L.tail=x,L.tailMode=T)}function PP(u,f,x){var M=f.pendingProps,T=M.revealOrder,L=M.tail;if(Yi(u,f,M.children,x),M=An.current,M&2)M=M&1|2,f.flags|=128;else{if(u!==null&&u.flags&128)e:for(u=f.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&CP(u,x,f);else if(u.tag===19)CP(u,x,f);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===f)break e;for(;u.sibling===null;){if(u.return===null||u.return===f)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}M&=1}if(Qe(An,M),!(f.mode&1))f.memoizedState=null;else switch(T){case"forwards":for(x=f.child,T=null;x!==null;)u=x.alternate,u!==null&&Ag(u)===null&&(T=x),x=x.sibling;x=T,x===null?(T=f.child,f.child=null):(T=x.sibling,x.sibling=null),fS(f,!1,T,x,L);break;case"backwards":for(x=null,T=f.child,f.child=null;T!==null;){if(u=T.alternate,u!==null&&Ag(u)===null){f.child=T;break}u=T.sibling,T.sibling=x,x=T,T=u}fS(f,!0,x,null,L);break;case"together":fS(f,!1,null,null,void 0);break;default:f.memoizedState=null}return f.child}function Oo(u,f,x){if(u!==null&&(f.dependencies=u.dependencies),Lu|=f.lanes,!(x&f.childLanes))return null;if(u!==null&&f.child!==u.child)throw Error(o(153));if(f.child!==null){for(u=f.child,x=Pa(u,u.pendingProps),f.child=x,x.return=f;u.sibling!==null;)u=u.sibling,x=x.sibling=Pa(u,u.pendingProps),x.return=f;x.sibling=null}return f.child}function tW(u,f,x){switch(f.tag){case 3:MP(f),Tu();break;case 5:jC(f);break;case 1:ui(f.type)&&_i(f);break;case 4:K_(f,f.stateNode.containerInfo);break;case 10:RC(f,f.type._context,f.memoizedProps.value);break;case 13:var M=f.memoizedState;if(M!==null)return M.dehydrated!==null?(Qe(An,An.current&1),f.flags|=128,null):x&f.child.childLanes?bP(u,f,x):(Qe(An,An.current&1),u=Oo(u,f,x),u!==null?u.sibling:null);Qe(An,An.current&1);break;case 19:if(M=(x&f.childLanes)!==0,u.flags&128){if(M)return PP(u,f,x);f.flags|=128}var T=f.memoizedState;if(T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),Qe(An,An.current),M)break;return null;case 22:case 23:return f.lanes=0,_P(u,f,x)}return Oo(u,f,x)}function nW(u,f){switch(q_(f),f.tag){case 1:return ui(f.type)&&jn(),u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 3:return Pu(),xt(On),xt(Wt),eS(),u=f.flags,u&65536&&!(u&128)?(f.flags=u&-65537|128,f):null;case 5:return Q_(f),null;case 13:if(xt(An),u=f.memoizedState,u!==null&&u.dehydrated!==null){if(f.alternate===null)throw Error(o(340));Tu()}return u=f.flags,u&65536?(f.flags=u&-65537|128,f):null;case 19:return xt(An),null;case 4:return Pu(),null;case 10:return V_(f.type._context),null;case 22:case 23:return RS(),null;case 24:return null;default:return null}}var Bg=!1,Yl=!1,iW=typeof WeakSet=="function"?WeakSet:Set,He=null;function Vg(u,f){var x=u.ref;if(x!==null)if(typeof x=="function")try{x(null)}catch(M){fr(u,f,M)}else x.current=null}function hS(u,f,x){try{x()}catch(M){fr(u,f,M)}}var RP=!1;function rW(u,f){for(W(u.containerInfo),He=f;He!==null;)if(u=He,f=u.child,(u.subtreeFlags&1028)!==0&&f!==null)f.return=u,He=f;else for(;He!==null;){u=He;try{var x=u.alternate;if(u.flags&1024)switch(u.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var M=x.memoizedProps,T=x.memoizedState,L=u.stateNode,G=L.getSnapshotBeforeUpdate(u.elementType===u.type?M:ms(u.type,M),T);L.__reactInternalSnapshotBeforeUpdate=G}break;case 3:Ae&&ke(u.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ee){fr(u,u.return,ee)}if(f=u.sibling,f!==null){f.return=u.return,He=f;break}He=u.return}return x=RP,RP=!1,x}function Zl(u,f,x){var M=f.updateQueue;if(M=M!==null?M.lastEffect:null,M!==null){var T=M=M.next;do{if((T.tag&u)===u){var L=T.destroy;T.destroy=void 0,L!==void 0&&hS(f,x,L)}T=T.next}while(T!==M)}}function ph(u,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var x=f=f.next;do{if((x.tag&u)===u){var M=x.create;x.destroy=M()}x=x.next}while(x!==f)}}function pS(u){var f=u.ref;if(f!==null){var x=u.stateNode;switch(u.tag){case 5:u=Y(x);break;default:u=x}typeof f=="function"?f(u):f.current=u}}function IP(u,f,x){if(Xs&&typeof Xs.onCommitFiberUnmount=="function")try{Xs.onCommitFiberUnmount(gg,f)}catch{}switch(f.tag){case 0:case 11:case 14:case 15:if(u=f.updateQueue,u!==null&&(u=u.lastEffect,u!==null)){var M=u=u.next;do{var T=M,L=T.destroy;T=T.tag,L!==void 0&&(T&2||T&4)&&hS(f,x,L),M=M.next}while(M!==u)}break;case 1:if(Vg(f,x),u=f.stateNode,typeof u.componentWillUnmount=="function")try{u.props=f.memoizedProps,u.state=f.memoizedState,u.componentWillUnmount()}catch(G){fr(f,x,G)}break;case 5:Vg(f,x);break;case 4:Ae?FP(u,f,x):H&&H&&(f=f.stateNode.containerInfo,x=Xe(f),Yt(f,x))}}function LP(u,f,x){for(var M=f;;)if(IP(u,M,x),M.child===null||Ae&&M.tag===4){if(M===f)break;for(;M.sibling===null;){if(M.return===null||M.return===f)return;M=M.return}M.sibling.return=M.return,M=M.sibling}else M.child.return=M,M=M.child}function DP(u){var f=u.alternate;f!==null&&(u.alternate=null,DP(f)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(f=u.stateNode,f!==null&&qe(f)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function NP(u){return u.tag===5||u.tag===3||u.tag===4}function OP(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||NP(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function kP(u){if(Ae){e:{for(var f=u.return;f!==null;){if(NP(f))break e;f=f.return}throw Error(o(160))}var x=f;switch(x.tag){case 5:f=x.stateNode,x.flags&32&&(Be(f),x.flags&=-33),x=OP(u),gS(u,x,f);break;case 3:case 4:f=x.stateNode.containerInfo,x=OP(u),mS(u,x,f);break;default:throw Error(o(161))}}}function mS(u,f,x){var M=u.tag;if(M===5||M===6)u=u.stateNode,f?et(x,u,f):mt(x,u);else if(M!==4&&(u=u.child,u!==null))for(mS(u,f,x),u=u.sibling;u!==null;)mS(u,f,x),u=u.sibling}function gS(u,f,x){var M=u.tag;if(M===5||M===6)u=u.stateNode,f?ft(x,u,f):rt(x,u);else if(M!==4&&(u=u.child,u!==null))for(gS(u,f,x),u=u.sibling;u!==null;)gS(u,f,x),u=u.sibling}function FP(u,f,x){for(var M=f,T=!1,L,G;;){if(!T){T=M.return;e:for(;;){if(T===null)throw Error(o(160));switch(L=T.stateNode,T.tag){case 5:G=!1;break e;case 3:L=L.containerInfo,G=!0;break e;case 4:L=L.containerInfo,G=!0;break e}T=T.return}T=!0}if(M.tag===5||M.tag===6)LP(u,M,x),G?ve(L,M.stateNode):q(L,M.stateNode);else if(M.tag===18)G?ae(L,M.stateNode):ce(L,M.stateNode);else if(M.tag===4){if(M.child!==null){L=M.stateNode.containerInfo,G=!0,M.child.return=M,M=M.child;continue}}else if(IP(u,M,x),M.child!==null){M.child.return=M,M=M.child;continue}if(M===f)break;for(;M.sibling===null;){if(M.return===null||M.return===f)return;M=M.return,M.tag===4&&(T=!1)}M.sibling.return=M.return,M=M.sibling}}function vS(u,f){if(Ae){switch(f.tag){case 0:case 11:case 14:case 15:Zl(3,f,f.return),ph(3,f),Zl(5,f,f.return);return;case 1:return;case 5:var x=f.stateNode;if(x!=null){var M=f.memoizedProps;u=u!==null?u.memoizedProps:M;var T=f.type,L=f.updateQueue;f.updateQueue=null,L!==null&&wt(x,L,T,u,M,f)}return;case 6:if(f.stateNode===null)throw Error(o(162));x=f.memoizedProps,we(f.stateNode,u!==null?u.memoizedProps:x,x);return;case 3:xe&&u!==null&&u.memoizedState.isDehydrated&&se(f.stateNode.containerInfo);return;case 12:return;case 13:Hg(f);return;case 19:Hg(f);return;case 17:return}throw Error(o(163))}switch(f.tag){case 0:case 11:case 14:case 15:Zl(3,f,f.return),ph(3,f),Zl(5,f,f.return);return;case 12:return;case 13:Hg(f);return;case 19:Hg(f);return;case 3:xe&&u!==null&&u.memoizedState.isDehydrated&&se(f.stateNode.containerInfo);break;case 22:case 23:return}e:if(H){switch(f.tag){case 1:case 5:case 6:break e;case 3:case 4:f=f.stateNode,Yt(f.containerInfo,f.pendingChildren);break e}throw Error(o(163))}}function Hg(u){var f=u.updateQueue;if(f!==null){u.updateQueue=null;var x=u.stateNode;x===null&&(x=u.stateNode=new iW),f.forEach(function(M){var T=pW.bind(null,u,M);x.has(M)||(x.add(M),M.then(T,T))})}}function sW(u,f){for(He=f;He!==null;){f=He;var x=f.deletions;if(x!==null)for(var M=0;M";case Gg:return":has("+(_S(u)||"")+")";case jg:return'[role="'+u.value+'"]';case qg:return'"'+u.value+'"';case Xg:return'[data-testname="'+u.value+'"]';default:throw Error(o(365))}}function HP(u,f){var x=[];u=[u,0];for(var M=0;MT&&(T=G),M&=~L}if(M=T,M=di()-M,M=(120>M?120:480>M?480:1080>M?1080:1920>M?1920:3e3>M?3e3:4320>M?4320:1960*aW(M/1960))-M,10u?16:u,Ta===null)var M=!1;else{if(u=Ta,Ta=null,Qg=0,Gt&6)throw Error(o(331));var T=Gt;for(Gt|=4,He=u.current;He!==null;){var L=He,G=L.child;if(He.flags&16){var ee=L.deletions;if(ee!==null){for(var pe=0;pedi()-ES?Kl(u,0):MS|=x),dr(u,f)}function KP(u,f){f===0&&(u.mode&1?(f=pg,pg<<=1,!(pg&130023424)&&(pg=4194304)):f=1);var x=Zi();u=tv(u,f),u!==null&&(th(u,f,x),dr(u,x))}function hW(u){var f=u.memoizedState,x=0;f!==null&&(x=f.retryLane),KP(u,x)}function pW(u,f){var x=0;switch(u.tag){case 13:var M=u.stateNode,T=u.memoizedState;T!==null&&(x=T.retryLane);break;case 19:M=u.stateNode;break;default:throw Error(o(314))}M!==null&&M.delete(f),KP(u,x)}var QP;QP=function(u,f,x){if(u!==null)if(u.memoizedProps!==f.pendingProps||On.current)Ar=!0;else{if(!(u.lanes&x)&&!(f.flags&128))return Ar=!1,tW(u,f,x);Ar=!!(u.flags&131072)}else Ar=!1,Mn&&f.flags&1048576&&UC(f,bg,f.index);switch(f.lanes=0,f.tag){case 2:var M=f.type;u!==null&&(u.alternate=null,f.alternate=null,f.flags|=2),u=f.pendingProps;var T=qr(f,Wt.current);Mu(f,x),T=nS(null,f,M,u,T,x);var L=iS();return f.flags|=1,typeof T=="object"&&T!==null&&typeof T.render=="function"&&T.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,ui(M)?(L=!0,_i(f)):L=!1,f.memoizedState=T.state!==null&&T.state!==void 0?T.state:null,W_(f),T.updater=Mg,f.stateNode=T,T._reactInternals=f,j_(f,M,u,x),f=uS(null,f,M,!0,L,x)):(f.tag=0,Mn&&L&&X_(f),Yi(null,f,T,x),f=f.child),f;case 16:M=f.elementType;e:{switch(u!==null&&(u.alternate=null,f.alternate=null,f.flags|=2),u=f.pendingProps,T=M._init,M=T(M._payload),f.type=M,T=f.tag=gW(M),u=ms(M,u),T){case 0:f=cS(null,f,M,u,x);break e;case 1:f=wP(null,f,M,u,x);break e;case 11:f=vP(null,f,M,u,x);break e;case 14:f=yP(null,f,M,ms(M.type,u),x);break e}throw Error(o(306,M,""))}return f;case 0:return M=f.type,T=f.pendingProps,T=f.elementType===M?T:ms(M,T),cS(u,f,M,T,x);case 1:return M=f.type,T=f.pendingProps,T=f.elementType===M?T:ms(M,T),wP(u,f,M,T,x);case 3:e:{if(MP(f),u===null)throw Error(o(387));M=f.pendingProps,L=f.memoizedState,T=L.element,IC(u,f),wg(f,M,null,x);var G=f.memoizedState;if(M=G.element,xe&&L.isDehydrated)if(L={element:M,isDehydrated:!1,cache:G.cache,transitions:G.transitions},f.updateQueue.baseState=L,f.memoizedState=L,f.flags&256){T=Error(o(423)),f=EP(u,f,M,x,T);break e}else if(M!==T){T=Error(o(424)),f=EP(u,f,M,x,T);break e}else for(xe&&(Tr=ug(f.stateNode.containerInfo),br=f,Mn=!0,gs=null,nh=!1),x=GC(f,null,M,x),f.child=x;x;)x.flags=x.flags&-3|4096,x=x.sibling;else{if(Tu(),M===T){f=Oo(u,f,x);break e}Yi(u,f,M,x)}f=f.child}return f;case 5:return jC(f),u===null&&Y_(f),M=f.type,T=f.pendingProps,L=u!==null?u.memoizedProps:null,G=T.children,he(M,T)?G=null:L!==null&&he(M,L)&&(f.flags|=32),SP(u,f),Yi(u,f,G,x),f.child;case 6:return u===null&&Y_(f),null;case 13:return bP(u,f,x);case 4:return K_(f,f.stateNode.containerInfo),M=f.pendingProps,u===null?f.child=Au(f,null,M,x):Yi(u,f,M,x),f.child;case 11:return M=f.type,T=f.pendingProps,T=f.elementType===M?T:ms(M,T),vP(u,f,M,T,x);case 7:return Yi(u,f,f.pendingProps,x),f.child;case 8:return Yi(u,f,f.pendingProps.children,x),f.child;case 12:return Yi(u,f,f.pendingProps.children,x),f.child;case 10:e:{if(M=f.type._context,T=f.pendingProps,L=f.memoizedProps,G=T.value,RC(f,M,G),L!==null)if(qs(L.value,G)){if(L.children===T.children&&!On.current){f=Oo(u,f,x);break e}}else for(L=f.child,L!==null&&(L.return=f);L!==null;){var ee=L.dependencies;if(ee!==null){G=L.child;for(var pe=ee.firstContext;pe!==null;){if(pe.context===M){if(L.tag===1){pe=Io(-1,x&-x),pe.tag=2;var Ne=L.updateQueue;if(Ne!==null){Ne=Ne.shared;var Je=Ne.pending;Je===null?pe.next=pe:(pe.next=Je.next,Je.next=pe),Ne.pending=pe}}L.lanes|=x,pe=L.alternate,pe!==null&&(pe.lanes|=x),H_(L.return,x,f),ee.lanes|=x;break}pe=pe.next}}else if(L.tag===10)G=L.type===f.type?null:L.child;else if(L.tag===18){if(G=L.return,G===null)throw Error(o(341));G.lanes|=x,ee=G.alternate,ee!==null&&(ee.lanes|=x),H_(G,x,f),G=L.sibling}else G=L.child;if(G!==null)G.return=L;else for(G=L;G!==null;){if(G===f){G=null;break}if(L=G.sibling,L!==null){L.return=G.return,G=L;break}G=G.return}L=G}Yi(u,f,T.children,x),f=f.child}return f;case 9:return T=f.type,M=f.pendingProps.children,Mu(f,x),T=$r(T),M=M(T),f.flags|=1,Yi(u,f,M,x),f.child;case 14:return M=f.type,T=ms(M,f.pendingProps),T=ms(M.type,T),yP(u,f,M,T,x);case 15:return xP(u,f,f.type,f.pendingProps,x);case 17:return M=f.type,T=f.pendingProps,T=f.elementType===M?T:ms(M,T),u!==null&&(u.alternate=null,f.alternate=null,f.flags|=2),f.tag=1,ui(M)?(u=!0,_i(f)):u=!1,Mu(f,x),kC(f,M,T),j_(f,M,T,x),uS(null,f,M,!0,u,x);case 19:return PP(u,f,x);case 22:return _P(u,f,x)}throw Error(o(156,f.tag))};function JP(u,f){return O_(u,f)}function mW(u,f,x,M){this.tag=u,this.key=x,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=M,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function es(u,f,x,M){return new mW(u,f,x,M)}function LS(u){return u=u.prototype,!(!u||!u.isReactComponent)}function gW(u){if(typeof u=="function")return LS(u)?1:0;if(u!=null){if(u=u.$$typeof,u===_)return 11;if(u===w)return 14}return 2}function Pa(u,f){var x=u.alternate;return x===null?(x=es(u.tag,f,u.key,u.mode),x.elementType=u.elementType,x.type=u.type,x.stateNode=u.stateNode,x.alternate=u,u.alternate=x):(x.pendingProps=f,x.type=u.type,x.flags=0,x.subtreeFlags=0,x.deletions=null),x.flags=u.flags&14680064,x.childLanes=u.childLanes,x.lanes=u.lanes,x.child=u.child,x.memoizedProps=u.memoizedProps,x.memoizedState=u.memoizedState,x.updateQueue=u.updateQueue,f=u.dependencies,x.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},x.sibling=u.sibling,x.index=u.index,x.ref=u.ref,x}function iv(u,f,x,M,T,L){var G=2;if(M=u,typeof u=="function")LS(u)&&(G=1);else if(typeof u=="string")G=5;else e:switch(u){case d:return ec(x.children,T,L,f);case h:G=8,T|=8;break;case p:return u=es(12,x,f,T|2),u.elementType=p,u.lanes=L,u;case y:return u=es(13,x,f,T),u.elementType=y,u.lanes=L,u;case m:return u=es(19,x,f,T),u.elementType=m,u.lanes=L,u;case E:return rv(x,T,L,f);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case g:G=10;break e;case v:G=9;break e;case _:G=11;break e;case w:G=14;break e;case S:G=16,M=null;break e}throw Error(o(130,u==null?u:typeof u,""))}return f=es(G,x,f,T),f.elementType=u,f.type=M,f.lanes=L,f}function ec(u,f,x,M){return u=es(7,u,M,f),u.lanes=x,u}function rv(u,f,x,M){return u=es(22,u,M,f),u.elementType=E,u.lanes=x,u.stateNode={},u}function DS(u,f,x){return u=es(6,u,null,f),u.lanes=x,u}function NS(u,f,x){return f=es(4,u.children!==null?u.children:[],u.key,f),f.lanes=x,f.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},f}function vW(u,f,x,M,T){this.tag=f,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Le,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=D_(0),this.expirationTimes=D_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=D_(0),this.identifierPrefix=M,this.onRecoverableError=T,xe&&(this.mutableSourceEagerHydrationData=null)}function eR(u,f,x,M,T,L,G,ee,pe){return u=new vW(u,f,x,ee,pe),f===1?(f=1,L===!0&&(f|=8)):f=0,L=es(3,null,null,f),u.current=L,L.stateNode=u,L.memoizedState={element:M,isDehydrated:x,cache:null,transitions:null},W_(L),u}function tR(u){if(!u)return Xr;u=u._reactInternals;e:{if(F(u)!==u||u.tag!==1)throw Error(o(170));var f=u;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(ui(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(o(171))}if(u.tag===1){var x=u.type;if(ui(x))return _u(u,x,f)}return f}function nR(u){var f=u._reactInternals;if(f===void 0)throw typeof u.render=="function"?Error(o(188)):(u=Object.keys(u).join(","),Error(o(268,u)));return u=j(f),u===null?null:u.stateNode}function iR(u,f){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var x=u.retryLane;u.retryLane=x!==0&&x=Ne&&L>=It&&T<=Je&&G<=pt){u.splice(f,1);break}else if(M!==Ne||x.width!==pe.width||ptG){if(!(L!==It||x.height!==pe.height||JeT)){Ne>M&&(pe.width+=Ne-M,pe.x=M),JeL&&(pe.height+=It-L,pe.y=L),ptx&&(x=G)),G ")+` + +No matching component was found for: + `)+u.join(" > ")}return null},n.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 5:return Y(u.child.stateNode);default:return u.child.stateNode}},n.injectIntoDevTools=function(u){if(u={bundleType:u.bundleType,version:u.version,rendererPackageName:u.rendererPackageName,rendererConfig:u.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:yW,findFiberByHostInstance:u.findFiberByHostInstance||xW,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)u=!0;else{try{gg=f.inject(u),Xs=f}catch{}u=!!f.checkDCE}}return u},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(u,f,x,M){if(!O)throw Error(o(363));u=SS(u,f);var T=Ve(u,x,M).disconnect;return{disconnect:function(){T()}}},n.registerMutableSourceForHydration=function(u,f){var x=f._getVersion;x=x(f._source),u.mutableSourceEagerHydrationData==null?u.mutableSourceEagerHydrationData=[f,x]:u.mutableSourceEagerHydrationData.push(f,x)},n.runWithPriority=function(u,f){var x=tn;try{return tn=u,f()}finally{tn=x}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(u,f,x,M){var T=f.current,L=Zi(),G=Aa(T);return x=tR(x),f.context===null?f.context=x:f.pendingContext=x,f=Io(L,G),f.payload={element:u},M=M===void 0?null:M,M!==null&&(f.callback=M),Ea(T,f),u=Jr(T,G,L),u!==null&&Sg(u,T,G),G},n};DB.exports=Rie;var Iie=DB.exports;const Lie=km(Iie),NA={},Die=t=>void Object.assign(NA,t);function Nie(t,e){function n(d,{args:h=[],attach:p,...g},v){let _=`${d[0].toUpperCase()}${d.slice(1)}`,y;if(d==="primitive"){if(g.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const m=g.object;y=ld(m,{type:d,root:v,attach:p,primitive:!0})}else{const m=NA[_];if(!m)throw new Error(`R3F: ${_} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(!Array.isArray(h))throw new Error("R3F: The args prop must be an array!");y=ld(new m(...h),{type:d,root:v,attach:p,memoizedProps:{args:h}})}return y.__r3f.attach===void 0&&(y instanceof Ut?y.__r3f.attach="geometry":y instanceof Ci&&(y.__r3f.attach="material")),_!=="inject"&&u1(y,g),y}function i(d,h){let p=!1;if(h){var g,v;(g=h.__r3f)!=null&&g.attach?c1(d,h,h.__r3f.attach):h.isObject3D&&d.isObject3D&&(d.add(h),p=!0),p||(v=d.__r3f)==null||v.objects.push(h),h.__r3f||ld(h,{}),h.__r3f.parent=d,VE(h),cd(h)}}function r(d,h,p){let g=!1;if(h){var v,_;if((v=h.__r3f)!=null&&v.attach)c1(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){h.parent=d,h.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:h});const y=d.children.filter(w=>w!==h),m=y.indexOf(p);d.children=[...y.slice(0,m),h,...y.slice(m)],g=!0}g||(_=d.__r3f)==null||_.objects.push(h),h.__r3f||ld(h,{}),h.__r3f.parent=d,VE(h),cd(h)}}function s(d,h,p=!1){d&&[...d].forEach(g=>o(h,g,p))}function o(d,h,p){if(h){var g,v,_;if(h.__r3f&&(h.__r3f.parent=null),(g=d.__r3f)!=null&&g.objects&&(d.__r3f.objects=d.__r3f.objects.filter(E=>E!==h)),(v=h.__r3f)!=null&&v.attach)KL(d,h,h.__r3f.attach);else if(h.isObject3D&&d.isObject3D){var y;d.remove(h),(y=h.__r3f)!=null&&y.root&&Wie(Q0(h),h)}const w=(_=h.__r3f)==null?void 0:_.primitive,S=!w&&(p===void 0?h.dispose!==null:p);if(!w){var m;s((m=h.__r3f)==null?void 0:m.objects,h,S),s(h.children,h,S)}if(delete h.__r3f,S&&h.dispose&&h.type!=="Scene"){const E=()=>{try{h.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?zE.unstable_scheduleCallback(zE.unstable_IdlePriority,E):E()}cd(d)}}function a(d,h,p,g){var v;const _=(v=d.__r3f)==null?void 0:v.parent;if(!_)return;const y=n(h,p,d.__r3f.root);if(d.children){for(const m of d.children)m.__r3f&&i(y,m);d.children=d.children.filter(m=>!m.__r3f)}d.__r3f.objects.forEach(m=>i(y,m)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(_,d),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),i(_,y),y.raycast&&y.__r3f.eventCount&&Q0(y).getState().internal.interaction.push(y),[g,g.alternate].forEach(m=>{m!==null&&(m.stateNode=y,m.ref&&(typeof m.ref=="function"?m.ref(y):m.ref.current=y))})}const l=()=>{};return{reconciler:Lie({createInstance:n,removeChild:o,appendChild:i,appendInitialChild:i,insertBefore:r,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,h)=>{if(!h)return;const p=d.getState().scene;p.__r3f&&(p.__r3f.root=d,i(p,h))},removeChildFromContainer:(d,h)=>{h&&o(d.getState().scene,h)},insertInContainerBefore:(d,h,p)=>{if(!h||!p)return;const g=d.getState().scene;g.__r3f&&r(g,h,p)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var h;return!!((h=d==null?void 0:d.__r3f)!=null?h:{}).handlers},prepareUpdate(d,h,p,g){var v;if(((v=d==null?void 0:d.__r3f)!=null?v:{}).primitive&&g.object&&g.object!==d)return[!0];{const{args:y=[],children:m,...w}=g,{args:S=[],children:E,...C}=p;if(!Array.isArray(y))throw new Error("R3F: the args prop must be an array!");if(y.some((I,N)=>I!==S[N]))return[!0];const R=HB(d,w,C,!0);return R.changes.length?[!1,R]:null}},commitUpdate(d,[h,p],g,v,_,y){h?a(d,g,_,y):u1(d,p)},commitMount(d,h,p,g){var v;const _=(v=d.__r3f)!=null?v:{};d.raycast&&_.handlers&&_.eventCount&&Q0(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>ld(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var h;const{attach:p,parent:g}=(h=d.__r3f)!=null?h:{};p&&g&&KL(g,d,p),d.isObject3D&&(d.visible=!1),cd(d)},unhideInstance(d,h){var p;const{attach:g,parent:v}=(p=d.__r3f)!=null?p:{};g&&v&&c1(v,d,g),(d.isObject3D&&h.visible==null||h.visible)&&(d.visible=!0),cd(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Cd.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&gn.fun(performance.now)?performance.now:gn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:gn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:gn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:u1}}var qL,$L;const l1=t=>"colorSpace"in t||"outputColorSpace"in t,kB=()=>{var t;return(t=NA.ColorManagement)!=null?t:null},FB=t=>t&&t.isOrthographicCamera,Oie=t=>t&&t.hasOwnProperty("current"),$f=typeof window<"u"&&((qL=window.document)!=null&&qL.createElement||(($L=window.navigator)==null?void 0:$L.product)==="ReactNative")?b.useLayoutEffect:b.useEffect;function UB(t){const e=b.useRef(t);return $f(()=>void(e.current=t),[t]),e}function kie({set:t}){return $f(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class zB extends b.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}zB.getDerivedStateFromError=()=>({error:!0});const BB="__default",YL=new Map,Fie=t=>t&&!!t.memoized&&!!t.changes;function VB(t){var e;const n=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],n),t[1]):t}const Hh=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function Q0(t){let e=t.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const gn={obj:t=>t===Object(t)&&!gn.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,arr:t=>Array.isArray(t),equ(t,e,{arrays:n="shallow",objects:i="reference",strict:r=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(gn.str(t)||gn.num(t)||gn.boo(t))return t===e;const s=gn.obj(t);if(s&&i==="reference")return t===e;const o=gn.arr(t);if(o&&n==="reference")return t===e;if((o||s)&&t===e)return!0;let a;for(a in t)if(!(a in e))return!1;if(s&&n==="shallow"&&i==="shallow"){for(a in r?e:t)if(!gn.equ(t[a],e[a],{strict:r,objects:"reference"}))return!1}else for(a in r?e:t)if(t[a]!==e[a])return!1;if(gn.und(a)){if(o&&t.length===0&&e.length===0||s&&Object.keys(t).length===0&&Object.keys(e).length===0)return!0;if(t!==e)return!1}return!0}};function Uie(t){const e={nodes:{},materials:{}};return t&&t.traverse(n=>{n.name&&(e.nodes[n.name]=n),n.material&&!e.materials[n.material.name]&&(e.materials[n.material.name]=n.material)}),e}function zie(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function ld(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function BE(t,e){let n=t;if(e.includes("-")){const i=e.split("-"),r=i.pop();return n=i.reduce((s,o)=>s[o],t),{target:n,key:r}}else return{target:n,key:e}}const ZL=/-\d+$/;function c1(t,e,n){if(gn.str(n)){if(ZL.test(n)){const s=n.replace(ZL,""),{target:o,key:a}=BE(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:i,key:r}=BE(t,n);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=n(t,e)}function KL(t,e,n){var i,r;if(gn.str(n)){const{target:s,key:o}=BE(t,n),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(t,e);(r=e.__r3f)==null||delete r.previousAttach}function HB(t,{children:e,key:n,ref:i,...r},{children:s,key:o,ref:a,...l}={},c=!1){const d=t.__r3f,h=Object.entries(r),p=[];if(c){const v=Object.keys(l);for(let _=0;_{var y;if((y=t.__r3f)!=null&&y.primitive&&v==="object"||gn.equ(_,l[v]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(v))return p.push([v,_,!0,[]]);let m=[];v.includes("-")&&(m=v.split("-")),p.push([v,_,!1,m]);for(const w in r){const S=r[w];w.startsWith(`${v}-`)&&p.push([w,S,!1,w.split("-")])}});const g={...r};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(g.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(g.attach=d.memoizedProps.attach),{memoized:g,changes:p}}const Bie=typeof process<"u"&&!1;function u1(t,e){var n;const i=t.__r3f,r=i==null?void 0:i.root,s=r==null||r.getState==null?void 0:r.getState(),{memoized:o,changes:a}=Fie(e)?e:HB(t,e),l=i==null?void 0:i.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let d=0;dm[w],t),!(y&&y.set))){const[m,...w]=v.reverse();_=w.reverse().reduce((S,E)=>S[E],t),h=m}if(p===BB+"remove")if(_.constructor){let m=YL.get(_.constructor);m||(m=new _.constructor,YL.set(_.constructor,m)),p=m[h]}else p=0;if(g&&i)p?i.handlers[h]=p:delete i.handlers[h],i.eventCount=Object.keys(i.handlers).length;else if(y&&y.set&&(y.copy||y instanceof Hc)){if(Array.isArray(p))y.fromArray?y.fromArray(p):y.set(...p);else if(y.copy&&p&&p.constructor&&(Bie?y.constructor.name===p.constructor.name:y.constructor===p.constructor))y.copy(p);else if(p!==void 0){const m=y instanceof ze;!m&&y.setScalar?y.setScalar(p):y instanceof Hc&&p instanceof Hc?y.mask=p.mask:y.set(p),!kB()&&s&&!s.linear&&m&&y.convertSRGBToLinear()}}else if(_[h]=p,_[h]instanceof Ln&&_[h].format===Hi&&_[h].type===ho&&s){const m=_[h];l1(m)&&l1(s.gl)?m.colorSpace=s.gl.outputColorSpace:m.encoding=s.gl.outputEncoding}cd(t)}if(i&&i.parent&&t.raycast&&l!==i.eventCount){const d=Q0(t).getState().internal,h=d.interaction.indexOf(t);h>-1&&d.interaction.splice(h,1),i.eventCount&&d.interaction.push(t)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(n=t.__r3f)!=null&&n.parent&&VE(t),t}function cd(t){var e,n;const i=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();i&&i.internal.frames===0&&i.invalidate()}function VE(t){t.onUpdate==null||t.onUpdate(t)}function Vie(t,e){t.manual||(FB(t)?(t.left=e.width/-2,t.right=e.width/2,t.top=e.height/2,t.bottom=e.height/-2):t.aspect=e.width/e.height,t.updateProjectionMatrix(),t.updateMatrixWorld())}function w0(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function Hie(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Cd.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Cd.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Cd.ContinuousEventPriority;default:return Cd.DefaultEventPriority}}function WB(t,e,n,i){const r=n.get(e);r&&(n.delete(e),n.size===0&&(t.delete(i),r.target.releasePointerCapture(i)))}function Wie(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(i=>i!==e),n.initialHits=n.initialHits.filter(i=>i!==e),n.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&n.hovered.delete(r)}),n.capturedMap.forEach((i,r)=>{WB(n.capturedMap,e,i,r)})}function Gie(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+h*h))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+d]}))}function i(l,c){const d=t.getState(),h=new Set,p=[],g=c?c(d.internal.interaction):d.internal.interaction;for(let m=0;m{const S=Hh(m.object),E=Hh(w.object);return!S||!E?m.distance-w.distance:E.events.priority-S.events.priority||m.distance-w.distance}).filter(m=>{const w=w0(m);return h.has(w)?!1:(h.add(w),!0)});d.events.filter&&(_=d.events.filter(_,d));for(const m of _){let w=m.object;for(;w;){var y;(y=w.__r3f)!=null&&y.eventCount&&p.push({...m,eventObject:w}),w=w.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let m of d.internal.capturedMap.get(l.pointerId).values())h.has(w0(m.intersection))||p.push(m.intersection);return p}function r(l,c,d,h){const p=t.getState();if(l.length){const g={stopped:!1};for(const v of l){const _=Hh(v.object)||p,{raycaster:y,pointer:m,camera:w,internal:S}=_,E=new B(m.x,m.y,0).unproject(w),C=A=>{var D,j;return(D=(j=S.capturedMap.get(A))==null?void 0:j.has(v.eventObject))!=null?D:!1},R=A=>{const D={intersection:v,target:c.target};S.capturedMap.has(A)?S.capturedMap.get(A).set(v.eventObject,D):S.capturedMap.set(A,new Map([[v.eventObject,D]])),c.target.setPointerCapture(A)},I=A=>{const D=S.capturedMap.get(A);D&&WB(S.capturedMap,v.eventObject,D,A)};let N={};for(let A in c){let D=c[A];typeof D!="function"&&(N[A]=D)}let F={...v,...N,pointer:m,intersections:l,stopped:g.stopped,delta:d,unprojectedPoint:E,ray:y.ray,camera:w,stopPropagation(){const A="pointerId"in c&&S.capturedMap.get(c.pointerId);if((!A||A.has(v.eventObject))&&(F.stopped=g.stopped=!0,S.hovered.size&&Array.from(S.hovered.values()).find(D=>D.eventObject===v.eventObject))){const D=l.slice(0,l.indexOf(v));s([...D,v])}},target:{hasPointerCapture:C,setPointerCapture:R,releasePointerCapture:I},currentTarget:{hasPointerCapture:C,setPointerCapture:R,releasePointerCapture:I},nativeEvent:c};if(h(F),g.stopped===!0)break}}return l}function s(l){const{internal:c}=t.getState();for(const d of c.hovered.values())if(!l.length||!l.find(h=>h.object===d.object&&h.index===d.index&&h.instanceId===d.instanceId)){const p=d.eventObject.__r3f,g=p==null?void 0:p.handlers;if(c.hovered.delete(w0(d)),p!=null&&p.eventCount){const v={...d,intersections:l};g.onPointerOut==null||g.onPointerOut(v),g.onPointerLeave==null||g.onPointerLeave(v)}}}function o(l,c){for(let d=0;ds([]);case"onLostPointerCapture":return c=>{const{internal:d}=t.getState();"pointerId"in c&&d.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{d.capturedMap.has(c.pointerId)&&(d.capturedMap.delete(c.pointerId),s([]))})}}return function(d){const{onPointerMissed:h,internal:p}=t.getState();p.lastEvent.current=d;const g=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",y=i(d,g?n:void 0),m=v?e(d):0;l==="onPointerDown"&&(p.initialClick=[d.offsetX,d.offsetY],p.initialHits=y.map(S=>S.eventObject)),v&&!y.length&&m<=2&&(o(d,p.interaction),h&&h(d)),g&&s(y);function w(S){const E=S.eventObject,C=E.__r3f,R=C==null?void 0:C.handlers;if(C!=null&&C.eventCount)if(g){if(R.onPointerOver||R.onPointerEnter||R.onPointerOut||R.onPointerLeave){const I=w0(S),N=p.hovered.get(I);N?N.stopped&&S.stopPropagation():(p.hovered.set(I,S),R.onPointerOver==null||R.onPointerOver(S),R.onPointerEnter==null||R.onPointerEnter(S))}R.onPointerMove==null||R.onPointerMove(S)}else{const I=R[l];I?(!v||p.initialHits.includes(E))&&(o(d,p.interaction.filter(N=>!p.initialHits.includes(N))),I(S)):v&&p.initialHits.includes(E)&&o(d,p.interaction.filter(N=>!p.initialHits.includes(N)))}}r(y,d,m,w)}}return{handlePointer:a}}const GB=t=>!!(t!=null&&t.render),jB=b.createContext(null),jie=(t,e)=>{const n=bie((a,l)=>{const c=new B,d=new B,h=new B;function p(m=l().camera,w=d,S=l().size){const{width:E,height:C,top:R,left:I}=S,N=E/C;w instanceof B?h.copy(w):h.set(...w);const F=m.getWorldPosition(c).distanceTo(h);if(FB(m))return{width:E/m.zoom,height:C/m.zoom,top:R,left:I,factor:1,distance:F,aspect:N};{const A=m.fov*Math.PI/180,D=2*Math.tan(A/2)*F,j=D*(E/C);return{width:j,height:D,top:R,left:I,factor:E/j,distance:F,aspect:N}}}let g;const v=m=>a(w=>({performance:{...w.performance,current:m}})),_=new ye;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(m=1)=>t(l(),m),advance:(m,w)=>e(m,w,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new $m,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const m=l();g&&clearTimeout(g),m.performance.current!==m.performance.min&&v(m.performance.min),g=setTimeout(()=>v(l().performance.max),m.performance.debounce)}},size:{width:0,height:0,top:0,left:0,updateStyle:!1},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:p},setEvents:m=>a(w=>({...w,events:{...w.events,...m}})),setSize:(m,w,S,E,C)=>{const R=l().camera,I={width:m,height:w,top:E||0,left:C||0,updateStyle:S};a(N=>({size:I,viewport:{...N.viewport,...p(R,d,I)}}))},setDpr:m=>a(w=>{const S=VB(m);return{viewport:{...w.viewport,dpr:S,initialDpr:w.viewport.initialDpr||S}}}),setFrameloop:(m="always")=>{const w=l().clock;w.stop(),w.elapsedTime=0,m!=="never"&&(w.start(),w.elapsedTime=0),a(()=>({frameloop:m}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:b.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(m,w,S)=>{const E=l().internal;return E.priority=E.priority+(w>0?1:0),E.subscribers.push({ref:m,priority:w,store:S}),E.subscribers=E.subscribers.sort((C,R)=>C.priority-R.priority),()=>{const C=l().internal;C!=null&&C.subscribers&&(C.priority=C.priority-(w>0?1:0),C.subscribers=C.subscribers.filter(R=>R.ref!==m))}}}}}),i=n.getState();let r=i.size,s=i.viewport.dpr,o=i.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:h}=n.getState();if(l.width!==r.width||l.height!==r.height||c.dpr!==s){var p;r=l,s=c.dpr,Vie(a,l),d.setPixelRatio(c.dpr);const g=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,g)}a!==o&&(o=a,h(g=>({viewport:{...g.viewport,...g.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let M0,Xie=new Set,qie=new Set,$ie=new Set;function d1(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function Wh(t,e){switch(t){case"before":return d1(Xie,e);case"after":return d1(qie,e);case"tail":return d1($ie,e)}}let f1,h1;function p1(t,e,n){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(i=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),f1=e.internal.subscribers,M0=0;M00)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(i+=p1(c,s))}if(n=!1,Wh("after",c),i===0)return Wh("tail",c),e=!1,cancelAnimationFrame(r)}function a(c,d=1){var h;if(!c)return t.forEach(p=>a(p.store.getState(),d));(h=c.gl.xr)!=null&&h.isPresenting||!c.internal.active||c.frameloop==="never"||(d>1?c.internal.frames=Math.min(60,c.internal.frames+d):n?c.internal.frames=2:c.internal.frames=1,e||(e=!0,requestAnimationFrame(o)))}function l(c,d=!0,h,p){if(d&&Wh("before",c),h)p1(c,h,p);else for(const g of t.values())p1(c,g.store.getState());d&&Wh("after",c)}return{loop:o,invalidate:a,advance:l}}function Xde(t){const e=b.useRef(null);return $f(()=>void(e.current=t.current.__r3f),[t]),e}function XB(){const t=b.useContext(jB);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function jo(t=n=>n,e){return XB()(t,e)}function f_(t,e=0){const n=XB(),i=n.getState().internal.subscribe,r=UB(t);return $f(()=>i(r,e,n),[e,i,n]),null}const QL=new WeakMap;function qB(t,e){return function(n,...i){let r=QL.get(n);return r||(r=new n,QL.set(n,r)),t&&t(r),Promise.all(i.map(s=>new Promise((o,a)=>r.load(s,l=>{l.scene&&Object.assign(l,Uie(l.scene)),o(l)},e,l=>a(new Error(`Could not load ${s}: ${l==null?void 0:l.message}`))))))}}function $B(t,e,n,i){const r=Array.isArray(e)?e:[e],s=Aie(qB(n,i),[t,...r],{equal:gn.equ});return Array.isArray(e)?s:s[0]}$B.preload=function(t,e,n){const i=Array.isArray(e)?e:[e];return Cie(qB(n),[t,...i])};$B.clear=function(t,e){const n=Array.isArray(e)?e:[e];return Pie([t,...n])};const Af=new Map,{invalidate:JL,advance:eD}=Yie(Af),{reconciler:Xy,applyProps:sd}=Nie(Af,Hie),od={objects:"shallow",strict:!1},Zie=(t,e)=>{const n=typeof t=="function"?t(e):t;return GB(n)?n:new Gb({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Kie(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:i,height:r,top:s,left:o,updateStyle:a=n}=e;return{width:i,height:r,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:i,height:r,top:s,left:o}=t.parentElement.getBoundingClientRect();return{width:i,height:r,top:s,left:o,updateStyle:n}}else if(typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0,updateStyle:n};return{width:0,height:0,top:0,left:0}}function Qie(t){const e=Af.get(t),n=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||jie(JL,eD),o=n||Xy.createContainer(s,Cd.ConcurrentRoot,null,!1,null,"",r,null);e||Af.set(t,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:h,size:p,scene:g,events:v,onCreated:_,shadows:y=!1,linear:m=!1,flat:w=!1,legacy:S=!1,orthographic:E=!1,frameloop:C="always",dpr:R=[1,2],performance:I,raycaster:N,camera:F,onPointerMissed:A}=d,D=s.getState(),j=D.gl;D.gl||D.set({gl:j=Zie(h,t)});let K=D.raycaster;K||D.set({raycaster:K=new bk});const{params:V,...Z}=N||{};if(gn.equ(Z,K,od)||sd(K,{...Z}),gn.equ(V,K.params,od)||sd(K,{params:{...K.params,...V}}),!D.camera||D.camera===c&&!gn.equ(c,F,od)){c=F;const $=F instanceof Vm,Q=$?F:E?new Qo(0,0,0,0,.1,1e3):new Wn(75,0,.1,1e3);$||(Q.position.z=5,F&&(sd(Q,F),("aspect"in F||"left"in F||"right"in F||"bottom"in F||"top"in F)&&(Q.manual=!0,Q.updateProjectionMatrix())),!D.camera&&!(F!=null&&F.rotation)&&Q.lookAt(0,0,0)),D.set({camera:Q}),K.camera=Q}if(!D.scene){let $;g instanceof ay?$=g:($=new ay,g&&sd($,g)),D.set({scene:ld($)})}if(!D.xr){var Y;const $=(be,ie)=>{const he=s.getState();he.frameloop!=="never"&&eD(be,!0,he,ie)},Q=()=>{const be=s.getState();be.gl.xr.enabled=be.gl.xr.isPresenting,be.gl.xr.setAnimationLoop(be.gl.xr.isPresenting?$:null),be.gl.xr.isPresenting||JL(be)},de={connect(){const be=s.getState().gl;be.xr.addEventListener("sessionstart",Q),be.xr.addEventListener("sessionend",Q)},disconnect(){const be=s.getState().gl;be.xr.removeEventListener("sessionstart",Q),be.xr.removeEventListener("sessionend",Q)}};typeof((Y=j.xr)==null?void 0:Y.addEventListener)=="function"&&de.connect(),D.set({xr:de})}if(j.shadowMap){const $=j.shadowMap.enabled,Q=j.shadowMap.type;if(j.shadowMap.enabled=!!y,gn.boo(y))j.shadowMap.type=np;else if(gn.str(y)){var J;const de={basic:g3,percentage:ux,soft:np,variance:ws};j.shadowMap.type=(J=de[y])!=null?J:np}else gn.obj(y)&&Object.assign(j.shadowMap,y);($!==j.shadowMap.enabled||Q!==j.shadowMap.type)&&(j.shadowMap.needsUpdate=!0)}const k=kB();k&&("enabled"in k?k.enabled=!S:"legacyMode"in k&&(k.legacyMode=S)),l||sd(j,{outputEncoding:m?3e3:3001,toneMapping:w?fo:Eb}),D.legacy!==S&&D.set(()=>({legacy:S})),D.linear!==m&&D.set(()=>({linear:m})),D.flat!==w&&D.set(()=>({flat:w})),h&&!gn.fun(h)&&!GB(h)&&!gn.equ(h,j,od)&&sd(j,h),v&&!D.events.handlers&&D.set({events:v(s)});const W=Kie(t,p);return gn.equ(W,D.size,od)||D.setSize(W.width,W.height,W.updateStyle,W.top,W.left),R&&D.viewport.dpr!==VB(R)&&D.setDpr(R),D.frameloop!==C&&D.setFrameloop(C),D.onPointerMissed||D.set({onPointerMissed:A}),I&&!gn.equ(I,D.performance,od)&&D.set($=>({performance:{...$.performance,...I}})),a=_,l=!0,this},render(d){return l||this.configure(),Xy.updateContainer(P.jsx(Jie,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){YB(t)}}}function Jie({store:t,children:e,onCreated:n,rootElement:i}){return $f(()=>{const r=t.getState();r.set(s=>({internal:{...s.internal,active:!0}})),n&&n(r),t.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),P.jsx(jB.Provider,{value:t,children:e})}function YB(t,e){const n=Af.get(t),i=n==null?void 0:n.fiber;if(i){const r=n==null?void 0:n.store.getState();r&&(r.internal.active=!1),Xy.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,o,a,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(o=s.renderLists)==null||o.dispose==null||o.dispose(),(a=r.gl)==null||a.forceContextLoss==null||a.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),zie(r),Af.delete(t)}catch{}},500)})}}Xy.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:b.version});const m1={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function ere(t){const{handlePointer:e}=Gie(t);return{priority:1,enabled:!0,compute(n,i,r){i.pointer.set(n.offsetX/i.size.width*2-1,-(n.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(m1).reduce((n,i)=>({...n,[i]:e(i)}),{}),update:()=>{var n;const{events:i,internal:r}=t.getState();(n=r.lastEvent)!=null&&n.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:n=>{var i;const{set:r,events:s}=t.getState();s.disconnect==null||s.disconnect(),r(o=>({events:{...o.events,connected:n}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([o,a])=>{const[l,c]=m1[o];n.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:n,events:i}=t.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,o])=>{if(i&&i.connected instanceof HTMLElement){const[a]=m1[s];i.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function HE(t,e,n){var i,r,s,o,a;e==null&&(e=100);function l(){var d=Date.now()-o;d=0?i=setTimeout(l,e-d):(i=null,n||(a=t.apply(s,r),s=r=null))}var c=function(){s=this,r=arguments,o=Date.now();var d=n&&!i;return i||(i=setTimeout(l,e)),d&&(a=t.apply(s,r),s=r=null),a};return c.clear=function(){i&&(clearTimeout(i),i=null)},c.flush=function(){i&&(a=t.apply(s,r),s=r=null,clearTimeout(i),i=null)},c}HE.debounce=HE;var tre=HE;const tD=km(tre);var nre=Object.defineProperty,ire=Object.defineProperties,rre=Object.getOwnPropertyDescriptors,nD=Object.getOwnPropertySymbols,sre=Object.prototype.hasOwnProperty,ore=Object.prototype.propertyIsEnumerable,iD=(t,e,n)=>e in t?nre(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,rD=(t,e)=>{for(var n in e||(e={}))sre.call(e,n)&&iD(t,n,e[n]);if(nD)for(var n of nD(e))ore.call(e,n)&&iD(t,n,e[n]);return t},are=(t,e)=>ire(t,rre(e)),sD,oD;typeof window<"u"&&((sD=window.document)!=null&&sD.createElement||((oD=window.navigator)==null?void 0:oD.product)==="ReactNative")?b.useLayoutEffect:b.useEffect;function ZB(t,e,n){if(!t)return;if(n(t)===!0)return t;let i=t.child;for(;i;){const r=ZB(i,e,n);if(r)return r;i=i.sibling}}function KB(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const aD=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=aD;return}return aD.apply(this,arguments)};const OA=KB(b.createContext(null));class QB extends b.Component{render(){return b.createElement(OA.Provider,{value:this._reactInternals},this.props.children)}}function lre(){const t=b.useContext(OA);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=b.useId();return b.useMemo(()=>{for(const i of[t,t==null?void 0:t.alternate]){if(!i)continue;const r=ZB(i,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(r)return r}},[t,e])}function cre(){const t=lre(),[e]=b.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const r=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;r&&r!==OA&&!e.has(r)&&e.set(r,b.useContext(KB(r)))}n=n.return}return e}function ure(){const t=cre();return b.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>i=>b.createElement(e,null,b.createElement(n.Provider,are(rD({},i),{value:t.get(n)}))),e=>b.createElement(QB,rD({},e))),[t])}function dre({debounce:t,scroll:e,polyfill:n,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const r=n||typeof window<"u"&&window.ResizeObserver,[s,o]=b.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0});if(!r)return s.width=1280,s.height=800,[()=>{},s,()=>{}];const a=b.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=t?typeof t=="number"?t:t.scroll:null,c=t?typeof t=="number"?t:t.resize:null,d=b.useRef(!1);b.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[h,p,g]=b.useMemo(()=>{const m=()=>{if(!a.current.element)return;const{left:w,top:S,width:E,height:C,bottom:R,right:I,x:N,y:F}=a.current.element.getBoundingClientRect(),A={left:w,top:S,width:E,height:C,bottom:R,right:I,x:N,y:F};a.current.element instanceof HTMLElement&&i&&(A.height=a.current.element.offsetHeight,A.width=a.current.element.offsetWidth),Object.freeze(A),d.current&&!mre(a.current.lastBounds,A)&&o(a.current.lastBounds=A)};return[m,c?tD(m,c):m,l?tD(m,l):m]},[o,i,l,c]);function v(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(m=>m.removeEventListener("scroll",g,!0)),a.current.scrollContainers=null),a.current.resizeObserver&&(a.current.resizeObserver.disconnect(),a.current.resizeObserver=null),a.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",a.current.orientationHandler))}function _(){var m;a.current.element&&(a.current.resizeObserver=new r(p),(m=a.current.resizeObserver)==null||m.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(w=>w.addEventListener("scroll",g,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{g()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const y=m=>{!m||m===a.current.element||(v(),a.current.element=m,a.current.scrollContainers=JB(m),_())};return hre(g,!!e),fre(p),b.useEffect(()=>{v(),_()},[e,g,p]),b.useEffect(()=>v,[]),[y,s,h]}function fre(t){b.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function hre(t,e){b.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function JB(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:i,overflowY:r}=window.getComputedStyle(t);return[n,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...JB(t.parentElement)]}const pre=["x","y","top","bottom","left","right","width","height"],mre=(t,e)=>pre.every(n=>t[n]===e[n]),gre=b.forwardRef(function({children:e,fallback:n,resize:i,style:r,gl:s,events:o=ere,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:h,legacy:p,orthographic:g,frameloop:v,dpr:_,performance:y,raycaster:m,camera:w,scene:S,onPointerMissed:E,onCreated:C,...R},I){b.useMemo(()=>Die(tY),[]);const N=ure(),[F,A]=dre({scroll:!0,debounce:{scroll:50,resize:0},...i}),D=b.useRef(null),j=b.useRef(null);b.useImperativeHandle(I,()=>D.current);const K=UB(E),[V,Z]=b.useState(!1),[Y,J]=b.useState(!1);if(V)throw V;if(Y)throw Y;const k=b.useRef(null);$f(()=>{const $=D.current;A.width>0&&A.height>0&&$&&(k.current||(k.current=Qie($)),k.current.configure({gl:s,events:o,shadows:c,linear:d,flat:h,legacy:p,orthographic:g,frameloop:v,dpr:_,performance:y,raycaster:m,camera:w,scene:S,size:A,onPointerMissed:(...Q)=>K.current==null?void 0:K.current(...Q),onCreated:Q=>{Q.events.connect==null||Q.events.connect(a?Oie(a)?a.current:a:j.current),l&&Q.setEvents({compute:(de,be)=>{const ie=de[l+"X"],he=de[l+"Y"];be.pointer.set(ie/be.size.width*2-1,-(he/be.size.height)*2+1),be.raycaster.setFromCamera(be.pointer,be.camera)}}),C==null||C(Q)}}),k.current.render(P.jsx(N,{children:P.jsx(zB,{set:J,children:P.jsx(b.Suspense,{fallback:P.jsx(kie,{set:Z}),children:e})})})))}),b.useEffect(()=>{const $=D.current;if($)return()=>YB($)},[]);const W=a?"none":"auto";return P.jsx("div",{ref:j,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:W,...r},...R,children:P.jsx("div",{ref:F,style:{width:"100%",height:"100%"},children:P.jsx("canvas",{ref:D,style:{display:"block"},children:n})})})}),e4=b.forwardRef(function(e,n){return P.jsx(QB,{children:P.jsx(gre,{...e,ref:n})})}),vre={map:()=>0,amplitude:0},yre=()=>{const t=Bf(),e=Ux(),n=aa.waveform.hooks.useInstance(),i=aa.noise.hooks.useInstance(),r=aa.data.hooks.useInstance();return{coordinateMapper:b.useMemo(()=>{switch(t){case je.WAVE_FORM:return n;case je.NOISE:return i;case je.AUDIO:return r;case je.AUDIO_SCOPE:case je.PARTICLE_NOISE:return vre;default:return t}},[t,r,i,n]),...e}},t4=()=>{const t=Fx(),e=yre();return P.jsx(t.ReactiveComponent,{...e})},xre=()=>P.jsxs(e4,{children:[P.jsx("color",{attach:"background",args:["#010204"]}),";",P.jsx(t4,{})]}),n4=()=>{const{colorBackground:t,palette:e}=Ym();return t?ei.getPalette(e).calcBackgroundColor(0):"#010204"},_re=()=>{const t=n4();return P.jsx("color",{attach:"background",args:[t]})},Sre=()=>{const t=n4();return P.jsx("fog",{attach:"fog",args:[t,0,100]})};function WE(){return WE=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?wre(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Mt=(t,e,n)=>(Mre(t,typeof e!="symbol"?e+"":e,n),n);const E0=new uu,cD=new $o,Ere=Math.cos(70*(Math.PI/180)),uD=(t,e)=>(t%e+e)%e;let bre=class extends bo{constructor(e,n){super(),Mt(this,"object"),Mt(this,"domElement"),Mt(this,"enabled",!0),Mt(this,"target",new B),Mt(this,"minDistance",0),Mt(this,"maxDistance",1/0),Mt(this,"minZoom",0),Mt(this,"maxZoom",1/0),Mt(this,"minPolarAngle",0),Mt(this,"maxPolarAngle",Math.PI),Mt(this,"minAzimuthAngle",-1/0),Mt(this,"maxAzimuthAngle",1/0),Mt(this,"enableDamping",!1),Mt(this,"dampingFactor",.05),Mt(this,"enableZoom",!0),Mt(this,"zoomSpeed",1),Mt(this,"enableRotate",!0),Mt(this,"rotateSpeed",1),Mt(this,"enablePan",!0),Mt(this,"panSpeed",1),Mt(this,"screenSpacePanning",!0),Mt(this,"keyPanSpeed",7),Mt(this,"zoomToCursor",!1),Mt(this,"autoRotate",!1),Mt(this,"autoRotateSpeed",2),Mt(this,"reverseOrbit",!1),Mt(this,"reverseHorizontalOrbit",!1),Mt(this,"reverseVerticalOrbit",!1),Mt(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Mt(this,"mouseButtons",{LEFT:fc.ROTATE,MIDDLE:fc.DOLLY,RIGHT:fc.PAN}),Mt(this,"touches",{ONE:hc.ROTATE,TWO:hc.DOLLY_PAN}),Mt(this,"target0"),Mt(this,"position0"),Mt(this,"zoom0"),Mt(this,"_domElementKeyEvents",null),Mt(this,"getPolarAngle"),Mt(this,"getAzimuthalAngle"),Mt(this,"setPolarAngle"),Mt(this,"setAzimuthalAngle"),Mt(this,"getDistance"),Mt(this,"listenToKeyEvents"),Mt(this,"stopListenToKeyEvents"),Mt(this,"saveState"),Mt(this,"reset"),Mt(this,"update"),Mt(this,"connect"),Mt(this,"dispose"),this.object=e,this.domElement=n,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>d.phi,this.getAzimuthalAngle=()=>d.theta,this.setPolarAngle=q=>{let ve=uD(q,2*Math.PI),Be=d.phi;Be<0&&(Be+=2*Math.PI),ve<0&&(ve+=2*Math.PI);let st=Math.abs(ve-Be);2*Math.PI-st{let ve=uD(q,2*Math.PI),Be=d.theta;Be<0&&(Be+=2*Math.PI),ve<0&&(ve+=2*Math.PI);let st=Math.abs(ve-Be);2*Math.PI-sti.object.position.distanceTo(i.target),this.listenToKeyEvents=q=>{q.addEventListener("keydown",Ve),this._domElementKeyEvents=q},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",Ve),this._domElementKeyEvents=null},this.saveState=()=>{i.target0.copy(i.target),i.position0.copy(i.object.position),i.zoom0=i.object.zoom},this.reset=()=>{i.target.copy(i.target0),i.object.position.copy(i.position0),i.object.zoom=i.zoom0,i.object.updateProjectionMatrix(),i.dispatchEvent(r),i.update(),l=a.NONE},this.update=(()=>{const q=new B,ve=new B(0,1,0),Be=new Wi().setFromUnitVectors(e.up,ve),st=Be.clone().invert(),lt=new B,Ht=new Wi,X=2*Math.PI;return function(){const De=i.object.position;Be.setFromUnitVectors(e.up,ve),st.copy(Be).invert(),q.copy(De).sub(i.target),q.applyQuaternion(Be),d.setFromVector3(q),i.autoRotate&&l===a.NONE&&V(j()),i.enableDamping?(d.theta+=h.theta*i.dampingFactor,d.phi+=h.phi*i.dampingFactor):(d.theta+=h.theta,d.phi+=h.phi);let Xe=i.minAzimuthAngle,tt=i.maxAzimuthAngle;isFinite(Xe)&&isFinite(tt)&&(Xe<-Math.PI?Xe+=X:Xe>Math.PI&&(Xe-=X),tt<-Math.PI?tt+=X:tt>Math.PI&&(tt-=X),Xe<=tt?d.theta=Math.max(Xe,Math.min(tt,d.theta)):d.theta=d.theta>(Xe+tt)/2?Math.max(Xe,d.theta):Math.min(tt,d.theta)),d.phi=Math.max(i.minPolarAngle,Math.min(i.maxPolarAngle,d.phi)),d.makeSafe(),i.enableDamping===!0?i.target.addScaledVector(g,i.dampingFactor):i.target.add(g),i.zoomToCursor&&F||i.object.isOrthographicCamera?d.radius=de(d.radius):d.radius=de(d.radius*p),q.setFromSpherical(d),q.applyQuaternion(st),De.copy(i.target).add(q),i.object.matrixAutoUpdate||i.object.updateMatrix(),i.object.lookAt(i.target),i.enableDamping===!0?(h.theta*=1-i.dampingFactor,h.phi*=1-i.dampingFactor,g.multiplyScalar(1-i.dampingFactor)):(h.set(0,0,0),g.set(0,0,0));let jt=!1;if(i.zoomToCursor&&F){let Yt=null;if(i.object instanceof Wn&&i.object.isPerspectiveCamera){const pn=q.length();Yt=de(pn*p);const Zn=pn-Yt;i.object.position.addScaledVector(I,Zn),i.object.updateMatrixWorld()}else if(i.object.isOrthographicCamera){const pn=new B(N.x,N.y,0);pn.unproject(i.object),i.object.zoom=Math.max(i.minZoom,Math.min(i.maxZoom,i.object.zoom/p)),i.object.updateProjectionMatrix(),jt=!0;const Zn=new B(N.x,N.y,0);Zn.unproject(i.object),i.object.position.sub(Zn).add(pn),i.object.updateMatrixWorld(),Yt=q.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),i.zoomToCursor=!1;Yt!==null&&(i.screenSpacePanning?i.target.set(0,0,-1).transformDirection(i.object.matrix).multiplyScalar(Yt).add(i.object.position):(E0.origin.copy(i.object.position),E0.direction.set(0,0,-1).transformDirection(i.object.matrix),Math.abs(i.object.up.dot(E0.direction))c||8*(1-Ht.dot(i.object.quaternion))>c?(i.dispatchEvent(r),lt.copy(i.object.position),Ht.copy(i.object.quaternion),jt=!1,!0):!1}})(),this.connect=q=>{i.domElement=q,i.domElement.style.touchAction="none",i.domElement.addEventListener("contextmenu",we),i.domElement.addEventListener("pointerdown",re),i.domElement.addEventListener("pointercancel",Se),i.domElement.addEventListener("wheel",Oe)},this.dispose=()=>{var q,ve,Be,st,lt,Ht;i.domElement&&(i.domElement.style.touchAction="auto"),(q=i.domElement)==null||q.removeEventListener("contextmenu",we),(ve=i.domElement)==null||ve.removeEventListener("pointerdown",re),(Be=i.domElement)==null||Be.removeEventListener("pointercancel",Se),(st=i.domElement)==null||st.removeEventListener("wheel",Oe),(lt=i.domElement)==null||lt.ownerDocument.removeEventListener("pointermove",Me),(Ht=i.domElement)==null||Ht.ownerDocument.removeEventListener("pointerup",Se),i._domElementKeyEvents!==null&&i._domElementKeyEvents.removeEventListener("keydown",Ve)};const i=this,r={type:"change"},s={type:"start"},o={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const c=1e-6,d=new cy,h=new cy;let p=1;const g=new B,v=new ye,_=new ye,y=new ye,m=new ye,w=new ye,S=new ye,E=new ye,C=new ye,R=new ye,I=new B,N=new ye;let F=!1;const A=[],D={};function j(){return 2*Math.PI/60/60*i.autoRotateSpeed}function K(){return Math.pow(.95,i.zoomSpeed)}function V(q){i.reverseOrbit||i.reverseHorizontalOrbit?h.theta+=q:h.theta-=q}function Z(q){i.reverseOrbit||i.reverseVerticalOrbit?h.phi+=q:h.phi-=q}const Y=(()=>{const q=new B;return function(Be,st){q.setFromMatrixColumn(st,0),q.multiplyScalar(-Be),g.add(q)}})(),J=(()=>{const q=new B;return function(Be,st){i.screenSpacePanning===!0?q.setFromMatrixColumn(st,1):(q.setFromMatrixColumn(st,0),q.crossVectors(i.object.up,q)),q.multiplyScalar(Be),g.add(q)}})(),k=(()=>{const q=new B;return function(Be,st){const lt=i.domElement;if(lt&&i.object instanceof Wn&&i.object.isPerspectiveCamera){const Ht=i.object.position;q.copy(Ht).sub(i.target);let X=q.length();X*=Math.tan(i.object.fov/2*Math.PI/180),Y(2*Be*X/lt.clientHeight,i.object.matrix),J(2*st*X/lt.clientHeight,i.object.matrix)}else lt&&i.object instanceof Qo&&i.object.isOrthographicCamera?(Y(Be*(i.object.right-i.object.left)/i.object.zoom/lt.clientWidth,i.object.matrix),J(st*(i.object.top-i.object.bottom)/i.object.zoom/lt.clientHeight,i.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),i.enablePan=!1)}})();function W(q){i.object instanceof Wn&&i.object.isPerspectiveCamera||i.object instanceof Qo&&i.object.isOrthographicCamera?p/=q:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function $(q){i.object instanceof Wn&&i.object.isPerspectiveCamera||i.object instanceof Qo&&i.object.isOrthographicCamera?p*=q:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),i.enableZoom=!1)}function Q(q){if(!i.zoomToCursor||!i.domElement)return;F=!0;const ve=i.domElement.getBoundingClientRect(),Be=q.clientX-ve.left,st=q.clientY-ve.top,lt=ve.width,Ht=ve.height;N.x=Be/lt*2-1,N.y=-(st/Ht)*2+1,I.set(N.x,N.y,1).unproject(i.object).sub(i.object.position).normalize()}function de(q){return Math.max(i.minDistance,Math.min(i.maxDistance,q))}function be(q){v.set(q.clientX,q.clientY)}function ie(q){Q(q),E.set(q.clientX,q.clientY)}function he(q){m.set(q.clientX,q.clientY)}function Ee(q){_.set(q.clientX,q.clientY),y.subVectors(_,v).multiplyScalar(i.rotateSpeed);const ve=i.domElement;ve&&(V(2*Math.PI*y.x/ve.clientHeight),Z(2*Math.PI*y.y/ve.clientHeight)),v.copy(_),i.update()}function me(q){C.set(q.clientX,q.clientY),R.subVectors(C,E),R.y>0?W(K()):R.y<0&&$(K()),E.copy(C),i.update()}function Re(q){w.set(q.clientX,q.clientY),S.subVectors(w,m).multiplyScalar(i.panSpeed),k(S.x,S.y),m.copy(w),i.update()}function Le(q){Q(q),q.deltaY<0?$(K()):q.deltaY>0&&W(K()),i.update()}function Ce(q){let ve=!1;switch(q.code){case i.keys.UP:k(0,i.keyPanSpeed),ve=!0;break;case i.keys.BOTTOM:k(0,-i.keyPanSpeed),ve=!0;break;case i.keys.LEFT:k(i.keyPanSpeed,0),ve=!0;break;case i.keys.RIGHT:k(-i.keyPanSpeed,0),ve=!0;break}ve&&(q.preventDefault(),i.update())}function Ae(){if(A.length==1)v.set(A[0].pageX,A[0].pageY);else{const q=.5*(A[0].pageX+A[1].pageX),ve=.5*(A[0].pageY+A[1].pageY);v.set(q,ve)}}function H(){if(A.length==1)m.set(A[0].pageX,A[0].pageY);else{const q=.5*(A[0].pageX+A[1].pageX),ve=.5*(A[0].pageY+A[1].pageY);m.set(q,ve)}}function xe(){const q=A[0].pageX-A[1].pageX,ve=A[0].pageY-A[1].pageY,Be=Math.sqrt(q*q+ve*ve);E.set(0,Be)}function fe(){i.enableZoom&&xe(),i.enablePan&&H()}function Te(){i.enableZoom&&xe(),i.enableRotate&&Ae()}function ge(q){if(A.length==1)_.set(q.pageX,q.pageY);else{const Be=et(q),st=.5*(q.pageX+Be.x),lt=.5*(q.pageY+Be.y);_.set(st,lt)}y.subVectors(_,v).multiplyScalar(i.rotateSpeed);const ve=i.domElement;ve&&(V(2*Math.PI*y.x/ve.clientHeight),Z(2*Math.PI*y.y/ve.clientHeight)),v.copy(_)}function qe(q){if(A.length==1)w.set(q.pageX,q.pageY);else{const ve=et(q),Be=.5*(q.pageX+ve.x),st=.5*(q.pageY+ve.y);w.set(Be,st)}S.subVectors(w,m).multiplyScalar(i.panSpeed),k(S.x,S.y),m.copy(w)}function Fe(q){const ve=et(q),Be=q.pageX-ve.x,st=q.pageY-ve.y,lt=Math.sqrt(Be*Be+st*st);C.set(0,lt),R.set(0,Math.pow(C.y/E.y,i.zoomSpeed)),W(R.y),E.copy(C)}function U(q){i.enableZoom&&Fe(q),i.enablePan&&qe(q)}function O(q){i.enableZoom&&Fe(q),i.enableRotate&&ge(q)}function re(q){var ve,Be;i.enabled!==!1&&(A.length===0&&((ve=i.domElement)==null||ve.ownerDocument.addEventListener("pointermove",Me),(Be=i.domElement)==null||Be.ownerDocument.addEventListener("pointerup",Se)),Ot(q),q.pointerType==="touch"?rt(q):_e(q))}function Me(q){i.enabled!==!1&&(q.pointerType==="touch"?mt(q):Ze(q))}function Se(q){var ve,Be,st;wt(q),A.length===0&&((ve=i.domElement)==null||ve.releasePointerCapture(q.pointerId),(Be=i.domElement)==null||Be.ownerDocument.removeEventListener("pointermove",Me),(st=i.domElement)==null||st.ownerDocument.removeEventListener("pointerup",Se)),i.dispatchEvent(o),l=a.NONE}function _e(q){let ve;switch(q.button){case 0:ve=i.mouseButtons.LEFT;break;case 1:ve=i.mouseButtons.MIDDLE;break;case 2:ve=i.mouseButtons.RIGHT;break;default:ve=-1}switch(ve){case fc.DOLLY:if(i.enableZoom===!1)return;ie(q),l=a.DOLLY;break;case fc.ROTATE:if(q.ctrlKey||q.metaKey||q.shiftKey){if(i.enablePan===!1)return;he(q),l=a.PAN}else{if(i.enableRotate===!1)return;be(q),l=a.ROTATE}break;case fc.PAN:if(q.ctrlKey||q.metaKey||q.shiftKey){if(i.enableRotate===!1)return;be(q),l=a.ROTATE}else{if(i.enablePan===!1)return;he(q),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}function Ze(q){if(i.enabled!==!1)switch(l){case a.ROTATE:if(i.enableRotate===!1)return;Ee(q);break;case a.DOLLY:if(i.enableZoom===!1)return;me(q);break;case a.PAN:if(i.enablePan===!1)return;Re(q);break}}function Oe(q){i.enabled===!1||i.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(q.preventDefault(),i.dispatchEvent(s),Le(q),i.dispatchEvent(o))}function Ve(q){i.enabled===!1||i.enablePan===!1||Ce(q)}function rt(q){switch(ft(q),A.length){case 1:switch(i.touches.ONE){case hc.ROTATE:if(i.enableRotate===!1)return;Ae(),l=a.TOUCH_ROTATE;break;case hc.PAN:if(i.enablePan===!1)return;H(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(i.touches.TWO){case hc.DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;fe(),l=a.TOUCH_DOLLY_PAN;break;case hc.DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;Te(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&i.dispatchEvent(s)}function mt(q){switch(ft(q),l){case a.TOUCH_ROTATE:if(i.enableRotate===!1)return;ge(q),i.update();break;case a.TOUCH_PAN:if(i.enablePan===!1)return;qe(q),i.update();break;case a.TOUCH_DOLLY_PAN:if(i.enableZoom===!1&&i.enablePan===!1)return;U(q),i.update();break;case a.TOUCH_DOLLY_ROTATE:if(i.enableZoom===!1&&i.enableRotate===!1)return;O(q),i.update();break;default:l=a.NONE}}function we(q){i.enabled!==!1&&q.preventDefault()}function Ot(q){A.push(q)}function wt(q){delete D[q.pointerId];for(let ve=0;ve{const h=jo(R=>R.invalidate),p=jo(R=>R.camera),g=jo(R=>R.gl),v=jo(R=>R.events),_=jo(R=>R.setEvents),y=jo(R=>R.set),m=jo(R=>R.get),w=jo(R=>R.performance),S=e||p,E=i||v.connected||g.domElement,C=b.useMemo(()=>new bre(S),[S]);return f_(()=>{C.enabled&&C.update()},-1),b.useEffect(()=>(s&&C.connect(s===!0?E:s),C.connect(E),()=>void C.dispose()),[s,E,n,C,h]),b.useEffect(()=>{const R=F=>{h(),n&&w.regress(),o&&o(F)},I=F=>{a&&a(F)},N=F=>{l&&l(F)};return C.addEventListener("change",R),C.addEventListener("start",I),C.addEventListener("end",N),()=>{C.removeEventListener("start",I),C.removeEventListener("end",N),C.removeEventListener("change",R)}},[o,a,l,C,h,_]),b.useEffect(()=>{if(t){const R=m().controls;return y({controls:C}),()=>y({controls:R})}},[t,C]),b.createElement("primitive",WE({ref:d,object:C,enableDamping:r},c))}),Are=(t,e)=>{const n=Math.sin(e.phi)*e.radius;return t.x=n*Math.sin(e.theta),t.z=Math.cos(e.phi)*e.radius,t.y=n*Math.cos(e.theta),t},Cre=()=>{const t=Fx();switch(t.id){case"ribbons":return{rMin:10,rMax:15,rSpeed:.1,thetaMin:Math.PI/8,thetaMax:2*Math.PI-Math.PI/8,thetaSpeed:.025,phiMin:Math.PI/3,phiMax:Math.PI/2.1,phiSpeed:.25};case"sphere":return{rMin:10,rMax:15,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/3,phiMax:Math.PI/2,phiSpeed:.25};case"cube":return{rMin:12,rMax:20,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/4,phiMax:Math.PI/2,phiSpeed:.25};case"diffusedRing":return{rMin:10,rMax:18,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/8,phiMax:Math.PI/2.25,phiSpeed:.25};case"treadmill":return{rMin:15,rMax:22,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/3.5,phiMax:Math.PI/2.25,phiSpeed:.25};case"movingBoxes":case"dna":case"grid":return{rMin:15,rMax:22,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/3,phiMax:Math.PI/2,phiSpeed:.25};case"swarm":return{rMin:10,rMax:15,rSpeed:.1,thetaMin:0,thetaMax:2*Math.PI,thetaSpeed:.025,phiMin:Math.PI/3,phiMax:Math.PI/2,phiSpeed:.25};case"scope":return null;default:return t}},Pre=()=>{const t=jo(i=>i.camera),e=Cre(),n=new cy;return f_(({clock:i})=>{if(!e)return;const{rMin:r,rMax:s,rSpeed:o,thetaMin:a,thetaMax:l,thetaSpeed:c,phiMin:d,phiMax:h,phiSpeed:p}=e,g=i.elapsedTime,v=.5*(1+Math.sin(g*o)),_=r+v*(s-r),y=.5*(1+Math.cos(g*c)),m=a+y*(l-a),w=.5*(1+Math.cos(g*p)),S=d+w*(h-d);Are(t.position,n.set(_,S,m)),t.lookAt(0,0,0)}),null};class Rre{constructor(e=.5,n=150,i=500){ot(this,"clock",new $m(!0));ot(this,"bufferSize",1e3);ot(this,"lastEventElapsedMs",0);ot(this,"buffer",Array.from({length:this.bufferSize}).map(e=>({value:0,elapsedTimeMs:0})));ot(this,"threshold");ot(this,"windowSizeMs");ot(this,"cooldownMs");ot(this,"observationCount",0);this.threshold=e,this.windowSizeMs=n,this.cooldownMs=i}get timeSinceLastEventMs(){return this.clock.elapsedTime*1e3-this.lastEventElapsedMs}getBufferAvg(e){const n=e-this.windowSizeMs,i=e,r=this.buffer.reduce((s,o)=>o.elapsedTimeMsi?s:{sum:s.sum+o.value,count:s.count+1},{sum:0,count:0});return r.count>0?r.sum/r.count:0}step(e){const n=this.clock.getElapsedTime()*1e3,i=this.observationCount%this.bufferSize;return this.buffer[i].value=e,this.buffer[i].elapsedTimeMs=n,this.observationCount++,this.timeSinceLastEventMsthis.threshold?(this.lastEventElapsedMs=n,!0):!1}}const Ire=({scalarTracker:t})=>{const{paletteTrackEnergy:e}=Ym(),n=new Rre(.5,50,500),{nextPalette:i}=Os();return f_(()=>{e&&n.step(t.get())&&i()}),P.jsx(P.Fragment,{})},Lre=()=>{const{energyTracker:t}=Ux();return t?P.jsx(Ire,{scalarTracker:t}):null},Dre=()=>{const{mode:t,autoOrbitAfterSleepMs:e}=Dk(),{setCamera:n}=Os(),{canvasInteractionEventTracker:i}=pY();switch(f_(()=>{t==="ORBIT_CONTROLS"&&e>0&&i.msSinceLastEvent>e?n({mode:"AUTO_ORBIT"}):t==="AUTO_ORBIT"&&i.msSinceLastEventP.jsxs(e4,{camera:{fov:45,near:1,far:1e3,position:[-17,-6,6.5],up:[0,0,1]},linear:!0,children:[P.jsx(_re,{}),P.jsx("ambientLight",{intensity:Math.PI}),P.jsx(Sre,{}),P.jsx(t4,{}),P.jsx(Dre,{}),P.jsx(Lre,{})]});function Ore(t){if(typeof Proxy>"u")return t;const e=new Map,n=(...i)=>t(...i);return new Proxy(n,{get:(i,r)=>r==="create"?t:(e.has(r)||e.set(r,t(r)),e.get(r))})}function Cm(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}const GE=t=>Array.isArray(t);function r4(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function kA(t,e,n,i){if(typeof e=="function"){const[r,s]=dD(i);e=e(n!==void 0?n:t.custom,r,s)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[r,s]=dD(i);e=e(n!==void 0?n:t.custom,r,s)}return e}function h_(t,e,n){const i=t.getProps();return kA(i,e,n!==void 0?n:i.custom,t)}const FA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],UA=["initial",...FA],rg=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Hl=new Set(rg),yo=t=>t*1e3,xo=t=>t/1e3,kre={type:"spring",stiffness:500,damping:25,restSpeed:10},Fre=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Ure={type:"keyframes",duration:.8},zre={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Bre=(t,{keyframes:e})=>e.length>2?Ure:Hl.has(t)?t.startsWith("scale")?Fre(e[1]):kre:zre;function zA(t,e){return t?t[e]||t.default||t:void 0}const Vre={skipAnimations:!1,useManualTiming:!1},Hre=t=>t!==null;function p_(t,{repeat:e,repeatType:n="loop"},i){const r=t.filter(Hre),s=e&&n!=="loop"&&e%2===1?0:r.length-1;return!s||i===void 0?r[s]:i}const ji=t=>t;function Wre(t){let e=new Set,n=new Set,i=!1,r=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(c){s.has(c)&&(l.schedule(c),t()),c(o)}const l={schedule:(c,d=!1,h=!1)=>{const g=h&&i?e:n;return d&&s.add(c),g.has(c)||g.add(c),c},cancel:c=>{n.delete(c),s.delete(c)},process:c=>{if(o=c,i){r=!0;return}i=!0,[e,n]=[n,e],n.clear(),e.forEach(a),i=!1,r&&(r=!1,l.process(c))}};return l}const b0=["read","resolveKeyframes","update","preRender","render","postRender"],Gre=40;function s4(t,e){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=b0.reduce((m,w)=>(m[w]=Wre(s),m),{}),{read:a,resolveKeyframes:l,update:c,preRender:d,render:h,postRender:p}=o,g=()=>{const m=performance.now();n=!1,r.delta=i?1e3/60:Math.max(Math.min(m-r.timestamp,Gre),1),r.timestamp=m,r.isProcessing=!0,a.process(r),l.process(r),c.process(r),d.process(r),h.process(r),p.process(r),r.isProcessing=!1,n&&e&&(i=!1,t(g))},v=()=>{n=!0,i=!0,r.isProcessing||t(g)};return{schedule:b0.reduce((m,w)=>{const S=o[w];return m[w]=(E,C=!1,R=!1)=>(n||v(),S.schedule(E,C,R)),m},{}),cancel:m=>{for(let w=0;w(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,jre=1e-7,Xre=12;function qre(t,e,n,i,r){let s,o,a=0;do o=e+(n-e)/2,s=o4(o,i,r)-t,s>0?n=o:e=o;while(Math.abs(s)>jre&&++aqre(s,0,1,t,n);return s=>s===0||s===1?s:o4(r(s),e,i)}const a4=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,l4=t=>e=>1-t(1-e),c4=sg(.33,1.53,.69,.99),BA=l4(c4),u4=a4(BA),d4=t=>(t*=2)<1?.5*BA(t):.5*(2-Math.pow(2,-10*(t-1))),VA=t=>1-Math.sin(Math.acos(t)),f4=l4(VA),h4=a4(VA),p4=t=>/^0[^.\s]+$/u.test(t);function $re(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||p4(t):!0}let jE=ji;const m4=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),g4=t=>e=>typeof e=="string"&&e.startsWith(t),v4=g4("--"),Yre=g4("var(--"),HA=t=>Yre(t)?Zre.test(t.split("/*")[0].trim()):!1,Zre=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Kre=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Qre(t){const e=Kre.exec(t);if(!e)return[,];const[,n,i,r]=e;return[`--${n??i}`,r]}function y4(t,e,n=1){const[i,r]=Qre(t);if(!i)return;const s=window.getComputedStyle(e).getPropertyValue(i);if(s){const o=s.trim();return m4(o)?parseFloat(o):o}return HA(r)?y4(r,e,n+1):r}const Ll=(t,e,n)=>n>e?e:ntypeof t=="number",parse:parseFloat,transform:t=>t},Rm={...Yf,transform:t=>Ll(0,1,t)},T0={...Yf,default:1},og=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Ga=og("deg"),_o=og("%"),vt=og("px"),Jre=og("vh"),ese=og("vw"),fD={..._o,parse:t=>_o.parse(t)/100,transform:t=>_o.transform(t*100)},tse=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),hD=t=>t===Yf||t===vt,pD=(t,e)=>parseFloat(t.split(", ")[e]),mD=(t,e)=>(n,{transform:i})=>{if(i==="none"||!i)return 0;const r=i.match(/^matrix3d\((.+)\)$/u);if(r)return pD(r[1],e);{const s=i.match(/^matrix\((.+)\)$/u);return s?pD(s[1],t):0}},nse=new Set(["x","y","z"]),ise=rg.filter(t=>!nse.has(t));function rse(t){const e=[];return ise.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const Cf={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:mD(4,13),y:mD(5,14)};Cf.translateX=Cf.x;Cf.translateY=Cf.y;const x4=t=>e=>e.test(t),sse={test:t=>t==="auto",parse:t=>t},_4=[Yf,vt,_o,Ga,ese,Jre,sse],gD=t=>_4.find(x4(t)),$c=new Set;let XE=!1,qE=!1;function S4(){if(qE){const t=Array.from($c).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const r=rse(i);r.length&&(n.set(i,r),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const r=n.get(i);r&&r.forEach(([s,o])=>{var a;(a=i.getValue(s))===null||a===void 0||a.set(o)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}qE=!1,XE=!1,$c.forEach(t=>t.complete()),$c.clear()}function w4(){$c.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(qE=!0)})}function ose(){w4(),S4()}class WA{constructor(e,n,i,r,s,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=r,this.element=s,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?($c.add(this),XE||(XE=!0,on.read(w4),on.resolveKeyframes(S4))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:r}=this;for(let s=0;sMath.round(t*1e5)/1e5,GA=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ase(t){return t==null}const lse=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,jA=(t,e)=>n=>!!(typeof n=="string"&&lse.test(n)&&n.startsWith(t)||e&&!ase(n)&&Object.prototype.hasOwnProperty.call(n,e)),M4=(t,e,n)=>i=>{if(typeof i!="string")return i;const[r,s,o,a]=i.match(GA);return{[t]:parseFloat(r),[e]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},cse=t=>Ll(0,255,t),v1={...Yf,transform:t=>Math.round(cse(t))},Ic={test:jA("rgb","red"),parse:M4("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+v1.transform(t)+", "+v1.transform(e)+", "+v1.transform(n)+", "+yp(Rm.transform(i))+")"};function use(t){let e="",n="",i="",r="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),r=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),r=t.substring(4,5),e+=e,n+=n,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const $E={test:jA("#"),parse:use,transform:Ic.transform},Pd={test:jA("hsl","hue"),parse:M4("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+_o.transform(yp(e))+", "+_o.transform(yp(n))+", "+yp(Rm.transform(i))+")"},zi={test:t=>Ic.test(t)||$E.test(t)||Pd.test(t),parse:t=>Ic.test(t)?Ic.parse(t):Pd.test(t)?Pd.parse(t):$E.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ic.transform(t):Pd.transform(t)},dse=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function fse(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(GA))===null||e===void 0?void 0:e.length)||0)+(((n=t.match(dse))===null||n===void 0?void 0:n.length)||0)>0}const E4="number",b4="color",hse="var",pse="var(",vD="${}",mse=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Im(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},r=[];let s=0;const a=e.replace(mse,l=>(zi.test(l)?(i.color.push(s),r.push(b4),n.push(zi.parse(l))):l.startsWith(pse)?(i.var.push(s),r.push(hse),n.push(l)):(i.number.push(s),r.push(E4),n.push(parseFloat(l))),++s,vD)).split(vD);return{values:n,split:a,indexes:i,types:r}}function T4(t){return Im(t).values}function A4(t){const{split:e,types:n}=Im(t),i=e.length;return r=>{let s="";for(let o=0;otypeof t=="number"?0:t;function vse(t){const e=T4(t);return A4(t)(e.map(gse))}const Dl={test:fse,parse:T4,createTransformer:A4,getAnimatableNone:vse},yse=new Set(["brightness","contrast","saturate","opacity"]);function xse(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(GA)||[];if(!i)return t;const r=n.replace(i,"");let s=yse.has(e)?1:0;return i!==n&&(s*=100),e+"("+s+r+")"}const _se=/\b([a-z-]*)\(.*?\)/gu,YE={...Dl,getAnimatableNone:t=>{const e=t.match(_se);return e?e.map(xse).join(" "):t}},Sse={borderWidth:vt,borderTopWidth:vt,borderRightWidth:vt,borderBottomWidth:vt,borderLeftWidth:vt,borderRadius:vt,radius:vt,borderTopLeftRadius:vt,borderTopRightRadius:vt,borderBottomRightRadius:vt,borderBottomLeftRadius:vt,width:vt,maxWidth:vt,height:vt,maxHeight:vt,top:vt,right:vt,bottom:vt,left:vt,padding:vt,paddingTop:vt,paddingRight:vt,paddingBottom:vt,paddingLeft:vt,margin:vt,marginTop:vt,marginRight:vt,marginBottom:vt,marginLeft:vt,backgroundPositionX:vt,backgroundPositionY:vt},wse={rotate:Ga,rotateX:Ga,rotateY:Ga,rotateZ:Ga,scale:T0,scaleX:T0,scaleY:T0,scaleZ:T0,skew:Ga,skewX:Ga,skewY:Ga,distance:vt,translateX:vt,translateY:vt,translateZ:vt,x:vt,y:vt,z:vt,perspective:vt,transformPerspective:vt,opacity:Rm,originX:fD,originY:fD,originZ:vt},yD={...Yf,transform:Math.round},XA={...Sse,...wse,zIndex:yD,size:vt,fillOpacity:Rm,strokeOpacity:Rm,numOctaves:yD},Mse={...XA,color:zi,backgroundColor:zi,outlineColor:zi,fill:zi,stroke:zi,borderColor:zi,borderTopColor:zi,borderRightColor:zi,borderBottomColor:zi,borderLeftColor:zi,filter:YE,WebkitFilter:YE},qA=t=>Mse[t];function C4(t,e){let n=qA(t);return n!==YE&&(n=Dl),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const Ese=new Set(["auto","none","0"]);function bse(t,e,n){let i=0,r;for(;i{n.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function m_(t){return typeof t=="function"}let J0;function Tse(){J0=void 0}const So={now:()=>(J0===void 0&&So.set(mi.isProcessing||Vre.useManualTiming?mi.timestamp:performance.now()),J0),set:t=>{J0=t,queueMicrotask(Tse)}},xD=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Dl.test(t)||t==="0")&&!t.startsWith("url("));function Ase(t){const e=t[0];if(t.length===1)return!0;for(let n=0;nPse?this.resolvedAt:this.createdAt:this.createdAt}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&ose(),this._resolved}onKeyframesResolved(e,n){this.resolvedAt=So.now(),this.hasAttemptedResolve=!0;const{name:i,type:r,velocity:s,delay:o,onComplete:a,onUpdate:l,isGenerator:c}=this.options;if(!c&&!Cse(e,i,r,s))if(o)this.options.duration=0;else{l==null||l(p_(e,this.options,n)),a==null||a(),this.resolveFinishedPromise();return}const d=this.initPlayback(e,n);d!==!1&&(this._resolved={keyframes:e,finalKeyframe:n,...d},this.onPostResolved())}onPostResolved(){}then(e,n){return this.currentFinishedPromise.then(e,n)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function I4(t,e){return e?t*(1e3/e):0}const Rse=5;function L4(t,e,n){const i=Math.max(e-Rse,0);return I4(n-t(i),e-i)}const y1=.001,Ise=.01,Lse=10,Dse=.05,Nse=1;function Ose({duration:t=800,bounce:e=.25,velocity:n=0,mass:i=1}){let r,s,o=1-e;o=Ll(Dse,Nse,o),t=Ll(Ise,Lse,xo(t)),o<1?(r=c=>{const d=c*o,h=d*t,p=d-n,g=ZE(c,o),v=Math.exp(-h);return y1-p/g*v},s=c=>{const h=c*o*t,p=h*n+n,g=Math.pow(o,2)*Math.pow(c,2)*t,v=Math.exp(-h),_=ZE(Math.pow(c,2),o);return(-r(c)+y1>0?-1:1)*((p-g)*v)/_}):(r=c=>{const d=Math.exp(-c*t),h=(c-n)*t+1;return-y1+d*h},s=c=>{const d=Math.exp(-c*t),h=(n-c)*(t*t);return d*h});const a=5/t,l=Fse(r,s,a);if(t=yo(t),isNaN(l))return{stiffness:100,damping:10,duration:t};{const c=Math.pow(l,2)*i;return{stiffness:c,damping:o*2*Math.sqrt(i*c),duration:t}}}const kse=12;function Fse(t,e,n){let i=n;for(let r=1;rt[n]!==void 0)}function Bse(t){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...t};if(!_D(t,zse)&&_D(t,Use)){const n=Ose(t);e={...e,...n,mass:1},e.isResolvedFromDuration=!0}return e}function $A({keyframes:t,restDelta:e,restSpeed:n,...i}){const r=t[0],s=t[t.length-1],o={done:!1,value:r},{stiffness:a,damping:l,mass:c,duration:d,velocity:h,isResolvedFromDuration:p}=Bse({...i,velocity:-xo(i.velocity||0)}),g=h||0,v=l/(2*Math.sqrt(a*c)),_=s-r,y=xo(Math.sqrt(a/c)),m=Math.abs(_)<5;n||(n=m?.01:2),e||(e=m?.005:.5);let w;if(v<1){const S=ZE(y,v);w=E=>{const C=Math.exp(-v*y*E);return s-C*((g+v*y*_)/S*Math.sin(S*E)+_*Math.cos(S*E))}}else if(v===1)w=S=>s-Math.exp(-y*S)*(_+(g+y*_)*S);else{const S=y*Math.sqrt(v*v-1);w=E=>{const C=Math.exp(-v*y*E),R=Math.min(S*E,300);return s-C*((g+v*y*_)*Math.sinh(R)+S*_*Math.cosh(R))/S}}return{calculatedDuration:p&&d||null,next:S=>{const E=w(S);if(p)o.done=S>=d;else{let C=0;v<1&&(C=S===0?yo(g):L4(w,S,E));const R=Math.abs(C)<=n,I=Math.abs(s-E)<=e;o.done=R&&I}return o.value=o.done?s:E,o}}}function SD({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:r=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:d}){const h=t[0],p={done:!1,value:h},g=N=>a!==void 0&&Nl,v=N=>a===void 0?l:l===void 0||Math.abs(a-N)-_*Math.exp(-N/i),S=N=>m+w(N),E=N=>{const F=w(N),A=S(N);p.done=Math.abs(F)<=c,p.value=p.done?m:A};let C,R;const I=N=>{g(p.value)&&(C=N,R=$A({keyframes:[p.value,v(p.value)],velocity:L4(S,N,p.value),damping:r,stiffness:s,restDelta:c,restSpeed:d}))};return I(0),{calculatedDuration:null,next:N=>{let F=!1;return!R&&C===void 0&&(F=!0,E(N),I(N)),C!==void 0&&N>=C?R.next(N-C):(!F&&E(N),p)}}}const Vse=sg(.42,0,1,1),Hse=sg(0,0,.58,1),D4=sg(.42,0,.58,1),N4=t=>Array.isArray(t)&&typeof t[0]!="number",YA=t=>Array.isArray(t)&&typeof t[0]=="number",wD={linear:ji,easeIn:Vse,easeInOut:D4,easeOut:Hse,circIn:VA,circInOut:h4,circOut:f4,backIn:BA,backInOut:u4,backOut:c4,anticipate:d4},MD=t=>{if(YA(t)){jE(t.length===4);const[e,n,i,r]=t;return sg(e,n,i,r)}else if(typeof t=="string")return jE(wD[t]!==void 0),wD[t];return t},Wse=(t,e)=>n=>e(t(n)),la=(...t)=>t.reduce(Wse),au=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i},bn=(t,e,n)=>t+(e-t)*n;function x1(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Gse({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let r=0,s=0,o=0;if(!e)r=s=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;r=x1(l,a,t+1/3),s=x1(l,a,t),o=x1(l,a,t-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:i}}function qy(t,e){return n=>n>0?e:t}const _1=(t,e,n)=>{const i=t*t,r=n*(e*e-i)+i;return r<0?0:Math.sqrt(r)},jse=[$E,Ic,Pd],Xse=t=>jse.find(e=>e.test(t));function ED(t){const e=Xse(t);if(!e)return!1;let n=e.parse(t);return e===Pd&&(n=Gse(n)),n}const bD=(t,e)=>{const n=ED(t),i=ED(e);if(!n||!i)return qy(t,e);const r={...n};return s=>(r.red=_1(n.red,i.red,s),r.green=_1(n.green,i.green,s),r.blue=_1(n.blue,i.blue,s),r.alpha=bn(n.alpha,i.alpha,s),Ic.transform(r))},KE=new Set(["none","hidden"]);function qse(t,e){return KE.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function $se(t,e){return n=>bn(t,e,n)}function ZA(t){return typeof t=="number"?$se:typeof t=="string"?HA(t)?qy:zi.test(t)?bD:Kse:Array.isArray(t)?O4:typeof t=="object"?zi.test(t)?bD:Yse:qy}function O4(t,e){const n=[...t],i=n.length,r=t.map((s,o)=>ZA(s)(s,e[o]));return s=>{for(let o=0;o{for(const s in i)n[s]=i[s](r);return n}}function Zse(t,e){var n;const i=[],r={color:0,var:0,number:0};for(let s=0;s{const n=Dl.createTransformer(e),i=Im(t),r=Im(e);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?KE.has(t)&&!r.values.length||KE.has(e)&&!i.values.length?qse(t,e):la(O4(Zse(i,r),r.values),n):qy(t,e)};function k4(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?bn(t,e,n):ZA(t)(t,e)}function Qse(t,e,n){const i=[],r=n||k4,s=t.length-1;for(let o=0;oe[0];if(s===2&&t[0]===t[1])return()=>e[1];t[0]>t[s-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=Qse(e,i,r),a=o.length,l=c=>{let d=0;if(a>1)for(;dl(Ll(t[0],t[s-1],c)):l}function U4(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const r=au(0,e,i);t.push(bn(n,1,r))}}function z4(t){const e=[0];return U4(e,t.length-1),e}function Jse(t,e){return t.map(n=>n*e)}function eoe(t,e){return t.map(()=>e||D4).splice(0,t.length-1)}function $y({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const r=N4(i)?i.map(MD):MD(i),s={done:!1,value:e[0]},o=Jse(n&&n.length===e.length?n:z4(e),t),a=F4(o,e,{ease:Array.isArray(r)?r:eoe(e,r)});return{calculatedDuration:t,next:l=>(s.value=a(l),s.done=l>=t,s)}}const QE=2e4;function B4(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e=QE?1/0:e}const toe=t=>{const e=({timestamp:n})=>t(n);return{start:()=>on.update(e,!0),stop:()=>_a(e),now:()=>mi.isProcessing?mi.timestamp:So.now()}},noe={decay:SD,inertia:SD,tween:$y,keyframes:$y,spring:$A},ioe=t=>t/100;class g_ extends R4{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:l}=this.options;l&&l()};const{name:n,motionValue:i,element:r,keyframes:s}=this.options,o=(r==null?void 0:r.KeyframeResolver)||WA,a=(l,c)=>this.onKeyframesResolved(l,c);this.resolver=new o(s,a,n,i,r),this.resolver.scheduleResolve()}initPlayback(e){const{type:n="keyframes",repeat:i=0,repeatDelay:r=0,repeatType:s,velocity:o=0}=this.options,a=m_(n)?n:noe[n]||$y;let l,c;a!==$y&&typeof e[0]!="number"&&(l=la(ioe,k4(e[0],e[1])),e=[0,100]);const d=a({...this.options,keyframes:e});s==="mirror"&&(c=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=B4(d));const{calculatedDuration:h}=d,p=h+r,g=p*(i+1)-r;return{generator:d,mirroredGenerator:c,mapPercentToKeyframes:l,calculatedDuration:h,resolvedDuration:p,totalDuration:g}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,n=!1){const{resolved:i}=this;if(!i){const{keyframes:N}=this.options;return{done:!0,value:N[N.length-1]}}const{finalKeyframe:r,generator:s,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:c,totalDuration:d,resolvedDuration:h}=i;if(this.startTime===null)return s.next(0);const{delay:p,repeat:g,repeatType:v,repeatDelay:_,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-d/this.speed,this.startTime)),n?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const m=this.currentTime-p*(this.speed>=0?1:-1),w=this.speed>=0?m<0:m>d;this.currentTime=Math.max(m,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=d);let S=this.currentTime,E=s;if(g){const N=Math.min(this.currentTime,d)/h;let F=Math.floor(N),A=N%1;!A&&N>=1&&(A=1),A===1&&F--,F=Math.min(F,g+1),!!(F%2)&&(v==="reverse"?(A=1-A,_&&(A-=_/h)):v==="mirror"&&(E=o)),S=Ll(0,1,A)*h}const C=w?{done:!1,value:l[0]}:E.next(S);a&&(C.value=a(C.value));let{done:R}=C;!w&&c!==null&&(R=this.speed>=0?this.currentTime>=d:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&R);return I&&r!==void 0&&(C.value=p_(l,this.options,r)),y&&y(C.value),I&&this.finish(),C}get duration(){const{resolved:e}=this;return e?xo(e.calculatedDuration):0}get time(){return xo(this.currentTime)}set time(e){e=yo(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=xo(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=toe,onPlay:n,startTime:i}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),n&&n();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime?this.state==="finished"&&(this.startTime=r):this.startTime=i??this.calcStartTime(),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}function roe(t){return new g_(t)}const V4=new Set(["opacity","clipPath","filter","transform"]),soe=10,ooe=(t,e)=>{let n="";const i=Math.max(Math.round(e/soe),2);for(let r=0;r(e===void 0&&(e=t()),e)}const aoe={linearEasing:void 0};function loe(t,e){const n=KA(t);return()=>{var i;return(i=aoe[e])!==null&&i!==void 0?i:n()}}const Yy=loe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing");function H4(t){return!!(typeof t=="function"&&Yy()||!t||typeof t=="string"&&(t in JE||Yy())||YA(t)||Array.isArray(t)&&t.every(H4))}const Jh=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,JE={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Jh([0,.65,.55,1]),circOut:Jh([.55,0,1,.45]),backIn:Jh([.31,.01,.66,-.59]),backOut:Jh([.33,1.53,.69,.99])};function W4(t,e){if(t)return typeof t=="function"&&Yy()?ooe(t,e):YA(t)?Jh(t):Array.isArray(t)?t.map(n=>W4(n,e)||JE.easeOut):JE[t]}function coe(t,e,n,{delay:i=0,duration:r=300,repeat:s=0,repeatType:o="loop",ease:a,times:l}={}){const c={[e]:n};l&&(c.offset=l);const d=W4(a,r);return Array.isArray(d)&&(c.easing=d),t.animate(c,{delay:i,duration:r,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"})}function TD(t,e){t.timeline=e,t.onfinish=null}const uoe=KA(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),Zy=10,doe=2e4;function foe(t){return m_(t.type)||t.type==="spring"||!H4(t.ease)}function hoe(t,e){const n=new g_({...e,keyframes:t,repeat:0,delay:0,isGenerator:!0});let i={done:!1,value:t[0]};const r=[];let s=0;for(;!i.done&&sthis.onKeyframesResolved(o,a),n,i,r),this.resolver.scheduleResolve()}initPlayback(e,n){var i;let{duration:r=300,times:s,ease:o,type:a,motionValue:l,name:c,startTime:d}=this.options;if(!(!((i=l.owner)===null||i===void 0)&&i.current))return!1;if(typeof o=="string"&&Yy()&&poe(o)&&(o=G4[o]),foe(this.options)){const{onComplete:p,onUpdate:g,motionValue:v,element:_,...y}=this.options,m=hoe(e,y);e=m.keyframes,e.length===1&&(e[1]=e[0]),r=m.duration,s=m.times,o=m.ease,a="keyframes"}const h=coe(l.owner.current,c,e,{...this.options,duration:r,times:s,ease:o});return h.startTime=d??this.calcStartTime(),this.pendingTimeline?(TD(h,this.pendingTimeline),this.pendingTimeline=void 0):h.onfinish=()=>{const{onComplete:p}=this.options;l.set(p_(e,this.options,n)),p&&p(),this.cancel(),this.resolveFinishedPromise()},{animation:h,duration:r,times:s,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:n}=e;return xo(n)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:n}=e;return xo(n.currentTime||0)}set time(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.currentTime=yo(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:n}=e;return n.playbackRate}set speed(e){const{resolved:n}=this;if(!n)return;const{animation:i}=n;i.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:n}=e;return n.playState}get startTime(){const{resolved:e}=this;if(!e)return null;const{animation:n}=e;return n.startTime}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:n}=this;if(!n)return ji;const{animation:i}=n;TD(i,e)}return ji}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.playState==="finished"&&this.updateFinishedPromise(),n.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:n}=e;n.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.resolveFinishedPromise(),this.updateFinishedPromise();const{resolved:e}=this;if(!e)return;const{animation:n,keyframes:i,duration:r,type:s,ease:o,times:a}=e;if(n.playState==="idle"||n.playState==="finished")return;if(this.time){const{motionValue:c,onUpdate:d,onComplete:h,element:p,...g}=this.options,v=new g_({...g,keyframes:i,duration:r,type:s,ease:o,times:a,isGenerator:!0}),_=yo(this.time);c.setWithVelocity(v.sample(_-Zy).value,v.sample(_).value,Zy)}const{onStop:l}=this.options;l&&l(),this.cancel()}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:n,name:i,repeatDelay:r,repeatType:s,damping:o,type:a}=e;return uoe()&&i&&V4.has(i)&&n&&n.owner&&n.owner.current instanceof HTMLElement&&!n.owner.getProps().onUpdate&&!r&&s!=="mirror"&&o!==0&&a!=="inertia"}}const moe=KA(()=>window.ScrollTimeline!==void 0);class j4{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,n){return Promise.all(this.animations).then(e).catch(n)}getAll(e){return this.animations[0][e]}setAll(e,n){for(let i=0;imoe()&&r.attachTimeline?r.attachTimeline(e):n(r));return()=>{i.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let n=0;nn[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function goe({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:r,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:c,...d}){return!!Object.keys(d).length}const QA=(t,e,n,i={},r,s)=>o=>{const a=zA(i,t)||{},l=a.delay||i.delay||0;let{elapsed:c=0}=i;c=c-yo(l);let d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:p=>{e.set(p),a.onUpdate&&a.onUpdate(p)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:s?void 0:r};goe(a)||(d={...d,...Bre(t,d)}),d.duration&&(d.duration=yo(d.duration)),d.repeatDelay&&(d.repeatDelay=yo(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(d.duration=0,d.delay===0&&(h=!0)),h&&!s&&e.get()!==void 0){const p=p_(d.keyframes,a);if(p!==void 0)return on.update(()=>{d.onUpdate(p),d.onComplete()}),new j4([])}return!s&&AD.supports(d)?new AD(d):new g_(d)},voe=t=>!!(t&&typeof t=="object"&&t.mix&&t.toValue),yoe=t=>GE(t)?t[t.length-1]||0:t;function JA(t,e){t.indexOf(e)===-1&&t.push(e)}function v_(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}class eC{constructor(){this.subscriptions=[]}add(e){return JA(this.subscriptions,e),()=>v_(this.subscriptions,e)}notify(e,n,i){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,n,i);else for(let s=0;s!isNaN(parseFloat(t)),xp={current:void 0};class _oe{constructor(e,n={}){this.version="11.11.9",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(i,r=!0)=>{const s=So.now();this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),r&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=So.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=xoe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new eC);const i=this.events[e].add(n);return e==="change"?()=>{i(),on.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e,n=!0){!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return xp.current&&xp.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=So.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>CD)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,CD);return I4(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Pf(t,e){return new _oe(t,e)}function Soe(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Pf(n))}function tC(t,e){const n=h_(t,e);let{transitionEnd:i={},transition:r={},...s}=n||{};s={...s,...i};for(const o in s){const a=yoe(s[o]);Soe(t,o,a)}}const y_=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),woe="framerAppearId",X4="data-"+y_(woe);function q4(t){return t.props[X4]}const ii=t=>!!(t&&t.getVelocity);function Moe(t){return!!(ii(t)&&t.add)}function eb(t,e){if(!t.applyWillChange)return;const n=t.getValue("willChange");if(Moe(n))return n.add(e)}function Eoe({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function nC(t,e,{delay:n=0,transitionOverride:i,type:r}={}){var s;let{transition:o=t.getDefaultTransition(),transitionEnd:a,...l}=e;i&&(o=i);const c=[],d=r&&t.animationState&&t.animationState.getState()[r];for(const h in l){const p=t.getValue(h,(s=t.latestValues[h])!==null&&s!==void 0?s:null),g=l[h];if(g===void 0||d&&Eoe(d,h))continue;const v={delay:n,...zA(o||{},h)};let _=!1;if(window.MotionHandoffAnimation){const m=q4(t);if(m){const w=window.MotionHandoffAnimation(m,h,on);w!==null&&(v.startTime=w,_=!0)}}eb(t,h),p.start(QA(h,p,g,t.shouldReduceMotion&&Hl.has(h)?{type:!1}:v,t,_));const y=p.animation;y&&c.push(y)}return a&&Promise.all(c).then(()=>{on.update(()=>{a&&tC(t,a)})}),c}function tb(t,e,n={}){var i;const r=h_(t,e,n.type==="exit"?(i=t.presenceContext)===null||i===void 0?void 0:i.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const o=r?()=>Promise.all(nC(t,r,n)):()=>Promise.resolve(),a=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:p}=s;return boe(t,e,d+c,h,p,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[c,d]=l==="beforeChildren"?[o,a]:[a,o];return c().then(()=>d())}else return Promise.all([o(),a(n.delay)])}function boe(t,e,n=0,i=0,r=1,s){const o=[],a=(t.variantChildren.size-1)*i,l=r===1?(c=0)=>c*i:(c=0)=>a-c*i;return Array.from(t.variantChildren).sort(Toe).forEach((c,d)=>{c.notify("AnimationStart",e),o.push(tb(c,e,{...s,delay:n+l(d)}).then(()=>c.notify("AnimationComplete",e)))}),Promise.all(o)}function Toe(t,e){return t.sortNodePosition(e)}function $4(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const r=e.map(s=>tb(t,s,n));i=Promise.all(r)}else if(typeof e=="string")i=tb(t,e,n);else{const r=typeof e=="function"?h_(t,e,n.custom):e;i=Promise.all(nC(t,r,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const Aoe=UA.length;function Y4(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?Y4(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;nPromise.all(e.map(({animation:n,options:i})=>$4(t,n,i)))}function Ioe(t){let e=Roe(t),n=PD(),i=!0;const r=l=>(c,d)=>{var h;const p=h_(t,d,l==="exit"?(h=t.presenceContext)===null||h===void 0?void 0:h.custom:void 0);if(p){const{transition:g,transitionEnd:v,..._}=p;c={...c,..._,...v}}return c};function s(l){e=l(t)}function o(l){const{props:c}=t,d=Y4(t.parent)||{},h=[],p=new Set;let g={},v=1/0;for(let y=0;yv&&E,F=!1;const A=Array.isArray(S)?S:[S];let D=A.reduce(r(m),{});C===!1&&(D={});const{prevResolvedValues:j={}}=w,K={...j,...D},V=J=>{N=!0,p.has(J)&&(F=!0,p.delete(J)),w.needsAnimating[J]=!0;const k=t.getValue(J);k&&(k.liveStyle=!1)};for(const J in K){const k=D[J],W=j[J];if(g.hasOwnProperty(J))continue;let $=!1;GE(k)&&GE(W)?$=!r4(k,W):$=k!==W,$?k!=null?V(J):p.add(J):k!==void 0&&p.has(J)?V(J):w.protectedKeys[J]=!0}w.prevProp=S,w.prevResolvedValues=D,w.isActive&&(g={...g,...D}),i&&t.blockInitialAnimation&&(N=!1),N&&(!(R&&I)||F)&&h.push(...A.map(J=>({animation:J,options:{type:m}})))}if(p.size){const y={};p.forEach(m=>{const w=t.getBaseTarget(m),S=t.getValue(m);S&&(S.liveStyle=!0),y[m]=w??null}),h.push({animation:y})}let _=!!h.length;return i&&(c.initial===!1||c.initial===c.animate)&&!t.manuallyAnimateOnMount&&(_=!1),i=!1,_?e(h):Promise.resolve()}function a(l,c){var d;if(n[l].isActive===c)return Promise.resolve();(d=t.variantChildren)===null||d===void 0||d.forEach(p=>{var g;return(g=p.animationState)===null||g===void 0?void 0:g.setActive(l,c)}),n[l].isActive=c;const h=o(l);for(const p in n)n[p].protectedKeys={};return h}return{animateChanges:o,setActive:a,setAnimateFunction:s,getState:()=>n,reset:()=>{n=PD(),i=!0}}}function Loe(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!r4(e,t):!1}function dc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function PD(){return{animate:dc(!0),whileInView:dc(),whileHover:dc(),whileTap:dc(),whileDrag:dc(),whileFocus:dc(),exit:dc()}}class Wl{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Doe extends Wl{constructor(e){super(e),e.animationState||(e.animationState=Ioe(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Cm(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let Noe=0;class Ooe extends Wl{constructor(){super(...arguments),this.id=Noe++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const r=this.node.animationState.setActive("exit",!e);n&&!e&&r.then(()=>n(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const koe={animation:{Feature:Doe},exit:{Feature:Ooe}},Z4=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1;function x_(t,e="page"){return{point:{x:t[`${e}X`],y:t[`${e}Y`]}}}const Foe=t=>e=>Z4(e)&&t(e,x_(e));function ia(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}function ca(t,e,n,i){return ia(t,e,Foe(n),i)}const RD=(t,e)=>Math.abs(t-e);function Uoe(t,e){const n=RD(t.x,e.x),i=RD(t.y,e.y);return Math.sqrt(n**2+i**2)}class K4{constructor(e,n,{transformPagePoint:i,contextWindow:r,dragSnapToOrigin:s=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const h=w1(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=Uoe(h.offset,{x:0,y:0})>=3;if(!p&&!g)return;const{point:v}=h,{timestamp:_}=mi;this.history.push({...v,timestamp:_});const{onStart:y,onMove:m}=this.handlers;p||(y&&y(this.lastMoveEvent,h),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,h)},this.handlePointerMove=(h,p)=>{this.lastMoveEvent=h,this.lastMoveEventInfo=S1(p,this.transformPagePoint),on.update(this.updatePoint,!0)},this.handlePointerUp=(h,p)=>{this.end();const{onEnd:g,onSessionEnd:v,resumeAnimation:_}=this.handlers;if(this.dragSnapToOrigin&&_&&_(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=w1(h.type==="pointercancel"?this.lastMoveEventInfo:S1(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(h,y),v&&v(h,y)},!Z4(e))return;this.dragSnapToOrigin=s,this.handlers=n,this.transformPagePoint=i,this.contextWindow=r||window;const o=x_(e),a=S1(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=mi;this.history=[{...l,timestamp:c}];const{onSessionStart:d}=n;d&&d(e,w1(a,this.history)),this.removeListeners=la(ca(this.contextWindow,"pointermove",this.handlePointerMove),ca(this.contextWindow,"pointerup",this.handlePointerUp),ca(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),_a(this.updatePoint)}}function S1(t,e){return e?{point:e(t.point)}:t}function ID(t,e){return{x:t.x-e.x,y:t.y-e.y}}function w1({point:t},e){return{point:t,delta:ID(t,Q4(e)),offset:ID(t,zoe(e)),velocity:Boe(e,.1)}}function zoe(t){return t[0]}function Q4(t){return t[t.length-1]}function Boe(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const r=Q4(t);for(;n>=0&&(i=t[n],!(r.timestamp-i.timestamp>yo(e)));)n--;if(!i)return{x:0,y:0};const s=xo(r.timestamp-i.timestamp);if(s===0)return{x:0,y:0};const o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function J4(t){let e=null;return()=>{const n=()=>{e=null};return e===null?(e=t,n):!1}}const LD=J4("dragHorizontal"),DD=J4("dragVertical");function eV(t){let e=!1;if(t==="y")e=DD();else if(t==="x")e=LD();else{const n=LD(),i=DD();n&&i?e=()=>{n(),i()}:(n&&n(),i&&i())}return e}function tV(){const t=eV(!0);return t?(t(),!1):!0}function Rd(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}const nV=1e-4,Voe=1-nV,Hoe=1+nV,iV=.01,Woe=0-iV,Goe=0+iV;function Hr(t){return t.max-t.min}function joe(t,e,n){return Math.abs(t-e)<=n}function ND(t,e,n,i=.5){t.origin=i,t.originPoint=bn(e.min,e.max,t.origin),t.scale=Hr(n)/Hr(e),t.translate=bn(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Voe&&t.scale<=Hoe||isNaN(t.scale))&&(t.scale=1),(t.translate>=Woe&&t.translate<=Goe||isNaN(t.translate))&&(t.translate=0)}function _p(t,e,n,i){ND(t.x,e.x,n.x,i?i.originX:void 0),ND(t.y,e.y,n.y,i?i.originY:void 0)}function OD(t,e,n){t.min=n.min+e.min,t.max=t.min+Hr(e)}function Xoe(t,e,n){OD(t.x,e.x,n.x),OD(t.y,e.y,n.y)}function kD(t,e,n){t.min=e.min-n.min,t.max=t.min+Hr(e)}function Sp(t,e,n){kD(t.x,e.x,n.x),kD(t.y,e.y,n.y)}function qoe(t,{min:e,max:n},i){return e!==void 0&&tn&&(t=i?bn(n,t,i.max):Math.min(t,n)),t}function FD(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function $oe(t,{top:e,left:n,bottom:i,right:r}){return{x:FD(t.x,n,r),y:FD(t.y,e,i)}}function UD(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.mini?n=au(e.min,e.max-i,t.min):i>r&&(n=au(t.min,t.max-r,e.min)),Ll(0,1,n)}function Koe(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const nb=.35;function Qoe(t=nb){return t===!1?t=0:t===!0&&(t=nb),{x:zD(t,"left","right"),y:zD(t,"top","bottom")}}function zD(t,e,n){return{min:BD(t,e),max:BD(t,n)}}function BD(t,e){return typeof t=="number"?t:t[e]||0}const VD=()=>({translate:0,scale:1,origin:0,originPoint:0}),Id=()=>({x:VD(),y:VD()}),HD=()=>({min:0,max:0}),zn=()=>({x:HD(),y:HD()});function rs(t){return[t("x"),t("y")]}function rV({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function Joe({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function eae(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function M1(t){return t===void 0||t===1}function ib({scale:t,scaleX:e,scaleY:n}){return!M1(t)||!M1(e)||!M1(n)}function yc(t){return ib(t)||sV(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function sV(t){return WD(t.x)||WD(t.y)}function WD(t){return t&&t!=="0%"}function Ky(t,e,n){const i=t-n,r=e*i;return n+r}function GD(t,e,n,i,r){return r!==void 0&&(t=Ky(t,r,i)),Ky(t,n,i)+e}function rb(t,e=0,n=1,i,r){t.min=GD(t.min,e,n,i,r),t.max=GD(t.max,e,n,i,r)}function oV(t,{x:e,y:n}){rb(t.x,e.translate,e.scale,e.originPoint),rb(t.y,n.translate,n.scale,n.originPoint)}const jD=.999999999999,XD=1.0000000000001;function tae(t,e,n,i=!1){const r=n.length;if(!r)return;e.x=e.y=1;let s,o;for(let a=0;ajD&&(e.x=1),e.yjD&&(e.y=1)}function Ld(t,e){t.min=t.min+e,t.max=t.max+e}function qD(t,e,n,i,r=.5){const s=bn(t.min,t.max,r);rb(t,e,n,s,i)}function Dd(t,e){qD(t.x,e.x,e.scaleX,e.scale,e.originX),qD(t.y,e.y,e.scaleY,e.scale,e.originY)}function aV(t,e){return rV(eae(t.getBoundingClientRect(),e))}function nae(t,e,n){const i=aV(t,n),{scroll:r}=e;return r&&(Ld(i.x,r.offset.x),Ld(i.y,r.offset.y)),i}const lV=({current:t})=>t?t.ownerDocument.defaultView:null,iae=new WeakMap;class rae{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=zn(),this.visualElement=e}start(e,{snapToCursor:n=!1}={}){const{presenceContext:i}=this.visualElement;if(i&&i.isPresent===!1)return;const r=d=>{const{dragSnapToOrigin:h}=this.getProps();h?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(x_(d,"page").point)},s=(d,h)=>{const{drag:p,dragPropagation:g,onDragStart:v}=this.getProps();if(p&&!g&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=eV(p),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),rs(y=>{let m=this.getAxisMotionValue(y).get()||0;if(_o.test(m)){const{projection:w}=this.visualElement;if(w&&w.layout){const S=w.layout.layoutBox[y];S&&(m=Hr(S)*(parseFloat(m)/100))}}this.originPoint[y]=m}),v&&on.postRender(()=>v(d,h)),eb(this.visualElement,"transform");const{animationState:_}=this.visualElement;_&&_.setActive("whileDrag",!0)},o=(d,h)=>{const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:v,onDrag:_}=this.getProps();if(!p&&!this.openGlobalLock)return;const{offset:y}=h;if(g&&this.currentDirection===null){this.currentDirection=sae(y),this.currentDirection!==null&&v&&v(this.currentDirection);return}this.updateAxis("x",h.point,y),this.updateAxis("y",h.point,y),this.visualElement.render(),_&&_(d,h)},a=(d,h)=>this.stop(d,h),l=()=>rs(d=>{var h;return this.getAnimationState(d)==="paused"&&((h=this.getAxisMotionValue(d).animation)===null||h===void 0?void 0:h.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new K4(e,{onSessionStart:r,onStart:s,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:lV(this.visualElement)})}stop(e,n){const i=this.isDragging;if(this.cancel(),!i)return;const{velocity:r}=n;this.startAnimation(r);const{onDragEnd:s}=this.getProps();s&&on.postRender(()=>s(e,n))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,i){const{drag:r}=this.getProps();if(!i||!A0(e,r,this.currentDirection))return;const s=this.getAxisMotionValue(e);let o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=qoe(o,this.constraints[e],this.elastic[e])),s.set(o)}resolveConstraints(){var e;const{dragConstraints:n,dragElastic:i}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,s=this.constraints;n&&Rd(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):n&&r?this.constraints=$oe(r.layoutBox,n):this.constraints=!1,this.elastic=Qoe(i),s!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&rs(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Koe(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Rd(e))return!1;const i=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const s=nae(i,r.root,this.visualElement.getTransformPagePoint());let o=Yoe(r.layout.layoutBox,s);if(n){const a=n(Joe(o));this.hasMutatedConstraints=!!a,a&&(o=rV(a))}return o}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:r,dragTransition:s,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=rs(d=>{if(!A0(d,n,this.currentDirection))return;let h=l&&l[d]||{};o&&(h={min:0,max:0});const p=r?200:1e6,g=r?40:1e7,v={type:"inertia",velocity:i?e[d]:0,bounceStiffness:p,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...s,...h};return this.startAxisValueAnimation(d,v)});return Promise.all(c).then(a)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return eb(this.visualElement,e),i.start(QA(e,i,0,n,this.visualElement,!1))}stopAnimation(){rs(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){rs(e=>{var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.pause()})}getAnimationState(e){var n;return(n=this.getAxisMotionValue(e).animation)===null||n===void 0?void 0:n.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),r=i[n];return r||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){rs(n=>{const{drag:i}=this.getProps();if(!A0(n,i,this.currentDirection))return;const{projection:r}=this.visualElement,s=this.getAxisMotionValue(n);if(r&&r.layout){const{min:o,max:a}=r.layout.layoutBox[n];s.set(e[n]-bn(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Rd(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};rs(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();r[o]=Zoe({min:l,max:l},this.constraints[o])}});const{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),rs(o=>{if(!A0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(bn(l,c,r[o]))})}addListeners(){if(!this.visualElement.current)return;iae.set(this.visualElement,this);const e=this.visualElement.current,n=ca(e,"pointerdown",l=>{const{drag:c,dragListener:d=!0}=this.getProps();c&&d&&this.start(l)}),i=()=>{const{dragConstraints:l}=this.getProps();Rd(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:r}=this.visualElement,s=r.addEventListener("measure",i);r&&!r.layout&&(r.root&&r.root.updateScroll(),r.updateLayout()),on.read(i);const o=ia(window,"resize",()=>this.scalePositionWithinConstraints()),a=r.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(rs(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=l[d].translate,h.set(h.get()+l[d].translate))}),this.visualElement.render())});return()=>{o(),n(),s(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:r=!1,dragConstraints:s=!1,dragElastic:o=nb,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:r,dragConstraints:s,dragElastic:o,dragMomentum:a}}}function A0(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function sae(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class oae extends Wl{constructor(e){super(e),this.removeGroupControls=ji,this.removeListeners=ji,this.controls=new rae(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ji}unmount(){this.removeGroupControls(),this.removeListeners()}}const $D=t=>(e,n)=>{t&&on.postRender(()=>t(e,n))};class aae extends Wl{constructor(){super(...arguments),this.removePointerDownListener=ji}onPointerDown(e){this.session=new K4(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lV(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:r}=this.node.getProps();return{onSessionStart:$D(e),onStart:$D(n),onMove:i,onEnd:(s,o)=>{delete this.session,r&&on.postRender(()=>r(s,o))}}}mount(){this.removePointerDownListener=ca(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const __=b.createContext(null);function lae(){const t=b.useContext(__);if(t===null)return[!0,null];const{isPresent:e,onExitComplete:n,register:i}=t,r=b.useId();b.useEffect(()=>i(r),[]);const s=b.useCallback(()=>n&&n(r),[r,n]);return!e&&n?[!1,s]:[!0]}const iC=b.createContext({}),cV=b.createContext({}),ey={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function YD(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Gh={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(vt.test(t))t=parseFloat(t);else return t;const n=YD(t,e.target.x),i=YD(t,e.target.y);return`${n}% ${i}%`}},cae={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,r=Dl.parse(t);if(r.length>5)return i;const s=Dl.createTransformer(t),o=typeof r[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;r[0+o]/=a,r[1+o]/=l;const c=bn(a,l,.5);return typeof r[2+o]=="number"&&(r[2+o]/=c),typeof r[3+o]=="number"&&(r[3+o]/=c),s(r)}},Qy={};function uae(t){Object.assign(Qy,t)}const{schedule:rC,cancel:$de}=s4(queueMicrotask,!1);class dae extends b.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:r}=this.props,{projection:s}=e;uae(fae),s&&(n.group&&n.group.add(s),i&&i.register&&r&&i.register(s),s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,onExitComplete:()=>this.safeToRemove()})),ey.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:r,isPresent:s}=this.props,o=i.projection;return o&&(o.isPresent=s,r||e.layoutDependency!==n||n===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?o.promote():o.relegate()||on.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),rC.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function uV(t){const[e,n]=lae(),i=b.useContext(iC);return P.jsx(dae,{...t,layoutGroup:i,switchLayoutGroup:b.useContext(cV),isPresent:e,safeToRemove:n})}const fae={borderRadius:{...Gh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Gh,borderTopRightRadius:Gh,borderBottomLeftRadius:Gh,borderBottomRightRadius:Gh,boxShadow:cae},dV=["TopLeft","TopRight","BottomLeft","BottomRight"],hae=dV.length,ZD=t=>typeof t=="string"?parseFloat(t):t,KD=t=>typeof t=="number"||vt.test(t);function pae(t,e,n,i,r,s){r?(t.opacity=bn(0,n.opacity!==void 0?n.opacity:1,mae(i)),t.opacityExit=bn(e.opacity!==void 0?e.opacity:1,0,gae(i))):s&&(t.opacity=bn(e.opacity!==void 0?e.opacity:1,n.opacity!==void 0?n.opacity:1,i));for(let o=0;oie?1:n(au(t,e,i))}function JD(t,e){t.min=e.min,t.max=e.max}function is(t,e){JD(t.x,e.x),JD(t.y,e.y)}function eN(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function tN(t,e,n,i,r){return t-=e,t=Ky(t,1/n,i),r!==void 0&&(t=Ky(t,1/r,i)),t}function vae(t,e=0,n=1,i=.5,r,s=t,o=t){if(_o.test(e)&&(e=parseFloat(e),e=bn(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=bn(s.min,s.max,i);t===s&&(a-=e),t.min=tN(t.min,e,n,a,r),t.max=tN(t.max,e,n,a,r)}function nN(t,e,[n,i,r],s,o){vae(t,e[n],e[i],e[r],e.scale,s,o)}const yae=["x","scaleX","originX"],xae=["y","scaleY","originY"];function iN(t,e,n,i){nN(t.x,e,yae,n?n.x:void 0,i?i.x:void 0),nN(t.y,e,xae,n?n.y:void 0,i?i.y:void 0)}function rN(t){return t.translate===0&&t.scale===1}function hV(t){return rN(t.x)&&rN(t.y)}function sN(t,e){return t.min===e.min&&t.max===e.max}function _ae(t,e){return sN(t.x,e.x)&&sN(t.y,e.y)}function oN(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function pV(t,e){return oN(t.x,e.x)&&oN(t.y,e.y)}function aN(t){return Hr(t.x)/Hr(t.y)}function lN(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Sae{constructor(){this.members=[]}add(e){JA(this.members,e),e.scheduleRender()}remove(e){if(v_(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(r=>e===r);if(n===0)return!1;let i;for(let r=n;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender(),e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:r}=e.options;r===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function wae(t,e,n){let i="";const r=t.x.translate/e.x,s=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((r||s||o)&&(i=`translate3d(${r}px, ${s}px, ${o}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:c,rotate:d,rotateX:h,rotateY:p,skewX:g,skewY:v}=n;c&&(i=`perspective(${c}px) ${i}`),d&&(i+=`rotate(${d}deg) `),h&&(i+=`rotateX(${h}deg) `),p&&(i+=`rotateY(${p}deg) `),g&&(i+=`skewX(${g}deg) `),v&&(i+=`skewY(${v}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(i+=`scale(${a}, ${l})`),i||"none"}const Mae=(t,e)=>t.depth-e.depth;class Eae{constructor(){this.children=[],this.isDirty=!1}add(e){JA(this.children,e),this.isDirty=!0}remove(e){v_(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Mae),this.isDirty=!1,this.children.forEach(e)}}function ty(t){const e=ii(t)?t.get():t;return voe(e)?e.toValue():e}function bae(t,e){const n=So.now(),i=({timestamp:r})=>{const s=r-n;s>=e&&(_a(i),t(s-e))};return on.read(i,!0),()=>_a(i)}function mV(t){return t instanceof SVGElement&&t.tagName!=="svg"}function gV(t,e,n){const i=ii(t)?t:Pf(t);return i.start(QA("",i,e,n)),i.animation}const xc={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},ep=typeof window<"u"&&window.MotionDebug!==void 0,E1=["","X","Y","Z"],Tae={visibility:"hidden"},cN=1e3;let Aae=0;function b1(t,e,n,i){const{latestValues:r}=e;r[t]&&(n[t]=r[t],e.setStaticValue(t,0),i&&(i[t]=0))}function vV(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=q4(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:r,layoutId:s}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",on,!(r||s))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&vV(i)}function yV({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:r}){return class{constructor(o={},a=e==null?void 0:e()){this.id=Aae++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,ep&&(xc.totalNodes=xc.resolvedTargetDeltas=xc.recalculatedProjection=0),this.nodes.forEach(Rae),this.nodes.forEach(Oae),this.nodes.forEach(kae),this.nodes.forEach(Iae),ep&&window.MotionDebug.record(xc)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;t(o,()=>{this.root.updateBlockedByResize=!0,h&&h(),h=bae(p,250),ey.hasAnimatedSinceResize&&(ey.hasAnimatedSinceResize=!1,this.nodes.forEach(dN))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p,hasRelativeTargetChanged:g,layout:v})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const _=this.options.transition||d.getDefaultTransition()||Vae,{onLayoutAnimationStart:y,onLayoutAnimationComplete:m}=d.getProps(),w=!this.targetLayout||!pV(this.targetLayout,v)||g,S=!p&&g;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||S||p&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(h,S);const E={...zA(_,"layout"),onPlay:y,onComplete:m};(d.shouldReduceMotion||this.options.layoutRoot)&&(E.delay=0,E.type=!1),this.startAnimation(E)}else p||dN(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=v})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,_a(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Fae),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&vV(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const C=E/1e3;fN(h.x,o.x,C),fN(h.y,o.y,C),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Sp(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox),zae(this.relativeTarget,this.relativeTargetOrigin,p,C),S&&_ae(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=zn()),is(S,this.relativeTarget)),_&&(this.animationValues=d,pae(d,c,this.latestValues,C,w,m)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(_a(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=on.update(()=>{ey.hasAnimatedSinceResize=!0,this.currentAnimation=gV(0,cN,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(cN),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:d}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&xV(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||zn();const h=Hr(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const p=Hr(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+p}is(a,l),Dd(a,d),_p(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Sae),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&b1("z",o,c,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(uN),this.root.sharedNodes.clear()}}}function Cae(t){t.updateLayout()}function Pae(t){var e;const n=((e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&n&&t.hasListeners("didUpdate")){const{layoutBox:i,measuredBox:r}=t.layout,{animationType:s}=t.options,o=n.source!==t.layout.source;s==="size"?rs(h=>{const p=o?n.measuredBox[h]:n.layoutBox[h],g=Hr(p);p.min=i[h].min,p.max=p.min+g}):xV(s,n.layoutBox,i)&&rs(h=>{const p=o?n.measuredBox[h]:n.layoutBox[h],g=Hr(i[h]);p.max=p.min+g,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+g)});const a=Id();_p(a,i,n.layoutBox);const l=Id();o?_p(l,t.applyTransform(r,!0),n.measuredBox):_p(l,i,n.layoutBox);const c=!hV(a);let d=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:p,layout:g}=h;if(p&&g){const v=zn();Sp(v,n.layoutBox,p.layoutBox);const _=zn();Sp(_,i,g.layoutBox),pV(v,_)||(d=!0),h.options.layoutRoot&&(t.relativeTarget=_,t.relativeTargetOrigin=v,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:d})}else if(t.isLead()){const{onExitComplete:i}=t.options;i&&i()}t.options.transition=void 0}function Rae(t){ep&&xc.totalNodes++,t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Iae(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Lae(t){t.clearSnapshot()}function uN(t){t.clearMeasurements()}function Dae(t){t.isLayoutDirty=!1}function Nae(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function dN(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Oae(t){t.resolveTargetDelta()}function kae(t){t.calcProjection()}function Fae(t){t.resetSkewAndRotation()}function Uae(t){t.removeLeadSnapshot()}function fN(t,e,n){t.translate=bn(e.translate,0,n),t.scale=bn(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function hN(t,e,n,i){t.min=bn(e.min,n.min,i),t.max=bn(e.max,n.max,i)}function zae(t,e,n,i){hN(t.x,e.x,n.x,i),hN(t.y,e.y,n.y,i)}function Bae(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Vae={duration:.45,ease:[.4,0,.1,1]},pN=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),mN=pN("applewebkit/")&&!pN("chrome/")?Math.round:ji;function gN(t){t.min=mN(t.min),t.max=mN(t.max)}function Hae(t){gN(t.x),gN(t.y)}function xV(t,e,n){return t==="position"||t==="preserve-aspect"&&!joe(aN(e),aN(n),.2)}function Wae(t){var e;return t!==t.root&&((e=t.scroll)===null||e===void 0?void 0:e.wasRoot)}const Gae=yV({attachResizeListener:(t,e)=>ia(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),T1={current:void 0},_V=yV({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!T1.current){const t=new Gae({});t.mount(window),t.setOptions({layoutScroll:!0}),T1.current=t}return T1.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),jae={pan:{Feature:aae},drag:{Feature:oae,ProjectionNode:_V,MeasureLayout:uV}};function vN(t,e){const n=e?"pointerenter":"pointerleave",i=e?"onHoverStart":"onHoverEnd",r=(s,o)=>{if(s.pointerType==="touch"||tV())return;const a=t.getProps();t.animationState&&a.whileHover&&t.animationState.setActive("whileHover",e);const l=a[i];l&&on.postRender(()=>l(s,o))};return ca(t.current,n,r,{passive:!t.getProps()[i]})}class Xae extends Wl{mount(){this.unmount=la(vN(this.node,!0),vN(this.node,!1))}unmount(){}}class qae extends Wl{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=la(ia(this.node.current,"focus",()=>this.onFocus()),ia(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const SV=(t,e)=>e?t===e?!0:SV(t,e.parentElement):!1;function A1(t,e){if(!e)return;const n=new PointerEvent("pointer"+t);e(n,x_(n))}class $ae extends Wl{constructor(){super(...arguments),this.removeStartListeners=ji,this.removeEndListeners=ji,this.removeAccessibleListeners=ji,this.startPointerPress=(e,n)=>{if(this.isPressing)return;this.removeEndListeners();const i=this.node.getProps(),s=ca(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:c,onTapCancel:d,globalTapTarget:h}=this.node.getProps(),p=!h&&!SV(this.node.current,a.target)?d:c;p&&on.update(()=>p(a,l))},{passive:!(i.onTap||i.onPointerUp)}),o=ca(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(i.onTapCancel||i.onPointerCancel)});this.removeEndListeners=la(s,o),this.startPress(e,n)},this.startAccessiblePress=()=>{const e=s=>{if(s.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||A1("up",(l,c)=>{const{onTap:d}=this.node.getProps();d&&on.postRender(()=>d(l,c))})};this.removeEndListeners(),this.removeEndListeners=ia(this.node.current,"keyup",o),A1("down",(a,l)=>{this.startPress(a,l)})},n=ia(this.node.current,"keydown",e),i=()=>{this.isPressing&&A1("cancel",(s,o)=>this.cancelPress(s,o))},r=ia(this.node.current,"blur",i);this.removeAccessibleListeners=la(n,r)}}startPress(e,n){this.isPressing=!0;const{onTapStart:i,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),i&&on.postRender(()=>i(e,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!tV()}cancelPress(e,n){if(!this.checkPressEnd())return;const{onTapCancel:i}=this.node.getProps();i&&on.postRender(()=>i(e,n))}mount(){const e=this.node.getProps(),n=ca(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),i=ia(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=la(n,i)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const sb=new WeakMap,C1=new WeakMap,Yae=t=>{const e=sb.get(t.target);e&&e(t)},Zae=t=>{t.forEach(Yae)};function Kae({root:t,...e}){const n=t||document;C1.has(n)||C1.set(n,{});const i=C1.get(n),r=JSON.stringify(e);return i[r]||(i[r]=new IntersectionObserver(Zae,{root:t,...e})),i[r]}function Qae(t,e,n){const i=Kae(e);return sb.set(t,n),i.observe(t),()=>{sb.delete(t),i.unobserve(t)}}const Jae={some:0,all:1};class ele extends Wl{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:r="some",once:s}=e,o={root:n?n.current:void 0,rootMargin:i,threshold:typeof r=="number"?r:Jae[r]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,s&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),p=c?d:h;p&&p(l)};return Qae(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(tle(e,n))&&this.startObserver()}unmount(){}}function tle({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const nle={inView:{Feature:ele},tap:{Feature:$ae},focus:{Feature:qae},hover:{Feature:Xae}},ile={layout:{ProjectionNode:_V,MeasureLayout:uV}},ag=b.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"}),S_=b.createContext({}),sC=typeof window<"u",lg=sC?b.useLayoutEffect:b.useEffect,wV=b.createContext({strict:!1});function rle(t,e,n,i,r){var s,o;const{visualElement:a}=b.useContext(S_),l=b.useContext(wV),c=b.useContext(__),d=b.useContext(ag).reducedMotion,h=b.useRef();i=i||l.renderer,!h.current&&i&&(h.current=i(t,{visualState:e,parent:a,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d}));const p=h.current,g=b.useContext(cV);p&&!p.projection&&r&&(p.type==="html"||p.type==="svg")&&sle(h.current,n,r,g),b.useInsertionEffect(()=>{p&&p.update(n,c)});const v=n[X4],_=b.useRef(!!v&&!(!((s=window.MotionHandoffIsComplete)===null||s===void 0)&&s.call(window,v))&&((o=window.MotionHasOptimisedAnimation)===null||o===void 0?void 0:o.call(window,v)));return lg(()=>{p&&(window.MotionIsMounted=!0,p.updateFeatures(),rC.render(p.render),_.current&&p.animationState&&p.animationState.animateChanges())}),b.useEffect(()=>{p&&(!_.current&&p.animationState&&p.animationState.animateChanges(),_.current&&(queueMicrotask(()=>{var y;(y=window.MotionHandoffMarkAsComplete)===null||y===void 0||y.call(window,v)}),_.current=!1))}),p}function sle(t,e,n,i){const{layoutId:r,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:MV(t.parent)),t.projection.setOptions({layoutId:r,layout:s,alwaysMeasureLayout:!!o||a&&Rd(a),visualElement:t,animationType:typeof s=="string"?s:"both",initialPromotionConfig:i,layoutScroll:l,layoutRoot:c})}function MV(t){if(t)return t.options.allowProjection!==!1?t.projection:MV(t.parent)}function ole(t,e,n){return b.useCallback(i=>{i&&t.mount&&t.mount(i),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):Rd(n)&&(n.current=i))},[e])}function w_(t){return Cm(t.animate)||UA.some(e=>Pm(t[e]))}function EV(t){return!!(w_(t)||t.variants)}function ale(t,e){if(w_(t)){const{initial:n,animate:i}=t;return{initial:n===!1||Pm(n)?n:void 0,animate:Pm(i)?i:void 0}}return t.inherit!==!1?e:{}}function lle(t){const{initial:e,animate:n}=ale(t,b.useContext(S_));return b.useMemo(()=>({initial:e,animate:n}),[yN(e),yN(n)])}function yN(t){return Array.isArray(t)?t.join(" "):t}const xN={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Rf={};for(const t in xN)Rf[t]={isEnabled:e=>xN[t].some(n=>!!e[n])};function cle(t){for(const e in t)Rf[e]={...Rf[e],...t[e]}}const ule=Symbol.for("motionComponentSymbol");function dle({preloadedFeatures:t,createVisualElement:e,useRender:n,useVisualState:i,Component:r}){t&&cle(t);function s(a,l){let c;const d={...b.useContext(ag),...a,layoutId:fle(a)},{isStatic:h}=d,p=lle(a),g=i(a,h);if(!h&&sC){hle();const v=ple(d);c=v.MeasureLayout,p.visualElement=rle(r,g,d,e,v.ProjectionNode)}return P.jsxs(S_.Provider,{value:p,children:[c&&p.visualElement?P.jsx(c,{visualElement:p.visualElement,...d}):null,n(r,a,ole(g,p.visualElement,l),g,h,p.visualElement)]})}const o=b.forwardRef(s);return o[ule]=r,o}function fle({layoutId:t}){const e=b.useContext(iC).id;return e&&t!==void 0?e+"-"+t:t}function hle(t,e){b.useContext(wV).strict}function ple(t){const{drag:e,layout:n}=Rf;if(!e&&!n)return{};const i={...e,...n};return{MeasureLayout:e!=null&&e.isEnabled(t)||n!=null&&n.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}const mle=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function oC(t){return typeof t!="string"||t.includes("-")?!1:!!(mle.indexOf(t)>-1||/[A-Z]/u.test(t))}function bV(t,{style:e,vars:n},i,r){Object.assign(t.style,e,r&&r.getProjectionStyles(i));for(const s in n)t.style.setProperty(s,n[s])}const TV=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function AV(t,e,n,i){bV(t,e,void 0,i);for(const r in e.attrs)t.setAttribute(TV.has(r)?r:y_(r),e.attrs[r])}function CV(t,{layout:e,layoutId:n}){return Hl.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Qy[t]||t==="opacity")}function aC(t,e,n){var i;const{style:r}=t,s={};for(const o in r)(ii(r[o])||e.style&&ii(e.style[o])||CV(o,t)||((i=n==null?void 0:n.getValue(o))===null||i===void 0?void 0:i.liveStyle)!==void 0)&&(s[o]=r[o]);return n&&r&&typeof r.willChange=="string"&&(n.applyWillChange=!1),s}function PV(t,e,n){const i=aC(t,e,n);for(const r in t)if(ii(t[r])||ii(e[r])){const s=rg.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;i[s]=t[r]}return i}function Zf(t){const e=b.useRef(null);return e.current===null&&(e.current=t()),e.current}function gle(t){if(Hl.has(t))return"transform";if(V4.has(t))return y_(t)}function vle({applyWillChange:t=!1,scrapeMotionValuesFromProps:e,createRenderState:n,onMount:i},r,s,o,a){const l={latestValues:yle(r,s,o,a?!1:t,e),renderState:n()};return i&&(l.mount=c=>i(r,c,l)),l}const RV=t=>(e,n)=>{const i=b.useContext(S_),r=b.useContext(__),s=()=>vle(t,e,i,r,n);return n?s():Zf(s)};function _N(t,e,n){const i=Array.isArray(e)?e:[e];for(let r=0;r{for(const w in y){let S=y[w];if(Array.isArray(S)){const E=v?S.length-1:0;S=S[E]}S!==null&&(o[w]=S)}for(const w in m)o[w]=m[w]}),l&&(h&&d!==!1&&!Cm(h)&&_N(t,h,y=>{for(const m in y){const w=gle(m);w&&a.add(w)}}),a.size&&(o.willChange=Array.from(a).join(","))),o}const lC=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),IV=()=>({...lC(),attrs:{}}),LV=(t,e)=>e&&typeof t=="number"?e.transform(t):t,xle={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},_le=rg.length;function Sle(t,e,n){let i="",r=!0;for(let s=0;s<_le;s++){const o=rg[s],a=t[o];if(a===void 0)continue;let l=!0;if(typeof a=="number"?l=a===(o.startsWith("scale")?1:0):l=parseFloat(a)===0,!l||n){const c=LV(a,XA[o]);if(!l){r=!1;const d=xle[o]||o;i+=`${d}(${c}) `}n&&(e[o]=c)}}return i=i.trim(),n?i=n(e,r?"":i):r&&(i="none"),i}function cC(t,e,n){const{style:i,vars:r,transformOrigin:s}=t;let o=!1,a=!1;for(const l in e){const c=e[l];if(Hl.has(l)){o=!0;continue}else if(v4(l)){r[l]=c;continue}else{const d=LV(c,XA[l]);l.startsWith("origin")?(a=!0,s[l]=d):i[l]=d}}if(e.transform||(o||n?i.transform=Sle(e,t.transform,n):i.transform&&(i.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:d=0}=s;i.transformOrigin=`${l} ${c} ${d}`}}function SN(t,e,n){return typeof t=="string"?t:vt.transform(e+n*t)}function wle(t,e,n){const i=SN(e,t.x,t.width),r=SN(n,t.y,t.height);return`${i} ${r}`}const Mle={offset:"stroke-dashoffset",array:"stroke-dasharray"},Ele={offset:"strokeDashoffset",array:"strokeDasharray"};function ble(t,e,n=1,i=0,r=!0){t.pathLength=1;const s=r?Mle:Ele;t[s.offset]=vt.transform(-i);const o=vt.transform(e),a=vt.transform(n);t[s.array]=`${o} ${a}`}function uC(t,{attrX:e,attrY:n,attrScale:i,originX:r,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},d,h){if(cC(t,c,h),d){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:p,style:g,dimensions:v}=t;p.transform&&(v&&(g.transform=p.transform),delete p.transform),v&&(r!==void 0||s!==void 0||g.transform)&&(g.transformOrigin=wle(v,r!==void 0?r:.5,s!==void 0?s:.5)),e!==void 0&&(p.x=e),n!==void 0&&(p.y=n),i!==void 0&&(p.scale=i),o!==void 0&&ble(p,o,a,l,!1)}const dC=t=>typeof t=="string"&&t.toLowerCase()==="svg",Tle={useVisualState:RV({scrapeMotionValuesFromProps:PV,createRenderState:IV,onMount:(t,e,{renderState:n,latestValues:i})=>{on.read(()=>{try{n.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),on.render(()=>{uC(n,i,dC(e.tagName),t.transformTemplate),AV(e,n)})}})},Ale={useVisualState:RV({applyWillChange:!0,scrapeMotionValuesFromProps:aC,createRenderState:lC})};function DV(t,e,n){for(const i in e)!ii(e[i])&&!CV(i,n)&&(t[i]=e[i])}function Cle({transformTemplate:t},e){return b.useMemo(()=>{const n=lC();return cC(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Ple(t,e){const n=t.style||{},i={};return DV(i,n,t),Object.assign(i,Cle(t,e)),i}function Rle(t,e){const n={},i=Ple(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const Ile=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Jy(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Ile.has(t)}let NV=t=>!Jy(t);function Lle(t){t&&(NV=e=>e.startsWith("on")?!Jy(e):t(e))}try{Lle(require("@emotion/is-prop-valid").default)}catch{}function Dle(t,e,n){const i={};for(const r in t)r==="values"&&typeof t.values=="object"||(NV(r)||n===!0&&Jy(r)||!e&&!Jy(r)||t.draggable&&r.startsWith("onDrag"))&&(i[r]=t[r]);return i}function Nle(t,e,n,i){const r=b.useMemo(()=>{const s=IV();return uC(s,e,dC(i),t.transformTemplate),{...s.attrs,style:{...s.style}}},[e]);if(t.style){const s={};DV(s,t.style,t),r.style={...s,...r.style}}return r}function Ole(t=!1){return(n,i,r,{latestValues:s},o)=>{const l=(oC(n)?Nle:Rle)(i,s,o,n),c=Dle(i,typeof n=="string",t),d=n!==b.Fragment?{...c,...l,ref:r}:{},{children:h}=i,p=b.useMemo(()=>ii(h)?h.get():h,[h]);return b.createElement(n,{...d,children:p})}}function kle(t,e){return function(i,{forwardMotionProps:r}={forwardMotionProps:!1}){const o={...oC(i)?Tle:Ale,preloadedFeatures:t,useRender:Ole(r),createVisualElement:e,Component:i};return dle(o)}}const ob={current:null},OV={current:!1};function Fle(){if(OV.current=!0,!!sC)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ob.current=t.matches;t.addListener(e),e()}else ob.current=!1}function Ule(t,e,n){for(const i in e){const r=e[i],s=n[i];if(ii(r))t.addValue(i,r);else if(ii(s))t.addValue(i,Pf(r,{owner:t}));else if(s!==r)if(t.hasValue(i)){const o=t.getValue(i);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=t.getStaticValue(i);t.addValue(i,Pf(o!==void 0?o:r,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const If=new WeakMap,zle=[..._4,zi,Dl],Ble=t=>zle.find(x4(t)),wN=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class kV{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:r,blockInitialAnimation:s,visualState:o},a={}){this.applyWillChange=!1,this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=WA,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=So.now();this.renderScheduledAtthis.bindToMotionValue(i,n)),OV.current||Fle(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:ob.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){If.delete(this.current),this.projection&&this.projection.unmount(),_a(this.notifyUpdate),_a(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const i=Hl.has(e),r=n.on("change",a=>{this.latestValues[e]=a,this.props.onUpdate&&on.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0)}),s=n.on("renderRequest",this.scheduleRender);let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{r(),s(),o&&o(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Rf){const n=Rf[e];if(!n)continue;const{isEnabled:i,Feature:r}=n;if(!this.features[e]&&r&&i(this.props)&&(this.features[e]=new r(this)),this.features[e]){const s=this.features[e];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):zn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;in.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=Pf(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){var i;let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(i=this.getBaseTargetFromProps(this.props,e))!==null&&i!==void 0?i:this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(m4(r)||p4(r))?r=parseFloat(r):!Ble(r)&&Dl.test(n)&&(r=C4(e,n)),this.setBaseTarget(e,ii(r)?r.get():r)),ii(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var n;const{initial:i}=this.props;let r;if(typeof i=="string"||typeof i=="object"){const o=kA(this.props,i,(n=this.presenceContext)===null||n===void 0?void 0:n.custom);o&&(r=o[e])}if(i&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!ii(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new eC),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}}class FV extends kV{constructor(){super(...arguments),this.KeyframeResolver=P4}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}}function Vle(t){return window.getComputedStyle(t)}class UV extends FV{constructor(){super(...arguments),this.type="html",this.applyWillChange=!0,this.renderInstance=bV}readValueFromInstance(e,n){if(Hl.has(n)){const i=qA(n);return i&&i.default||0}else{const i=Vle(e),r=(v4(n)?i.getPropertyValue(n):i[n])||0;return typeof r=="string"?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:n}){return aV(e,n)}build(e,n,i){cC(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return aC(e,n,i)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;ii(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class zV extends FV{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=zn}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Hl.has(n)){const i=qA(n);return i&&i.default||0}return n=TV.has(n)?n:y_(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return PV(e,n,i)}build(e,n,i){uC(e,n,this.isSVGTag,i.transformTemplate)}renderInstance(e,n,i,r){AV(e,n,i,r)}mount(e){this.isSVGTag=dC(e.tagName),super.mount(e)}}const Hle=(t,e)=>oC(t)?new zV(e):new UV(e,{allowProjection:t!==b.Fragment}),Wle=kle({...koe,...nle,...jae,...ile},Hle),wp=Ore(Wle);class Gle extends b.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent){const i=this.props.sizeRef.current;i.height=n.offsetHeight||0,i.width=n.offsetWidth||0,i.top=n.offsetTop,i.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function jle({children:t,isPresent:e}){const n=b.useId(),i=b.useRef(null),r=b.useRef({width:0,height:0,top:0,left:0}),{nonce:s}=b.useContext(ag);return b.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:c}=r.current;if(e||!i.current||!o||!a)return;i.current.dataset.motionPopId=n;const d=document.createElement("style");return s&&(d.nonce=s),document.head.appendChild(d),d.sheet&&d.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${o}px !important; + height: ${a}px !important; + top: ${l}px !important; + left: ${c}px !important; + } + `),()=>{document.head.removeChild(d)}},[e]),P.jsx(Gle,{isPresent:e,childRef:i,sizeRef:r,children:b.cloneElement(t,{ref:i})})}const Xle=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:r,presenceAffectsLayout:s,mode:o})=>{const a=Zf(qle),l=b.useId(),c=b.useCallback(h=>{a.set(h,!0);for(const p of a.values())if(!p)return;i&&i()},[a,i]),d=b.useMemo(()=>({id:l,initial:e,isPresent:n,custom:r,onExitComplete:c,register:h=>(a.set(h,!1),()=>a.delete(h))}),s?[Math.random(),c]:[n,c]);return b.useMemo(()=>{a.forEach((h,p)=>a.set(p,!1))},[n]),b.useEffect(()=>{!n&&!a.size&&i&&i()},[n]),o==="popLayout"&&(t=P.jsx(jle,{isPresent:n,children:t})),P.jsx(__.Provider,{value:d,children:t})};function qle(){return new Map}const C0=t=>t.key||"";function MN(t){const e=[];return b.Children.forEach(t,n=>{b.isValidElement(n)&&e.push(n)}),e}const $le=({children:t,exitBeforeEnter:e,custom:n,initial:i=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:o="sync"})=>{const a=b.useMemo(()=>MN(t),[t]),l=a.map(C0),c=b.useRef(!0),d=b.useRef(a),h=Zf(()=>new Map),[p,g]=b.useState(a),[v,_]=b.useState(a);lg(()=>{c.current=!1,d.current=a;for(let w=0;w{const S=C0(w),E=a===v||l.includes(S),C=()=>{if(h.has(S))h.set(S,!0);else return;let R=!0;h.forEach(I=>{I||(R=!1)}),R&&(m==null||m(),_(d.current),r&&r())};return P.jsx(Xle,{isPresent:E,initial:!c.current||i?void 0:!1,custom:E?void 0:n,presenceAffectsLayout:s,mode:o,onExitComplete:E?void 0:C,children:w},S)})})};function Lf(t){const e=Zf(()=>Pf(t)),{isStatic:n}=b.useContext(ag);if(n){const[,i]=b.useState(t);b.useEffect(()=>e.on("change",i),[])}return e}function BV(t,e){const n=Lf(e()),i=()=>n.set(e());return i(),lg(()=>{const r=()=>on.preRender(i,!1,!0),s=t.map(o=>o.on("change",r));return()=>{s.forEach(o=>o()),_a(i)}}),n}const Yle=t=>t&&typeof t=="object"&&t.mix,Zle=t=>Yle(t)?t.mix:void 0;function Kle(...t){const e=!Array.isArray(t[0]),n=e?0:-1,i=t[0+n],r=t[1+n],s=t[2+n],o=t[3+n],a=F4(r,s,{mixer:Zle(s[0]),...o});return e?a(i):a}function Qle(t){xp.current=[],t();const e=BV(xp.current,t);return xp.current=void 0,e}function EN(t,e,n,i){if(typeof t=="function")return Qle(t);const r=typeof e=="function"?e:Kle(e,n,i);return Array.isArray(t)?bN(t,r):bN([t],([s])=>r(s))}function bN(t,e){const n=Zf(()=>[]);return BV(t,()=>{n.length=0;const i=t.length;for(let r=0;r{}),a=()=>{const c=i.current;c&&c.time===0&&c.sample(mi.delta),l(),i.current=roe({keyframes:[r.get(),s.current],velocity:r.getVelocity(),type:"spring",restDelta:.001,restSpeed:.01,...e,onUpdate:o.current})},l=()=>{i.current&&i.current.stop()};return b.useInsertionEffect(()=>r.attach((c,d)=>n?d(c):(s.current=c,o.current=d,on.update(a),r.get()),l),[JSON.stringify(e)]),lg(()=>{if(ii(t))return t.on("change",c=>r.set(TN(c)))},[r]),r}function Jle(t,e,n){var i;if(typeof t=="string"){let r=document;n?((i=n[t])!==null&&i!==void 0||(n[t]=r.querySelectorAll(t)),t=n[t]):t=r.querySelectorAll(t)}else t instanceof Element&&(t=[t]);return Array.from(t||[])}function ece(t){t.values.forEach(e=>e.stop())}function ab(t,e){[...e].reverse().forEach(i=>{const r=t.getVariant(i);r&&tC(t,r),t.variantChildren&&t.variantChildren.forEach(s=>{ab(s,e)})})}function tce(t,e){if(Array.isArray(e))return ab(t,e);if(typeof e=="string")return ab(t,[e]);tC(t,e)}function nce(){const t=new Set,e={subscribe(n){return t.add(n),()=>void t.delete(n)},start(n,i){const r=[];return t.forEach(s=>{r.push($4(s,n,{transitionOverride:i}))}),Promise.all(r)},set(n){return t.forEach(i=>{tce(i,n)})},stop(){t.forEach(n=>{ece(n)})},mount(){return()=>{e.stop()}}};return e}function ice(t,e=100,n){const i=n({...t,keyframes:[0,e]}),r=Math.min(B4(i),QE);return{type:"keyframes",ease:s=>i.next(r*s).value/e,duration:xo(r)}}function fC(t){return typeof t=="object"&&!Array.isArray(t)}function VV(t,e,n,i){return typeof t=="string"&&fC(e)?Jle(t,n,i):t instanceof NodeList?Array.from(t):Array.isArray(t)?t:[t]}function AN(t,e,n,i){var r;return typeof e=="number"?e:e.startsWith("-")||e.startsWith("+")?Math.max(0,t+parseFloat(e)):e==="<"?n:(r=i.get(e))!==null&&r!==void 0?r:t}const rce=(t,e,n)=>{const i=e-t;return((n-t)%i+i)%i+t};function sce(t,e){return N4(t)?t[rce(0,t.length,e)]:t}function oce(t,e,n){for(let i=0;ie&&r.at{const F=dce(E),{delay:A=0,times:D=z4(F),type:j="keyframes",...K}=C;let{ease:V=e.ease||"easeOut",duration:Z}=C;const Y=typeof A=="function"?A(I,N):A,J=F.length,k=m_(j)?j:r==null?void 0:r[j];if(J<=2&&k){let de=100;if(J===2&&pce(F)){const he=F[1]-F[0];de=Math.abs(he)}const be={...K};Z!==void 0&&(be.duration=yo(Z));const ie=ice(be,de,k);V=ie.ease,Z=ie.duration}Z??(Z=s);const W=h+Y,$=W+Z;D.length===1&&D[0]===0&&(D[1]=1);const Q=D.length-F.length;Q>0&&U4(D,Q),F.length===1&&F.unshift(null),ace(R,F,V,D,W,$),w=Math.max(Y+Z,w),p=Math.max($,p)};if(ii(_)){const E=CN(_,a);S(y,m,PN("default",E))}else{const E=VV(_,y,i,l),C=E.length;for(let R=0;R{for(const _ in g){const y=g[_];y.sort(lce);const m=[],w=[],S=[];for(let C=0;Ctypeof t=="number",pce=t=>t.every(hce);function mce(t,e){return t in e}class gce extends kV{constructor(){super(...arguments),this.type="object"}readValueFromInstance(e,n){if(mce(n,e)){const i=e[n];if(typeof i=="string"||typeof i=="number")return i}}getBaseTargetFromProps(){}removeValueFromRenderState(e,n){delete n.output[e]}measureInstanceViewportBox(){return zn()}build(e,n){Object.assign(e.output,n)}renderInstance(e,{output:n}){Object.assign(e,n)}sortInstanceNodePosition(){return 0}}function vce(t){const e={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=mV(t)?new zV(e):new UV(e);n.mount(t),If.set(t,n)}function yce(t){const e={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new gce(e);n.mount(t),If.set(t,n)}function xce(t,e){return ii(t)||typeof t=="number"||typeof t=="string"&&!fC(e)}function HV(t,e,n,i){const r=[];if(xce(t,e))r.push(gV(t,fC(e)&&e.default||e,n&&(n.default||n)));else{const s=VV(t,e,i),o=s.length;for(let a=0;a{i.push(...HV(a,s,o))}),i}function Sce(t){return Array.isArray(t)&&Array.isArray(t[0])}function wce(t){function e(n,i,r){let s=[];return Sce(n)?s=_ce(n,i,t):s=HV(n,i,r,t),new j4(s)}return e}const lb=wce();function Mce(){const t=Zf(nce);return lg(t.mount,[]),t}const Ece=Mce,RN=48,WV=b.createContext({width:0,hovered:!1,setIsZooming:()=>{},zoomLevel:null,mouseX:null}),bce=()=>b.useContext(WV);function Tce({className:t,children:e,fixedChildren:n}){const[i,r]=b.useState(!1),[s,o]=b.useState(0),a=b.useRef(null),l=b.useRef(!1),c=b.useCallback(p=>{l.current=p,r(!p)},[]),d=Lf(1);jV(()=>{var p;o(((p=a.current)==null?void 0:p.clientWidth)||0)});const h=Lf(1/0);return P.jsx(WV.Provider,{value:{hovered:i,setIsZooming:c,width:s,zoomLevel:d,mouseX:h},children:P.jsxs(wp.div,{ref:a,className:qt("absolute bottom-4 left-1/2 flex h-14 max-w-[80%] -translate-x-1/2 transform items-end gap-3 rounded-xl bg-opacity-90 p-2","bg-gradient-to-t from-white/10 to-white/0 p-2 no-underline shadow-sm transition-colors hover:from-white/15","shadow-[0_1px_0_0_rgba(255,255,255,0.03)_inset,0_0_0_1px_rgba(255,255,255,0.03)_inset,0_0_0_0px_rgba(0,0,0,0.1),0_2px_2px_0_rgba(0,0,0,0.1),0_4px_4px_0_rgba(0,0,0,0.1),0_8px_8px_0_rgba(0,0,0,0.1)]",t),onMouseMove:p=>{h.set(p.pageX),l.current||r(!0)},onMouseLeave:()=>{h.set(1/0),r(!1)},style:{x:"-50%",scale:d},children:[P.jsx("div",{className:"no-scrollbar flex items-end gap-3 overflow-y-visible overflow-x-scroll",children:e}),n&&P.jsxs(P.Fragment,{children:[P.jsx(Ace,{})," ",n]})]})})}function GV({className:t,children:e,id:n,handleClick:i,active:r=!1}){const s=b.useRef(null),[o,a]=b.useState(0),l=bce(),c=P1(RN,{stiffness:320,damping:20,mass:.1}),d=P1(0,{stiffness:300,damping:20});Pce({onChange:({value:m})=>{const w=m.x;if(l.width>0){const S=RN+36*Math.cos((w-o)/l.width*Math.PI/2)**12;l.hovered&&lb(c,S)}}},[o,l]),jV(()=>{var w;const{x:m}=((w=s.current)==null?void 0:w.getBoundingClientRect())||{x:0};a(m+24)});const h=b.useRef(!1),p=Ece(),g=b.useRef(null);b.useEffect(()=>{r!==h.current&&(r?(h.current=!0,d.set(.5),p.start({y:-5,transition:{repeat:1/0,repeatType:"reverse",duration:.75}})):(h.current=!1,d.set(0),p.start({y:0,transition:{duration:.75}})))},[r]),b.useEffect(()=>()=>clearTimeout(g.current),[]);const v=EN(l.mouseX,m=>{var S;const w=((S=s.current)==null?void 0:S.getBoundingClientRect())??{x:0,width:0};return m-w.x-w.width/2});let _=EN(v,[-150,0,150],[40,80,40]),y=P1(_,{mass:.1,stiffness:150,damping:12});return P.jsxs("div",{className:"flex flex-col items-center gap-1 pt-2",children:[P.jsxs(wp.button,{ref:s,className:qt("saturate-90 transition-filter hover:brightness-112 grid aspect-square place-content-center rounded-lg border border-black/5 border-opacity-10 bg-gradient-to-b from-slate-700 to-black brightness-90 duration-200 hover:saturate-100 dark:border-white/5",t),onClick:i?()=>i():void 0,style:{width:y},animate:p,whileTap:{scale:.95},children:[e," "]}),P.jsx($le,{mode:"popLayout",children:h.current?P.jsx(wp.div,{layoutId:n,className:"rounded-full",style:{opacity:d},children:P.jsx(wp.div,{exit:{transition:{duration:0}},className:"h-1.5 w-1.5 rounded-full bg-black dark:bg-white",style:{opacity:d}})},n):null})]},n)}function Ace(){return P.jsx(wp.div,{className:"flex h-full cursor-ns-resize items-center p-1.5",drag:"y",dragConstraints:{top:-100,bottom:50},children:P.jsx("span",{className:"h-full w-0.5 rounded bg-neutral-800/10 dark:bg-neutral-100/10"})})}function jV(t){const e=Cce(t);b.useEffect(()=>{const n=()=>{e(window.innerWidth,window.innerHeight)};return n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},[e])}function Cce(t){const e=b.useRef(t);return b.useEffect(()=>{e.current=t}),b.useMemo(()=>(...n)=>{var i;return(i=e.current)==null?void 0:i.call(e,...n)},[])}function Pce(t={},e=[]){const{onChange:n}=t,i=Lf(0),r=Lf(0);return b.useEffect(()=>{const s=c=>{lb(i,c.clientX),lb(r,c.clientY)},o=()=>{n&&n({value:{x:i.get(),y:r.get()}})},a=i.on("change",o),l=r.on("change",o);return window.addEventListener("mousemove",s),()=>{window.removeEventListener("mousemove",s),a(),l()}},[i,r,n,...e]),b.useMemo(()=>({x:i,y:r}),[i,r])}var hC="Dialog",[XV,Zde]=gu(hC),[Rce,Ws]=XV(hC),qV=t=>{const{__scopeDialog:e,children:n,open:i,defaultOpen:r,onOpenChange:s,modal:o=!0}=t,a=b.useRef(null),l=b.useRef(null),[c=!1,d]=ru({prop:i,defaultProp:r,onChange:s});return P.jsx(Rce,{scope:e,triggerRef:a,contentRef:l,contentId:yl(),titleId:yl(),descriptionId:yl(),open:c,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(h=>!h),[d]),modal:o,children:n})};qV.displayName=hC;var $V="DialogTrigger",Ice=b.forwardRef((t,e)=>{const{__scopeDialog:n,...i}=t,r=Ws($V,n),s=$t(e,r.triggerRef);return P.jsx(Tt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":gC(r.open),...i,ref:s,onClick:ht(t.onClick,r.onOpenToggle)})});Ice.displayName=$V;var pC="DialogPortal",[Lce,YV]=XV(pC,{forceMount:void 0}),ZV=t=>{const{__scopeDialog:e,forceMount:n,children:i,container:r}=t,s=Ws(pC,e);return P.jsx(Lce,{scope:e,forceMount:n,children:b.Children.map(i,o=>P.jsx(Hs,{present:n||s.open,children:P.jsx(o_,{asChild:!0,container:r,children:o})}))})};ZV.displayName=pC;var ex="DialogOverlay",KV=b.forwardRef((t,e)=>{const n=YV(ex,t.__scopeDialog),{forceMount:i=n.forceMount,...r}=t,s=Ws(ex,t.__scopeDialog);return s.modal?P.jsx(Hs,{present:i||s.open,children:P.jsx(Dce,{...r,ref:e})}):null});KV.displayName=ex;var Dce=b.forwardRef((t,e)=>{const{__scopeDialog:n,...i}=t,r=Ws(ex,n);return P.jsx(l_,{as:Ml,allowPinchZoom:!0,shards:[r.contentRef],children:P.jsx(Tt.div,{"data-state":gC(r.open),...i,ref:e,style:{pointerEvents:"auto",...i.style}})})}),lu="DialogContent",QV=b.forwardRef((t,e)=>{const n=YV(lu,t.__scopeDialog),{forceMount:i=n.forceMount,...r}=t,s=Ws(lu,t.__scopeDialog);return P.jsx(Hs,{present:i||s.open,children:s.modal?P.jsx(Nce,{...r,ref:e}):P.jsx(Oce,{...r,ref:e})})});QV.displayName=lu;var Nce=b.forwardRef((t,e)=>{const n=Ws(lu,t.__scopeDialog),i=b.useRef(null),r=$t(e,n.contentRef,i);return b.useEffect(()=>{const s=i.current;if(s)return xA(s)},[]),P.jsx(JV,{...t,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ht(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ht(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:ht(t.onFocusOutside,s=>s.preventDefault())})}),Oce=b.forwardRef((t,e)=>{const n=Ws(lu,t.__scopeDialog),i=b.useRef(!1),r=b.useRef(!1);return P.jsx(JV,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(i.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),i.current=!1,r.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(i.current=!0,s.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&r.current&&s.preventDefault()}})}),JV=b.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:i,onOpenAutoFocus:r,onCloseAutoFocus:s,...o}=t,a=Ws(lu,n),l=b.useRef(null),c=$t(e,l);return aA(),P.jsxs(P.Fragment,{children:[P.jsx(t_,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:r,onUnmountAutoFocus:s,children:P.jsx(e_,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":gC(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),P.jsxs(P.Fragment,{children:[P.jsx(kce,{titleId:a.titleId}),P.jsx(Uce,{contentRef:l,descriptionId:a.descriptionId})]})]})}),mC="DialogTitle",e5=b.forwardRef((t,e)=>{const{__scopeDialog:n,...i}=t,r=Ws(mC,n);return P.jsx(Tt.h2,{id:r.titleId,...i,ref:e})});e5.displayName=mC;var t5="DialogDescription",n5=b.forwardRef((t,e)=>{const{__scopeDialog:n,...i}=t,r=Ws(t5,n);return P.jsx(Tt.p,{id:r.descriptionId,...i,ref:e})});n5.displayName=t5;var i5="DialogClose",r5=b.forwardRef((t,e)=>{const{__scopeDialog:n,...i}=t,r=Ws(i5,n);return P.jsx(Tt.button,{type:"button",...i,ref:e,onClick:ht(t.onClick,()=>r.onOpenChange(!1))})});r5.displayName=i5;function gC(t){return t?"open":"closed"}var s5="DialogTitleWarning",[Kde,o5]=hQ(s5,{contentName:lu,titleName:mC,docsSlug:"dialog"}),kce=({titleId:t})=>{const e=o5(s5),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return b.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},Fce="DialogDescriptionWarning",Uce=({contentRef:t,descriptionId:e})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${o5(Fce).contentName}}.`;return b.useEffect(()=>{var s;const r=(s=t.current)==null?void 0:s.getAttribute("aria-describedby");e&&r&&(document.getElementById(e)||console.warn(i))},[i,t,e]),null},zce=qV,Bce=ZV,a5=KV,l5=QV,c5=e5,u5=n5,Vce=r5,Hce="VisuallyHidden",vC=b.forwardRef((t,e)=>P.jsx(Tt.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));vC.displayName=Hce;var Wce=vC;const Gce=zce,jce=Bce,IN=Wce,d5=b.forwardRef(({className:t,...e},n)=>P.jsx(a5,{className:qt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/25",t),...e,ref:n}));d5.displayName=a5.displayName;const Xce=oA("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),f5=b.forwardRef(({insertHidden:t,side:e="right",className:n,children:i,...r},s)=>P.jsxs(jce,{children:[P.jsx(d5,{}),P.jsxs(l5,{ref:s,className:qt(Xce({side:e}),n),...r,children:[t&&P.jsxs(P.Fragment,{children:[P.jsx(h5,{children:P.jsx(IN,{children:"Nav Menu"})}),P.jsx(p5,{children:P.jsx(IN,{children:"Nav Menu"})})]}),i,P.jsxs(Vce,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[P.jsx(wG,{className:"h-4 w-4"}),P.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));f5.displayName=l5.displayName;const h5=b.forwardRef(({className:t,...e},n)=>P.jsx(c5,{ref:n,className:qt("text-lg font-semibold text-foreground",t),...e}));h5.displayName=c5.displayName;const p5=b.forwardRef(({className:t,...e},n)=>P.jsx(u5,{ref:n,className:qt("text-sm text-muted-foreground",t),...e}));p5.displayName=u5.displayName;var qce=[" ","Enter","ArrowUp","ArrowDown"],$ce=[" ","Enter"],cg="Select",[M_,E_,Yce]=MA(cg),[Kf,Qde]=gu(cg,[Yce,s_]),b_=s_(),[Zce,Gl]=Kf(cg),[Kce,Qce]=Kf(cg),m5=t=>{const{__scopeSelect:e,children:n,open:i,defaultOpen:r,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:d,autoComplete:h,disabled:p,required:g,form:v}=t,_=b_(e),[y,m]=b.useState(null),[w,S]=b.useState(null),[E,C]=b.useState(!1),R=tg(c),[I=!1,N]=ru({prop:i,defaultProp:r,onChange:s}),[F,A]=ru({prop:o,defaultProp:a,onChange:l}),D=b.useRef(null),j=y?v||!!y.closest("form"):!0,[K,V]=b.useState(new Set),Z=Array.from(K).map(Y=>Y.props.value).join(";");return P.jsx(UJ,{..._,children:P.jsxs(Zce,{required:g,scope:e,trigger:y,onTriggerChange:m,valueNode:w,onValueNodeChange:S,valueNodeHasChildren:E,onValueNodeHasChildrenChange:C,contentId:yl(),value:F,onValueChange:A,open:I,onOpenChange:N,dir:R,triggerPointerDownPosRef:D,disabled:p,children:[P.jsx(M_.Provider,{scope:e,children:P.jsx(Kce,{scope:t.__scopeSelect,onNativeOptionAdd:b.useCallback(Y=>{V(J=>new Set(J).add(Y))},[]),onNativeOptionRemove:b.useCallback(Y=>{V(J=>{const k=new Set(J);return k.delete(Y),k})},[]),children:n})}),j?P.jsxs(U5,{"aria-hidden":!0,required:g,tabIndex:-1,name:d,autoComplete:h,value:F,onChange:Y=>A(Y.target.value),disabled:p,form:v,children:[F===void 0?P.jsx("option",{value:""}):null,Array.from(K)]},Z):null]})})};m5.displayName=cg;var g5="SelectTrigger",v5=b.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:i=!1,...r}=t,s=b_(n),o=Gl(g5,n),a=o.disabled||i,l=$t(e,o.onTriggerChange),c=E_(n),d=b.useRef("touch"),[h,p,g]=z5(_=>{const y=c().filter(S=>!S.disabled),m=y.find(S=>S.value===o.value),w=B5(y,_,m);w!==void 0&&o.onValueChange(w.value)}),v=_=>{a||(o.onOpenChange(!0),g()),_&&(o.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return P.jsx(yA,{asChild:!0,...s,children:P.jsx(Tt.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":F5(o.value)?"":void 0,...r,ref:l,onClick:ht(r.onClick,_=>{_.currentTarget.focus(),d.current!=="mouse"&&v(_)}),onPointerDown:ht(r.onPointerDown,_=>{d.current=_.pointerType;const y=_.target;y.hasPointerCapture(_.pointerId)&&y.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(v(_),_.preventDefault())}),onKeyDown:ht(r.onKeyDown,_=>{const y=h.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&p(_.key),!(y&&_.key===" ")&&qce.includes(_.key)&&(v(),_.preventDefault())})})})});v5.displayName=g5;var y5="SelectValue",x5=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,children:s,placeholder:o="",...a}=t,l=Gl(y5,n),{onValueNodeHasChildrenChange:c}=l,d=s!==void 0,h=$t(e,l.onValueNodeChange);return qi(()=>{c(d)},[c,d]),P.jsx(Tt.span,{...a,ref:h,style:{pointerEvents:"none"},children:F5(l.value)?P.jsx(P.Fragment,{children:o}):s})});x5.displayName=y5;var Jce="SelectIcon",_5=b.forwardRef((t,e)=>{const{__scopeSelect:n,children:i,...r}=t;return P.jsx(Tt.span,{"aria-hidden":!0,...r,ref:e,children:i||"▼"})});_5.displayName=Jce;var eue="SelectPortal",S5=t=>P.jsx(o_,{asChild:!0,...t});S5.displayName=eue;var cu="SelectContent",w5=b.forwardRef((t,e)=>{const n=Gl(cu,t.__scopeSelect),[i,r]=b.useState();if(qi(()=>{r(new DocumentFragment)},[]),!n.open){const s=i;return s?Gf.createPortal(P.jsx(M5,{scope:t.__scopeSelect,children:P.jsx(M_.Slot,{scope:t.__scopeSelect,children:P.jsx("div",{children:t.children})})}),s):null}return P.jsx(E5,{...t,ref:e})});w5.displayName=cu;var Ss=10,[M5,jl]=Kf(cu),tue="SelectContentImpl",E5=b.forwardRef((t,e)=>{const{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:_,avoidCollisions:y,...m}=t,w=Gl(cu,n),[S,E]=b.useState(null),[C,R]=b.useState(null),I=$t(e,me=>E(me)),[N,F]=b.useState(null),[A,D]=b.useState(null),j=E_(n),[K,V]=b.useState(!1),Z=b.useRef(!1);b.useEffect(()=>{if(S)return xA(S)},[S]),aA();const Y=b.useCallback(me=>{const[Re,...Le]=j().map(H=>H.ref.current),[Ce]=Le.slice(-1),Ae=document.activeElement;for(const H of me)if(H===Ae||(H==null||H.scrollIntoView({block:"nearest"}),H===Re&&C&&(C.scrollTop=0),H===Ce&&C&&(C.scrollTop=C.scrollHeight),H==null||H.focus(),document.activeElement!==Ae))return},[j,C]),J=b.useCallback(()=>Y([N,S]),[Y,N,S]);b.useEffect(()=>{K&&J()},[K,J]);const{onOpenChange:k,triggerPointerDownPosRef:W}=w;b.useEffect(()=>{if(S){let me={x:0,y:0};const Re=Ce=>{var Ae,H;me={x:Math.abs(Math.round(Ce.pageX)-(((Ae=W.current)==null?void 0:Ae.x)??0)),y:Math.abs(Math.round(Ce.pageY)-(((H=W.current)==null?void 0:H.y)??0))}},Le=Ce=>{me.x<=10&&me.y<=10?Ce.preventDefault():S.contains(Ce.target)||k(!1),document.removeEventListener("pointermove",Re),W.current=null};return W.current!==null&&(document.addEventListener("pointermove",Re),document.addEventListener("pointerup",Le,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Re),document.removeEventListener("pointerup",Le,{capture:!0})}}},[S,k,W]),b.useEffect(()=>{const me=()=>k(!1);return window.addEventListener("blur",me),window.addEventListener("resize",me),()=>{window.removeEventListener("blur",me),window.removeEventListener("resize",me)}},[k]);const[$,Q]=z5(me=>{const Re=j().filter(Ae=>!Ae.disabled),Le=Re.find(Ae=>Ae.ref.current===document.activeElement),Ce=B5(Re,me,Le);Ce&&setTimeout(()=>Ce.ref.current.focus())}),de=b.useCallback((me,Re,Le)=>{const Ce=!Z.current&&!Le;(w.value!==void 0&&w.value===Re||Ce)&&(F(me),Ce&&(Z.current=!0))},[w.value]),be=b.useCallback(()=>S==null?void 0:S.focus(),[S]),ie=b.useCallback((me,Re,Le)=>{const Ce=!Z.current&&!Le;(w.value!==void 0&&w.value===Re||Ce)&&D(me)},[w.value]),he=i==="popper"?cb:b5,Ee=he===cb?{side:a,sideOffset:l,align:c,alignOffset:d,arrowPadding:h,collisionBoundary:p,collisionPadding:g,sticky:v,hideWhenDetached:_,avoidCollisions:y}:{};return P.jsx(M5,{scope:n,content:S,viewport:C,onViewportChange:R,itemRefCallback:de,selectedItem:N,onItemLeave:be,itemTextRefCallback:ie,focusSelectedItem:J,selectedItemText:A,position:i,isPositioned:K,searchRef:$,children:P.jsx(l_,{as:Ml,allowPinchZoom:!0,children:P.jsx(t_,{asChild:!0,trapped:w.open,onMountAutoFocus:me=>{me.preventDefault()},onUnmountAutoFocus:ht(r,me=>{var Re;(Re=w.trigger)==null||Re.focus({preventScroll:!0}),me.preventDefault()}),children:P.jsx(e_,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:me=>me.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:P.jsx(he,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:me=>me.preventDefault(),...m,...Ee,onPlaced:()=>V(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:ht(m.onKeyDown,me=>{const Re=me.ctrlKey||me.altKey||me.metaKey;if(me.key==="Tab"&&me.preventDefault(),!Re&&me.key.length===1&&Q(me.key),["ArrowUp","ArrowDown","Home","End"].includes(me.key)){let Ce=j().filter(Ae=>!Ae.disabled).map(Ae=>Ae.ref.current);if(["ArrowUp","End"].includes(me.key)&&(Ce=Ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(me.key)){const Ae=me.target,H=Ce.indexOf(Ae);Ce=Ce.slice(H+1)}setTimeout(()=>Y(Ce)),me.preventDefault()}})})})})})})});E5.displayName=tue;var nue="SelectItemAlignedPosition",b5=b.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:i,...r}=t,s=Gl(cu,n),o=jl(cu,n),[a,l]=b.useState(null),[c,d]=b.useState(null),h=$t(e,I=>d(I)),p=E_(n),g=b.useRef(!1),v=b.useRef(!0),{viewport:_,selectedItem:y,selectedItemText:m,focusSelectedItem:w}=o,S=b.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&_&&y&&m){const I=s.trigger.getBoundingClientRect(),N=c.getBoundingClientRect(),F=s.valueNode.getBoundingClientRect(),A=m.getBoundingClientRect();if(s.dir!=="rtl"){const Ae=A.left-N.left,H=F.left-Ae,xe=I.left-H,fe=I.width+xe,Te=Math.max(fe,N.width),ge=window.innerWidth-Ss,qe=dm(H,[Ss,Math.max(Ss,ge-Te)]);a.style.minWidth=fe+"px",a.style.left=qe+"px"}else{const Ae=N.right-A.right,H=window.innerWidth-F.right-Ae,xe=window.innerWidth-I.right-H,fe=I.width+xe,Te=Math.max(fe,N.width),ge=window.innerWidth-Ss,qe=dm(H,[Ss,Math.max(Ss,ge-Te)]);a.style.minWidth=fe+"px",a.style.right=qe+"px"}const D=p(),j=window.innerHeight-Ss*2,K=_.scrollHeight,V=window.getComputedStyle(c),Z=parseInt(V.borderTopWidth,10),Y=parseInt(V.paddingTop,10),J=parseInt(V.borderBottomWidth,10),k=parseInt(V.paddingBottom,10),W=Z+Y+K+k+J,$=Math.min(y.offsetHeight*5,W),Q=window.getComputedStyle(_),de=parseInt(Q.paddingTop,10),be=parseInt(Q.paddingBottom,10),ie=I.top+I.height/2-Ss,he=j-ie,Ee=y.offsetHeight/2,me=y.offsetTop+Ee,Re=Z+Y+me,Le=W-Re;if(Re<=ie){const Ae=D.length>0&&y===D[D.length-1].ref.current;a.style.bottom="0px";const H=c.clientHeight-_.offsetTop-_.offsetHeight,xe=Math.max(he,Ee+(Ae?be:0)+H+J),fe=Re+xe;a.style.height=fe+"px"}else{const Ae=D.length>0&&y===D[0].ref.current;a.style.top="0px";const xe=Math.max(ie,Z+_.offsetTop+(Ae?de:0)+Ee)+Le;a.style.height=xe+"px",_.scrollTop=Re-ie+_.offsetTop}a.style.margin=`${Ss}px 0`,a.style.minHeight=$+"px",a.style.maxHeight=j+"px",i==null||i(),requestAnimationFrame(()=>g.current=!0)}},[p,s.trigger,s.valueNode,a,c,_,y,m,s.dir,i]);qi(()=>S(),[S]);const[E,C]=b.useState();qi(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const R=b.useCallback(I=>{I&&v.current===!0&&(S(),w==null||w(),v.current=!1)},[S,w]);return P.jsx(rue,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:g,onScrollButtonChange:R,children:P.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:P.jsx(Tt.div,{...r,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});b5.displayName=nue;var iue="SelectPopperPosition",cb=b.forwardRef((t,e)=>{const{__scopeSelect:n,align:i="start",collisionPadding:r=Ss,...s}=t,o=b_(n);return P.jsx(fz,{...o,...s,ref:e,align:i,collisionPadding:r,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});cb.displayName=iue;var[rue,yC]=Kf(cu,{}),ub="SelectViewport",T5=b.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:i,...r}=t,s=jl(ub,n),o=yC(ub,n),a=$t(e,s.onViewportChange),l=b.useRef(0);return P.jsxs(P.Fragment,{children:[P.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),P.jsx(M_.Slot,{scope:n,children:P.jsx(Tt.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:ht(r.onScroll,c=>{const d=c.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:p}=o;if(p!=null&&p.current&&h){const g=Math.abs(l.current-d.scrollTop);if(g>0){const v=window.innerHeight-Ss*2,_=parseFloat(h.style.minHeight),y=parseFloat(h.style.height),m=Math.max(_,y);if(m0?E:0,h.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});T5.displayName=ub;var A5="SelectGroup",[sue,oue]=Kf(A5),aue=b.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=yl();return P.jsx(sue,{scope:n,id:r,children:P.jsx(Tt.div,{role:"group","aria-labelledby":r,...i,ref:e})})});aue.displayName=A5;var C5="SelectLabel",P5=b.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=oue(C5,n);return P.jsx(Tt.div,{id:r.id,...i,ref:e})});P5.displayName=C5;var tx="SelectItem",[lue,R5]=Kf(tx),I5=b.forwardRef((t,e)=>{const{__scopeSelect:n,value:i,disabled:r=!1,textValue:s,...o}=t,a=Gl(tx,n),l=jl(tx,n),c=a.value===i,[d,h]=b.useState(s??""),[p,g]=b.useState(!1),v=$t(e,w=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,w,i,r)}),_=yl(),y=b.useRef("touch"),m=()=>{r||(a.onValueChange(i),a.onOpenChange(!1))};if(i==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return P.jsx(lue,{scope:n,value:i,disabled:r,textId:_,isSelected:c,onItemTextChange:b.useCallback(w=>{h(S=>S||((w==null?void 0:w.textContent)??"").trim())},[]),children:P.jsx(M_.ItemSlot,{scope:n,value:i,disabled:r,textValue:d,children:P.jsx(Tt.div,{role:"option","aria-labelledby":_,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...o,ref:v,onFocus:ht(o.onFocus,()=>g(!0)),onBlur:ht(o.onBlur,()=>g(!1)),onClick:ht(o.onClick,()=>{y.current!=="mouse"&&m()}),onPointerUp:ht(o.onPointerUp,()=>{y.current==="mouse"&&m()}),onPointerDown:ht(o.onPointerDown,w=>{y.current=w.pointerType}),onPointerMove:ht(o.onPointerMove,w=>{var S;y.current=w.pointerType,r?(S=l.onItemLeave)==null||S.call(l):y.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ht(o.onPointerLeave,w=>{var S;w.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:ht(o.onKeyDown,w=>{var E;((E=l.searchRef)==null?void 0:E.current)!==""&&w.key===" "||($ce.includes(w.key)&&m(),w.key===" "&&w.preventDefault())})})})})});I5.displayName=tx;var tp="SelectItemText",L5=b.forwardRef((t,e)=>{const{__scopeSelect:n,className:i,style:r,...s}=t,o=Gl(tp,n),a=jl(tp,n),l=R5(tp,n),c=Qce(tp,n),[d,h]=b.useState(null),p=$t(e,m=>h(m),l.onItemTextChange,m=>{var w;return(w=a.itemTextRefCallback)==null?void 0:w.call(a,m,l.value,l.disabled)}),g=d==null?void 0:d.textContent,v=b.useMemo(()=>P.jsx("option",{value:l.value,disabled:l.disabled,children:g},l.value),[l.disabled,l.value,g]),{onNativeOptionAdd:_,onNativeOptionRemove:y}=c;return qi(()=>(_(v),()=>y(v)),[_,y,v]),P.jsxs(P.Fragment,{children:[P.jsx(Tt.span,{id:l.textId,...s,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Gf.createPortal(s.children,o.valueNode):null]})});L5.displayName=tp;var D5="SelectItemIndicator",N5=b.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return R5(D5,n).isSelected?P.jsx(Tt.span,{"aria-hidden":!0,...i,ref:e}):null});N5.displayName=D5;var db="SelectScrollUpButton",cue=b.forwardRef((t,e)=>{const n=jl(db,t.__scopeSelect),i=yC(db,t.__scopeSelect),[r,s]=b.useState(!1),o=$t(e,i.onScrollButtonChange);return qi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?P.jsx(O5,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});cue.displayName=db;var fb="SelectScrollDownButton",uue=b.forwardRef((t,e)=>{const n=jl(fb,t.__scopeSelect),i=yC(fb,t.__scopeSelect),[r,s]=b.useState(!1),o=$t(e,i.onScrollButtonChange);return qi(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?P.jsx(O5,{...t,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});uue.displayName=fb;var O5=b.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:i,...r}=t,s=jl("SelectScrollButton",n),o=b.useRef(null),a=E_(n),l=b.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return b.useEffect(()=>()=>l(),[l]),qi(()=>{var d;const c=a().find(h=>h.ref.current===document.activeElement);(d=c==null?void 0:c.ref.current)==null||d.scrollIntoView({block:"nearest"})},[a]),P.jsx(Tt.div,{"aria-hidden":!0,...r,ref:e,style:{flexShrink:0,...r.style},onPointerDown:ht(r.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:ht(r.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:ht(r.onPointerLeave,()=>{l()})})}),due="SelectSeparator",k5=b.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t;return P.jsx(Tt.div,{"aria-hidden":!0,...i,ref:e})});k5.displayName=due;var hb="SelectArrow",fue=b.forwardRef((t,e)=>{const{__scopeSelect:n,...i}=t,r=b_(n),s=Gl(hb,n),o=jl(hb,n);return s.open&&o.position==="popper"?P.jsx(hz,{...r,...i,ref:e}):null});fue.displayName=hb;function F5(t){return t===""||t===void 0}var U5=b.forwardRef((t,e)=>{const{value:n,...i}=t,r=b.useRef(null),s=$t(e,r),o=wA(n);return b.useEffect(()=>{const a=r.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==n&&d){const h=new Event("change",{bubbles:!0});d.call(a,n),a.dispatchEvent(h)}},[o,n]),P.jsx(vC,{asChild:!0,children:P.jsx("select",{...i,ref:s,defaultValue:n})})});U5.displayName="BubbleSelect";function z5(t){const e=bi(t),n=b.useRef(""),i=b.useRef(0),r=b.useCallback(o=>{const a=n.current+o;e(a),function l(c){n.current=c,window.clearTimeout(i.current),c!==""&&(i.current=window.setTimeout(()=>l(""),1e3))}(a)},[e]),s=b.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return b.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,r,s]}function B5(t,e,n){const r=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,s=n?t.indexOf(n):-1;let o=hue(t,Math.max(s,0));r.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function hue(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var pue=m5,V5=v5,mue=x5,gue=_5,vue=S5,H5=w5,yue=T5,W5=P5,G5=I5,xue=L5,_ue=N5,j5=k5;const pb=pue,mb=mue,nx=b.forwardRef(({className:t,children:e,...n},i)=>P.jsxs(V5,{ref:i,className:qt("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[e,P.jsx(gue,{asChild:!0,children:P.jsx(sG,{className:"h-4 w-4 opacity-50"})})]}));nx.displayName=V5.displayName;const ix=b.forwardRef(({className:t,children:e,position:n="popper",...i},r)=>P.jsx(vue,{children:P.jsx(H5,{ref:r,className:qt("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...i,children:P.jsx(yue,{className:qt("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e})})}));ix.displayName=H5.displayName;const Sue=b.forwardRef(({className:t,...e},n)=>P.jsx(W5,{ref:n,className:qt("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Sue.displayName=W5.displayName;const rx=b.forwardRef(({className:t,children:e,...n},i)=>P.jsxs(G5,{ref:i,className:qt("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50","cursor-pointer text-foreground/50 hover:text-foreground/80 aria-selected:text-foreground",t),...n,children:[P.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:P.jsx(_ue,{children:P.jsx(rG,{className:"h-4 w-4"})})}),P.jsx(xue,{children:e})]}));rx.displayName=G5.displayName;const wue=b.forwardRef(({className:t,...e},n)=>P.jsx(j5,{ref:n,className:qt("-mx-1 my-1 h-px bg-muted",t),...e}));wue.displayName=j5.displayName;var Mue="Separator",LN="horizontal",Eue=["horizontal","vertical"],X5=b.forwardRef((t,e)=>{const{decorative:n,orientation:i=LN,...r}=t,s=bue(i)?i:LN,a=n?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return P.jsx(Tt.div,{"data-orientation":s,...a,...r,ref:e})});X5.displayName=Mue;function bue(t){return Eue.includes(t)}var q5=X5;const xC=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...i},r)=>P.jsx(q5,{ref:r,decorative:n,orientation:e,className:qt("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...i}));xC.displayName=q5.displayName;var R1="rovingFocusGroup.onEntryFocus",Tue={bubbles:!1,cancelable:!0},T_="RovingFocusGroup",[gb,$5,Aue]=MA(T_),[Cue,Y5]=pA(T_,[Aue]),[Pue,Rue]=Cue(T_),Z5=b.forwardRef((t,e)=>P.jsx(gb.Provider,{scope:t.__scopeRovingFocusGroup,children:P.jsx(gb.Slot,{scope:t.__scopeRovingFocusGroup,children:P.jsx(Iue,{...t,ref:e})})}));Z5.displayName=T_;var Iue=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:i,loop:r=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:d=!1,...h}=t,p=b.useRef(null),g=$t(e,p),v=tg(s),[_=null,y]=ru({prop:o,defaultProp:a,onChange:l}),[m,w]=b.useState(!1),S=bi(c),E=$5(n),C=b.useRef(!1),[R,I]=b.useState(0);return b.useEffect(()=>{const N=p.current;if(N)return N.addEventListener(R1,S),()=>N.removeEventListener(R1,S)},[S]),P.jsx(Pue,{scope:n,orientation:i,dir:v,loop:r,currentTabStopId:_,onItemFocus:b.useCallback(N=>y(N),[y]),onItemShiftTab:b.useCallback(()=>w(!0),[]),onFocusableItemAdd:b.useCallback(()=>I(N=>N+1),[]),onFocusableItemRemove:b.useCallback(()=>I(N=>N-1),[]),children:P.jsx(Tt.div,{tabIndex:m||R===0?-1:0,"data-orientation":i,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:ht(t.onMouseDown,()=>{C.current=!0}),onFocus:ht(t.onFocus,N=>{const F=!C.current;if(N.target===N.currentTarget&&F&&!m){const A=new CustomEvent(R1,Tue);if(N.currentTarget.dispatchEvent(A),!A.defaultPrevented){const D=E().filter(Y=>Y.focusable),j=D.find(Y=>Y.active),K=D.find(Y=>Y.id===_),Z=[j,K,...D].filter(Boolean).map(Y=>Y.ref.current);J5(Z,d)}}C.current=!1}),onBlur:ht(t.onBlur,()=>w(!1))})})}),K5="RovingFocusGroupItem",Q5=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:i=!0,active:r=!1,tabStopId:s,...o}=t,a=yl(),l=s||a,c=Rue(K5,n),d=c.currentTabStopId===l,h=$5(n),{onFocusableItemAdd:p,onFocusableItemRemove:g}=c;return b.useEffect(()=>{if(i)return p(),()=>g()},[i,p,g]),P.jsx(gb.ItemSlot,{scope:n,id:l,focusable:i,active:r,children:P.jsx(Tt.span,{tabIndex:d?0:-1,"data-orientation":c.orientation,...o,ref:e,onMouseDown:ht(t.onMouseDown,v=>{i?c.onItemFocus(l):v.preventDefault()}),onFocus:ht(t.onFocus,()=>c.onItemFocus(l)),onKeyDown:ht(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const _=Nue(v,c.orientation,c.dir);if(_!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let m=h().filter(w=>w.focusable).map(w=>w.ref.current);if(_==="last")m.reverse();else if(_==="prev"||_==="next"){_==="prev"&&m.reverse();const w=m.indexOf(v.currentTarget);m=c.loop?Oue(m,w+1):m.slice(w+1)}setTimeout(()=>J5(m))}})})})});Q5.displayName=K5;var Lue={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Due(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Nue(t,e,n){const i=Due(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return Lue[i]}function J5(t,e=!1){const n=document.activeElement;for(const i of t)if(i===n||(i.focus({preventScroll:e}),document.activeElement!==n))return}function Oue(t,e){return t.map((n,i)=>t[(e+i)%t.length])}var kue=Z5,Fue=Q5,_C="Tabs",[Uue,Jde]=gu(_C,[Y5]),eH=Y5(),[zue,SC]=Uue(_C),tH=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:i,onValueChange:r,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=t,d=tg(a),[h,p]=ru({prop:i,onChange:r,defaultProp:s});return P.jsx(zue,{scope:n,baseId:yl(),value:h,onValueChange:p,orientation:o,dir:d,activationMode:l,children:P.jsx(Tt.div,{dir:d,"data-orientation":o,...c,ref:e})})});tH.displayName=_C;var nH="TabsList",iH=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:i=!0,...r}=t,s=SC(nH,n),o=eH(n);return P.jsx(kue,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:i,children:P.jsx(Tt.div,{role:"tablist","aria-orientation":s.orientation,...r,ref:e})})});iH.displayName=nH;var rH="TabsTrigger",sH=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:i,disabled:r=!1,...s}=t,o=SC(rH,n),a=eH(n),l=lH(o.baseId,i),c=cH(o.baseId,i),d=i===o.value;return P.jsx(Fue,{asChild:!0,...a,focusable:!r,active:d,children:P.jsx(Tt.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...s,ref:e,onMouseDown:ht(t.onMouseDown,h=>{!r&&h.button===0&&h.ctrlKey===!1?o.onValueChange(i):h.preventDefault()}),onKeyDown:ht(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(i)}),onFocus:ht(t.onFocus,()=>{const h=o.activationMode!=="manual";!d&&!r&&h&&o.onValueChange(i)})})})});sH.displayName=rH;var oH="TabsContent",aH=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:i,forceMount:r,children:s,...o}=t,a=SC(oH,n),l=lH(a.baseId,i),c=cH(a.baseId,i),d=i===a.value,h=b.useRef(d);return b.useEffect(()=>{const p=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(p)},[]),P.jsx(Hs,{present:r||d,children:({present:p})=>P.jsx(Tt.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:h.current?"0s":void 0},children:p&&s})})});aH.displayName=oH;function lH(t,e){return`${t}-trigger-${e}`}function cH(t,e){return`${t}-content-${e}`}var Bue=tH,uH=iH,dH=sH,fH=aH;const Vue=Bue,hH=b.forwardRef(({className:t,...e},n)=>P.jsx(uH,{ref:n,className:qt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));hH.displayName=uH.displayName;const vb=b.forwardRef(({className:t,...e},n)=>P.jsx(dH,{ref:n,className:qt("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));vb.displayName=dH.displayName;const yb=b.forwardRef(({className:t,...e},n)=>P.jsx(fH,{ref:n,className:qt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));yb.displayName=fH.displayName;const Hue=()=>P.jsx(oa,{children:"Not supported at this time."}),wC=b.createContext(null),Wue=({initial:t=void 0,children:e})=>{const[n,i]=b.useState(t==null?void 0:t.query);return P.jsx(wC.Provider,{value:{filters:{query:n},setters:{setQuery:i}},children:e})};function Gue(){const t=b.useContext(wC);if(!t)throw new Error("useSearchFiltersContext must be used within a SearchFiltersContextProvider");return t.filters}function jue(){const t=b.useContext(wC);if(!t)throw new Error("useSearchFiltersContextSetters must be used within a SearchFiltersContextProvider");return t.setters}const Xue=(t,e=500)=>{const[n,i]=b.useState(t);return b.useEffect(()=>{const r=setTimeout(()=>i(t),e||500);return()=>{clearTimeout(r)}},[t,e]),n},que=({placeholder:t="Search...",...e})=>{const[n,i]=b.useState(""),r=Xue(n,500),{setQuery:s}=jue();return b.useEffect(()=>{s(r)},[r,s]),P.jsxs("div",{className:"flex flex-row items-center justify-start gap-2 rounded-[6px] border-[#4E4E4E] bg-background px-2",children:[P.jsx(yG,{}),P.jsx("input",{id:"search-filter-input",type:"search",placeholder:t,onChange:o=>{i(o.target.value)},className:qt("search-cancel:appearance-none search-cancel:cursor-pointer flex-grow bg-transparent text-sm text-foreground outline-none placeholder:text-xs placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e.className)})]})};function $ue(t,e){return b.useReducer((n,i)=>e[n][i]??n,t)}var MC="ScrollArea",[pH,efe]=gu(MC),[Yue,ps]=pH(MC),mH=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:i="hover",dir:r,scrollHideDelay:s=600,...o}=t,[a,l]=b.useState(null),[c,d]=b.useState(null),[h,p]=b.useState(null),[g,v]=b.useState(null),[_,y]=b.useState(null),[m,w]=b.useState(0),[S,E]=b.useState(0),[C,R]=b.useState(!1),[I,N]=b.useState(!1),F=$t(e,D=>l(D)),A=tg(r);return P.jsx(Yue,{scope:n,type:i,dir:A,scrollHideDelay:s,scrollArea:a,viewport:c,onViewportChange:d,content:h,onContentChange:p,scrollbarX:g,onScrollbarXChange:v,scrollbarXEnabled:C,onScrollbarXEnabledChange:R,scrollbarY:_,onScrollbarYChange:y,scrollbarYEnabled:I,onScrollbarYEnabledChange:N,onCornerWidthChange:w,onCornerHeightChange:E,children:P.jsx(Tt.div,{dir:A,...o,ref:F,style:{position:"relative","--radix-scroll-area-corner-width":m+"px","--radix-scroll-area-corner-height":S+"px",...t.style}})})});mH.displayName=MC;var gH="ScrollAreaViewport",vH=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:i,asChild:r,nonce:s,...o}=t,a=ps(gH,n),l=b.useRef(null),c=$t(e,l,a.onViewportChange);return P.jsxs(P.Fragment,{children:[P.jsx("style",{dangerouslySetInnerHTML:{__html:` +[data-radix-scroll-area-viewport] { + scrollbar-width: none; + -ms-overflow-style: none; + -webkit-overflow-scrolling: touch; +} +[data-radix-scroll-area-viewport]::-webkit-scrollbar { + display: none; +} +:where([data-radix-scroll-area-viewport]) { + display: flex; + flex-direction: column; + align-items: stretch; +} +:where([data-radix-scroll-area-content]) { + flex-grow: 1; +} +`},nonce:s}),P.jsx(Tt.div,{"data-radix-scroll-area-viewport":"",...o,asChild:r,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:sde({asChild:r,children:i},d=>P.jsx("div",{"data-radix-scroll-area-content":"",ref:a.onContentChange,style:{minWidth:a.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});vH.displayName=gH;var Po="ScrollAreaScrollbar",EC=b.forwardRef((t,e)=>{const{forceMount:n,...i}=t,r=ps(Po,t.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:o}=r,a=t.orientation==="horizontal";return b.useEffect(()=>(a?s(!0):o(!0),()=>{a?s(!1):o(!1)}),[a,s,o]),r.type==="hover"?P.jsx(Zue,{...i,ref:e,forceMount:n}):r.type==="scroll"?P.jsx(Kue,{...i,ref:e,forceMount:n}):r.type==="auto"?P.jsx(yH,{...i,ref:e,forceMount:n}):r.type==="always"?P.jsx(bC,{...i,ref:e}):null});EC.displayName=Po;var Zue=b.forwardRef((t,e)=>{const{forceMount:n,...i}=t,r=ps(Po,t.__scopeScrollArea),[s,o]=b.useState(!1);return b.useEffect(()=>{const a=r.scrollArea;let l=0;if(a){const c=()=>{window.clearTimeout(l),o(!0)},d=()=>{l=window.setTimeout(()=>o(!1),r.scrollHideDelay)};return a.addEventListener("pointerenter",c),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),a.removeEventListener("pointerenter",c),a.removeEventListener("pointerleave",d)}}},[r.scrollArea,r.scrollHideDelay]),P.jsx(Hs,{present:n||s,children:P.jsx(yH,{"data-state":s?"visible":"hidden",...i,ref:e})})}),Kue=b.forwardRef((t,e)=>{const{forceMount:n,...i}=t,r=ps(Po,t.__scopeScrollArea),s=t.orientation==="horizontal",o=C_(()=>l("SCROLL_END"),100),[a,l]=$ue("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(a==="idle"){const c=window.setTimeout(()=>l("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(c)}},[a,r.scrollHideDelay,l]),b.useEffect(()=>{const c=r.viewport,d=s?"scrollLeft":"scrollTop";if(c){let h=c[d];const p=()=>{const g=c[d];h!==g&&(l("SCROLL"),o()),h=g};return c.addEventListener("scroll",p),()=>c.removeEventListener("scroll",p)}},[r.viewport,s,l,o]),P.jsx(Hs,{present:n||a!=="hidden",children:P.jsx(bC,{"data-state":a==="hidden"?"hidden":"visible",...i,ref:e,onPointerEnter:ht(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:ht(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),yH=b.forwardRef((t,e)=>{const n=ps(Po,t.__scopeScrollArea),{forceMount:i,...r}=t,[s,o]=b.useState(!1),a=t.orientation==="horizontal",l=C_(()=>{if(n.viewport){const c=n.viewport.offsetWidth{const{orientation:n="vertical",...i}=t,r=ps(Po,t.__scopeScrollArea),s=b.useRef(null),o=b.useRef(0),[a,l]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),c=MH(a.viewport,a.content),d={...i,sizes:a,onSizesChange:l,hasThumb:c>0&&c<1,onThumbChange:p=>s.current=p,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:p=>o.current=p};function h(p,g){return ide(p,o.current,a,g)}return n==="horizontal"?P.jsx(Que,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const p=r.viewport.scrollLeft,g=DN(p,a,r.dir);s.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:p=>{r.viewport&&(r.viewport.scrollLeft=p)},onDragScroll:p=>{r.viewport&&(r.viewport.scrollLeft=h(p,r.dir))}}):n==="vertical"?P.jsx(Jue,{...d,ref:e,onThumbPositionChange:()=>{if(r.viewport&&s.current){const p=r.viewport.scrollTop,g=DN(p,a);s.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:p=>{r.viewport&&(r.viewport.scrollTop=p)},onDragScroll:p=>{r.viewport&&(r.viewport.scrollTop=h(p))}}):null}),Que=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:i,...r}=t,s=ps(Po,t.__scopeScrollArea),[o,a]=b.useState(),l=b.useRef(null),c=$t(e,l,s.onScrollbarXChange);return b.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),P.jsx(_H,{"data-orientation":"horizontal",...r,ref:c,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":A_(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,h)=>{if(s.viewport){const p=s.viewport.scrollLeft+d.deltaX;t.onWheelScroll(p),bH(p,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&i({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:ox(o.paddingLeft),paddingEnd:ox(o.paddingRight)}})}})}),Jue=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:i,...r}=t,s=ps(Po,t.__scopeScrollArea),[o,a]=b.useState(),l=b.useRef(null),c=$t(e,l,s.onScrollbarYChange);return b.useEffect(()=>{l.current&&a(getComputedStyle(l.current))},[l]),P.jsx(_H,{"data-orientation":"vertical",...r,ref:c,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":A_(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,h)=>{if(s.viewport){const p=s.viewport.scrollTop+d.deltaY;t.onWheelScroll(p),bH(p,h)&&d.preventDefault()}},onResize:()=>{l.current&&s.viewport&&o&&i({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:ox(o.paddingTop),paddingEnd:ox(o.paddingBottom)}})}})}),[ede,xH]=pH(Po),_H=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:i,hasThumb:r,onThumbChange:s,onThumbPointerUp:o,onThumbPointerDown:a,onThumbPositionChange:l,onDragScroll:c,onWheelScroll:d,onResize:h,...p}=t,g=ps(Po,n),[v,_]=b.useState(null),y=$t(e,F=>_(F)),m=b.useRef(null),w=b.useRef(""),S=g.viewport,E=i.content-i.viewport,C=bi(d),R=bi(l),I=C_(h,10);function N(F){if(m.current){const A=F.clientX-m.current.left,D=F.clientY-m.current.top;c({x:A,y:D})}}return b.useEffect(()=>{const F=A=>{const D=A.target;(v==null?void 0:v.contains(D))&&C(A,E)};return document.addEventListener("wheel",F,{passive:!1}),()=>document.removeEventListener("wheel",F,{passive:!1})},[S,v,E,C]),b.useEffect(R,[i,R]),Df(v,I),Df(g.content,I),P.jsx(ede,{scope:n,scrollbar:v,hasThumb:r,onThumbChange:bi(s),onThumbPointerUp:bi(o),onThumbPositionChange:R,onThumbPointerDown:bi(a),children:P.jsx(Tt.div,{...p,ref:y,style:{position:"absolute",...p.style},onPointerDown:ht(t.onPointerDown,F=>{F.button===0&&(F.target.setPointerCapture(F.pointerId),m.current=v.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),N(F))}),onPointerMove:ht(t.onPointerMove,N),onPointerUp:ht(t.onPointerUp,F=>{const A=F.target;A.hasPointerCapture(F.pointerId)&&A.releasePointerCapture(F.pointerId),document.body.style.webkitUserSelect=w.current,g.viewport&&(g.viewport.style.scrollBehavior=""),m.current=null})})})}),sx="ScrollAreaThumb",SH=b.forwardRef((t,e)=>{const{forceMount:n,...i}=t,r=xH(sx,t.__scopeScrollArea);return P.jsx(Hs,{present:n||r.hasThumb,children:P.jsx(tde,{ref:e,...i})})}),tde=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:i,...r}=t,s=ps(sx,n),o=xH(sx,n),{onThumbPositionChange:a}=o,l=$t(e,h=>o.onThumbChange(h)),c=b.useRef(),d=C_(()=>{c.current&&(c.current(),c.current=void 0)},100);return b.useEffect(()=>{const h=s.viewport;if(h){const p=()=>{if(d(),!c.current){const g=rde(h,a);c.current=g,a()}};return a(),h.addEventListener("scroll",p),()=>h.removeEventListener("scroll",p)}},[s.viewport,d,a]),P.jsx(Tt.div,{"data-state":o.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...i},onPointerDownCapture:ht(t.onPointerDownCapture,h=>{const g=h.target.getBoundingClientRect(),v=h.clientX-g.left,_=h.clientY-g.top;o.onThumbPointerDown({x:v,y:_})}),onPointerUp:ht(t.onPointerUp,o.onThumbPointerUp)})});SH.displayName=sx;var TC="ScrollAreaCorner",wH=b.forwardRef((t,e)=>{const n=ps(TC,t.__scopeScrollArea),i=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&i?P.jsx(nde,{...t,ref:e}):null});wH.displayName=TC;var nde=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...i}=t,r=ps(TC,n),[s,o]=b.useState(0),[a,l]=b.useState(0),c=!!(s&&a);return Df(r.scrollbarX,()=>{var h;const d=((h=r.scrollbarX)==null?void 0:h.offsetHeight)||0;r.onCornerHeightChange(d),l(d)}),Df(r.scrollbarY,()=>{var h;const d=((h=r.scrollbarY)==null?void 0:h.offsetWidth)||0;r.onCornerWidthChange(d),o(d)}),c?P.jsx(Tt.div,{...i,ref:e,style:{width:s,height:a,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function ox(t){return t?parseInt(t,10):0}function MH(t,e){const n=t/e;return isNaN(n)?0:n}function A_(t){const e=MH(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=(t.scrollbar.size-n)*e;return Math.max(i,18)}function ide(t,e,n,i="ltr"){const r=A_(n),s=r/2,o=e||s,a=r-o,l=n.scrollbar.paddingStart+o,c=n.scrollbar.size-n.scrollbar.paddingEnd-a,d=n.content-n.viewport,h=i==="ltr"?[0,d]:[d*-1,0];return EH([l,c],h)(t)}function DN(t,e,n="ltr"){const i=A_(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=e.scrollbar.size-r,o=e.content-e.viewport,a=s-i,l=n==="ltr"?[0,o]:[o*-1,0],c=dm(t,l);return EH([0,o],[0,a])(c)}function EH(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const i=(e[1]-e[0])/(t[1]-t[0]);return e[0]+i*(n-t[0])}}function bH(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},i=0;return function r(){const s={left:t.scrollLeft,top:t.scrollTop},o=n.left!==s.left,a=n.top!==s.top;(o||a)&&e(),n=s,i=window.requestAnimationFrame(r)}(),()=>window.cancelAnimationFrame(i)};function C_(t,e){const n=bi(t),i=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(i.current),[]),b.useCallback(()=>{window.clearTimeout(i.current),i.current=window.setTimeout(n,e)},[n,e])}function Df(t,e){const n=bi(e);qi(()=>{let i=0;if(t){const r=new ResizeObserver(()=>{cancelAnimationFrame(i),i=window.requestAnimationFrame(n)});return r.observe(t),()=>{window.cancelAnimationFrame(i),r.unobserve(t)}}},[t,n])}function sde(t,e){const{asChild:n,children:i}=t;if(!n)return typeof e=="function"?e(i):e;const r=b.Children.only(i);return b.cloneElement(r,{children:typeof e=="function"?e(r.props.children):e})}var TH=mH,ode=vH,ade=wH;const AH=b.forwardRef(({className:t,children:e,...n},i)=>P.jsxs(TH,{ref:i,className:qt("relative overflow-hidden",t),...n,children:[P.jsx(ode,{className:"h-full w-full rounded-[inherit]",children:e}),P.jsx(CH,{}),P.jsx(ade,{})]}));AH.displayName=TH.displayName;const CH=b.forwardRef(({className:t,orientation:e="vertical",...n},i)=>P.jsx(EC,{ref:i,orientation:e,className:qt("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 border-t border-t-transparent p-[1px]",t),...n,children:P.jsx(SH,{className:"relative flex-1 rounded-full bg-border"})}));CH.displayName=EC.displayName;const lde=({track:t,className:e,...n})=>{var i;return P.jsxs("div",{className:qt("flex cursor-pointer flex-row items-center justify-start gap-2 hover:scale-105 hover:bg-slate-500/20",e),...n,children:[t.artwork_url?P.jsx("img",{src:t.artwork_url,className:"h-8 w-8 rounded-lg",alt:"Artwork"}):P.jsx(o3,{}),P.jsxs("div",{className:"flex flex-col items-start justify-center gap-0.5",children:[P.jsx("span",{className:"truncate text-xs text-foreground",children:t.title}),P.jsxs("span",{className:"truncate text-xs text-foreground/50",children:["playcount:"," ",(i=t.playback_count)==null?void 0:i.toLocaleString("en-US",{maximumFractionDigits:0})]})]})]})},cde=({tracks:t,onTrackSelected:e,className:n,...i})=>t.length===0?P.jsx("span",{className:"text-foreground",children:"This artist has no playable tracks."}):P.jsx(AH,{className:qt("no-scrollbar flex flex-col items-start justify-start gap-2",n),...i,children:t.map(r=>P.jsx(lde,{track:r,onClick:()=>{e(r)}},r.id))}),ude=({userId:t,limit:e=10,...n})=>{const{data:i}=DA({queryKey:["soundcloud-user-track-search",t],queryFn:async()=>await bne({userId:t,limit:e})});return P.jsx(cde,{tracks:i,...n})},dde=({user:t,className:e,...n})=>P.jsxs("div",{className:qt("flex w-12 shrink-0 flex-col items-center justify-start gap-1 hover:border hover:border-white aria-selected:animate-pulse aria-selected:border aria-selected:border-white",e),...n,children:[t.avatar_url?P.jsx("img",{src:t.avatar_url,className:"aspect-square w-full rounded-full",alt:"User avatar"}):P.jsx(o3,{}),P.jsx("span",{className:"w-full truncate text-xs text-foreground",children:t.username})]}),fde=({users:t,selectedUserId:e=void 0,onUserSelected:n,className:i,...r})=>P.jsx("div",{className:qt("no-scrollbar flex w-full cursor-pointer flex-row items-center justify-start gap-2 overflow-x-scroll",i),...r,children:t==null?void 0:t.map(s=>P.jsx(dde,{"aria-selected":e===s.id,user:s,onClick:()=>{n(s)}},s.id))}),hde=({query:t})=>{const{data:e}=DA({queryKey:["soundcloud-user-search",t],queryFn:async()=>await Ene({query:t,limit:20})}),[n,i]=b.useState(null),{setTrack:r}=yte();return P.jsxs("div",{className:"flex flex-col items-start justify-center gap-2",children:[P.jsx(fde,{users:e.filter(s=>(s.track_count??0)>0),onUserSelected:i,selectedUserId:n==null?void 0:n.id}),n&&P.jsx(b.Suspense,{fallback:P.jsx("span",{children:"Loading..."}),children:P.jsx(ude,{userId:n.id,onTrackSelected:r})})]})},pde=()=>{const{query:t}=Gue();return t?P.jsx(b.Suspense,{fallback:P.jsx("span",{className:"text-foreground",children:"Searching..."}),children:P.jsx(hde,{query:t})}):P.jsx("span",{className:"text-foreground",children:"No results..."})},mde=()=>P.jsxs(Wue,{children:[P.jsx(que,{placeholder:"Search Soundcloud users..."}),P.jsx(pde,{})]}),gde=()=>P.jsx(mde,{}),vde=({audioSource:t,...e})=>{switch(t){case Gn.SOUNDCLOUD:return P.jsx(a3,{...e});case Gn.MICROPHONE:return P.jsx(mG,{...e});case Gn.SCREEN_SHARE:return P.jsx(vG,{...e});case Gn.FILE_UPLOAD:return P.jsx(dG,{...e});default:return t}},yde=({className:t,...e})=>P.jsx("div",{className:qt("grid aspect-square w-full flex-none grow cursor-pointer place-content-center rounded-sm bg-gradient-to-b from-slate-700 to-black text-white shadow-inner duration-300 ease-in-out hover:scale-110 hover:from-slate-500 hover:to-slate-900 aria-selected:from-slate-100 aria-selected:to-slate-500 aria-selected:text-black",t),...e}),PH=({className:t,...e})=>{const{source:n}=hT(),{setAudio:i}=Os(),r=b.useMemo(()=>n3(),[]);return P.jsx("div",{className:qt("grid w-full grid-cols-6 justify-items-stretch gap-2 sm:grid-cols-8",t),...e,children:r.map(s=>P.jsx(yde,{onClick:()=>i({source:s}),"aria-selected":n===s,children:P.jsx(vde,{audioSource:s})},`grid_icon_${s}`))})},RH=()=>{const{source:t}=hT();switch(t){case Gn.SOUNDCLOUD:return P.jsx(gde,{});case Gn.FILE_UPLOAD:return P.jsx(Hue,{});case Gn.MICROPHONE:case Gn.SCREEN_SHARE:return null;default:return t}},xde=()=>{const{octaveBandMode:t,energyMeasure:e}=Lk(),{setAnalyzerFFT:n}=Os(),i=aa.data.hooks.useInstance(),{setParams:r}=aa.data.hooks.useActions();return P.jsxs("div",{className:"w-full space-y-4",children:[P.jsx(Pc,{label:"Amplitude",value:i.params.amplitude.toFixed(2)}),P.jsx(sl,{defaultValue:[i.params.amplitude],value:[i.params.amplitude],min:0,max:5,step:.01,onValueChange:s=>r({amplitude:s[0]})}),P.jsxs("div",{className:"flex w-full items-center justify-between",children:[P.jsx("span",{children:"Octave Band Mode"}),P.jsxs(pb,{onValueChange:s=>n({octaveBandMode:Number(s)}),children:[P.jsx(nx,{className:"max-w-1/2 w-[240px]",children:P.jsx(mb,{placeholder:GL[t],defaultValue:t,className:"w-full"})}),P.jsx(ix,{className:"max-h-36",children:Object.entries(GL).map(s=>P.jsx(rx,{value:s[0],"aria-selected":s[0]===t.toString(),children:s[1]},s[1]))})]})]}),P.jsxs("div",{className:"flex w-full items-center justify-between",children:[P.jsx("span",{children:"Energy Measure"}),P.jsxs(pb,{onValueChange:s=>{n({energyMeasure:s})},children:[P.jsx(nx,{className:"max-w-1/2 w-[240px]",children:P.jsx(mb,{placeholder:e,defaultValue:e,className:"w-full"})}),P.jsx(ix,{className:"max-h-36",children:fie.map(s=>P.jsx(rx,{value:s,"aria-selected":s===e,children:s},s))})]})]})]})},_de=()=>P.jsxs(Vue,{defaultValue:"source",className:"w-full",children:[P.jsxs(hH,{className:"w-full",children:[P.jsx(vb,{value:"source",className:"grow",children:"Audio Source"}),P.jsx(vb,{value:"analyzer",className:"grow",children:"Audio Analyzer"})]}),P.jsxs(yb,{value:"source",className:"space-y-4 p-4",children:[P.jsx(PH,{}),P.jsx(RH,{})]}),P.jsx(yb,{value:"analyzer",children:P.jsx(xde,{})})]}),Sde=()=>P.jsxs("div",{className:"space-y-4 p-4",children:[P.jsx(PH,{}),P.jsx(RH,{})]}),wde=({mode:t})=>{switch(t){case je.WAVE_FORM:return P.jsx(tG,{});case je.NOISE:return P.jsx(_G,{});case je.AUDIO:return P.jsx(a3,{});case je.AUDIO_SCOPE:return P.jsx(l3,{});case je.PARTICLE_NOISE:return P.jsx(SG,{});default:return t}},NN=({mode:t})=>P.jsxs("div",{className:"flex w-full items-center justify-start gap-2",children:[P.jsx("div",{className:"w-4",children:YW(t)&&"🎧"}),P.jsx(wde,{mode:t}),t]}),Mde=()=>{const t=Bf(),{setMode:e}=Os(),n=b.useMemo(()=>ZW(),[]);return P.jsxs(pb,{onValueChange:i=>{e(i)},children:[P.jsx(nx,{children:P.jsx(mb,{placeholder:P.jsx(NN,{mode:t}),defaultValue:t,className:"w-full"})}),P.jsx(ix,{children:n.map(i=>P.jsx(rx,{value:i,"aria-selected":i===t,children:P.jsx(NN,{mode:i})},`select_item_${i}`))})]})},Ede=()=>{const t=Bf();return P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:"flex items-center justify-start gap-4",children:[P.jsx("span",{className:"text-xl font-bold",children:"MODE"}),P.jsx(Mde,{})]}),P.jsx(xC,{}),t===je.WAVE_FORM&&P.jsx(aa.waveform.ControlsComponent,{}),t===je.NOISE&&P.jsx(aa.noise.ControlsComponent,{}),t===je.AUDIO&&P.jsx(_de,{}),t===je.AUDIO_SCOPE&&P.jsx(Sde,{})]})},bde=({palette:t,className:e,...n})=>{const i=ei.getPalette(t);return P.jsx("div",{className:qt("h-4 w-full rounded-sm",e),style:{background:`linear-gradient(0.25turn, ${i.colors.join(",")})`},...n})},Tde=({palette:t,className:e,...n})=>{const i=ei.getPalette(t);return P.jsx("div",{className:qt("aspect-square cursor-pointer rounded-full transition-all duration-200 ease-in-out hover:ring-2 hover:ring-primary aria-selected:animate-pulse aria-selected:ring-2 aria-selected:ring-primary",e),style:{background:`linear-gradient(45deg, ${i.colors.join(",")})`},...n})},Ade=()=>{const t=Fx();return t.ControlsComponent?P.jsx(t.ControlsComponent,{}):null},Cde=()=>{const t=Bf(),{colorBackground:e,paletteTrackEnergy:n}=Ym(),i=hY(),{setAppearance:r}=Os(),{autoOrbitAfterSleepMs:s}=Dk(),{setCamera:o}=Os();return P.jsxs("div",{className:"space-y-4",children:[P.jsxs("div",{className:"space-y-4",children:[P.jsxs("div",{className:"space-y-2",children:[P.jsx("div",{className:"",children:"Palette"}),P.jsx(bde,{palette:i}),P.jsx("div",{className:"grid w-full grid-cols-6 justify-items-stretch gap-2 sm:grid-cols-8",children:lp.map(a=>P.jsx(Tde,{palette:a,onClick:()=>r({palette:a}),"aria-selected":a===i},a))})]}),P.jsxs("div",{className:"flex items-center justify-between gap-2",children:[P.jsx(oa,{children:"Color Background"}),P.jsx(Gd,{defaultChecked:e,onCheckedChange:a=>r({colorBackground:a})})]}),P.jsxs("div",{className:"flex items-center justify-between gap-2",children:[P.jsx(oa,{children:"Colors Follow Music"}),P.jsx(Gd,{disabled:t!==je.AUDIO,defaultChecked:n,onCheckedChange:a=>r({paletteTrackEnergy:a})})]}),P.jsxs("div",{className:"flex items-center justify-between gap-2",children:[P.jsx(oa,{children:"Auto Orbit Camera"}),P.jsx(Gd,{disabled:!KW(t),defaultChecked:s>0,onCheckedChange:a=>{o(a?{mode:"AUTO_ORBIT",autoOrbitAfterSleepMs:3500}:{mode:"ORBIT_CONTROLS",autoOrbitAfterSleepMs:0})}})]})]}),P.jsx(xC,{}),P.jsx("div",{className:"space-y-4",children:P.jsx(Ade,{})})]})},Pde=()=>{const[t,e]=b.useState(!1);return P.jsxs(P.Fragment,{children:[P.jsx(GV,{id:"settings",handleClick:()=>e(n=>!n),children:P.jsx(xG,{})},"settings"),P.jsx(Gce,{open:t,onOpenChange:e,children:P.jsxs(f5,{insertHidden:!0,side:"right",className:"no-scrollbar w-full max-w-full space-y-4 overflow-scroll bg-background/70 p-4 pt-16 sm:w-[430px] sm:max-w-[430px]",children:[P.jsx(Ede,{}),P.jsx(Cde,{})]})})]})},Rde=()=>{const t=Fx(),{setVisual:e}=Os(),n=Bf(),i=b.useMemo(()=>Object.values(I0).filter(r=>[...r.supportedApplicationModes].includes(n)),[n]);return P.jsx(Tce,{fixedChildren:P.jsx(Pde,{}),children:i.map(r=>P.jsx(GV,{id:r.id,handleClick:()=>e(r.id),active:t.id===r.id,className:qt({"from-slate-500":t.id===r.id}),children:P.jsx(r.icon,{})},r.id))})},Ide=()=>{const{showUI:t}=Ym(),{setAppearance:e}=Os();return P.jsxs(P.Fragment,{children:[P.jsx("div",{className:"pointer-events-none absolute top-0 flex w-full flex-row items-center justify-end gap-2 p-4",children:P.jsx(Gd,{defaultChecked:t,className:"pointer-events-auto cursor-pointer",id:"controls-visible",onCheckedChange:n=>{e({showUI:n})}})}),t&&P.jsx(Rde,{})]})},Lde=t=>{switch(t){case je.AUDIO:case je.AUDIO_SCOPE:return P.jsx(wie,{mode:t});case je.WAVE_FORM:case je.NOISE:case je.PARTICLE_NOISE:return null;default:return t}},Dde=t=>{switch(t){case je.AUDIO_SCOPE:return P.jsx(xre,{});case je.WAVE_FORM:case je.NOISE:case je.AUDIO:case je.PARTICLE_NOISE:return P.jsx(Nre,{});default:return t}},Nde=()=>{const t=Bf(),{noteCanvasInteraction:e}=Os();return P.jsxs("main",{className:"relative h-[100dvh] w-[100dvw] bg-black",children:[P.jsx("div",{className:"absolute h-[100dvh] w-[100dvw]",onMouseDown:e,onTouchStart:e,children:P.jsx(b.Suspense,{fallback:P.jsx("span",{children:"loading..."}),children:Dde(t)})}),P.jsx("div",{className:"pointer-events-none absolute h-[100dvh] w-[100dvw]",children:P.jsx(b.Suspense,{fallback:P.jsx("span",{children:"loading..."}),children:Lde(t)})}),P.jsx(Ide,{})]})},Ode={theme:"system",setTheme:()=>null},kde=b.createContext(Ode);function Fde({children:t,defaultTheme:e="dark",storageKey:n="vite-ui-theme",...i}){const[r,s]=b.useState(e);b.useEffect(()=>{const a=window.document.documentElement;a.classList.remove("light","dark"),a.classList.add(r)},[r]);const o={theme:r,setTheme:a=>{localStorage.setItem(n,a),s(a)}};return P.jsx(kde.Provider,{...i,value:o,children:t})}const Ude=new Hne;i4(document.getElementById("root")).render(P.jsx(b.StrictMode,{children:P.jsx(qne,{client:Ude,children:P.jsx(Fde,{defaultTheme:"dark",storageKey:"vite-ui-theme",children:P.jsx(gte,{children:P.jsx(Nde,{})})})})}));export{Wn as $,nk as A,SA as B,ze as C,Vb as D,Bm as E,cs as F,ay as G,ap as H,Vm as I,ni as J,Pn as K,oa as L,Et as M,Nr as N,ir as O,oo as P,Wi as Q,Ns as R,sl as S,Ak as T,ho as U,B as V,Ds as W,ua as X,Ci as Y,Ln as Z,ra as _,ye as a,cx as a0,Ut as a1,un as a2,cn as a3,Xo as a4,Xde as a5,fo as a6,lf as a7,Die as a8,Rre as a9,kO as aA,To as aB,_l as aC,zO as aD,BO as aE,hd as aF,Qo as aG,_x as aH,Wp as aI,Xb as aJ,Pp as aK,ry as aL,ip as aM,_c as aN,Vi as aO,Ap as aP,Cp as aQ,Zc as aR,Hp as aS,Vp as aT,zf as aU,rr as aV,Gi as aW,qm as aX,$B as aY,L$ as aZ,HO as a_,WE as aa,eT as ab,$o as ac,al as ad,fx as ae,pj as af,gj as ag,mj as ah,Mr as ai,yM as aj,fa as ak,hk as al,pk as am,mk as an,JO as ao,FO as ap,df as aq,sn as ar,a$ as as,h$ as at,xx as au,co as av,Tp as aw,qb as ax,lr as ay,Jt as az,f_ as b,hY as c,ei as d,Pc as e,Gd as f,du as g,Ol as h,Rh as i,P as j,Vde as k,iY as l,Ox as m,Bs as n,mO as o,Vn as p,Yc as q,b as r,ol as s,Ko as t,jo as u,bo as v,vr as w,sO as x,cT as y,$n as z}; diff --git a/assets/index-zPQGFsGk.css b/assets/index-zPQGFsGk.css deleted file mode 100644 index 747dde93..00000000 --- a/assets/index-zPQGFsGk.css +++ /dev/null @@ -1 +0,0 @@ -#info{position:absolute;pointer-events:none;z-index:10;padding:1.5em;color:#fff;text-shadow:1px 1px black;border-radius:1em}.contrast #info button{border-color:#000}.contrast #info button:hover{background-color:#505050;color:#fff}#info button{color:inherit;cursor:pointer;border:1px solid white;outline:none;background:none;border-radius:3px;padding:.5em 1em;margin-right:.5em;pointer-events:auto;text-shadow:1px 1px black;font-weight:700}#info button:hover{background-color:#b4b4b4;color:#000;text-shadow:none}#info a{pointer-events:auto}#info p:last-child{margin-bottom:0}.contrast #info *,.contrast footer *{text-shadow:none;color:#000}#info h1{font-family:Montserrat,sans-serif;margin-bottom:.5em;font-size:1.5rem}#info h2{font-family:Montserrat,sans-serif;font-size:1rem}#info p{margin-bottom:1em}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root{--background: 0 0% 100%;--foreground: 20 14.3% 4.1%;--card: 0 0% 100%;--card-foreground: 20 14.3% 4.1%;--popover: 0 0% 100%;--popover-foreground: 20 14.3% 4.1%;--primary: 24 9.8% 10%;--primary-foreground: 60 9.1% 97.8%;--secondary: 60 4.8% 95.9%;--secondary-foreground: 24 9.8% 10%;--muted: 60 4.8% 95.9%;--muted-foreground: 25 5.3% 44.7%;--accent: 60 4.8% 95.9%;--accent-foreground: 24 9.8% 10%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 60 9.1% 97.8%;--border: 20 5.9% 90%;--input: 20 5.9% 90%;--ring: 20 14.3% 4.1%;--radius: .5rem}.dark{--background: 20 14.3% 4.1%;--foreground: 60 9.1% 97.8%;--card: 20 14.3% 4.1%;--card-foreground: 60 9.1% 97.8%;--popover: 20 14.3% 4.1%;--popover-foreground: 60 9.1% 97.8%;--primary: 60 9.1% 97.8%;--primary-foreground: 24 9.8% 10%;--secondary: 12 6.5% 15.1%;--secondary-foreground: 60 9.1% 97.8%;--muted: 12 6.5% 15.1%;--muted-foreground: 24 5.4% 63.9%;--accent: 12 6.5% 15.1%;--accent-foreground: 60 9.1% 97.8%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 60 9.1% 97.8%;--border: 12 6.5% 15.1%;--input: 12 6.5% 15.1%;--ring: 24 5.7% 82.9%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-24{bottom:6rem}.left-0{left:0}.left-2{left:.5rem}.right-0{right:0}.right-4{right:1rem}.top-0{top:0}.top-4{top:1rem}.z-50{z-index:50}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mt-2{margin-top:.5rem}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-square{aspect-ratio:1 / 1}.size-10{width:2.5rem;height:2.5rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[100dvh\]{height:100dvh}.h-\[1px\]{height:1px}.h-\[24px\]{height:24px}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.h-px{height:1px}.max-h-36{max-height:9rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-2\.5{width:.625rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-\[100dvw\]{width:100dvw}.w-\[1px\]{width:1px}.w-\[240px\]{width:240px}.w-\[44px\]{width:44px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-64{max-width:16rem}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-none{flex:none}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-y{scroll-snap-type:y var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness: mandatory}.snap-center{scroll-snap-align:center}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.place-content-center{place-content:center}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-items-stretch{justify-items:stretch}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-x-scroll{overflow-x:scroll}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded-\[6px\]{border-radius:6px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-\[\#4E4E4E\]{--tw-border-opacity: 1;border-color:rgb(78 78 78 / var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-transparent{border-color:transparent}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-background\/70{background-color:hsl(var(--background) / .7)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\/25{background-color:#00000040}.bg-border{background-color:hsl(var(--border))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-muted{background-color:hsl(var(--muted))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-white\/20{background-color:#fff3}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-l{background-image:linear-gradient(to left,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-slate-700{--tw-gradient-from: #334155 var(--tw-gradient-from-position);--tw-gradient-to: rgb(51 65 85 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white\/10{--tw-gradient-from: rgb(255 255 255 / .1) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-black{--tw-gradient-to: #000 var(--tw-gradient-to-position)}.to-white\/0{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position)}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pt-16{padding-top:4rem}.text-center{text-align:center}.text-right{text-align:right}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.leading-none{line-height:1}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}@keyframes scale{0%{scale:.25}}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-xs::-moz-placeholder{font-size:.75rem;line-height:1rem}.placeholder\:text-xs::placeholder{font-size:.75rem;line-height:1rem}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-150:hover{--tw-scale-x: 1.5;--tw-scale-y: 1.5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border:hover{border-width:1px}.hover\:border-white:hover{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-500\/20:hover{background-color:#64748b33}.hover\:bg-white\/50:hover{background-color:#ffffff80}.hover\:from-slate-500:hover{--tw-gradient-from: #64748b var(--tw-gradient-from-position);--tw-gradient-to: rgb(100 116 139 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-slate-900:hover{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground\/80:hover{color:hsl(var(--foreground) / .8)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}@keyframes pulse{50%{opacity:.5}}.aria-selected\:animate-pulse[aria-selected=true]{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.aria-selected\:border[aria-selected=true]{border-width:1px}.aria-selected\:border-white[aria-selected=true]{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.aria-selected\:bg-primary\/20[aria-selected=true]{background-color:hsl(var(--primary) / .2)}.aria-selected\:from-slate-100[aria-selected=true]{--tw-gradient-from: #f1f5f9 var(--tw-gradient-from-position);--tw-gradient-to: rgb(241 245 249 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.aria-selected\:to-slate-500[aria-selected=true]{--tw-gradient-to: #64748b var(--tw-gradient-to-position)}.aria-selected\:text-black[aria-selected=true]{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.aria-selected\:text-foreground[aria-selected=true]{color:hsl(var(--foreground))}.aria-selected\:ring-2[aria-selected=true]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.aria-selected\:ring-primary[aria-selected=true]{--tw-ring-color: hsl(var(--primary))}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}@media (min-width: 640px){.sm\:static{position:static}.sm\:bottom-0{bottom:0}.sm\:flex{display:flex}.sm\:h-fit{height:-moz-fit-content;height:fit-content}.sm\:w-\[540px\]{width:540px}.sm\:max-w-\[540px\]{max-width:540px}.sm\:max-w-\[60\%\]{max-width:60%}.sm\:max-w-sm{max-width:24rem}.sm\:snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:bg-black\/25{background-color:#00000040}.sm\:bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.sm\:text-left{text-align:left}} diff --git a/assets/reactive-3iPiwwNw.js b/assets/reactive-3iPiwwNw.js new file mode 100644 index 00000000..59ee3f20 --- /dev/null +++ b/assets/reactive-3iPiwwNw.js @@ -0,0 +1 @@ +import{r as A,M as I,c as _,d as B,b as G,j as n,g as N,h as U,H as b,i as w,V as F,k as O}from"./index-DwhXMaNP.js";import{G as v}from"./ground-DJZ6lP2l.js";const z=({coordinateMapper:M,nPerSide:e=10,cubeSideLength:i=.5,cubeSpacingScalar:d=.1,volume:j=!0})=>{const u=A.useRef(null),m=A.useMemo(()=>new I,[]),y=j?w.CARTESIAN_3D:w.CARTESIAN_CUBE_FACES,R=_(),T=B.getPalette(R).buildLut();return A.useEffect(()=>{let p,c,t,a,s;for(let o=0;o{const c=p.getElapsedTime(),t=e*(1+d)*i;let a,s,o,r,l,E,g,f;for(let h=0;h{const e=D();return n.jsxs(n.Fragment,{children:[n.jsx(z,{coordinateMapper:M,...e}),n.jsx(v,{position:new F(0,0,-.75*e.nPerSide*(1+e.cubeSpacingScalar)*e.cubeSideLength)})]})};export{X as default,L as useActions,D as useParams,V as usePresets}; diff --git a/assets/reactive-B8Cs-xx5.js b/assets/reactive-B8Cs-xx5.js new file mode 100644 index 00000000..2ef8b0fe --- /dev/null +++ b/assets/reactive-B8Cs-xx5.js @@ -0,0 +1 @@ +import{r as f,M as S,c as w,d as A,b as T,j as s,g as I,h as Y,i as b,k as z,V as B}from"./index-DwhXMaNP.js";import{G as O}from"./ground-DJZ6lP2l.js";const R=({coordinateMapper:i,nGridRows:e=100,nGridCols:t=100,cubeSideLength:o=.025,cubeSpacingScalar:h=5})=>{const n=f.useRef(null),M=f.useMemo(()=>new S,[]),E=w(),g=A.getPalette(E).buildLut();return f.useEffect(()=>{if(!g)return;const x=Math.hypot(.5,.5);let l,u,m,c;for(let a=0;a{const l=x.getElapsedTime(),u=e*h*o,m=t*h*o;let c,a,r,j,P,y;for(let d=0;d{const e=V();return s.jsxs(s.Fragment,{children:[s.jsx(R,{coordinateMapper:i,...e}),s.jsx(O,{position:new B(0,0,-2.5*i.amplitude)})]})};export{G as default,D as useActions,V as useParams,F as usePresets}; diff --git a/assets/reactive-BCKqTRYY.js b/assets/reactive-BCKqTRYY.js deleted file mode 100644 index 8d33a4c6..00000000 --- a/assets/reactive-BCKqTRYY.js +++ /dev/null @@ -1 +0,0 @@ -import{r as d,g as Y,ab as O,V as P,l as C,a as X,c as Z,j as c,G as _}from"./index-Cghja_vb.js";const L=d.createContext(null);function M(){const y=d.useContext(L);if(!y)throw new Error("useStencilVisualConfigContext must be used within a StencilVisualConfigContextProvider");return y.config}const U=(y,s=!1)=>{const t=y.length,o=new Array;for(let e=0;e{const D=Array.from({length:r}).map(Y),m=s.map(f=>new O(f.map(n=>new P(n.x,n.y,0).multiplyScalar(25)),!1,"catmullrom",0).getSpacedPoints(r)),B=m.map(f=>U(f.map(n=>new C(n.x,n.y)))),E=d.useRef(null),h=d.useRef(null);d.useLayoutEffect(()=>{h.current&&h.current.setFromPoints(m[0])},[h,m]);const b=a*s.length;return X(({clock:f})=>{const n=f.getElapsedTime(),G=n%b/b,p=Math.floor(G*s.length),V=p+1>=s.length?0:p+1,F=n%a/a,j=m[p],A=m[V],z=B[p],N=B[V];let i,w;const g=new P,R=new P,S=E.current.geometry.attributes.position;for(let x=0;xo){S.setXYZ(x,0,0,0);continue}i=l*y.map(Z.CARTESIAN_1D,(w-t)/Math.abs(o-t),0,0,n),e&&(i*=D[x]),g.set(j[x].x+i*z[x].x,j[x].y+i*z[x].y,j[x].z),p!==V&&(R.set(A[x].x+i*N[x].x,A[x].y+i*N[x].y,A[x].z),g.lerp(R,F)),S.setXYZ(x,g.x,g.y,g.z)}S.needsUpdate=!0}),c.jsxs("points",{ref:E,children:[c.jsx("bufferGeometry",{attach:"geometry",ref:h}),c.jsx("pointsMaterial",{attach:"material",size:u})]})},I=()=>[new C(-.5,.5),new C(.5,-.5)],k=[{x:0,y:0},{x:0,y:.6203703880310059},{x:.0029761905316263437,y:.6256613731384277},{x:0,y:.6289682388305664},{x:0,y:.6937830448150635},{x:.0034722222480922937,y:.6977513432502747},{x:0,y:.7017195820808411},{x:.004464285913854837,y:.7003968358039856},{x:.010416666977107525,y:.695105791091919},{x:.01686508022248745,y:.6957672238349915},{x:.0243055559694767,y:.7023809552192688},{x:.0252976194024086,y:.7109788656234741},{x:.0292658731341362,y:.7136243581771851},{x:.02976190485060215,y:.704365074634552},{x:.0272817462682724,y:.6990740895271301},{x:.03125,y:.6944444179534912},{x:.0396825410425663,y:.6944444179534912},{x:.0416666679084301,y:.6917989253997803},{x:.0520833320915699,y:.6911375522613525},{x:.0545634925365448,y:.695105791091919},{x:.0530753955245018,y:.6984127163887024},{x:.0565476194024086,y:.695105791091919},{x:.0615079365670681,y:.6970899701118469},{x:.0634920671582222,y:.6931216716766357},{x:.0620039664208889,y:.6904761791229248},{x:.0620039664208889,y:.6832010746002197},{x:.0634920671582222,y:.6812169551849365},{x:.0620039664208889,y:.6759259104728699},{x:.0694444477558136,y:.6712962985038757},{x:.0773809552192688,y:.6600528955459595},{x:.083829365670681,y:.6626983880996704},{x:.085317462682724,y:.6666666865348816},{x:.0868055522441864,y:.6560846567153931},{x:.092261902987957,y:.6554232835769653},{x:.09375,y:.6567460298538208},{x:.09375,y:.6607142686843872},{x:.0962301567196846,y:.6580687761306763},{x:.1011904776096344,y:.6600528955459595},{x:.1016865074634552,y:.6626983880996704},{x:.0997023805975914,y:.6660053133964539},{x:.105158731341362,y:.6646825671195984},{x:.1125992089509964,y:.6693121790885925},{x:.1160714253783226,y:.6567460298538208},{x:.1185515895485878,y:.6580687761306763},{x:.1200396791100502,y:.6560846567153931},{x:.1210317462682724,y:.6600528955459595},{x:.1240079328417778,y:.6560846567153931},{x:.1269841343164444,y:.6580687761306763},{x:.1269841343164444,y:.6620370149612427},{x:.1289682537317276,y:.6600528955459595},{x:.1324404776096344,y:.6626983880996704},{x:.1314484179019928,y:.670634925365448},{x:.133432537317276,y:.6732804179191589},{x:.133432537317276,y:.6785714030265808},{x:.1274801641702652,y:.6785714030265808},{x:.1269841343164444,y:.6805555820465088},{x:.1329365074634552,y:.6805555820465088},{x:.1339285671710968,y:.6792327761650085},{x:.1398809552192688,y:.679894208908081},{x:.1398809552192688,y:.6812169551849365},{x:.1408730149269104,y:.679894208908081},{x:.1453372985124588,y:.679894208908081},{x:.1512896865606308,y:.6759259104728699},{x:.153273805975914,y:.6792327761650085},{x:.15625,y:.6752645373344421},{x:.159226194024086,y:.679894208908081},{x:.16170634329319,y:.6792327761650085},{x:.164682537317276,y:.6818783283233643},{x:.1641865074634552,y:.6838624477386475},{x:.162202388048172,y:.6832010746002197},{x:.1631944477558136,y:.6878306865692139},{x:.16170634329319,y:.6898148059844971},{x:.1626984179019928,y:.6898148059844971},{x:.1666666716337204,y:.6832010746002197},{x:.1681547611951828,y:.682539701461792},{x:.1691468209028244,y:.6838624477386475},{x:.1656745970249176,y:.6898148059844971},{x:.1721230149269104,y:.6898148059844971},{x:.170634925365448,y:.695105791091919},{x:.1750992089509964,y:.6984127163887024},{x:.1746031790971756,y:.7017195820808411},{x:.176091268658638,y:.704365074634552},{x:.1770833283662796,y:.7017195820808411},{x:.179067462682724,y:.7003968358039856},{x:.181547611951828,y:.7010582089424133},{x:.1855158656835556,y:.6964285969734192},{x:.1870039701461792,y:.6970899701118469},{x:.1825396865606308,y:.7056878209114075},{x:.181547611951828,y:.7169312238693237},{x:.1865079402923584,y:.7142857313156128},{x:.1865079402923584,y:.7103174328804016},{x:.1884920597076416,y:.7103174328804016},{x:.1894841343164444,y:.7083333134651184},{x:.1969245970249176,y:.7096560597419739},{x:.1924603134393692,y:.7050264477729797},{x:.1884920597076416,y:.7050264477729797},{x:.1884920597076416,y:.7030423283576965},{x:.1914682537317276,y:.6984127163887024},{x:.1964285671710968,y:.6977513432502747},{x:.1979166716337204,y:.6990740895271301},{x:.2013888955116272,y:.6957672238349915},{x:.2063492089509964,y:.6851851940155029},{x:.2033730149269104,y:.6838624477386475},{x:.2003968209028244,y:.6865079402923584},{x:.1974206417798996,y:.6812169551849365},{x:.198908731341362,y:.6752645373344421},{x:.1924603134393692,y:.6699735522270203},{x:.1830357164144516,y:.6746031641960144},{x:.1830357164144516,y:.670634925365448},{x:.1894841343164444,y:.6653439402580261},{x:.181547611951828,y:.6666666865348816},{x:.18204365670681,y:.6633597612380981},{x:.1795634925365448,y:.6600528955459595},{x:.1795634925365448,y:.6567460298538208},{x:.1855158656835556,y:.6534391641616821},{x:.1855158656835556,y:.6461640000343323},{x:.1875,y:.6441798806190491},{x:.1884920597076416,y:.6382275223731995},{x:.195932537317276,y:.6296296119689941},{x:.2008928507566452,y:.6269841194152832},{x:.201884925365448,y:.6283068656921387},{x:.2038690447807312,y:.6256613731384277},{x:.2048611044883728,y:.6289682388305664},{x:.2063492089509964,y:.6243386268615723},{x:.210317462682724,y:.625},{x:.2118055522441864,y:.6309523582458496},{x:.2137896865606308,y:.6316137313842773},{x:.2147817462682724,y:.6256613731384277},{x:.2177579402923584,y:.6230158805847168},{x:.224702388048172,y:.625},{x:.224702388048172,y:.6230158805847168},{x:.2142857164144516,y:.6091269850730896},{x:.2147817462682724,y:.6071428656578064},{x:.2172619104385376,y:.6091269850730896},{x:.2172619104385376,y:.6071428656578064},{x:.2118055522441864,y:.5998677015304565},{x:.212797611951828,y:.5972222089767456},{x:.224702388048172,y:.5919312238693237},{x:.227182537317276,y:.5932539701461792},{x:.2286706417798996,y:.591269850730896},{x:.2321428507566452,y:.5972222089767456},{x:.2425595223903656,y:.5965608358383179},{x:.2480158656835556,y:.6025132536888123},{x:.2544642984867096,y:.60317462682724},{x:.2554563581943512,y:.6044973731040955},{x:.2539682686328888,y:.6183862686157227},{x:.255952388048172,y:.6177248954772949},{x:.2564484179019928,y:.6124338507652283},{x:.2599206268787384,y:.6097883582115173},{x:.2599206268787384,y:.6064814925193787},{x:.26091268658638,y:.6078042387962341},{x:.2633928656578064,y:.6071428656578064},{x:.2673611044883728,y:.6117724776268005},{x:.2713293731212616,y:.6058201193809509},{x:.2743055522441864,y:.6084656119346619},{x:.2738095223903656,y:.6150793433189392},{x:.2777777910232544,y:.6084656119346619},{x:.2802579402923584,y:.6071428656578064},{x:.2842261791229248,y:.6111111044883728},{x:.2876984179019928,y:.6117724776268005},{x:.2891865074634552,y:.6144179701805115},{x:.2881944477558136,y:.6164020895957947},{x:.29216268658638,y:.6137565970420837},{x:.293154776096344,y:.6097883582115173},{x:.2951388955116272,y:.6137565970420837},{x:.2976190447807312,y:.613095223903656},{x:.2986111044883728,y:.6150793433189392},{x:.3020833432674408,y:.6104497313499451},{x:.3055555522441864,y:.6144179701805115},{x:.304067462682724,y:.6177248954772949},{x:.3075396716594696,y:.6190476417541504},{x:.3090277910232544,y:.6111111044883728},{x:.3139880895614624,y:.6150793433189392},{x:.3199404776096344,y:.6084656119346619},{x:.3194444477558136,y:.6064814925193787},{x:.3164682686328888,y:.6044973731040955},{x:.314980149269104,y:.6051587462425232},{x:.3125,y:.6025132536888123},{x:.3115079402923584,y:.5992063283920288},{x:.3000991940498352,y:.5952380895614624},{x:.3010912835597992,y:.5939153432846069},{x:.3050595223903656,y:.5939153432846069},{x:.3020833432674408,y:.5853174328804016},{x:.3035714328289032,y:.5846560597419739},{x:.3050595223903656,y:.5873016119003296},{x:.3070436418056488,y:.5866402387619019},{x:.3090277910232544,y:.5767195820808411},{x:.3129960298538208,y:.5806878209114075},{x:.3144841194152832,y:.5773809552192688},{x:.3169642984867096,y:.5813491940498352},{x:.318452388048172,y:.5800264477729797},{x:.3224206268787384,y:.5853174328804016},{x:.3229166567325592,y:.5833333134651184},{x:.320932537317276,y:.5820105671882629},{x:.320932537317276,y:.5800264477729797},{x:.324404776096344,y:.579365074634552},{x:.3249008059501648,y:.5826719403266907},{x:.3253968358039856,y:.579365074634552},{x:.3239087164402008,y:.5773809552192688},{x:.3273809552192688,y:.5727513432502747},{x:.3308531641960144,y:.5753968358039856},{x:.3323412835597992,y:.5734127163887024},{x:.3373015820980072,y:.579365074634552},{x:.3417658805847168,y:.5780423283576965},{x:.346230149269104,y:.5833333134651184},{x:.349702388048172,y:.5800264477729797},{x:.349702388048172,y:.5740740895271301},{x:.3511904776096344,y:.5760582089424133},{x:.355654776096344,y:.5727513432502747},{x:.3571428656578064,y:.5767195820808411},{x:.358134925365448,y:.5734127163887024},{x:.3601190447807312,y:.5773809552192688},{x:.3596230149269104,y:.5826719403266907},{x:.3655754029750824,y:.5767195820808411},{x:.3685515820980072,y:.5773809552192688},{x:.3695436418056488,y:.579365074634552},{x:.3695436418056488,y:.5899471044540405},{x:.3660714328289032,y:.5952380895614624},{x:.3764880895614624,y:.5833333134651184},{x:.377480149269104,y:.5727513432502747},{x:.3794642984867096,y:.5720899701118469},{x:.3814484179019928,y:.5753968358039856},{x:.3854166567325592,y:.5727513432502747},{x:.3913690447807312,y:.5667989253997803},{x:.4007936418056488,y:.5529100298881531},{x:.4042658805847168,y:.5515872836112976},{x:.408730149269104,y:.5469576716423035},{x:.408730149269104,y:.5436508059501648},{x:.4032738208770752,y:.5416666865348816},{x:.4047619104385376,y:.5370370149612427},{x:.4112103283405304,y:.533730149269104},{x:.4201388955116272,y:.5343915224075317},{x:.44841268658638,y:.5026454925537109},{x:.4563491940498352,y:.4960317313671112},{x:.462797611951828,y:.48743385076522827},{x:.47966268658638,y:.47156083583831787},{x:.4766865074634552,y:.4642857015132904},{x:.4756944477558136,y:.43121692538261414},{x:.480654776096344,y:.4126984179019928},{x:.4801587164402008,y:.3968254029750824},{x:.4826388955116272,y:.39550265669822693},{x:.4866071343421936,y:.3988095223903656},{x:.4935515820980072,y:.3988095223903656},{x:.4990079402923584,y:.3948412835597992},{x:.4990079402923584,y:.41402116417884827},{x:.5029761791229248,y:.43716931343078613},{x:.5029761791229248,y:.454365074634552},{x:.5004960298538208,y:.47486773133277893},{x:.4955357015132904,y:.48544973134994507},{x:.4945436418056488,y:.49669313430786133},{x:.4925595223903656,y:.49933862686157227},{x:.4875991940498352,y:.49933862686157227},{x:.4846230149269104,y:.4841269850730896},{x:.480654776096344,y:.47883597016334534},{x:.4781745970249176,y:.4801587164402008},{x:.4751984179019928,y:.48478835821151733},{x:.474702388048172,y:.48875662684440613},{x:.4697420597076416,y:.4900793731212616},{x:.4702380895614624,y:.49867725372314453},{x:.4657738208770752,y:.5072751045227051},{x:.462797611951828,y:.5066137313842773},{x:.4613095223903656,y:.49933862686157227},{x:.4449404776096344,y:.5171957612037659},{x:.4449404776096344,y:.5224867463111877},{x:.4409722089767456,y:.5224867463111877},{x:.4379960298538208,y:.5244709253311157},{x:.42658731341362,y:.5370370149612427},{x:.4236111044883728,y:.5410053133964539},{x:.4236111044883728,y:.5462962985038757},{x:.4191468358039856,y:.5542327761650085},{x:.414682537317276,y:.5562169551849365},{x:.4126984179019928,y:.5535714030265808},{x:.4097222089767456,y:.5568783283233643},{x:.4092261791229248,y:.5641534328460693},{x:.4057539701461792,y:.5634920597076416},{x:.4027777910232544,y:.5661375522613525},{x:.4042658805847168,y:.5720899701118469},{x:.4027777910232544,y:.5853174328804016},{x:.4042658805847168,y:.5919312238693237},{x:.4032738208770752,y:.5992063283920288},{x:.4042658805847168,y:.5998677015304565},{x:.4057539701461792,y:.5978835821151733},{x:.4077380895614624,y:.6005290746688843},{x:.4032738208770752,y:.6025132536888123},{x:.4027777910232544,y:.6097883582115173},{x:.4052579402923584,y:.613095223903656},{x:.4022817313671112,y:.6164020895957947},{x:.4007936418056488,y:.6150793433189392},{x:.4012896716594696,y:.6117724776268005},{x:.3988095223903656,y:.6144179701805115},{x:.39533731341362,y:.6137565970420837},{x:.3983134925365448,y:.6111111044883728},{x:.3993055522441864,y:.6078042387962341},{x:.3983134925365448,y:.5925925970077515},{x:.4012896716594696,y:.5839946866035461},{x:.4007936418056488,y:.5687830448150635},{x:.391865074634552,y:.5787037014961243},{x:.3933531641960144,y:.5826719403266907},{x:.3923611044883728,y:.5873016119003296},{x:.39533731341362,y:.5879629850387573},{x:.394345223903656,y:.5939153432846069},{x:.391865074634552,y:.5952380895614624},{x:.3903769850730896,y:.60317462682724},{x:.3923611044883728,y:.6051587462425232},{x:.3928571343421936,y:.613095223903656},{x:.39533731341362,y:.6144179701805115},{x:.3938491940498352,y:.6157407164573669},{x:.39533731341362,y:.6216931343078613},{x:.397817462682724,y:.6256613731384277},{x:.4007936418056488,y:.6230158805847168},{x:.4027777910232544,y:.625},{x:.4007936418056488,y:.6283068656921387},{x:.4027777910232544,y:.6335979104042053},{x:.4052579402923584,y:.6316137313842773},{x:.4092261791229248,y:.6223545074462891},{x:.4156745970249176,y:.6236772537231445},{x:.41716268658638,y:.6296296119689941},{x:.418154776096344,y:.6269841194152832},{x:.4166666567325592,y:.6236772537231445},{x:.4201388955116272,y:.6183862686157227},{x:.4201388955116272,y:.6170634627342224},{x:.4196428656578064,y:.6164020895957947},{x:.4191468358039856,y:.6150793433189392},{x:.4191468358039856,y:.6170634627342224},{x:.41716268658638,y:.6170634627342224},{x:.4102182686328888,y:.6117724776268005},{x:.40625,y:.6124338507652283},{x:.4107142984867096,y:.6044973731040955},{x:.4102182686328888,y:.5992063283920288},{x:.4077380895614624,y:.5985449552536011},{x:.4072420597076416,y:.5965608358383179},{x:.4107142984867096,y:.5972222089767456},{x:.4131944477558136,y:.5958994626998901},{x:.4166666567325592,y:.5972222089767456},{x:.4201388955116272,y:.5932539701461792},{x:.423115074634552,y:.5925925970077515},{x:.4246031641960144,y:.5945767164230347},{x:.4241071343421936,y:.5972222089767456},{x:.42658731341362,y:.5965608358383179},{x:.4270833432674408,y:.5978835821151733},{x:.4260912835597992,y:.5992063283920288},{x:.4241071343421936,y:.5985449552536011},{x:.4226190447807312,y:.6025132536888123},{x:.4335317313671112,y:.6038359999656677},{x:.4414682686328888,y:.601190447807312},{x:.4479166567325592,y:.6038359999656677},{x:.4508928656578064,y:.6084656119346619},{x:.4533730149269104,y:.60317462682724},{x:.456845223903656,y:.6064814925193787},{x:.4618055522441864,y:.6078042387962341},{x:.4632936418056488,y:.6111111044883728},{x:.462797611951828,y:.6177248954772949},{x:.4598214328289032,y:.6203703880310059},{x:.4583333432674408,y:.625},{x:.462797611951828,y:.6197090148925781},{x:.4657738208770752,y:.6197090148925781},{x:.471230149269104,y:.6289682388305664},{x:.4707341194152832,y:.6302909851074219},{x:.4707341194152832,y:.6329365372657776},{x:.4717261791229248,y:.6302909851074219},{x:.474702388048172,y:.6309523582458496},{x:.4786706268787384,y:.6355820298194885},{x:.47966268658638,y:.6342592835426331},{x:.4836309552192688,y:.6355820298194885},{x:.4895833432674408,y:.6421957612037659},{x:.4895833432674408,y:.648809552192688},{x:.4841269850730896,y:.6547619104385376},{x:.4841269850730896,y:.6580687761306763},{x:.4875991940498352,y:.6554232835769653},{x:.48908731341362,y:.6560846567153931},{x:.4980158805847168,y:.6699735522270203},{x:.502480149269104,y:.6792327761650085},{x:.502480149269104,y:.6832010746002197},{x:.5054563283920288,y:.6871693134307861},{x:.507440447807312,y:.7010582089424133},{x:.5044642686843872,y:.7050264477729797},{x:.5039682388305664,y:.7103174328804016},{x:.5014880895614624,y:.7076719403266907},{x:.497519850730896,y:.7076719403266907},{x:.5009920597076416,y:.7142857313156128},{x:.5,y:.7175925970077515},{x:.4970238208770752,y:.7175925970077515},{x:.4965277910232544,y:.7189153432846069},{x:.4965277910232544,y:.7208994626998901},{x:.5004960298538208,y:.7248677015304565},{x:.4990079402923584,y:.7288359999656677},{x:.4960317313671112,y:.7301587462425232},{x:.497519850730896,y:.7400793433189392},{x:.494047611951828,y:.7453703880310059},{x:.488095223903656,y:.7466931343078613},{x:.4826388955116272,y:.7552909851074219},{x:.4826388955116272,y:.7572751045227051},{x:.488095223903656,y:.7566137313842773},{x:.4895833432674408,y:.761904776096344},{x:.4910714328289032,y:.7625661492347717},{x:.48908731341362,y:.7711640000343323},{x:.4905754029750824,y:.7843915224075317},{x:.4945436418056488,y:.7870370149612427},{x:.4955357015132904,y:.7923280596733093},{x:.497519850730896,y:.7936508059501648},{x:.5004960298538208,y:.8009259104728699},{x:.5004960298538208,y:.807539701461792},{x:.4960317313671112,y:.8134920597076416},{x:.4995039701461792,y:.8148148059844971},{x:.4990079402923584,y:.8220899701118469},{x:.5019841194152832,y:.8359788656234741},{x:.5,y:.8432539701461792},{x:.4905754029750824,y:.8406084775924683},{x:.4920634925365448,y:.8432539701461792},{x:.4925595223903656,y:.8518518805503845},{x:.4910714328289032,y:.8544973731040955},{x:.4920634925365448,y:.85317462682724},{x:.4930555522441864,y:.8544973731040955},{x:.494047611951828,y:.8650793433189392},{x:.4905754029750824,y:.8657407164573669},{x:.4900793731212616,y:.8697090148925781},{x:.4920634925365448,y:.8723545074462891},{x:.4851190447807312,y:.875},{x:.4846230149269104,y:.8776454925537109},{x:.4905754029750824,y:.8796296119689941},{x:.494047611951828,y:.8835979104042053},{x:.5,y:.8829365372657776},{x:.5009920597076416,y:.8842592835426331},{x:.502480149269104,y:.8822751045227051},{x:.504960298538208,y:.8829365372657776},{x:.5084325671195984,y:.8888888955116272},{x:.5104166865348816,y:.8862434029579163},{x:.5124008059501648,y:.886904776096344},{x:.5104166865348816,y:.8961640000343323},{x:.5114087462425232,y:.8974867463111877},{x:.5128968358039856,y:.8941798806190491},{x:.5133928656578064,y:.9001322984695435},{x:.5109127163887024,y:.9041005373001099},{x:.507440447807312,y:.9034391641616821},{x:.5054563283920288,y:.9120370149612427},{x:.50942462682724,y:.9093915224075317},{x:.5163690447807312,y:.8994709253311157},{x:.5188491940498352,y:.9034391641616821},{x:.5213293433189392,y:.8822751045227051},{x:.528769850730896,y:.8829365372657776},{x:.5277777910232544,y:.8849206566810608},{x:.5243055820465088,y:.8842592835426331},{x:.5233134627342224,y:.8855820298194885},{x:.5233134627342224,y:.8882275223731995},{x:.526289701461792,y:.8882275223731995},{x:.5252976417541504,y:.8908730149269104},{x:.528769850730896,y:.8888888955116272},{x:.5282738208770752,y:.8875661492347717},{x:.5302579402923584,y:.886904776096344},{x:.53125,y:.8835979104042053},{x:.5352182388305664,y:.8829365372657776},{x:.54067462682724,y:.8908730149269104},{x:.54067462682724,y:.8961640000343323},{x:.5426587462425232,y:.8935185074806213},{x:.5451388955116272,y:.8941798806190491},{x:.5500991940498352,y:.9027777910232544},{x:.5515872836112976,y:.9107142686843872},{x:.550595223903656,y:.9140211343765259},{x:.5515872836112976,y:.9120370149612427},{x:.5545634627342224,y:.9160053133964539},{x:.5610119104385376,y:.9153439402580261},{x:.5615079402923584,y:.9166666865348816},{x:.5634920597076416,y:.9140211343765259},{x:.5610119104385376,y:.9113756418228149},{x:.5615079402923584,y:.9093915224075317},{x:.5669642686843872,y:.9100528955459595},{x:.5689483880996704,y:.9133597612380981},{x:.5669642686843872,y:.9232804179191589},{x:.5724206566810608,y:.9272486567497253},{x:.5749008059501648,y:.9265872836112976},{x:.5778769850730896,y:.9318783283233643},{x:.579365074634552,y:.9305555820465088},{x:.5798611044883728,y:.9199735522270203},{x:.5828372836112976,y:.9219576716423035},{x:.58432537317276,y:.9193121790885925},{x:.5858134627342224,y:.9199735522270203},{x:.5882936716079712,y:.9179894328117371},{x:.5873016119003296,y:.9060846567153931},{x:.5932539701461792,y:.9041005373001099},{x:.5942460298538208,y:.9093915224075317},{x:.596230149269104,y:.9074074029922485},{x:.5967261791229248,y:.9107142686843872},{x:.598710298538208,y:.9113756418228149},{x:.5992063283920288,y:.9160053133964539},{x:.6016865372657776,y:.9133597612380981},{x:.6076388955116272,y:.9199735522270203},{x:.6061508059501648,y:.9226190447807312},{x:.6086309552192688,y:.9246031641960144},{x:.610615074634552,y:.9312169551849365},{x:.6061508059501648,y:.9398148059844971},{x:.6091269850730896,y:.9391534328460693},{x:.610615074634552,y:.9411375522613525},{x:.6160714030265808,y:.9384920597076416},{x:.6145833134651184,y:.9345238208770752},{x:.6160714030265808,y:.929894208908081},{x:.6254960298538208,y:.9332010746002197},{x:.625,y:.9259259104728699},{x:.627480149269104,y:.9259259104728699},{x:.6289682388305664,y:.9279100298881531},{x:.629960298538208,y:.9259259104728699},{x:.6319444179534912,y:.932539701461792},{x:.63442462682724,y:.9246031641960144},{x:.6364087462425232,y:.9232804179191589},{x:.636904776096344,y:.9285714030265808},{x:.6388888955116272,y:.9272486567497253},{x:.6423611044883728,y:.929894208908081},{x:.6438491940498352,y:.9292327761650085},{x:.6448412537574768,y:.9332010746002197},{x:.6473214030265808,y:.9305555820465088},{x:.6498016119003296,y:.9332010746002197},{x:.6493055820465088,y:.9365079402923584},{x:.6522817611694336,y:.9338624477386475},{x:.6602182388305664,y:.9384920597076416},{x:.6617063283920288,y:.9365079402923584},{x:.6641865372657776,y:.9378306865692139},{x:.6716269850730896,y:.9351851940155029},{x:.6770833134651184,y:.9411375522613525},{x:.6765872836112976,y:.9444444179534912},{x:.6830357313156128,y:.9417989253997803},{x:.685019850730896,y:.942460298538208},{x:.6815476417541504,y:.9378306865692139},{x:.6845238208770752,y:.9312169551849365},{x:.6860119104385376,y:.9312169551849365},{x:.6875,y:.9345238208770752},{x:.6884920597076416,y:.9338624477386475},{x:.6889880895614624,y:.9272486567497253},{x:.685019850730896,y:.9252645373344421},{x:.6865079402923584,y:.9239417910575867},{x:.685019850730896,y:.9199735522270203},{x:.6944444179534912,y:.9246031641960144},{x:.6944444179534912,y:.9212962985038757},{x:.69692462682724,y:.920634925365448},{x:.6974206566810608,y:.9226190447807312},{x:.6989087462425232,y:.9239417910575867},{x:.6954365372657776,y:.9153439402580261},{x:.6954365372657776,y:.9113756418228149},{x:.6989087462425232,y:.908730149269104},{x:.7033730149269104,y:.9100528955459595},{x:.7063491940498352,y:.9054232835769653},{x:.7058531641960144,y:.9014550447463989},{x:.7088293433189392,y:.8994709253311157},{x:.7132936716079712,y:.9007936716079712},{x:.7167658805847168,y:.8981481194496155},{x:.71875,y:.9054232835769653},{x:.721230149269104,y:.9007936716079712},{x:.726190447807312,y:.9067460298538208},{x:.7321428656578064,y:.9034391641616821},{x:.733134925365448,y:.9074074029922485},{x:.7351190447807312,y:.9074074029922485},{x:.7395833134651184,y:.9113756418228149},{x:.7385912537574768,y:.9160053133964539},{x:.74057537317276,y:.9133597612380981},{x:.742559552192688,y:.9160053133964539},{x:.7410714030265808,y:.9193121790885925},{x:.7435516119003296,y:.920634925365448},{x:.7435516119003296,y:.9259259104728699},{x:.7455357313156128,y:.9272486567497253},{x:.7465277910232544,y:.9318783283233643},{x:.7455357313156128,y:.9351851940155029},{x:.742559552192688,y:.9371693134307861},{x:.7470238208770752,y:.9404761791229248},{x:.7519841194152832,y:.9589946866035461},{x:.7495039701461792,y:.9748677015304565},{x:.75,y:.9808201193809509},{x:.747519850730896,y:.9821428656578064},{x:.7514880895614624,y:.9854497313499451},{x:.7504960298538208,y:.9933862686157227},{x:.752480149269104,y:.9947090148925781},{x:.7519841194152832,y:.9993386268615723},{x:.9995039701461792,y:.9993386268615723},{x:.9995039701461792,y:0},{x:0,y:0}],T=()=>k.map(y=>new C(y.x-.5,.5-y.y)),J=({coordinateMapper:y})=>{const{pointSize:s,power:t,bounds:o,transitionSpeed:l}=M(),e=[T(),I(),T(),I()];return c.jsxs(c.Fragment,{children:[c.jsx($,{coordinateMapper:y,polyStates:e,parametricMin:o[0],parametricMax:o[1],power:t,pointSize:s,transitionSpeedSec:l}),c.jsx(_,{position:new P(0,0,-1.5*y.amplitude)})]})};export{J as default}; diff --git a/assets/reactive-BYTUQiod.js b/assets/reactive-BYTUQiod.js new file mode 100644 index 00000000..b069038e --- /dev/null +++ b/assets/reactive-BYTUQiod.js @@ -0,0 +1,2 @@ +import{a0 as Ue,af as xe,ag as re,ah as Ie,M as v,ai as De,aj as _,ak as j,C as x,al as Pe,am as Ne,an as we,h as w,ao as J,a as Re,V as b,ap as _e,aq as Qe,ar as Y,as as ve,at as ke,a2 as Q,au as Xe,K as Te,av as ge,aw as oe,ax as je,Y as q,ay as Ye,ab as Ae,P as Ze,az as We,a1 as He,aA as Ve,J as qe,aB as ze,aC as $e,aD as et,aE as tt,aF as z,$ as st,o as nt,aG as rt,aH as ot,aI as it,aJ as at,aK as Je,Q as ce,z as At,aL as ct,aM as Bt,aN as lt,aO as Ct,aP as ut,aQ as ht,X as dt,aR as ft,Z as ue,aS as he,aT as de,aU as fe,aV as mt,aW as pt,aX as Gt,aY as Be,r as D,aZ as Et,b as le,c as Le,d as be,j as R,a_ as Ft,g as Mt,i as It}from"./index-DwhXMaNP.js";import{e as Dt,E as Rt}from"./easing-BzOxJDJb.js";const Tt=parseInt(Ue.replace(/\D+/g,""));function me(C,e){if(e===xe)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),C;if(e===re||e===Ie){let t=C.getIndex();if(t===null){const r=[],a=C.getAttribute("position");if(a!==void 0){for(let i=0;i=2.0 are supported."));return}const i=new is(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});i.fileLoader.setRequestHeader(this.requestHeader);for(let A=0;A=0&&a[B]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+B+'".')}}i.setExtensions(r),i.setPlugins(a),i.parse(o,s)}parseAsync(e,t){const o=this;return new Promise(function(s,n){o.parse(e,t,s,n)})}}function Ht(){let C={};return{get:function(e){return C[e]},add:function(e,t){C[e]=t},remove:function(e){delete C[e]},removeAll:function(){C={}}}}const E={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Jt{constructor(e){this.parser=e,this.name=E.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let o=0,s=t.length;o=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,r)}}class vt{constructor(e){this.parser=e,this.name=E.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,o=this.parser,s=o.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;const r=n.extensions[t],a=s.images[r.source];let i=o.textureLoader;if(a.uri){const A=o.options.manager.getHandler(a.uri);A!==null&&(i=A)}return this.detectSupport().then(function(A){if(A)return o.loadTextureImage(e,r.source,i);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return o.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class kt{constructor(e){this.parser=e,this.name=E.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,o=this.parser,s=o.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;const r=n.extensions[t],a=s.images[r.source];let i=o.textureLoader;if(a.uri){const A=o.options.manager.getHandler(a.uri);A!==null&&(i=A)}return this.detectSupport().then(function(A){if(A)return o.loadTextureImage(e,r.source,i);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return o.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Xt{constructor(e){this.name=E.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,o=t.bufferViews[e];if(o.extensions&&o.extensions[this.name]){const s=o.extensions[this.name],n=this.parser.getDependency("buffer",s.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then(function(a){const i=s.byteOffset||0,A=s.byteLength||0,B=s.count,c=s.byteStride,l=new Uint8Array(a,i,A);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(B,c,l,s.mode,s.filter).then(function(u){return u.buffer}):r.ready.then(function(){const u=new ArrayBuffer(B*c);return r.decodeGltfBuffer(new Uint8Array(u),B,c,l,s.mode,s.filter),u})})}else return null}}class jt{constructor(e){this.name=E.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,o=t.nodes[e];if(!o.extensions||!o.extensions[this.name]||o.mesh===void 0)return null;const s=t.meshes[o.mesh];for(const A of s.primitives)if(A.mode!==g.TRIANGLES&&A.mode!==g.TRIANGLE_STRIP&&A.mode!==g.TRIANGLE_FAN&&A.mode!==void 0)return null;const r=o.extensions[this.name].attributes,a=[],i={};for(const A in r)a.push(this.parser.getDependency("accessor",r[A]).then(B=>(i[A]=B,i[A])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(A=>{const B=A.pop(),c=B.isGroup?B.children:[B],l=A[0].count,u=[];for(const h of c){const f=new v,d=new b,m=new ce,G=new b(1,1,1),F=new _e(h.geometry,h.material,l);for(let p=0;p=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},S={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},$t={CUBICSPLINE:void 0,LINEAR:Je,STEP:ht},ee={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function es(C){return C.DefaultMaterial===void 0&&(C.DefaultMaterial=new Ae({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:dt})),C.DefaultMaterial}function K(C,e,t){for(const o in t.extensions)C[o]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[o]=t.extensions[o])}function L(C,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(C.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function ts(C,e,t){let o=!1,s=!1,n=!1;for(let A=0,B=e.length;A0||C.search(/^data\:image\/jpeg/)===0?"image/jpeg":C.search(/\.webp($|\?)/i)>0||C.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const os=new v;class is{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Ht,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let o=!1,s=!1,n=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,n=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||o||s&&n<98?this.textureLoader=new ve(this.options.manager):this.textureLoader=new ke(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new j(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const o=this,s=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([o.getDependencies("scene"),o.getDependencies("animation"),o.getDependencies("camera")])}).then(function(r){const a={scene:r[0][s.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:s.asset,parser:o,userData:{}};return K(n,a,s),L(a,s),Promise.all(o._invokeAll(function(i){return i.afterRoot&&i.afterRoot(a)})).then(function(){for(const i of a.scenes)i.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],o=this.json.meshes||[];for(let s=0,n=t.length;s{const i=this.associations.get(r);i!=null&&this.associations.set(a,i);for(const[A,B]of r.children.entries())n(B,a.children[A])};return n(o,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let o=0;o=2&&d.setY(H,I[T*i+1]),i>=3&&d.setZ(H,I[T*i+2]),i>=4&&d.setW(H,I[T*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return d})}loadTexture(e){const t=this.json,o=this.options,n=t.textures[e].source,r=t.images[n];let a=this.textureLoader;if(r.uri){const i=o.manager.getHandler(r.uri);i!==null&&(a=i)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,o){const s=this,n=this.json,r=n.textures[e],a=n.images[t],i=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[i])return this.textureCache[i];const A=this.loadImageSource(t,o).then(function(B){B.flipY=!1,B.name=r.name||a.name||"",B.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(B.name=a.uri);const l=(n.samplers||{})[r.sampler]||{};return B.magFilter=Ee[l.magFilter]||Te,B.minFilter=Ee[l.minFilter]||ge,B.wrapS=Fe[l.wrapS]||oe,B.wrapT=Fe[l.wrapT]||oe,s.associations.set(B,{textures:e}),B}).catch(function(){return null});return this.textureCache[i]=A,A}loadImageSource(e,t){const o=this,s=this.json,n=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(c=>c.clone());const r=s.images[e],a=self.URL||self.webkitURL;let i=r.uri||"",A=!1;if(r.bufferView!==void 0)i=o.getDependency("bufferView",r.bufferView).then(function(c){A=!0;const l=new Blob([c],{type:r.mimeType});return i=a.createObjectURL(l),i});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const B=Promise.resolve(i).then(function(c){return new Promise(function(l,u){let h=l;t.isImageBitmapLoader===!0&&(h=function(f){const d=new ue(f);d.needsUpdate=!0,l(d)}),t.load(_.resolveURL(c,n.path),h,void 0,u)})}).then(function(c){return A===!0&&a.revokeObjectURL(i),L(c,r),c.userData.mimeType=r.mimeType||rs(r.uri),c}).catch(function(c){throw console.error("THREE.GLTFLoader: Couldn't load texture",i),c});return this.sourceCache[e]=B,B}assignTexture(e,t,o,s){const n=this;return this.getDependency("texture",o.index).then(function(r){if(!r)return null;if(o.texCoord!==void 0&&o.texCoord>0&&(r=r.clone(),r.channel=o.texCoord),n.extensions[E.KHR_TEXTURE_TRANSFORM]){const a=o.extensions!==void 0?o.extensions[E.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const i=n.associations.get(r);r=n.extensions[E.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),n.associations.set(r,i)}}return s!==void 0&&(typeof s=="number"&&(s=s===pe?U:O),"colorSpace"in r?r.colorSpace=s:r.encoding=s===U?pe:gt),e[t]=r,r})}assignFinalMaterial(e){const t=e.geometry;let o=e.material;const s=t.attributes.tangent===void 0,n=t.attributes.color!==void 0,r=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+o.uuid;let i=this.cache.get(a);i||(i=new je,q.prototype.copy.call(i,o),i.color.copy(o.color),i.map=o.map,i.sizeAttenuation=!1,this.cache.add(a,i)),o=i}else if(e.isLine){const a="LineBasicMaterial:"+o.uuid;let i=this.cache.get(a);i||(i=new Ye,q.prototype.copy.call(i,o),i.color.copy(o.color),i.map=o.map,this.cache.add(a,i)),o=i}if(s||n||r){let a="ClonedMaterial:"+o.uuid+":";s&&(a+="derivative-tangents:"),n&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let i=this.cache.get(a);i||(i=o.clone(),n&&(i.vertexColors=!0),r&&(i.flatShading=!0),s&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(a,i),this.associations.set(i,this.associations.get(o))),o=i}e.material=o}getMaterialType(){return Ae}loadMaterial(e){const t=this,o=this.json,s=this.extensions,n=o.materials[e];let r;const a={},i=n.extensions||{},A=[];if(i[E.KHR_MATERIALS_UNLIT]){const c=s[E.KHR_MATERIALS_UNLIT];r=c.getMaterialType(),A.push(c.extendParams(a,n,t))}else{const c=n.pbrMetallicRoughness||{};if(a.color=new x(1,1,1),a.opacity=1,Array.isArray(c.baseColorFactor)){const l=c.baseColorFactor;a.color.setRGB(l[0],l[1],l[2],O),a.opacity=l[3]}c.baseColorTexture!==void 0&&A.push(t.assignTexture(a,"map",c.baseColorTexture,U)),a.metalness=c.metallicFactor!==void 0?c.metallicFactor:1,a.roughness=c.roughnessFactor!==void 0?c.roughnessFactor:1,c.metallicRoughnessTexture!==void 0&&(A.push(t.assignTexture(a,"metalnessMap",c.metallicRoughnessTexture)),A.push(t.assignTexture(a,"roughnessMap",c.metallicRoughnessTexture))),r=this._invokeOne(function(l){return l.getMaterialType&&l.getMaterialType(e)}),A.push(Promise.all(this._invokeAll(function(l){return l.extendMaterialParams&&l.extendMaterialParams(e,a)})))}n.doubleSided===!0&&(a.side=Ze);const B=n.alphaMode||ee.OPAQUE;if(B===ee.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,B===ee.MASK&&(a.alphaTest=n.alphaCutoff!==void 0?n.alphaCutoff:.5)),n.normalTexture!==void 0&&r!==w&&(A.push(t.assignTexture(a,"normalMap",n.normalTexture)),a.normalScale=new Re(1,1),n.normalTexture.scale!==void 0)){const c=n.normalTexture.scale;a.normalScale.set(c,c)}if(n.occlusionTexture!==void 0&&r!==w&&(A.push(t.assignTexture(a,"aoMap",n.occlusionTexture)),n.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=n.occlusionTexture.strength)),n.emissiveFactor!==void 0&&r!==w){const c=n.emissiveFactor;a.emissive=new x().setRGB(c[0],c[1],c[2],O)}return n.emissiveTexture!==void 0&&r!==w&&A.push(t.assignTexture(a,"emissiveMap",n.emissiveTexture,U)),Promise.all(A).then(function(){const c=new r(a);return n.name&&(c.name=n.name),L(c,n),t.associations.set(c,{materials:e}),n.extensions&&K(s,c,n),c})}createUniqueName(e){const t=We.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,o=this.extensions,s=this.primitiveCache;function n(a){return o[E.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(i){return Me(i,a,t)})}const r=[];for(let a=0,i=e.length;a0&&ss(m,n),m.name=t.createUniqueName(n.name||"mesh_"+e),L(m,n),d.extensions&&K(s,m,d),t.assignFinalMaterial(m),c.push(m)}for(let u=0,h=c.length;u1?B=new z:A.length===1?B=A[0]:B=new Y,B!==A[0])for(let c=0,l=A.length;c{const c=new Map;for(const[l,u]of s.associations)(l instanceof q||l instanceof ue)&&c.set(l,u);return B.traverse(l=>{const u=s.associations.get(l);u!=null&&c.set(l,u)}),c};return s.associations=A(n),n})}_createAnimationTracks(e,t,o,s,n){const r=[],a=e.name?e.name:e.uuid,i=[];S[n.path]===S.weights?e.traverse(function(l){l.morphTargetInfluences&&i.push(l.name?l.name:l.uuid)}):i.push(a);let A;switch(S[n.path]){case S.weights:A=de;break;case S.rotation:A=fe;break;case S.position:case S.scale:A=he;break;default:switch(o.itemSize){case 1:A=de;break;case 2:case 3:default:A=he;break}break}const B=s.interpolation!==void 0?$t[s.interpolation]:Je,c=this._getArrayFromAccessor(o);for(let l=0,u=i.length;l{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(r,a).then(t).catch(s)},o,s)}decodeDracoFile(e,t,o,s){const n={attributeIDs:o||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!o};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){for(const i in t.attributeTypes){const A=t.attributeTypes[i];A.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[i]=A.name)}const o=JSON.stringify(t);if(se.has(e)){const i=se.get(e);if(i.key===o)return i.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const n=this.workerNextTaskID++,r=e.byteLength,a=this._getWorker(n,r).then(i=>(s=i,new Promise((A,B)=>{s._callbacks[n]={resolve:A,reject:B},s.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(i=>this._createGeometry(i.geometry));return a.catch(()=>!0).then(()=>{s&&n&&this._releaseTask(s,n)}),se.set(e,{key:o,promise:a}),a}_createGeometry(e){const t=new He;e.index&&t.setIndex(new Q(e.index.array,1));for(let o=0;o{o.load(e,s,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(o=>{const s=o[0];e||(this.decoderConfig.wasmBinary=o[1]);const n=cs.toString(),r=["/* draco decoder */",s,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join(` +`);this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengthn._taskLoad?-1:1});const o=this.workerPool[this.workerPool.length-1];return o._taskCosts[e]=t,o._taskLoad+=t,o})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const c=B.draco,l=new c.Decoder,u=new c.DecoderBuffer;u.Init(new Int8Array(i),i.byteLength);try{const h=t(c,l,u,A),f=h.attributes.map(d=>d.array.buffer);h.index&&f.push(h.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:h},f)}catch(h){console.error(h),self.postMessage({type:"error",id:a.id,error:h.message})}finally{c.destroy(u),c.destroy(l)}});break}};function t(r,a,i,A){const B=A.attributeIDs,c=A.attributeTypes;let l,u;const h=a.GetEncodedGeometryType(i);if(h===r.TRIANGULAR_MESH)l=new r.Mesh,u=a.DecodeBufferToMesh(i,l);else if(h===r.POINT_CLOUD)l=new r.PointCloud,u=a.DecodeBufferToPointCloud(i,l);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!u.ok()||l.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+u.error_msg());const f={index:null,attributes:[]};for(const d in B){const m=self[c[d]];let G,F;if(A.useUniqueIDs)F=B[d],G=a.GetAttributeByUniqueId(l,F);else{if(F=a.GetAttributeId(l,r[B[d]]),F===-1)continue;G=a.GetAttribute(l,F)}f.attributes.push(s(r,a,l,d,m,G))}return h===r.TRIANGULAR_MESH&&(f.index=o(r,a,l)),r.destroy(l),f}function o(r,a,i){const B=i.num_faces()*3,c=B*4,l=r._malloc(c);a.GetTrianglesUInt32Array(i,c,l);const u=new Uint32Array(r.HEAPF32.buffer,l,B).slice();return r._free(l),{array:u,itemSize:1}}function s(r,a,i,A,B,c){const l=c.num_components(),h=i.num_points()*l,f=h*B.BYTES_PER_ELEMENT,d=n(r,B),m=r._malloc(f);a.GetAttributeDataArrayForAllPoints(i,c,d,f,m);const G=new B(r.HEAPF32.buffer,m,h).slice();return r._free(m),{name:A,array:G,itemSize:l}}function n(r,a){switch(a){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32}}}let k;const ne=()=>{if(k)return k;const C="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),o=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let s=C;WebAssembly.validate(t)&&(s=e);let n;const r=WebAssembly.instantiate(a(s),{}).then(c=>{n=c.instance,n.exports.__wasm_call_ctors()});function a(c){const l=new Uint8Array(c.length);for(let h=0;h96?f-71:f>64?f-65:f>47?f+4:f>46?63:62}let u=0;for(let h=0;h{t&&t(o),C&&(X||(X=new As),X.setDecoderPath(typeof C=="string"?C:ye),o.setDRACOLoader(X)),e&&o.setMeshoptDecoder(typeof ne=="function"?ne():ne)}}const W=(C,e,t,o)=>Be(Ce,C,Ke(e,t,o));W.preload=(C,e,t,o)=>Be.preload(Ce,C,Ke(e,t,o));W.clear=C=>Be.clear(Ce,C);W.setDecoderPath=C=>{ye=C};function Bs(C,e){const t=D.useRef(),[o]=D.useState(()=>e?e instanceof Y?{current:e}:e:t),[s]=D.useState(()=>new Et(void 0));D.useLayoutEffect(()=>{e&&(o.current=e instanceof Y?e:e.current),s._root=o.current});const n=D.useRef({}),r=D.useMemo(()=>{const a={};return C.forEach(i=>Object.defineProperty(a,i.name,{enumerable:!0,get(){if(o.current)return n.current[i.name]||(n.current[i.name]=s.clipAction(i,o.current))},configurable:!0})),{ref:o,clips:C,actions:a,names:C.map(i=>i.name),mixer:s}},[C]);return le((a,i)=>s.update(i)),D.useEffect(()=>{const a=o.current;return()=>{n.current={},s.stopAllAction(),Object.values(r.actions).forEach(i=>{a&&s.uncacheAction(i,a)})}},[C]),r}const ls="/r3f-audio-visualizer/assets/horse-DMamucGr.png",Cs=C=>{const e=D.useRef(null),{nodes:t,animations:o}=W(ls),s=Le(),n=be.getPalette(s).buildLut(),r=D.useMemo(()=>R.jsx("meshStandardMaterial",{color:n.getColor(.5),flatShading:!0}),[n]),{actions:a}=Bs(o,e);return D.useEffect(()=>{var i;(i=a==null?void 0:a.horse_A_)==null||i.play()}),le(({clock:i})=>{var l;const A=i.getElapsedTime(),c=(Math.sin(.5*A)+1)/2;(l=a==null?void 0:a.horse_A_)==null||l.setEffectiveTimeScale(c)}),R.jsx("group",{ref:e,scale:[.025,.025,.025],rotation:[Math.PI/2,Math.PI,0],dispose:null,children:R.jsxs("group",{name:"AuxScene",children:[R.jsx("pointLight",{position:[10,100,200],intensity:100}),R.jsx("mesh",{name:"mesh_0",castShadow:!0,receiveShadow:!0,geometry:t.mesh_0.geometry,morphTargetDictionary:t.mesh_0.morphTargetDictionary,morphTargetInfluences:t.mesh_0.morphTargetInfluences,children:r})]})})},us=[[-1,1],[-.75,-.1],[-.6,0],[0,0],[.6,0],[.75,-.1],[1,1]],hs=({nStones:C=30,stoneWidth:e=5,stoneHeight:t=.1,stoneLength:o=1,coordinateMapper:s})=>{const n=D.useRef(null),[r,a,i,A]=D.useMemo(()=>[new v,new b,new ce,new b],[]),B=D.useMemo(()=>new Ft(us.map(h=>new b(0,h[0],h[1]).multiplyScalar(10)),!1,"catmullrom",.1),[]),c=Le(),l=be.getPalette(c).buildLut();return D.useEffect(()=>{if(n.current){for(let u=0;u{if(!n.current)return;const h=u.getElapsedTime(),f=.025,d=.5,G=f*(h-Math.cos(d*h)/d)%1,F=1-Dt(G,Rt.LINEAR);for(let p=0;pR.jsxs(R.Fragment,{children:[R.jsx(hs,{...C}),R.jsx(Cs,{...C})]});export{ms as default}; diff --git a/assets/reactive-BdX5JLG8.js b/assets/reactive-BdX5JLG8.js new file mode 100644 index 00000000..e5b9909a --- /dev/null +++ b/assets/reactive-BdX5JLG8.js @@ -0,0 +1 @@ +import{c as w,r as m,M as C,d as E,b as R,j as e,g as T,h as A,i as I,T as f,V as y,k as B}from"./index-DwhXMaNP.js";import{G}from"./ground-DJZ6lP2l.js";const O=({coordinateMapper:c,radius:r=2,nPoints:t=800,cubeSideLength:l=.05})=>{const g=w(),s=m.useRef(null),j=m.useMemo(()=>new C,[]),M=E.getPalette(g).buildLut();return m.useEffect(()=>{for(let a=0;a{const P=a.getElapsedTime();let h,o,i,d,p,x,n;for(let u=0;u{const r=S();return e.jsxs(e.Fragment,{children:[e.jsx(O,{coordinateMapper:c,...r}),e.jsx(G,{position:new y(0,0,-r.radius*(1+.25*c.amplitude))})]})};export{U as default,k as useActions,S as useParams,F as usePresets}; diff --git a/assets/reactive-BgYCCJBi.js b/assets/reactive-BgYCCJBi.js deleted file mode 100644 index e5c1af0f..00000000 --- a/assets/reactive-BgYCCJBi.js +++ /dev/null @@ -1 +0,0 @@ -import{u as w,r as M,M as E,C as P,a as R,c as S,T as f,j as t,B as T,b as B,aa as I,G as y,V as A}from"./index-Cghja_vb.js";const G=({coordinateMapper:n,radius:r=2,nPoints:e=800,cubeSideLength:o=.05})=>{const g=w(),a=M.useRef(null),j=M.useMemo(()=>new E,[]),x=P.getPalette(g).buildLut();return M.useEffect(()=>{for(let s=0;s{const C=s.getElapsedTime();let h,i,c,m,p,d,l;for(let u=0;u{const{radius:r,nPoints:e,unitSideLength:o}=I();return t.jsxs(t.Fragment,{children:[t.jsx(G,{coordinateMapper:n,radius:r,nPoints:e,cubeSideLength:o}),t.jsx(y,{position:new A(0,0,-r*(1+.25*n.amplitude))})]})};export{V as default}; diff --git a/assets/reactive-BeOWGcMZ.js b/assets/reactive-BoTxrBvq.js similarity index 66% rename from assets/reactive-BeOWGcMZ.js rename to assets/reactive-BoTxrBvq.js index a09a549c..71668762 100644 --- a/assets/reactive-BeOWGcMZ.js +++ b/assets/reactive-BoTxrBvq.js @@ -1 +1 @@ -import{r as s,a9 as M,V as _,u as D,C as F,j as e,K as L,a as V,c as z}from"./index-Cghja_vb.js";function B(u,r){const h=u+"Geometry";return s.forwardRef(({args:i,children:a,...j},d)=>{const o=s.useRef(null);return s.useImperativeHandle(d,()=>o.current),s.useLayoutEffect(()=>void(r==null?void 0:r(o.current))),s.createElement("mesh",M({ref:o},j),s.createElement(h,{attach:"geometry",args:i}),a)})}const p=B("plane"),N=({coordinateMapper:u,ribbonWidth:r=1,ribbonHeight:h=10,ribbonWidthSegments:i=1,ribbonHeightSegments:a=64,zScale:j=2})=>{const d=[s.useRef(null),s.useRef(null),s.useRef(null),s.useRef(null),s.useRef(null)],o=d.length,w=r*o/2,n=h/2,T=Array.from({length:o}).map((m,l)=>new _(w-r*l-r/2,0,0)),A=D(),R=F.getPalette(A),f=s.useMemo(()=>e.jsx("meshStandardMaterial",{color:R.colorsHex[Math.floor(R.nColors/2)],roughness:.25,metalness:.25,side:L,flatShading:!1}),[R]);V(({clock:m})=>{const l=m.getElapsedTime();let x,c,E,g,S,v,P;d.forEach((y,I)=>{if(!y.current)return;const C=y.current.geometry.attributes.position;for(c=0;c<=a;c++)for(P=1-Math.abs(c-a/2)/(a/2),x=0;x<=i;x++)g=(I+.5)/o,S=(c+.5)/a,E=c*(i+1)+x,v=j*u.map(z.CARTESIAN_2D,g,S,0,l),C.setZ(E,v*P);C.needsUpdate=!0})});const t=250;return e.jsxs(e.Fragment,{children:[e.jsx("ambientLight",{}),e.jsx("pointLight",{position:[2,2,5],intensity:150}),e.jsx(p,{args:[t/2,t,1,1],position:[w+t/4,0,0],castShadow:!0,receiveShadow:!0,children:f}),e.jsx(p,{args:[t/2,t,1,1],position:[-w-t/4,0,0],castShadow:!0,receiveShadow:!0,children:f}),e.jsx(p,{args:[t/4,t/2-n,1,1],position:[0,-n-(t/2-n)/2,0],castShadow:!0,receiveShadow:!0,children:f}),e.jsx(p,{args:[t/4,t/2-n,1,1],position:[0,n+(t/2-n)/2,0],castShadow:!0,receiveShadow:!0,children:f}),d.map((m,l)=>e.jsx(p,{args:[r,h,i,a],ref:m,position:T[l],castShadow:!0,receiveShadow:!0,children:f},`ribbon-plane-${l}`))]})},Y=({coordinateMapper:u})=>e.jsx(e.Fragment,{children:e.jsx(N,{coordinateMapper:u})});export{Y as default}; +import{r as s,aa as M,V as _,c as D,d as F,j as e,P as L,b as z,i as B}from"./index-DwhXMaNP.js";function N(u,r){const h=u+"Geometry";return s.forwardRef(({args:i,children:a,...j},d)=>{const o=s.useRef(null);return s.useImperativeHandle(d,()=>o.current),s.useLayoutEffect(()=>void(r==null?void 0:r(o.current))),s.createElement("mesh",M({ref:o},j),s.createElement(h,{attach:"geometry",args:i}),a)})}const p=N("plane"),O=({coordinateMapper:u,ribbonWidth:r=1,ribbonHeight:h=10,ribbonWidthSegments:i=1,ribbonHeightSegments:a=64,zScale:j=2})=>{const d=[s.useRef(null),s.useRef(null),s.useRef(null),s.useRef(null),s.useRef(null)],o=d.length,w=r*o/2,n=h/2,T=Array.from({length:o}).map((m,l)=>new _(w-r*l-r/2,0,0)),A=D(),E=F.getPalette(A),f=s.useMemo(()=>e.jsx("meshStandardMaterial",{color:E.colorsHex[Math.floor(E.nColors/2)],roughness:.25,metalness:.25,side:L,flatShading:!1}),[E]);z(({clock:m})=>{const l=m.getElapsedTime();let x,c,R,g,v,S,P;d.forEach((y,I)=>{if(!y.current)return;const C=y.current.geometry.attributes.position;for(c=0;c<=a;c++)for(P=1-Math.abs(c-a/2)/(a/2),x=0;x<=i;x++)g=(I+.5)/o,v=(c+.5)/a,R=c*(i+1)+x,S=j*u.map(B.CARTESIAN_2D,g,v,0,l),C.setZ(R,S*P);C.needsUpdate=!0})});const t=250;return e.jsxs(e.Fragment,{children:[e.jsx("ambientLight",{}),e.jsx("pointLight",{position:[2,2,5],intensity:150}),e.jsx(p,{args:[t/2,t,1,1],position:[w+t/4,0,0],castShadow:!0,receiveShadow:!0,children:f}),e.jsx(p,{args:[t/2,t,1,1],position:[-w-t/4,0,0],castShadow:!0,receiveShadow:!0,children:f}),e.jsx(p,{args:[t/4,t/2-n,1,1],position:[0,-n-(t/2-n)/2,0],castShadow:!0,receiveShadow:!0,children:f}),e.jsx(p,{args:[t/4,t/2-n,1,1],position:[0,n+(t/2-n)/2,0],castShadow:!0,receiveShadow:!0,children:f}),d.map((m,l)=>e.jsx(p,{args:[r,h,i,a],ref:m,position:T[l],castShadow:!0,receiveShadow:!0,children:f},`ribbon-plane-${l}`))]})},Y=({coordinateMapper:u})=>e.jsx(e.Fragment,{children:e.jsx(O,{coordinateMapper:u})});export{Y as default}; diff --git a/assets/reactive-BphjmU22.js b/assets/reactive-BphjmU22.js deleted file mode 100644 index e3b21147..00000000 --- a/assets/reactive-BphjmU22.js +++ /dev/null @@ -1 +0,0 @@ -import{r as E,M as _,u as d,C as B,a as G,j as u,B as N,b as U,c as y,H as g,d as F,G as O,V}from"./index-Cghja_vb.js";const z=({coordinateMapper:A,nPerSide:t=10,cubeSideLength:l=.5,cubeSpacingScalar:p=.1,volume:b=!0})=>{const m=E.useRef(null),i=E.useMemo(()=>new _,[]),R=b?y.CARTESIAN_3D:y.CARTESIAN_CUBE_FACES,T=d(),I=B.getPalette(T).buildLut();return E.useEffect(()=>{let C,n,e,a,s;for(let o=0;o{const n=C.getElapsedTime(),e=t*(1+p)*l;let a,s,o,r,c,w,j,f;for(let x=0;x{const{nPerSide:t,unitSideLength:l,unitSpacingScalar:p,volume:b}=F();return u.jsxs(u.Fragment,{children:[u.jsx(z,{coordinateMapper:A,nPerSide:t,cubeSideLength:l,cubeSpacingScalar:p,volume:b}),u.jsx(O,{position:new V(0,0,-.75*t*(1+p)*l)})]})};export{Y as default}; diff --git a/assets/reactive-CeDCw1Du.js b/assets/reactive-CeDCw1Du.js new file mode 100644 index 00000000..8c1262ba --- /dev/null +++ b/assets/reactive-CeDCw1Du.js @@ -0,0 +1 @@ +import{r as M,a9 as U,M as V,c as q,d as F,b as J,j as n,g as L,h as X,V as Y}from"./index-DwhXMaNP.js";import{G as B}from"./ground-DJZ6lP2l.js";import{e as O,c as S,l as _}from"./easing-BzOxJDJb.js";const H=({scalarTracker:c,nBoxes:e=5,gridSize:x=10,cellSize:o=.25})=>{const u=x,m=x,g=M.useMemo(()=>new U(.65,150,2*250),[250]),i=M.useRef(null),h=M.useMemo(()=>new V,[]),D=q(),C=F.getPalette(D).buildLut(),a=M.useMemo(()=>Array.from({length:e},s=>{const r=Math.floor(u*Math.random()),l=Math.floor(m*Math.random());return{fromRow:r,fromCol:l,toRow:r,toCol:l}}),[e,u,m]);return M.useEffect(()=>{for(let s=0;s{if(g.step((c==null?void 0:c.get())??0)){const[w,p]=Math.random()>.5?[!0,!1]:[!1,!0];for(let t=0;t.5?1:-1),p&&(a[t].toCol+=Math.random()>.5?1:-1)}const s=O(S(g.timeSinceLastEventMs/250)),r=_(Math.PI/4,3*Math.PI/4,s),l=-.5*o*Math.cos(r)/Math.sqrt(2),E=.5*o*Math.sin(r)/Math.sqrt(2);let R,j,P,b,v,f,d;a.forEach(({fromRow:w,fromCol:p,toRow:t,toCol:I},y)=>{f=t-w,d=I-p;const A=w+f*(l+.5),G=p+d*(l+.5);f!==0&&h.makeRotationY((r-Math.PI/4)*f),d!==0&&h.makeRotationX(-(r-Math.PI/4)*d),R=A/(u-1),j=G/(m-1),P=u*o*(R-.5),b=m*o*(j-.5),v=E-o/4,h.setPosition(P,b,v),i.current.setMatrixAt(y,h)}),i.current.instanceMatrix.needsUpdate=!0}),n.jsxs("instancedMesh",{ref:i,castShadow:!0,receiveShadow:!0,args:[new L,new X,e],children:[n.jsx("boxGeometry",{attach:"geometry",args:[o,o,o,1]}),n.jsx("meshBasicMaterial",{attach:"material",color:"white",toneMapped:!1})]})},Z=({scalarTracker:c})=>n.jsxs(n.Fragment,{children:[n.jsx(H,{scalarTracker:c??{get:()=>Math.sin(.0025*Date.now())+1,set:()=>{}},nBoxes:200,gridSize:100,cellSize:1}),n.jsx(B,{position:new Y(0,0,-1/2)})]});export{Z as default}; diff --git a/assets/reactive-CgD5EBKP.js b/assets/reactive-CgD5EBKP.js deleted file mode 100644 index 9a9a5b75..00000000 --- a/assets/reactive-CgD5EBKP.js +++ /dev/null @@ -1,2 +0,0 @@ -import{_ as Ue,ac as xe,ad as re,ae as Ie,M as v,af as De,ag as _,ah as j,x,ai as Pe,aj as Ne,ak as we,b as w,al as J,l as Re,V as b,am as _e,an as Qe,ao as Y,ap as ve,aq as ke,a0 as Q,ar as Xe,I as Te,as as ge,at as oe,au as je,R as q,av as Ye,aw as Ae,K as Ze,ax as We,$ as He,ay as Ve,A as qe,az as ze,aA as $e,aB as et,aC as tt,aD as z,Z as st,h as nt,aE as rt,aF as ot,aG as it,aH as at,aI as Je,Q as ce,v as At,aJ as ct,aK as Bt,aL as lt,aM as Ct,aN as ut,aO as ht,P as dt,aP as ft,X as ue,aQ as he,aR as de,aS as fe,aT as mt,aU as pt,aV as Gt,aW as Be,r as D,aX as Et,a as le,u as Le,C as be,j as R,ab as Ft,c as Mt,B as It}from"./index-Cghja_vb.js";import{e as Dt,E as Rt}from"./easing-BzOxJDJb.js";const Tt=parseInt(Ue.replace(/\D+/g,""));function me(C,e){if(e===xe)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),C;if(e===re||e===Ie){let t=C.getIndex();if(t===null){const r=[],a=C.getAttribute("position");if(a!==void 0){for(let i=0;i=2.0 are supported."));return}const i=new is(n,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});i.fileLoader.setRequestHeader(this.requestHeader);for(let A=0;A=0&&a[B]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+B+'".')}}i.setExtensions(r),i.setPlugins(a),i.parse(o,s)}parseAsync(e,t){const o=this;return new Promise(function(s,n){o.parse(e,t,s,n)})}}function Ht(){let C={};return{get:function(e){return C[e]},add:function(e,t){C[e]=t},remove:function(e){delete C[e]},removeAll:function(){C={}}}}const E={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Jt{constructor(e){this.parser=e,this.name=E.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let o=0,s=t.length;o=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,n.source,r)}}class vt{constructor(e){this.parser=e,this.name=E.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,o=this.parser,s=o.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;const r=n.extensions[t],a=s.images[r.source];let i=o.textureLoader;if(a.uri){const A=o.options.manager.getHandler(a.uri);A!==null&&(i=A)}return this.detectSupport().then(function(A){if(A)return o.loadTextureImage(e,r.source,i);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return o.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class kt{constructor(e){this.parser=e,this.name=E.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,o=this.parser,s=o.json,n=s.textures[e];if(!n.extensions||!n.extensions[t])return null;const r=n.extensions[t],a=s.images[r.source];let i=o.textureLoader;if(a.uri){const A=o.options.manager.getHandler(a.uri);A!==null&&(i=A)}return this.detectSupport().then(function(A){if(A)return o.loadTextureImage(e,r.source,i);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return o.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class Xt{constructor(e){this.name=E.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,o=t.bufferViews[e];if(o.extensions&&o.extensions[this.name]){const s=o.extensions[this.name],n=this.parser.getDependency("buffer",s.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then(function(a){const i=s.byteOffset||0,A=s.byteLength||0,B=s.count,c=s.byteStride,l=new Uint8Array(a,i,A);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(B,c,l,s.mode,s.filter).then(function(u){return u.buffer}):r.ready.then(function(){const u=new ArrayBuffer(B*c);return r.decodeGltfBuffer(new Uint8Array(u),B,c,l,s.mode,s.filter),u})})}else return null}}class jt{constructor(e){this.name=E.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,o=t.nodes[e];if(!o.extensions||!o.extensions[this.name]||o.mesh===void 0)return null;const s=t.meshes[o.mesh];for(const A of s.primitives)if(A.mode!==g.TRIANGLES&&A.mode!==g.TRIANGLE_STRIP&&A.mode!==g.TRIANGLE_FAN&&A.mode!==void 0)return null;const r=o.extensions[this.name].attributes,a=[],i={};for(const A in r)a.push(this.parser.getDependency("accessor",r[A]).then(B=>(i[A]=B,i[A])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(A=>{const B=A.pop(),c=B.isGroup?B.children:[B],l=A[0].count,u=[];for(const h of c){const f=new v,d=new b,m=new ce,G=new b(1,1,1),F=new _e(h.geometry,h.material,l);for(let p=0;p=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},S={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},$t={CUBICSPLINE:void 0,LINEAR:Je,STEP:ht},ee={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function es(C){return C.DefaultMaterial===void 0&&(C.DefaultMaterial=new Ae({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:dt})),C.DefaultMaterial}function K(C,e,t){for(const o in t.extensions)C[o]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[o]=t.extensions[o])}function L(C,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(C.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function ts(C,e,t){let o=!1,s=!1,n=!1;for(let A=0,B=e.length;A0||C.search(/^data\:image\/jpeg/)===0?"image/jpeg":C.search(/\.webp($|\?)/i)>0||C.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const os=new v;class is{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Ht,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let o=!1,s=!1,n=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,n=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||o||s&&n<98?this.textureLoader=new ve(this.options.manager):this.textureLoader=new ke(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new j(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const o=this,s=this.json,n=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(r){return r._markDefs&&r._markDefs()}),Promise.all(this._invokeAll(function(r){return r.beforeRoot&&r.beforeRoot()})).then(function(){return Promise.all([o.getDependencies("scene"),o.getDependencies("animation"),o.getDependencies("camera")])}).then(function(r){const a={scene:r[0][s.scene||0],scenes:r[0],animations:r[1],cameras:r[2],asset:s.asset,parser:o,userData:{}};return K(n,a,s),L(a,s),Promise.all(o._invokeAll(function(i){return i.afterRoot&&i.afterRoot(a)})).then(function(){for(const i of a.scenes)i.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],o=this.json.meshes||[];for(let s=0,n=t.length;s{const i=this.associations.get(r);i!=null&&this.associations.set(a,i);for(const[A,B]of r.children.entries())n(B,a.children[A])};return n(o,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let o=0;o=2&&d.setY(H,I[T*i+1]),i>=3&&d.setZ(H,I[T*i+2]),i>=4&&d.setW(H,I[T*i+3]),i>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return d})}loadTexture(e){const t=this.json,o=this.options,n=t.textures[e].source,r=t.images[n];let a=this.textureLoader;if(r.uri){const i=o.manager.getHandler(r.uri);i!==null&&(a=i)}return this.loadTextureImage(e,n,a)}loadTextureImage(e,t,o){const s=this,n=this.json,r=n.textures[e],a=n.images[t],i=(a.uri||a.bufferView)+":"+r.sampler;if(this.textureCache[i])return this.textureCache[i];const A=this.loadImageSource(t,o).then(function(B){B.flipY=!1,B.name=r.name||a.name||"",B.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(B.name=a.uri);const l=(n.samplers||{})[r.sampler]||{};return B.magFilter=Ee[l.magFilter]||Te,B.minFilter=Ee[l.minFilter]||ge,B.wrapS=Fe[l.wrapS]||oe,B.wrapT=Fe[l.wrapT]||oe,s.associations.set(B,{textures:e}),B}).catch(function(){return null});return this.textureCache[i]=A,A}loadImageSource(e,t){const o=this,s=this.json,n=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(c=>c.clone());const r=s.images[e],a=self.URL||self.webkitURL;let i=r.uri||"",A=!1;if(r.bufferView!==void 0)i=o.getDependency("bufferView",r.bufferView).then(function(c){A=!0;const l=new Blob([c],{type:r.mimeType});return i=a.createObjectURL(l),i});else if(r.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const B=Promise.resolve(i).then(function(c){return new Promise(function(l,u){let h=l;t.isImageBitmapLoader===!0&&(h=function(f){const d=new ue(f);d.needsUpdate=!0,l(d)}),t.load(_.resolveURL(c,n.path),h,void 0,u)})}).then(function(c){return A===!0&&a.revokeObjectURL(i),L(c,r),c.userData.mimeType=r.mimeType||rs(r.uri),c}).catch(function(c){throw console.error("THREE.GLTFLoader: Couldn't load texture",i),c});return this.sourceCache[e]=B,B}assignTexture(e,t,o,s){const n=this;return this.getDependency("texture",o.index).then(function(r){if(!r)return null;if(o.texCoord!==void 0&&o.texCoord>0&&(r=r.clone(),r.channel=o.texCoord),n.extensions[E.KHR_TEXTURE_TRANSFORM]){const a=o.extensions!==void 0?o.extensions[E.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const i=n.associations.get(r);r=n.extensions[E.KHR_TEXTURE_TRANSFORM].extendTexture(r,a),n.associations.set(r,i)}}return s!==void 0&&(typeof s=="number"&&(s=s===pe?U:O),"colorSpace"in r?r.colorSpace=s:r.encoding=s===U?pe:gt),e[t]=r,r})}assignFinalMaterial(e){const t=e.geometry;let o=e.material;const s=t.attributes.tangent===void 0,n=t.attributes.color!==void 0,r=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+o.uuid;let i=this.cache.get(a);i||(i=new je,q.prototype.copy.call(i,o),i.color.copy(o.color),i.map=o.map,i.sizeAttenuation=!1,this.cache.add(a,i)),o=i}else if(e.isLine){const a="LineBasicMaterial:"+o.uuid;let i=this.cache.get(a);i||(i=new Ye,q.prototype.copy.call(i,o),i.color.copy(o.color),i.map=o.map,this.cache.add(a,i)),o=i}if(s||n||r){let a="ClonedMaterial:"+o.uuid+":";s&&(a+="derivative-tangents:"),n&&(a+="vertex-colors:"),r&&(a+="flat-shading:");let i=this.cache.get(a);i||(i=o.clone(),n&&(i.vertexColors=!0),r&&(i.flatShading=!0),s&&(i.normalScale&&(i.normalScale.y*=-1),i.clearcoatNormalScale&&(i.clearcoatNormalScale.y*=-1)),this.cache.add(a,i),this.associations.set(i,this.associations.get(o))),o=i}e.material=o}getMaterialType(){return Ae}loadMaterial(e){const t=this,o=this.json,s=this.extensions,n=o.materials[e];let r;const a={},i=n.extensions||{},A=[];if(i[E.KHR_MATERIALS_UNLIT]){const c=s[E.KHR_MATERIALS_UNLIT];r=c.getMaterialType(),A.push(c.extendParams(a,n,t))}else{const c=n.pbrMetallicRoughness||{};if(a.color=new x(1,1,1),a.opacity=1,Array.isArray(c.baseColorFactor)){const l=c.baseColorFactor;a.color.setRGB(l[0],l[1],l[2],O),a.opacity=l[3]}c.baseColorTexture!==void 0&&A.push(t.assignTexture(a,"map",c.baseColorTexture,U)),a.metalness=c.metallicFactor!==void 0?c.metallicFactor:1,a.roughness=c.roughnessFactor!==void 0?c.roughnessFactor:1,c.metallicRoughnessTexture!==void 0&&(A.push(t.assignTexture(a,"metalnessMap",c.metallicRoughnessTexture)),A.push(t.assignTexture(a,"roughnessMap",c.metallicRoughnessTexture))),r=this._invokeOne(function(l){return l.getMaterialType&&l.getMaterialType(e)}),A.push(Promise.all(this._invokeAll(function(l){return l.extendMaterialParams&&l.extendMaterialParams(e,a)})))}n.doubleSided===!0&&(a.side=Ze);const B=n.alphaMode||ee.OPAQUE;if(B===ee.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,B===ee.MASK&&(a.alphaTest=n.alphaCutoff!==void 0?n.alphaCutoff:.5)),n.normalTexture!==void 0&&r!==w&&(A.push(t.assignTexture(a,"normalMap",n.normalTexture)),a.normalScale=new Re(1,1),n.normalTexture.scale!==void 0)){const c=n.normalTexture.scale;a.normalScale.set(c,c)}if(n.occlusionTexture!==void 0&&r!==w&&(A.push(t.assignTexture(a,"aoMap",n.occlusionTexture)),n.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=n.occlusionTexture.strength)),n.emissiveFactor!==void 0&&r!==w){const c=n.emissiveFactor;a.emissive=new x().setRGB(c[0],c[1],c[2],O)}return n.emissiveTexture!==void 0&&r!==w&&A.push(t.assignTexture(a,"emissiveMap",n.emissiveTexture,U)),Promise.all(A).then(function(){const c=new r(a);return n.name&&(c.name=n.name),L(c,n),t.associations.set(c,{materials:e}),n.extensions&&K(s,c,n),c})}createUniqueName(e){const t=We.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,o=this.extensions,s=this.primitiveCache;function n(a){return o[E.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(i){return Me(i,a,t)})}const r=[];for(let a=0,i=e.length;a0&&ss(m,n),m.name=t.createUniqueName(n.name||"mesh_"+e),L(m,n),d.extensions&&K(s,m,d),t.assignFinalMaterial(m),c.push(m)}for(let u=0,h=c.length;u1?B=new z:A.length===1?B=A[0]:B=new Y,B!==A[0])for(let c=0,l=A.length;c{const c=new Map;for(const[l,u]of s.associations)(l instanceof q||l instanceof ue)&&c.set(l,u);return B.traverse(l=>{const u=s.associations.get(l);u!=null&&c.set(l,u)}),c};return s.associations=A(n),n})}_createAnimationTracks(e,t,o,s,n){const r=[],a=e.name?e.name:e.uuid,i=[];S[n.path]===S.weights?e.traverse(function(l){l.morphTargetInfluences&&i.push(l.name?l.name:l.uuid)}):i.push(a);let A;switch(S[n.path]){case S.weights:A=de;break;case S.rotation:A=fe;break;case S.position:case S.scale:A=he;break;default:switch(o.itemSize){case 1:A=de;break;case 2:case 3:default:A=he;break}break}const B=s.interpolation!==void 0?$t[s.interpolation]:Je,c=this._getArrayFromAccessor(o);for(let l=0,u=i.length;l{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(r,a).then(t).catch(s)},o,s)}decodeDracoFile(e,t,o,s){const n={attributeIDs:o||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!o};this.decodeGeometry(e,n).then(t)}decodeGeometry(e,t){for(const i in t.attributeTypes){const A=t.attributeTypes[i];A.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[i]=A.name)}const o=JSON.stringify(t);if(se.has(e)){const i=se.get(e);if(i.key===o)return i.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const n=this.workerNextTaskID++,r=e.byteLength,a=this._getWorker(n,r).then(i=>(s=i,new Promise((A,B)=>{s._callbacks[n]={resolve:A,reject:B},s.postMessage({type:"decode",id:n,taskConfig:t,buffer:e},[e])}))).then(i=>this._createGeometry(i.geometry));return a.catch(()=>!0).then(()=>{s&&n&&this._releaseTask(s,n)}),se.set(e,{key:o,promise:a}),a}_createGeometry(e){const t=new He;e.index&&t.setIndex(new Q(e.index.array,1));for(let o=0;o{o.load(e,s,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(o=>{const s=o[0];e||(this.decoderConfig.wasmBinary=o[1]);const n=cs.toString(),r=["/* draco decoder */",s,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join(` -`);this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengthn._taskLoad?-1:1});const o=this.workerPool[this.workerPool.length-1];return o._taskCosts[e]=t,o._taskLoad+=t,o})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const c=B.draco,l=new c.Decoder,u=new c.DecoderBuffer;u.Init(new Int8Array(i),i.byteLength);try{const h=t(c,l,u,A),f=h.attributes.map(d=>d.array.buffer);h.index&&f.push(h.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:h},f)}catch(h){console.error(h),self.postMessage({type:"error",id:a.id,error:h.message})}finally{c.destroy(u),c.destroy(l)}});break}};function t(r,a,i,A){const B=A.attributeIDs,c=A.attributeTypes;let l,u;const h=a.GetEncodedGeometryType(i);if(h===r.TRIANGULAR_MESH)l=new r.Mesh,u=a.DecodeBufferToMesh(i,l);else if(h===r.POINT_CLOUD)l=new r.PointCloud,u=a.DecodeBufferToPointCloud(i,l);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!u.ok()||l.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+u.error_msg());const f={index:null,attributes:[]};for(const d in B){const m=self[c[d]];let G,F;if(A.useUniqueIDs)F=B[d],G=a.GetAttributeByUniqueId(l,F);else{if(F=a.GetAttributeId(l,r[B[d]]),F===-1)continue;G=a.GetAttribute(l,F)}f.attributes.push(s(r,a,l,d,m,G))}return h===r.TRIANGULAR_MESH&&(f.index=o(r,a,l)),r.destroy(l),f}function o(r,a,i){const B=i.num_faces()*3,c=B*4,l=r._malloc(c);a.GetTrianglesUInt32Array(i,c,l);const u=new Uint32Array(r.HEAPF32.buffer,l,B).slice();return r._free(l),{array:u,itemSize:1}}function s(r,a,i,A,B,c){const l=c.num_components(),h=i.num_points()*l,f=h*B.BYTES_PER_ELEMENT,d=n(r,B),m=r._malloc(f);a.GetAttributeDataArrayForAllPoints(i,c,d,f,m);const G=new B(r.HEAPF32.buffer,m,h).slice();return r._free(m),{name:A,array:G,itemSize:l}}function n(r,a){switch(a){case Float32Array:return r.DT_FLOAT32;case Int8Array:return r.DT_INT8;case Int16Array:return r.DT_INT16;case Int32Array:return r.DT_INT32;case Uint8Array:return r.DT_UINT8;case Uint16Array:return r.DT_UINT16;case Uint32Array:return r.DT_UINT32}}}let k;const ne=()=>{if(k)return k;const C="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB",e="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB",t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),o=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let s=C;WebAssembly.validate(t)&&(s=e);let n;const r=WebAssembly.instantiate(a(s),{}).then(c=>{n=c.instance,n.exports.__wasm_call_ctors()});function a(c){const l=new Uint8Array(c.length);for(let h=0;h96?f-71:f>64?f-65:f>47?f+4:f>46?63:62}let u=0;for(let h=0;h{t&&t(o),C&&(X||(X=new As),X.setDecoderPath(typeof C=="string"?C:ye),o.setDRACOLoader(X)),e&&o.setMeshoptDecoder(typeof ne=="function"?ne():ne)}}function W(C,e=!0,t=!0,o){return Be(Ce,C,Ke(e,t,o))}W.preload=(C,e=!0,t=!0,o)=>Be.preload(Ce,C,Ke(e,t,o));W.clear=C=>Be.clear(Ce,C);W.setDecoderPath=C=>{ye=C};function Bs(C,e){const t=D.useRef(),[o]=D.useState(()=>e?e instanceof Y?{current:e}:e:t),[s]=D.useState(()=>new Et(void 0));D.useLayoutEffect(()=>{e&&(o.current=e instanceof Y?e:e.current),s._root=o.current});const n=D.useRef({}),r=D.useMemo(()=>{const a={};return C.forEach(i=>Object.defineProperty(a,i.name,{enumerable:!0,get(){if(o.current)return n.current[i.name]||(n.current[i.name]=s.clipAction(i,o.current))},configurable:!0})),{ref:o,clips:C,actions:a,names:C.map(i=>i.name),mixer:s}},[C]);return le((a,i)=>s.update(i)),D.useEffect(()=>{const a=o.current;return()=>{n.current={},s.stopAllAction(),Object.values(r.actions).forEach(i=>{a&&s.uncacheAction(i,a)})}},[C]),r}const ls="/r3f-audio-visualizer/assets/horse-DMamucGr.png",Cs=C=>{const e=D.useRef(null),{nodes:t,animations:o}=W(ls),s=Le(),n=be.getPalette(s).buildLut(),r=D.useMemo(()=>R.jsx("meshStandardMaterial",{color:n.getColor(.5),flatShading:!0}),[n]),{actions:a}=Bs(o,e);return D.useEffect(()=>{var i;(i=a==null?void 0:a.horse_A_)==null||i.play()}),le(({clock:i})=>{var l;const A=i.getElapsedTime(),c=(Math.sin(.5*A)+1)/2;(l=a==null?void 0:a.horse_A_)==null||l.setEffectiveTimeScale(c)}),R.jsx("group",{ref:e,scale:[.025,.025,.025],rotation:[Math.PI/2,Math.PI,0],dispose:null,children:R.jsxs("group",{name:"AuxScene",children:[R.jsx("pointLight",{position:[10,100,200],intensity:100}),R.jsx("mesh",{name:"mesh_0",castShadow:!0,receiveShadow:!0,geometry:t.mesh_0.geometry,morphTargetDictionary:t.mesh_0.morphTargetDictionary,morphTargetInfluences:t.mesh_0.morphTargetInfluences,children:r})]})})},us=[[-1,1],[-.75,-.1],[-.6,0],[0,0],[.6,0],[.75,-.1],[1,1]],hs=({nStones:C=30,stoneWidth:e=5,stoneHeight:t=.1,stoneLength:o=1,coordinateMapper:s})=>{const n=D.useRef(null),[r,a,i,A]=D.useMemo(()=>[new v,new b,new ce,new b],[]),B=D.useMemo(()=>new Ft(us.map(h=>new b(0,h[0],h[1]).multiplyScalar(10)),!1,"catmullrom",.1),[]),c=Le(),l=be.getPalette(c).buildLut();return D.useEffect(()=>{if(n.current){for(let u=0;u{if(!n.current)return;const h=u.getElapsedTime(),f=.025,d=.5,G=f*(h-Math.cos(d*h)/d)%1,F=1-Dt(G,Rt.LINEAR);for(let p=0;pR.jsxs(R.Fragment,{children:[R.jsx(hs,{...C}),R.jsx(Cs,{...C})]});export{ms as default}; diff --git a/assets/reactive-CmorMSwY.js b/assets/reactive-CmorMSwY.js deleted file mode 100644 index a028cc37..00000000 --- a/assets/reactive-CmorMSwY.js +++ /dev/null @@ -1 +0,0 @@ -var J=Object.defineProperty;var K=(s,e,o)=>e in s?J(s,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[e]=o;var V=(s,e,o)=>K(s,typeof e!="symbol"?e+"":e,o);import{r as t,V as R,j as i,u as $,C as X,b as O,B as ee,f as Q,M as te,Q as se,h as j,a as Y,c as ne,i as oe,T,E as re,k as ae}from"./index-Cghja_vb.js";import{a as ie,D as ce,M as le,w as ue,V as me,E as he,B as xe,N as pe}from"./Noise-eViT7niE.js";const fe=t.forwardRef(function({blendFunction:e,worldFocusDistance:o,worldFocusRange:c,focusDistance:r,focusRange:l,focalLength:n,bokehScale:x,resolutionScale:u,resolutionX:p,resolutionY:M,width:A,height:f,target:w,depthTexture:a,..._},L){const{camera:H}=t.useContext(ie),k=w!=null,b=t.useMemo(()=>{const B=new ce(H,{blendFunction:e,worldFocusDistance:o,worldFocusRange:c,focusDistance:r,focusRange:l,focalLength:n,bokehScale:x,resolutionScale:u,resolutionX:p,resolutionY:M,width:A,height:f});k&&(B.target=new R),a&&B.setDepthTexture(a.texture,a.packing);const N=B.maskPass;return N.maskFunction=le.MULTIPLY_RGB_SET_ALPHA,B},[H,e,o,c,r,l,n,x,u,p,M,A,f,k,a]);return t.useEffect(()=>()=>{b.dispose()},[b]),i.jsx("primitive",{..._,ref:L,object:b,target:w})}),ge=ue(me),de=s=>(s%T+T)%T;class Z extends oe{constructor(o,c,r,l=0){super();V(this,"helixLength");V(this,"helixRadius");V(this,"helixWindingSeparation");V(this,"helixStartingAngleRad");this.helixLength=o,this.helixRadius=c,this.helixWindingSeparation=r,this.helixStartingAngleRad=de(l)}getPoint(o,c=new R){o-=.5;const l=1/(this.helixLength/this.helixWindingSeparation),n=T*(o%l/l),x=this.helixRadius*Math.cos(n+this.helixStartingAngleRad),u=this.helixRadius*Math.sin(n+this.helixStartingAngleRad),p=this.helixLength*o;return c.set(x,u,p)}}const Me=(s,e)=>Math.hypot(s*Math.sin(e),s*Math.cos(e)-s),I=t.forwardRef(({coordinateMapper:s,helixLength:e=10,helixWindingSeparation:o=10,helixRadius:c=1,strandRadius:r=.1,baseSpacing:l=.35,strandOffsetRad:n=Math.PI/2,mirrorEffects:x=!0,fixedBaseGap:u=!0,...p},M)=>{const A=$(),f=X.getPalette(A).buildLut(),w=Math.floor(e/l),a=t.useRef(null),_=t.useMemo(()=>new O({color:"#606060"}),[]),L=t.useMemo(()=>{const m=.45*Me(c,n),d=new ee(r,r,m,1);for(let g=0;gnew O({color:f.getColor(.5)}),[f]),[B,N,U,q]=t.useMemo(()=>{const S=new Z(e,c,o,0),m=new Z(e,c,o,n);return[S,new Q(S,100,r,12,!1),m,new Q(m,100,r,12,!1)]},[e,c,o,r,n]),h=t.useMemo(()=>new te,[]),C=t.useMemo(()=>new R,[]),E=t.useMemo(()=>new R,[]),y=t.useMemo(()=>new R,[]),v=t.useMemo(()=>new se,[]),z=t.useMemo(()=>new R(0,0,1),[]);return t.useEffect(()=>{let S=0;for(let m=0;m{const m=S.getElapsedTime();let d=0,g=0,F=0,W=0;const D=.25,G=1;for(let P=0;P{const e=[t.useRef(null),t.useRef(null),t.useRef(null),t.useRef(null),t.useRef(null)],o=e.length,c=15,r=Array.from({length:o}).map((l,n)=>new R().fromArray(Array.from({length:3}).map((x,u)=>2*j.seededRandom(n+u)-1)).normalize().multiplyScalar(c));return Y(({clock:l})=>{const n=l.getElapsedTime(),x=5e-4,u=.05;let p,M=0;e.forEach((A,f)=>{A.current&&(p=r[f],M=Math.sin(u*(.5+.5*j.seededRandom(f))*n+j.seededRandom(f)/u),A.current.position.set(p.x*M,p.y*M,p.z*M),A.current.rotation.z+=x*Math.cos((.5+.5*j.seededRandom(f))*n),A.current.rotation.y+=x*Math.cos((.5+.5*j.seededRandom(f))*n))})}),i.jsx(i.Fragment,{children:e.map((l,n)=>i.jsx(I,{ref:l,position:r[n],rotation:new re(...Array.from({length:3}).map((x,u)=>Math.PI*(2*j.seededRandom(n+u)-1))),...s},n))})},we=({coordinateMapper:s})=>{const{multi:e,helixLength:o,helixRadius:c,helixWindingSeparation:r,strandRadius:l,baseSpacing:n,strandOffsetRad:x,mirrorEffects:u,fixedBaseGap:p}=ae();return e?i.jsx(Ae,{coordinateMapper:s,helixLength:o,helixRadius:c,helixWindingSeparation:r,strandRadius:l,baseSpacing:n,strandOffsetRad:x,mirrorEffects:u,fixedBaseGap:p}):i.jsx(I,{coordinateMapper:s,helixLength:o,helixRadius:c,helixWindingSeparation:r,strandRadius:l,baseSpacing:n,strandOffsetRad:x,mirrorEffects:u,fixedBaseGap:p})},Ee=({...s})=>i.jsxs(i.Fragment,{children:[i.jsx(we,{...s}),i.jsxs(he,{children:[i.jsx(fe,{focusDistance:0,focalLength:.02,bokehScale:3,height:480}),i.jsx(xe,{luminanceThreshold:0,luminanceSmoothing:.9,height:300}),i.jsx(pe,{opacity:.02}),i.jsx(ge,{eskil:!1,offset:.1,darkness:1.1})]})]});export{Ee as default}; diff --git a/assets/reactive-Csss5IX3.js b/assets/reactive-Csss5IX3.js new file mode 100644 index 00000000..55cac19e --- /dev/null +++ b/assets/reactive-Csss5IX3.js @@ -0,0 +1 @@ +import{r as m,V as h,b,j as o,k as w}from"./index-DwhXMaNP.js";import{G as y}from"./ground-DJZ6lP2l.js";const P=({motionMapper:l,maxPoints:n=1e3,pointSize:g=.2,maxDim:a=2,color:j="white"})=>{const s=Math.max(1,Math.floor(Math.cbrt(n))),x=Math.pow(s,3),d=m.useRef(null),i=m.useMemo(()=>new h,[]),c=m.useMemo(()=>new h,[]);return m.useEffect(()=>{const u=d.current.geometry.attributes.position,r=a/s;let f=0;for(let e=0;e{const f=u.getElapsedTime(),e=d.current.geometry.attributes.position;for(let t=0;t{const n=M();return o.jsxs(o.Fragment,{children:[o.jsx(P,{motionMapper:l,...n}),o.jsx(y,{position:new h(0,0,-1.5*n.maxDim)})]})};export{E as default,A as useActions,M as useParams,B as usePresets}; diff --git a/assets/reactive-D3UpTtXe.js b/assets/reactive-D3UpTtXe.js deleted file mode 100644 index b6b3b0f4..00000000 --- a/assets/reactive-D3UpTtXe.js +++ /dev/null @@ -1 +0,0 @@ -import{r as h,M as P,u as S,C as A,a as T,c as B,j as o,B as C,b as I,a8 as V,G as Y,V as z}from"./index-Cghja_vb.js";const O=({coordinateMapper:i,nGridRows:e=100,nGridCols:t=100,cubeSideLength:s=.025,cubeSpacingScalar:l=5})=>{const n=h.useRef(null),M=h.useMemo(()=>new P,[]),w=S(),g=A.getPalette(w).buildLut();return h.useEffect(()=>{if(!g)return;const f=Math.hypot(.5,.5);let u,m,x,c;for(let a=0;a{const u=f.getElapsedTime(),m=e*l*s,x=t*l*s;let c,a,r,j,y,E;for(let p=0;p{const{nRows:e,nCols:t,unitSideLength:s,unitSpacingScalar:l}=V();return o.jsxs(o.Fragment,{children:[o.jsx(O,{coordinateMapper:i,nGridRows:e,nGridCols:t,cubeSideLength:s,cubeSpacingScalar:l}),o.jsx(Y,{position:new z(0,0,-2.5*i.amplitude)})]})};export{X as default}; diff --git a/assets/reactive-DD7TKsGV.js b/assets/reactive-DD7TKsGV.js new file mode 100644 index 00000000..221ee305 --- /dev/null +++ b/assets/reactive-DD7TKsGV.js @@ -0,0 +1 @@ +var J=Object.defineProperty;var K=(s,e,n)=>e in s?J(s,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[e]=n;var v=(s,e,n)=>K(s,typeof e!="symbol"?e+"":e,n);import{r as t,V as R,j as a,c as $,d as X,h as O,g as ee,m as Q,M as te,Q as se,b as Y,n as ne,o as C,E as oe,T as _,i as re,k as ae}from"./index-DwhXMaNP.js";import{a as ie,D as ce,M as le,w as ue,V as me,E as he,B as xe,N as pe}from"./Noise-D5uvWl4i.js";const fe=t.forwardRef(function({blendFunction:e,worldFocusDistance:n,worldFocusRange:u,focusDistance:c,focusRange:m,focalLength:o,bokehScale:g,resolutionScale:h,resolutionX:d,resolutionY:M,width:A,height:x,target:w,depthTexture:r,...D},I){const{camera:H}=t.useContext(ie),V=w!=null,b=t.useMemo(()=>{const P=new ce(H,{blendFunction:e,worldFocusDistance:n,worldFocusRange:u,focusDistance:c,focusRange:m,focalLength:o,bokehScale:g,resolutionScale:h,resolutionX:d,resolutionY:M,width:A,height:x});V&&(P.target=new R),r&&P.setDepthTexture(r.texture,r.packing);const L=P.maskPass;return L.maskFunction=le.MULTIPLY_RGB_SET_ALPHA,P},[H,e,n,u,c,m,o,g,h,d,M,A,x,V,r]);return t.useEffect(()=>()=>{b.dispose()},[b]),a.jsx("primitive",{...D,ref:I,object:b,target:w})}),ge=ue(me),de=s=>(s%_+_)%_;class Z extends ne{constructor(n,u,c,m=0){super();v(this,"helixLength");v(this,"helixRadius");v(this,"helixWindingSeparation");v(this,"helixStartingAngleRad");this.helixLength=n,this.helixRadius=u,this.helixWindingSeparation=c,this.helixStartingAngleRad=de(m)}getPoint(n,u=new R){n-=.5;const m=1/(this.helixLength/this.helixWindingSeparation),o=_*(n%m/m),g=this.helixRadius*Math.cos(o+this.helixStartingAngleRad),h=this.helixRadius*Math.sin(o+this.helixStartingAngleRad),d=this.helixLength*n;return u.set(g,h,d)}}const Me=(s,e)=>Math.hypot(s*Math.sin(e),s*Math.cos(e)-s),N=t.forwardRef(({coordinateMapper:s,helixLength:e=10,helixWindingSeparation:n=10,helixRadius:u=1,strandRadius:c=.1,baseSpacing:m=.35,strandOffsetRad:o=Math.PI/2,mirrorEffects:g=!0,fixedBaseGap:h=!0,...d},M)=>{const A=$(),x=X.getPalette(A).buildLut(),w=Math.floor(e/m),r=t.useRef(null),D=t.useMemo(()=>new O({color:"#606060"}),[]),I=t.useMemo(()=>{const i=.45*Me(u,o),f=new ee(c,c,i,1);for(let p=0;pnew O({color:x.getColor(.5)}),[x]),[P,L,U,q]=t.useMemo(()=>{const S=new Z(e,u,n,0),i=new Z(e,u,n,o);return[S,new Q(S,100,c,12,!1),i,new Q(i,100,c,12,!1)]},[e,u,n,c,o]),l=t.useMemo(()=>new te,[]),B=t.useMemo(()=>new R,[]),E=t.useMemo(()=>new R,[]),y=t.useMemo(()=>new R,[]),k=t.useMemo(()=>new se,[]),z=t.useMemo(()=>new R(0,0,1),[]);return t.useEffect(()=>{let S=0;for(let i=0;i{const i=S.getElapsedTime();let f=0,p=0,F=0,W=0;const T=.25,G=1;for(let j=0;j{const e=[t.useRef(null),t.useRef(null),t.useRef(null),t.useRef(null),t.useRef(null)],n=e.length,u=15,c=Array.from({length:n}).map((m,o)=>new R().fromArray(Array.from({length:3}).map((g,h)=>2*C.seededRandom(o+h)-1)).normalize().multiplyScalar(u));return Y(({clock:m})=>{const o=m.getElapsedTime(),g=5e-4,h=.05;let d,M=0;e.forEach((A,x)=>{A.current&&(d=c[x],M=Math.sin(h*(.5+.5*C.seededRandom(x))*o+C.seededRandom(x)/h),A.current.position.set(d.x*M,d.y*M,d.z*M),A.current.rotation.z+=g*Math.cos((.5+.5*C.seededRandom(x))*o),A.current.rotation.y+=g*Math.cos((.5+.5*C.seededRandom(x))*o))})}),a.jsx(a.Fragment,{children:e.map((m,o)=>a.jsx(N,{ref:m,position:c[o],rotation:new oe(...Array.from({length:3}).map((g,h)=>Math.PI*(2*C.seededRandom(o+h)-1))),...s},o))})},{useParams:we,useActions:je}=ae({default:{multi:!0,helixLength:50,helixRadius:1,helixWindingSeparation:10,strandRadius:.1,baseSpacing:.35,strandOffsetRad:Math.PI/2,mirrorEffects:!0,fixedBaseGap:!1}}),Se=({coordinateMapper:s})=>{const{multi:e,...n}=we();return e?a.jsx(Ae,{coordinateMapper:s,...n}):a.jsx(N,{coordinateMapper:s,...n})},Ce=s=>a.jsxs(a.Fragment,{children:[a.jsx(Se,{...s}),a.jsxs(he,{children:[a.jsx(fe,{focusDistance:0,focalLength:.02,bokehScale:3,height:480}),a.jsx(xe,{luminanceThreshold:0,luminanceSmoothing:.9,height:300}),a.jsx(pe,{opacity:.02}),a.jsx(ge,{eskil:!1,offset:.1,darkness:1.1})]})]});export{Ce as default,je as useActions,we as useParams}; diff --git a/assets/reactive-DShZioEa.js b/assets/reactive-DShZioEa.js deleted file mode 100644 index b0e596fc..00000000 --- a/assets/reactive-DShZioEa.js +++ /dev/null @@ -1 +0,0 @@ -import{g as x,r as h,a as g,c as j,j as e,T as R,e as E,G as T,V as b}from"./index-Cghja_vb.js";import{E as y,B as A,N as C}from"./Noise-eViT7niE.js";const D=({coordinateMapper:t,radius:i=2,pointSize:o=.2,nPoints:s=1e3,mirrorEffects:m=!1})=>{const l=Array.from({length:s}).map(x),f=h.useRef(null);return g(({clock:d})=>{const p=d.getElapsedTime();let n,r,u;const c=f.current.geometry.attributes.position;for(let a=0;a{const{radius:i,pointSize:o,mirrorEffects:s}=E();return e.jsxs(e.Fragment,{children:[e.jsx(D,{coordinateMapper:t,radius:i,pointSize:o,mirrorEffects:s}),e.jsx(T,{position:new b(0,0,-1.5*t.amplitude)})]})},F=({...t})=>e.jsxs(e.Fragment,{children:[e.jsx(S,{...t}),e.jsxs(y,{children:[e.jsx(A,{luminanceThreshold:.5,luminanceSmoothing:1,height:300}),e.jsx(C,{opacity:.05})]})]});export{F as default}; diff --git a/assets/reactive-SpGdnhOu.js b/assets/reactive-SpGdnhOu.js new file mode 100644 index 00000000..5cc4dfcd --- /dev/null +++ b/assets/reactive-SpGdnhOu.js @@ -0,0 +1 @@ +import{l as x,r as h,b as j,j as e,i as g,T as E,k as R,V as T}from"./index-DwhXMaNP.js";import{G as b}from"./ground-DJZ6lP2l.js";import{E as A,B as y,N as S}from"./Noise-D5uvWl4i.js";const B=({coordinateMapper:s,radius:i=2,pointSize:m=.2,nPoints:t=1e3,mirrorEffects:f=!1})=>{const l=Array.from({length:t}).map(x),u=h.useRef(null);return j(({clock:d})=>{const p=d.getElapsedTime();let o,r,n;const c=u.current.geometry.attributes.position;for(let a=0;a{const i=C();return e.jsxs(e.Fragment,{children:[e.jsx(B,{coordinateMapper:s,...i}),e.jsx(b,{position:new T(0,0,-1.5*s.amplitude)})]})},M=s=>e.jsxs(e.Fragment,{children:[e.jsx(D,{...s}),e.jsxs(A,{children:[e.jsx(y,{luminanceThreshold:.5,luminanceSmoothing:1,height:300}),e.jsx(S,{opacity:.05})]})]});export{M as default,z as useActions,C as useParams,G as usePresets}; diff --git a/assets/reactive-UZqlxOwl.js b/assets/reactive-UZqlxOwl.js deleted file mode 100644 index 099e65d1..00000000 --- a/assets/reactive-UZqlxOwl.js +++ /dev/null @@ -1 +0,0 @@ -import{r as u,S as G,M as B,u as U,C as q,a as F,j as n,B as J,b as L,G as N,V as S}from"./index-Cghja_vb.js";import{e as X,c as Y,l as O}from"./easing-BzOxJDJb.js";const _=({scalarTracker:i,nBoxes:e=5,gridSize:x=10,cellSize:o=.25})=>{const M=x,m=x,g=u.useMemo(()=>new G(.65,150,2*250),[250]),c=u.useRef(null),h=u.useMemo(()=>new B,[]),E=U(),C=q.getPalette(E).buildLut(),a=u.useMemo(()=>Array.from({length:e},s=>{const r=Math.floor(M*Math.random()),l=Math.floor(m*Math.random());return{fromRow:r,fromCol:l,toRow:r,toCol:l}}),[e,M,m]);return u.useEffect(()=>{for(let s=0;s{if(g.step((i==null?void 0:i.getNormalizedValue())??0)){const[w,p]=Math.random()>.5?[!0,!1]:[!1,!0];for(let t=0;t.5?1:-1),p&&(a[t].toCol+=Math.random()>.5?1:-1)}const s=X(Y(g.timeSinceLastEventMs/250)),r=O(Math.PI/4,3*Math.PI/4,s),l=-.5*o*Math.cos(r)/Math.sqrt(2),I=.5*o*Math.sin(r)/Math.sqrt(2);let R,j,P,b,D,d,f;a.forEach(({fromRow:w,fromCol:p,toRow:t,toCol:V},v)=>{d=t-w,f=V-p;const y=w+d*(l+.5),A=p+f*(l+.5);d!==0&&h.makeRotationY((r-Math.PI/4)*d),f!==0&&h.makeRotationX(-(r-Math.PI/4)*f),R=y/(M-1),j=A/(m-1),P=M*o*(R-.5),b=m*o*(j-.5),D=I-o/4,h.setPosition(P,b,D),c.current.setMatrixAt(v,h)}),c.current.instanceMatrix.needsUpdate=!0}),n.jsxs("instancedMesh",{ref:c,castShadow:!0,receiveShadow:!0,args:[new J,new L,e],children:[n.jsx("boxGeometry",{attach:"geometry",args:[o,o,o,1]}),n.jsx("meshBasicMaterial",{attach:"material",color:"white",toneMapped:!1})]})},Q=({scalarTracker:i})=>n.jsxs(n.Fragment,{children:[n.jsx(_,{scalarTracker:i??{getNormalizedValue:()=>Math.sin(.0025*Date.now())+1},nBoxes:200,gridSize:100,cellSize:1}),n.jsx(N,{position:new S(0,0,-1/2)})]});export{Q as default}; diff --git a/assets/reactive-W3VVQsKw.js b/assets/reactive-W3VVQsKw.js new file mode 100644 index 00000000..dc6645f3 --- /dev/null +++ b/assets/reactive-W3VVQsKw.js @@ -0,0 +1,110 @@ +import{r as a,u as b,V as h,a as m,b as g,j as s,C as w,c as y,d as z}from"./index-DwhXMaNP.js";const j=` +precision mediump float; +uniform vec3 color; + +void main() { + gl_FragColor = vec4(color, 1.0); +} +`,D=` +precision mediump float; + +uniform float max_amplitude; +uniform vec2 resolution; +uniform sampler2D samples; +uniform vec2 sample_scale; +uniform bool b_should_interpolate; + +attribute float index; + +float decode(vec2 c) { + float unscaled = (c.x * 255.0 * 256.0 + c.y * 255.0) / (256.0 * 256.0 - 1.0); + return (unscaled * 2.0 - 1.0) * max_amplitude; +} + +vec2 interpolate_sample(int i) { + // calculate the size of single pixel in normalized coords + float texture_size_x = float(textureSize(samples, 0).x); + float texel_size_x = 1.0 / texture_size_x; + + // normalize the input coordinate (range 0-1) + float norm_x = float(i) / sample_scale.x; + + float nearest_tex_x_below = 1.0 * floor(norm_x * texture_size_x); + vec2 tex_coord_below_norm = vec2(nearest_tex_x_below / texture_size_x, 0.0); + vec2 tex_coord_above_norm = tex_coord_below_norm + vec2(texel_size_x, 0.0); + + // Sample the 1D texture above and below + vec4 sample_below = texture2D(samples, tex_coord_below_norm); + vec4 sample_above = texture2D(samples, tex_coord_above_norm); + + // decode the byte structures into a 2D xy coordinate + vec2 nearest_below = vec2(decode(sample_below.rg), decode(sample_below.ba)); + vec2 nearest_above = vec2(decode(sample_above.rg), decode(sample_above.ba)); + + // Interpolate between the coords + float a = fract((norm_x - tex_coord_below_norm.x) / texel_size_x ); + return mix(nearest_below, nearest_above, a); +} + +vec2 get_sample(int i, bool interp) { + if (interp){ + return interpolate_sample(i); + } + // normalize the coordinate (range 0-1) and then sample the 1D texture + vec4 my_sample = texture2D(samples, vec2(i, 0.0) / sample_scale); + + // decode the byte structure into a 2D xy coordinate + return vec2(decode(my_sample.rg), decode(my_sample.ba)); +} + +const float t_max = 5.0; +const float t_min = 1.0; +const float t_flat = 0.005; + +void main() { + // Read off the row/col texture coordinates + int i = int(index); + int j = 0; + + // translate to screen x/y + vec2 pos = get_sample(i, b_should_interpolate); + + vec2 prev_pos = get_sample(i - 1, b_should_interpolate); + vec2 next_pos = get_sample(i + 1, b_should_interpolate); + + float prev_len = distance(pos, prev_pos); + float next_len = distance(pos, next_pos); + float avg_len = mix(prev_len, next_len, 0.5); + + float thickness = (t_max - t_min) * t_flat / (t_flat + avg_len) + t_min; + + vec2 delta = vec2(0.0, 0.0); + if (j == 0) { + delta = pos - prev_pos; + } else if (j == 1) { + delta = prev_pos - pos; + } else if (j == 2) { + delta = next_pos - pos; + } else if (j == 3) { + delta = pos - next_pos; + } + + float side = min(resolution.x, resolution.y); + + // pos = pos + thickness / side * normalize(vec2(-delta.y, delta.x)); + + gl_PointSize = 3.0 + 5.0 * thickness / side; + + if (resolution.x < resolution.y) { + pos = pos.yx; + } + gl_Position = vec4(pos / resolution * side, 0.0, 1.0); + + + // // Pass info to fragment shader + // relative_length = avg_len; + // norm_index = float(i) / sample_scale.x; + // vec2 diff = next_pos - prev_pos; + // // angle = ... +} +`,S=({textureMapper:r,nParticles:t=512,usePoints:c=!0,interpolate:i=!1,color:u=new w("green")})=>{const{tex:n,textureData:p}=r.generateSupportedTextureAndData();n.needsUpdate=!0;const e=a.useRef(null),l=b(o=>o.size),d=a.useMemo(()=>new Float32Array(t).fill(0).map((o,v)=>v),[t]),f=a.useMemo(()=>new Float32Array(t*3).fill(0),[t]),x=a.useMemo(()=>({color:{value:new h},max_amplitude:{value:r.maxAmplitude},sample_scale:{value:new m(t,1)},samples:{type:"t",value:n},resolution:{value:new m(l.width,l.height)},b_should_interpolate:{value:i}}),[t,r,i,l,n]);g(()=>{r.updateTextureData(p),n.needsUpdate=!0,e.current.uniforms.max_amplitude.value=r.maxAmplitude,e.current.uniforms.samples.value=n}),a.useEffect(()=>{var o;(o=e.current)!=null&&o.uniforms&&(e.current.uniforms.resolution.value.x=l.width,e.current.uniforms.resolution.value.y=l.height)},[l]),a.useEffect(()=>{var o;(o=e.current)!=null&&o.uniforms&&(e.current.uniforms.b_should_interpolate.value=i,e.current.uniforms.color.value.x=u.r,e.current.uniforms.color.value.y=u.g,e.current.uniforms.color.value.z=u.b)},[i,u]),a.useEffect(()=>{var o;(o=e.current)!=null&&o.uniforms&&(e.current.uniforms.sample_scale.value.x=t,e.current.uniforms.sample_scale.value.y=1)},[t]);const _=s.jsxs(a.Fragment,{children:[s.jsxs("bufferGeometry",{children:[s.jsx("bufferAttribute",{attach:"attributes-position",count:t,array:f,itemSize:3}),s.jsx("bufferAttribute",{attach:"attributes-index",count:t,array:d,itemSize:1})]}),s.jsx("shaderMaterial",{ref:e,depthWrite:!1,fragmentShader:j,vertexShader:D,uniforms:x})]});return c?s.jsx("points",{children:_}):s.jsx("line",{children:_})},C=({textureMapper:r})=>{const t=y(),c=z.getPalette(t).lerpColor(.5);return s.jsx(S,{textureMapper:r,usePoints:!0,interpolate:!1,color:c})};export{C as default}; diff --git a/index.html b/index.html index f9465fdd..b80d593a 100644 --- a/index.html +++ b/index.html @@ -9,8 +9,8 @@ Interactive Audio Visualizer - - + +