diff --git a/frontend/dist/assets/GraphView-DvI7ySJd.js b/frontend/dist/assets/GraphView-DvI7ySJd.js deleted file mode 100644 index 00187dd..0000000 --- a/frontend/dist/assets/GraphView-DvI7ySJd.js +++ /dev/null @@ -1,3956 +0,0 @@ -import{r as K,a as Hv,g as Hr,R as Um,c as q2,j as Ne,l as Z2,S as K2,b as Vx,T as $2}from"./index-BNlNRfcu.js";/** - * @license - * Copyright 2010-2023 Three.js Authors - * SPDX-License-Identifier: MIT - */const Yd="154",ab={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},J2={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},lb=0,L0=1,cb=2,Q2=3,ub=0,qd=1,gu=2,Or=3,ls=0,yi=1,vn=2,eC=2,Fs=0,pa=1,I0=2,D0=3,U0=4,hb=5,aa=100,fb=101,db=102,O0=103,N0=104,pb=200,mb=201,gb=202,vb=203,Vv=204,Wv=205,yb=206,_b=207,xb=208,wb=209,Sb=210,Eb=0,bb=1,Mb=2,Ld=3,Tb=4,Ab=5,Cb=6,Rb=7,ih=0,Pb=1,Lb=2,zr=0,Ib=1,Db=2,Ub=3,Xv=4,Ob=5,Zd=300,xo=301,wo=302,Cu=303,Ru=304,Jl=306,Pu=1e3,vi=1001,Lu=1002,Dn=1003,Id=1004,tC=1004,vu=1005,nC=1005,fn=1006,jv=1007,iC=1007,So=1008,rC=1008,os=1009,Nb=1010,Fb=1011,Kd=1012,Yv=1013,Ns=1014,rs=1015,Vl=1016,qv=1017,Zv=1018,mo=1020,kb=1021,Bi=1023,zb=1024,Bb=1025,go=1026,xa=1027,Gb=1028,Kv=1029,Hb=1030,$v=1031,Jv=1033,vd=33776,yd=33777,_d=33778,xd=33779,F0=35840,k0=35841,z0=35842,B0=35843,Vb=36196,G0=37492,H0=37496,V0=37808,W0=37809,X0=37810,j0=37811,Y0=37812,q0=37813,Z0=37814,K0=37815,$0=37816,J0=37817,Q0=37818,ev=37819,tv=37820,nv=37821,wd=36492,Wb=36283,iv=36284,rv=36285,sv=36286,Xb=2200,jb=2201,Yb=2202,Iu=2300,Du=2301,Sd=2302,ua=2400,ha=2401,Uu=2402,$d=2500,Qv=2501,sC=0,oC=1,aC=2,ey=3e3,vo=3001,qb=3200,ty=3201,Mo=0,Zb=1,yo="",Mt="srgb",Br="srgb-linear",ny="display-p3",lC=0,Ed=7680,cC=7681,uC=7682,hC=7683,fC=34055,dC=34056,pC=5386,mC=512,gC=513,vC=514,yC=515,_C=516,xC=517,wC=518,Kb=519,$b=512,Jb=513,Qb=514,eM=515,tM=516,nM=517,iM=518,rM=519,Ou=35044,SC=35048,EC=35040,bC=35045,MC=35049,TC=35041,AC=35046,CC=35050,RC=35042,PC="100",ov="300 es",Dd=1035,ss=2e3,Nu=2001;let Hs=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[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 n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s>8&255]+mi[r>>16&255]+mi[r>>24&255]+"-"+mi[e&255]+mi[e>>8&255]+"-"+mi[e>>16&15|64]+mi[e>>24&255]+"-"+mi[t&63|128]+mi[t>>8&255]+"-"+mi[t>>16&255]+mi[t>>24&255]+mi[n&255]+mi[n>>8&255]+mi[n>>16&255]+mi[n>>24&255]).toLowerCase()}function Tn(r,e,t){return Math.max(e,Math.min(t,r))}function iy(r,e){return(r%e+e)%e}function LC(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function IC(r,e,t){return r!==e?(t-r)/(e-r):0}function yu(r,e,t){return(1-t)*r+t*e}function DC(r,e,t,n){return yu(r,e,1-Math.exp(-t*n))}function UC(r,e=1){return e-Math.abs(iy(r,e*2)-e)}function OC(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function NC(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function FC(r,e){return r+Math.floor(Math.random()*(e-r+1))}function kC(r,e){return r+Math.random()*(e-r)}function zC(r){return r*(.5-Math.random())}function BC(r){r!==void 0&&(Wx=r);let e=Wx+=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 GC(r){return r*ma}function HC(r){return r*Wl}function av(r){return(r&r-1)===0&&r!==0}function sM(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Ud(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function VC(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),p=o((e-n)/2),m=s((n-e)/2),v=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*h,l*p,a*c);break;case"YZY":r.set(l*p,a*u,l*h,a*c);break;case"ZXZ":r.set(l*h,l*p,a*u,a*c);break;case"XZX":r.set(a*u,l*v,l*m,a*c);break;case"YXY":r.set(l*m,a*u,l*v,a*c);break;case"ZYZ":r.set(l*v,l*m,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Qi(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function Lt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Od={DEG2RAD:ma,RAD2DEG:Wl,generateUUID:er,clamp:Tn,euclideanModulo:iy,mapLinear:LC,inverseLerp:IC,lerp:yu,damp:DC,pingpong:UC,smoothstep:OC,smootherstep:NC,randInt:FC,randFloat:kC,randFloatSpread:zC,seededRandom:BC,degToRad:GC,radToDeg:HC,isPowerOfTwo:av,ceilPowerOfTwo:sM,floorPowerOfTwo:Ud,setQuaternionFromProperEuler:VC,normalize:Lt,denormalize:Qi};class De{constructor(e=0,t=0){De.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,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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 n=this.dot(e)/t;return Math.acos(Tn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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 n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ct{constructor(e,t,n,i,s,o,a,l,c){Ct.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,l,c)}set(e,t,n,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.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 n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],h=n[7],p=n[2],m=n[5],v=n[8],_=i[0],y=i[3],g=i[6],x=i[1],w=i[4],E=i[7],b=i[2],M=i[5],A=i[8];return s[0]=o*_+a*x+l*b,s[3]=o*y+a*w+l*M,s[6]=o*g+a*E+l*A,s[1]=c*_+u*x+h*b,s[4]=c*y+u*w+h*M,s[7]=c*g+u*E+h*A,s[2]=p*_+m*x+v*b,s[5]=p*y+m*w+v*M,s[8]=p*g+m*E+v*A,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],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,p=a*l-u*s,m=c*s-o*l,v=t*h+n*p+i*m;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*c-u*n)*_,e[2]=(a*n-i*o)*_,e[3]=p*_,e[4]=(u*t-i*l)*_,e[5]=(i*s-a*t)*_,e[6]=m*_,e[7]=(n*l-c*t)*_,e[8]=(o*t-n*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,n,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Om.makeScale(e,t)),this}rotate(e){return this.premultiply(Om.makeRotation(-e)),this}translate(e,t){return this.premultiply(Om.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),n=Math.sin(e);return this.set(t,-n,0,n,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,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Om=new Ct;function oM(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const WC={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Dl(r,e){return new WC[r](e)}function Fu(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}const Xx={};function _u(r){r in Xx||(Xx[r]=!0,console.warn(r))}function zl(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Nm(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}const XC=new Ct().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),jC=new Ct().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function YC(r){return r.convertSRGBToLinear().applyMatrix3(jC)}function qC(r){return r.applyMatrix3(XC).convertLinearToSRGB()}const ZC={[Br]:r=>r,[Mt]:r=>r.convertSRGBToLinear(),[ny]:YC},KC={[Br]:r=>r,[Mt]:r=>r.convertLinearToSRGB(),[ny]:qC},vr={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return Br},set workingColorSpace(r){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=ZC[e],i=KC[t];if(n===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)}};let Ka;class ry{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ka===void 0&&(Ka=Fu("canvas")),Ka.width=e.width,Ka.height=e.height;const n=Ka.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ka}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=Fu("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Zd)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pu:e.x=e.x-Math.floor(e.x);break;case vi:e.x=e.x<0?0:1;break;case Lu: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 Pu:e.y=e.y-Math.floor(e.y);break;case vi:e.y=e.y<0?0:1;break;case Lu: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 _u("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Mt?vo:ey}set encoding(e){_u("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===vo?Mt:yo}}Sn.DEFAULT_IMAGE=null;Sn.DEFAULT_MAPPING=Zd;Sn.DEFAULT_ANISOTROPY=1;class Xt{constructor(e=0,t=0,n=0,i=1){Xt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,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,n,i){return this.x=e,this.y=t,this.z=n,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,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+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,n,i,s;const l=e.elements,c=l[0],u=l[4],h=l[8],p=l[1],m=l[5],v=l[9],_=l[2],y=l[6],g=l[10];if(Math.abs(u-p)<.01&&Math.abs(h-_)<.01&&Math.abs(v-y)<.01){if(Math.abs(u+p)<.1&&Math.abs(h+_)<.1&&Math.abs(v+y)<.1&&Math.abs(c+m+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,E=(m+1)/2,b=(g+1)/2,M=(u+p)/4,A=(h+_)/4,P=(v+y)/4;return w>E&&w>b?w<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(w),i=M/n,s=A/n):E>b?E<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(E),n=M/i,s=P/i):b<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(b),n=A/s,i=P/s),this.set(n,i,s,t),this}let x=Math.sqrt((y-v)*(y-v)+(h-_)*(h-_)+(p-u)*(p-u));return Math.abs(x)<.001&&(x=1),this.x=(y-v)/x,this.y=(h-_)/x,this.z=(p-u)/x,this.w=Math.acos((c+m+g-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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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 Gr extends Hs{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Xt(0,0,e,t),this.scissorTest=!1,this.viewport=new Xt(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(_u("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===vo?Mt:yo),this.texture=new Sn(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:fn,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,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 fa(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 Jd extends Sn{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Dn,this.minFilter=Dn,this.wrapR=vi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class QC extends Gr{constructor(e=1,t=1,n=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new Jd(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class sy extends Sn{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Dn,this.minFilter=Dn,this.wrapR=vi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class eR extends Gr{constructor(e=1,t=1,n=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new sy(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class tR extends Gr{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,w=1-g*g;if(w>Number.EPSILON){const b=Math.sqrt(w),M=Math.atan2(b,g*x);y=Math.sin(y*M)/b,a=Math.sin(a*M)/b}const E=a*x;if(l=l*y+p*E,c=c*y+m*E,u=u*y+v*E,h=h*y+_*E,y===1-a){const b=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=b,c*=b,u*=b,h*=b}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],h=s[o],p=s[o+1],m=s[o+2],v=s[o+3];return e[t]=a*v+u*h+l*m-c*p,e[t+1]=l*v+u*p+c*h-a*m,e[t+2]=c*v+u*m+a*p-l*h,e[t+3]=u*v-a*h-l*p-c*m,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,n,i){return this._x=e,this._y=t,this._z=n,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){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),h=a(s/2),p=l(n/2),m=l(i/2),v=l(s/2);switch(o){case"XYZ":this._x=p*u*h+c*m*v,this._y=c*m*h-p*u*v,this._z=c*u*v+p*m*h,this._w=c*u*h-p*m*v;break;case"YXZ":this._x=p*u*h+c*m*v,this._y=c*m*h-p*u*v,this._z=c*u*v-p*m*h,this._w=c*u*h+p*m*v;break;case"ZXY":this._x=p*u*h-c*m*v,this._y=c*m*h+p*u*v,this._z=c*u*v+p*m*h,this._w=c*u*h-p*m*v;break;case"ZYX":this._x=p*u*h-c*m*v,this._y=c*m*h+p*u*v,this._z=c*u*v-p*m*h,this._w=c*u*h+p*m*v;break;case"YZX":this._x=p*u*h+c*m*v,this._y=c*m*h+p*u*v,this._z=c*u*v-p*m*h,this._w=c*u*h-p*m*v;break;case"XZY":this._x=p*u*h-c*m*v,this._y=c*m*h-p*u*v,this._z=c*u*v+p*m*h,this._w=c*u*h+p*m*v;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],p=n+a+h;if(p>0){const m=.5/Math.sqrt(p+1);this._w=.25/m,this._x=(u-l)*m,this._y=(s-c)*m,this._z=(o-i)*m}else if(n>a&&n>h){const m=2*Math.sqrt(1+n-a-h);this._w=(u-l)/m,this._x=.25*m,this._y=(i+o)/m,this._z=(s+c)/m}else if(a>h){const m=2*Math.sqrt(1+a-n-h);this._w=(s-c)/m,this._x=(i+o)/m,this._y=.25*m,this._z=(l+u)/m}else{const m=2*Math.sqrt(1+h-n-a);this._w=(o-i)/m,this._x=(s+c)/m,this._y=(l+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Tn(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);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 n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+n*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=n,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const m=1-t;return this._w=m*o+t*this._w,this._x=m*n+t*this._x,this._y=m*i+t*this._y,this._z=m*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,p=Math.sin(t*u)/c;return this._w=o*h+this._w*p,this._x=n*h+this._x*p,this._y=i*h+this._y*p,this._z=s*h+this._z*p,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*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}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 Y{constructor(e=0,t=0,n=0){Y.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,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(jx.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(jx.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*n,u=l*n+a*t-s*i,h=l*i+s*n-o*t,p=-s*t-o*n-a*i;return this.x=c*l+p*-s+u*-a-h*-o,this.y=u*l+p*-o+h*-s-c*-a,this.z=h*l+p*-a+c*-o-u*-s,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,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=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-n*l,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return km.copy(this).projectOnVector(e),this.sub(km)}reflect(e){return this.sub(km.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 n=this.dot(e)/t;return Math.acos(Tn(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+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,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,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(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,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,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const km=new Y,jx=new si;class ir{constructor(e=new Y(1/0,1/0,1/0),t=new Y(-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,n=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,Es),Es.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Rc),hf.subVectors(this.max,Rc),Ja.subVectors(e.a,Rc),Qa.subVectors(e.b,Rc),el.subVectors(e.c,Rc),io.subVectors(Qa,Ja),ro.subVectors(el,Qa),Xo.subVectors(Ja,el);let t=[0,-io.z,io.y,0,-ro.z,ro.y,0,-Xo.z,Xo.y,io.z,0,-io.x,ro.z,0,-ro.x,Xo.z,0,-Xo.x,-io.y,io.x,0,-ro.y,ro.x,0,-Xo.y,Xo.x,0];return!zm(t,Ja,Qa,el,hf)||(t=[1,0,0,0,1,0,0,0,1],!zm(t,Ja,Qa,el,hf))?!1:(ff.crossVectors(io,ro),t=[ff.x,ff.y,ff.z],zm(t,Ja,Qa,el,hf))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Es).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Es).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:(Ss[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ss[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ss[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ss[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ss[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ss[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ss[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ss[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ss),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 Ss=[new Y,new Y,new Y,new Y,new Y,new Y,new Y,new Y],Es=new Y,$a=new ir,Ja=new Y,Qa=new Y,el=new Y,io=new Y,ro=new Y,Xo=new Y,Rc=new Y,hf=new Y,ff=new Y,jo=new Y;function zm(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){jo.fromArray(r,s);const a=i.x*Math.abs(jo.x)+i.y*Math.abs(jo.y)+i.z*Math.abs(jo.z),l=e.dot(jo),c=t.dot(jo),u=n.dot(jo);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const nR=new ir,Pc=new Y,Bm=new Y;let rr=class{constructor(e=new Y,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):nR.setFromPoints(e).getCenter(n);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;Pc.subVectors(e,this.center);const t=Pc.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Pc,i/n),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):(Bm.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Pc.copy(e.center).add(Bm)),this.expandByPoint(Pc.copy(e.center).sub(Bm))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const bs=new Y,Gm=new Y,df=new Y,so=new Y,Hm=new Y,pf=new Y,Vm=new Y;class Ql{constructor(e=new Y,t=new Y(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,bs)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=bs.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(bs.copy(this.origin).addScaledVector(this.direction,t),bs.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Gm.copy(e).add(t).multiplyScalar(.5),df.copy(t).sub(e).normalize(),so.copy(this.origin).sub(Gm);const s=e.distanceTo(t)*.5,o=-this.direction.dot(df),a=so.dot(this.direction),l=-so.dot(df),c=so.lengthSq(),u=Math.abs(1-o*o);let h,p,m,v;if(u>0)if(h=o*l-a,p=o*a-l,v=s*u,h>=0)if(p>=-v)if(p<=v){const _=1/u;h*=_,p*=_,m=h*(h+o*p+2*a)+p*(o*h+p+2*l)+c}else p=s,h=Math.max(0,-(o*p+a)),m=-h*h+p*(p+2*l)+c;else p=-s,h=Math.max(0,-(o*p+a)),m=-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),m=-h*h+p*(p+2*l)+c):p<=v?(h=0,p=Math.min(Math.max(-s,-l),s),m=p*(p+2*l)+c):(h=Math.max(0,-(o*s+a)),p=h>0?s:Math.min(Math.max(-s,-l),s),m=-h*h+p*(p+2*l)+c);else p=o>0?-s:s,h=Math.max(0,-(o*p+a)),m=-h*h+p*(p+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(Gm).addScaledVector(df,p),m}intersectSphere(e,t){bs.subVectors(e.center,this.origin);const n=bs.dot(this.direction),i=bs.dot(bs)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,p=this.origin;return c>=0?(n=(e.min.x-p.x)*c,i=(e.max.x-p.x)*c):(n=(e.max.x-p.x)*c,i=(e.min.x-p.x)*c),u>=0?(s=(e.min.y-p.y)*u,o=(e.max.y-p.y)*u):(s=(e.max.y-p.y)*u,o=(e.min.y-p.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=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),n>l||a>i)||((a>n||n!==n)&&(n=a),(l=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,bs)!==null}intersectTriangle(e,t,n,i,s){Hm.subVectors(t,e),pf.subVectors(n,e),Vm.crossVectors(Hm,pf);let o=this.direction.dot(Vm),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;so.subVectors(this.origin,e);const l=a*this.direction.dot(pf.crossVectors(so,pf));if(l<0)return null;const c=a*this.direction.dot(Hm.cross(so));if(c<0||l+c>o)return null;const u=-a*so.dot(Vm);return u<0?null:this.at(u/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,n,i,s,o,a,l,c,u,h,p,m,v,_,y){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,n,i,s,o,a,l,c,u,h,p,m,v,_,y)}set(e,t,n,i,s,o,a,l,c,u,h,p,m,v,_,y){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=o,g[9]=a,g[13]=l,g[2]=c,g[6]=u,g[10]=h,g[14]=p,g[3]=m,g[7]=v,g[11]=_,g[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 yt().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/tl.setFromMatrixColumn(e,0).length(),s=1/tl.setFromMatrixColumn(e,1).length(),o=1/tl.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const p=o*u,m=o*h,v=a*u,_=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=m+v*c,t[5]=p-_*c,t[9]=-a*l,t[2]=_-p*c,t[6]=v+m*c,t[10]=o*l}else if(e.order==="YXZ"){const p=l*u,m=l*h,v=c*u,_=c*h;t[0]=p+_*a,t[4]=v*a-m,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=m*a-v,t[6]=_+p*a,t[10]=o*l}else if(e.order==="ZXY"){const p=l*u,m=l*h,v=c*u,_=c*h;t[0]=p-_*a,t[4]=-o*h,t[8]=v+m*a,t[1]=m+v*a,t[5]=o*u,t[9]=_-p*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const p=o*u,m=o*h,v=a*u,_=a*h;t[0]=l*u,t[4]=v*c-m,t[8]=p*c+_,t[1]=l*h,t[5]=_*c+p,t[9]=m*c-v,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const p=o*l,m=o*c,v=a*l,_=a*c;t[0]=l*u,t[4]=_-p*h,t[8]=v*h+m,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=m*h+v,t[10]=p-_*h}else if(e.order==="XZY"){const p=o*l,m=o*c,v=a*l,_=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=p*h+_,t[5]=o*u,t[9]=m*h-v,t[2]=v*h-m,t[6]=a*u,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(iR,e,rR)}lookAt(e,t,n){const i=this.elements;return $i.subVectors(e,t),$i.lengthSq()===0&&($i.z=1),$i.normalize(),oo.crossVectors(n,$i),oo.lengthSq()===0&&(Math.abs(n.z)===1?$i.x+=1e-4:$i.z+=1e-4,$i.normalize(),oo.crossVectors(n,$i)),oo.normalize(),mf.crossVectors($i,oo),i[0]=oo.x,i[4]=mf.x,i[8]=$i.x,i[1]=oo.y,i[5]=mf.y,i[9]=$i.y,i[2]=oo.z,i[6]=mf.z,i[10]=$i.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],h=n[5],p=n[9],m=n[13],v=n[2],_=n[6],y=n[10],g=n[14],x=n[3],w=n[7],E=n[11],b=n[15],M=i[0],A=i[4],P=i[8],C=i[12],L=i[1],F=i[5],N=i[9],I=i[13],X=i[2],q=i[6],W=i[10],O=i[14],k=i[3],G=i[7],B=i[11],D=i[15];return s[0]=o*M+a*L+l*X+c*k,s[4]=o*A+a*F+l*q+c*G,s[8]=o*P+a*N+l*W+c*B,s[12]=o*C+a*I+l*O+c*D,s[1]=u*M+h*L+p*X+m*k,s[5]=u*A+h*F+p*q+m*G,s[9]=u*P+h*N+p*W+m*B,s[13]=u*C+h*I+p*O+m*D,s[2]=v*M+_*L+y*X+g*k,s[6]=v*A+_*F+y*q+g*G,s[10]=v*P+_*N+y*W+g*B,s[14]=v*C+_*I+y*O+g*D,s[3]=x*M+w*L+E*X+b*k,s[7]=x*A+w*F+E*q+b*G,s[11]=x*P+w*N+E*W+b*B,s[15]=x*C+w*I+E*O+b*D,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],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],p=e[10],m=e[14],v=e[3],_=e[7],y=e[11],g=e[15];return v*(+s*l*h-i*c*h-s*a*p+n*c*p+i*a*m-n*l*m)+_*(+t*l*m-t*c*p+s*o*p-i*o*m+i*c*u-s*l*u)+y*(+t*c*h-t*a*m-s*o*h+n*o*m+s*a*u-n*c*u)+g*(-i*a*u-t*l*h+t*a*p+i*o*h-n*o*p+n*l*u)}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,n){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]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],p=e[10],m=e[11],v=e[12],_=e[13],y=e[14],g=e[15],x=h*y*c-_*p*c+_*l*m-a*y*m-h*l*g+a*p*g,w=v*p*c-u*y*c-v*l*m+o*y*m+u*l*g-o*p*g,E=u*_*c-v*h*c+v*a*m-o*_*m-u*a*g+o*h*g,b=v*h*l-u*_*l-v*a*p+o*_*p+u*a*y-o*h*y,M=t*x+n*w+i*E+s*b;if(M===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const A=1/M;return e[0]=x*A,e[1]=(_*p*s-h*y*s-_*i*m+n*y*m+h*i*g-n*p*g)*A,e[2]=(a*y*s-_*l*s+_*i*c-n*y*c-a*i*g+n*l*g)*A,e[3]=(h*l*s-a*p*s-h*i*c+n*p*c+a*i*m-n*l*m)*A,e[4]=w*A,e[5]=(u*y*s-v*p*s+v*i*m-t*y*m-u*i*g+t*p*g)*A,e[6]=(v*l*s-o*y*s-v*i*c+t*y*c+o*i*g-t*l*g)*A,e[7]=(o*p*s-u*l*s+u*i*c-t*p*c-o*i*m+t*l*m)*A,e[8]=E*A,e[9]=(v*h*s-u*_*s-v*n*m+t*_*m+u*n*g-t*h*g)*A,e[10]=(o*_*s-v*a*s+v*n*c-t*_*c-o*n*g+t*a*g)*A,e[11]=(u*a*s-o*h*s-u*n*c+t*h*c+o*n*m-t*a*m)*A,e[12]=b*A,e[13]=(u*_*i-v*h*i+v*n*p-t*_*p-u*n*y+t*h*y)*A,e[14]=(v*a*i-o*_*i-v*n*l+t*_*l+o*n*y-t*a*y)*A,e[15]=(o*h*i-u*a*i+u*n*l-t*h*l-o*n*p+t*a*p)*A,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,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],n=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,n,i))}makeTranslation(e,t,n){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,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,s*l*l+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,h=a+a,p=s*c,m=s*u,v=s*h,_=o*u,y=o*h,g=a*h,x=l*c,w=l*u,E=l*h,b=n.x,M=n.y,A=n.z;return i[0]=(1-(_+g))*b,i[1]=(m+E)*b,i[2]=(v-w)*b,i[3]=0,i[4]=(m-E)*M,i[5]=(1-(p+g))*M,i[6]=(y+x)*M,i[7]=0,i[8]=(v+w)*A,i[9]=(y-x)*A,i[10]=(1-(p+_))*A,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=tl.set(i[0],i[1],i[2]).length();const o=tl.set(i[4],i[5],i[6]).length(),a=tl.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],Cr.copy(this);const c=1/s,u=1/o,h=1/a;return Cr.elements[0]*=c,Cr.elements[1]*=c,Cr.elements[2]*=c,Cr.elements[4]*=u,Cr.elements[5]*=u,Cr.elements[6]*=u,Cr.elements[8]*=h,Cr.elements[9]*=h,Cr.elements[10]*=h,t.setFromRotationMatrix(Cr),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=ss){const l=this.elements,c=2*s/(t-e),u=2*s/(n-i),h=(t+e)/(t-e),p=(n+i)/(n-i);let m,v;if(a===ss)m=-(o+s)/(o-s),v=-2*o*s/(o-s);else if(a===Nu)m=-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]=u,l[9]=p,l[13]=0,l[2]=0,l[6]=0,l[10]=m,l[14]=v,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=ss){const l=this.elements,c=1/(t-e),u=1/(n-i),h=1/(o-s),p=(t+e)*c,m=(n+i)*u;let v,_;if(a===ss)v=(o+s)*h,_=-2*h;else if(a===Nu)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*u,l[9]=0,l[13]=-m,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,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const tl=new Y,Cr=new yt,iR=new Y(0,0,0),rR=new Y(1,1,1),oo=new Y,mf=new Y,$i=new Y,Yx=new yt,qx=new si;class Eo{constructor(e=0,t=0,n=0,i=Eo.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,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,n,i=this._order){return this._x=e,this._y=t,this._z=n,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,n=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],h=i[2],p=i[6],m=i[10];switch(t){case"XYZ":this._y=Math.asin(Tn(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(p,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Tn(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Tn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Tn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,m),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Tn(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-Tn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(p,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Yx.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Yx,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return qx.setFromEuler(this),this.setFromQuaternion(qx,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}}Eo.DEFAULT_ORDER="XYZ";class ga{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(n=n.concat(o))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lc,e,oR),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Lc,aR,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n0&&(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()));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 c=0,u=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),p.length>0&&(n.skeletons=p),m.length>0&&(n.animations=m),v.length>0&&(n.nodes=v)}return n.object=i,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){Rr.subVectors(i,t),Ts.subVectors(n,t),Wm.subVectors(e,t);const o=Rr.dot(Rr),a=Rr.dot(Ts),l=Rr.dot(Wm),c=Ts.dot(Ts),u=Ts.dot(Wm),h=o*c-a*a;if(h===0)return s.set(-2,-1,-1);const p=1/h,m=(c*l-a*u)*p,v=(o*u-a*l)*p;return s.set(1-m-v,v,m)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,As),As.x>=0&&As.y>=0&&As.x+As.y<=1}static getUV(e,t,n,i,s,o,a,l){return vf===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),vf=!0),this.getInterpolation(e,t,n,i,s,o,a,l)}static getInterpolation(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,As),l.setScalar(0),l.addScaledVector(s,As.x),l.addScaledVector(o,As.y),l.addScaledVector(a,As.z),l}static isFrontFacing(e,t,n,i){return Rr.subVectors(n,t),Ts.subVectors(e,t),Rr.cross(Ts).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 Rr.subVectors(this.c,this.b),Ts.subVectors(this.a,this.b),Rr.cross(Ts).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return zi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return zi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return vf===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),vf=!0),zi.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return zi.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return zi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return zi.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;il.subVectors(i,n),rl.subVectors(s,n),Xm.subVectors(e,n);const l=il.dot(Xm),c=rl.dot(Xm);if(l<=0&&c<=0)return t.copy(n);jm.subVectors(e,i);const u=il.dot(jm),h=rl.dot(jm);if(u>=0&&h<=u)return t.copy(i);const p=l*h-u*c;if(p<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(il,o);Ym.subVectors(e,s);const m=il.dot(Ym),v=rl.dot(Ym);if(v>=0&&m<=v)return t.copy(s);const _=m*c-l*v;if(_<=0&&c>=0&&v<=0)return a=c/(c-v),t.copy(n).addScaledVector(rl,a);const y=u*v-m*h;if(y<=0&&h-u>=0&&m-v>=0)return e1.subVectors(s,i),a=(h-u)/(h-u+(m-v)),t.copy(i).addScaledVector(e1,a);const g=1/(y+_+p);return o=_*g,a=p*g,t.copy(n).addScaledVector(il,o).addScaledVector(rl,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let cR=0;class oi extends Hs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:cR++}),this.uuid=er(),this.name="",this.type="Material",this.blending=pa,this.side=ls,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Vv,this.blendDst=Wv,this.blendEquation=aa,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Ld,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Kb,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ed,this.stencilZFail=Ed,this.stencilZPass=Ed,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=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 n=e[t];if(n===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(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==pa&&(n.blending=this.blending),this.side!==ls&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=this.alphaHash),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(n.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.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&&(n.textures=s),o.length>0&&(n.images=o)}return n}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.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 n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,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++}}const aM={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},Pr={h:0,s:0,l:0},yf={h:0,s:0,l:0};function qm(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Ke{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===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,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,vr.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=vr.workingColorSpace){return this.r=e,this.g=t,this.b=n,vr.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=vr.workingColorSpace){if(e=iy(e,1),t=Tn(t,0,1),n=Tn(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=qm(o,s,e+1/3),this.g=qm(o,s,e),this.b=qm(o,s,e-1/3)}return vr.toWorkingColorSpace(this,i),this}setStyle(e,t=Mt){function n(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 n(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 n(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 n(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=Mt){const n=aM[e.toLowerCase()];return n!==void 0?this.setHex(n,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=zl(e.r),this.g=zl(e.g),this.b=zl(e.b),this}copyLinearToSRGB(e){return this.r=Nm(e.r),this.g=Nm(e.g),this.b=Nm(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Mt){return vr.fromWorkingColorSpace(gi.copy(this),e),Math.round(Tn(gi.r*255,0,255))*65536+Math.round(Tn(gi.g*255,0,255))*256+Math.round(Tn(gi.b*255,0,255))}getHexString(e=Mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=vr.workingColorSpace){vr.fromWorkingColorSpace(gi.copy(this),t);const n=gi.r,i=gi.g,s=gi.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case n:l=(i-s)/h+(i>-c-14,n[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(n[l]=c+15<<10,n[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(n[l]=31744,n[l|256]=64512,i[l]=24,i[l|256]=24):(n[l]=31744,n[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 c=l<<13,u=0;for(;(c&8388608)===0;)c<<=1,u-=8388608;c&=-8388609,u+=947912704,s[l]=c|u}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:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function ki(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Tn(r,-65504,65504),Os.floatView[0]=r;const e=Os.uint32View[0],t=e>>23&511;return Os.baseTable[t]+((e&8388607)>>Os.shiftTable[t])}function hu(r){const e=r>>10;return Os.uint32View[0]=Os.mantissaTable[Os.offsetTable[e]+(r&1023)]+Os.exponentTable[e],Os.floatView[0]}const hR={toHalfFloat:ki,fromHalfFloat:hu},Fn=new Y,_f=new De;class $t{constructor(e,t,n=!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=n,this.usage=Ou,this.updateRange={offset:0,count:-1},this.gpuType=rs,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(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 t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,p=c.length;h0&&(i[l]=u,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 n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let p=0,m=h.length;p0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(t1.copy(s).invert(),Yo.copy(e.ray).applyMatrix4(t1),!(n.boundingBox!==null&&Yo.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Yo)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,p=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let v=0,_=p.length;v<_;v++){const y=p[v],g=o[y.materialIndex],x=Math.max(y.start,m.start),w=Math.min(a.count,Math.min(y.start+y.count,m.start+m.count));for(let E=x,b=w;Et.far?null:{distance:c,point:Tf.clone(),object:r}}function Af(r,e,t,n,i,s,o,a,l,c){r.getVertexPosition(a,ol),r.getVertexPosition(l,al),r.getVertexPosition(c,ll);const u=xR(r,e,t,n,ol,al,ll,Mf);if(u){i&&(Sf.fromBufferAttribute(i,a),Ef.fromBufferAttribute(i,l),bf.fromBufferAttribute(i,c),u.uv=zi.getInterpolation(Mf,ol,al,ll,Sf,Ef,bf,new De)),s&&(Sf.fromBufferAttribute(s,a),Ef.fromBufferAttribute(s,l),bf.fromBufferAttribute(s,c),u.uv1=zi.getInterpolation(Mf,ol,al,ll,Sf,Ef,bf,new De),u.uv2=u.uv1),o&&(i1.fromBufferAttribute(o,a),r1.fromBufferAttribute(o,l),s1.fromBufferAttribute(o,c),u.normal=zi.getInterpolation(Mf,ol,al,ll,i1,r1,s1,new Y),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:l,c,normal:new Y,materialIndex:0};zi.getNormal(ol,al,ll,h.normal),u.face=h}return u}class Ws extends Tt{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],h=[];let p=0,m=0;v("z","y","x",-1,-1,n,t,e,o,s,0),v("z","y","x",1,-1,n,t,-e,o,s,1),v("x","z","y",1,1,e,n,t,i,o,2),v("x","z","y",1,-1,e,n,-t,i,o,3),v("x","y","z",1,-1,e,t,n,i,s,4),v("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new st(c,3)),this.setAttribute("normal",new st(u,3)),this.setAttribute("uv",new st(h,2));function v(_,y,g,x,w,E,b,M,A,P,C){const L=E/A,F=b/P,N=E/2,I=b/2,X=M/2,q=A+1,W=P+1;let O=0,k=0;const G=new Y;for(let B=0;B0?1:-1,u.push(G.x,G.y,G.z),h.push(V/A),h.push(1-B/P),O+=1}}for(let B=0;B0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class rh extends jt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new yt,this.projectionMatrix=new yt,this.projectionMatrixInverse=new yt,this.coordinateSystem=ss}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){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}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)}}class zn extends rh{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,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=Wl*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(ma*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Wl*2*Math.atan(Math.tan(ma*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,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=n,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(ma*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,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 cl=-90,ul=1;class cM extends jt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null;const i=new zn(cl,ul,e,t);i.layers=this.layers,this.add(i);const s=new zn(cl,ul,e,t);s.layers=this.layers,this.add(s);const o=new zn(cl,ul,e,t);o.layers=this.layers,this.add(o);const a=new zn(cl,ul,e,t);a.layers=this.layers,this.add(a);const l=new zn(cl,ul,e,t);l.layers=this.layers,this.add(l);const c=new zn(cl,ul,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===ss)n.up.set(0,1,0),n.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===Nu)n.up.set(0,-1,0),n.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 c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[i,s,o,a,l,c]=this.children,u=e.getRenderTarget(),h=e.toneMapping,p=e.xr.enabled;e.toneMapping=zr,e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=m,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class sh extends Sn{constructor(e,t,n,i,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:xo,super(e,t,n,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class uM extends Gr{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(_u("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===vo?Mt:yo),this.texture=new sh(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 n={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 Ws(5,5,5),s=new cs({name:"CubemapFromEquirect",uniforms:Xl(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:yi,blending:Fs});s.uniforms.tEquirect.value=t;const o=new _n(i,s),a=t.minFilter;return t.minFilter===So&&(t.minFilter=fn),new cM(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}const $m=new Y,bR=new Y,MR=new Ct;class Us{constructor(e=new Y(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=$m.subVectors(n,t).cross(bR.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 n=e.delta($m),i=this.normal.dot(n);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(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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 n=t||MR.getNormalMatrix(e),i=this.coplanarPoint($m).applyMatrix4(e),s=this.normal.applyMatrix3(n).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 qo=new rr,Cf=new Y;class oh{constructor(e=new Us,t=new Us,n=new Us,i=new Us,s=new Us,o=new Us){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=ss){const n=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],h=i[6],p=i[7],m=i[8],v=i[9],_=i[10],y=i[11],g=i[12],x=i[13],w=i[14],E=i[15];if(n[0].setComponents(l-s,p-c,y-m,E-g).normalize(),n[1].setComponents(l+s,p+c,y+m,E+g).normalize(),n[2].setComponents(l+o,p+u,y+v,E+x).normalize(),n[3].setComponents(l-o,p-u,y-v,E-x).normalize(),n[4].setComponents(l-a,p-h,y-_,E-w).normalize(),t===ss)n[5].setComponents(l+a,p+h,y+_,E+w).normalize();else if(t===Nu)n[5].setComponents(a,h,_,w).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(),qo.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),qo.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(qo)}intersectsSprite(e){return qo.center.set(0,0,0),qo.radius=.7071067811865476,qo.applyMatrix4(e.matrixWorld),this.intersectsSphere(qo)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,Cf.y=i.normal.y>0?e.max.y:e.min.y,Cf.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Cf)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function hM(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function TR(r,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const h=c.array,p=c.usage,m=r.createBuffer();r.bindBuffer(u,m),r.bufferData(u,h,p),c.onUploadCallback();let v;if(h instanceof Float32Array)v=r.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)v=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else v=r.UNSIGNED_SHORT;else if(h instanceof Int16Array)v=r.SHORT;else if(h instanceof Uint32Array)v=r.UNSIGNED_INT;else if(h instanceof Int32Array)v=r.INT;else if(h instanceof Int8Array)v=r.BYTE;else if(h instanceof Uint8Array)v=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)v=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:m,type:v,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){const p=u.array,m=u.updateRange;r.bindBuffer(h,c),m.count===-1?r.bufferSubData(h,0,p):(t?r.bufferSubData(h,m.offset*p.BYTES_PER_ELEMENT,p,m.offset,m.count):r.bufferSubData(h,m.offset*p.BYTES_PER_ELEMENT,p.subarray(m.offset,m.offset+m.count)),m.count=-1),u.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);u&&(r.deleteBuffer(u.buffer),n.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const p=n.get(c);(!p||p.version 0 - vec4 plane; - #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`,GR=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,HR=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,VR=`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,WR=`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,XR=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,jR=`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) - varying vec3 vColor; -#endif`,YR=`#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`,qR=`#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; -}; -struct GeometricContext { - vec3 position; - vec3 normal; - vec3 viewDir; -#ifdef USE_CLEARCOAT - vec3 clearcoatNormal; -#endif -}; -#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`,ZR=`#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_v0 0.339 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_v1 0.276 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_v4 0.046 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_v5 0.016 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_v6 0.0038 - #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`,KR=`vec3 transformedNormal = objectNormal; -#ifdef USE_INSTANCING - mat3 m = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); - transformedNormal = m * transformedNormal; -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`,$R=`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,JR=`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,QR=`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,eP=`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,tP="gl_FragColor = linearToOutputTexel( gl_FragColor );",nP=`vec4 LinearToLinear( in vec4 value ) { - return value; -} -vec4 LinearTosRGB( 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 ); -}`,iP=`#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`,rP=`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,sP=`#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`,oP=`#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`,aP=`#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`,lP=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,cP=`#ifdef USE_FOG - varying float vFogDepth; -#endif`,uP=`#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`,hP=`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,fP=`#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 -}`,dP=`#ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,pP=`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,mP=`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,gP=`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, 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`,vP=`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -uniform vec3 lightProbe[ 9 ]; -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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometry.position; - 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 GeometricContext geometry, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometry.position; - 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`,yP=`#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`,_P=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,xP=`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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`,wP=`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,SP=`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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`,EP=`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); -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 ); - 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`,bP=`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 clearcoatSpecular = vec3( 0.0 ); -vec3 sheenSpecular = 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometry.normal; - vec3 viewDir = geometry.viewDir; - vec3 position = geometry.position; - 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometry.normal, geometry.viewDir, 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 ); -}`,MP=` -GeometricContext geometry; -geometry.position = - vViewPosition; -geometry.normal = normal; -geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -#ifdef USE_CLEARCOAT - geometry.clearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometry.viewDir ) ); - 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, geometry, 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, geometry, 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, geometry, 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, geometry, 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, geometry, 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, geometry, 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, geometry, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,TP=`#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( geometry.normal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,AP=`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`,CP=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,RP=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,PP=`#ifdef USE_LOGDEPTHBUF - #ifdef USE_LOGDEPTHBUF_EXT - varying float vFragDepth; - varying float vIsPerspective; - #else - uniform float logDepthBufFC; - #endif -#endif`,LP=`#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`,IP=`#ifdef USE_MAP - diffuseColor *= texture2D( map, vMapUv ); -#endif`,DP=`#ifdef USE_MAP - uniform sampler2D map; -#endif`,UP=`#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`,OP=`#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`,NP=`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,FP=`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,kP=`#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`,zP=`#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`,BP=`#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`,GP=`#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`,HP=`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 geometryNormal = normal;`,VP=`#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`,WP=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,XP=`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,jP=`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,YP=`#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`,qP=`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = geometryNormal; -#endif`,ZP=`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,KP=`#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`,$P=`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,JP=`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,QP=`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 ); -}`,eL=`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,tL=`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,nL=`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,iL=`#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`,rL=`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,sL=`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,oL=`#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`,aL=`#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`,lL=`#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`,cL=`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; -}`,uL=`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,hL=`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - uniform int boneTextureSize; - mat4 getBoneMatrix( const in float i ) { - float j = i * 4.0; - float x = mod( j, float( boneTextureSize ) ); - float y = floor( j / float( boneTextureSize ) ); - float dx = 1.0 / float( boneTextureSize ); - float dy = 1.0 / float( boneTextureSize ); - y = dy * ( y + 0.5 ); - vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); - vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); - vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); - vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); - mat4 bone = mat4( v1, v2, v3, v4 ); - return bone; - } -#endif`,fL=`#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`,dL=`#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`,pL=`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,mL=`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,gL=`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,vL=`#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 ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,yL=`#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`,_L=`#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`,xL=`#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`,wL=`#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`,SL=`#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`,EL=`#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_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`;const bL=`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,ML=`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,TL=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,AL=`#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 -}`,CL=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,RL=`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 -}`,PL=`#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,LL=`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - vec4 diffuseColor = vec4( 1.0 ); - #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 -}`,IL=`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,DL=`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - #include - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,UL=`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,OL=`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,NL=`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 -}`,FL=`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,kL=`#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #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 -}`,zL=`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() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #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 -}`,BL=`#define LAMBERT -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 - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,GL=`#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() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - 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 -}`,HL=`#define MATCAP -varying vec3 vViewPosition; -#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; -}`,VL=`#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() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - #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 -}`,WL=`#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 -void main() { - #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 -}`,XL=`#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() { - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,jL=`#define PHONG -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 - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,YL=`#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() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - 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 -}`,qL=`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#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 - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,ZL=`#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() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - 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 + sheenSpecular; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,KL=`#define TOON -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 - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,$L=`#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() { - #include - vec4 diffuseColor = vec4( diffuse, opacity ); - 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 -}`,JL=`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 -}`,QL=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,eI=`#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,tI=`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 -}`,nI=`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 -}`,iI=`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - vec3 outgoingLight = vec3( 0.0 ); - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`,bt={alphahash_fragment:AR,alphahash_pars_fragment:CR,alphamap_fragment:RR,alphamap_pars_fragment:PR,alphatest_fragment:LR,alphatest_pars_fragment:IR,aomap_fragment:DR,aomap_pars_fragment:UR,begin_vertex:OR,beginnormal_vertex:NR,bsdfs:FR,iridescence_fragment:kR,bumpmap_pars_fragment:zR,clipping_planes_fragment:BR,clipping_planes_pars_fragment:GR,clipping_planes_pars_vertex:HR,clipping_planes_vertex:VR,color_fragment:WR,color_pars_fragment:XR,color_pars_vertex:jR,color_vertex:YR,common:qR,cube_uv_reflection_fragment:ZR,defaultnormal_vertex:KR,displacementmap_pars_vertex:$R,displacementmap_vertex:JR,emissivemap_fragment:QR,emissivemap_pars_fragment:eP,colorspace_fragment:tP,colorspace_pars_fragment:nP,envmap_fragment:iP,envmap_common_pars_fragment:rP,envmap_pars_fragment:sP,envmap_pars_vertex:oP,envmap_physical_pars_fragment:yP,envmap_vertex:aP,fog_vertex:lP,fog_pars_vertex:cP,fog_fragment:uP,fog_pars_fragment:hP,gradientmap_pars_fragment:fP,lightmap_fragment:dP,lightmap_pars_fragment:pP,lights_lambert_fragment:mP,lights_lambert_pars_fragment:gP,lights_pars_begin:vP,lights_toon_fragment:_P,lights_toon_pars_fragment:xP,lights_phong_fragment:wP,lights_phong_pars_fragment:SP,lights_physical_fragment:EP,lights_physical_pars_fragment:bP,lights_fragment_begin:MP,lights_fragment_maps:TP,lights_fragment_end:AP,logdepthbuf_fragment:CP,logdepthbuf_pars_fragment:RP,logdepthbuf_pars_vertex:PP,logdepthbuf_vertex:LP,map_fragment:IP,map_pars_fragment:DP,map_particle_fragment:UP,map_particle_pars_fragment:OP,metalnessmap_fragment:NP,metalnessmap_pars_fragment:FP,morphcolor_vertex:kP,morphnormal_vertex:zP,morphtarget_pars_vertex:BP,morphtarget_vertex:GP,normal_fragment_begin:HP,normal_fragment_maps:VP,normal_pars_fragment:WP,normal_pars_vertex:XP,normal_vertex:jP,normalmap_pars_fragment:YP,clearcoat_normal_fragment_begin:qP,clearcoat_normal_fragment_maps:ZP,clearcoat_pars_fragment:KP,iridescence_pars_fragment:$P,opaque_fragment:JP,packing:QP,premultiplied_alpha_fragment:eL,project_vertex:tL,dithering_fragment:nL,dithering_pars_fragment:iL,roughnessmap_fragment:rL,roughnessmap_pars_fragment:sL,shadowmap_pars_fragment:oL,shadowmap_pars_vertex:aL,shadowmap_vertex:lL,shadowmask_pars_fragment:cL,skinbase_vertex:uL,skinning_pars_vertex:hL,skinning_vertex:fL,skinnormal_vertex:dL,specularmap_fragment:pL,specularmap_pars_fragment:mL,tonemapping_fragment:gL,tonemapping_pars_fragment:vL,transmission_fragment:yL,transmission_pars_fragment:_L,uv_pars_fragment:xL,uv_pars_vertex:wL,uv_vertex:SL,worldpos_vertex:EL,background_vert:bL,background_frag:ML,backgroundCube_vert:TL,backgroundCube_frag:AL,cube_vert:CL,cube_frag:RL,depth_vert:PL,depth_frag:LL,distanceRGBA_vert:IL,distanceRGBA_frag:DL,equirect_vert:UL,equirect_frag:OL,linedashed_vert:NL,linedashed_frag:FL,meshbasic_vert:kL,meshbasic_frag:zL,meshlambert_vert:BL,meshlambert_frag:GL,meshmatcap_vert:HL,meshmatcap_frag:VL,meshnormal_vert:WL,meshnormal_frag:XL,meshphong_vert:jL,meshphong_frag:YL,meshphysical_vert:qL,meshphysical_frag:ZL,meshtoon_vert:KL,meshtoon_frag:$L,points_vert:JL,points_frag:QL,shadow_vert:eI,shadow_frag:tI,sprite_vert:nI,sprite_frag:iI},Je={common:{diffuse:{value:new Ke(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ct},alphaMap:{value:null},alphaMapTransform:{value:new Ct},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ct}},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 Ct}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ct}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ct},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ct},normalScale:{value:new De(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ct},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ct}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ct}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ct}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ke(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 Ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ct},alphaTest:{value:0},uvTransform:{value:new Ct}},sprite:{diffuse:{value:new Ke(16777215)},opacity:{value:1},center:{value:new De(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ct},alphaMap:{value:null},alphaMapTransform:{value:new Ct},alphaTest:{value:0}}},Nr={basic:{uniforms:Ci([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.fog]),vertexShader:bt.meshbasic_vert,fragmentShader:bt.meshbasic_frag},lambert:{uniforms:Ci([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,Je.lights,{emissive:{value:new Ke(0)}}]),vertexShader:bt.meshlambert_vert,fragmentShader:bt.meshlambert_frag},phong:{uniforms:Ci([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,Je.lights,{emissive:{value:new Ke(0)},specular:{value:new Ke(1118481)},shininess:{value:30}}]),vertexShader:bt.meshphong_vert,fragmentShader:bt.meshphong_frag},standard:{uniforms:Ci([Je.common,Je.envmap,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.roughnessmap,Je.metalnessmap,Je.fog,Je.lights,{emissive:{value:new Ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:bt.meshphysical_vert,fragmentShader:bt.meshphysical_frag},toon:{uniforms:Ci([Je.common,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.gradientmap,Je.fog,Je.lights,{emissive:{value:new Ke(0)}}]),vertexShader:bt.meshtoon_vert,fragmentShader:bt.meshtoon_frag},matcap:{uniforms:Ci([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,{matcap:{value:null}}]),vertexShader:bt.meshmatcap_vert,fragmentShader:bt.meshmatcap_frag},points:{uniforms:Ci([Je.points,Je.fog]),vertexShader:bt.points_vert,fragmentShader:bt.points_frag},dashed:{uniforms:Ci([Je.common,Je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:bt.linedashed_vert,fragmentShader:bt.linedashed_frag},depth:{uniforms:Ci([Je.common,Je.displacementmap]),vertexShader:bt.depth_vert,fragmentShader:bt.depth_frag},normal:{uniforms:Ci([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,{opacity:{value:1}}]),vertexShader:bt.meshnormal_vert,fragmentShader:bt.meshnormal_frag},sprite:{uniforms:Ci([Je.sprite,Je.fog]),vertexShader:bt.sprite_vert,fragmentShader:bt.sprite_frag},background:{uniforms:{uvTransform:{value:new Ct},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:bt.background_vert,fragmentShader:bt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:bt.backgroundCube_vert,fragmentShader:bt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:bt.cube_vert,fragmentShader:bt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:bt.equirect_vert,fragmentShader:bt.equirect_frag},distanceRGBA:{uniforms:Ci([Je.common,Je.displacementmap,{referencePosition:{value:new Y},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:bt.distanceRGBA_vert,fragmentShader:bt.distanceRGBA_frag},shadow:{uniforms:Ci([Je.lights,Je.fog,{color:{value:new Ke(0)},opacity:{value:1}}]),vertexShader:bt.shadow_vert,fragmentShader:bt.shadow_frag}};Nr.physical={uniforms:Ci([Nr.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ct},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ct},clearcoatNormalScale:{value:new De(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ct},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ct},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ct},sheen:{value:0},sheenColor:{value:new Ke(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ct},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ct},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ct},transmissionSamplerSize:{value:new De},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ct},attenuationDistance:{value:0},attenuationColor:{value:new Ke(0)},specularColor:{value:new Ke(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ct},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ct},anisotropyVector:{value:new De},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ct}}]),vertexShader:bt.meshphysical_vert,fragmentShader:bt.meshphysical_frag};const Rf={r:0,b:0,g:0};function rI(r,e,t,n,i,s,o){const a=new Ke(0);let l=s===!0?0:1,c,u,h=null,p=0,m=null;function v(y,g){let x=!1,w=g.isScene===!0?g.background:null;switch(w&&w.isTexture&&(w=(g.backgroundBlurriness>0?t:e).get(w)),w===null?_(a,l):w&&w.isColor&&(_(w,1),x=!0),r.xr.getEnvironmentBlendMode()){case"opaque":x=!0;break;case"additive":n.buffers.color.setClear(0,0,0,1,o),x=!0;break;case"alpha-blend":n.buffers.color.setClear(0,0,0,0,o),x=!0;break}(r.autoClear||x)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),w&&(w.isCubeTexture||w.mapping===Jl)?(u===void 0&&(u=new _n(new Ws(1,1,1),new cs({name:"BackgroundCubeMaterial",uniforms:Xl(Nr.backgroundCube.uniforms),vertexShader:Nr.backgroundCube.vertexShader,fragmentShader:Nr.backgroundCube.fragmentShader,side:yi,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(M,A,P){this.matrixWorld.copyPosition(P.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=w,u.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=g.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,u.material.toneMapped=w.colorSpace!==Mt,(h!==w||p!==w.version||m!==r.toneMapping)&&(u.material.needsUpdate=!0,h=w,p=w.version,m=r.toneMapping),u.layers.enableAll(),y.unshift(u,u.geometry,u.material,0,0,null)):w&&w.isTexture&&(c===void 0&&(c=new _n(new To(2,2),new cs({name:"BackgroundMaterial",uniforms:Xl(Nr.background.uniforms),vertexShader:Nr.background.vertexShader,fragmentShader:Nr.background.fragmentShader,side:ls,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=w,c.material.uniforms.backgroundIntensity.value=g.backgroundIntensity,c.material.toneMapped=w.colorSpace!==Mt,w.matrixAutoUpdate===!0&&w.updateMatrix(),c.material.uniforms.uvTransform.value.copy(w.matrix),(h!==w||p!==w.version||m!==r.toneMapping)&&(c.material.needsUpdate=!0,h=w,p=w.version,m=r.toneMapping),c.layers.enableAll(),y.unshift(c,c.geometry,c.material,0,0,null))}function _(y,g){y.getRGB(Rf,lM(r)),n.buffers.color.setClear(Rf.r,Rf.g,Rf.b,g,o)}return{getClearColor:function(){return a},setClearColor:function(y,g=1){a.set(y),l=g,_(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(y){l=y,_(a,l)},render:v}}function sI(r,e,t,n){const i=r.getParameter(r.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=y(null);let c=l,u=!1;function h(X,q,W,O,k){let G=!1;if(o){const B=_(O,W,q);c!==B&&(c=B,m(c.object)),G=g(X,O,W,k),G&&x(X,O,W,k)}else{const B=q.wireframe===!0;(c.geometry!==O.id||c.program!==W.id||c.wireframe!==B)&&(c.geometry=O.id,c.program=W.id,c.wireframe=B,G=!0)}k!==null&&t.update(k,r.ELEMENT_ARRAY_BUFFER),(G||u)&&(u=!1,P(X,q,W,O),k!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(k).buffer))}function p(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function m(X){return n.isWebGL2?r.bindVertexArray(X):s.bindVertexArrayOES(X)}function v(X){return n.isWebGL2?r.deleteVertexArray(X):s.deleteVertexArrayOES(X)}function _(X,q,W){const O=W.wireframe===!0;let k=a[X.id];k===void 0&&(k={},a[X.id]=k);let G=k[q.id];G===void 0&&(G={},k[q.id]=G);let B=G[O];return B===void 0&&(B=y(p()),G[O]=B),B}function y(X){const q=[],W=[],O=[];for(let k=0;k=0){const ee=k[V];let ie=G[V];if(ie===void 0&&(V==="instanceMatrix"&&X.instanceMatrix&&(ie=X.instanceMatrix),V==="instanceColor"&&X.instanceColor&&(ie=X.instanceColor)),ee===void 0||ee.attribute!==ie||ie&&ee.data!==ie.data)return!0;B++}return c.attributesNum!==B||c.index!==O}function x(X,q,W,O){const k={},G=q.attributes;let B=0;const D=W.getAttributes();for(const V in D)if(D[V].location>=0){let ee=G[V];ee===void 0&&(V==="instanceMatrix"&&X.instanceMatrix&&(ee=X.instanceMatrix),V==="instanceColor"&&X.instanceColor&&(ee=X.instanceColor));const ie={};ie.attribute=ee,ee&&ee.data&&(ie.data=ee.data),k[V]=ie,B++}c.attributes=k,c.attributesNum=B,c.index=O}function w(){const X=c.newAttributes;for(let q=0,W=X.length;q=0){let Z=k[D];if(Z===void 0&&(D==="instanceMatrix"&&X.instanceMatrix&&(Z=X.instanceMatrix),D==="instanceColor"&&X.instanceColor&&(Z=X.instanceColor)),Z!==void 0){const ee=Z.normalized,ie=Z.itemSize,ue=t.get(Z);if(ue===void 0)continue;const ce=ue.buffer,le=ue.type,Ae=ue.bytesPerElement,Ee=n.isWebGL2===!0&&(le===r.INT||le===r.UNSIGNED_INT||Z.gpuType===Yv);if(Z.isInterleavedBufferAttribute){const ae=Z.data,z=ae.stride,oe=Z.offset;if(ae.isInstancedInterleavedBuffer){for(let te=0;te0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";A="mediump"}return A==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&r.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 c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_TEXTURE_SIZE),v=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),_=r.getParameter(r.MAX_VERTEX_ATTRIBS),y=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),g=r.getParameter(r.MAX_VARYING_VECTORS),x=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),w=p>0,E=o||e.has("OES_texture_float"),b=w&&E,M=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:v,maxAttributes:_,maxVertexUniforms:y,maxVaryings:g,maxFragmentUniforms:x,vertexTextures:w,floatFragmentTextures:E,floatVertexTextures:b,maxSamples:M}}function lI(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new Us,a=new Ct,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,p){const m=h.length!==0||p||n!==0||i;return i=p,n=h.length,m},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,p){t=u(h,p,0)},this.setState=function(h,p,m){const v=h.clippingPlanes,_=h.clipIntersection,y=h.clipShadows,g=r.get(h);if(!i||v===null||v.length===0||s&&!y)s?u(null):c();else{const x=s?0:n,w=x*4;let E=g.clippingState||null;l.value=E,E=u(v,p,w,m);for(let b=0;b!==w;++b)E[b]=t[b];g.clippingState=E,this.numIntersection=_?this.numPlanes:0,this.numPlanes+=x}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,p,m,v){const _=h!==null?h.length:0;let y=null;if(_!==0){if(y=l.value,v!==!0||y===null){const g=m+_*4,x=p.matrixWorldInverse;a.getNormalMatrix(x),(y===null||y.length0){const c=new uM(l.height/2);return c.fromEquirectangularTexture(r,o),e.set(o,c),o.addEventListener("dispose",i),t(c.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:n,dispose:s}}class Pa extends rh{constructor(e=-1,t=1,n=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=n,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,n,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=n,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*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 Ul=4,o1=[.125,.215,.35,.446,.526,.582],la=20,Jm=new Pa,a1=new Ke;let Qm=null;const sa=(1+Math.sqrt(5))/2,hl=1/sa,l1=[new Y(1,1,1),new Y(-1,1,1),new Y(1,1,-1),new Y(-1,1,-1),new Y(0,sa,hl),new Y(0,sa,-hl),new Y(hl,0,sa),new Y(-hl,0,sa),new Y(sa,hl,0),new Y(-sa,hl,0)];class lv{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,n=.1,i=100){Qm=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,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=h1(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=u1(),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?w:0,w,w),u.setRenderTarget(i),_&&u.render(v,a),u.render(e,a)}v.geometry.dispose(),v.material.dispose(),u.toneMapping=p,u.autoClear=h,e.background=y}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===xo||e.mapping===wo;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=h1()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=u1());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new _n(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Pf(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,Jm)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;ila&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${y} samples when the maximum is set to ${la}`);const g=[];let x=0;for(let A=0;Aw-Ul?i-w+Ul:0),M=4*(this._cubeSize-E);Pf(t,b,M,3*E,2*E),l.setRenderTarget(t),l.render(h,Jm)}}function uI(r){const e=[],t=[],n=[];let i=r;const s=r-Ul+1+o1.length;for(let o=0;or-Ul?l=o1[o-r+Ul-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,h=1+c,p=[u,u,h,u,h,h,u,u,h,h,u,h],m=6,v=6,_=3,y=2,g=1,x=new Float32Array(_*v*m),w=new Float32Array(y*v*m),E=new Float32Array(g*v*m);for(let M=0;M2?0:-1,C=[A,P,0,A+2/3,P,0,A+2/3,P+1,0,A,P,0,A+2/3,P+1,0,A,P+1,0];x.set(C,_*v*M),w.set(p,y*v*M);const L=[M,M,M,M,M,M];E.set(L,g*v*M)}const b=new Tt;b.setAttribute("position",new $t(x,_)),b.setAttribute("uv",new $t(w,y)),b.setAttribute("faceIndex",new $t(E,g)),e.push(b),i>Ul&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function c1(r,e,t){const n=new Gr(r,e,t);return n.texture.mapping=Jl,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Pf(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function hI(r,e,t){const n=new Float32Array(la),i=new Y(0,1,0);return new cs({name:"SphericalGaussianBlur",defines:{n:la,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:cy(),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:Fs,depthTest:!1,depthWrite:!1})}function u1(){return new cs({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cy(),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:Fs,depthTest:!1,depthWrite:!1})}function h1(){return new cs({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cy(),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:Fs,depthTest:!1,depthWrite:!1})}function cy(){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 fI(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===Cu||l===Ru,u=l===xo||l===wo;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new lv(r)),h=c?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(c&&h&&h.height>0||u&&h&&i(h)){t===null&&(t=new lv(r));const p=c?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 c=6;for(let u=0;ue.maxTextureSize&&(L=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const F=new Float32Array(C*L*4*v),N=new Jd(F,C,L,v);N.type=rs,N.needsUpdate=!0;const I=P*4;for(let q=0;q0)return r;const i=e*t;let s=f1[i];if(s===void 0&&(s=new Float32Array(i),f1[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Wn(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t":" "} ${a}: ${t[o]}`)}return n.join(` -`)}function dD(r){switch(r){case Br:return["Linear","( value )"];case Mt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),["Linear","( value )"]}}function _1(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` - -`+i+` - -`+fD(r.getShaderSource(e),o)}else return i}function pD(r,e){const t=dD(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function mD(r,e){let t;switch(e){case Ib:t="Linear";break;case Db:t="Reinhard";break;case Ub:t="OptimizedCineon";break;case Xv:t="ACESFilmic";break;case Ob:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function gD(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(fu).join(` -`)}function vD(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function yD(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function cv(r){return r.replace(_D,wD)}const xD=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function wD(r,e){let t=bt[e];if(t===void 0){const n=xD.get(e);if(n!==void 0)t=bt[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return cv(t)}const SD=/#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 S1(r){return r.replace(SD,ED)}function ED(r,e,t,n){let i="";for(let s=parseInt(e);s0&&(y+=` -`),g=[m,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v].filter(fu).join(` -`),g.length>0&&(g+=` -`)):(y=[E1(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,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 "+u:"",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.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.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(fu).join(` -`),g=[m,E1(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,v,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",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.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==zr?"#define TONE_MAPPING":"",t.toneMapping!==zr?bt.tonemapping_pars_fragment:"",t.toneMapping!==zr?mD("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",bt.colorspace_pars_fragment,pD("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(fu).join(` -`)),o=cv(o),o=x1(o,t),o=w1(o,t),a=cv(a),a=x1(a,t),a=w1(a,t),o=S1(o),a=S1(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(x=`#version 300 es -`,y=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` -`)+` -`+y,g=["#define varying in",t.glslVersion===ov?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===ov?"":"#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(` -`)+` -`+g);const w=x+y+o,E=x+g+a,b=y1(i,i.VERTEX_SHADER,w),M=y1(i,i.FRAGMENT_SHADER,E);if(i.attachShader(_,b),i.attachShader(_,M),t.index0AttributeName!==void 0?i.bindAttribLocation(_,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(_,0,"position"),i.linkProgram(_),r.debug.checkShaderErrors){const C=i.getProgramInfoLog(_).trim(),L=i.getShaderInfoLog(b).trim(),F=i.getShaderInfoLog(M).trim();let N=!0,I=!0;if(i.getProgramParameter(_,i.LINK_STATUS)===!1)if(N=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,_,b,M);else{const X=_1(i,b,"vertex"),q=_1(i,M,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(_,i.VALIDATE_STATUS)+` - -Program Info Log: `+C+` -`+X+` -`+q)}else C!==""?console.warn("THREE.WebGLProgram: Program Info Log:",C):(L===""||F==="")&&(I=!1);I&&(this.diagnostics={runnable:N,programLog:C,vertexShader:{log:L,prefix:y},fragmentShader:{log:F,prefix:g}})}i.deleteShader(b),i.deleteShader(M);let A;this.getUniforms=function(){return A===void 0&&(A=new bd(i,_)),A};let P;return this.getAttributes=function(){return P===void 0&&(P=yD(i,_)),P},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(_),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=hD++,this.cacheKey=e,this.usedTimes=1,this.program=_,this.vertexShader=b,this.fragmentShader=M,this}let PD=0;class LD{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),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 n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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 n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new ID(e),t.set(e,n)),n}}class ID{constructor(e){this.id=PD++,this.code=e,this.usedTimes=0}}function DD(r,e,t,n,i,s,o){const a=new ga,l=new LD,c=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,p=i.vertexTextures;let m=i.precision;const v={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 _(C){return C===0?"uv":`uv${C}`}function y(C,L,F,N,I){const X=N.fog,q=I.geometry,W=C.isMeshStandardMaterial?N.environment:null,O=(C.isMeshStandardMaterial?t:e).get(C.envMap||W),k=O&&O.mapping===Jl?O.image.height:null,G=v[C.type];C.precision!==null&&(m=i.getMaxPrecision(C.precision),m!==C.precision&&console.warn("THREE.WebGLProgram.getParameters:",C.precision,"not supported, using",m,"instead."));const B=q.morphAttributes.position||q.morphAttributes.normal||q.morphAttributes.color,D=B!==void 0?B.length:0;let V=0;q.morphAttributes.position!==void 0&&(V=1),q.morphAttributes.normal!==void 0&&(V=2),q.morphAttributes.color!==void 0&&(V=3);let Z,ee,ie,ue;if(G){const Ot=Nr[G];Z=Ot.vertexShader,ee=Ot.fragmentShader}else Z=C.vertexShader,ee=C.fragmentShader,l.update(C),ie=l.getVertexShaderID(C),ue=l.getFragmentShaderID(C);const ce=r.getRenderTarget(),le=I.isInstancedMesh===!0,Ae=!!C.map,Ee=!!C.matcap,ae=!!O,z=!!C.aoMap,oe=!!C.lightMap,te=!!C.bumpMap,se=!!C.normalMap,$=!!C.displacementMap,Ie=!!C.emissiveMap,de=!!C.metalnessMap,Se=!!C.roughnessMap,Le=C.anisotropy>0,ge=C.clearcoat>0,He=C.iridescence>0,j=C.sheen>0,H=C.transmission>0,ne=Le&&!!C.anisotropyMap,we=ge&&!!C.clearcoatMap,be=ge&&!!C.clearcoatNormalMap,Me=ge&&!!C.clearcoatRoughnessMap,Fe=He&&!!C.iridescenceMap,Ue=He&&!!C.iridescenceThicknessMap,xe=j&&!!C.sheenColorMap,Be=j&&!!C.sheenRoughnessMap,$e=!!C.specularMap,Ve=!!C.specularColorMap,Oe=!!C.specularIntensityMap,We=H&&!!C.transmissionMap,nt=H&&!!C.thicknessMap,pt=!!C.gradientMap,re=!!C.alphaMap,ze=C.alphaTest>0,ve=!!C.alphaHash,Ge=!!C.extensions,Ye=!!q.attributes.uv1,_t=!!q.attributes.uv2,It=!!q.attributes.uv3;return{isWebGL2:u,shaderID:G,shaderType:C.type,shaderName:C.name,vertexShader:Z,fragmentShader:ee,defines:C.defines,customVertexShaderID:ie,customFragmentShaderID:ue,isRawShaderMaterial:C.isRawShaderMaterial===!0,glslVersion:C.glslVersion,precision:m,instancing:le,instancingColor:le&&I.instanceColor!==null,supportsVertexTextures:p,outputColorSpace:ce===null?r.outputColorSpace:ce.isXRRenderTarget===!0?ce.texture.colorSpace:Br,map:Ae,matcap:Ee,envMap:ae,envMapMode:ae&&O.mapping,envMapCubeUVHeight:k,aoMap:z,lightMap:oe,bumpMap:te,normalMap:se,displacementMap:p&&$,emissiveMap:Ie,normalMapObjectSpace:se&&C.normalMapType===Zb,normalMapTangentSpace:se&&C.normalMapType===Mo,metalnessMap:de,roughnessMap:Se,anisotropy:Le,anisotropyMap:ne,clearcoat:ge,clearcoatMap:we,clearcoatNormalMap:be,clearcoatRoughnessMap:Me,iridescence:He,iridescenceMap:Fe,iridescenceThicknessMap:Ue,sheen:j,sheenColorMap:xe,sheenRoughnessMap:Be,specularMap:$e,specularColorMap:Ve,specularIntensityMap:Oe,transmission:H,transmissionMap:We,thicknessMap:nt,gradientMap:pt,opaque:C.transparent===!1&&C.blending===pa,alphaMap:re,alphaTest:ze,alphaHash:ve,combine:C.combine,mapUv:Ae&&_(C.map.channel),aoMapUv:z&&_(C.aoMap.channel),lightMapUv:oe&&_(C.lightMap.channel),bumpMapUv:te&&_(C.bumpMap.channel),normalMapUv:se&&_(C.normalMap.channel),displacementMapUv:$&&_(C.displacementMap.channel),emissiveMapUv:Ie&&_(C.emissiveMap.channel),metalnessMapUv:de&&_(C.metalnessMap.channel),roughnessMapUv:Se&&_(C.roughnessMap.channel),anisotropyMapUv:ne&&_(C.anisotropyMap.channel),clearcoatMapUv:we&&_(C.clearcoatMap.channel),clearcoatNormalMapUv:be&&_(C.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Me&&_(C.clearcoatRoughnessMap.channel),iridescenceMapUv:Fe&&_(C.iridescenceMap.channel),iridescenceThicknessMapUv:Ue&&_(C.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&_(C.sheenColorMap.channel),sheenRoughnessMapUv:Be&&_(C.sheenRoughnessMap.channel),specularMapUv:$e&&_(C.specularMap.channel),specularColorMapUv:Ve&&_(C.specularColorMap.channel),specularIntensityMapUv:Oe&&_(C.specularIntensityMap.channel),transmissionMapUv:We&&_(C.transmissionMap.channel),thicknessMapUv:nt&&_(C.thicknessMap.channel),alphaMapUv:re&&_(C.alphaMap.channel),vertexTangents:!!q.attributes.tangent&&(se||Le),vertexColors:C.vertexColors,vertexAlphas:C.vertexColors===!0&&!!q.attributes.color&&q.attributes.color.itemSize===4,vertexUv1s:Ye,vertexUv2s:_t,vertexUv3s:It,pointsUvs:I.isPoints===!0&&!!q.attributes.uv&&(Ae||re),fog:!!X,useFog:C.fog===!0,fogExp2:X&&X.isFogExp2,flatShading:C.flatShading===!0,sizeAttenuation:C.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:I.isSkinnedMesh===!0,morphTargets:q.morphAttributes.position!==void 0,morphNormals:q.morphAttributes.normal!==void 0,morphColors:q.morphAttributes.color!==void 0,morphTargetsCount:D,morphTextureStride:V,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:C.dithering,shadowMapEnabled:r.shadowMap.enabled&&F.length>0,shadowMapType:r.shadowMap.type,toneMapping:C.toneMapped?r.toneMapping:zr,useLegacyLights:r.useLegacyLights,premultipliedAlpha:C.premultipliedAlpha,doubleSided:C.side===vn,flipSided:C.side===yi,useDepthPacking:C.depthPacking>=0,depthPacking:C.depthPacking||0,index0AttributeName:C.index0AttributeName,extensionDerivatives:Ge&&C.extensions.derivatives===!0,extensionFragDepth:Ge&&C.extensions.fragDepth===!0,extensionDrawBuffers:Ge&&C.extensions.drawBuffers===!0,extensionShaderTextureLOD:Ge&&C.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:C.customProgramCacheKey()}}function g(C){const L=[];if(C.shaderID?L.push(C.shaderID):(L.push(C.customVertexShaderID),L.push(C.customFragmentShaderID)),C.defines!==void 0)for(const F in C.defines)L.push(F),L.push(C.defines[F]);return C.isRawShaderMaterial===!1&&(x(L,C),w(L,C),L.push(r.outputColorSpace)),L.push(C.customProgramCacheKey),L.join()}function x(C,L){C.push(L.precision),C.push(L.outputColorSpace),C.push(L.envMapMode),C.push(L.envMapCubeUVHeight),C.push(L.mapUv),C.push(L.alphaMapUv),C.push(L.lightMapUv),C.push(L.aoMapUv),C.push(L.bumpMapUv),C.push(L.normalMapUv),C.push(L.displacementMapUv),C.push(L.emissiveMapUv),C.push(L.metalnessMapUv),C.push(L.roughnessMapUv),C.push(L.anisotropyMapUv),C.push(L.clearcoatMapUv),C.push(L.clearcoatNormalMapUv),C.push(L.clearcoatRoughnessMapUv),C.push(L.iridescenceMapUv),C.push(L.iridescenceThicknessMapUv),C.push(L.sheenColorMapUv),C.push(L.sheenRoughnessMapUv),C.push(L.specularMapUv),C.push(L.specularColorMapUv),C.push(L.specularIntensityMapUv),C.push(L.transmissionMapUv),C.push(L.thicknessMapUv),C.push(L.combine),C.push(L.fogExp2),C.push(L.sizeAttenuation),C.push(L.morphTargetsCount),C.push(L.morphAttributeCount),C.push(L.numDirLights),C.push(L.numPointLights),C.push(L.numSpotLights),C.push(L.numSpotLightMaps),C.push(L.numHemiLights),C.push(L.numRectAreaLights),C.push(L.numDirLightShadows),C.push(L.numPointLightShadows),C.push(L.numSpotLightShadows),C.push(L.numSpotLightShadowsWithMaps),C.push(L.shadowMapType),C.push(L.toneMapping),C.push(L.numClippingPlanes),C.push(L.numClipIntersection),C.push(L.depthPacking)}function w(C,L){a.disableAll(),L.isWebGL2&&a.enable(0),L.supportsVertexTextures&&a.enable(1),L.instancing&&a.enable(2),L.instancingColor&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUv1s&&a.enable(13),L.vertexUv2s&&a.enable(14),L.vertexUv3s&&a.enable(15),L.vertexTangents&&a.enable(16),L.anisotropy&&a.enable(17),C.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.skinning&&a.enable(4),L.morphTargets&&a.enable(5),L.morphNormals&&a.enable(6),L.morphColors&&a.enable(7),L.premultipliedAlpha&&a.enable(8),L.shadowMapEnabled&&a.enable(9),L.useLegacyLights&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),C.push(a.mask)}function E(C){const L=v[C.type];let F;if(L){const N=Nr[L];F=ly.clone(N.uniforms)}else F=C.uniforms;return F}function b(C,L){let F;for(let N=0,I=c.length;N0?n.push(g):m.transparent===!0?i.push(g):t.push(g)}function l(h,p,m,v,_,y){const g=o(h,p,m,v,_,y);m.transmission>0?n.unshift(g):m.transparent===!0?i.unshift(g):t.unshift(g)}function c(h,p){t.length>1&&t.sort(h||OD),n.length>1&&n.sort(p||b1),i.length>1&&i.sort(p||b1)}function u(){for(let h=e,p=r.length;h=s.length?(o=new M1,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function FD(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new Y,color:new Ke};break;case"SpotLight":t={position:new Y,direction:new Y,color:new Ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Y,color:new Ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Y,skyColor:new Ke,groundColor:new Ke};break;case"RectAreaLight":t={color:new Ke,position:new Y,halfWidth:new Y,halfHeight:new Y};break}return r[e.id]=t,t}}}function kD(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new De,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let zD=0;function BD(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function GD(r,e){const t=new FD,n=kD(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let u=0;u<9;u++)i.probe.push(new Y);const s=new Y,o=new yt,a=new yt;function l(u,h){let p=0,m=0,v=0;for(let F=0;F<9;F++)i.probe[F].set(0,0,0);let _=0,y=0,g=0,x=0,w=0,E=0,b=0,M=0,A=0,P=0;u.sort(BD);const C=h===!0?Math.PI:1;for(let F=0,N=u.length;F0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Je.LTC_FLOAT_1,i.rectAreaLTC2=Je.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Je.LTC_HALF_1,i.rectAreaLTC2=Je.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=p,i.ambient[1]=m,i.ambient[2]=v;const L=i.hash;(L.directionalLength!==_||L.pointLength!==y||L.spotLength!==g||L.rectAreaLength!==x||L.hemiLength!==w||L.numDirectionalShadows!==E||L.numPointShadows!==b||L.numSpotShadows!==M||L.numSpotMaps!==A)&&(i.directional.length=_,i.spot.length=g,i.rectArea.length=x,i.point.length=y,i.hemi.length=w,i.directionalShadow.length=E,i.directionalShadowMap.length=E,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=M,i.spotShadowMap.length=M,i.directionalShadowMatrix.length=E,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=M+A-P,i.spotLightMap.length=A,i.numSpotLightShadowsWithMaps=P,L.directionalLength=_,L.pointLength=y,L.spotLength=g,L.rectAreaLength=x,L.hemiLength=w,L.numDirectionalShadows=E,L.numPointShadows=b,L.numSpotShadows=M,L.numSpotMaps=A,i.version=zD++)}function c(u,h){let p=0,m=0,v=0,_=0,y=0;const g=h.matrixWorldInverse;for(let x=0,w=u.length;x=a.length?(l=new T1(r,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class ep extends oi{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=qb,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 tp extends oi{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 VD=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,WD=`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 XD(r,e,t){let n=new oh;const i=new De,s=new De,o=new Xt,a=new ep({depthPacking:ty}),l=new tp,c={},u=t.maxTextureSize,h={[ls]:yi,[yi]:ls,[vn]:vn},p=new cs({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new De},radius:{value:4}},vertexShader:VD,fragmentShader:WD}),m=p.clone();m.defines.HORIZONTAL_PASS=1;const v=new Tt;v.setAttribute("position",new $t(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const _=new _n(v,p),y=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=qd;let g=this.type;this.render=function(b,M,A){if(y.enabled===!1||y.autoUpdate===!1&&y.needsUpdate===!1||b.length===0)return;const P=r.getRenderTarget(),C=r.getActiveCubeFace(),L=r.getActiveMipmapLevel(),F=r.state;F.setBlending(Fs),F.buffers.color.setClear(1,1,1,1),F.buffers.depth.setTest(!0),F.setScissorTest(!1);const N=g!==Or&&this.type===Or,I=g===Or&&this.type!==Or;for(let X=0,q=b.length;Xu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/k.x),i.x=s.x*k.x,O.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/k.y),i.y=s.y*k.y,O.mapSize.y=s.y)),O.map===null||N===!0||I===!0){const B=this.type!==Or?{minFilter:Dn,magFilter:Dn}:{};O.map!==null&&O.map.dispose(),O.map=new Gr(i.x,i.y,B),O.map.texture.name=W.name+".shadowMap",O.camera.updateProjectionMatrix()}r.setRenderTarget(O.map),r.clear();const G=O.getViewportCount();for(let B=0;B0||M.map&&M.alphaTest>0){const F=C.uuid,N=M.uuid;let I=c[F];I===void 0&&(I={},c[F]=I);let X=I[N];X===void 0&&(X=C.clone(),I[N]=X),C=X}if(C.visible=M.visible,C.wireframe=M.wireframe,P===Or?C.side=M.shadowSide!==null?M.shadowSide:M.side:C.side=M.shadowSide!==null?M.shadowSide:h[M.side],C.alphaMap=M.alphaMap,C.alphaTest=M.alphaTest,C.map=M.map,C.clipShadows=M.clipShadows,C.clippingPlanes=M.clippingPlanes,C.clipIntersection=M.clipIntersection,C.displacementMap=M.displacementMap,C.displacementScale=M.displacementScale,C.displacementBias=M.displacementBias,C.wireframeLinewidth=M.wireframeLinewidth,C.linewidth=M.linewidth,A.isPointLight===!0&&C.isMeshDistanceMaterial===!0){const F=r.properties.get(C);F.light=A}return C}function E(b,M,A,P,C){if(b.visible===!1)return;if(b.layers.test(M.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&C===Or)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(A.matrixWorldInverse,b.matrixWorld);const N=e.update(b),I=b.material;if(Array.isArray(I)){const X=N.groups;for(let q=0,W=X.length;q=1):k.indexOf("OpenGL ES")!==-1&&(O=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]),W=O>=2);let G=null,B={};const D=r.getParameter(r.SCISSOR_BOX),V=r.getParameter(r.VIEWPORT),Z=new Xt().fromArray(D),ee=new Xt().fromArray(V);function ie(re,ze,ve,Ge){const Ye=new Uint8Array(4),_t=r.createTexture();r.bindTexture(re,_t),r.texParameteri(re,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(re,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let It=0;It"u"?!1:/OculusBrowser/g.test(navigator.userAgent),v=new WeakMap;let _;const y=new WeakMap;let g=!1;try{g=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(j,H){return g?new OffscreenCanvas(j,H):Fu("canvas")}function w(j,H,ne,we){let be=1;if((j.width>we||j.height>we)&&(be=we/Math.max(j.width,j.height)),be<1||H===!0)if(typeof HTMLImageElement<"u"&&j instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&j instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&j instanceof ImageBitmap){const Me=H?Ud:Math.floor,Fe=Me(be*j.width),Ue=Me(be*j.height);_===void 0&&(_=x(Fe,Ue));const xe=ne?x(Fe,Ue):_;return xe.width=Fe,xe.height=Ue,xe.getContext("2d").drawImage(j,0,0,Fe,Ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+j.width+"x"+j.height+") to ("+Fe+"x"+Ue+")."),xe}else return"data"in j&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+j.width+"x"+j.height+")."),j;return j}function E(j){return av(j.width)&&av(j.height)}function b(j){return a?!1:j.wrapS!==vi||j.wrapT!==vi||j.minFilter!==Dn&&j.minFilter!==fn}function M(j,H){return j.generateMipmaps&&H&&j.minFilter!==Dn&&j.minFilter!==fn}function A(j){r.generateMipmap(j)}function P(j,H,ne,we,be=!1){if(a===!1)return H;if(j!==null){if(r[j]!==void 0)return r[j];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+j+"'")}let Me=H;return H===r.RED&&(ne===r.FLOAT&&(Me=r.R32F),ne===r.HALF_FLOAT&&(Me=r.R16F),ne===r.UNSIGNED_BYTE&&(Me=r.R8)),H===r.RG&&(ne===r.FLOAT&&(Me=r.RG32F),ne===r.HALF_FLOAT&&(Me=r.RG16F),ne===r.UNSIGNED_BYTE&&(Me=r.RG8)),H===r.RGBA&&(ne===r.FLOAT&&(Me=r.RGBA32F),ne===r.HALF_FLOAT&&(Me=r.RGBA16F),ne===r.UNSIGNED_BYTE&&(Me=we===Mt&&be===!1?r.SRGB8_ALPHA8:r.RGBA8),ne===r.UNSIGNED_SHORT_4_4_4_4&&(Me=r.RGBA4),ne===r.UNSIGNED_SHORT_5_5_5_1&&(Me=r.RGB5_A1)),(Me===r.R16F||Me===r.R32F||Me===r.RG16F||Me===r.RG32F||Me===r.RGBA16F||Me===r.RGBA32F)&&e.get("EXT_color_buffer_float"),Me}function C(j,H,ne){return M(j,ne)===!0||j.isFramebufferTexture&&j.minFilter!==Dn&&j.minFilter!==fn?Math.log2(Math.max(H.width,H.height))+1:j.mipmaps!==void 0&&j.mipmaps.length>0?j.mipmaps.length:j.isCompressedTexture&&Array.isArray(j.image)?H.mipmaps.length:1}function L(j){return j===Dn||j===Id||j===vu?r.NEAREST:r.LINEAR}function F(j){const H=j.target;H.removeEventListener("dispose",F),I(H),H.isVideoTexture&&v.delete(H)}function N(j){const H=j.target;H.removeEventListener("dispose",N),q(H)}function I(j){const H=n.get(j);if(H.__webglInit===void 0)return;const ne=j.source,we=y.get(ne);if(we){const be=we[H.__cacheKey];be.usedTimes--,be.usedTimes===0&&X(j),Object.keys(we).length===0&&y.delete(ne)}n.remove(j)}function X(j){const H=n.get(j);r.deleteTexture(H.__webglTexture);const ne=j.source,we=y.get(ne);delete we[H.__cacheKey],o.memory.textures--}function q(j){const H=j.texture,ne=n.get(j),we=n.get(H);if(we.__webglTexture!==void 0&&(r.deleteTexture(we.__webglTexture),o.memory.textures--),j.depthTexture&&j.depthTexture.dispose(),j.isWebGLCubeRenderTarget)for(let be=0;be<6;be++)r.deleteFramebuffer(ne.__webglFramebuffer[be]),ne.__webglDepthbuffer&&r.deleteRenderbuffer(ne.__webglDepthbuffer[be]);else{if(r.deleteFramebuffer(ne.__webglFramebuffer),ne.__webglDepthbuffer&&r.deleteRenderbuffer(ne.__webglDepthbuffer),ne.__webglMultisampledFramebuffer&&r.deleteFramebuffer(ne.__webglMultisampledFramebuffer),ne.__webglColorRenderbuffer)for(let be=0;be=l&&console.warn("THREE.WebGLTextures: Trying to use "+j+" texture units while this GPU supports only "+l),W+=1,j}function G(j){const H=[];return H.push(j.wrapS),H.push(j.wrapT),H.push(j.wrapR||0),H.push(j.magFilter),H.push(j.minFilter),H.push(j.anisotropy),H.push(j.internalFormat),H.push(j.format),H.push(j.type),H.push(j.generateMipmaps),H.push(j.premultiplyAlpha),H.push(j.flipY),H.push(j.unpackAlignment),H.push(j.colorSpace),H.join()}function B(j,H){const ne=n.get(j);if(j.isVideoTexture&&ge(j),j.isRenderTargetTexture===!1&&j.version>0&&ne.__version!==j.version){const we=j.image;if(we===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(we.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ae(ne,j,H);return}}t.bindTexture(r.TEXTURE_2D,ne.__webglTexture,r.TEXTURE0+H)}function D(j,H){const ne=n.get(j);if(j.version>0&&ne.__version!==j.version){Ae(ne,j,H);return}t.bindTexture(r.TEXTURE_2D_ARRAY,ne.__webglTexture,r.TEXTURE0+H)}function V(j,H){const ne=n.get(j);if(j.version>0&&ne.__version!==j.version){Ae(ne,j,H);return}t.bindTexture(r.TEXTURE_3D,ne.__webglTexture,r.TEXTURE0+H)}function Z(j,H){const ne=n.get(j);if(j.version>0&&ne.__version!==j.version){Ee(ne,j,H);return}t.bindTexture(r.TEXTURE_CUBE_MAP,ne.__webglTexture,r.TEXTURE0+H)}const ee={[Pu]:r.REPEAT,[vi]:r.CLAMP_TO_EDGE,[Lu]:r.MIRRORED_REPEAT},ie={[Dn]:r.NEAREST,[Id]:r.NEAREST_MIPMAP_NEAREST,[vu]:r.NEAREST_MIPMAP_LINEAR,[fn]:r.LINEAR,[jv]:r.LINEAR_MIPMAP_NEAREST,[So]:r.LINEAR_MIPMAP_LINEAR},ue={[$b]:r.NEVER,[rM]:r.ALWAYS,[Jb]:r.LESS,[eM]:r.LEQUAL,[Qb]:r.EQUAL,[iM]:r.GEQUAL,[tM]:r.GREATER,[nM]:r.NOTEQUAL};function ce(j,H,ne){if(ne?(r.texParameteri(j,r.TEXTURE_WRAP_S,ee[H.wrapS]),r.texParameteri(j,r.TEXTURE_WRAP_T,ee[H.wrapT]),(j===r.TEXTURE_3D||j===r.TEXTURE_2D_ARRAY)&&r.texParameteri(j,r.TEXTURE_WRAP_R,ee[H.wrapR]),r.texParameteri(j,r.TEXTURE_MAG_FILTER,ie[H.magFilter]),r.texParameteri(j,r.TEXTURE_MIN_FILTER,ie[H.minFilter])):(r.texParameteri(j,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(j,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(j===r.TEXTURE_3D||j===r.TEXTURE_2D_ARRAY)&&r.texParameteri(j,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(H.wrapS!==vi||H.wrapT!==vi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(j,r.TEXTURE_MAG_FILTER,L(H.magFilter)),r.texParameteri(j,r.TEXTURE_MIN_FILTER,L(H.minFilter)),H.minFilter!==Dn&&H.minFilter!==fn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),H.compareFunction&&(r.texParameteri(j,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(j,r.TEXTURE_COMPARE_FUNC,ue[H.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const we=e.get("EXT_texture_filter_anisotropic");if(H.magFilter===Dn||H.minFilter!==vu&&H.minFilter!==So||H.type===rs&&e.has("OES_texture_float_linear")===!1||a===!1&&H.type===Vl&&e.has("OES_texture_half_float_linear")===!1)return;(H.anisotropy>1||n.get(H).__currentAnisotropy)&&(r.texParameterf(j,we.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(H.anisotropy,i.getMaxAnisotropy())),n.get(H).__currentAnisotropy=H.anisotropy)}}function le(j,H){let ne=!1;j.__webglInit===void 0&&(j.__webglInit=!0,H.addEventListener("dispose",F));const we=H.source;let be=y.get(we);be===void 0&&(be={},y.set(we,be));const Me=G(H);if(Me!==j.__cacheKey){be[Me]===void 0&&(be[Me]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,ne=!0),be[Me].usedTimes++;const Fe=be[j.__cacheKey];Fe!==void 0&&(be[j.__cacheKey].usedTimes--,Fe.usedTimes===0&&X(H)),j.__cacheKey=Me,j.__webglTexture=be[Me].texture}return ne}function Ae(j,H,ne){let we=r.TEXTURE_2D;(H.isDataArrayTexture||H.isCompressedArrayTexture)&&(we=r.TEXTURE_2D_ARRAY),H.isData3DTexture&&(we=r.TEXTURE_3D);const be=le(j,H),Me=H.source;t.bindTexture(we,j.__webglTexture,r.TEXTURE0+ne);const Fe=n.get(Me);if(Me.version!==Fe.__version||be===!0){t.activeTexture(r.TEXTURE0+ne),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,H.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,H.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE);const Ue=b(H)&&E(H.image)===!1;let xe=w(H.image,Ue,!1,u);xe=He(H,xe);const Be=E(xe)||a,$e=s.convert(H.format,H.colorSpace);let Ve=s.convert(H.type),Oe=P(H.internalFormat,$e,Ve,H.colorSpace);ce(we,H,Be);let We;const nt=H.mipmaps,pt=a&&H.isVideoTexture!==!0,re=Fe.__version===void 0||be===!0,ze=C(H,xe,Be);if(H.isDepthTexture)Oe=r.DEPTH_COMPONENT,a?H.type===rs?Oe=r.DEPTH_COMPONENT32F:H.type===Ns?Oe=r.DEPTH_COMPONENT24:H.type===mo?Oe=r.DEPTH24_STENCIL8:Oe=r.DEPTH_COMPONENT16:H.type===rs&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),H.format===go&&Oe===r.DEPTH_COMPONENT&&H.type!==Kd&&H.type!==Ns&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),H.type=Ns,Ve=s.convert(H.type)),H.format===xa&&Oe===r.DEPTH_COMPONENT&&(Oe=r.DEPTH_STENCIL,H.type!==mo&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),H.type=mo,Ve=s.convert(H.type))),re&&(pt?t.texStorage2D(r.TEXTURE_2D,1,Oe,xe.width,xe.height):t.texImage2D(r.TEXTURE_2D,0,Oe,xe.width,xe.height,0,$e,Ve,null));else if(H.isDataTexture)if(nt.length>0&&Be){pt&&re&&t.texStorage2D(r.TEXTURE_2D,ze,Oe,nt[0].width,nt[0].height);for(let ve=0,Ge=nt.length;ve>=1,Ge>>=1}}else if(nt.length>0&&Be){pt&&re&&t.texStorage2D(r.TEXTURE_2D,ze,Oe,nt[0].width,nt[0].height);for(let ve=0,Ge=nt.length;ve0&&re++,t.texStorage2D(r.TEXTURE_CUBE_MAP,re,We,xe[0].width,xe[0].height));for(let ve=0;ve<6;ve++)if(Ue){nt?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0,0,0,xe[ve].width,xe[ve].height,Ve,Oe,xe[ve].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+ve,0,We,xe[ve].width,xe[ve].height,0,Ve,Oe,xe[ve].data);for(let Ge=0;Ge=r.TEXTURE_CUBE_MAP_POSITIVE_X&&be<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,we,be,n.get(ne).__webglTexture,0),t.bindFramebuffer(r.FRAMEBUFFER,null)}function z(j,H,ne){if(r.bindRenderbuffer(r.RENDERBUFFER,j),H.depthBuffer&&!H.stencilBuffer){let we=r.DEPTH_COMPONENT16;if(ne||Le(H)){const be=H.depthTexture;be&&be.isDepthTexture&&(be.type===rs?we=r.DEPTH_COMPONENT32F:be.type===Ns&&(we=r.DEPTH_COMPONENT24));const Me=Se(H);Le(H)?p.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,Me,we,H.width,H.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,Me,we,H.width,H.height)}else r.renderbufferStorage(r.RENDERBUFFER,we,H.width,H.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,j)}else if(H.depthBuffer&&H.stencilBuffer){const we=Se(H);ne&&Le(H)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,we,r.DEPTH24_STENCIL8,H.width,H.height):Le(H)?p.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,we,r.DEPTH24_STENCIL8,H.width,H.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,H.width,H.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,j)}else{const we=H.isWebGLMultipleRenderTargets===!0?H.texture:[H.texture];for(let be=0;be0&&Le(j)===!1){const Ue=Me?H:[H];ne.__webglMultisampledFramebuffer=r.createFramebuffer(),ne.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,ne.__webglMultisampledFramebuffer);for(let xe=0;xe0&&Le(j)===!1){const H=j.isWebGLMultipleRenderTargets?j.texture:[j.texture],ne=j.width,we=j.height;let be=r.COLOR_BUFFER_BIT;const Me=[],Fe=j.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,Ue=n.get(j),xe=j.isWebGLMultipleRenderTargets===!0;if(xe)for(let Be=0;Be0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&H.__useRenderToTexture!==!1}function ge(j){const H=o.render.frame;v.get(j)!==H&&(v.set(j,H),j.update())}function He(j,H){const ne=j.colorSpace,we=j.format,be=j.type;return j.isCompressedTexture===!0||j.format===Dd||ne!==Br&&ne!==yo&&(ne===Mt?a===!1?e.has("EXT_sRGB")===!0&&we===Bi?(j.format=Dd,j.minFilter=fn,j.generateMipmaps=!1):H=ry.sRGBToLinear(H):(we!==Bi||be!==os)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",ne)),H}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=B,this.setTexture2DArray=D,this.setTexture3D=V,this.setTextureCube=Z,this.rebindTextures=se,this.setupRenderTarget=$,this.updateRenderTargetMipmap=Ie,this.updateMultisampleRenderTarget=de,this.setupDepthRenderbuffer=te,this.setupFrameBufferTexture=ae,this.useMultisampledRTT=Le}function gM(r,e,t){const n=t.isWebGL2;function i(s,o=yo){let a;if(s===os)return r.UNSIGNED_BYTE;if(s===qv)return r.UNSIGNED_SHORT_4_4_4_4;if(s===Zv)return r.UNSIGNED_SHORT_5_5_5_1;if(s===Nb)return r.BYTE;if(s===Fb)return r.SHORT;if(s===Kd)return r.UNSIGNED_SHORT;if(s===Yv)return r.INT;if(s===Ns)return r.UNSIGNED_INT;if(s===rs)return r.FLOAT;if(s===Vl)return n?r.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===kb)return r.ALPHA;if(s===Bi)return r.RGBA;if(s===zb)return r.LUMINANCE;if(s===Bb)return r.LUMINANCE_ALPHA;if(s===go)return r.DEPTH_COMPONENT;if(s===xa)return r.DEPTH_STENCIL;if(s===Dd)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Gb)return r.RED;if(s===Kv)return r.RED_INTEGER;if(s===Hb)return r.RG;if(s===$v)return r.RG_INTEGER;if(s===Jv)return r.RGBA_INTEGER;if(s===vd||s===yd||s===_d||s===xd)if(o===Mt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===vd)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===yd)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===_d)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===xd)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===vd)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===yd)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===_d)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===xd)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===F0||s===k0||s===z0||s===B0)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===F0)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===k0)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===z0)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===B0)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Vb)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===G0||s===H0)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===G0)return o===Mt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===H0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===V0||s===W0||s===X0||s===j0||s===Y0||s===q0||s===Z0||s===K0||s===$0||s===J0||s===Q0||s===ev||s===tv||s===nv)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===V0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===W0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===X0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===j0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Y0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===q0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Z0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===K0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===$0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===J0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===Q0)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===ev)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===tv)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===nv)return o===Mt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===wd)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===wd)return o===Mt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===Wb||s===iv||s===rv||s===sv)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===wd)return a.COMPRESSED_RED_RGTC1_EXT;if(s===iv)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===rv)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===sv)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===mo?n?r.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class vM extends zn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ol extends jt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const qD={type:"move"};class tg{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ol,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 Ol,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Y,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Y),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ol,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Y,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Y),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 n of e.hand.values())this._getHandJoint(t,n)}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,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const _ of e.hand.values()){const y=t.getJointPose(_,n),g=this._getHandJoint(c,_);y!==null&&(g.matrix.fromArray(y.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=y.radius),g.visible=y!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],p=u.position.distanceTo(h.position),m=.02,v=.005;c.inputState.pinching&&p>m+v?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&p<=m-v&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),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,n),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(qD)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new Ol;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class yM extends Sn{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:go,u!==go&&u!==xa)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===go&&(n=Ns),n===void 0&&u===xa&&(n=mo),super(null,i,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Dn,this.minFilter=l!==void 0?l:Dn,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class ZD extends Hs{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,h=null,p=null,m=null,v=null;const _=t.getContextAttributes();let y=null,g=null;const x=[],w=[],E=new zn;E.layers.enable(1),E.viewport=new Xt;const b=new zn;b.layers.enable(2),b.viewport=new Xt;const M=[E,b],A=new vM;A.layers.enable(1),A.layers.enable(2);let P=null,C=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(D){let V=x[D];return V===void 0&&(V=new tg,x[D]=V),V.getTargetRaySpace()},this.getControllerGrip=function(D){let V=x[D];return V===void 0&&(V=new tg,x[D]=V),V.getGripSpace()},this.getHand=function(D){let V=x[D];return V===void 0&&(V=new tg,x[D]=V),V.getHandSpace()};function L(D){const V=w.indexOf(D.inputSource);if(V===-1)return;const Z=x[V];Z!==void 0&&(Z.update(D.inputSource,D.frame,c||o),Z.dispatchEvent({type:D.type,data:D.inputSource}))}function F(){i.removeEventListener("select",L),i.removeEventListener("selectstart",L),i.removeEventListener("selectend",L),i.removeEventListener("squeeze",L),i.removeEventListener("squeezestart",L),i.removeEventListener("squeezeend",L),i.removeEventListener("end",F),i.removeEventListener("inputsourceschange",N);for(let D=0;D=0&&(w[ee]=null,x[ee].disconnect(Z))}for(let V=0;V=w.length){w.push(Z),ee=ue;break}else if(w[ue]===null){w[ue]=Z,ee=ue;break}if(ee===-1)break}const ie=x[ee];ie&&ie.connect(Z)}}const I=new Y,X=new Y;function q(D,V,Z){I.setFromMatrixPosition(V.matrixWorld),X.setFromMatrixPosition(Z.matrixWorld);const ee=I.distanceTo(X),ie=V.projectionMatrix.elements,ue=Z.projectionMatrix.elements,ce=ie[14]/(ie[10]-1),le=ie[14]/(ie[10]+1),Ae=(ie[9]+1)/ie[5],Ee=(ie[9]-1)/ie[5],ae=(ie[8]-1)/ie[0],z=(ue[8]+1)/ue[0],oe=ce*ae,te=ce*z,se=ee/(-ae+z),$=se*-ae;V.matrixWorld.decompose(D.position,D.quaternion,D.scale),D.translateX($),D.translateZ(se),D.matrixWorld.compose(D.position,D.quaternion,D.scale),D.matrixWorldInverse.copy(D.matrixWorld).invert();const Ie=ce+se,de=le+se,Se=oe-$,Le=te+(ee-$),ge=Ae*le/de*Ie,He=Ee*le/de*Ie;D.projectionMatrix.makePerspective(Se,Le,ge,He,Ie,de),D.projectionMatrixInverse.copy(D.projectionMatrix).invert()}function W(D,V){V===null?D.matrixWorld.copy(D.matrix):D.matrixWorld.multiplyMatrices(V.matrixWorld,D.matrix),D.matrixWorldInverse.copy(D.matrixWorld).invert()}this.updateCamera=function(D){if(i===null)return;A.near=b.near=E.near=D.near,A.far=b.far=E.far=D.far,(P!==A.near||C!==A.far)&&(i.updateRenderState({depthNear:A.near,depthFar:A.far}),P=A.near,C=A.far);const V=D.parent,Z=A.cameras;W(A,V);for(let ee=0;ee0&&(y.alphaTest.value=g.alphaTest);const x=e.get(g).envMap;if(x&&(y.envMap.value=x,y.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,y.reflectivity.value=g.reflectivity,y.ior.value=g.ior,y.refractionRatio.value=g.refractionRatio),g.lightMap){y.lightMap.value=g.lightMap;const w=r.useLegacyLights===!0?Math.PI:1;y.lightMapIntensity.value=g.lightMapIntensity*w,t(g.lightMap,y.lightMapTransform)}g.aoMap&&(y.aoMap.value=g.aoMap,y.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,y.aoMapTransform))}function o(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,g.map&&(y.map.value=g.map,t(g.map,y.mapTransform))}function a(y,g){y.dashSize.value=g.dashSize,y.totalSize.value=g.dashSize+g.gapSize,y.scale.value=g.scale}function l(y,g,x,w){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.size.value=g.size*x,y.scale.value=w*.5,g.map&&(y.map.value=g.map,t(g.map,y.uvTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,t(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function c(y,g){y.diffuse.value.copy(g.color),y.opacity.value=g.opacity,y.rotation.value=g.rotation,g.map&&(y.map.value=g.map,t(g.map,y.mapTransform)),g.alphaMap&&(y.alphaMap.value=g.alphaMap,t(g.alphaMap,y.alphaMapTransform)),g.alphaTest>0&&(y.alphaTest.value=g.alphaTest)}function u(y,g){y.specular.value.copy(g.specular),y.shininess.value=Math.max(g.shininess,1e-4)}function h(y,g){g.gradientMap&&(y.gradientMap.value=g.gradientMap)}function p(y,g){y.metalness.value=g.metalness,g.metalnessMap&&(y.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,y.metalnessMapTransform)),y.roughness.value=g.roughness,g.roughnessMap&&(y.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,y.roughnessMapTransform)),e.get(g).envMap&&(y.envMapIntensity.value=g.envMapIntensity)}function m(y,g,x){y.ior.value=g.ior,g.sheen>0&&(y.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),y.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(y.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,y.sheenColorMapTransform)),g.sheenRoughnessMap&&(y.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,y.sheenRoughnessMapTransform))),g.clearcoat>0&&(y.clearcoat.value=g.clearcoat,y.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(y.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,y.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(y.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===yi&&y.clearcoatNormalScale.value.negate())),g.iridescence>0&&(y.iridescence.value=g.iridescence,y.iridescenceIOR.value=g.iridescenceIOR,y.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(y.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,y.iridescenceMapTransform)),g.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),g.transmission>0&&(y.transmission.value=g.transmission,y.transmissionSamplerMap.value=x.texture,y.transmissionSamplerSize.value.set(x.width,x.height),g.transmissionMap&&(y.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,y.transmissionMapTransform)),y.thickness.value=g.thickness,g.thicknessMap&&(y.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=g.attenuationDistance,y.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(y.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(y.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=g.specularIntensity,y.specularColor.value.copy(g.specularColor),g.specularColorMap&&(y.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,y.specularColorMapTransform)),g.specularIntensityMap&&(y.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,y.specularIntensityMapTransform))}function v(y,g){g.matcap&&(y.matcap.value=g.matcap)}function _(y,g){const x=e.get(g).light;y.referencePosition.value.setFromMatrixPosition(x.matrixWorld),y.nearDistance.value=x.shadow.camera.near,y.farDistance.value=x.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function $D(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(x,w){const E=w.program;n.uniformBlockBinding(x,E)}function c(x,w){let E=i[x.id];E===void 0&&(v(x),E=u(x),i[x.id]=E,x.addEventListener("dispose",y));const b=w.program;n.updateUBOMapping(x,b);const M=e.render.frame;s[x.id]!==M&&(p(x),s[x.id]=M)}function u(x){const w=h();x.__bindingPointIndex=w;const E=r.createBuffer(),b=x.__size,M=x.usage;return r.bindBuffer(r.UNIFORM_BUFFER,E),r.bufferData(r.UNIFORM_BUFFER,b,M),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,w,E),E}function h(){for(let x=0;x0){M=E%b;const N=b-M;M!==0&&N-L.boundary<0&&(E+=b-M,C.__offset=E)}E+=L.storage}return M=E%b,M>0&&(E+=b-M),x.__size=E,x.__cache={},this}function _(x){const w={boundary:0,storage:0};return typeof x=="number"?(w.boundary=4,w.storage=4):x.isVector2?(w.boundary=8,w.storage=8):x.isVector3||x.isColor?(w.boundary=16,w.storage=12):x.isVector4?(w.boundary=16,w.storage=16):x.isMatrix3?(w.boundary=48,w.storage=48):x.isMatrix4?(w.boundary=64,w.storage=64):x.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",x),w}function y(x){const w=x.target;w.removeEventListener("dispose",y);const E=o.indexOf(w.__bindingPointIndex);o.splice(E,1),r.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function g(){for(const x in i)r.deleteBuffer(i[x]);o=[],i={},s={}}return{bind:l,update:c,dispose:g}}function JD(){const r=Fu("canvas");return r.style.display="block",r}class uy{constructor(e={}){const{canvas:t=JD(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let p;n!==null?p=n.getContextAttributes().alpha:p=o;const m=new Uint32Array(4),v=new Int32Array(4);let _=null,y=null;const g=[],x=[];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=Mt,this.useLegacyLights=!0,this.toneMapping=zr,this.toneMappingExposure=1;const w=this;let E=!1,b=0,M=0,A=null,P=-1,C=null;const L=new Xt,F=new Xt;let N=null;const I=new Ke(0);let X=0,q=t.width,W=t.height,O=1,k=null,G=null;const B=new Xt(0,0,q,W),D=new Xt(0,0,q,W);let V=!1;const Z=new oh;let ee=!1,ie=!1,ue=null;const ce=new yt,le=new De,Ae=new Y,Ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ae(){return A===null?O:1}let z=n;function oe(J,me){for(let Re=0;Re0?y=x[x.length-1]:y=null,g.pop(),g.length>0?_=g[g.length-1]:_=null};function li(J,me,Re,pe){if(J.visible===!1)return;if(J.layers.test(me.layers)){if(J.isGroup)Re=J.renderOrder;else if(J.isLOD)J.autoUpdate===!0&&J.update(me);else if(J.isLight)y.pushLight(J),J.castShadow&&y.pushShadow(J);else if(J.isSprite){if(!J.frustumCulled||Z.intersectsSprite(J)){pe&&Ae.setFromMatrixPosition(J.matrixWorld).applyMatrix4(ce);const lt=H.update(J),ct=J.material;ct.visible&&_.push(J,lt,ct,Re,Ae.z,null)}}else if((J.isMesh||J.isLine||J.isPoints)&&(!J.frustumCulled||Z.intersectsObject(J))){const lt=H.update(J),ct=J.material;if(pe&&(J.boundingSphere!==void 0?(J.boundingSphere===null&&J.computeBoundingSphere(),Ae.copy(J.boundingSphere.center)):(lt.boundingSphere===null&<.computeBoundingSphere(),Ae.copy(lt.boundingSphere.center)),Ae.applyMatrix4(J.matrixWorld).applyMatrix4(ce)),Array.isArray(ct)){const dt=lt.groups;for(let wt=0,ke=dt.length;wt0&&Bt(Pe,it,me,Re),pe&&$.viewport(L.copy(pe)),Pe.length>0&&sn(Pe,me,Re),it.length>0&&sn(it,me,Re),lt.length>0&&sn(lt,me,Re),$.buffers.depth.setTest(!0),$.buffers.depth.setMask(!0),$.buffers.color.setMask(!0),$.setPolygonOffset(!1)}function Bt(J,me,Re,pe){const Pe=se.isWebGL2;ue===null&&(ue=new Gr(1,1,{generateMipmaps:!0,type:te.has("EXT_color_buffer_half_float")?Vl:os,minFilter:So,samples:Pe?4:0})),w.getDrawingBufferSize(le),Pe?ue.setSize(le.x,le.y):ue.setSize(Ud(le.x),Ud(le.y));const it=w.getRenderTarget();w.setRenderTarget(ue),w.getClearColor(I),X=w.getClearAlpha(),X<1&&w.setClearColor(16777215,.5),w.clear();const lt=w.toneMapping;w.toneMapping=zr,sn(J,Re,pe),Se.updateMultisampleRenderTarget(ue),Se.updateRenderTargetMipmap(ue);let ct=!1;for(let dt=0,wt=me.length;dt0),ut=!!Re.morphAttributes.position,Jt=!!Re.morphAttributes.normal,Gt=!!Re.morphAttributes.color,Yn=pe.toneMapped?w.toneMapping:zr,ci=Re.morphAttributes.position||Re.morphAttributes.normal||Re.morphAttributes.color,qt=ci!==void 0?ci.length:0,mt=de.get(pe),kt=y.state.lights;if(ee===!0&&(ie===!0||J!==C)){const Un=J===C&&pe.id===P;Fe.setState(pe,J,Un)}let gt=!1;pe.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==kt.state.version||mt.outputColorSpace!==ct||Pe.isInstancedMesh&&mt.instancing===!1||!Pe.isInstancedMesh&&mt.instancing===!0||Pe.isSkinnedMesh&&mt.skinning===!1||!Pe.isSkinnedMesh&&mt.skinning===!0||mt.envMap!==dt||pe.fog===!0&&mt.fog!==it||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==Fe.numPlanes||mt.numIntersection!==Fe.numIntersection)||mt.vertexAlphas!==wt||mt.vertexTangents!==ke||mt.morphTargets!==ut||mt.morphNormals!==Jt||mt.morphColors!==Gt||mt.toneMapping!==Yn||se.isWebGL2===!0&&mt.morphTargetsCount!==qt)&&(gt=!0):(gt=!0,mt.__version=pe.version);let Cn=mt.currentProgram;gt===!0&&(Cn=tn(pe,me,Pe));let En=!1,cn=!1,Ii=!1;const Qt=Cn.getUniforms(),on=mt.uniforms;if($.useProgram(Cn.program)&&(En=!0,cn=!0,Ii=!0),pe.id!==P&&(P=pe.id,cn=!0),En||C!==J){if(Qt.setValue(z,"projectionMatrix",J.projectionMatrix),se.logarithmicDepthBuffer&&Qt.setValue(z,"logDepthBufFC",2/(Math.log(J.far+1)/Math.LN2)),C!==J&&(C=J,cn=!0,Ii=!0),pe.isShaderMaterial||pe.isMeshPhongMaterial||pe.isMeshToonMaterial||pe.isMeshStandardMaterial||pe.envMap){const Un=Qt.map.cameraPosition;Un!==void 0&&Un.setValue(z,Ae.setFromMatrixPosition(J.matrixWorld))}(pe.isMeshPhongMaterial||pe.isMeshToonMaterial||pe.isMeshLambertMaterial||pe.isMeshBasicMaterial||pe.isMeshStandardMaterial||pe.isShaderMaterial)&&Qt.setValue(z,"isOrthographic",J.isOrthographicCamera===!0),(pe.isMeshPhongMaterial||pe.isMeshToonMaterial||pe.isMeshLambertMaterial||pe.isMeshBasicMaterial||pe.isMeshStandardMaterial||pe.isShaderMaterial||pe.isShadowMaterial||Pe.isSkinnedMesh)&&Qt.setValue(z,"viewMatrix",J.matrixWorldInverse)}if(Pe.isSkinnedMesh){Qt.setOptional(z,Pe,"bindMatrix"),Qt.setOptional(z,Pe,"bindMatrixInverse");const Un=Pe.skeleton;Un&&(se.floatVertexTextures?(Un.boneTexture===null&&Un.computeBoneTexture(),Qt.setValue(z,"boneTexture",Un.boneTexture,Se),Qt.setValue(z,"boneTextureSize",Un.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const xi=Re.morphAttributes;if((xi.position!==void 0||xi.normal!==void 0||xi.color!==void 0&&se.isWebGL2===!0)&&Be.update(Pe,Re,Cn),(cn||mt.receiveShadow!==Pe.receiveShadow)&&(mt.receiveShadow=Pe.receiveShadow,Qt.setValue(z,"receiveShadow",Pe.receiveShadow)),pe.isMeshGouraudMaterial&&pe.envMap!==null&&(on.envMap.value=dt,on.flipEnvMap.value=dt.isCubeTexture&&dt.isRenderTargetTexture===!1?-1:1),cn&&(Qt.setValue(z,"toneMappingExposure",w.toneMappingExposure),mt.needsLights&&sr(on,Ii),it&&pe.fog===!0&&we.refreshFogUniforms(on,it),we.refreshMaterialUniforms(on,pe,O,W,ue),bd.upload(z,mt.uniformsList,on,Se)),pe.isShaderMaterial&&pe.uniformsNeedUpdate===!0&&(bd.upload(z,mt.uniformsList,on,Se),pe.uniformsNeedUpdate=!1),pe.isSpriteMaterial&&Qt.setValue(z,"center",Pe.center),Qt.setValue(z,"modelViewMatrix",Pe.modelViewMatrix),Qt.setValue(z,"normalMatrix",Pe.normalMatrix),Qt.setValue(z,"modelMatrix",Pe.matrixWorld),pe.isShaderMaterial||pe.isRawShaderMaterial){const Un=pe.uniformsGroups;for(let Xr=0,jr=Un.length;Xr0&&Se.useMultisampledRTT(J)===!1?Pe=de.get(J).__webglMultisampledFramebuffer:Pe=ke,L.copy(J.viewport),F.copy(J.scissor),N=J.scissorTest}else L.copy(B).multiplyScalar(O).floor(),F.copy(D).multiplyScalar(O).floor(),N=V;if($.bindFramebuffer(z.FRAMEBUFFER,Pe)&&se.drawBuffers&&pe&&$.drawBuffers(J,Pe),$.viewport(L),$.scissor(F),$.setScissorTest(N),it){const dt=de.get(J.texture);z.framebufferTexture2D(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,z.TEXTURE_CUBE_MAP_POSITIVE_X+me,dt.__webglTexture,Re)}else if(lt){const dt=de.get(J.texture),wt=me||0;z.framebufferTextureLayer(z.FRAMEBUFFER,z.COLOR_ATTACHMENT0,dt.__webglTexture,Re||0,wt)}P=-1},this.readRenderTargetPixels=function(J,me,Re,pe,Pe,it,lt){if(!(J&&J.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ct=de.get(J).__webglFramebuffer;if(J.isWebGLCubeRenderTarget&<!==void 0&&(ct=ct[lt]),ct){$.bindFramebuffer(z.FRAMEBUFFER,ct);try{const dt=J.texture,wt=dt.format,ke=dt.type;if(wt!==Bi&&Oe.convert(wt)!==z.getParameter(z.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ut=ke===Vl&&(te.has("EXT_color_buffer_half_float")||se.isWebGL2&&te.has("EXT_color_buffer_float"));if(ke!==os&&Oe.convert(ke)!==z.getParameter(z.IMPLEMENTATION_COLOR_READ_TYPE)&&!(ke===rs&&(se.isWebGL2||te.has("OES_texture_float")||te.has("WEBGL_color_buffer_float")))&&!ut){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}me>=0&&me<=J.width-pe&&Re>=0&&Re<=J.height-Pe&&z.readPixels(me,Re,pe,Pe,Oe.convert(wt),Oe.convert(ke),it)}finally{const dt=A!==null?de.get(A).__webglFramebuffer:null;$.bindFramebuffer(z.FRAMEBUFFER,dt)}}},this.copyFramebufferToTexture=function(J,me,Re=0){const pe=Math.pow(2,-Re),Pe=Math.floor(me.image.width*pe),it=Math.floor(me.image.height*pe);Se.setTexture2D(me,0),z.copyTexSubImage2D(z.TEXTURE_2D,Re,0,0,J.x,J.y,Pe,it),$.unbindTexture()},this.copyTextureToTexture=function(J,me,Re,pe=0){const Pe=me.image.width,it=me.image.height,lt=Oe.convert(Re.format),ct=Oe.convert(Re.type);Se.setTexture2D(Re,0),z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,Re.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Re.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,Re.unpackAlignment),me.isDataTexture?z.texSubImage2D(z.TEXTURE_2D,pe,J.x,J.y,Pe,it,lt,ct,me.image.data):me.isCompressedTexture?z.compressedTexSubImage2D(z.TEXTURE_2D,pe,J.x,J.y,me.mipmaps[0].width,me.mipmaps[0].height,lt,me.mipmaps[0].data):z.texSubImage2D(z.TEXTURE_2D,pe,J.x,J.y,lt,ct,me.image),pe===0&&Re.generateMipmaps&&z.generateMipmap(z.TEXTURE_2D),$.unbindTexture()},this.copyTextureToTexture3D=function(J,me,Re,pe,Pe=0){if(w.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const it=J.max.x-J.min.x+1,lt=J.max.y-J.min.y+1,ct=J.max.z-J.min.z+1,dt=Oe.convert(pe.format),wt=Oe.convert(pe.type);let ke;if(pe.isData3DTexture)Se.setTexture3D(pe,0),ke=z.TEXTURE_3D;else if(pe.isDataArrayTexture)Se.setTexture2DArray(pe,0),ke=z.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}z.pixelStorei(z.UNPACK_FLIP_Y_WEBGL,pe.flipY),z.pixelStorei(z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,pe.premultiplyAlpha),z.pixelStorei(z.UNPACK_ALIGNMENT,pe.unpackAlignment);const ut=z.getParameter(z.UNPACK_ROW_LENGTH),Jt=z.getParameter(z.UNPACK_IMAGE_HEIGHT),Gt=z.getParameter(z.UNPACK_SKIP_PIXELS),Yn=z.getParameter(z.UNPACK_SKIP_ROWS),ci=z.getParameter(z.UNPACK_SKIP_IMAGES),qt=Re.isCompressedTexture?Re.mipmaps[0]:Re.image;z.pixelStorei(z.UNPACK_ROW_LENGTH,qt.width),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,qt.height),z.pixelStorei(z.UNPACK_SKIP_PIXELS,J.min.x),z.pixelStorei(z.UNPACK_SKIP_ROWS,J.min.y),z.pixelStorei(z.UNPACK_SKIP_IMAGES,J.min.z),Re.isDataTexture||Re.isData3DTexture?z.texSubImage3D(ke,Pe,me.x,me.y,me.z,it,lt,ct,dt,wt,qt.data):Re.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),z.compressedTexSubImage3D(ke,Pe,me.x,me.y,me.z,it,lt,ct,dt,qt.data)):z.texSubImage3D(ke,Pe,me.x,me.y,me.z,it,lt,ct,dt,wt,qt),z.pixelStorei(z.UNPACK_ROW_LENGTH,ut),z.pixelStorei(z.UNPACK_IMAGE_HEIGHT,Jt),z.pixelStorei(z.UNPACK_SKIP_PIXELS,Gt),z.pixelStorei(z.UNPACK_SKIP_ROWS,Yn),z.pixelStorei(z.UNPACK_SKIP_IMAGES,ci),Pe===0&&pe.generateMipmaps&&z.generateMipmap(ke),$.unbindTexture()},this.initTexture=function(J){J.isCubeTexture?Se.setTextureCube(J,0):J.isData3DTexture?Se.setTexture3D(J,0):J.isDataArrayTexture||J.isCompressedArrayTexture?Se.setTexture2DArray(J,0):Se.setTexture2D(J,0),$.unbindTexture()},this.resetState=function(){b=0,M=0,A=null,$.reset(),We.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ss}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===Mt?vo:ey}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===vo?Mt:Br}}class _M extends uy{}_M.prototype.isWebGL1Renderer=!0;class np{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ke(e),this.density=t}clone(){return new np(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class ip{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ke(e),this.near=t,this.far=n}clone(){return new ip(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class ku extends jt{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 rp{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ou,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=er()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;ie.far||t.push({distance:l,point:Dc.clone(),uv:zi.getInterpolation(Dc,Lf,Oc,If,A1,ng,C1,new De),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 Df(r,e,t,n,i,s){ml.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(Uc.x=s*ml.x-i*ml.y,Uc.y=i*ml.x+s*ml.y):Uc.copy(ml),r.copy(e),r.x+=Uc.x,r.y+=Uc.y,r.applyMatrix4(xM)}const Uf=new Y,R1=new Y;class SM extends jt{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 n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){Uf.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Uf);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Uf.setFromMatrixPosition(e.matrixWorld),R1.setFromMatrixPosition(this.matrixWorld);const n=Uf.distanceTo(R1)/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;il)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:w,face:null,faceIndex:null,object:this})}}else{const g=Math.max(0,o.start),x=Math.min(y.count,o.start+o.count);for(let w=g,E=x-1;wl)continue;p.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(p);Me.far||t.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class nU extends Sn{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:fn,this.magFilter=s!==void 0?s:fn,this.generateMipmaps=!1;const u=this;function h(){u.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 iU extends Sn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Dn,this.minFilter=Dn,this.generateMipmaps=!1,this.needsUpdate=!0}}class py extends Sn{constructor(e,t,n,i,s,o,a,l,c,u,h,p){super(null,o,a,l,c,u,i,s,h,p),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class rU extends py{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=vi}}class sU extends Sn{constructor(e,t,n,i,s,o,a,l,c){super(e,t,n,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Vr{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/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 n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=n[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,n[i]===o)return i/(s-1);const u=n[i],p=n[i+1]-u,m=(o-u)/p;return(i+m)/(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 De:new Y);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new Y,i=[],s=[],o=[],a=new Y,l=new yt;for(let m=0;m<=e;m++){const v=m/e;i[m]=this.getTangentAt(v,new Y)}s[0]=new Y,o[0]=new Y;let c=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),p=Math.abs(i[0].z);u<=c&&(c=u,n.set(1,0,0)),h<=c&&(c=h,n.set(0,1,0)),p<=c&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(i[m-1],i[m]),a.length()>Number.EPSILON){a.normalize();const v=Math.acos(Tn(i[m-1].dot(i[m]),-1,1));s[m].applyMatrix4(l.makeRotationAxis(a,v))}o[m].crossVectors(i[m],s[m])}if(t===!0){let m=Math.acos(Tn(s[0].dot(s[e]),-1,1));m/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let v=1;v<=e;v++)s[v].applyMatrix4(l.makeRotationAxis(i[v],m*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 op extends Vr{constructor(e=0,t=0,n=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=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const n=t||new De,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 c,u;this.closed||a>0?c=i[(a-1)%s]:(zf.subVectors(i[0],i[1]).add(i[0]),c=zf);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 n.set(X1(a,l.x,c.x,u.x,h.x),X1(a,l.y,c.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const o=i[s]-n,a=this.curves[s],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,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 n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),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 ah extends Tt{constructor(e=[new De(0,-.5),new De(.5,0),new De(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Tn(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],u=1/t,h=new Y,p=new De,m=new Y,v=new Y,_=new Y;let y=0,g=0;for(let x=0;x<=e.length-1;x++)switch(x){case 0:y=e[x+1].x-e[x].x,g=e[x+1].y-e[x].y,m.x=g*1,m.y=-y,m.z=g*0,_.copy(m),m.normalize(),l.push(m.x,m.y,m.z);break;case e.length-1:l.push(_.x,_.y,_.z);break;default:y=e[x+1].x-e[x].x,g=e[x+1].y-e[x].y,m.x=g*1,m.y=-y,m.z=g*0,v.copy(m),m.x+=_.x,m.y+=_.y,m.z+=_.z,m.normalize(),l.push(m.x,m.y,m.z),_.copy(v)}for(let x=0;x<=t;x++){const w=n+x*u*i,E=Math.sin(w),b=Math.cos(w);for(let M=0;M<=e.length-1;M++){h.x=e[M].x*E,h.y=e[M].y,h.z=e[M].x*b,o.push(h.x,h.y,h.z),p.x=x/t,p.y=M/(e.length-1),a.push(p.x,p.y);const A=l[3*M+0]*E,P=l[3*M+1],C=l[3*M+0]*b;c.push(A,P,C)}}for(let x=0;x0&&w(!0),t>0&&w(!1)),this.setIndex(u),this.setAttribute("position",new st(h,3)),this.setAttribute("normal",new st(p,3)),this.setAttribute("uv",new st(m,2));function x(){const E=new Y,b=new Y;let M=0;const A=(t-e)/n;for(let P=0;P<=s;P++){const C=[],L=P/s,F=L*(t-e)+e;for(let N=0;N<=i;N++){const I=N/i,X=I*l+a,q=Math.sin(X),W=Math.cos(X);b.x=F*q,b.y=-L*n+y,b.z=F*W,h.push(b.x,b.y,b.z),E.set(q,A,W).normalize(),p.push(E.x,E.y,E.z),m.push(I,1-L),C.push(v++)}_.push(C)}for(let P=0;P.9&&A<.1&&(w<.2&&(o[x+0]+=1),E<.2&&(o[x+2]+=1),b<.2&&(o[x+4]+=1))}}function p(x){s.push(x.x,x.y,x.z)}function m(x,w){const E=x*3;w.x=e[E+0],w.y=e[E+1],w.z=e[E+2]}function v(){const x=new Y,w=new Y,E=new Y,b=new Y,M=new De,A=new De,P=new De;for(let C=0,L=0;C80*t){a=c=r[0],l=u=r[1];for(let v=t;vc&&(c=h),p>u&&(u=p);m=Math.max(c-a,u-l),m=m!==0?32767/m:0}return Bu(s,o,t,a,l,m,0),o}};function IM(r,e,t,n,i){let s,o;if(i===RU(r,e,t,n)>0)for(s=e;s=e;s-=n)o=j1(s,r[s],r[s+1],o);return o&&dp(o,o.next)&&(Hu(o),o=o.next),o}function Ea(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(dp(t,t.next)||yn(t.prev,t,t.next)===0)){if(Hu(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function Bu(r,e,t,n,i,s,o){if(!r)return;!o&&s&&EU(r,n,i,s);let a=r,l,c;for(;r.prev!==r.next;){if(l=r.prev,c=r.next,s?mU(r,n,i,s):pU(r)){e.push(l.i/t|0),e.push(r.i/t|0),e.push(c.i/t|0),Hu(r),r=c.next,a=c.next;continue}if(r=c,r===a){o?o===1?(r=gU(Ea(r),e,t),Bu(r,e,t,n,i,s,2)):o===2&&vU(r,e,t,n,i,s):Bu(Ea(r),e,t,n,i,s,1);break}}}function pU(r){const e=r.prev,t=r,n=r.next;if(yn(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,a=e.y,l=t.y,c=n.y,u=is?i>o?i:o:s>o?s:o,m=a>l?a>c?a:c:l>c?l:c;let v=n.next;for(;v!==e;){if(v.x>=u&&v.x<=p&&v.y>=h&&v.y<=m&&Nl(i,a,s,l,o,c,v.x,v.y)&&yn(v.prev,v,v.next)>=0)return!1;v=v.next}return!0}function mU(r,e,t,n){const i=r.prev,s=r,o=r.next;if(yn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,u=i.y,h=s.y,p=o.y,m=al?a>c?a:c:l>c?l:c,y=u>h?u>p?u:p:h>p?h:p,g=hv(m,v,e,t,n),x=hv(_,y,e,t,n);let w=r.prevZ,E=r.nextZ;for(;w&&w.z>=g&&E&&E.z<=x;){if(w.x>=m&&w.x<=_&&w.y>=v&&w.y<=y&&w!==i&&w!==o&&Nl(a,u,l,h,c,p,w.x,w.y)&&yn(w.prev,w,w.next)>=0||(w=w.prevZ,E.x>=m&&E.x<=_&&E.y>=v&&E.y<=y&&E!==i&&E!==o&&Nl(a,u,l,h,c,p,E.x,E.y)&&yn(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;w&&w.z>=g;){if(w.x>=m&&w.x<=_&&w.y>=v&&w.y<=y&&w!==i&&w!==o&&Nl(a,u,l,h,c,p,w.x,w.y)&&yn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;E&&E.z<=x;){if(E.x>=m&&E.x<=_&&E.y>=v&&E.y<=y&&E!==i&&E!==o&&Nl(a,u,l,h,c,p,E.x,E.y)&&yn(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function gU(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!dp(i,s)&&DM(i,n,n.next,s)&&Gu(i,s)&&Gu(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),Hu(n),Hu(n.next),n=r=s),n=n.next}while(n!==r);return Ea(n)}function vU(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&TU(o,a)){let l=UM(o,a);o=Ea(o,o.next),l=Ea(l,l.next),Bu(o,e,t,n,i,s,0),Bu(l,e,t,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function yU(r,e,t,n){const i=[];let s,o,a,l,c;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>n&&(n=p,i=t.x=t.x&&t.x>=l&&s!==t.x&&Nl(oi.x||t.x===i.x&&SU(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function SU(r,e){return yn(r.prev,r,e.prev)<0&&yn(e.next,r,r.next)<0}function EU(r,e,t,n){let i=r;do i.z===0&&(i.z=hv(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,bU(i)}function bU(r){let e,t,n,i,s,o,a,l,c=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e0||l>0&&n;)a!==0&&(l===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,l--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,c*=2}while(o>1);return r}function hv(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function MU(r){let e=r,t=r;do(e.x=(r-o)*(s-a)&&(r-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(n-a)}function TU(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!AU(r,e)&&(Gu(r,e)&&Gu(e,r)&&CU(r,e)&&(yn(r.prev,r,e.prev)||yn(r,e.prev,e))||dp(r,e)&&yn(r.prev,r,r.next)>0&&yn(e.prev,e,e.next)>0)}function yn(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function dp(r,e){return r.x===e.x&&r.y===e.y}function DM(r,e,t,n){const i=Wf(yn(r,e,t)),s=Wf(yn(r,e,n)),o=Wf(yn(t,n,r)),a=Wf(yn(t,n,e));return!!(i!==s&&o!==a||i===0&&Vf(r,t,e)||s===0&&Vf(r,n,e)||o===0&&Vf(t,r,n)||a===0&&Vf(t,e,n))}function Vf(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Wf(r){return r>0?1:r<0?-1:0}function AU(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&DM(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Gu(r,e){return yn(r.prev,r,r.next)<0?yn(r,e,r.next)>=0&&yn(r,r.prev,e)>=0:yn(r,e,r.prev)<0||yn(r,r.next,e)<0}function CU(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.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&&(n=!n),t=t.next;while(t!==r);return n}function UM(r,e){const t=new fv(r.i,r.x,r.y),n=new fv(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function j1(r,e,t,n){const i=new fv(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Hu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function fv(r,e,t){this.i=r,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 RU(r,e,t,n){let i=0;for(let s=e,o=t-n;s2&&r[e-1].equals(r[0])&&r.pop()}function q1(r,e){for(let t=0;tNumber.EPSILON){const H=Math.sqrt(He),ne=Math.sqrt(Le*Le+ge*ge),we=oe.x-Se/H,be=oe.y+de/H,Me=te.x-ge/ne,Fe=te.y+Le/ne,Ue=((Me-we)*ge-(Fe-be)*Le)/(de*ge-Se*Le);se=we+de*Ue-z.x,$=be+Se*Ue-z.y;const xe=se*se+$*$;if(xe<=2)return new De(se,$);Ie=Math.sqrt(xe/2)}else{let H=!1;de>Number.EPSILON?Le>Number.EPSILON&&(H=!0):de<-Number.EPSILON?Le<-Number.EPSILON&&(H=!0):Math.sign(Se)===Math.sign(ge)&&(H=!0),H?(se=-Se,$=de,Ie=Math.sqrt(He)):(se=de,$=Se,Ie=Math.sqrt(He/2))}return new De(se/Ie,$/Ie)}const G=[];for(let z=0,oe=X.length,te=oe-1,se=z+1;z=0;z--){const oe=z/y,te=m*Math.cos(oe*Math.PI/2),se=v*Math.sin(oe*Math.PI/2)+_;for(let $=0,Ie=X.length;$=0;){const se=te;let $=te-1;$<0&&($=z.length-1);for(let Ie=0,de=u+y*2;Ie0)&&m.push(w,E,M),(g!==n-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 zM extends oi{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ke(16777215),this.specular=new Ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new De(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ih,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 BM extends oi{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ke(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new De(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 GM extends oi{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new De(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 HM extends oi{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new De(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=ih,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 VM extends oi{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ke(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Mo,this.normalScale=new De(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 WM extends Pi{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 yr(r,e,t){return Sy(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)}function da(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function Sy(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function XM(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function dv(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=r[a+l]}return i}function Ey(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function DU(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let l=0;l=n)){h.push(c.times[m]);for(let _=0;_s.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[v]){const g=v*h+u,x=g+h-u;_=yr(a.values,g,x)}else{const g=a.createInterpolant(),x=u,w=h-u;g.evaluate(s),_=yr(g.resultBuffer,x,w)}l==="quaternion"&&new si().fromArray(_).normalize().conjugate().toArray(_);const y=c.times.length;for(let g=0;g=s)){const a=t[1];e=s)break t}o=n,n=0;break n}break e}for(;n>>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=yr(n,s,o),this.values=yr(this.values,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 n=this.times,i=this.values,s=n.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=n[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&&Sy(i))for(let a=0,l=i.length;a!==l;++a){const c=i[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=yr(this.times),t=yr(this.values),n=this.getValueSize(),i=this.getInterpolation()===Sd,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*n,l=o*n,c=0;c!==n;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=yr(e,0,o),this.values=yr(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=yr(this.times,0),t=yr(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Wr.prototype.TimeBufferType=Float32Array;Wr.prototype.ValueBufferType=Float32Array;Wr.prototype.DefaultInterpolation=Du;class Ia extends Wr{}Ia.prototype.ValueTypeName="bool";Ia.prototype.ValueBufferType=Array;Ia.prototype.DefaultInterpolation=Iu;Ia.prototype.InterpolantFactoryMethodLinear=void 0;Ia.prototype.InterpolantFactoryMethodSmooth=void 0;class My extends Wr{}My.prototype.ValueTypeName="color";class Vu extends Wr{}Vu.prototype.ValueTypeName="number";class qM extends uh{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(n-t)/(i-t);let c=e*a;for(let u=c+a;c!==u;c+=4)si.slerpFlat(s,0,o,c-a,o,c,l);return s}}class tc extends Wr{InterpolantFactoryMethodLinear(e){return new qM(this.times,this.values,this.getValueSize(),e)}}tc.prototype.ValueTypeName="quaternion";tc.prototype.DefaultInterpolation=Du;tc.prototype.InterpolantFactoryMethodSmooth=void 0;class Da extends Wr{}Da.prototype.ValueTypeName="string";Da.prototype.ValueBufferType=Array;Da.prototype.DefaultInterpolation=Iu;Da.prototype.InterpolantFactoryMethodLinear=void 0;Da.prototype.InterpolantFactoryMethodSmooth=void 0;class Wu extends Wr{}Wu.prototype.ValueTypeName="vector";class Xu{constructor(e,t=-1,n,i=$d){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=er(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(FU(n[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=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(Wr.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a1){const h=u[1];let p=i[h];p||(i[h]=p=[]),p.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,p,m,v,_){if(m.length!==0){const y=[],g=[];Ey(m,y,g,v),y.length!==0&&_.push(new h(p,y,g))}},i=[],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{t&&t(s),this.manager.itemEnd(e)},0),s;if(Cs[e]!==void 0){Cs[e].push({onLoad:t,onProgress:n,onError:i});return}Cs[e]=[],Cs[e].push({onLoad:t,onProgress:n,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(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 u=Cs[e],h=c.body.getReader(),p=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),m=p?parseInt(p):0,v=m!==0;let _=0;const y=new ReadableStream({start(g){x();function x(){h.read().then(({done:w,value:E})=>{if(w)g.close();else{_+=E.byteLength;const b=new ProgressEvent("progress",{lengthComputable:v,loaded:_,total:m});for(let M=0,A=u.length;M{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,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,m=new TextDecoder(p);return c.arrayBuffer().then(v=>m.decode(v))}}}).then(c=>{Ma.add(e,c);const u=Cs[e];delete Cs[e];for(let h=0,p=u.length;h{const u=Cs[e];if(u===void 0)throw this.manager.itemError(e),c;delete Cs[e];for(let h=0,p=u.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 zU extends Gi{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Bs(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)}},n,i)}parse(e){const t=[];for(let n=0;n0: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=n(o.value);break;case"c":i.uniforms[s].value=new Ke().setHex(o.value);break;case"v2":i.uniforms[s].value=new De().fromArray(o.value);break;case"v3":i.uniforms[s].value=new Y().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Xt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Ct().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=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(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 De().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(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=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new De().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:NM,SpriteMaterial:hy,RawShaderMaterial:FM,ShaderMaterial:cs,PointsMaterial:dy,MeshPhysicalMaterial:kM,MeshStandardMaterial:wy,MeshPhongMaterial:zM,MeshToonMaterial:BM,MeshNormalMaterial:GM,MeshLambertMaterial:HM,MeshDepthMaterial:ep,MeshDistanceMaterial:tp,MeshBasicMaterial:Vs,MeshMatcapMaterial:VM,LineDashedMaterial:WM,LineBasicMaterial:Pi,Material:oi};return new t[e]}}class pv{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n0){const l=new Ty(t);s=new ju(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){i=new ju(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"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,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Ma.get(e);if(o!==void 0)return s.manager.itemStart(e),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,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Ma.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let Xf;class Ry{static getContext(){return Xf===void 0&&(Xf=new(window.AudioContext||window.webkitAudioContext)),Xf}static setContext(e){Xf=e}}class ZU extends Gi{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new Bs(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);Ry.getContext().decodeAudioData(c,function(h){t(h)},a)}catch(c){a(c)}},n,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}class KU extends wp{constructor(e,t,n=1){super(void 0,n),this.isHemisphereLightProbe=!0;const i=new Ke().set(e),s=new Ke().set(t),o=new Y(i.r,i.g,i.b),a=new Y(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(l),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(c)}}class $U extends wp{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const n=new Ke().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const nw=new yt,iw=new yt,Zo=new yt;class JU{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new zn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new zn,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,Zo.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(ma*t.fov*.5)/t.zoom;let a,l;iw.elements[12]=-i,nw.elements[12]=i,a=-o*t.aspect+s,l=o*t.aspect+s,Zo.elements[0]=2*t.near/(l-a),Zo.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Zo),a=-o*t.aspect-s,l=o*t.aspect-s,Zo.elements[0]=2*t.near/(l-a),Zo.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Zo)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(iw),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(nw)}}class Py{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=rw(),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=rw();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function rw(){return(typeof performance>"u"?Date:performance).now()}const Ko=new Y,sw=new si,QU=new Y,$o=new Y;class e3 extends jt{constructor(){super(),this.type="AudioListener",this.context=Ry.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Py}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,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Ko,sw,QU),$o.set(0,0,-1).applyQuaternion(sw),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Ko.x,i),t.positionY.linearRampToValueAtTime(Ko.y,i),t.positionZ.linearRampToValueAtTime(Ko.z,i),t.forwardX.linearRampToValueAtTime($o.x,i),t.forwardY.linearRampToValueAtTime($o.y,i),t.forwardZ.linearRampToValueAtTime($o.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Ko.x,Ko.y,Ko.z),t.setOrientation($o.x,$o.y,$o.z,n.x,n.y,n.z)}}class sT extends jt{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(n,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(n[l]!==n[l+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];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 n=e;n=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){si.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;si.multiplyQuaternionsFlat(e,o,e,t,e,n),si.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Ly="\\[\\]\\.:\\/",r3=new RegExp("["+Ly+"]","g"),Iy="[^"+Ly+"]",s3="[^"+Ly.replace("\\.","")+"]",o3=/((?:WC+[\/:])*)/.source.replace("WC",Iy),a3=/(WCOD+)?/.source.replace("WCOD",s3),l3=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Iy),c3=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Iy),u3=new RegExp("^"+o3+a3+l3+c3+"$"),h3=["material","materials","bones","map"];class f3{constructor(e,t,n){const i=n||zt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class zt{constructor(e,t,n){this.path=t,this.parsedPath=n||zt.parseTrackName(t),this.node=zt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new zt.Composite(e,t,n):new zt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(r3,"")}static parseTrackName(e){const t=u3.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);h3.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o=s){const h=s++,p=e[h];t[p.uuid]=u,e[u]=p,t[c]=h,e[h]=l;for(let m=0,v=i;m!==v;++m){const _=n[m],y=_[h],g=_[u];_[u]=y,_[h]=g}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,l=arguments.length;a!==l;++a){const c=arguments[a],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h0&&(t[m.uuid]=h),e[h]=m,e.pop();for(let v=0,_=i;v!==_;++v){const y=n[v];y[h]=y[p],y.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(h);for(let p=u,m=l.length;p!==m;++p){const v=l[p];h[p]=new zt(v,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];t[c]=n,o[n]=l,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}class aT{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),l={endingStart:ua,endingEnd:ua};for(let c=0;c!==o;++c){const u=s[c].createInterpolant(null);a[c]=u,u.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=jb,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,n){if(e.fadeOut(t),this.fadeIn(t),n){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,n){return e.crossFadeFrom(this,t,n)}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,n){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,c=a.sampleValues;return l[0]=s,l[1]=s+n,c[0]=e/o,c[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,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*n;l<0||n===0?t=0:(this._startTime=null,t=n*l)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Qv:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case $d:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.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 n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===Yb;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===Xb){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 c=e<0;this._setEndings(c,!c,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,n){const i=this._interpolantSettings;n?(i.endingStart=ha,i.endingEnd=ha):(e?i.endingStart=this.zeroSlopeAtStart?ha:ua:i.endingStart=Uu,t?i.endingEnd=this.zeroSlopeAtEnd?ha:ua:i.endingEnd=Uu)}_scheduleFading(e,t,n){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]=n,this}}const p3=new Float32Array(1);class m3 extends Hs{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=n.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const p=i[h],m=p.name;let v=u[m];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,m));continue}const _=t&&t._propertyBindings[h].binding.parsedPath;v=new oT(zt.create(n,m,_),p.ValueTypeName,p.getValueSize()),++v.referenceCount,this._addInactiveBinding(v,l,m),o[h]=v}a[h].resultBuffer=v.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--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;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==n;++c)t[c]._update(i,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 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,lw).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 cw=new Y,jf=new Y;class S3{constructor(e=new Y,t=new Y){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){cw.subVectors(e,this.start),jf.subVectors(this.end,this.start);const n=jf.dot(jf);let s=jf.dot(cw)/n;return t&&(s=Tn(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).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 uw=new Y;class E3 extends jt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new Tt,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{mw.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(mw,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),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 N3 extends hs{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new Tt;i.setAttribute("position",new st(t,3)),i.setAttribute("color",new st(n,3));const s=new Pi({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new Ke,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(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class F3{constructor(){this.type="ShapePath",this.color=new Ke,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new zu,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(g){const x=[];for(let w=0,E=g.length;wNumber.EPSILON){if(L<0&&(A=x[M],C=-C,P=x[b],L=-L),g.yP.y)continue;if(g.y===A.y){if(g.x===A.x)return!0}else{const F=L*(g.x-A.x)-C*(g.y-A.y);if(F===0)return!0;if(F<0)continue;E=!E}}else{if(g.y!==A.y)continue;if(P.x<=g.x&&g.x<=A.x||A.x<=g.x&&g.x<=P.x)return!0}}return E}const i=as.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 va,l.curves=a.curves,c.push(l),c;let u=!i(s[0].getPoints());u=e?!u:u;const h=[],p=[];let m=[],v=0,_;p[v]=void 0,m[v]=[];for(let g=0,x=s.length;g1){let g=!1,x=0;for(let w=0,E=p.length;w0&&g===!1&&(m=h)}let y;for(let g=0,x=p.length;g{const h=typeof c=="function"?c(e):c;if(h!==e){const p=e;e=u?h:Object.assign({},e,h),t.forEach(m=>m(e,p))}},i=()=>e,s=(c,u=i,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let p=u(e);function m(){const v=u(e);if(!h(p,v)){const _=p;c(p=v,_)}}return t.add(m),()=>t.delete(m)},l={setState:n,getState:i,subscribe:(c,u,h)=>u||h?s(c,u,h):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=r(n,i,l),l}const G3=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),yw=G3?K.useEffect:K.useLayoutEffect;function H3(r){const e=typeof r=="function"?B3(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=K.useReducer(y=>y+1,0),o=e.getState(),a=K.useRef(o),l=K.useRef(n),c=K.useRef(i),u=K.useRef(!1),h=K.useRef();h.current===void 0&&(h.current=n(o));let p,m=!1;(a.current!==o||l.current!==n||c.current!==i||u.current)&&(p=n(o),m=!i(h.current,p)),yw(()=>{m&&(h.current=p),a.current=o,l.current=n,c.current=i,u.current=!1});const v=K.useRef(o);yw(()=>{const y=()=>{try{const x=e.getState(),w=l.current(x);c.current(h.current,w)||(a.current=x,h.current=w,s())}catch{u.current=!0,s()}},g=e.subscribe(y);return e.getState()!==v.current&&y(),g},[]);const _=m?p:h.current;return K.useDebugValue(_),_};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}var mg={exports:{}},gg={exports:{}},vg={};/** - * @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. - */var _w;function V3(){return _w||(_w=1,(function(r){function e(k,G){var B=k.length;k.push(G);e:for(;0>>1,V=k[D];if(0>>1;Di(ie,B))uei(ce,ie)?(k[D]=ce,k[ue]=B,D=ue):(k[D]=ie,k[ee]=B,D=ee);else if(uei(ce,B))k[D]=ce,k[ue]=B,D=ue;else break e}}return G}function i(k,G){var B=k.sortIndex-G.sortIndex;return B!==0?B:k.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();r.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,p=3,m=!1,v=!1,_=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(k){for(var G=t(c);G!==null;){if(G.callback===null)n(c);else if(G.startTime<=k)n(c),G.sortIndex=G.expirationTime,e(l,G);else break;G=t(c)}}function E(k){if(_=!1,w(k),!v)if(t(l)!==null)v=!0,W(b);else{var G=t(c);G!==null&&O(E,G.startTime-k)}}function b(k,G){v=!1,_&&(_=!1,g(P),P=-1),m=!0;var B=p;try{for(w(G),h=t(l);h!==null&&(!(h.expirationTime>G)||k&&!F());){var D=h.callback;if(typeof D=="function"){h.callback=null,p=h.priorityLevel;var V=D(h.expirationTime<=G);G=r.unstable_now(),typeof V=="function"?h.callback=V:h===t(l)&&n(l),w(G)}else n(l);h=t(l)}if(h!==null)var Z=!0;else{var ee=t(c);ee!==null&&O(E,ee.startTime-G),Z=!1}return Z}finally{h=null,p=B,m=!1}}var M=!1,A=null,P=-1,C=5,L=-1;function F(){return!(r.unstable_now()-Lk||125D?(k.sortIndex=B,e(c,k),t(l)===null&&k===t(c)&&(_?(g(P),P=-1):_=!0,O(E,B-D))):(k.sortIndex=V,e(l,k),v||m||(v=!0,W(b))),k},r.unstable_shouldYield=F,r.unstable_wrapCallback=function(k){var G=p;return function(){var B=p;p=G;try{return k.apply(this,arguments)}finally{p=B}}}})(vg)),vg}var xw;function W3(){return xw||(xw=1,gg.exports=V3()),gg.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 yg,ww;function X3(){return ww||(ww=1,yg=function(e){var t={},n=Hv(),i=W3(),s=Object.assign;function o(f){for(var d="https://reactjs.org/docs/error-decoder.html?invariant="+f,S=1;She||R[Q]!==U[he]){var Ce=` -`+R[Q].replace(" at new "," at ");return f.displayName&&Ce.includes("")&&(Ce=Ce.replace("",f.displayName)),Ce}while(1<=Q&&0<=he);break}}}finally{Jt=!1,Error.prepareStackTrace=S}return(f=f?f.displayName||f.name:"")?ut(f):""}var Yn=Object.prototype.hasOwnProperty,ci=[],qt=-1;function mt(f){return{current:f}}function kt(f){0>qt||(f.current=ci[qt],ci[qt]=null,qt--)}function gt(f,d){qt++,ci[qt]=f.current,f.current=d}var Cn={},En=mt(Cn),cn=mt(!1),Ii=Cn;function Qt(f,d){var S=f.type.contextTypes;if(!S)return Cn;var T=f.stateNode;if(T&&T.__reactInternalMemoizedUnmaskedChildContext===d)return T.__reactInternalMemoizedMaskedChildContext;var R={},U;for(U in S)R[U]=d[U];return T&&(f=f.stateNode,f.__reactInternalMemoizedUnmaskedChildContext=d,f.__reactInternalMemoizedMaskedChildContext=R),R}function on(f){return f=f.childContextTypes,f!=null}function xi(){kt(cn),kt(En)}function Un(f,d,S){if(En.current!==Cn)throw Error(o(168));gt(En,d),gt(cn,S)}function Xr(f,d,S){var T=f.stateNode;if(d=d.childContextTypes,typeof T.getChildContext!="function")return S;T=T.getChildContext();for(var R in T)if(!(R in d))throw Error(o(108,P(f)||"Unknown",R));return s({},S,T)}function jr(f){return f=(f=f.stateNode)&&f.__reactInternalMemoizedMergedChildContext||Cn,Ii=En.current,gt(En,f),gt(cn,cn.current),!0}function ui(f,d,S){var T=f.stateNode;if(!T)throw Error(o(169));S?(f=Xr(f,d,Ii),T.__reactInternalMemoizedMergedChildContext=f,kt(cn),kt(En),gt(En,f)):kt(cn),gt(cn,S)}var Vi=Math.clz32?Math.clz32:xh,Oa=Math.log,Ro=Math.LN2;function xh(f){return f>>>=0,f===0?32:31-(Oa(f)/Ro|0)|0}var fs=64,ds=4194304;function ps(f){switch(f&-f){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 f&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return f&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return f}}function Po(f,d){var S=f.pendingLanes;if(S===0)return 0;var T=0,R=f.suspendedLanes,U=f.pingedLanes,Q=S&268435455;if(Q!==0){var he=Q&~R;he!==0?T=ps(he):(U&=Q,U!==0&&(T=ps(U)))}else Q=S&~R,Q!==0?T=ps(Q):U!==0&&(T=ps(U));if(T===0)return 0;if(d!==0&&d!==T&&(d&R)===0&&(R=T&-T,U=d&-d,R>=U||R===16&&(U&4194240)!==0))return d;if((T&4)!==0&&(T|=S&16),d=f.entangledLanes,d!==0)for(f=f.entanglements,d&=T;0S;S++)d.push(f);return d}function Yr(f,d,S){f.pendingLanes|=d,d!==536870912&&(f.suspendedLanes=0,f.pingedLanes=0),f=f.eventTimes,d=31-Vi(d),f[d]=S}function Ys(f,d){var S=f.pendingLanes&~d;f.pendingLanes=d,f.suspendedLanes=0,f.pingedLanes=0,f.expiredLanes&=d,f.mutableReadLanes&=d,f.entangledLanes&=d,d=f.entanglements;var T=f.eventTimes;for(f=f.expirationTimes;0>=Q,R-=Q,ys=1<<32-Vi(d)+R|S<Ht?($n=Et,Et=null):$n=Et.sibling;var Vt=ht(ye,Et,Te[Ht],et);if(Vt===null){Et===null&&(Et=$n);break}f&&Et&&Vt.alternate===null&&d(ye,Et),fe=U(Vt,fe,Ht),Pt===null?ot=Vt:Pt.sibling=Vt,Pt=Vt,Et=$n}if(Ht===Te.length)return S(ye,Et),un&&Fo(ye,Ht),ot;if(Et===null){for(;HtHt?($n=Et,Et=null):$n=Et.sibling;var no=ht(ye,Et,Vt.value,et);if(no===null){Et===null&&(Et=$n);break}f&&Et&&no.alternate===null&&d(ye,Et),fe=U(no,fe,Ht),Pt===null?ot=no:Pt.sibling=no,Pt=no,Et=$n}if(Vt.done)return S(ye,Et),un&&Fo(ye,Ht),ot;if(Et===null){for(;!Vt.done;Ht++,Vt=Te.next())Vt=St(ye,Vt.value,et),Vt!==null&&(fe=U(Vt,fe,Ht),Pt===null?ot=Vt:Pt.sibling=Vt,Pt=Vt);return un&&Fo(ye,Ht),ot}for(Et=T(ye,Et);!Vt.done;Ht++,Vt=Te.next())Vt=nn(Et,ye,Ht,Vt.value,et),Vt!==null&&(f&&Vt.alternate!==null&&Et.delete(Vt.key===null?Ht:Vt.key),fe=U(Vt,fe,Ht),Pt===null?ot=Vt:Pt.sibling=Vt,Pt=Vt);return f&&Et.forEach(function(Y2){return d(ye,Y2)}),un&&Fo(ye,Ht),ot}function dr(ye,fe,Te,et){if(typeof Te=="object"&&Te!==null&&Te.type===u&&Te.key===null&&(Te=Te.props.children),typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case l:e:{for(var ot=Te.key,Pt=fe;Pt!==null;){if(Pt.key===ot){if(ot=Te.type,ot===u){if(Pt.tag===7){S(ye,Pt.sibling),fe=R(Pt,Te.props.children),fe.return=ye,ye=fe;break e}}else if(Pt.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===w&&A_(ot)===Pt.type){S(ye,Pt.sibling),fe=R(Pt,Te.props),fe.ref=pc(ye,Pt,Te),fe.return=ye,ye=fe;break e}S(ye,Pt);break}else d(ye,Pt);Pt=Pt.sibling}Te.type===u?(fe=Wo(Te.props.children,ye.mode,et,Te.key),fe.return=ye,ye=fe):(et=cf(Te.type,Te.key,Te.props,null,ye.mode,et),et.ref=pc(ye,fe,Te),et.return=ye,ye=et)}return Q(ye);case c:e:{for(Pt=Te.key;fe!==null;){if(fe.key===Pt)if(fe.tag===4&&fe.stateNode.containerInfo===Te.containerInfo&&fe.stateNode.implementation===Te.implementation){S(ye,fe.sibling),fe=R(fe,Te.children||[]),fe.return=ye,ye=fe;break e}else{S(ye,fe);break}else d(ye,fe);fe=fe.sibling}fe=Im(Te,ye.mode,et),fe.return=ye,ye=fe}return Q(ye);case w:return Pt=Te._init,dr(ye,fe,Pt(Te._payload),et)}if(q(Te))return at(ye,fe,Te,et);if(M(Te))return pi(ye,fe,Te,et);Lh(ye,Te)}return typeof Te=="string"&&Te!==""||typeof Te=="number"?(Te=""+Te,fe!==null&&fe.tag===6?(S(ye,fe.sibling),fe=R(fe,Te),fe.return=ye,ye=fe):(S(ye,fe),fe=Lm(Te,ye.mode,et),fe.return=ye,ye=fe),Q(ye)):S(ye,fe)}return dr}var Va=C_(!0),R_=C_(!1),mc={},cr=mt(mc),gc=mt(mc),Wa=mt(mc);function Kr(f){if(f===mc)throw Error(o(174));return f}function Zp(f,d){gt(Wa,d),gt(gc,f),gt(cr,mc),f=O(d),kt(cr),gt(cr,f)}function Xa(){kt(cr),kt(gc),kt(Wa)}function P_(f){var d=Kr(Wa.current),S=Kr(cr.current);d=k(S,f.type,d),S!==d&&(gt(gc,f),gt(cr,d))}function Kp(f){gc.current===f&&(kt(cr),kt(gc))}var mn=mt(0);function Ih(f){for(var d=f;d!==null;){if(d.tag===13){var S=d.memoizedState;if(S!==null&&(S=S.dehydrated,S===null||Bt(S)||sn(S)))return d}else if(d.tag===19&&d.memoizedProps.revealOrder!==void 0){if((d.flags&128)!==0)return d}else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break;for(;d.sibling===null;){if(d.return===null||d.return===f)return null;d=d.return}d.sibling.return=d.return,d=d.sibling}return null}var $p=[];function Jp(){for(var f=0;f<$p.length;f++){var d=$p[f];Ee?d._workInProgressVersionPrimary=null:d._workInProgressVersionSecondary=null}$p.length=0}var Dh=a.ReactCurrentDispatcher,ur=a.ReactCurrentBatchConfig,ja=0,bn=null,hi=null,Kn=null,Uh=!1,vc=!1,yc=0,y2=0;function fi(){throw Error(o(321))}function Qp(f,d){if(d===null)return!1;for(var S=0;SS?S:4,f(!0);var T=ur.transition;ur.transition={};try{f(!1),d()}finally{Ut=S,ur.transition=T}}function W_(){return $r().memoizedState}function x2(f,d,S){var T=Qs(f);S={lane:T,action:S,hasEagerState:!1,eagerState:null,next:null},X_(f)?j_(d,S):(Y_(f,d,S),S=Ti(),f=hr(f,T,S),f!==null&&q_(f,d,T))}function w2(f,d,S){var T=Qs(f),R={lane:T,action:S,hasEagerState:!1,eagerState:null,next:null};if(X_(f))j_(d,R);else{Y_(f,d,R);var U=f.alternate;if(f.lanes===0&&(U===null||U.lanes===0)&&(U=d.lastRenderedReducer,U!==null))try{var Q=d.lastRenderedState,he=U(Q,S);if(R.hasEagerState=!0,R.eagerState=he,Xi(he,Q))return}catch{}finally{}S=Ti(),f=hr(f,T,S),f!==null&&q_(f,d,T)}}function X_(f){var d=f.alternate;return f===bn||d!==null&&d===bn}function j_(f,d){vc=Uh=!0;var S=f.pending;S===null?d.next=d:(d.next=S.next,S.next=d),f.pending=d}function Y_(f,d,S){On!==null&&(f.mode&1)!==0&&(Dt&2)===0?(f=d.interleaved,f===null?(S.next=S,ji===null?ji=[d]:ji.push(d)):(S.next=f.next,f.next=S),d.interleaved=S):(f=d.pending,f===null?S.next=S:(S.next=f.next,f.next=S),d.pending=S)}function q_(f,d,S){if((S&4194240)!==0){var T=d.lanes;T&=f.pendingLanes,S|=T,d.lanes=S,qr(f,S)}}var zh={readContext:Pn,useCallback:fi,useContext:fi,useEffect:fi,useImperativeHandle:fi,useInsertionEffect:fi,useLayoutEffect:fi,useMemo:fi,useReducer:fi,useRef:fi,useState:fi,useDebugValue:fi,useDeferredValue:fi,useTransition:fi,useMutableSource:fi,useSyncExternalStore:fi,useId:fi,unstable_isNewReconciler:!1},S2={readContext:Pn,useCallback:function(f,d){return xs().memoizedState=[f,d===void 0?null:d],f},useContext:Pn,useEffect:im,useImperativeHandle:function(f,d,S){return S=S!=null?S.concat([f]):null,Fh(4194308,4,B_.bind(null,d,f),S)},useLayoutEffect:function(f,d){return Fh(4194308,4,f,d)},useInsertionEffect:function(f,d){return Fh(4,2,f,d)},useMemo:function(f,d){var S=xs();return d=d===void 0?null:d,f=f(),S.memoizedState=[f,d],f},useReducer:function(f,d,S){var T=xs();return d=S!==void 0?S(d):d,T.memoizedState=T.baseState=d,f={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:f,lastRenderedState:d},T.queue=f,f=f.dispatch=x2.bind(null,bn,f),[T.memoizedState,f]},useRef:function(f){var d=xs();return f={current:f},d.memoizedState=f},useState:nm,useDebugValue:rm,useDeferredValue:function(f){var d=nm(f),S=d[0],T=d[1];return im(function(){var R=ur.transition;ur.transition={};try{T(f)}finally{ur.transition=R}},[f]),S},useTransition:function(){var f=nm(!1),d=f[0];return f=_2.bind(null,f[1]),xs().memoizedState=f,[d,f]},useMutableSource:function(){},useSyncExternalStore:function(f,d,S){var T=bn,R=xs();if(un){if(S===void 0)throw Error(o(407));S=S()}else{if(S=d(),On===null)throw Error(o(349));(ja&30)!==0||D_(T,d,S)}R.memoizedState=S;var U={value:S,getSnapshot:d};return R.queue=U,im(O_.bind(null,T,U,f),[f]),T.flags|=2048,_c(9,U_.bind(null,T,U,S,d),void 0,null),S},useId:function(){var f=xs(),d=On.identifierPrefix;if(un){var S=_s,T=ys;S=(T&~(1<<32-Vi(T)-1)).toString(32)+S,d=":"+d+"R"+S,S=yc++,0Em&&(d.flags|=128,T=!0,Ec(R,!1),d.lanes=4194304)}else{if(!T)if(f=Ih(U),f!==null){if(d.flags|=128,T=!0,f=f.updateQueue,f!==null&&(d.updateQueue=f,d.flags|=4),Ec(R,!0),R.tail===null&&R.tailMode==="hidden"&&!U.alternate&&!un)return di(d),null}else 2*pn()-R.renderingStartTime>Em&&S!==1073741824&&(d.flags|=128,T=!0,Ec(R,!1),d.lanes=4194304);R.isBackwards?(U.sibling=d.child,d.child=U):(f=R.last,f!==null?f.sibling=U:d.child=U,R.last=U)}return R.tail!==null?(d=R.tail,R.rendering=d,R.tail=d.sibling,R.renderingStartTime=pn(),d.sibling=null,f=mn.current,gt(mn,T?f&1|2:f&1),d):(di(d),null);case 22:case 23:return Cm(),T=d.memoizedState!==null,f!==null&&f.memoizedState!==null!==T&&(d.flags|=8192),T&&(d.mode&1)!==0?(Ki&1073741824)!==0&&(di(d),ae&&d.subtreeFlags&6&&(d.flags|=8192)):di(d),null;case 24:return null;case 25:return null}throw Error(o(156,d.tag))}var A2=a.ReactCurrentOwner,Zi=!1;function Mi(f,d,S,T){d.child=f===null?R_(d,null,S,T):Va(d,f.child,S,T)}function nx(f,d,S,T,R){S=S.render;var U=d.ref;return Rn(d,R),T=em(f,d,S,T,U,R),S=tm(),f!==null&&!Zi?(d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~R,ws(f,d,R)):(un&&S&&Wp(d),d.flags|=1,Mi(f,d,T,R),d.child)}function ix(f,d,S,T,R){if(f===null){var U=S.type;return typeof U=="function"&&!Pm(U)&&U.defaultProps===void 0&&S.compare===null&&S.defaultProps===void 0?(d.tag=15,d.type=U,rx(f,d,U,T,R)):(f=cf(S.type,null,T,d,d.mode,R),f.ref=d.ref,f.return=d,d.child=f)}if(U=f.child,(f.lanes&R)===0){var Q=U.memoizedProps;if(S=S.compare,S=S!==null?S:Uo,S(Q,T)&&f.ref===d.ref)return ws(f,d,R)}return d.flags|=1,f=to(U,T),f.ref=d.ref,f.return=d,d.child=f}function rx(f,d,S,T,R){if(f!==null&&Uo(f.memoizedProps,T)&&f.ref===d.ref)if(Zi=!1,(f.lanes&R)!==0)(f.flags&131072)!==0&&(Zi=!0);else return d.lanes=f.lanes,ws(f,d,R);return am(f,d,S,T,R)}function sx(f,d,S){var T=d.pendingProps,R=T.children,U=f!==null?f.memoizedState:null;if(T.mode==="hidden")if((d.mode&1)===0)d.memoizedState={baseLanes:0,cachePool:null},gt(Ya,Ki),Ki|=S;else if((S&1073741824)!==0)d.memoizedState={baseLanes:0,cachePool:null},T=U!==null?U.baseLanes:S,gt(Ya,Ki),Ki|=T;else return f=U!==null?U.baseLanes|S:S,d.lanes=d.childLanes=1073741824,d.memoizedState={baseLanes:f,cachePool:null},d.updateQueue=null,gt(Ya,Ki),Ki|=f,null;else U!==null?(T=U.baseLanes|S,d.memoizedState=null):T=S,gt(Ya,Ki),Ki|=T;return Mi(f,d,R,S),d.child}function ox(f,d){var S=d.ref;(f===null&&S!==null||f!==null&&f.ref!==S)&&(d.flags|=512,d.flags|=2097152)}function am(f,d,S,T,R){var U=on(S)?Ii:En.current;return U=Qt(d,U),Rn(d,R),S=em(f,d,S,T,U,R),T=tm(),f!==null&&!Zi?(d.updateQueue=f.updateQueue,d.flags&=-2053,f.lanes&=~R,ws(f,d,R)):(un&&T&&Wp(d),d.flags|=1,Mi(f,d,S,R),d.child)}function ax(f,d,S,T,R){if(on(S)){var U=!0;jr(d)}else U=!1;if(Rn(d,R),d.stateNode===null)f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),w_(d,S,T),Vp(d,S,T,R),T=!0;else if(f===null){var Q=d.stateNode,he=d.memoizedProps;Q.props=he;var Ce=Q.context,Xe=S.contextType;typeof Xe=="object"&&Xe!==null?Xe=Pn(Xe):(Xe=on(S)?Ii:En.current,Xe=Qt(d,Xe));var rt=S.getDerivedStateFromProps,St=typeof rt=="function"||typeof Q.getSnapshotBeforeUpdate=="function";St||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(he!==T||Ce!==Xe)&&S_(d,Q,T,Xe),Zs=!1;var ht=d.memoizedState;Q.state=ht,Ah(d,T,Q,R),Ce=d.memoizedState,he!==T||ht!==Ce||cn.current||Zs?(typeof rt=="function"&&(Hp(d,S,rt,T),Ce=d.memoizedState),(he=Zs||x_(d,S,he,T,ht,Ce,Xe))?(St||typeof Q.UNSAFE_componentWillMount!="function"&&typeof Q.componentWillMount!="function"||(typeof Q.componentWillMount=="function"&&Q.componentWillMount(),typeof Q.UNSAFE_componentWillMount=="function"&&Q.UNSAFE_componentWillMount()),typeof Q.componentDidMount=="function"&&(d.flags|=4194308)):(typeof Q.componentDidMount=="function"&&(d.flags|=4194308),d.memoizedProps=T,d.memoizedState=Ce),Q.props=T,Q.state=Ce,Q.context=Xe,T=he):(typeof Q.componentDidMount=="function"&&(d.flags|=4194308),T=!1)}else{Q=d.stateNode,g_(f,d),he=d.memoizedProps,Xe=d.type===d.elementType?he:Ei(d.type,he),Q.props=Xe,St=d.pendingProps,ht=Q.context,Ce=S.contextType,typeof Ce=="object"&&Ce!==null?Ce=Pn(Ce):(Ce=on(S)?Ii:En.current,Ce=Qt(d,Ce));var nn=S.getDerivedStateFromProps;(rt=typeof nn=="function"||typeof Q.getSnapshotBeforeUpdate=="function")||typeof Q.UNSAFE_componentWillReceiveProps!="function"&&typeof Q.componentWillReceiveProps!="function"||(he!==St||ht!==Ce)&&S_(d,Q,T,Ce),Zs=!1,ht=d.memoizedState,Q.state=ht,Ah(d,T,Q,R);var at=d.memoizedState;he!==St||ht!==at||cn.current||Zs?(typeof nn=="function"&&(Hp(d,S,nn,T),at=d.memoizedState),(Xe=Zs||x_(d,S,Xe,T,ht,at,Ce)||!1)?(rt||typeof Q.UNSAFE_componentWillUpdate!="function"&&typeof Q.componentWillUpdate!="function"||(typeof Q.componentWillUpdate=="function"&&Q.componentWillUpdate(T,at,Ce),typeof Q.UNSAFE_componentWillUpdate=="function"&&Q.UNSAFE_componentWillUpdate(T,at,Ce)),typeof Q.componentDidUpdate=="function"&&(d.flags|=4),typeof Q.getSnapshotBeforeUpdate=="function"&&(d.flags|=1024)):(typeof Q.componentDidUpdate!="function"||he===f.memoizedProps&&ht===f.memoizedState||(d.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||he===f.memoizedProps&&ht===f.memoizedState||(d.flags|=1024),d.memoizedProps=T,d.memoizedState=at),Q.props=T,Q.state=at,Q.context=Ce,T=Xe):(typeof Q.componentDidUpdate!="function"||he===f.memoizedProps&&ht===f.memoizedState||(d.flags|=4),typeof Q.getSnapshotBeforeUpdate!="function"||he===f.memoizedProps&&ht===f.memoizedState||(d.flags|=1024),T=!1)}return lm(f,d,S,T,U,R)}function lm(f,d,S,T,R,U){ox(f,d);var Q=(d.flags&128)!==0;if(!T&&!Q)return R&&ui(d,S,!1),ws(f,d,U);T=d.stateNode,A2.current=d;var he=Q&&typeof S.getDerivedStateFromError!="function"?null:T.render();return d.flags|=1,f!==null&&Q?(d.child=Va(d,f.child,null,U),d.child=Va(d,null,he,U)):Mi(f,d,he,U),d.memoizedState=T.state,R&&ui(d,S,!0),d.child}function lx(f){var d=f.stateNode;d.pendingContext?Un(f,d.pendingContext,d.pendingContext!==d.context):d.context&&Un(f,d.context,!1),Zp(f,d.containerInfo)}function cx(f,d,S,T,R){return Ha(),qp(R),d.flags|=256,Mi(f,d,S,T),d.child}var Hh={dehydrated:null,treeContext:null,retryLane:0};function Vh(f){return{baseLanes:f,cachePool:null}}function ux(f,d,S){var T=d.pendingProps,R=mn.current,U=!1,Q=(d.flags&128)!==0,he;if((he=Q)||(he=f!==null&&f.memoizedState===null?!1:(R&2)!==0),he?(U=!0,d.flags&=-129):(f===null||f.memoizedState!==null)&&(R|=1),gt(mn,R&1),f===null)return Yp(d),f=d.memoizedState,f!==null&&(f=f.dehydrated,f!==null)?((d.mode&1)===0?d.lanes=1:sn(f)?d.lanes=8:d.lanes=1073741824,null):(R=T.children,f=T.fallback,U?(T=d.mode,U=d.child,R={mode:"hidden",children:R},(T&1)===0&&U!==null?(U.childLanes=0,U.pendingProps=R):U=uf(R,T,0,null),f=Wo(f,T,S,null),U.return=d,f.return=d,U.sibling=f,d.child=U,d.child.memoizedState=Vh(S),d.memoizedState=Hh,f):cm(d,R));if(R=f.memoizedState,R!==null){if(he=R.dehydrated,he!==null){if(Q)return d.flags&256?(d.flags&=-257,Wh(f,d,S,Error(o(422)))):d.memoizedState!==null?(d.child=f.child,d.flags|=128,null):(U=T.fallback,R=d.mode,T=uf({mode:"visible",children:T.children},R,0,null),U=Wo(U,R,S,null),U.flags|=2,T.return=d,U.return=d,T.sibling=U,d.child=T,(d.mode&1)!==0&&Va(d,f.child,null,S),d.child.memoizedState=Vh(S),d.memoizedState=Hh,U);if((d.mode&1)===0)d=Wh(f,d,S,null);else if(sn(he))d=Wh(f,d,S,Error(o(419)));else if(T=(S&f.childLanes)!==0,Zi||T){if(T=On,T!==null){switch(S&-S){case 4:U=2;break;case 16:U=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:U=32;break;case 536870912:U=268435456;break;default:U=0}T=(U&(T.suspendedLanes|S))!==0?0:U,T!==0&&T!==R.retryLane&&(R.retryLane=T,hr(f,T,-1))}Rm(),d=Wh(f,d,S,Error(o(421)))}else Bt(he)?(d.flags|=128,d.child=f.child,d=B2.bind(null,f),ti(he,d),d=null):(S=R.treeContext,oe&&(qi=sr(he),Yi=d,un=!0,Ar=null,fc=!1,S!==null&&(ar[lr++]=ys,ar[lr++]=_s,ar[lr++]=No,ys=S.id,_s=S.overflow,No=d)),d=cm(d,d.pendingProps.children),d.flags|=4096);return d}return U?(T=fx(f,d,T.children,T.fallback,S),U=d.child,R=f.child.memoizedState,U.memoizedState=R===null?Vh(S):{baseLanes:R.baseLanes|S,cachePool:null},U.childLanes=f.childLanes&~S,d.memoizedState=Hh,T):(S=hx(f,d,T.children,S),d.memoizedState=null,S)}return U?(T=fx(f,d,T.children,T.fallback,S),U=d.child,R=f.child.memoizedState,U.memoizedState=R===null?Vh(S):{baseLanes:R.baseLanes|S,cachePool:null},U.childLanes=f.childLanes&~S,d.memoizedState=Hh,T):(S=hx(f,d,T.children,S),d.memoizedState=null,S)}function cm(f,d){return d=uf({mode:"visible",children:d},f.mode,0,null),d.return=f,f.child=d}function hx(f,d,S,T){var R=f.child;return f=R.sibling,S=to(R,{mode:"visible",children:S}),(d.mode&1)===0&&(S.lanes=T),S.return=d,S.sibling=null,f!==null&&(T=d.deletions,T===null?(d.deletions=[f],d.flags|=16):T.push(f)),d.child=S}function fx(f,d,S,T,R){var U=d.mode;f=f.child;var Q=f.sibling,he={mode:"hidden",children:S};return(U&1)===0&&d.child!==f?(S=d.child,S.childLanes=0,S.pendingProps=he,d.deletions=null):(S=to(f,he),S.subtreeFlags=f.subtreeFlags&14680064),Q!==null?T=to(Q,T):(T=Wo(T,U,R,null),T.flags|=2),T.return=d,S.return=d,S.sibling=T,d.child=S,T}function Wh(f,d,S,T){return T!==null&&qp(T),Va(d,f.child,null,S),f=cm(d,d.pendingProps.children),f.flags|=2,d.memoizedState=null,f}function dx(f,d,S){f.lanes|=d;var T=f.alternate;T!==null&&(T.lanes|=d),bi(f.return,d,S)}function um(f,d,S,T,R){var U=f.memoizedState;U===null?f.memoizedState={isBackwards:d,rendering:null,renderingStartTime:0,last:T,tail:S,tailMode:R}:(U.isBackwards=d,U.rendering=null,U.renderingStartTime=0,U.last=T,U.tail=S,U.tailMode=R)}function px(f,d,S){var T=d.pendingProps,R=T.revealOrder,U=T.tail;if(Mi(f,d,T.children,S),T=mn.current,(T&2)!==0)T=T&1|2,d.flags|=128;else{if(f!==null&&(f.flags&128)!==0)e:for(f=d.child;f!==null;){if(f.tag===13)f.memoizedState!==null&&dx(f,S,d);else if(f.tag===19)dx(f,S,d);else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}T&=1}if(gt(mn,T),(d.mode&1)===0)d.memoizedState=null;else switch(R){case"forwards":for(S=d.child,R=null;S!==null;)f=S.alternate,f!==null&&Ih(f)===null&&(R=S),S=S.sibling;S=R,S===null?(R=d.child,d.child=null):(R=S.sibling,S.sibling=null),um(d,!1,R,S,U);break;case"backwards":for(S=null,R=d.child,d.child=null;R!==null;){if(f=R.alternate,f!==null&&Ih(f)===null){d.child=R;break}f=R.sibling,R.sibling=S,S=R,R=f}um(d,!0,S,null,U);break;case"together":um(d,!1,null,null,void 0);break;default:d.memoizedState=null}return d.child}function ws(f,d,S){if(f!==null&&(d.dependencies=f.dependencies),qa|=d.lanes,(S&d.childLanes)===0)return null;if(f!==null&&d.child!==f.child)throw Error(o(153));if(d.child!==null){for(f=d.child,S=to(f,f.pendingProps),d.child=S,S.return=d;f.sibling!==null;)f=f.sibling,S=S.sibling=to(f,f.pendingProps),S.return=d;S.sibling=null}return d.child}function C2(f,d,S){switch(d.tag){case 3:lx(d),Ha();break;case 5:P_(d);break;case 1:on(d.type)&&jr(d);break;case 4:Zp(d,d.stateNode.containerInfo);break;case 10:Mh(d,d.type._context,d.memoizedProps.value);break;case 13:var T=d.memoizedState;if(T!==null)return T.dehydrated!==null?(gt(mn,mn.current&1),d.flags|=128,null):(S&d.child.childLanes)!==0?ux(f,d,S):(gt(mn,mn.current&1),f=ws(f,d,S),f!==null?f.sibling:null);gt(mn,mn.current&1);break;case 19:if(T=(S&d.childLanes)!==0,(f.flags&128)!==0){if(T)return px(f,d,S);d.flags|=128}var R=d.memoizedState;if(R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),gt(mn,mn.current),T)break;return null;case 22:case 23:return d.lanes=0,sx(f,d,S)}return ws(f,d,S)}function R2(f,d){switch(Xp(d),d.tag){case 1:return on(d.type)&&xi(),f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 3:return Xa(),kt(cn),kt(En),Jp(),f=d.flags,(f&65536)!==0&&(f&128)===0?(d.flags=f&-65537|128,d):null;case 5:return Kp(d),null;case 13:if(kt(mn),f=d.memoizedState,f!==null&&f.dehydrated!==null){if(d.alternate===null)throw Error(o(340));Ha()}return f=d.flags,f&65536?(d.flags=f&-65537|128,d):null;case 19:return kt(mn),null;case 4:return Xa(),null;case 10:return Zn(d.type._context),null;case 22:case 23:return Cm(),null;case 24:return null;default:return null}}var Xh=!1,zo=!1,P2=typeof WeakSet=="function"?WeakSet:Set,Qe=null;function jh(f,d){var S=f.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(T){Ni(f,d,T)}else S.current=null}function hm(f,d,S){try{S()}catch(T){Ni(f,d,T)}}var mx=!1;function L2(f,d){for(G(f.containerInfo),Qe=d;Qe!==null;)if(f=Qe,d=f.child,(f.subtreeFlags&1028)!==0&&d!==null)d.return=f,Qe=d;else for(;Qe!==null;){f=Qe;try{var S=f.alternate;if((f.flags&1024)!==0)switch(f.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var T=S.memoizedProps,R=S.memoizedState,U=f.stateNode,Q=U.getSnapshotBeforeUpdate(f.elementType===f.type?T:Ei(f.type,T),R);U.__reactInternalSnapshotBeforeUpdate=Q}break;case 3:ae&&Ge(f.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(he){Ni(f,f.return,he)}if(d=f.sibling,d!==null){d.return=f.return,Qe=d;break}Qe=f.return}return S=mx,mx=!1,S}function Bo(f,d,S){var T=d.updateQueue;if(T=T!==null?T.lastEffect:null,T!==null){var R=T=T.next;do{if((R.tag&f)===f){var U=R.destroy;R.destroy=void 0,U!==void 0&&hm(d,S,U)}R=R.next}while(R!==T)}}function bc(f,d){if(d=d.updateQueue,d=d!==null?d.lastEffect:null,d!==null){var S=d=d.next;do{if((S.tag&f)===f){var T=S.create;S.destroy=T()}S=S.next}while(S!==d)}}function fm(f){var d=f.ref;if(d!==null){var S=f.stateNode;switch(f.tag){case 5:f=W(S);break;default:f=S}typeof d=="function"?d(f):d.current=f}}function gx(f,d,S){if(Wi&&typeof Wi.onCommitFiberUnmount=="function")try{Wi.onCommitFiberUnmount(Io,d)}catch{}switch(d.tag){case 0:case 11:case 14:case 15:if(f=d.updateQueue,f!==null&&(f=f.lastEffect,f!==null)){var T=f=f.next;do{var R=T,U=R.destroy;R=R.tag,U!==void 0&&((R&2)!==0||(R&4)!==0)&&hm(d,S,U),T=T.next}while(T!==f)}break;case 1:if(jh(d,S),f=d.stateNode,typeof f.componentWillUnmount=="function")try{f.props=d.memoizedProps,f.state=d.memoizedState,f.componentWillUnmount()}catch(Q){Ni(d,S,Q)}break;case 5:jh(d,S);break;case 4:ae?Sx(f,d,S):z&&z&&(d=d.stateNode.containerInfo,S=_t(d),Ot(d,S))}}function vx(f,d,S){for(var T=d;;)if(gx(f,T,S),T.child===null||ae&&T.tag===4){if(T===d)break;for(;T.sibling===null;){if(T.return===null||T.return===d)return;T=T.return}T.sibling.return=T.return,T=T.sibling}else T.child.return=T,T=T.child}function yx(f){var d=f.alternate;d!==null&&(f.alternate=null,yx(d)),f.child=null,f.deletions=null,f.sibling=null,f.tag===5&&(d=f.stateNode,d!==null&&Ie(d)),f.stateNode=null,f.return=null,f.dependencies=null,f.memoizedProps=null,f.memoizedState=null,f.pendingProps=null,f.stateNode=null,f.updateQueue=null}function _x(f){return f.tag===5||f.tag===3||f.tag===4}function xx(f){e:for(;;){for(;f.sibling===null;){if(f.return===null||_x(f.return))return null;f=f.return}for(f.sibling.return=f.return,f=f.sibling;f.tag!==5&&f.tag!==6&&f.tag!==18;){if(f.flags&2||f.child===null||f.tag===4)continue e;f.child.return=f,f=f.child}if(!(f.flags&2))return f.stateNode}}function wx(f){if(ae){e:{for(var d=f.return;d!==null;){if(_x(d))break e;d=d.return}throw Error(o(160))}var S=d;switch(S.tag){case 5:d=S.stateNode,S.flags&32&&(nt(d),S.flags&=-33),S=xx(f),pm(f,S,d);break;case 3:case 4:d=S.stateNode.containerInfo,S=xx(f),dm(f,S,d);break;default:throw Error(o(161))}}}function dm(f,d,S){var T=f.tag;if(T===5||T===6)f=f.stateNode,d?Ve(S,f,d):Fe(S,f);else if(T!==4&&(f=f.child,f!==null))for(dm(f,d,S),f=f.sibling;f!==null;)dm(f,d,S),f=f.sibling}function pm(f,d,S){var T=f.tag;if(T===5||T===6)f=f.stateNode,d?$e(S,f,d):Me(S,f);else if(T!==4&&(f=f.child,f!==null))for(pm(f,d,S),f=f.sibling;f!==null;)pm(f,d,S),f=f.sibling}function Sx(f,d,S){for(var T=d,R=!1,U,Q;;){if(!R){R=T.return;e:for(;;){if(R===null)throw Error(o(160));switch(U=R.stateNode,R.tag){case 5:Q=!1;break e;case 3:U=U.containerInfo,Q=!0;break e;case 4:U=U.containerInfo,Q=!0;break e}R=R.return}R=!0}if(T.tag===5||T.tag===6)vx(f,T,S),Q?We(U,T.stateNode):Oe(U,T.stateNode);else if(T.tag===18)Q?lt(U,T.stateNode):it(U,T.stateNode);else if(T.tag===4){if(T.child!==null){U=T.stateNode.containerInfo,Q=!0,T.child.return=T,T=T.child;continue}}else if(gx(f,T,S),T.child!==null){T.child.return=T,T=T.child;continue}if(T===d)break;for(;T.sibling===null;){if(T.return===null||T.return===d)return;T=T.return,T.tag===4&&(R=!1)}T.sibling.return=T.return,T=T.sibling}}function mm(f,d){if(ae){switch(d.tag){case 0:case 11:case 14:case 15:Bo(3,d,d.return),bc(3,d),Bo(5,d,d.return);return;case 1:return;case 5:var S=d.stateNode;if(S!=null){var T=d.memoizedProps;f=f!==null?f.memoizedProps:T;var R=d.type,U=d.updateQueue;d.updateQueue=null,U!==null&&Be(S,U,R,f,T,d)}return;case 6:if(d.stateNode===null)throw Error(o(162));S=d.memoizedProps,Ue(d.stateNode,f!==null?f.memoizedProps:S,S);return;case 3:oe&&f!==null&&f.memoizedState.isDehydrated&&pe(d.stateNode.containerInfo);return;case 12:return;case 13:Yh(d);return;case 19:Yh(d);return;case 17:return}throw Error(o(163))}switch(d.tag){case 0:case 11:case 14:case 15:Bo(3,d,d.return),bc(3,d),Bo(5,d,d.return);return;case 12:return;case 13:Yh(d);return;case 19:Yh(d);return;case 3:oe&&f!==null&&f.memoizedState.isDehydrated&&pe(d.stateNode.containerInfo);break;case 22:case 23:return}e:if(z){switch(d.tag){case 1:case 5:case 6:break e;case 3:case 4:d=d.stateNode,Ot(d.containerInfo,d.pendingChildren);break e}throw Error(o(163))}}function Yh(f){var d=f.updateQueue;if(d!==null){f.updateQueue=null;var S=f.stateNode;S===null&&(S=f.stateNode=new P2),d.forEach(function(T){var R=G2.bind(null,f,T);S.has(T)||(S.add(T),T.then(R,R))})}}function I2(f,d){for(Qe=d;Qe!==null;){d=Qe;var S=d.deletions;if(S!==null)for(var T=0;T";case Zh:return":has("+(ym(f)||"")+")";case Kh:return'[role="'+f.value+'"]';case Jh:return'"'+f.value+'"';case $h:return'[data-testname="'+f.value+'"]';default:throw Error(o(365))}}function Ax(f,d){var S=[];f=[f,0];for(var T=0;TR&&(R=Q),T&=~U}if(T=R,T=pn()-T,T=(120>T?120:480>T?480:1080>T?1080:1920>T?1920:3e3>T?3e3:4320>T?4320:1960*U2(T/1960))-T,10f?16:f,Js===null)var T=!1;else{if(f=Js,Js=null,rf=0,(Dt&6)!==0)throw Error(o(331));var R=Dt;for(Dt|=4,Qe=f.current;Qe!==null;){var U=Qe,Q=U.child;if((Qe.flags&16)!==0){var he=U.deletions;if(he!==null){for(var Ce=0;Cepn()-Sm?Go(f,0):wm|=S),Oi(f,d)}function Nx(f,d){d===0&&((f.mode&1)===0?d=1:(d=ds,ds<<=1,(ds&130023424)===0&&(ds=4194304)));var S=Ti();f=af(f,d),f!==null&&(Yr(f,d,S),Oi(f,S))}function B2(f){var d=f.memoizedState,S=0;d!==null&&(S=d.retryLane),Nx(f,S)}function G2(f,d){var S=0;switch(f.tag){case 13:var T=f.stateNode,R=f.memoizedState;R!==null&&(S=R.retryLane);break;case 19:T=f.stateNode;break;default:throw Error(o(314))}T!==null&&T.delete(d),Nx(f,S)}var Fx;Fx=function(f,d,S){if(f!==null)if(f.memoizedProps!==d.pendingProps||cn.current)Zi=!0;else{if((f.lanes&S)===0&&(d.flags&128)===0)return Zi=!1,C2(f,d,S);Zi=(f.flags&131072)!==0}else Zi=!1,un&&(d.flags&1048576)!==0&&E_(d,Ph,d.index);switch(d.lanes=0,d.tag){case 2:var T=d.type;f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),f=d.pendingProps;var R=Qt(d,En.current);Rn(d,S),R=em(null,d,T,f,R,S);var U=tm();return d.flags|=1,typeof R=="object"&&R!==null&&typeof R.render=="function"&&R.$$typeof===void 0?(d.tag=1,d.memoizedState=null,d.updateQueue=null,on(T)?(U=!0,jr(d)):U=!1,d.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,Gp(d),R.updater=Ch,d.stateNode=R,R._reactInternals=d,Vp(d,T,f,S),d=lm(null,d,T,!0,U,S)):(d.tag=0,un&&U&&Wp(d),Mi(null,d,R,S),d=d.child),d;case 16:T=d.elementType;e:{switch(f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),f=d.pendingProps,R=T._init,T=R(T._payload),d.type=T,R=d.tag=V2(T),f=Ei(T,f),R){case 0:d=am(null,d,T,f,S);break e;case 1:d=ax(null,d,T,f,S);break e;case 11:d=nx(null,d,T,f,S);break e;case 14:d=ix(null,d,T,Ei(T.type,f),S);break e}throw Error(o(306,T,""))}return d;case 0:return T=d.type,R=d.pendingProps,R=d.elementType===T?R:Ei(T,R),am(f,d,T,R,S);case 1:return T=d.type,R=d.pendingProps,R=d.elementType===T?R:Ei(T,R),ax(f,d,T,R,S);case 3:e:{if(lx(d),f===null)throw Error(o(387));T=d.pendingProps,U=d.memoizedState,R=U.element,g_(f,d),Ah(d,T,null,S);var Q=d.memoizedState;if(T=Q.element,oe&&U.isDehydrated)if(U={element:T,isDehydrated:!1,cache:Q.cache,transitions:Q.transitions},d.updateQueue.baseState=U,d.memoizedState=U,d.flags&256){R=Error(o(423)),d=cx(f,d,T,S,R);break e}else if(T!==R){R=Error(o(424)),d=cx(f,d,T,S,R);break e}else for(oe&&(qi=Gn(d.stateNode.containerInfo),Yi=d,un=!0,Ar=null,fc=!1),S=R_(d,null,T,S),d.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if(Ha(),T===R){d=ws(f,d,S);break e}Mi(f,d,T,S)}d=d.child}return d;case 5:return P_(d),f===null&&Yp(d),T=d.type,R=d.pendingProps,U=f!==null?f.memoizedProps:null,Q=R.children,ie(T,R)?Q=null:U!==null&&ie(T,U)&&(d.flags|=32),ox(f,d),Mi(f,d,Q,S),d.child;case 6:return f===null&&Yp(d),null;case 13:return ux(f,d,S);case 4:return Zp(d,d.stateNode.containerInfo),T=d.pendingProps,f===null?d.child=Va(d,null,T,S):Mi(f,d,T,S),d.child;case 11:return T=d.type,R=d.pendingProps,R=d.elementType===T?R:Ei(T,R),nx(f,d,T,R,S);case 7:return Mi(f,d,d.pendingProps,S),d.child;case 8:return Mi(f,d,d.pendingProps.children,S),d.child;case 12:return Mi(f,d,d.pendingProps.children,S),d.child;case 10:e:{if(T=d.type._context,R=d.pendingProps,U=d.memoizedProps,Q=R.value,Mh(d,T,Q),U!==null)if(Xi(U.value,Q)){if(U.children===R.children&&!cn.current){d=ws(f,d,S);break e}}else for(U=d.child,U!==null&&(U.return=d);U!==null;){var he=U.dependencies;if(he!==null){Q=U.child;for(var Ce=he.firstContext;Ce!==null;){if(Ce.context===T){if(U.tag===1){Ce=vs(-1,S&-S),Ce.tag=2;var Xe=U.updateQueue;if(Xe!==null){Xe=Xe.shared;var rt=Xe.pending;rt===null?Ce.next=Ce:(Ce.next=rt.next,rt.next=Ce),Xe.pending=Ce}}U.lanes|=S,Ce=U.alternate,Ce!==null&&(Ce.lanes|=S),bi(U.return,S,d),he.lanes|=S;break}Ce=Ce.next}}else if(U.tag===10)Q=U.type===d.type?null:U.child;else if(U.tag===18){if(Q=U.return,Q===null)throw Error(o(341));Q.lanes|=S,he=Q.alternate,he!==null&&(he.lanes|=S),bi(Q,S,d),Q=U.sibling}else Q=U.child;if(Q!==null)Q.return=U;else for(Q=U;Q!==null;){if(Q===d){Q=null;break}if(U=Q.sibling,U!==null){U.return=Q.return,Q=U;break}Q=Q.return}U=Q}Mi(f,d,R.children,S),d=d.child}return d;case 9:return R=d.type,T=d.pendingProps.children,Rn(d,S),R=Pn(R),T=T(R),d.flags|=1,Mi(f,d,T,S),d.child;case 14:return T=d.type,R=Ei(T,d.pendingProps),R=Ei(T.type,R),ix(f,d,T,R,S);case 15:return rx(f,d,d.type,d.pendingProps,S);case 17:return T=d.type,R=d.pendingProps,R=d.elementType===T?R:Ei(T,R),f!==null&&(f.alternate=null,d.alternate=null,d.flags|=2),d.tag=1,on(T)?(f=!0,jr(d)):f=!1,Rn(d,S),w_(d,T,R),Vp(d,T,R,S),lm(null,d,T,!0,f,S);case 19:return px(f,d,S);case 22:return sx(f,d,S)}throw Error(o(156,d.tag))};function kx(f,d){return gs(f,d)}function H2(f,d,S,T){this.tag=f,this.key=S,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=T,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fr(f,d,S,T){return new H2(f,d,S,T)}function Pm(f){return f=f.prototype,!(!f||!f.isReactComponent)}function V2(f){if(typeof f=="function")return Pm(f)?1:0;if(f!=null){if(f=f.$$typeof,f===_)return 11;if(f===x)return 14}return 2}function to(f,d){var S=f.alternate;return S===null?(S=fr(f.tag,d,f.key,f.mode),S.elementType=f.elementType,S.type=f.type,S.stateNode=f.stateNode,S.alternate=f,f.alternate=S):(S.pendingProps=d,S.type=f.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=f.flags&14680064,S.childLanes=f.childLanes,S.lanes=f.lanes,S.child=f.child,S.memoizedProps=f.memoizedProps,S.memoizedState=f.memoizedState,S.updateQueue=f.updateQueue,d=f.dependencies,S.dependencies=d===null?null:{lanes:d.lanes,firstContext:d.firstContext},S.sibling=f.sibling,S.index=f.index,S.ref=f.ref,S}function cf(f,d,S,T,R,U){var Q=2;if(T=f,typeof f=="function")Pm(f)&&(Q=1);else if(typeof f=="string")Q=5;else e:switch(f){case u:return Wo(S.children,R,U,d);case h:Q=8,R|=8;break;case p:return f=fr(12,S,d,R|2),f.elementType=p,f.lanes=U,f;case y:return f=fr(13,S,d,R),f.elementType=y,f.lanes=U,f;case g:return f=fr(19,S,d,R),f.elementType=g,f.lanes=U,f;case E:return uf(S,R,U,d);default:if(typeof f=="object"&&f!==null)switch(f.$$typeof){case m:Q=10;break e;case v:Q=9;break e;case _:Q=11;break e;case x:Q=14;break e;case w:Q=16,T=null;break e}throw Error(o(130,f==null?f:typeof f,""))}return d=fr(Q,S,d,R),d.elementType=f,d.type=T,d.lanes=U,d}function Wo(f,d,S,T){return f=fr(7,f,T,d),f.lanes=S,f}function uf(f,d,S,T){return f=fr(22,f,T,d),f.elementType=E,f.lanes=S,f.stateNode={},f}function Lm(f,d,S){return f=fr(6,f,null,d),f.lanes=S,f}function Im(f,d,S){return d=fr(4,f.children!==null?f.children:[],f.key,d),d.lanes=S,d.stateNode={containerInfo:f.containerInfo,pendingChildren:null,implementation:f.implementation},d}function W2(f,d,S,T,R){this.tag=d,this.containerInfo=f,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Ae,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Na(0),this.expirationTimes=Na(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Na(0),this.identifierPrefix=T,this.onRecoverableError=R,oe&&(this.mutableSourceEagerHydrationData=null)}function zx(f,d,S,T,R,U,Q,he,Ce){return f=new W2(f,d,S,he,Ce),d===1?(d=1,U===!0&&(d|=8)):d=0,U=fr(3,null,null,d),f.current=U,U.stateNode=f,U.memoizedState={element:T,isDehydrated:S,cache:null,transitions:null},Gp(U),f}function Bx(f){if(!f)return Cn;f=f._reactInternals;e:{if(C(f)!==f||f.tag!==1)throw Error(o(170));var d=f;do{switch(d.tag){case 3:d=d.stateNode.context;break e;case 1:if(on(d.type)){d=d.stateNode.__reactInternalMemoizedMergedChildContext;break e}}d=d.return}while(d!==null);throw Error(o(171))}if(f.tag===1){var S=f.type;if(on(S))return Xr(f,S,d)}return d}function Gx(f){var d=f._reactInternals;if(d===void 0)throw typeof f.render=="function"?Error(o(188)):(f=Object.keys(f).join(","),Error(o(268,f)));return f=N(d),f===null?null:f.stateNode}function Hx(f,d){if(f=f.memoizedState,f!==null&&f.dehydrated!==null){var S=f.retryLane;f.retryLane=S!==0&&S=Xe&&U>=St&&R<=rt&&Q<=ht){f.splice(d,1);break}else if(T!==Xe||S.width!==Ce.width||htQ){if(!(U!==St||S.height!==Ce.height||rtR)){Xe>T&&(Ce.width+=Xe-T,Ce.x=T),rtU&&(Ce.height+=St-U,Ce.y=U),htS&&(S=Q)),Q ")+` - -No matching component was found for: - `)+f.join(" > ")}return null},t.getPublicRootInstance=function(f){if(f=f.current,!f.child)return null;switch(f.child.tag){case 5:return W(f.child.stateNode);default:return f.child.stateNode}},t.injectIntoDevTools=function(f){if(f={bundleType:f.bundleType,version:f.version,rendererPackageName:f.rendererPackageName,rendererConfig:f.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:X2,findFiberByHostInstance:f.findFiberByHostInstance||j2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")f=!1;else{var d=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(d.isDisabled||!d.supportsFiber)f=!0;else{try{Io=d.inject(f),Wi=d}catch{}f=!!d.checkDCE}}return f},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(f,d,S,T){if(!Le)throw Error(o(363));f=_m(f,d);var R=be(f,S,T).disconnect;return{disconnect:function(){R()}}},t.registerMutableSourceForHydration=function(f,d){var S=d._getVersion;S=S(d._source),f.mutableSourceEagerHydrationData==null?f.mutableSourceEagerHydrationData=[d,S]:f.mutableSourceEagerHydrationData.push(d,S)},t.runWithPriority=function(f,d){var S=Ut;try{return Ut=f,d()}finally{Ut=S}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(f,d,S,T){var R=d.current,U=Ti(),Q=Qs(R);return S=Bx(S),d.context===null?d.context=S:d.pendingContext=S,d=vs(U,Q),d.payload={element:f},T=T===void 0?null:T,T!==null&&(d.callback=T),Ks(R,d),f=hr(R,Q,U),f!==null&&Th(f,R,Q),Q},t}),yg}var Sw;function j3(){return Sw||(Sw=1,mg.exports=X3()),mg.exports}var Y3=j3();const q3=Hr(Y3);var _g={exports:{}},xg={};/** - * @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. - */var Ew;function Z3(){return Ew||(Ew=1,(function(r){function e(k,G){var B=k.length;k.push(G);e:for(;0>>1,V=k[D];if(0>>1;Di(ie,B))uei(ce,ie)?(k[D]=ce,k[ue]=B,D=ue):(k[D]=ie,k[ee]=B,D=ee);else if(uei(ce,B))k[D]=ce,k[ue]=B,D=ue;else break e}}return G}function i(k,G){var B=k.sortIndex-G.sortIndex;return B!==0?B:k.id-G.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();r.unstable_now=function(){return o.now()-a}}var l=[],c=[],u=1,h=null,p=3,m=!1,v=!1,_=!1,y=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(k){for(var G=t(c);G!==null;){if(G.callback===null)n(c);else if(G.startTime<=k)n(c),G.sortIndex=G.expirationTime,e(l,G);else break;G=t(c)}}function E(k){if(_=!1,w(k),!v)if(t(l)!==null)v=!0,W(b);else{var G=t(c);G!==null&&O(E,G.startTime-k)}}function b(k,G){v=!1,_&&(_=!1,g(P),P=-1),m=!0;var B=p;try{for(w(G),h=t(l);h!==null&&(!(h.expirationTime>G)||k&&!F());){var D=h.callback;if(typeof D=="function"){h.callback=null,p=h.priorityLevel;var V=D(h.expirationTime<=G);G=r.unstable_now(),typeof V=="function"?h.callback=V:h===t(l)&&n(l),w(G)}else n(l);h=t(l)}if(h!==null)var Z=!0;else{var ee=t(c);ee!==null&&O(E,ee.startTime-G),Z=!1}return Z}finally{h=null,p=B,m=!1}}var M=!1,A=null,P=-1,C=5,L=-1;function F(){return!(r.unstable_now()-Lk||125D?(k.sortIndex=B,e(c,k),t(l)===null&&k===t(c)&&(_?(g(P),P=-1):_=!0,O(E,B-D))):(k.sortIndex=V,e(l,k),v||m||(v=!0,W(b))),k},r.unstable_shouldYield=F,r.unstable_wrapCallback=function(k){var G=p;return function(){var B=p;p=G;try{return k.apply(this,arguments)}finally{p=B}}}})(xg)),xg}var bw;function K3(){return bw||(bw=1,_g.exports=Z3()),_g.exports}var Mw=K3();const $3=r=>typeof r=="object"&&typeof r.then=="function",Jf=[];function J3(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Jf.indexOf(i);s!==-1&&Jf.splice(s,1)},promise:($3(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Jf.push(i),!t)throw i.promise}const eO=(r,e,t)=>Q3(r,e,!1,t),Oy={},hT=r=>void Object.assign(Oy,r);function tO(r,e){function t(u,{args:h=[],attach:p,...m},v){let _=`${u[0].toUpperCase()}${u.slice(1)}`,y;if(u==="primitive"){if(m.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const g=m.object;y=Ll(g,{type:u,root:v,attach:p,primitive:!0})}else{const g=Oy[_];if(!g)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=Ll(new g(...h),{type:u,root:v,attach:p,memoizedProps:{args:h}})}return y.__r3f.attach===void 0&&(y instanceof Tt?y.__r3f.attach="geometry":y instanceof oi&&(y.__r3f.attach="material")),_!=="inject"&&Eg(y,m),y}function n(u,h){let p=!1;if(h){var m,v;(m=h.__r3f)!=null&&m.attach?Sg(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),p=!0),p||(v=u.__r3f)==null||v.objects.push(h),h.__r3f||Ll(h,{}),h.__r3f.parent=u,vv(h),Il(h)}}function i(u,h,p){let m=!1;if(h){var v,_;if((v=h.__r3f)!=null&&v.attach)Sg(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"});const y=u.children.filter(x=>x!==h),g=y.indexOf(p);u.children=[...y.slice(0,g),h,...y.slice(g)],m=!0}m||(_=u.__r3f)==null||_.objects.push(h),h.__r3f||Ll(h,{}),h.__r3f.parent=u,vv(h),Il(h)}}function s(u,h,p=!1){u&&[...u].forEach(m=>o(h,m,p))}function o(u,h,p){if(h){var m,v,_;if(h.__r3f&&(h.__r3f.parent=null),(m=u.__r3f)!=null&&m.objects&&(u.__r3f.objects=u.__r3f.objects.filter(E=>E!==h)),(v=h.__r3f)!=null&&v.attach)Pw(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var y;u.remove(h),(y=h.__r3f)!=null&&y.root&&lO(h.__r3f.root,h)}const x=(_=h.__r3f)==null?void 0:_.primitive,w=p===void 0?h.dispose!==null&&!x:p;if(!x){var g;s((g=h.__r3f)==null?void 0:g.objects,h,w),s(h.children,h,w)}delete h.__r3f,w&&h.dispose&&h.type!=="Scene"&&Mw.unstable_scheduleCallback(Mw.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),Il(u)}}function a(u,h,p,m){var v;const _=(v=u.__r3f)==null?void 0:v.parent;if(!_)return;const y=t(h,p,u.__r3f.root);if(u.children){for(const g of u.children)g.__r3f&&n(y,g);u.children=u.children.filter(g=>!g.__r3f)}u.__r3f.objects.forEach(g=>n(y,g)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(_,u),y.parent&&(y.__r3f.autoRemovedBeforeAppend=!0),n(_,y),y.raycast&&y.__r3f.eventCount&&y.__r3f.root.getState().internal.interaction.push(y),[m,m.alternate].forEach(g=>{g!==null&&(g.stateNode=y,g.ref&&(typeof g.ref=="function"?g.ref(y):g.ref.current=y))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:q3({createInstance:t,removeChild:o,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,h)=>{if(!h)return;const p=u.getState().scene;p.__r3f&&(p.__r3f.root=u,n(p,h))},removeChildFromContainer:(u,h)=>{h&&o(u.getState().scene,h)},insertInContainerBefore:(u,h,p)=>{if(!h||!p)return;const m=u.getState().scene;m.__r3f&&i(m,h,p)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;return!!((h=u==null?void 0:u.__r3f)!=null?h:{}).handlers},prepareUpdate(u,h,p,m){var v;if(((v=u==null?void 0:u.__r3f)!=null?v:{}).primitive&&m.object&&m.object!==u)return[!0];{const{args:y=[],children:g,...x}=m,{args:w=[],children:E,...b}=p;if(!Array.isArray(y))throw new Error("R3F: the args prop must be an array!");if(y.some((A,P)=>A!==w[P]))return[!0];const M=yT(u,x,b,!0);return M.changes.length?[!1,M]:null}},commitUpdate(u,[h,p],m,v,_,y){h?a(u,m,_,y):Eg(u,p)},commitMount(u,h,p,m){var v;const _=(v=u.__r3f)!=null?v:{};u.raycast&&_.handlers&&_.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>Ll(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:p,parent:m}=(h=u.__r3f)!=null?h:{};p&&m&&Pw(m,u,p),u.isObject3D&&(u.visible=!1),Il(u)},unhideInstance(u,h){var p;const{attach:m,parent:v}=(p=u.__r3f)!=null?p:{};m&&v&&Sg(v,u,m),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),Il(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Fl.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&hn.fun(performance.now)?performance.now:hn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:hn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:hn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Eg}}var Tw,Aw;const wg=r=>"colorSpace"in r||"outputColorSpace"in r,fT=()=>{var r;return(r=Oy.ColorManagement)!=null?r:null},dT=r=>r&&r.isOrthographicCamera,nO=r=>r&&r.hasOwnProperty("current"),hh=typeof window<"u"&&((Tw=window.document)!=null&&Tw.createElement||((Aw=window.navigator)==null?void 0:Aw.product)==="ReactNative")?K.useLayoutEffect:K.useEffect;function pT(r){const e=K.useRef(r);return hh(()=>void(e.current=r),[r]),e}function iO({set:r}){return hh(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class mT extends K.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}mT.getDerivedStateFromError=()=>({error:!0});const gT="__default",Cw=new Map,rO=r=>r&&!!r.memoized&&!!r.changes;function vT(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const zc=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()},hn={obj:r=>r===Object(r)&&!hn.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(hn.str(r)||hn.num(r))return r===e;const s=hn.obj(r);if(s&&n==="reference")return r===e;const o=hn.arr(r);if(o&&t==="reference")return r===e;if((o||s)&&r===e)return!0;let a;for(a in r)if(!(a in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(a in i?e:r)if(!hn.equ(r[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:r)if(r[a]!==e[a])return!1;if(hn.und(a)){if(o&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function sO(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function Ll(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function gv(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,o)=>s[o],r),{target:t,key:i}}else return{target:t,key:e}}const Rw=/-\d+$/;function Sg(r,e,t){if(hn.str(t)){if(Rw.test(t)){const s=t.replace(Rw,""),{target:o,key:a}=gv(r,s);Array.isArray(o[a])||(o[a]=[])}const{target:n,key:i}=gv(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function Pw(r,e,t){var n,i;if(hn.str(t)){const{target:s,key:o}=gv(r,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function yT(r,{children:e,key:t,ref:n,...i},{children:s,key:o,ref:a,...l}={},c=!1){var u;const h=(u=r==null?void 0:r.__r3f)!=null?u:{},p=Object.entries(i),m=[];if(c){const _=Object.keys(l);for(let y=0;y<_.length;y++)i.hasOwnProperty(_[y])||p.unshift([_[y],gT+"remove"])}p.forEach(([_,y])=>{var g;if((g=r.__r3f)!=null&&g.primitive&&_==="object"||hn.equ(y,l[_]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(_))return m.push([_,y,!0,[]]);let x=[];_.includes("-")&&(x=_.split("-")),m.push([_,y,!1,x]);for(const w in i){const E=i[w];w.startsWith(`${_}-`)&&m.push([w,E,!1,w.split("-")])}});const v={...i};return h.memoizedProps&&h.memoizedProps.args&&(v.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(v.attach=h.memoizedProps.attach),{memoized:v,changes:m}}function Eg(r,e){var t,n,i;const s=(t=r.__r3f)!=null?t:{},o=s.root,a=(n=o==null||o.getState==null?void 0:o.getState())!=null?n:{},{memoized:l,changes:c}=rO(e)?e:yT(r,e),u=s.eventCount;r.__r3f&&(r.__r3f.memoizedProps=l);for(let p=0;pw[E],r),!(x&&x.set))){const[w,...E]=y.reverse();g=E.reverse().reduce((b,M)=>b[M],r),m=w}if(v===gT+"remove")if(g.constructor){let w=Cw.get(g.constructor);w||(w=new g.constructor,Cw.set(g.constructor,w)),v=w[m]}else v=0;if(_)v?s.handlers[m]=v:delete s.handlers[m],s.eventCount=Object.keys(s.handlers).length;else if(x&&x.set&&(x.copy||x instanceof ga)){if(Array.isArray(v))x.fromArray?x.fromArray(v):x.set(...v);else if(x.copy&&v&&v.constructor&&x.constructor===v.constructor)x.copy(v);else if(v!==void 0){const w=x instanceof Ke;!w&&x.setScalar?x.setScalar(v):x instanceof ga&&v instanceof ga?x.mask=v.mask:x.set(v),!fT()&&!a.linear&&w&&x.convertSRGBToLinear()}}else if(g[m]=v,g[m]instanceof Sn&&g[m].format===Bi&&g[m].type===os){const w=g[m];wg(w)&&wg(a.gl)?w.colorSpace=a.gl.outputColorSpace:w.encoding=a.gl.outputEncoding}Il(r)}if(s.parent&&a.internal&&r.raycast&&u!==s.eventCount){const p=a.internal.interaction.indexOf(r);p>-1&&a.internal.interaction.splice(p,1),s.eventCount&&a.internal.interaction.push(r)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(i=r.__r3f)!=null&&i.parent&&vv(r),r}function Il(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function vv(r){r.onUpdate==null||r.onUpdate(r)}function oO(r,e){r.manual||(dT(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function Qf(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function aO(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Fl.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Fl.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Fl.ContinuousEventPriority;default:return Fl.DefaultEventPriority}}function _T(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function lO(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{_T(t.capturedMap,e,n,i)})}function cO(r){function e(l){const{internal:c}=r.getState(),u=l.offsetX-c.initialClick[0],h=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(u*u+h*h))}function t(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(u=>{var h;return(h=c.__r3f)==null?void 0:h.handlers["onPointer"+u]}))}function n(l,c){const u=r.getState(),h=new Set,p=[],m=c?c(u.internal.interaction):u.internal.interaction;for(let g=0;g{const w=zc(g.object),E=zc(x.object);return!w||!E?g.distance-x.distance:E.events.priority-w.events.priority||g.distance-x.distance}).filter(g=>{const x=Qf(g);return h.has(x)?!1:(h.add(x),!0)});u.events.filter&&(_=u.events.filter(_,u));for(const g of _){let x=g.object;for(;x;){var y;(y=x.__r3f)!=null&&y.eventCount&&p.push({...g,eventObject:x}),x=x.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let g of u.internal.capturedMap.get(l.pointerId).values())h.has(Qf(g.intersection))||p.push(g.intersection);return p}function i(l,c,u,h){const p=r.getState();if(l.length){const m={stopped:!1};for(const v of l){const _=zc(v.object)||p,{raycaster:y,pointer:g,camera:x,internal:w}=_,E=new Y(g.x,g.y,0).unproject(x),b=L=>{var F,N;return(F=(N=w.capturedMap.get(L))==null?void 0:N.has(v.eventObject))!=null?F:!1},M=L=>{const F={intersection:v,target:c.target};w.capturedMap.has(L)?w.capturedMap.get(L).set(v.eventObject,F):w.capturedMap.set(L,new Map([[v.eventObject,F]])),c.target.setPointerCapture(L)},A=L=>{const F=w.capturedMap.get(L);F&&_T(w.capturedMap,v.eventObject,F,L)};let P={};for(let L in c){let F=c[L];typeof F!="function"&&(P[L]=F)}let C={...v,...P,pointer:g,intersections:l,stopped:m.stopped,delta:u,unprojectedPoint:E,ray:y.ray,camera:x,stopPropagation(){const L="pointerId"in c&&w.capturedMap.get(c.pointerId);if((!L||L.has(v.eventObject))&&(C.stopped=m.stopped=!0,w.hovered.size&&Array.from(w.hovered.values()).find(F=>F.eventObject===v.eventObject))){const F=l.slice(0,l.indexOf(v));s([...F,v])}},target:{hasPointerCapture:b,setPointerCapture:M,releasePointerCapture:A},currentTarget:{hasPointerCapture:b,setPointerCapture:M,releasePointerCapture:A},nativeEvent:c};if(h(C),m.stopped===!0)break}}return l}function s(l){const{internal:c}=r.getState();for(const u of c.hovered.values())if(!l.length||!l.find(h=>h.object===u.object&&h.index===u.index&&h.instanceId===u.instanceId)){const p=u.eventObject.__r3f,m=p==null?void 0:p.handlers;if(c.hovered.delete(Qf(u)),p!=null&&p.eventCount){const v={...u,intersections:l};m.onPointerOut==null||m.onPointerOut(v),m.onPointerLeave==null||m.onPointerLeave(v)}}}function o(l,c){for(let u=0;us([]);case"onLostPointerCapture":return c=>{const{internal:u}=r.getState();"pointerId"in c&&u.capturedMap.has(c.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(c.pointerId)&&(u.capturedMap.delete(c.pointerId),s([]))})}}return function(u){const{onPointerMissed:h,internal:p}=r.getState();p.lastEvent.current=u;const m=l==="onPointerMove",v=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",y=n(u,m?t:void 0),g=v?e(u):0;l==="onPointerDown"&&(p.initialClick=[u.offsetX,u.offsetY],p.initialHits=y.map(w=>w.eventObject)),v&&!y.length&&g<=2&&(o(u,p.interaction),h&&h(u)),m&&s(y);function x(w){const E=w.eventObject,b=E.__r3f,M=b==null?void 0:b.handlers;if(b!=null&&b.eventCount)if(m){if(M.onPointerOver||M.onPointerEnter||M.onPointerOut||M.onPointerLeave){const A=Qf(w),P=p.hovered.get(A);P?P.stopped&&w.stopPropagation():(p.hovered.set(A,w),M.onPointerOver==null||M.onPointerOver(w),M.onPointerEnter==null||M.onPointerEnter(w))}M.onPointerMove==null||M.onPointerMove(w)}else{const A=M[l];A?(!v||p.initialHits.includes(E))&&(o(u,p.interaction.filter(P=>!p.initialHits.includes(P))),A(w)):v&&p.initialHits.includes(E)&&o(u,p.interaction.filter(P=>!p.initialHits.includes(P)))}}i(y,u,g,x)}}return{handlePointer:a}}const xT=r=>!!(r!=null&&r.render),wT=K.createContext(null),uO=(r,e)=>{const t=H3((a,l)=>{const c=new Y,u=new Y,h=new Y;function p(g=l().camera,x=u,w=l().size){const{width:E,height:b,top:M,left:A}=w,P=E/b;x instanceof Y?h.copy(x):h.set(...x);const C=g.getWorldPosition(c).distanceTo(h);if(dT(g))return{width:E/g.zoom,height:b/g.zoom,top:M,left:A,factor:1,distance:C,aspect:P};{const L=g.fov*Math.PI/180,F=2*Math.tan(L/2)*C,N=F*(E/b);return{width:N,height:F,top:M,left:A,factor:E/N,distance:C,aspect:P}}}let m;const v=g=>a(x=>({performance:{...x.performance,current:g}})),_=new De;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(g=1)=>r(l(),g),advance:(g,x)=>e(g,x,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Py,pointer:_,mouse:_,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const g=l();m&&clearTimeout(m),g.performance.current!==g.performance.min&&v(g.performance.min),m=setTimeout(()=>v(l().performance.max),g.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:g=>a(x=>({...x,events:{...x.events,...g}})),setSize:(g,x,w,E,b)=>{const M=l().camera,A={width:g,height:x,top:E||0,left:b||0,updateStyle:w};a(P=>({size:A,viewport:{...P.viewport,...p(M,u,A)}}))},setDpr:g=>a(x=>{const w=vT(g);return{viewport:{...x.viewport,dpr:w,initialDpr:x.viewport.initialDpr||w}}}),setFrameloop:(g="always")=>{const x=l().clock;x.stop(),x.elapsedTime=0,g!=="never"&&(x.start(),x.elapsedTime=0),a(()=>({frameloop:g}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:K.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(g,x,w)=>{const E=l().internal;return E.priority=E.priority+(x>0?1:0),E.subscribers.push({ref:g,priority:x,store:w}),E.subscribers=E.subscribers.sort((b,M)=>b.priority-M.priority),()=>{const b=l().internal;b!=null&&b.subscribers&&(b.priority=b.priority-(x>0?1:0),b.subscribers=b.subscribers.filter(M=>M.ref!==g))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,o=n.camera;return t.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:u,set:h}=t.getState();if(l!==i||c.dpr!==s){var p;i=l,s=c.dpr,oO(a,l),u.setPixelRatio(c.dpr);const m=(p=l.updateStyle)!=null?p:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,m)}a!==o&&(o=a,h(m=>({viewport:{...m.viewport,...m.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>r(a)),t};function hO(r,e){const t={callback:r};return e.add(t),()=>void e.delete(t)}let ed,ST=new Set,fO=new Set,dO=new Set;const pO=r=>hO(r,ST);function bg(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function Bc(r,e){switch(r){case"before":return bg(ST,e);case"after":return bg(fO,e);case"tail":return bg(dO,e)}}let Mg,Tg;function Ag(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),Mg=e.internal.subscribers,ed=0;ed0)&&!((c=i.gl.xr)!=null&&c.isPresenting)&&(t+=Ag(l,i))}if(Bc("after",l),t===0)return Bc("tail",l),e=!1,cancelAnimationFrame(n)}function o(l,c=1){var u;if(!l)return r.forEach(h=>o(h.store.getState()),c);(u=l.gl.xr)!=null&&u.isPresenting||!l.internal.active||l.frameloop==="never"||(l.internal.frames=Math.min(60,l.internal.frames+c),e||(e=!0,requestAnimationFrame(s)))}function a(l,c=!0,u,h){if(c&&Bc("before",l),u)Ag(l,u,h);else for(const p of r.values())Ag(l,p.store.getState());c&&Bc("after",l)}return{loop:s,invalidate:o,advance:a}}function ET(){const r=K.useContext(wT);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Bn(r=t=>t,e){return ET()(r,e)}function Ep(r,e=0){const t=ET(),n=t.getState().internal.subscribe,i=pT(r);return hh(()=>n(i,e,t),[e,n,t]),null}const jl=new Map,{invalidate:Lw,advance:Iw}=mO(jl),{reconciler:Nd,applyProps:oa}=tO(jl,aO),yl={objects:"shallow",strict:!1},gO=(r,e)=>{const t=typeof r=="function"?r(e):r;return xT(t)?t:new uy({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function vO(r,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:s}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:s}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function yO(r){const e=jl.get(r),t=e==null?void 0:e.fiber,n=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=n||uO(Lw,Iw),o=t||Nd.createContainer(s,Fl.ConcurrentRoot,null,!1,null,"",i,null);e||jl.set(r,{fiber:o,store:s});let a,l=!1,c;return{configure(u={}){let{gl:h,size:p,scene:m,events:v,onCreated:_,shadows:y=!1,linear:g=!1,flat:x=!1,legacy:w=!1,orthographic:E=!1,frameloop:b="always",dpr:M=[1,2],performance:A,raycaster:P,camera:C,onPointerMissed:L}=u,F=s.getState(),N=F.gl;F.gl||F.set({gl:N=gO(h,r)});let I=F.raycaster;I||F.set({raycaster:I=new Uy});const{params:X,...q}=P||{};if(hn.equ(q,I,yl)||oa(I,{...q}),hn.equ(X,I.params,yl)||oa(I,{params:{...I.params,...X}}),!F.camera||F.camera===c&&!hn.equ(c,C,yl)){c=C;const D=C instanceof rh,V=D?C:E?new Pa(0,0,0,0,.1,1e3):new zn(75,0,.1,1e3);D||(V.position.z=5,C&&oa(V,C),!F.camera&&!(C!=null&&C.rotation)&&V.lookAt(0,0,0)),F.set({camera:V})}if(!F.scene){let D;m instanceof ku?D=m:(D=new ku,m&&oa(D,m)),F.set({scene:Ll(D)})}if(!F.xr){const D=(ee,ie)=>{const ue=s.getState();ue.frameloop!=="never"&&Iw(ee,!0,ue,ie)},V=()=>{const ee=s.getState();ee.gl.xr.enabled=ee.gl.xr.isPresenting,ee.gl.xr.setAnimationLoop(ee.gl.xr.isPresenting?D:null),ee.gl.xr.isPresenting||Lw(ee)},Z={connect(){const ee=s.getState().gl;ee.xr.addEventListener("sessionstart",V),ee.xr.addEventListener("sessionend",V)},disconnect(){const ee=s.getState().gl;ee.xr.removeEventListener("sessionstart",V),ee.xr.removeEventListener("sessionend",V)}};N.xr&&Z.connect(),F.set({xr:Z})}if(N.shadowMap){const D=N.shadowMap.enabled,V=N.shadowMap.type;if(N.shadowMap.enabled=!!y,hn.boo(y))N.shadowMap.type=gu;else if(hn.str(y)){var W;const Z={basic:ub,percentage:qd,soft:gu,variance:Or};N.shadowMap.type=(W=Z[y])!=null?W:gu}else hn.obj(y)&&Object.assign(N.shadowMap,y);(D!==N.shadowMap.enabled||V!==N.shadowMap.type)&&(N.shadowMap.needsUpdate=!0)}const O=fT();O&&("enabled"in O?O.enabled=!w:"legacyMode"in O&&(O.legacyMode=w)),oa(N,{outputEncoding:g?3e3:3001,toneMapping:x?zr:Xv}),F.legacy!==w&&F.set(()=>({legacy:w})),F.linear!==g&&F.set(()=>({linear:g})),F.flat!==x&&F.set(()=>({flat:x})),h&&!hn.fun(h)&&!xT(h)&&!hn.equ(h,N,yl)&&oa(N,h),v&&!F.events.handlers&&F.set({events:v(s)});const B=vO(r,p);return hn.equ(B,F.size,yl)||F.setSize(B.width,B.height,B.updateStyle,B.top,B.left),M&&F.viewport.dpr!==vT(M)&&F.setDpr(M),F.frameloop!==b&&F.setFrameloop(b),F.onPointerMissed||F.set({onPointerMissed:L}),A&&!hn.equ(A,F.performance,yl)&&F.set(D=>({performance:{...D.performance,...A}})),a=_,l=!0,this},render(u){return l||this.configure(),Nd.updateContainer(K.createElement(_O,{store:s,children:u,onCreated:a,rootElement:r}),o,null,()=>{}),s},unmount(){bT(r)}}}function _O({store:r,children:e,onCreated:t,rootElement:n}){return hh(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),K.createElement(wT.Provider,{value:r},e)}function bT(r,e){const t=jl.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),Nd.updateContainer(null,n,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(),sO(i),jl.delete(r)}catch{}},500)})}}Nd.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:K.version});function Ta(){return Ta=Object.assign?Object.assign.bind():function(r){for(var e=1;e{window.clearTimeout(t),t=window.setTimeout(()=>r(...n),e)}}function xO({debounce:r,scroll:e,polyfill:t,offsetSize:n}={debounce:0,scroll:!1,offsetSize:!1}){const i=t||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=K.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=K.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:s,orientationHandler:null}),l=r?typeof r=="number"?r:r.scroll:null,c=r?typeof r=="number"?r:r.resize:null,u=K.useRef(!1);K.useEffect(()=>(u.current=!0,()=>void(u.current=!1)));const[h,p,m]=K.useMemo(()=>{const g=()=>{if(!a.current.element)return;const{left:x,top:w,width:E,height:b,bottom:M,right:A,x:P,y:C}=a.current.element.getBoundingClientRect(),L={left:x,top:w,width:E,height:b,bottom:M,right:A,x:P,y:C};a.current.element instanceof HTMLElement&&n&&(L.height=a.current.element.offsetHeight,L.width=a.current.element.offsetWidth),Object.freeze(L),u.current&&!bO(a.current.lastBounds,L)&&o(a.current.lastBounds=L)};return[g,c?Dw(g,c):g,l?Dw(g,l):g]},[o,n,l,c]);function v(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(g=>g.removeEventListener("scroll",m,!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 _(){a.current.element&&(a.current.resizeObserver=new i(m),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(g=>g.addEventListener("scroll",m,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{m()},"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=g=>{!g||g===a.current.element||(v(),a.current.element=g,a.current.scrollContainers=MT(g),_())};return SO(m,!!e),wO(p),K.useEffect(()=>{v(),_()},[e,m,p]),K.useEffect(()=>v,[]),[y,s,h]}function wO(r){K.useEffect(()=>{const e=r;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[r])}function SO(r,e){K.useEffect(()=>{if(e){const t=r;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[r,e])}function MT(r){const e=[];if(!r||r===document.body)return e;const{overflow:t,overflowX:n,overflowY:i}=window.getComputedStyle(r);return[t,n,i].some(s=>s==="auto"||s==="scroll")&&e.push(r),[...e,...MT(r.parentElement)]}const EO=["x","y","top","bottom","left","right","width","height"],bO=(r,e)=>EO.every(t=>r[t]===e[t]);var MO=Object.defineProperty,TO=Object.defineProperties,AO=Object.getOwnPropertyDescriptors,Uw=Object.getOwnPropertySymbols,CO=Object.prototype.hasOwnProperty,RO=Object.prototype.propertyIsEnumerable,Ow=(r,e,t)=>e in r?MO(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Nw=(r,e)=>{for(var t in e||(e={}))CO.call(e,t)&&Ow(r,t,e[t]);if(Uw)for(var t of Uw(e))RO.call(e,t)&&Ow(r,t,e[t]);return r},PO=(r,e)=>TO(r,AO(e)),Fw,kw;typeof window<"u"&&((Fw=window.document)!=null&&Fw.createElement||((kw=window.navigator)==null?void 0:kw.product)==="ReactNative")?K.useLayoutEffect:K.useEffect;function TT(r,e,t){if(!r)return;if(t(r)===!0)return r;let n=r.child;for(;n;){const i=TT(n,e,t);if(i)return i;n=n.sibling}}function AT(r){try{return Object.defineProperties(r,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return r}}const zw=console.error;console.error=function(){const r=[...arguments].join("");if(r!=null&&r.startsWith("Warning:")&&r.includes("useContext")){console.error=zw;return}return zw.apply(this,arguments)};const Ny=AT(K.createContext(null));class CT extends K.Component{render(){return K.createElement(Ny.Provider,{value:this._reactInternals},this.props.children)}}function LO(){const r=K.useContext(Ny);if(r===null)throw new Error("its-fine: useFiber must be called within a !");const e=K.useId();return K.useMemo(()=>{for(const n of[r,r==null?void 0:r.alternate]){if(!n)continue;const i=TT(n,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[r,e])}function IO(){const r=LO(),[e]=K.useState(()=>new Map);e.clear();let t=r;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!==Ny&&!e.has(i)&&e.set(i,K.useContext(AT(i)))}t=t.return}return e}function DO(){const r=IO();return K.useMemo(()=>Array.from(r.keys()).reduce((e,t)=>n=>K.createElement(e,null,K.createElement(t.Provider,PO(Nw({},n),{value:r.get(t)}))),e=>K.createElement(CT,Nw({},e))),[r])}const Cg={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 UO(r){const{handlePointer:e}=cO(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Cg).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([o,a])=>{const[l,c]=Cg[o];t.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,o])=>{if(n&&n.connected instanceof HTMLElement){const[a]=Cg[s];n.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const OO=K.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:o=UO,eventSource:a,eventPrefix:l,shadows:c,linear:u,flat:h,legacy:p,orthographic:m,frameloop:v,dpr:_,performance:y,raycaster:g,camera:x,onPointerMissed:w,onCreated:E,...b},M){K.useMemo(()=>hT(uT),[]);const A=DO(),[P,C]=xO({scroll:!0,debounce:{scroll:50,resize:0},...n}),L=K.useRef(null),F=K.useRef(null);K.useImperativeHandle(M,()=>L.current);const N=pT(w),[I,X]=K.useState(!1),[q,W]=K.useState(!1);if(I)throw I;if(q)throw q;const O=K.useRef(null);hh(()=>{const G=L.current;C.width>0&&C.height>0&&G&&(O.current||(O.current=yO(G)),O.current.configure({gl:s,events:o,shadows:c,linear:u,flat:h,legacy:p,orthographic:m,frameloop:v,dpr:_,performance:y,raycaster:g,camera:x,size:C,onPointerMissed:(...B)=>N.current==null?void 0:N.current(...B),onCreated:B=>{B.events.connect==null||B.events.connect(a?nO(a)?a.current:a:F.current),l&&B.setEvents({compute:(D,V)=>{const Z=D[l+"X"],ee=D[l+"Y"];V.pointer.set(Z/V.size.width*2-1,-(ee/V.size.height)*2+1),V.raycaster.setFromCamera(V.pointer,V.camera)}}),E==null||E(B)}}),O.current.render(K.createElement(A,null,K.createElement(mT,{set:W},K.createElement(K.Suspense,{fallback:K.createElement(iO,{set:X})},e)))))}),K.useEffect(()=>{const G=L.current;if(G)return()=>bT(G)},[]);const k=a?"none":"auto";return K.createElement("div",Ta({ref:F,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:k,...i}},b),K.createElement("div",{ref:P,style:{width:"100%",height:"100%"}},K.createElement("canvas",{ref:L,style:{display:"block"}},t)))}),NO=K.forwardRef(function(e,t){return K.createElement(CT,null,K.createElement(OO,Ta({},e,{ref:t})))});function FO(r,e,t){var n,i=1;r==null&&(r=0),e==null&&(e=0),t==null&&(t=0);function s(){var o,a=n.length,l,c=0,u=0,h=0;for(o=0;o=(l=(o+a)/2))?o=l:a=l,n=i,!(i=i[h=+u]))return n[h]=s,r;if(c=+r._x.call(null,i.data),e===c)return s.next=i,n?n[h]=s:r._root=s,r;do n=n?n[h]=new Array(2):r._root=new Array(2),(u=e>=(l=(o+a)/2))?o=l:a=l;while((h=+u)==(p=+(c>=l)));return n[p]=i,n[h]=s,r}function zO(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,t=new Float64Array(e);let n=1/0,i=-1/0;for(let s=0,o;si&&(i=o));if(n>i)return this;this.cover(n).cover(i);for(let s=0;sr||r>=t;)switch(o=+(ro||(s=c.x1)=h))&&(c=a[a.length-1],a[a.length-1]=a[a.length-1-u],a[a.length-1-u]=c)}else{var p=Math.abs(r-+this._x.call(null,l.data));p=(c=(o+a)/2))?o=c:a=c,e=t,!(t=t[h=+u]))return this;if(!t.length)break;e[h+1&1]&&(n=e,p=h)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[h]=s:delete e[h],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(n?n[p]=t:this._root=t),this):(this._root=s,this)}function XO(r){for(var e=0,t=r.length;e=(h=(a+c)/2))?a=h:c=h,(y=t>=(p=(l+u)/2))?l=p:u=p,i=s,!(s=s[g=y<<1|_]))return i[g]=o,r;if(m=+r._x.call(null,s.data),v=+r._y.call(null,s.data),e===m&&t===v)return o.next=s,i?i[g]=o:r._root=o,r;do i=i?i[g]=new Array(4):r._root=new Array(4),(_=e>=(h=(a+c)/2))?a=h:c=h,(y=t>=(p=(l+u)/2))?l=p:u=p;while((g=y<<1|_)===(x=(v>=p)<<1|m>=h));return i[x]=s,i[g]=o,r}function QO(r){var e,t,n=r.length,i,s,o=new Array(n),a=new Array(n),l=1/0,c=1/0,u=-1/0,h=-1/0;for(t=0;tu&&(u=i),sh&&(h=s));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),t=0;tr||r>=i||n>e||e>=s;)switch(c=(eu||(a=v.y0)>h||(l=v.x1)=g)<<1|r>=y)&&(v=p[p.length-1],p[p.length-1]=p[p.length-1-_],p[p.length-1-_]=v)}else{var x=r-+this._x.call(null,m.data),w=e-+this._y.call(null,m.data),E=x*x+w*w;if(E=(p=(o+l)/2))?o=p:l=p,(_=h>=(m=(a+c)/2))?a=m:c=m,e=t,!(t=t[y=_<<1|v]))return this;if(!t.length)break;(e[y+1&3]||e[y+2&3]||e[y+3&3])&&(n=e,g=y)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[y]=s:delete e[y],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[g]=t:this._root=t),this):(this._root=s,this)}function sN(r){for(var e=0,t=r.length;e=(v=(l+h)/2))?l=v:h=v,(b=t>=(_=(c+p)/2))?c=_:p=_,(M=n>=(y=(u+m)/2))?u=y:m=y,s=o,!(o=o[A=M<<2|b<<1|E]))return s[A]=a,r;if(g=+r._x.call(null,o.data),x=+r._y.call(null,o.data),w=+r._z.call(null,o.data),e===g&&t===x&&n===w)return a.next=o,s?s[A]=a:r._root=a,r;do s=s?s[A]=new Array(8):r._root=new Array(8),(E=e>=(v=(l+h)/2))?l=v:h=v,(b=t>=(_=(c+p)/2))?c=_:p=_,(M=n>=(y=(u+m)/2))?u=y:m=y;while((A=M<<2|b<<1|E)===(P=(w>=y)<<2|(x>=_)<<1|g>=v));return s[P]=o,s[A]=a,r}function mN(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,t=new Float64Array(e),n=new Float64Array(e),i=new Float64Array(e);let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,u=-1/0;for(let h=0,p,m,v,_;hl&&(l=m),vc&&(c=v),_u&&(u=_));if(s>l||o>c||a>u)return this;this.cover(s,o,a).cover(l,c,u);for(let h=0;hr||r>=o||i>e||e>=a||s>t||t>=l;)switch(p=(tv||(c=w.y0)>_||(u=w.z0)>y||(h=w.x1)=A)<<2|(e>=M)<<1|r>=b)&&(w=g[g.length-1],g[g.length-1]=g[g.length-1-E],g[g.length-1-E]=w)}else{var P=r-+this._x.call(null,x.data),C=e-+this._y.call(null,x.data),L=t-+this._z.call(null,x.data),F=P*P+C*C+L*L;if(FMath.sqrt((r-n)**2+(e-i)**2+(t-s)**2);function wN(r,e,t,n){const i=[],s=r-n,o=e-n,a=t-n,l=r+n,c=e+n,u=t+n;return this.visit((h,p,m,v,_,y,g)=>{if(!h.length)do{const x=h.data;xN(r,e,t,this._x(x),this._y(x),this._z(x))<=n&&i.push(x)}while(h=h.next);return p>l||m>c||v>u||_=(_=(o+c)/2))?o=_:c=_,(w=m>=(y=(a+u)/2))?a=y:u=y,(E=v>=(g=(l+h)/2))?l=g:h=g,e=t,!(t=t[b=E<<2|w<<1|x]))return this;if(!t.length)break;(e[b+1&7]||e[b+2&7]||e[b+3&7]||e[b+4&7]||e[b+5&7]||e[b+6&7]||e[b+7&7])&&(n=e,M=b)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[b]=s:delete e[b],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[M]=t:this._root=t),this):(this._root=s,this)}function EN(r){for(var e=0,t=r.length;e1&&(_=m.y+m.vy),t>2&&(y=m.z+m.vz),p.visit(E);function E(b,M,A,P,C,L,F){var N=[M,A,P,C,L,F],I=N[0],X=N[1],q=N[2],W=N[t],O=N[t+1],k=N[t+2],G=b.data,B=b.r,D=g+B;if(G){if(G.index>m.index){var V=v-G.x-G.vx,Z=t>1?_-G.y-G.vy:0,ee=t>2?y-G.z-G.vz:0,ie=V*V+Z*Z+ee*ee;ie1&&Z===0&&(Z=xr(i),ie+=Z*Z),t>2&&ee===0&&(ee=xr(i),ie+=ee*ee),ie=(D-(ie=Math.sqrt(ie)))/ie*s,m.vx+=(V*=ie)*(D=(B*=B)/(x+B)),t>1&&(m.vy+=(Z*=ie)*D),t>2&&(m.vz+=(ee*=ie)*D),G.vx-=V*(D=1-D),t>1&&(G.vy-=Z*D),t>2&&(G.vz-=ee*D))}return}return I>v+D||W1&&(X>_+D||O<_-D)||t>2&&(q>y+D||ku.r&&(u.r=u[h].r)}function c(){if(e){var u,h=e.length,p;for(n=new Array(h),u=0;utypeof p=="function")||Math.random,t=h.find(p=>[1,2,3].includes(p))||2,c()},a.iterations=function(u){return arguments.length?(o=+u,a):o},a.strength=function(u){return arguments.length?(s=+u,a):s},a.radius=function(u){return arguments.length?(r=typeof u=="function"?u:xn(+u),c(),a):r},a}function ON(r){return r.index}function Ww(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function DT(r){var e=ON,t=p,n,i=xn(30),s,o,a,l,c,u,h=1;r==null&&(r=[]);function p(g){return 1/Math.min(l[g.source.index],l[g.target.index])}function m(g){for(var x=0,w=r.length;x1&&(C=A.y+A.vy-M.y-M.vy||xr(u)),a>2&&(L=A.z+A.vz-M.z-M.vz||xr(u)),F=Math.sqrt(P*P+C*C+L*L),F=(F-s[E])/F*g*n[E],P*=F,C*=F,L*=F,A.vx-=P*(N=c[E]),a>1&&(A.vy-=C*N),a>2&&(A.vz-=L*N),M.vx+=P*(N=1-N),a>1&&(M.vy+=C*N),a>2&&(M.vz+=L*N)}function v(){if(o){var g,x=o.length,w=r.length,E=new Map(o.map((M,A)=>[e(M,A,o),M])),b;for(g=0,l=new Array(x);gtypeof w=="function")||Math.random,a=x.find(w=>[1,2,3].includes(w))||2,v()},m.links=function(g){return arguments.length?(r=g,v(),m):r},m.id=function(g){return arguments.length?(e=g,m):e},m.iterations=function(g){return arguments.length?(h=+g,m):h},m.strength=function(g){return arguments.length?(t=typeof g=="function"?g:xn(+g),_(),m):t},m.distance=function(g){return arguments.length?(i=typeof g=="function"?g:xn(+g),y(),m):i},m}var NN={value:()=>{}};function UT(){for(var r=0,e=arguments.length,t={},n;r=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}Md.prototype=UT.prototype={constructor:Md,on:function(r,e){var t=this._,n=FN(r+"",t),i,s=-1,o=n.length;if(arguments.length<2){for(;++s0)for(var t=new Array(i),n=0,i,s;n=0&&r._call.call(void 0,e),r=r._next;--Yl}function jw(){Aa=(kd=Yu.now())+bp,Yl=du=0;try{BN()}finally{Yl=0,HN(),Aa=0}}function GN(){var r=Yu.now(),e=r-kd;e>OT&&(bp-=e,kd=r)}function HN(){for(var r,e=Fd,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:Fd=t);pu=r,_v(n)}function _v(r){if(!Yl){du&&(du=clearTimeout(du));var e=r-Aa;e>24?(r<1/0&&(du=setTimeout(jw,r-Yu.now()-bp)),Gc&&(Gc=clearInterval(Gc))):(Gc||(kd=Yu.now(),Gc=setInterval(GN,OT)),Yl=1,NT(jw))}}const VN=1664525,WN=1013904223,Yw=4294967296;function XN(){let r=1;return()=>(r=(VN*r+WN)%Yw)/Yw}var qw=3;function Pg(r){return r.x}function Zw(r){return r.y}function jN(r){return r.z}var YN=10,qN=Math.PI*(3-Math.sqrt(5)),ZN=Math.PI*20/(9+Math.sqrt(221));function zT(r,e){e=e||2;var t=Math.min(qw,Math.max(1,Math.round(e))),n,i=1,s=.001,o=1-Math.pow(s,1/300),a=0,l=.6,c=new Map,u=kT(m),h=UT("tick","end"),p=XN();r==null&&(r=[]);function m(){v(),h.call("tick",n),i1&&(E.fy==null?E.y+=E.vy*=l:(E.y=E.fy,E.vy=0)),t>2&&(E.fz==null?E.z+=E.vz*=l:(E.z=E.fz,E.vz=0));return n}function _(){for(var g=0,x=r.length,w;g1&&isNaN(w.y)||t>2&&isNaN(w.z)){var E=YN*(t>2?Math.cbrt(.5+g):t>1?Math.sqrt(.5+g):g),b=g*qN,M=g*ZN;t===1?w.x=E:t===2?(w.x=E*Math.cos(b),w.y=E*Math.sin(b)):(w.x=E*Math.sin(b)*Math.cos(M),w.y=E*Math.cos(b),w.z=E*Math.sin(b)*Math.sin(M))}(isNaN(w.vx)||t>1&&isNaN(w.vy)||t>2&&isNaN(w.vz))&&(w.vx=0,t>1&&(w.vy=0),t>2&&(w.vz=0))}}function y(g){return g.initialize&&g.initialize(r,p,t),g}return _(),n={tick:v,restart:function(){return u.restart(m),n},stop:function(){return u.stop(),n},numDimensions:function(g){return arguments.length?(t=Math.min(qw,Math.max(1,Math.round(g))),c.forEach(y),n):t},nodes:function(g){return arguments.length?(r=g,_(),c.forEach(y),n):r},alpha:function(g){return arguments.length?(i=+g,n):i},alphaMin:function(g){return arguments.length?(s=+g,n):s},alphaDecay:function(g){return arguments.length?(o=+g,n):+o},alphaTarget:function(g){return arguments.length?(a=+g,n):a},velocityDecay:function(g){return arguments.length?(l=1-g,n):1-l},randomSource:function(g){return arguments.length?(p=g,c.forEach(y),n):p},force:function(g,x){return arguments.length>1?(x==null?c.delete(g):c.set(g,y(x)),n):c.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),x=g.shift()||0,w=(t>1?g.shift():null)||0,E=(t>2?g.shift():null)||0,b=g.shift()||1/0,M=0,A=r.length,P,C,L,F,N,I;for(b*=b,M=0;M1?(h.on(g,x),n):h.on(g)}}}function BT(){var r,e,t,n,i,s=xn(-30),o,a=1,l=1/0,c=.81;function u(v){var _,y=r.length,g=(e===1?Fy(r,Pg):e===2?zy(r,Pg,Zw):e===3?Gy(r,Pg,Zw,jN):null).visitAfter(p);for(i=v,_=0;_1&&(v.y=E/x),e>2&&(v.z=b/x)}else{y=v,y.x=y.data.x,e>1&&(y.y=y.data.y),e>2&&(y.z=y.data.z);do _+=o[y.data.index];while(y=y.next)}v.value=_}function m(v,_,y,g,x){if(!v.value)return!0;var w=[y,g,x][e-1],E=v.x-t.x,b=e>1?v.y-t.y:0,M=e>2?v.z-t.z:0,A=w-_,P=E*E+b*b+M*M;if(A*A/c1&&b===0&&(b=xr(n),P+=b*b),e>2&&M===0&&(M=xr(n),P+=M*M),P1&&(t.vy+=b*v.value*i/P),e>2&&(t.vz+=M*v.value*i/P)),!0;if(v.length||P>=l)return;(v.data!==t||v.next)&&(E===0&&(E=xr(n),P+=E*E),e>1&&b===0&&(b=xr(n),P+=b*b),e>2&&M===0&&(M=xr(n),P+=M*M),P1&&(t.vy+=b*A),e>2&&(t.vz+=M*A));while(v=v.next)}return u.initialize=function(v,..._){r=v,n=_.find(y=>typeof y=="function")||Math.random,e=_.find(y=>[1,2,3].includes(y))||2,h()},u.strength=function(v){return arguments.length?(s=typeof v=="function"?v:xn(+v),h(),u):s},u.distanceMin=function(v){return arguments.length?(a=v*v,u):Math.sqrt(a)},u.distanceMax=function(v){return arguments.length?(l=v*v,u):Math.sqrt(l)},u.theta=function(v){return arguments.length?(c=v*v,u):Math.sqrt(c)},u}function KN(r,e,t,n){var i,s,o=xn(.1),a,l;typeof r!="function"&&(r=xn(+r)),e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function c(h){for(var p=0,m=i.length;p1&&(v.vy+=y*w),s>2&&(v.vz+=g*w)}}function u(){if(i){var h,p=i.length;for(a=new Array(p),l=new Array(p),h=0;h[1,2,3].includes(m))||2,u()},c.strength=function(h){return arguments.length?(o=typeof h=="function"?h:xn(+h),u(),c):o},c.radius=function(h){return arguments.length?(r=typeof h=="function"?h:xn(+h),u(),c):r},c.x=function(h){return arguments.length?(e=+h,c):e},c.y=function(h){return arguments.length?(t=+h,c):t},c.z=function(h){return arguments.length?(n=+h,c):n},c}function xv(r){var e=xn(.1),t,n,i;typeof r!="function"&&(r=xn(r==null?0:+r));function s(a){for(var l=0,c=t.length,u;l=0;)e+=t[n].value;r.value=e}function QN(){return this.eachAfter(JN)}function eF(r,e){let t=-1;for(const n of this)r.call(e,n,++t,this);return this}function tF(r,e){for(var t=this,n=[t],i,s,o=-1;t=n.pop();)if(r.call(e,t,++o,this),i=t.children)for(s=i.length-1;s>=0;--s)n.push(i[s]);return this}function nF(r,e){for(var t=this,n=[t],i=[],s,o,a,l=-1;t=n.pop();)if(i.push(t),s=t.children)for(o=0,a=s.length;o=0;)t+=n[i].value;e.value=t})}function sF(r){return this.eachBefore(function(e){e.children&&e.children.sort(r)})}function oF(r){for(var e=this,t=aF(e,r),n=[e];e!==t;)e=e.parent,n.push(e);for(var i=n.length;r!==t;)n.splice(i,0,r),r=r.parent;return n}function aF(r,e){if(r===e)return r;var t=r.ancestors(),n=e.ancestors(),i=null;for(r=t.pop(),e=n.pop();r===e;)i=r,r=t.pop(),e=n.pop();return i}function lF(){for(var r=this,e=[r];r=r.parent;)e.push(r);return e}function cF(){return Array.from(this)}function uF(){var r=[];return this.eachBefore(function(e){e.children||r.push(e)}),r}function hF(){var r=this,e=[];return r.each(function(t){t!==r&&e.push({source:t.parent,target:t})}),e}function*fF(){var r=this,e,t=[r],n,i,s;do for(e=t.reverse(),t=[];r=e.pop();)if(yield r,n=r.children)for(i=0,s=n.length;i=0;--a)i.push(s=o[a]=new ql(o[a])),s.parent=n,s.depth=n.depth+1;return t.eachBefore(GT)}function dF(){return Mp(this).eachBefore(gF)}function pF(r){return r.children}function mF(r){return Array.isArray(r)?r[1]:null}function gF(r){r.data.value!==void 0&&(r.value=r.data.value),r.data=r.data.data}function GT(r){var e=0;do r.height=e;while((r=r.parent)&&r.height<++e)}function ql(r){this.data=r,this.depth=this.height=0,this.parent=null}ql.prototype=Mp.prototype={constructor:ql,count:QN,each:eF,eachAfter:nF,eachBefore:tF,find:iF,sum:rF,sort:sF,path:oF,ancestors:lF,descendants:cF,leaves:uF,links:hF,copy:dF,[Symbol.iterator]:fF};function Lg(r){return r==null?null:HT(r)}function HT(r){if(typeof r!="function")throw new Error;return r}function Hc(){return 0}function Vc(r){return function(){return r}}function vF(r){r.x0=Math.round(r.x0),r.y0=Math.round(r.y0),r.x1=Math.round(r.x1),r.y1=Math.round(r.y1)}function yF(r,e,t,n,i){for(var s=r.children,o,a=-1,l=s.length,c=r.value&&(n-e)/r.value;++aEF(t(E,b,i))),x=g.map($w),w=new Set(g).add("");for(const E of x)w.has(E)||(w.add(E),g.push(E),x.push($w(E)),s.push(Ig));o=(E,b)=>g[b],a=(E,b)=>x[b]}for(u=0,l=s.length;u=0&&(m=s[g],m.data===Ig);--g)m.data=null}if(h.parent=_F,h.eachBefore(function(g){g.depth=g.parent.depth+1,--l}).eachBefore(GT),h.parent=null,l>0)throw new Error("cycle");return h}return n.id=function(i){return arguments.length?(r=Lg(i),n):r},n.parentId=function(i){return arguments.length?(e=Lg(i),n):e},n.path=function(i){return arguments.length?(t=Lg(i),n):t},n}function EF(r){r=`${r}`;let e=r.length;return Sv(r,e-1)&&!Sv(r,e-2)&&(r=r.slice(0,-1)),r[0]==="/"?r:`/${r}`}function $w(r){let e=r.length;if(e<2)return"";for(;--e>1&&!Sv(r,e););return r.slice(0,e)}function Sv(r,e){if(r[e]==="/"){let t=0;for(;e>0&&r[--e]==="\\";)++t;if((t&1)===0)return!0}return!1}function bF(r,e){return r.parent===e.parent?1:2}function Dg(r){var e=r.children;return e?e[0]:r.t}function Ug(r){var e=r.children;return e?e[e.length-1]:r.t}function MF(r,e,t){var n=t/(e.i-r.i);e.c-=n,e.s+=t,r.c+=n,e.z+=t,e.m+=t}function TF(r){for(var e=0,t=0,n=r.children,i=n.length,s;--i>=0;)s=n[i],s.z+=e,s.m+=e,e+=s.s+(t+=s.c)}function AF(r,e,t){return r.a.parent===e.parent?r.a:t}function Td(r,e){this._=r,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}Td.prototype=Object.create(ql.prototype);function CF(r){for(var e=new Td(r,0),t,n=[e],i,s,o,a;t=n.pop();)if(s=t._.children)for(t.children=new Array(a=s.length),o=a-1;o>=0;--o)n.push(i=t.children[o]=new Td(s[o],o)),i.parent=t;return(e.parent=new Td(null,0)).children=[e],e}function RF(){var r=bF,e=1,t=1,n=null;function i(c){var u=CF(c);if(u.eachAfter(s),u.parent.m=-u.z,u.eachBefore(o),n)c.eachBefore(l);else{var h=c,p=c,m=c;c.eachBefore(function(x){x.xp.x&&(p=x),x.depth>m.depth&&(m=x)});var v=h===p?1:r(h,p)/2,_=v-h.x,y=e/(p.x+v+_),g=t/(m.depth||1);c.eachBefore(function(x){x.x=(x.x+_)*y,x.y=x.depth*g})}return c}function s(c){var u=c.children,h=c.parent.children,p=c.i?h[c.i-1]:null;if(u){TF(c);var m=(u[0].z+u[u.length-1].z)/2;p?(c.z=p.z+r(c._,p._),c.m=c.z-m):c.z=m}else p&&(c.z=p.z+r(c._,p._));c.parent.A=a(c,p,c.parent.A||h[0])}function o(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function a(c,u,h){if(u){for(var p=c,m=c,v=u,_=p.parent.children[0],y=p.m,g=m.m,x=v.m,w=_.m,E;v=Ug(v),p=Dg(p),v&&p;)_=Dg(_),m=Ug(m),m.a=c,E=v.z+x-p.z-y+r(v._,p._),E>0&&(MF(AF(v,c,h),c,E),y+=E,g+=E),x+=v.m,y+=p.m,w+=_.m,g+=m.m;v&&!Ug(m)&&(m.t=v,m.m+=x-g),p&&!Dg(_)&&(_.t=p,_.m+=y-w,h=c)}return h}function l(c){c.x*=e,c.y=c.depth*t}return i.separation=function(c){return arguments.length?(r=c,i):r},i.size=function(c){return arguments.length?(n=!1,e=+c[0],t=+c[1],i):n?null:[e,t]},i.nodeSize=function(c){return arguments.length?(n=!0,e=+c[0],t=+c[1],i):n?[e,t]:null},i}function PF(r,e,t,n,i){for(var s=r.children,o,a=-1,l=s.length,c=r.value&&(i-t)/r.value;++ax&&(x=c),M=y*y*b,w=Math.max(x/M,M/g),w>E){y-=c;break}E=w}o.push(l={value:y,dice:m1?n:1)},t})(LF);function UF(){var r=DF,e=!1,t=1,n=1,i=[0],s=Hc,o=Hc,a=Hc,l=Hc,c=Hc;function u(p){return p.x0=p.y0=0,p.x1=t,p.y1=n,p.eachBefore(h),i=[0],e&&p.eachBefore(vF),p}function h(p){var m=i[p.depth],v=p.x0+m,_=p.y0+m,y=p.x1-m,g=p.y1-m;y1&&ae.has(Le))&&(k>1&&ae.add(Le),se=l[oe+r],Ie=l[oe+e],Se=l[oe+t],ge=se-te,He=Ie-$,j=Math.sqrt(ge*ge+He*He),H=j0?(A[oe]+=ge/j*(1+de),P[oe]+=He/j*(1+de)):(A[oe]+=I*s(),P[oe]+=X*s())));for(v=0,_=0;v"u"?i:c};typeof i=="function"&&(o=i);var a=function(c){return o(c[n])},l=function(){return o(void 0)};return typeof n=="string"?(s.fromAttributes=a,s.fromGraph=function(c,u){return a(c.getNodeAttributes(u))},s.fromEntry=function(c,u){return a(u)}):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},s.fromGraph=function(c,u){return o(n(u,c.getNodeAttributes(u)))},s.fromEntry=function(c,u){return o(n(c,u))}):(s.fromAttributes=l,s.fromGraph=l,s.fromEntry=l),s}function t(n,i){var s={},o=function(c){return typeof c>"u"?i:c};typeof i=="function"&&(o=i);var a=function(c){return o(c[n])},l=function(){return o(void 0)};return typeof n=="string"?(s.fromAttributes=a,s.fromGraph=function(c,u){return a(c.getEdgeAttributes(u))},s.fromEntry=function(c,u){return a(u)},s.fromPartialEntry=s.fromEntry,s.fromMinimalEntry=s.fromEntry):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},s.fromGraph=function(c,u){var h=c.extremities(u);return o(n(u,c.getEdgeAttributes(u),h[0],h[1],c.getNodeAttributes(h[0]),c.getNodeAttributes(h[1]),c.isUndirected(u)))},s.fromEntry=function(c,u,h,p,m,v,_){return o(n(c,u,h,p,m,v,_))},s.fromPartialEntry=function(c,u,h,p){return o(n(c,u,h,p))},s.fromMinimalEntry=function(c,u){return o(n(c,u))}):(s.fromAttributes=l,s.fromGraph=l,s.fromEntry=l,s.fromMinimalEntry=l),s}return Wc.createNodeValueGetter=e,Wc.createEdgeValueGetter=t,Wc.createEdgeWeightGetter=function(n){return t(n,r)},Wc}var Gg,oS;function WF(){if(oS)return Gg;oS=1;var r=0,e=1,t=2,n=3,i=4,s=5,o=6,a=7,l=8,c=9,u=0,h=1,p=2,m=0,v=1,_=2,y=3,g=4,x=5,w=6,E=7,b=8,M=3,A=10,P=3,C=9,L=10;return Gg=function(N,I,X){var q,W,O,k,G,B,D,V,Z,ee,ie=I.length,ue=X.length,ce=N.adjustSizes,le=N.barnesHutTheta*N.barnesHutTheta,Ae,Ee,ae,z,oe,te,se,$=[];for(O=0;One?(Se-=(H-ne)/2,Le=Se+H):(Ie-=(ne-H)/2,de=Ie+ne),$[0+m]=-1,$[0+v]=(Ie+de)/2,$[0+_]=(Se+Le)/2,$[0+y]=Math.max(de-Ie,Le-Se),$[0+g]=-1,$[0+x]=-1,$[0+w]=0,$[0+E]=0,$[0+b]=0,q=1,O=0;O=0){I[O+r]<$[W+v]?I[O+e]<$[W+_]?ge=$[W+x]:ge=$[W+x]+C:I[O+e]<$[W+_]?ge=$[W+x]+C*2:ge=$[W+x]+C*3,$[W+E]=($[W+E]*$[W+w]+I[O+r]*I[O+o])/($[W+w]+I[O+o]),$[W+b]=($[W+b]*$[W+w]+I[O+e]*I[O+o])/($[W+w]+I[O+o]),$[W+w]+=I[O+o],W=ge;continue}else if($[W+m]<0){$[W+m]=O;break}else{if($[W+x]=q*C,V=$[W+y]/2,Z=$[W+x],$[Z+m]=-1,$[Z+v]=$[W+v]-V,$[Z+_]=$[W+_]-V,$[Z+y]=V,$[Z+g]=Z+C,$[Z+x]=-1,$[Z+w]=0,$[Z+E]=0,$[Z+b]=0,Z+=C,$[Z+m]=-1,$[Z+v]=$[W+v]-V,$[Z+_]=$[W+_]+V,$[Z+y]=V,$[Z+g]=Z+C,$[Z+x]=-1,$[Z+w]=0,$[Z+E]=0,$[Z+b]=0,Z+=C,$[Z+m]=-1,$[Z+v]=$[W+v]+V,$[Z+_]=$[W+_]-V,$[Z+y]=V,$[Z+g]=Z+C,$[Z+x]=-1,$[Z+w]=0,$[Z+E]=0,$[Z+b]=0,Z+=C,$[Z+m]=-1,$[Z+v]=$[W+v]+V,$[Z+_]=$[W+_]+V,$[Z+y]=V,$[Z+g]=$[W+g],$[Z+x]=-1,$[Z+w]=0,$[Z+E]=0,$[Z+b]=0,q+=4,I[$[W+m]+r]<$[W+v]?I[$[W+m]+e]<$[W+_]?ge=$[W+x]:ge=$[W+x]+C:I[$[W+m]+e]<$[W+_]?ge=$[W+x]+C*2:ge=$[W+x]+C*3,$[W+w]=I[$[W+m]+o],$[W+E]=I[$[W+m]+r],$[W+b]=I[$[W+m]+e],$[ge+m]=$[W+m],$[W+m]=-1,I[O+r]<$[W+v]?I[O+e]<$[W+_]?He=$[W+x]:He=$[W+x]+C:I[O+e]<$[W+_]?He=$[W+x]+C*2:He=$[W+x]+C*3,ge===He)if(j--){W=ge;continue}else{j=M;break}$[He+m]=O;break}}if(N.barnesHutOptimize)for(Ee=N.scalingRatio,O=0;O=0)if(te=Math.pow(I[O+r]-$[W+E],2)+Math.pow(I[O+e]-$[W+b],2),ee=$[W+y],4*ee*ee/te0?(se=Ee*I[O+o]*$[W+w]/te,I[O+t]+=ae*se,I[O+n]+=z*se):te<0&&(se=-Ee*I[O+o]*$[W+w]/Math.sqrt(te),I[O+t]+=ae*se,I[O+n]+=z*se):te>0&&(se=Ee*I[O+o]*$[W+w]/te,I[O+t]+=ae*se,I[O+n]+=z*se),W=$[W+g],W<0)break;continue}else{W=$[W+x];continue}else{if(B=$[W+m],B>=0&&B!==O&&(ae=I[O+r]-I[B+r],z=I[O+e]-I[B+e],te=ae*ae+z*z,ce===!0?te>0?(se=Ee*I[O+o]*I[B+o]/te,I[O+t]+=ae*se,I[O+n]+=z*se):te<0&&(se=-Ee*I[O+o]*I[B+o]/Math.sqrt(te),I[O+t]+=ae*se,I[O+n]+=z*se):te>0&&(se=Ee*I[O+o]*I[B+o]/te,I[O+t]+=ae*se,I[O+n]+=z*se)),W=$[W+g],W<0)break;continue}else for(Ee=N.scalingRatio,k=0;k0?(se=Ee*I[k+o]*I[G+o]/te/te,I[k+t]+=ae*se,I[k+n]+=z*se,I[G+t]-=ae*se,I[G+n]-=z*se):te<0&&(se=100*Ee*I[k+o]*I[G+o],I[k+t]+=ae*se,I[k+n]+=z*se,I[G+t]-=ae*se,I[G+n]-=z*se)):(te=Math.sqrt(ae*ae+z*z),te>0&&(se=Ee*I[k+o]*I[G+o]/te/te,I[k+t]+=ae*se,I[k+n]+=z*se,I[G+t]-=ae*se,I[G+n]-=z*se));for(Z=N.gravity/N.scalingRatio,Ee=N.scalingRatio,O=0;O0&&(se=Ee*I[O+o]*Z):te>0&&(se=Ee*I[O+o]*Z/te),I[O+t]-=ae*se,I[O+n]-=z*se;for(Ee=1*(N.outboundAttractionDistribution?Ae:1),D=0;D0&&(se=-Ee*oe*Math.log(1+te)/te/I[k+o]):te>0&&(se=-Ee*oe*Math.log(1+te)/te):N.outboundAttractionDistribution?te>0&&(se=-Ee*oe/I[k+o]):te>0&&(se=-Ee*oe)):(te=Math.sqrt(Math.pow(ae,2)+Math.pow(z,2)),N.linLogMode?N.outboundAttractionDistribution?te>0&&(se=-Ee*oe*Math.log(1+te)/te/I[k+o]):te>0&&(se=-Ee*oe*Math.log(1+te)/te):N.outboundAttractionDistribution?(te=1,se=-Ee*oe/I[k+o]):(te=1,se=-Ee*oe)),te>0&&(I[k+t]+=ae*se,I[k+n]+=z*se,I[G+t]-=ae*se,I[G+n]-=z*se);var we,be,Me,Fe,Ue,xe;if(ce===!0)for(O=0;OL&&(I[O+t]=I[O+t]*L/we,I[O+n]=I[O+n]*L/we),be=I[O+o]*Math.sqrt((I[O+i]-I[O+t])*(I[O+i]-I[O+t])+(I[O+s]-I[O+n])*(I[O+s]-I[O+n])),Me=Math.sqrt((I[O+i]+I[O+t])*(I[O+i]+I[O+t])+(I[O+s]+I[O+n])*(I[O+s]+I[O+n]))/2,Fe=.1*Math.log(1+Me)/(1+Math.sqrt(be)),Ue=I[O+r]+I[O+t]*(Fe/N.slowDown),I[O+r]=Ue,xe=I[O+e]+I[O+n]*(Fe/N.slowDown),I[O+e]=xe);else for(O=0;O=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in t&&typeof t.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in t&&!(typeof t.gravity=="number"&&t.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in t&&!(typeof t.slowDown=="number"||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&typeof t.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in t&&!(typeof t.barnesHutTheta=="number"&&t.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},Rs.graphToByteArrays=function(t,n){var i=t.order,s=t.size,o={},a,l=new Float32Array(i*r),c=new Float32Array(s*e);return a=0,t.forEachNode(function(u,h){o[u]=a,l[a]=h.x,l[a+1]=h.y,l[a+2]=0,l[a+3]=0,l[a+4]=0,l[a+5]=0,l[a+6]=1,l[a+7]=1,l[a+8]=h.size||1,l[a+9]=h.fixed?1:0,a+=r}),a=0,t.forEachEdge(function(u,h,p,m,v,_,y){var g=o[p],x=o[m],w=n(u,h,p,m,v,_,y);l[g+6]+=w,l[x+6]+=w,c[a]=g,c[a+1]=x,c[a+2]=w,a+=e}),{nodes:l,edges:c}},Rs.assignLayoutChanges=function(t,n,i){var s=0;t.updateEachNodeAttributes(function(o,a){return a.x=n[s],a.y=n[s+1],s+=r,i?i(o,a):a})},Rs.readGraphPositions=function(t,n){var i=0;t.forEachNode(function(s,o){n[i]=o.x,n[i+1]=o.y,i+=r})},Rs.collectLayoutChanges=function(t,n,i){for(var s=t.nodes(),o={},a=0,l=0,c=n.length;a2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(c)}}var a=s.bind(null,!1);return a.assign=s.bind(null,!0),a.inferSettings=o,Vg=a,Vg}var qF=YF();const ZF=Hr(qF);var Wg,uS;function KF(){if(uS)return Wg;uS=1;var r=Vy(),e=Xs(),t={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function n(s,o,a){if(!e(o))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");a=r(a,t);var l=a.dimensions;if(!Array.isArray(l)||l.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var c=l.length,u=a.center,h=a.rng,p=a.scale,m=(u-.5)*p;function v(y){for(var g=0;g 4294967295 is not supported.")},r.getSignedPointerArray=function(l){var c=l-1;return c<=i?Int8Array:c<=s?Int16Array:c<=o?Int32Array:Float64Array},r.getNumberType=function(l){return l===(l|0)?Math.sign(l)===-1?l<=127&&l>=-128?Int8Array:l<=32767&&l>=-32768?Int16Array:Int32Array:l<=255?Uint8Array:l<=65535?Uint16Array:Uint32Array:Float64Array};var a={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};r.getMinimalRepresentation=function(l,c){var u=null,h=0,p,m,v,_,y;for(_=0,y=l.length;_h&&(h=p,u=m);return u},r.isTypedArray=function(l){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(l)},r.concat=function(){var l=0,c,u,h;for(c=0,h=arguments.length;c{let e;const t=new Set,n=(l,c)=>{const u=typeof l=="function"?l(e):l;if(!Object.is(u,e)){const h=e;e=c??typeof u!="object"?u:Object.assign({},e,u),t.forEach(p=>p(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:l=>(t.add(l),()=>t.delete(l)),destroy:()=>{(sk?"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()}};return e=r(n,i,a),a},ok=r=>r?mS(r):mS;var Yg={exports:{}},qg={},Zg={exports:{}},Kg={};/** - * @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 gS;function ak(){if(gS)return Kg;gS=1;var r=Hv();function e(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var t=typeof Object.is=="function"?Object.is:e,n=r.useState,i=r.useEffect,s=r.useLayoutEffect,o=r.useDebugValue;function a(h,p){var m=p(),v=n({inst:{value:m,getSnapshot:p}}),_=v[0].inst,y=v[1];return s(function(){_.value=m,_.getSnapshot=p,l(_)&&y({inst:_})},[h,m,p]),i(function(){return l(_)&&y({inst:_}),h(function(){l(_)&&y({inst:_})})},[h]),o(m),m}function l(h){var p=h.getSnapshot;h=h.value;try{var m=p();return!t(h,m)}catch{return!0}}function c(h,p){return p()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Kg.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:u,Kg}var vS;function lk(){return vS||(vS=1,Zg.exports=ak()),Zg.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 yS;function ck(){if(yS)return qg;yS=1;var r=Hv(),e=lk();function t(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=r.useRef,o=r.useEffect,a=r.useMemo,l=r.useDebugValue;return qg.useSyncExternalStoreWithSelector=function(c,u,h,p,m){var v=s(null);if(v.current===null){var _={hasValue:!1,value:null};v.current=_}else _=v.current;v=a(function(){function g(M){if(!x){if(x=!0,w=M,M=p(M),m!==void 0&&_.hasValue){var A=_.value;if(m(A,M))return E=A}return E=M}if(A=E,n(w,M))return A;var P=p(M);return m!==void 0&&m(A,P)?A:(w=M,E=P)}var x=!1,w,E,b=h===void 0?null:h;return[function(){return g(u())},b===null?void 0:function(){return g(b())}]},[u,h,p,m]);var y=i(c,v[0],v[1]);return o(function(){_.hasValue=!0,_.value=y},[y]),l(y),y},qg}var _S;function uk(){return _S||(_S=1,Yg.exports=ck()),Yg.exports}var hk=uk();const fk=Hr(hk),dk={},{useSyncExternalStoreWithSelector:pk}=fk;function WT(r,e=r.getState,t){const n=pk(r.subscribe,r.getState,r.getServerState||r.getState,e,t);return K.useDebugValue(n),n}const xS=r=>{(dk?"production":void 0)!=="production"&&typeof r!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof r=="function"?ok(r):r,t=(n,i)=>WT(e,n,i);return Object.assign(t,e),t},mk=r=>r?xS(r):xS,gk={};function vk(){(gk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `context` will be removed in a future version. Instead use `import { createStore, useStore } from 'zustand'`. See: https://github.com/pmndrs/zustand/discussions/1180.");const r=K.createContext(void 0);return{Provider:({createStore:i,children:s})=>{const o=K.useRef();return o.current||(o.current=i()),K.createElement(r.Provider,{value:o.current},s)},useStore:(i,s)=>{const o=K.useContext(r);if(!o)throw new Error("Seems like you have not used zustand provider as an ancestor.");return WT(o,i,s)},useStoreApi:()=>{const i=K.useContext(r);if(!i)throw new Error("Seems like you have not used zustand provider as an ancestor.");return K.useMemo(()=>({...i}),[i])}}}function yk(r,e,t){return Math.max(e,Math.min(r,t))}const ln={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function wS(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function SS(r,e,t,n=.15){return n===0?yk(r,e,t):rt?+wS(r-t,t-e,n)+t:r}function _k(r,[e,t],[n,i]){const[[s,o],[a,l]]=r;return[SS(e,s,o,n),SS(t,a,l,i)]}function xk(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function wk(r){var e=xk(r,"string");return typeof e=="symbol"?e:String(e)}function kn(r,e,t){return e=wk(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function ES(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function wn(r){for(var e=1;e{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function Rk(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function YT(r){return Ap(r)?Rk(r)[0]:r}function Ev(r,e){try{const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,s=(e.clientY+r.clientY)/2,o=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:o,origin:[i,s]}}catch{}return null}function Pk(r){return Ck(r).map(e=>e.identifier)}function MS(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return Ev(t,n)}function $g(r){const e=YT(r);return Ap(r)?e.identifier:e.pointerId}function Zl(r){const e=YT(r);return[e.clientX,e.clientY]}const TS=40,AS=800;function qT(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=TS,t*=TS):n===2&&(e*=AS,t*=AS),[e,t]}function Lk(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:s,scrollTop:o}=r.currentTarget;return[(e=n??s)!==null&&e!==void 0?e:0,(t=i??o)!==null&&t!==void 0?t:0]}function Ik(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s})}return e}function zd(r,...e){return typeof r=="function"?r(...e):r}function Dk(){}function Uk(...r){return r.length===0?Dk:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function CS(r,e){return Object.assign({},e,r||{})}const Ok=32;class ZT{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?zd(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,Ik(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const M=t._delta.map(Math.abs);ln.addTo(t._distance,M)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[l,c]=n.threshold,{_step:u,values:h}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=l&&h[0]),u[1]===!1&&(u[1]=Math.abs(a)>=c&&h[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=l&&Math.sign(o)*l),u[1]===!1&&(u[1]=Math.abs(a)>=c&&Math.sign(a)*c)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const p=[0,0];if(n.hasCustomTransform){const[M,A]=h;p[0]=u[0]!==!1?M-u[0]:0,p[1]=u[1]!==!1?A-u[1]:0}else p[0]=u[0]!==!1?o-u[0]:0,p[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(p);const m=t.offset,v=t._active&&!t._blocked||t.active;v&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=zd(n.bounds,t)),this.setup&&this.setup()),t.movement=p,this.computeOffset()));const[_,y]=t.offset,[[g,x],[w,E]]=t._bounds;t.overflow=[_x?1:0,yE?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const b=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=_k(t._bounds,t.offset,b),t.delta=ln.sub(t.offset,m),this.computeMovement(),v&&(!t.last||s>Ok)){t.delta=ln.sub(t.offset,m);const M=t.delta.map(Math.abs);ln.addTo(t.distance,M),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[M[0]/s,M[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(wn(wn(wn({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function Nk([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class fh extends ZT{constructor(...e){super(...e),kn(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=ln.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=ln.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[jT(e)]:n.axisThreshold;t.axis=Nk(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const Fk=r=>r,RS=.15,KT={enabled(r=!0){return r},eventOptions(r,e,t){return wn(wn({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[RS,RS];case!1:return[0,0];default:return ln.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return ln.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||Fk},threshold(r){return ln.toVector(r,0)}},kk=0,Ua=wn(wn({},KT),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=kk){return r},bounds(r={}){if(typeof r=="function")return s=>Ua.bounds(r(s));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),PS={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class zk extends fh{constructor(...e){super(...e),kn(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=Ua.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=$g(e),n._pointerActive=!0,this.computeValues(Zl(e)),this.computeInitial(),t.preventScrollAxis&&jT(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=$g(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=Zl(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=ln.sub(s,t._values),this.computeValues(s)),ln.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=$g(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=n.tapsThreshold&&o<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[a,l]=t._delta,[c,u]=t._movement,[h,p]=n.swipe.velocity,[m,v]=n.swipe.distance,_=n.swipe.duration;if(t.elapsedTime<_){const y=Math.abs(a/t.timeDelta),g=Math.abs(l/t.timeDelta);y>h&&Math.abs(c)>m&&(t.swipe[0]=Math.sign(a)),g>p&&Math.abs(u)>v&&(t.swipe[1]=Math.sign(l))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,Bk(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=PS[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,ln.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in PS&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function Bk(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const dh=typeof window<"u"&&window.document&&window.document.createElement;function $T(){return dh&&"ontouchstart"in window}function Gk(){return $T()||dh&&window.navigator.maxTouchPoints>1}function Hk(){return dh&&"onpointerdown"in window}function Vk(){return dh&&"exitPointerLock"in window.document}function Wk(){try{return"constructor"in GestureEvent}catch{return!1}}const wr={isBrowser:dh,gesture:Wk(),touch:$T(),touchscreen:Gk(),pointer:Hk(),pointerLock:Vk()},Xk=250,jk=180,Yk=.5,qk=50,Zk=250,Kk=10,LS={mouse:0,touch:0,pen:8},$k=wn(wn({},Ua),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&wr.pointerLock,wr.touch&&t?"touch":this.pointerLock?"mouse":wr.pointer&&!i?"pointer":wr.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?Xk:void 0,!(!wr.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const s=ln.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,s},swipe({velocity:r=Yk,distance:e=qk,duration:t=Zk}={}){return{velocity:this.transform(ln.toVector(r)),distance:this.transform(ln.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return jk;case!1:return 0;default:return r}},axisThreshold(r){return r?wn(wn({},LS),r):LS},keyboardDisplacement(r=Kk){return r}});function JT(r){const[e,t]=r.overflow,[n,i]=r._delta,[s,o]=r._direction;(e<0&&n>0&&s<0||e>0&&n<0&&s>0)&&(r._movement[0]=r._movementBound[0]),(t<0&&i>0&&o<0||t>0&&i<0&&o>0)&&(r._movement[1]=r._movementBound[1])}const Jk=30,Qk=100;class ez extends ZT{constructor(...e){super(...e),kn(this,"ingKey","pinching"),kn(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=ln.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*Jk-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(s=>n.has(s))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=MS(e,t._touchIds);i&&this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(o=>i.has(o))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const s=Ev(...Array.from(n.values()));s&&this.pinchStart(e,s)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=MS(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=Ev(...Array.from(t.values()));n&&this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],s=t.angle-i;let o=0;Math.abs(s)>270&&(o+=Math.sign(s)),this.computeValues([t.distance,t.angle-360*o]),n.origin=t.origin,n.turns=o,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=ln.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(n=>e[n]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-qT(e)[1]/Qk*n.offset[0],0],ln.addTo(n._movement,n._delta),JT(n),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const tz=wn(wn({},KT),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!wr.touch&&wr.gesture)return"gesture";if(wr.touch&&n)return"touch";if(wr.touchscreen){if(wr.pointer)return"pointer";if(wr.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=o=>{const a=CS(zd(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=CS(zd(n,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof n!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",ln.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}});class nz extends fh{constructor(...e){super(...e),kn(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(Zl(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=Zl(e),n=this.state;n._delta=ln.sub(t,n._values),ln.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const iz=wn(wn({},Ua),{},{mouseOnly:(r=!0)=>r});class rz extends fh{constructor(...e){super(...e),kn(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=Lk(e);t._delta=ln.sub(n,t._values),ln.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const sz=Ua;class oz extends fh{constructor(...e){super(...e),kn(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=qT(e),ln.addTo(t._movement,t._delta),JT(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const az=Ua;class lz extends fh{constructor(...e){super(...e),kn(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(Zl(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=Zl(e);t._movement=t._delta=ln.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const cz=wn(wn({},Ua),{},{mouseOnly:(r=!0)=>r}),Wy=new Map,bv=new Map;function uz(r){Wy.set(r.key,r.engine),bv.set(r.key,r.resolver)}const hz={key:"drag",engine:zk,resolver:$k},fz={key:"hover",engine:lz,resolver:cz},dz={key:"move",engine:nz,resolver:iz},pz={key:"pinch",engine:ez,resolver:tz},mz={key:"scroll",engine:rz,resolver:sz},gz={key:"wheel",engine:oz,resolver:az};function vz(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}function yz(r,e){if(r==null)return{};var t=vz(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const _z={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=wr.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},xz=["target","eventOptions","window","enabled","transform"];function Ad(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=Ad(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function wz(r,e,t={}){const n=r,{target:i,eventOptions:s,window:o,enabled:a,transform:l}=n,c=yz(n,xz);if(t.shared=Ad({target:i,eventOptions:s,window:o,enabled:a,transform:l},_z),e){const u=bv.get(e);t[e]=Ad(wn({shared:t.shared},c),u)}else for(const u in c){const h=bv.get(u);h&&(t[u]=Ad(wn({shared:t.shared},c[u]),h))}return t}class QT{constructor(e,t){kn(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,s){const o=this._listeners,a=Ak(t,n),l=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},c=wn(wn({},l),s);e.addEventListener(a,i,c);const u=()=>{e.removeEventListener(a,i,c),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class Sz{constructor(){kn(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}let Ez=class{constructor(e){kn(this,"gestures",new Set),kn(this,"_targetEventStore",new QT(this)),kn(this,"gestureEventStores",{}),kn(this,"gestureTimeoutStores",{}),kn(this,"handlers",{}),kn(this,"config",{}),kn(this,"pointerIds",new Set),kn(this,"touchIds",new Set),kn(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),bz(this,e)}setEventIds(e){if(Ap(e))return this.touchIds=new Set(Pk(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=wz(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],l=IS(n,a.eventOptions,!!i);if(a.enabled){const c=Wy.get(o);new c(this,e,o).bind(l)}}const s=IS(n,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](wn(wn({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in n)n[s]=Uk(...n[s]);if(!i)return n;for(const s in n){const{device:o,capture:a,passive:l}=Tk(s);this._targetEventStore.add(i,o,"",n[s],{capture:a,passive:l})}}}};function _l(r,e){r.gestures.add(e),r.gestureEventStores[e]=new QT(r,e),r.gestureTimeoutStores[e]=new Sz}function bz(r,e){e.drag&&_l(r,"drag"),e.wheel&&_l(r,"wheel"),e.scroll&&_l(r,"scroll"),e.move&&_l(r,"move"),e.pinch&&_l(r,"pinch"),e.hover&&_l(r,"hover")}const IS=(r,e,t)=>(n,i,s,o={},a=!1)=>{var l,c;const u=(l=o.capture)!==null&&l!==void 0?l:e.capture,h=(c=o.passive)!==null&&c!==void 0?c:e.passive;let p=a?n:bk(n,i,u);t&&h&&(p+="Passive"),r[p]=r[p]||[],r[p].push(s)},Mz=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function Tz(r){const e={},t={},n=new Set;for(let i in r)Mz.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function xl(r,e,t,n,i,s){if(!r.has(t)||!Wy.has(n))return;const o=t+"Start",a=t+"End",l=c=>{let u;return c.first&&o in e&&e[o](c),t in e&&(u=e[t](c)),c.last&&a in e&&e[a](c),u};i[n]=l,s[n]=s[n]||{}}function Az(r,e){const[t,n,i]=Tz(r),s={};return xl(i,t,"onDrag","drag",s,e),xl(i,t,"onWheel","wheel",s,e),xl(i,t,"onScroll","scroll",s,e),xl(i,t,"onPinch","pinch",s,e),xl(i,t,"onMove","move",s,e),xl(i,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:n}}function Cz(r,e={},t,n){const i=Um.useMemo(()=>new Ez(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Um.useEffect(i.effect.bind(i)),Um.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function Rz(r){return r.forEach(uz),function(t,n){const{handlers:i,nativeHandlers:s,config:o}=Az(t,n||{});return Cz(i,o,void 0,s)}}function Pz(r,e){return Rz([hz,pz,mz,gz,dz,fz])(r,e||{})}var Lr={},ta={},Jg,DS;function Cp(){if(DS)return Jg;DS=1;function r(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var e=arguments,t=e.length,n=0;return new r(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})},r.empty=function(){var e=new r(function(){return{done:!0}});return e},r.fromSequence=function(e){var t=0,n=e.length;return new r(function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}})},r.is=function(e){return e instanceof r?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},Jg=r,Jg}var nd={},US;function eA(){return US||(US=1,nd.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",nd.SYMBOL_SUPPORT=typeof Symbol<"u"),nd}var Qg,OS;function Xy(){if(OS)return Qg;OS=1;var r=eA(),e=r.ARRAY_BUFFER_SUPPORT,t=r.SYMBOL_SUPPORT;return Qg=function(i,s){var o,a,l,c,u;if(!i)throw new Error("obliterator/forEach: invalid iterable.");if(typeof s!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(i)||e&&ArrayBuffer.isView(i)||typeof i=="string"||i.toString()==="[object Arguments]"){for(l=0,c=i.length;l=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,n}},t.prototype.peek=function(){if(this.size)return this.items[this.offset]},t.prototype.forEach=function(n,i){i=arguments.length>1?i:this;for(var s=this.offset,o=0,a=this.items.length;s=n.length)return{done:!0};var s=n[i];return i++,{value:s,done:!1}})},t.prototype.entries=function(){var n=this.items,i=this.offset,s=0;return new r(function(){if(i>=n.length)return{done:!0};var o=n[i];return i++,{value:[s++,o],done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.toString=function(){return this.toArray().join(",")},t.prototype.toJSON=function(){return this.toArray()},t.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:t,enumerable:!1}),n},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),t.from=function(n){var i=new t;return e(n,function(s){i.enqueue(s)}),i},t.of=function(){return t.from(arguments)},e0=t,e0}var t0,FS;function Iz(){return FS||(FS=1,t0=function(e,t){var n=t.length;if(n!==0){var i=e.length;e.length+=n;for(var s=0;ss?1:0},e=function(i,s){return is?-1:0};function t(i){return function(s,o){return i(o,s)}}function n(i){return i===2?function(s,o){return s[0]o[0]?1:s[1]o[1]?1:0}:function(s,o){for(var a=0;ao[a])return 1;a++}return 0}}return wl.DEFAULT_COMPARATOR=r,wl.DEFAULT_REVERSE_COMPARATOR=e,wl.reverseComparator=t,wl.createTupleComparator=n,wl}var Sl={},GS;function Nz(){if(GS)return Sl;GS=1;var r=Xy(),e=VT();function t(o){return Array.isArray(o)||e.isTypedArray(o)}function n(o){if(typeof o.length=="number")return o.length;if(typeof o.size=="number")return o.size}function i(o){var a=n(o),l=typeof a=="number"?new Array(a):[],c=0;return r(o,function(u){l[c++]=u}),l}function s(o){var a=n(o),l=typeof a=="number"?e.getPointerArray(a):Array,c=typeof a=="number"?new Array(a):[],u=typeof a=="number"?new l(a):[],h=0;return r(o,function(p){c[h]=p,u[h]=h++}),[c,u]}return Sl.isArrayLike=t,Sl.guessLength=n,Sl.toArray=i,Sl.toArrayWithIndices=s,Sl}var i0,HS;function tA(){if(HS)return i0;HS=1;var r=Xy(),e=Oz(),t=Nz(),n=e.DEFAULT_COMPARATOR,i=e.reverseComparator;function s(g,x,w,E){for(var b=x[E],M,A;E>w;){if(M=E-1>>1,A=x[M],g(b,A)<0){x[E]=A,E=M;continue}break}x[E]=b}function o(g,x,w){for(var E=x.length,b=w,M=x[w],A=2*w+1,P;A=0&&(A=P),x[w]=x[A],w=A,A=2*w+1;x[w]=M,s(g,x,b,w)}function a(g,x,w){x.push(w),s(g,x,0,x.length-1)}function l(g,x){var w=x.pop();if(x.length!==0){var E=x[0];return x[0]=w,o(g,x,0),E}return w}function c(g,x,w){if(x.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var E=x[0];return x[0]=w,o(g,x,0),E}function u(g,x,w){var E;return x.length!==0&&g(x[0],w)<0&&(E=x[0],x[0]=w,w=E,o(g,x,0)),w}function h(g,x){for(var w=x.length,E=w>>1,b=E;--b>=0;)o(g,x,b)}function p(g,x){for(var w=x.length,E=0,b=new Array(w);E=w.length)return w.slice().sort(g);for(C=w.slice(0,x),h(E,C),b=x,M=w.length;b0&&c(E,C,w[b]);return C.sort(g)}var L=t.guessLength(w);return L!==null&&L0&&c(E,C,F)),b++}),C.length>b&&(C.length=b),C.sort(g)}function v(g,x,w){arguments.length===2&&(w=x,x=g,g=n);var E=i(g),b,M,A,P=-1/0,C;if(x===1){if(t.isArrayLike(w)){for(b=0,M=w.length;b0)&&(P=A);return C=new w.constructor(1),C[0]=P,C}return r(w,function(F){(P===-1/0||g(F,P)>0)&&(P=F)}),[P]}if(t.isArrayLike(w)){if(x>=w.length)return w.slice().sort(E);for(C=w.slice(0,x),h(g,C),b=x,M=w.length;b0&&c(g,C,w[b]);return C.sort(E)}var L=t.guessLength(w);return L!==null&&L0&&c(g,C,F)),b++}),C.length>b&&(C.length=b),C.sort(E)}function _(g){if(this.clear(),this.comparator=g||n,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}_.prototype.clear=function(){this.items=[],this.size=0},_.prototype.push=function(g){return a(this.comparator,this.items,g),++this.size},_.prototype.peek=function(){return this.items[0]},_.prototype.pop=function(){return this.size!==0&&this.size--,l(this.comparator,this.items)},_.prototype.replace=function(g){return c(this.comparator,this.items,g)},_.prototype.pushpop=function(g){return u(this.comparator,this.items,g)},_.prototype.consume=function(){return this.size=0,p(this.comparator,this.items)},_.prototype.toArray=function(){return p(this.comparator,this.items.slice())},_.prototype.inspect=function(){var g=this.toArray();return Object.defineProperty(g,"constructor",{value:_,enumerable:!1}),g},typeof Symbol<"u"&&(_.prototype[Symbol.for("nodejs.util.inspect.custom")]=_.prototype.inspect);function y(g){if(this.clear(),this.comparator=g||n,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=i(this.comparator)}return y.prototype=_.prototype,_.from=function(g,x){var w=new _(x),E;return t.isArrayLike(g)?E=g.slice():E=t.toArray(g),h(w.comparator,E),w.items=E,w.size=E.length,w},y.from=function(g,x){var w=new y(x),E;return t.isArrayLike(g)?E=g.slice():E=t.toArray(g),h(w.comparator,E),w.items=E,w.size=E.length,w},_.siftUp=o,_.siftDown=s,_.push=a,_.pop=l,_.replace=c,_.pushpop=u,_.heapify=h,_.consume=p,_.nsmallest=m,_.nlargest=v,_.MinHeap=_,_.MaxHeap=y,i0=_,i0}var VS;function Fz(){if(VS)return jc;VS=1;var r=Xs(),e=Tp().createEdgeWeightGetter,t=tA(),n="weight";function i(h,p){return h[0]>p[0]?1:h[0]p[1]?1:h[1]p[2]?1:h[2]p[0]?1:h[0]p[1]?1:h[1]p[2]?1:h[2]p[3]?1:h[3]L)&&(E=L,w=y[0][N].concat(y[1][N].slice(0,-1).reverse()))))}}return[1/0,null]}function a(h,p,m,v,_,y){if(!r(h))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");m=e(m||n).fromMinimalEntry;var g={},x={},w=new t(i),E=0,b,M,A,P,C,L,F,N,I,X,q;for(N=0,X=p.length;Na[0]?1:o[0]a[1]?1:o[1]h.cutoff||(v[F]=[L,P],m.push([L+P,p++,F,L,g]))}}for(;m.size!==0;){if(y=m.pop(),g=y[2],w=y[3],E=y[4],g===l){for(b=[g],M=E;M!==null;)b.push(M),M=_[M];return b.reverse(),b}_.hasOwnProperty(g)&&(_[g]===null||(A=v[g][0],A0&&(L=M[0]),L instanceof Error)throw L;var F=new Error("Unhandled error."+(L?" ("+L.message+")":""));throw F.context=L,F}var N=C[b];if(N===void 0)return!1;if(typeof N=="function")e(N,this,M);else for(var I=N.length,X=v(N,I),A=0;A0&&L.length>P&&!L.warned){L.warned=!0;var F=new Error("Possible EventEmitter memory leak detected. "+L.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");F.name="MaxListenersExceededWarning",F.emitter=E,F.type=b,F.count=L.length,n(F)}return E}s.prototype.addListener=function(b,M){return c(this,b,M,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(b,M){return c(this,b,M,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(E,b,M){var A={fired:!1,wrapFn:void 0,target:E,type:b,listener:M},P=u.bind(A);return P.listener=M,A.wrapFn=P,P}s.prototype.once=function(b,M){return a(M),this.on(b,h(this,b,M)),this},s.prototype.prependOnceListener=function(b,M){return a(M),this.prependListener(b,h(this,b,M)),this},s.prototype.removeListener=function(b,M){var A,P,C,L,F;if(a(M),P=this._events,P===void 0)return this;if(A=P[b],A===void 0)return this;if(A===M||A.listener===M)--this._eventsCount===0?this._events=Object.create(null):(delete P[b],P.removeListener&&this.emit("removeListener",b,A.listener||M));else if(typeof A!="function"){for(C=-1,L=A.length-1;L>=0;L--)if(A[L]===M||A[L].listener===M){F=A[L].listener,C=L;break}if(C<0)return this;C===0?A.shift():_(A,C),A.length===1&&(P[b]=A[0]),P.removeListener!==void 0&&this.emit("removeListener",b,F||M)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(b){var M,A,P;if(A=this._events,A===void 0)return this;if(A.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):A[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete A[b]),this;if(arguments.length===0){var C=Object.keys(A),L;for(P=0;P=0;P--)this.removeListener(b,M[P]);return this};function p(E,b,M){var A=E._events;if(A===void 0)return[];var P=A[b];return P===void 0?[]:typeof P=="function"?M?[P.listener||P]:[P]:M?y(P):v(P,P.length)}s.prototype.listeners=function(b){return p(this,b,!0)},s.prototype.rawListeners=function(b){return p(this,b,!1)},s.listenerCount=function(E,b){return typeof E.listenerCount=="function"?E.listenerCount(b):m.call(E,b)},s.prototype.listenerCount=m;function m(E){var b=this._events;if(b!==void 0){var M=b[E];if(typeof M=="function")return 1;if(M!==void 0)return M.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function v(E,b){for(var M=new Array(b),A=0;A1?n:1/0,s=i!==1/0?new Array(i):[],o,a=0,l=r(t);;){if(a===i)return s;if(o=l.next(),o.done)return a!==n&&(s.length=a),s;s[a++]=o.value}},o0}var Wz=Vz();const iA=Hr(Wz);var a0,ZS;function Xz(){if(ZS)return a0;ZS=1;var r=Cp(),e=nA();return a0=function(){var n=arguments,i=null,s=-1;return new r(function(){var a=null;do{if(i===null){if(s++,s>=n.length)return{done:!0};i=e(n[s])}if(a=i.next(),a.done===!0){i=null;continue}break}while(!0);return a})},a0}var jz=Xz();const zs=Hr(jz);function Yz(){const r=arguments[0];for(let e=1,t=arguments.length;er++}class jy extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class tt extends jy{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,tt.prototype.constructor)}}class je extends jy{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,je.prototype.constructor)}}class ft extends jy{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,ft.prototype.constructor)}}function sA(r,e){this.key=r,this.attributes=e,this.clear()}sA.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function oA(r,e){this.key=r,this.attributes=e,this.clear()}oA.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function aA(r,e){this.key=r,this.attributes=e,this.clear()}aA.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function nc(r,e,t,n,i){this.key=e,this.attributes=i,this.undirected=r,this.source=t,this.target=n}nc.prototype.attach=function(){let r="out",e="in";this.undirected&&(r=e="undirected");const t=this.source.key,n=this.target.key;this.source[r][n]=this,!(this.undirected&&t===n)&&(this.target[e][t]=this)};nc.prototype.attachMulti=function(){let r="out",e="in";const t=this.source.key,n=this.target.key;this.undirected&&(r=e="undirected");const i=this.source[r],s=i[n];if(typeof s>"u"){i[n]=this,this.undirected&&t===n||(this.target[e][t]=this);return}s.previous=this,this.next=s,i[n]=this,this.target[e][t]=this};nc.prototype.detach=function(){const r=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),delete this.source[t][e],delete this.target[n][r]};nc.prototype.detachMulti=function(){const r=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[n][r]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[n][r]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const lA=0,cA=1,Zz=2,uA=3;function js(r,e,t,n,i,s,o){let a,l,c,u;if(n=""+n,t===lA){if(a=r._nodes.get(n),!a)throw new je(`Graph.${e}: could not find the "${n}" node in the graph.`);c=i,u=s}else if(t===uA){if(i=""+i,l=r._edges.get(i),!l)throw new je(`Graph.${e}: could not find the "${i}" edge in the graph.`);const h=l.source.key,p=l.target.key;if(n===h)a=l.target;else if(n===p)a=l.source;else throw new je(`Graph.${e}: the "${n}" node is not attached to the "${i}" edge (${h}, ${p}).`);c=s,u=o}else{if(l=r._edges.get(n),!l)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`);t===cA?a=l.source:a=l.target,c=i,u=s}return[a,c,u]}function Kz(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=js(this,e,t,n,i,s);return o.attributes[a]}}function $z(r,e,t){r.prototype[e]=function(n,i){const[s]=js(this,e,t,n,i);return s.attributes}}function Jz(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=js(this,e,t,n,i,s);return o.attributes.hasOwnProperty(a)}}function Qz(r,e,t){r.prototype[e]=function(n,i,s,o){const[a,l,c]=js(this,e,t,n,i,s,o);return a.attributes[l]=c,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}function eB(r,e,t){r.prototype[e]=function(n,i,s,o){const[a,l,c]=js(this,e,t,n,i,s,o);if(typeof c!="function")throw new tt(`Graph.${e}: updater should be a function.`);const u=a.attributes,h=c(u[l]);return u[l]=h,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:l}),this}}function tB(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=js(this,e,t,n,i,s);return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}function nB(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=js(this,e,t,n,i,s);if(!ri(a))throw new tt(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function iB(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=js(this,e,t,n,i,s);if(!ri(a))throw new tt(`Graph.${e}: provided attributes are not a plain object.`);return Vn(o.attributes,a),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:a}),this}}function rB(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=js(this,e,t,n,i,s);if(typeof a!="function")throw new tt(`Graph.${e}: provided updater is not a function.`);return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const sB=[{name:r=>`get${r}Attribute`,attacher:Kz},{name:r=>`get${r}Attributes`,attacher:$z},{name:r=>`has${r}Attribute`,attacher:Jz},{name:r=>`set${r}Attribute`,attacher:Qz},{name:r=>`update${r}Attribute`,attacher:eB},{name:r=>`remove${r}Attribute`,attacher:tB},{name:r=>`replace${r}Attributes`,attacher:nB},{name:r=>`merge${r}Attributes`,attacher:iB},{name:r=>`update${r}Attributes`,attacher:rB}];function oB(r){sB.forEach(function({name:e,attacher:t}){t(r,e("Node"),lA),t(r,e("Source"),cA),t(r,e("Target"),Zz),t(r,e("Opposite"),uA)})}function aB(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=br(this,o,a,t),!s)throw new je(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes[i]}}function lB(r,e,t){r.prototype[e]=function(n){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,o=""+arguments[1];if(i=br(this,s,o,t),!i)throw new je(`Graph.${e}: could not find an edge for the given path ("${s}" - "${o}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,i=this._edges.get(n),!i)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return i.attributes}}function cB(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=br(this,o,a,t),!s)throw new je(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes.hasOwnProperty(i)}}function uB(r,e,t){r.prototype[e]=function(n,i,s){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,l=""+i;if(i=arguments[2],s=arguments[3],o=br(this,a,l,t),!o)throw new je(`Graph.${e}: could not find an edge for the given path ("${a}" - "${l}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return o.attributes[i]=s,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function hB(r,e,t){r.prototype[e]=function(n,i,s){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,l=""+i;if(i=arguments[2],s=arguments[3],o=br(this,a,l,t),!o)throw new je(`Graph.${e}: could not find an edge for the given path ("${a}" - "${l}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof s!="function")throw new tt(`Graph.${e}: updater should be a function.`);return o.attributes[i]=s(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function fB(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=br(this,o,a,t),!s)throw new je(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return delete s.attributes[i],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:i}),this}}function dB(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=br(this,o,a,t),!s)throw new je(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!ri(i))throw new tt(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function pB(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=br(this,o,a,t),!s)throw new je(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!ri(i))throw new tt(`Graph.${e}: provided attributes are not a plain object.`);return Vn(s.attributes,i),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:i}),this}}function mB(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new ft(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new ft(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=br(this,o,a,t),!s)throw new je(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new ft(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new je(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof i!="function")throw new tt(`Graph.${e}: provided updater is not a function.`);return s.attributes=i(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const gB=[{name:r=>`get${r}Attribute`,attacher:aB},{name:r=>`get${r}Attributes`,attacher:lB},{name:r=>`has${r}Attribute`,attacher:cB},{name:r=>`set${r}Attribute`,attacher:uB},{name:r=>`update${r}Attribute`,attacher:hB},{name:r=>`remove${r}Attribute`,attacher:fB},{name:r=>`replace${r}Attributes`,attacher:dB},{name:r=>`merge${r}Attributes`,attacher:pB},{name:r=>`update${r}Attributes`,attacher:mB}];function vB(r){gB.forEach(function({name:e,attacher:t}){t(r,e("Edge"),"mixed"),t(r,e("DirectedEdge"),"directed"),t(r,e("UndirectedEdge"),"undirected")})}const yB=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function _B(r,e,t,n){let i=!1;for(const s in e){if(s===n)continue;const o=e[s];if(i=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),r&&i)return o.key}}function xB(r,e,t,n){let i,s,o,a=!1;for(const l in e)if(l!==n){i=e[l];do{if(s=i.source,o=i.target,a=t(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected),r&&a)return i.key;i=i.next}while(i!==void 0)}}function l0(r,e){const t=Object.keys(r),n=t.length;let i,s=0;return new Mr(function(){do if(i)i=i.next;else{if(s>=n)return{done:!0};const a=t[s++];if(a===e){i=void 0;continue}i=r[a]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}})}function wB(r,e,t,n){const i=e[t];if(!i)return;const s=i.source,o=i.target;if(n(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected)&&r)return i.key}function SB(r,e,t,n){let i=e[t];if(!i)return;let s=!1;do{if(s=n(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),r&&s)return i.key;i=i.next}while(i!==void 0)}function c0(r,e){let t=r[e];return t.next!==void 0?new Mr(function(){if(!t)return{done:!0};const n={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:n}}):Mr.of({edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected})}function EB(r,e){if(r.size===0)return[];if(e==="mixed"||e===r.type)return typeof Array.from=="function"?Array.from(r._edges.keys()):iA(r._edges.keys(),r._edges.size);const t=e==="undirected"?r.undirectedSize:r.directedSize,n=new Array(t),i=e==="undirected",s=r._edges.values();let o=0,a,l;for(;a=s.next(),a.done!==!0;)l=a.value,l.undirected===i&&(n[o++]=l.key);return n}function hA(r,e,t,n){if(e.size===0)return;const i=t!=="mixed"&&t!==e.type,s=t==="undirected";let o,a,l=!1;const c=e._edges.values();for(;o=c.next(),o.done!==!0;){if(a=o.value,i&&a.undirected!==s)continue;const{key:u,attributes:h,source:p,target:m}=a;if(l=n(u,h,p.key,m.key,p.attributes,m.attributes,a.undirected),r&&l)return u}}function bB(r,e){if(r.size===0)return Mr.empty();const t=e!=="mixed"&&e!==r.type,n=e==="undirected",i=r._edges.values();return new Mr(function(){let o,a;for(;;){if(o=i.next(),o.done)return o;if(a=o.value,!(t&&a.undirected!==n))break}return{value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected},done:!1}})}function Yy(r,e,t,n,i,s){const o=e?xB:_B;let a;if(t!=="undirected"&&(n!=="out"&&(a=o(r,i.in,s),r&&a)||n!=="in"&&(a=o(r,i.out,s,n?void 0:i.key),r&&a))||t!=="directed"&&(a=o(r,i.undirected,s),r&&a))return a}function MB(r,e,t,n){const i=[];return Yy(!1,r,e,t,n,function(s){i.push(s)}),i}function TB(r,e,t){let n=Mr.empty();return r!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(n=zs(n,l0(t.in))),e!=="in"&&typeof t.out<"u"&&(n=zs(n,l0(t.out,e?void 0:t.key)))),r!=="directed"&&typeof t.undirected<"u"&&(n=zs(n,l0(t.undirected))),n}function qy(r,e,t,n,i,s,o){const a=t?SB:wB;let l;if(e!=="undirected"&&(typeof i.in<"u"&&n!=="out"&&(l=a(r,i.in,s,o),r&&l)||typeof i.out<"u"&&n!=="in"&&(n||i.key!==s)&&(l=a(r,i.out,s,o),r&&l))||e!=="directed"&&typeof i.undirected<"u"&&(l=a(r,i.undirected,s,o),r&&l))return l}function AB(r,e,t,n,i){const s=[];return qy(!1,r,e,t,n,i,function(o){s.push(o)}),s}function CB(r,e,t,n){let i=Mr.empty();return r!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&n in t.in&&(i=zs(i,c0(t.in,n))),typeof t.out<"u"&&e!=="in"&&n in t.out&&(e||t.key!==n)&&(i=zs(i,c0(t.out,n)))),r!=="directed"&&typeof t.undirected<"u"&&n in t.undirected&&(i=zs(i,c0(t.undirected,n))),i}function RB(r,e){const{name:t,type:n,direction:i}=e;r.prototype[t]=function(s,o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];if(!arguments.length)return EB(this,n);if(arguments.length===1){s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new je(`Graph.${t}: could not find the "${s}" node in the graph.`);return MB(this.multi,n==="mixed"?this.type:n,i,a)}if(arguments.length===2){s=""+s,o=""+o;const a=this._nodes.get(s);if(!a)throw new je(`Graph.${t}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(o))throw new je(`Graph.${t}: could not find the "${o}" target node in the graph.`);return AB(n,this.multi,i,a,o)}throw new tt(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function PB(r,e){const{name:t,type:n,direction:i}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(c,u,h){if(!(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)){if(arguments.length===1)return h=c,hA(!1,this,n,h);if(arguments.length===2){c=""+c,h=u;const p=this._nodes.get(c);if(typeof p>"u")throw new je(`Graph.${s}: could not find the "${c}" node in the graph.`);return Yy(!1,this.multi,n==="mixed"?this.type:n,i,p,h)}if(arguments.length===3){c=""+c,u=""+u;const p=this._nodes.get(c);if(!p)throw new je(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(u))throw new je(`Graph.${s}: could not find the "${u}" target node in the graph.`);return qy(!1,n,this.multi,i,p,u,h)}throw new tt(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);r.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop();let h;if(c.length===0){let p=0;n!=="directed"&&(p+=this.undirectedSize),n!=="undirected"&&(p+=this.directedSize),h=new Array(p);let m=0;c.push((v,_,y,g,x,w,E)=>{h[m++]=u(v,_,y,g,x,w,E)})}else h=[],c.push((p,m,v,_,y,g,x)=>{h.push(u(p,m,v,_,y,g,x))});return this[s].apply(this,c),h};const a="filter"+t[0].toUpperCase()+t.slice(1);r.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop(),h=[];return c.push((p,m,v,_,y,g,x)=>{u(p,m,v,_,y,g,x)&&h.push(p)}),this[s].apply(this,c),h};const l="reduce"+t[0].toUpperCase()+t.slice(1);r.prototype[l]=function(){let c=Array.prototype.slice.call(arguments);if(c.length<2||c.length>4)throw new tt(`Graph.${l}: invalid number of arguments (expecting 2, 3 or 4 and got ${c.length}).`);if(typeof c[c.length-1]=="function"&&typeof c[c.length-2]!="function")throw new tt(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let u,h;c.length===2?(u=c[0],h=c[1],c=[]):c.length===3?(u=c[1],h=c[2],c=[c[0]]):c.length===4&&(u=c[2],h=c[3],c=[c[0],c[1]]);let p=h;return c.push((m,v,_,y,g,x,w)=>{p=u(p,m,v,_,y,g,x,w)}),this[s].apply(this,c),p}}function LB(r,e){const{name:t,type:n,direction:i}=e,s="find"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(l,c,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return!1;if(arguments.length===1)return u=l,hA(!0,this,n,u);if(arguments.length===2){l=""+l,u=c;const h=this._nodes.get(l);if(typeof h>"u")throw new je(`Graph.${s}: could not find the "${l}" node in the graph.`);return Yy(!0,this.multi,n==="mixed"?this.type:n,i,h,u)}if(arguments.length===3){l=""+l,c=""+c;const h=this._nodes.get(l);if(!h)throw new je(`Graph.${s}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(c))throw new je(`Graph.${s}: could not find the "${c}" target node in the graph.`);return qy(!0,n,this.multi,i,h,c,u)}throw new tt(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((h,p,m,v,_,y,g)=>c(h,p,m,v,_,y,g)),!!this[s].apply(this,l)};const a="every"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((h,p,m,v,_,y,g)=>!c(h,p,m,v,_,y,g)),!this[s].apply(this,l)}}function IB(r,e){const{name:t,type:n,direction:i}=e,s=t.slice(0,-1)+"Entries";r.prototype[s]=function(o,a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return Mr.empty();if(!arguments.length)return bB(this,n);if(arguments.length===1){o=""+o;const l=this._nodes.get(o);if(!l)throw new je(`Graph.${s}: could not find the "${o}" node in the graph.`);return TB(n,i,l)}if(arguments.length===2){o=""+o,a=""+a;const l=this._nodes.get(o);if(!l)throw new je(`Graph.${s}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(a))throw new je(`Graph.${s}: could not find the "${a}" target node in the graph.`);return CB(n,i,l,a)}throw new tt(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function DB(r){yB.forEach(e=>{RB(r,e),PB(r,e),LB(r,e),IB(r,e)})}const UB=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function Rp(){this.A=null,this.B=null}Rp.prototype.wrap=function(r){this.A===null?this.A=r:this.B===null&&(this.B=r)};Rp.prototype.has=function(r){return this.A!==null&&r in this.A||this.B!==null&&r in this.B};function Yc(r,e,t,n,i){for(const s in n){const o=n[s],a=o.source,l=o.target,c=a===t?l:a;if(e&&e.has(c.key))continue;const u=i(c.key,c.attributes);if(r&&u)return c.key}}function Zy(r,e,t,n,i){if(e!=="mixed"){if(e==="undirected")return Yc(r,null,n,n.undirected,i);if(typeof t=="string")return Yc(r,null,n,n[t],i)}const s=new Rp;let o;if(e!=="undirected"){if(t!=="out"){if(o=Yc(r,null,n,n.in,i),r&&o)return o;s.wrap(n.in)}if(t!=="in"){if(o=Yc(r,s,n,n.out,i),r&&o)return o;s.wrap(n.out)}}if(e!=="directed"&&(o=Yc(r,s,n,n.undirected,i),r&&o))return o}function OB(r,e,t){if(r!=="mixed"){if(r==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const n=[];return Zy(!1,r,e,t,function(i){n.push(i)}),n}function qc(r,e,t){const n=Object.keys(t),i=n.length;let s=0;return new Mr(function(){let a=null;do{if(s>=i)return r&&r.wrap(t),{done:!0};const l=t[n[s++]],c=l.source,u=l.target;if(a=c===e?u:c,r&&r.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}})}function NB(r,e,t){if(r!=="mixed"){if(r==="undirected")return qc(null,t,t.undirected);if(typeof e=="string")return qc(null,t,t[e])}let n=Mr.empty();const i=new Rp;return r!=="undirected"&&(e!=="out"&&(n=zs(n,qc(i,t,t.in))),e!=="in"&&(n=zs(n,qc(i,t,t.out)))),r!=="directed"&&(n=zs(n,qc(i,t,t.undirected))),n}function FB(r,e){const{name:t,type:n,direction:i}=e;r.prototype[t]=function(s){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new je(`Graph.${t}: could not find the "${s}" node in the graph.`);return OB(n==="mixed"?this.type:n,i,o)}}function kB(r,e){const{name:t,type:n,direction:i}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(c,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;c=""+c;const h=this._nodes.get(c);if(typeof h>"u")throw new je(`Graph.${s}: could not find the "${c}" node in the graph.`);Zy(!1,n==="mixed"?this.type:n,i,h,u)};const o="map"+t[0].toUpperCase()+t.slice(1);r.prototype[o]=function(c,u){const h=[];return this[s](c,(p,m)=>{h.push(u(p,m))}),h};const a="filter"+t[0].toUpperCase()+t.slice(1);r.prototype[a]=function(c,u){const h=[];return this[s](c,(p,m)=>{u(p,m)&&h.push(p)}),h};const l="reduce"+t[0].toUpperCase()+t.slice(1);r.prototype[l]=function(c,u,h){if(arguments.length<3)throw new tt(`Graph.${l}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let p=h;return this[s](c,(m,v)=>{p=u(p,m,v)}),p}}function zB(r,e){const{name:t,type:n,direction:i}=e,s=t[0].toUpperCase()+t.slice(1,-1),o="find"+s;r.prototype[o]=function(c,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;c=""+c;const h=this._nodes.get(c);if(typeof h>"u")throw new je(`Graph.${o}: could not find the "${c}" node in the graph.`);return Zy(!0,n==="mixed"?this.type:n,i,h,u)};const a="some"+s;r.prototype[a]=function(c,u){return!!this[o](c,u)};const l="every"+s;r.prototype[l]=function(c,u){return!this[o](c,(p,m)=>!u(p,m))}}function BB(r,e){const{name:t,type:n,direction:i}=e,s=t.slice(0,-1)+"Entries";r.prototype[s]=function(o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return Mr.empty();o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new je(`Graph.${s}: could not find the "${o}" node in the graph.`);return NB(n==="mixed"?this.type:n,i,a)}}function GB(r){UB.forEach(e=>{FB(r,e),kB(r,e),zB(r,e),BB(r,e)})}function rd(r,e,t,n,i){const s=n._nodes.values(),o=n.type;let a,l,c,u,h,p;for(;a=s.next(),a.done!==!0;){let m=!1;if(l=a.value,o!=="undirected"){u=l.out;for(c in u){h=u[c];do p=h.target,m=!0,i(l.key,p.key,l.attributes,p.attributes,h.key,h.attributes,h.undirected),h=h.next;while(h)}}if(o!=="directed"){u=l.undirected;for(c in u)if(!(e&&l.key>c)){h=u[c];do p=h.target,p.key!==c&&(p=h.source),m=!0,i(l.key,p.key,l.attributes,p.attributes,h.key,h.attributes,h.undirected),h=h.next;while(h)}}t&&!m&&i(l.key,null,l.attributes,null,null,null,null)}}function HB(r,e){const t={key:r};return rA(e.attributes)||(t.attributes=Vn({},e.attributes)),t}function VB(r,e,t){const n={key:e,source:t.source.key,target:t.target.key};return rA(t.attributes)||(n.attributes=Vn({},t.attributes)),r==="mixed"&&t.undirected&&(n.undirected=!0),n}function WB(r){if(!ri(r))throw new tt('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in r))throw new tt("Graph.import: serialized node is missing its key.");if("attributes"in r&&(!ri(r.attributes)||r.attributes===null))throw new tt("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function XB(r){if(!ri(r))throw new tt('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in r))throw new tt("Graph.import: serialized edge is missing its source.");if(!("target"in r))throw new tt("Graph.import: serialized edge is missing its target.");if("attributes"in r&&(!ri(r.attributes)||r.attributes===null))throw new tt("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in r&&typeof r.undirected!="boolean")throw new tt("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const jB=qz(),YB=new Set(["directed","undirected","mixed"]),$S=new Set(["domain","_events","_eventsCount","_maxListeners"]),qB=[{name:r=>`${r}Edge`,generateKey:!0},{name:r=>`${r}DirectedEdge`,generateKey:!0,type:"directed"},{name:r=>`${r}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:r=>`${r}EdgeWithKey`},{name:r=>`${r}DirectedEdgeWithKey`,type:"directed"},{name:r=>`${r}UndirectedEdgeWithKey`,type:"undirected"}],ZB={allowSelfLoops:!0,multi:!1,type:"mixed"};function KB(r,e,t){if(t&&!ri(t))throw new tt(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},r._nodes.has(e))throw new ft(`Graph.addNode: the "${e}" node already exist in the graph.`);const n=new r.NodeDataClass(e,t);return r._nodes.set(e,n),r.emit("nodeAdded",{key:e,attributes:t}),n}function JS(r,e,t){const n=new r.NodeDataClass(e,t);return r._nodes.set(e,n),r.emit("nodeAdded",{key:e,attributes:t}),n}function fA(r,e,t,n,i,s,o,a){if(!n&&r.type==="undirected")throw new ft(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(n&&r.type==="directed")throw new ft(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!ri(a))throw new tt(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(s=""+s,o=""+o,a=a||{},!r.allowSelfLoops&&s===o)throw new ft(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const l=r._nodes.get(s),c=r._nodes.get(o);if(!l)throw new je(`Graph.${e}: source node "${s}" not found.`);if(!c)throw new je(`Graph.${e}: target node "${o}" not found.`);const u={key:null,undirected:n,source:s,target:o,attributes:a};if(t)i=r._edgeKeyGenerator();else if(i=""+i,r._edges.has(i))throw new ft(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!r.multi&&(n?typeof l.undirected[o]<"u":typeof l.out[o]<"u"))throw new ft(`Graph.${e}: an edge linking "${s}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const h=new nc(n,i,l,c,a);r._edges.set(i,h);const p=s===o;return n?(l.undirectedDegree++,c.undirectedDegree++,p&&(l.undirectedLoops++,r._undirectedSelfLoopCount++)):(l.outDegree++,c.inDegree++,p&&(l.directedLoops++,r._directedSelfLoopCount++)),r.multi?h.attachMulti():h.attach(),n?r._undirectedSize++:r._directedSize++,u.key=i,r.emit("edgeAdded",u),i}function $B(r,e,t,n,i,s,o,a,l){if(!n&&r.type==="undirected")throw new ft(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(n&&r.type==="directed")throw new ft(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a){if(l){if(typeof a!="function")throw new tt(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!ri(a))throw new tt(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`)}s=""+s,o=""+o;let c;if(l&&(c=a,a=void 0),!r.allowSelfLoops&&s===o)throw new ft(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=r._nodes.get(s),h=r._nodes.get(o),p,m;if(!t&&(p=r._edges.get(i),p)){if((p.source.key!==s||p.target.key!==o)&&(!n||p.source.key!==o||p.target.key!==s))throw new ft(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${s}" source & "${o}" target vs. ("${p.source.key}", "${p.target.key}").`);m=p}if(!m&&!r.multi&&u&&(m=n?u.undirected[o]:u.out[o]),m){const x=[m.key,!1,!1,!1];if(l?!c:!a)return x;if(l){const w=m.attributes;m.attributes=c(w),r.emit("edgeAttributesUpdated",{type:"replace",key:m.key,attributes:m.attributes})}else Vn(m.attributes,a),r.emit("edgeAttributesUpdated",{type:"merge",key:m.key,attributes:m.attributes,data:a});return x}a=a||{},l&&c&&(a=c(a));const v={key:null,undirected:n,source:s,target:o,attributes:a};if(t)i=r._edgeKeyGenerator();else if(i=""+i,r._edges.has(i))throw new ft(`Graph.${e}: the "${i}" edge already exists in the graph.`);let _=!1,y=!1;u||(u=JS(r,s,{}),_=!0,s===o&&(h=u,y=!0)),h||(h=JS(r,o,{}),y=!0),p=new nc(n,i,u,h,a),r._edges.set(i,p);const g=s===o;return n?(u.undirectedDegree++,h.undirectedDegree++,g&&(u.undirectedLoops++,r._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,g&&(u.directedLoops++,r._directedSelfLoopCount++)),r.multi?p.attachMulti():p.attach(),n?r._undirectedSize++:r._directedSize++,v.key=i,r.emit("edgeAdded",v),[i,!0,_,y]}function El(r,e){r._edges.delete(e.key);const{source:t,target:n,attributes:i}=e,s=e.undirected,o=t===n;s?(t.undirectedDegree--,n.undirectedDegree--,o&&(t.undirectedLoops--,r._undirectedSelfLoopCount--)):(t.outDegree--,n.inDegree--,o&&(t.directedLoops--,r._directedSelfLoopCount--)),r.multi?e.detachMulti():e.detach(),s?r._undirectedSize--:r._directedSize--,r.emit("edgeDropped",{key:e.key,attributes:i,source:t.key,target:n.key,undirected:s})}class en extends Gz.EventEmitter{constructor(e){if(super(),e=Vn({},ZB,e),typeof e.multi!="boolean")throw new tt(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!YB.has(e.type))throw new tt(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new tt(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?sA:e.type==="directed"?oA:aA;mr(this,"NodeDataClass",t);const n="geid_"+jB()+"_";let i=0;const s=()=>{let o;do o=n+i++;while(this._edges.has(o));return o};mr(this,"_attributes",{}),mr(this,"_nodes",new Map),mr(this,"_edges",new Map),mr(this,"_directedSize",0),mr(this,"_undirectedSize",0),mr(this,"_directedSelfLoopCount",0),mr(this,"_undirectedSelfLoopCount",0),mr(this,"_edgeKeyGenerator",s),mr(this,"_options",e),$S.forEach(o=>mr(this,o,this[o])),Ir(this,"order",()=>this._nodes.size),Ir(this,"size",()=>this._edges.size),Ir(this,"directedSize",()=>this._directedSize),Ir(this,"undirectedSize",()=>this._undirectedSize),Ir(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),Ir(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),Ir(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),Ir(this,"multi",this._options.multi),Ir(this,"type",this._options.type),Ir(this,"allowSelfLoops",this._options.allowSelfLoops),Ir(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const n=""+e,i=this._edges.get(n);return!!i&&!i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new tt(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const n=""+e,i=this._edges.get(n);return!!i&&i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new tt(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t):!1}throw new tt(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new ft("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(e);if(!n)throw new je(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new je(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=n.out&&n.out[t]||void 0;if(i)return i.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new ft("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(e);if(!n)throw new je(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new je(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=n.undirected&&n.undirected[t]||void 0;if(i)return i.key}edge(e,t){if(this.multi)throw new ft("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new je(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new je(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new je(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new je(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new je(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new je(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new je(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in n.in||t in n.out)||this.type!=="directed"&&t in n.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new je(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.in||this.type!=="directed"&&t in n.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new je(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.out||this.type!=="directed"&&t in n.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree),n}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.outDegree),n}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree,i+=t.directedLoops),n-i}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.outDegree,i+=t.directedLoops),n-i}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree,i+=t.directedLoops*2),n-i}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new je(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new je(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new je(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const n=this._edges.get(t);if(!n)throw new je(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=n.source.key,s=n.target.key;if(e===i)return s;if(e===s)return i;throw new je(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${i}, ${s}).`)}hasExtremity(e,t){e=""+e,t=""+t;const n=this._edges.get(e);if(!n)throw new je(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new je(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new je(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new je(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return KB(this,e,t).key}mergeNode(e,t){if(t&&!ri(t))throw new tt(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);return n?(t&&(Vn(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new tt(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){const s=n.attributes;n.attributes=t(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}const i=t?t({}):{};return n=new this.NodeDataClass(e,i),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new je(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(const i in t.out){n=t.out[i];do El(this,n),n=n.next;while(n)}for(const i in t.in){n=t.in[i];do El(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(const i in t.undirected){n=t.undirected[i];do El(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const n=""+arguments[0],i=""+arguments[1];if(t=br(this,n,i,this.type),!t)throw new je(`Graph.dropEdge: could not find the "${n}" -> "${i}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new je(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return El(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new ft("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new ft("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const n=br(this,e,t,"directed");if(!n)throw new je(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return El(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new ft("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new ft("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=br(this,e,t,"undirected");if(!n)throw new je(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return El(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new tt("Graph.updateAttribute: updater should be a function.");const n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!ri(e))throw new tt("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!ri(e))throw new tt("Graph.mergeAttributes: provided attributes are not a plain object.");return Vn(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new tt("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new tt("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!KS(t))throw new tt("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let i,s;for(;i=n.next(),i.done!==!0;)s=i.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new tt("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!KS(t))throw new tt("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let i,s,o,a;for(;i=n.next(),i.done!==!0;)s=i.value,o=s.source,a=s.target,s.attributes=e(s.key,s.attributes,o.key,a.key,o.attributes,a.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new tt("Graph.forEachAdjacencyEntry: expecting a callback.");rd(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new tt("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");rd(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new tt("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");rd(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new tt("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");rd(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):iA(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new tt("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)i=n.value,e(i.key,i.attributes)}findNode(e){if(typeof e!="function")throw new tt("Graph.findNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!="function")throw new tt("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let n,i;const s=new Array(this.order);let o=0;for(;n=t.next(),n.done!==!0;)i=n.value,s[o++]=e(i.key,i.attributes);return s}someNode(e){if(typeof e!="function")throw new tt("Graph.someNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new tt("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new tt("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let n,i;const s=[];for(;n=t.next(),n.done!==!0;)i=n.value,e(i.key,i.attributes)&&s.push(i.key);return s}reduceNodes(e,t){if(typeof e!="function")throw new tt("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new tt("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=t;const i=this._nodes.values();let s,o;for(;s=i.next(),s.done!==!0;)o=s.value,n=e(n,o.key,o.attributes);return n}nodeEntries(){const e=this._nodes.values();return new Mr(()=>{const t=e.next();if(t.done)return t;const n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,s)=>{e[t++]=HB(s,i)});const n=new Array(this._edges.size);return t=0,this._edges.forEach((i,s)=>{n[t++]=VB(this.type,s,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof en)return e.forEachNode((l,c)=>{t?this.mergeNode(l,c):this.addNode(l,c)}),e.forEachEdge((l,c,u,h,p,m,v)=>{t?v?this.mergeUndirectedEdgeWithKey(l,u,h,c):this.mergeDirectedEdgeWithKey(l,u,h,c):v?this.addUndirectedEdgeWithKey(l,u,h,c):this.addDirectedEdgeWithKey(l,u,h,c)}),this;if(!ri(e))throw new tt("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!ri(e.attributes))throw new tt("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let n,i,s,o,a;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new tt("Graph.import: invalid nodes. Expecting an array.");for(n=0,i=s.length;n{const s=Vn({},n.attributes);n=new t.NodeDataClass(i,s),t._nodes.set(i,n)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new ft(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new ft("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new ft("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),n=this._edges.values();let i,s;for(;i=n.next(),i.done!==!0;)s=i.value,fA(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,Vn({},s.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,o)=>{e[o]=s.attributes});const t={},n={};this._edges.forEach((s,o)=>{const a=s.undirected?"--":"->";let l="",c=s.source.key,u=s.target.key,h;s.undirected&&c>u&&(h=c,c=u,u=h);const p=`(${c})${a}(${u})`;o.startsWith("geid_")?this.multi&&(typeof n[p]>"u"?n[p]=0:n[p]++,l+=`${n[p]}. `):l+=`[${o}]: `,l+=p,t[l]=s.attributes});const i={};for(const s in this)this.hasOwnProperty(s)&&!$S.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(i[s]=this[s]);return i.attributes=this._attributes,i.nodes=e,i.edges=t,mr(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(en.prototype[Symbol.for("nodejs.util.inspect.custom")]=en.prototype.inspect);qB.forEach(r=>{["add","merge","update"].forEach(e=>{const t=r.name(e),n=e==="add"?fA:$B;r.generateKey?en.prototype[t]=function(i,s,o){return n(this,t,!0,(r.type||this.type)==="undirected",null,i,s,o,e==="update")}:en.prototype[t]=function(i,s,o,a){return n(this,t,!1,(r.type||this.type)==="undirected",i,s,o,a,e==="update")}})});oB(en);vB(en);DB(en);GB(en);class dA extends en{constructor(e){const t=Vn({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new tt("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new tt('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class pA extends en{constructor(e){const t=Vn({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new tt("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new tt('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class mA extends en{constructor(e){const t=Vn({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new tt("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class gA extends en{constructor(e){const t=Vn({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new tt("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new tt('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class vA extends en{constructor(e){const t=Vn({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new tt("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new tt('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function ic(r){r.from=function(e,t){const n=Vn({},e.options,t),i=new r(n);return i.import(e),i}}ic(en);ic(dA);ic(pA);ic(mA);ic(gA);ic(vA);en.Graph=en;en.DirectedGraph=dA;en.UndirectedGraph=pA;en.MultiGraph=mA;en.MultiDirectedGraph=gA;en.MultiUndirectedGraph=vA;en.InvalidArgumentsGraphError=tt;en.NotFoundGraphError=je;en.UsageGraphError=ft;const ph=new Y,Ky=new Y,JB=new Y;function QB(r,e,t){const n=ph.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,s=t.height/2;return[n.x*i+i,-(n.y*s)+s]}function e4(r,e){const t=ph.setFromMatrixPosition(r.matrixWorld),n=Ky.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),s=e.getWorldDirection(JB);return i.angleTo(s)>Math.PI/2}function t4(r,e,t,n){const i=ph.setFromMatrixPosition(r.matrixWorld),s=i.clone();s.project(e),t.setFromCamera(s,e);const o=t.intersectObjects(n,!0);if(o.length){const a=o[0].distance;return i.distanceTo(t.ray.origin)Math.abs(r)<1e-10?0:r;function yA(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=Mv(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const r4=(r=>e=>yA(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),s4=(r=>(e,t)=>yA(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]);function o4(r){return r&&typeof r=="object"&&"current"in r}const $y=K.forwardRef(({children:r,eps:e=.001,style:t,className:n,prepend:i,center:s,fullscreen:o,portal:a,distanceFactor:l,sprite:c=!1,transform:u=!1,occlude:h,onOcclude:p,castShadow:m,receiveShadow:v,material:_,geometry:y,zIndexRange:g=[16777271,0],calculatePosition:x=QB,as:w="div",wrapperClass:E,pointerEvents:b="auto",...M},A)=>{const{gl:P,camera:C,scene:L,size:F,raycaster:N,events:I,viewport:X}=Bn(),[q]=K.useState(()=>document.createElement(w)),W=K.useRef(),O=K.useRef(null),k=K.useRef(0),G=K.useRef([0,0]),B=K.useRef(null),D=K.useRef(null),V=(a==null?void 0:a.current)||I.connected||P.domElement.parentNode,Z=K.useRef(null),ee=K.useRef(!1),ie=K.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&o4(h[0]),[h]);K.useLayoutEffect(()=>{const Ee=P.domElement;h&&h==="blending"?(Ee.style.zIndex=`${Math.floor(g[0]/2)}`,Ee.style.position="absolute",Ee.style.pointerEvents="none"):(Ee.style.zIndex=null,Ee.style.position=null,Ee.style.pointerEvents=null)},[h]),K.useLayoutEffect(()=>{if(O.current){const Ee=W.current=q2.createRoot(q);if(L.updateMatrixWorld(),u)q.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const ae=x(O.current,C,F);q.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${ae[0]}px,${ae[1]}px,0);transform-origin:0 0;`}return V&&(i?V.prepend(q):V.appendChild(q)),()=>{V&&V.removeChild(q),Ee.unmount()}}},[V,u]),K.useLayoutEffect(()=>{E&&(q.className=E)},[E]);const ue=K.useMemo(()=>u?{position:"absolute",top:0,left:0,width:F.width,height:F.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-F.height/2,left:-F.width/2,width:F.width,height:F.height},...t},[t,s,o,F,u]),ce=K.useMemo(()=>({position:"absolute",pointerEvents:b}),[b]);K.useLayoutEffect(()=>{if(ee.current=!1,u){var Ee;(Ee=W.current)==null||Ee.render(K.createElement("div",{ref:B,style:ue},K.createElement("div",{ref:D,style:ce},K.createElement("div",{ref:A,className:n,style:t,children:r}))))}else{var ae;(ae=W.current)==null||ae.render(K.createElement("div",{ref:A,style:ue,className:n,children:r}))}});const le=K.useRef(!0);Ep(Ee=>{if(O.current){C.updateMatrixWorld(),O.current.updateWorldMatrix(!0,!1);const ae=u?G.current:x(O.current,C,F);if(u||Math.abs(k.current-C.zoom)>e||Math.abs(G.current[0]-ae[0])>e||Math.abs(G.current[1]-ae[1])>e){const z=e4(O.current,C);let oe=!1;ie&&(Array.isArray(h)?oe=h.map(Ie=>Ie.current):h!=="blending"&&(oe=[L]));const te=le.current;if(oe){const Ie=t4(O.current,C,N,oe);le.current=Ie&&!z}else le.current=!z;te!==le.current&&(p?p(!le.current):q.style.display=le.current?"block":"none");const se=Math.floor(g[0]/2),$=h?ie?[g[0],se]:[se-1,0]:g;if(q.style.zIndex=`${i4(O.current,C,$)}`,u){const[Ie,de]=[F.width/2,F.height/2],Se=C.projectionMatrix.elements[5]*de,{isOrthographicCamera:Le,top:ge,left:He,bottom:j,right:H}=C,ne=r4(C.matrixWorldInverse),we=Le?`scale(${Se})translate(${Mv(-(H+He)/2)}px,${Mv((ge+j)/2)}px)`:`translateZ(${Se}px)`;let be=O.current.matrixWorld;c&&(be=C.matrixWorldInverse.clone().transpose().copyPosition(be).scale(O.current.scale),be.elements[3]=be.elements[7]=be.elements[11]=0,be.elements[15]=1),q.style.width=F.width+"px",q.style.height=F.height+"px",q.style.perspective=Le?"":`${Se}px`,B.current&&D.current&&(B.current.style.transform=`${we}${ne}translate(${Ie}px,${de}px)`,D.current.style.transform=s4(be,1/((l||10)/400)))}else{const Ie=l===void 0?1:n4(O.current,C)*l;q.style.transform=`translate3d(${ae[0]}px,${ae[1]}px,0) scale(${Ie})`}G.current=ae,k.current=C.zoom}}if(!ie&&Z.current&&!ee.current)if(u){if(B.current){const ae=B.current.children[0];if(ae!=null&&ae.clientWidth&&ae!=null&&ae.clientHeight){const{isOrthographicCamera:z}=C;if(z||y)M.scale&&(Array.isArray(M.scale)?M.scale instanceof Y?Z.current.scale.copy(M.scale.clone().divideScalar(1)):Z.current.scale.set(1/M.scale[0],1/M.scale[1],1/M.scale[2]):Z.current.scale.setScalar(1/M.scale));else{const oe=(l||10)/400,te=ae.clientWidth*oe,se=ae.clientHeight*oe;Z.current.scale.set(te,se,1)}ee.current=!0}}}else{const ae=q.children[0];if(ae!=null&&ae.clientWidth&&ae!=null&&ae.clientHeight){const z=1/X.factor,oe=ae.clientWidth*z,te=ae.clientHeight*z;Z.current.scale.set(oe,te,1),ee.current=!0}Z.current.lookAt(Ee.camera.position)}});const Ae=K.useMemo(()=>({vertexShader:u?void 0:` - /* - This shader is from the THREE's SpriteMaterial. - We need to turn the backing plane into a Sprite - (make it always face the camera) if "transfrom" - is false. - */ - #include - - void main() { - vec2 center = vec2(0., 1.); - float rotation = 0.0; - - // This is somewhat arbitrary, but it seems to work well - // Need to figure out how to derive this dynamically if it even matters - float size = 0.03; - - 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 ) ); - - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; - 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; - } - `,fragmentShader:` - void main() { - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); - } - `}),[u]);return K.createElement("group",Ta({},M,{ref:O}),h&&!ie&&K.createElement("mesh",{castShadow:m,receiveShadow:v,ref:Z},y||K.createElement("planeGeometry",null),_||K.createElement("shaderMaterial",{side:vn,vertexShader:Ae.vertexShader,fragmentShader:Ae.fragmentShader})))});function ya(r,e="pointer",t="auto",n=document.body){K.useEffect(()=>{if(r)return n.style.cursor=e,()=>void(n.style.cursor=t)},[r])}let Jy=gh();const xt=r=>mh(r,Jy);let Qy=gh();xt.write=r=>mh(r,Qy);let Pp=gh();xt.onStart=r=>mh(r,Pp);let e_=gh();xt.onFrame=r=>mh(r,e_);let t_=gh();xt.onFinish=r=>mh(r,t_);let Gl=[];xt.setTimeout=(r,e)=>{let t=xt.now()+e,n=()=>{let s=Gl.findIndex(o=>o.cancel==n);~s&&Gl.splice(s,1),po-=~s?1:0},i={time:t,handler:r,cancel:n};return Gl.splice(_A(t),0,i),po+=1,xA(),i};let _A=r=>~(~Gl.findIndex(e=>e.time>r)||~Gl.length);xt.cancel=r=>{Pp.delete(r),e_.delete(r),t_.delete(r),Jy.delete(r),Qy.delete(r)};xt.sync=r=>{Tv=!0,xt.batchedUpdates(r),Tv=!1};xt.throttle=r=>{let e;function t(){try{r(...e)}finally{e=null}}function n(...i){e=i,xt.onStart(t)}return n.handler=r,n.cancel=()=>{Pp.delete(t),e=null},n};let n_=typeof window<"u"?window.requestAnimationFrame:()=>{};xt.use=r=>n_=r;xt.now=typeof performance<"u"?()=>performance.now():Date.now;xt.batchedUpdates=r=>r();xt.catch=console.error;xt.frameLoop="always";xt.advance=()=>{xt.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):SA()};let fo=-1,po=0,Tv=!1;function mh(r,e){Tv?(e.delete(r),r(0)):(e.add(r),xA())}function xA(){fo<0&&(fo=0,xt.frameLoop!=="demand"&&n_(wA))}function a4(){fo=-1}function wA(){~fo&&(n_(wA),xt.batchedUpdates(SA))}function SA(){let r=fo;fo=xt.now();let e=_A(fo);if(e&&(EA(Gl.splice(0,e),t=>t.handler()),po-=e),!po){a4();return}Pp.flush(),Jy.flush(r?Math.min(64,fo-r):16.667),e_.flush(),Qy.flush(),t_.flush()}function gh(){let r=new Set,e=r;return{add(t){po+=e==r&&!r.has(t)?1:0,r.add(t)},delete(t){return po-=e==r&&r.has(t)?1:0,r.delete(t)},flush(t){e.size&&(r=new Set,po-=e.size,EA(e,n=>n(t)&&r.add(n)),po+=r.size,e=r)}}}function EA(r,e){r.forEach(t=>{try{e(t)}catch(n){xt.catch(n)}})}function Av(){}const l4=(r,e,t)=>Object.defineProperty(r,e,{value:t,writable:!0,configurable:!0}),Ze={arr:Array.isArray,obj:r=>!!r&&r.constructor.name==="Object",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",und:r=>r===void 0};function Ds(r,e){if(Ze.arr(r)){if(!Ze.arr(e)||r.length!==e.length)return!1;for(let t=0;tr.forEach(e);function Gs(r,e,t){if(Ze.arr(r)){for(let n=0;nZe.und(r)?[]:Ze.arr(r)?r:[r];function Su(r,e){if(r.size){const t=Array.from(r);r.clear(),Kt(t,e)}}const mu=(r,...e)=>Su(r,t=>t(...e)),i_=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);let r_,bA,_o=null,MA=!1,s_=Av;const c4=r=>{r.to&&(bA=r.to),r.now&&(xt.now=r.now),r.colors!==void 0&&(_o=r.colors),r.skipAnimation!=null&&(MA=r.skipAnimation),r.createStringInterpolator&&(r_=r.createStringInterpolator),r.requestAnimationFrame&&xt.use(r.requestAnimationFrame),r.batchedUpdates&&(xt.batchedUpdates=r.batchedUpdates),r.willAdvance&&(s_=r.willAdvance),r.frameLoop&&(xt.frameLoop=r.frameLoop)};var us=Object.freeze({__proto__:null,get createStringInterpolator(){return r_},get to(){return bA},get colors(){return _o},get skipAnimation(){return MA},get willAdvance(){return s_},assign:c4});const Eu=new Set;let Sr=[],u0=[],Bd=0;const Lp={get idle(){return!Eu.size&&!Sr.length},start(r){Bd>r.priority?(Eu.add(r),xt.onStart(u4)):(TA(r),xt(Cv))},advance:Cv,sort(r){if(Bd)xt.onFrame(()=>Lp.sort(r));else{const e=Sr.indexOf(r);~e&&(Sr.splice(e,1),AA(r))}},clear(){Sr=[],Eu.clear()}};function u4(){Eu.forEach(TA),Eu.clear(),xt(Cv)}function TA(r){Sr.includes(r)||AA(r)}function AA(r){Sr.splice(h4(Sr,e=>e.priority>r.priority),0,r)}function Cv(r){const e=u0;for(let t=0;t0}function h4(r,e){const t=r.findIndex(e);return t<0?r.length:t}const f4={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},kr="[-+]?\\d*\\.?\\d+",Gd=kr+"%";function Ip(...r){return"\\(\\s*("+r.join(")\\s*,\\s*(")+")\\s*\\)"}const d4=new RegExp("rgb"+Ip(kr,kr,kr)),p4=new RegExp("rgba"+Ip(kr,kr,kr,kr)),m4=new RegExp("hsl"+Ip(kr,Gd,Gd)),g4=new RegExp("hsla"+Ip(kr,Gd,Gd,kr)),v4=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,y4=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,_4=/^#([0-9a-fA-F]{6})$/,x4=/^#([0-9a-fA-F]{8})$/;function w4(r){let e;return typeof r=="number"?r>>>0===r&&r>=0&&r<=4294967295?r:null:(e=_4.exec(r))?parseInt(e[1]+"ff",16)>>>0:_o&&_o[r]!==void 0?_o[r]:(e=d4.exec(r))?(bl(e[1])<<24|bl(e[2])<<16|bl(e[3])<<8|255)>>>0:(e=p4.exec(r))?(bl(e[1])<<24|bl(e[2])<<16|bl(e[3])<<8|tE(e[4]))>>>0:(e=v4.exec(r))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=x4.exec(r))?parseInt(e[1],16)>>>0:(e=y4.exec(r))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=m4.exec(r))?(QS(eE(e[1]),sd(e[2]),sd(e[3]))|255)>>>0:(e=g4.exec(r))?(QS(eE(e[1]),sd(e[2]),sd(e[3]))|tE(e[4]))>>>0:null}function h0(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*(2/3-t)*6:r}function QS(r,e,t){const n=t<.5?t*(1+e):t+e-t*e,i=2*t-n,s=h0(i,n,r+1/3),o=h0(i,n,r),a=h0(i,n,r-1/3);return Math.round(s*255)<<24|Math.round(o*255)<<16|Math.round(a*255)<<8}function bl(r){const e=parseInt(r,10);return e<0?0:e>255?255:e}function eE(r){return(parseFloat(r)%360+360)%360/360}function tE(r){const e=parseFloat(r);return e<0?0:e>1?255:Math.round(e*255)}function sd(r){const e=parseFloat(r);return e<0?0:e>100?1:e/100}function nE(r){let e=w4(r);if(e===null)return r;e=e||0;let t=(e&4278190080)>>>24,n=(e&16711680)>>>16,i=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${n}, ${i}, ${s})`}const qu=(r,e,t)=>{if(Ze.fun(r))return r;if(Ze.arr(r))return qu({range:r,output:e,extrapolate:t});if(Ze.str(r.output[0]))return r_(r);const n=r,i=n.output,s=n.range||[0,1],o=n.extrapolateLeft||n.extrapolate||"extend",a=n.extrapolateRight||n.extrapolate||"extend",l=n.easing||(c=>c);return c=>{const u=E4(c,s);return S4(c,s[u],s[u+1],i[u],i[u+1],l,o,a,n.map)}};function S4(r,e,t,n,i,s,o,a,l){let c=l?l(r):r;if(ct){if(a==="identity")return c;a==="clamp"&&(c=t)}return n===i?n:e===t?r<=e?n:i:(e===-1/0?c=-c:t===1/0?c=c-e:c=(c-e)/(t-e),c=s(c),n===-1/0?c=-c:i===1/0?c=c+n:c=c*(i-n)+n,c)}function E4(r,e){for(var t=1;t=r);++t);return t-1}const b4={linear:r=>r};function Rv(){return Rv=Object.assign?Object.assign.bind():function(r){for(var e=1;e!!(r&&r[Kl]),_r=r=>r&&r[Kl]?r[Kl]():r,iE=r=>r[Ca]||null;function M4(r,e){r.eventObserved?r.eventObserved(e):r(e)}function Hd(r,e){let t=r[Ca];t&&t.forEach(n=>{M4(n,e)})}class T4{constructor(e){if(this[Kl]=void 0,this[Ca]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");A4(this,e)}}const A4=(r,e)=>CA(r,Kl,e);function vh(r,e){if(r[Kl]){let t=r[Ca];t||CA(r,Ca,t=new Set),t.has(e)||(t.add(e),r.observerAdded&&r.observerAdded(t.size,e))}return e}function Vd(r,e){let t=r[Ca];if(t&&t.has(e)){const n=t.size-1;n?t.delete(e):r[Ca]=null,r.observerRemoved&&r.observerRemoved(n,e)}}const CA=(r,e,t)=>Object.defineProperty(r,e,{value:t,writable:!0,configurable:!0}),Cd=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,C4=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,rE=new RegExp(`(${Cd.source})(%|[a-z]+)`,"i"),R4=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,Dp=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,RA=r=>{const[e,t]=P4(r);if(!e||i_())return r;const n=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(n)return n.trim();if(t&&t.startsWith("--")){const i=window.getComputedStyle(document.documentElement).getPropertyValue(t);return i||r}else{if(t&&Dp.test(t))return RA(t);if(t)return t}return r},P4=r=>{const e=Dp.exec(r);if(!e)return[,];const[,t,n]=e;return[t,n]};let f0;const L4=(r,e,t,n,i)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)}, ${i})`,PA=r=>{f0||(f0=_o?new RegExp(`(${Object.keys(_o).join("|")})(?!\\w)`,"g"):/^\b$/);const e=r.output.map(s=>_r(s).replace(Dp,RA).replace(C4,nE).replace(f0,nE)),t=e.map(s=>s.match(Cd).map(Number)),i=t[0].map((s,o)=>t.map(a=>{if(!(o in a))throw Error('The arity of each "output" value must be equal');return a[o]})).map(s=>qu(Rv({},r,{output:s})));return s=>{var o;const a=!rE.test(e[0])&&((o=e.find(c=>rE.test(c)))==null?void 0:o.replace(Cd,""));let l=0;return e[0].replace(Cd,()=>`${i[l++](s)}${a||""}`).replace(R4,L4)}},o_="react-spring: ",LA=r=>{const e=r;let t=!1;if(typeof e!="function")throw new TypeError(`${o_}once requires a function parameter`);return(...n)=>{t||(e(...n),t=!0)}},I4=LA(console.warn);function D4(){I4(`${o_}The "interpolate" function is deprecated in v9 (use "to" instead)`)}const U4=LA(console.warn);function O4(){U4(`${o_}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function Up(r){return Ze.str(r)&&(r[0]=="#"||/\d/.test(r)||!i_()&&Dp.test(r)||r in(_o||{}))}const a_=i_()?K.useEffect:K.useLayoutEffect,N4=()=>{const r=K.useRef(!1);return a_(()=>(r.current=!0,()=>{r.current=!1}),[]),r};function IA(){const r=K.useState()[1],e=N4();return()=>{e.current&&r(Math.random())}}function F4(r,e){const[t]=K.useState(()=>({inputs:e,result:r()})),n=K.useRef(),i=n.current;let s=i;return s?e&&s.inputs&&k4(e,s.inputs)||(s={inputs:e,result:r()}):s=t,K.useEffect(()=>{n.current=s,i==t&&(t.inputs=t.result=void 0)},[s]),s.result}function k4(r,e){if(r.length!==e.length)return!1;for(let t=0;tK.useEffect(r,z4),z4=[];function sE(r){const e=K.useRef();return K.useEffect(()=>{e.current=r}),e.current}const Zu=Symbol.for("Animated:node"),B4=r=>!!r&&r[Zu]===r,ns=r=>r&&r[Zu],l_=(r,e)=>l4(r,Zu,e),Op=r=>r&&r[Zu]&&r[Zu].getPayload();class UA{constructor(){this.payload=void 0,l_(this,this)}getPayload(){return this.payload||[]}}class rc extends UA{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,Ze.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new rc(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Ze.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,Ze.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class $l extends rc{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=qu({output:[e,e]})}static create(e){return new $l(e)}getValue(){let e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(Ze.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=qu({output:[this.getValue(),e]})),this._value=0,super.reset()}}const Wd={dependencies:null};class c_ extends UA{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return Gs(this.source,(n,i)=>{B4(n)?t[i]=n.getValue(e):is(n)?t[i]=_r(n):e||(t[i]=n)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&Kt(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return Gs(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Wd.dependencies&&is(e)&&Wd.dependencies.add(e);const t=Op(e);t&&Kt(t,n=>this.add(n))}}class u_ extends c_{constructor(e){super(e)}static create(e){return new u_(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((n,i)=>n.setValue(e[i])).some(Boolean):(super.setValue(e.map(G4)),!0)}}function G4(r){return(Up(r)?$l:rc).create(r)}function Pv(r){const e=ns(r);return e?e.constructor:Ze.arr(r)?u_:Up(r)?$l:rc}function Xd(){return Xd=Object.assign?Object.assign.bind():function(r){for(var e=1;e{const t=!Ze.fun(r)||r.prototype&&r.prototype.isReactComponent;return K.forwardRef((n,i)=>{const s=K.useRef(null),o=t&&K.useCallback(v=>{s.current=W4(i,v)},[i]),[a,l]=V4(n,e),c=IA(),u=()=>{const v=s.current;if(t&&!v)return;(v?e.applyAnimatedValues(v,a.getValue(!0)):!1)===!1&&c()},h=new H4(u,l),p=K.useRef();a_(()=>(p.current=h,Kt(l,v=>vh(v,h)),()=>{p.current&&(Kt(p.current.deps,v=>Vd(v,p.current)),xt.cancel(p.current.update))})),K.useEffect(u,[]),DA(()=>()=>{const v=p.current;Kt(v.deps,_=>Vd(_,v))});const m=e.getComponentProps(a.getValue());return K.createElement(r,Xd({},m,{ref:o}))})};class H4{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&xt.write(this.update)}}function V4(r,e){const t=new Set;return Wd.dependencies=t,r.style&&(r=Xd({},r,{style:e.createAnimatedStyle(r.style)})),r=new c_(r),Wd.dependencies=null,[r,t]}function W4(r,e){return r&&(Ze.fun(r)?r(e):r.current=e),e}const aE=Symbol.for("AnimatedComponent"),X4=(r,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=i=>new c_(i),getComponentProps:n=i=>i}={})=>{const i={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:n},s=o=>{const a=lE(o)||"Anonymous";return Ze.str(o)?o=s[o]||(s[o]=oE(o,i)):o=o[aE]||(o[aE]=oE(o,i)),o.displayName=`Animated(${a})`,o};return Gs(r,(o,a)=>{Ze.arr(r)&&(a=lE(o)),s[a]=s(o)}),{animated:s}},lE=r=>Ze.str(r)?r:r&&Ze.str(r.displayName)?r.displayName:Ze.fun(r)&&r.name||null;function ei(){return ei=Object.assign?Object.assign.bind():function(r){for(var e=1;er===!0||!!(e&&r&&(Ze.fun(r)?r(e):Er(r).includes(e))),OA=(r,e)=>Ze.obj(r)?e&&r[e]:r,NA=(r,e)=>r.default===!0?r[e]:r.default?r.default[e]:void 0,j4=r=>r,h_=(r,e=j4)=>{let t=Y4;r.default&&r.default!==!0&&(r=r.default,t=Object.keys(r));const n={};for(const i of t){const s=e(r[i],i);Ze.und(s)||(n[i]=s)}return n},Y4=["config","onProps","onStart","onChange","onPause","onResume","onRest"],q4={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function Z4(r){const e={};let t=0;if(Gs(r,(n,i)=>{q4[i]||(e[i]=n,t++)}),t)return e}function FA(r){const e=Z4(r);if(e){const t={to:e};return Gs(r,(n,i)=>i in e||(t[i]=n)),t}return ei({},r)}function Ku(r){return r=_r(r),Ze.arr(r)?r.map(Ku):Up(r)?us.createStringInterpolator({range:[0,1],output:[r,r]})(1):r}function K4(r){for(const e in r)return!0;return!1}function Lv(r){return Ze.fun(r)||Ze.arr(r)&&Ze.obj(r[0])}function $4(r,e){var t;(t=r.ref)==null||t.delete(r),e==null||e.delete(r)}function J4(r,e){if(e&&r.ref!==e){var t;(t=r.ref)==null||t.delete(r),e.add(r),r.ref=e}}const Q4={default:{tension:170,friction:26}},Iv=ei({},Q4.default,{mass:1,damping:1,easing:b4.linear,clamp:!1});class eG{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,Iv)}}function tG(r,e,t){t&&(t=ei({},t),cE(t,e),e=ei({},t,e)),cE(r,e),Object.assign(r,e);for(const o in Iv)r[o]==null&&(r[o]=Iv[o]);let{mass:n,frequency:i,damping:s}=r;return Ze.und(i)||(i<.01&&(i=.01),s<0&&(s=0),r.tension=Math.pow(2*Math.PI/i,2)*n,r.friction=4*Math.PI*s*n/i),r}function cE(r,e){if(!Ze.und(e.decay))r.duration=void 0;else{const t=!Ze.und(e.tension)||!Ze.und(e.friction);(t||!Ze.und(e.frequency)||!Ze.und(e.damping)||!Ze.und(e.mass))&&(r.duration=void 0,r.decay=void 0),t&&(r.frequency=void 0)}}const uE=[];class nG{constructor(){this.changed=!1,this.values=uE,this.toValues=null,this.fromValues=uE,this.to=void 0,this.from=void 0,this.config=new eG,this.immediate=!1}}function kA(r,{key:e,props:t,defaultProps:n,state:i,actions:s}){return new Promise((o,a)=>{var l;let c,u,h=bu((l=t.cancel)!=null?l:n==null?void 0:n.cancel,e);if(h)v();else{Ze.und(t.pause)||(i.paused=bu(t.pause,e));let _=n==null?void 0:n.pause;_!==!0&&(_=i.paused||bu(_,e)),c=ca(t.delay||0,e),_?(i.resumeQueue.add(m),s.pause()):(s.resume(),m())}function p(){i.resumeQueue.add(m),i.timeouts.delete(u),u.cancel(),c=u.time-xt.now()}function m(){c>0&&!us.skipAnimation?(i.delayed=!0,u=xt.setTimeout(v,c),i.pauseQueue.add(p),i.timeouts.add(u)):v()}function v(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(p),i.timeouts.delete(u),r<=(i.cancelId||0)&&(h=!0);try{s.start(ei({},t,{callId:r,cancel:h}),o)}catch(_){a(_)}}})}const f_=(r,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?Hl(r.get()):e.every(t=>t.noop)?zA(r.get()):Fr(r.get(),e.every(t=>t.finished)),zA=r=>({value:r,noop:!0,finished:!0,cancelled:!1}),Fr=(r,e,t=!1)=>({value:r,finished:e,cancelled:t}),Hl=r=>({value:r,cancelled:!0,finished:!1});function BA(r,e,t,n){const{callId:i,parentId:s,onRest:o}=e,{asyncTo:a,promise:l}=t;return!s&&r===a&&!e.reset?l:t.promise=(async()=>{t.asyncId=i,t.asyncTo=r;const c=h_(e,(y,g)=>g==="onRest"?void 0:y);let u,h;const p=new Promise((y,g)=>(u=y,h=g)),m=y=>{const g=i<=(t.cancelId||0)&&Hl(n)||i!==t.asyncId&&Fr(n,!1);if(g)throw y.result=g,h(y),y},v=(y,g)=>{const x=new hE,w=new fE;return(async()=>{if(us.skipAnimation)throw $u(t),w.result=Fr(n,!1),h(w),w;m(x);const E=Ze.obj(y)?ei({},y):ei({},g,{to:y});E.parentId=i,Gs(c,(M,A)=>{Ze.und(E[A])&&(E[A]=M)});const b=await n.start(E);return m(x),t.paused&&await new Promise(M=>{t.resumeQueue.add(M)}),b})()};let _;if(us.skipAnimation)return $u(t),Fr(n,!1);try{let y;Ze.arr(r)?y=(async g=>{for(const x of g)await v(x)})(r):y=Promise.resolve(r(v,n.stop.bind(n))),await Promise.all([y.then(u),p]),_=Fr(n.get(),!0,!1)}catch(y){if(y instanceof hE)_=y.result;else if(y instanceof fE)_=y.result;else throw y}finally{i==t.asyncId&&(t.asyncId=s,t.asyncTo=s?a:void 0,t.promise=s?l:void 0)}return Ze.fun(o)&&xt.batchedUpdates(()=>{o(_,n,n.item)}),_})()}function $u(r,e){Su(r.timeouts,t=>t.cancel()),r.pauseQueue.clear(),r.resumeQueue.clear(),r.asyncId=r.asyncTo=r.promise=void 0,e&&(r.cancelId=e)}class hE extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class fE extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const Dv=r=>r instanceof d_;let iG=1;class d_ extends T4{constructor(...e){super(...e),this.id=iG++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=ns(this);return e&&e.getValue()}to(...e){return us.to(this,e)}interpolate(...e){return D4(),us.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){Hd(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||Lp.sort(this),Hd(this,{type:"priority",parent:this,priority:e})}}const Ra=Symbol.for("SpringPhase"),GA=1,Uv=2,Ov=4,d0=r=>(r[Ra]&GA)>0,co=r=>(r[Ra]&Uv)>0,Zc=r=>(r[Ra]&Ov)>0,dE=(r,e)=>e?r[Ra]|=Uv|GA:r[Ra]&=~Uv,pE=(r,e)=>e?r[Ra]|=Ov:r[Ra]&=~Ov;class rG extends d_{constructor(e,t){if(super(),this.key=void 0,this.animation=new nG,this.queue=void 0,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Ze.und(e)||!Ze.und(t)){const n=Ze.obj(e)?ei({},e):ei({},t,{from:e});Ze.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(co(this)||this._state.asyncTo)||Zc(this)}get goal(){return _r(this.animation.to)}get velocity(){const e=ns(this);return e instanceof rc?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return d0(this)}get isAnimating(){return co(this)}get isPaused(){return Zc(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1;const i=this.animation;let{config:s,toValues:o}=i;const a=Op(i.to);!a&&is(i.to)&&(o=Er(_r(i.to))),i.values.forEach((u,h)=>{if(u.done)return;const p=u.constructor==$l?1:a?a[h].lastPosition:o[h];let m=i.immediate,v=p;if(!m){if(v=u.lastPosition,s.tension<=0){u.done=!0;return}let _=u.elapsedTime+=e;const y=i.fromValues[h],g=u.v0!=null?u.v0:u.v0=Ze.arr(s.velocity)?s.velocity[h]:s.velocity;let x;const w=s.precision||(y==p?.005:Math.min(1,Math.abs(p-y)*.001));if(Ze.und(s.duration))if(s.decay){const E=s.decay===!0?.998:s.decay,b=Math.exp(-(1-E)*_);v=y+g/(1-E)*(1-b),m=Math.abs(u.lastPosition-v)<=w,x=g*b}else{x=u.lastVelocity==null?g:u.lastVelocity;const E=s.restVelocity||w/10,b=s.clamp?0:s.bounce,M=!Ze.und(b),A=y==p?u.v0>0:yE,!(!P&&(m=Math.abs(p-v)<=w,m)));++N){M&&(C=v==p||v>p==A,C&&(x=-x*b,v=p));const I=-s.tension*1e-6*(v-p),X=-s.friction*.001*x,q=(I+X)/s.mass;x=x+q*L,v=v+x*L}}else{let E=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,u.durationProgress>0&&(u.elapsedTime=s.duration*u.durationProgress,_=u.elapsedTime+=e)),E=(s.progress||0)+_/this._memoizedDuration,E=E>1?1:E<0?0:E,u.durationProgress=E),v=y+s.easing(E)*(p-y),x=(v-u.lastPosition)/e,m=E==1}u.lastVelocity=x,Number.isNaN(v)&&(console.warn("Got NaN while animating:",this),m=!0)}a&&!a[h].done&&(m=!1),m?u.done=!0:t=!1,u.setValue(v,s.round)&&(n=!0)});const l=ns(this),c=l.getValue();if(t){const u=_r(i.to);(c!==u||n)&&!s.decay?(l.setValue(u),this._onChange(u)):n&&s.decay&&this._onChange(c),this._stop()}else n&&this._onChange(c)}set(e){return xt.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(co(this)){const{to:e,config:t}=this.animation;xt.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return Ze.und(e)?(n=this.queue||[],this.queue=[]):n=[Ze.obj(e)?e:ei({},t,{to:e})],Promise.all(n.map(i=>this._update(i))).then(i=>f_(this,i))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),$u(this._state,e&&this._lastCallId),xt.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:n,from:i}=e;n=Ze.obj(n)?n[t]:n,(n==null||Lv(n))&&(n=void 0),i=Ze.obj(i)?i[t]:i,i==null&&(i=void 0);const s={to:n,from:i};return d0(this)||(e.reverse&&([n,i]=[i,n]),i=_r(i),Ze.und(i)?ns(this)||this._set(n):this._set(i)),s}_update(e,t){let n=ei({},e);const{key:i,defaultProps:s}=this;n.default&&Object.assign(s,h_(n,(l,c)=>/^on/.test(c)?OA(l,i):l)),gE(this,n,"onProps"),$c(this,"onProps",n,this);const o=this._prepareNode(n);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const a=this._state;return kA(++this._lastCallId,{key:i,props:n,defaultProps:s,state:a,actions:{pause:()=>{Zc(this)||(pE(this,!0),mu(a.pauseQueue),$c(this,"onPause",Fr(this,Kc(this,this.animation.to)),this))},resume:()=>{Zc(this)&&(pE(this,!1),co(this)&&this._resume(),mu(a.resumeQueue),$c(this,"onResume",Fr(this,Kc(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then(l=>{if(n.loop&&l.finished&&!(t&&l.noop)){const c=HA(n);if(c)return this._update(c,!0)}return l})}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(Hl(this));const i=!Ze.und(e.to),s=!Ze.und(e.from);if(i||s)if(t.callId>this._lastToId)this._lastToId=t.callId;else return n(Hl(this));const{key:o,defaultProps:a,animation:l}=this,{to:c,from:u}=l;let{to:h=c,from:p=u}=e;s&&!i&&(!t.default||Ze.und(h))&&(h=p),t.reverse&&([h,p]=[p,h]);const m=!Ds(p,u);m&&(l.from=p),p=_r(p);const v=!Ds(h,c);v&&this._focus(h);const _=Lv(t.to),{config:y}=l,{decay:g,velocity:x}=y;(i||s)&&(y.velocity=0),t.config&&!_&&tG(y,ca(t.config,o),t.config!==a.config?ca(a.config,o):void 0);let w=ns(this);if(!w||Ze.und(h))return n(Fr(this,!0));const E=Ze.und(t.reset)?s&&!t.default:!Ze.und(p)&&bu(t.reset,o),b=E?p:this.get(),M=Ku(h),A=Ze.num(M)||Ze.arr(M)||Up(M),P=!_&&(!A||bu(a.immediate||t.immediate,o));if(v){const N=Pv(h);if(N!==w.constructor)if(P)w=this._set(M);else throw Error(`Cannot animate between ${w.constructor.name} and ${N.name}, as the "to" prop suggests`)}const C=w.constructor;let L=is(h),F=!1;if(!L){const N=E||!d0(this)&&m;(v||N)&&(F=Ds(Ku(b),M),L=!F),(!Ds(l.immediate,P)&&!P||!Ds(y.decay,g)||!Ds(y.velocity,x))&&(L=!0)}if(F&&co(this)&&(l.changed&&!E?L=!0:L||this._stop(c)),!_&&((L||is(c))&&(l.values=w.getPayload(),l.toValues=is(h)?null:C==$l?[1]:Er(M)),l.immediate!=P&&(l.immediate=P,!P&&!E&&this._set(c)),L)){const{onRest:N}=l;Kt(oG,X=>gE(this,t,X));const I=Fr(this,Kc(this,c));mu(this._pendingCalls,I),this._pendingCalls.add(n),l.changed&&xt.batchedUpdates(()=>{l.changed=!E,N==null||N(I,this),E?ca(a.onRest,I):l.onStart==null||l.onStart(I,this)})}E&&this._set(b),_?n(BA(t.to,t,this._state,this)):L?this._start():co(this)&&!v?this._pendingCalls.add(n):n(zA(b))}_focus(e){const t=this.animation;e!==t.to&&(iE(this)&&this._detach(),t.to=e,iE(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;is(t)&&(vh(t,this),Dv(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;is(e)&&Vd(e,this)}_set(e,t=!0){const n=_r(e);if(!Ze.und(n)){const i=ns(this);if(!i||!Ds(n,i.getValue())){const s=Pv(n);!i||i.constructor!=s?l_(this,s.create(n)):i.setValue(n),i&&xt.batchedUpdates(()=>{this._onChange(n,t)})}}return ns(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,$c(this,"onStart",Fr(this,Kc(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),ca(this.animation.onChange,e,this)),ca(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;ns(this).reset(_r(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),co(this)||(dE(this,!0),Zc(this)||this._resume())}_resume(){us.skipAnimation?this.finish():Lp.start(this)}_stop(e,t){if(co(this)){dE(this,!1);const n=this.animation;Kt(n.values,s=>{s.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Hd(this,{type:"idle",parent:this});const i=t?Hl(this.get()):Fr(this.get(),Kc(this,e??n.to));mu(this._pendingCalls,i),n.changed&&(n.changed=!1,$c(this,"onRest",i,this))}}}function Kc(r,e){const t=Ku(e),n=Ku(r.get());return Ds(n,t)}function HA(r,e=r.loop,t=r.to){let n=ca(e);if(n){const i=n!==!0&&FA(n),s=(i||r).reverse,o=!i||i.reset;return Ju(ei({},r,{loop:e,default:!1,pause:void 0,to:!s||Lv(t)?t:void 0,from:o?r.from:void 0,reset:o},i))}}function Ju(r){const{to:e,from:t}=r=FA(r),n=new Set;return Ze.obj(e)&&mE(e,n),Ze.obj(t)&&mE(t,n),r.keys=n.size?Array.from(n):null,r}function sG(r){const e=Ju(r);return Ze.und(e.default)&&(e.default=h_(e)),e}function mE(r,e){Gs(r,(t,n)=>t!=null&&e.add(n))}const oG=["onStart","onRest","onChange","onPause","onResume"];function gE(r,e,t){r.animation[t]=e[t]!==NA(e,t)?OA(e[t],r.key):void 0}function $c(r,e,...t){var n,i,s,o;(n=(i=r.animation)[e])==null||n.call(i,...t),(s=(o=r.defaultProps)[e])==null||s.call(o,...t)}const aG=["onStart","onChange","onRest"];let lG=1;class cG{constructor(e,t){this.id=lG++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(ei({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(const t in e){const n=e[t];Ze.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(Ju(e)),this}start(e){let{queue:t}=this;return e?t=Er(e).map(Ju):this.queue=[],this._flush?this._flush(this,t):(YA(this,t),Nv(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;Kt(Er(t),i=>n[i].stop(!!e))}else $u(this._state,this._lastAsyncId),this.each(n=>n.stop(!!e));return this}pause(e){if(Ze.und(e))this.start({pause:!0});else{const t=this.springs;Kt(Er(e),n=>t[n].pause())}return this}resume(e){if(Ze.und(e))this.start({pause:!1});else{const t=this.springs;Kt(Er(e),n=>t[n].resume())}return this}each(e){Gs(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,i=this._active.size>0,s=this._changed.size>0;(i&&!this._started||s&&!this._started)&&(this._started=!0,Su(e,([l,c])=>{c.value=this.get(),l(c,this,this._item)}));const o=!i&&this._started,a=s||o&&n.size?this.get():null;s&&t.size&&Su(t,([l,c])=>{c.value=a,l(c,this,this._item)}),o&&(this._started=!1,Su(n,([l,c])=>{c.value=a,l(c,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;xt.onFrame(this._onFrame)}}function Nv(r,e){return Promise.all(e.map(t=>VA(r,t))).then(t=>f_(r,t))}async function VA(r,e,t){const{keys:n,to:i,from:s,loop:o,onRest:a,onResolve:l}=e,c=Ze.obj(e.default)&&e.default;o&&(e.loop=!1),i===!1&&(e.to=null),s===!1&&(e.from=null);const u=Ze.arr(i)||Ze.fun(i)?i:void 0;u?(e.to=void 0,e.onRest=void 0,c&&(c.onRest=void 0)):Kt(aG,_=>{const y=e[_];if(Ze.fun(y)){const g=r._events[_];e[_]=({finished:x,cancelled:w})=>{const E=g.get(y);E?(x||(E.finished=!1),w&&(E.cancelled=!0)):g.set(y,{value:null,finished:x||!1,cancelled:w||!1})},c&&(c[_]=e[_])}});const h=r._state;e.pause===!h.paused?(h.paused=e.pause,mu(e.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(e.pause=!0);const p=(n||Object.keys(r.springs)).map(_=>r.springs[_].start(e)),m=e.cancel===!0||NA(e,"cancel")===!0;(u||m&&h.asyncId)&&p.push(kA(++r._lastAsyncId,{props:e,state:h,actions:{pause:Av,resume:Av,start(_,y){m?($u(h,r._lastAsyncId),y(Hl(r))):(_.onRest=a,y(BA(u,_,h,r)))}}})),h.paused&&await new Promise(_=>{h.resumeQueue.add(_)});const v=f_(r,await Promise.all(p));if(o&&v.finished&&!(t&&v.noop)){const _=HA(e,o,i);if(_)return YA(r,[_]),VA(r,_,!0)}return l&&xt.batchedUpdates(()=>l(v,r,r.item)),v}function vE(r,e){const t=ei({},r.springs);return e&&Kt(Er(e),n=>{Ze.und(n.keys)&&(n=Ju(n)),Ze.obj(n.to)||(n=ei({},n,{to:void 0})),jA(t,n,i=>XA(i))}),WA(r,t),t}function WA(r,e){Gs(e,(t,n)=>{r.springs[n]||(r.springs[n]=t,vh(t,r))})}function XA(r,e){const t=new rG;return t.key=r,e&&vh(t,e),t}function jA(r,e,t){e.keys&&Kt(e.keys,n=>{(r[n]||(r[n]=t(n)))._prepareNode(e)})}function YA(r,e){Kt(e,t=>{jA(r.springs,t,n=>XA(n,r))})}function uG(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}const hG=["children"],Np=r=>{let{children:e}=r,t=uG(r,hG);const n=K.useContext(jd),i=t.pause||!!n.pause,s=t.immediate||!!n.immediate;t=F4(()=>({pause:i,immediate:s}),[i,s]);const{Provider:o}=jd;return K.createElement(o,{value:t},e)},jd=fG(Np,{});Np.Provider=jd.Provider;Np.Consumer=jd.Consumer;function fG(r,e){return Object.assign(r,K.createContext(e)),r.Provider._context=r,r.Consumer._context=r,r}const dG=()=>{const r=[],e=function(i){O4();const s=[];return Kt(r,(o,a)=>{if(Ze.und(i))s.push(o.start());else{const l=t(i,o,a);l&&s.push(o.start(l))}}),s};e.current=r,e.add=function(n){r.includes(n)||r.push(n)},e.delete=function(n){const i=r.indexOf(n);~i&&r.splice(i,1)},e.pause=function(){return Kt(r,n=>n.pause(...arguments)),this},e.resume=function(){return Kt(r,n=>n.resume(...arguments)),this},e.set=function(n){Kt(r,i=>i.set(n))},e.start=function(n){const i=[];return Kt(r,(s,o)=>{if(Ze.und(n))i.push(s.start());else{const a=this._getProps(n,s,o);a&&i.push(s.start(a))}}),i},e.stop=function(){return Kt(r,n=>n.stop(...arguments)),this},e.update=function(n){return Kt(r,(i,s)=>i.update(this._getProps(n,i,s))),this};const t=function(i,s,o){return Ze.fun(i)?i(o,s):i};return e._getProps=t,e};function pG(r,e,t){const n=Ze.fun(e)&&e;n&&!t&&(t=[]);const i=K.useMemo(()=>n||arguments.length==3?dG():void 0,[]),s=K.useRef(0),o=IA(),a=K.useMemo(()=>({ctrls:[],queue:[],flush(g,x){const w=vE(g,x);return s.current>0&&!a.queue.length&&!Object.keys(w).some(b=>!g.springs[b])?Nv(g,x):new Promise(b=>{WA(g,w),a.queue.push(()=>{b(Nv(g,x))}),o()})}}),[]),l=K.useRef([...a.ctrls]),c=[],u=sE(r)||0;K.useMemo(()=>{Kt(l.current.slice(r,u),g=>{$4(g,i),g.stop(!0)}),l.current.length=r,h(u,r)},[r]),K.useMemo(()=>{h(0,Math.min(u,r))},t);function h(g,x){for(let w=g;wvE(g,c[x])),m=K.useContext(Np),v=sE(m),_=m!==v&&K4(m);a_(()=>{s.current++,a.ctrls=l.current;const{queue:g}=a;g.length&&(a.queue=[],Kt(g,x=>x())),Kt(l.current,(x,w)=>{i==null||i.add(x),_&&x.start({default:m});const E=c[w];E&&(J4(x,E.ref),x.ref?x.queue.push(E):x.start(E))})}),DA(()=>()=>{Kt(a.ctrls,g=>g.stop(!0))});const y=p.map(g=>ei({},g));return i?[y,i]:y}function tr(r,e){const t=Ze.fun(r),[[n],i]=pG(1,t?r:[r],t?e||[]:e);return t||arguments.length==2?[n,i]:n}let yE;(function(r){r.MOUNT="mount",r.ENTER="enter",r.UPDATE="update",r.LEAVE="leave"})(yE||(yE={}));class mG extends d_{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=qu(...t);const n=this._get(),i=Pv(n);l_(this,i.create(n))}advance(e){const t=this._get(),n=this.get();Ds(t,n)||(ns(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&_E(this._active)&&p0(this)}_get(){const e=Ze.arr(this.source)?this.source.map(_r):Er(_r(this.source));return this.calc(...e)}_start(){this.idle&&!_E(this._active)&&(this.idle=!1,Kt(Op(this),e=>{e.done=!1}),us.skipAnimation?(xt.batchedUpdates(()=>this.advance()),p0(this)):Lp.start(this))}_attach(){let e=1;Kt(Er(this.source),t=>{is(t)&&vh(t,this),Dv(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){Kt(Er(this.source),e=>{is(e)&&Vd(e,this)}),this._active.clear(),p0(this)}eventObserved(e){e.type=="change"?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type=="idle"?this._active.delete(e.parent):e.type=="priority"&&(this.priority=Er(this.source).reduce((t,n)=>Math.max(t,(Dv(n)?n.priority:0)+1),0))}}function gG(r){return r.idle!==!1}function _E(r){return!r.size||Array.from(r).every(gG)}function p0(r){r.idle||(r.idle=!0,Kt(Op(r),e=>{e.done=!0}),Hd(r,{type:"idle",parent:r}))}us.assign({createStringInterpolator:PA,to:(r,e)=>new mG(r,e)});const vG=["primitive"].concat(Object.keys(uT).filter(r=>/^[A-Z]/.test(r)).map(r=>r[0].toLowerCase()+r.slice(1)));us.assign({createStringInterpolator:PA,colors:f4,frameLoop:"demand"});pO(()=>{xt.advance()});const yG=X4(vG,{applyAnimatedValues:oa}),An=yG.animated,od=(r,e)=>{const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,l=new Tt;let c=0;if(r.forEach((u,h)=>{let p=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let m in u.attributes){if(!n.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;s[m]===void 0&&(s[m]=[]),s[m].push(u.attributes[m]),p++}if(p!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let m in u.morphAttributes){if(!i.has(m))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[m]===void 0&&(o[m]=[]),o[m].push(u.morphAttributes[m])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(u.userData),e){let m;if(u.index)m=u.index.count;else if(u.attributes.position!==void 0)m=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;l.addGroup(c,m,h),c+=m}}),t){let u=0;const h=[];r.forEach(p=>{const m=p.index;for(let v=0;v{let e,t,n,i=0;if(r.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}),e&&t){const s=new e(i);let o=0;return r.forEach(a=>{s.set(a.array,o),o+=a.array.length}),new $t(s,t,n)}},m0=new oh,g0=new Y,Ml=new Y,Dr=new Y,Ps=new Y,Qr=new Y,Ls=new Y,Is=new Y,Jc=new Y,Qc=new Y,eu=new Y,ad=new Y,tu=new Y,nu=new Y,iu=new Y;class wE{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new Y,this.endPoint=new Y,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(m0,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Ml.copy(e),Ml.x=Math.min(e.x,t.x),Ml.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),Dr.setFromMatrixPosition(this.camera.matrixWorld),Ps.copy(Ml),Qr.set(t.x,Ml.y,0),Ls.copy(t),Is.set(Ml.x,t.y,0),Ps.unproject(this.camera),Qr.unproject(this.camera),Ls.unproject(this.camera),Is.unproject(this.camera),tu.copy(Ps).sub(Dr),nu.copy(Qr).sub(Dr),iu.copy(Ls).sub(Dr),tu.normalize(),nu.normalize(),iu.normalize(),tu.multiplyScalar(this.deep),nu.multiplyScalar(this.deep),iu.multiplyScalar(this.deep),tu.add(Dr),nu.add(Dr),iu.add(Dr);var n=m0.planes;n[0].setFromCoplanarPoints(Dr,Ps,Qr),n[1].setFromCoplanarPoints(Dr,Qr,Ls),n[2].setFromCoplanarPoints(Ls,Is,Dr),n[3].setFromCoplanarPoints(Is,Ps,Dr),n[4].setFromCoplanarPoints(Qr,Ls,Is),n[5].setFromCoplanarPoints(iu,nu,tu),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const i=Math.min(e.x,t.x),s=Math.max(e.y,t.y),o=Math.max(e.x,t.x),a=Math.min(e.y,t.y);Ps.set(i,s,-1),Qr.set(o,s,-1),Ls.set(o,a,-1),Is.set(i,a,-1),Jc.set(i,s,1),Qc.set(o,s,1),eu.set(o,a,1),ad.set(i,a,1),Ps.unproject(this.camera),Qr.unproject(this.camera),Ls.unproject(this.camera),Is.unproject(this.camera),Jc.unproject(this.camera),Qc.unproject(this.camera),eu.unproject(this.camera),ad.unproject(this.camera);var n=m0.planes;n[0].setFromCoplanarPoints(Ps,Jc,Qc),n[1].setFromCoplanarPoints(Qr,Qc,eu),n[2].setFromCoplanarPoints(eu,ad,Is),n[3].setFromCoplanarPoints(ad,Jc,Ps),n[4].setFromCoplanarPoints(Qr,Ls,Is),n[5].setFromCoplanarPoints(eu,Qc,Jc),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),g0.copy(t.geometry.boundingSphere.center),g0.applyMatrix4(t.matrixWorld),e.containsPoint(g0)&&this.collection.push(t)),t.children.length>0)for(let n=0;n{if(!t||!c.current)return;const p=c.current.rotation.clone();c.current.updateMatrix(),c.current.updateWorldMatrix(!1,!1),c.current.getWorldQuaternion(u),h.getWorldQuaternion(l.current.quaternion).premultiply(u.invert()),n&&(c.current.rotation.x=p.x),i&&(c.current.rotation.y=p.y),s&&(c.current.rotation.z=p.z)}),K.useImperativeHandle(a,()=>c.current,[]),K.createElement("group",Ta({ref:c,matrixAutoUpdate:!1,matrixWorldAutoUpdate:!1},o),K.createElement("group",{ref:l},e))});function _G(){var r=Object.create(null);function e(i,s){var o=i.id,a=i.name,l=i.dependencies;l===void 0&&(l=[]);var c=i.init;c===void 0&&(c=function(){});var u=i.getTransferables;if(u===void 0&&(u=null),!r[o])try{l=l.map(function(p){return p&&p.isWorkerModule&&(e(p,function(m){if(m instanceof Error)throw m}),p=r[p.id].value),p}),c=n("<"+a+">.init",c),u&&(u=n("<"+a+">.getTransferables",u));var h=null;typeof c=="function"?h=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),r[o]={id:o,value:h,getTransferables:u},s(h)}catch(p){p&&p.noLog||console.error(p),s(p)}}function t(i,s){var o,a=i.id,l=i.args;(!r[a]||typeof r[a].value!="function")&&s(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var c=(o=r[a]).value.apply(o,l);c&&typeof c.then=="function"?c.then(u,function(h){return s(h instanceof Error?h:new Error(""+h))}):u(c)}catch(h){s(h)}function u(h){try{var p=r[a].getTransferables&&r[a].getTransferables(h);(!p||!Array.isArray(p)||!p.length)&&(p=void 0),s(h,p)}catch(m){console.error(m),s(m)}}}function n(i,s){var o=void 0;self.troikaDefine=function(l){return o=l};var a=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/ - -troikaDefine( -`+s+` -)`],{type:"application/javascript"}));try{importScripts(a)}catch(l){console.error(l)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(i){var s=i.data,o=s.messageId,a=s.action,l=s.data;try{a==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof c=="function"}})}),a==="callModule"&&t(l,function(c,u){c instanceof Error?postMessage({messageId:o,success:!1,error:c.message}):postMessage({messageId:o,success:!0,result:c},u||void 0)})}catch(c){postMessage({messageId:o,success:!1,error:c.stack})}})}function xG(r){var e=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=r.dependencies,n=r.init;t=Array.isArray(t)?t.map(function(s){return s&&s._getInitResult?s._getInitResult():s}):[];var i=Promise.all(t).then(function(s){return n.apply(null,s)});return e._getInitResult=function(){return i},i},e}var ZA=function(){var r=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),r=!0}catch(t){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return ZA=function(){return r},r},wG=0,SG=0,v0=!1,Mu=Object.create(null),Tu=Object.create(null),Fv=Object.create(null);function yh(r){if((!r||typeof r.init!="function")&&!v0)throw new Error("requires `options.init` function");var e=r.dependencies,t=r.init,n=r.getTransferables,i=r.workerId;if(!ZA())return xG(r);i==null&&(i="#default");var s="workerModule"+ ++wG,o=r.name||s,a=null;e=e&&e.map(function(c){return typeof c=="function"&&!c.workerModuleData&&(v0=!0,c=yh({workerId:i,name:"<"+o+"> function dependency: "+c.name,init:`function(){return ( -`+Rd(c)+` -)}`}),v0=!1),c&&c.workerModuleData&&(c=c.workerModuleData),c});function l(){for(var c=[],u=arguments.length;u--;)c[u]=arguments[u];if(!a){a=SE(i,"registerModule",l.workerModuleData);var h=function(){a=null,Tu[i].delete(h)};(Tu[i]||(Tu[i]=new Set)).add(h)}return a.then(function(p){var m=p.isCallable;if(m)return SE(i,"callModule",{id:s,args:c});throw new Error("Worker module function was called but `init` did not return a callable function")})}return l.workerModuleData={isWorkerModule:!0,id:s,name:o,dependencies:e,init:Rd(t),getTransferables:n&&Rd(n)},l}function EG(r){Tu[r]&&Tu[r].forEach(function(e){e()}),Mu[r]&&(Mu[r].terminate(),delete Mu[r])}function Rd(r){var e=r.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function bG(r){var e=Mu[r];if(!e){var t=Rd(_G);e=Mu[r]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+r.replace(/\*/g,"")+` **/ - -;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(n){var i=n.data,s=i.messageId,o=Fv[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete Fv[s],o(i)}}return e}function SE(r,e,t){return new Promise(function(n,i){var s=++SG;Fv[s]=function(o){o.success?n(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},bG(r).postMessage({messageId:s,action:e,data:t})})}function KA(){var r=(function(e){function t(G,B,D,V,Z,ee,ie,ue){var ce=1-ie;ue.x=ce*ce*G+2*ce*ie*D+ie*ie*Z,ue.y=ce*ce*B+2*ce*ie*V+ie*ie*ee}function n(G,B,D,V,Z,ee,ie,ue,ce,le){var Ae=1-ce;le.x=Ae*Ae*Ae*G+3*Ae*Ae*ce*D+3*Ae*ce*ce*Z+ce*ce*ce*ie,le.y=Ae*Ae*Ae*B+3*Ae*Ae*ce*V+3*Ae*ce*ce*ee+ce*ce*ce*ue}function i(G,B){for(var D=/([MLQCZ])([^MLQCZ]*)/g,V,Z,ee,ie,ue;V=D.exec(G);){var ce=V[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(le){return parseFloat(le)});switch(V[1]){case"M":ie=Z=ce[0],ue=ee=ce[1];break;case"L":(ce[0]!==ie||ce[1]!==ue)&&B("L",ie,ue,ie=ce[0],ue=ce[1]);break;case"Q":{B("Q",ie,ue,ie=ce[2],ue=ce[3],ce[0],ce[1]);break}case"C":{B("C",ie,ue,ie=ce[4],ue=ce[5],ce[0],ce[1],ce[2],ce[3]);break}case"Z":(ie!==Z||ue!==ee)&&B("L",ie,ue,Z,ee);break}}}function s(G,B,D){D===void 0&&(D=16);var V={x:0,y:0};i(G,function(Z,ee,ie,ue,ce,le,Ae,Ee,ae){switch(Z){case"L":B(ee,ie,ue,ce);break;case"Q":{for(var z=ee,oe=ie,te=1;te0;)be[Me]=arguments[Me+2];var Fe=Le[we]||(Le[we]=D.getUniformLocation(ge,we));D["uniform"+ne].apply(D,[Fe].concat(be))},setAttribute:function(ne,we,be,Me,Fe){var Ue=Se[ne];Ue||(Ue=Se[ne]={buf:D.createBuffer(),loc:D.getAttribLocation(ge,ne),data:null}),D.bindBuffer(D.ARRAY_BUFFER,Ue.buf),D.vertexAttribPointer(Ue.loc,we,D.FLOAT,!1,0,0),D.enableVertexAttribArray(Ue.loc),Z?D.vertexAttribDivisor(Ue.loc,Me):Ae("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Ue.loc,Me),Fe!==Ue.data&&(D.bufferData(D.ARRAY_BUFFER,Fe,be),Ue.data=Fe)}})}}}ie[se].transaction(de)},z=function(se,$){ce++;try{D.activeTexture(D.TEXTURE0+ce);var Ie=ue[se];Ie||(Ie=ue[se]=D.createTexture(),D.bindTexture(D.TEXTURE_2D,Ie),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MIN_FILTER,D.NEAREST),D.texParameteri(D.TEXTURE_2D,D.TEXTURE_MAG_FILTER,D.NEAREST)),D.bindTexture(D.TEXTURE_2D,Ie),$(Ie,ce)}finally{ce--}},oe=function(se,$,Ie){var de=D.createFramebuffer();le.push(de),D.bindFramebuffer(D.FRAMEBUFFER,de),D.activeTexture(D.TEXTURE0+$),D.bindTexture(D.TEXTURE_2D,se),D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_2D,se,0);try{Ie(de)}finally{D.deleteFramebuffer(de),D.bindFramebuffer(D.FRAMEBUFFER,le[--le.length-1]||null)}},te=function(){ee={},ie={},ue={},ce=-1,le.length=0};var Z=typeof WebGL2RenderingContext<"u"&&D instanceof WebGL2RenderingContext,ee={},ie={},ue={},ce=-1,le=[];D.canvas.addEventListener("webglcontextlost",function(se){te(),se.preventDefault()},!1),l.set(D,V={gl:D,isWebGL2:Z,getExtension:Ae,withProgram:ae,withTexture:z,withTextureFramebuffer:oe,handleContextLoss:te})}B(V)}function h(G,B,D,V,Z,ee,ie,ue){ie===void 0&&(ie=15),ue===void 0&&(ue=null),u(G,function(ce){var le=ce.gl,Ae=ce.withProgram,Ee=ce.withTexture;Ee("copy",function(ae,z){le.texImage2D(le.TEXTURE_2D,0,le.RGBA,Z,ee,0,le.RGBA,le.UNSIGNED_BYTE,B),Ae("copy",o,a,function(oe){var te=oe.setUniform,se=oe.setAttribute;se("aUV",2,le.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),te("1i","image",z),le.bindFramebuffer(le.FRAMEBUFFER,ue||null),le.disable(le.BLEND),le.colorMask(ie&8,ie&4,ie&2,ie&1),le.viewport(D,V,Z,ee),le.scissor(D,V,Z,ee),le.drawArrays(le.TRIANGLES,0,3)})})})}function p(G,B,D){var V=G.width,Z=G.height;u(G,function(ee){var ie=ee.gl,ue=new Uint8Array(V*Z*4);ie.readPixels(0,0,V,Z,ie.RGBA,ie.UNSIGNED_BYTE,ue),G.width=B,G.height=D,h(ie,ue,0,0,V,Z)})}var m=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:p});function v(G,B,D,V,Z,ee){ee===void 0&&(ee=1);var ie=new Uint8Array(G*B),ue=V[2]-V[0],ce=V[3]-V[1],le=[];s(D,function(se,$,Ie,de){le.push({x1:se,y1:$,x2:Ie,y2:de,minX:Math.min(se,Ie),minY:Math.min($,de),maxX:Math.max(se,Ie),maxY:Math.max($,de)})}),le.sort(function(se,$){return se.maxX-$.maxX});for(var Ae=0;AeLe.minX&&$-deLe.minY){var ge=g(se,$,Le.x1,Le.y1,Le.x2,Le.y2);ge$!=Se.y2>$&&se<(Se.x2-Se.x1)*($-Se.y1)/(Se.y2-Se.y1)+Se.x1;Le&&(Ie+=Se.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function _(de,Se){var Le=36,ge=0,He=new Map,j=Se&&new Map,H;return de.split(",").forEach(function ne(we){if(we.indexOf("+")!==-1)for(var be=+we;be--;)ne(H);else{H=we;var Me=we.split(">"),Fe=Me[0],Ue=Me[1];Fe=String.fromCodePoint(ge+=parseInt(Fe,Le)),Ue=String.fromCodePoint(ge+=parseInt(Ue,Le)),He.set(Fe,Ue),Se&&j.set(Ue,Fe)}}),{map:He,reverseMap:j}}var y,g,x;function w(){if(!y){var de=_(v.pairs,!0),Se=de.map,Le=de.reverseMap;y=Se,g=Le,x=_(v.canonical,!1).map}}function E(de){return w(),y.get(de)||null}function b(de){return w(),g.get(de)||null}function M(de){return w(),x.get(de)||null}var A=n.L,P=n.R,C=n.EN,L=n.ES,F=n.ET,N=n.AN,I=n.CS,X=n.B,q=n.S,W=n.ON,O=n.BN,k=n.NSM,G=n.AL,B=n.LRO,D=n.RLO,V=n.LRE,Z=n.RLE,ee=n.PDF,ie=n.LRI,ue=n.RLI,ce=n.FSI,le=n.PDI;function Ae(de,Se){for(var Le=125,ge=new Uint32Array(de.length),He=0;He0)We--;else if(pt>0){for(nt=0;!Ve[Ve.length-1]._isolate;)Ve.pop();var _t=Ve[Ve.length-1]._isolInitIndex;_t!=null&&(we.set(_t,re),we.set(re,_t)),Ve.pop(),pt--}Oe=Ve[Ve.length-1],ne[re]=Oe._level,Oe._override&&H(re,Oe._override)}else ze&ee?(We===0&&(nt>0?nt--:!Oe._isolate&&Ve.length>1&&(Ve.pop(),Oe=Ve[Ve.length-1])),ne[re]=Oe._level):ze&X&&(ne[re]=Me.level);else ne[re]=Oe._level,Oe._override&&ze!==O&&H(re,Oe._override)}for(var It=[],Ft=null,Ot=Me.start;Ot<=Me.end;Ot++){var Yt=ge[Ot];if(!(Yt&l)){var Nt=ne[Ot],Rt=Yt&s,li=Yt===le;Ft&&Nt===Ft._level?(Ft._end=Ot,Ft._endsWithIsolInit=Rt):It.push(Ft={_start:Ot,_end:Ot,_level:Nt,_startsWithPDI:li,_endsWithIsolInit:Rt})}}for(var jn=[],Bt=0;Bt=0;pe--)if(!(ge[pe]&l)){Re=ne[pe];break}var Pe=Gn[Gn.length-1],it=ne[Pe],lt=Me.level;if(!(ge[Pe]&s)){for(var ct=Pe+1;ct<=Me.end;ct++)if(!(ge[ct]&l)){lt=ne[ct];break}}jn.push({_seqIndices:Gn,_sosType:Math.max(Re,me)%2?P:A,_eosType:Math.max(lt,it)%2?P:A})}}for(var dt=0;dt=0;mt--)if(!(ge[ke[mt]]&l)){qt=ge[ke[mt]];break}H(ci,qt&(s|le)?W:qt)}}if(j.get(C))for(var kt=0;kt=-1;Cn--){var En=Cn===-1?ut:ge[ke[Cn]];if(En&o){En===G&&H(gt,N);break}}}if(j.get(G))for(var cn=0;cn=0&&(xi=ge[ke[Xr]],!!(xi&l));Xr--);for(var jr=Qt+1;jr=0&&ge[ke[Oa]]&(F|l);Oa--)H(ke[Oa],C);for(ui++;ui=0&&ge[ke[fs]]&l;fs--)H(ke[fs],W);for(var ds=Ro+1;ds=0;gs--){var Fa=Ys[gs].char;if(Fa===oc||Fa===b(M(Ut))||E(M(Fa))===Ut){Yr.push([Ys[gs].seqIndex,qr]),Ys.length=gs;break}}}Yr.sort(function(Zn,bi){return Zn[0]-bi[0]})}for(var ac=0;ac=0;cc--){var bh=ke[cc];if(ge[bh]&Na){var Xi=ge[bh]&ms?P:A;Xi!==Gt?wi=Xi:wi=Gt;break}}}if(wi){if(ge[ke[pn]]=ge[ke[Lo]]=wi,wi!==Gt){for(var Si=pn+1;Si=0;Do--)if(ge[ke[Do]]&l)uc=Do;else{Di=ge[ke[Do]]&ms?P:A;break}for(var Uo=Jt,Oo=or+1;Oo=0&&p(de[qs])&c;qs--)ne[qs]=Me.level}}return{levels:ne,paragraphs:be};function za(Zn,bi){for(var Rn=Zn;Rn=ne&&p(de[Me])&c;Me--)be[Me]=H.level;for(var Fe=H.level,Ue=1/0,xe=0;xeFe&&(Fe=Be),Be=Ue;$e--)for(var Ve=0;Ve=$e){for(var Oe=Ve;Ve+1=$e;)Ve++;Ve>Oe&&j.push([Oe+ne,Ve+ne])}}}),j}function $(de,Se,Le,ge){var He=Ie(de,Se,Le,ge),j=[].concat(de);return He.forEach(function(H,ne){j[ne]=(Se.levels[H]&1?oe(de[H]):null)||de[H]}),j.join("")}function Ie(de,Se,Le,ge){for(var He=se(de,Se,Le,ge),j=[],H=0;H/gm;function t(n,i){let s=bt[i];return s?kv(s):n}return r.replace(e,t)}const ii=[];for(let r=0;r<256;r++)ii[r]=(r<16?"0":"")+r.toString(16);function TG(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(ii[r&255]+ii[r>>8&255]+ii[r>>16&255]+ii[r>>24&255]+"-"+ii[e&255]+ii[e>>8&255]+"-"+ii[e>>16&15|64]+ii[e>>24&255]+"-"+ii[t&63|128]+ii[t>>8&255]+"-"+ii[t>>16&255]+ii[t>>24&255]+ii[n&255]+ii[n>>8&255]+ii[n>>16&255]+ii[n>>24&255]).toUpperCase()}const na=Object.assign||function(){let r=arguments[0];for(let e=1,t=arguments.length;e/gm,` -//!BEGIN_POST_CHUNK $1 -$& -//!END_POST_CHUNK -`),t=kv(t)),m){let _=m({vertexShader:e,fragmentShader:t});e=_.vertexShader,t=_.fragmentShader}if(p){let _=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,y=>(_.push(y),"")),h=`${p} -${_.join(` -`)} -${h}`}if(v){const _=` -uniform float ${v}; -`;s=_+s,c=_+c}return l&&(e=`vec3 troika_position_${i}; -vec3 troika_normal_${i}; -vec2 troika_uv_${i}; -${e} -`,s=`${s} -void troikaVertexTransform${i}(inout vec3 position, inout vec3 normal, inout vec2 uv) { - ${l} -} -`,o=` -troika_position_${i} = vec3(position); -troika_normal_${i} = vec3(normal); -troika_uv_${i} = vec2(uv); -troikaVertexTransform${i}(troika_position_${i}, troika_normal_${i}, troika_uv_${i}); -${o} -`,e=e.replace(/\b(position|normal|uv)\b/g,(_,y,g,x)=>/\battribute\s+vec[23]\s+$/.test(x.substr(0,g))?y:`troika_${y}_${i}`),r.map&&r.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=ME(e,i,s,o,a),t=ME(t,i,c,u,h),{vertexShader:e,fragmentShader:t}}function ME(r,e,t,n,i){return(n||i||t)&&(r=r.replace($A,` -${t} -void troikaOrigMain${e}() {`),r+=` -void main() { - ${n} - troikaOrigMain${e}(); - ${i} -}`),r}function PG(r,e){return r==="uniforms"?void 0:typeof e=="function"?e.toString():e}let LG=0;const TE=new Map;function IG(r){const e=JSON.stringify(r,PG);let t=TE.get(e);return t==null&&TE.set(e,t=++LG),t}function DG(r,e,t){const{defaultFontURL:n}=t,i=Object.create(null),s=1/0,o=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,a="[^\\S\\u00A0]",l=new RegExp(`${a}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function c(x,w){function E(){const b=M=>{console.error(`Failure loading font ${x}${x===n?"":"; trying fallback"}`,M),x!==n&&(x=n,E())};try{const M=new XMLHttpRequest;M.open("get",x,!0),M.responseType="arraybuffer",M.onload=function(){if(M.status>=400)b(new Error(M.statusText));else if(M.status>0)try{const A=r(M.response);w(A)}catch(A){b(A)}},M.onerror=b,M.send()}catch(M){b(M)}}E()}function u(x,w){x||(x=n);let E=i[x];E?E.pending?E.pending.push(w):w(E):(i[x]={pending:[w]},c(x,b=>{let M=i[x].pending;i[x]=b,M.forEach(A=>A(b))}))}function h({text:x="",font:w=n,sdfGlyphSize:E=64,fontSize:b=1,letterSpacing:M=0,lineHeight:A="normal",maxWidth:P=s,direction:C,textAlign:L="left",textIndent:F=0,whiteSpace:N="normal",overflowWrap:I="normal",anchorX:X=0,anchorY:q=0,includeCaretPositions:W=!1,chunkedBoundsSize:O=8192,colorRanges:k=null},G,B=!1){const D=_(),V={fontLoad:0,typesetting:0};x.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),x=x.replace(/\r\n/g,` -`).replace(/\r/g,` -`)),b=+b,M=+M,P=+P,A=A||"normal",F=+F,u(w,Z=>{const ee=isFinite(P);let ie=null,ue=null,ce=null,le=null,Ae=null,Ee=null,ae=null,z=0,oe=0,te=N!=="nowrap";const{ascender:se,descender:$,unitsPerEm:Ie,lineGap:de,capHeight:Se,xHeight:Le}=Z;V.fontLoad=_()-D;const ge=_(),He=b/Ie;A==="normal"&&(A=(se-$+de)/Ie),A=A*b;const j=(A-(se-$)*He)/2,H=-(se*He+j),ne=Math.min(A,(se-$)*He),we=(se+$)/2*He-ne/2;let be=F,Me=new y;const Fe=[Me];Z.forEachGlyph(x,b,M,(Be,$e,Ve)=>{const Oe=x.charAt(Ve),We=Be.advanceWidth*He,nt=Me.count;let pt;if("isEmpty"in Be||(Be.isWhitespace=!!Oe&&new RegExp(a).test(Oe),Be.canBreakAfter=!!Oe&&l.test(Oe),Be.isEmpty=Be.xMin===Be.xMax||Be.yMin===Be.yMax||o.test(Oe)),!Be.isWhitespace&&!Be.isEmpty&&oe++,te&&ee&&!Be.isWhitespace&&$e+We+be>P&&nt){if(Me.glyphAt(nt-1).glyphObj.canBreakAfter)pt=new y,be=-$e;else for(let ze=nt;ze--;)if(ze===0&&I==="break-word"){pt=new y,be=-$e;break}else if(Me.glyphAt(ze).glyphObj.canBreakAfter){pt=Me.splitAt(ze+1);const ve=pt.glyphAt(0).x;be-=ve;for(let Ge=pt.count;Ge--;)pt.glyphAt(Ge).x-=ve;break}pt&&(Me.isSoftWrapped=!0,Me=pt,Fe.push(Me),z=P)}let re=Me.glyphAt(Me.count);re.glyphObj=Be,re.x=$e+be,re.width=We,re.charIndex=Ve,Oe===` -`&&(Me=new y,Fe.push(Me),be=-($e+We+M*b)+F)}),Fe.forEach(Be=>{for(let $e=Be.count;$e--;){let{glyphObj:Ve,x:Oe,width:We}=Be.glyphAt($e);if(!Ve.isWhitespace){Be.width=Oe+We,Be.width>z&&(z=Be.width);return}}});let Ue=0,xe=0;if(X&&(typeof X=="number"?Ue=-X:typeof X=="string"&&(Ue=-z*(X==="left"?0:X==="center"?.5:X==="right"?1:m(X)))),q){if(typeof q=="number")xe=-q;else if(typeof q=="string"){let Be=Fe.length*A;xe=q==="top"?0:q==="top-baseline"?-H:q==="top-cap"?-H-Se*He:q==="top-ex"?-H-Le*He:q==="middle"?Be/2:q==="bottom"?Be:q==="bottom-baseline"?Be-j+$*He:m(q)*Be}}if(!B){const Be=e.getEmbeddingLevels(x,C);ie=new Uint16Array(oe),ue=new Float32Array(oe*2),ce={},Ee=[s,s,-s,-s],ae=[];let $e=H;W&&(Ae=new Float32Array(x.length*3)),k&&(le=new Uint8Array(oe*3));let Ve=0,Oe=-1,We=-1,nt,pt;if(Fe.forEach((re,ze)=>{let{count:ve,width:Ge}=re;if(ve>0){let Ye=0;for(let Nt=ve;Nt--&&re.glyphAt(Nt).glyphObj.isWhitespace;)Ye++;let _t=0,It=0;if(L==="center")_t=(z-Ge)/2;else if(L==="right")_t=z-Ge;else if(L==="justify"&&re.isSoftWrapped){let Nt=0;for(let Rt=ve-Ye;Rt--;)re.glyphAt(Rt).glyphObj.isWhitespace&&Nt++;It=(z-Ge)/Nt}if(It||_t){let Nt=0;for(let Rt=0;Rt=Rt){let ti=sn,tn=sn;for(;tnli)break;tnOt=Nt;for(let Nt=0;Nt1&&v(Ae,Oe,tn),Oe=Bt}if(k){const{charIndex:Bt}=Rt;for(;Bt>We;)We++,k.hasOwnProperty(We)&&(pt=k[We])}if(!Ot.isWhitespace&&!Ot.isEmpty){const Bt=Ve++;ce[li]||(ce[li]={path:Ot.path,pathBounds:[Ot.xMin,Ot.yMin,Ot.xMax,Ot.yMax]});const sn=Rt.x+Ue,ti=$e+xe;ue[Bt*2]=sn,ue[Bt*2+1]=ti;const tn=sn+Ot.xMin*He,dn=ti+Ot.yMin*He,Gn=sn+Ot.xMax*He,sr=ti+Ot.yMax*He;tnEe[2]&&(Ee[2]=Gn),sr>Ee[3]&&(Ee[3]=sr),Bt%O===0&&(nt={start:Bt,end:Bt,rect:[s,s,-s,-s]},ae.push(nt)),nt.end++;const _i=nt.rect;if(tn<_i[0]&&(_i[0]=tn),dn<_i[1]&&(_i[1]=dn),Gn>_i[2]&&(_i[2]=Gn),sr>_i[3]&&(_i[3]=sr),ie[Bt]=li,k){const J=Bt*3;le[J]=pt>>16&255,le[J+1]=pt>>8&255,le[J+2]=pt&255}}}}$e-=A}),Ae){const re=x.length-Oe;re>1&&v(Ae,Oe,re)}}V.typesetting=_()-ge,G({glyphIds:ie,glyphPositions:ue,glyphData:ce,caretPositions:Ae,caretHeight:ne,glyphColors:le,chunkedBounds:ae,fontSize:b,unitsPerEm:Ie,ascender:se*He,descender:$*He,capHeight:Se*He,xHeight:Le*He,lineHeight:A,topBaseline:H,blockBounds:[Ue,xe-Fe.length*A,Ue+z,xe],visibleBounds:Ee,timings:V})})}function p(x,w){h(x,E=>{const[b,M,A,P]=E.blockBounds;w({width:A-b,height:P-M})},{})}function m(x){let w=x.match(/^([\d.]+)%$/),E=w?parseFloat(w[1]):NaN;return isNaN(E)?0:E/100}function v(x,w,E){const b=x[w*3],M=x[w*3+1],A=x[w*3+2],P=(M-b)/E;for(let C=0;C(Object.defineProperty(x,w,{get(){return this.data[this.index*g.length+E]},set(M){this.data[this.index*g.length+E]=M}}),x),{data:null,index:0}),{typeset:h,measure:p,loadFont:u}}const _a=()=>(self.performance||Date).now(),Fp=KA();let AE;function UG(r,e,t,n,i,s,o,a,l,c,u=!0){return u?NG(r,e,t,n,i,s,o,a,l,c).then(null,h=>(AE||(console.warn("WebGL SDF generation failed, falling back to JS",h),AE=!0),RE(r,e,t,n,i,s,o,a,l,c))):RE(r,e,t,n,i,s,o,a,l,c)}const Pd=[],OG=5;let Bv=0;function JA(){const r=_a();for(;Pd.length&&_a()-rnew Promise((e,t)=>{Pd.push(()=>{const n=_a();try{Fp.webgl.generateIntoCanvas(...r),e({timing:_a()-n})}catch(i){t(i)}}),Bv||(Bv=setTimeout(JA,0))}),FG=4,kG=2e3,CE={};let zG=0;function RE(r,e,t,n,i,s,o,a,l,c){const u="TroikaTextSDFGenerator_JS_"+zG++%FG;let h=CE[u];return h||(h=CE[u]={workerModule:yh({name:u,workerId:u,dependencies:[KA,_a],init(p,m){const v=p().javascript.generate;return function(..._){const y=m();return{textureData:v(..._),timing:m()-y}}},getTransferables(p){return[p.textureData.buffer]}}),requests:0,idleTimer:null}),h.requests++,clearTimeout(h.idleTimer),h.workerModule(r,e,t,n,i,s).then(({textureData:p,timing:m})=>{const v=_a(),_=new Uint8Array(p.length*4);for(let y=0;y{EG(u)},kG)),{timing:m}})}function BG(r){r._warm||(Fp.webgl.isSupported(r),r._warm=!0)}const GG=Fp.webglUtils.resizeWebGLCanvasWithoutClearing;/*! -Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. -Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE -*/function HG(){return typeof window>"u"&&(self.window=self),(function(r){var e={parse:function(i){var s=e._bin,o=new Uint8Array(i);if(s.readASCII(o,0,4)=="ttcf"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var l=s.readUint(o,a);a+=4;for(var c=[],u=0;u>>o&1)!=0&&s++;return s},e._lctf.readClassDef=function(i,s){var o=e._bin,a=[],l=o.readUshort(i,s);if(s+=2,l==1){var c=o.readUshort(i,s);s+=2;var u=o.readUshort(i,s);s+=2;for(var h=0;h0&&(l.featureParams=a+c);var u=o.readUshort(i,s);s+=2,l.tab=[];for(var h=0;h255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[s])},e.CFF.readEncoding=function(i,s,o){e._bin;var a=[".notdef"],l=i[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=i[s];s++;for(var u=0;u>4,x=15&y;if(g!=15&&_.push(g),x!=15&&_.push(x),x==15)break}for(var w="",E=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],b=0;b<_.length;b++)w+=E[_[b]];v=parseFloat(w)}u<=21&&(m=["version","Notice","FullName","FamilyName","Weight","FontBBox","BlueValues","OtherBlues","FamilyBlues","FamilyOtherBlues","StdHW","StdVW","escape","UniqueID","XUID","charset","Encoding","CharStrings","Private","Subrs","defaultWidthX","nominalWidthX"][u],p=1,u==12&&(m=["Copyright","isFixedPitch","ItalicAngle","UnderlinePosition","UnderlineThickness","PaintType","CharstringType","FontMatrix","StrokeWidth","BlueScale","BlueShift","BlueFuzz","StemSnapH","StemSnapV","ForceBold",0,0,"LanguageGroup","ExpansionFactor","initialRandomSeed","SyntheticBase","PostScript","BaseFontName","BaseFontBlend",0,0,0,0,0,0,"ROS","CIDFontVersion","CIDFontRevision","CIDFontType","CIDCount","UIDBase","FDArray","FDSelect","FontName"][h],p=2)),m!=null?(l[m]=c.length==1?c[0]:c,c=[]):c.push(v),s+=p}return l},e.cmap={},e.cmap.parse=function(i,s,o){i=new Uint8Array(i.buffer,s,o),s=0;var a=e._bin,l={};a.readUshort(i,s),s+=2;var c=a.readUshort(i,s);s+=2;var u=[];l.tables=[];for(var h=0;h=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var u=0;u=1&&u.fmt<=2){p=l.readUshort(i,o),o+=2;var v=l.readUshort(i,o);o+=2,m=e._lctf.numOfOnes(p);var _=e._lctf.numOfOnes(v);if(u.fmt==1){u.pairsets=[];var y=l.readUshort(i,o);o+=2;for(var g=0;g=1&&u.fmt<=2){if(u.fmt==1)u.delta=l.readShort(i,o),o+=2;else if(u.fmt==2){var p=l.readUshort(i,o);o+=2,u.newg=l.readUshorts(i,o,p),o+=2*u.newg.length}}else if(s==4){u.vals=[],p=l.readUshort(i,o),o+=2;for(var m=0;m>>8;if((v&=15)!=0)throw"unknown kern table format: "+v;s=e.kern.readFormat0(i,s,h)}return h},e.kern.parseV1=function(i,s,o,a){var l=e._bin;l.readFixed(i,s),s+=4;var c=l.readUint(i,s);s+=4;for(var u={glyph1:[],rval:[]},h=0;h>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(i,s,u)}return u},e.kern.readFormat0=function(i,s,o){var a=e._bin,l=-1,c=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2;for(var u=0;u=l.map.length?0:l.map[s];if(l.format==4){for(var c=-1,u=0;us?0:65535&(l.idRangeOffset[c]!=0?l.glyphIdArray[s-l.startCount[c]+(l.idRangeOffset[c]>>1)-(l.idRangeOffset.length-c)]:s+l.idDelta[c])}if(l.format==12){if(s>l.groups[l.groups.length-1][1])return 0;for(u=0;u-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(i,s){for(var o=0;ol)){for(var y=!0,g=0,x=0;x<_;x++){for(;i[s+g+(1+x)]==-1;)g++;v.chain[x]!=i[s+g+(1+x)]&&(y=!1)}if(y){for(i[s]=v.nglyph,x=0;x<_+g;x++)i[s+x+1]=-1;break}}}else if(o.ltype==5&&h.fmt==2)for(var w=e._lctf.getInterval(h.cDef,i[s]),E=h.cDef[w+2],b=h.scset[E],M=0;Ml)){for(y=!0,x=0;x>1,c.length=0,h=!0;else if(N=="o3"||N=="o23")c.length%2!=0&&!h&&(p=c.shift()+a.nominalWidthX),u+=c.length>>1,c.length=0,h=!0;else if(N=="o4")c.length>1&&!h&&(p=c.shift()+a.nominalWidthX,h=!0),m&&e.U.P.closePath(l),y+=c.pop(),e.U.P.moveTo(l,_,y),m=!0;else if(N=="o5")for(;c.length>0;)_+=c.shift(),y+=c.shift(),e.U.P.lineTo(l,_,y);else if(N=="o6"||N=="o7")for(var I=c.length,X=N=="o6",q=0;qMath.abs(P-y)?_=A+c.shift():y=P+c.shift(),e.U.P.curveTo(l,g,x,w,E,C,L),e.U.P.curveTo(l,b,M,A,P,_,y));else if(N=="o14"){if(c.length>0&&!h&&(p=c.shift()+o.nominalWidthX,h=!0),c.length==4){var k=c.shift(),G=c.shift(),B=c.shift(),D=c.shift(),V=e.CFF.glyphBySE(o,B),Z=e.CFF.glyphBySE(o,D);e.U._drawCFF(o.CharStrings[V],s,o,a,l),s.x=k,s.y=G,e.U._drawCFF(o.CharStrings[Z],s,o,a,l)}m&&(e.U.P.closePath(l),m=!1)}else if(N=="o19"||N=="o20")c.length%2!=0&&!h&&(p=c.shift()+a.nominalWidthX),u+=c.length>>1,c.length=0,h=!0,v+=u+7>>3;else if(N=="o21")c.length>2&&!h&&(p=c.shift()+a.nominalWidthX,h=!0),y+=c.pop(),_+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,_,y),m=!0;else if(N=="o22")c.length>1&&!h&&(p=c.shift()+a.nominalWidthX,h=!0),_+=c.pop(),m&&e.U.P.closePath(l),e.U.P.moveTo(l,_,y),m=!0;else if(N=="o25"){for(;c.length>6;)_+=c.shift(),y+=c.shift(),e.U.P.lineTo(l,_,y);g=_+c.shift(),x=y+c.shift(),w=g+c.shift(),E=x+c.shift(),_=w+c.shift(),y=E+c.shift(),e.U.P.curveTo(l,g,x,w,E,_,y)}else if(N=="o26")for(c.length%2&&(_+=c.shift());c.length>0;)g=_,x=y+c.shift(),_=w=g+c.shift(),y=(E=x+c.shift())+c.shift(),e.U.P.curveTo(l,g,x,w,E,_,y);else if(N=="o27")for(c.length%2&&(y+=c.shift());c.length>0;)x=y,w=(g=_+c.shift())+c.shift(),E=x+c.shift(),_=w+c.shift(),y=E,e.U.P.curveTo(l,g,x,w,E,_,y);else if(N=="o10"||N=="o29"){var ee=N=="o10"?a:o;if(c.length==0)console.debug("error: empty stack");else{var ie=c.pop(),ue=ee.Subrs[ie+ee.Bias];s.x=_,s.y=y,s.nStems=u,s.haveWidth=h,s.width=p,s.open=m,e.U._drawCFF(ue,s,o,a,l),_=s.x,y=s.y,u=s.nStems,h=s.haveWidth,p=s.width,m=s.open}}else if(N=="o30"||N=="o31"){var ce=c.length,le=(O=0,N=="o31");for(O+=ce-(I=-3&ce);O>>1|(21845&m)<<1;v=(61680&(v=(52428&v)>>>2|(13107&v)<<2))>>>4|(3855&v)<<4,p[m]=((65280&v)>>>8|(255&v)<<8)>>>1}var _=function(N,I,X){for(var q=N.length,W=0,O=new t(I);W>>B]=D}return k},y=new e(288);for(m=0;m<144;++m)y[m]=8;for(m=144;m<256;++m)y[m]=9;for(m=256;m<280;++m)y[m]=7;for(m=280;m<288;++m)y[m]=8;var g=new e(32);for(m=0;m<32;++m)g[m]=5;var x=_(y,9),w=_(g,5),E=function(N){for(var I=N[0],X=1;XI&&(I=N[X]);return I},b=function(N,I,X){var q=I/8|0;return(N[q]|N[q+1]<<8)>>(7&I)&X},M=function(N,I){var X=I/8|0;return(N[X]|N[X+1]<<8|N[X+2]<<16)>>(7&I)},A=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],P=function(N,I,X){var q=new Error(I||A[N]);if(q.code=N,Error.captureStackTrace&&Error.captureStackTrace(q,P),!X)throw q;return q},C=function(N,I,X){var q=N.length;if(!q||X&&!X.l&&q<5)return I||new e(0);var W=!I||X,O=!X||X.i;X||(X={}),I||(I=new e(3*q));var k,G=function(Oe){var We=I.length;if(Oe>We){var nt=new e(Math.max(2*We,Oe));nt.set(I),I=nt}},B=X.f||0,D=X.p||0,V=X.b||0,Z=X.l,ee=X.d,ie=X.m,ue=X.n,ce=8*q;do{if(!Z){X.f=B=b(N,D,1);var le=b(N,D+1,3);if(D+=3,!le){var Ae=N[(Le=((k=D)/8|0)+(7&k&&1)+4)-4]|N[Le-3]<<8,Ee=Le+Ae;if(Ee>q){O&&P(0);break}W&&G(V+Ae),I.set(N.subarray(Le,Ee),V),X.b=V+=Ae,X.p=D=8*Ee;continue}if(le==1)Z=x,ee=w,ie=9,ue=5;else if(le==2){var ae=b(N,D,31)+257,z=b(N,D+10,15)+4,oe=ae+b(N,D+5,31)+1;D+=14;for(var te=new e(oe),se=new e(19),$=0;$>>4)<16)te[$++]=Le;else{var He=0,j=0;for(Le==16?(j=3+b(N,D,3),D+=2,He=te[$-1]):Le==17?(j=3+b(N,D,7),D+=3):Le==18&&(j=11+b(N,D,127),D+=7);j--;)te[$++]=He}}var H=te.subarray(0,ae),ne=te.subarray(ae);ie=E(H),ue=E(ne),Z=_(H,ie),ee=_(ne,ue)}else P(1);if(D>ce){O&&P(0);break}}W&&G(V+131072);for(var we=(1<>>4;if((D+=15&He)>ce){O&&P(0);break}if(He||P(2),Fe<256)I[V++]=Fe;else{if(Fe==256){Me=D,Z=null;break}var Ue=Fe-254;if(Fe>264){var xe=i[$=Fe-257];Ue=b(N,D,(1<>>4;if(Be||P(3),D+=15&Be,ne=h[$e],$e>3&&(xe=s[$e],ne+=M(N,D)&(1<ce){O&&P(0);break}W&&G(V+131072);for(var Ve=V+Ue;VOe.length)&&(nt=Oe.length);var pt=new(Oe instanceof t?t:Oe instanceof n?n:e)(nt-We);return pt.set(Oe.subarray(We,nt)),pt})(I,0,V)},L=new e(0),F=typeof TextDecoder<"u"&&new TextDecoder;try{F.decode(L,{stream:!0})}catch{}return r.convert_streams=function(N){var I=new DataView(N),X=0;function q(){var ae=I.getUint16(X);return X+=2,ae}function W(){var ae=I.getUint32(X);return X+=4,ae}function O(ae){Ae.setUint16(Ee,ae),Ee+=2}function k(ae){Ae.setUint32(Ee,ae),Ee+=4}for(var G={signature:W(),flavor:W(),length:W(),numTables:q(),reserved:q(),totalSfntSize:W(),majorVersion:q(),minorVersion:q(),metaOffset:W(),metaLength:W(),metaOrigLength:W(),privOffset:W(),privLength:W()},B=0;Math.pow(2,B)<=G.numTables;)B++;B--;for(var D=16*Math.pow(2,B),V=16*G.numTables-D,Z=12,ee=[],ie=0;ie{let[L,F]=C.split("+");L=parseInt(L,36),F=F?parseInt(F,36):0,u.set(P+=L,M[A]);for(let N=F;N--;)u.set(++P,M[A])})}}return u.get(b)||c}const p=1,m=2,v=3,_=4,y=[null,"isol","init","fina","medi"];function g(b){const M=new Uint8Array(b.length);let A=c,P=p,C=-1;for(let L=0;L65535&&L++)}return M}function x(b,M){const A=[];for(let C=0;C65535&&C++,A.push(r.U.codeToGlyph(b,L))}const P=b.GSUB;if(P){const{lookupList:C,featureList:L}=P;let F;const N=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,I=[];L.forEach(X=>{if(N.test(X.tag))for(let q=0;q{if(D!==-1){let Z=M[D];if(!Z){const{cmds:ee,crds:ie}=r.U.glyphToPath(b,D);let ue="",ce=0;for(let z=0,oe=ee.length;z1?",":"")+ie[ce++]}let le,Ae,Ee,ae;if(ie.length){le=Ae=1/0,Ee=ae=-1/0;for(let z=0,oe=ie.length;zEe&&(Ee=te),se>ae&&(ae=se)}}else le=Ee=Ae=ae=0;Z=M[D]={index:D,advanceWidth:b.hmtx.aWidth[D],xMin:le,yMin:Ae,xMax:Ee,yMax:ae,path:ue,pathCommandCount:ee.length}}B!==-1&&(W+=r.U.getPairAdjustment(b,B,D)*O),q.call(null,Z,W,G),Z.advanceWidth&&(W+=Z.advanceWidth*O),X&&(W+=X*I),B=D}G+=N.codePointAt(G)>65535?2:1}),W}};return F}return function(M){const A=new Uint8Array(M,0,4),P=r._bin.readASCII(A,0,4);if(P==="wOFF")M=e(M);else if(P==="wOF2")throw new Error("woff2 fonts not supported");return E(r.parse(M)[0])}}const XG=yh({name:"Typr Font Parser",dependencies:[HG,VG,WG],init(r,e,t){const n=r(),i=e();return t(n,i)}}),kl={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},jG=new Ke;function Tl(){return(self.performance||Date).now()}const PE=Object.create(null);function QA(r,e){r=ZG({},r);const t=Tl();if(r.font=KG(r.font||kl.defaultFontURL),r.text=""+r.text,r.sdfGlyphSize=r.sdfGlyphSize||kl.sdfGlyphSize,r.colorRanges!=null){let h={};for(let p in r.colorRanges)if(r.colorRanges.hasOwnProperty(p)){let m=r.colorRanges[p];typeof m!="number"&&(m=jG.set(m).getHex()),h[p]=m}r.colorRanges=h}Object.freeze(r);const{textureWidth:n,sdfExponent:i}=kl,{sdfGlyphSize:s}=r,o=n/s*4;let a=PE[s];if(!a){const h=document.createElement("canvas");h.width=n,h.height=s*256/o,a=PE[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:h,sdfTexture:new Sn(h,void 0,void 0,void 0,fn,fn),contextLost:!1,glyphsByFont:new Map},a.sdfTexture.generateMipmaps=!1,YG(a)}const{sdfTexture:l,sdfCanvas:c}=a;let u=a.glyphsByFont.get(r.font);u||a.glyphsByFont.set(r.font,u=new Map),JG(r).then(h=>{const{glyphIds:p,glyphPositions:m,fontSize:v,unitsPerEm:_,timings:y}=h,g=[],x=new Float32Array(p.length*4),w=v/_;let E=0,b=0;const M=Tl();p.forEach((F,N)=>{let I=u.get(F);if(!I){const{path:O,pathBounds:k}=h.glyphData[F],G=Math.max(k[2]-k[0],k[3]-k[1])/s*(kl.sdfMargin*s+.5),B=a.glyphCount++,D=[k[0]-G,k[1]-G,k[2]+G,k[3]+G];u.set(F,I={path:O,atlasIndex:B,sdfViewBox:D}),g.push(I)}const{sdfViewBox:X}=I,q=m[b++],W=m[b++];x[E++]=q+X[0]*w,x[E++]=W+X[1]*w,x[E++]=q+X[2]*w,x[E++]=W+X[3]*w,p[N]=I.atlasIndex}),y.quads=(y.quads||0)+(Tl()-M);const A=Tl();y.sdf={};const P=c.height,C=Math.ceil(a.glyphCount/o),L=Math.pow(2,Math.ceil(Math.log2(C*s)));L>P&&(console.info(`Increasing SDF texture size ${P}->${L}`),GG(c,n,L),l.dispose()),Promise.all(g.map(F=>e2(F,a,r.gpuAccelerateSDF).then(({timing:N})=>{y.sdf[F.atlasIndex]=N}))).then(()=>{g.length&&!a.contextLost&&(t2(a),l.needsUpdate=!0),y.sdfTotal=Tl()-A,y.total=Tl()-t,e(Object.freeze({parameters:r,sdfTexture:l,sdfGlyphSize:s,sdfExponent:i,glyphBounds:x,glyphAtlasIndices:p,glyphColors:h.glyphColors,caretPositions:h.caretPositions,caretHeight:h.caretHeight,chunkedBounds:h.chunkedBounds,ascender:h.ascender,descender:h.descender,lineHeight:h.lineHeight,capHeight:h.capHeight,xHeight:h.xHeight,topBaseline:h.topBaseline,blockBounds:h.blockBounds,visibleBounds:h.visibleBounds,timings:h.timings}))})}),Promise.resolve().then(()=>{a.contextLost||BG(c)})}function e2({path:r,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:n,sdfCanvas:i,contextLost:s},o){if(s)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:l}=kl,c=Math.max(t[2]-t[0],t[3]-t[1]),u=Math.floor(e/4),h=u%(a/n)*n,p=Math.floor(u/(a/n))*n,m=e%4;return UG(n,n,r,t,c,l,i,h,p,m,o)}function YG(r){const e=r.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),r.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),r.contextLost=!1;const n=[];r.glyphsByFont.forEach(i=>{i.forEach(s=>{n.push(e2(s,r,!0))})}),Promise.all(n).then(()=>{t2(r),r.sdfTexture.needsUpdate=!0})})}function qG({font:r,characters:e,sdfGlyphSize:t},n){let i=Array.isArray(e)?e.join(` -`):""+e;QA({font:r,sdfGlyphSize:t,text:i},n)}function ZG(r,e){for(let t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}let ld;function KG(r){return ld||(ld=typeof document>"u"?{}:document.createElement("a")),ld.href=r,ld.href}function t2(r){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=r,{width:n,height:i}=e,s=r.sdfCanvas.getContext("webgl");let o=t.image.data;(!o||o.length!==n*i*4)&&(o=new Uint8Array(n*i*4),t.image={width:n,height:i,data:o},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,n,i,s.RGBA,s.UNSIGNED_BYTE,o)}}const $G=yh({name:"Typesetter",dependencies:[kl,XG,DG,MG],init(r,e,t,n){const{defaultFontURL:i}=r;return t(e,n(),{defaultFontURL:i})}}),JG=yh({name:"Typesetter",dependencies:[$G],init(r){return function(e){return new Promise(t=>{r.typeset(e,t)})}},getTransferables(r){const e=[r.glyphPositions.buffer,r.glyphIds.buffer];return r.caretPositions&&e.push(r.caretPositions.buffer),r.glyphColors&&e.push(r.glyphColors.buffer),e}}),LE={};function QG(r){let e=LE[r];if(!e){const t=new To(1,1,r,r),n=t.clone(),i=t.attributes,s=n.attributes,o=new Tt,a=i.uv.count;for(let l=0;l{o.setAttribute(l,new st([...i[l].array,...s[l].array],i[l].itemSize))}),o.setIndex([...t.index.array,...n.index.array.map(l=>l+a)]),o.translate(.5,.5,0),e=LE[r]=o}return e}const e5="aTroikaGlyphBounds",IE="aTroikaGlyphIndex",t5="aTroikaGlyphColor";class n5 extends Cy{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new rr,this.boundingBox=new ir}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const t=this.getIndex().count;this.setDrawRange(e===yi?t/2:0,e===vn?t:t/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=QG(e);["position","normal","uv"].forEach(n=>{this.attributes[n]=t.attributes[n].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,n,i,s){y0(this,e5,e,4),y0(this,IE,t,1),y0(this,t5,s,3),this._blockBounds=n,this._chunkedBounds=i,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:n}=this;if(t){const{PI:i,floor:s,min:o,max:a,sin:l,cos:c}=Math,u=i/2,h=i*2,p=Math.abs(t),m=e[0]/p,v=e[2]/p,_=s((m+u)/h)!==s((v+u)/h)?-p:o(l(m)*p,l(v)*p),y=s((m-u)/h)!==s((v-u)/h)?p:a(l(m)*p,l(v)*p),g=s((m+i)/h)!==s((v+i)/h)?p*2:a(p-c(m)*p,p-c(v)*p);n.min.set(_,e[1],t<0?-g:0),n.max.set(y,e[3],t<0?0:g)}else n.min.set(e[0],e[1],0),n.max.set(e[2],e[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(IE).count,n=this._chunkedBounds;if(n)for(let i=n.length;i--;){t=n[i].end;let s=n[i].rect;if(s[1]e.y&&s[0]e.x)break}this.instanceCount=t}}function y0(r,e,t,n){const i=r.getAttribute(e);t?i&&i.array.length===t.length?(i.array.set(t),i.needsUpdate=!0):(r.setAttribute(e,new Sa(t,n)),delete r._maxInstanceCount,r.dispose()):i&&r.deleteAttribute(e)}const i5=` -uniform vec2 uTroikaSDFTextureSize; -uniform float uTroikaSDFGlyphSize; -uniform vec4 uTroikaTotalBounds; -uniform vec4 uTroikaClipRect; -uniform mat3 uTroikaOrient; -uniform bool uTroikaUseGlyphColors; -uniform float uTroikaDistanceOffset; -uniform float uTroikaBlurRadius; -uniform vec2 uTroikaPositionOffset; -uniform float uTroikaCurveRadius; -attribute vec4 aTroikaGlyphBounds; -attribute float aTroikaGlyphIndex; -attribute vec3 aTroikaGlyphColor; -varying vec2 vTroikaGlyphUV; -varying vec4 vTroikaTextureUVBounds; -varying float vTroikaTextureChannel; -varying vec3 vTroikaGlyphColor; -varying vec2 vTroikaGlyphDimensions; -`,r5=` -vec4 bounds = aTroikaGlyphBounds; -bounds.xz += uTroikaPositionOffset.x; -bounds.yw -= uTroikaPositionOffset.y; - -vec4 outlineBounds = vec4( - bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius, - bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius -); -vec4 clippedBounds = vec4( - clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw), - clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw) -); - -vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy); - -position.xy = mix(bounds.xy, bounds.zw, clippedXY); - -uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy); - -float rad = uTroikaCurveRadius; -if (rad != 0.0) { - float angle = position.x / rad; - position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad); - normal.xz = vec2(sin(angle), cos(angle)); -} - -position = uTroikaOrient * position; -normal = uTroikaOrient * normal; - -vTroikaGlyphUV = clippedXY.xy; -vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]); - - -float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize; -vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize; -vec2 txStartUV = txUvPerSquare * vec2( - mod(floor(aTroikaGlyphIndex / 4.0), txCols), - floor(floor(aTroikaGlyphIndex / 4.0) / txCols) -); -vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare); -vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0); -`,s5=` -uniform sampler2D uTroikaSDFTexture; -uniform vec2 uTroikaSDFTextureSize; -uniform float uTroikaSDFGlyphSize; -uniform float uTroikaSDFExponent; -uniform float uTroikaDistanceOffset; -uniform float uTroikaFillOpacity; -uniform float uTroikaOutlineOpacity; -uniform float uTroikaBlurRadius; -uniform vec3 uTroikaStrokeColor; -uniform float uTroikaStrokeWidth; -uniform float uTroikaStrokeOpacity; -uniform bool uTroikaSDFDebug; -varying vec2 vTroikaGlyphUV; -varying vec4 vTroikaTextureUVBounds; -varying float vTroikaTextureChannel; -varying vec2 vTroikaGlyphDimensions; - -float troikaSdfValueToSignedDistance(float alpha) { - // Inverse of exponential encoding in webgl-sdf-generator - - float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y); - float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension; - float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0); - return signedDist; -} - -float troikaGlyphUvToSdfValue(vec2 glyphUV) { - vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV); - vec4 rgba = texture2D(uTroikaSDFTexture, textureUV); - float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1 - return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a; -} - -float troikaGlyphUvToDistance(vec2 uv) { - return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv)); -} - -float troikaGetAADist() { - - #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 - return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5; - #else - return vTroikaGlyphDimensions.x / 64.0; - #endif -} - -float troikaGetFragDistValue() { - vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize); - float distance = troikaGlyphUvToDistance(clampedGlyphUV); - - // Extrapolate distance when outside bounds: - distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : - length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions); - - - - return distance; -} - -float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { - #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL) - float alpha = step(-distanceOffset, -distance); - #else - - float alpha = smoothstep( - distanceOffset + aaDist, - distanceOffset - aaDist, - distance - ); - #endif - - return alpha; -} -`,o5=` -float aaDist = troikaGetAADist(); -float fragDistance = troikaGetFragDistValue(); -float edgeAlpha = uTroikaSDFDebug ? - troikaGlyphUvToSdfValue(vTroikaGlyphUV) : - troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius)); - -#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) -vec4 fillRGBA = gl_FragColor; -fillRGBA.a *= uTroikaFillOpacity; -vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity); -if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; -gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( - -uTroikaStrokeWidth - aaDist, - -uTroikaStrokeWidth + aaDist, - fragDistance -)); -gl_FragColor.a *= edgeAlpha; -#endif - -if (edgeAlpha == 0.0) { - discard; -} -`;function a5(r){const e=zv(r,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new De},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new Xt(0,0,0,0)},uTroikaClipRect:{value:new Xt(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new De},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ke},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Ct},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:i5,vertexTransform:r5,fragmentDefs:s5,fragmentColorTransform:o5,customRewriter({vertexShader:t,fragmentShader:n}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(n)&&(n=n.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(t)||(t=t.replace($A,`uniform vec3 diffuse; -$& -vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; -`))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const p_=new Vs({color:16777215,side:vn,transparent:!0}),DE=8421504,UE=new yt,cd=new Y,_0=new Y,ru=[],l5=new Y,x0="+x+y";function OE(r){return Array.isArray(r)?r[0]:r}let n2=()=>{const r=new _n(new To(1,1),p_);return n2=()=>r,r},i2=()=>{const r=new _n(new To(1,1,32,1),p_);return i2=()=>r,r};const c5={type:"syncstart"},u5={type:"synccomplete"},r2=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],h5=r2.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let s2=class extends _n{constructor(){const e=new n5;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=DE,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=x0,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(c5),QA({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(i=>i&&i())})),this.dispatchEvent(u5),e&&e()})))}onBeforeRender(e,t,n,i,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s),s._hadOwnSide=s.hasOwnProperty("side"),this.geometry.setSide(s._actualSide=s.side),s.side=ls}onAfterRender(e,t,n,i,s,o){s._hadOwnSide?s.side=s._actualSide:delete s.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=p_.clone());if((!e||e.baseMaterial!==t)&&(e=this._derivedMaterial=a5(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return OE(this.material).getDepthMaterial()}get customDistanceMaterial(){return OE(this.material).getDistanceMaterial()}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:a,blockBounds:l}=i;n.uTroikaSDFTexture.value=a,n.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),n.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,n.uTroikaSDFExponent.value=i.sdfExponent,n.uTroikaTotalBounds.value.fromArray(l),n.uTroikaUseGlyphColors.value=!t&&!!i.glyphColors;let c=0,u=0,h=0,p,m,v,_=0,y=0;if(t){let{outlineWidth:x,outlineOffsetX:w,outlineOffsetY:E,outlineBlur:b,outlineOpacity:M}=this;c=this._parsePercent(x)||0,u=Math.max(0,this._parsePercent(b)||0),p=M,_=this._parsePercent(w)||0,y=this._parsePercent(E)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(v=this.strokeColor,n.uTroikaStrokeColor.value.set(v??DE),m=this.strokeOpacity,m==null&&(m=1)),p=this.fillOpacity;n.uTroikaDistanceOffset.value=c,n.uTroikaPositionOffset.value.set(_,y),n.uTroikaBlurRadius.value=u,n.uTroikaStrokeWidth.value=h,n.uTroikaStrokeOpacity.value=m,n.uTroikaFillOpacity.value=p??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let g=this.clipRect;if(g&&Array.isArray(g)&&g.length===4)n.uTroikaClipRect.value.fromArray(g);else{const x=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(l[0]-x,l[1]-x,l[2]+x,l[3]+x)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Ke;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||x0;if(o!==e._orientation){let a=n.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let l=o!==x0&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,u,h,p]=l;cd.set(0,0,0)[u]=c==="-"?1:-1,_0.set(0,0,0)[p]=h==="-"?-1:1,UE.lookAt(l5,cd.cross(_0),_0),a.setFromMatrix4(UE)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new De){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new De){return cd.copy(e),this.localPositionToTextCoords(this.worldToLocal(cd),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:i}=this;if(n){const s=n.blockBounds,o=i?i2():n2(),a=o.geometry,{position:l,uv:c}=a.attributes;for(let u=0;u{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};r2.forEach(r=>{const e="_private_"+r;Object.defineProperty(s2.prototype,r,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});const f5=K.forwardRef(({sdfGlyphSize:r=64,anchorX:e="center",anchorY:t="middle",font:n,fontSize:i=1,children:s,characters:o,onSync:a,...l},c)=>{const u=Bn(({invalidate:v})=>v),[h]=K.useState(()=>new s2),[p,m]=K.useMemo(()=>{const v=[];let _="";return K.Children.forEach(s,y=>{typeof y=="string"||typeof y=="number"?_+=y:v.push(y)}),[v,_]},[s]);return eO(()=>new Promise(v=>qG({font:n,characters:o},v)),["troika-text",n,o]),K.useLayoutEffect(()=>void h.sync(()=>{u(),a&&a(h)})),K.useEffect(()=>()=>h.dispose(),[h]),K.createElement("primitive",Ta({object:h,ref:c,font:n,text:m,anchorX:e,anchorY:t,fontSize:i,sdfGlyphSize:r},l),p)});/*! - * camera-controls - * https://github.com/yomotsu/camera-controls - * (c) 2017 @yomotsu - * Released under the MIT License. - */const gn={LEFT:1,RIGHT:2,MIDDLE:4},_e=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,SCREEN_PAN:4,OFFSET:8,DOLLY:16,ZOOM:32,TOUCH_ROTATE:64,TOUCH_TRUCK:128,TOUCH_SCREEN_PAN:256,TOUCH_OFFSET:512,TOUCH_DOLLY:1024,TOUCH_ZOOM:2048,TOUCH_DOLLY_TRUCK:4096,TOUCH_DOLLY_SCREEN_PAN:8192,TOUCH_DOLLY_OFFSET:16384,TOUCH_DOLLY_ROTATE:32768,TOUCH_ZOOM_TRUCK:65536,TOUCH_ZOOM_OFFSET:131072,TOUCH_ZOOM_SCREEN_PAN:262144,TOUCH_ZOOM_ROTATE:524288}),Al={NONE:0,IN:1,OUT:-1};function ia(r){return r.isPerspectiveCamera}function ho(r){return r.isOrthographicCamera}const Cl=Math.PI*2,NE=Math.PI/2,o2=1e-5,su=Math.PI/180;function Ur(r,e,t){return Math.max(e,Math.min(t,r))}function an(r,e=o2){return Math.abs(r)0==m>u&&(m=u,t.value=(m-u)/s),m}function kE(r,e,t,n,i=1/0,s,o){n=Math.max(1e-4,n);const a=2/n,l=a*s,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,h=e.y,p=e.z,m=r.x-u,v=r.y-h,_=r.z-p;const y=u,g=h,x=p,w=i*n,E=w*w,b=m*m+v*v+_*_;if(b>E){const q=Math.sqrt(b);m=m/q*w,v=v/q*w,_=_/q*w}u=r.x-m,h=r.y-v,p=r.z-_;const M=(t.x+a*m)*s,A=(t.y+a*v)*s,P=(t.z+a*_)*s;t.x=(t.x-a*M)*c,t.y=(t.y-a*A)*c,t.z=(t.z-a*P)*c,o.x=u+(m+M)*c,o.y=h+(v+A)*c,o.z=p+(_+P)*c;const C=y-r.x,L=g-r.y,F=x-r.z,N=o.x-y,I=o.y-g,X=o.z-x;return C*N+L*I+F*X>0&&(o.x=y,o.y=g,o.z=x,t.x=(o.x-y)/s,t.y=(o.y-g)/s,t.z=(o.z-x)/s),o}function w0(r,e){e.set(0,0),r.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=r.length,e.y/=r.length}function S0(r,e){return ho(r)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let d5=class{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s{},this._enabled=!0,this._state=_e.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Al.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new vt.Vector3,this._focalOffsetVelocity=new vt.Vector3,this._zoomVelocity={value:0},this._truckInternal=(g,x,w,E)=>{let b,M;if(ia(this._camera)){const A=At.copy(this._camera.position).sub(this._target),P=this._camera.getEffectiveFOV()*su,C=A.length()*Math.tan(P*.5);b=this.truckSpeed*g*C/this._elementRect.height,M=this.truckSpeed*x*C/this._elementRect.height}else if(ho(this._camera)){const A=this._camera;b=this.truckSpeed*g*(A.right-A.left)/A.zoom/this._elementRect.width,M=this.truckSpeed*x*(A.top-A.bottom)/A.zoom/this._elementRect.height}else return;E?(w?this.setFocalOffset(this._focalOffsetEnd.x+b,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(b,0,!0),this.forward(-M,!0)):w?this.setFocalOffset(this._focalOffsetEnd.x+b,this._focalOffsetEnd.y+M,this._focalOffsetEnd.z,!0):this.truck(b,M,!0)},this._rotateInternal=(g,x)=>{const w=Cl*this.azimuthRotateSpeed*g/this._elementRect.height,E=Cl*this.polarRotateSpeed*x/this._elementRect.height;this.rotate(w,E,!0)},this._dollyInternal=(g,x,w)=>{const E=Math.pow(.95,-g*this.dollySpeed),b=this._sphericalEnd.radius,M=this._sphericalEnd.radius*E,A=Ur(M,this.minDistance,this.maxDistance),P=A-M;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(M,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(P,!0),this._dollyToNoClamp(A,!0)):this._dollyToNoClamp(A,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?M:A)-b,this._dollyControlCoord.set(x,w)),this._lastDollyDirection=Math.sign(-g)},this._zoomInternal=(g,x,w)=>{const E=Math.pow(.95,g*this.dollySpeed),b=this._zoom,M=this._zoom*E;this.zoomTo(M,!0),this.dollyToCursor&&(this._changedZoom+=M-b,this._dollyControlCoord.set(x,w))},typeof vt>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new vt.Quaternion().setFromUnitVectors(this._camera.up,fd),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=_e.NONE,this._target=new vt.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new vt.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new vt.Spherical().setFromVector3(At.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new vt.Vector3,new vt.Vector3,new vt.Vector3,new vt.Vector3],this._updateNearPlaneCorners(),this._boundary=new vt.Box3(new vt.Vector3(-1/0,-1/0,-1/0),new vt.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new vt.Vector2,this.mouseButtons={left:_e.ROTATE,middle:_e.DOLLY,right:_e.TRUCK,wheel:ia(this._camera)?_e.DOLLY:ho(this._camera)?_e.ZOOM:_e.NONE},this.touches={one:_e.TOUCH_ROTATE,two:ia(this._camera)?_e.TOUCH_DOLLY_TRUCK:ho(this._camera)?_e.TOUCH_ZOOM_TRUCK:_e.NONE,three:_e.TOUCH_TRUCK};const n=new vt.Vector2,i=new vt.Vector2,s=new vt.Vector2,o=g=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const E=this._domElement.getBoundingClientRect(),b=g.clientX/E.width,M=g.clientY/E.height;if(bthis._interactiveArea.right||Mthis._interactiveArea.bottom)return}const x=g.pointerType!=="mouse"?null:(g.buttons&gn.LEFT)===gn.LEFT?gn.LEFT:(g.buttons&gn.MIDDLE)===gn.MIDDLE?gn.MIDDLE:(g.buttons&gn.RIGHT)===gn.RIGHT?gn.RIGHT:null;if(x!==null){const E=this._findPointerByMouseButton(x);E&&this._disposePointer(E)}if((g.buttons&gn.LEFT)===gn.LEFT&&this._lockedPointer)return;const w={pointerId:g.pointerId,clientX:g.clientX,clientY:g.clientY,deltaX:0,deltaY:0,mouseButton:x};this._activePointers.push(w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),this._isDragging=!0,p(g)},a=g=>{g.cancelable&&g.preventDefault();const x=g.pointerId,w=this._lockedPointer||this._findPointerById(x);if(w){if(w.clientX=g.clientX,w.clientY=g.clientY,w.deltaX=g.movementX,w.deltaY=g.movementY,this._state=0,g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(g.buttons&gn.LEFT)===gn.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(g.buttons&gn.MIDDLE)===gn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(g.buttons&gn.RIGHT)===gn.RIGHT&&(this._state=this._state|this.mouseButtons.right);m()}},l=g=>{const x=this._findPointerById(g.pointerId);if(!(x&&x===this._lockedPointer)){if(x&&this._disposePointer(x),g.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=_e.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=_e.NONE;v()}};let c=-1;const u=g=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===_e.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const M=this._domElement.getBoundingClientRect(),A=g.clientX/M.width,P=g.clientY/M.height;if(Athis._interactiveArea.right||Pthis._interactiveArea.bottom)return}if(g.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===_e.ROTATE||this.mouseButtons.wheel===_e.TRUCK){const M=performance.now();c-M<1e3&&this._getClientRect(this._elementRect),c=M}const x=m5?-1:-3,w=g.deltaMode===1||g.ctrlKey?g.deltaY/x:g.deltaY/(x*10),E=this.dollyToCursor?(g.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(g.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case _e.ROTATE:{this._rotateInternal(g.deltaX,g.deltaY),this._isUserControllingRotate=!0;break}case _e.TRUCK:{this._truckInternal(g.deltaX,g.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case _e.SCREEN_PAN:{this._truckInternal(g.deltaX,g.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case _e.OFFSET:{this._truckInternal(g.deltaX,g.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case _e.DOLLY:{this._dollyInternal(-w,E,b),this._isUserControllingDolly=!0;break}case _e.ZOOM:{this._zoomInternal(-w,E,b),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},h=g=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Gv.ACTION.NONE){const x=g instanceof PointerEvent?g.pointerId:0,w=this._findPointerById(x);w&&this._disposePointer(w),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l);return}g.preventDefault()}},p=g=>{if(!this._enabled)return;if(w0(this._activePointers,Fi),this._getClientRect(this._elementRect),n.copy(Fi),i.copy(Fi),this._activePointers.length>=2){const w=Fi.x-this._activePointers[1].clientX,E=Fi.y-this._activePointers[1].clientY,b=Math.sqrt(w*w+E*E);s.set(0,b);const M=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,A=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(M,A)}if(this._state=0,!g)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in g&&g.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(g.buttons&gn.LEFT)===gn.LEFT&&(this._state=this._state|this.mouseButtons.left),(g.buttons&gn.MIDDLE)===gn.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(g.buttons&gn.RIGHT)===gn.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&_e.ZOOM)===_e.ZOOM||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},m=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,w0(this._activePointers,Fi);const x=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,w=x?-x.deltaX:i.x-Fi.x,E=x?-x.deltaY:i.y-Fi.y;if(i.copy(Fi),((this._state&_e.ROTATE)===_e.ROTATE||(this._state&_e.TOUCH_ROTATE)===_e.TOUCH_ROTATE||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(w,E),this._isUserControllingRotate=!0),(this._state&_e.DOLLY)===_e.DOLLY||(this._state&_e.ZOOM)===_e.ZOOM){const b=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,M=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,A=this.dollyDragInverted?-1:1;(this._state&_e.DOLLY)===_e.DOLLY?(this._dollyInternal(A*E*hd,b,M),this._isUserControllingDolly=!0):(this._zoomInternal(A*E*hd,b,M),this._isUserControllingZoom=!0)}if((this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_ZOOM)===_e.TOUCH_ZOOM||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_ZOOM_ROTATE)===_e.TOUCH_ZOOM_ROTATE){const b=Fi.x-this._activePointers[1].clientX,M=Fi.y-this._activePointers[1].clientY,A=Math.sqrt(b*b+M*M),P=s.y-A;s.set(0,A);const C=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,L=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&_e.TOUCH_DOLLY)===_e.TOUCH_DOLLY||(this._state&_e.TOUCH_DOLLY_ROTATE)===_e.TOUCH_DOLLY_ROTATE||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET?(this._dollyInternal(P*hd,C,L),this._isUserControllingDolly=!0):(this._zoomInternal(P*hd,C,L),this._isUserControllingZoom=!0)}((this._state&_e.TRUCK)===_e.TRUCK||(this._state&_e.TOUCH_TRUCK)===_e.TOUCH_TRUCK||(this._state&_e.TOUCH_DOLLY_TRUCK)===_e.TOUCH_DOLLY_TRUCK||(this._state&_e.TOUCH_ZOOM_TRUCK)===_e.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(w,E,!1,!1),this._isUserControllingTruck=!0),((this._state&_e.SCREEN_PAN)===_e.SCREEN_PAN||(this._state&_e.TOUCH_SCREEN_PAN)===_e.TOUCH_SCREEN_PAN||(this._state&_e.TOUCH_DOLLY_SCREEN_PAN)===_e.TOUCH_DOLLY_SCREEN_PAN||(this._state&_e.TOUCH_ZOOM_SCREEN_PAN)===_e.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(w,E,!1,!0),this._isUserControllingTruck=!0),((this._state&_e.OFFSET)===_e.OFFSET||(this._state&_e.TOUCH_OFFSET)===_e.TOUCH_OFFSET||(this._state&_e.TOUCH_DOLLY_OFFSET)===_e.TOUCH_DOLLY_OFFSET||(this._state&_e.TOUCH_ZOOM_OFFSET)===_e.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(w,E,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},v=()=>{w0(this._activePointers,Fi),i.copy(Fi),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",_),this._domElement.ownerDocument.addEventListener("pointerlockerror",y),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",l),p())},this.unlockPointer=()=>{var g,x,w;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(g=this._domElement)===null||g===void 0||g.ownerDocument.exitPointerLock(),(x=this._domElement)===null||x===void 0||x.ownerDocument.removeEventListener("pointerlockchange",_),(w=this._domElement)===null||w===void 0||w.ownerDocument.removeEventListener("pointerlockerror",y),this.cancel()};const _=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},y=()=>{this.unlockPointer()};this._addAllEventListeners=g=>{this._domElement=g,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),this._domElement.addEventListener("pointercancel",l),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",h)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("pointercancel",l),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",h),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",l),this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",y))},this.cancel=()=>{this._state!==_e.NONE&&(this._state=_e.NONE,this._activePointers.length=0,v())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=Ur(e.width,0,1),this._interactiveArea.height=Ur(e.height,0,1),this._interactiveArea.x=Ur(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=Ur(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,n=!1){this._isUserControllingRotate=!1;const i=Ur(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=Ur(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!n||Zt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Zt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Al.NONE,this._changedDolly=0,this._dollyToNoClamp(Ur(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=Zt(o,this._spherical.radius);if(!(n>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||Zt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(lu).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||Zt(this._target.x,this._targetEnd.x,this.restThreshold)&&Zt(this._target.y,this._targetEnd.y,this.restThreshold)&&Zt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=Ur(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||Zt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),es.setFromMatrixColumn(this._camera.matrix,0),ts.setFromMatrixColumn(this._camera.matrix,1),es.multiplyScalar(e),ts.multiplyScalar(-t);const i=At.copy(es).add(ts),s=Wt.copy(this._targetEnd).add(i);return this.moveTo(s.x,s.y,s.z,n)}forward(e,t=!1){At.setFromMatrixColumn(this._camera.matrix,0),At.crossVectors(this._camera.up,At),At.multiplyScalar(e);const n=Wt.copy(this._targetEnd).add(At);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return At.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+At.x,this._targetEnd.y+At.y,this._targetEnd.z+At.z,t)}moveTo(e,t,n,i=!1){this._isUserControllingTruck=!1;const s=At.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const o=!i||Zt(this._target.x,this._targetEnd.x,this.restThreshold)&&Zt(this._target.y,this._targetEnd.y,this.restThreshold)&&Zt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,n,i=!1){const a=At.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(a.x,a.y,a.z,i)}fitToBox(e,t,{cover:n=!1,paddingLeft:i=0,paddingRight:s=0,paddingBottom:o=0,paddingTop:a=0}={}){const l=[],c=e.isBox3?Pl.copy(e):Pl.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=FE(this._sphericalEnd.theta,NE),h=FE(this._sphericalEnd.phi,NE);l.push(this.rotateTo(u,h,t));const p=At.setFromSpherical(this._sphericalEnd).normalize(),m=VE.setFromUnitVectors(p,b0),v=Zt(Math.abs(p.y),1);v&&m.multiply(T0.setFromAxisAngle(fd,u)),m.multiply(this._yAxisUpSpaceInverse);const _=HE.makeEmpty();Wt.copy(c.min).applyQuaternion(m),_.expandByPoint(Wt),Wt.copy(c.min).setX(c.max.x).applyQuaternion(m),_.expandByPoint(Wt),Wt.copy(c.min).setY(c.max.y).applyQuaternion(m),_.expandByPoint(Wt),Wt.copy(c.max).setZ(c.min.z).applyQuaternion(m),_.expandByPoint(Wt),Wt.copy(c.min).setZ(c.max.z).applyQuaternion(m),_.expandByPoint(Wt),Wt.copy(c.max).setY(c.min.y).applyQuaternion(m),_.expandByPoint(Wt),Wt.copy(c.max).setX(c.min.x).applyQuaternion(m),_.expandByPoint(Wt),Wt.copy(c.max).applyQuaternion(m),_.expandByPoint(Wt),_.min.x-=i,_.min.y-=o,_.max.x+=s,_.max.y+=a,m.setFromUnitVectors(b0,p),v&&m.premultiply(T0.invert()),m.premultiply(this._yAxisUpSpace);const y=_.getSize(At),g=_.getCenter(Wt).applyQuaternion(m);if(ia(this._camera)){const x=this.getDistanceToFitBox(y.x,y.y,y.z,n);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.dollyTo(x,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(ho(this._camera)){const x=this._camera,w=x.right-x.left,E=x.top-x.bottom,b=n?Math.max(w/y.x,E/y.y):Math.min(w/y.x,E/y.y);l.push(this.moveTo(g.x,g.y,g.z,t)),l.push(this.zoomTo(b,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const n=[],s="isObject3D"in e?Gv.createBoundingSphere(e,M0):M0.copy(e);if(n.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),ia(this._camera)){const o=this.getDistanceToFitSphere(s.radius);n.push(this.dollyTo(o,t))}else if(ho(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,l=2*s.radius,c=Math.min(o/l,a/l);n.push(this.zoomTo(c,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,i,s,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Al.NONE,this._changedDolly=0;const l=Wt.set(i,s,o),c=At.set(e,t,n);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!a||Zt(this._target.x,this._targetEnd.x,this.restThreshold)&&Zt(this._target.y,this._targetEnd.y,this.restThreshold)&&Zt(this._target.z,this._targetEnd.z,this.restThreshold)&&Zt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Zt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Zt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,n,i,s,o,a,l,c,u,h,p,m,v=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Al.NONE,this._changedDolly=0;const _=At.set(i,s,o),y=Wt.set(e,t,n);gr.setFromVector3(y.sub(_).applyQuaternion(this._yAxisUpSpace));const g=Rl.set(u,h,p),x=Wt.set(a,l,c);cu.setFromVector3(x.sub(g).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(_.lerp(g,m));const w=cu.theta-gr.theta,E=cu.phi-gr.phi,b=cu.radius-gr.radius;this._sphericalEnd.set(gr.radius+b*m,gr.phi+E*m,gr.theta+w*m),this.normalizeRotations(),this._needsUpdate=!0,v||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const M=!v||Zt(this._target.x,this._targetEnd.x,this.restThreshold)&&Zt(this._target.y,this._targetEnd.y,this.restThreshold)&&Zt(this._target.z,this._targetEnd.z,this.restThreshold)&&Zt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&Zt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&Zt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(M)}setPosition(e,t,n,i=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,n,i=!1){const s=this.getPosition(At),o=this.setLookAt(s.x,s.y,s.z,e,t,n,i);return this._sphericalEnd.phi=Ur(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,n,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const s=!i||Zt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&Zt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&Zt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),es.setFromMatrixColumn(this._camera.matrixWorldInverse,0),ts.setFromMatrixColumn(this._camera.matrixWorldInverse,1),ra.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=At.set(e,t,n),s=i.distanceTo(this._camera.position),o=i.sub(this._camera.position);es.multiplyScalar(o.x),ts.multiplyScalar(o.y),ra.multiplyScalar(o.z),At.copy(es).add(ts).add(ra),At.z=At.z+s,this.dollyTo(s,!1),this.setFocalOffset(-At.x,At.y,-At.z,!1),this.moveTo(e,t,n,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,n,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new vt.Vector4,typeof e=="number"?this._viewport.set(e,t,n,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,i=!1){if(S0(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,o=this._camera.getEffectiveFOV()*su,a=this._camera.aspect;return((i?s>a:st.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,n){const i=t.lengthSq();if(i===0)return e;const s=Wt.copy(t).add(e),a=this._boundary.clampPoint(s,Rl).sub(s),l=a.lengthSq();if(l===0)return e.add(t);if(l===i)return e;if(n===0)return e.add(t).add(a);{const c=1+n*l/t.dot(a);return e.add(Wt.copy(t).multiplyScalar(c)).add(a.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(ia(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*su,i=Math.tan(n*.5)*t,s=i*e.aspect;this._nearPlaneCorners[0].set(-s,-i,0),this._nearPlaneCorners[1].set(s,-i,0),this._nearPlaneCorners[2].set(s,i,0),this._nearPlaneCorners[3].set(-s,i,0)}else if(ho(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,i=e.right*t,s=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(n,s,0),this._nearPlaneCorners[1].set(i,s,0),this._nearPlaneCorners[2].set(i,o,0),this._nearPlaneCorners[3].set(n,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||S0(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(lu);A0.lookAt(zE,n,this._camera.up);for(let i=0;i<4;i++){const s=Wt.copy(this._nearPlaneCorners[i]);s.applyMatrix4(A0);const o=Rl.addVectors(this._target,s);dd.set(o,n),dd.far=this._spherical.radius+1;const a=dd.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance{const n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new vt.Sphere){const n=t,i=n.center;Pl.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&Pl.expandByObject(o)}),Pl.getCenter(i);let s=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o;if(!a.geometry)return;const l=a.geometry.clone();l.applyMatrix4(a.matrixWorld);const u=l.attributes.position;for(let h=0,p=u.count;h"u")&&(s[o]=r[o]);return s.max=i||s.max,s.truncate=="middle"?e(n,s.max,s.ellipse,s.chars):t(n,s.max,s.ellipse,s.chars,s.truncate)},uu.exports.ellipsizeMiddle=e,uu.exports.ellipsize=t,uu.exports}var v5=g5();const y5=Hr(v5);/*! - * hold-event - * https://github.com/yomotsu/hold-event - * (c) 2020 @yomotsu - * Released under the MIT License. - */var Au;(function(r){r.HOLD_START="holdStart",r.HOLD_END="holdEnd",r.HOLDING="holding"})(Au||(Au={}));class _5{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s{if(!this._enabled||this._holding)return;this._deltaTime=0,this._elapsedTime=0,this._lastTime=performance.now(),this.dispatchEvent({type:Au.HOLD_START,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),this._holding=!0;const n=()=>{this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n);const i=performance.now();this._deltaTime=i-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:Au.HOLDING,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t})};this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n)},this._holdEnd=t=>{if(!this._enabled||!this._holding)return;const n=performance.now();this._deltaTime=n-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:Au.HOLD_END,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),window.clearTimeout(this._intervalId),window.cancelAnimationFrame(this._intervalId),this._holding=!1},this.holdIntervalDelay=e}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._enabled||this._holdEnd())}}class kp extends x5{constructor(e,t){super(t),this._holdStart=this._holdStart.bind(this),this._holdEnd=this._holdEnd.bind(this);const n=s=>{w5(s)||s.keyCode===e&&this._holdStart(s)},i=s=>{s.keyCode===e&&this._holdEnd(s)};document.addEventListener("keydown",n),document.addEventListener("keyup",i),window.addEventListener("blur",this._holdEnd)}}function w5(r){const e=r.target;return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.isContentEditable}var C0={exports:{}};/*! - Copyright (c) 2018 Jed Watson. - Licensed under the MIT License (MIT), see - http://jedwatson.github.io/classnames -*/var XE;function S5(){return XE||(XE=1,(function(r){(function(){var e={}.hasOwnProperty;function t(){for(var s="",o=0;o-1){const s=[...e.slice(i),n].map(o=>o.data.id);throw new Error(`Invalid Graph: Circular node path detected: ${s.join(" -> ")}.`)}t>n.depth&&(n.depth=t,a2(n.out,[...e,n]))}}function l2(r,e){let t=!1;const n=r.reduce((o,a)=>({...o,[a.id]:{data:a,out:[],depth:-1,ins:[]}}),{});try{for(const o of e){const a=o.source,l=o.target;if(!n.hasOwnProperty(a))throw new Error(`Missing source Node ${a}`);if(!n.hasOwnProperty(l))throw new Error(`Missing target Node ${l}`);const c=n[a],u=n[l];u.ins.push(c),c.out.push(u)}a2(Object.values(n))}catch{t=!0}const i=Object.keys(n).map(o=>n[o].depth),s=Math.max(...i);return{invalid:t,depths:n,maxDepth:s||1}}const qE=["radialin","radialout"];function E5({nodes:r,edges:e,mode:t="lr",nodeLevelRatio:n=2}){const{depths:i,maxDepth:s,invalid:o}=l2(r,e);if(o)return null;const a=qE.includes(t)?1:5,l=r.length/s*n*a;if(t){const c=(m,v)=>_=>m?(i[_.id].depth-s/2)*l*(v?-1:1):void 0,u=c(["lr","rl"].includes(t),t==="rl"),h=c(["td","bu"].includes(t),t==="td"),p=c(["zin","zout"].includes(t),t==="zout");r.forEach(m=>{m.fx=u(m),m.fy=h(m),m.fz=p(m)})}return qE.includes(t)?KN(c=>{const u=i[c.id];return(t==="radialin"?s-u.depth:u.depth)*l}).strength(1):null}function b5(r){return new Promise((e,t)=>{let n;function i(){n?e(n):(n=r.step(),i())}i()})}function _h(r){const e=[],t=[];return r.forEachNode((n,i)=>{e.push({...i,id:n,radius:i.size||1})}),r.forEachEdge((n,i)=>{t.push({...i,id:n})}),{nodes:e,edges:t}}function M5(){const r=O=>()=>O;let t=O=>O.index,n=[],i=[],s,o,a=[100,100],l=r(1),c=r(-1),u=r(100),h=r(.1),p={},m=.1,v=.001,_=[],y=[0,0],g,x=O=>O.cluster,w="treemap",E=!0,b=.1;function M(O){if(!E)return M;w==="force"&&(g.tick(),I());for(let k=0,G=n.length,B,D=O*b;kk.radius).sort(function(k,G){return G.height-k.height||G.value-k.value}),_=O(o).leaves(),I()}function q(){let O=0;n.length!==0&&i.forEach(function(k){let G,B;if(n){if(G=k.source,B=k.target,typeof k.source!="object"&&(G=n.find(D=>D.id===k.source)),typeof k.target!="object"&&(B=n.find(D=>D.id===k.target)),G===void 0||B===void 0)throw Error("Error setting links, couldnt find nodes for a link (see it on the console)");k.source=G,k.target=B,k.index=O++}})}function W(){let O;!n||!n.length||(q(),O=F(),s.size>0&&O.nodes.forEach(k=>{var G,B,D,V;k.fx=(B=(G=s.get(k.id))==null?void 0:G.position)==null?void 0:B.x,k.fy=(V=(D=s.get(k.id))==null?void 0:D.position)==null?void 0:V.y}),g=zT(O.nodes).force("x",xv(a[0]/2).strength(.1)).force("y",wv(a[1]/2).strength(.1)).force("collide",IT(k=>k.r).iterations(4)).force("charge",BT().strength(c)).force("links",DT(O.nodes.length?O.links:[]).distance(u).strength(h)),_=g.nodes(),I())}return M.template=function(O){return arguments.length?(w=O,A(),M):w},M.groupBy=function(O){return arguments.length?typeof O=="string"?(x=function(k){return k[O]},M):(x=O,M):x},M.enableGrouping=function(O){return arguments.length?(E=O,M):E},M.strength=function(O){return arguments.length?(b=O,M):b},M.getLinkStrength=function(O){return E?x(O.source)===x(O.target)?typeof m=="function"?m(O):m:typeof v=="function"?v(O):v:typeof m=="function"?m(O):m},M.id=function(O){return arguments.length?(t=O,M):t},M.size=function(O){return arguments.length?(a=O,M):a},M.linkStrengthInterCluster=function(O){return arguments.length?(v=O,M):v},M.linkStrengthIntraCluster=function(O){return arguments.length?(m=O,M):m},M.nodes=function(O){return arguments.length?(n=O,M):n},M.links=function(O){return arguments.length?(O===null?i=[]:i=O,A(),M):i},M.template=function(O){return arguments.length?(w=O,A(),M):w},M.forceNodeSize=function(O){return arguments.length?(l=typeof O=="function"?O:r(+O),A(),M):l},M.nodeSize=M.forceNodeSize,M.forceCharge=function(O){return arguments.length?(c=typeof O=="function"?O:r(+O),A(),M):c},M.forceLinkDistance=function(O){return arguments.length?(u=typeof O=="function"?O:r(+O),A(),M):u},M.forceLinkStrength=function(O){return arguments.length?(h=typeof O=="function"?O:r(+O),A(),M):h},M.offset=function(O){return arguments.length?(y=typeof O=="function"?O:r(+O),M):y},M.getFocis=I,M.setClusters=function(O){return s=O,M},M}function uo({graph:r,nodeLevelRatio:e=2,mode:t=null,dimensions:n=2,nodeStrength:i=-250,linkDistance:s=50,clusterStrength:o=.5,linkStrengthInterCluster:a=.01,linkStrengthIntraCluster:l=.5,forceLinkDistance:c=100,forceLinkStrength:u=.1,clusterType:h="force",forceCharge:p=-700,getNodePosition:m,drags:v,clusters:_,clusterAttribute:y,forceLayout:g}){const{nodes:x,edges:w}=_h(r),b=n===2&&w.length>25?i*2:i;let M,A;g==="forceDirected2d"?(M=xv(),A=wv()):(M=xv(600).strength(.05),A=wv(600).strength(.05));const P=zT().force("center",FO(0,0)).force("link",DT()).force("charge",BT().strength(b)).force("x",M).force("y",A).force("z",$N()).force("collide",IT(N=>N.radius+10)).force("dagRadial",E5({nodes:x,edges:w,mode:t,nodeLevelRatio:e})).stop();let C;if(y){let N=p;if(x!=null&&x.length){const I=Math.ceil(x.length/200);N=p*I}C=M5().setClusters(_).strength(o).template(h).groupBy(I=>I.data[y]).links(w).size([100,100]).linkStrengthInterCluster(a).linkStrengthIntraCluster(l).forceLinkDistance(c).forceLinkStrength(u).forceCharge(N).forceNodeSize(I=>I.radius)}let L=P.numDimensions(n).nodes(x);if(C&&(L=L.force("group",C)),s){let N=L.force("link");N&&(N.id(I=>I.id).links(w).distance(s),C&&(N=N.strength((C==null?void 0:C.getLinkStrength)??.1)))}const F=new Map(x.map(N=>[N.id,N]));return{step(){for(;P.alpha()>.01;)P.tick();return!0},getNodePosition(N){var I,X;if(m){const q=m(N,{graph:r,drags:v,nodes:x,edges:w});if(q)return q}return(I=v==null?void 0:v[N])!=null&&I.position?(X=v==null?void 0:v[N])==null?void 0:X.position:F.get(N)}}}function T5({graph:r,radius:e,drags:t,getNodePosition:n}){const i=FF(r,{scale:e}),{nodes:s,edges:o}=_h(r);return{step(){return!0},getNodePosition(a){var l,c;if(n){const u=n(a,{graph:r,drags:t,nodes:s,edges:o});if(u)return u}return(l=t==null?void 0:t[a])!=null&&l.position?(c=t==null?void 0:t[a])==null?void 0:c.position:i==null?void 0:i[a]}}}const A5={td:{x:"x",y:"y",factor:-1},lr:{x:"y",y:"x",factor:1}};function ZE({graph:r,drags:e,mode:t="td",nodeSeparation:n=1,nodeSize:i=[50,50],getNodePosition:s}){const{nodes:o,edges:a}=_h(r),{depths:l}=l2(o,a),c=Object.keys(l).map(_=>l[_]),u=SF().id(_=>_.data.id).parentId(_=>{var y,g,x;return(x=(g=(y=_.ins)==null?void 0:y[0])==null?void 0:g.data)==null?void 0:x.id})(c),p=RF().separation(()=>n).nodeSize(i)(Mp(u)).descendants(),m=A5[t],v=new Map(o.map(_=>{const{x:y,y:g}=p.find(x=>x.data.id===_.id);return[_.id,{..._,[m.x]:y*m.factor,[m.y]:g*m.factor,z:0}]}));return{step(){return!0},getNodePosition(_){var y,g;if(s){const x=s(_,{graph:r,drags:e,nodes:o,edges:a});if(x)return x}return(y=e==null?void 0:e[_])!=null&&y.position?(g=e==null?void 0:e[_])==null?void 0:g.position:v.get(_)}}}function C5({graph:r,margin:e,drags:t,getNodePosition:n,ratio:i,gridSize:s,maxIterations:o}){const{nodes:a,edges:l}=_h(r),c=VF(r,{maxIterations:o,inputReducer:(u,h)=>({...h,x:h.x||0,y:h.y||0}),settings:{ratio:i,margin:e,gridSize:s}});return{step(){return!0},getNodePosition(u){var h,p;if(n){const m=n(u,{graph:r,drags:t,nodes:a,edges:l});if(m)return m}return(h=t==null?void 0:t[u])!=null&&h.position?(p=t==null?void 0:t[u])==null?void 0:p.position:c==null?void 0:c[u]}}}function R5({graph:r,drags:e,iterations:t,...n}){JF.assign(r);const i=ZF(r,{iterations:t,settings:n});return{step(){return!0},getNodePosition(s){var o;return((o=e==null?void 0:e[s])==null?void 0:o.position)||(i==null?void 0:i[s])}}}function P5({graph:r,drags:e,getNodePosition:t}){const{nodes:n,edges:i}=_h(r);return{step(){return!0},getNodePosition(s){return t(s,{graph:r,drags:e,nodes:n,edges:i})}}}const L5=["forceDirected2d","treeTd2d","treeLr2d","radialOut2d","treeTd3d","treeLr3d","radialOut3d","forceDirected3d"];function I5({type:r,...e}){if(L5.includes(r)){const{nodeStrength:t,linkDistance:n,nodeLevelRatio:i}=e;if(r==="forceDirected2d")return uo({...e,dimensions:2,nodeLevelRatio:i||2,nodeStrength:t||-250,linkDistance:n,forceLayout:r});if(r==="treeTd2d")return uo({...e,mode:"td",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:r});if(r==="treeLr2d")return uo({...e,mode:"lr",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:r});if(r==="radialOut2d")return uo({...e,mode:"radialout",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-500,linkDistance:n||100,forceLayout:r});if(r==="treeTd3d")return uo({...e,mode:"td",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||50});if(r==="treeLr3d")return uo({...e,mode:"lr",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||50,forceLayout:r});if(r==="radialOut3d")return uo({...e,mode:"radialout",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||100,forceLayout:r});if(r==="forceDirected3d")return uo({...e,dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-250,linkDistance:n,forceLayout:r})}else if(r==="circular2d"){const{radius:t}=e;return T5({...e,radius:t||300})}else{if(r==="hierarchicalTd")return ZE({...e,mode:"td"});if(r==="hierarchicalLr")return ZE({...e,mode:"lr"});if(r==="nooverlap"){const{graph:t,maxIterations:n,ratio:i,margin:s,gridSize:o,...a}=e;return C5({graph:t,margin:s||10,maxIterations:n||50,ratio:i||10,gridSize:o||20,...a})}else if(r==="forceatlas2"){const{graph:t,iterations:n,gravity:i,scalingRatio:s,...o}=e;return R5({type:"forceatlas2",graph:t,...o,scalingRatio:s||100,gravity:i||10,iterations:n||50})}else if(r==="custom")return P5({...e})}throw new Error(`Layout ${r} not found.`)}function c2({nodeCount:r,nodePosition:e,labelType:t,camera:n}){return(i,s)=>{var o;if(n&&e&&((o=n==null?void 0:n.position)==null?void 0:o.z)/(n==null?void 0:n.zoom)-(e==null?void 0:e.z)>6e3)return!1;if(t==="all")return!0;if(t==="nodes"&&i==="node")return!0;if(t==="edges"&&i==="edge")return!0;if(t==="auto"&&i==="node"){if(s>7)return!0;if(n&&e&&n.position.z/n.zoom-e.z<3e3)return!0}return!1}}function u2(r,e){switch(e){case"above":return r;case"below":return-r;case"inline":case"natural":default:return 0}}function D5({graph:r}){const e=nk(r);return{ranks:e,getSizeForNode:t=>e[t]*80}}function U5({graph:r}){const e=rk.degreeCentrality(r);return{ranks:e,getSizeForNode:t=>e[t]*20}}function O5({graph:r,attribute:e,defaultSize:t}){const n=new Map;return e?r.forEachNode((i,s)=>{var o;const a=(o=s.data)==null?void 0:o[e];isNaN(a)&&console.warn(`Attribute ${a} is not a number for node ${s.id}`),n.set(i,a||0)}):console.warn("Attribute sizing configured but no attribute provided"),{getSizeForNode:i=>!e||!n?t:n.get(i)}}const KE={pagerank:D5,centrality:U5,attribute:O5,none:({defaultSize:r})=>({getSizeForNode:e=>r})};function N5({type:r,...e}){var t;const n=(t=KE[r])==null?void 0:t.call(KE,e);if(!n&&r!=="default")throw new Error(`Unknown sizing strategy: ${r}`);const{graph:i,minSize:s,maxSize:o}=e,a=new Map;let l,c;if(i.forEachNode((u,h)=>{let p;r==="default"?p=h.size||e.defaultSize:p=n.getSizeForNode(u),(l===void 0||pc)&&(c=p),a.set(u,p)}),r!=="none"){const u=Z2().domain([l,c]).rangeRound([s,o]);for(const[h,p]of a)a.set(h,u(p))}return a}function F5(r,e,t){r.clear();const n=new Set;for(const i of e)try{n.has(i.id)||(r.addNode(i.id,i),n.add(i.id))}catch(s){console.error(`[Graph] Error adding node '${i.id}`,s)}for(const i of t)if(!(!n.has(i.source)||!n.has(i.target)))try{r.addEdge(i.source,i.target,i)}catch(s){console.error(`[Graph] Error adding edge '${i.source} -> ${i.target}`,s)}return r}function k5({graph:r,layout:e,sizingType:t,labelType:n,sizingAttribute:i,defaultNodeSize:s,minNodeSize:o,maxNodeSize:a,clusterAttribute:l}){const c=[],u=[],h=new Map,p=N5({graph:r,type:t,attribute:i,minSize:o,maxSize:a,defaultSize:s}),m=r.nodes().length,v=c2({nodeCount:m,labelType:n});return r.forEachNode((_,y)=>{const g=e.getNodePosition(_),{data:x,fill:w,icon:E,label:b,size:M,...A}=y,P=p.get(y.id),C=v("node",P),F=(r.inboundNeighbors(y.id)||[]).map(I=>r.getNodeAttributes(I)),N={...y,size:P,labelVisible:C,label:b,icon:E,fill:w,cluster:l?x[l]:void 0,parents:F,data:{...A,...x??{}},position:{...g,x:g.x||0,y:g.y||0,z:g.z||1}};h.set(y.id,N),c.push(N)}),r.forEachEdge((_,y)=>{const g=h.get(y.source),x=h.get(y.target);if(g&&x){const{data:w,id:E,label:b,size:M,...A}=y,P=v("edge",M);u.push({...y,id:E,label:b,labelVisible:P,size:M,data:{...A,id:E,...w||{}}})}}),{nodes:c,edges:u}}const nr={mass:10,tension:1e3,friction:300,precision:.1};function h2(r,e,t){const n=e.getLength(),i=r==="end"?n:n/2,s=r==="end"?t/2:0,o=(i-s)/n,a=e.getPointAt(o),l=e.getTangentAt(o);return[a,l]}function f2(r){return[r+6,2+r/1.5]}const R0=.7;function d2(r,e,t=0){const n=new Y(r.x,r.y||0,r.z||0),i=new Y(e.x,e.y||0,e.z||0),s=new Y().addVectors(n,i).divideScalar(2);return s.setLength(s.length()+t)}function z5(r,e,t=-1){const n=r.clone(),i=e.clone(),s=new Y().subVectors(i,n),o=s.length(),a=s.clone().normalize(),l=new Y().subVectors(i,n).divideScalar(2),c=Math.abs(a.x)%1,u=new Y(-a.y,a.x-c*a.z,c*a.y).normalize(),h=new Y().add(n).add(l).add(u.multiplyScalar(o/4).multiplyScalar(t));return[r,h,e]}function Qu(r,e,t,n,i,s){const o=$E(r,t,e),a=$E(t,r,n);return i?new lp(...z5(o,a,s)):new vy(o,a)}function eh(r){return new Y(r.position.x,r.position.y,r.position.z||0)}function $E(r,e,t){const n=r.distanceTo(e);return r.clone().add(e.clone().sub(r).multiplyScalar(t/n))}function JE(r,e){return{...r,position:{...r.position,x:r.position.x+e.x,y:r.position.y+e.y,z:r.position.z+e.z}}}function B5({edge:r,edges:e,curved:t}){let n=t,i;const s=e.filter(o=>o.target===r.target&&o.source===r.source).map(o=>o.id);if(s.length>1){n=!0;const o=s.indexOf(r.id);s.length===2?i=o===0?R0:-R0:i=(o-Math.floor(s.length/2))*R0}return{curved:n,curveOffset:i}}function th(r){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let a of r)e=Math.min(e,a.position.x),t=Math.max(t,a.position.x),n=Math.min(n,a.position.y),i=Math.max(i,a.position.y),s=Math.min(s,a.position.z),o=Math.max(o,a.position.z);return{height:i-n,width:t-e,minX:e,maxX:t,minY:n,maxY:i,minZ:s,maxZ:o,x:(t+e)/2,y:(i+n)/2,z:(o+s)/2}}function G5(r,e){return e?r.reduce((t,n)=>{const i=n.data[e];return i&&t.set(i,[...t.get(i)||[],n]),t},new Map):new Map}function H5({nodes:r,clusterAttribute:e}){const t=new Map;if(e){const n=G5(r,e);for(const[i,s]of n){const o=th(s);t.set(i,{label:i,nodes:s,position:o})}}return t}const m_=({sensitivity:r=7,interval:e=50,timeout:t=0,disabled:n,onPointerOver:i,onPointerOut:s})=>{const o=K.useRef(!1),a=K.useRef(null),l=K.useRef(0),c=K.useRef({x:null,y:null,px:null,py:null}),u=K.useCallback(y=>{c.current.x=y.clientX,c.current.y=y.clientY},[]),h=K.useCallback(y=>{a.current=clearTimeout(a.current);const{px:g,x,py:w,y:E}=c.current;Math.abs(g-x)+Math.abs(w-E)h(y),e))},[e,i,r]),p=K.useCallback(()=>{clearTimeout(a.current),typeof window<"u"&&document.removeEventListener("mousemove",u,!1)},[u]),m=K.useCallback(y=>{n||(o.current=!0,p(),l.current!==1&&(c.current.px=y.pointer.x,c.current.py=y.pointer.y,typeof window<"u"&&document.addEventListener("mousemove",u,!1),a.current=setTimeout(()=>h(y),t)))},[p,h,n,u,t]),v=K.useCallback(y=>{a.current=clearTimeout(a.current),l.current=0,s(y)},[s]),_=K.useCallback(y=>{o.current=!1,p(),l.current===1&&(a.current=setTimeout(()=>v(y),t))},[p,v,t]);return{pointerOver:m,pointerOut:_}},p2=({draggable:r,set:e,position:t,bounds:n,onDragStart:i,onDragEnd:s})=>{const o=Bn(y=>y.camera),a=Bn(y=>y.raycaster),l=Bn(y=>y.size),c=Bn(y=>y.gl),{mouse2D:u,mouse3D:h,offset:p,normal:m,plane:v}=K.useMemo(()=>({mouse2D:new De,mouse3D:new Y,offset:new Y,normal:new Y,plane:new Us}),[]),_=K.useMemo(()=>c.domElement.getBoundingClientRect(),[c.domElement]);return Pz({onDragStart:({event:y})=>{const{eventObject:g,point:x}=y;g.getWorldPosition(p).sub(x),h.copy(x),i()},onDrag:({xy:y,buttons:g,cancel:x})=>{if(g!==1){x();return}const w=(y[0]-((_==null?void 0:_.left)??0))/l.width*2-1,E=-((y[1]-((_==null?void 0:_.top)??0))/l.height)*2+1;u.set(w,E),a.setFromCamera(u,o),o.getWorldDirection(m).negate(),v.setFromNormalAndCoplanarPoint(m,h),a.ray.intersectPlane(v,h);const b=new Y(t.x,t.y,t.z).copy(h).add(p);if(n){const M=new Y((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),A=(n.maxX-n.minX)/2,P=b.clone().sub(M);P.length()>A&&(P.normalize().multiplyScalar(A),b.copy(M).add(P))}return e(b)},onDragEnd:s},{drag:{enabled:r,threshold:10}})},{Provider:V5,useStore:qe}=vk(),W5=({actives:r=[],selections:e=[],collapsedNodeIds:t=[],theme:n})=>mk(i=>({theme:{...n,edge:{...n.edge,label:{...n.edge.label,fontSize:n.edge.label.fontSize??6}}},edges:[],nodes:[],collapsedNodeIds:t,clusters:new Map,panning:!1,draggingIds:[],actives:r,edgeContextMenus:new Set,edgeMeshes:[],selections:e,hoveredNodeId:null,drags:{},graph:new en({multi:!0}),setTheme:s=>i(o=>({...o,theme:s})),setClusters:s=>i(o=>({...o,clusters:s})),setEdgeContextMenus:s=>i(o=>({...o,edgeContextMenus:s})),setEdgeMeshes:s=>i(o=>({...o,edgeMeshes:s})),setPanning:s=>i(o=>({...o,panning:s})),setDrags:s=>i(o=>({...o,drags:s})),addDraggingId:s=>i(o=>({...o,draggingIds:[...o.draggingIds,s]})),removeDraggingId:s=>i(o=>({...o,draggingIds:o.draggingIds.filter(a=>a!==s)})),setActives:s=>i(o=>({...o,actives:s})),setSelections:s=>i(o=>({...o,selections:s})),setHoveredNodeId:s=>i(o=>({...o,hoveredNodeId:s})),setNodes:s=>i(o=>({...o,nodes:s,centerPosition:th(s)})),setEdges:s=>i(o=>({...o,edges:s})),setNodePosition:(s,o)=>i(a=>{var l,c;const u=a.nodes.find(_=>_.id===s),h=eh(u),m=new Y(o.x,o.y,o.z).sub(h),v=[...a.nodes];if((l=a.selections)!=null&&l.includes(s))(c=a.selections)==null||c.forEach(_=>{const y=a.nodes.find(g=>g.id===_);if(y){const g=a.nodes.indexOf(y);v[g]=JE(y,m)}});else{const _=a.nodes.indexOf(u);v[_]=JE(u,m)}return{...a,drags:{...a.drags,[s]:u},nodes:v}}),setCollapsedNodeIds:(s=[])=>i(o=>({...o,collapsedNodeIds:s})),setClusterPosition:(s,o)=>i(a=>{const l=new Map(a.clusters),c=l.get(s);if(c){const u=c.position,h=new Y(o.x-u.x,o.y-u.y,o.z-(u.z??0)),p=[...a.nodes],m={...a.drags};p.forEach((y,g)=>{y.cluster===s&&(p[g]={...y,position:{...y.position,x:y.position.x+h.x,y:y.position.y+h.y,z:y.position.z+(h.z??0)}},m[y.id]=y)});const v=p.filter(y=>y.cluster===s),_=th(v);return l.set(s,{...c,position:_}),{...a,drags:{...m,[s]:c},clusters:l,nodes:p}}return a})}));function m2({nodeId:r,nodes:e,edges:t,currentHiddenNodes:n,currentHiddenEdges:i}){const s=[],o=[],a=n.map(m=>m.id),l=i.map(m=>m.id),c=t.filter(m=>m.source===r),u=c.map(m=>m.target);o.push(...c);for(const m of u){const v=t.filter(y=>y.target===m&&y.source!==r);let _=!1;if((v.length===0||v.length>0&&!a.includes(m)&&v.map(g=>g.id).every(g=>l.includes(g)))&&(_=!0),_){const y=e.find(x=>x.id===m);y&&s.push(y);const g=m2({nodeId:m,nodes:e,edges:t,currentHiddenEdges:o,currentHiddenNodes:s});o.push(...g.hiddenEdges),s.push(...g.hiddenNodes)}}const h=Object.values(o.reduce((m,v)=>({...m,[v.id]:v}),{})),p=Object.values(s.reduce((m,v)=>({...m,[v.id]:v}),{}));return{hiddenEdges:h,hiddenNodes:p}}const X5=({collapsedIds:r,nodes:e,edges:t})=>{const n=[],i=[];for(const c of r){const{hiddenEdges:u,hiddenNodes:h}=m2({nodeId:c,nodes:e,edges:t,currentHiddenEdges:i,currentHiddenNodes:n});n.push(...h),i.push(...u)}const s=n.map(c=>c.id),o=i.map(c=>c.id),a=e.filter(c=>!s.includes(c.id)),l=t.filter(c=>!o.includes(c.id));return{visibleNodes:a,visibleEdges:l}},j5=({layoutType:r,sizingType:e,labelType:t,sizingAttribute:n,clusterAttribute:i,selections:s,nodes:o,edges:a,actives:l,collapsedNodeIds:c,defaultNodeSize:u,maxNodeSize:h,minNodeSize:p,layoutOverrides:m,constrainDragging:v})=>{const _=qe(D=>D.graph),y=qe(D=>D.clusters),g=qe(D=>D.nodes),x=qe(D=>D.setClusters),w=qe(D=>D.collapsedNodeIds),E=qe(D=>D.setEdges),b=qe(D=>D.nodes),M=qe(D=>D.setNodes),A=qe(D=>D.setSelections),P=qe(D=>D.setActives),C=qe(D=>D.drags),L=qe(D=>D.setDrags),F=qe(D=>D.setCollapsedNodeIds),N=K.useRef(!1),I=K.useRef(null),X=Bn(D=>D.camera),q=K.useRef(C),W=K.useRef([]);K.useEffect(()=>{var D;if(!i)return;const V=g.map(ee=>ee.id),Z=o.find(ee=>!V.includes(ee.id));if(Z){const ee=Z.data[i],ie=y.get(ee),ue={...q.current};(D=ie==null?void 0:ie.nodes)==null||D.forEach(ce=>ue[ce.id]=void 0),q.current=ue,L(ue)}},[g,o,i,y,L]);const{visibleEdges:O,visibleNodes:k}=K.useMemo(()=>X5({collapsedIds:w,nodes:o,edges:a}),[w,o,a]),G=K.useCallback(D=>{const V={...q.current};D.forEach(Z=>V[Z.id]=Z),q.current=V,L(V)},[L]),B=K.useCallback(async D=>{I.current=D||I5({...m,type:r,graph:_,drags:q.current,clusters:W==null?void 0:W.current,clusterAttribute:i}),await b5(I.current);const V=k5({graph:_,layout:I.current,sizingType:e,labelType:t,sizingAttribute:n,maxNodeSize:h,minNodeSize:p,defaultNodeSize:u,clusterAttribute:i}),Z=H5({nodes:V.nodes,clusterAttribute:i});v&&Z.forEach(ee=>{var ie,ue;const ce=W.current.get(ee.label);(ce==null?void 0:ce.nodes.length)===ee.nodes.length&&(ee.position=((ue=(ie=W.current)==null?void 0:ie.get(ee.label))==null?void 0:ue.position)??ee.position)}),E(V.edges),M(V.nodes),x(Z),i&&G(V.nodes)},[m,r,i,e,t,n,h,p,u,E,M,x]);return K.useEffect(()=>{q.current=C},[C,i,B]),K.useEffect(()=>{W.current=y},[y]),K.useEffect(()=>{const D=b.map(Z=>({...Z,labelVisible:c2({nodeCount:b==null?void 0:b.length,labelType:t,camera:X,nodePosition:Z==null?void 0:Z.position})("node",Z==null?void 0:Z.size)}));D.some((Z,ee)=>Z.labelVisible!==b[ee].labelVisible)&&M(D)},[X,X.zoom,X.position.z,M,b,t]),K.useEffect(()=>{N.current&&A(s)},[s,A]),K.useEffect(()=>{N.current&&P(l)},[l,P]),K.useEffect(()=>{async function D(){N.current=!1,F5(_,k,O),await B(),requestAnimationFrame(()=>N.current=!0)}D()},[k,O]),K.useEffect(()=>{N.current&&F(c)},[c,F]),K.useEffect(()=>{N.current&&(q.current={},L({}),B())},[r,B,L]),K.useEffect(()=>{N.current&&B(I.current)},[e,n,t,B]),{updateLayout:B}},nh=({text:r,fontSize:e=7,fontUrl:t,color:n="#2A6475",opacity:i=1,stroke:s,active:o,ellipsis:a=75,rotation:l})=>{const c=a&&!o?y5(r,a):r,u=K.useMemo(()=>new Ke(n),[n]),h=K.useMemo(()=>s?new Ke(s):void 0,[s]);return Ne.jsx(qA,{position:[0,0,1],children:Ne.jsx(f5,{font:t,fontSize:e,color:u,fillOpacity:i,textAlign:"center",outlineWidth:s?1:0,outlineColor:h,depthOffset:0,maxWidth:100,overflowWrap:"break-word",rotation:l,children:c})})},Y5=({color:r="#D8E6EA",size:e=1,opacity:t=.5,animated:n,strokeWidth:i=5,innerRadius:s=4,segments:o=25})=>{const a=K.useMemo(()=>new Ke(r),[r]),{ringSize:l,ringOpacity:c}=tr({from:{ringOpacity:0,ringSize:[1e-5,1e-5,1e-5]},to:{ringOpacity:t,ringSize:[e/2,e/2,1]},config:{...nr,duration:n?void 0:0}}),u=i/10,h=s+u;return Ne.jsx(qA,{position:[0,0,1],children:Ne.jsxs(An.mesh,{scale:l,children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[s,h,o]}),Ne.jsx(An.meshBasicMaterial,{attach:"material",color:a,transparent:!0,depthTest:!1,opacity:c,side:vn,fog:!0})]})})},q5=({color:r,id:e,size:t,selected:n,opacity:i=1,animated:s})=>{const{scale:o,nodeOpacity:a}=tr({from:{scale:[1e-5,1e-5,1e-5],nodeOpacity:0},to:{scale:[t,t,t],nodeOpacity:i},config:{...nr,duration:s?void 0:0}}),l=K.useMemo(()=>new Ke(r),[r]),c=qe(u=>u.theme);return Ne.jsxs(Ne.Fragment,{children:[Ne.jsxs(An.mesh,{userData:{id:e,type:"node"},scale:o,children:[Ne.jsx("sphereGeometry",{attach:"geometry",args:[1,25,25]}),Ne.jsx(An.meshPhongMaterial,{attach:"material",side:vn,transparent:!0,fog:!0,opacity:a,color:l})]}),Ne.jsx(Y5,{opacity:n?.5:0,size:t,animated:s,color:n?c.ring.activeFill:c.ring.fill})]})},g2=K.createContext({controls:null,resetControls:()=>{},zoomIn:()=>{},zoomOut:()=>{},dollyIn:()=>{},dollyOut:()=>{},panLeft:()=>{},panRight:()=>{},panUp:()=>{},panDown:()=>{},freeze:()=>{},unFreeze:()=>{}}),zp=()=>{const r=K.useContext(g2);if(r===void 0)throw new Error("`useCameraControls` hook must be used within a `ControlsProvider` component");return r};Qn.install({THREE:{MOUSE:ab,Vector2:De,Vector3:Y,Vector4:Xt,Quaternion:si,Matrix4:yt,Spherical:lT,Box3:ir,Sphere:rr,Raycaster:Uy,MathUtils:{DEG2RAD:(jE=Od)==null?void 0:jE.DEG2RAD,clamp:(YE=Od)==null?void 0:YE.clamp}}});hT({ThreeCameraControls:Qn});const Bp={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40},QE=new kp(Bp.ARROW_LEFT,100),eb=new kp(Bp.ARROW_RIGHT,100),tb=new kp(Bp.ARROW_UP,100),nb=new kp(Bp.ARROW_DOWN,100),Z5=K.forwardRef(({mode:r="rotate",children:e,animated:t,disabled:n,minDistance:i=1e3,maxDistance:s=5e4},o)=>{const a=K.useRef(null),l=Bn(F=>F.camera),c=Bn(F=>F.gl),u=r==="orbit",h=qe(F=>F.setPanning),p=qe(F=>F.draggingIds.length>0),m=K.useRef(0),[v,_]=K.useState(!1);Ep((F,N)=>{var I,X;(I=a.current)!=null&&I.enabled&&((X=a.current)==null||X.update(N)),u&&(a.current.azimuthAngle+=20*N*Od.DEG2RAD)},-1),K.useEffect(()=>()=>{var F;return(F=a.current)==null?void 0:F.dispose()},[]);const y=K.useCallback(()=>{var F;(F=a.current)==null||F.zoom(l.zoom/2,t)},[t,l.zoom]),g=K.useCallback(()=>{var F;(F=a.current)==null||F.zoom(-l.zoom/2,t)},[t,l.zoom]),x=K.useCallback(F=>{var N;(N=a.current)==null||N.dolly(F,t)},[t]),w=K.useCallback(F=>{var N;(N=a.current)==null||N.dolly(F,t)},[t]),E=K.useCallback(F=>{var N;u||(N=a.current)==null||N.truck(-.03*F.deltaTime,0,t)},[t,u]),b=K.useCallback(F=>{var N;u||(N=a.current)==null||N.truck(.03*F.deltaTime,0,t)},[t,u]),M=K.useCallback(F=>{var N;u||(N=a.current)==null||N.truck(0,.03*F.deltaTime,t)},[t,u]),A=K.useCallback(F=>{var N;u||(N=a.current)==null||N.truck(0,-.03*F.deltaTime,t)},[t,u]),P=K.useCallback(F=>{F.code==="Space"&&(r==="rotate"?a.current.mouseButtons.left=Qn.ACTION.TRUCK:a.current.mouseButtons.left=Qn.ACTION.ROTATE)},[r]),C=K.useCallback(F=>{F.code==="Space"&&(r==="rotate"?a.current.mouseButtons.left=Qn.ACTION.ROTATE:a.current.mouseButtons.left=Qn.ACTION.TRUCK)},[r]);K.useEffect(()=>(n||(QE.addEventListener("holding",b),eb.addEventListener("holding",E),tb.addEventListener("holding",M),nb.addEventListener("holding",A),typeof window<"u"&&(window.addEventListener("keydown",P),window.addEventListener("keyup",C))),()=>{QE.removeEventListener("holding",b),eb.removeEventListener("holding",E),tb.removeEventListener("holding",M),nb.removeEventListener("holding",A),typeof window<"u"&&(window.removeEventListener("keydown",P),window.removeEventListener("keyup",C))}),[n,P,C,A,b,E,M]),K.useEffect(()=>{n?(a.current.mouseButtons.left=Qn.ACTION.NONE,a.current.mouseButtons.middle=Qn.ACTION.NONE,a.current.mouseButtons.wheel=Qn.ACTION.NONE):(a.current.mouseButtons.left=Qn.ACTION.TRUCK,a.current.mouseButtons.middle=Qn.ACTION.TRUCK,a.current.mouseButtons.wheel=Qn.ACTION.DOLLY)},[n]),K.useEffect(()=>{const F=()=>h(!0),N=()=>h(!1),I=a.current;return I&&(I.addEventListener("control",F),I.addEventListener("controlend",N)),()=>{I&&(I.removeEventListener("control",F),I.removeEventListener("controlend",N))}},[a,h]),K.useEffect(()=>{p?(a.current.mouseButtons.left=Qn.ACTION.NONE,a.current.touches.one=Qn.ACTION.NONE):r==="rotate"?(a.current.mouseButtons.left=Qn.ACTION.ROTATE,a.current.touches.one=Qn.ACTION.TOUCH_ROTATE):(a.current.touches.one=Qn.ACTION.TOUCH_TRUCK,a.current.mouseButtons.left=Qn.ACTION.TRUCK)},[p,r]);const L=K.useMemo(()=>({controls:a.current,zoomIn:()=>y(),zoomOut:()=>g(),dollyIn:(F=1e3)=>x(F),dollyOut:(F=-1e3)=>w(F),panLeft:(F=100)=>b({deltaTime:F}),panRight:(F=100)=>E({deltaTime:F}),panDown:(F=100)=>A({deltaTime:F}),panUp:(F=100)=>M({deltaTime:F}),resetControls:F=>{var N;return(N=a.current)==null?void 0:N.reset(F)},freeze:()=>{a.current.truckSpeed&&(m.current=a.current.truckSpeed),a.current.truckSpeed=0},unFreeze:()=>a.current.truckSpeed=m.current}),[y,g,b,E,A,M,a.current]);return K.useImperativeHandle(o,()=>L),Ne.jsxs(g2.Provider,{value:L,children:[Ne.jsx("threeCameraControls",{ref:F=>{a.current=F,v||_(!0)},args:[l,c.domElement],smoothTime:.1,minDistance:i,dollyToCursor:!0,maxDistance:s}),e]})});function v2(r,e){const t=e.position.z;rl.x0&&(e==null?void 0:e.x)l.y0&&(e==null?void 0:e.y)Math.abs(n-r%Math.PI){const n=qe(_=>_.nodes),[i,s]=K.useState(!1),o=Bn(_=>_.invalidate),{controls:a}=zp(),l=Bn(_=>_.camera),c=K.useRef(!1),u=K.useCallback(async(_,y)=>{const g=(y==null?void 0:y.animated)!==void 0?y==null?void 0:y.animated:!0,x=(y==null?void 0:y.centerOnlyIfNodesNotInView)!==void 0?y==null?void 0:y.centerOnlyIfNodesNotInView:!1;if(!c.current||!x||x&&(_!=null&&_.some(w=>!ib(l,w.position)))){const{x:w,y:E,z:b}=th(_);await a.setTarget(w,E,b,g),i||s(!0),o()}},[o,a,n]),h=K.useCallback(async(_,y={animated:!0,fitOnlyIfNodesNotInView:!1})=>{const{fitOnlyIfNodesNotInView:g}=y;if(!g||g&&(_!=null&&_.some(x=>!ib(l,x.position)))){const{minX:x,maxX:w,minY:E,maxY:b,minZ:M,maxZ:A}=th(_);if(!t.includes("3d")){const{horizontalRotation:P,verticalRotation:C}=$5(a==null?void 0:a.azimuthAngle,a==null?void 0:a.polarAngle);a==null||a.rotate(P,C,!0)}await(a==null?void 0:a.zoomTo(1,y==null?void 0:y.animated)),await(a==null?void 0:a.fitToBox(new ir(new Y(x,E,M),new Y(w,b,A)),y==null?void 0:y.animated,{cover:!1,paddingLeft:pd,paddingRight:pd,paddingBottom:pd,paddingTop:pd}))}},[l,a,t]),p=K.useCallback(_=>{let y=null;return _!=null&&_.length&&(y=_.reduce((g,x)=>{const w=n.find(E=>E.id===x);if(w)g.push(w);else throw new Error(`Attempted to center ${x} but it was not found in the nodes`);return g},[])),y},[n]),m=K.useCallback((_,y)=>{const g=p(_);u(g||n,{animated:r,centerOnlyIfNodesNotInView:y==null?void 0:y.centerOnlyIfNodesNotInView})},[r,u,p,n]),v=K.useCallback(async(_,y)=>{const g=p(_);await h(g||n,{animated:r,...y})},[r,h,p,n]);return K.useLayoutEffect(()=>{async function _(){a&&(n!=null&&n.length)&&(c.current||(await u(n,{animated:!1}),await h(n,{animated:!1}),c.current=!0))}_()},[a,u,n,r,l,h]),{centerNodes:u,centerNodesById:m,fitNodesInViewById:v,isCentered:i}},Q5=({image:r,id:e,size:t,opacity:n=1,animated:i})=>{const s=K.useMemo(()=>new KM().load(r),[r]),{scale:o,spriteOpacity:a}=tr({from:{scale:[1e-5,1e-5,1e-5],spriteOpacity:0},to:{scale:[t,t,t],spriteOpacity:n},config:{...nr,duration:i?void 0:0}});return Ne.jsx(An.sprite,{userData:{id:e,type:"node"},scale:o,children:Ne.jsx(An.spriteMaterial,{attach:"material",opacity:a,fog:!0,depthTest:!1,transparent:!0,side:vn,children:Ne.jsx("primitive",{attach:"map",object:s,minFilter:fn})})})},eH=({animated:r,disabled:e,id:t,draggable:n=!1,labelFontUrl:i,contextMenu:s,onClick:o,onDoubleClick:a,onPointerOver:l,onDragged:c,onPointerOut:u,onContextMenu:h,renderNode:p,constrainDragging:m})=>{var v,_,y;const g=zp(),x=qe(ne=>ne.theme),w=qe(ne=>ne.nodes.find(we=>we.id===t)),E=qe(ne=>ne.edges),b=qe(ne=>ne.draggingIds),M=qe(ne=>ne.collapsedNodeIds),A=qe(ne=>ne.addDraggingId),P=qe(ne=>ne.removeDraggingId),C=qe(ne=>ne.setHoveredNodeId),L=qe(ne=>ne.setNodePosition),F=qe(ne=>ne.setCollapsedNodeIds),N=qe(ne=>ne.collapsedNodeIds.includes(t)),I=qe(ne=>{var we;return(we=ne.actives)==null?void 0:we.includes(t)}),X=qe(ne=>{var we;return(we=ne.selections)==null?void 0:we.includes(t)}),q=qe(ne=>{var we;return((we=ne.selections)==null?void 0:we.length)>0}),W=qe(ne=>ne.centerPosition),O=qe(ne=>ne.clusters.get(w.cluster)),k=b.includes(t),G=b.length>0,{position:B,label:D,subLabel:V,size:Z=7,labelVisible:ee=!0}=w,ie=K.useRef(null),[ue,ce]=K.useState(!1),[le,Ae]=K.useState(!1),Ee=ue||X||I,ae=q?Ee?x.node.selectedOpacity:x.node.inactiveOpacity:x.node.opacity,z=K.useMemo(()=>E.filter(we=>we.source===t).length>0||N,[E,t,N]),oe=K.useCallback(()=>{z&&F(N?M.filter(ne=>ne!==t):[...M,t])},[z,M,t,N,F]),[{nodePosition:te,labelPosition:se,subLabelPosition:$}]=tr(()=>({from:{nodePosition:W?[W.x,W.y,0]:[0,0,0],labelPosition:[0,-(Z+7),2],subLabelPosition:[0,-(Z+14),2]},to:{nodePosition:B?[B.x,B.y,Ee?B.z+1:B.z]:[0,0,0],labelPosition:[0,-(Z+7),2],subLabelPosition:[0,-(Z+14),2]},config:{...nr,duration:r&&!G?void 0:0}}),[k,B,r,Z,Ee]),Ie=p2({draggable:n,position:B,bounds:m?O==null?void 0:O.position:void 0,set:ne=>L(t,ne),onDragStart:()=>{A(t),ce(!0)},onDragEnd:()=>{P(t),c==null||c(w)}});ya(ue&&!G&&o!==void 0,"pointer"),ya(ue&&n&&!k&&o===void 0,"grab"),ya(k,"grabbing");const de=Ee||k,Se=de?x.node.activeFill:w.fill||x.node.fill,{pointerOver:Le,pointerOut:ge}=m_({disabled:e||k,onPointerOver:ne=>{g.freeze(),ce(!0),l==null||l(w,ne),C(t)},onPointerOut:ne=>{g.unFreeze(),ce(!1),u==null||u(w,ne),C(null)}}),He=K.useMemo(()=>p?p({id:t,color:Se,size:Z,active:de,opacity:ae,animated:r,selected:X,node:w}):Ne.jsx(Ne.Fragment,{children:w.icon?Ne.jsx(Q5,{id:t,image:w.icon||"",size:Z+8,opacity:ae,animated:r,color:Se,node:w,active:de,selected:X}):Ne.jsx(q5,{id:t,size:Z,opacity:ae,animated:r,color:Se,node:w,active:de,selected:X})}),[p,t,Se,Z,de,ae,r,X,w]),j=K.useMemo(()=>{var ne,we,be;return ee&&(ee||X||ue)&&D&&Ne.jsxs(Ne.Fragment,{children:[Ne.jsx(An.group,{position:se,children:Ne.jsx(nh,{text:D,fontUrl:i,opacity:ae,stroke:x.node.label.stroke,active:X||ue||k||I,color:X||ue||k||I?x.node.label.activeColor:x.node.label.color})}),V&&Ne.jsx(An.group,{position:$,children:Ne.jsx(nh,{text:V,fontUrl:i,fontSize:5,opacity:ae,stroke:(ne=x.node.subLabel)==null?void 0:ne.stroke,active:X||ue||k||I,color:X||ue||k||I?(we=x.node.subLabel)==null?void 0:we.activeColor:(be=x.node.subLabel)==null?void 0:be.color})})]})},[ue,I,k,X,D,i,se,ee,ae,V,$,x.node.label.activeColor,x.node.label.color,x.node.label.stroke,(v=x.node.subLabel)==null?void 0:v.activeColor,(_=x.node.subLabel)==null?void 0:_.color,(y=x.node.subLabel)==null?void 0:y.stroke]),H=K.useMemo(()=>le&&s&&Ne.jsx($y,{prepend:!0,center:!0,children:s({data:w,canCollapse:z,isCollapsed:N,onCollapse:oe,onClose:()=>Ae(!1)})}),[le,s,w,z,N,oe]);return Ne.jsxs(An.group,{renderOrder:1,userData:{id:t,type:"node"},ref:ie,position:te,onPointerOver:Le,onPointerOut:ge,onClick:ne=>{!e&&!k&&(o==null||o(w,{canCollapse:z,isCollapsed:N},ne))},onDoubleClick:ne=>{!e&&!k&&(a==null||a(w,ne))},onContextMenu:()=>{e||(Ae(!0),h==null||h(w,{canCollapse:z,isCollapsed:N,onCollapse:oe}))},...Ie(),children:[He,H,j]})},tH=({animated:r,color:e="#D8E6EA",length:t,opacity:n=.5,position:i,rotation:s,size:o=1,onActive:a,onContextMenu:l})=>{const c=K.useMemo(()=>new Ke(e),[e]),u=K.useRef(null),h=qe(y=>y.draggingIds.length>0),p=qe(y=>y.centerPosition),[{pos:m,arrowOpacity:v}]=tr(()=>({from:{pos:p?[p.x,p.y,p.z]:[0,0,0],arrowOpacity:0},to:{pos:[i.x,i.y,i.z],arrowOpacity:n},config:{...nr,duration:r&&!h?void 0:0}}),[r,h,n,i]),_=K.useCallback(()=>{var y;const g=new Y(0,1,0);(y=u.current)==null||y.quaternion.setFromUnitVectors(g,s)},[s,u]);return K.useEffect(()=>_(),[_]),Ne.jsxs(An.mesh,{position:m,ref:u,scale:[1,1,1],onPointerOver:()=>a(!0),onPointerOut:()=>a(!1),onPointerDown:y=>{y.nativeEvent.buttons===2&&(y.stopPropagation(),l())},children:[Ne.jsx("cylinderGeometry",{args:[0,o,t,20,1,!0],attach:"geometry"}),Ne.jsx(An.meshBasicMaterial,{attach:"material",color:c,depthTest:!1,opacity:v,transparent:!0,side:vn,fog:!0})]})},nH=({curveOffset:r,animated:e,color:t="#000",curve:n,curved:i=!1,id:s,opacity:o=1,size:a=1,onContextMenu:l,onClick:c,onPointerOver:u,onPointerOut:h})=>{const p=K.useRef(null),m=qe(x=>x.draggingIds.length>0),v=K.useMemo(()=>new Ke(t),[t]),_=qe(x=>x.centerPosition),y=K.useRef(!1),{lineOpacity:g}=tr({from:{lineOpacity:0},to:{lineOpacity:o},config:{...nr,duration:e?void 0:0}});return tr(()=>{const x=n.getPoint(0),w=n.getPoint(1);return{from:{fromVertices:y.current?[w==null?void 0:w.x,w==null?void 0:w.y,(w==null?void 0:w.z)||0]:[_==null?void 0:_.x,_==null?void 0:_.y,(_==null?void 0:_.z)||0],toVertices:[x==null?void 0:x.x,x==null?void 0:x.y,(x==null?void 0:x.z)||0]},to:{fromVertices:[x==null?void 0:x.x,x==null?void 0:x.y,(x==null?void 0:x.z)||0],toVertices:[w==null?void 0:w.x,w==null?void 0:w.y,(w==null?void 0:w.z)||0]},onChange:E=>{const{fromVertices:b,toVertices:M}=E.value,A=new Y(...b),P=new Y(...M),C=Qu(A,0,P,0,i,r);p.current.copy(new ba(C,20,a/2,5,!1))},config:{...nr,duration:e&&!m?void 0:0}}},[e,m,n,a]),K.useEffect(()=>{y.current=!0},[]),Ne.jsxs("mesh",{userData:{id:s,type:"edge"},onPointerOver:u,onPointerOut:h,onClick:c,onPointerDown:x=>{x.nativeEvent.buttons===2&&(x.stopPropagation(),l())},children:[Ne.jsx("tubeGeometry",{attach:"geometry",ref:p}),Ne.jsx(An.meshBasicMaterial,{attach:"material",opacity:g,fog:!0,transparent:!0,depthTest:!1,color:v})]})},sb=3,iH=({animated:r,arrowPlacement:e="end",contextMenu:t,disabled:n,labelPlacement:i="inline",id:s,interpolation:o,labelFontUrl:a,onContextMenu:l,onClick:c,onPointerOver:u,onPointerOut:h})=>{const p=qe(oe=>oe.theme),m=qe(oe=>oe.draggingIds.length>0),[v,_]=K.useState(!1),[y,g]=K.useState(!1),x=qe(oe=>oe.edges),w=x.find(oe=>oe.id===s),{target:E,source:b,label:M,labelVisible:A=!1,size:P=1,fill:C}=w,L=qe(oe=>oe.nodes.find(te=>te.id===b)),F=qe(oe=>oe.nodes.find(te=>te.id===E)),N=(P+p.edge.label.fontSize)/2,[I,X]=K.useMemo(()=>f2(P),[P]),{curveOffset:q,curved:W}=K.useMemo(()=>B5({edge:w,edges:x,curved:o==="curved"}),[w,x,o]),[O,k,G]=K.useMemo(()=>{const oe=eh(L),te=L.size,se=eh(F),$=F.size;let Ie=Qu(oe,te,se,$,W,q);const[de,Se]=h2(e,Ie,I);return e==="end"&&(Ie=Qu(oe,te,de,0,W,q)),[Ie,de,Se]},[L,F,W,q,e,I]),B=K.useMemo(()=>{let oe=d2(L.position,F.position,u2(N,i));if(W){const te=new Y().subVectors(oe,O.getPoint(.5));switch(i){case"above":te.y=te.y-sb;break;case"below":te.y=te.y+sb;break}oe=oe.sub(te)}return oe},[L.position,F.position,N,i,W,O]),D=qe(oe=>{var te;return(te=oe.selections)==null?void 0:te.includes(s)}),V=qe(oe=>{var te;return(te=oe.selections)==null?void 0:te.length}),Z=qe(oe=>{var te;return(te=oe.actives)==null?void 0:te.includes(s)}),ee=qe(oe=>oe.centerPosition),ie=V?D||Z?p.edge.selectedOpacity:p.edge.inactiveOpacity:p.edge.opacity,[{labelPosition:ue}]=tr(()=>({from:{labelPosition:ee?[ee.x,ee.y,ee.z]:[0,0,0]},to:{labelPosition:[B.x,B.y,B.z]},config:{...nr,duration:r&&!m?void 0:0}}),[B,r,m]),ce=K.useMemo(()=>new Eo(0,0,i==="natural"?0:Math.atan((F.position.y-L.position.y)/(F.position.x-L.position.x))),[F.position.x,F.position.y,L.position.x,L.position.y,i]);ya(v&&!m&&c!==void 0,"pointer");const{pointerOver:le,pointerOut:Ae}=m_({disabled:n,onPointerOver:oe=>{_(!0),u==null||u(w,oe)},onPointerOut:oe=>{_(!1),h==null||h(w,oe)}}),Ee=K.useMemo(()=>e!=="none"&&Ne.jsx(tH,{animated:r,color:D||v||Z?p.arrow.activeFill:C||p.arrow.fill,length:I,opacity:ie,position:k,rotation:G,size:X,onActive:_,onContextMenu:()=>{n||(g(!0),l==null||l(w))}}),[C,v,r,I,e,k,G,X,n,w,Z,D,l,ie,p.arrow.activeFill,p.arrow.fill]),ae=K.useMemo(()=>A&&M&&Ne.jsx(An.group,{position:ue,onContextMenu:()=>{n||(g(!0),l==null||l(w))},onPointerOver:le,onPointerOut:Ae,children:Ne.jsx(nh,{text:M,ellipsis:15,fontUrl:a,stroke:p.edge.label.stroke,color:D||v||Z?p.edge.label.activeColor:p.edge.label.color,opacity:ie,fontSize:p.edge.label.fontSize,rotation:ce})}),[v,n,w,Z,D,M,a,ue,ce,A,l,Ae,le,ie,p.edge.label.activeColor,p.edge.label.color,p.edge.label.fontSize,p.edge.label.stroke]),z=K.useMemo(()=>y&&t&&Ne.jsx($y,{prepend:!0,center:!0,position:B,children:t({data:w,onClose:()=>g(!1)})}),[y,t,B,w]);return Ne.jsxs("group",{children:[Ne.jsx(nH,{curveOffset:q,animated:r,color:D||v||Z?p.edge.activeFill:C||p.edge.fill,curve:O,curved:W,id:s,opacity:ie,size:P,onClick:oe=>{n||c==null||c(w,oe)},onPointerOver:le,onPointerOut:Ae,onContextMenu:()=>{n||(g(!0),l==null||l(w))}}),Ee,ae,z]})},ob=new Ws(0,0,0);function rH(r,e){const t=K.useRef(),n=qe(c=>c.theme);qe(c=>{t.current=c});const i=K.useRef(new Map);K.useRef(new Ws(0,0,0));const s=K.useRef(),o=e==="curved",a=K.useCallback(c=>{const u=[],h=i.current,{nodes:p}=t.current,m=new Map(p.map(_=>[_.id,_])),v=n.edge.label.fontSize;return r!=="none"&&!s.current&&(s.current=new La(0,1,1,20,1,!0)),c.forEach(_=>{const{target:y,source:g,size:x=1}=_,w=m.get(g),E=m.get(y);if(!w||!E)return;const b=`${w.position.x},${w.position.y},${E.position.x},${E.position.y},${x}`;if(h.has(b)){u.push(h.get(b));return}const M=eh(w),A=w.size+v,P=eh(E),C=E.size+v;let L=Qu(M,A,P,C,o),F=new ba(L,20,x/2,5,!1);if(r==="none"){u.push(F),h.set(b,F);return}const[N,I]=f2(x),X=s.current.clone();X.scale(I,N,I);const[q,W]=h2(r,L,N),O=new si;if(O.setFromUnitVectors(new Y(0,1,0),W),X.applyQuaternion(O),X.translate(q.x,q.y,q.z),r&&r==="end"){const G=Qu(M,A,q,0,o);F=new ba(G,20,x/2,5,!1)}const k=od([F,X]);u.push(k),h.set(b,k)}),u},[r,o,n.edge.label.fontSize]),l=K.useCallback((c,u)=>{const h=a(c),p=a(u);return od([p.length?od(p):ob,h.length?od(h):ob],!0)},[a]);return{getGeometries:a,getGeometry:l}}function sH(r,e,t){const n=K.useRef(r);K.useEffect(()=>{n.current=r},[r]);const i=qe(h=>h.edgeContextMenus),s=qe(K.useCallback(h=>h.setEdgeContextMenus,[])),o=K.useRef(!1),a=K.useCallback(()=>{o.current=!0},[]),l=K.useRef(!1),c=K.useCallback(()=>{l.current=!0},[]),u=K.useCallback((h,p)=>{const{onClick:m,onContextMenu:v,onPointerOver:_,onPointerOut:y}=n.current;if(m&&o.current&&!t){o.current=!1;for(const g of p)m(g)}if((e||v)&&l.current&&!t){l.current=!1;const g=new Set(i);let x=!1;for(const w of p)i.has(w.id)||(g.add(w.id),x=!0,v==null||v(w));x&&s(g)}_&&p.filter(x=>!h.includes(x)).forEach(x=>{_(x)}),y&&h.filter(x=>!p.includes(x)).forEach(x=>{y(x)})},[e,t,i,s]);return{handleClick:a,handleContextMenu:c,handleIntersections:u}}function oH(r,e){const t=K.useRef(r),n=K.useRef();K.useEffect(()=>{t.current=r;const o=r.getAttribute("position");n.current=new Float32Array(o.array.length)},[r]);const i=K.useCallback(()=>{const o=t.current.getAttribute("position");return{from:new Float32Array(o.array.length),to:o.array}},[]),s=K.useCallback(o=>{const a=n.current;a.set(o);const l=new $t(a,3,!1);t.current.setAttribute("position",l),l.needsUpdate=!0},[]);tr(()=>{if(!e)return null;const o=i();return{from:{positions:o.from},to:{positions:o.to},onChange:a=>{s(a.value.positions)},config:{...nr,duration:e?void 0:0}}},[e,i,s])}function aH(r,e,t){const[{activeOpacity:n,inactiveOpacity:i}]=tr(()=>({from:{activeOpacity:0,inactiveOpacity:0},to:{activeOpacity:e?t.edge.selectedOpacity:t.edge.opacity,inactiveOpacity:e?t.edge.inactiveOpacity:t.edge.opacity},config:{...nr,duration:r?void 0:0}}),[r,e,t]);return{activeOpacity:n,inactiveOpacity:i}}const lH=({animated:r,color:e,contextMenu:t,edge:n,labelFontUrl:i,labelPlacement:s="inline",opacity:o})=>{const a=qe(L=>L.theme),{target:l,source:c,label:u,labelVisible:h=!1,size:p=1}=n,m=qe(L=>L.nodes),[v,_]=K.useMemo(()=>[m.find(L=>L.id===c),m.find(L=>L.id===l)],[m,c,l]),y=qe(L=>L.draggingIds.length>0),g=K.useMemo(()=>(p+a.edge.label.fontSize)/2,[p,a.edge.label.fontSize]),x=K.useMemo(()=>d2(v.position,_.position,u2(g,s)),[v.position,_.position,g,s]),w=qe(L=>L.edgeContextMenus),E=qe(L=>L.setEdgeContextMenus),[{labelPosition:b}]=tr(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[x.x,x.y,x.z]},config:{...nr,duration:r&&!y?void 0:0}}),[x,r,y]),M=K.useCallback(L=>{w.delete(L),E(new Set(w))},[w,E]),A=K.useMemo(()=>s==="natural"?new Eo(0,0,0):new Eo(0,0,Math.atan2(_.position.y-v.position.y,_.position.x-v.position.x)),[s,_.position.y,_.position.x,v.position.y,v.position.x]),P=K.useMemo(()=>({prepend:!0,center:!0,position:x}),[x]),C=K.useMemo(()=>({text:u,ellipsis:15,fontUrl:i,stroke:a.edge.label.stroke,color:e,opacity:o,fontSize:a.edge.label.fontSize,rotation:A}),[u,i,a.edge.label.stroke,e,o,a.edge.label.fontSize,A]);return Ne.jsxs("group",{children:[h&&u&&Ne.jsx(An.group,{position:b,children:Ne.jsx(nh,{...C})}),t&&w.has(n.id)&&Ne.jsx($y,{...P,children:t({data:n,onClose:()=>M(n.id)})})]})},cH=({interpolation:r="linear",arrowPlacement:e="end",labelPlacement:t="inline",animated:n,contextMenu:i,disabled:s,edges:o,labelFontUrl:a,onClick:l,onContextMenu:c,onPointerOut:u,onPointerOver:h})=>{const p=qe(B=>B.theme),{getGeometries:m,getGeometry:v}=rH(e,r),_=qe(B=>B.draggingIds),y=qe(B=>B.edgeMeshes),g=qe(B=>B.setEdgeMeshes),x=qe(B=>B.actives||[]),w=qe(B=>B.selections||[]),[E,b,M,A]=K.useMemo(()=>{const B=[],D=[],V=[],Z=[];return o.forEach(ee=>{if(_.includes(ee.source)||_.includes(ee.target)){w.includes(ee.id)||x.includes(ee.id)?V.push(ee):Z.push(ee);return}w.includes(ee.id)||x.includes(ee.id)?B.push(ee):D.push(ee)}),[B,D,V,Z]},[o,x,w,_]),P=!!w.length,C=K.useMemo(()=>v(E,b),[v,E,b]),{activeOpacity:L,inactiveOpacity:F}=aH(n,P,p);oH(C,n),K.useEffect(()=>{if(_.length===0){const D=m(o).map(V=>new _n(V));g(D)}},[m,g,o,_.length]);const N=K.useRef(new _n),I=K.useRef(new _n),X=K.useCallback(B=>{if(!B.camera)return[];const D=B.intersectObjects(y);return D.length?D.map(V=>o[y.indexOf(V.object)]):[]},[y,o]),{handleClick:q,handleContextMenu:W,handleIntersections:O}=sH({onClick:l,onContextMenu:c,onPointerOut:u,onPointerOver:h},i,s),k=K.useRef([]),G=K.useRef([]);return Ep(B=>{if(N.current.geometry=C,s)return;const D=k.current;if((_.length||_.length===0&&D!==null)&&(I.current.geometry=v(M,A)),k.current=_,_.length)return;const V=G.current,Z=X(B.raycaster);O(V,Z),Z.join()!==V.join()&&(I.current.geometry=v(Z,[])),G.current=Z}),Ne.jsxs("group",{onClick:q,onContextMenu:W,children:[Ne.jsxs("mesh",{ref:N,children:[Ne.jsx(An.meshBasicMaterial,{attach:"material-0",color:p.edge.fill,depthTest:!1,fog:!0,opacity:F,side:vn,transparent:!0}),Ne.jsx(An.meshBasicMaterial,{attach:"material-1",color:p.edge.activeFill,depthTest:!1,fog:!0,opacity:L,side:vn,transparent:!0})]}),Ne.jsxs("mesh",{ref:I,children:[Ne.jsx(An.meshBasicMaterial,{attach:"material-0",color:p.edge.fill,depthTest:!1,fog:!0,opacity:F,side:vn,transparent:!0}),Ne.jsx(An.meshBasicMaterial,{attach:"material-1",color:p.edge.activeFill,depthTest:!1,fog:!0,opacity:L,side:vn,transparent:!0})]}),o.map(B=>Ne.jsx(lH,{animated:n,contextMenu:i,color:p.edge.label.color,disabled:s,edge:B,labelFontUrl:a,labelPlacement:t},B.id))]})},uH=({outerRadius:r,innerRadius:e,padding:t,normalizedFill:n,normalizedStroke:i,opacity:s,animated:o,theme:a})=>{var l;const{opacity:c}=tr({from:{opacity:0},to:{opacity:s},config:{...nr,duration:o?void 0:0}});return Ne.jsxs(Ne.Fragment,{children:[Ne.jsxs("mesh",{children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[r,0,128]}),Ne.jsx(An.meshBasicMaterial,{attach:"material",color:n,transparent:!0,depthTest:!1,opacity:(l=a.cluster)!=null&&l.fill?c:0,side:vn,fog:!0})]}),Ne.jsxs("mesh",{children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[r,e+t,128]}),Ne.jsx(An.meshBasicMaterial,{attach:"material",color:i,transparent:!0,depthTest:!1,opacity:c,side:vn,fog:!0})]})]})},hH=({animated:r,position:e,padding:t=40,labelFontUrl:n,disabled:i,radius:s=2,nodes:o,label:a,onClick:l,onPointerOver:c,onPointerOut:u,draggable:h=!1,onDragged:p,onRender:m})=>{var v,_,y,g,x,w,E;const b=qe(z=>z.theme),M=Math.max(e.width,e.height)/2,A=M-s+t,[P,C]=K.useState(!1),L=qe(z=>z.centerPosition),F=qe(z=>z.nodes),N=zp(),I=qe(z=>z.draggingIds),X=I.includes(a),q=I.length>0,W=qe(z=>{var oe;return(oe=z.actives)==null?void 0:oe.some(te=>o.some(se=>se.id===te))}),O=qe(z=>z.hoveredNodeId),k=qe(z=>{var oe;return(oe=z.selections)==null?void 0:oe.some(te=>o.some(se=>se.id===te))}),B=qe(z=>{var oe;return((oe=z.selections)==null?void 0:oe.length)>0})?k||P||W?(v=b.cluster)==null?void 0:v.selectedOpacity:(_=b.cluster)==null?void 0:_.inactiveOpacity:(y=b.cluster)==null?void 0:y.opacity,D=K.useMemo(()=>{var z,oe;const te=[0,-A,2],se=(oe=(z=b.cluster)==null?void 0:z.label)==null?void 0:oe.offset;return se?[te[0]-se[0],te[1]-se[1],te[2]-se[2]]:te},[A,(x=(g=b.cluster)==null?void 0:g.label)==null?void 0:x.offset]),{circlePosition:V}=tr({from:{circlePosition:[L.x,L.y,-1]},to:{circlePosition:e?[e.x,e.y,-1]:[0,0,-1]},config:{...nr,duration:r&&!q?void 0:0}}),Z=K.useMemo(()=>{var z;return new Ke((z=b.cluster)==null?void 0:z.stroke)},[(w=b.cluster)==null?void 0:w.stroke]),ee=K.useMemo(()=>{var z;return new Ke((z=b.cluster)==null?void 0:z.fill)},[(E=b.cluster)==null?void 0:E.fill]),ie=qe(z=>z.addDraggingId),ue=qe(z=>z.removeDraggingId),ce=qe(z=>z.setClusterPosition),le=p2({draggable:h&&!O,position:{x:e.x,y:e.y,z:-1},set:z=>ce(a,z),onDragStart:()=>{ie(a),C(!0)},onDragEnd:()=>{ue(a),C(!1);const z=F.filter(oe=>oe.cluster===a);p==null||p({nodes:z,label:a})}});ya(P&&!q&&l!==void 0,"pointer"),ya(P&&h&&!X&&l===void 0,"grab"),ya(X,"grabbing");const{pointerOver:Ae,pointerOut:Ee}=m_({disabled:i,onPointerOver:z=>{C(!0),N.freeze(),c==null||c({nodes:o,label:a},z)},onPointerOut:z=>{C(!1),N.unFreeze(),u==null||u({nodes:o,label:a},z)}});return K.useMemo(()=>{var z,oe,te;return b.cluster&&Ne.jsx(An.group,{userData:{id:a,type:"cluster"},position:V,onPointerOver:Ae,onPointerOut:Ee,onClick:se=>{!i&&!X&&(l==null||l({nodes:o,label:a},se))},...le(),children:m?m({label:{position:D,text:a,opacity:B,fontUrl:n},opacity:B,outerRadius:A,innerRadius:M,padding:t,theme:b}):Ne.jsxs(Ne.Fragment,{children:[Ne.jsx(uH,{outerRadius:A,innerRadius:M,padding:t,normalizedFill:ee,normalizedStroke:Z,opacity:B,animated:r,theme:b}),((z=b.cluster)==null?void 0:z.label)&&Ne.jsx(An.group,{position:D,children:Ne.jsx(nh,{text:a,opacity:B,fontUrl:n,stroke:b.cluster.label.stroke,active:!1,color:(oe=b.cluster)==null?void 0:oe.label.color,fontSize:((te=b.cluster)==null?void 0:te.label.fontSize)??12})})]})})},[b,V,Ae,Ee,A,ee,M,t,Z,D,a,B,n,i,l,o,le,X,m,r])},fH=K.forwardRef(({onNodeClick:r,onNodeDoubleClick:e,onNodeContextMenu:t,onEdgeContextMenu:n,onEdgeClick:i,onEdgePointerOver:s,onEdgePointerOut:o,onNodePointerOver:a,onNodePointerOut:l,onClusterClick:c,onNodeDragged:u,onClusterDragged:h,onClusterPointerOver:p,onClusterPointerOut:m,contextMenu:v,animated:_,disabled:y,draggable:g,constrainDragging:x=!1,edgeLabelPosition:w,edgeArrowPosition:E,edgeInterpolation:b="linear",labelFontUrl:M,renderNode:A,onRenderCluster:P,...C},L)=>{const{layoutType:F,clusterAttribute:N}=C,I=Bn(le=>le.gl),X=Bn(le=>le.scene),q=Bn(le=>le.camera),{updateLayout:W}=j5({...C,constrainDragging:x});if(N&&!(F==="forceDirected2d"||F==="forceDirected3d"))throw new Error("Clustering is only supported for the force directed layouts.");const O=qe(le=>le.graph),k=qe(le=>le.nodes),G=qe(le=>le.edges),B=qe(le=>[...le.clusters.values()]),{centerNodesById:D,fitNodesInViewById:V,isCentered:Z}=J5({animated:_,disabled:y,layoutType:F});K.useImperativeHandle(L,()=>({centerGraph:D,fitNodesInView:V,graph:O,renderScene:()=>I.render(X,q)}),[D,V,O,I,X,q]);const ee=K.useCallback(le=>{u==null||u(le),N&&W()},[N,u,W]),ie=K.useMemo(()=>k.map(le=>Ne.jsx(eH,{id:le==null?void 0:le.id,labelFontUrl:M,draggable:g,constrainDragging:x,disabled:y,animated:_,contextMenu:v,renderNode:A,onClick:r,onDoubleClick:e,onContextMenu:t,onPointerOver:a,onPointerOut:l,onDragged:ee},le==null?void 0:le.id)),[x,_,v,y,g,M,k,r,t,e,ee,l,a,A]),ue=K.useMemo(()=>_?G.map(le=>Ne.jsx(iH,{id:le.id,disabled:y,animated:_,labelFontUrl:M,labelPlacement:w,arrowPlacement:E,interpolation:b,contextMenu:v,onClick:i,onContextMenu:n,onPointerOver:s,onPointerOut:o},le.id)):Ne.jsx(cH,{edges:G,disabled:y,animated:_,labelFontUrl:M,labelPlacement:w,arrowPlacement:E,interpolation:b,contextMenu:v,onClick:i,onContextMenu:n,onPointerOver:s,onPointerOut:o}),[_,v,y,E,b,w,G,M,i,n,o,s]),ce=K.useMemo(()=>B.map(le=>Ne.jsx(hH,{animated:_,disabled:y,draggable:g,labelFontUrl:M,onClick:c,onPointerOver:p,onPointerOut:m,onDragged:h,onRender:P,...le},le.label)),[_,B,y,g,M,c,m,p,h,P]);return Z&&Ne.jsxs(K.Fragment,{children:[ue,ie,ce]})}),dH={canvas:{background:"#1E2026"},node:{fill:"#7A8C9E",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC"},subLabel:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#54616D",activeFill:"#1DE9AC"},edge:{fill:"#474B56",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#474B56",activeFill:"#1DE9AC"},cluster:{stroke:"#474B56",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#1E2026",color:"#ACBAC7"}}},pH={canvas:{background:"#fff"},node:{fill:"#7CA0AB",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{color:"#2A6475",stroke:"#fff",activeColor:"#1DE9AC"},subLabel:{color:"#ddd",stroke:"transparent",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#D8E6EA",activeFill:"#1DE9AC"},edge:{fill:"#D8E6EA",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#D8E6EA",activeFill:"#1DE9AC"},cluster:{stroke:"#D8E6EA",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475"}}};function md(r,e,t){const{offsetX:n,offsetY:i}=r,{width:s,height:o}=t;e.set(n/s*2-1,-(i/o)*2+1)}function mH(r){const e=document.createElement("div");return e.style.pointerEvents="none",e.style.border=r.lasso.border,e.style.backgroundColor=r.lasso.background,e.style.position="fixed",e}const gH=({children:r,type:e="none",onLasso:t,onLassoEnd:n,disabled:i})=>{var s;const o=qe(I=>I.theme),a=Bn(I=>I.camera),l=Bn(I=>I.gl),c=Bn(I=>I.setEvents),u=Bn(I=>I.size),h=Bn(I=>I.get),p=Bn(I=>I.scene),m=zp(),v=qe(I=>I.actives),_=qe(I=>I.setActives),y=qe(I=>I.edges),g=qe(I=>I.edgeMeshes),x=K.useRef(!1),w=K.useRef(null),E=K.useRef(null),b=K.useRef(mH(o)),M=K.useRef(null),A=K.useRef(!1),P=K.useRef(h().events.enabled),C=K.useRef((s=m.controls)==null?void 0:s.enabled);K.useEffect(()=>{x.current&&(t==null||t(v)),x.current=!0},[v,t]);const L=K.useCallback(I=>{if(A.current){const[X,q,W]=M.current;W.x=Math.max(X.x,I.clientX),W.y=Math.max(X.y,I.clientY),q.x=Math.min(X.x,I.clientX),q.y=Math.min(X.y,I.clientY),b.current.style.left=`${q.x}px`,b.current.style.top=`${q.y}px`,b.current.style.width=`${W.x-q.x}px`,b.current.style.height=`${W.y-q.y}px`,md(I,w.current.endPoint,u),md(I,E.current.endPoint,u);const O=[],k=E.current.select().sort(B=>B.uuid).map(B=>y[g.indexOf(B)].id);O.push(...k);const G=w.current.select().sort(B=>B.uuid).filter(B=>{var D,V;return B.isMesh&&((D=B.userData)==null?void 0:D.id)&&(((V=B.userData)==null?void 0:V.type)===e||e==="all")}).map(B=>B.userData.id);O.push(...G),requestAnimationFrame(()=>{_(O)}),document.addEventListener("pointermove",L,{passive:!0,capture:!0,once:!0})}},[y,g,_,u,e]),F=K.useCallback(()=>{var I;A.current&&(c({enabled:P.current}),A.current=!1,(I=b.current.parentElement)==null||I.removeChild(b.current),m.controls.enabled=C.current,n==null||n(v),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",F))},[c,m.controls,n,v,L]),N=K.useCallback(I=>{var X,q;if(I.shiftKey){P.current=h().events.enabled,C.current=(X=m.controls)==null?void 0:X.enabled,w.current=new wE(a,p);const W=new ku;g.length&&W.add(...g),E.current=new wE(a,W),M.current=[new De,new De,new De];const[O]=M.current;m.controls.enabled=!1,c({enabled:!1}),A.current=!0,(q=l.domElement.parentElement)==null||q.appendChild(b.current),b.current.style.left=`${I.clientX}px`,b.current.style.top=`${I.clientY}px`,b.current.style.width="0px",b.current.style.height="0px",O.x=I.clientX,O.y=I.clientY,md(I,w.current.startPoint,u),md(I,E.current.startPoint,u),document.addEventListener("pointermove",L,{passive:!0,capture:!0,once:!0}),document.addEventListener("pointerup",F,{passive:!0})}},[a,m.controls,g,h,l.domElement.parentElement,L,F,p,c,u]);return K.useEffect(()=>{if(!(i||e==="none"))return typeof window<"u"&&(document.addEventListener("pointerdown",N,{passive:!0}),document.addEventListener("pointermove",L,{passive:!0}),document.addEventListener("pointerup",F,{passive:!0})),()=>{typeof window<"u"&&(document.removeEventListener("pointerdown",N),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",F))}},[e,i,N,L,F]),Ne.jsx("group",{children:r})},vH="_canvas_670zp_1",yH={canvas:vH},_H={alpha:!0,antialias:!0},xH={position:[0,0,1e3],near:5,far:5e4,fov:10},wH=K.forwardRef(({cameraMode:r="pan",layoutType:e="forceDirected2d",sizingType:t="default",labelType:n="auto",theme:i=pH,animated:s=!0,defaultNodeSize:o=7,minNodeSize:a=5,maxNodeSize:l=15,lassoType:c="none",glOptions:u={},edges:h,children:p,nodes:m,minDistance:v,maxDistance:_,onCanvasClick:y,disabled:g,onLasso:x,onLassoEnd:w,...E},b)=>{var M,A;const P=K.useRef(null),C=K.useRef(null),L=K.useRef(null);K.useImperativeHandle(b,()=>({centerGraph:(W,O)=>{var k;return(k=P.current)==null?void 0:k.centerGraph(W,O)},fitNodesInView:(W,O)=>{var k;return(k=P.current)==null?void 0:k.fitNodesInView(W,O)},zoomIn:()=>{var W;return(W=C.current)==null?void 0:W.zoomIn()},zoomOut:()=>{var W;return(W=C.current)==null?void 0:W.zoomOut()},dollyIn:W=>{var O;return(O=C.current)==null?void 0:O.dollyIn(W)},dollyOut:W=>{var O;return(O=C.current)==null?void 0:O.dollyOut(W)},panLeft:()=>{var W;return(W=C.current)==null?void 0:W.panLeft()},panRight:()=>{var W;return(W=C.current)==null?void 0:W.panRight()},panDown:()=>{var W;return(W=C.current)==null?void 0:W.panDown()},panUp:()=>{var W;return(W=C.current)==null?void 0:W.panUp()},resetControls:W=>{var O;return(O=C.current)==null?void 0:O.resetControls(W)},getControls:()=>{var W;return(W=C.current)==null?void 0:W.controls},getGraph:()=>{var W;return(W=P.current)==null?void 0:W.graph},exportCanvas:()=>(P.current.renderScene(),L.current.toDataURL()),freeze:()=>{var W;return(W=C.current)==null?void 0:W.freeze()},unFreeze:()=>{var W;return(W=C.current)==null?void 0:W.unFreeze()}}));const{selections:F,actives:N,collapsedNodeIds:I}=E,X=h.length+m.length>400?!1:s,q=K.useMemo(()=>({...u,..._H}),[u]);return Ne.jsx("div",{className:yH.canvas,children:Ne.jsx(NO,{legacy:!0,linear:!0,ref:L,flat:!0,gl:q,camera:xH,onPointerMissed:y,children:Ne.jsxs(V5,{createStore:()=>W5({selections:F,actives:N,theme:i,collapsedNodeIds:I}),children:[((M=i.canvas)==null?void 0:M.background)&&Ne.jsx("color",{attach:"background",args:[i.canvas.background]}),Ne.jsx("ambientLight",{intensity:1}),p,((A=i.canvas)==null?void 0:A.fog)&&Ne.jsx("fog",{attach:"fog",args:[i.canvas.fog,4e3,9e3]}),Ne.jsx(Z5,{mode:r,ref:C,disabled:g,minDistance:v,maxDistance:_,animated:s,children:Ne.jsx(gH,{disabled:g,type:c,onLasso:x,onLassoEnd:w,children:Ne.jsx(K.Suspense,{children:Ne.jsx(fH,{ref:P,disabled:g,animated:X,edges:h,nodes:m,layoutType:e,sizingType:t,labelType:n,defaultNodeSize:o,minNodeSize:a,maxNodeSize:l,...E})})})})]})})})}),gd={identity:"#22d3ee",knowledge:"#6366f1",rules:"#a78bfa",events:"#fbbf24"},SH={identity:"Identität",knowledge:"Wissen",rules:"Regeln",events:"Ereignisse"},P0=new Set(["auto","agent","hermes"]);function PH({data:r,onDelete:e}){const[t,n]=K.useState(null),i=K.useMemo(()=>{const c={};return r.edges.forEach(u=>{c[u.source]=(c[u.source]||0)+1,c[u.target]=(c[u.target]||0)+1}),c},[r]),s=K.useMemo(()=>r.nodes.map(c=>({id:c.id,label:c.content.length>26?c.content.slice(0,25)+"…":c.content,fill:gd[c.category]||"#64748b",size:6+Math.min(i[c.id]||0,6)*2})),[r,i]),o=K.useMemo(()=>r.edges.map(c=>({id:`${c.source}->${c.target}`,source:c.source,target:c.target,size:.4+c.weight})),[r]),a=t?r.nodes.find(c=>c.id===t)??null:null,l=K.useMemo(()=>{if(!t)return[];const c=new Set;return r.edges.forEach(u=>{u.source===t&&c.add(u.target),u.target===t&&c.add(u.source)}),r.nodes.filter(u=>c.has(u.id))},[t,r]);return r.nodes.length?Ne.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_280px] gap-3",children:[Ne.jsx("div",{className:"relative h-[480px] rounded-2xl border border-border/60 bg-[#070a0f] overflow-hidden",children:Ne.jsx(wH,{nodes:s,edges:o,theme:dH,layoutType:"forceDirected2d",labelType:"nodes",edgeArrowPosition:"none",draggable:!0,onNodeClick:c=>n(c.id),onCanvasClick:()=>n(null)})}),Ne.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 min-h-[480px]",children:a?Ne.jsxs(Ne.Fragment,{children:[Ne.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[Ne.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:gd[a.category],boxShadow:`0 0 0 2px ${P0.has(a.source)?"#34d399":"#475569"}`}}),Ne.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:gd[a.category]},children:SH[a.category]||a.category}),Ne.jsxs("span",{className:`ml-auto text-[10px] font-mono flex items-center gap-1 ${P0.has(a.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[P0.has(a.source)&&Ne.jsx(K2,{className:"h-2.5 w-2.5"}),a.source]})]}),Ne.jsx("div",{className:"text-sm text-foreground leading-relaxed mb-4 break-words",children:a.content}),Ne.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70 mb-2 flex items-center gap-1",children:[Ne.jsx(Vx,{className:"h-3 w-3"})," verwandte Fakten"]}),Ne.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:l.length?l.map(c=>Ne.jsxs("button",{onClick:()=>n(c.id),className:"flex items-center gap-2 text-[11px] text-muted-foreground hover:text-foreground text-left transition-colors",children:[Ne.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:gd[c.category]}}),Ne.jsx("span",{className:"truncate",children:c.content})]},c.id)):Ne.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"—"})}),Ne.jsxs("button",{onClick:()=>{e(a.id),n(null)},className:"flex items-center gap-1.5 text-[11px] text-red-400 border border-red-500/20 rounded-lg px-2.5 py-1.5 hover:bg-red-500/5 transition-all",children:[Ne.jsx($2,{className:"h-3.5 w-3.5"})," vergessen"]})]}):Ne.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center text-muted-foreground/70 gap-2 pt-24",children:[Ne.jsx(Vx,{className:"h-6 w-6"}),Ne.jsx("div",{className:"text-xs max-w-[180px] leading-relaxed",children:"Einen Knoten wählen, um den Fakt und seine semantischen Nachbarn zu sehen."})]})})]}):Ne.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Noch keine Fakten — der Graph füllt sich, sobald Hermes lernt oder du Einträge anlegst."})}export{PH as GraphView}; diff --git a/frontend/dist/assets/GraphView-UmiKmWIR.js b/frontend/dist/assets/GraphView-UmiKmWIR.js new file mode 100644 index 0000000..13bdd2a --- /dev/null +++ b/frontend/dist/assets/GraphView-UmiKmWIR.js @@ -0,0 +1,3922 @@ +import{R as Fh,B as Ww,a as Xw,V as _n,F as qw,r as Iy,g as ki,b as q,c as go,d as Yw,e as jw,_ as Tc,u as $w,j as Zw,f as Kw,h as Se,l as Jw,S as Qw,i as Cg,T as eS}from"./index-eeooup-h.js";const tS=r=>typeof r=="object"&&typeof r.then=="function",Zc=[];function nS(r,e,t=(n,i)=>n===i){if(r===e)return!0;if(!r||!e)return!1;const n=r.length;if(e.length!==n)return!1;for(let i=0;i0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,n.lifespan)),s.response;if(!t)throw s.promise}const i={keys:e,equal:n.equal,remove:()=>{const s=Zc.indexOf(i);s!==-1&&Zc.splice(s,1)},promise:(tS(r)?r:r(...e)).then(s=>{i.response=s,n.lifespan&&n.lifespan>0&&(i.timeout=setTimeout(i.remove,n.lifespan))}).catch(s=>i.error=s)};if(Zc.push(i),!t)throw i.promise}const rS=(r,e,t)=>iS(r,e,!1,t);function sS(r,e,t){return Math.max(e,Math.min(r,t))}const Tt={toVector(r,e){return r===void 0&&(r=e),Array.isArray(r)?r:[r,r]},add(r,e){return[r[0]+e[0],r[1]+e[1]]},sub(r,e){return[r[0]-e[0],r[1]-e[1]]},addTo(r,e){r[0]+=e[0],r[1]+=e[1]},subTo(r,e){r[0]-=e[0],r[1]-=e[1]}};function Rg(r,e,t){return e===0||Math.abs(e)===1/0?Math.pow(r,t*5):r*e*t/(e+t*r)}function Pg(r,e,t,n=.15){return n===0?sS(r,e,t):rt?+Rg(r-t,t-e,n)+t:r}function oS(r,[e,t],[n,i]){const[[s,o],[a,c]]=r;return[Pg(e,s,o,n),Pg(t,a,c,i)]}function aS(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function cS(r){var e=aS(r,"string");return typeof e=="symbol"?e:String(e)}function $t(r,e,t){return e=cS(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Lg(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ut(r){for(var e=1;e{var t,n;return e.target===r.currentTarget||((t=r.currentTarget)===null||t===void 0||(n=t.contains)===null||n===void 0?void 0:n.call(t,e.target))})}function gS(r){return r.type==="touchend"||r.type==="touchcancel"?r.changedTouches:r.targetTouches}function Ny(r){return Du(r)?gS(r)[0]:r}function Pd(r,e){try{const t=e.clientX-r.clientX,n=e.clientY-r.clientY,i=(e.clientX+r.clientX)/2,s=(e.clientY+r.clientY)/2,o=Math.hypot(t,n);return{angle:-(Math.atan2(t,n)*180)/Math.PI,distance:o,origin:[i,s]}}catch{}return null}function vS(r){return mS(r).map(e=>e.identifier)}function Ig(r,e){const[t,n]=Array.from(r.touches).filter(i=>e.includes(i.identifier));return Pd(t,n)}function kh(r){const e=Ny(r);return Du(r)?e.identifier:e.pointerId}function To(r){const e=Ny(r);return[e.clientX,e.clientY]}const Ug=40,Og=800;function Fy(r){let{deltaX:e,deltaY:t,deltaMode:n}=r;return n===1?(e*=Ug,t*=Ug):n===2&&(e*=Og,t*=Og),[e,t]}function _S(r){var e,t;const{scrollX:n,scrollY:i,scrollLeft:s,scrollTop:o}=r.currentTarget;return[(e=n??s)!==null&&e!==void 0?e:0,(t=i??o)!==null&&t!==void 0?t:0]}function yS(r){const e={};if("buttons"in r&&(e.buttons=r.buttons),"shiftKey"in r){const{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s}=r;Object.assign(e,{shiftKey:t,altKey:n,metaKey:i,ctrlKey:s})}return e}function gu(r,...e){return typeof r=="function"?r(...e):r}function xS(){}function bS(...r){return r.length===0?xS:r.length===1?r[0]:function(){let e;for(const t of r)e=t.apply(this,arguments)||e;return e}}function Ng(r,e){return Object.assign({},e,r||{})}const wS=32;class ky{constructor(e,t,n){this.ctrl=e,this.args=t,this.key=n,this.state||(this.state={},this.computeValues([0,0]),this.computeInitial(),this.init&&this.init(),this.reset())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){const{state:e,shared:t,ingKey:n,args:i}=this;t[n]=e._active=e.active=e._blocked=e._force=!1,e._step=[!1,!1],e.intentional=!1,e._movement=[0,0],e._distance=[0,0],e._direction=[0,0],e._delta=[0,0],e._bounds=[[-1/0,1/0],[-1/0,1/0]],e.args=i,e.axis=void 0,e.memo=void 0,e.elapsedTime=e.timeDelta=0,e.direction=[0,0],e.distance=[0,0],e.overflow=[0,0],e._movementBound=[!1,!1],e.velocity=[0,0],e.movement=[0,0],e.delta=[0,0],e.timeStamp=0}start(e){const t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?gu(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){const t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){const e=this.state;e._initial=e._values,e.initial=e.values}compute(e){const{state:t,config:n,shared:i}=this;t.args=this.args;let s=0;if(e&&(t.event=e,n.preventDefault&&e.cancelable&&t.event.preventDefault(),t.type=e.type,i.touches=this.ctrl.pointerIds.size||this.ctrl.touchIds.size,i.locked=!!document.pointerLockElement,Object.assign(i,yS(e)),i.down=i.pressed=i.buttons%2===1||i.touches>0,s=e.timeStamp-t.timeStamp,t.timeStamp=e.timeStamp,t.elapsedTime=t.timeStamp-t.startTime),t._active){const w=t._delta.map(Math.abs);Tt.addTo(t._distance,w)}this.axisIntent&&this.axisIntent(e);const[o,a]=t._movement,[c,l]=n.threshold,{_step:u,values:h}=t;if(n.hasCustomTransform?(u[0]===!1&&(u[0]=Math.abs(o)>=c&&h[0]),u[1]===!1&&(u[1]=Math.abs(a)>=l&&h[1])):(u[0]===!1&&(u[0]=Math.abs(o)>=c&&Math.sign(o)*c),u[1]===!1&&(u[1]=Math.abs(a)>=l&&Math.sign(a)*l)),t.intentional=u[0]!==!1||u[1]!==!1,!t.intentional)return;const f=[0,0];if(n.hasCustomTransform){const[w,S]=h;f[0]=u[0]!==!1?w-u[0]:0,f[1]=u[1]!==!1?S-u[1]:0}else f[0]=u[0]!==!1?o-u[0]:0,f[1]=u[1]!==!1?a-u[1]:0;this.restrictToAxis&&!t._blocked&&this.restrictToAxis(f);const d=t.offset,m=t._active&&!t._blocked||t.active;m&&(t.first=t._active&&!t.active,t.last=!t._active&&t.active,t.active=i[this.ingKey]=t._active,e&&(t.first&&("bounds"in n&&(t._bounds=gu(n.bounds,t)),this.setup&&this.setup()),t.movement=f,this.computeOffset()));const[v,g]=t.offset,[[p,_],[y,x]]=t._bounds;t.overflow=[v_?1:0,gx?1:0],t._movementBound[0]=t.overflow[0]?t._movementBound[0]===!1?t._movement[0]:t._movementBound[0]:!1,t._movementBound[1]=t.overflow[1]?t._movementBound[1]===!1?t._movement[1]:t._movementBound[1]:!1;const b=t._active?n.rubberband||[0,0]:[0,0];if(t.offset=oS(t._bounds,t.offset,b),t.delta=Tt.sub(t.offset,d),this.computeMovement(),m&&(!t.last||s>wS)){t.delta=Tt.sub(t.offset,d);const w=t.delta.map(Math.abs);Tt.addTo(t.distance,w),t.direction=t.delta.map(Math.sign),t._direction=t._delta.map(Math.sign),!t.first&&s>0&&(t.velocity=[w[0]/s,w[1]/s],t.timeDelta=s)}}emit(){const e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;const i=this.handler(Ut(Ut(Ut({},t),e),{},{[this.aliasKey]:e.values}));i!==void 0&&(e.memo=i)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}}function SS([r,e],t){const n=Math.abs(r),i=Math.abs(e);if(n>i&&n>t)return"x";if(i>n&&i>t)return"y"}class Ac extends ky{constructor(...e){super(...e),$t(this,"aliasKey","xy")}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=Tt.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=Tt.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){const t=this.state,n=this.config;if(!t.axis&&e){const i=typeof n.axisThreshold=="object"?n.axisThreshold[Oy(e)]:n.axisThreshold;t.axis=SS(t._movement,i)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case"x":e[1]=0;break;case"y":e[0]=0;break}}}const ES=r=>r,Fg=.15,zy={enabled(r=!0){return r},eventOptions(r,e,t){return Ut(Ut({},t.shared.eventOptions),r)},preventDefault(r=!1){return r},triggerAllEvents(r=!1){return r},rubberband(r=0){switch(r){case!0:return[Fg,Fg];case!1:return[0,0];default:return Tt.toVector(r)}},from(r){if(typeof r=="function")return r;if(r!=null)return Tt.toVector(r)},transform(r,e,t){const n=r||t.shared.transform;return this.hasCustomTransform=!!n,n||ES},threshold(r){return Tt.toVector(r,0)}},MS=0,Es=Ut(Ut({},zy),{},{axis(r,e,{axis:t}){if(this.lockDirection=t==="lock",!this.lockDirection)return t},axisThreshold(r=MS){return r},bounds(r={}){if(typeof r=="function")return s=>Es.bounds(r(s));if("current"in r)return()=>r.current;if(typeof HTMLElement=="function"&&r instanceof HTMLElement)return r;const{left:e=-1/0,right:t=1/0,top:n=-1/0,bottom:i=1/0}=r;return[[e,t],[n,i]]}}),kg={ArrowRight:(r,e=1)=>[r*e,0],ArrowLeft:(r,e=1)=>[-1*r*e,0],ArrowUp:(r,e=1)=>[0,-1*r*e],ArrowDown:(r,e=1)=>[0,r*e]};class TS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","dragging")}reset(){super.reset();const e=this.state;e._pointerId=void 0,e._pointerActive=!1,e._keyboardActive=!1,e._preventScroll=!1,e._delayed=!1,e.swipe=[0,0],e.tap=!1,e.canceled=!1,e.cancel=this.cancel.bind(this)}setup(){const e=this.state;if(e._bounds instanceof HTMLElement){const t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),i={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=Es.bounds(i)}}cancel(){const e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){const t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;const i=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(i&&i.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=kh(e),n._pointerActive=!0,this.computeValues(To(e)),this.computeInitial(),t.preventScrollAxis&&Oy(e)!=="mouse"?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){const t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){const t=this.state,n=this.config;if(!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;const s=To(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=Tt.sub(s,t._values),this.computeValues(s)),Tt.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove("dragDelay"),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis==="xy"){t._active=!1,this.clean();return}else{this.timeoutStore.remove("startPointerDrag"),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}const t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;const i=kh(e);if(t._pointerId!==void 0&&i!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);const[s,o]=t._distance;if(t.tap=s<=n.tapsThreshold&&o<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{const[a,c]=t._delta,[l,u]=t._movement,[h,f]=n.swipe.velocity,[d,m]=n.swipe.distance,v=n.swipe.duration;if(t.elapsedTimeh&&Math.abs(l)>d&&(t.swipe[0]=Math.sign(a)),p>f&&Math.abs(u)>m&&(t.swipe[1]=Math.sign(c))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){const t=this.config,n=t.device;t.pointerLock&&e.currentTarget.requestPointerLock(),t.pointerCapture||(this.eventStore.add(this.sharedConfig.window,n,"change",this.pointerMove.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"end",this.pointerUp.bind(this)),this.eventStore.add(this.sharedConfig.window,n,"cancel",this.pointerUp.bind(this)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,AS(e);const t=this.eventStore.add(this.sharedConfig.window,"touch","change",this.preventScroll.bind(this),{passive:!1});this.eventStore.add(this.sharedConfig.window,"touch","end",t),this.eventStore.add(this.sharedConfig.window,"touch","cancel",t),this.timeoutStore.add("startPointerDrag",this.startPointerDrag.bind(this),this.config.preventScrollDelay,e)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add("dragDelay",()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){const t=kg[e.key];if(t){const n=this.state,i=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,i),n._keyboardActive=!0,Tt.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in kg&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){const t=this.config.device;e(t,"start",this.pointerDown.bind(this)),this.config.pointerCapture&&(e(t,"change",this.pointerMove.bind(this)),e(t,"end",this.pointerUp.bind(this)),e(t,"cancel",this.pointerUp.bind(this)),e("lostPointerCapture","",this.pointerUp.bind(this))),this.config.keys&&(e("key","down",this.keyDown.bind(this)),e("key","up",this.keyUp.bind(this))),this.config.filterTaps&&e("click","",this.pointerClick.bind(this),{capture:!0,passive:!1})}}function AS(r){"persist"in r&&typeof r.persist=="function"&&r.persist()}const Cc=typeof window<"u"&&window.document&&window.document.createElement;function By(){return Cc&&"ontouchstart"in window}function CS(){return By()||Cc&&window.navigator.maxTouchPoints>1}function RS(){return Cc&&"onpointerdown"in window}function PS(){return Cc&&"exitPointerLock"in window.document}function LS(){try{return"constructor"in GestureEvent}catch{return!1}}const Qn={isBrowser:Cc,gesture:LS(),touch:By(),touchscreen:CS(),pointer:RS(),pointerLock:PS()},DS=250,IS=180,US=.5,OS=50,NS=250,FS=10,zg={mouse:0,touch:0,pen:8},kS=Ut(Ut({},Es),{},{device(r,e,{pointer:{touch:t=!1,lock:n=!1,mouse:i=!1}={}}){return this.pointerLock=n&&Qn.pointerLock,Qn.touch&&t?"touch":this.pointerLock?"mouse":Qn.pointer&&!i?"pointer":Qn.touch?"touch":"mouse"},preventScrollAxis(r,e,{preventScroll:t}){if(this.preventScrollDelay=typeof t=="number"?t:t||t===void 0&&r?DS:void 0,!(!Qn.touchscreen||t===!1))return r||(t!==void 0?"y":void 0)},pointerCapture(r,e,{pointer:{capture:t=!0,buttons:n=1,keys:i=!0}={}}){return this.pointerButtons=n,this.keys=i,!this.pointerLock&&this.device==="pointer"&&t},threshold(r,e,{filterTaps:t=!1,tapsThreshold:n=3,axis:i=void 0}){const s=Tt.toVector(r,t?n:i?1:0);return this.filterTaps=t,this.tapsThreshold=n,s},swipe({velocity:r=US,distance:e=OS,duration:t=NS}={}){return{velocity:this.transform(Tt.toVector(r)),distance:this.transform(Tt.toVector(e)),duration:t}},delay(r=0){switch(r){case!0:return IS;case!1:return 0;default:return r}},axisThreshold(r){return r?Ut(Ut({},zg),r):zg},keyboardDisplacement(r=FS){return r}});function Gy(r){const[e,t]=r.overflow,[n,i]=r._delta,[s,o]=r._direction;(e<0&&n>0&&s<0||e>0&&n<0&&s>0)&&(r._movement[0]=r._movementBound[0]),(t<0&&i>0&&o<0||t>0&&i<0&&o>0)&&(r._movement[1]=r._movementBound[1])}const zS=30,BS=100;class GS extends ky{constructor(...e){super(...e),$t(this,"ingKey","pinching"),$t(this,"aliasKey","da")}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();const e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){const{type:e,movement:t,lastOffset:n}=this.state;e==="wheel"?this.state.offset=Tt.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){const{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){const e=this.state,[t,n]=e._movement;if(!e.axis){const i=Math.abs(t)*zS-Math.abs(n);i<0?e.axis="angle":i>0&&(e.axis="scale")}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis==="scale"?e[1]=0:this.state.axis==="angle"&&(e[0]=0))}cancel(){const e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);const t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(s=>n.has(s))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);const i=Ig(e,t._touchIds);i&&this.pinchStart(e,i)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!==1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);const t=this.state,n=t._pointerEvents,i=this.ctrl.pointerIds;if(t._active&&Array.from(n.keys()).every(o=>i.has(o))||(n.size<2&&n.set(e.pointerId,e),t._pointerEvents.size<2))return;this.start(e);const s=Pd(...Array.from(n.values()));s&&this.pinchStart(e,s)}pinchStart(e,t){const n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;const t=Ig(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){const t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;const n=Pd(...Array.from(t.values()));n&&this.pinchMove(e,n)}pinchMove(e,t){const n=this.state,i=n._values[1],s=t.angle-i;let o=0;Math.abs(s)>270&&(o+=Math.sign(s)),this.computeValues([t.distance,t.angle-360*o]),n.origin=t.origin,n.turns=o,n._movement=[n._values[0]/n._initial[0]-1,n._values[1]-n._initial[1]],this.compute(e),this.emit()}touchEnd(e){this.ctrl.setEventIds(e),this.state._active&&this.state._touchIds.some(t=>!this.ctrl.touchIds.has(t))&&(this.state._active=!1,this.compute(e),this.emit())}pointerEnd(e){const t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();const t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;const t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];const n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=Tt.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){const t=this.config.modifierKey;t&&(Array.isArray(t)?!t.find(n=>e[n]):!e[t])||(this.state._active?this.wheelChange(e):this.wheelStart(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){"uv"in e||e.cancelable&&e.preventDefault();const n=this.state;n._delta=[-Fy(e)[1]/BS*n.offset[0],0],Tt.addTo(n._movement,n._delta),Gy(n),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){const t=this.config.device;t&&(e(t,"start",this[t+"Start"].bind(this)),e(t,"change",this[t+"Move"].bind(this)),e(t,"end",this[t+"End"].bind(this)),e(t,"cancel",this[t+"End"].bind(this)),e("lostPointerCapture","",this[t+"End"].bind(this))),this.config.pinchOnWheel&&e("wheel","",this.wheel.bind(this),{passive:!1})}}const VS=Ut(Ut({},zy),{},{device(r,e,{shared:t,pointer:{touch:n=!1}={}}){if(t.target&&!Qn.touch&&Qn.gesture)return"gesture";if(Qn.touch&&n)return"touch";if(Qn.touchscreen){if(Qn.pointer)return"pointer";if(Qn.touch)return"touch"}},bounds(r,e,{scaleBounds:t={},angleBounds:n={}}){const i=o=>{const a=Ng(gu(t,o),{min:-1/0,max:1/0});return[a.min,a.max]},s=o=>{const a=Ng(gu(n,o),{min:-1/0,max:1/0});return[a.min,a.max]};return typeof t!="function"&&typeof n!="function"?[i(),s()]:o=>[i(o),s(o)]},threshold(r,e,t){return this.lockDirection=t.axis==="lock",Tt.toVector(r,this.lockDirection?[.1,3]:0)},modifierKey(r){return r===void 0?"ctrlKey":r},pinchOnWheel(r=!0){return r}});class HS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","moving")}move(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.state._active?this.moveChange(e):this.moveStart(e),this.timeoutStore.add("moveEnd",this.moveEnd.bind(this)))}moveStart(e){this.start(e),this.computeValues(To(e)),this.compute(e),this.computeInitial(),this.emit()}moveChange(e){if(!this.state._active)return;const t=To(e),n=this.state;n._delta=Tt.sub(t,n._values),Tt.addTo(n._movement,n._delta),this.computeValues(t),this.compute(e),this.emit()}moveEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}bind(e){e("pointer","change",this.move.bind(this)),e("pointer","leave",this.moveEnd.bind(this))}}const WS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r});class XS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","scrolling")}scroll(e){this.state._active||this.start(e),this.scrollChange(e),this.timeoutStore.add("scrollEnd",this.scrollEnd.bind(this))}scrollChange(e){e.cancelable&&e.preventDefault();const t=this.state,n=_S(e);t._delta=Tt.sub(n,t._values),Tt.addTo(t._movement,t._delta),this.computeValues(n),this.compute(e),this.emit()}scrollEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("scroll","",this.scroll.bind(this))}}const qS=Es;class YS extends Ac{constructor(...e){super(...e),$t(this,"ingKey","wheeling")}wheel(e){this.state._active||this.start(e),this.wheelChange(e),this.timeoutStore.add("wheelEnd",this.wheelEnd.bind(this))}wheelChange(e){const t=this.state;t._delta=Fy(e),Tt.addTo(t._movement,t._delta),Gy(t),this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){e("wheel","",this.wheel.bind(this))}}const jS=Es;class $S extends Ac{constructor(...e){super(...e),$t(this,"ingKey","hovering")}enter(e){this.config.mouseOnly&&e.pointerType!=="mouse"||(this.start(e),this.computeValues(To(e)),this.compute(e),this.emit())}leave(e){if(this.config.mouseOnly&&e.pointerType!=="mouse")return;const t=this.state;if(!t._active)return;t._active=!1;const n=To(e);t._movement=t._delta=Tt.sub(n,t._values),this.computeValues(n),this.compute(e),t.delta=t.movement,this.emit()}bind(e){e("pointer","enter",this.enter.bind(this)),e("pointer","leave",this.leave.bind(this))}}const ZS=Ut(Ut({},Es),{},{mouseOnly:(r=!0)=>r}),Gp=new Map,Ld=new Map;function KS(r){Gp.set(r.key,r.engine),Ld.set(r.key,r.resolver)}const JS={key:"drag",engine:TS,resolver:kS},QS={key:"hover",engine:$S,resolver:ZS},eE={key:"move",engine:HS,resolver:WS},tE={key:"pinch",engine:GS,resolver:VS},nE={key:"scroll",engine:XS,resolver:qS},iE={key:"wheel",engine:YS,resolver:jS};function rE(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}function sE(r,e){if(r==null)return{};var t=rE(r,e),n,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(r);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}const oE={target(r){if(r)return()=>"current"in r?r.current:r},enabled(r=!0){return r},window(r=Qn.isBrowser?window:void 0){return r},eventOptions({passive:r=!0,capture:e=!1}={}){return{passive:r,capture:e}},transform(r){return r}},aE=["target","eventOptions","window","enabled","transform"];function nu(r={},e){const t={};for(const[n,i]of Object.entries(e))switch(typeof i){case"function":t[n]=i.call(t,r[n],n,r);break;case"object":t[n]=nu(r[n],i);break;case"boolean":i&&(t[n]=r[n]);break}return t}function cE(r,e,t={}){const n=r,{target:i,eventOptions:s,window:o,enabled:a,transform:c}=n,l=sE(n,aE);if(t.shared=nu({target:i,eventOptions:s,window:o,enabled:a,transform:c},oE),e){const u=Ld.get(e);t[e]=nu(Ut({shared:t.shared},l),u)}else for(const u in l){const h=Ld.get(u);h&&(t[u]=nu(Ut({shared:t.shared},l[u]),h))}return t}class Vy{constructor(e,t){$t(this,"_listeners",new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,i,s){const o=this._listeners,a=pS(t,n),c=this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{},l=Ut(Ut({},c),s);e.addEventListener(a,i,l);const u=()=>{e.removeEventListener(a,i,l),o.delete(u)};return o.add(u),u}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}}class lE{constructor(){$t(this,"_timeouts",new Map)}add(e,t,n=140,...i){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...i))}remove(e){const t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}}let uE=class{constructor(e){$t(this,"gestures",new Set),$t(this,"_targetEventStore",new Vy(this)),$t(this,"gestureEventStores",{}),$t(this,"gestureTimeoutStores",{}),$t(this,"handlers",{}),$t(this,"config",{}),$t(this,"pointerIds",new Set),$t(this,"touchIds",new Set),$t(this,"state",{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),hE(this,e)}setEventIds(e){if(Du(e))return this.touchIds=new Set(vS(e)),this.touchIds;if("pointerId"in e)return e.type==="pointerup"||e.type==="pointercancel"?this.pointerIds.delete(e.pointerId):e.type==="pointerdown"&&this.pointerIds.add(e.pointerId),this.pointerIds}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=cE(e,t,this.config)}clean(){this._targetEventStore.clean();for(const e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){const t=this.config.shared,n={};let i;if(!(t.target&&(i=t.target(),!i))){if(t.enabled){for(const o of this.gestures){const a=this.config[o],c=Bg(n,a.eventOptions,!!i);if(a.enabled){const l=Gp.get(o);new l(this,e,o).bind(c)}}const s=Bg(n,t.eventOptions,!!i);for(const o in this.nativeHandlers)s(o,"",a=>this.nativeHandlers[o](Ut(Ut({},this.state.shared),{},{event:a,args:e})),void 0,!0)}for(const s in n)n[s]=bS(...n[s]);if(!i)return n;for(const s in n){const{device:o,capture:a,passive:c}=dS(s);this._targetEventStore.add(i,o,"",n[s],{capture:a,passive:c})}}}};function Ds(r,e){r.gestures.add(e),r.gestureEventStores[e]=new Vy(r,e),r.gestureTimeoutStores[e]=new lE}function hE(r,e){e.drag&&Ds(r,"drag"),e.wheel&&Ds(r,"wheel"),e.scroll&&Ds(r,"scroll"),e.move&&Ds(r,"move"),e.pinch&&Ds(r,"pinch"),e.hover&&Ds(r,"hover")}const Bg=(r,e,t)=>(n,i,s,o={},a=!1)=>{var c,l;const u=(c=o.capture)!==null&&c!==void 0?c:e.capture,h=(l=o.passive)!==null&&l!==void 0?l:e.passive;let f=a?n:hS(n,i,u);t&&h&&(f+="Passive"),r[f]=r[f]||[],r[f].push(s)},fE=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function dE(r){const e={},t={},n=new Set;for(let i in r)fE.test(i)?(n.add(RegExp.lastMatch),t[i]=r[i]):e[i]=r[i];return[t,e,n]}function Is(r,e,t,n,i,s){if(!r.has(t)||!Gp.has(n))return;const o=t+"Start",a=t+"End",c=l=>{let u;return l.first&&o in e&&e[o](l),t in e&&(u=e[t](l)),l.last&&a in e&&e[a](l),u};i[n]=c,s[n]=s[n]||{}}function pE(r,e){const[t,n,i]=dE(r),s={};return Is(i,t,"onDrag","drag",s,e),Is(i,t,"onWheel","wheel",s,e),Is(i,t,"onScroll","scroll",s,e),Is(i,t,"onPinch","pinch",s,e),Is(i,t,"onMove","move",s,e),Is(i,t,"onHover","hover",s,e),{handlers:s,config:e,nativeHandlers:n}}function mE(r,e={},t,n){const i=Fh.useMemo(()=>new uE(r),[]);if(i.applyHandlers(r,n),i.applyConfig(e,t),Fh.useEffect(i.effect.bind(i)),Fh.useEffect(()=>i.clean.bind(i),[]),e.target===void 0)return i.bind.bind(i)}function gE(r){return r.forEach(KS),function(t,n){const{handlers:i,nativeHandlers:s,config:o}=pE(t,n||{});return mE(i,o,void 0,s)}}function vE(r,e){return gE([JS,tE,nE,iE,eE,QS])(r,e||{})}const Kc=(r,e)=>{const t=r[0].index!==null,n=new Set(Object.keys(r[0].attributes)),i=new Set(Object.keys(r[0].morphAttributes)),s={},o={},a=r[0].morphTargetsRelative,c=new Ww;let l=0;if(r.forEach((u,h)=>{let f=0;if(t!==(u.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let d in u.attributes){if(!n.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+d+'" attribute exists among all geometries, or in none of them.'),null;s[d]===void 0&&(s[d]=[]),s[d].push(u.attributes[d]),f++}if(f!==n.size)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". Make sure all geometries have the same number of attributes."),null;if(a!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let d in u.morphAttributes){if(!i.has(d))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;o[d]===void 0&&(o[d]=[]),o[d].push(u.morphAttributes[d])}if(c.userData.mergedUserData=c.userData.mergedUserData||[],c.userData.mergedUserData.push(u.userData),e){let d;if(u.index)d=u.index.count;else if(u.attributes.position!==void 0)d=u.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,d,h),l+=d}}),t){let u=0;const h=[];r.forEach(f=>{const d=f.index;for(let m=0;m{let e,t,n,i=0;if(r.forEach(s=>{if(e===void 0&&(e=s.array.constructor),e!==s.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=s.itemSize),t!==s.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(n===void 0&&(n=s.normalized),n!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;i+=s.array.length}),e&&t){const s=new e(i);let o=0;return r.forEach(a=>{s.set(a.array,o),o+=a.array.length}),new Xw(s,t,n)}},zh=new qw,Bh=new _n,Us=new _n,ci=new _n,Gi=new _n,Ti=new _n,Vi=new _n,Hi=new _n,Jo=new _n,Qo=new _n,ea=new _n,Jc=new _n,ta=new _n,na=new _n,ia=new _n;class Vg{constructor(e,t,n){this.camera=e,this.scene=t,this.startPoint=new _n,this.endPoint=new _n,this.collection=[],this.deep=n||Number.MAX_VALUE}select(e,t){return this.startPoint=e||this.startPoint,this.endPoint=t||this.endPoint,this.collection=[],this.updateFrustum(this.startPoint,this.endPoint),this.searchChildInFrustum(zh,this.scene),this.collection}updateFrustum(e,t){if(e=e||this.startPoint,t=t||this.endPoint,e.x===t.x&&(t.x+=Number.EPSILON),e.y===t.y&&(t.y+=Number.EPSILON),this.camera.updateProjectionMatrix(),this.camera.updateMatrixWorld(),this.camera.isPerspectiveCamera){Us.copy(e),Us.x=Math.min(e.x,t.x),Us.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),ci.setFromMatrixPosition(this.camera.matrixWorld),Gi.copy(Us),Ti.set(t.x,Us.y,0),Vi.copy(t),Hi.set(Us.x,t.y,0),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),ta.copy(Gi).sub(ci),na.copy(Ti).sub(ci),ia.copy(Vi).sub(ci),ta.normalize(),na.normalize(),ia.normalize(),ta.multiplyScalar(this.deep),na.multiplyScalar(this.deep),ia.multiplyScalar(this.deep),ta.add(ci),na.add(ci),ia.add(ci);var n=zh.planes;n[0].setFromCoplanarPoints(ci,Gi,Ti),n[1].setFromCoplanarPoints(ci,Ti,Vi),n[2].setFromCoplanarPoints(Vi,Hi,ci),n[3].setFromCoplanarPoints(Hi,Gi,ci),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ia,na,ta),n[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const i=Math.min(e.x,t.x),s=Math.max(e.y,t.y),o=Math.max(e.x,t.x),a=Math.min(e.y,t.y);Gi.set(i,s,-1),Ti.set(o,s,-1),Vi.set(o,a,-1),Hi.set(i,a,-1),Jo.set(i,s,1),Qo.set(o,s,1),ea.set(o,a,1),Jc.set(i,a,1),Gi.unproject(this.camera),Ti.unproject(this.camera),Vi.unproject(this.camera),Hi.unproject(this.camera),Jo.unproject(this.camera),Qo.unproject(this.camera),ea.unproject(this.camera),Jc.unproject(this.camera);var n=zh.planes;n[0].setFromCoplanarPoints(Gi,Jo,Qo),n[1].setFromCoplanarPoints(Ti,Qo,ea),n[2].setFromCoplanarPoints(ea,Jc,Hi),n[3].setFromCoplanarPoints(Jc,Jo,Gi),n[4].setFromCoplanarPoints(Ti,Vi,Hi),n[5].setFromCoplanarPoints(ea,Qo,Jo),n[5].normal.multiplyScalar(-1)}else console.error("THREE.SelectionBox: Unsupported camera type.")}searchChildInFrustum(e,t){if((t.isMesh||t.isLine||t.isPoints)&&t.material!==void 0&&(t.geometry.boundingSphere===null&&t.geometry.computeBoundingSphere(),Bh.copy(t.geometry.boundingSphere.center),Bh.applyMatrix4(t.matrixWorld),e.containsPoint(Bh)&&this.collection.push(t)),t.children.length>0)for(let n=0;n0;)de[pe]=arguments[pe+2];var Me=xe[he]||(xe[he]=R.getUniformLocation(ce,he));R["uniform"+$].apply(R,[Me].concat(de))},setAttribute:function($,he,de,pe,Me){var we=fe[$];we||(we=fe[$]={buf:R.createBuffer(),loc:R.getAttribLocation(ce,$),data:null}),R.bindBuffer(R.ARRAY_BUFFER,we.buf),R.vertexAttribPointer(we.loc,he,R.FLOAT,!1,0,0),R.enableVertexAttribArray(we.loc),H?R.vertexAttribDivisor(we.loc,pe):ge("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(we.loc,pe),Me!==we.data&&(R.bufferData(R.ARRAY_BUFFER,Me,de),we.data=Me)}})}}}J[K].transaction(re)},D=function(K,W){ne++;try{R.activeTexture(R.TEXTURE0+ne);var ye=ie[K];ye||(ye=ie[K]=R.createTexture(),R.bindTexture(R.TEXTURE_2D,ye),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MIN_FILTER,R.NEAREST),R.texParameteri(R.TEXTURE_2D,R.TEXTURE_MAG_FILTER,R.NEAREST)),R.bindTexture(R.TEXTURE_2D,ye),W(ye,ne)}finally{ne--}},Q=function(K,W,ye){var re=R.createFramebuffer();ee.push(re),R.bindFramebuffer(R.FRAMEBUFFER,re),R.activeTexture(R.TEXTURE0+W),R.bindTexture(R.TEXTURE_2D,K),R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_2D,K,0);try{ye(re)}finally{R.deleteFramebuffer(re),R.bindFramebuffer(R.FRAMEBUFFER,ee[--ee.length-1]||null)}},j=function(){Y={},J={},ie={},ne=-1,ee.length=0};var H=typeof WebGL2RenderingContext<"u"&&R instanceof WebGL2RenderingContext,Y={},J={},ie={},ne=-1,ee=[];R.canvas.addEventListener("webglcontextlost",function(K){j(),K.preventDefault()},!1),c.set(R,F={gl:R,isWebGL2:H,getExtension:ge,withProgram:te,withTexture:D,withTextureFramebuffer:Q,handleContextLoss:j})}U(F)}function h(k,U,R,F,H,Y,J,ie){J===void 0&&(J=15),ie===void 0&&(ie=null),u(k,function(ne){var ee=ne.gl,ge=ne.withProgram,me=ne.withTexture;me("copy",function(te,D){ee.texImage2D(ee.TEXTURE_2D,0,ee.RGBA,H,Y,0,ee.RGBA,ee.UNSIGNED_BYTE,U),ge("copy",o,a,function(Q){var j=Q.setUniform,K=Q.setAttribute;K("aUV",2,ee.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),j("1i","image",D),ee.bindFramebuffer(ee.FRAMEBUFFER,ie||null),ee.disable(ee.BLEND),ee.colorMask(J&8,J&4,J&2,J&1),ee.viewport(R,F,H,Y),ee.scissor(R,F,H,Y),ee.drawArrays(ee.TRIANGLES,0,3)})})})}function f(k,U,R){var F=k.width,H=k.height;u(k,function(Y){var J=Y.gl,ie=new Uint8Array(F*H*4);J.readPixels(0,0,F,H,J.RGBA,J.UNSIGNED_BYTE,ie),k.width=U,k.height=R,h(J,ie,0,0,F,H)})}var d=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:f});function m(k,U,R,F,H,Y){Y===void 0&&(Y=1);var J=new Uint8Array(k*U),ie=F[2]-F[0],ne=F[3]-F[1],ee=[];s(R,function(K,W,ye,re){ee.push({x1:K,y1:W,x2:ye,y2:re,minX:Math.min(K,ye),minY:Math.min(W,re),maxX:Math.max(K,ye),maxY:Math.max(W,re)})}),ee.sort(function(K,W){return K.maxX-W.maxX});for(var ge=0;gexe.minX&&W-rexe.minY){var ce=p(K,W,xe.x1,xe.y1,xe.x2,xe.y2);ceW!=fe.y2>W&&K<(fe.x2-fe.x1)*(W-fe.y1)/(fe.y2-fe.y1)+fe.x1;xe&&(ye+=fe.y1p.y!=seg.w>p.y)&&(p.x<(seg.z-seg.x)*(p.y-seg.y)/(seg.w-seg.y)+seg.x);bool crossingUp=crossing&&vLineSegment.y1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function v(re,fe){var xe=36,ce=0,Pe=new Map,B=fe&&new Map,I;return re.split(",").forEach(function $(he){if(he.indexOf("+")!==-1)for(var de=+he;de--;)$(I);else{I=he;var pe=he.split(">"),Me=pe[0],we=pe[1];Me=String.fromCodePoint(ce+=parseInt(Me,xe)),we=String.fromCodePoint(ce+=parseInt(we,xe)),Pe.set(Me,we),fe&&B.set(we,Me)}}),{map:Pe,reverseMap:B}}var g,p,_;function y(){if(!g){var re=v(m.pairs,!0),fe=re.map,xe=re.reverseMap;g=fe,p=xe,_=v(m.canonical,!1).map}}function x(re){return y(),g.get(re)||null}function b(re){return y(),p.get(re)||null}function w(re){return y(),_.get(re)||null}var S=n.L,M=n.R,E=n.EN,T=n.ES,L=n.ET,P=n.AN,A=n.CS,z=n.B,V=n.S,N=n.ON,C=n.BN,O=n.NSM,k=n.AL,U=n.LRO,R=n.RLO,F=n.LRE,H=n.RLE,Y=n.PDF,J=n.LRI,ie=n.RLI,ne=n.FSI,ee=n.PDI;function ge(re,fe){for(var xe=125,ce=new Uint32Array(re.length),Pe=0;Pe0)De--;else if(je>0){for(Ve=0;!Le[Le.length-1]._isolate;)Le.pop();var tt=Le[Le.length-1]._isolInitIndex;tt!=null&&(he.set(tt,Z),he.set(Z,tt)),Le.pop(),je--}Ee=Le[Le.length-1],$[Z]=Ee._level,Ee._override&&I(Z,Ee._override)}else Ae&Y?(De===0&&(Ve>0?Ve--:!Ee._isolate&&Le.length>1&&(Le.pop(),Ee=Le[Le.length-1])),$[Z]=Ee._level):Ae&z&&($[Z]=pe.level);else $[Z]=Ee._level,Ee._override&&Ae!==C&&I(Z,Ee._override)}for(var lt=[],ft=null,ut=pe.start;ut<=pe.end;ut++){var xt=ce[ut];if(!(xt&c)){var dt=$[ut],ct=xt&s,Mn=xt===ee;ft&&dt===ft._level?(ft._end=ut,ft._endsWithIsolInit=ct):lt.push(ft={_start:ut,_end:ut,_level:dt,_startsWithPDI:Mn,_endsWithIsolInit:ct})}}for(var fn=[],yt=0;yt=0;se--)if(!(ce[se]&c)){ve=$[se];break}var _e=sn[sn.length-1],Ge=$[_e],We=pe.level;if(!(ce[_e]&s)){for(var qe=_e+1;qe<=pe.end;qe++)if(!(ce[qe]&c)){We=$[qe];break}}fn.push({_seqIndices:sn,_sosType:Math.max(ve,ae)%2?M:S,_eosType:Math.max(We,Ge)%2?M:S})}}for(var Ye=0;Ye=0;at--)if(!(ce[Te[at]]&c)){Ct=ce[Te[at]];break}I(Xn,Ct&(s|ee)?N:Ct)}}if(B.get(E))for(var fr=0;fr=-1;qn--){var Vo=qn===-1?Ze:ce[Te[qn]];if(Vo&o){Vo===k&&I(Wt,P);break}}}if(B.get(k))for(var Bi=0;Bi=0&&(Mi=ce[Te[zr]],!!(Mi&c));zr--);for(var Ho=Xt+1;Ho=0&&ce[Te[Hc]]&(L|c);Hc--)I(Te[Hc],E);for(On++;On=0&&ce[Te[Wc]]&c;Wc--)I(Te[Wc],N);for(var Xc=Wo+1;Xc=0;Yo--){var Rh=Ps[Yo].char;if(Rh===vg||Rh===b(w(qo))||x(w(Rh))===qo){qc.push([Ps[Yo].seqIndex,Ls]),Ps.length=Yo;break}}}qc.sort(function(Tn,ai){return Tn[0]-ai[0]})}for(var Ph=0;Ph=0;Ih--){var wg=Te[Ih];if(ce[wg]&gg){var Sg=ce[wg]&Xo?M:S;Sg!==bt?oi=Sg:oi=bt;break}}}if(oi){if(ce[Te[Yc]]=ce[Te[Lh]]=oi,oi!==bt){for(var jo=Yc+1;jo=0;Zo--)if(ce[Te[Zo]]&c)Eg=Zo;else{Oh=ce[Te[Zo]]&Xo?M:S;break}for(var Mg=At,Ko=dr+1;Ko=0&&f(re[$c])&l;$c--)$[$c]=pe.level}}return{levels:$,paragraphs:de};function Tg(Tn,ai){for(var An=Tn;An=$&&f(re[pe])&l;pe--)de[pe]=I.level;for(var Me=I.level,we=1/0,ue=0;ueMe&&(Me=Ce),Ce=we;ze--)for(var Le=0;Le=ze){for(var Ee=Le;Le+1=ze;)Le++;Le>Ee&&B.push([Ee+$,Le+$])}}}),B}function W(re,fe,xe,ce){var Pe=ye(re,fe,xe,ce),B=[].concat(re);return Pe.forEach(function(I,$){B[$]=(fe.levels[I]&1?Q(re[I]):null)||re[I]}),B.join("")}function ye(re,fe,xe,ce){for(var Pe=K(re,fe,xe,ce),B=[],I=0;I0==d>u&&(d=u,t.value=(d-u)/s),d}function Xg(r,e,t,n,i=1/0,s,o){n=Math.max(1e-4,n);const a=2/n,c=a*s,l=1/(1+c+.48*c*c+.235*c*c*c);let u=e.x,h=e.y,f=e.z,d=r.x-u,m=r.y-h,v=r.z-f;const g=u,p=h,_=f,y=i*n,x=y*y,b=d*d+m*m+v*v;if(b>x){const V=Math.sqrt(b);d=d/V*y,m=m/V*y,v=v/V*y}u=r.x-d,h=r.y-m,f=r.z-v;const w=(t.x+a*d)*s,S=(t.y+a*m)*s,M=(t.z+a*v)*s;t.x=(t.x-a*w)*l,t.y=(t.y-a*S)*l,t.z=(t.z-a*M)*l,o.x=u+(d+w)*l,o.y=h+(m+S)*l,o.z=f+(v+M)*l;const E=g-r.x,T=p-r.y,L=_-r.z,P=o.x-g,A=o.y-p,z=o.z-_;return E*P+T*A+L*z>0&&(o.x=g,o.y=p,o.z=_,t.x=(o.x-g)/s,t.y=(o.y-p)/s,t.z=(o.z-_)/s),o}function Gh(r,e){e.set(0,0),r.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=r.length,e.y/=r.length}function Vh(r,e){return wr(r)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let yE=class{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s{},this._enabled=!0,this._state=oe.NONE,this._viewport=null,this._changedDolly=0,this._changedZoom=0,this._hasRested=!0,this._boundaryEnclosesCamera=!1,this._needsUpdate=!0,this._updatedLastTime=!1,this._elementRect=new DOMRect,this._isDragging=!1,this._dragNeedsUpdate=!0,this._activePointers=[],this._lockedPointer=null,this._interactiveArea=new DOMRect(0,0,1,1),this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._isUserControllingOffset=!1,this._isUserControllingZoom=!1,this._lastDollyDirection=Os.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new $e.Vector3,this._focalOffsetVelocity=new $e.Vector3,this._zoomVelocity={value:0},this._truckInternal=(p,_,y,x)=>{let b,w;if(Br(this._camera)){const S=it.copy(this._camera.position).sub(this._target),M=this._camera.getEffectiveFOV()*ra,E=S.length()*Math.tan(M*.5);b=this.truckSpeed*p*E/this._elementRect.height,w=this.truckSpeed*_*E/this._elementRect.height}else if(wr(this._camera)){const S=this._camera;b=this.truckSpeed*p*(S.right-S.left)/S.zoom/this._elementRect.width,w=this.truckSpeed*_*(S.top-S.bottom)/S.zoom/this._elementRect.height}else return;x?(y?this.setFocalOffset(this._focalOffsetEnd.x+b,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(b,0,!0),this.forward(-w,!0)):y?this.setFocalOffset(this._focalOffsetEnd.x+b,this._focalOffsetEnd.y+w,this._focalOffsetEnd.z,!0):this.truck(b,w,!0)},this._rotateInternal=(p,_)=>{const y=Ns*this.azimuthRotateSpeed*p/this._elementRect.height,x=Ns*this.polarRotateSpeed*_/this._elementRect.height;this.rotate(y,x,!0)},this._dollyInternal=(p,_,y)=>{const x=Math.pow(.95,-p*this.dollySpeed),b=this._sphericalEnd.radius,w=this._sphericalEnd.radius*x,S=pi(w,this.minDistance,this.maxDistance),M=S-w;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(w,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(M,!0),this._dollyToNoClamp(S,!0)):this._dollyToNoClamp(S,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?w:S)-b,this._dollyControlCoord.set(_,y)),this._lastDollyDirection=Math.sign(-p)},this._zoomInternal=(p,_,y)=>{const x=Math.pow(.95,p*this.dollySpeed),b=this._zoom,w=this._zoom*x;this.zoomTo(w,!0),this.dollyToCursor&&(this._changedZoom+=w-b,this._dollyControlCoord.set(_,y))},typeof $e>"u"&&console.error("camera-controls: `THREE` is undefined. You must first run `CameraControls.install( { THREE: THREE } )`. Check the docs for further information."),this._camera=e,this._yAxisUpSpace=new $e.Quaternion().setFromUnitVectors(this._camera.up,tl),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=oe.NONE,this._target=new $e.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new $e.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new $e.Spherical().setFromVector3(it.copy(this._camera.position).applyQuaternion(this._yAxisUpSpace)),this._sphericalEnd=this._spherical.clone(),this._lastDistance=this._spherical.radius,this._zoom=this._camera.zoom,this._zoomEnd=this._zoom,this._lastZoom=this._zoom,this._nearPlaneCorners=[new $e.Vector3,new $e.Vector3,new $e.Vector3,new $e.Vector3],this._updateNearPlaneCorners(),this._boundary=new $e.Box3(new $e.Vector3(-1/0,-1/0,-1/0),new $e.Vector3(1/0,1/0,1/0)),this._cameraUp0=this._camera.up.clone(),this._target0=this._target.clone(),this._position0=this._camera.position.clone(),this._zoom0=this._zoom,this._focalOffset0=this._focalOffset.clone(),this._dollyControlCoord=new $e.Vector2,this.mouseButtons={left:oe.ROTATE,middle:oe.DOLLY,right:oe.TRUCK,wheel:Br(this._camera)?oe.DOLLY:wr(this._camera)?oe.ZOOM:oe.NONE},this.touches={one:oe.TOUCH_ROTATE,two:Br(this._camera)?oe.TOUCH_DOLLY_TRUCK:wr(this._camera)?oe.TOUCH_ZOOM_TRUCK:oe.NONE,three:oe.TOUCH_TRUCK};const n=new $e.Vector2,i=new $e.Vector2,s=new $e.Vector2,o=p=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const x=this._domElement.getBoundingClientRect(),b=p.clientX/x.width,w=p.clientY/x.height;if(bthis._interactiveArea.right||wthis._interactiveArea.bottom)return}const _=p.pointerType!=="mouse"?null:(p.buttons&Lt.LEFT)===Lt.LEFT?Lt.LEFT:(p.buttons&Lt.MIDDLE)===Lt.MIDDLE?Lt.MIDDLE:(p.buttons&Lt.RIGHT)===Lt.RIGHT?Lt.RIGHT:null;if(_!==null){const x=this._findPointerByMouseButton(_);x&&this._disposePointer(x)}if((p.buttons&Lt.LEFT)===Lt.LEFT&&this._lockedPointer)return;const y={pointerId:p.pointerId,clientX:p.clientX,clientY:p.clientY,deltaX:0,deltaY:0,mouseButton:_};this._activePointers.push(y),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),this._isDragging=!0,f(p)},a=p=>{p.cancelable&&p.preventDefault();const _=p.pointerId,y=this._lockedPointer||this._findPointerById(_);if(y){if(y.clientX=p.clientX,y.clientY=p.clientY,y.deltaX=p.movementX,y.deltaY=p.movementY,this._state=0,p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else(!this._isDragging&&this._lockedPointer||this._isDragging&&(p.buttons&Lt.LEFT)===Lt.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(p.buttons&Lt.MIDDLE)===Lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(p.buttons&Lt.RIGHT)===Lt.RIGHT&&(this._state=this._state|this.mouseButtons.right);d()}},c=p=>{const _=this._findPointerById(p.pointerId);if(!(_&&_===this._lockedPointer)){if(_&&this._disposePointer(_),p.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=oe.NONE;break;case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else this._state=oe.NONE;m()}};let l=-1;const u=p=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===oe.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const w=this._domElement.getBoundingClientRect(),S=p.clientX/w.width,M=p.clientY/w.height;if(Sthis._interactiveArea.right||Mthis._interactiveArea.bottom)return}if(p.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===oe.ROTATE||this.mouseButtons.wheel===oe.TRUCK){const w=performance.now();l-w<1e3&&this._getClientRect(this._elementRect),l=w}const _=bE?-1:-3,y=p.deltaMode===1||p.ctrlKey?p.deltaY/_:p.deltaY/(_*10),x=this.dollyToCursor?(p.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(p.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case oe.ROTATE:{this._rotateInternal(p.deltaX,p.deltaY),this._isUserControllingRotate=!0;break}case oe.TRUCK:{this._truckInternal(p.deltaX,p.deltaY,!1,!1),this._isUserControllingTruck=!0;break}case oe.SCREEN_PAN:{this._truckInternal(p.deltaX,p.deltaY,!1,!0),this._isUserControllingTruck=!0;break}case oe.OFFSET:{this._truckInternal(p.deltaX,p.deltaY,!0,!1),this._isUserControllingOffset=!0;break}case oe.DOLLY:{this._dollyInternal(-y,x,b),this._isUserControllingDolly=!0;break}case oe.ZOOM:{this._zoomInternal(-y,x,b),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},h=p=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===Dd.ACTION.NONE){const _=p instanceof PointerEvent?p.pointerId:0,y=this._findPointerById(_);y&&this._disposePointer(y),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c);return}p.preventDefault()}},f=p=>{if(!this._enabled)return;if(Gh(this._activePointers,Cn),this._getClientRect(this._elementRect),n.copy(Cn),i.copy(Cn),this._activePointers.length>=2){const y=Cn.x-this._activePointers[1].clientX,x=Cn.y-this._activePointers[1].clientY,b=Math.sqrt(y*y+x*x);s.set(0,b);const w=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,S=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;i.set(w,S)}if(this._state=0,!p)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in p&&p.pointerType==="touch")switch(this._activePointers.length){case 1:this._state=this.touches.one;break;case 2:this._state=this.touches.two;break;case 3:this._state=this.touches.three;break}else!this._lockedPointer&&(p.buttons&Lt.LEFT)===Lt.LEFT&&(this._state=this._state|this.mouseButtons.left),(p.buttons&Lt.MIDDLE)===Lt.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(p.buttons&Lt.RIGHT)===Lt.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&oe.ROTATE)===oe.ROTATE||(this._state&oe.TOUCH_ROTATE)===oe.TOUCH_ROTATE||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE||(this._state&oe.TOUCH_ZOOM_ROTATE)===oe.TOUCH_ZOOM_ROTATE)&&(this._sphericalEnd.theta=this._spherical.theta,this._sphericalEnd.phi=this._spherical.phi,this._thetaVelocity.value=0,this._phiVelocity.value=0),((this._state&oe.TRUCK)===oe.TRUCK||(this._state&oe.SCREEN_PAN)===oe.SCREEN_PAN||(this._state&oe.TOUCH_TRUCK)===oe.TOUCH_TRUCK||(this._state&oe.TOUCH_SCREEN_PAN)===oe.TOUCH_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_ZOOM_TRUCK)===oe.TOUCH_ZOOM_TRUCK||(this._state&oe.TOUCH_ZOOM_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&oe.DOLLY)===oe.DOLLY||(this._state&oe.TOUCH_DOLLY)===oe.TOUCH_DOLLY||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&oe.ZOOM)===oe.ZOOM||(this._state&oe.TOUCH_ZOOM)===oe.TOUCH_ZOOM||(this._state&oe.TOUCH_ZOOM_TRUCK)===oe.TOUCH_ZOOM_TRUCK||(this._state&oe.TOUCH_ZOOM_SCREEN_PAN)===oe.TOUCH_ZOOM_SCREEN_PAN||(this._state&oe.TOUCH_ZOOM_OFFSET)===oe.TOUCH_ZOOM_OFFSET||(this._state&oe.TOUCH_ZOOM_ROTATE)===oe.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&oe.OFFSET)===oe.OFFSET||(this._state&oe.TOUCH_OFFSET)===oe.TOUCH_OFFSET||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET||(this._state&oe.TOUCH_ZOOM_OFFSET)===oe.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},d=()=>{if(!this._enabled||!this._dragNeedsUpdate)return;this._dragNeedsUpdate=!1,Gh(this._activePointers,Cn);const _=this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,y=_?-_.deltaX:i.x-Cn.x,x=_?-_.deltaY:i.y-Cn.y;if(i.copy(Cn),((this._state&oe.ROTATE)===oe.ROTATE||(this._state&oe.TOUCH_ROTATE)===oe.TOUCH_ROTATE||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE||(this._state&oe.TOUCH_ZOOM_ROTATE)===oe.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(y,x),this._isUserControllingRotate=!0),(this._state&oe.DOLLY)===oe.DOLLY||(this._state&oe.ZOOM)===oe.ZOOM){const b=this.dollyToCursor?(n.x-this._elementRect.x)/this._elementRect.width*2-1:0,w=this.dollyToCursor?(n.y-this._elementRect.y)/this._elementRect.height*-2+1:0,S=this.dollyDragInverted?-1:1;(this._state&oe.DOLLY)===oe.DOLLY?(this._dollyInternal(S*x*el,b,w),this._isUserControllingDolly=!0):(this._zoomInternal(S*x*el,b,w),this._isUserControllingZoom=!0)}if((this._state&oe.TOUCH_DOLLY)===oe.TOUCH_DOLLY||(this._state&oe.TOUCH_ZOOM)===oe.TOUCH_ZOOM||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_ZOOM_TRUCK)===oe.TOUCH_ZOOM_TRUCK||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_ZOOM_SCREEN_PAN)===oe.TOUCH_ZOOM_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET||(this._state&oe.TOUCH_ZOOM_OFFSET)===oe.TOUCH_ZOOM_OFFSET||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE||(this._state&oe.TOUCH_ZOOM_ROTATE)===oe.TOUCH_ZOOM_ROTATE){const b=Cn.x-this._activePointers[1].clientX,w=Cn.y-this._activePointers[1].clientY,S=Math.sqrt(b*b+w*w),M=s.y-S;s.set(0,S);const E=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,T=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&oe.TOUCH_DOLLY)===oe.TOUCH_DOLLY||(this._state&oe.TOUCH_DOLLY_ROTATE)===oe.TOUCH_DOLLY_ROTATE||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET?(this._dollyInternal(M*el,E,T),this._isUserControllingDolly=!0):(this._zoomInternal(M*el,E,T),this._isUserControllingZoom=!0)}((this._state&oe.TRUCK)===oe.TRUCK||(this._state&oe.TOUCH_TRUCK)===oe.TOUCH_TRUCK||(this._state&oe.TOUCH_DOLLY_TRUCK)===oe.TOUCH_DOLLY_TRUCK||(this._state&oe.TOUCH_ZOOM_TRUCK)===oe.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(y,x,!1,!1),this._isUserControllingTruck=!0),((this._state&oe.SCREEN_PAN)===oe.SCREEN_PAN||(this._state&oe.TOUCH_SCREEN_PAN)===oe.TOUCH_SCREEN_PAN||(this._state&oe.TOUCH_DOLLY_SCREEN_PAN)===oe.TOUCH_DOLLY_SCREEN_PAN||(this._state&oe.TOUCH_ZOOM_SCREEN_PAN)===oe.TOUCH_ZOOM_SCREEN_PAN)&&(this._truckInternal(y,x,!1,!0),this._isUserControllingTruck=!0),((this._state&oe.OFFSET)===oe.OFFSET||(this._state&oe.TOUCH_OFFSET)===oe.TOUCH_OFFSET||(this._state&oe.TOUCH_DOLLY_OFFSET)===oe.TOUCH_DOLLY_OFFSET||(this._state&oe.TOUCH_ZOOM_OFFSET)===oe.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(y,x,!0,!1),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},m=()=>{Gh(this._activePointers,Cn),i.copy(Cn),this._dragNeedsUpdate=!1,(this._activePointers.length===0||this._activePointers.length===1&&this._activePointers[0]===this._lockedPointer)&&(this._isDragging=!1),this._activePointers.length===0&&this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this.dispatchEvent({type:"controlend"}))};this.lockPointer=()=>{!this._enabled||!this._domElement||(this.cancel(),this._lockedPointer={pointerId:-1,clientX:0,clientY:0,deltaX:0,deltaY:0,mouseButton:null},this._activePointers.push(this._lockedPointer),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",v),this._domElement.ownerDocument.addEventListener("pointerlockerror",g),this._domElement.ownerDocument.addEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",c),f())},this.unlockPointer=()=>{var p,_,y;this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),(p=this._domElement)===null||p===void 0||p.ownerDocument.exitPointerLock(),(_=this._domElement)===null||_===void 0||_.ownerDocument.removeEventListener("pointerlockchange",v),(y=this._domElement)===null||y===void 0||y.ownerDocument.removeEventListener("pointerlockerror",g),this.cancel()};const v=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},g=()=>{this.unlockPointer()};this._addAllEventListeners=p=>{this._domElement=p,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",o),this._domElement.addEventListener("pointercancel",c),this._domElement.addEventListener("wheel",u,{passive:!1}),this._domElement.addEventListener("contextmenu",h)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",o),this._domElement.removeEventListener("pointercancel",c),this._domElement.removeEventListener("wheel",u,{passive:!1}),this._domElement.removeEventListener("contextmenu",h),this._domElement.ownerDocument.removeEventListener("pointermove",a,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",c),this._domElement.ownerDocument.removeEventListener("pointerlockchange",v),this._domElement.ownerDocument.removeEventListener("pointerlockerror",g))},this.cancel=()=>{this._state!==oe.NONE&&(this._state=oe.NONE,this._activePointers.length=0,m())},t&&this.connect(t),this.update(0)}get camera(){return this._camera}set camera(e){this._camera=e,this.updateCameraUp(),this._camera.updateProjectionMatrix(),this._updateNearPlaneCorners(),this._needsUpdate=!0}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this._domElement&&(e?(this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none"):(this.cancel(),this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect=""))}get active(){return!this._hasRested}get currentAction(){return this._state}get distance(){return this._spherical.radius}set distance(e){this._spherical.radius===e&&this._sphericalEnd.radius===e||(this._spherical.radius=e,this._sphericalEnd.radius=e,this._needsUpdate=!0)}get azimuthAngle(){return this._spherical.theta}set azimuthAngle(e){this._spherical.theta===e&&this._sphericalEnd.theta===e||(this._spherical.theta=e,this._sphericalEnd.theta=e,this._needsUpdate=!0)}get polarAngle(){return this._spherical.phi}set polarAngle(e){this._spherical.phi===e&&this._sphericalEnd.phi===e||(this._spherical.phi=e,this._sphericalEnd.phi=e,this._needsUpdate=!0)}get boundaryEnclosesCamera(){return this._boundaryEnclosesCamera}set boundaryEnclosesCamera(e){this._boundaryEnclosesCamera=e,this._needsUpdate=!0}set interactiveArea(e){this._interactiveArea.width=pi(e.width,0,1),this._interactiveArea.height=pi(e.height,0,1),this._interactiveArea.x=pi(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=pi(e.y,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,n=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,n)}rotateAzimuthTo(e,t=!1){return this.rotateTo(e,this._sphericalEnd.phi,t)}rotatePolarTo(e,t=!1){return this.rotateTo(this._sphericalEnd.theta,e,t)}rotateTo(e,t,n=!1){this._isUserControllingRotate=!1;const i=pi(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=pi(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=i,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,n||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const o=!n||vt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&vt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(o)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Os.NONE,this._changedDolly=0,this._dollyToNoClamp(pi(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const n=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const o=this._collisionTest(),a=vt(o,this._spherical.radius);if(!(n>e)&&a)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,o)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||vt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(aa).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const n=!t||vt(this._target.x,this._targetEnd.x,this.restThreshold)&&vt(this._target.y,this._targetEnd.y,this.restThreshold)&&vt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(n)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=pi(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const n=!t||vt(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(n)}pan(e,t,n=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,n)}truck(e,t,n=!1){this._camera.updateMatrix(),Ai.setFromMatrixColumn(this._camera.matrix,0),Ci.setFromMatrixColumn(this._camera.matrix,1),Ai.multiplyScalar(e),Ci.multiplyScalar(-t);const i=it.copy(Ai).add(Ci),s=pt.copy(this._targetEnd).add(i);return this.moveTo(s.x,s.y,s.z,n)}forward(e,t=!1){it.setFromMatrixColumn(this._camera.matrix,0),it.crossVectors(this._camera.up,it),it.multiplyScalar(e);const n=pt.copy(this._targetEnd).add(it);return this.moveTo(n.x,n.y,n.z,t)}elevate(e,t=!1){return it.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+it.x,this._targetEnd.y+it.y,this._targetEnd.z+it.z,t)}moveTo(e,t,n,i=!1){this._isUserControllingTruck=!1;const s=it.set(e,t,n).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,i||this._target.copy(this._targetEnd);const o=!i||vt(this._target.x,this._targetEnd.x,this.restThreshold)&&vt(this._target.y,this._targetEnd.y,this.restThreshold)&&vt(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(o)}lookInDirectionOf(e,t,n,i=!1){const a=it.set(e,t,n).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius).add(this._targetEnd);return this.setPosition(a.x,a.y,a.z,i)}fitToBox(e,t,{cover:n=!1,paddingLeft:i=0,paddingRight:s=0,paddingBottom:o=0,paddingTop:a=0}={}){const c=[],l=e.isBox3?ks.copy(e):ks.setFromObject(e);l.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=Wg(this._sphericalEnd.theta,Hg),h=Wg(this._sphericalEnd.phi,Hg);c.push(this.rotateTo(u,h,t));const f=it.setFromSpherical(this._sphericalEnd).normalize(),d=Zg.setFromUnitVectors(f,Wh),m=vt(Math.abs(f.y),1);m&&d.multiply(qh.setFromAxisAngle(tl,u)),d.multiply(this._yAxisUpSpaceInverse);const v=$g.makeEmpty();pt.copy(l.min).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.min).setX(l.max.x).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.min).setY(l.max.y).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.max).setZ(l.min.z).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.min).setZ(l.max.z).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.max).setY(l.min.y).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.max).setX(l.min.x).applyQuaternion(d),v.expandByPoint(pt),pt.copy(l.max).applyQuaternion(d),v.expandByPoint(pt),v.min.x-=i,v.min.y-=o,v.max.x+=s,v.max.y+=a,d.setFromUnitVectors(Wh,f),m&&d.premultiply(qh.invert()),d.premultiply(this._yAxisUpSpace);const g=v.getSize(it),p=v.getCenter(pt).applyQuaternion(d);if(Br(this._camera)){const _=this.getDistanceToFitBox(g.x,g.y,g.z,n);c.push(this.moveTo(p.x,p.y,p.z,t)),c.push(this.dollyTo(_,t)),c.push(this.setFocalOffset(0,0,0,t))}else if(wr(this._camera)){const _=this._camera,y=_.right-_.left,x=_.top-_.bottom,b=n?Math.max(y/g.x,x/g.y):Math.min(y/g.x,x/g.y);c.push(this.moveTo(p.x,p.y,p.z,t)),c.push(this.zoomTo(b,t)),c.push(this.setFocalOffset(0,0,0,t))}return Promise.all(c)}fitToSphere(e,t){const n=[],s="isObject3D"in e?Dd.createBoundingSphere(e,Xh):Xh.copy(e);if(n.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),Br(this._camera)){const o=this.getDistanceToFitSphere(s.radius);n.push(this.dollyTo(o,t))}else if(wr(this._camera)){const o=this._camera.right-this._camera.left,a=this._camera.top-this._camera.bottom,c=2*s.radius,l=Math.min(o/c,a/c);n.push(this.zoomTo(l,t))}return n.push(this.setFocalOffset(0,0,0,t)),Promise.all(n)}setLookAt(e,t,n,i,s,o,a=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Os.NONE,this._changedDolly=0;const c=pt.set(i,s,o),l=it.set(e,t,n);this._targetEnd.copy(c),this._sphericalEnd.setFromVector3(l.sub(c).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,a||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!a||vt(this._target.x,this._targetEnd.x,this.restThreshold)&&vt(this._target.y,this._targetEnd.y,this.restThreshold)&&vt(this._target.z,this._targetEnd.z,this.restThreshold)&&vt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&vt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&vt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,n,i,s,o,a,c,l,u,h,f,d,m=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Os.NONE,this._changedDolly=0;const v=it.set(i,s,o),g=pt.set(e,t,n);Yn.setFromVector3(g.sub(v).applyQuaternion(this._yAxisUpSpace));const p=Fs.set(u,h,f),_=pt.set(a,c,l);ca.setFromVector3(_.sub(p).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(v.lerp(p,d));const y=ca.theta-Yn.theta,x=ca.phi-Yn.phi,b=ca.radius-Yn.radius;this._sphericalEnd.set(Yn.radius+b*d,Yn.phi+x*d,Yn.theta+y*d),this.normalizeRotations(),this._needsUpdate=!0,m||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const w=!m||vt(this._target.x,this._targetEnd.x,this.restThreshold)&&vt(this._target.y,this._targetEnd.y,this.restThreshold)&&vt(this._target.z,this._targetEnd.z,this.restThreshold)&&vt(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&vt(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&vt(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(w)}setPosition(e,t,n,i=!1){return this.setLookAt(e,t,n,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,i)}setTarget(e,t,n,i=!1){const s=this.getPosition(it),o=this.setLookAt(s.x,s.y,s.z,e,t,n,i);return this._sphericalEnd.phi=pi(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),o}setFocalOffset(e,t,n,i=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,n),this._needsUpdate=!0,i||this._focalOffset.copy(this._focalOffsetEnd);const s=!i||vt(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&vt(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&vt(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,n){this._camera.updateMatrixWorld(),Ai.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Ci.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Gr.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const i=it.set(e,t,n),s=i.distanceTo(this._camera.position),o=i.sub(this._camera.position);Ai.multiplyScalar(o.x),Ci.multiplyScalar(o.y),Gr.multiplyScalar(o.z),it.copy(Ai).add(Ci).add(Gr),it.z=it.z+s,this.dollyTo(s,!1),this.setFocalOffset(-it.x,it.y,-it.z,!1),this.moveTo(e,t,n,!1)}setBoundary(e){if(!e){this._boundary.min.set(-1/0,-1/0,-1/0),this._boundary.max.set(1/0,1/0,1/0),this._needsUpdate=!0;return}this._boundary.copy(e),this._boundary.clampPoint(this._targetEnd,this._targetEnd),this._needsUpdate=!0}setViewport(e,t,n,i){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new $e.Vector4,typeof e=="number"?this._viewport.set(e,t,n,i):this._viewport.copy(e)}getDistanceToFitBox(e,t,n,i=!1){if(Vh(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,o=this._camera.getEffectiveFOV()*ra,a=this._camera.aspect;return((i?s>a:st.pointerId===e)}_findPointerByMouseButton(e){return this._activePointers.find(t=>t.mouseButton===e)}_disposePointer(e){this._activePointers.splice(this._activePointers.indexOf(e),1)}_encloseToBoundary(e,t,n){const i=t.lengthSq();if(i===0)return e;const s=pt.copy(t).add(e),a=this._boundary.clampPoint(s,Fs).sub(s),c=a.lengthSq();if(c===0)return e.add(t);if(c===i)return e;if(n===0)return e.add(t).add(a);{const l=1+n*c/t.dot(a);return e.add(pt.copy(t).multiplyScalar(l)).add(a.multiplyScalar(1-n))}}_updateNearPlaneCorners(){if(Br(this._camera)){const e=this._camera,t=e.near,n=e.getEffectiveFOV()*ra,i=Math.tan(n*.5)*t,s=i*e.aspect;this._nearPlaneCorners[0].set(-s,-i,0),this._nearPlaneCorners[1].set(s,-i,0),this._nearPlaneCorners[2].set(s,i,0),this._nearPlaneCorners[3].set(-s,i,0)}else if(wr(this._camera)){const e=this._camera,t=1/e.zoom,n=e.left*t,i=e.right*t,s=e.top*t,o=e.bottom*t;this._nearPlaneCorners[0].set(n,s,0),this._nearPlaneCorners[1].set(i,s,0),this._nearPlaneCorners[2].set(i,o,0),this._nearPlaneCorners[3].set(n,o,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||Vh(this._camera,"_collisionTest"))return e;const n=this._getTargetDirection(aa);Yh.lookAt(qg,n,this._camera.up);for(let i=0;i<4;i++){const s=pt.copy(this._nearPlaneCorners[i]);s.applyMatrix4(Yh);const o=Fs.addVectors(this._target,s);nl.set(o,n),nl.far=this._spherical.radius+1;const a=nl.intersectObjects(this.colliderMeshes);a.length!==0&&a[0].distance{const n=()=>{this.removeEventListener("rest",n),t()};this.addEventListener("rest",n)}))}_addAllEventListeners(e){}_removeAllEventListeners(){}get dampingFactor(){return console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead."),0}set dampingFactor(e){console.warn(".dampingFactor has been deprecated. use smoothTime (in seconds) instead.")}get draggingDampingFactor(){return console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead."),0}set draggingDampingFactor(e){console.warn(".draggingDampingFactor has been deprecated. use draggingSmoothTime (in seconds) instead.")}static createBoundingSphere(e,t=new $e.Sphere){const n=t,i=n.center;ks.makeEmpty(),e.traverseVisible(o=>{o.isMesh&&ks.expandByObject(o)}),ks.getCenter(i);let s=0;return e.traverseVisible(o=>{if(!o.isMesh)return;const a=o;if(!a.geometry)return;const c=a.geometry.clone();c.applyMatrix4(a.matrixWorld);const u=c.attributes.position;for(let h=0,f=u.count;h{let e;const t=new Set,n=(c,l)=>{const u=typeof c=="function"?c(e):c;if(!Object.is(u,e)){const h=e;e=l??typeof u!="object"?u:Object.assign({},e,u),t.forEach(f=>f(e,h))}},i=()=>e,a={setState:n,getState:i,subscribe:c=>(t.add(c),()=>t.delete(c)),destroy:()=>{(wE?"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()}};return e=r(n,i,a),a},SE=r=>r?Kg(r):Kg;var jh={exports:{}},$h={},Zh={exports:{}},Kh={};/** + * @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 Jg;function EE(){if(Jg)return Kh;Jg=1;var r=Iy();function e(h,f){return h===f&&(h!==0||1/h===1/f)||h!==h&&f!==f}var t=typeof Object.is=="function"?Object.is:e,n=r.useState,i=r.useEffect,s=r.useLayoutEffect,o=r.useDebugValue;function a(h,f){var d=f(),m=n({inst:{value:d,getSnapshot:f}}),v=m[0].inst,g=m[1];return s(function(){v.value=d,v.getSnapshot=f,c(v)&&g({inst:v})},[h,d,f]),i(function(){return c(v)&&g({inst:v}),h(function(){c(v)&&g({inst:v})})},[h]),o(d),d}function c(h){var f=h.getSnapshot;h=h.value;try{var d=f();return!t(h,d)}catch{return!0}}function l(h,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return Kh.useSyncExternalStore=r.useSyncExternalStore!==void 0?r.useSyncExternalStore:u,Kh}var Qg;function ME(){return Qg||(Qg=1,Zh.exports=EE()),Zh.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 e0;function TE(){if(e0)return $h;e0=1;var r=Iy(),e=ME();function t(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var n=typeof Object.is=="function"?Object.is:t,i=e.useSyncExternalStore,s=r.useRef,o=r.useEffect,a=r.useMemo,c=r.useDebugValue;return $h.useSyncExternalStoreWithSelector=function(l,u,h,f,d){var m=s(null);if(m.current===null){var v={hasValue:!1,value:null};m.current=v}else v=m.current;m=a(function(){function p(w){if(!_){if(_=!0,y=w,w=f(w),d!==void 0&&v.hasValue){var S=v.value;if(d(S,w))return x=S}return x=w}if(S=x,n(y,w))return S;var M=f(w);return d!==void 0&&d(S,M)?S:(y=w,x=M)}var _=!1,y,x,b=h===void 0?null:h;return[function(){return p(u())},b===null?void 0:function(){return p(b())}]},[u,h,f,d]);var g=i(l,m[0],m[1]);return o(function(){v.hasValue=!0,v.value=g},[g]),c(g),g},$h}var t0;function AE(){return t0||(t0=1,jh.exports=TE()),jh.exports}var CE=AE();const RE=ki(CE),PE={},{useSyncExternalStoreWithSelector:LE}=RE;function Xy(r,e=r.getState,t){const n=LE(r.subscribe,r.getState,r.getServerState||r.getState,e,t);return q.useDebugValue(n),n}const n0=r=>{(PE?"production":void 0)!=="production"&&typeof r!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof r=="function"?SE(r):r,t=(n,i)=>Xy(e,n,i);return Object.assign(t,e),t},DE=r=>r?n0(r):n0;/** + * @license + * Copyright 2010-2023 Three.js Authors + * SPDX-License-Identifier: MIT + */const Iu="154",qy={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},IE={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Yy=0,Id=1,jy=2,UE=3,$y=0,Uu=1,za=2,mi=3,Oi=0,vn=1,Dt=2,OE=2,nr=0,ls=1,Ud=2,Od=3,Nd=4,Zy=5,ns=100,Ky=101,Jy=102,Fd=103,kd=104,Qy=200,ex=201,tx=202,nx=203,Vp=204,Hp=205,ix=206,rx=207,sx=208,ox=209,ax=210,cx=0,lx=1,ux=2,vu=3,hx=4,fx=5,dx=6,px=7,Rc=0,mx=1,gx=2,yi=0,vx=1,_x=2,yx=3,Wp=4,xx=5,Ou=300,Pr=301,Lr=302,Ka=303,Ja=304,Oo=306,Qa=1e3,gn=1001,ec=1002,Yt=1003,_u=1004,NE=1004,Ba=1005,FE=1005,Pt=1006,Xp=1007,kE=1007,Dr=1008,zE=1008,Ii=1009,bx=1010,wx=1011,Nu=1012,qp=1013,tr=1014,Li=1015,Ao=1016,Yp=1017,jp=1018,Mr=1020,Sx=1021,Ln=1023,Ex=1024,Mx=1025,Tr=1026,ms=1027,Tx=1028,$p=1029,Ax=1030,Zp=1031,Kp=1033,iu=33776,ru=33777,su=33778,ou=33779,zd=35840,Bd=35841,Gd=35842,Vd=35843,Cx=36196,Hd=37492,Wd=37496,Xd=37808,qd=37809,Yd=37810,jd=37811,$d=37812,Zd=37813,Kd=37814,Jd=37815,Qd=37816,ep=37817,tp=37818,np=37819,ip=37820,rp=37821,au=36492,Rx=36283,sp=36284,op=36285,ap=36286,Px=2200,Lx=2201,Dx=2202,tc=2300,nc=2301,cu=2302,ss=2400,os=2401,ic=2402,Fu=2500,Jp=2501,BE=0,GE=1,VE=2,Qp=3e3,Ar=3001,Ix=3200,em=3201,Or=0,Ux=1,Cr="",et="srgb",xi="srgb-linear",tm="display-p3",HE=0,lu=7680,WE=7681,XE=7682,qE=7683,YE=34055,jE=34056,$E=5386,ZE=512,KE=513,JE=514,QE=515,eM=516,tM=517,nM=518,Ox=519,Nx=512,Fx=513,kx=514,zx=515,Bx=516,Gx=517,Vx=518,Hx=519,rc=35044,iM=35048,rM=35040,sM=35045,oM=35049,aM=35041,cM=35046,lM=35050,uM=35042,hM="100",cp="300 es",yu=1035,Di=2e3,sc=2001;let ar=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[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 n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s>8&255]+pn[r>>16&255]+pn[r>>24&255]+"-"+pn[e&255]+pn[e>>8&255]+"-"+pn[e>>16&15|64]+pn[e>>24&255]+"-"+pn[t&63|128]+pn[t>>8&255]+"-"+pn[t>>16&255]+pn[t>>24&255]+pn[n&255]+pn[n>>8&255]+pn[n>>16&255]+pn[n>>24&255]).toLowerCase()}function Bt(r,e,t){return Math.max(e,Math.min(t,r))}function nm(r,e){return(r%e+e)%e}function fM(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function dM(r,e,t){return r!==e?(t-r)/(e-r):0}function Ga(r,e,t){return(1-t)*r+t*e}function pM(r,e,t,n){return Ga(r,e,1-Math.exp(-t*n))}function mM(r,e=1){return e-Math.abs(nm(r,e*2)-e)}function gM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function vM(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function _M(r,e){return r+Math.floor(Math.random()*(e-r+1))}function yM(r,e){return r+Math.random()*(e-r)}function xM(r){return r*(.5-Math.random())}function bM(r){r!==void 0&&(i0=r);let e=i0+=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 wM(r){return r*us}function SM(r){return r*Co}function lp(r){return(r&r-1)===0&&r!==0}function Wx(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function xu(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function EM(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),c=o(t/2),l=s((e+n)/2),u=o((e+n)/2),h=s((e-n)/2),f=o((e-n)/2),d=s((n-e)/2),m=o((n-e)/2);switch(i){case"XYX":r.set(a*u,c*h,c*f,a*l);break;case"YZY":r.set(c*f,a*u,c*h,a*l);break;case"ZXZ":r.set(c*h,c*f,a*u,a*l);break;case"XZX":r.set(a*u,c*m,c*d,a*l);break;case"YXY":r.set(c*d,a*u,c*m,a*l);break;case"ZYZ":r.set(c*m,c*d,a*u,a*l);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function zn(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function ot(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const bu={DEG2RAD:us,RAD2DEG:Co,generateUUID:Bn,clamp:Bt,euclideanModulo:nm,mapLinear:fM,inverseLerp:dM,lerp:Ga,damp:pM,pingpong:mM,smoothstep:gM,smootherstep:vM,randInt:_M,randFloat:yM,randFloatSpread:xM,seededRandom:bM,degToRad:wM,radToDeg:SM,isPowerOfTwo:lp,ceilPowerOfTwo:Wx,floorPowerOfTwo:xu,setQuaternionFromProperEuler:EM,normalize:ot,denormalize:zn};class be{constructor(e=0,t=0){be.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,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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 n=this.dot(e)/t;return Math.acos(Bt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,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 n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class rt{constructor(e,t,n,i,s,o,a,c,l){rt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,o,a,c,l)}set(e,t,n,i,s,o,a,c,l){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=c,u[6]=n,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.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 n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[3],c=n[6],l=n[1],u=n[4],h=n[7],f=n[2],d=n[5],m=n[8],v=i[0],g=i[3],p=i[6],_=i[1],y=i[4],x=i[7],b=i[2],w=i[5],S=i[8];return s[0]=o*v+a*_+c*b,s[3]=o*g+a*y+c*w,s[6]=o*p+a*x+c*S,s[1]=l*v+u*_+h*b,s[4]=l*g+u*y+h*w,s[7]=l*p+u*x+h*S,s[2]=f*v+d*_+m*b,s[5]=f*g+d*y+m*w,s[8]=f*p+d*x+m*S,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],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return t*o*u-t*a*l-n*s*u+n*a*c+i*s*l-i*o*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,f=a*c-u*s,d=l*s-o*c,m=t*h+n*f+i*d;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/m;return e[0]=h*v,e[1]=(i*l-u*n)*v,e[2]=(a*n-i*o)*v,e[3]=f*v,e[4]=(u*t-i*c)*v,e[5]=(i*s-a*t)*v,e[6]=d*v,e[7]=(n*c-l*t)*v,e[8]=(o*t-n*s)*v,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,n,i,s,o,a){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*o+l*a)+o+e,-i*l,i*c,-i*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Jh.makeScale(e,t)),this}rotate(e){return this.premultiply(Jh.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jh.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),n=Math.sin(e);return this.set(t,-n,0,n,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,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Jh=new rt;function Xx(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}const MM={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function vo(r,e){return new MM[r](e)}function oc(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}const r0={};function Va(r){r in r0||(r0[r]=!0,console.warn(r))}function wo(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Qh(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}const TM=new rt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),AM=new rt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function CM(r){return r.convertSRGBToLinear().applyMatrix3(AM)}function RM(r){return r.applyMatrix3(TM).convertLinearToSRGB()}const PM={[xi]:r=>r,[et]:r=>r.convertSRGBToLinear(),[tm]:CM},LM={[xi]:r=>r,[et]:r=>r.convertLinearToSRGB(),[tm]:RM},Zn={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return xi},set workingColorSpace(r){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=PM[e],i=LM[t];if(n===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)}};let zs;class im{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{zs===void 0&&(zs=oc("canvas")),zs.width=e.width,zs.height=e.height;const n=zs.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=zs}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=oc("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ou)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Qa:e.x=e.x-Math.floor(e.x);break;case gn:e.x=e.x<0?0:1;break;case ec: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 Qa:e.y=e.y-Math.floor(e.y);break;case gn:e.y=e.y<0?0:1;break;case ec: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 Va("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===et?Ar:Qp}set encoding(e){Va("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Ar?et:Cr}}Ft.DEFAULT_IMAGE=null;Ft.DEFAULT_MAPPING=Ou;Ft.DEFAULT_ANISOTROPY=1;class mt{constructor(e=0,t=0,n=0,i=1){mt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,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,n,i){return this.x=e,this.y=t,this.z=n,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,n=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+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,n,i,s;const c=e.elements,l=c[0],u=c[4],h=c[8],f=c[1],d=c[5],m=c[9],v=c[2],g=c[6],p=c[10];if(Math.abs(u-f)<.01&&Math.abs(h-v)<.01&&Math.abs(m-g)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+v)<.1&&Math.abs(m+g)<.1&&Math.abs(l+d+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const y=(l+1)/2,x=(d+1)/2,b=(p+1)/2,w=(u+f)/4,S=(h+v)/4,M=(m+g)/4;return y>x&&y>b?y<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(y),i=w/n,s=S/n):x>b?x<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),n=w/i,s=M/i):b<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(b),n=S/s,i=M/s),this.set(n,i,s,t),this}let _=Math.sqrt((g-m)*(g-m)+(h-v)*(h-v)+(f-u)*(f-u));return Math.abs(_)<.001&&(_=1),this.x=(g-m)/_,this.y=(h-v)/_,this.z=(f-u)/_,this.w=Math.acos((l+d+p-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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,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 bi extends ar{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new mt(0,0,e,t),this.scissorTest=!1,this.viewport=new mt(0,0,e,t);const i={width:e,height:t,depth:1};n.encoding!==void 0&&(Va("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),n.colorSpace=n.encoding===Ar?et:Cr),this.texture=new Ft(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Pt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,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 as(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 ku extends Ft{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Yt,this.minFilter=Yt,this.wrapR=gn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class UM extends bi{constructor(e=1,t=1,n=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new ku(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class rm extends Ft{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Yt,this.minFilter=Yt,this.wrapR=gn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class OM extends bi{constructor(e=1,t=1,n=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new rm(null,e,t,n),this.texture.isRenderTargetTexture=!0}}class NM extends bi{constructor(e=1,t=1,n=1,i={}){super(e,t,i),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let o=0;o=0?1:-1,y=1-p*p;if(y>Number.EPSILON){const b=Math.sqrt(y),w=Math.atan2(b,p*_);g=Math.sin(g*w)/b,a=Math.sin(a*w)/b}const x=a*_;if(c=c*g+f*x,l=l*g+d*x,u=u*g+m*x,h=h*g+v*x,g===1-a){const b=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=b,l*=b,u*=b,h*=b}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],c=n[i+1],l=n[i+2],u=n[i+3],h=s[o],f=s[o+1],d=s[o+2],m=s[o+3];return e[t]=a*m+u*h+c*d-l*f,e[t+1]=c*m+u*f+l*h-a*d,e[t+2]=l*m+u*d+a*f-c*h,e[t+3]=u*m-a*h-c*f-l*d,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,n,i){return this._x=e,this._y=t,this._z=n,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){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(n/2),u=a(i/2),h=a(s/2),f=c(n/2),d=c(i/2),m=c(s/2);switch(o){case"XYZ":this._x=f*u*h+l*d*m,this._y=l*d*h-f*u*m,this._z=l*u*m+f*d*h,this._w=l*u*h-f*d*m;break;case"YXZ":this._x=f*u*h+l*d*m,this._y=l*d*h-f*u*m,this._z=l*u*m-f*d*h,this._w=l*u*h+f*d*m;break;case"ZXY":this._x=f*u*h-l*d*m,this._y=l*d*h+f*u*m,this._z=l*u*m+f*d*h,this._w=l*u*h-f*d*m;break;case"ZYX":this._x=f*u*h-l*d*m,this._y=l*d*h+f*u*m,this._z=l*u*m-f*d*h,this._w=l*u*h+f*d*m;break;case"YZX":this._x=f*u*h+l*d*m,this._y=l*d*h+f*u*m,this._z=l*u*m-f*d*h,this._w=l*u*h-f*d*m;break;case"XZY":this._x=f*u*h-l*d*m,this._y=l*d*h-f*u*m,this._z=l*u*m+f*d*h,this._w=l*u*h+f*d*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],o=t[1],a=t[5],c=t[9],l=t[2],u=t[6],h=t[10],f=n+a+h;if(f>0){const d=.5/Math.sqrt(f+1);this._w=.25/d,this._x=(u-c)*d,this._y=(s-l)*d,this._z=(o-i)*d}else if(n>a&&n>h){const d=2*Math.sqrt(1+n-a-h);this._w=(u-c)/d,this._x=.25*d,this._y=(i+o)/d,this._z=(s+l)/d}else if(a>h){const d=2*Math.sqrt(1+a-n-h);this._w=(s-l)/d,this._x=(i+o)/d,this._y=.25*d,this._z=(c+u)/d}else{const d=2*Math.sqrt(1+h-n-a);this._w=(o-i)/d,this._x=(s+l)/d,this._y=(c+u)/d,this._z=.25*d}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return nMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(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=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Bt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);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 n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,c=t._y,l=t._z,u=t._w;return this._x=n*u+o*a+i*l-s*c,this._y=i*u+o*c+s*a-n*l,this._z=s*u+o*l+n*c-i*a,this._w=o*u-n*a-i*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+n*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=n,this._y=i,this._z=s,this;const c=1-a*a;if(c<=Number.EPSILON){const d=1-t;return this._w=d*o+t*this._w,this._x=d*n+t*this._x,this._y=d*i+t*this._y,this._z=d*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const l=Math.sqrt(c),u=Math.atan2(l,a),h=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=o*h+this._w*f,this._x=n*h+this._x*f,this._y=i*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=Math.random(),t=Math.sqrt(1-e),n=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*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}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 G{constructor(e=0,t=0,n=0){G.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,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(s0.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(s0.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,c=e.w,l=c*t+o*i-a*n,u=c*n+a*t-s*i,h=c*i+s*n-o*t,f=-s*t-o*n-a*i;return this.x=l*c+f*-s+u*-a-h*-o,this.y=u*c+f*-o+h*-s-l*-a,this.z=h*c+f*-a+l*-o-u*-s,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,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+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 n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))}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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,c=t.z;return this.x=i*c-s*a,this.y=s*o-n*c,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return tf.copy(this).projectOnVector(e),this.sub(tf)}reflect(e){return this.sub(tf.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 n=this.dot(e)/t;return Math.acos(Bt(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+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,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,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(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,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,n=Math.sqrt(1-e**2);return this.x=n*Math.cos(t),this.y=n*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const tf=new G,s0=new ln;class Hn{constructor(e=new G(1/0,1/0,1/0),t=new G(-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,n=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,Xi),Xi.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(la),il.subVectors(this.max,la),Gs.subVectors(e.a,la),Vs.subVectors(e.b,la),Hs.subVectors(e.c,la),mr.subVectors(Vs,Gs),gr.subVectors(Hs,Vs),Vr.subVectors(Gs,Hs);let t=[0,-mr.z,mr.y,0,-gr.z,gr.y,0,-Vr.z,Vr.y,mr.z,0,-mr.x,gr.z,0,-gr.x,Vr.z,0,-Vr.x,-mr.y,mr.x,0,-gr.y,gr.x,0,-Vr.y,Vr.x,0];return!nf(t,Gs,Vs,Hs,il)||(t=[1,0,0,0,1,0,0,0,1],!nf(t,Gs,Vs,Hs,il))?!1:(rl.crossVectors(mr,gr),t=[rl.x,rl.y,rl.z],nf(t,Gs,Vs,Hs,il))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xi).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xi).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:(Wi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Wi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Wi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Wi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Wi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Wi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Wi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Wi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Wi),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 Wi=[new G,new G,new G,new G,new G,new G,new G,new G],Xi=new G,Bs=new Hn,Gs=new G,Vs=new G,Hs=new G,mr=new G,gr=new G,Vr=new G,la=new G,il=new G,rl=new G,Hr=new G;function nf(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){Hr.fromArray(r,s);const a=i.x*Math.abs(Hr.x)+i.y*Math.abs(Hr.y)+i.z*Math.abs(Hr.z),c=e.dot(Hr),l=t.dot(Hr),u=n.dot(Hr);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}const FM=new Hn,ua=new G,rf=new G;let Wn=class{constructor(e=new G,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):FM.setFromPoints(e).getCenter(n);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;ua.subVectors(e,this.center);const t=ua.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(ua,i/n),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):(rf.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(ua.copy(e.center).add(rf)),this.expandByPoint(ua.copy(e.center).sub(rf))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const qi=new G,sf=new G,sl=new G,vr=new G,of=new G,ol=new G,af=new G;class No{constructor(e=new G,t=new G(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,qi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=qi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(qi.copy(this.origin).addScaledVector(this.direction,t),qi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){sf.copy(e).add(t).multiplyScalar(.5),sl.copy(t).sub(e).normalize(),vr.copy(this.origin).sub(sf);const s=e.distanceTo(t)*.5,o=-this.direction.dot(sl),a=vr.dot(this.direction),c=-vr.dot(sl),l=vr.lengthSq(),u=Math.abs(1-o*o);let h,f,d,m;if(u>0)if(h=o*c-a,f=o*a-c,m=s*u,h>=0)if(f>=-m)if(f<=m){const v=1/u;h*=v,f*=v,d=h*(h+o*f+2*a)+f*(o*h+f+2*c)+l}else f=s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*c)+l;else f=-s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*c)+l;else f<=-m?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-c),s),d=-h*h+f*(f+2*c)+l):f<=m?(h=0,f=Math.min(Math.max(-s,-c),s),d=f*(f+2*c)+l):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-c),s),d=-h*h+f*(f+2*c)+l);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),d=-h*h+f*(f+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(sf).addScaledVector(sl,f),d}intersectSphere(e,t){qi.subVectors(e.center,this.origin);const n=qi.dot(this.direction),i=qi.dot(qi)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,c=n+o;return c<0?null:a<0?this.at(c,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 n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,c;const l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return l>=0?(n=(e.min.x-f.x)*l,i=(e.max.x-f.x)*l):(n=(e.max.x-f.x)*l,i=(e.min.x-f.x)*l),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-f.z)*h,c=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,c=(e.min.z-f.z)*h),n>c||a>i)||((a>n||n!==n)&&(n=a),(c=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,qi)!==null}intersectTriangle(e,t,n,i,s){of.subVectors(t,e),ol.subVectors(n,e),af.crossVectors(of,ol);let o=this.direction.dot(af),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;vr.subVectors(this.origin,e);const c=a*this.direction.dot(ol.crossVectors(vr,ol));if(c<0)return null;const l=a*this.direction.dot(of.cross(vr));if(l<0||c+l>o)return null;const u=-a*vr.dot(af);return u<0?null:this.at(u/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 Ke{constructor(e,t,n,i,s,o,a,c,l,u,h,f,d,m,v,g){Ke.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,n,i,s,o,a,c,l,u,h,f,d,m,v,g)}set(e,t,n,i,s,o,a,c,l,u,h,f,d,m,v,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=n,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=c,p[2]=l,p[6]=u,p[10]=h,p[14]=f,p[3]=d,p[7]=m,p[11]=v,p[15]=g,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 Ke().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[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,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,n=e.elements,i=1/Ws.setFromMatrixColumn(e,0).length(),s=1/Ws.setFromMatrixColumn(e,1).length(),o=1/Ws.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),c=Math.cos(i),l=Math.sin(i),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=o*u,d=o*h,m=a*u,v=a*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=d+m*l,t[5]=f-v*l,t[9]=-a*c,t[2]=v-f*l,t[6]=m+d*l,t[10]=o*c}else if(e.order==="YXZ"){const f=c*u,d=c*h,m=l*u,v=l*h;t[0]=f+v*a,t[4]=m*a-d,t[8]=o*l,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=d*a-m,t[6]=v+f*a,t[10]=o*c}else if(e.order==="ZXY"){const f=c*u,d=c*h,m=l*u,v=l*h;t[0]=f-v*a,t[4]=-o*h,t[8]=m+d*a,t[1]=d+m*a,t[5]=o*u,t[9]=v-f*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){const f=o*u,d=o*h,m=a*u,v=a*h;t[0]=c*u,t[4]=m*l-d,t[8]=f*l+v,t[1]=c*h,t[5]=v*l+f,t[9]=d*l-m,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){const f=o*c,d=o*l,m=a*c,v=a*l;t[0]=c*u,t[4]=v-f*h,t[8]=m*h+d,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=d*h+m,t[10]=f-v*h}else if(e.order==="XZY"){const f=o*c,d=o*l,m=a*c,v=a*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=f*h+v,t[5]=o*u,t[9]=d*h-m,t[2]=m*h-d,t[6]=a*u,t[10]=v*h+f}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(kM,e,zM)}lookAt(e,t,n){const i=this.elements;return Fn.subVectors(e,t),Fn.lengthSq()===0&&(Fn.z=1),Fn.normalize(),_r.crossVectors(n,Fn),_r.lengthSq()===0&&(Math.abs(n.z)===1?Fn.x+=1e-4:Fn.z+=1e-4,Fn.normalize(),_r.crossVectors(n,Fn)),_r.normalize(),al.crossVectors(Fn,_r),i[0]=_r.x,i[4]=al.x,i[8]=Fn.x,i[1]=_r.y,i[5]=al.y,i[9]=Fn.y,i[2]=_r.z,i[6]=al.z,i[10]=Fn.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,o=n[0],a=n[4],c=n[8],l=n[12],u=n[1],h=n[5],f=n[9],d=n[13],m=n[2],v=n[6],g=n[10],p=n[14],_=n[3],y=n[7],x=n[11],b=n[15],w=i[0],S=i[4],M=i[8],E=i[12],T=i[1],L=i[5],P=i[9],A=i[13],z=i[2],V=i[6],N=i[10],C=i[14],O=i[3],k=i[7],U=i[11],R=i[15];return s[0]=o*w+a*T+c*z+l*O,s[4]=o*S+a*L+c*V+l*k,s[8]=o*M+a*P+c*N+l*U,s[12]=o*E+a*A+c*C+l*R,s[1]=u*w+h*T+f*z+d*O,s[5]=u*S+h*L+f*V+d*k,s[9]=u*M+h*P+f*N+d*U,s[13]=u*E+h*A+f*C+d*R,s[2]=m*w+v*T+g*z+p*O,s[6]=m*S+v*L+g*V+p*k,s[10]=m*M+v*P+g*N+p*U,s[14]=m*E+v*A+g*C+p*R,s[3]=_*w+y*T+x*z+b*O,s[7]=_*S+y*L+x*V+b*k,s[11]=_*M+y*P+x*N+b*U,s[15]=_*E+y*A+x*C+b*R,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],n=e[4],i=e[8],s=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],f=e[10],d=e[14],m=e[3],v=e[7],g=e[11],p=e[15];return m*(+s*c*h-i*l*h-s*a*f+n*l*f+i*a*d-n*c*d)+v*(+t*c*d-t*l*f+s*o*f-i*o*d+i*l*u-s*c*u)+g*(+t*l*h-t*a*d-s*o*h+n*o*d+s*a*u-n*l*u)+p*(-i*a*u-t*c*h+t*a*f+i*o*h-n*o*f+n*c*u)}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,n){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]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],f=e[10],d=e[11],m=e[12],v=e[13],g=e[14],p=e[15],_=h*g*l-v*f*l+v*c*d-a*g*d-h*c*p+a*f*p,y=m*f*l-u*g*l-m*c*d+o*g*d+u*c*p-o*f*p,x=u*v*l-m*h*l+m*a*d-o*v*d-u*a*p+o*h*p,b=m*h*c-u*v*c-m*a*f+o*v*f+u*a*g-o*h*g,w=t*_+n*y+i*x+s*b;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/w;return e[0]=_*S,e[1]=(v*f*s-h*g*s-v*i*d+n*g*d+h*i*p-n*f*p)*S,e[2]=(a*g*s-v*c*s+v*i*l-n*g*l-a*i*p+n*c*p)*S,e[3]=(h*c*s-a*f*s-h*i*l+n*f*l+a*i*d-n*c*d)*S,e[4]=y*S,e[5]=(u*g*s-m*f*s+m*i*d-t*g*d-u*i*p+t*f*p)*S,e[6]=(m*c*s-o*g*s-m*i*l+t*g*l+o*i*p-t*c*p)*S,e[7]=(o*f*s-u*c*s+u*i*l-t*f*l-o*i*d+t*c*d)*S,e[8]=x*S,e[9]=(m*h*s-u*v*s-m*n*d+t*v*d+u*n*p-t*h*p)*S,e[10]=(o*v*s-m*a*s+m*n*l-t*v*l-o*n*p+t*a*p)*S,e[11]=(u*a*s-o*h*s-u*n*l+t*h*l+o*n*d-t*a*d)*S,e[12]=b*S,e[13]=(u*v*i-m*h*i+m*n*f-t*v*f-u*n*g+t*h*g)*S,e[14]=(m*a*i-o*v*i-m*n*c+t*v*c+o*n*g-t*a*g)*S,e[15]=(o*h*i-u*a*i+u*n*c-t*h*c-o*n*f+t*a*f)*S,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,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],n=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,n,i))}makeTranslation(e,t,n){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,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,o=e.x,a=e.y,c=e.z,l=s*o,u=s*a;return this.set(l*o+n,l*a-i*c,l*c+i*a,0,l*a+i*c,u*a+n,u*c-i*o,0,l*c-i*a,u*c+i*o,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,c=t._w,l=s+s,u=o+o,h=a+a,f=s*l,d=s*u,m=s*h,v=o*u,g=o*h,p=a*h,_=c*l,y=c*u,x=c*h,b=n.x,w=n.y,S=n.z;return i[0]=(1-(v+p))*b,i[1]=(d+x)*b,i[2]=(m-y)*b,i[3]=0,i[4]=(d-x)*w,i[5]=(1-(f+p))*w,i[6]=(g+_)*w,i[7]=0,i[8]=(m+y)*S,i[9]=(g-_)*S,i[10]=(1-(f+v))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;let s=Ws.set(i[0],i[1],i[2]).length();const o=Ws.set(i[4],i[5],i[6]).length(),a=Ws.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],li.copy(this);const l=1/s,u=1/o,h=1/a;return li.elements[0]*=l,li.elements[1]*=l,li.elements[2]*=l,li.elements[4]*=u,li.elements[5]*=u,li.elements[6]*=u,li.elements[8]*=h,li.elements[9]*=h,li.elements[10]*=h,t.setFromRotationMatrix(li),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o,a=Di){const c=this.elements,l=2*s/(t-e),u=2*s/(n-i),h=(t+e)/(t-e),f=(n+i)/(n-i);let d,m;if(a===Di)d=-(o+s)/(o-s),m=-2*o*s/(o-s);else if(a===sc)d=-o/(o-s),m=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=l,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=d,c[14]=m,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,n,i,s,o,a=Di){const c=this.elements,l=1/(t-e),u=1/(n-i),h=1/(o-s),f=(t+e)*l,d=(n+i)*u;let m,v;if(a===Di)m=(o+s)*h,v=-2*h;else if(a===sc)m=s*h,v=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-f,c[1]=0,c[5]=2*u,c[9]=0,c[13]=-d,c[2]=0,c[6]=0,c[10]=v,c[14]=-m,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const Ws=new G,li=new Ke,kM=new G(0,0,0),zM=new G(1,1,1),_r=new G,al=new G,Fn=new G,o0=new Ke,a0=new ln;class Ir{constructor(e=0,t=0,n=0,i=Ir.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,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,n,i=this._order){return this._x=e,this._y=t,this._z=n,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,n=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],c=i[1],l=i[5],u=i[9],h=i[2],f=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Bt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Bt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(Bt(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-Bt(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,d),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(Bt(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-Bt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return o0.makeRotationFromQuaternion(e),this.setFromRotationMatrix(o0,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return a0.setFromEuler(this),this.setFromQuaternion(a0,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}}Ir.DEFAULT_ORDER="XYZ";class hs{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(n=n.concat(o))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ha,e,GM),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ha,VM,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n0&&(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()));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.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 c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),u.length>0&&(n.images=u),h.length>0&&(n.shapes=h),f.length>0&&(n.skeletons=f),d.length>0&&(n.animations=d),m.length>0&&(n.nodes=m)}return n.object=i,n;function o(a){const c=[];for(const l in a){const u=a[l];delete u.metadata,c.push(u)}return c}}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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){ui.subVectors(i,t),ji.subVectors(n,t),cf.subVectors(e,t);const o=ui.dot(ui),a=ui.dot(ji),c=ui.dot(cf),l=ji.dot(ji),u=ji.dot(cf),h=o*l-a*a;if(h===0)return s.set(-2,-1,-1);const f=1/h,d=(l*c-a*u)*f,m=(o*u-a*c)*f;return s.set(1-d-m,m,d)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,$i),$i.x>=0&&$i.y>=0&&$i.x+$i.y<=1}static getUV(e,t,n,i,s,o,a,c){return ll===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ll=!0),this.getInterpolation(e,t,n,i,s,o,a,c)}static getInterpolation(e,t,n,i,s,o,a,c){return this.getBarycoord(e,t,n,i,$i),c.setScalar(0),c.addScaledVector(s,$i.x),c.addScaledVector(o,$i.y),c.addScaledVector(a,$i.z),c}static isFrontFacing(e,t,n,i){return ui.subVectors(n,t),ji.subVectors(e,t),ui.cross(ji).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),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 ui.subVectors(this.c,this.b),ji.subVectors(this.a,this.b),ui.cross(ji).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Pn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Pn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return ll===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),ll=!0),Pn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return Pn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Pn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Pn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;qs.subVectors(i,n),Ys.subVectors(s,n),lf.subVectors(e,n);const c=qs.dot(lf),l=Ys.dot(lf);if(c<=0&&l<=0)return t.copy(n);uf.subVectors(e,i);const u=qs.dot(uf),h=Ys.dot(uf);if(u>=0&&h<=u)return t.copy(i);const f=c*h-u*l;if(f<=0&&c>=0&&u<=0)return o=c/(c-u),t.copy(n).addScaledVector(qs,o);hf.subVectors(e,s);const d=qs.dot(hf),m=Ys.dot(hf);if(m>=0&&d<=m)return t.copy(s);const v=d*l-c*m;if(v<=0&&l>=0&&m<=0)return a=l/(l-m),t.copy(n).addScaledVector(Ys,a);const g=u*m-d*h;if(g<=0&&h-u>=0&&d-m>=0)return d0.subVectors(s,i),a=(h-u)/(h-u+(d-m)),t.copy(i).addScaledVector(d0,a);const p=1/(g+v+f);return o=v*p,a=f*p,t.copy(n).addScaledVector(qs,o).addScaledVector(Ys,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let WM=0;class un extends ar{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:WM++}),this.uuid=Bn(),this.name="",this.type="Material",this.blending=ls,this.side=Oi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Vp,this.blendDst=Hp,this.blendEquation=ns,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=vu,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Ox,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=lu,this.stencilZFail=lu,this.stencilZPass=lu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=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 n=e[t];if(n===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(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ls&&(n.blending=this.blending),this.side!==Oi&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.colorWrite=this.colorWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=this.alphaHash),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(n.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const c=s[a];delete c.metadata,o.push(c)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}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.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 n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,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++}}const qx={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},hi={h:0,s:0,l:0},ul={h:0,s:0,l:0};function ff(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Ne{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===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,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=et){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Zn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=Zn.workingColorSpace){return this.r=e,this.g=t,this.b=n,Zn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=Zn.workingColorSpace){if(e=nm(e,1),t=Bt(t,0,1),n=Bt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=ff(o,s,e+1/3),this.g=ff(o,s,e),this.b=ff(o,s,e-1/3)}return Zn.toWorkingColorSpace(this,i),this}setStyle(e,t=et){function n(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 n(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 n(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 n(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=et){const n=qx[e.toLowerCase()];return n!==void 0?this.setHex(n,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=wo(e.r),this.g=wo(e.g),this.b=wo(e.b),this}copyLinearToSRGB(e){return this.r=Qh(e.r),this.g=Qh(e.g),this.b=Qh(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=et){return Zn.fromWorkingColorSpace(mn.copy(this),e),Math.round(Bt(mn.r*255,0,255))*65536+Math.round(Bt(mn.g*255,0,255))*256+Math.round(Bt(mn.b*255,0,255))}getHexString(e=et){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Zn.workingColorSpace){Zn.fromWorkingColorSpace(mn.copy(this),t);const n=mn.r,i=mn.g,s=mn.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let c,l;const u=(a+o)/2;if(a===o)c=0,l=0;else{const h=o-a;switch(l=u<=.5?h/(o+a):h/(2-o-a),o){case n:c=(i-s)/h+(i>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,u=0;for(;(l&8388608)===0;)l<<=1,u-=8388608;l&=-8388609,u+=947912704,s[c]=l|u}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)o[c]=c<<23;o[31]=1199570944,o[32]=2147483648;for(let c=33;c<63;++c)o[c]=2147483648+(c-32<<23);o[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(a[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function Rn(r){Math.abs(r)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),r=Bt(r,-65504,65504),er.floatView[0]=r;const e=er.uint32View[0],t=e>>23&511;return er.baseTable[t]+((e&8388607)>>er.shiftTable[t])}function Ua(r){const e=r>>10;return er.uint32View[0]=er.mantissaTable[er.offsetTable[e]+(r&1023)]+er.exponentTable[e],er.floatView[0]}const qM={toHalfFloat:Rn,fromHalfFloat:Ua},jt=new G,hl=new be;class wt{constructor(e,t,n=!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=n,this.usage=rc,this.updateRange={offset:0,count:-1},this.gpuType=Li,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);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 n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],u=[];for(let h=0,f=l.length;h0&&(i[c]=u,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 n=e.index;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const l in i){const u=i[l];this.setAttribute(l,u.clone(t))}const s=e.morphAttributes;for(const l in s){const u=[],h=s[l];for(let f=0,d=h.length;f0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(p0.copy(s).invert(),Wr.copy(e.ray).applyMatrix4(p0),!(n.boundingBox!==null&&Wr.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Wr)))}_computeIntersections(e,t,n){let i;const s=this.geometry,o=this.material,a=s.index,c=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,d=s.drawRange;if(a!==null)if(Array.isArray(o))for(let m=0,v=f.length;mt.far?null:{distance:l,point:_l.clone(),object:r}}function yl(r,e,t,n,i,s,o,a,c,l){r.getVertexPosition(a,$s),r.getVertexPosition(c,Zs),r.getVertexPosition(l,Ks);const u=tT(r,e,t,n,$s,Zs,Ks,vl);if(u){i&&(pl.fromBufferAttribute(i,a),ml.fromBufferAttribute(i,c),gl.fromBufferAttribute(i,l),u.uv=Pn.getInterpolation(vl,$s,Zs,Ks,pl,ml,gl,new be)),s&&(pl.fromBufferAttribute(s,a),ml.fromBufferAttribute(s,c),gl.fromBufferAttribute(s,l),u.uv1=Pn.getInterpolation(vl,$s,Zs,Ks,pl,ml,gl,new be),u.uv2=u.uv1),o&&(g0.fromBufferAttribute(o,a),v0.fromBufferAttribute(o,c),_0.fromBufferAttribute(o,l),u.normal=Pn.getInterpolation(vl,$s,Zs,Ks,g0,v0,_0,new G),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a,b:c,c:l,normal:new G,materialIndex:0};Pn.getNormal($s,Zs,Ks,h.normal),u.face=h}return u}class lr extends st{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const c=[],l=[],u=[],h=[];let f=0,d=0;m("z","y","x",-1,-1,n,t,e,o,s,0),m("z","y","x",1,-1,n,t,-e,o,s,1),m("x","z","y",1,1,e,n,t,i,o,2),m("x","z","y",1,-1,e,n,-t,i,o,3),m("x","y","z",1,-1,e,t,n,i,s,4),m("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new He(l,3)),this.setAttribute("normal",new He(u,3)),this.setAttribute("uv",new He(h,2));function m(v,g,p,_,y,x,b,w,S,M,E){const T=x/S,L=b/M,P=x/2,A=b/2,z=w/2,V=S+1,N=M+1;let C=0,O=0;const k=new G;for(let U=0;U0?1:-1,u.push(k.x,k.y,k.z),h.push(F/S),h.push(1-U/M),C+=1}}for(let U=0;U0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Pc extends gt{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ke,this.projectionMatrix=new Ke,this.projectionMatrixInverse=new Ke,this.coordinateSystem=Di}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){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}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)}}class Zt extends Pc{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,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=Co*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(us*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Co*2*Math.atan(Math.tan(us*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,n,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=n,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(us*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const c=o.fullWidth,l=o.fullHeight;s+=o.offsetX*i/c,t-=o.offsetY*n/l,i*=o.width/c,n*=o.height/l}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,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 Js=-90,Qs=1;class jx extends gt{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null;const i=new Zt(Js,Qs,e,t);i.layers=this.layers,this.add(i);const s=new Zt(Js,Qs,e,t);s.layers=this.layers,this.add(s);const o=new Zt(Js,Qs,e,t);o.layers=this.layers,this.add(o);const a=new Zt(Js,Qs,e,t);a.layers=this.layers,this.add(a);const c=new Zt(Js,Qs,e,t);c.layers=this.layers,this.add(c);const l=new Zt(Js,Qs,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,o,a,c]=t;for(const l of t)this.remove(l);if(e===Di)n.up.set(0,1,0),n.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),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===sc)n.up.set(0,-1,0),n.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),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[i,s,o,a,c,l]=this.children,u=e.getRenderTarget(),h=e.toneMapping,f=e.xr.enabled;e.toneMapping=yi,e.xr.enabled=!1;const d=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,c),n.texture.generateMipmaps=d,e.setRenderTarget(n,5),e.render(t,l),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}}class Lc extends Ft{constructor(e,t,n,i,s,o,a,c,l,u){e=e!==void 0?e:[],t=t!==void 0?t:Pr,super(e,t,n,i,s,o,a,c,l,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class $x extends bi{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];t.encoding!==void 0&&(Va("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Ar?et:Cr),this.texture=new Lc(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:Pt}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 n={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 lr(5,5,5),s=new Ni({name:"CubemapFromEquirect",uniforms:Ro(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:vn,blending:nr});s.uniforms.tEquirect.value=t;const o=new Ot(i,s),a=t.minFilter;return t.minFilter===Dr&&(t.minFilter=Pt),new jx(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}const mf=new G,sT=new G,oT=new rt;class Qi{constructor(e=new G(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,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=mf.subVectors(n,t).cross(sT.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 n=e.delta(mf),i=this.normal.dot(n);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(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<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 n=t||oT.getNormalMatrix(e),i=this.coplanarPoint(mf).applyMatrix4(e),s=this.normal.applyMatrix3(n).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 Xr=new Wn,xl=new G;class zu{constructor(e=new Qi,t=new Qi,n=new Qi,i=new Qi,s=new Qi,o=new Qi){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Di){const n=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],c=i[3],l=i[4],u=i[5],h=i[6],f=i[7],d=i[8],m=i[9],v=i[10],g=i[11],p=i[12],_=i[13],y=i[14],x=i[15];if(n[0].setComponents(c-s,f-l,g-d,x-p).normalize(),n[1].setComponents(c+s,f+l,g+d,x+p).normalize(),n[2].setComponents(c+o,f+u,g+m,x+_).normalize(),n[3].setComponents(c-o,f-u,g-m,x-_).normalize(),n[4].setComponents(c-a,f-h,g-v,x-y).normalize(),t===Di)n[5].setComponents(c+a,f+h,g+v,x+y).normalize();else if(t===sc)n[5].setComponents(a,h,v,y).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(),Xr.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Xr.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Xr)}intersectsSprite(e){return Xr.center.set(0,0,0),Xr.radius=.7071067811865476,Xr.applyMatrix4(e.matrixWorld),this.intersectsSphere(Xr)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,xl.y=i.normal.y>0?e.max.y:e.min.y,xl.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(xl)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Zx(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function aT(r,e){const t=e.isWebGL2,n=new WeakMap;function i(l,u){const h=l.array,f=l.usage,d=r.createBuffer();r.bindBuffer(u,d),r.bufferData(u,h,f),l.onUploadCallback();let m;if(h instanceof Float32Array)m=r.FLOAT;else if(h instanceof Uint16Array)if(l.isFloat16BufferAttribute)if(t)m=r.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else m=r.UNSIGNED_SHORT;else if(h instanceof Int16Array)m=r.SHORT;else if(h instanceof Uint32Array)m=r.UNSIGNED_INT;else if(h instanceof Int32Array)m=r.INT;else if(h instanceof Int8Array)m=r.BYTE;else if(h instanceof Uint8Array)m=r.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)m=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:d,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:l.version}}function s(l,u,h){const f=u.array,d=u.updateRange;r.bindBuffer(h,l),d.count===-1?r.bufferSubData(h,0,f):(t?r.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f,d.offset,d.count):r.bufferSubData(h,d.offset*f.BYTES_PER_ELEMENT,f.subarray(d.offset,d.offset+d.count)),d.count=-1),u.onUploadCallback()}function o(l){return l.isInterleavedBufferAttribute&&(l=l.data),n.get(l)}function a(l){l.isInterleavedBufferAttribute&&(l=l.data);const u=n.get(l);u&&(r.deleteBuffer(u.buffer),n.delete(l))}function c(l,u){if(l.isGLBufferAttribute){const f=n.get(l);(!f||f.version 0 + vec4 plane; + #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`,wT=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,ST=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,ET=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,MT=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,TT=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,AT=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + varying vec3 vColor; +#endif`,CT=`#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`,RT=`#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; +}; +struct GeometricContext { + vec3 position; + vec3 normal; + vec3 viewDir; +#ifdef USE_CLEARCOAT + vec3 clearcoatNormal; +#endif +}; +#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`,PT=`#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_v0 0.339 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_v1 0.276 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_v4 0.046 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_v5 0.016 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_v6 0.0038 + #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`,LT=`vec3 transformedNormal = objectNormal; +#ifdef USE_INSTANCING + mat3 m = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); + transformedNormal = m * transformedNormal; +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,DT=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,IT=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,UT=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,OT=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,NT="gl_FragColor = linearToOutputTexel( gl_FragColor );",FT=`vec4 LinearToLinear( in vec4 value ) { + return value; +} +vec4 LinearTosRGB( 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 ); +}`,kT=`#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`,zT=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,BT=`#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`,GT=`#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`,VT=`#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`,HT=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,WT=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,XT=`#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`,qT=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,YT=`#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 +}`,jT=`#ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + reflectedLight.indirectDiffuse += lightMapIrradiance; +#endif`,$T=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,ZT=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,KT=`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, 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`,JT=`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +uniform vec3 lightProbe[ 9 ]; +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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometry.position; + 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 GeometricContext geometry, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometry.position; + 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`,QT=`#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`,eA=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,tA=`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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`,nA=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,iA=`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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`,rA=`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); +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 ); + 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`,sA=`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 clearcoatSpecular = vec3( 0.0 ); +vec3 sheenSpecular = 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometry.normal; + vec3 viewDir = geometry.viewDir; + vec3 position = geometry.position; + 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometry.normal, geometry.viewDir, 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 ); +}`,oA=` +GeometricContext geometry; +geometry.position = - vViewPosition; +geometry.normal = normal; +geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +#ifdef USE_CLEARCOAT + geometry.clearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometry.viewDir ) ); + 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, geometry, 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, geometry, 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, geometry, 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, geometry, 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, geometry, 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, geometry, 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, geometry, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,aA=`#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( geometry.normal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,cA=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); +#endif`,lA=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,uA=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,hA=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + varying float vFragDepth; + varying float vIsPerspective; + #else + uniform float logDepthBufFC; + #endif +#endif`,fA=`#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`,dA=`#ifdef USE_MAP + diffuseColor *= texture2D( map, vMapUv ); +#endif`,pA=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,mA=`#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`,gA=`#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`,vA=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,_A=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,yA=`#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`,xA=`#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`,bA=`#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`,wA=`#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`,SA=`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 geometryNormal = normal;`,EA=`#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`,MA=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,TA=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,AA=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,CA=`#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`,RA=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = geometryNormal; +#endif`,PA=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,LA=`#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`,DA=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,IA=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,UA=`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 ); +}`,OA=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,NA=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,FA=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,kA=`#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`,zA=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,BA=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,GA=`#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`,VA=`#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`,HA=`#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`,WA=`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; +}`,XA=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,qA=`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + uniform int boneTextureSize; + mat4 getBoneMatrix( const in float i ) { + float j = i * 4.0; + float x = mod( j, float( boneTextureSize ) ); + float y = floor( j / float( boneTextureSize ) ); + float dx = 1.0 / float( boneTextureSize ); + float dy = 1.0 / float( boneTextureSize ); + y = dy * ( y + 0.5 ); + vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) ); + vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) ); + vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) ); + vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) ); + mat4 bone = mat4( v1, v2, v3, v4 ); + return bone; + } +#endif`,YA=`#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`,jA=`#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`,$A=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,ZA=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,KA=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,JA=`#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 ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,QA=`#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`,e2=`#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`,t2=`#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`,n2=`#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`,i2=`#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`,r2=`#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_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`;const s2=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,o2=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,a2=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,c2=`#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 +}`,l2=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,u2=`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 +}`,h2=`#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,f2=`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + vec4 diffuseColor = vec4( 1.0 ); + #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 +}`,d2=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,p2=`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + #include + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,m2=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,g2=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,v2=`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 +}`,_2=`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,y2=`#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #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 +}`,x2=`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() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #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 +}`,b2=`#define LAMBERT +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 + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,w2=`#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() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + 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 +}`,S2=`#define MATCAP +varying vec3 vViewPosition; +#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; +}`,E2=`#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() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + #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 +}`,M2=`#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 +void main() { + #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 +}`,T2=`#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() { + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,A2=`#define PHONG +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 + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,C2=`#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() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + 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 +}`,R2=`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#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 + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,P2=`#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() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + 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 + sheenSpecular; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,L2=`#define TOON +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 + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,D2=`#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() { + #include + vec4 diffuseColor = vec4( diffuse, opacity ); + 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 +}`,I2=`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 +}`,U2=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,O2=`#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,N2=`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 +}`,F2=`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 +}`,k2=`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + vec3 outgoingLight = vec3( 0.0 ); + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`,Qe={alphahash_fragment:cT,alphahash_pars_fragment:lT,alphamap_fragment:uT,alphamap_pars_fragment:hT,alphatest_fragment:fT,alphatest_pars_fragment:dT,aomap_fragment:pT,aomap_pars_fragment:mT,begin_vertex:gT,beginnormal_vertex:vT,bsdfs:_T,iridescence_fragment:yT,bumpmap_pars_fragment:xT,clipping_planes_fragment:bT,clipping_planes_pars_fragment:wT,clipping_planes_pars_vertex:ST,clipping_planes_vertex:ET,color_fragment:MT,color_pars_fragment:TT,color_pars_vertex:AT,color_vertex:CT,common:RT,cube_uv_reflection_fragment:PT,defaultnormal_vertex:LT,displacementmap_pars_vertex:DT,displacementmap_vertex:IT,emissivemap_fragment:UT,emissivemap_pars_fragment:OT,colorspace_fragment:NT,colorspace_pars_fragment:FT,envmap_fragment:kT,envmap_common_pars_fragment:zT,envmap_pars_fragment:BT,envmap_pars_vertex:GT,envmap_physical_pars_fragment:QT,envmap_vertex:VT,fog_vertex:HT,fog_pars_vertex:WT,fog_fragment:XT,fog_pars_fragment:qT,gradientmap_pars_fragment:YT,lightmap_fragment:jT,lightmap_pars_fragment:$T,lights_lambert_fragment:ZT,lights_lambert_pars_fragment:KT,lights_pars_begin:JT,lights_toon_fragment:eA,lights_toon_pars_fragment:tA,lights_phong_fragment:nA,lights_phong_pars_fragment:iA,lights_physical_fragment:rA,lights_physical_pars_fragment:sA,lights_fragment_begin:oA,lights_fragment_maps:aA,lights_fragment_end:cA,logdepthbuf_fragment:lA,logdepthbuf_pars_fragment:uA,logdepthbuf_pars_vertex:hA,logdepthbuf_vertex:fA,map_fragment:dA,map_pars_fragment:pA,map_particle_fragment:mA,map_particle_pars_fragment:gA,metalnessmap_fragment:vA,metalnessmap_pars_fragment:_A,morphcolor_vertex:yA,morphnormal_vertex:xA,morphtarget_pars_vertex:bA,morphtarget_vertex:wA,normal_fragment_begin:SA,normal_fragment_maps:EA,normal_pars_fragment:MA,normal_pars_vertex:TA,normal_vertex:AA,normalmap_pars_fragment:CA,clearcoat_normal_fragment_begin:RA,clearcoat_normal_fragment_maps:PA,clearcoat_pars_fragment:LA,iridescence_pars_fragment:DA,opaque_fragment:IA,packing:UA,premultiplied_alpha_fragment:OA,project_vertex:NA,dithering_fragment:FA,dithering_pars_fragment:kA,roughnessmap_fragment:zA,roughnessmap_pars_fragment:BA,shadowmap_pars_fragment:GA,shadowmap_pars_vertex:VA,shadowmap_vertex:HA,shadowmask_pars_fragment:WA,skinbase_vertex:XA,skinning_pars_vertex:qA,skinning_vertex:YA,skinnormal_vertex:jA,specularmap_fragment:$A,specularmap_pars_fragment:ZA,tonemapping_fragment:KA,tonemapping_pars_fragment:JA,transmission_fragment:QA,transmission_pars_fragment:e2,uv_pars_fragment:t2,uv_pars_vertex:n2,uv_vertex:i2,worldpos_vertex:r2,background_vert:s2,background_frag:o2,backgroundCube_vert:a2,backgroundCube_frag:c2,cube_vert:l2,cube_frag:u2,depth_vert:h2,depth_frag:f2,distanceRGBA_vert:d2,distanceRGBA_frag:p2,equirect_vert:m2,equirect_frag:g2,linedashed_vert:v2,linedashed_frag:_2,meshbasic_vert:y2,meshbasic_frag:x2,meshlambert_vert:b2,meshlambert_frag:w2,meshmatcap_vert:S2,meshmatcap_frag:E2,meshnormal_vert:M2,meshnormal_frag:T2,meshphong_vert:A2,meshphong_frag:C2,meshphysical_vert:R2,meshphysical_frag:P2,meshtoon_vert:L2,meshtoon_frag:D2,points_vert:I2,points_frag:U2,shadow_vert:O2,shadow_frag:N2,sprite_vert:F2,sprite_frag:k2},ke={common:{diffuse:{value:new Ne(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new rt}},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 rt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new rt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new rt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new rt},normalScale:{value:new be(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new rt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new rt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new rt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new rt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Ne(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 Ne(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0},uvTransform:{value:new rt}},sprite:{diffuse:{value:new Ne(16777215)},opacity:{value:1},center:{value:new be(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new rt},alphaMap:{value:null},alphaMapTransform:{value:new rt},alphaTest:{value:0}}},gi={basic:{uniforms:bn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.fog]),vertexShader:Qe.meshbasic_vert,fragmentShader:Qe.meshbasic_frag},lambert:{uniforms:bn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,ke.lights,{emissive:{value:new Ne(0)}}]),vertexShader:Qe.meshlambert_vert,fragmentShader:Qe.meshlambert_frag},phong:{uniforms:bn([ke.common,ke.specularmap,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,ke.lights,{emissive:{value:new Ne(0)},specular:{value:new Ne(1118481)},shininess:{value:30}}]),vertexShader:Qe.meshphong_vert,fragmentShader:Qe.meshphong_frag},standard:{uniforms:bn([ke.common,ke.envmap,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.roughnessmap,ke.metalnessmap,ke.fog,ke.lights,{emissive:{value:new Ne(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag},toon:{uniforms:bn([ke.common,ke.aomap,ke.lightmap,ke.emissivemap,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.gradientmap,ke.fog,ke.lights,{emissive:{value:new Ne(0)}}]),vertexShader:Qe.meshtoon_vert,fragmentShader:Qe.meshtoon_frag},matcap:{uniforms:bn([ke.common,ke.bumpmap,ke.normalmap,ke.displacementmap,ke.fog,{matcap:{value:null}}]),vertexShader:Qe.meshmatcap_vert,fragmentShader:Qe.meshmatcap_frag},points:{uniforms:bn([ke.points,ke.fog]),vertexShader:Qe.points_vert,fragmentShader:Qe.points_frag},dashed:{uniforms:bn([ke.common,ke.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Qe.linedashed_vert,fragmentShader:Qe.linedashed_frag},depth:{uniforms:bn([ke.common,ke.displacementmap]),vertexShader:Qe.depth_vert,fragmentShader:Qe.depth_frag},normal:{uniforms:bn([ke.common,ke.bumpmap,ke.normalmap,ke.displacementmap,{opacity:{value:1}}]),vertexShader:Qe.meshnormal_vert,fragmentShader:Qe.meshnormal_frag},sprite:{uniforms:bn([ke.sprite,ke.fog]),vertexShader:Qe.sprite_vert,fragmentShader:Qe.sprite_frag},background:{uniforms:{uvTransform:{value:new rt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Qe.background_vert,fragmentShader:Qe.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:Qe.backgroundCube_vert,fragmentShader:Qe.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Qe.cube_vert,fragmentShader:Qe.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Qe.equirect_vert,fragmentShader:Qe.equirect_frag},distanceRGBA:{uniforms:bn([ke.common,ke.displacementmap,{referencePosition:{value:new G},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Qe.distanceRGBA_vert,fragmentShader:Qe.distanceRGBA_frag},shadow:{uniforms:bn([ke.lights,ke.fog,{color:{value:new Ne(0)},opacity:{value:1}}]),vertexShader:Qe.shadow_vert,fragmentShader:Qe.shadow_frag}};gi.physical={uniforms:bn([gi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new rt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new rt},clearcoatNormalScale:{value:new be(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new rt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new rt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new rt},sheen:{value:0},sheenColor:{value:new Ne(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new rt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new rt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new rt},transmissionSamplerSize:{value:new be},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new rt},attenuationDistance:{value:0},attenuationColor:{value:new Ne(0)},specularColor:{value:new Ne(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new rt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new rt},anisotropyVector:{value:new be},anisotropyMap:{value:null},anisotropyMapTransform:{value:new rt}}]),vertexShader:Qe.meshphysical_vert,fragmentShader:Qe.meshphysical_frag};const bl={r:0,b:0,g:0};function z2(r,e,t,n,i,s,o){const a=new Ne(0);let c=s===!0?0:1,l,u,h=null,f=0,d=null;function m(g,p){let _=!1,y=p.isScene===!0?p.background:null;switch(y&&y.isTexture&&(y=(p.backgroundBlurriness>0?t:e).get(y)),y===null?v(a,c):y&&y.isColor&&(v(y,1),_=!0),r.xr.getEnvironmentBlendMode()){case"opaque":_=!0;break;case"additive":n.buffers.color.setClear(0,0,0,1,o),_=!0;break;case"alpha-blend":n.buffers.color.setClear(0,0,0,0,o),_=!0;break}(r.autoClear||_)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),y&&(y.isCubeTexture||y.mapping===Oo)?(u===void 0&&(u=new Ot(new lr(1,1,1),new Ni({name:"BackgroundCubeMaterial",uniforms:Ro(gi.backgroundCube.uniforms),vertexShader:gi.backgroundCube.vertexShader,fragmentShader:gi.backgroundCube.fragmentShader,side:vn,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(w,S,M){this.matrixWorld.copyPosition(M.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=y,u.material.uniforms.flipEnvMap.value=y.isCubeTexture&&y.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=p.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,u.material.toneMapped=y.colorSpace!==et,(h!==y||f!==y.version||d!==r.toneMapping)&&(u.material.needsUpdate=!0,h=y,f=y.version,d=r.toneMapping),u.layers.enableAll(),g.unshift(u,u.geometry,u.material,0,0,null)):y&&y.isTexture&&(l===void 0&&(l=new Ot(new Nr(2,2),new Ni({name:"BackgroundMaterial",uniforms:Ro(gi.background.uniforms),vertexShader:gi.background.vertexShader,fragmentShader:gi.background.fragmentShader,side:Oi,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=y,l.material.uniforms.backgroundIntensity.value=p.backgroundIntensity,l.material.toneMapped=y.colorSpace!==et,y.matrixAutoUpdate===!0&&y.updateMatrix(),l.material.uniforms.uvTransform.value.copy(y.matrix),(h!==y||f!==y.version||d!==r.toneMapping)&&(l.material.needsUpdate=!0,h=y,f=y.version,d=r.toneMapping),l.layers.enableAll(),g.unshift(l,l.geometry,l.material,0,0,null))}function v(g,p){g.getRGB(bl,Yx(r)),n.buffers.color.setClear(bl.r,bl.g,bl.b,p,o)}return{getClearColor:function(){return a},setClearColor:function(g,p=1){a.set(g),c=p,v(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(g){c=g,v(a,c)},render:m}}function B2(r,e,t,n){const i=r.getParameter(r.MAX_VERTEX_ATTRIBS),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},c=g(null);let l=c,u=!1;function h(z,V,N,C,O){let k=!1;if(o){const U=v(C,N,V);l!==U&&(l=U,d(l.object)),k=p(z,C,N,O),k&&_(z,C,N,O)}else{const U=V.wireframe===!0;(l.geometry!==C.id||l.program!==N.id||l.wireframe!==U)&&(l.geometry=C.id,l.program=N.id,l.wireframe=U,k=!0)}O!==null&&t.update(O,r.ELEMENT_ARRAY_BUFFER),(k||u)&&(u=!1,M(z,V,N,C),O!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t.get(O).buffer))}function f(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function d(z){return n.isWebGL2?r.bindVertexArray(z):s.bindVertexArrayOES(z)}function m(z){return n.isWebGL2?r.deleteVertexArray(z):s.deleteVertexArrayOES(z)}function v(z,V,N){const C=N.wireframe===!0;let O=a[z.id];O===void 0&&(O={},a[z.id]=O);let k=O[V.id];k===void 0&&(k={},O[V.id]=k);let U=k[C];return U===void 0&&(U=g(f()),k[C]=U),U}function g(z){const V=[],N=[],C=[];for(let O=0;O=0){const Y=O[F];let J=k[F];if(J===void 0&&(F==="instanceMatrix"&&z.instanceMatrix&&(J=z.instanceMatrix),F==="instanceColor"&&z.instanceColor&&(J=z.instanceColor)),Y===void 0||Y.attribute!==J||J&&Y.data!==J.data)return!0;U++}return l.attributesNum!==U||l.index!==C}function _(z,V,N,C){const O={},k=V.attributes;let U=0;const R=N.getAttributes();for(const F in R)if(R[F].location>=0){let Y=k[F];Y===void 0&&(F==="instanceMatrix"&&z.instanceMatrix&&(Y=z.instanceMatrix),F==="instanceColor"&&z.instanceColor&&(Y=z.instanceColor));const J={};J.attribute=Y,Y&&Y.data&&(J.data=Y.data),O[F]=J,U++}l.attributes=O,l.attributesNum=U,l.index=C}function y(){const z=l.newAttributes;for(let V=0,N=z.length;V=0){let H=O[R];if(H===void 0&&(R==="instanceMatrix"&&z.instanceMatrix&&(H=z.instanceMatrix),R==="instanceColor"&&z.instanceColor&&(H=z.instanceColor)),H!==void 0){const Y=H.normalized,J=H.itemSize,ie=t.get(H);if(ie===void 0)continue;const ne=ie.buffer,ee=ie.type,ge=ie.bytesPerElement,me=n.isWebGL2===!0&&(ee===r.INT||ee===r.UNSIGNED_INT||H.gpuType===qp);if(H.isInterleavedBufferAttribute){const te=H.data,D=te.stride,Q=H.offset;if(te.isInstancedInterleavedBuffer){for(let j=0;j0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";S="mediump"}return S==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&r.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const c=s(a);c!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",c,"instead."),a=c);const l=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),f=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),d=r.getParameter(r.MAX_TEXTURE_SIZE),m=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),v=r.getParameter(r.MAX_VERTEX_ATTRIBS),g=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),p=r.getParameter(r.MAX_VARYING_VECTORS),_=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),y=f>0,x=o||e.has("OES_texture_float"),b=y&&x,w=o?r.getParameter(r.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:l,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:d,maxCubemapSize:m,maxAttributes:v,maxVertexUniforms:g,maxVaryings:p,maxFragmentUniforms:_,vertexTextures:y,floatFragmentTextures:x,floatVertexTextures:b,maxSamples:w}}function H2(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new Qi,a=new rt,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const d=h.length!==0||f||n!==0||i;return i=f,n=h.length,d},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(h,f){t=u(h,f,0)},this.setState=function(h,f,d){const m=h.clippingPlanes,v=h.clipIntersection,g=h.clipShadows,p=r.get(h);if(!i||m===null||m.length===0||s&&!g)s?u(null):l();else{const _=s?0:n,y=_*4;let x=p.clippingState||null;c.value=x,x=u(m,f,y,d);for(let b=0;b!==y;++b)x[b]=t[b];p.clippingState=x,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=_}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(h,f,d,m){const v=h!==null?h.length:0;let g=null;if(v!==0){if(g=c.value,m!==!0||g===null){const p=d+v*4,_=f.matrixWorldInverse;a.getNormalMatrix(_),(g===null||g.length0){const l=new $x(c.height/2);return l.fromEquirectangularTexture(r,o),e.set(o,l),o.addEventListener("dispose",i),t(l.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const c=e.get(a);c!==void 0&&(e.delete(a),c.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Ms extends Pc{constructor(e=-1,t=1,n=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=n,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,n,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=n,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),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,o=n+e,a=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,o=s+l*this.view.width,a-=u*this.view.offsetY,c=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,c,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 _o=4,y0=[.125,.215,.35,.446,.526,.582],is=20,gf=new Ms,x0=new Ne;let vf=null;const es=(1+Math.sqrt(5))/2,eo=1/es,b0=[new G(1,1,1),new G(-1,1,1),new G(1,1,-1),new G(-1,1,-1),new G(0,es,eo),new G(0,es,-eo),new G(eo,0,es),new G(-eo,0,es),new G(es,eo,0),new G(-es,eo,0)];class up{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,n=.1,i=100){vf=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,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=E0(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=S0(),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?y:0,y,y),u.setRenderTarget(i),v&&u.render(m,a),u.render(e,a)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=g}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Pr||e.mapping===Lr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=E0()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=S0());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Ot(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const c=this._cubeSize;wl(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(o,gf)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;iis&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${is}`);const p=[];let _=0;for(let S=0;Sy-_o?i-y+_o:0),w=4*(this._cubeSize-x);wl(t,b,w,3*x,2*x),c.setRenderTarget(t),c.render(h,gf)}}function X2(r){const e=[],t=[],n=[];let i=r;const s=r-_o+1+y0.length;for(let o=0;or-_o?c=y0[o-r+_o-1]:o===0&&(c=0),n.push(c);const l=1/(a-2),u=-l,h=1+l,f=[u,u,h,u,h,h,u,u,h,h,u,h],d=6,m=6,v=3,g=2,p=1,_=new Float32Array(v*m*d),y=new Float32Array(g*m*d),x=new Float32Array(p*m*d);for(let w=0;w2?0:-1,E=[S,M,0,S+2/3,M,0,S+2/3,M+1,0,S,M,0,S+2/3,M+1,0,S,M+1,0];_.set(E,v*m*w),y.set(f,g*m*w);const T=[w,w,w,w,w,w];x.set(T,p*m*w)}const b=new st;b.setAttribute("position",new wt(_,v)),b.setAttribute("uv",new wt(y,g)),b.setAttribute("faceIndex",new wt(x,p)),e.push(b),i>_o&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function w0(r,e,t){const n=new bi(r,e,t);return n.texture.mapping=Oo,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function wl(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function q2(r,e,t){const n=new Float32Array(is),i=new G(0,1,0);return new Ni({name:"SphericalGaussianBlur",defines:{n:is,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:cm(),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:nr,depthTest:!1,depthWrite:!1})}function S0(){return new Ni({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:cm(),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:nr,depthTest:!1,depthWrite:!1})}function E0(){return new Ni({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:cm(),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:nr,depthTest:!1,depthWrite:!1})}function cm(){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 Y2(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const c=a.mapping,l=c===Ka||c===Ja,u=c===Pr||c===Lr;if(l||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new up(r)),h=l?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(l&&h&&h.height>0||u&&h&&i(h)){t===null&&(t=new up(r));const f=l?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function i(a){let c=0;const l=6;for(let u=0;ue.maxTextureSize&&(T=Math.ceil(E/e.maxTextureSize),E=e.maxTextureSize);const L=new Float32Array(E*T*4*m),P=new ku(L,E,T,m);P.type=Li,P.needsUpdate=!0;const A=M*4;for(let V=0;V0)return r;const i=e*t;let s=M0[i];if(s===void 0&&(s=new Float32Array(i),M0[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Qt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t":" "} ${a}: ${t[o]}`)}return n.join(` +`)}function jC(r){switch(r){case xi:return["Linear","( value )"];case et:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",r),["Linear","( value )"]}}function D0(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` + +`+i+` + +`+YC(r.getShaderSource(e),o)}else return i}function $C(r,e){const t=jC(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function ZC(r,e){let t;switch(e){case vx:t="Linear";break;case _x:t="Reinhard";break;case yx:t="OptimizedCineon";break;case Wp:t="ACESFilmic";break;case xx:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function KC(r){return[r.extensionDerivatives||r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Oa).join(` +`)}function JC(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` +`)}function QC(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function hp(r){return r.replace(eR,nR)}const tR=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function nR(r,e){let t=Qe[e];if(t===void 0){const n=tR.get(e);if(n!==void 0)t=Qe[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return hp(t)}const iR=/#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 O0(r){return r.replace(iR,rR)}function rR(r,e,t,n){let i="";for(let s=parseInt(e);s0&&(g+=` +`),p=[d,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Oa).join(` +`),p.length>0&&(p+=` +`)):(g=[N0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,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 "+u:"",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.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 "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",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(Oa).join(` +`),p=[d,N0(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.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 "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==yi?"#define TONE_MAPPING":"",t.toneMapping!==yi?Qe.tonemapping_pars_fragment:"",t.toneMapping!==yi?ZC("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Qe.colorspace_pars_fragment,$C("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Oa).join(` +`)),o=hp(o),o=I0(o,t),o=U0(o,t),a=hp(a),a=I0(a,t),a=U0(a,t),o=O0(o),a=O0(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(_=`#version 300 es +`,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+g,p=["#define varying in",t.glslVersion===cp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===cp?"":"#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(` +`)+` +`+p);const y=_+g+o,x=_+p+a,b=L0(i,i.VERTEX_SHADER,y),w=L0(i,i.FRAGMENT_SHADER,x);if(i.attachShader(v,b),i.attachShader(v,w),t.index0AttributeName!==void 0?i.bindAttribLocation(v,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(v,0,"position"),i.linkProgram(v),r.debug.checkShaderErrors){const E=i.getProgramInfoLog(v).trim(),T=i.getShaderInfoLog(b).trim(),L=i.getShaderInfoLog(w).trim();let P=!0,A=!0;if(i.getProgramParameter(v,i.LINK_STATUS)===!1)if(P=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,v,b,w);else{const z=D0(i,b,"vertex"),V=D0(i,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(v,i.VALIDATE_STATUS)+` + +Program Info Log: `+E+` +`+z+` +`+V)}else E!==""?console.warn("THREE.WebGLProgram: Program Info Log:",E):(T===""||L==="")&&(A=!1);A&&(this.diagnostics={runnable:P,programLog:E,vertexShader:{log:T,prefix:g},fragmentShader:{log:L,prefix:p}})}i.deleteShader(b),i.deleteShader(w);let S;this.getUniforms=function(){return S===void 0&&(S=new uu(i,v)),S};let M;return this.getAttributes=function(){return M===void 0&&(M=QC(i,v)),M},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(v),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=qC++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=b,this.fragmentShader=w,this}let hR=0;class fR{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),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 n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.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 n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new dR(e),t.set(e,n)),n}}class dR{constructor(e){this.id=hR++,this.code=e,this.usedTimes=0}}function pR(r,e,t,n,i,s,o){const a=new hs,c=new fR,l=[],u=i.isWebGL2,h=i.logarithmicDepthBuffer,f=i.vertexTextures;let d=i.precision;const m={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 v(E){return E===0?"uv":`uv${E}`}function g(E,T,L,P,A){const z=P.fog,V=A.geometry,N=E.isMeshStandardMaterial?P.environment:null,C=(E.isMeshStandardMaterial?t:e).get(E.envMap||N),O=C&&C.mapping===Oo?C.image.height:null,k=m[E.type];E.precision!==null&&(d=i.getMaxPrecision(E.precision),d!==E.precision&&console.warn("THREE.WebGLProgram.getParameters:",E.precision,"not supported, using",d,"instead."));const U=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,R=U!==void 0?U.length:0;let F=0;V.morphAttributes.position!==void 0&&(F=1),V.morphAttributes.normal!==void 0&&(F=2),V.morphAttributes.color!==void 0&&(F=3);let H,Y,J,ie;if(k){const ut=gi[k];H=ut.vertexShader,Y=ut.fragmentShader}else H=E.vertexShader,Y=E.fragmentShader,c.update(E),J=c.getVertexShaderID(E),ie=c.getFragmentShaderID(E);const ne=r.getRenderTarget(),ee=A.isInstancedMesh===!0,ge=!!E.map,me=!!E.matcap,te=!!C,D=!!E.aoMap,Q=!!E.lightMap,j=!!E.bumpMap,K=!!E.normalMap,W=!!E.displacementMap,ye=!!E.emissiveMap,re=!!E.metalnessMap,fe=!!E.roughnessMap,xe=E.anisotropy>0,ce=E.clearcoat>0,Pe=E.iridescence>0,B=E.sheen>0,I=E.transmission>0,$=xe&&!!E.anisotropyMap,he=ce&&!!E.clearcoatMap,de=ce&&!!E.clearcoatNormalMap,pe=ce&&!!E.clearcoatRoughnessMap,Me=Pe&&!!E.iridescenceMap,we=Pe&&!!E.iridescenceThicknessMap,ue=B&&!!E.sheenColorMap,Ce=B&&!!E.sheenRoughnessMap,ze=!!E.specularMap,Le=!!E.specularColorMap,Ee=!!E.specularIntensityMap,De=I&&!!E.transmissionMap,Ve=I&&!!E.thicknessMap,je=!!E.gradientMap,Z=!!E.alphaMap,Ae=E.alphaTest>0,le=!!E.alphaHash,Re=!!E.extensions,Fe=!!V.attributes.uv1,tt=!!V.attributes.uv2,lt=!!V.attributes.uv3;return{isWebGL2:u,shaderID:k,shaderType:E.type,shaderName:E.name,vertexShader:H,fragmentShader:Y,defines:E.defines,customVertexShaderID:J,customFragmentShaderID:ie,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:d,instancing:ee,instancingColor:ee&&A.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:ne===null?r.outputColorSpace:ne.isXRRenderTarget===!0?ne.texture.colorSpace:xi,map:ge,matcap:me,envMap:te,envMapMode:te&&C.mapping,envMapCubeUVHeight:O,aoMap:D,lightMap:Q,bumpMap:j,normalMap:K,displacementMap:f&&W,emissiveMap:ye,normalMapObjectSpace:K&&E.normalMapType===Ux,normalMapTangentSpace:K&&E.normalMapType===Or,metalnessMap:re,roughnessMap:fe,anisotropy:xe,anisotropyMap:$,clearcoat:ce,clearcoatMap:he,clearcoatNormalMap:de,clearcoatRoughnessMap:pe,iridescence:Pe,iridescenceMap:Me,iridescenceThicknessMap:we,sheen:B,sheenColorMap:ue,sheenRoughnessMap:Ce,specularMap:ze,specularColorMap:Le,specularIntensityMap:Ee,transmission:I,transmissionMap:De,thicknessMap:Ve,gradientMap:je,opaque:E.transparent===!1&&E.blending===ls,alphaMap:Z,alphaTest:Ae,alphaHash:le,combine:E.combine,mapUv:ge&&v(E.map.channel),aoMapUv:D&&v(E.aoMap.channel),lightMapUv:Q&&v(E.lightMap.channel),bumpMapUv:j&&v(E.bumpMap.channel),normalMapUv:K&&v(E.normalMap.channel),displacementMapUv:W&&v(E.displacementMap.channel),emissiveMapUv:ye&&v(E.emissiveMap.channel),metalnessMapUv:re&&v(E.metalnessMap.channel),roughnessMapUv:fe&&v(E.roughnessMap.channel),anisotropyMapUv:$&&v(E.anisotropyMap.channel),clearcoatMapUv:he&&v(E.clearcoatMap.channel),clearcoatNormalMapUv:de&&v(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:pe&&v(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Me&&v(E.iridescenceMap.channel),iridescenceThicknessMapUv:we&&v(E.iridescenceThicknessMap.channel),sheenColorMapUv:ue&&v(E.sheenColorMap.channel),sheenRoughnessMapUv:Ce&&v(E.sheenRoughnessMap.channel),specularMapUv:ze&&v(E.specularMap.channel),specularColorMapUv:Le&&v(E.specularColorMap.channel),specularIntensityMapUv:Ee&&v(E.specularIntensityMap.channel),transmissionMapUv:De&&v(E.transmissionMap.channel),thicknessMapUv:Ve&&v(E.thicknessMap.channel),alphaMapUv:Z&&v(E.alphaMap.channel),vertexTangents:!!V.attributes.tangent&&(K||xe),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,vertexUv1s:Fe,vertexUv2s:tt,vertexUv3s:lt,pointsUvs:A.isPoints===!0&&!!V.attributes.uv&&(ge||Z),fog:!!z,useFog:E.fog===!0,fogExp2:z&&z.isFogExp2,flatShading:E.flatShading===!0,sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:A.isSkinnedMesh===!0,morphTargets:V.morphAttributes.position!==void 0,morphNormals:V.morphAttributes.normal!==void 0,morphColors:V.morphAttributes.color!==void 0,morphTargetsCount:R,morphTextureStride:F,numDirLights:T.directional.length,numPointLights:T.point.length,numSpotLights:T.spot.length,numSpotLightMaps:T.spotLightMap.length,numRectAreaLights:T.rectArea.length,numHemiLights:T.hemi.length,numDirLightShadows:T.directionalShadowMap.length,numPointLightShadows:T.pointShadowMap.length,numSpotLightShadows:T.spotShadowMap.length,numSpotLightShadowsWithMaps:T.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:E.dithering,shadowMapEnabled:r.shadowMap.enabled&&L.length>0,shadowMapType:r.shadowMap.type,toneMapping:E.toneMapped?r.toneMapping:yi,useLegacyLights:r.useLegacyLights,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===Dt,flipSided:E.side===vn,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionDerivatives:Re&&E.extensions.derivatives===!0,extensionFragDepth:Re&&E.extensions.fragDepth===!0,extensionDrawBuffers:Re&&E.extensions.drawBuffers===!0,extensionShaderTextureLOD:Re&&E.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:E.customProgramCacheKey()}}function p(E){const T=[];if(E.shaderID?T.push(E.shaderID):(T.push(E.customVertexShaderID),T.push(E.customFragmentShaderID)),E.defines!==void 0)for(const L in E.defines)T.push(L),T.push(E.defines[L]);return E.isRawShaderMaterial===!1&&(_(T,E),y(T,E),T.push(r.outputColorSpace)),T.push(E.customProgramCacheKey),T.join()}function _(E,T){E.push(T.precision),E.push(T.outputColorSpace),E.push(T.envMapMode),E.push(T.envMapCubeUVHeight),E.push(T.mapUv),E.push(T.alphaMapUv),E.push(T.lightMapUv),E.push(T.aoMapUv),E.push(T.bumpMapUv),E.push(T.normalMapUv),E.push(T.displacementMapUv),E.push(T.emissiveMapUv),E.push(T.metalnessMapUv),E.push(T.roughnessMapUv),E.push(T.anisotropyMapUv),E.push(T.clearcoatMapUv),E.push(T.clearcoatNormalMapUv),E.push(T.clearcoatRoughnessMapUv),E.push(T.iridescenceMapUv),E.push(T.iridescenceThicknessMapUv),E.push(T.sheenColorMapUv),E.push(T.sheenRoughnessMapUv),E.push(T.specularMapUv),E.push(T.specularColorMapUv),E.push(T.specularIntensityMapUv),E.push(T.transmissionMapUv),E.push(T.thicknessMapUv),E.push(T.combine),E.push(T.fogExp2),E.push(T.sizeAttenuation),E.push(T.morphTargetsCount),E.push(T.morphAttributeCount),E.push(T.numDirLights),E.push(T.numPointLights),E.push(T.numSpotLights),E.push(T.numSpotLightMaps),E.push(T.numHemiLights),E.push(T.numRectAreaLights),E.push(T.numDirLightShadows),E.push(T.numPointLightShadows),E.push(T.numSpotLightShadows),E.push(T.numSpotLightShadowsWithMaps),E.push(T.shadowMapType),E.push(T.toneMapping),E.push(T.numClippingPlanes),E.push(T.numClipIntersection),E.push(T.depthPacking)}function y(E,T){a.disableAll(),T.isWebGL2&&a.enable(0),T.supportsVertexTextures&&a.enable(1),T.instancing&&a.enable(2),T.instancingColor&&a.enable(3),T.matcap&&a.enable(4),T.envMap&&a.enable(5),T.normalMapObjectSpace&&a.enable(6),T.normalMapTangentSpace&&a.enable(7),T.clearcoat&&a.enable(8),T.iridescence&&a.enable(9),T.alphaTest&&a.enable(10),T.vertexColors&&a.enable(11),T.vertexAlphas&&a.enable(12),T.vertexUv1s&&a.enable(13),T.vertexUv2s&&a.enable(14),T.vertexUv3s&&a.enable(15),T.vertexTangents&&a.enable(16),T.anisotropy&&a.enable(17),E.push(a.mask),a.disableAll(),T.fog&&a.enable(0),T.useFog&&a.enable(1),T.flatShading&&a.enable(2),T.logarithmicDepthBuffer&&a.enable(3),T.skinning&&a.enable(4),T.morphTargets&&a.enable(5),T.morphNormals&&a.enable(6),T.morphColors&&a.enable(7),T.premultipliedAlpha&&a.enable(8),T.shadowMapEnabled&&a.enable(9),T.useLegacyLights&&a.enable(10),T.doubleSided&&a.enable(11),T.flipSided&&a.enable(12),T.useDepthPacking&&a.enable(13),T.dithering&&a.enable(14),T.transmission&&a.enable(15),T.sheen&&a.enable(16),T.opaque&&a.enable(17),T.pointsUvs&&a.enable(18),E.push(a.mask)}function x(E){const T=m[E.type];let L;if(T){const P=gi[T];L=am.clone(P.uniforms)}else L=E.uniforms;return L}function b(E,T){let L;for(let P=0,A=l.length;P0?n.push(p):d.transparent===!0?i.push(p):t.push(p)}function c(h,f,d,m,v,g){const p=o(h,f,d,m,v,g);d.transmission>0?n.unshift(p):d.transparent===!0?i.unshift(p):t.unshift(p)}function l(h,f){t.length>1&&t.sort(h||gR),n.length>1&&n.sort(f||F0),i.length>1&&i.sort(f||F0)}function u(){for(let h=e,f=r.length;h=s.length?(o=new k0,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function _R(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new G,color:new Ne};break;case"SpotLight":t={position:new G,direction:new G,color:new Ne,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new G,color:new Ne,distance:0,decay:0};break;case"HemisphereLight":t={direction:new G,skyColor:new Ne,groundColor:new Ne};break;case"RectAreaLight":t={color:new Ne,position:new G,halfWidth:new G,halfHeight:new G};break}return r[e.id]=t,t}}}function yR(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new be,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let xR=0;function bR(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function wR(r,e){const t=new _R,n=yR(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let u=0;u<9;u++)i.probe.push(new G);const s=new G,o=new Ke,a=new Ke;function c(u,h){let f=0,d=0,m=0;for(let L=0;L<9;L++)i.probe[L].set(0,0,0);let v=0,g=0,p=0,_=0,y=0,x=0,b=0,w=0,S=0,M=0;u.sort(bR);const E=h===!0?Math.PI:1;for(let L=0,P=u.length;L0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ke.LTC_FLOAT_1,i.rectAreaLTC2=ke.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=ke.LTC_HALF_1,i.rectAreaLTC2=ke.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=d,i.ambient[2]=m;const T=i.hash;(T.directionalLength!==v||T.pointLength!==g||T.spotLength!==p||T.rectAreaLength!==_||T.hemiLength!==y||T.numDirectionalShadows!==x||T.numPointShadows!==b||T.numSpotShadows!==w||T.numSpotMaps!==S)&&(i.directional.length=v,i.spot.length=p,i.rectArea.length=_,i.point.length=g,i.hemi.length=y,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=b,i.pointShadowMap.length=b,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=b,i.spotLightMatrix.length=w+S-M,i.spotLightMap.length=S,i.numSpotLightShadowsWithMaps=M,T.directionalLength=v,T.pointLength=g,T.spotLength=p,T.rectAreaLength=_,T.hemiLength=y,T.numDirectionalShadows=x,T.numPointShadows=b,T.numSpotShadows=w,T.numSpotMaps=S,i.version=xR++)}function l(u,h){let f=0,d=0,m=0,v=0,g=0;const p=h.matrixWorldInverse;for(let _=0,y=u.length;_=a.length?(c=new z0(r,e),a.push(c)):c=a[o],c}function i(){t=new WeakMap}return{get:n,dispose:i}}class Gu extends un{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=Ix,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 Vu extends un{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 ER=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,MR=`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 TR(r,e,t){let n=new zu;const i=new be,s=new be,o=new mt,a=new Gu({depthPacking:em}),c=new Vu,l={},u=t.maxTextureSize,h={[Oi]:vn,[vn]:Oi,[Dt]:Dt},f=new Ni({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new be},radius:{value:4}},vertexShader:ER,fragmentShader:MR}),d=f.clone();d.defines.HORIZONTAL_PASS=1;const m=new st;m.setAttribute("position",new wt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Ot(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Uu;let p=this.type;this.render=function(b,w,S){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const M=r.getRenderTarget(),E=r.getActiveCubeFace(),T=r.getActiveMipmapLevel(),L=r.state;L.setBlending(nr),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const P=p!==mi&&this.type===mi,A=p===mi&&this.type!==mi;for(let z=0,V=b.length;zu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/O.x),i.x=s.x*O.x,C.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/O.y),i.y=s.y*O.y,C.mapSize.y=s.y)),C.map===null||P===!0||A===!0){const U=this.type!==mi?{minFilter:Yt,magFilter:Yt}:{};C.map!==null&&C.map.dispose(),C.map=new bi(i.x,i.y,U),C.map.texture.name=N.name+".shadowMap",C.camera.updateProjectionMatrix()}r.setRenderTarget(C.map),r.clear();const k=C.getViewportCount();for(let U=0;U0||w.map&&w.alphaTest>0){const L=E.uuid,P=w.uuid;let A=l[L];A===void 0&&(A={},l[L]=A);let z=A[P];z===void 0&&(z=E.clone(),A[P]=z),E=z}if(E.visible=w.visible,E.wireframe=w.wireframe,M===mi?E.side=w.shadowSide!==null?w.shadowSide:w.side:E.side=w.shadowSide!==null?w.shadowSide:h[w.side],E.alphaMap=w.alphaMap,E.alphaTest=w.alphaTest,E.map=w.map,E.clipShadows=w.clipShadows,E.clippingPlanes=w.clippingPlanes,E.clipIntersection=w.clipIntersection,E.displacementMap=w.displacementMap,E.displacementScale=w.displacementScale,E.displacementBias=w.displacementBias,E.wireframeLinewidth=w.wireframeLinewidth,E.linewidth=w.linewidth,S.isPointLight===!0&&E.isMeshDistanceMaterial===!0){const L=r.properties.get(E);L.light=S}return E}function x(b,w,S,M,E){if(b.visible===!1)return;if(b.layers.test(w.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&E===mi)&&(!b.frustumCulled||n.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,b.matrixWorld);const P=e.update(b),A=b.material;if(Array.isArray(A)){const z=P.groups;for(let V=0,N=z.length;V=1):O.indexOf("OpenGL ES")!==-1&&(C=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),N=C>=2);let k=null,U={};const R=r.getParameter(r.SCISSOR_BOX),F=r.getParameter(r.VIEWPORT),H=new mt().fromArray(R),Y=new mt().fromArray(F);function J(Z,Ae,le,Re){const Fe=new Uint8Array(4),tt=r.createTexture();r.bindTexture(Z,tt),r.texParameteri(Z,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(Z,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let lt=0;lt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let v;const g=new WeakMap;let p=!1;try{p=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(B,I){return p?new OffscreenCanvas(B,I):oc("canvas")}function y(B,I,$,he){let de=1;if((B.width>he||B.height>he)&&(de=he/Math.max(B.width,B.height)),de<1||I===!0)if(typeof HTMLImageElement<"u"&&B instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&B instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&B instanceof ImageBitmap){const pe=I?xu:Math.floor,Me=pe(de*B.width),we=pe(de*B.height);v===void 0&&(v=_(Me,we));const ue=$?_(Me,we):v;return ue.width=Me,ue.height=we,ue.getContext("2d").drawImage(B,0,0,Me,we),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+B.width+"x"+B.height+") to ("+Me+"x"+we+")."),ue}else return"data"in B&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+B.width+"x"+B.height+")."),B;return B}function x(B){return lp(B.width)&&lp(B.height)}function b(B){return a?!1:B.wrapS!==gn||B.wrapT!==gn||B.minFilter!==Yt&&B.minFilter!==Pt}function w(B,I){return B.generateMipmaps&&I&&B.minFilter!==Yt&&B.minFilter!==Pt}function S(B){r.generateMipmap(B)}function M(B,I,$,he,de=!1){if(a===!1)return I;if(B!==null){if(r[B]!==void 0)return r[B];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+B+"'")}let pe=I;return I===r.RED&&($===r.FLOAT&&(pe=r.R32F),$===r.HALF_FLOAT&&(pe=r.R16F),$===r.UNSIGNED_BYTE&&(pe=r.R8)),I===r.RG&&($===r.FLOAT&&(pe=r.RG32F),$===r.HALF_FLOAT&&(pe=r.RG16F),$===r.UNSIGNED_BYTE&&(pe=r.RG8)),I===r.RGBA&&($===r.FLOAT&&(pe=r.RGBA32F),$===r.HALF_FLOAT&&(pe=r.RGBA16F),$===r.UNSIGNED_BYTE&&(pe=he===et&&de===!1?r.SRGB8_ALPHA8:r.RGBA8),$===r.UNSIGNED_SHORT_4_4_4_4&&(pe=r.RGBA4),$===r.UNSIGNED_SHORT_5_5_5_1&&(pe=r.RGB5_A1)),(pe===r.R16F||pe===r.R32F||pe===r.RG16F||pe===r.RG32F||pe===r.RGBA16F||pe===r.RGBA32F)&&e.get("EXT_color_buffer_float"),pe}function E(B,I,$){return w(B,$)===!0||B.isFramebufferTexture&&B.minFilter!==Yt&&B.minFilter!==Pt?Math.log2(Math.max(I.width,I.height))+1:B.mipmaps!==void 0&&B.mipmaps.length>0?B.mipmaps.length:B.isCompressedTexture&&Array.isArray(B.image)?I.mipmaps.length:1}function T(B){return B===Yt||B===_u||B===Ba?r.NEAREST:r.LINEAR}function L(B){const I=B.target;I.removeEventListener("dispose",L),A(I),I.isVideoTexture&&m.delete(I)}function P(B){const I=B.target;I.removeEventListener("dispose",P),V(I)}function A(B){const I=n.get(B);if(I.__webglInit===void 0)return;const $=B.source,he=g.get($);if(he){const de=he[I.__cacheKey];de.usedTimes--,de.usedTimes===0&&z(B),Object.keys(he).length===0&&g.delete($)}n.remove(B)}function z(B){const I=n.get(B);r.deleteTexture(I.__webglTexture);const $=B.source,he=g.get($);delete he[I.__cacheKey],o.memory.textures--}function V(B){const I=B.texture,$=n.get(B),he=n.get(I);if(he.__webglTexture!==void 0&&(r.deleteTexture(he.__webglTexture),o.memory.textures--),B.depthTexture&&B.depthTexture.dispose(),B.isWebGLCubeRenderTarget)for(let de=0;de<6;de++)r.deleteFramebuffer($.__webglFramebuffer[de]),$.__webglDepthbuffer&&r.deleteRenderbuffer($.__webglDepthbuffer[de]);else{if(r.deleteFramebuffer($.__webglFramebuffer),$.__webglDepthbuffer&&r.deleteRenderbuffer($.__webglDepthbuffer),$.__webglMultisampledFramebuffer&&r.deleteFramebuffer($.__webglMultisampledFramebuffer),$.__webglColorRenderbuffer)for(let de=0;de<$.__webglColorRenderbuffer.length;de++)$.__webglColorRenderbuffer[de]&&r.deleteRenderbuffer($.__webglColorRenderbuffer[de]);$.__webglDepthRenderbuffer&&r.deleteRenderbuffer($.__webglDepthRenderbuffer)}if(B.isWebGLMultipleRenderTargets)for(let de=0,pe=I.length;de=c&&console.warn("THREE.WebGLTextures: Trying to use "+B+" texture units while this GPU supports only "+c),N+=1,B}function k(B){const I=[];return I.push(B.wrapS),I.push(B.wrapT),I.push(B.wrapR||0),I.push(B.magFilter),I.push(B.minFilter),I.push(B.anisotropy),I.push(B.internalFormat),I.push(B.format),I.push(B.type),I.push(B.generateMipmaps),I.push(B.premultiplyAlpha),I.push(B.flipY),I.push(B.unpackAlignment),I.push(B.colorSpace),I.join()}function U(B,I){const $=n.get(B);if(B.isVideoTexture&&ce(B),B.isRenderTargetTexture===!1&&B.version>0&&$.__version!==B.version){const he=B.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ge($,B,I);return}}t.bindTexture(r.TEXTURE_2D,$.__webglTexture,r.TEXTURE0+I)}function R(B,I){const $=n.get(B);if(B.version>0&&$.__version!==B.version){ge($,B,I);return}t.bindTexture(r.TEXTURE_2D_ARRAY,$.__webglTexture,r.TEXTURE0+I)}function F(B,I){const $=n.get(B);if(B.version>0&&$.__version!==B.version){ge($,B,I);return}t.bindTexture(r.TEXTURE_3D,$.__webglTexture,r.TEXTURE0+I)}function H(B,I){const $=n.get(B);if(B.version>0&&$.__version!==B.version){me($,B,I);return}t.bindTexture(r.TEXTURE_CUBE_MAP,$.__webglTexture,r.TEXTURE0+I)}const Y={[Qa]:r.REPEAT,[gn]:r.CLAMP_TO_EDGE,[ec]:r.MIRRORED_REPEAT},J={[Yt]:r.NEAREST,[_u]:r.NEAREST_MIPMAP_NEAREST,[Ba]:r.NEAREST_MIPMAP_LINEAR,[Pt]:r.LINEAR,[Xp]:r.LINEAR_MIPMAP_NEAREST,[Dr]:r.LINEAR_MIPMAP_LINEAR},ie={[Nx]:r.NEVER,[Hx]:r.ALWAYS,[Fx]:r.LESS,[zx]:r.LEQUAL,[kx]:r.EQUAL,[Vx]:r.GEQUAL,[Bx]:r.GREATER,[Gx]:r.NOTEQUAL};function ne(B,I,$){if($?(r.texParameteri(B,r.TEXTURE_WRAP_S,Y[I.wrapS]),r.texParameteri(B,r.TEXTURE_WRAP_T,Y[I.wrapT]),(B===r.TEXTURE_3D||B===r.TEXTURE_2D_ARRAY)&&r.texParameteri(B,r.TEXTURE_WRAP_R,Y[I.wrapR]),r.texParameteri(B,r.TEXTURE_MAG_FILTER,J[I.magFilter]),r.texParameteri(B,r.TEXTURE_MIN_FILTER,J[I.minFilter])):(r.texParameteri(B,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(B,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),(B===r.TEXTURE_3D||B===r.TEXTURE_2D_ARRAY)&&r.texParameteri(B,r.TEXTURE_WRAP_R,r.CLAMP_TO_EDGE),(I.wrapS!==gn||I.wrapT!==gn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(B,r.TEXTURE_MAG_FILTER,T(I.magFilter)),r.texParameteri(B,r.TEXTURE_MIN_FILTER,T(I.minFilter)),I.minFilter!==Yt&&I.minFilter!==Pt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),I.compareFunction&&(r.texParameteri(B,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(B,r.TEXTURE_COMPARE_FUNC,ie[I.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const he=e.get("EXT_texture_filter_anisotropic");if(I.magFilter===Yt||I.minFilter!==Ba&&I.minFilter!==Dr||I.type===Li&&e.has("OES_texture_float_linear")===!1||a===!1&&I.type===Ao&&e.has("OES_texture_half_float_linear")===!1)return;(I.anisotropy>1||n.get(I).__currentAnisotropy)&&(r.texParameterf(B,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(I.anisotropy,i.getMaxAnisotropy())),n.get(I).__currentAnisotropy=I.anisotropy)}}function ee(B,I){let $=!1;B.__webglInit===void 0&&(B.__webglInit=!0,I.addEventListener("dispose",L));const he=I.source;let de=g.get(he);de===void 0&&(de={},g.set(he,de));const pe=k(I);if(pe!==B.__cacheKey){de[pe]===void 0&&(de[pe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,$=!0),de[pe].usedTimes++;const Me=de[B.__cacheKey];Me!==void 0&&(de[B.__cacheKey].usedTimes--,Me.usedTimes===0&&z(I)),B.__cacheKey=pe,B.__webglTexture=de[pe].texture}return $}function ge(B,I,$){let he=r.TEXTURE_2D;(I.isDataArrayTexture||I.isCompressedArrayTexture)&&(he=r.TEXTURE_2D_ARRAY),I.isData3DTexture&&(he=r.TEXTURE_3D);const de=ee(B,I),pe=I.source;t.bindTexture(he,B.__webglTexture,r.TEXTURE0+$);const Me=n.get(pe);if(pe.version!==Me.__version||de===!0){t.activeTexture(r.TEXTURE0+$),r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,I.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,I.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,I.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,r.NONE);const we=b(I)&&x(I.image)===!1;let ue=y(I.image,we,!1,u);ue=Pe(I,ue);const Ce=x(ue)||a,ze=s.convert(I.format,I.colorSpace);let Le=s.convert(I.type),Ee=M(I.internalFormat,ze,Le,I.colorSpace);ne(he,I,Ce);let De;const Ve=I.mipmaps,je=a&&I.isVideoTexture!==!0,Z=Me.__version===void 0||de===!0,Ae=E(I,ue,Ce);if(I.isDepthTexture)Ee=r.DEPTH_COMPONENT,a?I.type===Li?Ee=r.DEPTH_COMPONENT32F:I.type===tr?Ee=r.DEPTH_COMPONENT24:I.type===Mr?Ee=r.DEPTH24_STENCIL8:Ee=r.DEPTH_COMPONENT16:I.type===Li&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),I.format===Tr&&Ee===r.DEPTH_COMPONENT&&I.type!==Nu&&I.type!==tr&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),I.type=tr,Le=s.convert(I.type)),I.format===ms&&Ee===r.DEPTH_COMPONENT&&(Ee=r.DEPTH_STENCIL,I.type!==Mr&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),I.type=Mr,Le=s.convert(I.type))),Z&&(je?t.texStorage2D(r.TEXTURE_2D,1,Ee,ue.width,ue.height):t.texImage2D(r.TEXTURE_2D,0,Ee,ue.width,ue.height,0,ze,Le,null));else if(I.isDataTexture)if(Ve.length>0&&Ce){je&&Z&&t.texStorage2D(r.TEXTURE_2D,Ae,Ee,Ve[0].width,Ve[0].height);for(let le=0,Re=Ve.length;le>=1,Re>>=1}}else if(Ve.length>0&&Ce){je&&Z&&t.texStorage2D(r.TEXTURE_2D,Ae,Ee,Ve[0].width,Ve[0].height);for(let le=0,Re=Ve.length;le0&&Z++,t.texStorage2D(r.TEXTURE_CUBE_MAP,Z,De,ue[0].width,ue[0].height));for(let le=0;le<6;le++)if(we){Ve?t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+le,0,0,0,ue[le].width,ue[le].height,Le,Ee,ue[le].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+le,0,De,ue[le].width,ue[le].height,0,Le,Ee,ue[le].data);for(let Re=0;Re=r.TEXTURE_CUBE_MAP_POSITIVE_X&&de<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,he,de,n.get($).__webglTexture,0),t.bindFramebuffer(r.FRAMEBUFFER,null)}function D(B,I,$){if(r.bindRenderbuffer(r.RENDERBUFFER,B),I.depthBuffer&&!I.stencilBuffer){let he=r.DEPTH_COMPONENT16;if($||xe(I)){const de=I.depthTexture;de&&de.isDepthTexture&&(de.type===Li?he=r.DEPTH_COMPONENT32F:de.type===tr&&(he=r.DEPTH_COMPONENT24));const pe=fe(I);xe(I)?f.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,pe,he,I.width,I.height):r.renderbufferStorageMultisample(r.RENDERBUFFER,pe,he,I.width,I.height)}else r.renderbufferStorage(r.RENDERBUFFER,he,I.width,I.height);r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,B)}else if(I.depthBuffer&&I.stencilBuffer){const he=fe(I);$&&xe(I)===!1?r.renderbufferStorageMultisample(r.RENDERBUFFER,he,r.DEPTH24_STENCIL8,I.width,I.height):xe(I)?f.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,he,r.DEPTH24_STENCIL8,I.width,I.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,I.width,I.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,B)}else{const he=I.isWebGLMultipleRenderTargets===!0?I.texture:[I.texture];for(let de=0;de0&&xe(B)===!1){const we=pe?I:[I];$.__webglMultisampledFramebuffer=r.createFramebuffer(),$.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,$.__webglMultisampledFramebuffer);for(let ue=0;ue0&&xe(B)===!1){const I=B.isWebGLMultipleRenderTargets?B.texture:[B.texture],$=B.width,he=B.height;let de=r.COLOR_BUFFER_BIT;const pe=[],Me=B.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,we=n.get(B),ue=B.isWebGLMultipleRenderTargets===!0;if(ue)for(let Ce=0;Ce0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&I.__useRenderToTexture!==!1}function ce(B){const I=o.render.frame;m.get(B)!==I&&(m.set(B,I),B.update())}function Pe(B,I){const $=B.colorSpace,he=B.format,de=B.type;return B.isCompressedTexture===!0||B.format===yu||$!==xi&&$!==Cr&&($===et?a===!1?e.has("EXT_sRGB")===!0&&he===Ln?(B.format=yu,B.minFilter=Pt,B.generateMipmaps=!1):I=im.sRGBToLinear(I):(he!==Ln||de!==Ii)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",$)),I}this.allocateTextureUnit=O,this.resetTextureUnits=C,this.setTexture2D=U,this.setTexture2DArray=R,this.setTexture3D=F,this.setTextureCube=H,this.rebindTextures=K,this.setupRenderTarget=W,this.updateRenderTargetMipmap=ye,this.updateMultisampleRenderTarget=re,this.setupDepthRenderbuffer=j,this.setupFrameBufferTexture=te,this.useMultisampledRTT=xe}function tb(r,e,t){const n=t.isWebGL2;function i(s,o=Cr){let a;if(s===Ii)return r.UNSIGNED_BYTE;if(s===Yp)return r.UNSIGNED_SHORT_4_4_4_4;if(s===jp)return r.UNSIGNED_SHORT_5_5_5_1;if(s===bx)return r.BYTE;if(s===wx)return r.SHORT;if(s===Nu)return r.UNSIGNED_SHORT;if(s===qp)return r.INT;if(s===tr)return r.UNSIGNED_INT;if(s===Li)return r.FLOAT;if(s===Ao)return n?r.HALF_FLOAT:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Sx)return r.ALPHA;if(s===Ln)return r.RGBA;if(s===Ex)return r.LUMINANCE;if(s===Mx)return r.LUMINANCE_ALPHA;if(s===Tr)return r.DEPTH_COMPONENT;if(s===ms)return r.DEPTH_STENCIL;if(s===yu)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Tx)return r.RED;if(s===$p)return r.RED_INTEGER;if(s===Ax)return r.RG;if(s===Zp)return r.RG_INTEGER;if(s===Kp)return r.RGBA_INTEGER;if(s===iu||s===ru||s===su||s===ou)if(o===et)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===iu)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===ru)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===su)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===ou)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===iu)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===ru)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===su)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===ou)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===zd||s===Bd||s===Gd||s===Vd)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===zd)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===Bd)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===Gd)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Vd)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===Cx)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Hd||s===Wd)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===Hd)return o===et?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===Wd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===Xd||s===qd||s===Yd||s===jd||s===$d||s===Zd||s===Kd||s===Jd||s===Qd||s===ep||s===tp||s===np||s===ip||s===rp)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===Xd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===qd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===Yd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===jd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===$d)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===Zd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===Kd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===Jd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===Qd)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===ep)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===tp)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===np)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===ip)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===rp)return o===et?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===au)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===au)return o===et?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===Rx||s===sp||s===op||s===ap)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===au)return a.COMPRESSED_RED_RGTC1_EXT;if(s===sp)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===op)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===ap)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Mr?n?r.UNSIGNED_INT_24_8:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class nb extends Zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class yo extends gt{constructor(){super(),this.isGroup=!0,this.type="Group"}}const RR={type:"move"};class yf{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new yo,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 yo,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new G,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new G),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new yo,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new G,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new G),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 n of e.hand.values())this._getHandJoint(t,n)}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,n){let i=null,s=null,o=null;const a=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){o=!0;for(const v of e.hand.values()){const g=t.getJointPose(v,n),p=this._getHandJoint(l,v);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const u=l.joints["index-finger-tip"],h=l.joints["thumb-tip"],f=u.position.distanceTo(h.position),d=.02,m=.005;l.inputState.pinching&&f>d+m?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&f<=d-m&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),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(RR)))}return a!==null&&(a.visible=i!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new yo;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class ib extends Ft{constructor(e,t,n,i,s,o,a,c,l,u){if(u=u!==void 0?u:Tr,u!==Tr&&u!==ms)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===Tr&&(n=tr),n===void 0&&u===ms&&(n=Mr),super(null,i,s,o,a,c,u,n,l),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Yt,this.minFilter=c!==void 0?c:Yt,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class PR extends ar{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,f=null,d=null,m=null;const v=t.getContextAttributes();let g=null,p=null;const _=[],y=[],x=new Zt;x.layers.enable(1),x.viewport=new mt;const b=new Zt;b.layers.enable(2),b.viewport=new mt;const w=[x,b],S=new nb;S.layers.enable(1),S.layers.enable(2);let M=null,E=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(R){let F=_[R];return F===void 0&&(F=new yf,_[R]=F),F.getTargetRaySpace()},this.getControllerGrip=function(R){let F=_[R];return F===void 0&&(F=new yf,_[R]=F),F.getGripSpace()},this.getHand=function(R){let F=_[R];return F===void 0&&(F=new yf,_[R]=F),F.getHandSpace()};function T(R){const F=y.indexOf(R.inputSource);if(F===-1)return;const H=_[F];H!==void 0&&(H.update(R.inputSource,R.frame,l||o),H.dispatchEvent({type:R.type,data:R.inputSource}))}function L(){i.removeEventListener("select",T),i.removeEventListener("selectstart",T),i.removeEventListener("selectend",T),i.removeEventListener("squeeze",T),i.removeEventListener("squeezestart",T),i.removeEventListener("squeezeend",T),i.removeEventListener("end",L),i.removeEventListener("inputsourceschange",P);for(let R=0;R<_.length;R++){const F=y[R];F!==null&&(y[R]=null,_[R].disconnect(F))}M=null,E=null,e.setRenderTarget(g),d=null,f=null,h=null,i=null,p=null,U.stop(),n.isPresenting=!1,n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(R){s=R,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(R){a=R,n.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(R){l=R},this.getBaseLayer=function(){return f!==null?f:d},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return i},this.setSession=async function(R){if(i=R,i!==null){if(g=e.getRenderTarget(),i.addEventListener("select",T),i.addEventListener("selectstart",T),i.addEventListener("selectend",T),i.addEventListener("squeeze",T),i.addEventListener("squeezestart",T),i.addEventListener("squeezeend",T),i.addEventListener("end",L),i.addEventListener("inputsourceschange",P),v.xrCompatible!==!0&&await t.makeXRCompatible(),i.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const F={antialias:i.renderState.layers===void 0?v.antialias:!0,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:s};d=new XRWebGLLayer(i,t,F),i.updateRenderState({baseLayer:d}),p=new bi(d.framebufferWidth,d.framebufferHeight,{format:Ln,type:Ii,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil})}else{let F=null,H=null,Y=null;v.depth&&(Y=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,F=v.stencil?ms:Tr,H=v.stencil?Mr:tr);const J={colorFormat:t.RGBA8,depthFormat:Y,scaleFactor:s};h=new XRWebGLBinding(i,t),f=h.createProjectionLayer(J),i.updateRenderState({layers:[f]}),p=new bi(f.textureWidth,f.textureHeight,{format:Ln,type:Ii,depthTexture:new ib(f.textureWidth,f.textureHeight,H,void 0,void 0,void 0,void 0,void 0,void 0,F),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0});const ie=e.properties.get(p);ie.__ignoreDepthValues=f.ignoreDepthValues}p.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=await i.requestReferenceSpace(a),U.setContext(i),U.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode};function P(R){for(let F=0;F=0&&(y[Y]=null,_[Y].disconnect(H))}for(let F=0;F=y.length){y.push(H),Y=ie;break}else if(y[ie]===null){y[ie]=H,Y=ie;break}if(Y===-1)break}const J=_[Y];J&&J.connect(H)}}const A=new G,z=new G;function V(R,F,H){A.setFromMatrixPosition(F.matrixWorld),z.setFromMatrixPosition(H.matrixWorld);const Y=A.distanceTo(z),J=F.projectionMatrix.elements,ie=H.projectionMatrix.elements,ne=J[14]/(J[10]-1),ee=J[14]/(J[10]+1),ge=(J[9]+1)/J[5],me=(J[9]-1)/J[5],te=(J[8]-1)/J[0],D=(ie[8]+1)/ie[0],Q=ne*te,j=ne*D,K=Y/(-te+D),W=K*-te;F.matrixWorld.decompose(R.position,R.quaternion,R.scale),R.translateX(W),R.translateZ(K),R.matrixWorld.compose(R.position,R.quaternion,R.scale),R.matrixWorldInverse.copy(R.matrixWorld).invert();const ye=ne+K,re=ee+K,fe=Q-W,xe=j+(Y-W),ce=ge*ee/re*ye,Pe=me*ee/re*ye;R.projectionMatrix.makePerspective(fe,xe,ce,Pe,ye,re),R.projectionMatrixInverse.copy(R.projectionMatrix).invert()}function N(R,F){F===null?R.matrixWorld.copy(R.matrix):R.matrixWorld.multiplyMatrices(F.matrixWorld,R.matrix),R.matrixWorldInverse.copy(R.matrixWorld).invert()}this.updateCamera=function(R){if(i===null)return;S.near=b.near=x.near=R.near,S.far=b.far=x.far=R.far,(M!==S.near||E!==S.far)&&(i.updateRenderState({depthNear:S.near,depthFar:S.far}),M=S.near,E=S.far);const F=R.parent,H=S.cameras;N(S,F);for(let Y=0;Y0&&(g.alphaTest.value=p.alphaTest);const _=e.get(p).envMap;if(_&&(g.envMap.value=_,g.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap){g.lightMap.value=p.lightMap;const y=r.useLegacyLights===!0?Math.PI:1;g.lightMapIntensity.value=p.lightMapIntensity*y,t(p.lightMap,g.lightMapTransform)}p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function c(g,p,_,y){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*_,g.scale.value=y*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function l(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function u(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function h(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function f(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),e.get(p).envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function d(g,p,_){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===vn&&g.clearcoatNormalScale.value.negate())),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=_.texture,g.transmissionSamplerSize.value.set(_.width,_.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function m(g,p){p.matcap&&(g.matcap.value=p.matcap)}function v(g,p){const _=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(_.matrixWorld),g.nearDistance.value=_.shadow.camera.near,g.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function DR(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(_,y){const x=y.program;n.uniformBlockBinding(_,x)}function l(_,y){let x=i[_.id];x===void 0&&(m(_),x=u(_),i[_.id]=x,_.addEventListener("dispose",g));const b=y.program;n.updateUBOMapping(_,b);const w=e.render.frame;s[_.id]!==w&&(f(_),s[_.id]=w)}function u(_){const y=h();_.__bindingPointIndex=y;const x=r.createBuffer(),b=_.__size,w=_.usage;return r.bindBuffer(r.UNIFORM_BUFFER,x),r.bufferData(r.UNIFORM_BUFFER,b,w),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,y,x),x}function h(){for(let _=0;_0){w=x%b;const P=b-w;w!==0&&P-T.boundary<0&&(x+=b-w,E.__offset=x)}x+=T.storage}return w=x%b,w>0&&(x+=b-w),_.__size=x,_.__cache={},this}function v(_){const y={boundary:0,storage:0};return typeof _=="number"?(y.boundary=4,y.storage=4):_.isVector2?(y.boundary=8,y.storage=8):_.isVector3||_.isColor?(y.boundary=16,y.storage=12):_.isVector4?(y.boundary=16,y.storage=16):_.isMatrix3?(y.boundary=48,y.storage=48):_.isMatrix4?(y.boundary=64,y.storage=64):_.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",_),y}function g(_){const y=_.target;y.removeEventListener("dispose",g);const x=o.indexOf(y.__bindingPointIndex);o.splice(x,1),r.deleteBuffer(i[y.id]),delete i[y.id],delete s[y.id]}function p(){for(const _ in i)r.deleteBuffer(i[_]);o=[],i={},s={}}return{bind:c,update:l,dispose:p}}function IR(){const r=oc("canvas");return r.style.display="block",r}class lm{constructor(e={}){const{canvas:t=IR(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;n!==null?f=n.getContextAttributes().alpha:f=o;const d=new Uint32Array(4),m=new Int32Array(4);let v=null,g=null;const p=[],_=[];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=et,this.useLegacyLights=!0,this.toneMapping=yi,this.toneMappingExposure=1;const y=this;let x=!1,b=0,w=0,S=null,M=-1,E=null;const T=new mt,L=new mt;let P=null;const A=new Ne(0);let z=0,V=t.width,N=t.height,C=1,O=null,k=null;const U=new mt(0,0,V,N),R=new mt(0,0,V,N);let F=!1;const H=new zu;let Y=!1,J=!1,ie=null;const ne=new Ke,ee=new be,ge=new G,me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return S===null?C:1}let D=n;function Q(X,ae){for(let ve=0;ve0?g=_[_.length-1]:g=null,p.pop(),p.length>0?v=p[p.length-1]:v=null};function Mn(X,ae,ve,se){if(X.visible===!1)return;if(X.layers.test(ae.layers)){if(X.isGroup)ve=X.renderOrder;else if(X.isLOD)X.autoUpdate===!0&&X.update(ae);else if(X.isLight)g.pushLight(X),X.castShadow&&g.pushShadow(X);else if(X.isSprite){if(!X.frustumCulled||H.intersectsSprite(X)){se&&ge.setFromMatrixPosition(X.matrixWorld).applyMatrix4(ne);const We=I.update(X),qe=X.material;qe.visible&&v.push(X,We,qe,ve,ge.z,null)}}else if((X.isMesh||X.isLine||X.isPoints)&&(!X.frustumCulled||H.intersectsObject(X))){const We=I.update(X),qe=X.material;if(se&&(X.boundingSphere!==void 0?(X.boundingSphere===null&&X.computeBoundingSphere(),ge.copy(X.boundingSphere.center)):(We.boundingSphere===null&&We.computeBoundingSphere(),ge.copy(We.boundingSphere.center)),ge.applyMatrix4(X.matrixWorld).applyMatrix4(ne)),Array.isArray(qe)){const Ye=We.groups;for(let nt=0,Te=Ye.length;nt0&&yt(_e,Ge,ae,ve),se&&W.viewport(T.copy(se)),_e.length>0&&kt(_e,ae,ve),Ge.length>0&&kt(Ge,ae,ve),We.length>0&&kt(We,ae,ve),W.buffers.depth.setTest(!0),W.buffers.depth.setMask(!0),W.buffers.color.setMask(!0),W.setPolygonOffset(!1)}function yt(X,ae,ve,se){const _e=K.isWebGL2;ie===null&&(ie=new bi(1,1,{generateMipmaps:!0,type:j.has("EXT_color_buffer_half_float")?Ao:Ii,minFilter:Dr,samples:_e?4:0})),y.getDrawingBufferSize(ee),_e?ie.setSize(ee.x,ee.y):ie.setSize(xu(ee.x),xu(ee.y));const Ge=y.getRenderTarget();y.setRenderTarget(ie),y.getClearColor(A),z=y.getClearAlpha(),z<1&&y.setClearColor(16777215,.5),y.clear();const We=y.toneMapping;y.toneMapping=yi,kt(X,ve,se),fe.updateMultisampleRenderTarget(ie),fe.updateRenderTargetMipmap(ie);let qe=!1;for(let Ye=0,nt=ae.length;Ye0),Ze=!!ve.morphAttributes.position,At=!!ve.morphAttributes.normal,bt=!!ve.morphAttributes.color,dn=se.toneMapped?y.toneMapping:yi,Xn=ve.morphAttributes.position||ve.morphAttributes.normal||ve.morphAttributes.color,Ct=Xn!==void 0?Xn.length:0,at=re.get(se),fr=g.state.lights;if(Y===!0&&(J===!0||X!==E)){const on=X===E&&se.id===M;Me.setState(se,X,on)}let Wt=!1;se.version===at.__version?(at.needsLights&&at.lightsStateVersion!==fr.state.version||at.outputColorSpace!==qe||_e.isInstancedMesh&&at.instancing===!1||!_e.isInstancedMesh&&at.instancing===!0||_e.isSkinnedMesh&&at.skinning===!1||!_e.isSkinnedMesh&&at.skinning===!0||at.envMap!==Ye||se.fog===!0&&at.fog!==Ge||at.numClippingPlanes!==void 0&&(at.numClippingPlanes!==Me.numPlanes||at.numIntersection!==Me.numIntersection)||at.vertexAlphas!==nt||at.vertexTangents!==Te||at.morphTargets!==Ze||at.morphNormals!==At||at.morphColors!==bt||at.toneMapping!==dn||K.isWebGL2===!0&&at.morphTargetsCount!==Ct)&&(Wt=!0):(Wt=!0,at.__version=se.version);let qn=at.currentProgram;Wt===!0&&(qn=Vt(se,ae,_e));let Vo=!1,Bi=!1,Rs=!1;const Xt=qn.getUniforms(),si=at.uniforms;if(W.useProgram(qn.program)&&(Vo=!0,Bi=!0,Rs=!0),se.id!==M&&(M=se.id,Bi=!0),Vo||E!==X){if(Xt.setValue(D,"projectionMatrix",X.projectionMatrix),K.logarithmicDepthBuffer&&Xt.setValue(D,"logDepthBufFC",2/(Math.log(X.far+1)/Math.LN2)),E!==X&&(E=X,Bi=!0,Rs=!0),se.isShaderMaterial||se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshStandardMaterial||se.envMap){const on=Xt.map.cameraPosition;on!==void 0&&on.setValue(D,ge.setFromMatrixPosition(X.matrixWorld))}(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&Xt.setValue(D,"isOrthographic",X.isOrthographicCamera===!0),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial||se.isShadowMaterial||_e.isSkinnedMesh)&&Xt.setValue(D,"viewMatrix",X.matrixWorldInverse)}if(_e.isSkinnedMesh){Xt.setOptional(D,_e,"bindMatrix"),Xt.setOptional(D,_e,"bindMatrixInverse");const on=_e.skeleton;on&&(K.floatVertexTextures?(on.boneTexture===null&&on.computeBoneTexture(),Xt.setValue(D,"boneTexture",on.boneTexture,fe),Xt.setValue(D,"boneTextureSize",on.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}const Mi=ve.morphAttributes;if((Mi.position!==void 0||Mi.normal!==void 0||Mi.color!==void 0&&K.isWebGL2===!0)&&Ce.update(_e,ve,qn),(Bi||at.receiveShadow!==_e.receiveShadow)&&(at.receiveShadow=_e.receiveShadow,Xt.setValue(D,"receiveShadow",_e.receiveShadow)),se.isMeshGouraudMaterial&&se.envMap!==null&&(si.envMap.value=Ye,si.flipEnvMap.value=Ye.isCubeTexture&&Ye.isRenderTargetTexture===!1?-1:1),Bi&&(Xt.setValue(D,"toneMappingExposure",y.toneMappingExposure),at.needsLights&&Ei(si,Rs),Ge&&se.fog===!0&&he.refreshFogUniforms(si,Ge),he.refreshMaterialUniforms(si,se,C,N,ie),uu.upload(D,at.uniformsList,si,fe)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(uu.upload(D,at.uniformsList,si,fe),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&Xt.setValue(D,"center",_e.center),Xt.setValue(D,"modelViewMatrix",_e.modelViewMatrix),Xt.setValue(D,"normalMatrix",_e.normalMatrix),Xt.setValue(D,"modelMatrix",_e.matrixWorld),se.isShaderMaterial||se.isRawShaderMaterial){const on=se.uniformsGroups;for(let zr=0,Ho=on.length;zr0&&fe.useMultisampledRTT(X)===!1?_e=re.get(X).__webglMultisampledFramebuffer:_e=Te,T.copy(X.viewport),L.copy(X.scissor),P=X.scissorTest}else T.copy(U).multiplyScalar(C).floor(),L.copy(R).multiplyScalar(C).floor(),P=F;if(W.bindFramebuffer(D.FRAMEBUFFER,_e)&&K.drawBuffers&&se&&W.drawBuffers(X,_e),W.viewport(T),W.scissor(L),W.setScissorTest(P),Ge){const Ye=re.get(X.texture);D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+ae,Ye.__webglTexture,ve)}else if(We){const Ye=re.get(X.texture),nt=ae||0;D.framebufferTextureLayer(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,Ye.__webglTexture,ve||0,nt)}M=-1},this.readRenderTargetPixels=function(X,ae,ve,se,_e,Ge,We){if(!(X&&X.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qe=re.get(X).__webglFramebuffer;if(X.isWebGLCubeRenderTarget&&We!==void 0&&(qe=qe[We]),qe){W.bindFramebuffer(D.FRAMEBUFFER,qe);try{const Ye=X.texture,nt=Ye.format,Te=Ye.type;if(nt!==Ln&&Ee.convert(nt)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ze=Te===Ao&&(j.has("EXT_color_buffer_half_float")||K.isWebGL2&&j.has("EXT_color_buffer_float"));if(Te!==Ii&&Ee.convert(Te)!==D.getParameter(D.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Te===Li&&(K.isWebGL2||j.has("OES_texture_float")||j.has("WEBGL_color_buffer_float")))&&!Ze){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ae>=0&&ae<=X.width-se&&ve>=0&&ve<=X.height-_e&&D.readPixels(ae,ve,se,_e,Ee.convert(nt),Ee.convert(Te),Ge)}finally{const Ye=S!==null?re.get(S).__webglFramebuffer:null;W.bindFramebuffer(D.FRAMEBUFFER,Ye)}}},this.copyFramebufferToTexture=function(X,ae,ve=0){const se=Math.pow(2,-ve),_e=Math.floor(ae.image.width*se),Ge=Math.floor(ae.image.height*se);fe.setTexture2D(ae,0),D.copyTexSubImage2D(D.TEXTURE_2D,ve,0,0,X.x,X.y,_e,Ge),W.unbindTexture()},this.copyTextureToTexture=function(X,ae,ve,se=0){const _e=ae.image.width,Ge=ae.image.height,We=Ee.convert(ve.format),qe=Ee.convert(ve.type);fe.setTexture2D(ve,0),D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,ve.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ve.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,ve.unpackAlignment),ae.isDataTexture?D.texSubImage2D(D.TEXTURE_2D,se,X.x,X.y,_e,Ge,We,qe,ae.image.data):ae.isCompressedTexture?D.compressedTexSubImage2D(D.TEXTURE_2D,se,X.x,X.y,ae.mipmaps[0].width,ae.mipmaps[0].height,We,ae.mipmaps[0].data):D.texSubImage2D(D.TEXTURE_2D,se,X.x,X.y,We,qe,ae.image),se===0&&ve.generateMipmaps&&D.generateMipmap(D.TEXTURE_2D),W.unbindTexture()},this.copyTextureToTexture3D=function(X,ae,ve,se,_e=0){if(y.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ge=X.max.x-X.min.x+1,We=X.max.y-X.min.y+1,qe=X.max.z-X.min.z+1,Ye=Ee.convert(se.format),nt=Ee.convert(se.type);let Te;if(se.isData3DTexture)fe.setTexture3D(se,0),Te=D.TEXTURE_3D;else if(se.isDataArrayTexture)fe.setTexture2DArray(se,0),Te=D.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}D.pixelStorei(D.UNPACK_FLIP_Y_WEBGL,se.flipY),D.pixelStorei(D.UNPACK_PREMULTIPLY_ALPHA_WEBGL,se.premultiplyAlpha),D.pixelStorei(D.UNPACK_ALIGNMENT,se.unpackAlignment);const Ze=D.getParameter(D.UNPACK_ROW_LENGTH),At=D.getParameter(D.UNPACK_IMAGE_HEIGHT),bt=D.getParameter(D.UNPACK_SKIP_PIXELS),dn=D.getParameter(D.UNPACK_SKIP_ROWS),Xn=D.getParameter(D.UNPACK_SKIP_IMAGES),Ct=ve.isCompressedTexture?ve.mipmaps[0]:ve.image;D.pixelStorei(D.UNPACK_ROW_LENGTH,Ct.width),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,Ct.height),D.pixelStorei(D.UNPACK_SKIP_PIXELS,X.min.x),D.pixelStorei(D.UNPACK_SKIP_ROWS,X.min.y),D.pixelStorei(D.UNPACK_SKIP_IMAGES,X.min.z),ve.isDataTexture||ve.isData3DTexture?D.texSubImage3D(Te,_e,ae.x,ae.y,ae.z,Ge,We,qe,Ye,nt,Ct.data):ve.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),D.compressedTexSubImage3D(Te,_e,ae.x,ae.y,ae.z,Ge,We,qe,Ye,Ct.data)):D.texSubImage3D(Te,_e,ae.x,ae.y,ae.z,Ge,We,qe,Ye,nt,Ct),D.pixelStorei(D.UNPACK_ROW_LENGTH,Ze),D.pixelStorei(D.UNPACK_IMAGE_HEIGHT,At),D.pixelStorei(D.UNPACK_SKIP_PIXELS,bt),D.pixelStorei(D.UNPACK_SKIP_ROWS,dn),D.pixelStorei(D.UNPACK_SKIP_IMAGES,Xn),_e===0&&se.generateMipmaps&&D.generateMipmap(Te),W.unbindTexture()},this.initTexture=function(X){X.isCubeTexture?fe.setTextureCube(X,0):X.isData3DTexture?fe.setTexture3D(X,0):X.isDataArrayTexture||X.isCompressedArrayTexture?fe.setTexture2DArray(X,0):fe.setTexture2D(X,0),W.unbindTexture()},this.resetState=function(){b=0,w=0,S=null,W.reset(),De.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Di}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===et?Ar:Qp}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Ar?et:xi}}class rb extends lm{}rb.prototype.isWebGL1Renderer=!0;class Hu{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new Ne(e),this.density=t}clone(){return new Hu(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class Wu{constructor(e,t=1,n=1e3){this.isFog=!0,this.name="",this.color=new Ne(e),this.near=t,this.far=n}clone(){return new Wu(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class ac extends gt{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 Xu{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=rc,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Bn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;ie.far||t.push({distance:c,point:da.clone(),uv:Pn.getInterpolation(da,Sl,ma,El,B0,xf,G0,new be),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 Ml(r,e,t,n,i,s){ro.subVectors(r,t).addScalar(.5).multiply(n),i!==void 0?(pa.x=s*ro.x-i*ro.y,pa.y=i*ro.x+s*ro.y):pa.copy(ro),r.copy(e),r.x+=pa.x,r.y+=pa.y,r.applyMatrix4(sb)}const Tl=new G,V0=new G;class ab extends gt{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 n=0,i=t.length;n0){let n,i;for(n=1,i=t.length;n0){Tl.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(Tl);this.getObjectForDistance(i).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Tl.setFromMatrixPosition(e.matrixWorld),V0.setFromMatrixPosition(this.matrixWorld);const n=Tl.distanceTo(V0)/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;ic)continue;f.applyMatrix4(this.matrixWorld);const M=e.ray.origin.distanceTo(f);Me.far||t.push({distance:M,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}else{const p=Math.max(0,o.start),_=Math.min(g.count,o.start+o.count);for(let y=p,x=_-1;yc)continue;f.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(f);we.far||t.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:l,distanceToRay:Math.sqrt(a),point:c,index:e,face:null,object:o})}}class FR extends Ft{constructor(e,t,n,i,s,o,a,c,l){super(e,t,n,i,s,o,a,c,l),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Pt,this.magFilter=s!==void 0?s:Pt,this.generateMipmaps=!1;const u=this;function h(){u.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 kR extends Ft{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Yt,this.minFilter=Yt,this.generateMipmaps=!1,this.needsUpdate=!0}}class dm extends Ft{constructor(e,t,n,i,s,o,a,c,l,u,h,f){super(null,o,a,c,l,u,i,s,h,f),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class zR extends dm{constructor(e,t,n,i,s,o){super(e,t,n,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=gn}}class BR extends Ft{constructor(e,t,n,i,s,o,a,c,l){super(e,t,n,i,s,o,a,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class wi{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/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 n,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)n=this.getPoint(o/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const n=this.getLengths();let i=0;const s=n.length;let o;t?o=t:o=e*n[s-1];let a=0,c=s-1,l;for(;a<=c;)if(i=Math.floor(a+(c-a)/2),l=n[i]-o,l<0)a=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===o)return i/(s-1);const u=n[i],f=n[i+1]-u,d=(o-u)/f;return(i+d)/(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),c=t||(o.isVector2?new be:new G);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t){const n=new G,i=[],s=[],o=[],a=new G,c=new Ke;for(let d=0;d<=e;d++){const m=d/e;i[d]=this.getTangentAt(m,new G)}s[0]=new G,o[0]=new G;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),h=Math.abs(i[0].y),f=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),h<=l&&(l=h,n.set(0,1,0)),f<=l&&n.set(0,0,1),a.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let d=1;d<=e;d++){if(s[d]=s[d-1].clone(),o[d]=o[d-1].clone(),a.crossVectors(i[d-1],i[d]),a.length()>Number.EPSILON){a.normalize();const m=Math.acos(Bt(i[d-1].dot(i[d]),-1,1));s[d].applyMatrix4(c.makeRotationAxis(a,m))}o[d].crossVectors(i[d],s[d])}if(t===!0){let d=Math.acos(Bt(s[0].dot(s[e]),-1,1));d/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(d=-d);for(let m=1;m<=e;m++)s[m].applyMatrix4(c.makeRotationAxis(i[m],d*m)),o[m].crossVectors(i[m],s[m])}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 Yu extends wi{constructor(e=0,t=0,n=1,i=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t){const n=t||new be,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:c===0&&a===s-1&&(a=s-2,c=1);let l,u;this.closed||a>0?l=i[(a-1)%s]:(Ll.subVectors(i[0],i[1]).add(i[0]),l=Ll);const h=i[a%s],f=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 n.set(rv(a,c.x,l.x,u.x,h.x),rv(a,c.y,l.y,u.y,h.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const o=i[s]-n,a=this.curves[s],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,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 n=0,i=this.curves.length;n1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),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 Dc extends st{constructor(e=[new be(0,-.5),new be(.5,0),new be(0,.5)],t=12,n=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Bt(i,0,Math.PI*2);const s=[],o=[],a=[],c=[],l=[],u=1/t,h=new G,f=new be,d=new G,m=new G,v=new G;let g=0,p=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:g=e[_+1].x-e[_].x,p=e[_+1].y-e[_].y,d.x=p*1,d.y=-g,d.z=p*0,v.copy(d),d.normalize(),c.push(d.x,d.y,d.z);break;case e.length-1:c.push(v.x,v.y,v.z);break;default:g=e[_+1].x-e[_].x,p=e[_+1].y-e[_].y,d.x=p*1,d.y=-g,d.z=p*0,m.copy(d),d.x+=v.x,d.y+=v.y,d.z+=v.z,d.normalize(),c.push(d.x,d.y,d.z),v.copy(m)}for(let _=0;_<=t;_++){const y=n+_*u*i,x=Math.sin(y),b=Math.cos(y);for(let w=0;w<=e.length-1;w++){h.x=e[w].x*x,h.y=e[w].y,h.z=e[w].x*b,o.push(h.x,h.y,h.z),f.x=_/t,f.y=w/(e.length-1),a.push(f.x,f.y);const S=c[3*w+0]*x,M=c[3*w+1],E=c[3*w+0]*b;l.push(S,M,E)}}for(let _=0;_0&&y(!0),t>0&&y(!1)),this.setIndex(u),this.setAttribute("position",new He(h,3)),this.setAttribute("normal",new He(f,3)),this.setAttribute("uv",new He(d,2));function _(){const x=new G,b=new G;let w=0;const S=(t-e)/n;for(let M=0;M<=s;M++){const E=[],T=M/s,L=T*(t-e)+e;for(let P=0;P<=i;P++){const A=P/i,z=A*c+a,V=Math.sin(z),N=Math.cos(z);b.x=L*V,b.y=-T*n+g,b.z=L*N,h.push(b.x,b.y,b.z),x.set(V,S,N).normalize(),f.push(x.x,x.y,x.z),d.push(A,1-T),E.push(m++)}v.push(E)}for(let M=0;M.9&&S<.1&&(y<.2&&(o[_+0]+=1),x<.2&&(o[_+2]+=1),b<.2&&(o[_+4]+=1))}}function f(_){s.push(_.x,_.y,_.z)}function d(_,y){const x=_*3;y.x=e[x+0],y.y=e[x+1],y.z=e[x+2]}function m(){const _=new G,y=new G,x=new G,b=new G,w=new be,S=new be,M=new be;for(let E=0,T=0;E80*t){a=l=r[0],c=u=r[1];for(let m=t;ml&&(l=h),f>u&&(u=f);d=Math.max(l-a,u-c),d=d!==0?32767/d:0}return lc(s,o,t,a,c,d,0),o}};function vb(r,e,t,n,i){let s,o;if(i===uP(r,e,t,n)>0)for(s=e;s=e;s-=n)o=sv(s,r[s],r[s+1],o);return o&&eh(o,o.next)&&(hc(o),o=o.next),o}function _s(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(eh(t,t.next)||It(t.prev,t,t.next)===0)){if(hc(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function lc(r,e,t,n,i,s,o){if(!r)return;!o&&s&&rP(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?ZR(r,n,i,s):$R(r)){e.push(c.i/t|0),e.push(r.i/t|0),e.push(l.i/t|0),hc(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=KR(_s(r),e,t),lc(r,e,t,n,i,s,2)):o===2&&JR(r,e,t,n,i,s):lc(_s(r),e,t,n,i,s,1);break}}}function $R(r){const e=r.prev,t=r,n=r.next;if(It(e,t,n)>=0)return!1;const i=e.x,s=t.x,o=n.x,a=e.y,c=t.y,l=n.y,u=is?i>o?i:o:s>o?s:o,d=a>c?a>l?a:l:c>l?c:l;let m=n.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=d&&xo(i,a,s,c,o,l,m.x,m.y)&&It(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function ZR(r,e,t,n){const i=r.prev,s=r,o=r.next;if(It(i,s,o)>=0)return!1;const a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,f=o.y,d=ac?a>l?a:l:c>l?c:l,g=u>h?u>f?u:f:h>f?h:f,p=dp(d,m,e,t,n),_=dp(v,g,e,t,n);let y=r.prevZ,x=r.nextZ;for(;y&&y.z>=p&&x&&x.z<=_;){if(y.x>=d&&y.x<=v&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&xo(a,u,c,h,l,f,y.x,y.y)&&It(y.prev,y,y.next)>=0||(y=y.prevZ,x.x>=d&&x.x<=v&&x.y>=m&&x.y<=g&&x!==i&&x!==o&&xo(a,u,c,h,l,f,x.x,x.y)&&It(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;y&&y.z>=p;){if(y.x>=d&&y.x<=v&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&xo(a,u,c,h,l,f,y.x,y.y)&&It(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;x&&x.z<=_;){if(x.x>=d&&x.x<=v&&x.y>=m&&x.y<=g&&x!==i&&x!==o&&xo(a,u,c,h,l,f,x.x,x.y)&&It(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function KR(r,e,t){let n=r;do{const i=n.prev,s=n.next.next;!eh(i,s)&&_b(i,n,n.next,s)&&uc(i,s)&&uc(s,i)&&(e.push(i.i/t|0),e.push(n.i/t|0),e.push(s.i/t|0),hc(n),hc(n.next),n=r=s),n=n.next}while(n!==r);return _s(n)}function JR(r,e,t,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&aP(o,a)){let c=yb(o,a);o=_s(o,o.next),c=_s(c,c.next),lc(o,e,t,n,i,s,0),lc(c,e,t,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function QR(r,e,t,n){const i=[];let s,o,a,c,l;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>n&&(n=f,i=t.x=t.x&&t.x>=c&&s!==t.x&&xo(oi.x||t.x===i.x&&iP(i,t)))&&(i=t,u=h)),t=t.next;while(t!==a);return i}function iP(r,e){return It(r.prev,r,e.prev)<0&&It(e.next,r,r.next)<0}function rP(r,e,t,n){let i=r;do i.z===0&&(i.z=dp(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,sP(i)}function sP(r){let e,t,n,i,s,o,a,c,l=1;do{for(t=r,r=null,s=null,o=0;t;){for(o++,n=t,a=0,e=0;e0||c>0&&n;)a!==0&&(c===0||!n||t.z<=n.z)?(i=t,t=t.nextZ,a--):(i=n,n=n.nextZ,c--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;t=n}s.nextZ=null,l*=2}while(o>1);return r}function dp(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function oP(r){let e=r,t=r;do(e.x=(r-o)*(s-a)&&(r-o)*(n-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(n-a)}function aP(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!cP(r,e)&&(uc(r,e)&&uc(e,r)&&lP(r,e)&&(It(r.prev,r,e.prev)||It(r,e.prev,e))||eh(r,e)&&It(r.prev,r,r.next)>0&&It(e.prev,e,e.next)>0)}function It(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function eh(r,e){return r.x===e.x&&r.y===e.y}function _b(r,e,t,n){const i=Nl(It(r,e,t)),s=Nl(It(r,e,n)),o=Nl(It(t,n,r)),a=Nl(It(t,n,e));return!!(i!==s&&o!==a||i===0&&Ol(r,t,e)||s===0&&Ol(r,n,e)||o===0&&Ol(t,r,n)||a===0&&Ol(t,e,n))}function Ol(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function Nl(r){return r>0?1:r<0?-1:0}function cP(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&_b(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function uc(r,e){return It(r.prev,r,r.next)<0?It(r,e,r.next)>=0&&It(r,r.prev,e)>=0:It(r,e,r.prev)<0||It(r,r.next,e)<0}function lP(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.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&&(n=!n),t=t.next;while(t!==r);return n}function yb(r,e){const t=new pp(r.i,r.x,r.y),n=new pp(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function sv(r,e,t,n){const i=new pp(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function hc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function pp(r,e,t){this.i=r,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 uP(r,e,t,n){let i=0;for(let s=e,o=t-n;s2&&r[e-1].equals(r[0])&&r.pop()}function av(r,e){for(let t=0;tNumber.EPSILON){const I=Math.sqrt(Pe),$=Math.sqrt(xe*xe+ce*ce),he=Q.x-fe/I,de=Q.y+re/I,pe=j.x-ce/$,Me=j.y+xe/$,we=((pe-he)*ce-(Me-de)*xe)/(re*ce-fe*xe);K=he+re*we-D.x,W=de+fe*we-D.y;const ue=K*K+W*W;if(ue<=2)return new be(K,W);ye=Math.sqrt(ue/2)}else{let I=!1;re>Number.EPSILON?xe>Number.EPSILON&&(I=!0):re<-Number.EPSILON?xe<-Number.EPSILON&&(I=!0):Math.sign(fe)===Math.sign(ce)&&(I=!0),I?(K=-fe,W=re,ye=Math.sqrt(Pe)):(K=re,W=fe,ye=Math.sqrt(Pe/2))}return new be(K/ye,W/ye)}const k=[];for(let D=0,Q=z.length,j=Q-1,K=D+1;D=0;D--){const Q=D/g,j=d*Math.cos(Q*Math.PI/2),K=m*Math.sin(Q*Math.PI/2)+v;for(let W=0,ye=z.length;W=0;){const K=j;let W=j-1;W<0&&(W=D.length-1);for(let ye=0,re=u+g*2;ye0)&&d.push(y,x,w),(p!==n-1||c0!=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 Eb extends un{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Ne(16777215),this.specular=new Ne(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Rc,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 Mb extends un{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new Ne(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(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 Tb extends un{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(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 Ab extends un{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Ne(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Ne(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Rc,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 Cb extends un{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Ne(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Or,this.normalScale=new be(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 Rb extends Sn{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 Kn(r,e,t){return bm(r)?new r.constructor(r.subarray(e,t!==void 0?t:r.length)):r.slice(e,t)}function cs(r,e,t){return!r||!t&&r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function bm(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function Pb(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function mp(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,o=0;o!==n;++s){const a=t[s]*e;for(let c=0;c!==e;++c)i[o++]=r[a+c]}return i}function wm(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let o=s[n];if(o!==void 0)if(Array.isArray(o))do o=s[n],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=r[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[n],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do o=s[n],o!==void 0&&(e.push(s.time),t.push(o)),s=r[i++];while(s!==void 0)}function pP(r,e,t,n,i=30){const s=r.clone();s.name=e;const o=[];for(let c=0;c=n)){h.push(l.times[d]);for(let v=0;vs.tracks[c].times[0]&&(a=s.tracks[c].times[0]);for(let c=0;c=a.times[m]){const p=m*h+u,_=p+h-u;v=Kn(a.values,p,_)}else{const p=a.createInterpolant(),_=u,y=h-u;p.evaluate(s),v=Kn(p.resultBuffer,_,y)}c==="quaternion"&&new ln().fromArray(v).normalize().conjugate().toArray(v);const g=l.times.length;for(let p=0;p=s)){const a=t[1];e=s)break t}o=n,n=0;break n}break e}for(;n>>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=Kn(n,s,o),this.values=Kn(this.values,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 n=this.times,i=this.values,s=n.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const c=n[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(i!==void 0&&bm(i))for(let a=0,c=i.length;a!==c;++a){const l=i[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){const e=Kn(this.times),t=Kn(this.values),n=this.getValueSize(),i=this.getInterpolation()===cu,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*n,c=o*n,l=0;l!==n;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=Kn(e,0,o),this.values=Kn(t,0,o*n)):(this.times=e,this.values=t),this}clone(){const e=Kn(this.times,0),t=Kn(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}Si.prototype.TimeBufferType=Float32Array;Si.prototype.ValueBufferType=Float32Array;Si.prototype.DefaultInterpolation=nc;class As extends Si{}As.prototype.ValueTypeName="bool";As.prototype.ValueBufferType=Array;As.prototype.DefaultInterpolation=tc;As.prototype.InterpolantFactoryMethodLinear=void 0;As.prototype.InterpolantFactoryMethodSmooth=void 0;class Em extends Si{}Em.prototype.ValueTypeName="color";class fc extends Si{}fc.prototype.ValueTypeName="number";class Ib extends Oc{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(n-t)/(i-t);let l=e*a;for(let u=l+a;l!==u;l+=4)ln.slerpFlat(s,0,o,l-a,o,l,c);return s}}class ko extends Si{InterpolantFactoryMethodLinear(e){return new Ib(this.times,this.values,this.getValueSize(),e)}}ko.prototype.ValueTypeName="quaternion";ko.prototype.DefaultInterpolation=nc;ko.prototype.InterpolantFactoryMethodSmooth=void 0;class Cs extends Si{}Cs.prototype.ValueTypeName="string";Cs.prototype.ValueBufferType=Array;Cs.prototype.DefaultInterpolation=tc;Cs.prototype.InterpolantFactoryMethodLinear=void 0;Cs.prototype.InterpolantFactoryMethodSmooth=void 0;class dc extends Si{}dc.prototype.ValueTypeName="vector";class pc{constructor(e,t=-1,n,i=Fu){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Bn(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let o=0,a=n.length;o!==a;++o)t.push(_P(n[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=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=n.length;s!==o;++s)t.push(Si.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,o=[];for(let a=0;a1){const h=u[1];let f=i[h];f||(i[h]=f=[]),f.push(l)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,n));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const n=function(h,f,d,m,v){if(d.length!==0){const g=[],p=[];wm(d,g,p,m),g.length!==0&&v.push(new h(f,g,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let h=0;h{t&&t(s),this.manager.itemEnd(e)},0),s;if(Zi[e]!==void 0){Zi[e].push({onLoad:t,onProgress:n,onError:i});return}Zi[e]=[],Zi[e].push({onLoad:t,onProgress:n,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,c=this.responseType;fetch(o).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const u=Zi[e],h=l.body.getReader(),f=l.headers.get("Content-Length")||l.headers.get("X-File-Size"),d=f?parseInt(f):0,m=d!==0;let v=0;const g=new ReadableStream({start(p){_();function _(){h.read().then(({done:y,value:x})=>{if(y)p.close();else{v+=x.byteLength;const b=new ProgressEvent("progress",{lengthComputable:m,loaded:v,total:d});for(let w=0,S=u.length;w{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return l.json();default:if(a===void 0)return l.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),f=h&&h[1]?h[1].toLowerCase():void 0,d=new TextDecoder(f);return l.arrayBuffer().then(m=>d.decode(m))}}}).then(l=>{xs.add(e,l);const u=Zi[e];delete Zi[e];for(let h=0,f=u.length;h{const u=Zi[e];if(u===void 0)throw this.manager.itemError(e),l;delete Zi[e];for(let h=0,f=u.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 xP extends Dn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new sr(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(c){i?i(c):console.error(c),s.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n0: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=n(o.value);break;case"c":i.uniforms[s].value=new Ne().setHex(o.value);break;case"v2":i.uniforms[s].value=new be().fromArray(o.value);break;case"v3":i.uniforms[s].value=new G().fromArray(o.value);break;case"v4":i.uniforms[s].value=new mt().fromArray(o.value);break;case"m3":i.uniforms[s].value=new rt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new Ke().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=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap)),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(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 be().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.specularIntensityMap!==void 0&&(i.specularIntensityMap=n(e.specularIntensityMap)),e.specularColorMap!==void 0&&(i.specularColorMap=n(e.specularColorMap)),e.envMap!==void 0&&(i.envMap=n(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=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),e.clearcoatMap!==void 0&&(i.clearcoatMap=n(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(i.clearcoatNormalScale=new be().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(i.iridescenceMap=n(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(i.transmissionMap=n(e.transmissionMap)),e.thicknessMap!==void 0&&(i.thicknessMap=n(e.thicknessMap)),e.anisotropyMap!==void 0&&(i.anisotropyMap=n(e.anisotropyMap)),e.sheenColorMap!==void 0&&(i.sheenColorMap=n(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:bb,SpriteMaterial:um,RawShaderMaterial:wb,ShaderMaterial:Ni,PointsMaterial:fm,MeshPhysicalMaterial:Sb,MeshStandardMaterial:xm,MeshPhongMaterial:Eb,MeshToonMaterial:Mb,MeshNormalMaterial:Tb,MeshLambertMaterial:Ab,MeshDepthMaterial:Gu,MeshDistanceMaterial:Vu,MeshBasicMaterial:cr,MeshMatcapMaterial:Cb,LineDashedMaterial:Rb,LineBasicMaterial:Sn,Material:un};return new t[e]}}class gp{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let n=0,i=e.length;n0){const c=new Mm(t);s=new mc(c),s.setCrossOrigin(this.crossOrigin);for(let l=0,u=e.length;l0){i=new mc(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o"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,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=xs.get(e);if(o!==void 0)return s.manager.itemStart(e),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,fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){xs.add(e,c),t&&t(c),s.manager.itemEnd(e)}).catch(function(c){i&&i(c),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let Fl;class Cm{static getContext(){return Fl===void 0&&(Fl=new(window.AudioContext||window.webkitAudioContext)),Fl}static setContext(e){Fl=e}}class PP extends Dn{constructor(e){super(e)}load(e,t,n,i){const s=this,o=new sr(this.manager);o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(c){try{const l=c.slice(0);Cm.getContext().decodeAudioData(l,function(h){t(h)},a)}catch(l){a(l)}},n,i);function a(c){i?i(c):console.error(c),s.manager.itemError(e)}}}class LP extends ch{constructor(e,t,n=1){super(void 0,n),this.isHemisphereLightProbe=!0;const i=new Ne().set(e),s=new Ne().set(t),o=new G(i.r,i.g,i.b),a=new G(s.r,s.g,s.b),c=Math.sqrt(Math.PI),l=c*Math.sqrt(.75);this.sh.coefficients[0].copy(o).add(a).multiplyScalar(c),this.sh.coefficients[1].copy(o).sub(a).multiplyScalar(l)}}class DP extends ch{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const n=new Ne().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const mv=new Ke,gv=new Ke,qr=new Ke;class IP{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Zt,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Zt,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,qr.copy(e.projectionMatrix);const i=t.eyeSep/2,s=i*t.near/t.focus,o=t.near*Math.tan(us*t.fov*.5)/t.zoom;let a,c;gv.elements[12]=-i,mv.elements[12]=i,a=-o*t.aspect+s,c=o*t.aspect+s,qr.elements[0]=2*t.near/(c-a),qr.elements[8]=(c+a)/(c-a),this.cameraL.projectionMatrix.copy(qr),a=-o*t.aspect-s,c=o*t.aspect-s,qr.elements[0]=2*t.near/(c-a),qr.elements[8]=(c+a)/(c-a),this.cameraR.projectionMatrix.copy(qr)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(gv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(mv)}}class Rm{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=vv(),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=vv();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function vv(){return(typeof performance>"u"?Date:performance).now()}const Yr=new G,_v=new ln,UP=new G,jr=new G;class OP extends gt{constructor(){super(),this.type="AudioListener",this.context=Cm.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Rm}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,n=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Yr,_v,UP),jr.set(0,0,-1).applyQuaternion(_v),t.positionX){const i=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Yr.x,i),t.positionY.linearRampToValueAtTime(Yr.y,i),t.positionZ.linearRampToValueAtTime(Yr.z,i),t.forwardX.linearRampToValueAtTime(jr.x,i),t.forwardY.linearRampToValueAtTime(jr.y,i),t.forwardZ.linearRampToValueAtTime(jr.z,i),t.upX.linearRampToValueAtTime(n.x,i),t.upY.linearRampToValueAtTime(n.y,i),t.upZ.linearRampToValueAtTime(n.z,i)}else t.setPosition(Yr.x,Yr.y,Yr.z),t.setOrientation(jr.x,jr.y,jr.z,n.x,n.y,n.z)}}class Wb extends gt{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(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){a.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,o=i;s!==o;++s)t[s]=t[i+s%n];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 n=e;n=.5)for(let o=0;o!==s;++o)e[t+o]=e[n+o]}_slerp(e,t,n,i){ln.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const o=this._workIndex*s;ln.multiplyQuaternionsFlat(e,o,e,t,e,n),ln.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,n,i,s){const o=1-i;for(let a=0;a!==s;++a){const c=t+a;e[c]=e[c]*o+e[n+a]*i}}_lerpAdditive(e,t,n,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[n+o]*i}}}const Pm="\\[\\]\\.:\\/",zP=new RegExp("["+Pm+"]","g"),Lm="[^"+Pm+"]",BP="[^"+Pm.replace("\\.","")+"]",GP=/((?:WC+[\/:])*)/.source.replace("WC",Lm),VP=/(WCOD+)?/.source.replace("WCOD",BP),HP=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Lm),WP=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Lm),XP=new RegExp("^"+GP+VP+HP+WP+"$"),qP=["material","materials","bones","map"];class YP{constructor(e,t,n){const i=n||ht.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class ht{constructor(e,t,n){this.path=t,this.parsedPath=n||ht.parseTrackName(t),this.node=ht.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new ht.Composite(e,t,n):new ht(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(zP,"")}static parseTrackName(e){const t=XP.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);qP.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let o=0;o=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[l]=h,e[h]=c;for(let d=0,m=i;d!==m;++d){const v=n[d],g=v[h],p=v[u];v[u]=g,v[h]=p}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let s=this.nCachedObjects_,o=e.length;for(let a=0,c=arguments.length;a!==c;++a){const l=arguments[a],u=l.uuid,h=t[u];if(h!==void 0)if(delete t[u],h0&&(t[d.uuid]=h),e[h]=d,e.pop();for(let m=0,v=i;m!==v;++m){const g=n[m];g[h]=g[f],g.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const s=this._bindings;if(i!==void 0)return s[i];const o=this._paths,a=this._parsedPaths,c=this._objects,l=c.length,u=this.nCachedObjects_,h=new Array(l);i=s.length,n[e]=i,o.push(e),a.push(t),s.push(h);for(let f=u,d=c.length;f!==d;++f){const m=c[f];h[f]=new ht(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,c=o[a],l=e[a];t[l]=n,o[n]=c,o.pop(),s[n]=s[a],s.pop(),i[n]=i[a],i.pop()}}}class qb{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,o=s.length,a=new Array(o),c={endingStart:ss,endingEnd:ss};for(let l=0;l!==o;++l){const u=s[l].createInterpolant(null);a[l]=u,u.settings=c}this._interpolantSettings=c,this._interpolants=a,this._propertyBindings=new Array(o),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Lx,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,n){if(e.fadeOut(t),this.fadeIn(t),n){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,n){return e.crossFadeFrom(this,t,n)}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,n){const i=this._mixer,s=i.time,o=this.timeScale;let a=this._timeScaleInterpolant;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);const c=a.parameterPositions,l=a.sampleValues;return c[0]=s,c[1]=s+n,l[0]=e/o,l[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,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const o=this._updateTime(t),a=this._updateWeight(e);if(a>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case Jp:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulateAdditive(a);break;case Fu:default:for(let u=0,h=c.length;u!==h;++u)c[u].evaluate(o),l[u].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.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 n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const o=n===Dx;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(n===Px){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 c=this.repetitions-s;if(c<=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(c===1){const l=e<0;this._setEndings(l,!l,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,n){const i=this._interpolantSettings;n?(i.endingStart=os,i.endingEnd=os):(e?i.endingStart=this.zeroSlopeAtStart?os:ss:i.endingStart=ic,t?i.endingEnd=this.zeroSlopeAtEnd?os:ss:i.endingEnd=ic)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,c=o.sampleValues;return a[0]=s,c[0]=t,a[1]=s+e,c[1]=n,this}}const $P=new Float32Array(1);class ZP extends ar{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let u=l[c];u===void 0&&(u={},l[c]=u);for(let h=0;h!==s;++h){const f=i[h],d=f.name;let m=u[d];if(m!==void 0)++m.referenceCount,o[h]=m;else{if(m=o[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,c,d));continue}const v=t&&t._propertyBindings[h].binding.parsedPath;m=new Xb(ht.create(n,d,v),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,c,d),o[h]=m}a[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--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;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,s,o);const a=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)a[l].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,bv).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 wv=new G,kl=new G;class iL{constructor(e=new G,t=new G){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){wv.subVectors(e,this.start),kl.subVectors(this.end,this.start);const n=kl.dot(kl);let s=kl.dot(wv)/n;return t&&(s=Bt(s,0,1)),s}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).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 Sv=new G;class rL extends gt{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new st,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,c=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{Cv.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(Cv,t)}}setLength(e,t=e*.2,n=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),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 vL extends zi{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new st;i.setAttribute("position",new He(t,3)),i.setAttribute("color",new He(n,3));const s=new Sn({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,t,n){const i=new Ne,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(n),i.toArray(s,12),i.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class _L{constructor(){this.type="ShapePath",this.color=new Ne,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new cc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,s,o){return this.currentPath.bezierCurveTo(e,t,n,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(p){const _=[];for(let y=0,x=p.length;yNumber.EPSILON){if(T<0&&(S=_[w],E=-E,M=_[b],T=-T),p.yM.y)continue;if(p.y===S.y){if(p.x===S.x)return!0}else{const L=T*(p.x-S.x)-E*(p.y-S.y);if(L===0)return!0;if(L<0)continue;x=!x}}else{if(p.y!==S.y)continue;if(M.x<=p.x&&p.x<=S.x||S.x<=p.x&&p.x<=M.x)return!0}}return x}const i=Ui.isClockWise,s=this.subPaths;if(s.length===0)return[];let o,a,c;const l=[];if(s.length===1)return a=s[0],c=new fs,c.curves=a.curves,l.push(c),l;let u=!i(s[0].getPoints());u=e?!u:u;const h=[],f=[];let d=[],m=0,v;f[m]=void 0,d[m]=[];for(let p=0,_=s.length;p<_;p++)a=s[p],v=a.getPoints(),o=i(v),o=e?!o:o,o?(!u&&f[m]&&m++,f[m]={s:new fs,p:v},f[m].s.curves=a.curves,u&&m++,d[m]=[]):d[m].push({h:a,p:v[0]});if(!f[0])return t(s);if(f.length>1){let p=!1,_=0;for(let y=0,x=f.length;y0&&p===!1&&(d=h)}let g;for(let p=0,_=f.length;p<_;p++){c=f[p].s,l.push(c),g=d[p];for(let y=0,x=g.length;y{const h=typeof l=="function"?l(e):l;if(h!==e){const f=e;e=u?h:Object.assign({},e,h),t.forEach(d=>d(e,f))}},i=()=>e,s=(l,u=i,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let f=u(e);function d(){const m=u(e);if(!h(f,m)){const v=f;l(f=m,v)}}return t.add(d),()=>t.delete(d)},c={setState:n,getState:i,subscribe:(l,u,h)=>u||h?s(l,u,h):(t.add(l),()=>t.delete(l)),destroy:()=>t.clear()};return e=r(n,i,c),c}const xL=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),Rv=xL?q.useEffect:q.useLayoutEffect;function bL(r){const e=typeof r=="function"?yL(r):r,t=(n=e.getState,i=Object.is)=>{const[,s]=q.useReducer(g=>g+1,0),o=e.getState(),a=q.useRef(o),c=q.useRef(n),l=q.useRef(i),u=q.useRef(!1),h=q.useRef();h.current===void 0&&(h.current=n(o));let f,d=!1;(a.current!==o||c.current!==n||l.current!==i||u.current)&&(f=n(o),d=!i(h.current,f)),Rv(()=>{d&&(h.current=f),a.current=o,c.current=n,l.current=i,u.current=!1});const m=q.useRef(o);Rv(()=>{const g=()=>{try{const _=e.getState(),y=c.current(_);l.current(h.current,y)||(a.current=_,h.current=y,s())}catch{u.current=!0,s()}},p=e.subscribe(g);return e.getState()!==m.current&&g(),p},[]);const v=d?f:h.current;return q.useDebugValue(v),v};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const n=[t,e];return{next(){const i=n.length<=0;return{value:n.shift(),done:i}}}},t}var Df={exports:{}},If={};/** + * @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. + */var Pv;function wL(){return Pv||(Pv=1,(function(r){function e(O,k){var U=O.length;O.push(k);e:for(;0>>1,F=O[R];if(0>>1;Ri(J,U))iei(ne,J)?(O[R]=ne,O[ie]=U,R=ie):(O[R]=J,O[Y]=U,R=Y);else if(iei(ne,U))O[R]=ne,O[ie]=U,R=ie;else break e}}return k}function i(O,k){var U=O.sortIndex-k.sortIndex;return U!==0?U:O.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;r.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();r.unstable_now=function(){return o.now()-a}}var c=[],l=[],u=1,h=null,f=3,d=!1,m=!1,v=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(O){for(var k=t(l);k!==null;){if(k.callback===null)n(l);else if(k.startTime<=O)n(l),k.sortIndex=k.expirationTime,e(c,k);else break;k=t(l)}}function x(O){if(v=!1,y(O),!m)if(t(c)!==null)m=!0,N(b);else{var k=t(l);k!==null&&C(x,k.startTime-O)}}function b(O,k){m=!1,v&&(v=!1,p(M),M=-1),d=!0;var U=f;try{for(y(k),h=t(c);h!==null&&(!(h.expirationTime>k)||O&&!L());){var R=h.callback;if(typeof R=="function"){h.callback=null,f=h.priorityLevel;var F=R(h.expirationTime<=k);k=r.unstable_now(),typeof F=="function"?h.callback=F:h===t(c)&&n(c),y(k)}else n(c);h=t(c)}if(h!==null)var H=!0;else{var Y=t(l);Y!==null&&C(x,Y.startTime-k),H=!1}return H}finally{h=null,f=U,d=!1}}var w=!1,S=null,M=-1,E=5,T=-1;function L(){return!(r.unstable_now()-TO||125R?(O.sortIndex=U,e(l,O),t(c)===null&&O===t(l)&&(v?(p(M),M=-1):v=!0,C(x,U-R))):(O.sortIndex=F,e(c,O),m||d||(m=!0,N(b))),O},r.unstable_shouldYield=L,r.unstable_wrapCallback=function(O){var k=f;return function(){var U=f;f=k;try{return O.apply(this,arguments)}finally{f=U}}}})(If)),If}var Lv;function SL(){return Lv||(Lv=1,Df.exports=wL()),Df.exports}var Dv=SL();const Um={},Zb=r=>void Object.assign(Um,r);function EL(r,e){function t(u,{args:h=[],attach:f,...d},m){let v=`${u[0].toUpperCase()}${u.slice(1)}`,g;if(u==="primitive"){if(d.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const p=d.object;g=po(p,{type:u,root:m,attach:f,primitive:!0})}else{const p=Um[v];if(!p)throw new Error(`R3F: ${v} 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!");g=po(new p(...h),{type:u,root:m,attach:f,memoizedProps:{args:h}})}return g.__r3f.attach===void 0&&(g instanceof st?g.__r3f.attach="geometry":g instanceof un&&(g.__r3f.attach="material")),v!=="inject"&&Nf(g,d),g}function n(u,h){let f=!1;if(h){var d,m;(d=h.__r3f)!=null&&d.attach?Of(u,h,h.__r3f.attach):h.isObject3D&&u.isObject3D&&(u.add(h),f=!0),f||(m=u.__r3f)==null||m.objects.push(h),h.__r3f||po(h,{}),h.__r3f.parent=u,yp(h),mo(h)}}function i(u,h,f){let d=!1;if(h){var m,v;if((m=h.__r3f)!=null&&m.attach)Of(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"});const g=u.children.filter(_=>_!==h),p=g.indexOf(f);u.children=[...g.slice(0,p),h,...g.slice(p)],d=!0}d||(v=u.__r3f)==null||v.objects.push(h),h.__r3f||po(h,{}),h.__r3f.parent=u,yp(h),mo(h)}}function s(u,h,f=!1){u&&[...u].forEach(d=>o(h,d,f))}function o(u,h,f){if(h){var d,m,v;if(h.__r3f&&(h.__r3f.parent=null),(d=u.__r3f)!=null&&d.objects&&(u.__r3f.objects=u.__r3f.objects.filter(x=>x!==h)),(m=h.__r3f)!=null&&m.attach)Fv(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var g;u.remove(h),(g=h.__r3f)!=null&&g.root&&LL(h.__r3f.root,h)}const _=(v=h.__r3f)==null?void 0:v.primitive,y=f===void 0?h.dispose!==null&&!_:f;if(!_){var p;s((p=h.__r3f)==null?void 0:p.objects,h,y),s(h.children,h,y)}delete h.__r3f,y&&h.dispose&&h.type!=="Scene"&&Dv.unstable_scheduleCallback(Dv.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),mo(u)}}function a(u,h,f,d){var m;const v=(m=u.__r3f)==null?void 0:m.parent;if(!v)return;const g=t(h,f,u.__r3f.root);if(u.children){for(const p of u.children)p.__r3f&&n(g,p);u.children=u.children.filter(p=>!p.__r3f)}u.__r3f.objects.forEach(p=>n(g,p)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||o(v,u),g.parent&&(g.__r3f.autoRemovedBeforeAppend=!0),n(v,g),g.raycast&&g.__r3f.eventCount&&g.__r3f.root.getState().internal.interaction.push(g),[d,d.alternate].forEach(p=>{p!==null&&(p.stateNode=g,p.ref&&(typeof p.ref=="function"?p.ref(g):p.ref.current=g))})}const c=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:Yw({createInstance:t,removeChild:o,appendChild:n,appendInitialChild:n,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(u,h)=>{if(!h)return;const f=u.getState().scene;f.__r3f&&(f.__r3f.root=u,n(f,h))},removeChildFromContainer:(u,h)=>{h&&o(u.getState().scene,h)},insertInContainerBefore:(u,h,f)=>{if(!h||!f)return;const d=u.getState().scene;d.__r3f&&i(d,h,f)},getRootHostContext:()=>null,getChildHostContext:u=>u,finalizeInitialChildren(u){var h;return!!((h=u==null?void 0:u.__r3f)!=null?h:{}).handlers},prepareUpdate(u,h,f,d){var m;if(((m=u==null?void 0:u.__r3f)!=null?m:{}).primitive&&d.object&&d.object!==u)return[!0];{const{args:g=[],children:p,..._}=d,{args:y=[],children:x,...b}=f;if(!Array.isArray(g))throw new Error("R3F: the args prop must be an array!");if(g.some((S,M)=>S!==y[M]))return[!0];const w=i1(u,_,b,!0);return w.changes.length?[!1,w]:null}},commitUpdate(u,[h,f],d,m,v,g){h?a(u,d,v,g):Nf(u,f)},commitMount(u,h,f,d){var m;const v=(m=u.__r3f)!=null?m:{};u.raycast&&v.handlers&&v.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>po(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:f,parent:d}=(h=u.__r3f)!=null?h:{};f&&d&&Fv(d,u,f),u.isObject3D&&(u.visible=!1),mo(u)},unhideInstance(u,h){var f;const{attach:d,parent:m}=(f=u.__r3f)!=null?f:{};d&&m&&Of(m,u,d),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),mo(u)},createTextInstance:c,hideTextInstance:c,unhideTextInstance:c,getCurrentEventPriority:()=>e?e():go.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Rt.fun(performance.now)?performance.now:Rt.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Rt.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Rt.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Nf}}var Iv,Uv;const Uf=r=>"colorSpace"in r||"outputColorSpace"in r,Kb=()=>{var r;return(r=Um.ColorManagement)!=null?r:null},Jb=r=>r&&r.isOrthographicCamera,ML=r=>r&&r.hasOwnProperty("current"),Nc=typeof window<"u"&&((Iv=window.document)!=null&&Iv.createElement||((Uv=window.navigator)==null?void 0:Uv.product)==="ReactNative")?q.useLayoutEffect:q.useEffect;function Qb(r){const e=q.useRef(r);return Nc(()=>void(e.current=r),[r]),e}function TL({set:r}){return Nc(()=>(r(new Promise(()=>null)),()=>r(!1)),[r]),null}class e1 extends q.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}e1.getDerivedStateFromError=()=>({error:!0});const t1="__default",Ov=new Map,AL=r=>r&&!!r.memoized&&!!r.changes;function n1(r){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(r)?Math.min(Math.max(r[0],t),r[1]):r}const ya=r=>{var e;return(e=r.__r3f)==null?void 0:e.root.getState()},Rt={obj:r=>r===Object(r)&&!Rt.arr(r)&&typeof r!="function",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",boo:r=>typeof r=="boolean",und:r=>r===void 0,arr:r=>Array.isArray(r),equ(r,e,{arrays:t="shallow",objects:n="reference",strict:i=!0}={}){if(typeof r!=typeof e||!!r!=!!e)return!1;if(Rt.str(r)||Rt.num(r))return r===e;const s=Rt.obj(r);if(s&&n==="reference")return r===e;const o=Rt.arr(r);if(o&&t==="reference")return r===e;if((o||s)&&r===e)return!0;let a;for(a in r)if(!(a in e))return!1;if(s&&t==="shallow"&&n==="shallow"){for(a in i?e:r)if(!Rt.equ(r[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:r)if(r[a]!==e[a])return!1;if(Rt.und(a)){if(o&&r.length===0&&e.length===0||s&&Object.keys(r).length===0&&Object.keys(e).length===0)return!0;if(r!==e)return!1}return!0}};function CL(r){r.dispose&&r.type!=="Scene"&&r.dispose();for(const e in r)e.dispose==null||e.dispose(),delete r[e]}function po(r,e){const t=r;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},r}function _p(r,e){let t=r;if(e.includes("-")){const n=e.split("-"),i=n.pop();return t=n.reduce((s,o)=>s[o],r),{target:t,key:i}}else return{target:t,key:e}}const Nv=/-\d+$/;function Of(r,e,t){if(Rt.str(t)){if(Nv.test(t)){const s=t.replace(Nv,""),{target:o,key:a}=_p(r,s);Array.isArray(o[a])||(o[a]=[])}const{target:n,key:i}=_p(r,t);e.__r3f.previousAttach=n[i],n[i]=e}else e.__r3f.previousAttach=t(r,e)}function Fv(r,e,t){var n,i;if(Rt.str(t)){const{target:s,key:o}=_p(r,t),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(n=e.__r3f)==null||n.previousAttach==null||n.previousAttach(r,e);(i=e.__r3f)==null||delete i.previousAttach}function i1(r,{children:e,key:t,ref:n,...i},{children:s,key:o,ref:a,...c}={},l=!1){var u;const h=(u=r==null?void 0:r.__r3f)!=null?u:{},f=Object.entries(i),d=[];if(l){const v=Object.keys(c);for(let g=0;g{var p;if((p=r.__r3f)!=null&&p.primitive&&v==="object"||Rt.equ(g,c[v]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(v))return d.push([v,g,!0,[]]);let _=[];v.includes("-")&&(_=v.split("-")),d.push([v,g,!1,_]);for(const y in i){const x=i[y];y.startsWith(`${v}-`)&&d.push([y,x,!1,y.split("-")])}});const m={...i};return h.memoizedProps&&h.memoizedProps.args&&(m.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(m.attach=h.memoizedProps.attach),{memoized:m,changes:d}}function Nf(r,e){var t,n,i;const s=(t=r.__r3f)!=null?t:{},o=s.root,a=(n=o==null||o.getState==null?void 0:o.getState())!=null?n:{},{memoized:c,changes:l}=AL(e)?e:i1(r,e),u=s.eventCount;r.__r3f&&(r.__r3f.memoizedProps=c);for(let f=0;fy[x],r),!(_&&_.set))){const[y,...x]=g.reverse();p=x.reverse().reduce((b,w)=>b[w],r),d=y}if(m===t1+"remove")if(p.constructor){let y=Ov.get(p.constructor);y||(y=new p.constructor,Ov.set(p.constructor,y)),m=y[d]}else m=0;if(v)m?s.handlers[d]=m:delete s.handlers[d],s.eventCount=Object.keys(s.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof hs)){if(Array.isArray(m))_.fromArray?_.fromArray(m):_.set(...m);else if(_.copy&&m&&m.constructor&&_.constructor===m.constructor)_.copy(m);else if(m!==void 0){const y=_ instanceof Ne;!y&&_.setScalar?_.setScalar(m):_ instanceof hs&&m instanceof hs?_.mask=m.mask:_.set(m),!Kb()&&!a.linear&&y&&_.convertSRGBToLinear()}}else if(p[d]=m,p[d]instanceof Ft&&p[d].format===Ln&&p[d].type===Ii){const y=p[d];Uf(y)&&Uf(a.gl)?y.colorSpace=a.gl.outputColorSpace:y.encoding=a.gl.outputEncoding}mo(r)}if(s.parent&&a.internal&&r.raycast&&u!==s.eventCount){const f=a.internal.interaction.indexOf(r);f>-1&&a.internal.interaction.splice(f,1),s.eventCount&&a.internal.interaction.push(r)}return!(l.length===1&&l[0][0]==="onUpdate")&&l.length&&(i=r.__r3f)!=null&&i.parent&&yp(r),r}function mo(r){var e,t;const n=(e=r.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();n&&n.internal.frames===0&&n.invalidate()}function yp(r){r.onUpdate==null||r.onUpdate(r)}function RL(r,e){r.manual||(Jb(r)?(r.left=e.width/-2,r.right=e.width/2,r.top=e.height/2,r.bottom=e.height/-2):r.aspect=e.width/e.height,r.updateProjectionMatrix(),r.updateMatrixWorld())}function Wl(r){return(r.eventObject||r.object).uuid+"/"+r.index+r.instanceId}function PL(){var r;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return go.DefaultEventPriority;switch((r=e.event)==null?void 0:r.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return go.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return go.ContinuousEventPriority;default:return go.DefaultEventPriority}}function r1(r,e,t,n){const i=t.get(e);i&&(t.delete(e),t.size===0&&(r.delete(n),i.target.releasePointerCapture(n)))}function LL(r,e){const{internal:t}=r.getState();t.interaction=t.interaction.filter(n=>n!==e),t.initialHits=t.initialHits.filter(n=>n!==e),t.hovered.forEach((n,i)=>{(n.eventObject===e||n.object===e)&&t.hovered.delete(i)}),t.capturedMap.forEach((n,i)=>{r1(t.capturedMap,e,n,i)})}function DL(r){function e(c){const{internal:l}=r.getState(),u=c.offsetX-l.initialClick[0],h=c.offsetY-l.initialClick[1];return Math.round(Math.sqrt(u*u+h*h))}function t(c){return c.filter(l=>["Move","Over","Enter","Out","Leave"].some(u=>{var h;return(h=l.__r3f)==null?void 0:h.handlers["onPointer"+u]}))}function n(c,l){const u=r.getState(),h=new Set,f=[],d=l?l(u.internal.interaction):u.internal.interaction;for(let p=0;p{const y=ya(p.object),x=ya(_.object);return!y||!x?p.distance-_.distance:x.events.priority-y.events.priority||p.distance-_.distance}).filter(p=>{const _=Wl(p);return h.has(_)?!1:(h.add(_),!0)});u.events.filter&&(v=u.events.filter(v,u));for(const p of v){let _=p.object;for(;_;){var g;(g=_.__r3f)!=null&&g.eventCount&&f.push({...p,eventObject:_}),_=_.parent}}if("pointerId"in c&&u.internal.capturedMap.has(c.pointerId))for(let p of u.internal.capturedMap.get(c.pointerId).values())h.has(Wl(p.intersection))||f.push(p.intersection);return f}function i(c,l,u,h){const f=r.getState();if(c.length){const d={stopped:!1};for(const m of c){const v=ya(m.object)||f,{raycaster:g,pointer:p,camera:_,internal:y}=v,x=new G(p.x,p.y,0).unproject(_),b=T=>{var L,P;return(L=(P=y.capturedMap.get(T))==null?void 0:P.has(m.eventObject))!=null?L:!1},w=T=>{const L={intersection:m,target:l.target};y.capturedMap.has(T)?y.capturedMap.get(T).set(m.eventObject,L):y.capturedMap.set(T,new Map([[m.eventObject,L]])),l.target.setPointerCapture(T)},S=T=>{const L=y.capturedMap.get(T);L&&r1(y.capturedMap,m.eventObject,L,T)};let M={};for(let T in l){let L=l[T];typeof L!="function"&&(M[T]=L)}let E={...m,...M,pointer:p,intersections:c,stopped:d.stopped,delta:u,unprojectedPoint:x,ray:g.ray,camera:_,stopPropagation(){const T="pointerId"in l&&y.capturedMap.get(l.pointerId);if((!T||T.has(m.eventObject))&&(E.stopped=d.stopped=!0,y.hovered.size&&Array.from(y.hovered.values()).find(L=>L.eventObject===m.eventObject))){const L=c.slice(0,c.indexOf(m));s([...L,m])}},target:{hasPointerCapture:b,setPointerCapture:w,releasePointerCapture:S},currentTarget:{hasPointerCapture:b,setPointerCapture:w,releasePointerCapture:S},nativeEvent:l};if(h(E),d.stopped===!0)break}}return c}function s(c){const{internal:l}=r.getState();for(const u of l.hovered.values())if(!c.length||!c.find(h=>h.object===u.object&&h.index===u.index&&h.instanceId===u.instanceId)){const f=u.eventObject.__r3f,d=f==null?void 0:f.handlers;if(l.hovered.delete(Wl(u)),f!=null&&f.eventCount){const m={...u,intersections:c};d.onPointerOut==null||d.onPointerOut(m),d.onPointerLeave==null||d.onPointerLeave(m)}}}function o(c,l){for(let u=0;us([]);case"onLostPointerCapture":return l=>{const{internal:u}=r.getState();"pointerId"in l&&u.capturedMap.has(l.pointerId)&&requestAnimationFrame(()=>{u.capturedMap.has(l.pointerId)&&(u.capturedMap.delete(l.pointerId),s([]))})}}return function(u){const{onPointerMissed:h,internal:f}=r.getState();f.lastEvent.current=u;const d=c==="onPointerMove",m=c==="onClick"||c==="onContextMenu"||c==="onDoubleClick",g=n(u,d?t:void 0),p=m?e(u):0;c==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=g.map(y=>y.eventObject)),m&&!g.length&&p<=2&&(o(u,f.interaction),h&&h(u)),d&&s(g);function _(y){const x=y.eventObject,b=x.__r3f,w=b==null?void 0:b.handlers;if(b!=null&&b.eventCount)if(d){if(w.onPointerOver||w.onPointerEnter||w.onPointerOut||w.onPointerLeave){const S=Wl(y),M=f.hovered.get(S);M?M.stopped&&y.stopPropagation():(f.hovered.set(S,y),w.onPointerOver==null||w.onPointerOver(y),w.onPointerEnter==null||w.onPointerEnter(y))}w.onPointerMove==null||w.onPointerMove(y)}else{const S=w[c];S?(!m||f.initialHits.includes(x))&&(o(u,f.interaction.filter(M=>!f.initialHits.includes(M))),S(y)):m&&f.initialHits.includes(x)&&o(u,f.interaction.filter(M=>!f.initialHits.includes(M)))}}i(g,u,p,_)}}return{handlePointer:a}}const s1=r=>!!(r!=null&&r.render),o1=q.createContext(null),IL=(r,e)=>{const t=bL((a,c)=>{const l=new G,u=new G,h=new G;function f(p=c().camera,_=u,y=c().size){const{width:x,height:b,top:w,left:S}=y,M=x/b;_ instanceof G?h.copy(_):h.set(..._);const E=p.getWorldPosition(l).distanceTo(h);if(Jb(p))return{width:x/p.zoom,height:b/p.zoom,top:w,left:S,factor:1,distance:E,aspect:M};{const T=p.fov*Math.PI/180,L=2*Math.tan(T/2)*E,P=L*(x/b);return{width:P,height:L,top:w,left:S,factor:x/P,distance:E,aspect:M}}}let d;const m=p=>a(_=>({performance:{..._.performance,current:p}})),v=new be;return{set:a,get:c,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(p=1)=>r(c(),p),advance:(p,_)=>e(p,_,c()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Rm,pointer:v,mouse:v,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const p=c();d&&clearTimeout(d),p.performance.current!==p.performance.min&&m(p.performance.min),d=setTimeout(()=>m(c().performance.max),p.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:f},setEvents:p=>a(_=>({..._,events:{..._.events,...p}})),setSize:(p,_,y,x,b)=>{const w=c().camera,S={width:p,height:_,top:x||0,left:b||0,updateStyle:y};a(M=>({size:S,viewport:{...M.viewport,...f(w,u,S)}}))},setDpr:p=>a(_=>{const y=n1(p);return{viewport:{..._.viewport,dpr:y,initialDpr:_.viewport.initialDpr||y}}}),setFrameloop:(p="always")=>{const _=c().clock;_.stop(),_.elapsedTime=0,p!=="never"&&(_.start(),_.elapsedTime=0),a(()=>({frameloop:p}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:q.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(p,_,y)=>{const x=c().internal;return x.priority=x.priority+(_>0?1:0),x.subscribers.push({ref:p,priority:_,store:y}),x.subscribers=x.subscribers.sort((b,w)=>b.priority-w.priority),()=>{const b=c().internal;b!=null&&b.subscribers&&(b.priority=b.priority-(_>0?1:0),b.subscribers=b.subscribers.filter(w=>w.ref!==p))}}}}}),n=t.getState();let i=n.size,s=n.viewport.dpr,o=n.camera;return t.subscribe(()=>{const{camera:a,size:c,viewport:l,gl:u,set:h}=t.getState();if(c!==i||l.dpr!==s){var f;i=c,s=l.dpr,RL(a,c),u.setPixelRatio(l.dpr);const d=(f=c.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(c.width,c.height,d)}a!==o&&(o=a,h(d=>({viewport:{...d.viewport,...d.viewport.getCurrentViewport(a)}})))}),t.subscribe(a=>r(a)),t};function UL(r,e){const t={callback:r};return e.add(t),()=>void e.delete(t)}let Xl,a1=new Set,OL=new Set,NL=new Set;const FL=r=>UL(r,a1);function Ff(r,e){if(r.size)for(const{callback:t}of r.values())t(e)}function xa(r,e){switch(r){case"before":return Ff(a1,e);case"after":return Ff(OL,e);case"tail":return Ff(NL,e)}}let kf,zf;function Bf(r,e,t){let n=e.clock.getDelta();for(e.frameloop==="never"&&typeof r=="number"&&(n=r-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=r),kf=e.internal.subscribers,Xl=0;Xl0)&&!((l=i.gl.xr)!=null&&l.isPresenting)&&(t+=Bf(c,i))}if(xa("after",c),t===0)return xa("tail",c),e=!1,cancelAnimationFrame(n)}function o(c,l=1){var u;if(!c)return r.forEach(h=>o(h.store.getState()),l);(u=c.gl.xr)!=null&&u.isPresenting||!c.internal.active||c.frameloop==="never"||(c.internal.frames=Math.min(60,c.internal.frames+l),e||(e=!0,requestAnimationFrame(s)))}function a(c,l=!0,u,h){if(l&&xa("before",c),u)Bf(c,u,h);else for(const f of r.values())Bf(c,f.store.getState());l&&xa("after",c)}return{loop:s,invalidate:o,advance:a}}function c1(){const r=q.useContext(o1);if(!r)throw new Error("R3F: Hooks can only be used within the Canvas component!");return r}function Kt(r=t=>t,e){return c1()(r,e)}function uh(r,e=0){const t=c1(),n=t.getState().internal.subscribe,i=Qb(r);return Nc(()=>n(i,e,t),[e,n,t]),null}const Po=new Map,{invalidate:kv,advance:zv}=kL(Po),{reconciler:wu,applyProps:ts}=EL(Po,PL),ao={objects:"shallow",strict:!1},zL=(r,e)=>{const t=typeof r=="function"?r(e):r;return s1(t)?t:new lm({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...r})};function BL(r,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement&&r.parentElement){const{width:t,height:n,top:i,left:s}=r.parentElement.getBoundingClientRect();return{width:t,height:n,top:i,left:s}}else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas)return{width:r.width,height:r.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function GL(r){const e=Po.get(r),t=e==null?void 0:e.fiber,n=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=n||IL(kv,zv),o=t||wu.createContainer(s,go.ConcurrentRoot,null,!1,null,"",i,null);e||Po.set(r,{fiber:o,store:s});let a,c=!1,l;return{configure(u={}){let{gl:h,size:f,scene:d,events:m,onCreated:v,shadows:g=!1,linear:p=!1,flat:_=!1,legacy:y=!1,orthographic:x=!1,frameloop:b="always",dpr:w=[1,2],performance:S,raycaster:M,camera:E,onPointerMissed:T}=u,L=s.getState(),P=L.gl;L.gl||L.set({gl:P=zL(h,r)});let A=L.raycaster;A||L.set({raycaster:A=new Im});const{params:z,...V}=M||{};if(Rt.equ(V,A,ao)||ts(A,{...V}),Rt.equ(z,A.params,ao)||ts(A,{params:{...A.params,...z}}),!L.camera||L.camera===l&&!Rt.equ(l,E,ao)){l=E;const R=E instanceof Pc,F=R?E:x?new Ms(0,0,0,0,.1,1e3):new Zt(75,0,.1,1e3);R||(F.position.z=5,E&&ts(F,E),!L.camera&&!(E!=null&&E.rotation)&&F.lookAt(0,0,0)),L.set({camera:F})}if(!L.scene){let R;d instanceof ac?R=d:(R=new ac,d&&ts(R,d)),L.set({scene:po(R)})}if(!L.xr){const R=(Y,J)=>{const ie=s.getState();ie.frameloop!=="never"&&zv(Y,!0,ie,J)},F=()=>{const Y=s.getState();Y.gl.xr.enabled=Y.gl.xr.isPresenting,Y.gl.xr.setAnimationLoop(Y.gl.xr.isPresenting?R:null),Y.gl.xr.isPresenting||kv(Y)},H={connect(){const Y=s.getState().gl;Y.xr.addEventListener("sessionstart",F),Y.xr.addEventListener("sessionend",F)},disconnect(){const Y=s.getState().gl;Y.xr.removeEventListener("sessionstart",F),Y.xr.removeEventListener("sessionend",F)}};P.xr&&H.connect(),L.set({xr:H})}if(P.shadowMap){const R=P.shadowMap.enabled,F=P.shadowMap.type;if(P.shadowMap.enabled=!!g,Rt.boo(g))P.shadowMap.type=za;else if(Rt.str(g)){var N;const H={basic:$y,percentage:Uu,soft:za,variance:mi};P.shadowMap.type=(N=H[g])!=null?N:za}else Rt.obj(g)&&Object.assign(P.shadowMap,g);(R!==P.shadowMap.enabled||F!==P.shadowMap.type)&&(P.shadowMap.needsUpdate=!0)}const C=Kb();C&&("enabled"in C?C.enabled=!y:"legacyMode"in C&&(C.legacyMode=y)),ts(P,{outputEncoding:p?3e3:3001,toneMapping:_?yi:Wp}),L.legacy!==y&&L.set(()=>({legacy:y})),L.linear!==p&&L.set(()=>({linear:p})),L.flat!==_&&L.set(()=>({flat:_})),h&&!Rt.fun(h)&&!s1(h)&&!Rt.equ(h,P,ao)&&ts(P,h),m&&!L.events.handlers&&L.set({events:m(s)});const U=BL(r,f);return Rt.equ(U,L.size,ao)||L.setSize(U.width,U.height,U.updateStyle,U.top,U.left),w&&L.viewport.dpr!==n1(w)&&L.setDpr(w),L.frameloop!==b&&L.setFrameloop(b),L.onPointerMissed||L.set({onPointerMissed:T}),S&&!Rt.equ(S,L.performance,ao)&&L.set(R=>({performance:{...R.performance,...S}})),a=v,c=!0,this},render(u){return c||this.configure(),wu.updateContainer(q.createElement(VL,{store:s,children:u,onCreated:a,rootElement:r}),o,null,()=>{}),s},unmount(){l1(r)}}}function VL({store:r,children:e,onCreated:t,rootElement:n}){return Nc(()=>{const i=r.getState();i.set(s=>({internal:{...s.internal,active:!0}})),t&&t(i),r.getState().events.connected||i.events.connect==null||i.events.connect(n)},[]),q.createElement(o1.Provider,{value:r},e)}function l1(r,e){const t=Po.get(r),n=t==null?void 0:t.fiber;if(n){const i=t==null?void 0:t.store.getState();i&&(i.internal.active=!1),wu.updateContainer(null,n,null,()=>{i&&setTimeout(()=>{try{var s,o,a,c;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(),(c=i.gl)!=null&&c.xr&&i.xr.disconnect(),CL(i),Po.delete(r)}catch{}},500)})}}wu.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:q.version});const Gf={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 HL(r){const{handlePointer:e}=DL(r);return{priority:1,enabled:!0,compute(t,n,i){n.pointer.set(t.offsetX/n.size.width*2-1,-(t.offsetY/n.size.height)*2+1),n.raycaster.setFromCamera(n.pointer,n.camera)},connected:void 0,handlers:Object.keys(Gf).reduce((t,n)=>({...t,[n]:e(n)}),{}),update:()=>{var t;const{events:n,internal:i}=r.getState();(t=i.lastEvent)!=null&&t.current&&n.handlers&&n.handlers.onPointerMove(i.lastEvent.current)},connect:t=>{var n;const{set:i,events:s}=r.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:t}})),Object.entries((n=s.handlers)!=null?n:[]).forEach(([o,a])=>{const[c,l]=Gf[o];t.addEventListener(c,a,{passive:l})})},disconnect:()=>{const{set:t,events:n}=r.getState();if(n.connected){var i;Object.entries((i=n.handlers)!=null?i:[]).forEach(([s,o])=>{if(n&&n.connected instanceof HTMLElement){const[a]=Gf[s];n.connected.removeEventListener(a,o)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const WL=q.forwardRef(function({children:e,fallback:t,resize:n,style:i,gl:s,events:o=HL,eventSource:a,eventPrefix:c,shadows:l,linear:u,flat:h,legacy:f,orthographic:d,frameloop:m,dpr:v,performance:g,raycaster:p,camera:_,onPointerMissed:y,onCreated:x,...b},w){q.useMemo(()=>Zb($b),[]);const S=$w(),[M,E]=Zw({scroll:!0,debounce:{scroll:50,resize:0},...n}),T=q.useRef(null),L=q.useRef(null);q.useImperativeHandle(w,()=>T.current);const P=Qb(y),[A,z]=q.useState(!1),[V,N]=q.useState(!1);if(A)throw A;if(V)throw V;const C=q.useRef(null);Nc(()=>{const k=T.current;E.width>0&&E.height>0&&k&&(C.current||(C.current=GL(k)),C.current.configure({gl:s,events:o,shadows:l,linear:u,flat:h,legacy:f,orthographic:d,frameloop:m,dpr:v,performance:g,raycaster:p,camera:_,size:E,onPointerMissed:(...U)=>P.current==null?void 0:P.current(...U),onCreated:U=>{U.events.connect==null||U.events.connect(a?ML(a)?a.current:a:L.current),c&&U.setEvents({compute:(R,F)=>{const H=R[c+"X"],Y=R[c+"Y"];F.pointer.set(H/F.size.width*2-1,-(Y/F.size.height)*2+1),F.raycaster.setFromCamera(F.pointer,F.camera)}}),x==null||x(U)}}),C.current.render(q.createElement(S,null,q.createElement(e1,{set:N},q.createElement(q.Suspense,{fallback:q.createElement(TL,{set:z})},e)))))}),q.useEffect(()=>{const k=T.current;if(k)return()=>l1(k)},[]);const O=a?"none":"auto";return q.createElement("div",Tc({ref:L,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:O,...i}},b),q.createElement("div",{ref:M,style:{width:"100%",height:"100%"}},q.createElement("canvas",{ref:T,style:{display:"block"}},t)))}),XL=q.forwardRef(function(e,t){return q.createElement(jw,null,q.createElement(WL,Tc({},e,{ref:t})))});function qL(r,e,t){var n,i=1;r==null&&(r=0),e==null&&(e=0),t==null&&(t=0);function s(){var o,a=n.length,c,l=0,u=0,h=0;for(o=0;o=(c=(o+a)/2))?o=c:a=c,n=i,!(i=i[h=+u]))return n[h]=s,r;if(l=+r._x.call(null,i.data),e===l)return s.next=i,n?n[h]=s:r._root=s,r;do n=n?n[h]=new Array(2):r._root=new Array(2),(u=e>=(c=(o+a)/2))?o=c:a=c;while((h=+u)==(f=+(l>=c)));return n[f]=i,n[h]=s,r}function jL(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,t=new Float64Array(e);let n=1/0,i=-1/0;for(let s=0,o;si&&(i=o));if(n>i)return this;this.cover(n).cover(i);for(let s=0;sr||r>=t;)switch(o=+(ro||(s=l.x1)=h))&&(l=a[a.length-1],a[a.length-1]=a[a.length-1-u],a[a.length-1-u]=l)}else{var f=Math.abs(r-+this._x.call(null,c.data));f=(l=(o+a)/2))?o=l:a=l,e=t,!(t=t[h=+u]))return this;if(!t.length)break;e[h+1&1]&&(n=e,f=h)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[h]=s:delete e[h],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(n?n[f]=t:this._root=t),this):(this._root=s,this)}function eD(r){for(var e=0,t=r.length;e=(h=(a+l)/2))?a=h:l=h,(g=t>=(f=(c+u)/2))?c=f:u=f,i=s,!(s=s[p=g<<1|v]))return i[p]=o,r;if(d=+r._x.call(null,s.data),m=+r._y.call(null,s.data),e===d&&t===m)return o.next=s,i?i[p]=o:r._root=o,r;do i=i?i[p]=new Array(4):r._root=new Array(4),(v=e>=(h=(a+l)/2))?a=h:l=h,(g=t>=(f=(c+u)/2))?c=f:u=f;while((p=g<<1|v)===(_=(m>=f)<<1|d>=h));return i[_]=s,i[p]=o,r}function cD(r){var e,t,n=r.length,i,s,o=new Array(n),a=new Array(n),c=1/0,l=1/0,u=-1/0,h=-1/0;for(t=0;tu&&(u=i),sh&&(h=s));if(c>u||l>h)return this;for(this.cover(c,l).cover(u,h),t=0;tr||r>=i||n>e||e>=s;)switch(l=(eu||(a=m.y0)>h||(c=m.x1)=p)<<1|r>=g)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-v],f[f.length-1-v]=m)}else{var _=r-+this._x.call(null,d.data),y=e-+this._y.call(null,d.data),x=_*_+y*y;if(x=(f=(o+c)/2))?o=f:c=f,(v=h>=(d=(a+l)/2))?a=d:l=d,e=t,!(t=t[g=v<<1|m]))return this;if(!t.length)break;(e[g+1&3]||e[g+2&3]||e[g+3&3])&&(n=e,p=g)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[g]=s:delete e[g],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[p]=t:this._root=t),this):(this._root=s,this)}function pD(r){for(var e=0,t=r.length;e=(m=(c+h)/2))?c=m:h=m,(b=t>=(v=(l+f)/2))?l=v:f=v,(w=n>=(g=(u+d)/2))?u=g:d=g,s=o,!(o=o[S=w<<2|b<<1|x]))return s[S]=a,r;if(p=+r._x.call(null,o.data),_=+r._y.call(null,o.data),y=+r._z.call(null,o.data),e===p&&t===_&&n===y)return a.next=o,s?s[S]=a:r._root=a,r;do s=s?s[S]=new Array(8):r._root=new Array(8),(x=e>=(m=(c+h)/2))?c=m:h=m,(b=t>=(v=(l+f)/2))?l=v:f=v,(w=n>=(g=(u+d)/2))?u=g:d=g;while((S=w<<2|b<<1|x)===(M=(y>=g)<<2|(_>=v)<<1|p>=m));return s[M]=o,s[S]=a,r}function ED(r){Array.isArray(r)||(r=Array.from(r));const e=r.length,t=new Float64Array(e),n=new Float64Array(e),i=new Float64Array(e);let s=1/0,o=1/0,a=1/0,c=-1/0,l=-1/0,u=-1/0;for(let h=0,f,d,m,v;hc&&(c=d),ml&&(l=m),vu&&(u=v));if(s>c||o>l||a>u)return this;this.cover(s,o,a).cover(c,l,u);for(let h=0;hr||r>=o||i>e||e>=a||s>t||t>=c;)switch(f=(tm||(l=y.y0)>v||(u=y.z0)>g||(h=y.x1)=S)<<2|(e>=w)<<1|r>=b)&&(y=p[p.length-1],p[p.length-1]=p[p.length-1-x],p[p.length-1-x]=y)}else{var M=r-+this._x.call(null,_.data),E=e-+this._y.call(null,_.data),T=t-+this._z.call(null,_.data),L=M*M+E*E+T*T;if(LMath.sqrt((r-n)**2+(e-i)**2+(t-s)**2);function PD(r,e,t,n){const i=[],s=r-n,o=e-n,a=t-n,c=r+n,l=e+n,u=t+n;return this.visit((h,f,d,m,v,g,p)=>{if(!h.length)do{const _=h.data;RD(r,e,t,this._x(_),this._y(_),this._z(_))<=n&&i.push(_)}while(h=h.next);return f>c||d>l||m>u||v=(v=(o+l)/2))?o=v:l=v,(y=d>=(g=(a+u)/2))?a=g:u=g,(x=m>=(p=(c+h)/2))?c=p:h=p,e=t,!(t=t[b=x<<2|y<<1|_]))return this;if(!t.length)break;(e[b+1&7]||e[b+2&7]||e[b+3&7]||e[b+4&7]||e[b+5&7]||e[b+6&7]||e[b+7&7])&&(n=e,w=b)}for(;t.data!==r;)if(i=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,i?(s?i.next=s:delete i.next,this):e?(s?e[b]=s:delete e[b],(t=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&t===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!t.length&&(n?n[w]=t:this._root=t),this):(this._root=s,this)}function DD(r){for(var e=0,t=r.length;e1&&(v=d.y+d.vy),t>2&&(g=d.z+d.vz),f.visit(x);function x(b,w,S,M,E,T,L){var P=[w,S,M,E,T,L],A=P[0],z=P[1],V=P[2],N=P[t],C=P[t+1],O=P[t+2],k=b.data,U=b.r,R=p+U;if(k){if(k.index>d.index){var F=m-k.x-k.vx,H=t>1?v-k.y-k.vy:0,Y=t>2?g-k.z-k.vz:0,J=F*F+H*H+Y*Y;J1&&H===0&&(H=ei(i),J+=H*H),t>2&&Y===0&&(Y=ei(i),J+=Y*Y),J=(R-(J=Math.sqrt(J)))/J*s,d.vx+=(F*=J)*(R=(U*=U)/(_+U)),t>1&&(d.vy+=(H*=J)*R),t>2&&(d.vz+=(Y*=J)*R),k.vx-=F*(R=1-R),t>1&&(k.vy-=H*R),t>2&&(k.vz-=Y*R))}return}return A>m+R||N1&&(z>v+R||C2&&(V>g+R||Ou.r&&(u.r=u[h].r)}function l(){if(e){var u,h=e.length,f;for(n=new Array(h),u=0;utypeof f=="function")||Math.random,t=h.find(f=>[1,2,3].includes(f))||2,l()},a.iterations=function(u){return arguments.length?(o=+u,a):o},a.strength=function(u){return arguments.length?(s=+u,a):s},a.radius=function(u){return arguments.length?(r=typeof u=="function"?u:Nt(+u),l(),a):r},a}function WD(r){return r.index}function Wv(r,e){var t=r.get(e);if(!t)throw new Error("node not found: "+e);return t}function p1(r){var e=WD,t=f,n,i=Nt(30),s,o,a,c,l,u,h=1;r==null&&(r=[]);function f(p){return 1/Math.min(c[p.source.index],c[p.target.index])}function d(p){for(var _=0,y=r.length;_1&&(E=S.y+S.vy-w.y-w.vy||ei(u)),a>2&&(T=S.z+S.vz-w.z-w.vz||ei(u)),L=Math.sqrt(M*M+E*E+T*T),L=(L-s[x])/L*p*n[x],M*=L,E*=L,T*=L,S.vx-=M*(P=l[x]),a>1&&(S.vy-=E*P),a>2&&(S.vz-=T*P),w.vx+=M*(P=1-P),a>1&&(w.vy+=E*P),a>2&&(w.vz+=T*P)}function m(){if(o){var p,_=o.length,y=r.length,x=new Map(o.map((w,S)=>[e(w,S,o),w])),b;for(p=0,c=new Array(_);ptypeof y=="function")||Math.random,a=_.find(y=>[1,2,3].includes(y))||2,m()},d.links=function(p){return arguments.length?(r=p,m(),d):r},d.id=function(p){return arguments.length?(e=p,d):e},d.iterations=function(p){return arguments.length?(h=+p,d):h},d.strength=function(p){return arguments.length?(t=typeof p=="function"?p:Nt(+p),v(),d):t},d.distance=function(p){return arguments.length?(i=typeof p=="function"?p:Nt(+p),g(),d):i},d}var XD={value:()=>{}};function m1(){for(var r=0,e=arguments.length,t={},n;r=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}hu.prototype=m1.prototype={constructor:hu,on:function(r,e){var t=this._,n=qD(r+"",t),i,s=-1,o=n.length;if(arguments.length<2){for(;++s0)for(var t=new Array(i),n=0,i,s;n=0&&r._call.call(void 0,e),r=r._next;--Lo}function qv(){bs=(Eu=gc.now())+hh,Lo=Na=0;try{$D()}finally{Lo=0,KD(),bs=0}}function ZD(){var r=gc.now(),e=r-Eu;e>g1&&(hh-=e,Eu=r)}function KD(){for(var r,e=Su,t,n=1/0;e;)e._call?(n>e._time&&(n=e._time),r=e,e=e._next):(t=e._next,e._next=null,e=r?r._next=t:Su=t);Fa=r,bp(n)}function bp(r){if(!Lo){Na&&(Na=clearTimeout(Na));var e=r-bs;e>24?(r<1/0&&(Na=setTimeout(qv,r-gc.now()-hh)),ba&&(ba=clearInterval(ba))):(ba||(Eu=gc.now(),ba=setInterval(ZD,g1)),Lo=1,v1(qv))}}const JD=1664525,QD=1013904223,Yv=4294967296;function eI(){let r=1;return()=>(r=(JD*r+QD)%Yv)/Yv}var jv=3;function Hf(r){return r.x}function $v(r){return r.y}function tI(r){return r.z}var nI=10,iI=Math.PI*(3-Math.sqrt(5)),rI=Math.PI*20/(9+Math.sqrt(221));function x1(r,e){e=e||2;var t=Math.min(jv,Math.max(1,Math.round(e))),n,i=1,s=.001,o=1-Math.pow(s,1/300),a=0,c=.6,l=new Map,u=y1(d),h=m1("tick","end"),f=eI();r==null&&(r=[]);function d(){m(),h.call("tick",n),i1&&(x.fy==null?x.y+=x.vy*=c:(x.y=x.fy,x.vy=0)),t>2&&(x.fz==null?x.z+=x.vz*=c:(x.z=x.fz,x.vz=0));return n}function v(){for(var p=0,_=r.length,y;p<_;++p){if(y=r[p],y.index=p,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),y.fz!=null&&(y.z=y.fz),isNaN(y.x)||t>1&&isNaN(y.y)||t>2&&isNaN(y.z)){var x=nI*(t>2?Math.cbrt(.5+p):t>1?Math.sqrt(.5+p):p),b=p*iI,w=p*rI;t===1?y.x=x:t===2?(y.x=x*Math.cos(b),y.y=x*Math.sin(b)):(y.x=x*Math.sin(b)*Math.cos(w),y.y=x*Math.cos(b),y.z=x*Math.sin(b)*Math.sin(w))}(isNaN(y.vx)||t>1&&isNaN(y.vy)||t>2&&isNaN(y.vz))&&(y.vx=0,t>1&&(y.vy=0),t>2&&(y.vz=0))}}function g(p){return p.initialize&&p.initialize(r,f,t),p}return v(),n={tick:m,restart:function(){return u.restart(d),n},stop:function(){return u.stop(),n},numDimensions:function(p){return arguments.length?(t=Math.min(jv,Math.max(1,Math.round(p))),l.forEach(g),n):t},nodes:function(p){return arguments.length?(r=p,v(),l.forEach(g),n):r},alpha:function(p){return arguments.length?(i=+p,n):i},alphaMin:function(p){return arguments.length?(s=+p,n):s},alphaDecay:function(p){return arguments.length?(o=+p,n):+o},alphaTarget:function(p){return arguments.length?(a=+p,n):a},velocityDecay:function(p){return arguments.length?(c=1-p,n):1-c},randomSource:function(p){return arguments.length?(f=p,l.forEach(g),n):f},force:function(p,_){return arguments.length>1?(_==null?l.delete(p):l.set(p,g(_)),n):l.get(p)},find:function(){var p=Array.prototype.slice.call(arguments),_=p.shift()||0,y=(t>1?p.shift():null)||0,x=(t>2?p.shift():null)||0,b=p.shift()||1/0,w=0,S=r.length,M,E,T,L,P,A;for(b*=b,w=0;w1?(h.on(p,_),n):h.on(p)}}}function b1(){var r,e,t,n,i,s=Nt(-30),o,a=1,c=1/0,l=.81;function u(m){var v,g=r.length,p=(e===1?Om(r,Hf):e===2?Fm(r,Hf,$v):e===3?zm(r,Hf,$v,tI):null).visitAfter(f);for(i=m,v=0;v1&&(m.y=x/_),e>2&&(m.z=b/_)}else{g=m,g.x=g.data.x,e>1&&(g.y=g.data.y),e>2&&(g.z=g.data.z);do v+=o[g.data.index];while(g=g.next)}m.value=v}function d(m,v,g,p,_){if(!m.value)return!0;var y=[g,p,_][e-1],x=m.x-t.x,b=e>1?m.y-t.y:0,w=e>2?m.z-t.z:0,S=y-v,M=x*x+b*b+w*w;if(S*S/l1&&b===0&&(b=ei(n),M+=b*b),e>2&&w===0&&(w=ei(n),M+=w*w),M1&&(t.vy+=b*m.value*i/M),e>2&&(t.vz+=w*m.value*i/M)),!0;if(m.length||M>=c)return;(m.data!==t||m.next)&&(x===0&&(x=ei(n),M+=x*x),e>1&&b===0&&(b=ei(n),M+=b*b),e>2&&w===0&&(w=ei(n),M+=w*w),M1&&(t.vy+=b*S),e>2&&(t.vz+=w*S));while(m=m.next)}return u.initialize=function(m,...v){r=m,n=v.find(g=>typeof g=="function")||Math.random,e=v.find(g=>[1,2,3].includes(g))||2,h()},u.strength=function(m){return arguments.length?(s=typeof m=="function"?m:Nt(+m),h(),u):s},u.distanceMin=function(m){return arguments.length?(a=m*m,u):Math.sqrt(a)},u.distanceMax=function(m){return arguments.length?(c=m*m,u):Math.sqrt(c)},u.theta=function(m){return arguments.length?(l=m*m,u):Math.sqrt(l)},u}function sI(r,e,t,n){var i,s,o=Nt(.1),a,c;typeof r!="function"&&(r=Nt(+r)),e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function l(h){for(var f=0,d=i.length;f1&&(m.vy+=g*y),s>2&&(m.vz+=p*y)}}function u(){if(i){var h,f=i.length;for(a=new Array(f),c=new Array(f),h=0;h[1,2,3].includes(d))||2,u()},l.strength=function(h){return arguments.length?(o=typeof h=="function"?h:Nt(+h),u(),l):o},l.radius=function(h){return arguments.length?(r=typeof h=="function"?h:Nt(+h),u(),l):r},l.x=function(h){return arguments.length?(e=+h,l):e},l.y=function(h){return arguments.length?(t=+h,l):t},l.z=function(h){return arguments.length?(n=+h,l):n},l}function wp(r){var e=Nt(.1),t,n,i;typeof r!="function"&&(r=Nt(r==null?0:+r));function s(a){for(var c=0,l=t.length,u;c=0;)e+=t[n].value;r.value=e}function cI(){return this.eachAfter(aI)}function lI(r,e){let t=-1;for(const n of this)r.call(e,n,++t,this);return this}function uI(r,e){for(var t=this,n=[t],i,s,o=-1;t=n.pop();)if(r.call(e,t,++o,this),i=t.children)for(s=i.length-1;s>=0;--s)n.push(i[s]);return this}function hI(r,e){for(var t=this,n=[t],i=[],s,o,a,c=-1;t=n.pop();)if(i.push(t),s=t.children)for(o=0,a=s.length;o=0;)t+=n[i].value;e.value=t})}function pI(r){return this.eachBefore(function(e){e.children&&e.children.sort(r)})}function mI(r){for(var e=this,t=gI(e,r),n=[e];e!==t;)e=e.parent,n.push(e);for(var i=n.length;r!==t;)n.splice(i,0,r),r=r.parent;return n}function gI(r,e){if(r===e)return r;var t=r.ancestors(),n=e.ancestors(),i=null;for(r=t.pop(),e=n.pop();r===e;)i=r,r=t.pop(),e=n.pop();return i}function vI(){for(var r=this,e=[r];r=r.parent;)e.push(r);return e}function _I(){return Array.from(this)}function yI(){var r=[];return this.eachBefore(function(e){e.children||r.push(e)}),r}function xI(){var r=this,e=[];return r.each(function(t){t!==r&&e.push({source:t.parent,target:t})}),e}function*bI(){var r=this,e,t=[r],n,i,s;do for(e=t.reverse(),t=[];r=e.pop();)if(yield r,n=r.children)for(i=0,s=n.length;i=0;--a)i.push(s=o[a]=new Do(o[a])),s.parent=n,s.depth=n.depth+1;return t.eachBefore(w1)}function wI(){return fh(this).eachBefore(MI)}function SI(r){return r.children}function EI(r){return Array.isArray(r)?r[1]:null}function MI(r){r.data.value!==void 0&&(r.value=r.data.value),r.data=r.data.data}function w1(r){var e=0;do r.height=e;while((r=r.parent)&&r.height<++e)}function Do(r){this.data=r,this.depth=this.height=0,this.parent=null}Do.prototype=fh.prototype={constructor:Do,count:cI,each:lI,eachAfter:hI,eachBefore:uI,find:fI,sum:dI,sort:pI,path:mI,ancestors:vI,descendants:_I,leaves:yI,links:xI,copy:wI,[Symbol.iterator]:bI};function Wf(r){return r==null?null:S1(r)}function S1(r){if(typeof r!="function")throw new Error;return r}function wa(){return 0}function Sa(r){return function(){return r}}function TI(r){r.x0=Math.round(r.x0),r.y0=Math.round(r.y0),r.x1=Math.round(r.x1),r.y1=Math.round(r.y1)}function AI(r,e,t,n,i){for(var s=r.children,o,a=-1,c=s.length,l=r.value&&(n-e)/r.value;++aDI(t(x,b,i))),_=p.map(Kv),y=new Set(p).add("");for(const x of _)y.has(x)||(y.add(x),p.push(x),_.push(Kv(x)),s.push(Xf));o=(x,b)=>p[b],a=(x,b)=>_[b]}for(u=0,c=s.length;u=0&&(d=s[p],d.data===Xf);--p)d.data=null}if(h.parent=CI,h.eachBefore(function(p){p.depth=p.parent.depth+1,--c}).eachBefore(w1),h.parent=null,c>0)throw new Error("cycle");return h}return n.id=function(i){return arguments.length?(r=Wf(i),n):r},n.parentId=function(i){return arguments.length?(e=Wf(i),n):e},n.path=function(i){return arguments.length?(t=Wf(i),n):t},n}function DI(r){r=`${r}`;let e=r.length;return Ep(r,e-1)&&!Ep(r,e-2)&&(r=r.slice(0,-1)),r[0]==="/"?r:`/${r}`}function Kv(r){let e=r.length;if(e<2)return"";for(;--e>1&&!Ep(r,e););return r.slice(0,e)}function Ep(r,e){if(r[e]==="/"){let t=0;for(;e>0&&r[--e]==="\\";)++t;if((t&1)===0)return!0}return!1}function II(r,e){return r.parent===e.parent?1:2}function qf(r){var e=r.children;return e?e[0]:r.t}function Yf(r){var e=r.children;return e?e[e.length-1]:r.t}function UI(r,e,t){var n=t/(e.i-r.i);e.c-=n,e.s+=t,r.c+=n,e.z+=t,e.m+=t}function OI(r){for(var e=0,t=0,n=r.children,i=n.length,s;--i>=0;)s=n[i],s.z+=e,s.m+=e,e+=s.s+(t+=s.c)}function NI(r,e,t){return r.a.parent===e.parent?r.a:t}function fu(r,e){this._=r,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}fu.prototype=Object.create(Do.prototype);function FI(r){for(var e=new fu(r,0),t,n=[e],i,s,o,a;t=n.pop();)if(s=t._.children)for(t.children=new Array(a=s.length),o=a-1;o>=0;--o)n.push(i=t.children[o]=new fu(s[o],o)),i.parent=t;return(e.parent=new fu(null,0)).children=[e],e}function kI(){var r=II,e=1,t=1,n=null;function i(l){var u=FI(l);if(u.eachAfter(s),u.parent.m=-u.z,u.eachBefore(o),n)l.eachBefore(c);else{var h=l,f=l,d=l;l.eachBefore(function(_){_.xf.x&&(f=_),_.depth>d.depth&&(d=_)});var m=h===f?1:r(h,f)/2,v=m-h.x,g=e/(f.x+m+v),p=t/(d.depth||1);l.eachBefore(function(_){_.x=(_.x+v)*g,_.y=_.depth*p})}return l}function s(l){var u=l.children,h=l.parent.children,f=l.i?h[l.i-1]:null;if(u){OI(l);var d=(u[0].z+u[u.length-1].z)/2;f?(l.z=f.z+r(l._,f._),l.m=l.z-d):l.z=d}else f&&(l.z=f.z+r(l._,f._));l.parent.A=a(l,f,l.parent.A||h[0])}function o(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,h){if(u){for(var f=l,d=l,m=u,v=f.parent.children[0],g=f.m,p=d.m,_=m.m,y=v.m,x;m=Yf(m),f=qf(f),m&&f;)v=qf(v),d=Yf(d),d.a=l,x=m.z+_-f.z-g+r(m._,f._),x>0&&(UI(NI(m,l,h),l,x),g+=x,p+=x),_+=m.m,g+=f.m,y+=v.m,p+=d.m;m&&!Yf(d)&&(d.t=m,d.m+=_-p),f&&!qf(v)&&(v.t=f,v.m+=g-y,h=l)}return h}function c(l){l.x*=e,l.y=l.depth*t}return i.separation=function(l){return arguments.length?(r=l,i):r},i.size=function(l){return arguments.length?(n=!1,e=+l[0],t=+l[1],i):n?null:[e,t]},i.nodeSize=function(l){return arguments.length?(n=!0,e=+l[0],t=+l[1],i):n?[e,t]:null},i}function zI(r,e,t,n,i){for(var s=r.children,o,a=-1,c=s.length,l=r.value&&(i-t)/r.value;++a_&&(_=l),w=g*g*b,y=Math.max(_/w,w/p),y>x){g-=l;break}x=y}o.push(c={value:g,dice:d1?n:1)},t})(BI);function HI(){var r=VI,e=!1,t=1,n=1,i=[0],s=wa,o=wa,a=wa,c=wa,l=wa;function u(f){return f.x0=f.y0=0,f.x1=t,f.y1=n,f.eachBefore(h),i=[0],e&&f.eachBefore(TI),f}function h(f){var d=i[f.depth],m=f.x0+d,v=f.y0+d,g=f.x1-d,p=f.y1-d;g1&&te.has(xe))&&(O>1&&te.add(xe),K=c[Q+r],ye=c[Q+e],fe=c[Q+t],ce=K-j,Pe=ye-W,B=Math.sqrt(ce*ce+Pe*Pe),I=B0?(S[Q]+=ce/B*(1+re),M[Q]+=Pe/B*(1+re)):(S[Q]+=A*s(),M[Q]+=z*s())));for(m=0,v=0;m"u"?i:l};typeof i=="function"&&(o=i);var a=function(l){return o(l[n])},c=function(){return o(void 0)};return typeof n=="string"?(s.fromAttributes=a,s.fromGraph=function(l,u){return a(l.getNodeAttributes(u))},s.fromEntry=function(l,u){return a(u)}):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},s.fromGraph=function(l,u){return o(n(u,l.getNodeAttributes(u)))},s.fromEntry=function(l,u){return o(n(l,u))}):(s.fromAttributes=c,s.fromGraph=c,s.fromEntry=c),s}function t(n,i){var s={},o=function(l){return typeof l>"u"?i:l};typeof i=="function"&&(o=i);var a=function(l){return o(l[n])},c=function(){return o(void 0)};return typeof n=="string"?(s.fromAttributes=a,s.fromGraph=function(l,u){return a(l.getEdgeAttributes(u))},s.fromEntry=function(l,u){return a(u)},s.fromPartialEntry=s.fromEntry,s.fromMinimalEntry=s.fromEntry):typeof n=="function"?(s.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},s.fromGraph=function(l,u){var h=l.extremities(u);return o(n(u,l.getEdgeAttributes(u),h[0],h[1],l.getNodeAttributes(h[0]),l.getNodeAttributes(h[1]),l.isUndirected(u)))},s.fromEntry=function(l,u,h,f,d,m,v){return o(n(l,u,h,f,d,m,v))},s.fromPartialEntry=function(l,u,h,f){return o(n(l,u,h,f))},s.fromMinimalEntry=function(l,u){return o(n(l,u))}):(s.fromAttributes=c,s.fromGraph=c,s.fromEntry=c,s.fromMinimalEntry=c),s}return Ea.createNodeValueGetter=e,Ea.createEdgeValueGetter=t,Ea.createEdgeWeightGetter=function(n){return t(n,r)},Ea}var ed,o_;function QI(){if(o_)return ed;o_=1;var r=0,e=1,t=2,n=3,i=4,s=5,o=6,a=7,c=8,l=9,u=0,h=1,f=2,d=0,m=1,v=2,g=3,p=4,_=5,y=6,x=7,b=8,w=3,S=10,M=3,E=9,T=10;return ed=function(P,A,z){var V,N,C,O,k,U,R,F,H,Y,J=A.length,ie=z.length,ne=P.adjustSizes,ee=P.barnesHutTheta*P.barnesHutTheta,ge,me,te,D,Q,j,K,W=[];for(C=0;C$?(fe-=(I-$)/2,xe=fe+I):(ye-=($-I)/2,re=ye+$),W[0+d]=-1,W[0+m]=(ye+re)/2,W[0+v]=(fe+xe)/2,W[0+g]=Math.max(re-ye,xe-fe),W[0+p]=-1,W[0+_]=-1,W[0+y]=0,W[0+x]=0,W[0+b]=0,V=1,C=0;C=0){A[C+r]=0)if(j=Math.pow(A[C+r]-W[N+x],2)+Math.pow(A[C+e]-W[N+b],2),Y=W[N+g],4*Y*Y/j0?(K=me*A[C+o]*W[N+y]/j,A[C+t]+=te*K,A[C+n]+=D*K):j<0&&(K=-me*A[C+o]*W[N+y]/Math.sqrt(j),A[C+t]+=te*K,A[C+n]+=D*K):j>0&&(K=me*A[C+o]*W[N+y]/j,A[C+t]+=te*K,A[C+n]+=D*K),N=W[N+p],N<0)break;continue}else{N=W[N+_];continue}else{if(U=W[N+d],U>=0&&U!==C&&(te=A[C+r]-A[U+r],D=A[C+e]-A[U+e],j=te*te+D*D,ne===!0?j>0?(K=me*A[C+o]*A[U+o]/j,A[C+t]+=te*K,A[C+n]+=D*K):j<0&&(K=-me*A[C+o]*A[U+o]/Math.sqrt(j),A[C+t]+=te*K,A[C+n]+=D*K):j>0&&(K=me*A[C+o]*A[U+o]/j,A[C+t]+=te*K,A[C+n]+=D*K)),N=W[N+p],N<0)break;continue}else for(me=P.scalingRatio,O=0;O0?(K=me*A[O+o]*A[k+o]/j/j,A[O+t]+=te*K,A[O+n]+=D*K,A[k+t]-=te*K,A[k+n]-=D*K):j<0&&(K=100*me*A[O+o]*A[k+o],A[O+t]+=te*K,A[O+n]+=D*K,A[k+t]-=te*K,A[k+n]-=D*K)):(j=Math.sqrt(te*te+D*D),j>0&&(K=me*A[O+o]*A[k+o]/j/j,A[O+t]+=te*K,A[O+n]+=D*K,A[k+t]-=te*K,A[k+n]-=D*K));for(H=P.gravity/P.scalingRatio,me=P.scalingRatio,C=0;C0&&(K=me*A[C+o]*H):j>0&&(K=me*A[C+o]*H/j),A[C+t]-=te*K,A[C+n]-=D*K;for(me=1*(P.outboundAttractionDistribution?ge:1),R=0;R0&&(K=-me*Q*Math.log(1+j)/j/A[O+o]):j>0&&(K=-me*Q*Math.log(1+j)/j):P.outboundAttractionDistribution?j>0&&(K=-me*Q/A[O+o]):j>0&&(K=-me*Q)):(j=Math.sqrt(Math.pow(te,2)+Math.pow(D,2)),P.linLogMode?P.outboundAttractionDistribution?j>0&&(K=-me*Q*Math.log(1+j)/j/A[O+o]):j>0&&(K=-me*Q*Math.log(1+j)/j):P.outboundAttractionDistribution?(j=1,K=-me*Q/A[O+o]):(j=1,K=-me*Q)),j>0&&(A[O+t]+=te*K,A[O+n]+=D*K,A[k+t]-=te*K,A[k+n]-=D*K);var he,de,pe,Me,we,ue;if(ne===!0)for(C=0;CT&&(A[C+t]=A[C+t]*T/he,A[C+n]=A[C+n]*T/he),de=A[C+o]*Math.sqrt((A[C+i]-A[C+t])*(A[C+i]-A[C+t])+(A[C+s]-A[C+n])*(A[C+s]-A[C+n])),pe=Math.sqrt((A[C+i]+A[C+t])*(A[C+i]+A[C+t])+(A[C+s]+A[C+n])*(A[C+s]+A[C+n]))/2,Me=.1*Math.log(1+pe)/(1+Math.sqrt(de)),we=A[C+r]+A[C+t]*(Me/P.slowDown),A[C+r]=we,ue=A[C+e]+A[C+n]*(Me/P.slowDown),A[C+e]=ue);else for(C=0;C=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in t&&typeof t.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in t&&!(typeof t.gravity=="number"&&t.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in t&&!(typeof t.slowDown=="number"||t.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in t&&typeof t.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in t&&!(typeof t.barnesHutTheta=="number"&&t.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null},Ki.graphToByteArrays=function(t,n){var i=t.order,s=t.size,o={},a,c=new Float32Array(i*r),l=new Float32Array(s*e);return a=0,t.forEachNode(function(u,h){o[u]=a,c[a]=h.x,c[a+1]=h.y,c[a+2]=0,c[a+3]=0,c[a+4]=0,c[a+5]=0,c[a+6]=1,c[a+7]=1,c[a+8]=h.size||1,c[a+9]=h.fixed?1:0,a+=r}),a=0,t.forEachEdge(function(u,h,f,d,m,v,g){var p=o[f],_=o[d],y=n(u,h,f,d,m,v,g);c[p+6]+=y,c[_+6]+=y,l[a]=p,l[a+1]=_,l[a+2]=y,a+=e}),{nodes:c,edges:l}},Ki.assignLayoutChanges=function(t,n,i){var s=0;t.updateEachNodeAttributes(function(o,a){return a.x=n[s],a.y=n[s+1],s+=r,i?i(o,a):a})},Ki.readGraphPositions=function(t,n){var i=0;t.forEachNode(function(s,o){n[i]=o.x,n[i+1]=o.y,i+=r})},Ki.collectLayoutChanges=function(t,n,i){for(var s=t.nodes(),o={},a=0,c=0,l=n.length;a2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(l)}}var a=s.bind(null,!1);return a.assign=s.bind(null,!0),a.inferSettings=o,nd=a,nd}var iU=nU();const rU=ki(iU);var id,u_;function sU(){if(u_)return id;u_=1;var r=Gm(),e=ur(),t={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function n(s,o,a){if(!e(o))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");a=r(a,t);var c=a.dimensions;if(!Array.isArray(c)||c.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var l=c.length,u=a.center,h=a.rng,f=a.scale,d=(u-.5)*f;function m(g){for(var p=0;p 4294967295 is not supported.")},r.getSignedPointerArray=function(c){var l=c-1;return l<=i?Int8Array:l<=s?Int16Array:l<=o?Int32Array:Float64Array},r.getNumberType=function(c){return c===(c|0)?Math.sign(c)===-1?c<=127&&c>=-128?Int8Array:c<=32767&&c>=-32768?Int16Array:Int32Array:c<=255?Uint8Array:c<=65535?Uint16Array:Uint32Array:Float64Array};var a={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};r.getMinimalRepresentation=function(c,l){var u=null,h=0,f,d,m,v,g;for(v=0,g=c.length;vh&&(h=f,u=d);return u},r.isTypedArray=function(c){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(c)},r.concat=function(){var c=0,l,u,h;for(l=0,h=arguments.length;l{const o=q.useRef();return o.current||(o.current=i()),q.createElement(r.Provider,{value:o.current},s)},useStore:(i,s)=>{const o=q.useContext(r);if(!o)throw new Error("Seems like you have not used zustand provider as an ancestor.");return Xy(o,i,s)},useStoreApi:()=>{const i=q.useContext(r);if(!i)throw new Error("Seems like you have not used zustand provider as an ancestor.");return q.useMemo(()=>({...i}),[i])}}}var fi={},Jr={},od,m_;function ph(){if(m_)return od;m_=1;function r(e){if(typeof e!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=e}return typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=function(){return this}),r.of=function(){var e=arguments,t=e.length,n=0;return new r(function(){return n>=t?{done:!0}:{done:!1,value:e[n++]}})},r.empty=function(){var e=new r(function(){return{done:!0}});return e},r.fromSequence=function(e){var t=0,n=e.length;return new r(function(){return t>=n?{done:!0}:{done:!1,value:e[t++]}})},r.is=function(e){return e instanceof r?!0:typeof e=="object"&&e!==null&&typeof e.next=="function"},od=r,od}var Yl={},g_;function M1(){return g_||(g_=1,Yl.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u",Yl.SYMBOL_SUPPORT=typeof Symbol<"u"),Yl}var ad,v_;function Vm(){if(v_)return ad;v_=1;var r=M1(),e=r.ARRAY_BUFFER_SUPPORT,t=r.SYMBOL_SUPPORT;return ad=function(i,s){var o,a,c,l,u;if(!i)throw new Error("obliterator/forEach: invalid iterable.");if(typeof s!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(i)||e&&ArrayBuffer.isView(i)||typeof i=="string"||i.toString()==="[object Arguments]"){for(c=0,l=i.length;c=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,n}},t.prototype.peek=function(){if(this.size)return this.items[this.offset]},t.prototype.forEach=function(n,i){i=arguments.length>1?i:this;for(var s=this.offset,o=0,a=this.items.length;s=n.length)return{done:!0};var s=n[i];return i++,{value:s,done:!1}})},t.prototype.entries=function(){var n=this.items,i=this.offset,s=0;return new r(function(){if(i>=n.length)return{done:!0};var o=n[i];return i++,{value:[s++,o],done:!1}})},typeof Symbol<"u"&&(t.prototype[Symbol.iterator]=t.prototype.values),t.prototype.toString=function(){return this.toArray().join(",")},t.prototype.toJSON=function(){return this.toArray()},t.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:t,enumerable:!1}),n},typeof Symbol<"u"&&(t.prototype[Symbol.for("nodejs.util.inspect.custom")]=t.prototype.inspect),t.from=function(n){var i=new t;return e(n,function(s){i.enqueue(s)}),i},t.of=function(){return t.from(arguments)},cd=t,cd}var ld,y_;function vU(){return y_||(y_=1,ld=function(e,t){var n=t.length;if(n!==0){var i=e.length;e.length+=n;for(var s=0;ss?1:0},e=function(i,s){return is?-1:0};function t(i){return function(s,o){return i(o,s)}}function n(i){return i===2?function(s,o){return s[0]o[0]?1:s[1]o[1]?1:0}:function(s,o){for(var a=0;ao[a])return 1;a++}return 0}}return co.DEFAULT_COMPARATOR=r,co.DEFAULT_REVERSE_COMPARATOR=e,co.reverseComparator=t,co.createTupleComparator=n,co}var lo={},S_;function bU(){if(S_)return lo;S_=1;var r=Vm(),e=E1();function t(o){return Array.isArray(o)||e.isTypedArray(o)}function n(o){if(typeof o.length=="number")return o.length;if(typeof o.size=="number")return o.size}function i(o){var a=n(o),c=typeof a=="number"?new Array(a):[],l=0;return r(o,function(u){c[l++]=u}),c}function s(o){var a=n(o),c=typeof a=="number"?e.getPointerArray(a):Array,l=typeof a=="number"?new Array(a):[],u=typeof a=="number"?new c(a):[],h=0;return r(o,function(f){l[h]=f,u[h]=h++}),[l,u]}return lo.isArrayLike=t,lo.guessLength=n,lo.toArray=i,lo.toArrayWithIndices=s,lo}var hd,E_;function T1(){if(E_)return hd;E_=1;var r=Vm(),e=xU(),t=bU(),n=e.DEFAULT_COMPARATOR,i=e.reverseComparator;function s(p,_,y,x){for(var b=_[x],w,S;x>y;){if(w=x-1>>1,S=_[w],p(b,S)<0){_[x]=S,x=w;continue}break}_[x]=b}function o(p,_,y){for(var x=_.length,b=y,w=_[y],S=2*y+1,M;S=0&&(S=M),_[y]=_[S],y=S,S=2*y+1;_[y]=w,s(p,_,b,y)}function a(p,_,y){_.push(y),s(p,_,0,_.length-1)}function c(p,_){var y=_.pop();if(_.length!==0){var x=_[0];return _[0]=y,o(p,_,0),x}return y}function l(p,_,y){if(_.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var x=_[0];return _[0]=y,o(p,_,0),x}function u(p,_,y){var x;return _.length!==0&&p(_[0],y)<0&&(x=_[0],_[0]=y,y=x,o(p,_,0)),y}function h(p,_){for(var y=_.length,x=y>>1,b=x;--b>=0;)o(p,_,b)}function f(p,_){for(var y=_.length,x=0,b=new Array(y);x=y.length)return y.slice().sort(p);for(E=y.slice(0,_),h(x,E),b=_,w=y.length;b0&&l(x,E,y[b]);return E.sort(p)}var T=t.guessLength(y);return T!==null&&T<_&&(_=T),E=new Array(_),b=0,r(y,function(L){b<_?E[b]=L:(b===_&&h(x,E),x(L,E[0])>0&&l(x,E,L)),b++}),E.length>b&&(E.length=b),E.sort(p)}function m(p,_,y){arguments.length===2&&(y=_,_=p,p=n);var x=i(p),b,w,S,M=-1/0,E;if(_===1){if(t.isArrayLike(y)){for(b=0,w=y.length;b0)&&(M=S);return E=new y.constructor(1),E[0]=M,E}return r(y,function(L){(M===-1/0||p(L,M)>0)&&(M=L)}),[M]}if(t.isArrayLike(y)){if(_>=y.length)return y.slice().sort(x);for(E=y.slice(0,_),h(p,E),b=_,w=y.length;b0&&l(p,E,y[b]);return E.sort(x)}var T=t.guessLength(y);return T!==null&&T<_&&(_=T),E=new Array(_),b=0,r(y,function(L){b<_?E[b]=L:(b===_&&h(p,E),p(L,E[0])>0&&l(p,E,L)),b++}),E.length>b&&(E.length=b),E.sort(x)}function v(p){if(this.clear(),this.comparator=p||n,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}v.prototype.clear=function(){this.items=[],this.size=0},v.prototype.push=function(p){return a(this.comparator,this.items,p),++this.size},v.prototype.peek=function(){return this.items[0]},v.prototype.pop=function(){return this.size!==0&&this.size--,c(this.comparator,this.items)},v.prototype.replace=function(p){return l(this.comparator,this.items,p)},v.prototype.pushpop=function(p){return u(this.comparator,this.items,p)},v.prototype.consume=function(){return this.size=0,f(this.comparator,this.items)},v.prototype.toArray=function(){return f(this.comparator,this.items.slice())},v.prototype.inspect=function(){var p=this.toArray();return Object.defineProperty(p,"constructor",{value:v,enumerable:!1}),p},typeof Symbol<"u"&&(v.prototype[Symbol.for("nodejs.util.inspect.custom")]=v.prototype.inspect);function g(p){if(this.clear(),this.comparator=p||n,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=i(this.comparator)}return g.prototype=v.prototype,v.from=function(p,_){var y=new v(_),x;return t.isArrayLike(p)?x=p.slice():x=t.toArray(p),h(y.comparator,x),y.items=x,y.size=x.length,y},g.from=function(p,_){var y=new g(_),x;return t.isArrayLike(p)?x=p.slice():x=t.toArray(p),h(y.comparator,x),y.items=x,y.size=x.length,y},v.siftUp=o,v.siftDown=s,v.push=a,v.pop=c,v.replace=l,v.pushpop=u,v.heapify=h,v.consume=f,v.nsmallest=d,v.nlargest=m,v.MinHeap=v,v.MaxHeap=g,hd=v,hd}var M_;function wU(){if(M_)return Ta;M_=1;var r=ur(),e=dh().createEdgeWeightGetter,t=T1(),n="weight";function i(h,f){return h[0]>f[0]?1:h[0]f[1]?1:h[1]f[2]?1:h[2]f[0]?1:h[0]f[1]?1:h[1]f[2]?1:h[2]f[3]?1:h[3]T)&&(x=T,y=g[0][P].concat(g[1][P].slice(0,-1).reverse()))))}}return[1/0,null]}function a(h,f,d,m,v,g){if(!r(h))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");d=e(d||n).fromMinimalEntry;var p={},_={},y=new t(i),x=0,b,w,S,M,E,T,L,P,A,z,V;for(P=0,z=f.length;Pa[0]?1:o[0]a[1]?1:o[1]h.cutoff||(m[L]=[T,M],d.push([T+M,f++,L,T,p]))}}for(;d.size!==0;){if(g=d.pop(),p=g[2],y=g[3],x=g[4],p===c){for(b=[p],w=x;w!==null;)b.push(w),w=v[w];return b.reverse(),b}v.hasOwnProperty(p)&&(v[p]===null||(S=m[p][0],S0&&(T=w[0]),T instanceof Error)throw T;var L=new Error("Unhandled error."+(T?" ("+T.message+")":""));throw L.context=T,L}var P=E[b];if(P===void 0)return!1;if(typeof P=="function")e(P,this,w);else for(var A=P.length,z=m(P,A),S=0;S0&&T.length>M&&!T.warned){T.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+T.length+" "+String(b)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=x,L.type=b,L.count=T.length,n(L)}return x}s.prototype.addListener=function(b,w){return l(this,b,w,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(b,w){return l(this,b,w,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(x,b,w){var S={fired:!1,wrapFn:void 0,target:x,type:b,listener:w},M=u.bind(S);return M.listener=w,S.wrapFn=M,M}s.prototype.once=function(b,w){return a(w),this.on(b,h(this,b,w)),this},s.prototype.prependOnceListener=function(b,w){return a(w),this.prependListener(b,h(this,b,w)),this},s.prototype.removeListener=function(b,w){var S,M,E,T,L;if(a(w),M=this._events,M===void 0)return this;if(S=M[b],S===void 0)return this;if(S===w||S.listener===w)--this._eventsCount===0?this._events=Object.create(null):(delete M[b],M.removeListener&&this.emit("removeListener",b,S.listener||w));else if(typeof S!="function"){for(E=-1,T=S.length-1;T>=0;T--)if(S[T]===w||S[T].listener===w){L=S[T].listener,E=T;break}if(E<0)return this;E===0?S.shift():v(S,E),S.length===1&&(M[b]=S[0]),M.removeListener!==void 0&&this.emit("removeListener",b,L||w)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(b){var w,S,M;if(S=this._events,S===void 0)return this;if(S.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):S[b]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete S[b]),this;if(arguments.length===0){var E=Object.keys(S),T;for(M=0;M=0;M--)this.removeListener(b,w[M]);return this};function f(x,b,w){var S=x._events;if(S===void 0)return[];var M=S[b];return M===void 0?[]:typeof M=="function"?w?[M.listener||M]:[M]:w?g(M):m(M,M.length)}s.prototype.listeners=function(b){return f(this,b,!0)},s.prototype.rawListeners=function(b){return f(this,b,!1)},s.listenerCount=function(x,b){return typeof x.listenerCount=="function"?x.listenerCount(b):d.call(x,b)},s.prototype.listenerCount=d;function d(x){var b=this._events;if(b!==void 0){var w=b[x];if(typeof w=="function")return 1;if(w!==void 0)return w.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]};function m(x,b){for(var w=new Array(b),S=0;S1?n:1/0,s=i!==1/0?new Array(i):[],o,a=0,c=r(t);;){if(a===i)return s;if(o=c.next(),o.done)return a!==n&&(s.length=a),s;s[a++]=o.value}},pd}var RU=CU();const C1=ki(RU);var md,L_;function PU(){if(L_)return md;L_=1;var r=ph(),e=A1();return md=function(){var n=arguments,i=null,s=-1;return new r(function(){var a=null;do{if(i===null){if(s++,s>=n.length)return{done:!0};i=e(n[s])}if(a=i.next(),a.done===!0){i=null;continue}break}while(!0);return a})},md}var LU=PU();const rr=ki(LU);function DU(){const r=arguments[0];for(let e=1,t=arguments.length;er++}class Hm extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class Be extends Hm{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Be.prototype.constructor)}}class Ie extends Hm{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ie.prototype.constructor)}}class Xe extends Hm{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Xe.prototype.constructor)}}function P1(r,e){this.key=r,this.attributes=e,this.clear()}P1.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function L1(r,e){this.key=r,this.attributes=e,this.clear()}L1.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function D1(r,e){this.key=r,this.attributes=e,this.clear()}D1.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function zo(r,e,t,n,i){this.key=e,this.attributes=i,this.undirected=r,this.source=t,this.target=n}zo.prototype.attach=function(){let r="out",e="in";this.undirected&&(r=e="undirected");const t=this.source.key,n=this.target.key;this.source[r][n]=this,!(this.undirected&&t===n)&&(this.target[e][t]=this)};zo.prototype.attachMulti=function(){let r="out",e="in";const t=this.source.key,n=this.target.key;this.undirected&&(r=e="undirected");const i=this.source[r],s=i[n];if(typeof s>"u"){i[n]=this,this.undirected&&t===n||(this.target[e][t]=this);return}s.previous=this,this.next=s,i[n]=this,this.target[e][t]=this};zo.prototype.detach=function(){const r=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),delete this.source[t][e],delete this.target[n][r]};zo.prototype.detachMulti=function(){const r=this.source.key,e=this.target.key;let t="out",n="in";this.undirected&&(t=n="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[n][r]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[n][r]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const I1=0,U1=1,UU=2,O1=3;function hr(r,e,t,n,i,s,o){let a,c,l,u;if(n=""+n,t===I1){if(a=r._nodes.get(n),!a)throw new Ie(`Graph.${e}: could not find the "${n}" node in the graph.`);l=i,u=s}else if(t===O1){if(i=""+i,c=r._edges.get(i),!c)throw new Ie(`Graph.${e}: could not find the "${i}" edge in the graph.`);const h=c.source.key,f=c.target.key;if(n===h)a=c.target;else if(n===f)a=c.source;else throw new Ie(`Graph.${e}: the "${n}" node is not attached to the "${i}" edge (${h}, ${f}).`);l=s,u=o}else{if(c=r._edges.get(n),!c)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`);t===U1?a=c.source:a=c.target,l=i,u=s}return[a,l,u]}function OU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);return o.attributes[a]}}function NU(r,e,t){r.prototype[e]=function(n,i){const[s]=hr(this,e,t,n,i);return s.attributes}}function FU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);return o.attributes.hasOwnProperty(a)}}function kU(r,e,t){r.prototype[e]=function(n,i,s,o){const[a,c,l]=hr(this,e,t,n,i,s,o);return a.attributes[c]=l,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}function zU(r,e,t){r.prototype[e]=function(n,i,s,o){const[a,c,l]=hr(this,e,t,n,i,s,o);if(typeof l!="function")throw new Be(`Graph.${e}: updater should be a function.`);const u=a.attributes,h=l(u[c]);return u[c]=h,this.emit("nodeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:c}),this}}function BU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);return delete o.attributes[a],this.emit("nodeAttributesUpdated",{key:o.key,type:"remove",attributes:o.attributes,name:a}),this}}function GU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);if(!cn(a))throw new Be(`Graph.${e}: provided attributes are not a plain object.`);return o.attributes=a,this.emit("nodeAttributesUpdated",{key:o.key,type:"replace",attributes:o.attributes}),this}}function VU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);if(!cn(a))throw new Be(`Graph.${e}: provided attributes are not a plain object.`);return Jt(o.attributes,a),this.emit("nodeAttributesUpdated",{key:o.key,type:"merge",attributes:o.attributes,data:a}),this}}function HU(r,e,t){r.prototype[e]=function(n,i,s){const[o,a]=hr(this,e,t,n,i,s);if(typeof a!="function")throw new Be(`Graph.${e}: provided updater is not a function.`);return o.attributes=a(o.attributes),this.emit("nodeAttributesUpdated",{key:o.key,type:"update",attributes:o.attributes}),this}}const WU=[{name:r=>`get${r}Attribute`,attacher:OU},{name:r=>`get${r}Attributes`,attacher:NU},{name:r=>`has${r}Attribute`,attacher:FU},{name:r=>`set${r}Attribute`,attacher:kU},{name:r=>`update${r}Attribute`,attacher:zU},{name:r=>`remove${r}Attribute`,attacher:BU},{name:r=>`replace${r}Attributes`,attacher:GU},{name:r=>`merge${r}Attributes`,attacher:VU},{name:r=>`update${r}Attributes`,attacher:HU}];function XU(r){WU.forEach(function({name:e,attacher:t}){t(r,e("Node"),I1),t(r,e("Source"),U1),t(r,e("Target"),UU),t(r,e("Opposite"),O1)})}function qU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes[i]}}function YU(r,e,t){r.prototype[e]=function(n){let i;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const s=""+n,o=""+arguments[1];if(i=ii(this,s,o,t),!i)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${s}" - "${o}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,i=this._edges.get(n),!i)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return i.attributes}}function jU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return s.attributes.hasOwnProperty(i)}}function $U(r,e,t){r.prototype[e]=function(n,i,s){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,c=""+i;if(i=arguments[2],s=arguments[3],o=ii(this,a,c,t),!o)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${a}" - "${c}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return o.attributes[i]=s,this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function ZU(r,e,t){r.prototype[e]=function(n,i,s){let o;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const a=""+n,c=""+i;if(i=arguments[2],s=arguments[3],o=ii(this,a,c,t),!o)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${a}" - "${c}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,o=this._edges.get(n),!o)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof s!="function")throw new Be(`Graph.${e}: updater should be a function.`);return o.attributes[i]=s(o.attributes[i]),this.emit("edgeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:i}),this}}function KU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}return delete s.attributes[i],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:i}),this}}function JU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!cn(i))throw new Be(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=i,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function QU(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(!cn(i))throw new Be(`Graph.${e}: provided attributes are not a plain object.`);return Jt(s.attributes,i),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:i}),this}}function eO(r,e,t){r.prototype[e]=function(n,i){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new Xe(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new Xe(`Graph.${e}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);const o=""+n,a=""+i;if(i=arguments[2],s=ii(this,o,a,t),!s)throw new Ie(`Graph.${e}: could not find an edge for the given path ("${o}" - "${a}").`)}else{if(t!=="mixed")throw new Xe(`Graph.${e}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(n=""+n,s=this._edges.get(n),!s)throw new Ie(`Graph.${e}: could not find the "${n}" edge in the graph.`)}if(typeof i!="function")throw new Be(`Graph.${e}: provided updater is not a function.`);return s.attributes=i(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const tO=[{name:r=>`get${r}Attribute`,attacher:qU},{name:r=>`get${r}Attributes`,attacher:YU},{name:r=>`has${r}Attribute`,attacher:jU},{name:r=>`set${r}Attribute`,attacher:$U},{name:r=>`update${r}Attribute`,attacher:ZU},{name:r=>`remove${r}Attribute`,attacher:KU},{name:r=>`replace${r}Attributes`,attacher:JU},{name:r=>`merge${r}Attributes`,attacher:QU},{name:r=>`update${r}Attributes`,attacher:eO}];function nO(r){tO.forEach(function({name:e,attacher:t}){t(r,e("Edge"),"mixed"),t(r,e("DirectedEdge"),"directed"),t(r,e("UndirectedEdge"),"undirected")})}const iO=[{name:"edges",type:"mixed"},{name:"inEdges",type:"directed",direction:"in"},{name:"outEdges",type:"directed",direction:"out"},{name:"inboundEdges",type:"mixed",direction:"in"},{name:"outboundEdges",type:"mixed",direction:"out"},{name:"directedEdges",type:"directed"},{name:"undirectedEdges",type:"undirected"}];function rO(r,e,t,n){let i=!1;for(const s in e){if(s===n)continue;const o=e[s];if(i=t(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),r&&i)return o.key}}function sO(r,e,t,n){let i,s,o,a=!1;for(const c in e)if(c!==n){i=e[c];do{if(s=i.source,o=i.target,a=t(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected),r&&a)return i.key;i=i.next}while(i!==void 0)}}function gd(r,e){const t=Object.keys(r),n=t.length;let i,s=0;return new ri(function(){do if(i)i=i.next;else{if(s>=n)return{done:!0};const a=t[s++];if(a===e){i=void 0;continue}i=r[a]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}})}function oO(r,e,t,n){const i=e[t];if(!i)return;const s=i.source,o=i.target;if(n(i.key,i.attributes,s.key,o.key,s.attributes,o.attributes,i.undirected)&&r)return i.key}function aO(r,e,t,n){let i=e[t];if(!i)return;let s=!1;do{if(s=n(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),r&&s)return i.key;i=i.next}while(i!==void 0)}function vd(r,e){let t=r[e];return t.next!==void 0?new ri(function(){if(!t)return{done:!0};const n={edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected};return t=t.next,{done:!1,value:n}}):ri.of({edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected})}function cO(r,e){if(r.size===0)return[];if(e==="mixed"||e===r.type)return typeof Array.from=="function"?Array.from(r._edges.keys()):C1(r._edges.keys(),r._edges.size);const t=e==="undirected"?r.undirectedSize:r.directedSize,n=new Array(t),i=e==="undirected",s=r._edges.values();let o=0,a,c;for(;a=s.next(),a.done!==!0;)c=a.value,c.undirected===i&&(n[o++]=c.key);return n}function N1(r,e,t,n){if(e.size===0)return;const i=t!=="mixed"&&t!==e.type,s=t==="undirected";let o,a,c=!1;const l=e._edges.values();for(;o=l.next(),o.done!==!0;){if(a=o.value,i&&a.undirected!==s)continue;const{key:u,attributes:h,source:f,target:d}=a;if(c=n(u,h,f.key,d.key,f.attributes,d.attributes,a.undirected),r&&c)return u}}function lO(r,e){if(r.size===0)return ri.empty();const t=e!=="mixed"&&e!==r.type,n=e==="undirected",i=r._edges.values();return new ri(function(){let o,a;for(;;){if(o=i.next(),o.done)return o;if(a=o.value,!(t&&a.undirected!==n))break}return{value:{edge:a.key,attributes:a.attributes,source:a.source.key,target:a.target.key,sourceAttributes:a.source.attributes,targetAttributes:a.target.attributes,undirected:a.undirected},done:!1}})}function Wm(r,e,t,n,i,s){const o=e?sO:rO;let a;if(t!=="undirected"&&(n!=="out"&&(a=o(r,i.in,s),r&&a)||n!=="in"&&(a=o(r,i.out,s,n?void 0:i.key),r&&a))||t!=="directed"&&(a=o(r,i.undirected,s),r&&a))return a}function uO(r,e,t,n){const i=[];return Wm(!1,r,e,t,n,function(s){i.push(s)}),i}function hO(r,e,t){let n=ri.empty();return r!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(n=rr(n,gd(t.in))),e!=="in"&&typeof t.out<"u"&&(n=rr(n,gd(t.out,e?void 0:t.key)))),r!=="directed"&&typeof t.undirected<"u"&&(n=rr(n,gd(t.undirected))),n}function Xm(r,e,t,n,i,s,o){const a=t?aO:oO;let c;if(e!=="undirected"&&(typeof i.in<"u"&&n!=="out"&&(c=a(r,i.in,s,o),r&&c)||typeof i.out<"u"&&n!=="in"&&(n||i.key!==s)&&(c=a(r,i.out,s,o),r&&c))||e!=="directed"&&typeof i.undirected<"u"&&(c=a(r,i.undirected,s,o),r&&c))return c}function fO(r,e,t,n,i){const s=[];return Xm(!1,r,e,t,n,i,function(o){s.push(o)}),s}function dO(r,e,t,n){let i=ri.empty();return r!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&n in t.in&&(i=rr(i,vd(t.in,n))),typeof t.out<"u"&&e!=="in"&&n in t.out&&(e||t.key!==n)&&(i=rr(i,vd(t.out,n)))),r!=="directed"&&typeof t.undirected<"u"&&n in t.undirected&&(i=rr(i,vd(t.undirected,n))),i}function pO(r,e){const{name:t,type:n,direction:i}=e;r.prototype[t]=function(s,o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];if(!arguments.length)return cO(this,n);if(arguments.length===1){s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new Ie(`Graph.${t}: could not find the "${s}" node in the graph.`);return uO(this.multi,n==="mixed"?this.type:n,i,a)}if(arguments.length===2){s=""+s,o=""+o;const a=this._nodes.get(s);if(!a)throw new Ie(`Graph.${t}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(o))throw new Ie(`Graph.${t}: could not find the "${o}" target node in the graph.`);return fO(n,this.multi,i,a,o)}throw new Be(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function mO(r,e){const{name:t,type:n,direction:i}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(l,u,h){if(!(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)){if(arguments.length===1)return h=l,N1(!1,this,n,h);if(arguments.length===2){l=""+l,h=u;const f=this._nodes.get(l);if(typeof f>"u")throw new Ie(`Graph.${s}: could not find the "${l}" node in the graph.`);return Wm(!1,this.multi,n==="mixed"?this.type:n,i,f,h)}if(arguments.length===3){l=""+l,u=""+u;const f=this._nodes.get(l);if(!f)throw new Ie(`Graph.${s}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(u))throw new Ie(`Graph.${s}: could not find the "${u}" target node in the graph.`);return Xm(!1,n,this.multi,i,f,u,h)}throw new Be(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const o="map"+t[0].toUpperCase()+t.slice(1);r.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),u=l.pop();let h;if(l.length===0){let f=0;n!=="directed"&&(f+=this.undirectedSize),n!=="undirected"&&(f+=this.directedSize),h=new Array(f);let d=0;l.push((m,v,g,p,_,y,x)=>{h[d++]=u(m,v,g,p,_,y,x)})}else h=[],l.push((f,d,m,v,g,p,_)=>{h.push(u(f,d,m,v,g,p,_))});return this[s].apply(this,l),h};const a="filter"+t[0].toUpperCase()+t.slice(1);r.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),u=l.pop(),h=[];return l.push((f,d,m,v,g,p,_)=>{u(f,d,m,v,g,p,_)&&h.push(f)}),this[s].apply(this,l),h};const c="reduce"+t[0].toUpperCase()+t.slice(1);r.prototype[c]=function(){let l=Array.prototype.slice.call(arguments);if(l.length<2||l.length>4)throw new Be(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${l.length}).`);if(typeof l[l.length-1]=="function"&&typeof l[l.length-2]!="function")throw new Be(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let u,h;l.length===2?(u=l[0],h=l[1],l=[]):l.length===3?(u=l[1],h=l[2],l=[l[0]]):l.length===4&&(u=l[2],h=l[3],l=[l[0],l[1]]);let f=h;return l.push((d,m,v,g,p,_,y)=>{f=u(f,d,m,v,g,p,_,y)}),this[s].apply(this,l),f}}function gO(r,e){const{name:t,type:n,direction:i}=e,s="find"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(c,l,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return!1;if(arguments.length===1)return u=c,N1(!0,this,n,u);if(arguments.length===2){c=""+c,u=l;const h=this._nodes.get(c);if(typeof h>"u")throw new Ie(`Graph.${s}: could not find the "${c}" node in the graph.`);return Wm(!0,this.multi,n==="mixed"?this.type:n,i,h,u)}if(arguments.length===3){c=""+c,l=""+l;const h=this._nodes.get(c);if(!h)throw new Ie(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(l))throw new Ie(`Graph.${s}: could not find the "${l}" target node in the graph.`);return Xm(!0,n,this.multi,i,h,l,u)}throw new Be(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const o="some"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((h,f,d,m,v,g,p)=>l(h,f,d,m,v,g,p)),!!this[s].apply(this,c)};const a="every"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),l=c.pop();return c.push((h,f,d,m,v,g,p)=>!l(h,f,d,m,v,g,p)),!this[s].apply(this,c)}}function vO(r,e){const{name:t,type:n,direction:i}=e,s=t.slice(0,-1)+"Entries";r.prototype[s]=function(o,a){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return ri.empty();if(!arguments.length)return lO(this,n);if(arguments.length===1){o=""+o;const c=this._nodes.get(o);if(!c)throw new Ie(`Graph.${s}: could not find the "${o}" node in the graph.`);return hO(n,i,c)}if(arguments.length===2){o=""+o,a=""+a;const c=this._nodes.get(o);if(!c)throw new Ie(`Graph.${s}: could not find the "${o}" source node in the graph.`);if(!this._nodes.has(a))throw new Ie(`Graph.${s}: could not find the "${a}" target node in the graph.`);return dO(n,i,c,a)}throw new Be(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function _O(r){iO.forEach(e=>{pO(r,e),mO(r,e),gO(r,e),vO(r,e)})}const yO=[{name:"neighbors",type:"mixed"},{name:"inNeighbors",type:"directed",direction:"in"},{name:"outNeighbors",type:"directed",direction:"out"},{name:"inboundNeighbors",type:"mixed",direction:"in"},{name:"outboundNeighbors",type:"mixed",direction:"out"},{name:"directedNeighbors",type:"directed"},{name:"undirectedNeighbors",type:"undirected"}];function mh(){this.A=null,this.B=null}mh.prototype.wrap=function(r){this.A===null?this.A=r:this.B===null&&(this.B=r)};mh.prototype.has=function(r){return this.A!==null&&r in this.A||this.B!==null&&r in this.B};function Aa(r,e,t,n,i){for(const s in n){const o=n[s],a=o.source,c=o.target,l=a===t?c:a;if(e&&e.has(l.key))continue;const u=i(l.key,l.attributes);if(r&&u)return l.key}}function qm(r,e,t,n,i){if(e!=="mixed"){if(e==="undirected")return Aa(r,null,n,n.undirected,i);if(typeof t=="string")return Aa(r,null,n,n[t],i)}const s=new mh;let o;if(e!=="undirected"){if(t!=="out"){if(o=Aa(r,null,n,n.in,i),r&&o)return o;s.wrap(n.in)}if(t!=="in"){if(o=Aa(r,s,n,n.out,i),r&&o)return o;s.wrap(n.out)}}if(e!=="directed"&&(o=Aa(r,s,n,n.undirected,i),r&&o))return o}function xO(r,e,t){if(r!=="mixed"){if(r==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const n=[];return qm(!1,r,e,t,function(i){n.push(i)}),n}function Ca(r,e,t){const n=Object.keys(t),i=n.length;let s=0;return new ri(function(){let a=null;do{if(s>=i)return r&&r.wrap(t),{done:!0};const c=t[n[s++]],l=c.source,u=c.target;if(a=l===e?u:l,r&&r.has(a.key)){a=null;continue}}while(a===null);return{done:!1,value:{neighbor:a.key,attributes:a.attributes}}})}function bO(r,e,t){if(r!=="mixed"){if(r==="undirected")return Ca(null,t,t.undirected);if(typeof e=="string")return Ca(null,t,t[e])}let n=ri.empty();const i=new mh;return r!=="undirected"&&(e!=="out"&&(n=rr(n,Ca(i,t,t.in))),e!=="in"&&(n=rr(n,Ca(i,t,t.out)))),r!=="directed"&&(n=rr(n,Ca(i,t,t.undirected))),n}function wO(r,e){const{name:t,type:n,direction:i}=e;r.prototype[t]=function(s){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return[];s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new Ie(`Graph.${t}: could not find the "${s}" node in the graph.`);return xO(n==="mixed"?this.type:n,i,o)}}function SO(r,e){const{name:t,type:n,direction:i}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);r.prototype[s]=function(l,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;l=""+l;const h=this._nodes.get(l);if(typeof h>"u")throw new Ie(`Graph.${s}: could not find the "${l}" node in the graph.`);qm(!1,n==="mixed"?this.type:n,i,h,u)};const o="map"+t[0].toUpperCase()+t.slice(1);r.prototype[o]=function(l,u){const h=[];return this[s](l,(f,d)=>{h.push(u(f,d))}),h};const a="filter"+t[0].toUpperCase()+t.slice(1);r.prototype[a]=function(l,u){const h=[];return this[s](l,(f,d)=>{u(f,d)&&h.push(f)}),h};const c="reduce"+t[0].toUpperCase()+t.slice(1);r.prototype[c]=function(l,u,h){if(arguments.length<3)throw new Be(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let f=h;return this[s](l,(d,m)=>{f=u(f,d,m)}),f}}function EO(r,e){const{name:t,type:n,direction:i}=e,s=t[0].toUpperCase()+t.slice(1,-1),o="find"+s;r.prototype[o]=function(l,u){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return;l=""+l;const h=this._nodes.get(l);if(typeof h>"u")throw new Ie(`Graph.${o}: could not find the "${l}" node in the graph.`);return qm(!0,n==="mixed"?this.type:n,i,h,u)};const a="some"+s;r.prototype[a]=function(l,u){return!!this[o](l,u)};const c="every"+s;r.prototype[c]=function(l,u){return!this[o](l,(f,d)=>!u(f,d))}}function MO(r,e){const{name:t,type:n,direction:i}=e,s=t.slice(0,-1)+"Entries";r.prototype[s]=function(o){if(n!=="mixed"&&this.type!=="mixed"&&n!==this.type)return ri.empty();o=""+o;const a=this._nodes.get(o);if(typeof a>"u")throw new Ie(`Graph.${s}: could not find the "${o}" node in the graph.`);return bO(n==="mixed"?this.type:n,i,a)}}function TO(r){yO.forEach(e=>{wO(r,e),SO(r,e),EO(r,e),MO(r,e)})}function $l(r,e,t,n,i){const s=n._nodes.values(),o=n.type;let a,c,l,u,h,f;for(;a=s.next(),a.done!==!0;){let d=!1;if(c=a.value,o!=="undirected"){u=c.out;for(l in u){h=u[l];do f=h.target,d=!0,i(c.key,f.key,c.attributes,f.attributes,h.key,h.attributes,h.undirected),h=h.next;while(h)}}if(o!=="directed"){u=c.undirected;for(l in u)if(!(e&&c.key>l)){h=u[l];do f=h.target,f.key!==l&&(f=h.source),d=!0,i(c.key,f.key,c.attributes,f.attributes,h.key,h.attributes,h.undirected),h=h.next;while(h)}}t&&!d&&i(c.key,null,c.attributes,null,null,null,null)}}function AO(r,e){const t={key:r};return R1(e.attributes)||(t.attributes=Jt({},e.attributes)),t}function CO(r,e,t){const n={key:e,source:t.source.key,target:t.target.key};return R1(t.attributes)||(n.attributes=Jt({},t.attributes)),r==="mixed"&&t.undirected&&(n.undirected=!0),n}function RO(r){if(!cn(r))throw new Be('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in r))throw new Be("Graph.import: serialized node is missing its key.");if("attributes"in r&&(!cn(r.attributes)||r.attributes===null))throw new Be("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function PO(r){if(!cn(r))throw new Be('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in r))throw new Be("Graph.import: serialized edge is missing its source.");if(!("target"in r))throw new Be("Graph.import: serialized edge is missing its target.");if("attributes"in r&&(!cn(r.attributes)||r.attributes===null))throw new Be("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in r&&typeof r.undirected!="boolean")throw new Be("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const LO=IU(),DO=new Set(["directed","undirected","mixed"]),I_=new Set(["domain","_events","_eventsCount","_maxListeners"]),IO=[{name:r=>`${r}Edge`,generateKey:!0},{name:r=>`${r}DirectedEdge`,generateKey:!0,type:"directed"},{name:r=>`${r}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:r=>`${r}EdgeWithKey`},{name:r=>`${r}DirectedEdgeWithKey`,type:"directed"},{name:r=>`${r}UndirectedEdgeWithKey`,type:"undirected"}],UO={allowSelfLoops:!0,multi:!1,type:"mixed"};function OO(r,e,t){if(t&&!cn(t))throw new Be(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},r._nodes.has(e))throw new Xe(`Graph.addNode: the "${e}" node already exist in the graph.`);const n=new r.NodeDataClass(e,t);return r._nodes.set(e,n),r.emit("nodeAdded",{key:e,attributes:t}),n}function U_(r,e,t){const n=new r.NodeDataClass(e,t);return r._nodes.set(e,n),r.emit("nodeAdded",{key:e,attributes:t}),n}function F1(r,e,t,n,i,s,o,a){if(!n&&r.type==="undirected")throw new Xe(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(n&&r.type==="directed")throw new Xe(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(a&&!cn(a))throw new Be(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`);if(s=""+s,o=""+o,a=a||{},!r.allowSelfLoops&&s===o)throw new Xe(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const c=r._nodes.get(s),l=r._nodes.get(o);if(!c)throw new Ie(`Graph.${e}: source node "${s}" not found.`);if(!l)throw new Ie(`Graph.${e}: target node "${o}" not found.`);const u={key:null,undirected:n,source:s,target:o,attributes:a};if(t)i=r._edgeKeyGenerator();else if(i=""+i,r._edges.has(i))throw new Xe(`Graph.${e}: the "${i}" edge already exists in the graph.`);if(!r.multi&&(n?typeof c.undirected[o]<"u":typeof c.out[o]<"u"))throw new Xe(`Graph.${e}: an edge linking "${s}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);const h=new zo(n,i,c,l,a);r._edges.set(i,h);const f=s===o;return n?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,r._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,r._directedSelfLoopCount++)),r.multi?h.attachMulti():h.attach(),n?r._undirectedSize++:r._directedSize++,u.key=i,r.emit("edgeAdded",u),i}function NO(r,e,t,n,i,s,o,a,c){if(!n&&r.type==="undirected")throw new Xe(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(n&&r.type==="directed")throw new Xe(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(a){if(c){if(typeof a!="function")throw new Be(`Graph.${e}: invalid updater function. Expecting a function but got "${a}"`)}else if(!cn(a))throw new Be(`Graph.${e}: invalid attributes. Expecting an object but got "${a}"`)}s=""+s,o=""+o;let l;if(c&&(l=a,a=void 0),!r.allowSelfLoops&&s===o)throw new Xe(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=r._nodes.get(s),h=r._nodes.get(o),f,d;if(!t&&(f=r._edges.get(i),f)){if((f.source.key!==s||f.target.key!==o)&&(!n||f.source.key!==o||f.target.key!==s))throw new Xe(`Graph.${e}: inconsistency detected when attempting to merge the "${i}" edge with "${s}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);d=f}if(!d&&!r.multi&&u&&(d=n?u.undirected[o]:u.out[o]),d){const _=[d.key,!1,!1,!1];if(c?!l:!a)return _;if(c){const y=d.attributes;d.attributes=l(y),r.emit("edgeAttributesUpdated",{type:"replace",key:d.key,attributes:d.attributes})}else Jt(d.attributes,a),r.emit("edgeAttributesUpdated",{type:"merge",key:d.key,attributes:d.attributes,data:a});return _}a=a||{},c&&l&&(a=l(a));const m={key:null,undirected:n,source:s,target:o,attributes:a};if(t)i=r._edgeKeyGenerator();else if(i=""+i,r._edges.has(i))throw new Xe(`Graph.${e}: the "${i}" edge already exists in the graph.`);let v=!1,g=!1;u||(u=U_(r,s,{}),v=!0,s===o&&(h=u,g=!0)),h||(h=U_(r,o,{}),g=!0),f=new zo(n,i,u,h,a),r._edges.set(i,f);const p=s===o;return n?(u.undirectedDegree++,h.undirectedDegree++,p&&(u.undirectedLoops++,r._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,p&&(u.directedLoops++,r._directedSelfLoopCount++)),r.multi?f.attachMulti():f.attach(),n?r._undirectedSize++:r._directedSize++,m.key=i,r.emit("edgeAdded",m),[i,!0,v,g]}function uo(r,e){r._edges.delete(e.key);const{source:t,target:n,attributes:i}=e,s=e.undirected,o=t===n;s?(t.undirectedDegree--,n.undirectedDegree--,o&&(t.undirectedLoops--,r._undirectedSelfLoopCount--)):(t.outDegree--,n.inDegree--,o&&(t.directedLoops--,r._directedSelfLoopCount--)),r.multi?e.detachMulti():e.detach(),s?r._undirectedSize--:r._directedSize--,r.emit("edgeDropped",{key:e.key,attributes:i,source:t.key,target:n.key,undirected:s})}class St extends TU.EventEmitter{constructor(e){if(super(),e=Jt({},UO,e),typeof e.multi!="boolean")throw new Be(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!DO.has(e.type))throw new Be(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new Be(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?P1:e.type==="directed"?L1:D1;$n(this,"NodeDataClass",t);const n="geid_"+LO()+"_";let i=0;const s=()=>{let o;do o=n+i++;while(this._edges.has(o));return o};$n(this,"_attributes",{}),$n(this,"_nodes",new Map),$n(this,"_edges",new Map),$n(this,"_directedSize",0),$n(this,"_undirectedSize",0),$n(this,"_directedSelfLoopCount",0),$n(this,"_undirectedSelfLoopCount",0),$n(this,"_edgeKeyGenerator",s),$n(this,"_options",e),I_.forEach(o=>$n(this,o,this[o])),di(this,"order",()=>this._nodes.size),di(this,"size",()=>this._edges.size),di(this,"directedSize",()=>this._directedSize),di(this,"undirectedSize",()=>this._undirectedSize),di(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),di(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),di(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),di(this,"multi",this._options.multi),di(this,"type",this._options.type),di(this,"allowSelfLoops",this._options.allowSelfLoops),di(this,"implementation",()=>"graphology")}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(""+e)}hasDirectedEdge(e,t){if(this.type==="undirected")return!1;if(arguments.length===1){const n=""+e,i=this._edges.get(n);return!!i&&!i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new Be(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type==="directed")return!1;if(arguments.length===1){const n=""+e,i=this._edges.get(n);return!!i&&i.undirected}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new Be(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){const n=""+e;return this._edges.has(n)}else if(arguments.length===2){e=""+e,t=""+t;const n=this._nodes.get(e);return n?typeof n.out<"u"&&n.out.hasOwnProperty(t)||typeof n.undirected<"u"&&n.undirected.hasOwnProperty(t):!1}throw new Be(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type==="undirected")return;if(e=""+e,t=""+t,this.multi)throw new Xe("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new Ie(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const i=n.out&&n.out[t]||void 0;if(i)return i.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new Xe("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new Ie(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const i=n.undirected&&n.undirected[t]||void 0;if(i)return i.key}edge(e,t){if(this.multi)throw new Xe("Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.");e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new Ie(`Graph.edge: could not find the "${t}" target node in the graph.`);const i=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(i)return i.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.out}areInNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in n.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in n.undirected}areNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in n.in||t in n.out)||this.type!=="directed"&&t in n.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.in||this.type!=="directed"&&t in n.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const n=this._nodes.get(e);if(!n)throw new Ie(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in n.out||this.type!=="directed"&&t in n.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree}outDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree}directedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree}undirectedDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree}inboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree),n}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.outDegree),n}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!=="directed"&&(n+=t.undirectedDegree),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="undirected"?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type==="directed"?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree,i+=t.directedLoops),n-i}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.outDegree,i+=t.directedLoops),n-i}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,i=0;return this.type!=="directed"&&(n+=t.undirectedDegree,i+=t.undirectedLoops*2),this.type!=="undirected"&&(n+=t.inDegree+t.outDegree,i+=t.directedLoops*2),n-i}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=""+e,t=""+t;const n=this._edges.get(t);if(!n)throw new Ie(`Graph.opposite: could not find the "${t}" edge in the graph.`);const i=n.source.key,s=n.target.key;if(e===i)return s;if(e===s)return i;throw new Ie(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${i}, ${s}).`)}hasExtremity(e,t){e=""+e,t=""+t;const n=this._edges.get(e);if(!n)throw new Ie(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=""+e;const t=this._edges.get(e);if(!t)throw new Ie(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return OO(this,e,t).key}mergeNode(e,t){if(t&&!cn(t))throw new Be(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let n=this._nodes.get(e);return n?(t&&(Jt(n.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new Be(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let n=this._nodes.get(e);if(n){if(t){const s=n.attributes;n.attributes=t(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:n.attributes})}return[e,!1]}const i=t?t({}):{};return n=new this.NodeDataClass(e,i),this._nodes.set(e,n),this.emit("nodeAdded",{key:e,attributes:i}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new Ie(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!=="undirected"){for(const i in t.out){n=t.out[i];do uo(this,n),n=n.next;while(n)}for(const i in t.in){n=t.in[i];do uo(this,n),n=n.next;while(n)}}if(this.type!=="directed")for(const i in t.undirected){n=t.undirected[i];do uo(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const n=""+arguments[0],i=""+arguments[1];if(t=ii(this,n,i,this.type),!t)throw new Ie(`Graph.dropEdge: could not find the "${n}" -> "${i}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new Ie(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return uo(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new Xe("Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Xe("Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");e=""+e,t=""+t;const n=ii(this,e,t,"directed");if(!n)throw new Ie(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return uo(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new Xe("Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.");if(this.multi)throw new Xe("Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.");const n=ii(this,e,t,"undirected");if(!n)throw new Ie(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return uo(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit("cleared")}clearEdges(){const e=this._nodes.values();let t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit("edgesCleared")}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!="function")throw new Be("Graph.updateAttribute: updater should be a function.");const n=this._attributes[e];return this._attributes[e]=t(n),this.emit("attributesUpdated",{type:"set",attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit("attributesUpdated",{type:"remove",attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!cn(e))throw new Be("Graph.replaceAttributes: provided attributes are not a plain object.");return this._attributes=e,this.emit("attributesUpdated",{type:"replace",attributes:this._attributes}),this}mergeAttributes(e){if(!cn(e))throw new Be("Graph.mergeAttributes: provided attributes are not a plain object.");return Jt(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new Be("Graph.updateAttributes: provided updater is not a function.");return this._attributes=e(this._attributes),this.emit("attributesUpdated",{type:"update",attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!="function")throw new Be("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!D_(t))throw new Be("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._nodes.values();let i,s;for(;i=n.next(),i.done!==!0;)s=i.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new Be("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!D_(t))throw new Be("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const n=this._edges.values();let i,s,o,a;for(;i=n.next(),i.done!==!0;)s=i.value,o=s.source,a=s.target,s.attributes=e(s.key,s.attributes,o.key,a.key,o.attributes,a.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new Be("Graph.forEachAdjacencyEntry: expecting a callback.");$l(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new Be("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");$l(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new Be("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");$l(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new Be("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");$l(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):C1(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new Be("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)i=n.value,e(i.key,i.attributes)}findNode(e){if(typeof e!="function")throw new Be("Graph.findNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,e(i.key,i.attributes))return i.key}mapNodes(e){if(typeof e!="function")throw new Be("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let n,i;const s=new Array(this.order);let o=0;for(;n=t.next(),n.done!==!0;)i=n.value,s[o++]=e(i.key,i.attributes);return s}someNode(e){if(typeof e!="function")throw new Be("Graph.someNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,e(i.key,i.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new Be("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let n,i;for(;n=t.next(),n.done!==!0;)if(i=n.value,!e(i.key,i.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new Be("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let n,i;const s=[];for(;n=t.next(),n.done!==!0;)i=n.value,e(i.key,i.attributes)&&s.push(i.key);return s}reduceNodes(e,t){if(typeof e!="function")throw new Be("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new Be("Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.");let n=t;const i=this._nodes.values();let s,o;for(;s=i.next(),s.done!==!0;)o=s.value,n=e(n,o.key,o.attributes);return n}nodeEntries(){const e=this._nodes.values();return new ri(()=>{const t=e.next();if(t.done)return t;const n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((i,s)=>{e[t++]=AO(s,i)});const n=new Array(this._edges.size);return t=0,this._edges.forEach((i,s)=>{n[t++]=CO(this.type,s,i)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(e,t=!1){if(e instanceof St)return e.forEachNode((c,l)=>{t?this.mergeNode(c,l):this.addNode(c,l)}),e.forEachEdge((c,l,u,h,f,d,m)=>{t?m?this.mergeUndirectedEdgeWithKey(c,u,h,l):this.mergeDirectedEdgeWithKey(c,u,h,l):m?this.addUndirectedEdgeWithKey(c,u,h,l):this.addDirectedEdgeWithKey(c,u,h,l)}),this;if(!cn(e))throw new Be("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!cn(e.attributes))throw new Be("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let n,i,s,o,a;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new Be("Graph.import: invalid nodes. Expecting an array.");for(n=0,i=s.length;n{const s=Jt({},n.attributes);n=new t.NodeDataClass(i,s),t._nodes.set(i,n)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new Xe(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi=="boolean"&&e.multi!==this.multi&&e.multi!==!0)throw new Xe("Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.");if(typeof e.allowSelfLoops=="boolean"&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new Xe("Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.");const t=this.emptyCopy(e),n=this._edges.values();let i,s;for(;i=n.next(),i.done!==!0;)s=i.value,F1(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,Jt({},s.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,o)=>{e[o]=s.attributes});const t={},n={};this._edges.forEach((s,o)=>{const a=s.undirected?"--":"->";let c="",l=s.source.key,u=s.target.key,h;s.undirected&&l>u&&(h=l,l=u,u=h);const f=`(${l})${a}(${u})`;o.startsWith("geid_")?this.multi&&(typeof n[f]>"u"?n[f]=0:n[f]++,c+=`${n[f]}. `):c+=`[${o}]: `,c+=f,t[c]=s.attributes});const i={};for(const s in this)this.hasOwnProperty(s)&&!I_.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(i[s]=this[s]);return i.attributes=this._attributes,i.nodes=e,i.edges=t,$n(i,"constructor",this.constructor),i}}typeof Symbol<"u"&&(St.prototype[Symbol.for("nodejs.util.inspect.custom")]=St.prototype.inspect);IO.forEach(r=>{["add","merge","update"].forEach(e=>{const t=r.name(e),n=e==="add"?F1:NO;r.generateKey?St.prototype[t]=function(i,s,o){return n(this,t,!0,(r.type||this.type)==="undirected",null,i,s,o,e==="update")}:St.prototype[t]=function(i,s,o,a){return n(this,t,!1,(r.type||this.type)==="undirected",i,s,o,a,e==="update")}})});XU(St);nO(St);_O(St);TO(St);class k1 extends St{constructor(e){const t=Jt({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new Be("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new Be('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class z1 extends St{constructor(e){const t=Jt({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new Be("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new Be('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class B1 extends St{constructor(e){const t=Jt({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new Be("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class G1 extends St{constructor(e){const t=Jt({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new Be("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new Be('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class V1 extends St{constructor(e){const t=Jt({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new Be("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new Be('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Bo(r){r.from=function(e,t){const n=Jt({},e.options,t),i=new r(n);return i.import(e),i}}Bo(St);Bo(k1);Bo(z1);Bo(B1);Bo(G1);Bo(V1);St.Graph=St;St.DirectedGraph=k1;St.UndirectedGraph=z1;St.MultiGraph=B1;St.MultiDirectedGraph=G1;St.MultiUndirectedGraph=V1;St.InvalidArgumentsGraphError=Be;St.NotFoundGraphError=Ie;St.UsageGraphError=Xe;const Fc=new G,Ym=new G,FO=new G;function kO(r,e,t){const n=Fc.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,s=t.height/2;return[n.x*i+i,-(n.y*s)+s]}function zO(r,e){const t=Fc.setFromMatrixPosition(r.matrixWorld),n=Ym.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),s=e.getWorldDirection(FO);return i.angleTo(s)>Math.PI/2}function BO(r,e,t,n){const i=Fc.setFromMatrixPosition(r.matrixWorld),s=i.clone();s.project(e),t.setFromCamera(s,e);const o=t.intersectObjects(n,!0);if(o.length){const a=o[0].distance;return i.distanceTo(t.ray.origin)Math.abs(r)<1e-10?0:r;function H1(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=Mp(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const HO=(r=>e=>H1(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),WO=(r=>(e,t)=>H1(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]);function XO(r){return r&&typeof r=="object"&&"current"in r}const jm=q.forwardRef(({children:r,eps:e=.001,style:t,className:n,prepend:i,center:s,fullscreen:o,portal:a,distanceFactor:c,sprite:l=!1,transform:u=!1,occlude:h,onOcclude:f,castShadow:d,receiveShadow:m,material:v,geometry:g,zIndexRange:p=[16777271,0],calculatePosition:_=kO,as:y="div",wrapperClass:x,pointerEvents:b="auto",...w},S)=>{const{gl:M,camera:E,scene:T,size:L,raycaster:P,events:A,viewport:z}=Kt(),[V]=q.useState(()=>document.createElement(y)),N=q.useRef(),C=q.useRef(null),O=q.useRef(0),k=q.useRef([0,0]),U=q.useRef(null),R=q.useRef(null),F=(a==null?void 0:a.current)||A.connected||M.domElement.parentNode,H=q.useRef(null),Y=q.useRef(!1),J=q.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&XO(h[0]),[h]);q.useLayoutEffect(()=>{const me=M.domElement;h&&h==="blending"?(me.style.zIndex=`${Math.floor(p[0]/2)}`,me.style.position="absolute",me.style.pointerEvents="none"):(me.style.zIndex=null,me.style.position=null,me.style.pointerEvents=null)},[h]),q.useLayoutEffect(()=>{if(C.current){const me=N.current=Kw.createRoot(V);if(T.updateMatrixWorld(),u)V.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const te=_(C.current,E,L);V.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${te[0]}px,${te[1]}px,0);transform-origin:0 0;`}return F&&(i?F.prepend(V):F.appendChild(V)),()=>{F&&F.removeChild(V),me.unmount()}}},[F,u]),q.useLayoutEffect(()=>{x&&(V.className=x)},[x]);const ie=q.useMemo(()=>u?{position:"absolute",top:0,left:0,width:L.width,height:L.height,transformStyle:"preserve-3d",pointerEvents:"none"}:{position:"absolute",transform:s?"translate3d(-50%,-50%,0)":"none",...o&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...t},[t,s,o,L,u]),ne=q.useMemo(()=>({position:"absolute",pointerEvents:b}),[b]);q.useLayoutEffect(()=>{if(Y.current=!1,u){var me;(me=N.current)==null||me.render(q.createElement("div",{ref:U,style:ie},q.createElement("div",{ref:R,style:ne},q.createElement("div",{ref:S,className:n,style:t,children:r}))))}else{var te;(te=N.current)==null||te.render(q.createElement("div",{ref:S,style:ie,className:n,children:r}))}});const ee=q.useRef(!0);uh(me=>{if(C.current){E.updateMatrixWorld(),C.current.updateWorldMatrix(!0,!1);const te=u?k.current:_(C.current,E,L);if(u||Math.abs(O.current-E.zoom)>e||Math.abs(k.current[0]-te[0])>e||Math.abs(k.current[1]-te[1])>e){const D=zO(C.current,E);let Q=!1;J&&(Array.isArray(h)?Q=h.map(ye=>ye.current):h!=="blending"&&(Q=[T]));const j=ee.current;if(Q){const ye=BO(C.current,E,P,Q);ee.current=ye&&!D}else ee.current=!D;j!==ee.current&&(f?f(!ee.current):V.style.display=ee.current?"block":"none");const K=Math.floor(p[0]/2),W=h?J?[p[0],K]:[K-1,0]:p;if(V.style.zIndex=`${VO(C.current,E,W)}`,u){const[ye,re]=[L.width/2,L.height/2],fe=E.projectionMatrix.elements[5]*re,{isOrthographicCamera:xe,top:ce,left:Pe,bottom:B,right:I}=E,$=HO(E.matrixWorldInverse),he=xe?`scale(${fe})translate(${Mp(-(I+Pe)/2)}px,${Mp((ce+B)/2)}px)`:`translateZ(${fe}px)`;let de=C.current.matrixWorld;l&&(de=E.matrixWorldInverse.clone().transpose().copyPosition(de).scale(C.current.scale),de.elements[3]=de.elements[7]=de.elements[11]=0,de.elements[15]=1),V.style.width=L.width+"px",V.style.height=L.height+"px",V.style.perspective=xe?"":`${fe}px`,U.current&&R.current&&(U.current.style.transform=`${he}${$}translate(${ye}px,${re}px)`,R.current.style.transform=WO(de,1/((c||10)/400)))}else{const ye=c===void 0?1:GO(C.current,E)*c;V.style.transform=`translate3d(${te[0]}px,${te[1]}px,0) scale(${ye})`}k.current=te,O.current=E.zoom}}if(!J&&H.current&&!Y.current)if(u){if(U.current){const te=U.current.children[0];if(te!=null&&te.clientWidth&&te!=null&&te.clientHeight){const{isOrthographicCamera:D}=E;if(D||g)w.scale&&(Array.isArray(w.scale)?w.scale instanceof G?H.current.scale.copy(w.scale.clone().divideScalar(1)):H.current.scale.set(1/w.scale[0],1/w.scale[1],1/w.scale[2]):H.current.scale.setScalar(1/w.scale));else{const Q=(c||10)/400,j=te.clientWidth*Q,K=te.clientHeight*Q;H.current.scale.set(j,K,1)}Y.current=!0}}}else{const te=V.children[0];if(te!=null&&te.clientWidth&&te!=null&&te.clientHeight){const D=1/z.factor,Q=te.clientWidth*D,j=te.clientHeight*D;H.current.scale.set(Q,j,1),Y.current=!0}H.current.lookAt(me.camera.position)}});const ge=q.useMemo(()=>({vertexShader:u?void 0:` + /* + This shader is from the THREE's SpriteMaterial. + We need to turn the backing plane into a Sprite + (make it always face the camera) if "transfrom" + is false. + */ + #include + + void main() { + vec2 center = vec2(0., 1.); + float rotation = 0.0; + + // This is somewhat arbitrary, but it seems to work well + // Need to figure out how to derive this dynamically if it even matters + float size = 0.03; + + 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 ) ); + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; + 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; + } + `,fragmentShader:` + void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + } + `}),[u]);return q.createElement("group",Tc({},w,{ref:C}),h&&!J&&q.createElement("mesh",{castShadow:d,receiveShadow:m,ref:H},g||q.createElement("planeGeometry",null),v||q.createElement("shaderMaterial",{side:Dt,vertexShader:ge.vertexShader,fragmentShader:ge.fragmentShader})))});function ds(r,e="pointer",t="auto",n=document.body){q.useEffect(()=>{if(r)return n.style.cursor=e,()=>void(n.style.cursor=t)},[r])}let $m=zc();const Je=r=>kc(r,$m);let Zm=zc();Je.write=r=>kc(r,Zm);let gh=zc();Je.onStart=r=>kc(r,gh);let Km=zc();Je.onFrame=r=>kc(r,Km);let Jm=zc();Je.onFinish=r=>kc(r,Jm);let Eo=[];Je.setTimeout=(r,e)=>{let t=Je.now()+e,n=()=>{let s=Eo.findIndex(o=>o.cancel==n);~s&&Eo.splice(s,1),Er-=~s?1:0},i={time:t,handler:r,cancel:n};return Eo.splice(W1(t),0,i),Er+=1,X1(),i};let W1=r=>~(~Eo.findIndex(e=>e.time>r)||~Eo.length);Je.cancel=r=>{gh.delete(r),Km.delete(r),Jm.delete(r),$m.delete(r),Zm.delete(r)};Je.sync=r=>{Tp=!0,Je.batchedUpdates(r),Tp=!1};Je.throttle=r=>{let e;function t(){try{r(...e)}finally{e=null}}function n(...i){e=i,Je.onStart(t)}return n.handler=r,n.cancel=()=>{gh.delete(t),e=null},n};let Qm=typeof window<"u"?window.requestAnimationFrame:()=>{};Je.use=r=>Qm=r;Je.now=typeof performance<"u"?()=>performance.now():Date.now;Je.batchedUpdates=r=>r();Je.catch=console.error;Je.frameLoop="always";Je.advance=()=>{Je.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):Y1()};let Sr=-1,Er=0,Tp=!1;function kc(r,e){Tp?(e.delete(r),r(0)):(e.add(r),X1())}function X1(){Sr<0&&(Sr=0,Je.frameLoop!=="demand"&&Qm(q1))}function qO(){Sr=-1}function q1(){~Sr&&(Qm(q1),Je.batchedUpdates(Y1))}function Y1(){let r=Sr;Sr=Je.now();let e=W1(Sr);if(e&&(j1(Eo.splice(0,e),t=>t.handler()),Er-=e),!Er){qO();return}gh.flush(),$m.flush(r?Math.min(64,Sr-r):16.667),Km.flush(),Zm.flush(),Jm.flush()}function zc(){let r=new Set,e=r;return{add(t){Er+=e==r&&!r.has(t)?1:0,r.add(t)},delete(t){return Er-=e==r&&r.has(t)?1:0,r.delete(t)},flush(t){e.size&&(r=new Set,Er-=e.size,j1(e,n=>n(t)&&r.add(n)),Er+=r.size,e=r)}}}function j1(r,e){r.forEach(t=>{try{e(t)}catch(n){Je.catch(n)}})}function Ap(){}const YO=(r,e,t)=>Object.defineProperty(r,e,{value:t,writable:!0,configurable:!0}),Oe={arr:Array.isArray,obj:r=>!!r&&r.constructor.name==="Object",fun:r=>typeof r=="function",str:r=>typeof r=="string",num:r=>typeof r=="number",und:r=>r===void 0};function Ji(r,e){if(Oe.arr(r)){if(!Oe.arr(e)||r.length!==e.length)return!1;for(let t=0;tr.forEach(e);function or(r,e,t){if(Oe.arr(r)){for(let n=0;nOe.und(r)?[]:Oe.arr(r)?r:[r];function Xa(r,e){if(r.size){const t=Array.from(r);r.clear(),_t(t,e)}}const ka=(r,...e)=>Xa(r,t=>t(...e)),eg=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);let tg,$1,Rr=null,Z1=!1,ng=Ap;const jO=r=>{r.to&&($1=r.to),r.now&&(Je.now=r.now),r.colors!==void 0&&(Rr=r.colors),r.skipAnimation!=null&&(Z1=r.skipAnimation),r.createStringInterpolator&&(tg=r.createStringInterpolator),r.requestAnimationFrame&&Je.use(r.requestAnimationFrame),r.batchedUpdates&&(Je.batchedUpdates=r.batchedUpdates),r.willAdvance&&(ng=r.willAdvance),r.frameLoop&&(Je.frameLoop=r.frameLoop)};var Fi=Object.freeze({__proto__:null,get createStringInterpolator(){return tg},get to(){return $1},get colors(){return Rr},get skipAnimation(){return Z1},get willAdvance(){return ng},assign:jO});const qa=new Set;let ti=[],_d=[],Mu=0;const vh={get idle(){return!qa.size&&!ti.length},start(r){Mu>r.priority?(qa.add(r),Je.onStart($O)):(K1(r),Je(Cp))},advance:Cp,sort(r){if(Mu)Je.onFrame(()=>vh.sort(r));else{const e=ti.indexOf(r);~e&&(ti.splice(e,1),J1(r))}},clear(){ti=[],qa.clear()}};function $O(){qa.forEach(K1),qa.clear(),Je(Cp)}function K1(r){ti.includes(r)||J1(r)}function J1(r){ti.splice(ZO(ti,e=>e.priority>r.priority),0,r)}function Cp(r){const e=_d;for(let t=0;t0}function ZO(r,e){const t=r.findIndex(e);return t<0?r.length:t}const KO={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},_i="[-+]?\\d*\\.?\\d+",Tu=_i+"%";function _h(...r){return"\\(\\s*("+r.join(")\\s*,\\s*(")+")\\s*\\)"}const JO=new RegExp("rgb"+_h(_i,_i,_i)),QO=new RegExp("rgba"+_h(_i,_i,_i,_i)),e3=new RegExp("hsl"+_h(_i,Tu,Tu)),t3=new RegExp("hsla"+_h(_i,Tu,Tu,_i)),n3=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,i3=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,r3=/^#([0-9a-fA-F]{6})$/,s3=/^#([0-9a-fA-F]{8})$/;function o3(r){let e;return typeof r=="number"?r>>>0===r&&r>=0&&r<=4294967295?r:null:(e=r3.exec(r))?parseInt(e[1]+"ff",16)>>>0:Rr&&Rr[r]!==void 0?Rr[r]:(e=JO.exec(r))?(ho(e[1])<<24|ho(e[2])<<16|ho(e[3])<<8|255)>>>0:(e=QO.exec(r))?(ho(e[1])<<24|ho(e[2])<<16|ho(e[3])<<8|F_(e[4]))>>>0:(e=n3.exec(r))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=s3.exec(r))?parseInt(e[1],16)>>>0:(e=i3.exec(r))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=e3.exec(r))?(O_(N_(e[1]),Zl(e[2]),Zl(e[3]))|255)>>>0:(e=t3.exec(r))?(O_(N_(e[1]),Zl(e[2]),Zl(e[3]))|F_(e[4]))>>>0:null}function yd(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*(2/3-t)*6:r}function O_(r,e,t){const n=t<.5?t*(1+e):t+e-t*e,i=2*t-n,s=yd(i,n,r+1/3),o=yd(i,n,r),a=yd(i,n,r-1/3);return Math.round(s*255)<<24|Math.round(o*255)<<16|Math.round(a*255)<<8}function ho(r){const e=parseInt(r,10);return e<0?0:e>255?255:e}function N_(r){return(parseFloat(r)%360+360)%360/360}function F_(r){const e=parseFloat(r);return e<0?0:e>1?255:Math.round(e*255)}function Zl(r){const e=parseFloat(r);return e<0?0:e>100?1:e/100}function k_(r){let e=o3(r);if(e===null)return r;e=e||0;let t=(e&4278190080)>>>24,n=(e&16711680)>>>16,i=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${n}, ${i}, ${s})`}const vc=(r,e,t)=>{if(Oe.fun(r))return r;if(Oe.arr(r))return vc({range:r,output:e,extrapolate:t});if(Oe.str(r.output[0]))return tg(r);const n=r,i=n.output,s=n.range||[0,1],o=n.extrapolateLeft||n.extrapolate||"extend",a=n.extrapolateRight||n.extrapolate||"extend",c=n.easing||(l=>l);return l=>{const u=c3(l,s);return a3(l,s[u],s[u+1],i[u],i[u+1],c,o,a,n.map)}};function a3(r,e,t,n,i,s,o,a,c){let l=c?c(r):r;if(lt){if(a==="identity")return l;a==="clamp"&&(l=t)}return n===i?n:e===t?r<=e?n:i:(e===-1/0?l=-l:t===1/0?l=l-e:l=(l-e)/(t-e),l=s(l),n===-1/0?l=-l:i===1/0?l=l+n:l=l*(i-n)+n,l)}function c3(r,e){for(var t=1;t=r);++t);return t-1}const l3={linear:r=>r};function Rp(){return Rp=Object.assign?Object.assign.bind():function(r){for(var e=1;e!!(r&&r[Io]),Jn=r=>r&&r[Io]?r[Io]():r,z_=r=>r[ws]||null;function u3(r,e){r.eventObserved?r.eventObserved(e):r(e)}function Au(r,e){let t=r[ws];t&&t.forEach(n=>{u3(n,e)})}class h3{constructor(e){if(this[Io]=void 0,this[ws]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");f3(this,e)}}const f3=(r,e)=>Q1(r,Io,e);function Bc(r,e){if(r[Io]){let t=r[ws];t||Q1(r,ws,t=new Set),t.has(e)||(t.add(e),r.observerAdded&&r.observerAdded(t.size,e))}return e}function Cu(r,e){let t=r[ws];if(t&&t.has(e)){const n=t.size-1;n?t.delete(e):r[ws]=null,r.observerRemoved&&r.observerRemoved(n,e)}}const Q1=(r,e,t)=>Object.defineProperty(r,e,{value:t,writable:!0,configurable:!0}),du=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,d3=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,B_=new RegExp(`(${du.source})(%|[a-z]+)`,"i"),p3=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,yh=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,ew=r=>{const[e,t]=m3(r);if(!e||eg())return r;const n=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(n)return n.trim();if(t&&t.startsWith("--")){const i=window.getComputedStyle(document.documentElement).getPropertyValue(t);return i||r}else{if(t&&yh.test(t))return ew(t);if(t)return t}return r},m3=r=>{const e=yh.exec(r);if(!e)return[,];const[,t,n]=e;return[t,n]};let xd;const g3=(r,e,t,n,i)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)}, ${i})`,tw=r=>{xd||(xd=Rr?new RegExp(`(${Object.keys(Rr).join("|")})(?!\\w)`,"g"):/^\b$/);const e=r.output.map(s=>Jn(s).replace(yh,ew).replace(d3,k_).replace(xd,k_)),t=e.map(s=>s.match(du).map(Number)),i=t[0].map((s,o)=>t.map(a=>{if(!(o in a))throw Error('The arity of each "output" value must be equal');return a[o]})).map(s=>vc(Rp({},r,{output:s})));return s=>{var o;const a=!B_.test(e[0])&&((o=e.find(l=>B_.test(l)))==null?void 0:o.replace(du,""));let c=0;return e[0].replace(du,()=>`${i[c++](s)}${a||""}`).replace(p3,g3)}},ig="react-spring: ",nw=r=>{const e=r;let t=!1;if(typeof e!="function")throw new TypeError(`${ig}once requires a function parameter`);return(...n)=>{t||(e(...n),t=!0)}},v3=nw(console.warn);function _3(){v3(`${ig}The "interpolate" function is deprecated in v9 (use "to" instead)`)}const y3=nw(console.warn);function x3(){y3(`${ig}Directly calling start instead of using the api object is deprecated in v9 (use ".start" instead), this will be removed in later 0.X.0 versions`)}function xh(r){return Oe.str(r)&&(r[0]=="#"||/\d/.test(r)||!eg()&&yh.test(r)||r in(Rr||{}))}const rg=eg()?q.useEffect:q.useLayoutEffect,b3=()=>{const r=q.useRef(!1);return rg(()=>(r.current=!0,()=>{r.current=!1}),[]),r};function iw(){const r=q.useState()[1],e=b3();return()=>{e.current&&r(Math.random())}}function w3(r,e){const[t]=q.useState(()=>({inputs:e,result:r()})),n=q.useRef(),i=n.current;let s=i;return s?e&&s.inputs&&S3(e,s.inputs)||(s={inputs:e,result:r()}):s=t,q.useEffect(()=>{n.current=s,i==t&&(t.inputs=t.result=void 0)},[s]),s.result}function S3(r,e){if(r.length!==e.length)return!1;for(let t=0;tq.useEffect(r,E3),E3=[];function G_(r){const e=q.useRef();return q.useEffect(()=>{e.current=r}),e.current}const _c=Symbol.for("Animated:node"),M3=r=>!!r&&r[_c]===r,Ri=r=>r&&r[_c],sg=(r,e)=>YO(r,_c,e),bh=r=>r&&r[_c]&&r[_c].getPayload();class sw{constructor(){this.payload=void 0,sg(this,this)}getPayload(){return this.payload||[]}}class Go extends sw{constructor(e){super(),this.done=!0,this.elapsedTime=void 0,this.lastPosition=void 0,this.lastVelocity=void 0,this.v0=void 0,this.durationProgress=0,this._value=e,Oe.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new Go(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Oe.num(e)&&(this.lastPosition=e,t&&(e=Math.round(e/t)*t,this.done&&(this.lastPosition=e))),this._value===e?!1:(this._value=e,!0)}reset(){const{done:e}=this;this.done=!1,Oe.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class Uo extends Go{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=vc({output:[e,e]})}static create(e){return new Uo(e)}getValue(){let e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(Oe.str(e)){if(e==this._string)return!1;this._string=e,this._value=1}else if(super.setValue(e))this._string=null;else return!1;return!0}reset(e){e&&(this._toString=vc({output:[this.getValue(),e]})),this._value=0,super.reset()}}const Ru={dependencies:null};class og extends sw{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return or(this.source,(n,i)=>{M3(n)?t[i]=n.getValue(e):Pi(n)?t[i]=Jn(n):e||(t[i]=n)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&_t(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return or(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){Ru.dependencies&&Pi(e)&&Ru.dependencies.add(e);const t=bh(e);t&&_t(t,n=>this.add(n))}}class ag extends og{constructor(e){super(e)}static create(e){return new ag(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((n,i)=>n.setValue(e[i])).some(Boolean):(super.setValue(e.map(T3)),!0)}}function T3(r){return(xh(r)?Uo:Go).create(r)}function Pp(r){const e=Ri(r);return e?e.constructor:Oe.arr(r)?ag:xh(r)?Uo:Go}function Pu(){return Pu=Object.assign?Object.assign.bind():function(r){for(var e=1;e{const t=!Oe.fun(r)||r.prototype&&r.prototype.isReactComponent;return q.forwardRef((n,i)=>{const s=q.useRef(null),o=t&&q.useCallback(m=>{s.current=R3(i,m)},[i]),[a,c]=C3(n,e),l=iw(),u=()=>{const m=s.current;if(t&&!m)return;(m?e.applyAnimatedValues(m,a.getValue(!0)):!1)===!1&&l()},h=new A3(u,c),f=q.useRef();rg(()=>(f.current=h,_t(c,m=>Bc(m,h)),()=>{f.current&&(_t(f.current.deps,m=>Cu(m,f.current)),Je.cancel(f.current.update))})),q.useEffect(u,[]),rw(()=>()=>{const m=f.current;_t(m.deps,v=>Cu(v,m))});const d=e.getComponentProps(a.getValue());return q.createElement(r,Pu({},d,{ref:o}))})};class A3{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&Je.write(this.update)}}function C3(r,e){const t=new Set;return Ru.dependencies=t,r.style&&(r=Pu({},r,{style:e.createAnimatedStyle(r.style)})),r=new og(r),Ru.dependencies=null,[r,t]}function R3(r,e){return r&&(Oe.fun(r)?r(e):r.current=e),e}const H_=Symbol.for("AnimatedComponent"),P3=(r,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=i=>new og(i),getComponentProps:n=i=>i}={})=>{const i={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:n},s=o=>{const a=W_(o)||"Anonymous";return Oe.str(o)?o=s[o]||(s[o]=V_(o,i)):o=o[H_]||(o[H_]=V_(o,i)),o.displayName=`Animated(${a})`,o};return or(r,(o,a)=>{Oe.arr(r)&&(a=W_(o)),s[a]=s(o)}),{animated:s}},W_=r=>Oe.str(r)?r:r&&Oe.str(r.displayName)?r.displayName:Oe.fun(r)&&r.name||null;function rn(){return rn=Object.assign?Object.assign.bind():function(r){for(var e=1;er===!0||!!(e&&r&&(Oe.fun(r)?r(e):ni(r).includes(e))),ow=(r,e)=>Oe.obj(r)?e&&r[e]:r,aw=(r,e)=>r.default===!0?r[e]:r.default?r.default[e]:void 0,L3=r=>r,cg=(r,e=L3)=>{let t=D3;r.default&&r.default!==!0&&(r=r.default,t=Object.keys(r));const n={};for(const i of t){const s=e(r[i],i);Oe.und(s)||(n[i]=s)}return n},D3=["config","onProps","onStart","onChange","onPause","onResume","onRest"],I3={config:1,from:1,to:1,ref:1,loop:1,reset:1,pause:1,cancel:1,reverse:1,immediate:1,default:1,delay:1,onProps:1,onStart:1,onChange:1,onPause:1,onResume:1,onRest:1,onResolve:1,items:1,trail:1,sort:1,expires:1,initial:1,enter:1,update:1,leave:1,children:1,onDestroyed:1,keys:1,callId:1,parentId:1};function U3(r){const e={};let t=0;if(or(r,(n,i)=>{I3[i]||(e[i]=n,t++)}),t)return e}function cw(r){const e=U3(r);if(e){const t={to:e};return or(r,(n,i)=>i in e||(t[i]=n)),t}return rn({},r)}function yc(r){return r=Jn(r),Oe.arr(r)?r.map(yc):xh(r)?Fi.createStringInterpolator({range:[0,1],output:[r,r]})(1):r}function O3(r){for(const e in r)return!0;return!1}function Lp(r){return Oe.fun(r)||Oe.arr(r)&&Oe.obj(r[0])}function N3(r,e){var t;(t=r.ref)==null||t.delete(r),e==null||e.delete(r)}function F3(r,e){if(e&&r.ref!==e){var t;(t=r.ref)==null||t.delete(r),e.add(r),r.ref=e}}const k3={default:{tension:170,friction:26}},Dp=rn({},k3.default,{mass:1,damping:1,easing:l3.linear,clamp:!1});class z3{constructor(){this.tension=void 0,this.friction=void 0,this.frequency=void 0,this.damping=void 0,this.mass=void 0,this.velocity=0,this.restVelocity=void 0,this.precision=void 0,this.progress=void 0,this.duration=void 0,this.easing=void 0,this.clamp=void 0,this.bounce=void 0,this.decay=void 0,this.round=void 0,Object.assign(this,Dp)}}function B3(r,e,t){t&&(t=rn({},t),X_(t,e),e=rn({},t,e)),X_(r,e),Object.assign(r,e);for(const o in Dp)r[o]==null&&(r[o]=Dp[o]);let{mass:n,frequency:i,damping:s}=r;return Oe.und(i)||(i<.01&&(i=.01),s<0&&(s=0),r.tension=Math.pow(2*Math.PI/i,2)*n,r.friction=4*Math.PI*s*n/i),r}function X_(r,e){if(!Oe.und(e.decay))r.duration=void 0;else{const t=!Oe.und(e.tension)||!Oe.und(e.friction);(t||!Oe.und(e.frequency)||!Oe.und(e.damping)||!Oe.und(e.mass))&&(r.duration=void 0,r.decay=void 0),t&&(r.frequency=void 0)}}const q_=[];class G3{constructor(){this.changed=!1,this.values=q_,this.toValues=null,this.fromValues=q_,this.to=void 0,this.from=void 0,this.config=new z3,this.immediate=!1}}function lw(r,{key:e,props:t,defaultProps:n,state:i,actions:s}){return new Promise((o,a)=>{var c;let l,u,h=Ya((c=t.cancel)!=null?c:n==null?void 0:n.cancel,e);if(h)m();else{Oe.und(t.pause)||(i.paused=Ya(t.pause,e));let v=n==null?void 0:n.pause;v!==!0&&(v=i.paused||Ya(v,e)),l=rs(t.delay||0,e),v?(i.resumeQueue.add(d),s.pause()):(s.resume(),d())}function f(){i.resumeQueue.add(d),i.timeouts.delete(u),u.cancel(),l=u.time-Je.now()}function d(){l>0&&!Fi.skipAnimation?(i.delayed=!0,u=Je.setTimeout(m,l),i.pauseQueue.add(f),i.timeouts.add(u)):m()}function m(){i.delayed&&(i.delayed=!1),i.pauseQueue.delete(f),i.timeouts.delete(u),r<=(i.cancelId||0)&&(h=!0);try{s.start(rn({},t,{callId:r,cancel:h}),o)}catch(v){a(v)}}})}const lg=(r,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?Mo(r.get()):e.every(t=>t.noop)?uw(r.get()):vi(r.get(),e.every(t=>t.finished)),uw=r=>({value:r,noop:!0,finished:!0,cancelled:!1}),vi=(r,e,t=!1)=>({value:r,finished:e,cancelled:t}),Mo=r=>({value:r,cancelled:!0,finished:!1});function hw(r,e,t,n){const{callId:i,parentId:s,onRest:o}=e,{asyncTo:a,promise:c}=t;return!s&&r===a&&!e.reset?c:t.promise=(async()=>{t.asyncId=i,t.asyncTo=r;const l=cg(e,(g,p)=>p==="onRest"?void 0:g);let u,h;const f=new Promise((g,p)=>(u=g,h=p)),d=g=>{const p=i<=(t.cancelId||0)&&Mo(n)||i!==t.asyncId&&vi(n,!1);if(p)throw g.result=p,h(g),g},m=(g,p)=>{const _=new Y_,y=new j_;return(async()=>{if(Fi.skipAnimation)throw xc(t),y.result=vi(n,!1),h(y),y;d(_);const x=Oe.obj(g)?rn({},g):rn({},p,{to:g});x.parentId=i,or(l,(w,S)=>{Oe.und(x[S])&&(x[S]=w)});const b=await n.start(x);return d(_),t.paused&&await new Promise(w=>{t.resumeQueue.add(w)}),b})()};let v;if(Fi.skipAnimation)return xc(t),vi(n,!1);try{let g;Oe.arr(r)?g=(async p=>{for(const _ of p)await m(_)})(r):g=Promise.resolve(r(m,n.stop.bind(n))),await Promise.all([g.then(u),f]),v=vi(n.get(),!0,!1)}catch(g){if(g instanceof Y_)v=g.result;else if(g instanceof j_)v=g.result;else throw g}finally{i==t.asyncId&&(t.asyncId=s,t.asyncTo=s?a:void 0,t.promise=s?c:void 0)}return Oe.fun(o)&&Je.batchedUpdates(()=>{o(v,n,n.item)}),v})()}function xc(r,e){Xa(r.timeouts,t=>t.cancel()),r.pauseQueue.clear(),r.resumeQueue.clear(),r.asyncId=r.asyncTo=r.promise=void 0,e&&(r.cancelId=e)}class Y_ extends Error{constructor(){super("An async animation has been interrupted. You see this error because you forgot to use `await` or `.catch(...)` on its returned promise."),this.result=void 0}}class j_ extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const Ip=r=>r instanceof ug;let V3=1;class ug extends h3{constructor(...e){super(...e),this.id=V3++,this.key=void 0,this._priority=0}get priority(){return this._priority}set priority(e){this._priority!=e&&(this._priority=e,this._onPriorityChange(e))}get(){const e=Ri(this);return e&&e.getValue()}to(...e){return Fi.to(this,e)}interpolate(...e){return _3(),Fi.to(this,e)}toJSON(){return this.get()}observerAdded(e){e==1&&this._attach()}observerRemoved(e){e==0&&this._detach()}_attach(){}_detach(){}_onChange(e,t=!1){Au(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||vh.sort(this),Au(this,{type:"priority",parent:this,priority:e})}}const Ss=Symbol.for("SpringPhase"),fw=1,Up=2,Op=4,bd=r=>(r[Ss]&fw)>0,xr=r=>(r[Ss]&Up)>0,Ra=r=>(r[Ss]&Op)>0,$_=(r,e)=>e?r[Ss]|=Up|fw:r[Ss]&=~Up,Z_=(r,e)=>e?r[Ss]|=Op:r[Ss]&=~Op;class H3 extends ug{constructor(e,t){if(super(),this.key=void 0,this.animation=new G3,this.queue=void 0,this.defaultProps={},this._state={paused:!1,delayed:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._pendingCalls=new Set,this._lastCallId=0,this._lastToId=0,this._memoizedDuration=0,!Oe.und(e)||!Oe.und(t)){const n=Oe.obj(e)?rn({},e):rn({},t,{from:e});Oe.und(n.default)&&(n.default=!0),this.start(n)}}get idle(){return!(xr(this)||this._state.asyncTo)||Ra(this)}get goal(){return Jn(this.animation.to)}get velocity(){const e=Ri(this);return e instanceof Go?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return bd(this)}get isAnimating(){return xr(this)}get isPaused(){return Ra(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,n=!1;const i=this.animation;let{config:s,toValues:o}=i;const a=bh(i.to);!a&&Pi(i.to)&&(o=ni(Jn(i.to))),i.values.forEach((u,h)=>{if(u.done)return;const f=u.constructor==Uo?1:a?a[h].lastPosition:o[h];let d=i.immediate,m=f;if(!d){if(m=u.lastPosition,s.tension<=0){u.done=!0;return}let v=u.elapsedTime+=e;const g=i.fromValues[h],p=u.v0!=null?u.v0:u.v0=Oe.arr(s.velocity)?s.velocity[h]:s.velocity;let _;const y=s.precision||(g==f?.005:Math.min(1,Math.abs(f-g)*.001));if(Oe.und(s.duration))if(s.decay){const x=s.decay===!0?.998:s.decay,b=Math.exp(-(1-x)*v);m=g+p/(1-x)*(1-b),d=Math.abs(u.lastPosition-m)<=y,_=p*b}else{_=u.lastVelocity==null?p:u.lastVelocity;const x=s.restVelocity||y/10,b=s.clamp?0:s.bounce,w=!Oe.und(b),S=g==f?u.v0>0:gx,!(!M&&(d=Math.abs(f-m)<=y,d)));++P){w&&(E=m==f||m>f==S,E&&(_=-_*b,m=f));const A=-s.tension*1e-6*(m-f),z=-s.friction*.001*_,V=(A+z)/s.mass;_=_+V*T,m=m+_*T}}else{let x=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,u.durationProgress>0&&(u.elapsedTime=s.duration*u.durationProgress,v=u.elapsedTime+=e)),x=(s.progress||0)+v/this._memoizedDuration,x=x>1?1:x<0?0:x,u.durationProgress=x),m=g+s.easing(x)*(f-g),_=(m-u.lastPosition)/e,d=x==1}u.lastVelocity=_,Number.isNaN(m)&&(console.warn("Got NaN while animating:",this),d=!0)}a&&!a[h].done&&(d=!1),d?u.done=!0:t=!1,u.setValue(m,s.round)&&(n=!0)});const c=Ri(this),l=c.getValue();if(t){const u=Jn(i.to);(l!==u||n)&&!s.decay?(c.setValue(u),this._onChange(u)):n&&s.decay&&this._onChange(l),this._stop()}else n&&this._onChange(l)}set(e){return Je.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(xr(this)){const{to:e,config:t}=this.animation;Je.batchedUpdates(()=>{this._onStart(),t.decay||this._set(e,!1),this._stop()})}return this}update(e){return(this.queue||(this.queue=[])).push(e),this}start(e,t){let n;return Oe.und(e)?(n=this.queue||[],this.queue=[]):n=[Oe.obj(e)?e:rn({},t,{to:e})],Promise.all(n.map(i=>this._update(i))).then(i=>lg(this,i))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),xc(this._state,e&&this._lastCallId),Je.batchedUpdates(()=>this._stop(t,e)),this}reset(){this._update({reset:!0})}eventObserved(e){e.type=="change"?this._start():e.type=="priority"&&(this.priority=e.priority+1)}_prepareNode(e){const t=this.key||"";let{to:n,from:i}=e;n=Oe.obj(n)?n[t]:n,(n==null||Lp(n))&&(n=void 0),i=Oe.obj(i)?i[t]:i,i==null&&(i=void 0);const s={to:n,from:i};return bd(this)||(e.reverse&&([n,i]=[i,n]),i=Jn(i),Oe.und(i)?Ri(this)||this._set(n):this._set(i)),s}_update(e,t){let n=rn({},e);const{key:i,defaultProps:s}=this;n.default&&Object.assign(s,cg(n,(c,l)=>/^on/.test(l)?ow(c,i):c)),J_(this,n,"onProps"),La(this,"onProps",n,this);const o=this._prepareNode(n);if(Object.isFrozen(this))throw Error("Cannot animate a `SpringValue` object that is frozen. Did you forget to pass your component to `animated(...)` before animating its props?");const a=this._state;return lw(++this._lastCallId,{key:i,props:n,defaultProps:s,state:a,actions:{pause:()=>{Ra(this)||(Z_(this,!0),ka(a.pauseQueue),La(this,"onPause",vi(this,Pa(this,this.animation.to)),this))},resume:()=>{Ra(this)&&(Z_(this,!1),xr(this)&&this._resume(),ka(a.resumeQueue),La(this,"onResume",vi(this,Pa(this,this.animation.to)),this))},start:this._merge.bind(this,o)}}).then(c=>{if(n.loop&&c.finished&&!(t&&c.noop)){const l=dw(n);if(l)return this._update(l,!0)}return c})}_merge(e,t,n){if(t.cancel)return this.stop(!0),n(Mo(this));const i=!Oe.und(e.to),s=!Oe.und(e.from);if(i||s)if(t.callId>this._lastToId)this._lastToId=t.callId;else return n(Mo(this));const{key:o,defaultProps:a,animation:c}=this,{to:l,from:u}=c;let{to:h=l,from:f=u}=e;s&&!i&&(!t.default||Oe.und(h))&&(h=f),t.reverse&&([h,f]=[f,h]);const d=!Ji(f,u);d&&(c.from=f),f=Jn(f);const m=!Ji(h,l);m&&this._focus(h);const v=Lp(t.to),{config:g}=c,{decay:p,velocity:_}=g;(i||s)&&(g.velocity=0),t.config&&!v&&B3(g,rs(t.config,o),t.config!==a.config?rs(a.config,o):void 0);let y=Ri(this);if(!y||Oe.und(h))return n(vi(this,!0));const x=Oe.und(t.reset)?s&&!t.default:!Oe.und(f)&&Ya(t.reset,o),b=x?f:this.get(),w=yc(h),S=Oe.num(w)||Oe.arr(w)||xh(w),M=!v&&(!S||Ya(a.immediate||t.immediate,o));if(m){const P=Pp(h);if(P!==y.constructor)if(M)y=this._set(w);else throw Error(`Cannot animate between ${y.constructor.name} and ${P.name}, as the "to" prop suggests`)}const E=y.constructor;let T=Pi(h),L=!1;if(!T){const P=x||!bd(this)&&d;(m||P)&&(L=Ji(yc(b),w),T=!L),(!Ji(c.immediate,M)&&!M||!Ji(g.decay,p)||!Ji(g.velocity,_))&&(T=!0)}if(L&&xr(this)&&(c.changed&&!x?T=!0:T||this._stop(l)),!v&&((T||Pi(l))&&(c.values=y.getPayload(),c.toValues=Pi(h)?null:E==Uo?[1]:ni(w)),c.immediate!=M&&(c.immediate=M,!M&&!x&&this._set(l)),T)){const{onRest:P}=c;_t(X3,z=>J_(this,t,z));const A=vi(this,Pa(this,l));ka(this._pendingCalls,A),this._pendingCalls.add(n),c.changed&&Je.batchedUpdates(()=>{c.changed=!x,P==null||P(A,this),x?rs(a.onRest,A):c.onStart==null||c.onStart(A,this)})}x&&this._set(b),v?n(hw(t.to,t,this._state,this)):T?this._start():xr(this)&&!m?this._pendingCalls.add(n):n(uw(b))}_focus(e){const t=this.animation;e!==t.to&&(z_(this)&&this._detach(),t.to=e,z_(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Pi(t)&&(Bc(t,this),Ip(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Pi(e)&&Cu(e,this)}_set(e,t=!0){const n=Jn(e);if(!Oe.und(n)){const i=Ri(this);if(!i||!Ji(n,i.getValue())){const s=Pp(n);!i||i.constructor!=s?sg(this,s.create(n)):i.setValue(n),i&&Je.batchedUpdates(()=>{this._onChange(n,t)})}}return Ri(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,La(this,"onStart",vi(this,Pa(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),rs(this.animation.onChange,e,this)),rs(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;Ri(this).reset(Jn(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),xr(this)||($_(this,!0),Ra(this)||this._resume())}_resume(){Fi.skipAnimation?this.finish():vh.start(this)}_stop(e,t){if(xr(this)){$_(this,!1);const n=this.animation;_t(n.values,s=>{s.done=!0}),n.toValues&&(n.onChange=n.onPause=n.onResume=void 0),Au(this,{type:"idle",parent:this});const i=t?Mo(this.get()):vi(this.get(),Pa(this,e??n.to));ka(this._pendingCalls,i),n.changed&&(n.changed=!1,La(this,"onRest",i,this))}}}function Pa(r,e){const t=yc(e),n=yc(r.get());return Ji(n,t)}function dw(r,e=r.loop,t=r.to){let n=rs(e);if(n){const i=n!==!0&&cw(n),s=(i||r).reverse,o=!i||i.reset;return bc(rn({},r,{loop:e,default:!1,pause:void 0,to:!s||Lp(t)?t:void 0,from:o?r.from:void 0,reset:o},i))}}function bc(r){const{to:e,from:t}=r=cw(r),n=new Set;return Oe.obj(e)&&K_(e,n),Oe.obj(t)&&K_(t,n),r.keys=n.size?Array.from(n):null,r}function W3(r){const e=bc(r);return Oe.und(e.default)&&(e.default=cg(e)),e}function K_(r,e){or(r,(t,n)=>t!=null&&e.add(n))}const X3=["onStart","onRest","onChange","onPause","onResume"];function J_(r,e,t){r.animation[t]=e[t]!==aw(e,t)?ow(e[t],r.key):void 0}function La(r,e,...t){var n,i,s,o;(n=(i=r.animation)[e])==null||n.call(i,...t),(s=(o=r.defaultProps)[e])==null||s.call(o,...t)}const q3=["onStart","onChange","onRest"];let Y3=1;class j3{constructor(e,t){this.id=Y3++,this.springs={},this.queue=[],this.ref=void 0,this._flush=void 0,this._initialProps=void 0,this._lastAsyncId=0,this._active=new Set,this._changed=new Set,this._started=!1,this._item=void 0,this._state={paused:!1,pauseQueue:new Set,resumeQueue:new Set,timeouts:new Set},this._events={onStart:new Map,onChange:new Map,onRest:new Map},this._onFrame=this._onFrame.bind(this),t&&(this._flush=t),e&&this.start(rn({default:!0},e))}get idle(){return!this._state.asyncTo&&Object.values(this.springs).every(e=>e.idle&&!e.isDelayed&&!e.isPaused)}get item(){return this._item}set item(e){this._item=e}get(){const e={};return this.each((t,n)=>e[n]=t.get()),e}set(e){for(const t in e){const n=e[t];Oe.und(n)||this.springs[t].set(n)}}update(e){return e&&this.queue.push(bc(e)),this}start(e){let{queue:t}=this;return e?t=ni(e).map(bc):this.queue=[],this._flush?this._flush(this,t):(_w(this,t),Np(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const n=this.springs;_t(ni(t),i=>n[i].stop(!!e))}else xc(this._state,this._lastAsyncId),this.each(n=>n.stop(!!e));return this}pause(e){if(Oe.und(e))this.start({pause:!0});else{const t=this.springs;_t(ni(e),n=>t[n].pause())}return this}resume(e){if(Oe.und(e))this.start({pause:!1});else{const t=this.springs;_t(ni(e),n=>t[n].resume())}return this}each(e){or(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:n}=this._events,i=this._active.size>0,s=this._changed.size>0;(i&&!this._started||s&&!this._started)&&(this._started=!0,Xa(e,([c,l])=>{l.value=this.get(),c(l,this,this._item)}));const o=!i&&this._started,a=s||o&&n.size?this.get():null;s&&t.size&&Xa(t,([c,l])=>{l.value=a,c(l,this,this._item)}),o&&(this._started=!1,Xa(n,([c,l])=>{l.value=a,c(l,this,this._item)}))}eventObserved(e){if(e.type=="change")this._changed.add(e.parent),e.idle||this._active.add(e.parent);else if(e.type=="idle")this._active.delete(e.parent);else return;Je.onFrame(this._onFrame)}}function Np(r,e){return Promise.all(e.map(t=>pw(r,t))).then(t=>lg(r,t))}async function pw(r,e,t){const{keys:n,to:i,from:s,loop:o,onRest:a,onResolve:c}=e,l=Oe.obj(e.default)&&e.default;o&&(e.loop=!1),i===!1&&(e.to=null),s===!1&&(e.from=null);const u=Oe.arr(i)||Oe.fun(i)?i:void 0;u?(e.to=void 0,e.onRest=void 0,l&&(l.onRest=void 0)):_t(q3,v=>{const g=e[v];if(Oe.fun(g)){const p=r._events[v];e[v]=({finished:_,cancelled:y})=>{const x=p.get(g);x?(_||(x.finished=!1),y&&(x.cancelled=!0)):p.set(g,{value:null,finished:_||!1,cancelled:y||!1})},l&&(l[v]=e[v])}});const h=r._state;e.pause===!h.paused?(h.paused=e.pause,ka(e.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(e.pause=!0);const f=(n||Object.keys(r.springs)).map(v=>r.springs[v].start(e)),d=e.cancel===!0||aw(e,"cancel")===!0;(u||d&&h.asyncId)&&f.push(lw(++r._lastAsyncId,{props:e,state:h,actions:{pause:Ap,resume:Ap,start(v,g){d?(xc(h,r._lastAsyncId),g(Mo(r))):(v.onRest=a,g(hw(u,v,h,r)))}}})),h.paused&&await new Promise(v=>{h.resumeQueue.add(v)});const m=lg(r,await Promise.all(f));if(o&&m.finished&&!(t&&m.noop)){const v=dw(e,o,i);if(v)return _w(r,[v]),pw(r,v,!0)}return c&&Je.batchedUpdates(()=>c(m,r,r.item)),m}function Q_(r,e){const t=rn({},r.springs);return e&&_t(ni(e),n=>{Oe.und(n.keys)&&(n=bc(n)),Oe.obj(n.to)||(n=rn({},n,{to:void 0})),vw(t,n,i=>gw(i))}),mw(r,t),t}function mw(r,e){or(e,(t,n)=>{r.springs[n]||(r.springs[n]=t,Bc(t,r))})}function gw(r,e){const t=new H3;return t.key=r,e&&Bc(t,e),t}function vw(r,e,t){e.keys&&_t(e.keys,n=>{(r[n]||(r[n]=t(n)))._prepareNode(e)})}function _w(r,e){_t(e,t=>{vw(r.springs,t,n=>gw(n,r))})}function $3(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s=0)&&(t[i]=r[i]);return t}const Z3=["children"],wh=r=>{let{children:e}=r,t=$3(r,Z3);const n=q.useContext(Lu),i=t.pause||!!n.pause,s=t.immediate||!!n.immediate;t=w3(()=>({pause:i,immediate:s}),[i,s]);const{Provider:o}=Lu;return q.createElement(o,{value:t},e)},Lu=K3(wh,{});wh.Provider=Lu.Provider;wh.Consumer=Lu.Consumer;function K3(r,e){return Object.assign(r,q.createContext(e)),r.Provider._context=r,r.Consumer._context=r,r}const J3=()=>{const r=[],e=function(i){x3();const s=[];return _t(r,(o,a)=>{if(Oe.und(i))s.push(o.start());else{const c=t(i,o,a);c&&s.push(o.start(c))}}),s};e.current=r,e.add=function(n){r.includes(n)||r.push(n)},e.delete=function(n){const i=r.indexOf(n);~i&&r.splice(i,1)},e.pause=function(){return _t(r,n=>n.pause(...arguments)),this},e.resume=function(){return _t(r,n=>n.resume(...arguments)),this},e.set=function(n){_t(r,i=>i.set(n))},e.start=function(n){const i=[];return _t(r,(s,o)=>{if(Oe.und(n))i.push(s.start());else{const a=this._getProps(n,s,o);a&&i.push(s.start(a))}}),i},e.stop=function(){return _t(r,n=>n.stop(...arguments)),this},e.update=function(n){return _t(r,(i,s)=>i.update(this._getProps(n,i,s))),this};const t=function(i,s,o){return Oe.fun(i)?i(o,s):i};return e._getProps=t,e};function Q3(r,e,t){const n=Oe.fun(e)&&e;n&&!t&&(t=[]);const i=q.useMemo(()=>n||arguments.length==3?J3():void 0,[]),s=q.useRef(0),o=iw(),a=q.useMemo(()=>({ctrls:[],queue:[],flush(p,_){const y=Q_(p,_);return s.current>0&&!a.queue.length&&!Object.keys(y).some(b=>!p.springs[b])?Np(p,_):new Promise(b=>{mw(p,y),a.queue.push(()=>{b(Np(p,_))}),o()})}}),[]),c=q.useRef([...a.ctrls]),l=[],u=G_(r)||0;q.useMemo(()=>{_t(c.current.slice(r,u),p=>{N3(p,i),p.stop(!0)}),c.current.length=r,h(u,r)},[r]),q.useMemo(()=>{h(0,Math.min(u,r))},t);function h(p,_){for(let y=p;y<_;y++){const x=c.current[y]||(c.current[y]=new j3(null,a.flush)),b=n?n(y,x):e[y];b&&(l[y]=W3(b))}}const f=c.current.map((p,_)=>Q_(p,l[_])),d=q.useContext(wh),m=G_(d),v=d!==m&&O3(d);rg(()=>{s.current++,a.ctrls=c.current;const{queue:p}=a;p.length&&(a.queue=[],_t(p,_=>_())),_t(c.current,(_,y)=>{i==null||i.add(_),v&&_.start({default:d});const x=l[y];x&&(F3(_,x.ref),_.ref?_.queue.push(x):_.start(x))})}),rw(()=>()=>{_t(a.ctrls,p=>p.stop(!0))});const g=f.map(p=>rn({},p));return i?[g,i]:g}function Gn(r,e){const t=Oe.fun(r),[[n],i]=Q3(1,t?r:[r],t?e||[]:e);return t||arguments.length==2?[n,i]:n}let ey;(function(r){r.MOUNT="mount",r.ENTER="enter",r.UPDATE="update",r.LEAVE="leave"})(ey||(ey={}));class eN extends ug{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=vc(...t);const n=this._get(),i=Pp(n);sg(this,i.create(n))}advance(e){const t=this._get(),n=this.get();Ji(t,n)||(Ri(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&ty(this._active)&&wd(this)}_get(){const e=Oe.arr(this.source)?this.source.map(Jn):ni(Jn(this.source));return this.calc(...e)}_start(){this.idle&&!ty(this._active)&&(this.idle=!1,_t(bh(this),e=>{e.done=!1}),Fi.skipAnimation?(Je.batchedUpdates(()=>this.advance()),wd(this)):vh.start(this))}_attach(){let e=1;_t(ni(this.source),t=>{Pi(t)&&Bc(t,this),Ip(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){_t(ni(this.source),e=>{Pi(e)&&Cu(e,this)}),this._active.clear(),wd(this)}eventObserved(e){e.type=="change"?e.idle?this.advance():(this._active.add(e.parent),this._start()):e.type=="idle"?this._active.delete(e.parent):e.type=="priority"&&(this.priority=ni(this.source).reduce((t,n)=>Math.max(t,(Ip(n)?n.priority:0)+1),0))}}function tN(r){return r.idle!==!1}function ty(r){return!r.size||Array.from(r).every(tN)}function wd(r){r.idle||(r.idle=!0,_t(bh(r),e=>{e.done=!0}),Au(r,{type:"idle",parent:r}))}Fi.assign({createStringInterpolator:tw,to:(r,e)=>new eN(r,e)});const nN=["primitive"].concat(Object.keys($b).filter(r=>/^[A-Z]/.test(r)).map(r=>r[0].toLowerCase()+r.slice(1)));Fi.assign({createStringInterpolator:tw,colors:KO,frameLoop:"demand"});FL(()=>{Je.advance()});const iN=P3(nN,{applyAnimatedValues:ts}),Gt=iN.animated,yw=q.forwardRef(function({children:e,follow:t=!0,lockX:n=!1,lockY:i=!1,lockZ:s=!1,...o},a){const c=q.useRef(null),l=q.useRef(null),u=new ln;return uh(({camera:h})=>{if(!t||!l.current)return;const f=l.current.rotation.clone();l.current.updateMatrix(),l.current.updateWorldMatrix(!1,!1),l.current.getWorldQuaternion(u),h.getWorldQuaternion(c.current.quaternion).premultiply(u.invert()),n&&(l.current.rotation.x=f.x),i&&(l.current.rotation.y=f.y),s&&(l.current.rotation.z=f.z)}),q.useImperativeHandle(a,()=>l.current,[]),q.createElement("group",Tc({ref:l,matrixAutoUpdate:!1,matrixWorldAutoUpdate:!1},o),q.createElement("group",{ref:c},e))});function rN(){var r=Object.create(null);function e(i,s){var o=i.id,a=i.name,c=i.dependencies;c===void 0&&(c=[]);var l=i.init;l===void 0&&(l=function(){});var u=i.getTransferables;if(u===void 0&&(u=null),!r[o])try{c=c.map(function(f){return f&&f.isWorkerModule&&(e(f,function(d){if(d instanceof Error)throw d}),f=r[f.id].value),f}),l=n("<"+a+">.init",l),u&&(u=n("<"+a+">.getTransferables",u));var h=null;typeof l=="function"?h=l.apply(void 0,c):console.error("worker module init function failed to rehydrate"),r[o]={id:o,value:h,getTransferables:u},s(h)}catch(f){f&&f.noLog||console.error(f),s(f)}}function t(i,s){var o,a=i.id,c=i.args;(!r[a]||typeof r[a].value!="function")&&s(new Error("Worker module "+a+": not found or its 'init' did not return a function"));try{var l=(o=r[a]).value.apply(o,c);l&&typeof l.then=="function"?l.then(u,function(h){return s(h instanceof Error?h:new Error(""+h))}):u(l)}catch(h){s(h)}function u(h){try{var f=r[a].getTransferables&&r[a].getTransferables(h);(!f||!Array.isArray(f)||!f.length)&&(f=void 0),s(h,f)}catch(d){console.error(d),s(d)}}}function n(i,s){var o=void 0;self.troikaDefine=function(c){return o=c};var a=URL.createObjectURL(new Blob(["/** "+i.replace(/\*/g,"")+` **/ + +troikaDefine( +`+s+` +)`],{type:"application/javascript"}));try{importScripts(a)}catch(c){console.error(c)}return URL.revokeObjectURL(a),delete self.troikaDefine,o}self.addEventListener("message",function(i){var s=i.data,o=s.messageId,a=s.action,c=s.data;try{a==="registerModule"&&e(c,function(l){l instanceof Error?postMessage({messageId:o,success:!1,error:l.message}):postMessage({messageId:o,success:!0,result:{isCallable:typeof l=="function"}})}),a==="callModule"&&t(c,function(l,u){l instanceof Error?postMessage({messageId:o,success:!1,error:l.message}):postMessage({messageId:o,success:!0,result:l},u||void 0)})}catch(l){postMessage({messageId:o,success:!1,error:l.stack})}})}function sN(r){var e=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return e._getInitResult().then(function(i){if(typeof i=="function")return i.apply(void 0,t);throw new Error("Worker module function was called but `init` did not return a callable function")})};return e._getInitResult=function(){var t=r.dependencies,n=r.init;t=Array.isArray(t)?t.map(function(s){return s&&s._getInitResult?s._getInitResult():s}):[];var i=Promise.all(t).then(function(s){return n.apply(null,s)});return e._getInitResult=function(){return i},i},e}var xw=function(){var r=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),r=!0}catch(t){console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return xw=function(){return r},r},oN=0,aN=0,Sd=!1,ja=Object.create(null),$a=Object.create(null),Fp=Object.create(null);function Gc(r){if((!r||typeof r.init!="function")&&!Sd)throw new Error("requires `options.init` function");var e=r.dependencies,t=r.init,n=r.getTransferables,i=r.workerId;if(!xw())return sN(r);i==null&&(i="#default");var s="workerModule"+ ++oN,o=r.name||s,a=null;e=e&&e.map(function(l){return typeof l=="function"&&!l.workerModuleData&&(Sd=!0,l=Gc({workerId:i,name:"<"+o+"> function dependency: "+l.name,init:`function(){return ( +`+pu(l)+` +)}`}),Sd=!1),l&&l.workerModuleData&&(l=l.workerModuleData),l});function c(){for(var l=[],u=arguments.length;u--;)l[u]=arguments[u];if(!a){a=ny(i,"registerModule",c.workerModuleData);var h=function(){a=null,$a[i].delete(h)};($a[i]||($a[i]=new Set)).add(h)}return a.then(function(f){var d=f.isCallable;if(d)return ny(i,"callModule",{id:s,args:l});throw new Error("Worker module function was called but `init` did not return a callable function")})}return c.workerModuleData={isWorkerModule:!0,id:s,name:o,dependencies:e,init:pu(t),getTransferables:n&&pu(n)},c}function cN(r){$a[r]&&$a[r].forEach(function(e){e()}),ja[r]&&(ja[r].terminate(),delete ja[r])}function pu(r){var e=r.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function lN(r){var e=ja[r];if(!e){var t=pu(rN);e=ja[r]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+r.replace(/\*/g,"")+` **/ + +;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(n){var i=n.data,s=i.messageId,o=Fp[s];if(!o)throw new Error("WorkerModule response with empty or unknown messageId");delete Fp[s],o(i)}}return e}function ny(r,e,t){return new Promise(function(n,i){var s=++aN;Fp[s]=function(o){o.success?n(o.result):i(new Error("Error in worker "+e+" call: "+o.error))},lN(r).postMessage({messageId:s,action:e,data:t})})}const bw=/\bvoid\s+main\s*\(\s*\)\s*{/g;function kp(r){const e=/^[ \t]*#include +<([\w\d./]+)>/gm;function t(n,i){let s=Qe[i];return s?kp(s):n}return r.replace(e,t)}const an=[];for(let r=0;r<256;r++)an[r]=(r<16?"0":"")+r.toString(16);function uN(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(an[r&255]+an[r>>8&255]+an[r>>16&255]+an[r>>24&255]+"-"+an[e&255]+an[e>>8&255]+"-"+an[e>>16&15|64]+an[e>>24&255]+"-"+an[t&63|128]+an[t>>8&255]+"-"+an[t>>16&255]+an[t>>24&255]+an[n&255]+an[n>>8&255]+an[n>>16&255]+an[n>>24&255]).toUpperCase()}const Qr=Object.assign||function(){let r=arguments[0];for(let e=1,t=arguments.length;e/gm,` +//!BEGIN_POST_CHUNK $1 +$& +//!END_POST_CHUNK +`),t=kp(t)),d){let v=d({vertexShader:e,fragmentShader:t});e=v.vertexShader,t=v.fragmentShader}if(f){let v=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,g=>(v.push(g),"")),h=`${f} +${v.join(` +`)} +${h}`}if(m){const v=` +uniform float ${m}; +`;s=v+s,l=v+l}return c&&(e=`vec3 troika_position_${i}; +vec3 troika_normal_${i}; +vec2 troika_uv_${i}; +${e} +`,s=`${s} +void troikaVertexTransform${i}(inout vec3 position, inout vec3 normal, inout vec2 uv) { + ${c} +} +`,o=` +troika_position_${i} = vec3(position); +troika_normal_${i} = vec3(normal); +troika_uv_${i} = vec2(uv); +troikaVertexTransform${i}(troika_position_${i}, troika_normal_${i}, troika_uv_${i}); +${o} +`,e=e.replace(/\b(position|normal|uv)\b/g,(v,g,p,_)=>/\battribute\s+vec[23]\s+$/.test(_.substr(0,p))?g:`troika_${g}_${i}`),r.map&&r.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${i}`))),e=sy(e,i,s,o,a),t=sy(t,i,l,u,h),{vertexShader:e,fragmentShader:t}}function sy(r,e,t,n,i){return(n||i||t)&&(r=r.replace(bw,` +${t} +void troikaOrigMain${e}() {`),r+=` +void main() { + ${n} + troikaOrigMain${e}(); + ${i} +}`),r}function pN(r,e){return r==="uniforms"?void 0:typeof e=="function"?e.toString():e}let mN=0;const oy=new Map;function gN(r){const e=JSON.stringify(r,pN);let t=oy.get(e);return t==null&&oy.set(e,t=++mN),t}function vN(r,e,t){const{defaultFontURL:n}=t,i=Object.create(null),s=1/0,o=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,a="[^\\S\\u00A0]",c=new RegExp(`${a}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function l(_,y){function x(){const b=w=>{console.error(`Failure loading font ${_}${_===n?"":"; trying fallback"}`,w),_!==n&&(_=n,x())};try{const w=new XMLHttpRequest;w.open("get",_,!0),w.responseType="arraybuffer",w.onload=function(){if(w.status>=400)b(new Error(w.statusText));else if(w.status>0)try{const S=r(w.response);y(S)}catch(S){b(S)}},w.onerror=b,w.send()}catch(w){b(w)}}x()}function u(_,y){_||(_=n);let x=i[_];x?x.pending?x.pending.push(y):y(x):(i[_]={pending:[y]},l(_,b=>{let w=i[_].pending;i[_]=b,w.forEach(S=>S(b))}))}function h({text:_="",font:y=n,sdfGlyphSize:x=64,fontSize:b=1,letterSpacing:w=0,lineHeight:S="normal",maxWidth:M=s,direction:E,textAlign:T="left",textIndent:L=0,whiteSpace:P="normal",overflowWrap:A="normal",anchorX:z=0,anchorY:V=0,includeCaretPositions:N=!1,chunkedBoundsSize:C=8192,colorRanges:O=null},k,U=!1){const R=v(),F={fontLoad:0,typesetting:0};_.indexOf("\r")>-1&&(console.info("Typesetter: got text with \\r chars; normalizing to \\n"),_=_.replace(/\r\n/g,` +`).replace(/\r/g,` +`)),b=+b,w=+w,M=+M,S=S||"normal",L=+L,u(y,H=>{const Y=isFinite(M);let J=null,ie=null,ne=null,ee=null,ge=null,me=null,te=null,D=0,Q=0,j=P!=="nowrap";const{ascender:K,descender:W,unitsPerEm:ye,lineGap:re,capHeight:fe,xHeight:xe}=H;F.fontLoad=v()-R;const ce=v(),Pe=b/ye;S==="normal"&&(S=(K-W+re)/ye),S=S*b;const B=(S-(K-W)*Pe)/2,I=-(K*Pe+B),$=Math.min(S,(K-W)*Pe),he=(K+W)/2*Pe-$/2;let de=L,pe=new g;const Me=[pe];H.forEachGlyph(_,b,w,(Ce,ze,Le)=>{const Ee=_.charAt(Le),De=Ce.advanceWidth*Pe,Ve=pe.count;let je;if("isEmpty"in Ce||(Ce.isWhitespace=!!Ee&&new RegExp(a).test(Ee),Ce.canBreakAfter=!!Ee&&c.test(Ee),Ce.isEmpty=Ce.xMin===Ce.xMax||Ce.yMin===Ce.yMax||o.test(Ee)),!Ce.isWhitespace&&!Ce.isEmpty&&Q++,j&&Y&&!Ce.isWhitespace&&ze+De+de>M&&Ve){if(pe.glyphAt(Ve-1).glyphObj.canBreakAfter)je=new g,de=-ze;else for(let Ae=Ve;Ae--;)if(Ae===0&&A==="break-word"){je=new g,de=-ze;break}else if(pe.glyphAt(Ae).glyphObj.canBreakAfter){je=pe.splitAt(Ae+1);const le=je.glyphAt(0).x;de-=le;for(let Re=je.count;Re--;)je.glyphAt(Re).x-=le;break}je&&(pe.isSoftWrapped=!0,pe=je,Me.push(pe),D=M)}let Z=pe.glyphAt(pe.count);Z.glyphObj=Ce,Z.x=ze+de,Z.width=De,Z.charIndex=Le,Ee===` +`&&(pe=new g,Me.push(pe),de=-(ze+De+w*b)+L)}),Me.forEach(Ce=>{for(let ze=Ce.count;ze--;){let{glyphObj:Le,x:Ee,width:De}=Ce.glyphAt(ze);if(!Le.isWhitespace){Ce.width=Ee+De,Ce.width>D&&(D=Ce.width);return}}});let we=0,ue=0;if(z&&(typeof z=="number"?we=-z:typeof z=="string"&&(we=-D*(z==="left"?0:z==="center"?.5:z==="right"?1:d(z)))),V){if(typeof V=="number")ue=-V;else if(typeof V=="string"){let Ce=Me.length*S;ue=V==="top"?0:V==="top-baseline"?-I:V==="top-cap"?-I-fe*Pe:V==="top-ex"?-I-xe*Pe:V==="middle"?Ce/2:V==="bottom"?Ce:V==="bottom-baseline"?Ce-B+W*Pe:d(V)*Ce}}if(!U){const Ce=e.getEmbeddingLevels(_,E);J=new Uint16Array(Q),ie=new Float32Array(Q*2),ne={},me=[s,s,-s,-s],te=[];let ze=I;N&&(ge=new Float32Array(_.length*3)),O&&(ee=new Uint8Array(Q*3));let Le=0,Ee=-1,De=-1,Ve,je;if(Me.forEach((Z,Ae)=>{let{count:le,width:Re}=Z;if(le>0){let Fe=0;for(let dt=le;dt--&&Z.glyphAt(dt).glyphObj.isWhitespace;)Fe++;let tt=0,lt=0;if(T==="center")tt=(D-Re)/2;else if(T==="right")tt=D-Re;else if(T==="justify"&&Z.isSoftWrapped){let dt=0;for(let ct=le-Fe;ct--;)Z.glyphAt(ct).glyphObj.isWhitespace&&dt++;lt=(D-Re)/dt}if(lt||tt){let dt=0;for(let ct=0;ct=ct){let yn=kt,Vt=kt;for(;VtMn)break;Vtut=dt;for(let dt=0;dt1&&m(ge,Ee,Vt),Ee=yt}if(O){const{charIndex:yt}=ct;for(;yt>De;)De++,O.hasOwnProperty(De)&&(je=O[De])}if(!ut.isWhitespace&&!ut.isEmpty){const yt=Le++;ne[Mn]||(ne[Mn]={path:ut.path,pathBounds:[ut.xMin,ut.yMin,ut.xMax,ut.yMax]});const kt=ct.x+we,yn=ze+ue;ie[yt*2]=kt,ie[yt*2+1]=yn;const Vt=kt+ut.xMin*Pe,Ht=yn+ut.yMin*Pe,sn=kt+ut.xMax*Pe,Ei=yn+ut.yMax*Pe;Vtme[2]&&(me[2]=sn),Ei>me[3]&&(me[3]=Ei),yt%C===0&&(Ve={start:yt,end:yt,rect:[s,s,-s,-s]},te.push(Ve)),Ve.end++;const Un=Ve.rect;if(VtUn[2]&&(Un[2]=sn),Ei>Un[3]&&(Un[3]=Ei),J[yt]=Mn,O){const X=yt*3;ee[X]=je>>16&255,ee[X+1]=je>>8&255,ee[X+2]=je&255}}}}ze-=S}),ge){const Z=_.length-Ee;Z>1&&m(ge,Ee,Z)}}F.typesetting=v()-ce,k({glyphIds:J,glyphPositions:ie,glyphData:ne,caretPositions:ge,caretHeight:$,glyphColors:ee,chunkedBounds:te,fontSize:b,unitsPerEm:ye,ascender:K*Pe,descender:W*Pe,capHeight:fe*Pe,xHeight:xe*Pe,lineHeight:S,topBaseline:I,blockBounds:[we,ue-Me.length*S,we+D,ue],visibleBounds:me,timings:F})})}function f(_,y){h(_,x=>{const[b,w,S,M]=x.blockBounds;y({width:S-b,height:M-w})},{})}function d(_){let y=_.match(/^([\d.]+)%$/),x=y?parseFloat(y[1]):NaN;return isNaN(x)?0:x/100}function m(_,y,x){const b=_[y*3],w=_[y*3+1],S=_[y*3+2],M=(w-b)/x;for(let E=0;E(Object.defineProperty(_,y,{get(){return this.data[this.index*p.length+x]},set(w){this.data[this.index*p.length+x]=w}}),_),{data:null,index:0}),{typeset:h,measure:f,loadFont:u}}const ps=()=>(self.performance||Date).now(),Sh=Hy();let ay;function _N(r,e,t,n,i,s,o,a,c,l,u=!0){return u?xN(r,e,t,n,i,s,o,a,c,l).then(null,h=>(ay||(console.warn("WebGL SDF generation failed, falling back to JS",h),ay=!0),ly(r,e,t,n,i,s,o,a,c,l))):ly(r,e,t,n,i,s,o,a,c,l)}const mu=[],yN=5;let Bp=0;function ww(){const r=ps();for(;mu.length&&ps()-rnew Promise((e,t)=>{mu.push(()=>{const n=ps();try{Sh.webgl.generateIntoCanvas(...r),e({timing:ps()-n})}catch(i){t(i)}}),Bp||(Bp=setTimeout(ww,0))}),bN=4,wN=2e3,cy={};let SN=0;function ly(r,e,t,n,i,s,o,a,c,l){const u="TroikaTextSDFGenerator_JS_"+SN++%bN;let h=cy[u];return h||(h=cy[u]={workerModule:Gc({name:u,workerId:u,dependencies:[Hy,ps],init(f,d){const m=f().javascript.generate;return function(...v){const g=d();return{textureData:m(...v),timing:d()-g}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),h.requests++,clearTimeout(h.idleTimer),h.workerModule(r,e,t,n,i,s).then(({textureData:f,timing:d})=>{const m=ps(),v=new Uint8Array(f.length*4);for(let g=0;g{cN(u)},wN)),{timing:d}})}function EN(r){r._warm||(Sh.webgl.isSupported(r),r._warm=!0)}const MN=Sh.webglUtils.resizeWebGLCanvasWithoutClearing;/*! +Custom build of Typr.ts (https://github.com/fredli74/Typr.ts) for use in Troika text rendering. +Original MIT license applies: https://github.com/fredli74/Typr.ts/blob/master/LICENSE +*/function TN(){return typeof window>"u"&&(self.window=self),(function(r){var e={parse:function(i){var s=e._bin,o=new Uint8Array(i);if(s.readASCII(o,0,4)=="ttcf"){var a=4;s.readUshort(o,a),a+=2,s.readUshort(o,a),a+=2;var c=s.readUint(o,a);a+=4;for(var l=[],u=0;u>>o&1)!=0&&s++;return s},e._lctf.readClassDef=function(i,s){var o=e._bin,a=[],c=o.readUshort(i,s);if(s+=2,c==1){var l=o.readUshort(i,s);s+=2;var u=o.readUshort(i,s);s+=2;for(var h=0;h0&&(c.featureParams=a+l);var u=o.readUshort(i,s);s+=2,c.tab=[];for(var h=0;h255?-1:e.CFF.glyphByUnicode(i,e.CFF.tableSE[s])},e.CFF.readEncoding=function(i,s,o){e._bin;var a=[".notdef"],c=i[s];if(s++,c!=0)throw"error: unknown encoding format: "+c;var l=i[s];s++;for(var u=0;u>4,_=15&g;if(p!=15&&v.push(p),_!=15&&v.push(_),_==15)break}for(var y="",x=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],b=0;b=l.xMax||l.yMin>=l.yMax)return null;if(l.noc>0){l.endPts=[];for(var u=0;u=1&&u.fmt<=2){f=c.readUshort(i,o),o+=2;var m=c.readUshort(i,o);o+=2,d=e._lctf.numOfOnes(f);var v=e._lctf.numOfOnes(m);if(u.fmt==1){u.pairsets=[];var g=c.readUshort(i,o);o+=2;for(var p=0;p=1&&u.fmt<=2){if(u.fmt==1)u.delta=c.readShort(i,o),o+=2;else if(u.fmt==2){var f=c.readUshort(i,o);o+=2,u.newg=c.readUshorts(i,o,f),o+=2*u.newg.length}}else if(s==4){u.vals=[],f=c.readUshort(i,o),o+=2;for(var d=0;d>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(i,s,h)}return h},e.kern.parseV1=function(i,s,o,a){var c=e._bin;c.readFixed(i,s),s+=4;var l=c.readUint(i,s);s+=4;for(var u={glyph1:[],rval:[]},h=0;h>>8;if((d&=15)!=0)throw"unknown kern table format: "+d;s=e.kern.readFormat0(i,s,u)}return u},e.kern.readFormat0=function(i,s,o){var a=e._bin,c=-1,l=a.readUshort(i,s);s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2,a.readUshort(i,s),s+=2;for(var u=0;u=c.map.length?0:c.map[s];if(c.format==4){for(var l=-1,u=0;us?0:65535&(c.idRangeOffset[l]!=0?c.glyphIdArray[s-c.startCount[l]+(c.idRangeOffset[l]>>1)-(c.idRangeOffset.length-l)]:s+c.idDelta[l])}if(c.format==12){if(s>c.groups[c.groups.length-1][1])return 0;for(u=0;u-1?e.U._simpleGlyph(a,o):e.U._compoGlyph(a,s,o))},e.U._simpleGlyph=function(i,s){for(var o=0;oc)){for(var g=!0,p=0,_=0;_c)){for(g=!0,_=0;_>1,l.length=0,h=!0;else if(P=="o3"||P=="o23")l.length%2!=0&&!h&&(f=l.shift()+a.nominalWidthX),u+=l.length>>1,l.length=0,h=!0;else if(P=="o4")l.length>1&&!h&&(f=l.shift()+a.nominalWidthX,h=!0),d&&e.U.P.closePath(c),g+=l.pop(),e.U.P.moveTo(c,v,g),d=!0;else if(P=="o5")for(;l.length>0;)v+=l.shift(),g+=l.shift(),e.U.P.lineTo(c,v,g);else if(P=="o6"||P=="o7")for(var A=l.length,z=P=="o6",V=0;VMath.abs(M-g)?v=S+l.shift():g=M+l.shift(),e.U.P.curveTo(c,p,_,y,x,E,T),e.U.P.curveTo(c,b,w,S,M,v,g));else if(P=="o14"){if(l.length>0&&!h&&(f=l.shift()+o.nominalWidthX,h=!0),l.length==4){var O=l.shift(),k=l.shift(),U=l.shift(),R=l.shift(),F=e.CFF.glyphBySE(o,U),H=e.CFF.glyphBySE(o,R);e.U._drawCFF(o.CharStrings[F],s,o,a,c),s.x=O,s.y=k,e.U._drawCFF(o.CharStrings[H],s,o,a,c)}d&&(e.U.P.closePath(c),d=!1)}else if(P=="o19"||P=="o20")l.length%2!=0&&!h&&(f=l.shift()+a.nominalWidthX),u+=l.length>>1,l.length=0,h=!0,m+=u+7>>3;else if(P=="o21")l.length>2&&!h&&(f=l.shift()+a.nominalWidthX,h=!0),g+=l.pop(),v+=l.pop(),d&&e.U.P.closePath(c),e.U.P.moveTo(c,v,g),d=!0;else if(P=="o22")l.length>1&&!h&&(f=l.shift()+a.nominalWidthX,h=!0),v+=l.pop(),d&&e.U.P.closePath(c),e.U.P.moveTo(c,v,g),d=!0;else if(P=="o25"){for(;l.length>6;)v+=l.shift(),g+=l.shift(),e.U.P.lineTo(c,v,g);p=v+l.shift(),_=g+l.shift(),y=p+l.shift(),x=_+l.shift(),v=y+l.shift(),g=x+l.shift(),e.U.P.curveTo(c,p,_,y,x,v,g)}else if(P=="o26")for(l.length%2&&(v+=l.shift());l.length>0;)p=v,_=g+l.shift(),v=y=p+l.shift(),g=(x=_+l.shift())+l.shift(),e.U.P.curveTo(c,p,_,y,x,v,g);else if(P=="o27")for(l.length%2&&(g+=l.shift());l.length>0;)_=g,y=(p=v+l.shift())+l.shift(),x=_+l.shift(),v=y+l.shift(),g=x,e.U.P.curveTo(c,p,_,y,x,v,g);else if(P=="o10"||P=="o29"){var Y=P=="o10"?a:o;if(l.length==0)console.debug("error: empty stack");else{var J=l.pop(),ie=Y.Subrs[J+Y.Bias];s.x=v,s.y=g,s.nStems=u,s.haveWidth=h,s.width=f,s.open=d,e.U._drawCFF(ie,s,o,a,c),v=s.x,g=s.y,u=s.nStems,h=s.haveWidth,f=s.width,d=s.open}}else if(P=="o30"||P=="o31"){var ne=l.length,ee=(C=0,P=="o31");for(C+=ne-(A=-3&ne);C>>1|(21845&d)<<1;m=(61680&(m=(52428&m)>>>2|(13107&m)<<2))>>>4|(3855&m)<<4,f[d]=((65280&m)>>>8|(255&m)<<8)>>>1}var v=function(P,A,z){for(var V=P.length,N=0,C=new t(A);N>>U]=R}return O},g=new e(288);for(d=0;d<144;++d)g[d]=8;for(d=144;d<256;++d)g[d]=9;for(d=256;d<280;++d)g[d]=7;for(d=280;d<288;++d)g[d]=8;var p=new e(32);for(d=0;d<32;++d)p[d]=5;var _=v(g,9),y=v(p,5),x=function(P){for(var A=P[0],z=1;zA&&(A=P[z]);return A},b=function(P,A,z){var V=A/8|0;return(P[V]|P[V+1]<<8)>>(7&A)&z},w=function(P,A){var z=A/8|0;return(P[z]|P[z+1]<<8|P[z+2]<<16)>>(7&A)},S=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],M=function(P,A,z){var V=new Error(A||S[P]);if(V.code=P,Error.captureStackTrace&&Error.captureStackTrace(V,M),!z)throw V;return V},E=function(P,A,z){var V=P.length;if(!V||z&&!z.l&&V<5)return A||new e(0);var N=!A||z,C=!z||z.i;z||(z={}),A||(A=new e(3*V));var O,k=function(Ee){var De=A.length;if(Ee>De){var Ve=new e(Math.max(2*De,Ee));Ve.set(A),A=Ve}},U=z.f||0,R=z.p||0,F=z.b||0,H=z.l,Y=z.d,J=z.m,ie=z.n,ne=8*V;do{if(!H){z.f=U=b(P,R,1);var ee=b(P,R+1,3);if(R+=3,!ee){var ge=P[(xe=((O=R)/8|0)+(7&O&&1)+4)-4]|P[xe-3]<<8,me=xe+ge;if(me>V){C&&M(0);break}N&&k(F+ge),A.set(P.subarray(xe,me),F),z.b=F+=ge,z.p=R=8*me;continue}if(ee==1)H=_,Y=y,J=9,ie=5;else if(ee==2){var te=b(P,R,31)+257,D=b(P,R+10,15)+4,Q=te+b(P,R+5,31)+1;R+=14;for(var j=new e(Q),K=new e(19),W=0;W>>4)<16)j[W++]=xe;else{var Pe=0,B=0;for(xe==16?(B=3+b(P,R,3),R+=2,Pe=j[W-1]):xe==17?(B=3+b(P,R,7),R+=3):xe==18&&(B=11+b(P,R,127),R+=7);B--;)j[W++]=Pe}}var I=j.subarray(0,te),$=j.subarray(te);J=x(I),ie=x($),H=v(I,J),Y=v($,ie)}else M(1);if(R>ne){C&&M(0);break}}N&&k(F+131072);for(var he=(1<>>4;if((R+=15&Pe)>ne){C&&M(0);break}if(Pe||M(2),Me<256)A[F++]=Me;else{if(Me==256){pe=R,H=null;break}var we=Me-254;if(Me>264){var ue=i[W=Me-257];we=b(P,R,(1<>>4;if(Ce||M(3),R+=15&Ce,$=h[ze],ze>3&&(ue=s[ze],$+=w(P,R)&(1<ne){C&&M(0);break}N&&k(F+131072);for(var Le=F+we;FEe.length)&&(Ve=Ee.length);var je=new(Ee instanceof t?t:Ee instanceof n?n:e)(Ve-De);return je.set(Ee.subarray(De,Ve)),je})(A,0,F)},T=new e(0),L=typeof TextDecoder<"u"&&new TextDecoder;try{L.decode(T,{stream:!0})}catch{}return r.convert_streams=function(P){var A=new DataView(P),z=0;function V(){var te=A.getUint16(z);return z+=2,te}function N(){var te=A.getUint32(z);return z+=4,te}function C(te){ge.setUint16(me,te),me+=2}function O(te){ge.setUint32(me,te),me+=4}for(var k={signature:N(),flavor:N(),length:N(),numTables:V(),reserved:V(),totalSfntSize:N(),majorVersion:V(),minorVersion:V(),metaOffset:N(),metaLength:N(),metaOrigLength:N(),privOffset:N(),privLength:N()},U=0;Math.pow(2,U)<=k.numTables;)U++;U--;for(var R=16*Math.pow(2,U),F=16*k.numTables-R,H=12,Y=[],J=0;J{let[T,L]=E.split("+");T=parseInt(T,36),L=L?parseInt(L,36):0,u.set(M+=T,w[S]);for(let P=L;P--;)u.set(++M,w[S])})}}return u.get(b)||l}const f=1,d=2,m=3,v=4,g=[null,"isol","init","fina","medi"];function p(b){const w=new Uint8Array(b.length);let S=l,M=f,E=-1;for(let T=0;T65535&&T++)}return w}function _(b,w){const S=[];for(let E=0;E65535&&E++,S.push(r.U.codeToGlyph(b,T))}const M=b.GSUB;if(M){const{lookupList:E,featureList:T}=M;let L;const P=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,A=[];T.forEach(z=>{if(P.test(z.tag))for(let V=0;V{if(R!==-1){let H=w[R];if(!H){const{cmds:Y,crds:J}=r.U.glyphToPath(b,R);let ie="",ne=0;for(let D=0,Q=Y.length;D1?",":"")+J[ne++]}let ee,ge,me,te;if(J.length){ee=ge=1/0,me=te=-1/0;for(let D=0,Q=J.length;Dme&&(me=j),K>te&&(te=K)}}else ee=me=ge=te=0;H=w[R]={index:R,advanceWidth:b.hmtx.aWidth[R],xMin:ee,yMin:ge,xMax:me,yMax:te,path:ie,pathCommandCount:Y.length}}U!==-1&&(N+=r.U.getPairAdjustment(b,U,R)*C),V.call(null,H,N,k),H.advanceWidth&&(N+=H.advanceWidth*C),z&&(N+=z*A),U=R}k+=P.codePointAt(k)>65535?2:1}),N}};return L}return function(w){const S=new Uint8Array(w,0,4),M=r._bin.readASCII(S,0,4);if(M==="wOFF")w=e(w);else if(M==="wOF2")throw new Error("woff2 fonts not supported");return x(r.parse(w)[0])}}const RN=Gc({name:"Typr Font Parser",dependencies:[TN,AN,CN],init(r,e,t){const n=r(),i=e();return t(n,i)}}),bo={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},PN=new Ne;function fo(){return(self.performance||Date).now()}const uy=Object.create(null);function Sw(r,e){r=IN({},r);const t=fo();if(r.font=UN(r.font||bo.defaultFontURL),r.text=""+r.text,r.sdfGlyphSize=r.sdfGlyphSize||bo.sdfGlyphSize,r.colorRanges!=null){let h={};for(let f in r.colorRanges)if(r.colorRanges.hasOwnProperty(f)){let d=r.colorRanges[f];typeof d!="number"&&(d=PN.set(d).getHex()),h[f]=d}r.colorRanges=h}Object.freeze(r);const{textureWidth:n,sdfExponent:i}=bo,{sdfGlyphSize:s}=r,o=n/s*4;let a=uy[s];if(!a){const h=document.createElement("canvas");h.width=n,h.height=s*256/o,a=uy[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:h,sdfTexture:new Ft(h,void 0,void 0,void 0,Pt,Pt),contextLost:!1,glyphsByFont:new Map},a.sdfTexture.generateMipmaps=!1,LN(a)}const{sdfTexture:c,sdfCanvas:l}=a;let u=a.glyphsByFont.get(r.font);u||a.glyphsByFont.set(r.font,u=new Map),NN(r).then(h=>{const{glyphIds:f,glyphPositions:d,fontSize:m,unitsPerEm:v,timings:g}=h,p=[],_=new Float32Array(f.length*4),y=m/v;let x=0,b=0;const w=fo();f.forEach((L,P)=>{let A=u.get(L);if(!A){const{path:C,pathBounds:O}=h.glyphData[L],k=Math.max(O[2]-O[0],O[3]-O[1])/s*(bo.sdfMargin*s+.5),U=a.glyphCount++,R=[O[0]-k,O[1]-k,O[2]+k,O[3]+k];u.set(L,A={path:C,atlasIndex:U,sdfViewBox:R}),p.push(A)}const{sdfViewBox:z}=A,V=d[b++],N=d[b++];_[x++]=V+z[0]*y,_[x++]=N+z[1]*y,_[x++]=V+z[2]*y,_[x++]=N+z[3]*y,f[P]=A.atlasIndex}),g.quads=(g.quads||0)+(fo()-w);const S=fo();g.sdf={};const M=l.height,E=Math.ceil(a.glyphCount/o),T=Math.pow(2,Math.ceil(Math.log2(E*s)));T>M&&(console.info(`Increasing SDF texture size ${M}->${T}`),MN(l,n,T),c.dispose()),Promise.all(p.map(L=>Ew(L,a,r.gpuAccelerateSDF).then(({timing:P})=>{g.sdf[L.atlasIndex]=P}))).then(()=>{p.length&&!a.contextLost&&(Mw(a),c.needsUpdate=!0),g.sdfTotal=fo()-S,g.total=fo()-t,e(Object.freeze({parameters:r,sdfTexture:c,sdfGlyphSize:s,sdfExponent:i,glyphBounds:_,glyphAtlasIndices:f,glyphColors:h.glyphColors,caretPositions:h.caretPositions,caretHeight:h.caretHeight,chunkedBounds:h.chunkedBounds,ascender:h.ascender,descender:h.descender,lineHeight:h.lineHeight,capHeight:h.capHeight,xHeight:h.xHeight,topBaseline:h.topBaseline,blockBounds:h.blockBounds,visibleBounds:h.visibleBounds,timings:h.timings}))})}),Promise.resolve().then(()=>{a.contextLost||EN(l)})}function Ew({path:r,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:n,sdfCanvas:i,contextLost:s},o){if(s)return Promise.resolve({timing:-1});const{textureWidth:a,sdfExponent:c}=bo,l=Math.max(t[2]-t[0],t[3]-t[1]),u=Math.floor(e/4),h=u%(a/n)*n,f=Math.floor(u/(a/n))*n,d=e%4;return _N(n,n,r,t,l,c,i,h,f,d,o)}function LN(r){const e=r.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),r.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),r.contextLost=!1;const n=[];r.glyphsByFont.forEach(i=>{i.forEach(s=>{n.push(Ew(s,r,!0))})}),Promise.all(n).then(()=>{Mw(r),r.sdfTexture.needsUpdate=!0})})}function DN({font:r,characters:e,sdfGlyphSize:t},n){let i=Array.isArray(e)?e.join(` +`):""+e;Sw({font:r,sdfGlyphSize:t,text:i},n)}function IN(r,e){for(let t in e)e.hasOwnProperty(t)&&(r[t]=e[t]);return r}let Kl;function UN(r){return Kl||(Kl=typeof document>"u"?{}:document.createElement("a")),Kl.href=r,Kl.href}function Mw(r){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=r,{width:n,height:i}=e,s=r.sdfCanvas.getContext("webgl");let o=t.image.data;(!o||o.length!==n*i*4)&&(o=new Uint8Array(n*i*4),t.image={width:n,height:i,data:o},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,n,i,s.RGBA,s.UNSIGNED_BYTE,o)}}const ON=Gc({name:"Typesetter",dependencies:[bo,RN,vN,_E],init(r,e,t,n){const{defaultFontURL:i}=r;return t(e,n(),{defaultFontURL:i})}}),NN=Gc({name:"Typesetter",dependencies:[ON],init(r){return function(e){return new Promise(t=>{r.typeset(e,t)})}},getTransferables(r){const e=[r.glyphPositions.buffer,r.glyphIds.buffer];return r.caretPositions&&e.push(r.caretPositions.buffer),r.glyphColors&&e.push(r.glyphColors.buffer),e}}),hy={};function FN(r){let e=hy[r];if(!e){const t=new Nr(1,1,r,r),n=t.clone(),i=t.attributes,s=n.attributes,o=new st,a=i.uv.count;for(let c=0;c{o.setAttribute(c,new He([...i[c].array,...s[c].array],i[c].itemSize))}),o.setIndex([...t.index.array,...n.index.array.map(c=>c+a)]),o.translate(.5,.5,0),e=hy[r]=o}return e}const kN="aTroikaGlyphBounds",fy="aTroikaGlyphIndex",zN="aTroikaGlyphColor";class BN extends Am{constructor(){super(),this.detail=1,this.curveRadius=0,this.groups=[{start:0,count:1/0,materialIndex:0},{start:0,count:1/0,materialIndex:1}],this.boundingSphere=new Wn,this.boundingBox=new Hn}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const t=this.getIndex().count;this.setDrawRange(e===vn?t/2:0,e===Dt?t:t/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=FN(e);["position","normal","uv"].forEach(n=>{this.attributes[n]=t.attributes[n].clone()}),this.setIndex(t.getIndex().clone())}}get detail(){return this._detail}set curveRadius(e){e!==this._curveRadius&&(this._curveRadius=e,this._updateBounds())}get curveRadius(){return this._curveRadius}updateGlyphs(e,t,n,i,s){Ed(this,kN,e,4),Ed(this,fy,t,1),Ed(this,zN,s,3),this._blockBounds=n,this._chunkedBounds=i,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:n}=this;if(t){const{PI:i,floor:s,min:o,max:a,sin:c,cos:l}=Math,u=i/2,h=i*2,f=Math.abs(t),d=e[0]/f,m=e[2]/f,v=s((d+u)/h)!==s((m+u)/h)?-f:o(c(d)*f,c(m)*f),g=s((d-u)/h)!==s((m-u)/h)?f:a(c(d)*f,c(m)*f),p=s((d+i)/h)!==s((m+i)/h)?f*2:a(f-l(d)*f,f-l(m)*f);n.min.set(v,e[1],t<0?-p:0),n.max.set(g,e[3],t<0?0:p)}else n.min.set(e[0],e[1],0),n.max.set(e[2],e[3],0);n.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(fy).count,n=this._chunkedBounds;if(n)for(let i=n.length;i--;){t=n[i].end;let s=n[i].rect;if(s[1]e.y&&s[0]e.x)break}this.instanceCount=t}}function Ed(r,e,t,n){const i=r.getAttribute(e);t?i&&i.array.length===t.length?(i.array.set(t),i.needsUpdate=!0):(r.setAttribute(e,new vs(t,n)),delete r._maxInstanceCount,r.dispose()):i&&r.deleteAttribute(e)}const GN=` +uniform vec2 uTroikaSDFTextureSize; +uniform float uTroikaSDFGlyphSize; +uniform vec4 uTroikaTotalBounds; +uniform vec4 uTroikaClipRect; +uniform mat3 uTroikaOrient; +uniform bool uTroikaUseGlyphColors; +uniform float uTroikaDistanceOffset; +uniform float uTroikaBlurRadius; +uniform vec2 uTroikaPositionOffset; +uniform float uTroikaCurveRadius; +attribute vec4 aTroikaGlyphBounds; +attribute float aTroikaGlyphIndex; +attribute vec3 aTroikaGlyphColor; +varying vec2 vTroikaGlyphUV; +varying vec4 vTroikaTextureUVBounds; +varying float vTroikaTextureChannel; +varying vec3 vTroikaGlyphColor; +varying vec2 vTroikaGlyphDimensions; +`,VN=` +vec4 bounds = aTroikaGlyphBounds; +bounds.xz += uTroikaPositionOffset.x; +bounds.yw -= uTroikaPositionOffset.y; + +vec4 outlineBounds = vec4( + bounds.xy - uTroikaDistanceOffset - uTroikaBlurRadius, + bounds.zw + uTroikaDistanceOffset + uTroikaBlurRadius +); +vec4 clippedBounds = vec4( + clamp(outlineBounds.xy, uTroikaClipRect.xy, uTroikaClipRect.zw), + clamp(outlineBounds.zw, uTroikaClipRect.xy, uTroikaClipRect.zw) +); + +vec2 clippedXY = (mix(clippedBounds.xy, clippedBounds.zw, position.xy) - bounds.xy) / (bounds.zw - bounds.xy); + +position.xy = mix(bounds.xy, bounds.zw, clippedXY); + +uv = (position.xy - uTroikaTotalBounds.xy) / (uTroikaTotalBounds.zw - uTroikaTotalBounds.xy); + +float rad = uTroikaCurveRadius; +if (rad != 0.0) { + float angle = position.x / rad; + position.xz = vec2(sin(angle) * rad, rad - cos(angle) * rad); + normal.xz = vec2(sin(angle), cos(angle)); +} + +position = uTroikaOrient * position; +normal = uTroikaOrient * normal; + +vTroikaGlyphUV = clippedXY.xy; +vTroikaGlyphDimensions = vec2(bounds[2] - bounds[0], bounds[3] - bounds[1]); + + +float txCols = uTroikaSDFTextureSize.x / uTroikaSDFGlyphSize; +vec2 txUvPerSquare = uTroikaSDFGlyphSize / uTroikaSDFTextureSize; +vec2 txStartUV = txUvPerSquare * vec2( + mod(floor(aTroikaGlyphIndex / 4.0), txCols), + floor(floor(aTroikaGlyphIndex / 4.0) / txCols) +); +vTroikaTextureUVBounds = vec4(txStartUV, vec2(txStartUV) + txUvPerSquare); +vTroikaTextureChannel = mod(aTroikaGlyphIndex, 4.0); +`,HN=` +uniform sampler2D uTroikaSDFTexture; +uniform vec2 uTroikaSDFTextureSize; +uniform float uTroikaSDFGlyphSize; +uniform float uTroikaSDFExponent; +uniform float uTroikaDistanceOffset; +uniform float uTroikaFillOpacity; +uniform float uTroikaOutlineOpacity; +uniform float uTroikaBlurRadius; +uniform vec3 uTroikaStrokeColor; +uniform float uTroikaStrokeWidth; +uniform float uTroikaStrokeOpacity; +uniform bool uTroikaSDFDebug; +varying vec2 vTroikaGlyphUV; +varying vec4 vTroikaTextureUVBounds; +varying float vTroikaTextureChannel; +varying vec2 vTroikaGlyphDimensions; + +float troikaSdfValueToSignedDistance(float alpha) { + // Inverse of exponential encoding in webgl-sdf-generator + + float maxDimension = max(vTroikaGlyphDimensions.x, vTroikaGlyphDimensions.y); + float absDist = (1.0 - pow(2.0 * (alpha > 0.5 ? 1.0 - alpha : alpha), 1.0 / uTroikaSDFExponent)) * maxDimension; + float signedDist = absDist * (alpha > 0.5 ? -1.0 : 1.0); + return signedDist; +} + +float troikaGlyphUvToSdfValue(vec2 glyphUV) { + vec2 textureUV = mix(vTroikaTextureUVBounds.xy, vTroikaTextureUVBounds.zw, glyphUV); + vec4 rgba = texture2D(uTroikaSDFTexture, textureUV); + float ch = floor(vTroikaTextureChannel + 0.5); //NOTE: can't use round() in WebGL1 + return ch == 0.0 ? rgba.r : ch == 1.0 ? rgba.g : ch == 2.0 ? rgba.b : rgba.a; +} + +float troikaGlyphUvToDistance(vec2 uv) { + return troikaSdfValueToSignedDistance(troikaGlyphUvToSdfValue(uv)); +} + +float troikaGetAADist() { + + #if defined(GL_OES_standard_derivatives) || __VERSION__ >= 300 + return length(fwidth(vTroikaGlyphUV * vTroikaGlyphDimensions)) * 0.5; + #else + return vTroikaGlyphDimensions.x / 64.0; + #endif +} + +float troikaGetFragDistValue() { + vec2 clampedGlyphUV = clamp(vTroikaGlyphUV, 0.5 / uTroikaSDFGlyphSize, 1.0 - 0.5 / uTroikaSDFGlyphSize); + float distance = troikaGlyphUvToDistance(clampedGlyphUV); + + // Extrapolate distance when outside bounds: + distance += clampedGlyphUV == vTroikaGlyphUV ? 0.0 : + length((vTroikaGlyphUV - clampedGlyphUV) * vTroikaGlyphDimensions); + + + + return distance; +} + +float troikaGetEdgeAlpha(float distance, float distanceOffset, float aaDist) { + #if defined(IS_DEPTH_MATERIAL) || defined(IS_DISTANCE_MATERIAL) + float alpha = step(-distanceOffset, -distance); + #else + + float alpha = smoothstep( + distanceOffset + aaDist, + distanceOffset - aaDist, + distance + ); + #endif + + return alpha; +} +`,WN=` +float aaDist = troikaGetAADist(); +float fragDistance = troikaGetFragDistValue(); +float edgeAlpha = uTroikaSDFDebug ? + troikaGlyphUvToSdfValue(vTroikaGlyphUV) : + troikaGetEdgeAlpha(fragDistance, uTroikaDistanceOffset, max(aaDist, uTroikaBlurRadius)); + +#if !defined(IS_DEPTH_MATERIAL) && !defined(IS_DISTANCE_MATERIAL) +vec4 fillRGBA = gl_FragColor; +fillRGBA.a *= uTroikaFillOpacity; +vec4 strokeRGBA = uTroikaStrokeWidth == 0.0 ? fillRGBA : vec4(uTroikaStrokeColor, uTroikaStrokeOpacity); +if (fillRGBA.a == 0.0) fillRGBA.rgb = strokeRGBA.rgb; +gl_FragColor = mix(fillRGBA, strokeRGBA, smoothstep( + -uTroikaStrokeWidth - aaDist, + -uTroikaStrokeWidth + aaDist, + fragDistance +)); +gl_FragColor.a *= edgeAlpha; +#endif + +if (edgeAlpha == 0.0) { + discard; +} +`;function XN(r){const e=zp(r,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new be},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new mt(0,0,0,0)},uTroikaClipRect:{value:new mt(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new be},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new Ne},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new rt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:GN,vertexTransform:VN,fragmentDefs:HN,fragmentColorTransform:WN,customRewriter({vertexShader:t,fragmentShader:n}){let i=/\buniform\s+vec3\s+diffuse\b/;return i.test(n)&&(n=n.replace(i,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),i.test(t)||(t=t.replace(bw,`uniform vec3 diffuse; +$& +vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; +`))),{vertexShader:t,fragmentShader:n}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const hg=new cr({color:16777215,side:Dt,transparent:!0}),dy=8421504,py=new Ke,Jl=new G,Md=new G,Da=[],qN=new G,Td="+x+y";function my(r){return Array.isArray(r)?r[0]:r}let Tw=()=>{const r=new Ot(new Nr(1,1),hg);return Tw=()=>r,r},Aw=()=>{const r=new Ot(new Nr(1,1,32,1),hg);return Aw=()=>r,r};const YN={type:"syncstart"},jN={type:"synccomplete"},Cw=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],$N=Cw.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let Rw=class extends Ot{constructor(){const e=new BN;super(e,null),this.text="",this.anchorX=0,this.anchorY=0,this.curveRadius=0,this.direction="auto",this.font=null,this.fontSize=.1,this.letterSpacing=0,this.lineHeight="normal",this.maxWidth=1/0,this.overflowWrap="normal",this.textAlign="left",this.textIndent=0,this.whiteSpace="normal",this.material=null,this.color=null,this.colorRanges=null,this.outlineWidth=0,this.outlineColor=0,this.outlineOpacity=1,this.outlineBlur=0,this.outlineOffsetX=0,this.outlineOffsetY=0,this.strokeWidth=0,this.strokeColor=dy,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=Td,this.glyphGeometryDetail=1,this.sdfGlyphSize=null,this.gpuAccelerateSDF=!0,this.debugSDF=!1}sync(e){this._needsSync&&(this._needsSync=!1,this._isSyncing?(this._queuedSyncs||(this._queuedSyncs=[])).push(e):(this._isSyncing=!0,this.dispatchEvent(YN),Sw({text:this.text,font:this.font,fontSize:this.fontSize||.1,letterSpacing:this.letterSpacing||0,lineHeight:this.lineHeight||"normal",maxWidth:this.maxWidth,direction:this.direction||"auto",textAlign:this.textAlign,textIndent:this.textIndent,whiteSpace:this.whiteSpace,overflowWrap:this.overflowWrap,anchorX:this.anchorX,anchorY:this.anchorY,colorRanges:this.colorRanges,includeCaretPositions:!0,sdfGlyphSize:this.sdfGlyphSize,gpuAccelerateSDF:this.gpuAccelerateSDF},t=>{this._isSyncing=!1,this._textRenderInfo=t,this.geometry.updateGlyphs(t.glyphBounds,t.glyphAtlasIndices,t.blockBounds,t.chunkedBounds,t.glyphColors);const n=this._queuedSyncs;n&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{n.forEach(i=>i&&i())})),this.dispatchEvent(jN),e&&e()})))}onBeforeRender(e,t,n,i,s,o){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s),s._hadOwnSide=s.hasOwnProperty("side"),this.geometry.setSide(s._actualSide=s.side),s.side=Oi}onAfterRender(e,t,n,i,s,o){s._hadOwnSide?s.side=s._actualSide:delete s.side}dispose(){this.geometry.dispose()}get textRenderInfo(){return this._textRenderInfo||null}get material(){let e=this._derivedMaterial;const t=this._baseMaterial||this._defaultMaterial||(this._defaultMaterial=hg.clone());if((!e||e.baseMaterial!==t)&&(e=this._derivedMaterial=XN(t),t.addEventListener("dispose",function n(){t.removeEventListener("dispose",n),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let n=e._outlineMtl;return n||(n=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),n.isTextOutlineMaterial=!0,n.depthWrite=!1,n.map=null,e.addEventListener("dispose",function i(){e.removeEventListener("dispose",i),n.dispose()})),[n,e]}else return e}set material(e){e&&e.isTroikaTextMaterial?(this._derivedMaterial=e,this._baseMaterial=e.baseMaterial):this._baseMaterial=e}get glyphGeometryDetail(){return this.geometry.detail}set glyphGeometryDetail(e){this.geometry.detail=e}get curveRadius(){return this.geometry.curveRadius}set curveRadius(e){this.geometry.curveRadius=e}get customDepthMaterial(){return my(this.material).getDepthMaterial()}get customDistanceMaterial(){return my(this.material).getDistanceMaterial()}_prepareForRender(e){const t=e.isTextOutlineMaterial,n=e.uniforms,i=this.textRenderInfo;if(i){const{sdfTexture:a,blockBounds:c}=i;n.uTroikaSDFTexture.value=a,n.uTroikaSDFTextureSize.value.set(a.image.width,a.image.height),n.uTroikaSDFGlyphSize.value=i.sdfGlyphSize,n.uTroikaSDFExponent.value=i.sdfExponent,n.uTroikaTotalBounds.value.fromArray(c),n.uTroikaUseGlyphColors.value=!t&&!!i.glyphColors;let l=0,u=0,h=0,f,d,m,v=0,g=0;if(t){let{outlineWidth:_,outlineOffsetX:y,outlineOffsetY:x,outlineBlur:b,outlineOpacity:w}=this;l=this._parsePercent(_)||0,u=Math.max(0,this._parsePercent(b)||0),f=w,v=this._parsePercent(y)||0,g=this._parsePercent(x)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(m=this.strokeColor,n.uTroikaStrokeColor.value.set(m??dy),d=this.strokeOpacity,d==null&&(d=1)),f=this.fillOpacity;n.uTroikaDistanceOffset.value=l,n.uTroikaPositionOffset.value.set(v,g),n.uTroikaBlurRadius.value=u,n.uTroikaStrokeWidth.value=h,n.uTroikaStrokeOpacity.value=d,n.uTroikaFillOpacity.value=f??1,n.uTroikaCurveRadius.value=this.curveRadius||0;let p=this.clipRect;if(p&&Array.isArray(p)&&p.length===4)n.uTroikaClipRect.value.fromArray(p);else{const _=(this.fontSize||.1)*100;n.uTroikaClipRect.value.set(c[0]-_,c[1]-_,c[2]+_,c[3]+_)}this.geometry.applyClipRect(n.uTroikaClipRect.value)}n.uTroikaSDFDebug.value=!!this.debugSDF,e.polygonOffset=!!this.depthOffset,e.polygonOffsetFactor=e.polygonOffsetUnits=this.depthOffset||0;const s=t?this.outlineColor||0:this.color;if(s==null)delete e.color;else{const a=e.hasOwnProperty("color")?e.color:e.color=new Ne;(s!==a._input||typeof s=="object")&&a.set(a._input=s)}let o=this.orientation||Td;if(o!==e._orientation){let a=n.uTroikaOrient.value;o=o.replace(/[^-+xyz]/g,"");let c=o!==Td&&o.match(/^([-+])([xyz])([-+])([xyz])$/);if(c){let[,l,u,h,f]=c;Jl.set(0,0,0)[u]=l==="-"?1:-1,Md.set(0,0,0)[f]=h==="-"?-1:1,py.lookAt(qN,Jl.cross(Md),Md),a.setFromMatrix4(py)}else a.identity();e._orientation=o}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),n=t?parseFloat(t[1]):NaN;e=(isNaN(n)?0:n/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new be){t.copy(e);const n=this.curveRadius;return n&&(t.x=Math.atan2(e.x,Math.abs(n)-Math.abs(e.z))*Math.abs(n)),t}worldPositionToTextCoords(e,t=new be){return Jl.copy(e),this.localPositionToTextCoords(this.worldToLocal(Jl),t)}raycast(e,t){const{textRenderInfo:n,curveRadius:i}=this;if(n){const s=n.blockBounds,o=i?Aw():Tw(),a=o.geometry,{position:c,uv:l}=a.attributes;for(let u=0;u{this[n]=e[n]}),this}clone(){return new this.constructor().copy(this)}};Cw.forEach(r=>{const e="_private_"+r;Object.defineProperty(Rw.prototype,r,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});const ZN=q.forwardRef(({sdfGlyphSize:r=64,anchorX:e="center",anchorY:t="middle",font:n,fontSize:i=1,children:s,characters:o,onSync:a,...c},l)=>{const u=Kt(({invalidate:m})=>m),[h]=q.useState(()=>new Rw),[f,d]=q.useMemo(()=>{const m=[];let v="";return q.Children.forEach(s,g=>{typeof g=="string"||typeof g=="number"?v+=g:m.push(g)}),[m,v]},[s]);return rS(()=>new Promise(m=>DN({font:n,characters:o},m)),["troika-text",n,o]),q.useLayoutEffect(()=>void h.sync(()=>{u(),a&&a(h)})),q.useEffect(()=>()=>h.dispose(),[h]),q.createElement("primitive",Tc({object:h,ref:l,font:n,text:d,anchorX:e,anchorY:t,fontSize:i,sdfGlyphSize:r},c),f)});var Ia={exports:{}},gy;function KN(){if(gy)return Ia.exports;gy=1;var r={ellipse:"…",chars:[" ","-"],max:140,truncate:!0};function e(n,i,s,o){if(n<=i)return n;if(i<2)return n.slice(0,i-s.length)+s;for(var a=i-s.length,c=Math.floor(a/2),l=c,u=n.length-c,h=0;h"u")&&(s[o]=r[o]);return s.max=i||s.max,s.truncate=="middle"?e(n,s.max,s.ellipse,s.chars):t(n,s.max,s.ellipse,s.chars,s.truncate)},Ia.exports.ellipsizeMiddle=e,Ia.exports.ellipsize=t,Ia.exports}var JN=KN();const QN=ki(JN);/*! + * hold-event + * https://github.com/yomotsu/hold-event + * (c) 2020 @yomotsu + * Released under the MIT License. + */var Za;(function(r){r.HOLD_START="holdStart",r.HOLD_END="holdEnd",r.HOLDING="holding"})(Za||(Za={}));class eF{constructor(){this._listeners={}}addEventListener(e,t){const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}removeEventListener(e,t){const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s{if(!this._enabled||this._holding)return;this._deltaTime=0,this._elapsedTime=0,this._lastTime=performance.now(),this.dispatchEvent({type:Za.HOLD_START,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),this._holding=!0;const n=()=>{this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n);const i=performance.now();this._deltaTime=i-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:Za.HOLDING,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t})};this._intervalId=this.holdIntervalDelay?window.setTimeout(n,this.holdIntervalDelay):window.requestAnimationFrame(n)},this._holdEnd=t=>{if(!this._enabled||!this._holding)return;const n=performance.now();this._deltaTime=n-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:Za.HOLD_END,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),window.clearTimeout(this._intervalId),window.cancelAnimationFrame(this._intervalId),this._holding=!1},this.holdIntervalDelay=e}get enabled(){return this._enabled}set enabled(e){this._enabled!==e&&(this._enabled=e,this._enabled||this._holdEnd())}}class Eh extends tF{constructor(e,t){super(t),this._holdStart=this._holdStart.bind(this),this._holdEnd=this._holdEnd.bind(this);const n=s=>{nF(s)||s.keyCode===e&&this._holdStart(s)},i=s=>{s.keyCode===e&&this._holdEnd(s)};document.addEventListener("keydown",n),document.addEventListener("keyup",i),window.addEventListener("blur",this._holdEnd)}}function nF(r){const e=r.target;return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.isContentEditable}var Ad={exports:{}};/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/var vy;function iF(){return vy||(vy=1,(function(r){(function(){var e={}.hasOwnProperty;function t(){for(var s="",o=0;o-1){const s=[...e.slice(i),n].map(o=>o.data.id);throw new Error(`Invalid Graph: Circular node path detected: ${s.join(" -> ")}.`)}t>n.depth&&(n.depth=t,Pw(n.out,[...e,n]))}}function Lw(r,e){let t=!1;const n=r.reduce((o,a)=>({...o,[a.id]:{data:a,out:[],depth:-1,ins:[]}}),{});try{for(const o of e){const a=o.source,c=o.target;if(!n.hasOwnProperty(a))throw new Error(`Missing source Node ${a}`);if(!n.hasOwnProperty(c))throw new Error(`Missing target Node ${c}`);const l=n[a],u=n[c];u.ins.push(l),l.out.push(u)}Pw(Object.values(n))}catch{t=!0}const i=Object.keys(n).map(o=>n[o].depth),s=Math.max(...i);return{invalid:t,depths:n,maxDepth:s||1}}const xy=["radialin","radialout"];function rF({nodes:r,edges:e,mode:t="lr",nodeLevelRatio:n=2}){const{depths:i,maxDepth:s,invalid:o}=Lw(r,e);if(o)return null;const a=xy.includes(t)?1:5,c=r.length/s*n*a;if(t){const l=(d,m)=>v=>d?(i[v.id].depth-s/2)*c*(m?-1:1):void 0,u=l(["lr","rl"].includes(t),t==="rl"),h=l(["td","bu"].includes(t),t==="td"),f=l(["zin","zout"].includes(t),t==="zout");r.forEach(d=>{d.fx=u(d),d.fy=h(d),d.fz=f(d)})}return xy.includes(t)?sI(l=>{const u=i[l.id];return(t==="radialin"?s-u.depth:u.depth)*c}).strength(1):null}function sF(r){return new Promise((e,t)=>{let n;function i(){n?e(n):(n=r.step(),i())}i()})}function Vc(r){const e=[],t=[];return r.forEachNode((n,i)=>{e.push({...i,id:n,radius:i.size||1})}),r.forEachEdge((n,i)=>{t.push({...i,id:n})}),{nodes:e,edges:t}}function oF(){const r=C=>()=>C;let t=C=>C.index,n=[],i=[],s,o,a=[100,100],c=r(1),l=r(-1),u=r(100),h=r(.1),f={},d=.1,m=.001,v=[],g=[0,0],p,_=C=>C.cluster,y="treemap",x=!0,b=.1;function w(C){if(!x)return w;y==="force"&&(p.tick(),A());for(let O=0,k=n.length,U,R=C*b;OO.radius).sort(function(O,k){return k.height-O.height||k.value-O.value}),v=C(o).leaves(),A()}function V(){let C=0;n.length!==0&&i.forEach(function(O){let k,U;if(n){if(k=O.source,U=O.target,typeof O.source!="object"&&(k=n.find(R=>R.id===O.source)),typeof O.target!="object"&&(U=n.find(R=>R.id===O.target)),k===void 0||U===void 0)throw Error("Error setting links, couldnt find nodes for a link (see it on the console)");O.source=k,O.target=U,O.index=C++}})}function N(){let C;!n||!n.length||(V(),C=L(),s.size>0&&C.nodes.forEach(O=>{var k,U,R,F;O.fx=(U=(k=s.get(O.id))==null?void 0:k.position)==null?void 0:U.x,O.fy=(F=(R=s.get(O.id))==null?void 0:R.position)==null?void 0:F.y}),p=x1(C.nodes).force("x",wp(a[0]/2).strength(.1)).force("y",Sp(a[1]/2).strength(.1)).force("collide",d1(O=>O.r).iterations(4)).force("charge",b1().strength(l)).force("links",p1(C.nodes.length?C.links:[]).distance(u).strength(h)),v=p.nodes(),A())}return w.template=function(C){return arguments.length?(y=C,S(),w):y},w.groupBy=function(C){return arguments.length?typeof C=="string"?(_=function(O){return O[C]},w):(_=C,w):_},w.enableGrouping=function(C){return arguments.length?(x=C,w):x},w.strength=function(C){return arguments.length?(b=C,w):b},w.getLinkStrength=function(C){return x?_(C.source)===_(C.target)?typeof d=="function"?d(C):d:typeof m=="function"?m(C):m:typeof d=="function"?d(C):d},w.id=function(C){return arguments.length?(t=C,w):t},w.size=function(C){return arguments.length?(a=C,w):a},w.linkStrengthInterCluster=function(C){return arguments.length?(m=C,w):m},w.linkStrengthIntraCluster=function(C){return arguments.length?(d=C,w):d},w.nodes=function(C){return arguments.length?(n=C,w):n},w.links=function(C){return arguments.length?(C===null?i=[]:i=C,S(),w):i},w.template=function(C){return arguments.length?(y=C,S(),w):y},w.forceNodeSize=function(C){return arguments.length?(c=typeof C=="function"?C:r(+C),S(),w):c},w.nodeSize=w.forceNodeSize,w.forceCharge=function(C){return arguments.length?(l=typeof C=="function"?C:r(+C),S(),w):l},w.forceLinkDistance=function(C){return arguments.length?(u=typeof C=="function"?C:r(+C),S(),w):u},w.forceLinkStrength=function(C){return arguments.length?(h=typeof C=="function"?C:r(+C),S(),w):h},w.offset=function(C){return arguments.length?(g=typeof C=="function"?C:r(+C),w):g},w.getFocis=A,w.setClusters=function(C){return s=C,w},w}function br({graph:r,nodeLevelRatio:e=2,mode:t=null,dimensions:n=2,nodeStrength:i=-250,linkDistance:s=50,clusterStrength:o=.5,linkStrengthInterCluster:a=.01,linkStrengthIntraCluster:c=.5,forceLinkDistance:l=100,forceLinkStrength:u=.1,clusterType:h="force",forceCharge:f=-700,getNodePosition:d,drags:m,clusters:v,clusterAttribute:g,forceLayout:p}){const{nodes:_,edges:y}=Vc(r),b=n===2&&y.length>25?i*2:i;let w,S;p==="forceDirected2d"?(w=wp(),S=Sp()):(w=wp(600).strength(.05),S=Sp(600).strength(.05));const M=x1().force("center",qL(0,0)).force("link",p1()).force("charge",b1().strength(b)).force("x",w).force("y",S).force("z",oI()).force("collide",d1(P=>P.radius+10)).force("dagRadial",rF({nodes:_,edges:y,mode:t,nodeLevelRatio:e})).stop();let E;if(g){let P=f;if(_!=null&&_.length){const A=Math.ceil(_.length/200);P=f*A}E=oF().setClusters(v).strength(o).template(h).groupBy(A=>A.data[g]).links(y).size([100,100]).linkStrengthInterCluster(a).linkStrengthIntraCluster(c).forceLinkDistance(l).forceLinkStrength(u).forceCharge(P).forceNodeSize(A=>A.radius)}let T=M.numDimensions(n).nodes(_);if(E&&(T=T.force("group",E)),s){let P=T.force("link");P&&(P.id(A=>A.id).links(y).distance(s),E&&(P=P.strength((E==null?void 0:E.getLinkStrength)??.1)))}const L=new Map(_.map(P=>[P.id,P]));return{step(){for(;M.alpha()>.01;)M.tick();return!0},getNodePosition(P){var A,z;if(d){const V=d(P,{graph:r,drags:m,nodes:_,edges:y});if(V)return V}return(A=m==null?void 0:m[P])!=null&&A.position?(z=m==null?void 0:m[P])==null?void 0:z.position:L.get(P)}}}function aF({graph:r,radius:e,drags:t,getNodePosition:n}){const i=qI(r,{scale:e}),{nodes:s,edges:o}=Vc(r);return{step(){return!0},getNodePosition(a){var c,l;if(n){const u=n(a,{graph:r,drags:t,nodes:s,edges:o});if(u)return u}return(c=t==null?void 0:t[a])!=null&&c.position?(l=t==null?void 0:t[a])==null?void 0:l.position:i==null?void 0:i[a]}}}const cF={td:{x:"x",y:"y",factor:-1},lr:{x:"y",y:"x",factor:1}};function by({graph:r,drags:e,mode:t="td",nodeSeparation:n=1,nodeSize:i=[50,50],getNodePosition:s}){const{nodes:o,edges:a}=Vc(r),{depths:c}=Lw(o,a),l=Object.keys(c).map(v=>c[v]),u=LI().id(v=>v.data.id).parentId(v=>{var g,p,_;return(_=(p=(g=v.ins)==null?void 0:g[0])==null?void 0:p.data)==null?void 0:_.id})(l),f=kI().separation(()=>n).nodeSize(i)(fh(u)).descendants(),d=cF[t],m=new Map(o.map(v=>{const{x:g,y:p}=f.find(_=>_.data.id===v.id);return[v.id,{...v,[d.x]:g*d.factor,[d.y]:p*d.factor,z:0}]}));return{step(){return!0},getNodePosition(v){var g,p;if(s){const _=s(v,{graph:r,drags:e,nodes:o,edges:a});if(_)return _}return(g=e==null?void 0:e[v])!=null&&g.position?(p=e==null?void 0:e[v])==null?void 0:p.position:m.get(v)}}}function lF({graph:r,margin:e,drags:t,getNodePosition:n,ratio:i,gridSize:s,maxIterations:o}){const{nodes:a,edges:c}=Vc(r),l=JI(r,{maxIterations:o,inputReducer:(u,h)=>({...h,x:h.x||0,y:h.y||0}),settings:{ratio:i,margin:e,gridSize:s}});return{step(){return!0},getNodePosition(u){var h,f;if(n){const d=n(u,{graph:r,drags:t,nodes:a,edges:c});if(d)return d}return(h=t==null?void 0:t[u])!=null&&h.position?(f=t==null?void 0:t[u])==null?void 0:f.position:l==null?void 0:l[u]}}}function uF({graph:r,drags:e,iterations:t,...n}){aU.assign(r);const i=rU(r,{iterations:t,settings:n});return{step(){return!0},getNodePosition(s){var o;return((o=e==null?void 0:e[s])==null?void 0:o.position)||(i==null?void 0:i[s])}}}function hF({graph:r,drags:e,getNodePosition:t}){const{nodes:n,edges:i}=Vc(r);return{step(){return!0},getNodePosition(s){return t(s,{graph:r,drags:e,nodes:n,edges:i})}}}const fF=["forceDirected2d","treeTd2d","treeLr2d","radialOut2d","treeTd3d","treeLr3d","radialOut3d","forceDirected3d"];function dF({type:r,...e}){if(fF.includes(r)){const{nodeStrength:t,linkDistance:n,nodeLevelRatio:i}=e;if(r==="forceDirected2d")return br({...e,dimensions:2,nodeLevelRatio:i||2,nodeStrength:t||-250,linkDistance:n,forceLayout:r});if(r==="treeTd2d")return br({...e,mode:"td",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:r});if(r==="treeLr2d")return br({...e,mode:"lr",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-250,linkDistance:n||50,forceLayout:r});if(r==="radialOut2d")return br({...e,mode:"radialout",dimensions:2,nodeLevelRatio:i||5,nodeStrength:t||-500,linkDistance:n||100,forceLayout:r});if(r==="treeTd3d")return br({...e,mode:"td",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||50});if(r==="treeLr3d")return br({...e,mode:"lr",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||50,forceLayout:r});if(r==="radialOut3d")return br({...e,mode:"radialout",dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-500,linkDistance:n||100,forceLayout:r});if(r==="forceDirected3d")return br({...e,dimensions:3,nodeLevelRatio:i||2,nodeStrength:t||-250,linkDistance:n,forceLayout:r})}else if(r==="circular2d"){const{radius:t}=e;return aF({...e,radius:t||300})}else{if(r==="hierarchicalTd")return by({...e,mode:"td"});if(r==="hierarchicalLr")return by({...e,mode:"lr"});if(r==="nooverlap"){const{graph:t,maxIterations:n,ratio:i,margin:s,gridSize:o,...a}=e;return lF({graph:t,margin:s||10,maxIterations:n||50,ratio:i||10,gridSize:o||20,...a})}else if(r==="forceatlas2"){const{graph:t,iterations:n,gravity:i,scalingRatio:s,...o}=e;return uF({type:"forceatlas2",graph:t,...o,scalingRatio:s||100,gravity:i||10,iterations:n||50})}else if(r==="custom")return hF({...e})}throw new Error(`Layout ${r} not found.`)}function Dw({nodeCount:r,nodePosition:e,labelType:t,camera:n}){return(i,s)=>{var o;if(n&&e&&((o=n==null?void 0:n.position)==null?void 0:o.z)/(n==null?void 0:n.zoom)-(e==null?void 0:e.z)>6e3)return!1;if(t==="all")return!0;if(t==="nodes"&&i==="node")return!0;if(t==="edges"&&i==="edge")return!0;if(t==="auto"&&i==="node"){if(s>7)return!0;if(n&&e&&n.position.z/n.zoom-e.z<3e3)return!0}return!1}}function Iw(r,e){switch(e){case"above":return r;case"below":return-r;case"inline":case"natural":default:return 0}}function pF({graph:r}){const e=hU(r);return{ranks:e,getSizeForNode:t=>e[t]*80}}function mF({graph:r}){const e=dU.degreeCentrality(r);return{ranks:e,getSizeForNode:t=>e[t]*20}}function gF({graph:r,attribute:e,defaultSize:t}){const n=new Map;return e?r.forEachNode((i,s)=>{var o;const a=(o=s.data)==null?void 0:o[e];isNaN(a)&&console.warn(`Attribute ${a} is not a number for node ${s.id}`),n.set(i,a||0)}):console.warn("Attribute sizing configured but no attribute provided"),{getSizeForNode:i=>!e||!n?t:n.get(i)}}const wy={pagerank:pF,centrality:mF,attribute:gF,none:({defaultSize:r})=>({getSizeForNode:e=>r})};function vF({type:r,...e}){var t;const n=(t=wy[r])==null?void 0:t.call(wy,e);if(!n&&r!=="default")throw new Error(`Unknown sizing strategy: ${r}`);const{graph:i,minSize:s,maxSize:o}=e,a=new Map;let c,l;if(i.forEachNode((u,h)=>{let f;r==="default"?f=h.size||e.defaultSize:f=n.getSizeForNode(u),(c===void 0||fl)&&(l=f),a.set(u,f)}),r!=="none"){const u=Jw().domain([c,l]).rangeRound([s,o]);for(const[h,f]of a)a.set(h,u(f))}return a}function _F(r,e,t){r.clear();const n=new Set;for(const i of e)try{n.has(i.id)||(r.addNode(i.id,i),n.add(i.id))}catch(s){console.error(`[Graph] Error adding node '${i.id}`,s)}for(const i of t)if(!(!n.has(i.source)||!n.has(i.target)))try{r.addEdge(i.source,i.target,i)}catch(s){console.error(`[Graph] Error adding edge '${i.source} -> ${i.target}`,s)}return r}function yF({graph:r,layout:e,sizingType:t,labelType:n,sizingAttribute:i,defaultNodeSize:s,minNodeSize:o,maxNodeSize:a,clusterAttribute:c}){const l=[],u=[],h=new Map,f=vF({graph:r,type:t,attribute:i,minSize:o,maxSize:a,defaultSize:s}),d=r.nodes().length,m=Dw({nodeCount:d,labelType:n});return r.forEachNode((v,g)=>{const p=e.getNodePosition(v),{data:_,fill:y,icon:x,label:b,size:w,...S}=g,M=f.get(g.id),E=m("node",M),L=(r.inboundNeighbors(g.id)||[]).map(A=>r.getNodeAttributes(A)),P={...g,size:M,labelVisible:E,label:b,icon:x,fill:y,cluster:c?_[c]:void 0,parents:L,data:{...S,..._??{}},position:{...p,x:p.x||0,y:p.y||0,z:p.z||1}};h.set(g.id,P),l.push(P)}),r.forEachEdge((v,g)=>{const p=h.get(g.source),_=h.get(g.target);if(p&&_){const{data:y,id:x,label:b,size:w,...S}=g,M=m("edge",w);u.push({...g,id:x,label:b,labelVisible:M,size:w,data:{...S,id:x,...y||{}}})}}),{nodes:l,edges:u}}const Vn={mass:10,tension:1e3,friction:300,precision:.1};function Uw(r,e,t){const n=e.getLength(),i=r==="end"?n:n/2,s=r==="end"?t/2:0,o=(i-s)/n,a=e.getPointAt(o),c=e.getTangentAt(o);return[a,c]}function Ow(r){return[r+6,2+r/1.5]}const Cd=.7;function Nw(r,e,t=0){const n=new G(r.x,r.y||0,r.z||0),i=new G(e.x,e.y||0,e.z||0),s=new G().addVectors(n,i).divideScalar(2);return s.setLength(s.length()+t)}function xF(r,e,t=-1){const n=r.clone(),i=e.clone(),s=new G().subVectors(i,n),o=s.length(),a=s.clone().normalize(),c=new G().subVectors(i,n).divideScalar(2),l=Math.abs(a.x)%1,u=new G(-a.y,a.x-l*a.z,l*a.y).normalize(),h=new G().add(n).add(c).add(u.multiplyScalar(o/4).multiplyScalar(t));return[r,h,e]}function wc(r,e,t,n,i,s){const o=Sy(r,t,e),a=Sy(t,r,n);return i?new $u(...xF(o,a,s)):new gm(o,a)}function Sc(r){return new G(r.position.x,r.position.y,r.position.z||0)}function Sy(r,e,t){const n=r.distanceTo(e);return r.clone().add(e.clone().sub(r).multiplyScalar(t/n))}function Ey(r,e){return{...r,position:{...r.position,x:r.position.x+e.x,y:r.position.y+e.y,z:r.position.z+e.z}}}function bF({edge:r,edges:e,curved:t}){let n=t,i;const s=e.filter(o=>o.target===r.target&&o.source===r.source).map(o=>o.id);if(s.length>1){n=!0;const o=s.indexOf(r.id);s.length===2?i=o===0?Cd:-Cd:i=(o-Math.floor(s.length/2))*Cd}return{curved:n,curveOffset:i}}function Ec(r){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;for(let a of r)e=Math.min(e,a.position.x),t=Math.max(t,a.position.x),n=Math.min(n,a.position.y),i=Math.max(i,a.position.y),s=Math.min(s,a.position.z),o=Math.max(o,a.position.z);return{height:i-n,width:t-e,minX:e,maxX:t,minY:n,maxY:i,minZ:s,maxZ:o,x:(t+e)/2,y:(i+n)/2,z:(o+s)/2}}function wF(r,e){return e?r.reduce((t,n)=>{const i=n.data[e];return i&&t.set(i,[...t.get(i)||[],n]),t},new Map):new Map}function SF({nodes:r,clusterAttribute:e}){const t=new Map;if(e){const n=wF(r,e);for(const[i,s]of n){const o=Ec(s);t.set(i,{label:i,nodes:s,position:o})}}return t}const fg=({sensitivity:r=7,interval:e=50,timeout:t=0,disabled:n,onPointerOver:i,onPointerOut:s})=>{const o=q.useRef(!1),a=q.useRef(null),c=q.useRef(0),l=q.useRef({x:null,y:null,px:null,py:null}),u=q.useCallback(g=>{l.current.x=g.clientX,l.current.y=g.clientY},[]),h=q.useCallback(g=>{a.current=clearTimeout(a.current);const{px:p,x:_,py:y,y:x}=l.current;Math.abs(p-_)+Math.abs(y-x)h(g),e))},[e,i,r]),f=q.useCallback(()=>{clearTimeout(a.current),typeof window<"u"&&document.removeEventListener("mousemove",u,!1)},[u]),d=q.useCallback(g=>{n||(o.current=!0,f(),c.current!==1&&(l.current.px=g.pointer.x,l.current.py=g.pointer.y,typeof window<"u"&&document.addEventListener("mousemove",u,!1),a.current=setTimeout(()=>h(g),t)))},[f,h,n,u,t]),m=q.useCallback(g=>{a.current=clearTimeout(a.current),c.current=0,s(g)},[s]),v=q.useCallback(g=>{o.current=!1,f(),c.current===1&&(a.current=setTimeout(()=>m(g),t))},[f,m,t]);return{pointerOver:d,pointerOut:v}},Fw=({draggable:r,set:e,position:t,bounds:n,onDragStart:i,onDragEnd:s})=>{const o=Kt(g=>g.camera),a=Kt(g=>g.raycaster),c=Kt(g=>g.size),l=Kt(g=>g.gl),{mouse2D:u,mouse3D:h,offset:f,normal:d,plane:m}=q.useMemo(()=>({mouse2D:new be,mouse3D:new G,offset:new G,normal:new G,plane:new Qi}),[]),v=q.useMemo(()=>l.domElement.getBoundingClientRect(),[l.domElement]);return vE({onDragStart:({event:g})=>{const{eventObject:p,point:_}=g;p.getWorldPosition(f).sub(_),h.copy(_),i()},onDrag:({xy:g,buttons:p,cancel:_})=>{if(p!==1){_();return}const y=(g[0]-((v==null?void 0:v.left)??0))/c.width*2-1,x=-((g[1]-((v==null?void 0:v.top)??0))/c.height)*2+1;u.set(y,x),a.setFromCamera(u,o),o.getWorldDirection(d).negate(),m.setFromNormalAndCoplanarPoint(d,h),a.ray.intersectPlane(m,h);const b=new G(t.x,t.y,t.z).copy(h).add(f);if(n){const w=new G((n.minX+n.maxX)/2,(n.minY+n.maxY)/2,(n.minZ+n.maxZ)/2),S=(n.maxX-n.minX)/2,M=b.clone().sub(w);M.length()>S&&(M.normalize().multiplyScalar(S),b.copy(w).add(M))}return e(b)},onDragEnd:s},{drag:{enabled:r,threshold:10}})},{Provider:EF,useStore:Ue}=mU(),MF=({actives:r=[],selections:e=[],collapsedNodeIds:t=[],theme:n})=>DE(i=>({theme:{...n,edge:{...n.edge,label:{...n.edge.label,fontSize:n.edge.label.fontSize??6}}},edges:[],nodes:[],collapsedNodeIds:t,clusters:new Map,panning:!1,draggingIds:[],actives:r,edgeContextMenus:new Set,edgeMeshes:[],selections:e,hoveredNodeId:null,drags:{},graph:new St({multi:!0}),setTheme:s=>i(o=>({...o,theme:s})),setClusters:s=>i(o=>({...o,clusters:s})),setEdgeContextMenus:s=>i(o=>({...o,edgeContextMenus:s})),setEdgeMeshes:s=>i(o=>({...o,edgeMeshes:s})),setPanning:s=>i(o=>({...o,panning:s})),setDrags:s=>i(o=>({...o,drags:s})),addDraggingId:s=>i(o=>({...o,draggingIds:[...o.draggingIds,s]})),removeDraggingId:s=>i(o=>({...o,draggingIds:o.draggingIds.filter(a=>a!==s)})),setActives:s=>i(o=>({...o,actives:s})),setSelections:s=>i(o=>({...o,selections:s})),setHoveredNodeId:s=>i(o=>({...o,hoveredNodeId:s})),setNodes:s=>i(o=>({...o,nodes:s,centerPosition:Ec(s)})),setEdges:s=>i(o=>({...o,edges:s})),setNodePosition:(s,o)=>i(a=>{var c,l;const u=a.nodes.find(v=>v.id===s),h=Sc(u),d=new G(o.x,o.y,o.z).sub(h),m=[...a.nodes];if((c=a.selections)!=null&&c.includes(s))(l=a.selections)==null||l.forEach(v=>{const g=a.nodes.find(p=>p.id===v);if(g){const p=a.nodes.indexOf(g);m[p]=Ey(g,d)}});else{const v=a.nodes.indexOf(u);m[v]=Ey(u,d)}return{...a,drags:{...a.drags,[s]:u},nodes:m}}),setCollapsedNodeIds:(s=[])=>i(o=>({...o,collapsedNodeIds:s})),setClusterPosition:(s,o)=>i(a=>{const c=new Map(a.clusters),l=c.get(s);if(l){const u=l.position,h=new G(o.x-u.x,o.y-u.y,o.z-(u.z??0)),f=[...a.nodes],d={...a.drags};f.forEach((g,p)=>{g.cluster===s&&(f[p]={...g,position:{...g.position,x:g.position.x+h.x,y:g.position.y+h.y,z:g.position.z+(h.z??0)}},d[g.id]=g)});const m=f.filter(g=>g.cluster===s),v=Ec(m);return c.set(s,{...l,position:v}),{...a,drags:{...d,[s]:l},clusters:c,nodes:f}}return a})}));function kw({nodeId:r,nodes:e,edges:t,currentHiddenNodes:n,currentHiddenEdges:i}){const s=[],o=[],a=n.map(d=>d.id),c=i.map(d=>d.id),l=t.filter(d=>d.source===r),u=l.map(d=>d.target);o.push(...l);for(const d of u){const m=t.filter(g=>g.target===d&&g.source!==r);let v=!1;if((m.length===0||m.length>0&&!a.includes(d)&&m.map(p=>p.id).every(p=>c.includes(p)))&&(v=!0),v){const g=e.find(_=>_.id===d);g&&s.push(g);const p=kw({nodeId:d,nodes:e,edges:t,currentHiddenEdges:o,currentHiddenNodes:s});o.push(...p.hiddenEdges),s.push(...p.hiddenNodes)}}const h=Object.values(o.reduce((d,m)=>({...d,[m.id]:m}),{})),f=Object.values(s.reduce((d,m)=>({...d,[m.id]:m}),{}));return{hiddenEdges:h,hiddenNodes:f}}const TF=({collapsedIds:r,nodes:e,edges:t})=>{const n=[],i=[];for(const l of r){const{hiddenEdges:u,hiddenNodes:h}=kw({nodeId:l,nodes:e,edges:t,currentHiddenEdges:i,currentHiddenNodes:n});n.push(...h),i.push(...u)}const s=n.map(l=>l.id),o=i.map(l=>l.id),a=e.filter(l=>!s.includes(l.id)),c=t.filter(l=>!o.includes(l.id));return{visibleNodes:a,visibleEdges:c}},AF=({layoutType:r,sizingType:e,labelType:t,sizingAttribute:n,clusterAttribute:i,selections:s,nodes:o,edges:a,actives:c,collapsedNodeIds:l,defaultNodeSize:u,maxNodeSize:h,minNodeSize:f,layoutOverrides:d,constrainDragging:m})=>{const v=Ue(R=>R.graph),g=Ue(R=>R.clusters),p=Ue(R=>R.nodes),_=Ue(R=>R.setClusters),y=Ue(R=>R.collapsedNodeIds),x=Ue(R=>R.setEdges),b=Ue(R=>R.nodes),w=Ue(R=>R.setNodes),S=Ue(R=>R.setSelections),M=Ue(R=>R.setActives),E=Ue(R=>R.drags),T=Ue(R=>R.setDrags),L=Ue(R=>R.setCollapsedNodeIds),P=q.useRef(!1),A=q.useRef(null),z=Kt(R=>R.camera),V=q.useRef(E),N=q.useRef([]);q.useEffect(()=>{var R;if(!i)return;const F=p.map(Y=>Y.id),H=o.find(Y=>!F.includes(Y.id));if(H){const Y=H.data[i],J=g.get(Y),ie={...V.current};(R=J==null?void 0:J.nodes)==null||R.forEach(ne=>ie[ne.id]=void 0),V.current=ie,T(ie)}},[p,o,i,g,T]);const{visibleEdges:C,visibleNodes:O}=q.useMemo(()=>TF({collapsedIds:y,nodes:o,edges:a}),[y,o,a]),k=q.useCallback(R=>{const F={...V.current};R.forEach(H=>F[H.id]=H),V.current=F,T(F)},[T]),U=q.useCallback(async R=>{A.current=R||dF({...d,type:r,graph:v,drags:V.current,clusters:N==null?void 0:N.current,clusterAttribute:i}),await sF(A.current);const F=yF({graph:v,layout:A.current,sizingType:e,labelType:t,sizingAttribute:n,maxNodeSize:h,minNodeSize:f,defaultNodeSize:u,clusterAttribute:i}),H=SF({nodes:F.nodes,clusterAttribute:i});m&&H.forEach(Y=>{var J,ie;const ne=N.current.get(Y.label);(ne==null?void 0:ne.nodes.length)===Y.nodes.length&&(Y.position=((ie=(J=N.current)==null?void 0:J.get(Y.label))==null?void 0:ie.position)??Y.position)}),x(F.edges),w(F.nodes),_(H),i&&k(F.nodes)},[d,r,i,e,t,n,h,f,u,x,w,_]);return q.useEffect(()=>{V.current=E},[E,i,U]),q.useEffect(()=>{N.current=g},[g]),q.useEffect(()=>{const R=b.map(H=>({...H,labelVisible:Dw({nodeCount:b==null?void 0:b.length,labelType:t,camera:z,nodePosition:H==null?void 0:H.position})("node",H==null?void 0:H.size)}));R.some((H,Y)=>H.labelVisible!==b[Y].labelVisible)&&w(R)},[z,z.zoom,z.position.z,w,b,t]),q.useEffect(()=>{P.current&&S(s)},[s,S]),q.useEffect(()=>{P.current&&M(c)},[c,M]),q.useEffect(()=>{async function R(){P.current=!1,_F(v,O,C),await U(),requestAnimationFrame(()=>P.current=!0)}R()},[O,C]),q.useEffect(()=>{P.current&&L(l)},[l,L]),q.useEffect(()=>{P.current&&(V.current={},T({}),U())},[r,U,T]),q.useEffect(()=>{P.current&&U(A.current)},[e,n,t,U]),{updateLayout:U}},Mc=({text:r,fontSize:e=7,fontUrl:t,color:n="#2A6475",opacity:i=1,stroke:s,active:o,ellipsis:a=75,rotation:c})=>{const l=a&&!o?QN(r,a):r,u=q.useMemo(()=>new Ne(n),[n]),h=q.useMemo(()=>s?new Ne(s):void 0,[s]);return Se.jsx(yw,{position:[0,0,1],children:Se.jsx(ZN,{font:t,fontSize:e,color:u,fillOpacity:i,textAlign:"center",outlineWidth:s?1:0,outlineColor:h,depthOffset:0,maxWidth:100,overflowWrap:"break-word",rotation:c,children:l})})},CF=({color:r="#D8E6EA",size:e=1,opacity:t=.5,animated:n,strokeWidth:i=5,innerRadius:s=4,segments:o=25})=>{const a=q.useMemo(()=>new Ne(r),[r]),{ringSize:c,ringOpacity:l}=Gn({from:{ringOpacity:0,ringSize:[1e-5,1e-5,1e-5]},to:{ringOpacity:t,ringSize:[e/2,e/2,1]},config:{...Vn,duration:n?void 0:0}}),u=i/10,h=s+u;return Se.jsx(yw,{position:[0,0,1],children:Se.jsxs(Gt.mesh,{scale:c,children:[Se.jsx("ringGeometry",{attach:"geometry",args:[s,h,o]}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",color:a,transparent:!0,depthTest:!1,opacity:l,side:Dt,fog:!0})]})})},RF=({color:r,id:e,size:t,selected:n,opacity:i=1,animated:s})=>{const{scale:o,nodeOpacity:a}=Gn({from:{scale:[1e-5,1e-5,1e-5],nodeOpacity:0},to:{scale:[t,t,t],nodeOpacity:i},config:{...Vn,duration:s?void 0:0}}),c=q.useMemo(()=>new Ne(r),[r]),l=Ue(u=>u.theme);return Se.jsxs(Se.Fragment,{children:[Se.jsxs(Gt.mesh,{userData:{id:e,type:"node"},scale:o,children:[Se.jsx("sphereGeometry",{attach:"geometry",args:[1,25,25]}),Se.jsx(Gt.meshPhongMaterial,{attach:"material",side:Dt,transparent:!0,fog:!0,opacity:a,color:c})]}),Se.jsx(CF,{opacity:n?.5:0,size:t,animated:s,color:n?l.ring.activeFill:l.ring.fill})]})},zw=q.createContext({controls:null,resetControls:()=>{},zoomIn:()=>{},zoomOut:()=>{},dollyIn:()=>{},dollyOut:()=>{},panLeft:()=>{},panRight:()=>{},panUp:()=>{},panDown:()=>{},freeze:()=>{},unFreeze:()=>{}}),Mh=()=>{const r=q.useContext(zw);if(r===void 0)throw new Error("`useCameraControls` hook must be used within a `ControlsProvider` component");return r};nn.install({THREE:{MOUSE:qy,Vector2:be,Vector3:G,Vector4:mt,Quaternion:ln,Matrix4:Ke,Spherical:Yb,Box3:Hn,Sphere:Wn,Raycaster:Im,MathUtils:{DEG2RAD:(_y=bu)==null?void 0:_y.DEG2RAD,clamp:(yy=bu)==null?void 0:yy.clamp}}});Zb({ThreeCameraControls:nn});const Th={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40},My=new Eh(Th.ARROW_LEFT,100),Ty=new Eh(Th.ARROW_RIGHT,100),Ay=new Eh(Th.ARROW_UP,100),Cy=new Eh(Th.ARROW_DOWN,100),PF=q.forwardRef(({mode:r="rotate",children:e,animated:t,disabled:n,minDistance:i=1e3,maxDistance:s=5e4},o)=>{const a=q.useRef(null),c=Kt(L=>L.camera),l=Kt(L=>L.gl),u=r==="orbit",h=Ue(L=>L.setPanning),f=Ue(L=>L.draggingIds.length>0),d=q.useRef(0),[m,v]=q.useState(!1);uh((L,P)=>{var A,z;(A=a.current)!=null&&A.enabled&&((z=a.current)==null||z.update(P)),u&&(a.current.azimuthAngle+=20*P*bu.DEG2RAD)},-1),q.useEffect(()=>()=>{var L;return(L=a.current)==null?void 0:L.dispose()},[]);const g=q.useCallback(()=>{var L;(L=a.current)==null||L.zoom(c.zoom/2,t)},[t,c.zoom]),p=q.useCallback(()=>{var L;(L=a.current)==null||L.zoom(-c.zoom/2,t)},[t,c.zoom]),_=q.useCallback(L=>{var P;(P=a.current)==null||P.dolly(L,t)},[t]),y=q.useCallback(L=>{var P;(P=a.current)==null||P.dolly(L,t)},[t]),x=q.useCallback(L=>{var P;u||(P=a.current)==null||P.truck(-.03*L.deltaTime,0,t)},[t,u]),b=q.useCallback(L=>{var P;u||(P=a.current)==null||P.truck(.03*L.deltaTime,0,t)},[t,u]),w=q.useCallback(L=>{var P;u||(P=a.current)==null||P.truck(0,.03*L.deltaTime,t)},[t,u]),S=q.useCallback(L=>{var P;u||(P=a.current)==null||P.truck(0,-.03*L.deltaTime,t)},[t,u]),M=q.useCallback(L=>{L.code==="Space"&&(r==="rotate"?a.current.mouseButtons.left=nn.ACTION.TRUCK:a.current.mouseButtons.left=nn.ACTION.ROTATE)},[r]),E=q.useCallback(L=>{L.code==="Space"&&(r==="rotate"?a.current.mouseButtons.left=nn.ACTION.ROTATE:a.current.mouseButtons.left=nn.ACTION.TRUCK)},[r]);q.useEffect(()=>(n||(My.addEventListener("holding",b),Ty.addEventListener("holding",x),Ay.addEventListener("holding",w),Cy.addEventListener("holding",S),typeof window<"u"&&(window.addEventListener("keydown",M),window.addEventListener("keyup",E))),()=>{My.removeEventListener("holding",b),Ty.removeEventListener("holding",x),Ay.removeEventListener("holding",w),Cy.removeEventListener("holding",S),typeof window<"u"&&(window.removeEventListener("keydown",M),window.removeEventListener("keyup",E))}),[n,M,E,S,b,x,w]),q.useEffect(()=>{n?(a.current.mouseButtons.left=nn.ACTION.NONE,a.current.mouseButtons.middle=nn.ACTION.NONE,a.current.mouseButtons.wheel=nn.ACTION.NONE):(a.current.mouseButtons.left=nn.ACTION.TRUCK,a.current.mouseButtons.middle=nn.ACTION.TRUCK,a.current.mouseButtons.wheel=nn.ACTION.DOLLY)},[n]),q.useEffect(()=>{const L=()=>h(!0),P=()=>h(!1),A=a.current;return A&&(A.addEventListener("control",L),A.addEventListener("controlend",P)),()=>{A&&(A.removeEventListener("control",L),A.removeEventListener("controlend",P))}},[a,h]),q.useEffect(()=>{f?(a.current.mouseButtons.left=nn.ACTION.NONE,a.current.touches.one=nn.ACTION.NONE):r==="rotate"?(a.current.mouseButtons.left=nn.ACTION.ROTATE,a.current.touches.one=nn.ACTION.TOUCH_ROTATE):(a.current.touches.one=nn.ACTION.TOUCH_TRUCK,a.current.mouseButtons.left=nn.ACTION.TRUCK)},[f,r]);const T=q.useMemo(()=>({controls:a.current,zoomIn:()=>g(),zoomOut:()=>p(),dollyIn:(L=1e3)=>_(L),dollyOut:(L=-1e3)=>y(L),panLeft:(L=100)=>b({deltaTime:L}),panRight:(L=100)=>x({deltaTime:L}),panDown:(L=100)=>S({deltaTime:L}),panUp:(L=100)=>w({deltaTime:L}),resetControls:L=>{var P;return(P=a.current)==null?void 0:P.reset(L)},freeze:()=>{a.current.truckSpeed&&(d.current=a.current.truckSpeed),a.current.truckSpeed=0},unFreeze:()=>a.current.truckSpeed=d.current}),[g,p,b,x,S,w,a.current]);return q.useImperativeHandle(o,()=>T),Se.jsxs(zw.Provider,{value:T,children:[Se.jsx("threeCameraControls",{ref:L=>{a.current=L,m||v(!0)},args:[c,l.domElement],smoothTime:.1,minDistance:i,dollyToCursor:!0,maxDistance:s}),e]})});function Bw(r,e){const t=e.position.z;rc.x0&&(e==null?void 0:e.x)c.y0&&(e==null?void 0:e.y)Math.abs(n-r%Math.PI){const n=Ue(v=>v.nodes),[i,s]=q.useState(!1),o=Kt(v=>v.invalidate),{controls:a}=Mh(),c=Kt(v=>v.camera),l=q.useRef(!1),u=q.useCallback(async(v,g)=>{const p=(g==null?void 0:g.animated)!==void 0?g==null?void 0:g.animated:!0,_=(g==null?void 0:g.centerOnlyIfNodesNotInView)!==void 0?g==null?void 0:g.centerOnlyIfNodesNotInView:!1;if(!l.current||!_||_&&(v!=null&&v.some(y=>!Ry(c,y.position)))){const{x:y,y:x,z:b}=Ec(v);await a.setTarget(y,x,b,p),i||s(!0),o()}},[o,a,n]),h=q.useCallback(async(v,g={animated:!0,fitOnlyIfNodesNotInView:!1})=>{const{fitOnlyIfNodesNotInView:p}=g;if(!p||p&&(v!=null&&v.some(_=>!Ry(c,_.position)))){const{minX:_,maxX:y,minY:x,maxY:b,minZ:w,maxZ:S}=Ec(v);if(!t.includes("3d")){const{horizontalRotation:M,verticalRotation:E}=DF(a==null?void 0:a.azimuthAngle,a==null?void 0:a.polarAngle);a==null||a.rotate(M,E,!0)}await(a==null?void 0:a.zoomTo(1,g==null?void 0:g.animated)),await(a==null?void 0:a.fitToBox(new Hn(new G(_,x,w),new G(y,b,S)),g==null?void 0:g.animated,{cover:!1,paddingLeft:Ql,paddingRight:Ql,paddingBottom:Ql,paddingTop:Ql}))}},[c,a,t]),f=q.useCallback(v=>{let g=null;return v!=null&&v.length&&(g=v.reduce((p,_)=>{const y=n.find(x=>x.id===_);if(y)p.push(y);else throw new Error(`Attempted to center ${_} but it was not found in the nodes`);return p},[])),g},[n]),d=q.useCallback((v,g)=>{const p=f(v);u(p||n,{animated:r,centerOnlyIfNodesNotInView:g==null?void 0:g.centerOnlyIfNodesNotInView})},[r,u,f,n]),m=q.useCallback(async(v,g)=>{const p=f(v);await h(p||n,{animated:r,...g})},[r,h,f,n]);return q.useLayoutEffect(()=>{async function v(){a&&(n!=null&&n.length)&&(l.current||(await u(n,{animated:!1}),await h(n,{animated:!1}),l.current=!0))}v()},[a,u,n,r,c,h]),{centerNodes:u,centerNodesById:d,fitNodesInViewById:m,isCentered:i}},UF=({image:r,id:e,size:t,opacity:n=1,animated:i})=>{const s=q.useMemo(()=>new Ob().load(r),[r]),{scale:o,spriteOpacity:a}=Gn({from:{scale:[1e-5,1e-5,1e-5],spriteOpacity:0},to:{scale:[t,t,t],spriteOpacity:n},config:{...Vn,duration:i?void 0:0}});return Se.jsx(Gt.sprite,{userData:{id:e,type:"node"},scale:o,children:Se.jsx(Gt.spriteMaterial,{attach:"material",opacity:a,fog:!0,depthTest:!1,transparent:!0,side:Dt,children:Se.jsx("primitive",{attach:"map",object:s,minFilter:Pt})})})},OF=({animated:r,disabled:e,id:t,draggable:n=!1,labelFontUrl:i,contextMenu:s,onClick:o,onDoubleClick:a,onPointerOver:c,onDragged:l,onPointerOut:u,onContextMenu:h,renderNode:f,constrainDragging:d})=>{var m,v,g;const p=Mh(),_=Ue($=>$.theme),y=Ue($=>$.nodes.find(he=>he.id===t)),x=Ue($=>$.edges),b=Ue($=>$.draggingIds),w=Ue($=>$.collapsedNodeIds),S=Ue($=>$.addDraggingId),M=Ue($=>$.removeDraggingId),E=Ue($=>$.setHoveredNodeId),T=Ue($=>$.setNodePosition),L=Ue($=>$.setCollapsedNodeIds),P=Ue($=>$.collapsedNodeIds.includes(t)),A=Ue($=>{var he;return(he=$.actives)==null?void 0:he.includes(t)}),z=Ue($=>{var he;return(he=$.selections)==null?void 0:he.includes(t)}),V=Ue($=>{var he;return((he=$.selections)==null?void 0:he.length)>0}),N=Ue($=>$.centerPosition),C=Ue($=>$.clusters.get(y.cluster)),O=b.includes(t),k=b.length>0,{position:U,label:R,subLabel:F,size:H=7,labelVisible:Y=!0}=y,J=q.useRef(null),[ie,ne]=q.useState(!1),[ee,ge]=q.useState(!1),me=ie||z||A,te=V?me?_.node.selectedOpacity:_.node.inactiveOpacity:_.node.opacity,D=q.useMemo(()=>x.filter(he=>he.source===t).length>0||P,[x,t,P]),Q=q.useCallback(()=>{D&&L(P?w.filter($=>$!==t):[...w,t])},[D,w,t,P,L]),[{nodePosition:j,labelPosition:K,subLabelPosition:W}]=Gn(()=>({from:{nodePosition:N?[N.x,N.y,0]:[0,0,0],labelPosition:[0,-(H+7),2],subLabelPosition:[0,-(H+14),2]},to:{nodePosition:U?[U.x,U.y,me?U.z+1:U.z]:[0,0,0],labelPosition:[0,-(H+7),2],subLabelPosition:[0,-(H+14),2]},config:{...Vn,duration:r&&!k?void 0:0}}),[O,U,r,H,me]),ye=Fw({draggable:n,position:U,bounds:d?C==null?void 0:C.position:void 0,set:$=>T(t,$),onDragStart:()=>{S(t),ne(!0)},onDragEnd:()=>{M(t),l==null||l(y)}});ds(ie&&!k&&o!==void 0,"pointer"),ds(ie&&n&&!O&&o===void 0,"grab"),ds(O,"grabbing");const re=me||O,fe=re?_.node.activeFill:y.fill||_.node.fill,{pointerOver:xe,pointerOut:ce}=fg({disabled:e||O,onPointerOver:$=>{p.freeze(),ne(!0),c==null||c(y,$),E(t)},onPointerOut:$=>{p.unFreeze(),ne(!1),u==null||u(y,$),E(null)}}),Pe=q.useMemo(()=>f?f({id:t,color:fe,size:H,active:re,opacity:te,animated:r,selected:z,node:y}):Se.jsx(Se.Fragment,{children:y.icon?Se.jsx(UF,{id:t,image:y.icon||"",size:H+8,opacity:te,animated:r,color:fe,node:y,active:re,selected:z}):Se.jsx(RF,{id:t,size:H,opacity:te,animated:r,color:fe,node:y,active:re,selected:z})}),[f,t,fe,H,re,te,r,z,y]),B=q.useMemo(()=>{var $,he,de;return Y&&(Y||z||ie)&&R&&Se.jsxs(Se.Fragment,{children:[Se.jsx(Gt.group,{position:K,children:Se.jsx(Mc,{text:R,fontUrl:i,opacity:te,stroke:_.node.label.stroke,active:z||ie||O||A,color:z||ie||O||A?_.node.label.activeColor:_.node.label.color})}),F&&Se.jsx(Gt.group,{position:W,children:Se.jsx(Mc,{text:F,fontUrl:i,fontSize:5,opacity:te,stroke:($=_.node.subLabel)==null?void 0:$.stroke,active:z||ie||O||A,color:z||ie||O||A?(he=_.node.subLabel)==null?void 0:he.activeColor:(de=_.node.subLabel)==null?void 0:de.color})})]})},[ie,A,O,z,R,i,K,Y,te,F,W,_.node.label.activeColor,_.node.label.color,_.node.label.stroke,(m=_.node.subLabel)==null?void 0:m.activeColor,(v=_.node.subLabel)==null?void 0:v.color,(g=_.node.subLabel)==null?void 0:g.stroke]),I=q.useMemo(()=>ee&&s&&Se.jsx(jm,{prepend:!0,center:!0,children:s({data:y,canCollapse:D,isCollapsed:P,onCollapse:Q,onClose:()=>ge(!1)})}),[ee,s,y,D,P,Q]);return Se.jsxs(Gt.group,{renderOrder:1,userData:{id:t,type:"node"},ref:J,position:j,onPointerOver:xe,onPointerOut:ce,onClick:$=>{!e&&!O&&(o==null||o(y,{canCollapse:D,isCollapsed:P},$))},onDoubleClick:$=>{!e&&!O&&(a==null||a(y,$))},onContextMenu:()=>{e||(ge(!0),h==null||h(y,{canCollapse:D,isCollapsed:P,onCollapse:Q}))},...ye(),children:[Pe,I,B]})},NF=({animated:r,color:e="#D8E6EA",length:t,opacity:n=.5,position:i,rotation:s,size:o=1,onActive:a,onContextMenu:c})=>{const l=q.useMemo(()=>new Ne(e),[e]),u=q.useRef(null),h=Ue(g=>g.draggingIds.length>0),f=Ue(g=>g.centerPosition),[{pos:d,arrowOpacity:m}]=Gn(()=>({from:{pos:f?[f.x,f.y,f.z]:[0,0,0],arrowOpacity:0},to:{pos:[i.x,i.y,i.z],arrowOpacity:n},config:{...Vn,duration:r&&!h?void 0:0}}),[r,h,n,i]),v=q.useCallback(()=>{var g;const p=new G(0,1,0);(g=u.current)==null||g.quaternion.setFromUnitVectors(p,s)},[s,u]);return q.useEffect(()=>v(),[v]),Se.jsxs(Gt.mesh,{position:d,ref:u,scale:[1,1,1],onPointerOver:()=>a(!0),onPointerOut:()=>a(!1),onPointerDown:g=>{g.nativeEvent.buttons===2&&(g.stopPropagation(),c())},children:[Se.jsx("cylinderGeometry",{args:[0,o,t,20,1,!0],attach:"geometry"}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",color:l,depthTest:!1,opacity:m,transparent:!0,side:Dt,fog:!0})]})},FF=({curveOffset:r,animated:e,color:t="#000",curve:n,curved:i=!1,id:s,opacity:o=1,size:a=1,onContextMenu:c,onClick:l,onPointerOver:u,onPointerOut:h})=>{const f=q.useRef(null),d=Ue(_=>_.draggingIds.length>0),m=q.useMemo(()=>new Ne(t),[t]),v=Ue(_=>_.centerPosition),g=q.useRef(!1),{lineOpacity:p}=Gn({from:{lineOpacity:0},to:{lineOpacity:o},config:{...Vn,duration:e?void 0:0}});return Gn(()=>{const _=n.getPoint(0),y=n.getPoint(1);return{from:{fromVertices:g.current?[y==null?void 0:y.x,y==null?void 0:y.y,(y==null?void 0:y.z)||0]:[v==null?void 0:v.x,v==null?void 0:v.y,(v==null?void 0:v.z)||0],toVertices:[_==null?void 0:_.x,_==null?void 0:_.y,(_==null?void 0:_.z)||0]},to:{fromVertices:[_==null?void 0:_.x,_==null?void 0:_.y,(_==null?void 0:_.z)||0],toVertices:[y==null?void 0:y.x,y==null?void 0:y.y,(y==null?void 0:y.z)||0]},onChange:x=>{const{fromVertices:b,toVertices:w}=x.value,S=new G(...b),M=new G(...w),E=wc(S,0,M,0,i,r);f.current.copy(new ys(E,20,a/2,5,!1))},config:{...Vn,duration:e&&!d?void 0:0}}},[e,d,n,a]),q.useEffect(()=>{g.current=!0},[]),Se.jsxs("mesh",{userData:{id:s,type:"edge"},onPointerOver:u,onPointerOut:h,onClick:l,onPointerDown:_=>{_.nativeEvent.buttons===2&&(_.stopPropagation(),c())},children:[Se.jsx("tubeGeometry",{attach:"geometry",ref:f}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",opacity:p,fog:!0,transparent:!0,depthTest:!1,color:m})]})},Ly=3,kF=({animated:r,arrowPlacement:e="end",contextMenu:t,disabled:n,labelPlacement:i="inline",id:s,interpolation:o,labelFontUrl:a,onContextMenu:c,onClick:l,onPointerOver:u,onPointerOut:h})=>{const f=Ue(Q=>Q.theme),d=Ue(Q=>Q.draggingIds.length>0),[m,v]=q.useState(!1),[g,p]=q.useState(!1),_=Ue(Q=>Q.edges),y=_.find(Q=>Q.id===s),{target:x,source:b,label:w,labelVisible:S=!1,size:M=1,fill:E}=y,T=Ue(Q=>Q.nodes.find(j=>j.id===b)),L=Ue(Q=>Q.nodes.find(j=>j.id===x)),P=(M+f.edge.label.fontSize)/2,[A,z]=q.useMemo(()=>Ow(M),[M]),{curveOffset:V,curved:N}=q.useMemo(()=>bF({edge:y,edges:_,curved:o==="curved"}),[y,_,o]),[C,O,k]=q.useMemo(()=>{const Q=Sc(T),j=T.size,K=Sc(L),W=L.size;let ye=wc(Q,j,K,W,N,V);const[re,fe]=Uw(e,ye,A);return e==="end"&&(ye=wc(Q,j,re,0,N,V)),[ye,re,fe]},[T,L,N,V,e,A]),U=q.useMemo(()=>{let Q=Nw(T.position,L.position,Iw(P,i));if(N){const j=new G().subVectors(Q,C.getPoint(.5));switch(i){case"above":j.y=j.y-Ly;break;case"below":j.y=j.y+Ly;break}Q=Q.sub(j)}return Q},[T.position,L.position,P,i,N,C]),R=Ue(Q=>{var j;return(j=Q.selections)==null?void 0:j.includes(s)}),F=Ue(Q=>{var j;return(j=Q.selections)==null?void 0:j.length}),H=Ue(Q=>{var j;return(j=Q.actives)==null?void 0:j.includes(s)}),Y=Ue(Q=>Q.centerPosition),J=F?R||H?f.edge.selectedOpacity:f.edge.inactiveOpacity:f.edge.opacity,[{labelPosition:ie}]=Gn(()=>({from:{labelPosition:Y?[Y.x,Y.y,Y.z]:[0,0,0]},to:{labelPosition:[U.x,U.y,U.z]},config:{...Vn,duration:r&&!d?void 0:0}}),[U,r,d]),ne=q.useMemo(()=>new Ir(0,0,i==="natural"?0:Math.atan((L.position.y-T.position.y)/(L.position.x-T.position.x))),[L.position.x,L.position.y,T.position.x,T.position.y,i]);ds(m&&!d&&l!==void 0,"pointer");const{pointerOver:ee,pointerOut:ge}=fg({disabled:n,onPointerOver:Q=>{v(!0),u==null||u(y,Q)},onPointerOut:Q=>{v(!1),h==null||h(y,Q)}}),me=q.useMemo(()=>e!=="none"&&Se.jsx(NF,{animated:r,color:R||m||H?f.arrow.activeFill:E||f.arrow.fill,length:A,opacity:J,position:O,rotation:k,size:z,onActive:v,onContextMenu:()=>{n||(p(!0),c==null||c(y))}}),[E,m,r,A,e,O,k,z,n,y,H,R,c,J,f.arrow.activeFill,f.arrow.fill]),te=q.useMemo(()=>S&&w&&Se.jsx(Gt.group,{position:ie,onContextMenu:()=>{n||(p(!0),c==null||c(y))},onPointerOver:ee,onPointerOut:ge,children:Se.jsx(Mc,{text:w,ellipsis:15,fontUrl:a,stroke:f.edge.label.stroke,color:R||m||H?f.edge.label.activeColor:f.edge.label.color,opacity:J,fontSize:f.edge.label.fontSize,rotation:ne})}),[m,n,y,H,R,w,a,ie,ne,S,c,ge,ee,J,f.edge.label.activeColor,f.edge.label.color,f.edge.label.fontSize,f.edge.label.stroke]),D=q.useMemo(()=>g&&t&&Se.jsx(jm,{prepend:!0,center:!0,position:U,children:t({data:y,onClose:()=>p(!1)})}),[g,t,U,y]);return Se.jsxs("group",{children:[Se.jsx(FF,{curveOffset:V,animated:r,color:R||m||H?f.edge.activeFill:E||f.edge.fill,curve:C,curved:N,id:s,opacity:J,size:M,onClick:Q=>{n||l==null||l(y,Q)},onPointerOver:ee,onPointerOut:ge,onContextMenu:()=>{n||(p(!0),c==null||c(y))}}),me,te,D]})},Dy=new lr(0,0,0);function zF(r,e){const t=q.useRef(),n=Ue(l=>l.theme);Ue(l=>{t.current=l});const i=q.useRef(new Map);q.useRef(new lr(0,0,0));const s=q.useRef(),o=e==="curved",a=q.useCallback(l=>{const u=[],h=i.current,{nodes:f}=t.current,d=new Map(f.map(v=>[v.id,v])),m=n.edge.label.fontSize;return r!=="none"&&!s.current&&(s.current=new Ts(0,1,1,20,1,!0)),l.forEach(v=>{const{target:g,source:p,size:_=1}=v,y=d.get(p),x=d.get(g);if(!y||!x)return;const b=`${y.position.x},${y.position.y},${x.position.x},${x.position.y},${_}`;if(h.has(b)){u.push(h.get(b));return}const w=Sc(y),S=y.size+m,M=Sc(x),E=x.size+m;let T=wc(w,S,M,E,o),L=new ys(T,20,_/2,5,!1);if(r==="none"){u.push(L),h.set(b,L);return}const[P,A]=Ow(_),z=s.current.clone();z.scale(A,P,A);const[V,N]=Uw(r,T,P),C=new ln;if(C.setFromUnitVectors(new G(0,1,0),N),z.applyQuaternion(C),z.translate(V.x,V.y,V.z),r&&r==="end"){const k=wc(w,S,V,0,o);L=new ys(k,20,_/2,5,!1)}const O=Kc([L,z]);u.push(O),h.set(b,O)}),u},[r,o,n.edge.label.fontSize]),c=q.useCallback((l,u)=>{const h=a(l),f=a(u);return Kc([f.length?Kc(f):Dy,h.length?Kc(h):Dy],!0)},[a]);return{getGeometries:a,getGeometry:c}}function BF(r,e,t){const n=q.useRef(r);q.useEffect(()=>{n.current=r},[r]);const i=Ue(h=>h.edgeContextMenus),s=Ue(q.useCallback(h=>h.setEdgeContextMenus,[])),o=q.useRef(!1),a=q.useCallback(()=>{o.current=!0},[]),c=q.useRef(!1),l=q.useCallback(()=>{c.current=!0},[]),u=q.useCallback((h,f)=>{const{onClick:d,onContextMenu:m,onPointerOver:v,onPointerOut:g}=n.current;if(d&&o.current&&!t){o.current=!1;for(const p of f)d(p)}if((e||m)&&c.current&&!t){c.current=!1;const p=new Set(i);let _=!1;for(const y of f)i.has(y.id)||(p.add(y.id),_=!0,m==null||m(y));_&&s(p)}v&&f.filter(_=>!h.includes(_)).forEach(_=>{v(_)}),g&&h.filter(_=>!f.includes(_)).forEach(_=>{g(_)})},[e,t,i,s]);return{handleClick:a,handleContextMenu:l,handleIntersections:u}}function GF(r,e){const t=q.useRef(r),n=q.useRef();q.useEffect(()=>{t.current=r;const o=r.getAttribute("position");n.current=new Float32Array(o.array.length)},[r]);const i=q.useCallback(()=>{const o=t.current.getAttribute("position");return{from:new Float32Array(o.array.length),to:o.array}},[]),s=q.useCallback(o=>{const a=n.current;a.set(o);const c=new wt(a,3,!1);t.current.setAttribute("position",c),c.needsUpdate=!0},[]);Gn(()=>{if(!e)return null;const o=i();return{from:{positions:o.from},to:{positions:o.to},onChange:a=>{s(a.value.positions)},config:{...Vn,duration:e?void 0:0}}},[e,i,s])}function VF(r,e,t){const[{activeOpacity:n,inactiveOpacity:i}]=Gn(()=>({from:{activeOpacity:0,inactiveOpacity:0},to:{activeOpacity:e?t.edge.selectedOpacity:t.edge.opacity,inactiveOpacity:e?t.edge.inactiveOpacity:t.edge.opacity},config:{...Vn,duration:r?void 0:0}}),[r,e,t]);return{activeOpacity:n,inactiveOpacity:i}}const HF=({animated:r,color:e,contextMenu:t,edge:n,labelFontUrl:i,labelPlacement:s="inline",opacity:o})=>{const a=Ue(T=>T.theme),{target:c,source:l,label:u,labelVisible:h=!1,size:f=1}=n,d=Ue(T=>T.nodes),[m,v]=q.useMemo(()=>[d.find(T=>T.id===l),d.find(T=>T.id===c)],[d,l,c]),g=Ue(T=>T.draggingIds.length>0),p=q.useMemo(()=>(f+a.edge.label.fontSize)/2,[f,a.edge.label.fontSize]),_=q.useMemo(()=>Nw(m.position,v.position,Iw(p,s)),[m.position,v.position,p,s]),y=Ue(T=>T.edgeContextMenus),x=Ue(T=>T.setEdgeContextMenus),[{labelPosition:b}]=Gn(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[_.x,_.y,_.z]},config:{...Vn,duration:r&&!g?void 0:0}}),[_,r,g]),w=q.useCallback(T=>{y.delete(T),x(new Set(y))},[y,x]),S=q.useMemo(()=>s==="natural"?new Ir(0,0,0):new Ir(0,0,Math.atan2(v.position.y-m.position.y,v.position.x-m.position.x)),[s,v.position.y,v.position.x,m.position.y,m.position.x]),M=q.useMemo(()=>({prepend:!0,center:!0,position:_}),[_]),E=q.useMemo(()=>({text:u,ellipsis:15,fontUrl:i,stroke:a.edge.label.stroke,color:e,opacity:o,fontSize:a.edge.label.fontSize,rotation:S}),[u,i,a.edge.label.stroke,e,o,a.edge.label.fontSize,S]);return Se.jsxs("group",{children:[h&&u&&Se.jsx(Gt.group,{position:b,children:Se.jsx(Mc,{...E})}),t&&y.has(n.id)&&Se.jsx(jm,{...M,children:t({data:n,onClose:()=>w(n.id)})})]})},WF=({interpolation:r="linear",arrowPlacement:e="end",labelPlacement:t="inline",animated:n,contextMenu:i,disabled:s,edges:o,labelFontUrl:a,onClick:c,onContextMenu:l,onPointerOut:u,onPointerOver:h})=>{const f=Ue(U=>U.theme),{getGeometries:d,getGeometry:m}=zF(e,r),v=Ue(U=>U.draggingIds),g=Ue(U=>U.edgeMeshes),p=Ue(U=>U.setEdgeMeshes),_=Ue(U=>U.actives||[]),y=Ue(U=>U.selections||[]),[x,b,w,S]=q.useMemo(()=>{const U=[],R=[],F=[],H=[];return o.forEach(Y=>{if(v.includes(Y.source)||v.includes(Y.target)){y.includes(Y.id)||_.includes(Y.id)?F.push(Y):H.push(Y);return}y.includes(Y.id)||_.includes(Y.id)?U.push(Y):R.push(Y)}),[U,R,F,H]},[o,_,y,v]),M=!!y.length,E=q.useMemo(()=>m(x,b),[m,x,b]),{activeOpacity:T,inactiveOpacity:L}=VF(n,M,f);GF(E,n),q.useEffect(()=>{if(v.length===0){const R=d(o).map(F=>new Ot(F));p(R)}},[d,p,o,v.length]);const P=q.useRef(new Ot),A=q.useRef(new Ot),z=q.useCallback(U=>{if(!U.camera)return[];const R=U.intersectObjects(g);return R.length?R.map(F=>o[g.indexOf(F.object)]):[]},[g,o]),{handleClick:V,handleContextMenu:N,handleIntersections:C}=BF({onClick:c,onContextMenu:l,onPointerOut:u,onPointerOver:h},i,s),O=q.useRef([]),k=q.useRef([]);return uh(U=>{if(P.current.geometry=E,s)return;const R=O.current;if((v.length||v.length===0&&R!==null)&&(A.current.geometry=m(w,S)),O.current=v,v.length)return;const F=k.current,H=z(U.raycaster);C(F,H),H.join()!==F.join()&&(A.current.geometry=m(H,[])),k.current=H}),Se.jsxs("group",{onClick:V,onContextMenu:N,children:[Se.jsxs("mesh",{ref:P,children:[Se.jsx(Gt.meshBasicMaterial,{attach:"material-0",color:f.edge.fill,depthTest:!1,fog:!0,opacity:L,side:Dt,transparent:!0}),Se.jsx(Gt.meshBasicMaterial,{attach:"material-1",color:f.edge.activeFill,depthTest:!1,fog:!0,opacity:T,side:Dt,transparent:!0})]}),Se.jsxs("mesh",{ref:A,children:[Se.jsx(Gt.meshBasicMaterial,{attach:"material-0",color:f.edge.fill,depthTest:!1,fog:!0,opacity:L,side:Dt,transparent:!0}),Se.jsx(Gt.meshBasicMaterial,{attach:"material-1",color:f.edge.activeFill,depthTest:!1,fog:!0,opacity:T,side:Dt,transparent:!0})]}),o.map(U=>Se.jsx(HF,{animated:n,contextMenu:i,color:f.edge.label.color,disabled:s,edge:U,labelFontUrl:a,labelPlacement:t},U.id))]})},XF=({outerRadius:r,innerRadius:e,padding:t,normalizedFill:n,normalizedStroke:i,opacity:s,animated:o,theme:a})=>{var c;const{opacity:l}=Gn({from:{opacity:0},to:{opacity:s},config:{...Vn,duration:o?void 0:0}});return Se.jsxs(Se.Fragment,{children:[Se.jsxs("mesh",{children:[Se.jsx("ringGeometry",{attach:"geometry",args:[r,0,128]}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",color:n,transparent:!0,depthTest:!1,opacity:(c=a.cluster)!=null&&c.fill?l:0,side:Dt,fog:!0})]}),Se.jsxs("mesh",{children:[Se.jsx("ringGeometry",{attach:"geometry",args:[r,e+t,128]}),Se.jsx(Gt.meshBasicMaterial,{attach:"material",color:i,transparent:!0,depthTest:!1,opacity:l,side:Dt,fog:!0})]})]})},qF=({animated:r,position:e,padding:t=40,labelFontUrl:n,disabled:i,radius:s=2,nodes:o,label:a,onClick:c,onPointerOver:l,onPointerOut:u,draggable:h=!1,onDragged:f,onRender:d})=>{var m,v,g,p,_,y,x;const b=Ue(D=>D.theme),w=Math.max(e.width,e.height)/2,S=w-s+t,[M,E]=q.useState(!1),T=Ue(D=>D.centerPosition),L=Ue(D=>D.nodes),P=Mh(),A=Ue(D=>D.draggingIds),z=A.includes(a),V=A.length>0,N=Ue(D=>{var Q;return(Q=D.actives)==null?void 0:Q.some(j=>o.some(K=>K.id===j))}),C=Ue(D=>D.hoveredNodeId),O=Ue(D=>{var Q;return(Q=D.selections)==null?void 0:Q.some(j=>o.some(K=>K.id===j))}),U=Ue(D=>{var Q;return((Q=D.selections)==null?void 0:Q.length)>0})?O||M||N?(m=b.cluster)==null?void 0:m.selectedOpacity:(v=b.cluster)==null?void 0:v.inactiveOpacity:(g=b.cluster)==null?void 0:g.opacity,R=q.useMemo(()=>{var D,Q;const j=[0,-S,2],K=(Q=(D=b.cluster)==null?void 0:D.label)==null?void 0:Q.offset;return K?[j[0]-K[0],j[1]-K[1],j[2]-K[2]]:j},[S,(_=(p=b.cluster)==null?void 0:p.label)==null?void 0:_.offset]),{circlePosition:F}=Gn({from:{circlePosition:[T.x,T.y,-1]},to:{circlePosition:e?[e.x,e.y,-1]:[0,0,-1]},config:{...Vn,duration:r&&!V?void 0:0}}),H=q.useMemo(()=>{var D;return new Ne((D=b.cluster)==null?void 0:D.stroke)},[(y=b.cluster)==null?void 0:y.stroke]),Y=q.useMemo(()=>{var D;return new Ne((D=b.cluster)==null?void 0:D.fill)},[(x=b.cluster)==null?void 0:x.fill]),J=Ue(D=>D.addDraggingId),ie=Ue(D=>D.removeDraggingId),ne=Ue(D=>D.setClusterPosition),ee=Fw({draggable:h&&!C,position:{x:e.x,y:e.y,z:-1},set:D=>ne(a,D),onDragStart:()=>{J(a),E(!0)},onDragEnd:()=>{ie(a),E(!1);const D=L.filter(Q=>Q.cluster===a);f==null||f({nodes:D,label:a})}});ds(M&&!V&&c!==void 0,"pointer"),ds(M&&h&&!z&&c===void 0,"grab"),ds(z,"grabbing");const{pointerOver:ge,pointerOut:me}=fg({disabled:i,onPointerOver:D=>{E(!0),P.freeze(),l==null||l({nodes:o,label:a},D)},onPointerOut:D=>{E(!1),P.unFreeze(),u==null||u({nodes:o,label:a},D)}});return q.useMemo(()=>{var D,Q,j;return b.cluster&&Se.jsx(Gt.group,{userData:{id:a,type:"cluster"},position:F,onPointerOver:ge,onPointerOut:me,onClick:K=>{!i&&!z&&(c==null||c({nodes:o,label:a},K))},...ee(),children:d?d({label:{position:R,text:a,opacity:U,fontUrl:n},opacity:U,outerRadius:S,innerRadius:w,padding:t,theme:b}):Se.jsxs(Se.Fragment,{children:[Se.jsx(XF,{outerRadius:S,innerRadius:w,padding:t,normalizedFill:Y,normalizedStroke:H,opacity:U,animated:r,theme:b}),((D=b.cluster)==null?void 0:D.label)&&Se.jsx(Gt.group,{position:R,children:Se.jsx(Mc,{text:a,opacity:U,fontUrl:n,stroke:b.cluster.label.stroke,active:!1,color:(Q=b.cluster)==null?void 0:Q.label.color,fontSize:((j=b.cluster)==null?void 0:j.label.fontSize)??12})})]})})},[b,F,ge,me,S,Y,w,t,H,R,a,U,n,i,c,o,ee,z,d,r])},YF=q.forwardRef(({onNodeClick:r,onNodeDoubleClick:e,onNodeContextMenu:t,onEdgeContextMenu:n,onEdgeClick:i,onEdgePointerOver:s,onEdgePointerOut:o,onNodePointerOver:a,onNodePointerOut:c,onClusterClick:l,onNodeDragged:u,onClusterDragged:h,onClusterPointerOver:f,onClusterPointerOut:d,contextMenu:m,animated:v,disabled:g,draggable:p,constrainDragging:_=!1,edgeLabelPosition:y,edgeArrowPosition:x,edgeInterpolation:b="linear",labelFontUrl:w,renderNode:S,onRenderCluster:M,...E},T)=>{const{layoutType:L,clusterAttribute:P}=E,A=Kt(ee=>ee.gl),z=Kt(ee=>ee.scene),V=Kt(ee=>ee.camera),{updateLayout:N}=AF({...E,constrainDragging:_});if(P&&!(L==="forceDirected2d"||L==="forceDirected3d"))throw new Error("Clustering is only supported for the force directed layouts.");const C=Ue(ee=>ee.graph),O=Ue(ee=>ee.nodes),k=Ue(ee=>ee.edges),U=Ue(ee=>[...ee.clusters.values()]),{centerNodesById:R,fitNodesInViewById:F,isCentered:H}=IF({animated:v,disabled:g,layoutType:L});q.useImperativeHandle(T,()=>({centerGraph:R,fitNodesInView:F,graph:C,renderScene:()=>A.render(z,V)}),[R,F,C,A,z,V]);const Y=q.useCallback(ee=>{u==null||u(ee),P&&N()},[P,u,N]),J=q.useMemo(()=>O.map(ee=>Se.jsx(OF,{id:ee==null?void 0:ee.id,labelFontUrl:w,draggable:p,constrainDragging:_,disabled:g,animated:v,contextMenu:m,renderNode:S,onClick:r,onDoubleClick:e,onContextMenu:t,onPointerOver:a,onPointerOut:c,onDragged:Y},ee==null?void 0:ee.id)),[_,v,m,g,p,w,O,r,t,e,Y,c,a,S]),ie=q.useMemo(()=>v?k.map(ee=>Se.jsx(kF,{id:ee.id,disabled:g,animated:v,labelFontUrl:w,labelPlacement:y,arrowPlacement:x,interpolation:b,contextMenu:m,onClick:i,onContextMenu:n,onPointerOver:s,onPointerOut:o},ee.id)):Se.jsx(WF,{edges:k,disabled:g,animated:v,labelFontUrl:w,labelPlacement:y,arrowPlacement:x,interpolation:b,contextMenu:m,onClick:i,onContextMenu:n,onPointerOver:s,onPointerOut:o}),[v,m,g,x,b,y,k,w,i,n,o,s]),ne=q.useMemo(()=>U.map(ee=>Se.jsx(qF,{animated:v,disabled:g,draggable:p,labelFontUrl:w,onClick:l,onPointerOver:f,onPointerOut:d,onDragged:h,onRender:M,...ee},ee.label)),[v,U,g,p,w,l,d,f,h,M]);return H&&Se.jsxs(q.Fragment,{children:[ie,J,ne]})}),jF={canvas:{background:"#1E2026"},node:{fill:"#7A8C9E",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC"},subLabel:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#54616D",activeFill:"#1DE9AC"},edge:{fill:"#474B56",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#1E2026",color:"#ACBAC7",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#474B56",activeFill:"#1DE9AC"},cluster:{stroke:"#474B56",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#1E2026",color:"#ACBAC7"}}},$F={canvas:{background:"#fff"},node:{fill:"#7CA0AB",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{color:"#2A6475",stroke:"#fff",activeColor:"#1DE9AC"},subLabel:{color:"#ddd",stroke:"transparent",activeColor:"#1DE9AC"}},lasso:{border:"1px solid #55aaff",background:"rgba(75, 160, 255, 0.1)"},ring:{fill:"#D8E6EA",activeFill:"#1DE9AC"},edge:{fill:"#D8E6EA",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475",activeColor:"#1DE9AC",fontSize:6}},arrow:{fill:"#D8E6EA",activeFill:"#1DE9AC"},cluster:{stroke:"#D8E6EA",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475"}}};function eu(r,e,t){const{offsetX:n,offsetY:i}=r,{width:s,height:o}=t;e.set(n/s*2-1,-(i/o)*2+1)}function ZF(r){const e=document.createElement("div");return e.style.pointerEvents="none",e.style.border=r.lasso.border,e.style.backgroundColor=r.lasso.background,e.style.position="fixed",e}const KF=({children:r,type:e="none",onLasso:t,onLassoEnd:n,disabled:i})=>{var s;const o=Ue(A=>A.theme),a=Kt(A=>A.camera),c=Kt(A=>A.gl),l=Kt(A=>A.setEvents),u=Kt(A=>A.size),h=Kt(A=>A.get),f=Kt(A=>A.scene),d=Mh(),m=Ue(A=>A.actives),v=Ue(A=>A.setActives),g=Ue(A=>A.edges),p=Ue(A=>A.edgeMeshes),_=q.useRef(!1),y=q.useRef(null),x=q.useRef(null),b=q.useRef(ZF(o)),w=q.useRef(null),S=q.useRef(!1),M=q.useRef(h().events.enabled),E=q.useRef((s=d.controls)==null?void 0:s.enabled);q.useEffect(()=>{_.current&&(t==null||t(m)),_.current=!0},[m,t]);const T=q.useCallback(A=>{if(S.current){const[z,V,N]=w.current;N.x=Math.max(z.x,A.clientX),N.y=Math.max(z.y,A.clientY),V.x=Math.min(z.x,A.clientX),V.y=Math.min(z.y,A.clientY),b.current.style.left=`${V.x}px`,b.current.style.top=`${V.y}px`,b.current.style.width=`${N.x-V.x}px`,b.current.style.height=`${N.y-V.y}px`,eu(A,y.current.endPoint,u),eu(A,x.current.endPoint,u);const C=[],O=x.current.select().sort(U=>U.uuid).map(U=>g[p.indexOf(U)].id);C.push(...O);const k=y.current.select().sort(U=>U.uuid).filter(U=>{var R,F;return U.isMesh&&((R=U.userData)==null?void 0:R.id)&&(((F=U.userData)==null?void 0:F.type)===e||e==="all")}).map(U=>U.userData.id);C.push(...k),requestAnimationFrame(()=>{v(C)}),document.addEventListener("pointermove",T,{passive:!0,capture:!0,once:!0})}},[g,p,v,u,e]),L=q.useCallback(()=>{var A;S.current&&(l({enabled:M.current}),S.current=!1,(A=b.current.parentElement)==null||A.removeChild(b.current),d.controls.enabled=E.current,n==null||n(m),document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",L))},[l,d.controls,n,m,T]),P=q.useCallback(A=>{var z,V;if(A.shiftKey){M.current=h().events.enabled,E.current=(z=d.controls)==null?void 0:z.enabled,y.current=new Vg(a,f);const N=new ac;p.length&&N.add(...p),x.current=new Vg(a,N),w.current=[new be,new be,new be];const[C]=w.current;d.controls.enabled=!1,l({enabled:!1}),S.current=!0,(V=c.domElement.parentElement)==null||V.appendChild(b.current),b.current.style.left=`${A.clientX}px`,b.current.style.top=`${A.clientY}px`,b.current.style.width="0px",b.current.style.height="0px",C.x=A.clientX,C.y=A.clientY,eu(A,y.current.startPoint,u),eu(A,x.current.startPoint,u),document.addEventListener("pointermove",T,{passive:!0,capture:!0,once:!0}),document.addEventListener("pointerup",L,{passive:!0})}},[a,d.controls,p,h,c.domElement.parentElement,T,L,f,l,u]);return q.useEffect(()=>{if(!(i||e==="none"))return typeof window<"u"&&(document.addEventListener("pointerdown",P,{passive:!0}),document.addEventListener("pointermove",T,{passive:!0}),document.addEventListener("pointerup",L,{passive:!0})),()=>{typeof window<"u"&&(document.removeEventListener("pointerdown",P),document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",L))}},[e,i,P,T,L]),Se.jsx("group",{children:r})},JF="_canvas_670zp_1",QF={canvas:JF},ek={alpha:!0,antialias:!0},tk={position:[0,0,1e3],near:5,far:5e4,fov:10},nk=q.forwardRef(({cameraMode:r="pan",layoutType:e="forceDirected2d",sizingType:t="default",labelType:n="auto",theme:i=$F,animated:s=!0,defaultNodeSize:o=7,minNodeSize:a=5,maxNodeSize:c=15,lassoType:l="none",glOptions:u={},edges:h,children:f,nodes:d,minDistance:m,maxDistance:v,onCanvasClick:g,disabled:p,onLasso:_,onLassoEnd:y,...x},b)=>{var w,S;const M=q.useRef(null),E=q.useRef(null),T=q.useRef(null);q.useImperativeHandle(b,()=>({centerGraph:(N,C)=>{var O;return(O=M.current)==null?void 0:O.centerGraph(N,C)},fitNodesInView:(N,C)=>{var O;return(O=M.current)==null?void 0:O.fitNodesInView(N,C)},zoomIn:()=>{var N;return(N=E.current)==null?void 0:N.zoomIn()},zoomOut:()=>{var N;return(N=E.current)==null?void 0:N.zoomOut()},dollyIn:N=>{var C;return(C=E.current)==null?void 0:C.dollyIn(N)},dollyOut:N=>{var C;return(C=E.current)==null?void 0:C.dollyOut(N)},panLeft:()=>{var N;return(N=E.current)==null?void 0:N.panLeft()},panRight:()=>{var N;return(N=E.current)==null?void 0:N.panRight()},panDown:()=>{var N;return(N=E.current)==null?void 0:N.panDown()},panUp:()=>{var N;return(N=E.current)==null?void 0:N.panUp()},resetControls:N=>{var C;return(C=E.current)==null?void 0:C.resetControls(N)},getControls:()=>{var N;return(N=E.current)==null?void 0:N.controls},getGraph:()=>{var N;return(N=M.current)==null?void 0:N.graph},exportCanvas:()=>(M.current.renderScene(),T.current.toDataURL()),freeze:()=>{var N;return(N=E.current)==null?void 0:N.freeze()},unFreeze:()=>{var N;return(N=E.current)==null?void 0:N.unFreeze()}}));const{selections:L,actives:P,collapsedNodeIds:A}=x,z=h.length+d.length>400?!1:s,V=q.useMemo(()=>({...u,...ek}),[u]);return Se.jsx("div",{className:QF.canvas,children:Se.jsx(XL,{legacy:!0,linear:!0,ref:T,flat:!0,gl:V,camera:tk,onPointerMissed:g,children:Se.jsxs(EF,{createStore:()=>MF({selections:L,actives:P,theme:i,collapsedNodeIds:A}),children:[((w=i.canvas)==null?void 0:w.background)&&Se.jsx("color",{attach:"background",args:[i.canvas.background]}),Se.jsx("ambientLight",{intensity:1}),f,((S=i.canvas)==null?void 0:S.fog)&&Se.jsx("fog",{attach:"fog",args:[i.canvas.fog,4e3,9e3]}),Se.jsx(PF,{mode:r,ref:E,disabled:p,minDistance:m,maxDistance:v,animated:s,children:Se.jsx(KF,{disabled:p,type:l,onLasso:_,onLassoEnd:y,children:Se.jsx(q.Suspense,{children:Se.jsx(YF,{ref:M,disabled:p,animated:z,edges:h,nodes:d,layoutType:e,sizingType:t,labelType:n,defaultNodeSize:o,minNodeSize:a,maxNodeSize:c,...x})})})})]})})})}),tu={identity:"#22d3ee",knowledge:"#6366f1",rules:"#a78bfa",events:"#fbbf24"},ik={identity:"Identität",knowledge:"Wissen",rules:"Regeln",events:"Ereignisse"},Rd=new Set(["auto","agent","hermes"]);function hk({data:r,onDelete:e}){const[t,n]=q.useState(null),i=q.useMemo(()=>{const l={};return r.edges.forEach(u=>{l[u.source]=(l[u.source]||0)+1,l[u.target]=(l[u.target]||0)+1}),l},[r]),s=q.useMemo(()=>r.nodes.map(l=>({id:l.id,label:l.content.length>26?l.content.slice(0,25)+"…":l.content,fill:tu[l.category]||"#64748b",size:6+Math.min(i[l.id]||0,6)*2})),[r,i]),o=q.useMemo(()=>r.edges.map(l=>({id:`${l.source}->${l.target}`,source:l.source,target:l.target,size:.4+l.weight})),[r]),a=t?r.nodes.find(l=>l.id===t)??null:null,c=q.useMemo(()=>{if(!t)return[];const l=new Set;return r.edges.forEach(u=>{u.source===t&&l.add(u.target),u.target===t&&l.add(u.source)}),r.nodes.filter(u=>l.has(u.id))},[t,r]);return r.nodes.length?Se.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_280px] gap-3",children:[Se.jsx("div",{className:"relative h-[480px] rounded-2xl border border-border/60 bg-[#070a0f] overflow-hidden",children:Se.jsx(nk,{nodes:s,edges:o,theme:jF,layoutType:"forceDirected2d",labelType:"nodes",edgeArrowPosition:"none",draggable:!0,onNodeClick:l=>n(l.id),onCanvasClick:()=>n(null)})}),Se.jsx("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 min-h-[480px]",children:a?Se.jsxs(Se.Fragment,{children:[Se.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[Se.jsx("span",{className:"w-3 h-3 rounded-full",style:{background:tu[a.category],boxShadow:`0 0 0 2px ${Rd.has(a.source)?"#34d399":"#475569"}`}}),Se.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",style:{color:tu[a.category]},children:ik[a.category]||a.category}),Se.jsxs("span",{className:`ml-auto text-[10px] font-mono flex items-center gap-1 ${Rd.has(a.source)?"text-emerald-400":"text-muted-foreground/70"}`,children:[Rd.has(a.source)&&Se.jsx(Qw,{className:"h-2.5 w-2.5"}),a.source]})]}),Se.jsx("div",{className:"text-sm text-foreground leading-relaxed mb-4 break-words",children:a.content}),Se.jsxs("div",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70 mb-2 flex items-center gap-1",children:[Se.jsx(Cg,{className:"h-3 w-3"})," verwandte Fakten"]}),Se.jsx("div",{className:"flex flex-col gap-1.5 mb-4",children:c.length?c.map(l=>Se.jsxs("button",{onClick:()=>n(l.id),className:"flex items-center gap-2 text-[11px] text-muted-foreground hover:text-foreground text-left transition-colors",children:[Se.jsx("span",{className:"w-1.5 h-1.5 rounded-full shrink-0",style:{background:tu[l.category]}}),Se.jsx("span",{className:"truncate",children:l.content})]},l.id)):Se.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:"—"})}),Se.jsxs("button",{onClick:()=>{e(a.id),n(null)},className:"flex items-center gap-1.5 text-[11px] text-red-400 border border-red-500/20 rounded-lg px-2.5 py-1.5 hover:bg-red-500/5 transition-all",children:[Se.jsx(eS,{className:"h-3.5 w-3.5"})," vergessen"]})]}):Se.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-center text-muted-foreground/70 gap-2 pt-24",children:[Se.jsx(Cg,{className:"h-6 w-6"}),Se.jsx("div",{className:"text-xs max-w-[180px] leading-relaxed",children:"Einen Knoten wählen, um den Fakt und seine semantischen Nachbarn zu sehen."})]})})]}):Se.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Noch keine Fakten — der Graph füllt sich, sobald Hermes lernt oder du Einträge anlegst."})}export{hk as GraphView}; diff --git a/frontend/dist/assets/index-BNlNRfcu.js b/frontend/dist/assets/index-BNlNRfcu.js deleted file mode 100644 index c9e0df8..0000000 --- a/frontend/dist/assets/index-BNlNRfcu.js +++ /dev/null @@ -1,564 +0,0 @@ -var hM=Object.defineProperty;var L1=e=>{throw TypeError(e)};var pM=(e,t,r)=>t in e?hM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Ql=(e,t,r)=>pM(e,typeof t!="symbol"?t+"":t,r),zm=(e,t,r)=>t.has(e)||L1("Cannot "+r);var L=(e,t,r)=>(zm(e,t,"read from private field"),r?r.call(e):t.get(e)),De=(e,t,r)=>t.has(e)?L1("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,r),xe=(e,t,r,n)=>(zm(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),We=(e,t,r)=>(zm(e,t,"access private method"),r);var wd=(e,t,r,n)=>({set _(a){xe(e,t,a,r)},get _(){return L(e,t,n)}});function mM(e,t){for(var r=0;rn[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&n(c)}).observe(document,{childList:!0,subtree:!0});function r(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(a){if(a.ep)return;a.ep=!0;const o=r(a);fetch(a.href,o)}})();function cy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fm={exports:{}},Yl={},Bm={exports:{}},Fe={};/** - * @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 z1;function gM(){if(z1)return Fe;z1=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=g&&D[g]||D["@@iterator"],typeof D=="function"?D:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,k={};function S(D,T,Z){this.props=D,this.context=T,this.refs=k,this.updater=Z||b}S.prototype.isReactComponent={},S.prototype.setState=function(D,T){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,T,"setState")},S.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function N(){}N.prototype=S.prototype;function E(D,T,Z){this.props=D,this.context=T,this.refs=k,this.updater=Z||b}var O=E.prototype=new N;O.constructor=E,j(O,S.prototype),O.isPureReactComponent=!0;var P=Array.isArray,_=Object.prototype.hasOwnProperty,C={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function B(D,T,Z){var oe,re={},ue=null,me=null;if(T!=null)for(oe in T.ref!==void 0&&(me=T.ref),T.key!==void 0&&(ue=""+T.key),T)_.call(T,oe)&&!I.hasOwnProperty(oe)&&(re[oe]=T[oe]);var Pe=arguments.length-2;if(Pe===1)re.children=Z;else if(1>>1,T=Y[D];if(0>>1;Da(re,Q))uea(me,re)?(Y[D]=me,Y[ue]=Q,D=ue):(Y[D]=re,Y[oe]=Q,D=oe);else if(uea(me,Q))Y[D]=me,Y[ue]=Q,D=ue;else break e}}return V}function a(Y,V){var Q=Y.sortIndex-V.sortIndex;return Q!==0?Q:Y.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var c=Date,l=c.now();e.unstable_now=function(){return c.now()-l}}var f=[],h=[],p=1,g=null,x=3,b=!1,j=!1,k=!1,S=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(Y){for(var V=r(h);V!==null;){if(V.callback===null)n(h);else if(V.startTime<=Y)n(h),V.sortIndex=V.expirationTime,t(f,V);else break;V=r(h)}}function P(Y){if(k=!1,O(Y),!j)if(r(f)!==null)j=!0,be(_);else{var V=r(h);V!==null&&de(P,V.startTime-Y)}}function _(Y,V){j=!1,k&&(k=!1,N(B),B=-1),b=!0;var Q=x;try{for(O(V),g=r(f);g!==null&&(!(g.expirationTime>V)||Y&&!X());){var D=g.callback;if(typeof D=="function"){g.callback=null,x=g.priorityLevel;var T=D(g.expirationTime<=V);V=e.unstable_now(),typeof T=="function"?g.callback=T:g===r(f)&&n(f),O(V)}else n(f);g=r(f)}if(g!==null)var Z=!0;else{var oe=r(h);oe!==null&&de(P,oe.startTime-V),Z=!1}return Z}finally{g=null,x=Q,b=!1}}var C=!1,I=null,B=-1,U=5,G=-1;function X(){return!(e.unstable_now()-GY||125D?(Y.sortIndex=Q,t(h,Y),r(f)===null&&Y===r(h)&&(k?(N(B),B=-1):k=!0,de(P,Q-D))):(Y.sortIndex=T,t(f,Y),j||b||(j=!0,be(_))),Y},e.unstable_shouldYield=X,e.unstable_wrapCallback=function(Y){var V=x;return function(){var Q=x;x=V;try{return Y.apply(this,arguments)}finally{x=Q}}}})(Hm)),Hm}var H1;function bM(){return H1||(H1=1,Wm.exports=xM()),Wm.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 K1;function wM(){if(K1)return kr;K1=1;var e=Vs(),t=bM();function r(i){for(var s="https://reactjs.org/docs/error-decoder.html?invariant="+i,d=1;d"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,h=/^[: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]*$/,p={},g={};function x(i){return f.call(g,i)?!0:f.call(p,i)?!1:h.test(i)?g[i]=!0:(p[i]=!0,!1)}function b(i,s,d,m){if(d!==null&&d.type===0)return!1;switch(typeof s){case"function":case"symbol":return!0;case"boolean":return m?!1:d!==null?!d.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function j(i,s,d,m){if(s===null||typeof s>"u"||b(i,s,d,m))return!0;if(m)return!1;if(d!==null)switch(d.type){case 3:return!s;case 4:return s===!1;case 5:return isNaN(s);case 6:return isNaN(s)||1>s}return!1}function k(i,s,d,m,y,w,A){this.acceptsBooleans=s===2||s===3||s===4,this.attributeName=m,this.attributeNamespace=y,this.mustUseProperty=d,this.propertyName=i,this.type=s,this.sanitizeURL=w,this.removeEmptyString=A}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){S[i]=new k(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var s=i[0];S[s]=new k(s,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){S[i]=new k(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){S[i]=new k(i,2,!1,i,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(i){S[i]=new k(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){S[i]=new k(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){S[i]=new k(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){S[i]=new k(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){S[i]=new k(i,5,!1,i.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function E(i){return i[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(i){var s=i.replace(N,E);S[s]=new k(s,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var s=i.replace(N,E);S[s]=new k(s,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var s=i.replace(N,E);S[s]=new k(s,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){S[i]=new k(i,1,!1,i.toLowerCase(),null,!1,!1)}),S.xlinkHref=new k("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){S[i]=new k(i,1,!1,i.toLowerCase(),null,!0,!0)});function O(i,s,d,m){var y=S.hasOwnProperty(s)?S[s]:null;(y!==null?y.type!==0:m||!(2M||y[A]!==w[M]){var R=` -`+y[A].replace(" at new "," at ");return i.displayName&&R.includes("")&&(R=R.replace("",i.displayName)),R}while(1<=A&&0<=M);break}}}finally{Z=!1,Error.prepareStackTrace=d}return(i=i?i.displayName||i.name:"")?T(i):""}function re(i){switch(i.tag){case 5:return T(i.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return i=oe(i.type,!1),i;case 11:return i=oe(i.type.render,!1),i;case 1:return i=oe(i.type,!0),i;default:return""}}function ue(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case I:return"Fragment";case C:return"Portal";case U:return"Profiler";case B:return"StrictMode";case fe:return"Suspense";case J:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case X:return(i.displayName||"Context")+".Consumer";case G:return(i._context.displayName||"Context")+".Provider";case $:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case pe:return s=i.displayName||null,s!==null?s:ue(i.type)||"Memo";case be:s=i._payload,i=i._init;try{return ue(i(s))}catch{}}return null}function me(i){var s=i.type;switch(i.tag){case 24:return"Cache";case 9:return(s.displayName||"Context")+".Consumer";case 10:return(s._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=s.render,i=i.displayName||i.name||"",s.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return s;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ue(s);case 8:return s===B?"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 s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s}return null}function Pe(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function te(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function ve(i){var s=te(i)?"checked":"value",d=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),m=""+i[s];if(!i.hasOwnProperty(s)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var y=d.get,w=d.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return y.call(this)},set:function(A){m=""+A,w.call(this,A)}}),Object.defineProperty(i,s,{enumerable:d.enumerable}),{getValue:function(){return m},setValue:function(A){m=""+A},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Oe(i){i._valueTracker||(i._valueTracker=ve(i))}function ie(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var d=s.getValue(),m="";return i&&(m=te(i)?i.checked?"true":"false":i.value),i=m,i!==d?(s.setValue(i),!0):!1}function Je(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function Be(i,s){var d=s.checked;return Q({},s,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??i._wrapperState.initialChecked})}function _e(i,s){var d=s.defaultValue==null?"":s.defaultValue,m=s.checked!=null?s.checked:s.defaultChecked;d=Pe(s.value!=null?s.value:d),i._wrapperState={initialChecked:m,initialValue:d,controlled:s.type==="checkbox"||s.type==="radio"?s.checked!=null:s.value!=null}}function jt(i,s){s=s.checked,s!=null&&O(i,"checked",s,!1)}function ur(i,s){jt(i,s);var d=Pe(s.value),m=s.type;if(d!=null)m==="number"?(d===0&&i.value===""||i.value!=d)&&(i.value=""+d):i.value!==""+d&&(i.value=""+d);else if(m==="submit"||m==="reset"){i.removeAttribute("value");return}s.hasOwnProperty("value")?Yn(i,s.type,d):s.hasOwnProperty("defaultValue")&&Yn(i,s.type,Pe(s.defaultValue)),s.checked==null&&s.defaultChecked!=null&&(i.defaultChecked=!!s.defaultChecked)}function Qn(i,s,d){if(s.hasOwnProperty("value")||s.hasOwnProperty("defaultValue")){var m=s.type;if(!(m!=="submit"&&m!=="reset"||s.value!==void 0&&s.value!==null))return;s=""+i._wrapperState.initialValue,d||s===i.value||(i.value=s),i.defaultValue=s}d=i.name,d!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,d!==""&&(i.name=d)}function Yn(i,s,d){(s!=="number"||Je(i.ownerDocument)!==i)&&(d==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+d&&(i.defaultValue=""+d))}var sn=Array.isArray;function Fr(i,s,d,m){if(i=i.options,s){s={};for(var y=0;y"+s.valueOf().toString()+"",s=Sa.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;s.firstChild;)i.appendChild(s.firstChild)}});function Mi(i,s){if(s){var d=i.firstChild;if(d&&d===i.lastChild&&d.nodeType===3){d.nodeValue=s;return}}i.textContent=s}var Ii={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},fc=["Webkit","ms","Moz","O"];Object.keys(Ii).forEach(function(i){fc.forEach(function(s){s=s+i.charAt(0).toUpperCase()+i.substring(1),Ii[s]=Ii[i]})});function ul(i,s,d){return s==null||typeof s=="boolean"||s===""?"":d||typeof s!="number"||s===0||Ii.hasOwnProperty(i)&&Ii[i]?(""+s).trim():s+"px"}function cl(i,s){i=i.style;for(var d in s)if(s.hasOwnProperty(d)){var m=d.indexOf("--")===0,y=ul(d,s[d],m);d==="float"&&(d="cssFloat"),m?i.setProperty(d,y):i[d]=y}}var F=Q({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 he(i,s){if(s){if(F[i]&&(s.children!=null||s.dangerouslySetInnerHTML!=null))throw Error(r(137,i));if(s.dangerouslySetInnerHTML!=null){if(s.children!=null)throw Error(r(60));if(typeof s.dangerouslySetInnerHTML!="object"||!("__html"in s.dangerouslySetInnerHTML))throw Error(r(61))}if(s.style!=null&&typeof s.style!="object")throw Error(r(62))}}function Ae(i,s){if(i.indexOf("-")===-1)return typeof s.is=="string";switch(i){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 Ue=null;function Ye(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Jt=null,tt=null,yt=null;function Na(i){if(i=Tl(i)){if(typeof Jt!="function")throw Error(r(280));var s=i.stateNode;s&&(s=Rc(s),Jt(i.stateNode,i.type,s))}}function dl(i){tt?yt?yt.push(i):yt=[i]:tt=i}function hc(){if(tt){var i=tt,s=yt;if(yt=tt=null,Na(i),s)for(i=0;i>>=0,i===0?32:31-(C_(i)/O_|0)|0}var yc=64,xc=4194304;function gl(i){switch(i&-i){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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function bc(i,s){var d=i.pendingLanes;if(d===0)return 0;var m=0,y=i.suspendedLanes,w=i.pingedLanes,A=d&268435455;if(A!==0){var M=A&~y;M!==0?m=gl(M):(w&=A,w!==0&&(m=gl(w)))}else A=d&~y,A!==0?m=gl(A):w!==0&&(m=gl(w));if(m===0)return 0;if(s!==0&&s!==m&&(s&y)===0&&(y=m&-m,w=s&-s,y>=w||y===16&&(w&4194240)!==0))return s;if((m&4)!==0&&(m|=d&16),s=i.entangledLanes,s!==0)for(i=i.entanglements,s&=m;0d;d++)s.push(i);return s}function vl(i,s,d){i.pendingLanes|=s,s!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,s=31-ln(s),i[s]=d}function T_(i,s){var d=i.pendingLanes&~s;i.pendingLanes=s,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=s,i.mutableReadLanes&=s,i.entangledLanes&=s,s=i.entanglements;var m=i.eventTimes;for(i=i.expirationTimes;0=Nl),_x=" ",Mx=!1;function Ix(i,s){switch(i){case"keyup":return l5.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Tx(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Io=!1;function c5(i,s){switch(i){case"compositionend":return Tx(s);case"keypress":return s.which!==32?null:(Mx=!0,_x);case"textInput":return i=s.data,i===_x&&Mx?null:i;default:return null}}function d5(i,s){if(Io)return i==="compositionend"||!xp&&Ix(i,s)?(i=Nx(),Nc=hp=Li=null,Io=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1=s)return{node:d,offset:s-i};i=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Bx(d)}}function Wx(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?Wx(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function Hx(){for(var i=window,s=Je();s instanceof i.HTMLIFrameElement;){try{var d=typeof s.contentWindow.location.href=="string"}catch{d=!1}if(d)i=s.contentWindow;else break;s=Je(i.document)}return s}function kp(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}function b5(i){var s=Hx(),d=i.focusedElem,m=i.selectionRange;if(s!==d&&d&&d.ownerDocument&&Wx(d.ownerDocument.documentElement,d)){if(m!==null&&kp(d)){if(s=m.start,i=m.end,i===void 0&&(i=s),"selectionStart"in d)d.selectionStart=s,d.selectionEnd=Math.min(i,d.value.length);else if(i=(s=d.ownerDocument||document)&&s.defaultView||window,i.getSelection){i=i.getSelection();var y=d.textContent.length,w=Math.min(m.start,y);m=m.end===void 0?w:Math.min(m.end,y),!i.extend&&w>m&&(y=m,m=w,w=y),y=Ux(d,w);var A=Ux(d,m);y&&A&&(i.rangeCount!==1||i.anchorNode!==y.node||i.anchorOffset!==y.offset||i.focusNode!==A.node||i.focusOffset!==A.offset)&&(s=s.createRange(),s.setStart(y.node,y.offset),i.removeAllRanges(),w>m?(i.addRange(s),i.extend(A.node,A.offset)):(s.setEnd(A.node,A.offset),i.addRange(s)))}}for(s=[],i=d;i=i.parentNode;)i.nodeType===1&&s.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d=document.documentMode,To=null,jp=null,Cl=null,Sp=!1;function Kx(i,s,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Sp||To==null||To!==Je(m)||(m=To,"selectionStart"in m&&kp(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Cl&&Pl(Cl,m)||(Cl=m,m=Ic(jp,"onSelect"),0zo||(i.current=Rp[zo],Rp[zo]=null,zo--)}function rt(i,s){zo++,Rp[zo]=i.current,i.current=s}var Ui={},er=Bi(Ui),vr=Bi(!1),Pa=Ui;function Fo(i,s){var d=i.type.contextTypes;if(!d)return Ui;var m=i.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===s)return m.__reactInternalMemoizedMaskedChildContext;var y={},w;for(w in d)y[w]=s[w];return m&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=s,i.__reactInternalMemoizedMaskedChildContext=y),y}function yr(i){return i=i.childContextTypes,i!=null}function $c(){at(vr),at(er)}function ob(i,s,d){if(er.current!==Ui)throw Error(r(168));rt(er,s),rt(vr,d)}function sb(i,s,d){var m=i.stateNode;if(s=s.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var y in m)if(!(y in s))throw Error(r(108,me(i)||"Unknown",y));return Q({},d,m)}function Lc(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||Ui,Pa=er.current,rt(er,i),rt(vr,vr.current),!0}function lb(i,s,d){var m=i.stateNode;if(!m)throw Error(r(169));d?(i=sb(i,s,Pa),m.__reactInternalMemoizedMergedChildContext=i,at(vr),at(er),rt(er,i)):at(vr),rt(vr,d)}var Zn=null,zc=!1,$p=!1;function ub(i){Zn===null?Zn=[i]:Zn.push(i)}function M5(i){zc=!0,ub(i)}function Wi(){if(!$p&&Zn!==null){$p=!0;var i=0,s=Ze;try{var d=Zn;for(Ze=1;i>=A,y-=A,Jn=1<<32-ln(s)+y|d<Re?(Rt=Te,Te=null):Rt=Te.sibling;var qe=ne(W,Te,H[Re],le);if(qe===null){Te===null&&(Te=Rt);break}i&&Te&&qe.alternate===null&&s(W,Te),z=w(qe,z,Re),Ie===null?Ee=qe:Ie.sibling=qe,Ie=qe,Te=Rt}if(Re===H.length)return d(W,Te),ut&&Oa(W,Re),Ee;if(Te===null){for(;ReRe?(Rt=Te,Te=null):Rt=Te.sibling;var Zi=ne(W,Te,qe.value,le);if(Zi===null){Te===null&&(Te=Rt);break}i&&Te&&Zi.alternate===null&&s(W,Te),z=w(Zi,z,Re),Ie===null?Ee=Zi:Ie.sibling=Zi,Ie=Zi,Te=Rt}if(qe.done)return d(W,Te),ut&&Oa(W,Re),Ee;if(Te===null){for(;!qe.done;Re++,qe=H.next())qe=se(W,qe.value,le),qe!==null&&(z=w(qe,z,Re),Ie===null?Ee=qe:Ie.sibling=qe,Ie=qe);return ut&&Oa(W,Re),Ee}for(Te=m(W,Te);!qe.done;Re++,qe=H.next())qe=ye(Te,W,Re,qe.value,le),qe!==null&&(i&&qe.alternate!==null&&Te.delete(qe.key===null?Re:qe.key),z=w(qe,z,Re),Ie===null?Ee=qe:Ie.sibling=qe,Ie=qe);return i&&Te.forEach(function(fM){return s(W,fM)}),ut&&Oa(W,Re),Ee}function bt(W,z,H,le){if(typeof H=="object"&&H!==null&&H.type===I&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case _:e:{for(var Ee=H.key,Ie=z;Ie!==null;){if(Ie.key===Ee){if(Ee=H.type,Ee===I){if(Ie.tag===7){d(W,Ie.sibling),z=y(Ie,H.props.children),z.return=W,W=z;break e}}else if(Ie.elementType===Ee||typeof Ee=="object"&&Ee!==null&&Ee.$$typeof===be&&mb(Ee)===Ie.type){d(W,Ie.sibling),z=y(Ie,H.props),z.ref=Dl(W,Ie,H),z.return=W,W=z;break e}d(W,Ie);break}else s(W,Ie);Ie=Ie.sibling}H.type===I?(z=La(H.props.children,W.mode,le,H.key),z.return=W,W=z):(le=hd(H.type,H.key,H.props,null,W.mode,le),le.ref=Dl(W,z,H),le.return=W,W=le)}return A(W);case C:e:{for(Ie=H.key;z!==null;){if(z.key===Ie)if(z.tag===4&&z.stateNode.containerInfo===H.containerInfo&&z.stateNode.implementation===H.implementation){d(W,z.sibling),z=y(z,H.children||[]),z.return=W,W=z;break e}else{d(W,z);break}else s(W,z);z=z.sibling}z=Tm(H,W.mode,le),z.return=W,W=z}return A(W);case be:return Ie=H._init,bt(W,z,Ie(H._payload),le)}if(sn(H))return je(W,z,H,le);if(V(H))return Se(W,z,H,le);Wc(W,H)}return typeof H=="string"&&H!==""||typeof H=="number"?(H=""+H,z!==null&&z.tag===6?(d(W,z.sibling),z=y(z,H),z.return=W,W=z):(d(W,z),z=Im(H,W.mode,le),z.return=W,W=z),A(W)):d(W,z)}return bt}var Ho=gb(!0),vb=gb(!1),Hc=Bi(null),Kc=null,Ko=null,Wp=null;function Hp(){Wp=Ko=Kc=null}function Kp(i){var s=Hc.current;at(Hc),i._currentValue=s}function Gp(i,s,d){for(;i!==null;){var m=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,m!==null&&(m.childLanes|=s)):m!==null&&(m.childLanes&s)!==s&&(m.childLanes|=s),i===d)break;i=i.return}}function Go(i,s){Kc=i,Wp=Ko=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&s)!==0&&(xr=!0),i.firstContext=null)}function Wr(i){var s=i._currentValue;if(Wp!==i)if(i={context:i,memoizedValue:s,next:null},Ko===null){if(Kc===null)throw Error(r(308));Ko=i,Kc.dependencies={lanes:0,firstContext:i}}else Ko=Ko.next=i;return s}var _a=null;function Vp(i){_a===null?_a=[i]:_a.push(i)}function yb(i,s,d,m){var y=s.interleaved;return y===null?(d.next=d,Vp(s)):(d.next=y.next,y.next=d),s.interleaved=d,ti(i,m)}function ti(i,s){i.lanes|=s;var d=i.alternate;for(d!==null&&(d.lanes|=s),d=i,i=i.return;i!==null;)i.childLanes|=s,d=i.alternate,d!==null&&(d.childLanes|=s),d=i,i=i.return;return d.tag===3?d.stateNode:null}var Hi=!1;function qp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function xb(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function ri(i,s){return{eventTime:i,lane:s,tag:0,payload:null,callback:null,next:null}}function Ki(i,s,d){var m=i.updateQueue;if(m===null)return null;if(m=m.shared,(Ve&2)!==0){var y=m.pending;return y===null?s.next=s:(s.next=y.next,y.next=s),m.pending=s,ti(i,d)}return y=m.interleaved,y===null?(s.next=s,Vp(m)):(s.next=y.next,y.next=s),m.interleaved=s,ti(i,d)}function Gc(i,s,d){if(s=s.updateQueue,s!==null&&(s=s.shared,(d&4194240)!==0)){var m=s.lanes;m&=i.pendingLanes,d|=m,s.lanes=d,lp(i,d)}}function bb(i,s){var d=i.updateQueue,m=i.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var y=null,w=null;if(d=d.firstBaseUpdate,d!==null){do{var A={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};w===null?y=w=A:w=w.next=A,d=d.next}while(d!==null);w===null?y=w=s:w=w.next=s}else y=w=s;d={baseState:m.baseState,firstBaseUpdate:y,lastBaseUpdate:w,shared:m.shared,effects:m.effects},i.updateQueue=d;return}i=d.lastBaseUpdate,i===null?d.firstBaseUpdate=s:i.next=s,d.lastBaseUpdate=s}function Vc(i,s,d,m){var y=i.updateQueue;Hi=!1;var w=y.firstBaseUpdate,A=y.lastBaseUpdate,M=y.shared.pending;if(M!==null){y.shared.pending=null;var R=M,q=R.next;R.next=null,A===null?w=q:A.next=q,A=R;var ae=i.alternate;ae!==null&&(ae=ae.updateQueue,M=ae.lastBaseUpdate,M!==A&&(M===null?ae.firstBaseUpdate=q:M.next=q,ae.lastBaseUpdate=R))}if(w!==null){var se=y.baseState;A=0,ae=q=R=null,M=w;do{var ne=M.lane,ye=M.eventTime;if((m&ne)===ne){ae!==null&&(ae=ae.next={eventTime:ye,lane:0,tag:M.tag,payload:M.payload,callback:M.callback,next:null});e:{var je=i,Se=M;switch(ne=s,ye=d,Se.tag){case 1:if(je=Se.payload,typeof je=="function"){se=je.call(ye,se,ne);break e}se=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Se.payload,ne=typeof je=="function"?je.call(ye,se,ne):je,ne==null)break e;se=Q({},se,ne);break e;case 2:Hi=!0}}M.callback!==null&&M.lane!==0&&(i.flags|=64,ne=y.effects,ne===null?y.effects=[M]:ne.push(M))}else ye={eventTime:ye,lane:ne,tag:M.tag,payload:M.payload,callback:M.callback,next:null},ae===null?(q=ae=ye,R=se):ae=ae.next=ye,A|=ne;if(M=M.next,M===null){if(M=y.shared.pending,M===null)break;ne=M,M=ne.next,ne.next=null,y.lastBaseUpdate=ne,y.shared.pending=null}}while(!0);if(ae===null&&(R=se),y.baseState=R,y.firstBaseUpdate=q,y.lastBaseUpdate=ae,s=y.shared.interleaved,s!==null){y=s;do A|=y.lane,y=y.next;while(y!==s)}else w===null&&(y.shared.lanes=0);Ta|=A,i.lanes=A,i.memoizedState=se}}function wb(i,s,d){if(i=s.effects,s.effects=null,i!==null)for(s=0;sd?d:4,i(!0);var m=Jp.transition;Jp.transition={};try{i(!1),s()}finally{Ze=d,Jp.transition=m}}function Fb(){return Hr().memoizedState}function R5(i,s,d){var m=Qi(i);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Bb(i))Ub(s,d);else if(d=yb(i,s,d,m),d!==null){var y=dr();pn(d,i,m,y),Wb(d,s,m)}}function $5(i,s,d){var m=Qi(i),y={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Bb(i))Ub(s,y);else{var w=i.alternate;if(i.lanes===0&&(w===null||w.lanes===0)&&(w=s.lastRenderedReducer,w!==null))try{var A=s.lastRenderedState,M=w(A,d);if(y.hasEagerState=!0,y.eagerState=M,un(M,A)){var R=s.interleaved;R===null?(y.next=y,Vp(s)):(y.next=R.next,R.next=y),s.interleaved=y;return}}catch{}finally{}d=yb(i,s,y,m),d!==null&&(y=dr(),pn(d,i,m,y),Wb(d,s,m))}}function Bb(i){var s=i.alternate;return i===ht||s!==null&&s===ht}function Ub(i,s){zl=Yc=!0;var d=i.pending;d===null?s.next=s:(s.next=d.next,d.next=s),i.pending=s}function Wb(i,s,d){if((d&4194240)!==0){var m=s.lanes;m&=i.pendingLanes,d|=m,s.lanes=d,lp(i,d)}}var Jc={readContext:Wr,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},L5={readContext:Wr,useCallback:function(i,s){return An().memoizedState=[i,s===void 0?null:s],i},useContext:Wr,useEffect:Mb,useImperativeHandle:function(i,s,d){return d=d!=null?d.concat([i]):null,Xc(4194308,4,Db.bind(null,s,i),d)},useLayoutEffect:function(i,s){return Xc(4194308,4,i,s)},useInsertionEffect:function(i,s){return Xc(4,2,i,s)},useMemo:function(i,s){var d=An();return s=s===void 0?null:s,i=i(),d.memoizedState=[i,s],i},useReducer:function(i,s,d){var m=An();return s=d!==void 0?d(s):s,m.memoizedState=m.baseState=s,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:s},m.queue=i,i=i.dispatch=R5.bind(null,ht,i),[m.memoizedState,i]},useRef:function(i){var s=An();return i={current:i},s.memoizedState=i},useState:Ob,useDebugValue:om,useDeferredValue:function(i){return An().memoizedState=i},useTransition:function(){var i=Ob(!1),s=i[0];return i=D5.bind(null,i[1]),An().memoizedState=i,[s,i]},useMutableSource:function(){},useSyncExternalStore:function(i,s,d){var m=ht,y=An();if(ut){if(d===void 0)throw Error(r(407));d=d()}else{if(d=s(),Dt===null)throw Error(r(349));(Ia&30)!==0||Nb(m,s,d)}y.memoizedState=d;var w={value:d,getSnapshot:s};return y.queue=w,Mb(Ab.bind(null,m,w,i),[i]),m.flags|=2048,Ul(9,Eb.bind(null,m,w,d,s),void 0,null),d},useId:function(){var i=An(),s=Dt.identifierPrefix;if(ut){var d=ei,m=Jn;d=(m&~(1<<32-ln(m)-1)).toString(32)+d,s=":"+s+"R"+d,d=Fl++,0<\/script>",i=i.removeChild(i.firstChild)):typeof m.is=="string"?i=A.createElement(d,{is:m.is}):(i=A.createElement(d),d==="select"&&(A=i,m.multiple?A.multiple=!0:m.size&&(A.size=m.size))):i=A.createElementNS(i,d),i[Nn]=s,i[Il]=m,u1(i,s,!1,!1),s.stateNode=i;e:{switch(A=Ae(d,m),d){case"dialog":it("cancel",i),it("close",i),y=m;break;case"iframe":case"object":case"embed":it("load",i),y=m;break;case"video":case"audio":for(y=0;yXo&&(s.flags|=128,m=!0,Wl(w,!1),s.lanes=4194304)}else{if(!m)if(i=qc(A),i!==null){if(s.flags|=128,m=!0,d=i.updateQueue,d!==null&&(s.updateQueue=d,s.flags|=4),Wl(w,!0),w.tail===null&&w.tailMode==="hidden"&&!A.alternate&&!ut)return rr(s),null}else 2*xt()-w.renderingStartTime>Xo&&d!==1073741824&&(s.flags|=128,m=!0,Wl(w,!1),s.lanes=4194304);w.isBackwards?(A.sibling=s.child,s.child=A):(d=w.last,d!==null?d.sibling=A:s.child=A,w.last=A)}return w.tail!==null?(s=w.tail,w.rendering=s,w.tail=s.sibling,w.renderingStartTime=xt(),s.sibling=null,d=ft.current,rt(ft,m?d&1|2:d&1),s):(rr(s),null);case 22:case 23:return Om(),m=s.memoizedState!==null,i!==null&&i.memoizedState!==null!==m&&(s.flags|=8192),m&&(s.mode&1)!==0?(_r&1073741824)!==0&&(rr(s),s.subtreeFlags&6&&(s.flags|=8192)):rr(s),null;case 24:return null;case 25:return null}throw Error(r(156,s.tag))}function G5(i,s){switch(zp(s),s.tag){case 1:return yr(s.type)&&$c(),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return Vo(),at(vr),at(er),Zp(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 5:return Yp(s),null;case 13:if(at(ft),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));Wo()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return at(ft),null;case 4:return Vo(),null;case 10:return Kp(s.type._context),null;case 22:case 23:return Om(),null;case 24:return null;default:return null}}var nd=!1,nr=!1,V5=typeof WeakSet=="function"?WeakSet:Set,we=null;function Qo(i,s){var d=i.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){pt(i,s,m)}else d.current=null}function ym(i,s,d){try{d()}catch(m){pt(i,s,m)}}var f1=!1;function q5(i,s){if(Op=jc,i=Hx(),kp(i)){if("selectionStart"in i)var d={start:i.selectionStart,end:i.selectionEnd};else e:{d=(d=i.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var y=m.anchorOffset,w=m.focusNode;m=m.focusOffset;try{d.nodeType,w.nodeType}catch{d=null;break e}var A=0,M=-1,R=-1,q=0,ae=0,se=i,ne=null;t:for(;;){for(var ye;se!==d||y!==0&&se.nodeType!==3||(M=A+y),se!==w||m!==0&&se.nodeType!==3||(R=A+m),se.nodeType===3&&(A+=se.nodeValue.length),(ye=se.firstChild)!==null;)ne=se,se=ye;for(;;){if(se===i)break t;if(ne===d&&++q===y&&(M=A),ne===w&&++ae===m&&(R=A),(ye=se.nextSibling)!==null)break;se=ne,ne=se.parentNode}se=ye}d=M===-1||R===-1?null:{start:M,end:R}}else d=null}d=d||{start:0,end:0}}else d=null;for(_p={focusedElem:i,selectionRange:d},jc=!1,we=s;we!==null;)if(s=we,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,we=i;else for(;we!==null;){s=we;try{var je=s.alternate;if((s.flags&1024)!==0)switch(s.tag){case 0:case 11:case 15:break;case 1:if(je!==null){var Se=je.memoizedProps,bt=je.memoizedState,W=s.stateNode,z=W.getSnapshotBeforeUpdate(s.elementType===s.type?Se:dn(s.type,Se),bt);W.__reactInternalSnapshotBeforeUpdate=z}break;case 3:var H=s.stateNode.containerInfo;H.nodeType===1?H.textContent="":H.nodeType===9&&H.documentElement&&H.removeChild(H.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(le){pt(s,s.return,le)}if(i=s.sibling,i!==null){i.return=s.return,we=i;break}we=s.return}return je=f1,f1=!1,je}function Hl(i,s,d){var m=s.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var y=m=m.next;do{if((y.tag&i)===i){var w=y.destroy;y.destroy=void 0,w!==void 0&&ym(s,d,w)}y=y.next}while(y!==m)}}function id(i,s){if(s=s.updateQueue,s=s!==null?s.lastEffect:null,s!==null){var d=s=s.next;do{if((d.tag&i)===i){var m=d.create;d.destroy=m()}d=d.next}while(d!==s)}}function xm(i){var s=i.ref;if(s!==null){var d=i.stateNode;switch(i.tag){case 5:i=d;break;default:i=d}typeof s=="function"?s(i):s.current=i}}function h1(i){var s=i.alternate;s!==null&&(i.alternate=null,h1(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&(delete s[Nn],delete s[Il],delete s[Dp],delete s[O5],delete s[_5])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function p1(i){return i.tag===5||i.tag===3||i.tag===4}function m1(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||p1(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function bm(i,s,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,s?d.nodeType===8?d.parentNode.insertBefore(i,s):d.insertBefore(i,s):(d.nodeType===8?(s=d.parentNode,s.insertBefore(i,d)):(s=d,s.appendChild(i)),d=d._reactRootContainer,d!=null||s.onclick!==null||(s.onclick=Dc));else if(m!==4&&(i=i.child,i!==null))for(bm(i,s,d),i=i.sibling;i!==null;)bm(i,s,d),i=i.sibling}function wm(i,s,d){var m=i.tag;if(m===5||m===6)i=i.stateNode,s?d.insertBefore(i,s):d.appendChild(i);else if(m!==4&&(i=i.child,i!==null))for(wm(i,s,d),i=i.sibling;i!==null;)wm(i,s,d),i=i.sibling}var Wt=null,fn=!1;function Gi(i,s,d){for(d=d.child;d!==null;)g1(i,s,d),d=d.sibling}function g1(i,s,d){if(Sn&&typeof Sn.onCommitFiberUnmount=="function")try{Sn.onCommitFiberUnmount(vc,d)}catch{}switch(d.tag){case 5:nr||Qo(d,s);case 6:var m=Wt,y=fn;Wt=null,Gi(i,s,d),Wt=m,fn=y,Wt!==null&&(fn?(i=Wt,d=d.stateNode,i.nodeType===8?i.parentNode.removeChild(d):i.removeChild(d)):Wt.removeChild(d.stateNode));break;case 18:Wt!==null&&(fn?(i=Wt,d=d.stateNode,i.nodeType===8?Tp(i.parentNode,d):i.nodeType===1&&Tp(i,d),kl(i)):Tp(Wt,d.stateNode));break;case 4:m=Wt,y=fn,Wt=d.stateNode.containerInfo,fn=!0,Gi(i,s,d),Wt=m,fn=y;break;case 0:case 11:case 14:case 15:if(!nr&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){y=m=m.next;do{var w=y,A=w.destroy;w=w.tag,A!==void 0&&((w&2)!==0||(w&4)!==0)&&ym(d,s,A),y=y.next}while(y!==m)}Gi(i,s,d);break;case 1:if(!nr&&(Qo(d,s),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(M){pt(d,s,M)}Gi(i,s,d);break;case 21:Gi(i,s,d);break;case 22:d.mode&1?(nr=(m=nr)||d.memoizedState!==null,Gi(i,s,d),nr=m):Gi(i,s,d);break;default:Gi(i,s,d)}}function v1(i){var s=i.updateQueue;if(s!==null){i.updateQueue=null;var d=i.stateNode;d===null&&(d=i.stateNode=new V5),s.forEach(function(m){var y=nM.bind(null,i,m);d.has(m)||(d.add(m),m.then(y,y))})}}function hn(i,s){var d=s.deletions;if(d!==null)for(var m=0;my&&(y=A),m&=~w}if(m=y,m=xt()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*Y5(m/1960))-m,10i?16:i,qi===null)var m=!1;else{if(i=qi,qi=null,ud=0,(Ve&6)!==0)throw Error(r(331));var y=Ve;for(Ve|=4,we=i.current;we!==null;){var w=we,A=w.child;if((we.flags&16)!==0){var M=w.deletions;if(M!==null){for(var R=0;Rxt()-Sm?Ra(i,0):jm|=d),wr(i,s)}function O1(i,s){s===0&&((i.mode&1)===0?s=1:(s=xc,xc<<=1,(xc&130023424)===0&&(xc=4194304)));var d=dr();i=ti(i,s),i!==null&&(vl(i,s,d),wr(i,d))}function rM(i){var s=i.memoizedState,d=0;s!==null&&(d=s.retryLane),O1(i,d)}function nM(i,s){var d=0;switch(i.tag){case 13:var m=i.stateNode,y=i.memoizedState;y!==null&&(d=y.retryLane);break;case 19:m=i.stateNode;break;default:throw Error(r(314))}m!==null&&m.delete(s),O1(i,d)}var _1;_1=function(i,s,d){if(i!==null)if(i.memoizedProps!==s.pendingProps||vr.current)xr=!0;else{if((i.lanes&d)===0&&(s.flags&128)===0)return xr=!1,H5(i,s,d);xr=(i.flags&131072)!==0}else xr=!1,ut&&(s.flags&1048576)!==0&&cb(s,Bc,s.index);switch(s.lanes=0,s.tag){case 2:var m=s.type;rd(i,s),i=s.pendingProps;var y=Fo(s,er.current);Go(s,d),y=tm(null,s,m,i,y,d);var w=rm();return s.flags|=1,typeof y=="object"&&y!==null&&typeof y.render=="function"&&y.$$typeof===void 0?(s.tag=1,s.memoizedState=null,s.updateQueue=null,yr(m)?(w=!0,Lc(s)):w=!1,s.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,qp(s),y.updater=ed,s.stateNode=y,y._reactInternals=s,lm(s,m,i,d),s=fm(null,s,m,!0,w,d)):(s.tag=0,ut&&w&&Lp(s),cr(null,s,y,d),s=s.child),s;case 16:m=s.elementType;e:{switch(rd(i,s),i=s.pendingProps,y=m._init,m=y(m._payload),s.type=m,y=s.tag=aM(m),i=dn(m,i),y){case 0:s=dm(null,s,m,i,d);break e;case 1:s=n1(null,s,m,i,d);break e;case 11:s=Zb(null,s,m,i,d);break e;case 14:s=Jb(null,s,m,dn(m.type,i),d);break e}throw Error(r(306,m,""))}return s;case 0:return m=s.type,y=s.pendingProps,y=s.elementType===m?y:dn(m,y),dm(i,s,m,y,d);case 1:return m=s.type,y=s.pendingProps,y=s.elementType===m?y:dn(m,y),n1(i,s,m,y,d);case 3:e:{if(i1(s),i===null)throw Error(r(387));m=s.pendingProps,w=s.memoizedState,y=w.element,xb(i,s),Vc(s,m,null,d);var A=s.memoizedState;if(m=A.element,w.isDehydrated)if(w={element:m,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},s.updateQueue.baseState=w,s.memoizedState=w,s.flags&256){y=qo(Error(r(423)),s),s=a1(i,s,m,d,y);break e}else if(m!==y){y=qo(Error(r(424)),s),s=a1(i,s,m,d,y);break e}else for(Or=Fi(s.stateNode.containerInfo.firstChild),Cr=s,ut=!0,cn=null,d=vb(s,null,m,d),s.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Wo(),m===y){s=ni(i,s,d);break e}cr(i,s,m,d)}s=s.child}return s;case 5:return kb(s),i===null&&Bp(s),m=s.type,y=s.pendingProps,w=i!==null?i.memoizedProps:null,A=y.children,Mp(m,y)?A=null:w!==null&&Mp(m,w)&&(s.flags|=32),r1(i,s),cr(i,s,A,d),s.child;case 6:return i===null&&Bp(s),null;case 13:return o1(i,s,d);case 4:return Qp(s,s.stateNode.containerInfo),m=s.pendingProps,i===null?s.child=Ho(s,null,m,d):cr(i,s,m,d),s.child;case 11:return m=s.type,y=s.pendingProps,y=s.elementType===m?y:dn(m,y),Zb(i,s,m,y,d);case 7:return cr(i,s,s.pendingProps,d),s.child;case 8:return cr(i,s,s.pendingProps.children,d),s.child;case 12:return cr(i,s,s.pendingProps.children,d),s.child;case 10:e:{if(m=s.type._context,y=s.pendingProps,w=s.memoizedProps,A=y.value,rt(Hc,m._currentValue),m._currentValue=A,w!==null)if(un(w.value,A)){if(w.children===y.children&&!vr.current){s=ni(i,s,d);break e}}else for(w=s.child,w!==null&&(w.return=s);w!==null;){var M=w.dependencies;if(M!==null){A=w.child;for(var R=M.firstContext;R!==null;){if(R.context===m){if(w.tag===1){R=ri(-1,d&-d),R.tag=2;var q=w.updateQueue;if(q!==null){q=q.shared;var ae=q.pending;ae===null?R.next=R:(R.next=ae.next,ae.next=R),q.pending=R}}w.lanes|=d,R=w.alternate,R!==null&&(R.lanes|=d),Gp(w.return,d,s),M.lanes|=d;break}R=R.next}}else if(w.tag===10)A=w.type===s.type?null:w.child;else if(w.tag===18){if(A=w.return,A===null)throw Error(r(341));A.lanes|=d,M=A.alternate,M!==null&&(M.lanes|=d),Gp(A,d,s),A=w.sibling}else A=w.child;if(A!==null)A.return=w;else for(A=w;A!==null;){if(A===s){A=null;break}if(w=A.sibling,w!==null){w.return=A.return,A=w;break}A=A.return}w=A}cr(i,s,y.children,d),s=s.child}return s;case 9:return y=s.type,m=s.pendingProps.children,Go(s,d),y=Wr(y),m=m(y),s.flags|=1,cr(i,s,m,d),s.child;case 14:return m=s.type,y=dn(m,s.pendingProps),y=dn(m.type,y),Jb(i,s,m,y,d);case 15:return e1(i,s,s.type,s.pendingProps,d);case 17:return m=s.type,y=s.pendingProps,y=s.elementType===m?y:dn(m,y),rd(i,s),s.tag=1,yr(m)?(i=!0,Lc(s)):i=!1,Go(s,d),Kb(s,m,y),lm(s,m,y,d),fm(null,s,m,!0,i,d);case 19:return l1(i,s,d);case 22:return t1(i,s,d)}throw Error(r(156,s.tag))};function M1(i,s){return dx(i,s)}function iM(i,s,d,m){this.tag=i,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=s,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 Gr(i,s,d,m){return new iM(i,s,d,m)}function Mm(i){return i=i.prototype,!(!i||!i.isReactComponent)}function aM(i){if(typeof i=="function")return Mm(i)?1:0;if(i!=null){if(i=i.$$typeof,i===$)return 11;if(i===pe)return 14}return 2}function Xi(i,s){var d=i.alternate;return d===null?(d=Gr(i.tag,s,i.key,i.mode),d.elementType=i.elementType,d.type=i.type,d.stateNode=i.stateNode,d.alternate=i,i.alternate=d):(d.pendingProps=s,d.type=i.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=i.flags&14680064,d.childLanes=i.childLanes,d.lanes=i.lanes,d.child=i.child,d.memoizedProps=i.memoizedProps,d.memoizedState=i.memoizedState,d.updateQueue=i.updateQueue,s=i.dependencies,d.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},d.sibling=i.sibling,d.index=i.index,d.ref=i.ref,d}function hd(i,s,d,m,y,w){var A=2;if(m=i,typeof i=="function")Mm(i)&&(A=1);else if(typeof i=="string")A=5;else e:switch(i){case I:return La(d.children,y,w,s);case B:A=8,y|=8;break;case U:return i=Gr(12,d,s,y|2),i.elementType=U,i.lanes=w,i;case fe:return i=Gr(13,d,s,y),i.elementType=fe,i.lanes=w,i;case J:return i=Gr(19,d,s,y),i.elementType=J,i.lanes=w,i;case de:return pd(d,y,w,s);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case G:A=10;break e;case X:A=9;break e;case $:A=11;break e;case pe:A=14;break e;case be:A=16,m=null;break e}throw Error(r(130,i==null?i:typeof i,""))}return s=Gr(A,d,s,y),s.elementType=i,s.type=m,s.lanes=w,s}function La(i,s,d,m){return i=Gr(7,i,m,s),i.lanes=d,i}function pd(i,s,d,m){return i=Gr(22,i,m,s),i.elementType=de,i.lanes=d,i.stateNode={isHidden:!1},i}function Im(i,s,d){return i=Gr(6,i,null,s),i.lanes=d,i}function Tm(i,s,d){return s=Gr(4,i.children!==null?i.children:[],i.key,s),s.lanes=d,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}function oM(i,s,d,m,y){this.tag=s,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sp(0),this.expirationTimes=sp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sp(0),this.identifierPrefix=m,this.onRecoverableError=y,this.mutableSourceEagerHydrationData=null}function Dm(i,s,d,m,y,w,A,M,R){return i=new oM(i,s,d,M,R),s===1?(s=1,w===!0&&(s|=8)):s=0,w=Gr(3,null,null,s),i.current=w,w.stateNode=i,w.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},qp(w),i}function sM(i,s,d){var m=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Um.exports=wM(),Um.exports}var V1;function kM(){if(V1)return kd;V1=1;var e=J2();return kd.createRoot=e.createRoot,kd.hydrateRoot=e.hydrateRoot,kd}var jM=kM();const SM=cy(jM);var qu=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},eo,sa,ws,U2,NM=(U2=class extends qu{constructor(){super();De(this,eo);De(this,sa);De(this,ws);xe(this,ws,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t();return window.addEventListener("visibilitychange",r,!1),()=>{window.removeEventListener("visibilitychange",r)}}})}onSubscribe(){L(this,sa)||this.setEventListener(L(this,ws))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,sa))==null||t.call(this),xe(this,sa,void 0))}setEventListener(t){var r;xe(this,ws,t),(r=L(this,sa))==null||r.call(this),xe(this,sa,t(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(t){L(this,eo)!==t&&(xe(this,eo,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(r=>{r(t)})}isFocused(){var t;return typeof L(this,eo)=="boolean"?L(this,eo):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},eo=new WeakMap,sa=new WeakMap,ws=new WeakMap,U2),dy=new NM,EM={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},la,uy,W2,AM=(W2=class{constructor(){De(this,la,EM);De(this,uy,!1)}setTimeoutProvider(e){xe(this,la,e)}setTimeout(e,t){return L(this,la).setTimeout(e,t)}clearTimeout(e){L(this,la).clearTimeout(e)}setInterval(e,t){return L(this,la).setInterval(e,t)}clearInterval(e){L(this,la).clearInterval(e)}},la=new WeakMap,uy=new WeakMap,W2),qa=new AM;function PM(e){setTimeout(e,0)}var CM=typeof window>"u"||"Deno"in globalThis;function Sr(){}function OM(e,t){return typeof e=="function"?e(t):e}function $g(e){return typeof e=="number"&&e>=0&&e!==1/0}function eN(e,t){return Math.max(e+(t||0)-Date.now(),0)}function ga(e,t){return typeof e=="function"?e(t):e}function Tr(e,t){return typeof e=="function"?e(t):e}function q1(e,t){const{type:r="all",exact:n,fetchStatus:a,predicate:o,queryKey:c,stale:l}=e;if(c){if(n){if(t.queryHash!==fy(c,t.options))return!1}else if(!bu(t.queryKey,c))return!1}if(r!=="all"){const f=t.isActive();if(r==="active"&&!f||r==="inactive"&&f)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||a&&a!==t.state.fetchStatus||o&&!o(t))}function Q1(e,t){const{exact:r,status:n,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(xu(t.options.mutationKey)!==xu(o))return!1}else if(!bu(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||a&&!a(t))}function fy(e,t){return((t==null?void 0:t.queryKeyHashFn)||xu)(e)}function xu(e){return JSON.stringify(e,(t,r)=>zg(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function bu(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>bu(e[r],t[r])):!1}var _M=Object.prototype.hasOwnProperty;function tN(e,t,r=0){if(e===t)return e;if(r>500)return t;const n=Y1(e)&&Y1(t);if(!n&&!(zg(e)&&zg(t)))return t;const o=(n?e:Object.keys(e)).length,c=n?t:Object.keys(t),l=c.length,f=n?new Array(l):{};let h=0;for(let p=0;p{qa.setTimeout(t,e)})}function Fg(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?tN(e,t):t}function IM(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function TM(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var hy=Symbol();function rN(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===hy?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function nN(e,t){return typeof e=="function"?e(...t):!!e}function DM(e,t,r){let n=!1,a;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(a??(a=t()),n||(n=!0,a.aborted?r():a.addEventListener("abort",r,{once:!0})),a)}),e}var wu=(()=>{let e=()=>CM;return{isServer(){return e()},setIsServer(t){e=t}}})();function Bg(){let e,t;const r=new Promise((a,o)=>{e=a,t=o});r.status="pending",r.catch(()=>{});function n(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{n({status:"fulfilled",value:a}),e(a)},r.reject=a=>{n({status:"rejected",reason:a}),t(a)},r}var RM=PM;function $M(){let e=[],t=0,r=l=>{l()},n=l=>{l()},a=RM;const o=l=>{t?e.push(l):a(()=>{r(l)})},c=()=>{const l=e;e=[],l.length&&a(()=>{n(()=>{l.forEach(f=>{r(f)})})})};return{batch:l=>{let f;t++;try{f=l()}finally{t--,t||c()}return f},batchCalls:l=>(...f)=>{o(()=>{l(...f)})},schedule:o,setNotifyFunction:l=>{r=l},setBatchNotifyFunction:l=>{n=l},setScheduler:l=>{a=l}}}var qt=$M(),ks,ua,js,H2,LM=(H2=class extends qu{constructor(){super();De(this,ks,!0);De(this,ua);De(this,js);xe(this,js,t=>{if(typeof window<"u"&&window.addEventListener){const r=()=>t(!0),n=()=>t(!1);return window.addEventListener("online",r,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",n)}}})}onSubscribe(){L(this,ua)||this.setEventListener(L(this,js))}onUnsubscribe(){var t;this.hasListeners()||((t=L(this,ua))==null||t.call(this),xe(this,ua,void 0))}setEventListener(t){var r;xe(this,js,t),(r=L(this,ua))==null||r.call(this),xe(this,ua,t(this.setOnline.bind(this)))}setOnline(t){L(this,ks)!==t&&(xe(this,ks,t),this.listeners.forEach(n=>{n(t)}))}isOnline(){return L(this,ks)}},ks=new WeakMap,ua=new WeakMap,js=new WeakMap,H2),of=new LM;function zM(e){return Math.min(1e3*2**e,3e4)}function iN(e){return(e??"online")==="online"?of.isOnline():!0}var Ug=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function aN(e){let t=!1,r=0,n;const a=Bg(),o=()=>a.status!=="pending",c=k=>{var S;if(!o()){const N=new Ug(k);x(N),(S=e.onCancel)==null||S.call(e,N)}},l=()=>{t=!0},f=()=>{t=!1},h=()=>dy.isFocused()&&(e.networkMode==="always"||of.isOnline())&&e.canRun(),p=()=>iN(e.networkMode)&&e.canRun(),g=k=>{o()||(n==null||n(),a.resolve(k))},x=k=>{o()||(n==null||n(),a.reject(k))},b=()=>new Promise(k=>{var S;n=N=>{(o()||h())&&k(N)},(S=e.onPause)==null||S.call(e)}).then(()=>{var k;n=void 0,o()||(k=e.onContinue)==null||k.call(e)}),j=()=>{if(o())return;let k;const S=r===0?e.initialPromise:void 0;try{k=S??e.fn()}catch(N){k=Promise.reject(N)}Promise.resolve(k).then(g).catch(N=>{var C;if(o())return;const E=e.retry??(wu.isServer()?0:3),O=e.retryDelay??zM,P=typeof O=="function"?O(r,N):O,_=E===!0||typeof E=="number"&&rh()?void 0:b()).then(()=>{t?x(N):j()})})};return{promise:a,status:()=>a.status,cancel:c,continue:()=>(n==null||n(),a),cancelRetry:l,continueRetry:f,canStart:p,start:()=>(p()?j():b().then(j),a)}}var to,K2,oN=(K2=class{constructor(){De(this,to)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),$g(this.gcTime)&&xe(this,to,qa.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(wu.isServer()?1/0:300*1e3))}clearGcTimeout(){L(this,to)!==void 0&&(qa.clearTimeout(L(this,to)),xe(this,to,void 0))}},to=new WeakMap,K2);function FM(e){return{onFetch:(t,r)=>{var p,g,x,b,j;const n=t.options,a=(x=(g=(p=t.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:x.direction,o=((b=t.state.data)==null?void 0:b.pages)||[],c=((j=t.state.data)==null?void 0:j.pageParams)||[];let l={pages:[],pageParams:[]},f=0;const h=async()=>{let k=!1;const S=O=>{DM(O,()=>t.signal,()=>k=!0)},N=rN(t.options,t.fetchOptions),E=async(O,P,_)=>{if(k)return Promise.reject(t.signal.reason);if(P==null&&O.pages.length)return Promise.resolve(O);const I=(()=>{const X={client:t.client,queryKey:t.queryKey,pageParam:P,direction:_?"backward":"forward",meta:t.options.meta};return S(X),X})(),B=await N(I),{maxPages:U}=t.options,G=_?TM:IM;return{pages:G(O.pages,B,U),pageParams:G(O.pageParams,P,U)}};if(a&&o.length){const O=a==="backward",P=O?BM:Z1,_={pages:o,pageParams:c},C=P(n,_);l=await E(_,C,O)}else{const O=e??o.length;do{const P=f===0?c[0]??n.initialPageParam:Z1(n,l);if(f>0&&P==null)break;l=await E(l,P),f++}while(f{var k,S;return(S=(k=t.options).persister)==null?void 0:S.call(k,h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r)}:t.fetchFn=h}}}function Z1(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function BM(e,{pages:t,pageParams:r}){var n;return t.length>0?(n=e.getPreviousPageParam)==null?void 0:n.call(e,t[0],t,r[0],r):void 0}var Ss,ro,Ns,Qr,no,$t,Wu,io,Ir,sN,oi,G2,UM=(G2=class extends oN{constructor(t){super();De(this,Ir);De(this,Ss);De(this,ro);De(this,Ns);De(this,Qr);De(this,no);De(this,$t);De(this,Wu);De(this,io);xe(this,io,!1),xe(this,Wu,t.defaultOptions),this.setOptions(t.options),this.observers=[],xe(this,no,t.client),xe(this,Qr,L(this,no).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,xe(this,ro,ew(this.options)),this.state=t.state??L(this,ro),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return L(this,Ss)}get promise(){var t;return(t=L(this,$t))==null?void 0:t.promise}setOptions(t){if(this.options={...L(this,Wu),...t},t!=null&&t._type&&xe(this,Ss,t._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const r=ew(this.options);r.data!==void 0&&(this.setState(J1(r.data,r.dataUpdatedAt)),xe(this,ro,r))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&L(this,Qr).remove(this)}setData(t,r){const n=Fg(this.state.data,t,this.options);return We(this,Ir,oi).call(this,{data:n,type:"success",dataUpdatedAt:r==null?void 0:r.updatedAt,manual:r==null?void 0:r.manual}),n}setState(t){We(this,Ir,oi).call(this,{type:"setState",state:t})}cancel(t){var n,a;const r=(n=L(this,$t))==null?void 0:n.promise;return(a=L(this,$t))==null||a.cancel(t),r?r.then(Sr).catch(Sr):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return L(this,ro)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(t=>Tr(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===hy||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>ga(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!eN(this.state.dataUpdatedAt,t)}onFocus(){var r;const t=this.observers.find(n=>n.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(r=L(this,$t))==null||r.continue()}onOnline(){var r;const t=this.observers.find(n=>n.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(r=L(this,$t))==null||r.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),L(this,Qr).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(r=>r!==t),this.observers.length||(L(this,$t)&&(L(this,io)||We(this,Ir,sN).call(this)?L(this,$t).cancel({revert:!0}):L(this,$t).cancelRetry()),this.scheduleGc()),L(this,Qr).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||We(this,Ir,oi).call(this,{type:"invalidate"})}async fetch(t,r){var h,p,g,x,b,j,k,S,N,E,O;if(this.state.fetchStatus!=="idle"&&((h=L(this,$t))==null?void 0:h.status())!=="rejected"){if(this.state.data!==void 0&&(r!=null&&r.cancelRefetch))this.cancel({silent:!0});else if(L(this,$t))return L(this,$t).continueRetry(),L(this,$t).promise}if(t&&this.setOptions(t),!this.options.queryFn){const P=this.observers.find(_=>_.options.queryFn);P&&this.setOptions(P.options)}const n=new AbortController,a=P=>{Object.defineProperty(P,"signal",{enumerable:!0,get:()=>(xe(this,io,!0),n.signal)})},o=()=>{const P=rN(this.options,r),C=(()=>{const I={client:L(this,no),queryKey:this.queryKey,meta:this.meta};return a(I),I})();return xe(this,io,!1),this.options.persister?this.options.persister(P,C,this):P(C)},l=(()=>{const P={fetchOptions:r,options:this.options,queryKey:this.queryKey,client:L(this,no),state:this.state,fetchFn:o};return a(P),P})(),f=L(this,Ss)==="infinite"?FM(this.options.pages):this.options.behavior;f==null||f.onFetch(l,this),xe(this,Ns,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=l.fetchOptions)==null?void 0:p.meta))&&We(this,Ir,oi).call(this,{type:"fetch",meta:(g=l.fetchOptions)==null?void 0:g.meta}),xe(this,$t,aN({initialPromise:r==null?void 0:r.initialPromise,fn:l.fetchFn,onCancel:P=>{P instanceof Ug&&P.revert&&this.setState({...L(this,Ns),fetchStatus:"idle"}),n.abort()},onFail:(P,_)=>{We(this,Ir,oi).call(this,{type:"failed",failureCount:P,error:_})},onPause:()=>{We(this,Ir,oi).call(this,{type:"pause"})},onContinue:()=>{We(this,Ir,oi).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0}));try{const P=await L(this,$t).start();if(P===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(P),(b=(x=L(this,Qr).config).onSuccess)==null||b.call(x,P,this),(k=(j=L(this,Qr).config).onSettled)==null||k.call(j,P,this.state.error,this),P}catch(P){if(P instanceof Ug){if(P.silent)return L(this,$t).promise;if(P.revert){if(this.state.data===void 0)throw P;return this.state.data}}throw We(this,Ir,oi).call(this,{type:"error",error:P}),(N=(S=L(this,Qr).config).onError)==null||N.call(S,P,this),(O=(E=L(this,Qr).config).onSettled)==null||O.call(E,this.state.data,P,this),P}finally{this.scheduleGc()}}},Ss=new WeakMap,ro=new WeakMap,Ns=new WeakMap,Qr=new WeakMap,no=new WeakMap,$t=new WeakMap,Wu=new WeakMap,io=new WeakMap,Ir=new WeakSet,sN=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},oi=function(t){const r=n=>{switch(t.type){case"failed":return{...n,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...lN(n.data,this.options),fetchMeta:t.meta??null};case"success":const a={...n,...J1(t.data,t.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return xe(this,Ns,t.manual?a:void 0),a;case"error":const o=t.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...t.state}}};this.state=r(this.state),qt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),L(this,Qr).notify({query:this,type:"updated",action:t})})},G2);function lN(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:iN(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function J1(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ew(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var jr,Ke,Hu,fr,ao,Es,li,ca,Ku,As,Ps,oo,so,da,Cs,Xe,cu,Wg,Hg,Kg,Gg,Vg,qg,Qg,uN,V2,WM=(V2=class extends qu{constructor(t,r){super();De(this,Xe);De(this,jr);De(this,Ke);De(this,Hu);De(this,fr);De(this,ao);De(this,Es);De(this,li);De(this,ca);De(this,Ku);De(this,As);De(this,Ps);De(this,oo);De(this,so);De(this,da);De(this,Cs,new Set);this.options=r,xe(this,jr,t),xe(this,ca,null),xe(this,li,Bg()),this.bindMethods(),this.setOptions(r)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(L(this,Ke).addObserver(this),tw(L(this,Ke),this.options)?We(this,Xe,cu).call(this):this.updateResult(),We(this,Xe,Gg).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Yg(L(this,Ke),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Yg(L(this,Ke),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,We(this,Xe,Vg).call(this),We(this,Xe,qg).call(this),L(this,Ke).removeObserver(this)}setOptions(t){const r=this.options,n=L(this,Ke);if(this.options=L(this,jr).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Tr(this.options.enabled,L(this,Ke))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");We(this,Xe,Qg).call(this),L(this,Ke).setOptions(this.options),r._defaulted&&!Lg(this.options,r)&&L(this,jr).getQueryCache().notify({type:"observerOptionsUpdated",query:L(this,Ke),observer:this});const a=this.hasListeners();a&&rw(L(this,Ke),n,this.options,r)&&We(this,Xe,cu).call(this),this.updateResult(),a&&(L(this,Ke)!==n||Tr(this.options.enabled,L(this,Ke))!==Tr(r.enabled,L(this,Ke))||ga(this.options.staleTime,L(this,Ke))!==ga(r.staleTime,L(this,Ke)))&&We(this,Xe,Wg).call(this);const o=We(this,Xe,Hg).call(this);a&&(L(this,Ke)!==n||Tr(this.options.enabled,L(this,Ke))!==Tr(r.enabled,L(this,Ke))||o!==L(this,da))&&We(this,Xe,Kg).call(this,o)}getOptimisticResult(t){const r=L(this,jr).getQueryCache().build(L(this,jr),t),n=this.createResult(r,t);return KM(this,n)&&(xe(this,fr,n),xe(this,Es,this.options),xe(this,ao,L(this,Ke).state)),n}getCurrentResult(){return L(this,fr)}trackResult(t,r){return new Proxy(t,{get:(n,a)=>(this.trackProp(a),r==null||r(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&L(this,li).status==="pending"&&L(this,li).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,a))})}trackProp(t){L(this,Cs).add(t)}getCurrentQuery(){return L(this,Ke)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const r=L(this,jr).defaultQueryOptions(t),n=L(this,jr).getQueryCache().build(L(this,jr),r);return n.fetch().then(()=>this.createResult(n,r))}fetch(t){return We(this,Xe,cu).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),L(this,fr)))}createResult(t,r){var U;const n=L(this,Ke),a=this.options,o=L(this,fr),c=L(this,ao),l=L(this,Es),h=t!==n?t.state:L(this,Hu),{state:p}=t;let g={...p},x=!1,b;if(r._optimisticResults){const G=this.hasListeners(),X=!G&&tw(t,r),$=G&&rw(t,n,r,a);(X||$)&&(g={...g,...lN(p.data,t.options)}),r._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:j,errorUpdatedAt:k,status:S}=g;b=g.data;let N=!1;if(r.placeholderData!==void 0&&b===void 0&&S==="pending"){let G;o!=null&&o.isPlaceholderData&&r.placeholderData===(l==null?void 0:l.placeholderData)?(G=o.data,N=!0):G=typeof r.placeholderData=="function"?r.placeholderData((U=L(this,Ps))==null?void 0:U.state.data,L(this,Ps)):r.placeholderData,G!==void 0&&(S="success",b=Fg(o==null?void 0:o.data,G,r),x=!0)}if(r.select&&b!==void 0&&!N)if(o&&b===(c==null?void 0:c.data)&&r.select===L(this,Ku))b=L(this,As);else try{xe(this,Ku,r.select),b=r.select(b),b=Fg(o==null?void 0:o.data,b,r),xe(this,As,b),xe(this,ca,null)}catch(G){xe(this,ca,G)}L(this,ca)&&(j=L(this,ca),b=L(this,As),k=Date.now(),S="error");const E=g.fetchStatus==="fetching",O=S==="pending",P=S==="error",_=O&&E,C=b!==void 0,B={status:S,fetchStatus:g.fetchStatus,isPending:O,isSuccess:S==="success",isError:P,isInitialLoading:_,isLoading:_,data:b,dataUpdatedAt:g.dataUpdatedAt,error:j,errorUpdatedAt:k,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:t.isFetched(),isFetchedAfterMount:g.dataUpdateCount>h.dataUpdateCount||g.errorUpdateCount>h.errorUpdateCount,isFetching:E,isRefetching:E&&!O,isLoadingError:P&&!C,isPaused:g.fetchStatus==="paused",isPlaceholderData:x,isRefetchError:P&&C,isStale:py(t,r),refetch:this.refetch,promise:L(this,li),isEnabled:Tr(r.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const G=B.data!==void 0,X=B.status==="error"&&!G,$=pe=>{X?pe.reject(B.error):G&&pe.resolve(B.data)},fe=()=>{const pe=xe(this,li,B.promise=Bg());$(pe)},J=L(this,li);switch(J.status){case"pending":t.queryHash===n.queryHash&&$(J);break;case"fulfilled":(X||B.data!==J.value)&&fe();break;case"rejected":(!X||B.error!==J.reason)&&fe();break}}return B}updateResult(){const t=L(this,fr),r=this.createResult(L(this,Ke),this.options);if(xe(this,ao,L(this,Ke).state),xe(this,Es,this.options),L(this,ao).data!==void 0&&xe(this,Ps,L(this,Ke)),Lg(r,t))return;xe(this,fr,r);const n=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!L(this,Cs).size)return!0;const c=new Set(o??L(this,Cs));return this.options.throwOnError&&c.add("error"),Object.keys(L(this,fr)).some(l=>{const f=l;return L(this,fr)[f]!==t[f]&&c.has(f)})};We(this,Xe,uN).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&We(this,Xe,Gg).call(this)}},jr=new WeakMap,Ke=new WeakMap,Hu=new WeakMap,fr=new WeakMap,ao=new WeakMap,Es=new WeakMap,li=new WeakMap,ca=new WeakMap,Ku=new WeakMap,As=new WeakMap,Ps=new WeakMap,oo=new WeakMap,so=new WeakMap,da=new WeakMap,Cs=new WeakMap,Xe=new WeakSet,cu=function(t){We(this,Xe,Qg).call(this);let r=L(this,Ke).fetch(this.options,t);return t!=null&&t.throwOnError||(r=r.catch(Sr)),r},Wg=function(){We(this,Xe,Vg).call(this);const t=ga(this.options.staleTime,L(this,Ke));if(wu.isServer()||L(this,fr).isStale||!$g(t))return;const n=eN(L(this,fr).dataUpdatedAt,t)+1;xe(this,oo,qa.setTimeout(()=>{L(this,fr).isStale||this.updateResult()},n))},Hg=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(L(this,Ke)):this.options.refetchInterval)??!1},Kg=function(t){We(this,Xe,qg).call(this),xe(this,da,t),!(wu.isServer()||Tr(this.options.enabled,L(this,Ke))===!1||!$g(L(this,da))||L(this,da)===0)&&xe(this,so,qa.setInterval(()=>{(this.options.refetchIntervalInBackground||dy.isFocused())&&We(this,Xe,cu).call(this)},L(this,da)))},Gg=function(){We(this,Xe,Wg).call(this),We(this,Xe,Kg).call(this,We(this,Xe,Hg).call(this))},Vg=function(){L(this,oo)!==void 0&&(qa.clearTimeout(L(this,oo)),xe(this,oo,void 0))},qg=function(){L(this,so)!==void 0&&(qa.clearInterval(L(this,so)),xe(this,so,void 0))},Qg=function(){const t=L(this,jr).getQueryCache().build(L(this,jr),this.options);if(t===L(this,Ke))return;const r=L(this,Ke);xe(this,Ke,t),xe(this,Hu,t.state),this.hasListeners()&&(r==null||r.removeObserver(this),t.addObserver(this))},uN=function(t){qt.batch(()=>{t.listeners&&this.listeners.forEach(r=>{r(L(this,fr))}),L(this,jr).getQueryCache().notify({query:L(this,Ke),type:"observerResultsUpdated"})})},V2);function HM(e,t){return Tr(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&Tr(t.retryOnMount,e)===!1)}function tw(e,t){return HM(e,t)||e.state.data!==void 0&&Yg(e,t,t.refetchOnMount)}function Yg(e,t,r){if(Tr(t.enabled,e)!==!1&&ga(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&py(e,t)}return!1}function rw(e,t,r,n){return(e!==t||Tr(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&py(e,r)}function py(e,t){return Tr(t.enabled,e)!==!1&&e.isStaleByTime(ga(t.staleTime,e))}function KM(e,t){return!Lg(e.getCurrentResult(),t)}var Gu,In,ir,lo,Tn,ra,q2,GM=(q2=class extends oN{constructor(t){super();De(this,Tn);De(this,Gu);De(this,In);De(this,ir);De(this,lo);xe(this,Gu,t.client),this.mutationId=t.mutationId,xe(this,ir,t.mutationCache),xe(this,In,[]),this.state=t.state||VM(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){L(this,In).includes(t)||(L(this,In).push(t),this.clearGcTimeout(),L(this,ir).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){xe(this,In,L(this,In).filter(r=>r!==t)),this.scheduleGc(),L(this,ir).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){L(this,In).length||(this.state.status==="pending"?this.scheduleGc():L(this,ir).remove(this))}continue(){var t;return((t=L(this,lo))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var c,l,f,h,p,g,x,b,j,k,S,N,E,O,P,_,C,I;const r=()=>{We(this,Tn,ra).call(this,{type:"continue"})},n={client:L(this,Gu),meta:this.options.meta,mutationKey:this.options.mutationKey};xe(this,lo,aN({fn:()=>this.options.mutationFn?this.options.mutationFn(t,n):Promise.reject(new Error("No mutationFn found")),onFail:(B,U)=>{We(this,Tn,ra).call(this,{type:"failed",failureCount:B,error:U})},onPause:()=>{We(this,Tn,ra).call(this,{type:"pause"})},onContinue:r,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>L(this,ir).canRun(this)}));const a=this.state.status==="pending",o=!L(this,lo).canStart();try{if(a)r();else{We(this,Tn,ra).call(this,{type:"pending",variables:t,isPaused:o}),L(this,ir).config.onMutate&&await L(this,ir).config.onMutate(t,this,n);const U=await((l=(c=this.options).onMutate)==null?void 0:l.call(c,t,n));U!==this.state.context&&We(this,Tn,ra).call(this,{type:"pending",context:U,variables:t,isPaused:o})}const B=await L(this,lo).start();return await((h=(f=L(this,ir).config).onSuccess)==null?void 0:h.call(f,B,t,this.state.context,this,n)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,B,t,this.state.context,n)),await((b=(x=L(this,ir).config).onSettled)==null?void 0:b.call(x,B,null,this.state.variables,this.state.context,this,n)),await((k=(j=this.options).onSettled)==null?void 0:k.call(j,B,null,t,this.state.context,n)),We(this,Tn,ra).call(this,{type:"success",data:B}),B}catch(B){try{await((N=(S=L(this,ir).config).onError)==null?void 0:N.call(S,B,t,this.state.context,this,n))}catch(U){Promise.reject(U)}try{await((O=(E=this.options).onError)==null?void 0:O.call(E,B,t,this.state.context,n))}catch(U){Promise.reject(U)}try{await((_=(P=L(this,ir).config).onSettled)==null?void 0:_.call(P,void 0,B,this.state.variables,this.state.context,this,n))}catch(U){Promise.reject(U)}try{await((I=(C=this.options).onSettled)==null?void 0:I.call(C,void 0,B,t,this.state.context,n))}catch(U){Promise.reject(U)}throw We(this,Tn,ra).call(this,{type:"error",error:B}),B}finally{L(this,ir).runNext(this)}}},Gu=new WeakMap,In=new WeakMap,ir=new WeakMap,lo=new WeakMap,Tn=new WeakSet,ra=function(t){const r=n=>{switch(t.type){case"failed":return{...n,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...n,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:t.error,failureCount:n.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=r(this.state),qt.batch(()=>{L(this,In).forEach(n=>{n.onMutationUpdate(t)}),L(this,ir).notify({mutation:this,type:"updated",action:t})})},q2);function VM(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var ui,gn,Vu,Q2,qM=(Q2=class extends qu{constructor(t={}){super();De(this,ui);De(this,gn);De(this,Vu);this.config=t,xe(this,ui,new Set),xe(this,gn,new Map),xe(this,Vu,0)}build(t,r,n){const a=new GM({client:t,mutationCache:this,mutationId:++wd(this,Vu)._,options:t.defaultMutationOptions(r),state:n});return this.add(a),a}add(t){L(this,ui).add(t);const r=jd(t);if(typeof r=="string"){const n=L(this,gn).get(r);n?n.push(t):L(this,gn).set(r,[t])}this.notify({type:"added",mutation:t})}remove(t){if(L(this,ui).delete(t)){const r=jd(t);if(typeof r=="string"){const n=L(this,gn).get(r);if(n)if(n.length>1){const a=n.indexOf(t);a!==-1&&n.splice(a,1)}else n[0]===t&&L(this,gn).delete(r)}}this.notify({type:"removed",mutation:t})}canRun(t){const r=jd(t);if(typeof r=="string"){const n=L(this,gn).get(r),a=n==null?void 0:n.find(o=>o.state.status==="pending");return!a||a===t}else return!0}runNext(t){var n;const r=jd(t);if(typeof r=="string"){const a=(n=L(this,gn).get(r))==null?void 0:n.find(o=>o!==t&&o.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){qt.batch(()=>{L(this,ui).forEach(t=>{this.notify({type:"removed",mutation:t})}),L(this,ui).clear(),L(this,gn).clear()})}getAll(){return Array.from(L(this,ui))}find(t){const r={exact:!0,...t};return this.getAll().find(n=>Q1(r,n))}findAll(t={}){return this.getAll().filter(r=>Q1(t,r))}notify(t){qt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}resumePausedMutations(){const t=this.getAll().filter(r=>r.state.isPaused);return qt.batch(()=>Promise.all(t.map(r=>r.continue().catch(Sr))))}},ui=new WeakMap,gn=new WeakMap,Vu=new WeakMap,Q2);function jd(e){var t;return(t=e.options.scope)==null?void 0:t.id}var Dn,Y2,QM=(Y2=class extends qu{constructor(t={}){super();De(this,Dn);this.config=t,xe(this,Dn,new Map)}build(t,r,n){const a=r.queryKey,o=r.queryHash??fy(a,r);let c=this.get(o);return c||(c=new UM({client:t,queryKey:a,queryHash:o,options:t.defaultQueryOptions(r),state:n,defaultOptions:t.getQueryDefaults(a)}),this.add(c)),c}add(t){L(this,Dn).has(t.queryHash)||(L(this,Dn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const r=L(this,Dn).get(t.queryHash);r&&(t.destroy(),r===t&&L(this,Dn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){qt.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return L(this,Dn).get(t)}getAll(){return[...L(this,Dn).values()]}find(t){const r={exact:!0,...t};return this.getAll().find(n=>q1(r,n))}findAll(t={}){const r=this.getAll();return Object.keys(t).length>0?r.filter(n=>q1(t,n)):r}notify(t){qt.batch(()=>{this.listeners.forEach(r=>{r(t)})})}onFocus(){qt.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){qt.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Dn=new WeakMap,Y2),mt,fa,ha,Os,_s,pa,Ms,Is,X2,YM=(X2=class{constructor(e={}){De(this,mt);De(this,fa);De(this,ha);De(this,Os);De(this,_s);De(this,pa);De(this,Ms);De(this,Is);xe(this,mt,e.queryCache||new QM),xe(this,fa,e.mutationCache||new qM),xe(this,ha,e.defaultOptions||{}),xe(this,Os,new Map),xe(this,_s,new Map),xe(this,pa,0)}mount(){wd(this,pa)._++,L(this,pa)===1&&(xe(this,Ms,dy.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,mt).onFocus())})),xe(this,Is,of.subscribe(async e=>{e&&(await this.resumePausedMutations(),L(this,mt).onOnline())})))}unmount(){var e,t;wd(this,pa)._--,L(this,pa)===0&&((e=L(this,Ms))==null||e.call(this),xe(this,Ms,void 0),(t=L(this,Is))==null||t.call(this),xe(this,Is,void 0))}isFetching(e){return L(this,mt).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return L(this,fa).findAll({...e,status:"pending"}).length}getQueryData(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=L(this,mt).get(t.queryHash))==null?void 0:r.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=L(this,mt).build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(ga(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return L(this,mt).findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),a=L(this,mt).get(n.queryHash),o=a==null?void 0:a.state.data,c=OM(t,o);if(c!==void 0)return L(this,mt).build(this,n).setData(c,{...r,manual:!0})}setQueriesData(e,t,r){return qt.batch(()=>L(this,mt).findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){var r;const t=this.defaultQueryOptions({queryKey:e});return(r=L(this,mt).get(t.queryHash))==null?void 0:r.state}removeQueries(e){const t=L(this,mt);qt.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=L(this,mt);return qt.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=qt.batch(()=>L(this,mt).findAll(e).map(a=>a.cancel(r)));return Promise.all(n).then(Sr).catch(Sr)}invalidateQueries(e,t={}){return qt.batch(()=>(L(this,mt).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},n=qt.batch(()=>L(this,mt).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,r);return r.throwOnError||(o=o.catch(Sr)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(Sr)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=L(this,mt).build(this,t);return r.isStaleByTime(ga(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Sr).catch(Sr)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Sr).catch(Sr)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return of.isOnline()?L(this,fa).resumePausedMutations():Promise.resolve()}getQueryCache(){return L(this,mt)}getMutationCache(){return L(this,fa)}getDefaultOptions(){return L(this,ha)}setDefaultOptions(e){xe(this,ha,e)}setQueryDefaults(e,t){L(this,Os).set(xu(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...L(this,Os).values()],r={};return t.forEach(n=>{bu(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){L(this,_s).set(xu(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...L(this,_s).values()],r={};return t.forEach(n=>{bu(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...L(this,ha).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=fy(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===hy&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...L(this,ha).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){L(this,mt).clear(),L(this,fa).clear()}},mt=new WeakMap,fa=new WeakMap,ha=new WeakMap,Os=new WeakMap,_s=new WeakMap,pa=new WeakMap,Ms=new WeakMap,Is=new WeakMap,X2),cN=v.createContext(void 0),jo=e=>{const t=v.useContext(cN);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},XM=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),u.jsx(cN.Provider,{value:e,children:t})),dN=v.createContext(!1),ZM=()=>v.useContext(dN);dN.Provider;function JM(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var eI=v.createContext(JM()),tI=()=>v.useContext(eI),rI=(e,t,r)=>{const n=r!=null&&r.state.error&&typeof e.throwOnError=="function"?nN(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||n)&&(t.isReset()||(e.retryOnMount=!1))},nI=e=>{v.useEffect(()=>{e.clearReset()},[e])},iI=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(a&&e.data===void 0||nN(r,[e.error,n])),aI=e=>{if(e.suspense){const r=a=>a==="static"?a:Math.max(a??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...a)=>r(n(...a)):r(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},oI=(e,t)=>e.isLoading&&e.isFetching&&!t,sI=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,nw=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function lI(e,t,r){var b,j,k,S;const n=ZM(),a=tI(),o=jo(),c=o.defaultQueryOptions(e);(j=(b=o.getDefaultOptions().queries)==null?void 0:b._experimental_beforeQuery)==null||j.call(b,c);const l=o.getQueryCache().get(c.queryHash),f=e.subscribed!==!1;c._optimisticResults=n?"isRestoring":f?"optimistic":void 0,aI(c),rI(c,a,l),nI(a);const h=!o.getQueryCache().get(c.queryHash),[p]=v.useState(()=>new t(o,c)),g=p.getOptimisticResult(c),x=!n&&f;if(v.useSyncExternalStore(v.useCallback(N=>{const E=x?p.subscribe(qt.batchCalls(N)):Sr;return p.updateResult(),E},[p,x]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),v.useEffect(()=>{p.setOptions(c)},[c,p]),sI(c,g))throw nw(c,p,a);if(iI({result:g,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw g.error;if((S=(k=o.getDefaultOptions().queries)==null?void 0:k._experimental_afterQuery)==null||S.call(k,c,g),c.experimental_prefetchInRender&&!wu.isServer()&&oI(g,n)){const N=h?nw(c,p,a):l==null?void 0:l.promise;N==null||N.catch(Sr).finally(()=>{p.updateResult()})}return c.notifyOnChangeProps?g:p.trackResult(g)}function sr(e,t){return lI(e,WM)}/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uI=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fN=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var cI={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.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dI=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:o,iconNode:c,...l},f)=>v.createElement("svg",{ref:f,...cI,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:fN("lucide",a),...l},[...c.map(([h,p])=>v.createElement(h,p)),...Array.isArray(o)?o:[o]]));/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ge=(e,t)=>{const r=v.forwardRef(({className:n,...a},o)=>v.createElement(dI,{ref:o,iconNode:t,className:fN(`lucide-${uI(e)}`,n),...a}));return r.displayName=`${e}`,r};/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ku=ge("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iw=ge("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fI=ge("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** - * @license lucide-react v0.460.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=ge("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yi=ge("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const hI=ge("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.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zg=ge("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.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ah=ge("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pI=ge("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yr=ge("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mI=ge("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gI=ge("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** - * @license lucide-react v0.460.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=ge("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const vI=ge("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yI=ge("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xI=ge("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.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bI=ge("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wI=ge("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pN=ge("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kI=ge("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jg=ge("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const jI=ge("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sf=ge("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zn=ge("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SI=ge("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ts=ge("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ju=ge("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aw=ge("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ev=ge("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const NI=ge("FileText",[["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:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const EI=ge("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AI=ge("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PI=ge("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.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Km=ge("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ow=ge("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CI=ge("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OI=ge("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oh=ge("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _I=ge("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MI=ge("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const II=ge("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TI=ge("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DI=ge("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RI=ge("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $I=ge("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const LI=ge("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zI=ge("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FI=ge("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const BI=ge("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tv=ge("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rv=ge("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const UI=ge("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const WI=ge("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mu=ge("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const HI=ge("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const my=ge("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KI=ge("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gy=ge("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const GI=ge("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VI=ge("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Su=ge("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const du=ge("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mN=ge("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qI=ge("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gN=ge("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nv=ge("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ds=ge("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QI=ge("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lf=ge("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pi=ge("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.460.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const uo=ge("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),iv=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:_I},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:Zg},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:ah},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:tv},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:yi},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:mN},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:xI}];var sw=1,YI=.9,XI=.8,ZI=.17,Gm=.1,Vm=.999,JI=.9999,eT=.99,tT=/[\\\/_+.#"@\[\(\{&]/,rT=/[\\\/_+.#"@\[\(\{&]/g,nT=/[\s-]/,vN=/[\s-]/g;function av(e,t,r,n,a,o,c){if(o===t.length)return a===e.length?sw:eT;var l=`${a},${o}`;if(c[l]!==void 0)return c[l];for(var f=n.charAt(o),h=r.indexOf(f,a),p=0,g,x,b,j;h>=0;)g=av(e,t,r,n,h+1,o+1,c),g>p&&(h===a?g*=sw:tT.test(e.charAt(h-1))?(g*=XI,b=e.slice(a,h-1).match(rT),b&&a>0&&(g*=Math.pow(Vm,b.length))):nT.test(e.charAt(h-1))?(g*=YI,j=e.slice(a,h-1).match(vN),j&&a>0&&(g*=Math.pow(Vm,j.length))):(g*=ZI,a>0&&(g*=Math.pow(Vm,h-a))),e.charAt(h)!==t.charAt(o)&&(g*=JI)),(gg&&(g=x*Gm)),g>p&&(p=g),h=r.indexOf(f,h+1);return c[l]=p,p}function lw(e){return e.toLowerCase().replace(vN," ")}function iT(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,av(e,t,lw(e),lw(t),0,0,{})}function va(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e==null||e(a),r===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function uw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rs(...e){return t=>{let r=!1;const n=e.map(a=>{const o=uw(a,t);return!r&&typeof o=="function"&&(r=!0),o});if(r)return()=>{for(let a=0;a{var N;const{scope:x,children:b,...j}=g,k=((N=x==null?void 0:x[e])==null?void 0:N[f])||l,S=v.useMemo(()=>j,Object.values(j));return u.jsx(k.Provider,{value:S,children:b})};h.displayName=o+"Provider";function p(g,x){var k;const b=((k=x==null?void 0:x[e])==null?void 0:k[f])||l,j=v.useContext(b);if(j)return j;if(c!==void 0)return c;throw new Error(`\`${g}\` must be used within \`${o}\``)}return[h,p]}const a=()=>{const o=r.map(c=>v.createContext(c));return function(l){const f=(l==null?void 0:l[e])||o;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:f}}),[l,f])}};return a.scopeName=e,[n,oT(a,...t)]}function oT(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const c=n.reduce((l,{useScope:f,scopeName:h})=>{const g=f(o)[`__scope${h}`];return{...l,...g}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return r.scopeName=t.scopeName,r}var Nu=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},sT=ih[" useId ".trim().toString()]||(()=>{}),lT=0;function mi(e){const[t,r]=v.useState(sT());return Nu(()=>{r(n=>n??String(lT++))},[e]),t?`radix-${t}`:""}var uT=ih[" useInsertionEffect ".trim().toString()]||Nu;function cT({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[a,o,c]=dT({defaultProp:t,onChange:r}),l=e!==void 0,f=l?e:a;{const p=v.useRef(e!==void 0);v.useEffect(()=>{const g=p.current;g!==l&&console.warn(`${n} is changing from ${g?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=l},[l,n])}const h=v.useCallback(p=>{var g;if(l){const x=fT(p)?p(e):p;x!==e&&((g=c.current)==null||g.call(c,x))}else o(p)},[l,e,o,c]);return[f,h]}function dT({defaultProp:e,onChange:t}){const[r,n]=v.useState(e),a=v.useRef(r),o=v.useRef(t);return uT(()=>{o.current=t},[t]),v.useEffect(()=>{var c;a.current!==r&&((c=o.current)==null||c.call(o,r),a.current=r)},[r,a]),[r,n,o]}function fT(e){return typeof e=="function"}var sh=J2();function yN(e){const t=v.forwardRef((r,n)=>{let{children:a,...o}=r,c=null,l=!1;const f=[];cw(a)&&typeof Sd=="function"&&(a=Sd(a._payload)),v.Children.forEach(a,x=>{var b;if(vT(x)){l=!0;const j=x;let k="child"in j.props?j.props.child:j.props.children;cw(k)&&typeof Sd=="function"&&(k=Sd(k._payload)),c=pT(j,k),f.push((b=c==null?void 0:c.props)==null?void 0:b.children)}else f.push(x)}),c?c=v.cloneElement(c,void 0,f):!l&&v.Children.count(a)===1&&v.isValidElement(a)&&(c=a);const h=c?gT(c):void 0,p=So(n,h);if(!c){if(a||a===0)throw new Error(l?wT(e):bT(e));return a}const g=mT(o,c.props??{});return c.type!==v.Fragment&&(g.ref=n?p:h),v.cloneElement(c,g)});return t.displayName=`${e}.Slot`,t}var hT=Symbol.for("radix.slottable"),pT=(e,t)=>{if("child"in e.props){const r=e.props.child;return v.isValidElement(r)?v.cloneElement(r,void 0,e.props.children(r.props.children)):null}return v.isValidElement(t)?t:null};function mT(e,t){const r={...t};for(const n in t){const a=e[n],o=t[n];/^on[A-Z]/.test(n)?a&&o?r[n]=(...l)=>{const f=o(...l);return a(...l),f}:a&&(r[n]=a):n==="style"?r[n]={...a,...o}:n==="className"&&(r[n]=[a,o].filter(Boolean).join(" "))}return{...e,...r}}function gT(e){var n,a;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function vT(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===hT}var yT=Symbol.for("react.lazy");function cw(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===yT&&"_payload"in e&&xT(e._payload)}function xT(e){return typeof e=="object"&&e!==null&&"then"in e}var bT=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,wT=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Sd=ih[" use ".trim().toString()],kT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Xt=kT.reduce((e,t)=>{const r=yN(`Primitive.${t}`),n=v.forwardRef((a,o)=>{const{asChild:c,...l}=a,f=c?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),u.jsx(f,{...l,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function jT(e,t){e&&sh.flushSync(()=>e.dispatchEvent(t))}function Eu(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>((...r)=>{var n;return(n=t.current)==null?void 0:n.call(t,...r)}),[])}function ST(e,t=globalThis==null?void 0:globalThis.document){const r=Eu(e);v.useEffect(()=>{const n=a=>{a.key==="Escape"&&r(a)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var NT="DismissableLayer",ov="dismissableLayer.update",ET="dismissableLayer.pointerDownOutside",AT="dismissableLayer.focusOutside",dw,vy=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xN=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:n=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:c,onInteractOutside:l,onDismiss:f,...h}=e,p=v.useContext(vy),[g,x]=v.useState(null),b=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,j]=v.useState({}),k=So(t,U=>x(U)),S=Array.from(p.layers),[N]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),E=S.indexOf(N),O=g?S.indexOf(g):-1,P=p.layersWithOutsidePointerEventsDisabled.size>0,_=O>=E,C=v.useRef(!1),I=_T(U=>{const G=U.target;if(!(G instanceof Node))return;const X=[...p.branches].some($=>$.contains(G));!_||X||(o==null||o(U),l==null||l(U),U.defaultPrevented||f==null||f())},{ownerDocument:b,deferPointerDownOutside:n,isDeferredPointerDownOutsideRef:C,dismissableSurfaces:p.dismissableSurfaces}),B=MT(U=>{if(n&&C.current)return;const G=U.target;[...p.branches].some($=>$.contains(G))||(c==null||c(U),l==null||l(U),U.defaultPrevented||f==null||f())},b);return ST(U=>{O===p.layers.size-1&&(a==null||a(U),!U.defaultPrevented&&f&&(U.preventDefault(),f()))},b),v.useEffect(()=>{if(g)return r&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(dw=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(g)),p.layers.add(g),fw(),()=>{r&&(p.layersWithOutsidePointerEventsDisabled.delete(g),p.layersWithOutsidePointerEventsDisabled.size===0&&(b.body.style.pointerEvents=dw))}},[g,b,r,p]),v.useEffect(()=>()=>{g&&(p.layers.delete(g),p.layersWithOutsidePointerEventsDisabled.delete(g),fw())},[g,p]),v.useEffect(()=>{const U=()=>j({});return document.addEventListener(ov,U),()=>document.removeEventListener(ov,U)},[]),u.jsx(Xt.div,{...h,ref:k,style:{pointerEvents:P?_?"auto":"none":void 0,...e.style},onFocusCapture:va(e.onFocusCapture,B.onFocusCapture),onBlurCapture:va(e.onBlurCapture,B.onBlurCapture),onPointerDownCapture:va(e.onPointerDownCapture,I.onPointerDownCapture)})});xN.displayName=NT;var PT="DismissableLayerBranch",CT=v.forwardRef((e,t)=>{const r=v.useContext(vy),n=v.useRef(null),a=So(t,n);return v.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),u.jsx(Xt.div,{...e,ref:a})});CT.displayName=PT;function OT(){const e=v.useContext(vy),[t,r]=v.useState(null);return v.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}function _T(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:n=!1,isDeferredPointerDownOutsideRef:a,dismissableSurfaces:o}=t,c=Eu(e),l=v.useRef(!1),f=v.useRef(!1),h=v.useRef(new Map),p=v.useRef(()=>{});return v.useEffect(()=>{function g(){f.current=!1,a.current=!1,h.current.clear()}function x(){return Array.from(h.current.values()).some(Boolean)}function b(E){if(!f.current)return;const O=E.target;O instanceof Node&&[...o].some(_=>_.contains(O))||h.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{f.current&&p.current()},0)}function j(E){f.current&&h.current.set(E.type,!1)}const k=E=>{if(E.target&&!l.current){let O=function(){r.removeEventListener("click",p.current);const _=x();g(),_||bN(ET,c,P,{discrete:!0})};const P={originalEvent:E};f.current=!0,a.current=n&&E.button===0,h.current.clear(),!n||E.button!==0?O():(r.removeEventListener("click",p.current),p.current=O,r.addEventListener("click",p.current,{once:!0}))}else r.removeEventListener("click",p.current),g();l.current=!1},S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const E of S)r.addEventListener(E,b,!0),r.addEventListener(E,j);const N=window.setTimeout(()=>{r.addEventListener("pointerdown",k)},0);return()=>{window.clearTimeout(N),r.removeEventListener("pointerdown",k),r.removeEventListener("click",p.current);for(const E of S)r.removeEventListener(E,b,!0),r.removeEventListener(E,j)}},[r,c,n,a,o]),{onPointerDownCapture:()=>l.current=!0}}function MT(e,t=globalThis==null?void 0:globalThis.document){const r=Eu(e),n=v.useRef(!1);return v.useEffect(()=>{const a=o=>{o.target&&!n.current&&bN(AT,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function fw(){const e=new CustomEvent(ov);document.dispatchEvent(e)}function bN(e,t,r,{discrete:n}){const a=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&a.addEventListener(e,t,{once:!0}),n?jT(a,o):a.dispatchEvent(o)}var qm="focusScope.autoFocusOnMount",Qm="focusScope.autoFocusOnUnmount",hw={bubbles:!1,cancelable:!0},IT="FocusScope",wN=v.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...c}=e,[l,f]=v.useState(null),h=Eu(a),p=Eu(o),g=v.useRef(null),x=So(t,k=>f(k)),b=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(n){let k=function(O){if(b.paused||!l)return;const P=O.target;l.contains(P)?g.current=P:na(g.current,{select:!0})},S=function(O){if(b.paused||!l)return;const P=O.relatedTarget;P!==null&&(l.contains(P)||na(g.current,{select:!0}))},N=function(O){if(document.activeElement===document.body)for(const _ of O)_.removedNodes.length>0&&na(l)};document.addEventListener("focusin",k),document.addEventListener("focusout",S);const E=new MutationObserver(N);return l&&E.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",S),E.disconnect()}}},[n,l,b.paused]),v.useEffect(()=>{if(l){mw.add(b);const k=document.activeElement;if(!l.contains(k)){const N=new CustomEvent(qm,hw);l.addEventListener(qm,h),l.dispatchEvent(N),N.defaultPrevented||(TT(zT(kN(l)),{select:!0}),document.activeElement===k&&na(l))}return()=>{l.removeEventListener(qm,h),setTimeout(()=>{const N=new CustomEvent(Qm,hw);l.addEventListener(Qm,p),l.dispatchEvent(N),N.defaultPrevented||na(k??document.body,{select:!0}),l.removeEventListener(Qm,p),mw.remove(b)},0)}}},[l,h,p,b]);const j=v.useCallback(k=>{if(!r&&!n||b.paused)return;const S=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,N=document.activeElement;if(S&&N){const E=k.currentTarget,[O,P]=DT(E);O&&P?!k.shiftKey&&N===P?(k.preventDefault(),r&&na(O,{select:!0})):k.shiftKey&&N===O&&(k.preventDefault(),r&&na(P,{select:!0})):N===E&&k.preventDefault()}},[r,n,b.paused]);return u.jsx(Xt.div,{tabIndex:-1,...c,ref:x,onKeyDown:j})});wN.displayName=IT;function TT(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(na(n,{select:t}),document.activeElement!==r)return}function DT(e){const t=kN(e),r=pw(t,e),n=pw(t.reverse(),e);return[r,n]}function kN(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const a=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||a?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function pw(e,t){for(const r of e)if(!RT(r,{upTo:t}))return r}function RT(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function $T(e){return e instanceof HTMLInputElement&&"select"in e}function na(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&$T(e)&&t&&e.select()}}var mw=LT();function LT(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=gw(e,t),e.unshift(t)},remove(t){var r;e=gw(e,t),(r=e[0])==null||r.resume()}}}function gw(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function zT(e){return e.filter(t=>t.tagName!=="A")}var FT="Portal",jN=v.forwardRef((e,t)=>{var l;const{container:r,...n}=e,[a,o]=v.useState(!1);Nu(()=>o(!0),[]);const c=r||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return c?sh.createPortal(u.jsx(Xt.div,{...n,ref:t}),c):null});jN.displayName=FT;function BT(e,t){return v.useReducer((r,n)=>t[r][n]??r,e)}var lh=e=>{const{present:t,children:r}=e,n=UT(t),a=typeof r=="function"?r({present:n.isPresent}):v.Children.only(r),o=WT(n.ref,HT(a));return typeof r=="function"||n.isPresent?v.cloneElement(a,{ref:o}):null};lh.displayName="Presence";function UT(e){const[t,r]=v.useState(),n=v.useRef(null),a=v.useRef(e),o=v.useRef("none"),c=e?"mounted":"unmounted",[l,f]=BT(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const h=Nd(n.current);o.current=l==="mounted"?h:"none"},[l]),Nu(()=>{const h=n.current,p=a.current;if(p!==e){const x=o.current,b=Nd(h);e?f("MOUNT"):b==="none"||(h==null?void 0:h.display)==="none"?f("UNMOUNT"):f(p&&x!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,f]),Nu(()=>{if(t){let h;const p=t.ownerDocument.defaultView??window,g=b=>{const k=Nd(n.current).includes(CSS.escape(b.animationName));if(b.target===t&&k&&(f("ANIMATION_END"),!a.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",h=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},x=b=>{b.target===t&&(o.current=Nd(n.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",g),t.addEventListener("animationend",g),()=>{p.clearTimeout(h),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",g),t.removeEventListener("animationend",g)}}else f("ANIMATION_END")},[t,f]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(h=>{n.current=h?getComputedStyle(h):null,r(h)},[])}}function vw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function WT(...e){const t=v.useRef(e);return t.current=e,v.useCallback(r=>{const n=t.current;let a=!1;const o=n.map(c=>{const l=vw(c,r);return!a&&typeof l=="function"&&(a=!0),l});if(a)return()=>{for(let c=0;c{Cn||(Cn={start:yw(),end:yw()});const{start:e,end:t}=Cn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ed++,()=>{Ed===1&&(Cn==null||Cn.start.remove(),Cn==null||Cn.end.remove(),Cn=null),Ed=Math.max(0,Ed-1)}},[])}function yw(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Rn=function(){return Rn=Object.assign||function(t){for(var r,n=1,a=arguments.length;n"u")return l3;var t=u3(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},d3=AN(),gs="data-scroll-locked",f3=function(e,t,r,n){var a=e.left,o=e.top,c=e.right,l=e.gap;return r===void 0&&(r="margin"),` - .`.concat(VT,` { - overflow: hidden `).concat(n,`; - padding-right: `).concat(l,"px ").concat(n,`; - } - body[`).concat(gs,`] { - overflow: hidden `).concat(n,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&` - padding-left: `.concat(a,`px; - padding-top: `).concat(o,`px; - padding-right: `).concat(c,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(l,"px ").concat(n,`; - `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(n,";")].filter(Boolean).join(""),` - } - - .`).concat(Yd,` { - right: `).concat(l,"px ").concat(n,`; - } - - .`).concat(Xd,` { - margin-right: `).concat(l,"px ").concat(n,`; - } - - .`).concat(Yd," .").concat(Yd,` { - right: 0 `).concat(n,`; - } - - .`).concat(Xd," .").concat(Xd,` { - margin-right: 0 `).concat(n,`; - } - - body[`).concat(gs,`] { - `).concat(qT,": ").concat(l,`px; - } -`)},bw=function(){var e=parseInt(document.body.getAttribute(gs)||"0",10);return isFinite(e)?e:0},h3=function(){v.useEffect(function(){return document.body.setAttribute(gs,(bw()+1).toString()),function(){var e=bw()-1;e<=0?document.body.removeAttribute(gs):document.body.setAttribute(gs,e.toString())}},[])},p3=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,a=n===void 0?"margin":n;h3();var o=v.useMemo(function(){return c3(a)},[a]);return v.createElement(d3,{styles:f3(o,!t,a,r?"":"!important")})},sv=!1;if(typeof window<"u")try{var Ad=Object.defineProperty({},"passive",{get:function(){return sv=!0,!0}});window.addEventListener("test",Ad,Ad),window.removeEventListener("test",Ad,Ad)}catch{sv=!1}var Jo=sv?{passive:!1}:!1,m3=function(e){return e.tagName==="TEXTAREA"},PN=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!m3(e)&&r[t]==="visible")},g3=function(e){return PN(e,"overflowY")},v3=function(e){return PN(e,"overflowX")},ww=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var a=CN(e,n);if(a){var o=ON(e,n),c=o[1],l=o[2];if(c>l)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},y3=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},x3=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},CN=function(e,t){return e==="v"?g3(t):v3(t)},ON=function(e,t){return e==="v"?y3(t):x3(t)},b3=function(e,t){return e==="h"&&t==="rtl"?-1:1},w3=function(e,t,r,n,a){var o=b3(e,window.getComputedStyle(t).direction),c=o*n,l=r.target,f=t.contains(l),h=!1,p=c>0,g=0,x=0;do{if(!l)break;var b=ON(e,l),j=b[0],k=b[1],S=b[2],N=k-S-o*j;(j||N)&&CN(e,l)&&(g+=N,x+=j);var E=l.parentNode;l=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!f&&l!==document.body||f&&(t.contains(l)||t===l));return(p&&Math.abs(g)<1||!p&&Math.abs(x)<1)&&(h=!0),h},Pd=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},kw=function(e){return[e.deltaX,e.deltaY]},jw=function(e){return e&&"current"in e?e.current:e},k3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},j3=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},S3=0,es=[];function N3(e){var t=v.useRef([]),r=v.useRef([0,0]),n=v.useRef(),a=v.useState(S3++)[0],o=v.useState(AN)[0],c=v.useRef(e);v.useEffect(function(){c.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var k=GT([e.lockRef.current],(e.shards||[]).map(jw),!0).filter(Boolean);return k.forEach(function(S){return S.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),k.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(k,S){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!c.current.allowPinchZoom;var N=Pd(k),E=r.current,O="deltaX"in k?k.deltaX:E[0]-N[0],P="deltaY"in k?k.deltaY:E[1]-N[1],_,C=k.target,I=Math.abs(O)>Math.abs(P)?"h":"v";if("touches"in k&&I==="h"&&C.type==="range")return!1;var B=window.getSelection(),U=B&&B.anchorNode,G=U?U===C||U.contains(C):!1;if(G)return!1;var X=ww(I,C);if(!X)return!0;if(X?_=I:(_=I==="v"?"h":"v",X=ww(I,C)),!X)return!1;if(!n.current&&"changedTouches"in k&&(O||P)&&(n.current=_),!_)return!0;var $=n.current||_;return w3($,S,k,$==="h"?O:P)},[]),f=v.useCallback(function(k){var S=k;if(!(!es.length||es[es.length-1]!==o)){var N="deltaY"in S?kw(S):Pd(S),E=t.current.filter(function(_){return _.name===S.type&&(_.target===S.target||S.target===_.shadowParent)&&k3(_.delta,N)})[0];if(E&&E.should){S.cancelable&&S.preventDefault();return}if(!E){var O=(c.current.shards||[]).map(jw).filter(Boolean).filter(function(_){return _.contains(S.target)}),P=O.length>0?l(S,O[0]):!c.current.noIsolation;P&&S.cancelable&&S.preventDefault()}}},[]),h=v.useCallback(function(k,S,N,E){var O={name:k,delta:S,target:N,should:E,shadowParent:E3(N)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(P){return P!==O})},1)},[]),p=v.useCallback(function(k){r.current=Pd(k),n.current=void 0},[]),g=v.useCallback(function(k){h(k.type,kw(k),k.target,l(k,e.lockRef.current))},[]),x=v.useCallback(function(k){h(k.type,Pd(k),k.target,l(k,e.lockRef.current))},[]);v.useEffect(function(){return es.push(o),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:x}),document.addEventListener("wheel",f,Jo),document.addEventListener("touchmove",f,Jo),document.addEventListener("touchstart",p,Jo),function(){es=es.filter(function(k){return k!==o}),document.removeEventListener("wheel",f,Jo),document.removeEventListener("touchmove",f,Jo),document.removeEventListener("touchstart",p,Jo)}},[]);var b=e.removeScrollBar,j=e.inert;return v.createElement(v.Fragment,null,j?v.createElement(o,{styles:j3(a)}):null,b?v.createElement(p3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function E3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const A3=t3(EN,N3);var _N=v.forwardRef(function(e,t){return v.createElement(uh,Rn({},e,{ref:t,sideCar:A3}))});_N.classNames=uh.classNames;var P3=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ts=new WeakMap,Cd=new WeakMap,Od={},Jm=0,MN=function(e){return e&&(e.host||MN(e.parentNode))},C3=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=MN(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},O3=function(e,t,r,n){var a=C3(t,Array.isArray(e)?e:[e]);Od[r]||(Od[r]=new WeakMap);var o=Od[r],c=[],l=new Set,f=new Set(a),h=function(g){!g||l.has(g)||(l.add(g),h(g.parentNode))};a.forEach(h);var p=function(g){!g||f.has(g)||Array.prototype.forEach.call(g.children,function(x){if(l.has(x))p(x);else try{var b=x.getAttribute(n),j=b!==null&&b!=="false",k=(ts.get(x)||0)+1,S=(o.get(x)||0)+1;ts.set(x,k),o.set(x,S),c.push(x),k===1&&j&&Cd.set(x,!0),S===1&&x.setAttribute(r,"true"),j||x.setAttribute(n,"true")}catch(N){console.error("aria-hidden: cannot operate on ",x,N)}})};return p(t),l.clear(),Jm++,function(){c.forEach(function(g){var x=ts.get(g)-1,b=o.get(g)-1;ts.set(g,x),o.set(g,b),x||(Cd.has(g)||g.removeAttribute(n),Cd.delete(g)),b||g.removeAttribute(r)}),Jm--,Jm||(ts=new WeakMap,ts=new WeakMap,Cd=new WeakMap,Od={})}},_3=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),a=P3(e);return a?(n.push.apply(n,Array.from(a.querySelectorAll("[aria-live], script"))),O3(n,a,r,"aria-hidden")):function(){return null}},ch="Dialog",[IN]=aT(ch),[M3,kn]=IN(ch),TN=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:a,onOpenChange:o,modal:c=!0}=e,l=v.useRef(null),f=v.useRef(null),[h,p]=cT({prop:n,defaultProp:a??!1,onChange:o,caller:ch});return u.jsx(M3,{scope:t,triggerRef:l,contentRef:f,contentId:mi(),titleId:mi(),descriptionId:mi(),open:h,onOpenChange:p,onOpenToggle:v.useCallback(()=>p(g=>!g),[p]),modal:c,children:r})};TN.displayName=ch;var DN="DialogTrigger",I3=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=kn(DN,r),o=So(t,a.triggerRef);return u.jsx(Xt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":xy(a.open),...n,ref:o,onClick:va(e.onClick,a.onOpenToggle)})});I3.displayName=DN;var yy="DialogPortal",[T3,RN]=IN(yy,{forceMount:void 0}),$N=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:a}=e,o=kn(yy,t);return u.jsx(T3,{scope:t,forceMount:r,children:v.Children.map(n,c=>u.jsx(lh,{present:r||o.open,children:u.jsx(jN,{asChild:!0,container:a,children:c})}))})};$N.displayName=yy;var uf="DialogOverlay",LN=v.forwardRef((e,t)=>{const r=RN(uf,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,o=kn(uf,e.__scopeDialog);return o.modal?u.jsx(lh,{present:n||o.open,children:u.jsx(R3,{...a,ref:t})}):null});LN.displayName=uf;var D3=yN("DialogOverlay.RemoveScroll"),R3=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=kn(uf,r),o=OT(),c=So(t,o);return u.jsx(_N,{as:D3,allowPinchZoom:!0,shards:[a.contentRef],children:u.jsx(Xt.div,{"data-state":xy(a.open),...n,ref:c,style:{pointerEvents:"auto",...n.style}})})}),$s="DialogContent",zN=v.forwardRef((e,t)=>{const r=RN($s,e.__scopeDialog),{forceMount:n=r.forceMount,...a}=e,o=kn($s,e.__scopeDialog);return u.jsx(lh,{present:n||o.open,children:o.modal?u.jsx($3,{...a,ref:t}):u.jsx(L3,{...a,ref:t})})});zN.displayName=$s;var $3=v.forwardRef((e,t)=>{const r=kn($s,e.__scopeDialog),n=v.useRef(null),a=So(t,r.contentRef,n);return v.useEffect(()=>{const o=n.current;if(o)return _3(o)},[]),u.jsx(FN,{...e,ref:a,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:va(e.onCloseAutoFocus,o=>{var c;o.preventDefault(),(c=r.triggerRef.current)==null||c.focus()}),onPointerDownOutside:va(e.onPointerDownOutside,o=>{const c=o.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0;(c.button===2||l)&&o.preventDefault()}),onFocusOutside:va(e.onFocusOutside,o=>o.preventDefault())})}),L3=v.forwardRef((e,t)=>{const r=kn($s,e.__scopeDialog),n=v.useRef(!1),a=v.useRef(!1);return u.jsx(FN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var c,l;(c=e.onCloseAutoFocus)==null||c.call(e,o),o.defaultPrevented||(n.current||(l=r.triggerRef.current)==null||l.focus(),o.preventDefault()),n.current=!1,a.current=!1},onInteractOutside:o=>{var f,h;(f=e.onInteractOutside)==null||f.call(e,o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const c=o.target;((h=r.triggerRef.current)==null?void 0:h.contains(c))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),FN=v.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:a,onCloseAutoFocus:o,...c}=e,l=kn($s,r);return KT(),u.jsx(u.Fragment,{children:u.jsx(wN,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:a,onUnmountAutoFocus:o,children:u.jsx(xN,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":xy(l.open),...c,ref:t,deferPointerDownOutside:!0,onDismiss:()=>l.onOpenChange(!1)})})})}),BN="DialogTitle",z3=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=kn(BN,r);return u.jsx(Xt.h2,{id:a.titleId,...n,ref:t})});z3.displayName=BN;var UN="DialogDescription",F3=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=kn(UN,r);return u.jsx(Xt.p,{id:a.descriptionId,...n,ref:t})});F3.displayName=UN;var WN="DialogClose",B3=v.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,a=kn(WN,r);return u.jsx(Xt.button,{type:"button",...n,ref:t,onClick:va(e.onClick,()=>a.onOpenChange(!1))})});B3.displayName=WN;function xy(e){return e?"open":"closed"}var Xl='[cmdk-group=""]',eg='[cmdk-group-items=""]',U3='[cmdk-group-heading=""]',HN='[cmdk-item=""]',Sw=`${HN}:not([aria-disabled="true"])`,lv="cmdk-item-select",ds="data-value",W3=(e,t,r)=>iT(e,t,r),KN=v.createContext(void 0),Qu=()=>v.useContext(KN),GN=v.createContext(void 0),by=()=>v.useContext(GN),VN=v.createContext(void 0),qN=v.forwardRef((e,t)=>{let r=fs(()=>{var T,Z;return{search:"",value:(Z=(T=e.value)!=null?T:e.defaultValue)!=null?Z:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=fs(()=>new Set),a=fs(()=>new Map),o=fs(()=>new Map),c=fs(()=>new Set),l=QN(e),{label:f,children:h,value:p,onValueChange:g,filter:x,shouldFilter:b,loop:j,disablePointerSelection:k=!1,vimBindings:S=!0,...N}=e,E=mi(),O=mi(),P=mi(),_=v.useRef(null),C=e4();po(()=>{if(p!==void 0){let T=p.trim();r.current.value=T,I.emit()}},[p]),po(()=>{C(6,fe)},[]);let I=v.useMemo(()=>({subscribe:T=>(c.current.add(T),()=>c.current.delete(T)),snapshot:()=>r.current,setState:(T,Z,oe)=>{var re,ue,me,Pe;if(!Object.is(r.current[T],Z)){if(r.current[T]=Z,T==="search")$(),G(),C(1,X);else if(T==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let te=document.getElementById(P);te?te.focus():(re=document.getElementById(E))==null||re.focus()}if(C(7,()=>{var te;r.current.selectedItemId=(te=J())==null?void 0:te.id,I.emit()}),oe||C(5,fe),((ue=l.current)==null?void 0:ue.value)!==void 0){let te=Z??"";(Pe=(me=l.current).onValueChange)==null||Pe.call(me,te);return}}I.emit()}},emit:()=>{c.current.forEach(T=>T())}}),[]),B=v.useMemo(()=>({value:(T,Z,oe)=>{var re;Z!==((re=o.current.get(T))==null?void 0:re.value)&&(o.current.set(T,{value:Z,keywords:oe}),r.current.filtered.items.set(T,U(Z,oe)),C(2,()=>{G(),I.emit()}))},item:(T,Z)=>(n.current.add(T),Z&&(a.current.has(Z)?a.current.get(Z).add(T):a.current.set(Z,new Set([T]))),C(3,()=>{$(),G(),r.current.value||X(),I.emit()}),()=>{o.current.delete(T),n.current.delete(T),r.current.filtered.items.delete(T);let oe=J();C(4,()=>{$(),(oe==null?void 0:oe.getAttribute("id"))===T&&X(),I.emit()})}),group:T=>(a.current.has(T)||a.current.set(T,new Set),()=>{o.current.delete(T),a.current.delete(T)}),filter:()=>l.current.shouldFilter,label:f||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:E,inputId:P,labelId:O,listInnerRef:_}),[]);function U(T,Z){var oe,re;let ue=(re=(oe=l.current)==null?void 0:oe.filter)!=null?re:W3;return T?ue(T,r.current.search,Z):0}function G(){if(!r.current.search||l.current.shouldFilter===!1)return;let T=r.current.filtered.items,Z=[];r.current.filtered.groups.forEach(re=>{let ue=a.current.get(re),me=0;ue.forEach(Pe=>{let te=T.get(Pe);me=Math.max(te,me)}),Z.push([re,me])});let oe=_.current;pe().sort((re,ue)=>{var me,Pe;let te=re.getAttribute("id"),ve=ue.getAttribute("id");return((me=T.get(ve))!=null?me:0)-((Pe=T.get(te))!=null?Pe:0)}).forEach(re=>{let ue=re.closest(eg);ue?ue.appendChild(re.parentElement===ue?re:re.closest(`${eg} > *`)):oe.appendChild(re.parentElement===oe?re:re.closest(`${eg} > *`))}),Z.sort((re,ue)=>ue[1]-re[1]).forEach(re=>{var ue;let me=(ue=_.current)==null?void 0:ue.querySelector(`${Xl}[${ds}="${encodeURIComponent(re[0])}"]`);me==null||me.parentElement.appendChild(me)})}function X(){let T=pe().find(oe=>oe.getAttribute("aria-disabled")!=="true"),Z=T==null?void 0:T.getAttribute(ds);I.setState("value",Z||void 0)}function $(){var T,Z,oe,re;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let ue=0;for(let me of n.current){let Pe=(Z=(T=o.current.get(me))==null?void 0:T.value)!=null?Z:"",te=(re=(oe=o.current.get(me))==null?void 0:oe.keywords)!=null?re:[],ve=U(Pe,te);r.current.filtered.items.set(me,ve),ve>0&&ue++}for(let[me,Pe]of a.current)for(let te of Pe)if(r.current.filtered.items.get(te)>0){r.current.filtered.groups.add(me);break}r.current.filtered.count=ue}function fe(){var T,Z,oe;let re=J();re&&(((T=re.parentElement)==null?void 0:T.firstChild)===re&&((oe=(Z=re.closest(Xl))==null?void 0:Z.querySelector(U3))==null||oe.scrollIntoView({block:"nearest"})),re.scrollIntoView({block:"nearest"}))}function J(){var T;return(T=_.current)==null?void 0:T.querySelector(`${HN}[aria-selected="true"]`)}function pe(){var T;return Array.from(((T=_.current)==null?void 0:T.querySelectorAll(Sw))||[])}function be(T){let Z=pe()[T];Z&&I.setState("value",Z.getAttribute(ds))}function de(T){var Z;let oe=J(),re=pe(),ue=re.findIndex(Pe=>Pe===oe),me=re[ue+T];(Z=l.current)!=null&&Z.loop&&(me=ue+T<0?re[re.length-1]:ue+T===re.length?re[0]:re[ue+T]),me&&I.setState("value",me.getAttribute(ds))}function Y(T){let Z=J(),oe=Z==null?void 0:Z.closest(Xl),re;for(;oe&&!re;)oe=T>0?Z3(oe,Xl):J3(oe,Xl),re=oe==null?void 0:oe.querySelector(Sw);re?I.setState("value",re.getAttribute(ds)):de(T)}let V=()=>be(pe().length-1),Q=T=>{T.preventDefault(),T.metaKey?V():T.altKey?Y(1):de(1)},D=T=>{T.preventDefault(),T.metaKey?be(0):T.altKey?Y(-1):de(-1)};return v.createElement(Xt.div,{ref:t,tabIndex:-1,...N,"cmdk-root":"",onKeyDown:T=>{var Z;(Z=N.onKeyDown)==null||Z.call(N,T);let oe=T.nativeEvent.isComposing||T.keyCode===229;if(!(T.defaultPrevented||oe))switch(T.key){case"n":case"j":{S&&T.ctrlKey&&Q(T);break}case"ArrowDown":{Q(T);break}case"p":case"k":{S&&T.ctrlKey&&D(T);break}case"ArrowUp":{D(T);break}case"Home":{T.preventDefault(),be(0);break}case"End":{T.preventDefault(),V();break}case"Enter":{T.preventDefault();let re=J();if(re){let ue=new Event(lv);re.dispatchEvent(ue)}}}}},v.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:r4},f),dh(e,T=>v.createElement(GN.Provider,{value:I},v.createElement(KN.Provider,{value:B},T))))}),H3=v.forwardRef((e,t)=>{var r,n;let a=mi(),o=v.useRef(null),c=v.useContext(VN),l=Qu(),f=QN(e),h=(n=(r=f.current)==null?void 0:r.forceMount)!=null?n:c==null?void 0:c.forceMount;po(()=>{if(!h)return l.item(a,c==null?void 0:c.id)},[h]);let p=YN(a,o,[e.value,e.children,o],e.keywords),g=by(),x=ba(C=>C.value&&C.value===p.current),b=ba(C=>h||l.filter()===!1?!0:C.search?C.filtered.items.get(a)>0:!0);v.useEffect(()=>{let C=o.current;if(!(!C||e.disabled))return C.addEventListener(lv,j),()=>C.removeEventListener(lv,j)},[b,e.onSelect,e.disabled]);function j(){var C,I;k(),(I=(C=f.current).onSelect)==null||I.call(C,p.current)}function k(){g.setState("value",p.current,!0)}if(!b)return null;let{disabled:S,value:N,onSelect:E,forceMount:O,keywords:P,..._}=e;return v.createElement(Xt.div,{ref:Rs(o,t),..._,id:a,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!x,"data-disabled":!!S,"data-selected":!!x,onPointerMove:S||l.getDisablePointerSelection()?void 0:k,onClick:S?void 0:j},e.children)}),K3=v.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...o}=e,c=mi(),l=v.useRef(null),f=v.useRef(null),h=mi(),p=Qu(),g=ba(b=>a||p.filter()===!1?!0:b.search?b.filtered.groups.has(c):!0);po(()=>p.group(c),[]),YN(c,l,[e.value,e.heading,f]);let x=v.useMemo(()=>({id:c,forceMount:a}),[a]);return v.createElement(Xt.div,{ref:Rs(l,t),...o,"cmdk-group":"",role:"presentation",hidden:g?void 0:!0},r&&v.createElement("div",{ref:f,"cmdk-group-heading":"","aria-hidden":!0,id:h},r),dh(e,b=>v.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?h:void 0},v.createElement(VN.Provider,{value:x},b))))}),G3=v.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=v.useRef(null),o=ba(c=>!c.search);return!r&&!o?null:v.createElement(Xt.div,{ref:Rs(a,t),...n,"cmdk-separator":"",role:"separator"})}),V3=v.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,o=by(),c=ba(h=>h.search),l=ba(h=>h.selectedItemId),f=Qu();return v.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),v.createElement(Xt.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":f.listId,"aria-labelledby":f.labelId,"aria-activedescendant":l,id:f.inputId,type:"text",value:a?e.value:c,onChange:h=>{a||o.setState("search",h.target.value),r==null||r(h.target.value)}})}),q3=v.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,o=v.useRef(null),c=v.useRef(null),l=ba(h=>h.selectedItemId),f=Qu();return v.useEffect(()=>{if(c.current&&o.current){let h=c.current,p=o.current,g,x=new ResizeObserver(()=>{g=requestAnimationFrame(()=>{let b=h.offsetHeight;p.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return x.observe(h),()=>{cancelAnimationFrame(g),x.unobserve(h)}}},[]),v.createElement(Xt.div,{ref:Rs(o,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":n,id:f.listId},dh(e,h=>v.createElement("div",{ref:Rs(c,f.listInnerRef),"cmdk-list-sizer":""},h)))}),Q3=v.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:o,container:c,...l}=e;return v.createElement(TN,{open:r,onOpenChange:n},v.createElement($N,{container:c},v.createElement(LN,{"cmdk-overlay":"",className:a}),v.createElement(zN,{"aria-label":e.label,"cmdk-dialog":"",className:o},v.createElement(qN,{ref:t,...l}))))}),Y3=v.forwardRef((e,t)=>ba(r=>r.filtered.count===0)?v.createElement(Xt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),X3=v.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...o}=e;return v.createElement(Xt.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},dh(e,c=>v.createElement("div",{"aria-hidden":!0},c)))}),rs=Object.assign(qN,{List:q3,Item:H3,Input:V3,Group:K3,Separator:G3,Dialog:Q3,Empty:Y3,Loading:X3});function Z3(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function J3(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function QN(e){let t=v.useRef(e);return po(()=>{t.current=e}),t}var po=typeof window>"u"?v.useEffect:v.useLayoutEffect;function fs(e){let t=v.useRef();return t.current===void 0&&(t.current=e()),t}function ba(e){let t=by(),r=()=>e(t.snapshot());return v.useSyncExternalStore(t.subscribe,r,r)}function YN(e,t,r,n=[]){let a=v.useRef(),o=Qu();return po(()=>{var c;let l=(()=>{var h;for(let p of r){if(typeof p=="string")return p.trim();if(typeof p=="object"&&"current"in p)return p.current?(h=p.current.textContent)==null?void 0:h.trim():a.current}})(),f=n.map(h=>h.trim());o.value(e,l,f),(c=t.current)==null||c.setAttribute(ds,l),a.current=l}),a}var e4=()=>{let[e,t]=v.useState(),r=fs(()=>new Map);return po(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function t4(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function dh({asChild:e,children:t},r){return e&&v.isValidElement(t)?v.cloneElement(t4(t),{ref:t.ref},r(t.props.children)):r(t)}var r4={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function n4({onNavigate:e}){const[t,r]=v.useState(!1);return v.useEffect(()=>{const n=a=>{(a.metaKey||a.ctrlKey)&&a.key.toLowerCase()==="k"&&(a.preventDefault(),r(o=>!o))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),u.jsx(rs.Dialog,{open:t,onOpenChange:r,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>r(!1),children:u.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:n=>n.stopPropagation(),children:[u.jsx(rs.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),u.jsxs(rs.List,{className:"max-h-80 overflow-y-auto p-2",children:[u.jsx(rs.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),u.jsx(rs.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:iv.map(n=>u.jsxs(rs.Item,{value:`${n.label} ${n.hint}`,onSelect:()=>{e(n.id),r(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[u.jsx(n.icon,{className:"h-4 w-4 text-primary"}),u.jsx("span",{children:n.label}),u.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:n.hint})]},n.id))})]})]})})}async function Ce(e,t){var f;const r={"Content-Type":"application/json",...t==null?void 0:t.headers},n=localStorage.getItem("mc_sudo_password"),a=localStorage.getItem("mc_hf_token");n&&(r["X-Sudo-Password"]=n);let o=t==null?void 0:t.body;if((((f=t==null?void 0:t.method)==null?void 0:f.toUpperCase())||"GET")==="POST"){if(typeof o=="string")try{const h=JSON.parse(o);let p=!1;n&&!("sudo_password"in h)&&(h.sudo_password=n,p=!0),a&&!("hf_token"in h)&&(h.hf_token=a,p=!0),p&&(o=JSON.stringify(h))}catch{}else if(!o){const h={};n&&(h.sudo_password=n),a&&(h.hf_token=a),Object.keys(h).length>0&&(o=JSON.stringify(h))}}const l=await fetch(e,{...t,headers:r,body:o});if(!l.ok)throw new Error(`${l.status} ${l.statusText}`);return l.json()}const kt={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:e=>["drafts",e??""],connect:e=>["connect",e??""],connectHealth:["connect-health"],memory:(e,t)=>["memory",e??"",t??""],memoryGraph:["memory-graph"]},i4=(e=!0)=>sr({queryKey:kt.memoryGraph,queryFn:()=>Ce("/api/memory/graph"),enabled:e}),a4=()=>sr({queryKey:kt.health,queryFn:()=>Ce("/api/health"),refetchInterval:1e4}),fh=(e=5e3)=>sr({queryKey:kt.systemStatus,queryFn:()=>Ce("/api/system/status"),refetchInterval:e}),o4=(e=3e3)=>sr({queryKey:kt.services,queryFn:()=>Ce("/api/system/services"),refetchInterval:e}),No=(e=4e3)=>sr({queryKey:kt.models,queryFn:()=>Ce("/api/models"),refetchInterval:e}),s4=(e=4e3)=>sr({queryKey:kt.routing,queryFn:()=>Ce("/api/routing"),refetchInterval:e}),l4=(e=2e3)=>sr({queryKey:kt.jobs,queryFn:()=>Ce("/api/jobs"),refetchInterval:e,select:t=>t.jobs??[]}),wy=(e=3e3)=>sr({queryKey:kt.tokenStats,queryFn:()=>Ce("/api/system/token-stats"),refetchInterval:e}),ky=(e=5e3)=>sr({queryKey:kt.agentStatus,queryFn:()=>Ce("/api/agent/status"),refetchInterval:e}),u4=(e=6e4)=>sr({queryKey:kt.hermesBrain,queryFn:()=>Ce("/api/agent/brain"),refetchInterval:e}),jy=e=>sr({queryKey:kt.updates,queryFn:()=>Ce("/api/maintenance/updates"),refetchInterval:e}),c4=()=>sr({queryKey:kt.discover,queryFn:()=>Ce("/api/discover")}),d4=e=>sr({queryKey:kt.drafts(e),queryFn:()=>Ce(`/api/models/drafts?target=${encodeURIComponent(e??"")}`),enabled:!!e}),XN=e=>sr({queryKey:kt.connect(e),queryFn:()=>Ce(e?`/api/connect?${e}`:"/api/connect")}),f4=()=>sr({queryKey:kt.connectHealth,queryFn:()=>Ce("/api/connect/health"),refetchInterval:15e3}),uv=e=>sr({queryKey:kt.memory(e==null?void 0:e.q,e==null?void 0:e.category),queryFn:()=>{const t=new URLSearchParams;return e!=null&&e.q&&t.set("q",e.q),e!=null&&e.category&&t.set("category",e.category),Ce(`/api/memory?${t}`)},select:t=>e!=null&&e.limit?t.slice(0,e.limit):t});function ns(e){return(e/1024**3).toFixed(1)}function cv(e){return e?e>1024**3?`${(e/1024**3).toFixed(1)} GB`:`${(e/1024**2).toFixed(0)} MB`:""}function qr(e){if(!e)return"—";const t=e/1024**3;return t>=1?`${t.toFixed(1)} GB`:`${(e/1024**2).toFixed(0)} MB`}function h4(e){if(!e)return"";const t=Math.floor(e/60);return t>0?`${t} min`:`${e} s`}function Nw(e){return e?`${Math.round(e/1024)}k`:"—"}function ZN(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t{const t=g4(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:c=>{const l=c.split(Sy);return l[0]===""&&l.length!==1&&l.shift(),JN(l,t)||m4(c)},getConflictingClassGroupIds:(c,l)=>{const f=r[c]||[];return l&&n[c]?[...f,...n[c]]:f}}},JN=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?JN(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(Sy);return(c=t.validators.find(({validator:l})=>l(o)))==null?void 0:c.classGroupId},Ew=/^\[(.+)\]$/,m4=e=>{if(Ew.test(e)){const t=Ew.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},g4=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return y4(Object.entries(e.classGroups),r).forEach(([o,c])=>{dv(c,n,o,t)}),n},dv=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:Aw(t,a);o.classGroupId=r;return}if(typeof a=="function"){if(v4(a)){dv(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([o,c])=>{dv(c,Aw(t,o),r,n)})})},Aw=(e,t)=>{let r=e;return t.split(Sy).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},v4=e=>e.isThemeGetter,y4=(e,t)=>t?e.map(([r,n])=>{const a=n.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([c,l])=>[t+c,l])):o);return[r,a]}):e,x4=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(o,c)=>{r.set(o,c),t++,t>e&&(t=0,n=r,r=new Map)};return{get(o){let c=r.get(o);if(c!==void 0)return c;if((c=n.get(o))!==void 0)return a(o,c),c},set(o,c){r.has(o)?r.set(o,c):a(o,c)}}},eE="!",b4=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,a=t[0],o=t.length,c=l=>{const f=[];let h=0,p=0,g;for(let S=0;Sp?g-p:void 0;return{modifiers:f,hasImportantModifier:b,baseClassName:j,maybePostfixModifierPosition:k}};return r?l=>r({className:l,parseClassName:c}):c},w4=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},k4=e=>({cache:x4(e.cacheSize),parseClassName:b4(e),...p4(e)}),j4=/\s+/,S4=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a}=t,o=[],c=e.trim().split(j4);let l="";for(let f=c.length-1;f>=0;f-=1){const h=c[f],{modifiers:p,hasImportantModifier:g,baseClassName:x,maybePostfixModifierPosition:b}=r(h);let j=!!b,k=n(j?x.substring(0,b):x);if(!k){if(!j){l=h+(l.length>0?" "+l:l);continue}if(k=n(x),!k){l=h+(l.length>0?" "+l:l);continue}j=!1}const S=w4(p).join(":"),N=g?S+eE:S,E=N+k;if(o.includes(E))continue;o.push(E);const O=a(k,j);for(let P=0;P0?" "+l:l)}return l};function N4(){let e=0,t,r,n="";for(;e{if(typeof e=="string")return e;let t,r="";for(let n=0;ng(p),e());return r=k4(h),n=r.cache.get,a=r.cache.set,o=l,l(f)}function l(f){const h=n(f);if(h)return h;const p=S4(f,r);return a(f,p),p}return function(){return o(N4.apply(null,arguments))}}const ot=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},rE=/^\[(?:([a-z-]+):)?(.+)\]$/i,A4=/^\d+\/\d+$/,P4=new Set(["px","full","screen"]),C4=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,O4=/\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$/,_4=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,M4=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,I4=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ai=e=>vs(e)||P4.has(e)||A4.test(e),Ji=e=>qs(e,"length",B4),vs=e=>!!e&&!Number.isNaN(Number(e)),tg=e=>qs(e,"number",vs),Zl=e=>!!e&&Number.isInteger(Number(e)),T4=e=>e.endsWith("%")&&vs(e.slice(0,-1)),Le=e=>rE.test(e),ea=e=>C4.test(e),D4=new Set(["length","size","percentage"]),R4=e=>qs(e,D4,nE),$4=e=>qs(e,"position",nE),L4=new Set(["image","url"]),z4=e=>qs(e,L4,W4),F4=e=>qs(e,"",U4),Jl=()=>!0,qs=(e,t,r)=>{const n=rE.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},B4=e=>O4.test(e)&&!_4.test(e),nE=()=>!1,U4=e=>M4.test(e),W4=e=>I4.test(e),H4=()=>{const e=ot("colors"),t=ot("spacing"),r=ot("blur"),n=ot("brightness"),a=ot("borderColor"),o=ot("borderRadius"),c=ot("borderSpacing"),l=ot("borderWidth"),f=ot("contrast"),h=ot("grayscale"),p=ot("hueRotate"),g=ot("invert"),x=ot("gap"),b=ot("gradientColorStops"),j=ot("gradientColorStopPositions"),k=ot("inset"),S=ot("margin"),N=ot("opacity"),E=ot("padding"),O=ot("saturate"),P=ot("scale"),_=ot("sepia"),C=ot("skew"),I=ot("space"),B=ot("translate"),U=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],X=()=>["auto",Le,t],$=()=>[Le,t],fe=()=>["",ai,Ji],J=()=>["auto",vs,Le],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],be=()=>["solid","dashed","dotted","double","none"],de=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],V=()=>["","0",Le],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],D=()=>[vs,Le];return{cacheSize:500,separator:":",theme:{colors:[Jl],spacing:[ai,Ji],blur:["none","",ea,Le],brightness:D(),borderColor:[e],borderRadius:["none","","full",ea,Le],borderSpacing:$(),borderWidth:fe(),contrast:D(),grayscale:V(),hueRotate:D(),invert:V(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[T4,Ji],inset:X(),margin:X(),opacity:D(),padding:$(),saturate:D(),scale:D(),sepia:V(),skew:D(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",Le]}],container:["container"],columns:[{columns:[ea]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"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:[...pe(),Le]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Zl,Le]}],basis:[{basis:X()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Le]}],grow:[{grow:V()}],shrink:[{shrink:V()}],order:[{order:["first","last","none",Zl,Le]}],"grid-cols":[{"grid-cols":[Jl]}],"col-start-end":[{col:["auto",{span:["full",Zl,Le]},Le]}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":[Jl]}],"row-start-end":[{row:["auto",{span:[Zl,Le]},Le]}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Le]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Le]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"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",Le,t]}],"min-w":[{"min-w":[Le,t,"min","max","fit"]}],"max-w":[{"max-w":[Le,t,"none","full","min","max","fit","prose",{screen:[ea]},ea]}],h:[{h:[Le,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Le,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Le,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Le,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ea,Ji]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tg]}],"font-family":[{font:[Jl]}],"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-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Le]}],"line-clamp":[{"line-clamp":["none",vs,tg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ai,Le]}],"list-image":[{"list-image":["none",Le]}],"list-style-type":[{list:["none","disc","decimal",Le]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...be(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ai,Ji]}],"underline-offset":[{"underline-offset":["auto",ai,Le]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Le]}],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",Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),$4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",R4]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},z4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[j]}],"gradient-via-pos":[{via:[j]}],"gradient-to-pos":[{to:[j]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...be(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:be()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...be()]}],"outline-offset":[{"outline-offset":[ai,Le]}],"outline-w":[{outline:[ai,Ji]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[ai,Ji]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ea,F4]}],"shadow-color":[{shadow:[Jl]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...de(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":de()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",ea,Le]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[g]}],saturate:[{saturate:[O]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[N]}],"backdrop-saturate":[{"backdrop-saturate":[O]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Le]}],duration:[{duration:D()}],ease:[{ease:["linear","in","out","in-out",Le]}],delay:[{delay:D()}],animate:[{animate:["none","spin","ping","pulse","bounce",Le]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[Zl,Le]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Le]}],accent:[{accent:["auto",e]}],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",Le]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",Le]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ai,Ji,tg]}],stroke:[{stroke:[e,"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"]}}},K4=E4(H4);function ce(...e){return K4(nt(e))}function Ls(e){return e?e.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const iE=["fast","heavy","coder","vision","scout"],G4={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"},Ny=e=>e&&G4[e]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function V4({fit:e}){const t={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[e.level];return u.jsxs("span",{className:ce("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",t),children:[e.text," • ",e.req_gb," GB RAM"]})}function Pw(e){const t=e.toLowerCase();return t.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:t.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:t.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:t.includes("mistral")||t.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:t.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:t.includes("hermes")||t.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:t.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function q4(){const{data:e}=No(2e3),{data:t}=wy(2e3),r=(e==null?void 0:e.models)??[],n=(e==null?void 0:e.running)??[],a=r.filter(f=>n.includes(f.name)),o=v.useRef(null),[c,l]=v.useState(!1);return v.useEffect(()=>{if(!t)return;const f=t.total_tokens;if(o.current!==null&&f>o.current){l(!0);const h=setTimeout(()=>l(!1),4e3);return o.current=f,()=>clearTimeout(h)}o.current=f},[t==null?void 0:t.total_tokens]),u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[u.jsxs("div",{className:"flex items-center justify-between mb-4",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(ku,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),u.jsxs("span",{className:ce("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",c?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[c?u.jsx(uo,{className:"h-3 w-3 animate-pulse"}):u.jsx(zI,{className:"h-3 w-3"}),c?"Inferenz aktiv":"Idle"]})]}),a.length===0?u.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):u.jsx("div",{className:"grid gap-2",children:a.map(f=>{var h;return u.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[f.role&&u.jsx("span",{className:ce("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",Ny(f.role)),children:f.role}),u.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(h=f.name.split("/").pop())==null?void 0:h.replace(/\.gguf$/i,"")})]}),u.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[qr(f.size_bytes)," im Unified-RAM"]})]}),u.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[u.jsx("span",{className:ce("h-1.5 w-1.5 rounded-full bg-emerald-500",c&&"animate-pulse")})," warm"]})]},f.name)})})]})}let fv=[],hv=[];const pv=new Set,aE=()=>pv.forEach(e=>e());function oE(e){return pv.add(e),()=>{pv.delete(e)}}function Q4(e){fv=[...fv,e].slice(-40),aE()}function Y4(e){hv=[...hv,e].slice(-40),aE()}const X4=()=>v.useSyncExternalStore(oE,()=>fv),Z4=()=>v.useSyncExternalStore(oE,()=>hv);function J4(){const{data:e,dataUpdatedAt:t}=fh(3e3),{data:r,dataUpdatedAt:n}=wy(3e3),a=v.useRef(null);v.useEffect(()=>{var o,c,l,f;e&&Q4({t:Date.now(),cpu:((o=e.cpu)==null?void 0:o.percent)??0,ram:((c=e.ram)==null?void 0:c.percent)??0,gpu:((l=e.gpu)==null?void 0:l.busy_percent)??null,disk:((f=e.disk)==null?void 0:f.percent)??null})},[t]),v.useEffect(()=>{if(!r)return;const o=Date.now(),c=r.prompt_tokens,l=r.completion_tokens;if(a.current){const f=Math.max((o-a.current.t)/1e3,.001);Y4({t:o,prompt:Math.max(0,(c-a.current.p)/f),completion:Math.max(0,(l-a.current.c)/f)})}a.current={p:c,c:l,t:o}},[n])}function eD(){const{data:e,error:t}=fh(3e3),r=X4();return{sys:e,hist:r,error:t}}var tD=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function Ey(e){if(typeof e!="string")return!1;var t=tD;return t.includes(e)}var rD=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],nD=new Set(rD);function sE(e){return typeof e!="string"?!1:nD.has(e)}function lE(e){return typeof e=="string"&&e.startsWith("data-")}function bn(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(sE(r)||lE(r))&&(t[r]=e[r]);return t}function hh(e){if(e==null)return null;if(v.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return bn(t)}return typeof e=="object"&&!Array.isArray(e)?bn(e):null}function en(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(sE(r)||lE(r)||Ey(r))&&(t[r]=e[r]);return t}function iD(e){return e==null?null:v.isValidElement(e)?en(e.props):typeof e=="object"&&!Array.isArray(e)?en(e):null}var aD=["children","width","height","viewBox","className","style","title","desc"];function mv(){return mv=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=e.children,n=e.width,a=e.height,o=e.viewBox,c=e.className,l=e.style,f=e.title,h=e.desc,p=oD(e,aD),g=o||{width:n,height:a,x:0,y:0},x=nt("recharts-surface",c);return v.createElement("svg",mv({},en(p),{className:x,width:n,height:a,style:l,viewBox:"".concat(g.x," ").concat(g.y," ").concat(g.width," ").concat(g.height),ref:t}),v.createElement("title",null,f),v.createElement("desc",null,h),r)}),lD=["children","className"];function gv(){return gv=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=e.children,n=e.className,a=uD(e,lD),o=nt("recharts-layer",n);return v.createElement("g",gv({className:o},en(a),{ref:t}),r)}),dD=v.createContext(null);function gt(e){return function(){return e}}const vv=Math.PI,yv=2*vv,Ka=1e-6,fD=yv-Ka;function cE(e){this._+=e[0];for(let t=1,r=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return cE;const r=10**t;return function(n){this._+=n[0];for(let a=1,o=n.length;aKa)if(!(Math.abs(g*f-h*p)>Ka)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let b=n-c,j=a-l,k=f*f+h*h,S=b*b+j*j,N=Math.sqrt(k),E=Math.sqrt(x),O=o*Math.tan((vv-Math.acos((k+x-S)/(2*N*E)))/2),P=O/E,_=O/N;Math.abs(P-1)>Ka&&this._append`L${t+P*p},${r+P*g}`,this._append`A${o},${o},0,0,${+(g*b>p*j)},${this._x1=t+_*f},${this._y1=r+_*h}`}}arc(t,r,n,a,o,c){if(t=+t,r=+r,n=+n,c=!!c,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(a),f=n*Math.sin(a),h=t+l,p=r+f,g=1^c,x=c?a-o:o-a;this._x1===null?this._append`M${h},${p}`:(Math.abs(this._x1-h)>Ka||Math.abs(this._y1-p)>Ka)&&this._append`L${h},${p}`,n&&(x<0&&(x=x%yv+yv),x>fD?this._append`A${n},${n},0,1,${g},${t-l},${r-f}A${n},${n},0,1,${g},${this._x1=h},${this._y1=p}`:x>Ka&&this._append`A${n},${n},0,${+(x>=vv)},${g},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function dE(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new pD(t)}function Ay(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fE(e){this._context=e}fE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ph(e){return new fE(e)}function hE(e){return e[0]}function pE(e){return e[1]}function mE(e,t){var r=gt(!0),n=null,a=ph,o=null,c=dE(l);e=typeof e=="function"?e:e===void 0?hE:gt(e),t=typeof t=="function"?t:t===void 0?pE:gt(t);function l(f){var h,p=(f=Ay(f)).length,g,x=!1,b;for(n==null&&(o=a(b=c())),h=0;h<=p;++h)!(h=b;--j)l.point(O[j],P[j]);l.lineEnd(),l.areaEnd()}N&&(O[x]=+e(S,x,g),P[x]=+t(S,x,g),l.point(n?+n(S,x,g):O[x],r?+r(S,x,g):P[x]))}if(E)return l=null,E+""||null}function p(){return mE().defined(a).curve(c).context(o)}return h.x=function(g){return arguments.length?(e=typeof g=="function"?g:gt(+g),n=null,h):e},h.x0=function(g){return arguments.length?(e=typeof g=="function"?g:gt(+g),h):e},h.x1=function(g){return arguments.length?(n=g==null?null:typeof g=="function"?g:gt(+g),h):n},h.y=function(g){return arguments.length?(t=typeof g=="function"?g:gt(+g),r=null,h):t},h.y0=function(g){return arguments.length?(t=typeof g=="function"?g:gt(+g),h):t},h.y1=function(g){return arguments.length?(r=g==null?null:typeof g=="function"?g:gt(+g),h):r},h.lineX0=h.lineY0=function(){return p().x(e).y(t)},h.lineY1=function(){return p().x(e).y(r)},h.lineX1=function(){return p().x(n).y(t)},h.defined=function(g){return arguments.length?(a=typeof g=="function"?g:gt(!!g),h):a},h.curve=function(g){return arguments.length?(c=g,o!=null&&(l=c(o)),h):c},h.context=function(g){return arguments.length?(g==null?o=l=null:l=c(o=g),h):o},h}class gE{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function mD(e){return new gE(e,!0)}function gD(e){return new gE(e,!1)}function cf(){}function df(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function vE(e){this._context=e}vE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:df(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:df(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function vD(e){return new vE(e)}function yE(e){this._context=e}yE.prototype={areaStart:cf,areaEnd:cf,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:df(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yD(e){return new yE(e)}function xE(e){this._context=e}xE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:df(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function xD(e){return new xE(e)}function bE(e){this._context=e}bE.prototype={areaStart:cf,areaEnd:cf,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function bD(e){return new bE(e)}function Cw(e){return e<0?-1:1}function Ow(e,t,r){var n=e._x1-e._x0,a=t-e._x1,o=(e._y1-e._y0)/(n||a<0&&-0),c=(r-e._y1)/(a||n<0&&-0),l=(o*a+c*n)/(n+a);return(Cw(o)+Cw(c))*Math.min(Math.abs(o),Math.abs(c),.5*Math.abs(l))||0}function _w(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function rg(e,t,r){var n=e._x0,a=e._y0,o=e._x1,c=e._y1,l=(o-n)/3;e._context.bezierCurveTo(n+l,a+l*t,o-l,c-l*r,o,c)}function ff(e){this._context=e}ff.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:rg(this,this._t0,_w(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,rg(this,_w(this,r=Ow(this,e,t)),r);break;default:rg(this,this._t0,r=Ow(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function wE(e){this._context=new kE(e)}(wE.prototype=Object.create(ff.prototype)).point=function(e,t){ff.prototype.point.call(this,t,e)};function kE(e){this._context=e}kE.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,o){this._context.bezierCurveTo(t,e,n,r,o,a)}};function wD(e){return new ff(e)}function kD(e){return new wE(e)}function jE(e){this._context=e}jE.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Mw(e),a=Mw(t),o=0,c=1;c=0;--t)a[t]=(c[t]-a[t+1])/o[t];for(o[r-1]=(e[r]+a[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function SD(e){return new mh(e,.5)}function ND(e){return new mh(e,0)}function ED(e){return new mh(e,1)}function mo(e,t){if((c=e.length)>1)for(var r=1,n,a,o=e[t[0]],c,l=o.length;r=0;)r[t]=t;return r}function AD(e,t){return e[t]}function PD(e){const t=[];return t.key=e,t}function CD(){var e=gt([]),t=xv,r=mo,n=AD;function a(o){var c=Array.from(e.apply(this,arguments),PD),l,f=c.length,h=-1,p;for(const g of o)for(l=0,++h;l0){for(var r,n,a=0,o=e[0].length,c;a0){for(var r=0,n=e[t[0]],a,o=n.length;r0)||!((o=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,o,c;n1&&arguments[1]!==void 0?arguments[1]:TD,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function Gt(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n{var l=r[c-1];return typeof l=="string"?a+l+o:l!==void 0?a+ma(l)+o:a+o},"")}var Xr=e=>e===0?0:e>0?1:-1,Un=e=>typeof e=="number"&&e!=+e,go=e=>typeof e=="string"&&e.length>1&&e.indexOf("%")===e.length-1,Ne=e=>(typeof e=="number"||e instanceof Number)&&!Un(e),Wn=e=>Ne(e)||typeof e=="string",DD=0,Au=e=>{var t=++DD;return"".concat(e||"").concat(t)},wa=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ne(t)&&typeof t!="string")return n;var o;if(go(t)){if(r==null)return n;var c=t.indexOf("%");o=r*parseFloat(t.slice(0,c))/100}else o=+t;return Un(o)&&(o=n),a&&r!=null&&o>r&&(o=r),o},EE=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;nn&&(typeof t=="function"?t(n):Eo(n,t))===r)}var Yt=e=>e===null||typeof e>"u",Oy=e=>Yt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Nr(e){return e!=null}function Qs(){}var PE=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,_y=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(v.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(a=>{Ey(a)&&typeof r[a]=="function"&&(n[a]=(o=>r[a](r,o)))}),n},RD=(e,t,r)=>n=>(e(t,r,n),null),$D=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(a=>{var o=e[a];Ey(a)&&typeof o=="function"&&(n||(n={}),n[a]=RD(o,t,r))}),n};function Iw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function LD(e){for(var t=1;t(c[l]===void 0&&n[l]!==void 0&&(c[l]=n[l]),c),r);return o}function UD(e,t){const r=new Map;for(let n=0;nObject.prototype.propertyIsEnumerable.call(e,t))}function My(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const VD="[object RegExp]",OE="[object String]",_E="[object Number]",ME="[object Boolean]",IE="[object Arguments]",qD="[object Symbol]",QD="[object Date]",YD="[object Map]",XD="[object Set]",ZD="[object Array]",JD="[object ArrayBuffer]",eR="[object Object]",tR="[object DataView]",rR="[object Uint8Array]",nR="[object Uint8ClampedArray]",iR="[object Uint16Array]",aR="[object Uint32Array]",oR="[object Int8Array]",sR="[object Int16Array]",lR="[object Int32Array]",uR="[object Float32Array]",cR="[object Float64Array]",Tw=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function dR(e){return typeof Tw.Buffer<"u"&&Tw.Buffer.isBuffer(e)}function fR(e,t){return Qa(e,void 0,e,new Map,t)}function Qa(e,t,r,n=new Map,a=void 0){const o=a==null?void 0:a(e,t,r,n);if(o!==void 0)return o;if(wv(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){const c=new Array(e.length);n.set(e,c);for(let l=0;l{}):kv(e,t,function n(a,o,c,l,f,h){const p=r(a,o,c,l,f,h);return p!==void 0?!!p:kv(a,o,n,h,!1)},new Map,!0)}function kv(e,t,r,n,a=!1){if(t===e)return!0;switch(typeof t){case"object":return mR(e,t,r,n);case"function":return Object.keys(t).length>0?kv(e,{...t},r,n,a):Zd(e,t);default:return TE(e)&&a?typeof t=="string"?t==="":!0:Zd(e,t)}}function mR(e,t,r,n){if(t==null)return!0;if(Array.isArray(t))return RE(e,t,r,n);if(t instanceof Map)return gR(e,t,r,n);if(t instanceof Set)return vR(e,t,r,n);const a=Object.keys(t);if(e==null||wv(e))return a.length===0;if(a.length===0)return!0;if(n!=null&&n.has(t))return n.get(t)===e;n==null||n.set(t,e);try{for(let o=0;o{})}function yR(e){return e=pR(e),t=>$E(t,e)}function xR(e,t){return fR(e,(r,n,a,o)=>{if(typeof e=="object"){if(My(e)==="[object Object]"&&typeof e.constructor!="function"){const c={};return o.set(e,c),mn(c,e,a,o),c}switch(Object.prototype.toString.call(e)){case _E:case OE:case ME:{const c=new e.constructor(e==null?void 0:e.valueOf());return mn(c,e),c}case IE:{const c={};return mn(c,e),c.length=e.length,c[Symbol.iterator]=e[Symbol.iterator],c}default:return}}})}function bR(e){return xR(e)}const wR=/^(?:0|[1-9]\d*)$/;function LE(e,t=Number.MAX_SAFE_INTEGER){switch(typeof e){case"number":return Number.isInteger(e)&&e>=0&&e=0}function zE(e){return e!=null&&typeof e!="function"&&ER(e.length)}function AR(e){return typeof e=="object"&&e!==null}function PR(e){return AR(e)&&zE(e)}function Dw(e,t=CE){return PR(e)?UD(Array.from(e),WD(NR(t),1)):[]}function CR(e,t,r){return t===!0?Dw(e,r):typeof t=="function"?Dw(e,t):e}var ng={exports:{}},ig={},ag={exports:{}},og={};/** - * @license React - * use-sync-external-store-shim.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Rw;function OR(){if(Rw)return og;Rw=1;var e=Vs();function t(g,x){return g===x&&(g!==0||1/g===1/x)||g!==g&&x!==x}var r=typeof Object.is=="function"?Object.is:t,n=e.useState,a=e.useEffect,o=e.useLayoutEffect,c=e.useDebugValue;function l(g,x){var b=x(),j=n({inst:{value:b,getSnapshot:x}}),k=j[0].inst,S=j[1];return o(function(){k.value=b,k.getSnapshot=x,f(k)&&S({inst:k})},[g,b,x]),a(function(){return f(k)&&S({inst:k}),g(function(){f(k)&&S({inst:k})})},[g]),c(b),b}function f(g){var x=g.getSnapshot;g=g.value;try{var b=x();return!r(g,b)}catch{return!0}}function h(g,x){return x()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:l;return og.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,og}var $w;function _R(){return $w||($w=1,ag.exports=OR()),ag.exports}/** - * @license React - * use-sync-external-store-shim/with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Lw;function MR(){if(Lw)return ig;Lw=1;var e=Vs(),t=_R();function r(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var n=typeof Object.is=="function"?Object.is:r,a=t.useSyncExternalStore,o=e.useRef,c=e.useEffect,l=e.useMemo,f=e.useDebugValue;return ig.useSyncExternalStoreWithSelector=function(h,p,g,x,b){var j=o(null);if(j.current===null){var k={hasValue:!1,value:null};j.current=k}else k=j.current;j=l(function(){function N(C){if(!E){if(E=!0,O=C,C=x(C),b!==void 0&&k.hasValue){var I=k.value;if(b(I,C))return P=I}return P=C}if(I=P,n(O,C))return I;var B=x(C);return b!==void 0&&b(I,B)?(O=C,I):(O=C,P=B)}var E=!1,O,P,_=g===void 0?null:g;return[function(){return N(p())},_===null?void 0:function(){return N(_())}]},[p,g,x,b]);var S=a(h,j[0],j[1]);return c(function(){k.hasValue=!0,k.value=S},[S]),f(S),S},ig}var zw;function IR(){return zw||(zw=1,ng.exports=MR()),ng.exports}var TR=IR(),Iy=v.createContext(null),DR=e=>e,Et=()=>{var e=v.useContext(Iy);return e?e.store.dispatch:DR},Jd=()=>{},RR=()=>Jd,$R=(e,t)=>e===t;function Me(e){var t=v.useContext(Iy),r=v.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Jd,[t,e]);return TR.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:RR,t?t.store.getState:Jd,t?t.store.getState:Jd,r,$R)}function LR(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function zR(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var Fw=e=>Array.isArray(e)?e:[e];function FR(e){const t=Array.isArray(e[0])?e[0]:e;return zR(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function BR(e,t){const r=[],{length:n}=e;for(let a=0;atypeof WeakRef>"u"?UR:WeakRef,FE=WR(),HR=0,Bw=1;function Md(){return{s:HR,v:void 0,o:null,p:null}}function KR(e){return e instanceof FE?e.deref():e}function BE(e,t={}){let r=Md();const{resultEqualityCheck:n}=t;let a,o=0;function c(){let l=r;const{length:f}=arguments;for(let g=0,x=f;g{r=Md(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}function GR(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...a)=>{let o=0,c=0,l,f={},h=a.pop();typeof h=="object"&&(f=h,h=a.pop()),LR(h,`createSelector expects an output function after the inputs, but received: [${typeof h}]`);const p={...r,...f},{memoize:g,memoizeOptions:x=[],argsMemoize:b=BE,argsMemoizeOptions:j=[]}=p,k=Fw(x),S=Fw(j),N=FR(a),E=g(function(){return o++,h.apply(null,arguments)},...k),O=b(function(){c++;const _=BR(N,arguments);return l=E.apply(null,_),l},...S);return Object.assign(O,{resultFunc:h,memoizedResultFunc:E,dependencies:N,dependencyRecomputations:()=>c,resetDependencyRecomputations:()=>{c=0},lastResult:()=>l,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:g,argsMemoize:b})};return Object.assign(n,{withTypes:()=>n}),n}var K=GR(BE);function VR(e,t=1){const r=[],n=Math.floor(t),a=(o,c)=>{for(let l=0;l{if(e!==t){const n=Uw(e),a=Uw(t);if(n===a&&n===0){if(et)return r==="desc"?-1:1}return r==="desc"?a-n:n-a}return 0};function UE(e){return typeof e=="symbol"||e instanceof Symbol}const QR=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,YR=/^\w*$/;function XR(e,t){return Array.isArray(e)?!1:typeof e=="number"||typeof e=="boolean"||e==null||UE(e)?!0:typeof e=="string"&&(YR.test(e)||!QR.test(e))||t!=null}function ZR(e,t,r,n){if(e==null)return[];r=r,Array.isArray(e)||(e=Object.values(e)),Array.isArray(t)||(t=t==null?[null]:[t]),t.length===0&&(t=[null]),Array.isArray(r)||(r=r==null?[]:[r]),r=r.map(l=>String(l));const a=(l,f)=>{let h=l;for(let p=0;pf==null||l==null?f:typeof l=="object"&&"key"in l?Object.hasOwn(f,l.key)?f[l.key]:a(f,l.path):typeof l=="function"?l(f):Array.isArray(l)?a(f,l):typeof f=="object"?f[l]:f,c=t.map(l=>(Array.isArray(l)&&l.length===1&&(l=l[0]),l==null||typeof l=="function"||Array.isArray(l)||XR(l)?l:{key:l,path:Cy(l)}));return e.map(l=>({original:l,criteria:c.map(f=>o(f,l))})).slice().sort((l,f)=>{for(let h=0;hl.original)}function gh(e,...t){const r=t.length;return r>1&&jv(e,t[0],t[1])?t=[]:r>2&&jv(t[0],t[1],t[2])&&(t=[t[0]]),ZR(e,VR(t),["asc"])}var WE=e=>e.legend.settings,JR=e=>e.legend.size,e$=e=>e.legend.payload;K([e$,WE],(e,t)=>{var r=t.itemSorter,n=e.flat(1);return r?gh(n,r):n});function t$(e,t){return a$(e)||i$(e,t)||n$(e,t)||r$()}function r$(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function n$(e,t){if(e){if(typeof e=="string")return Ww(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ww(e,t):void 0}}function Ww(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);rId||Math.abs(e.left-t.left)>Id||Math.abs(e.top-t.top)>Id||Math.abs(e.width-t.width)>Id}function Kw(e){var t=e.getBoundingClientRect();return{height:t.height,left:t.left,top:t.top,width:t.width}}function o$(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],t=v.useState({height:0,left:0,top:0,width:0}),r=t$(t,2),n=r[0],a=r[1],o=v.useRef(null),c=v.useRef(n);c.current=n;var l=v.useCallback(f=>{if(o.current!=null&&(o.current.disconnect(),o.current=null),f!=null){var h=Kw(f);if(Hw(h,c.current)&&a(h),typeof ResizeObserver<"u"){var p=new ResizeObserver(()=>{var g=Kw(f);Hw(g,c.current)&&a(g)});p.observe(f),o.current=p}}},[...e]);return v.useEffect(()=>()=>{var f;(f=o.current)===null||f===void 0||f.disconnect()},[]),[n,l]}function Kt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var s$=typeof Symbol=="function"&&Symbol.observable||"@@observable",Gw=s$,sg=()=>Math.random().toString(36).substring(7).split("").join("."),l$={INIT:`@@redux/INIT${sg()}`,REPLACE:`@@redux/REPLACE${sg()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${sg()}`},hf=l$;function Ty(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function HE(e,t,r){if(typeof e!="function")throw new Error(Kt(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(Kt(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(Kt(1));return r(HE)(e,t)}let n=e,a=t,o=new Map,c=o,l=0,f=!1;function h(){c===o&&(c=new Map,o.forEach((S,N)=>{c.set(N,S)}))}function p(){if(f)throw new Error(Kt(3));return a}function g(S){if(typeof S!="function")throw new Error(Kt(4));if(f)throw new Error(Kt(5));let N=!0;h();const E=l++;return c.set(E,S),function(){if(N){if(f)throw new Error(Kt(6));N=!1,h(),c.delete(E),o=null}}}function x(S){if(!Ty(S))throw new Error(Kt(7));if(typeof S.type>"u")throw new Error(Kt(8));if(typeof S.type!="string")throw new Error(Kt(17));if(f)throw new Error(Kt(9));try{f=!0,a=n(a,S)}finally{f=!1}return(o=c).forEach(E=>{E()}),S}function b(S){if(typeof S!="function")throw new Error(Kt(10));n=S,x({type:hf.REPLACE})}function j(){const S=g;return{subscribe(N){if(typeof N!="object"||N===null)throw new Error(Kt(11));function E(){const P=N;P.next&&P.next(p())}return E(),{unsubscribe:S(E)}},[Gw](){return this}}}return x({type:hf.INIT}),{dispatch:x,subscribe:g,getState:p,replaceReducer:b,[Gw]:j}}function u$(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:hf.INIT})>"u")throw new Error(Kt(12));if(typeof r(void 0,{type:hf.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Kt(13))})}function KE(e){const t=Object.keys(e),r={};for(let o=0;o"u")throw l&&l.type,new Error(Kt(14));h[g]=j,f=f||j!==b}return f=f||n.length!==Object.keys(c).length,f?h:c}}function pf(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function c$(...e){return t=>(r,n)=>{const a=t(r,n);let o=()=>{throw new Error(Kt(15))};const c={getState:a.getState,dispatch:(f,...h)=>o(f,...h)},l=e.map(f=>f(c));return o=pf(...l)(a.dispatch),{...a,dispatch:o}}}function GE(e){return Ty(e)&&"type"in e&&typeof e.type=="string"}var VE=Symbol.for("immer-nothing"),Vw=Symbol.for("immer-draftable"),mr=Symbol.for("immer-state");function vn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Rr=Object,zs=Rr.getPrototypeOf,mf="constructor",vh="prototype",Sv="configurable",gf="enumerable",ef="writable",Pu="value",xi=e=>!!e&&!!e[mr];function wn(e){var t;return e?qE(e)||xh(e)||!!e[Vw]||!!((t=e[mf])!=null&&t[Vw])||bh(e)||wh(e):!1}var d$=Rr[vh][mf].toString(),qw=new WeakMap;function qE(e){if(!e||!Dy(e))return!1;const t=zs(e);if(t===null||t===Rr[vh])return!0;const r=Rr.hasOwnProperty.call(t,mf)&&t[mf];if(r===Object)return!0;if(!hs(r))return!1;let n=qw.get(r);return n===void 0&&(n=Function.toString.call(r),qw.set(r,n)),n===d$}function yh(e,t,r=!0){Yu(e)===0?(r?Reflect.ownKeys(e):Rr.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((n,a)=>t(a,n,e))}function Yu(e){const t=e[mr];return t?t.type_:xh(e)?1:bh(e)?2:wh(e)?3:0}var Qw=(e,t,r=Yu(e))=>r===2?e.has(t):Rr[vh].hasOwnProperty.call(e,t),Nv=(e,t,r=Yu(e))=>r===2?e.get(t):e[t],vf=(e,t,r,n=Yu(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function f$(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var xh=Array.isArray,bh=e=>e instanceof Map,wh=e=>e instanceof Set,Dy=e=>typeof e=="object",hs=e=>typeof e=="function",lg=e=>typeof e=="boolean";function h$(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var si=e=>e.copy_||e.base_,Ry=e=>e.modified_?e.copy_:e.base_;function Ev(e,t){if(bh(e))return new Map(e);if(wh(e))return new Set(e);if(xh(e))return Array[vh].slice.call(e);const r=qE(e);if(t===!0||t==="class_only"&&!r){const n=Rr.getOwnPropertyDescriptors(e);delete n[mr];let a=Reflect.ownKeys(n);for(let o=0;o1&&Rr.defineProperties(e,{set:Td,add:Td,clear:Td,delete:Td}),Rr.freeze(e),t&&yh(e,(r,n)=>{$y(n,!0)},!1)),e}function p$(){vn(2)}var Td={[Pu]:p$};function kh(e){return e===null||!Dy(e)?!0:Rr.isFrozen(e)}var yf="MapSet",Av="Patches",Yw="ArrayMethods",QE={};function vo(e){const t=QE[e];return t||vn(0,e),t}var Xw=e=>!!QE[e],Cu,YE=()=>Cu,m$=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Xw(yf)?vo(yf):void 0,arrayMethodsPlugin_:Xw(Yw)?vo(Yw):void 0});function Zw(e,t){t&&(e.patchPlugin_=vo(Av),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Pv(e){Cv(e),e.drafts_.forEach(g$),e.drafts_=null}function Cv(e){e===Cu&&(Cu=e.parent_)}var Jw=e=>Cu=m$(Cu,e);function g$(e){const t=e[mr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ek(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[mr].modified_&&(Pv(t),vn(4)),wn(e)&&(e=tk(t,e));const{patchPlugin_:a}=t;a&&a.generateReplacementPatches_(r[mr].base_,e,t)}else e=tk(t,r);return v$(t,e,!0),Pv(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==VE?e:void 0}function tk(e,t){if(kh(t))return t;const r=t[mr];if(!r)return xf(t,e.handledSet_,e);if(!jh(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);JE(r,e)}return r.copy_}function v$(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&$y(t,r)}function XE(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var jh=(e,t)=>e.scope_===t,y$=[];function ZE(e,t,r,n){const a=si(e),o=e.type_;if(n!==void 0&&Nv(a,n,o)===t){vf(a,n,r,o);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;yh(a,(f,h)=>{if(xi(h)){const p=l.get(h)||[];p.push(f),l.set(h,p)}})}const c=e.draftLocations_.get(t)??y$;for(const l of c)vf(a,l,r,o)}function x$(e,t,r){e.callbacks_.push(function(a){var l;const o=t;if(!o||!jh(o,a))return;(l=a.mapSetPlugin_)==null||l.fixSetContents(o);const c=Ry(o);ZE(e,o.draft_??o,c,r),JE(o,a)})}function JE(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:a}=t;if(a){const o=a.getPath(e);o&&a.generatePatches_(e,o,t)}XE(e)}}function b$(e,t,r){const{scope_:n}=e;if(xi(r)){const a=r[mr];jh(a,n)&&a.callbacks_.push(function(){tf(e);const c=Ry(a);ZE(e,r,c,t)})}else wn(r)&&e.callbacks_.push(function(){const o=si(e);e.type_===3?o.has(r)&&xf(r,n.handledSet_,n):Nv(o,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&xf(Nv(e.copy_,t,e.type_),n.handledSet_,n)})}function xf(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||xi(e)||t.has(e)||!wn(e)||kh(e)||(t.add(e),yh(e,(n,a)=>{if(xi(a)){const o=a[mr];if(jh(o,r)){const c=Ry(o);vf(e,n,c,e.type_),XE(o)}}else wn(a)&&xf(a,t,r)})),e}function w$(e,t){const r=xh(e),n={type_:r?1:0,scope_:t?t.scope_:YE(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let a=n,o=bf;r&&(a=[n],o=Ou);const{revoke:c,proxy:l}=Proxy.revocable(a,o);return n.draft_=l,n.revoke_=c,[l,n]}var bf={get(e,t){if(t===mr)return e;let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const a=si(e);if(!Qw(a,t,e.type_))return k$(e,a,t);const o=a[t];if(e.finalized_||!wn(o)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&h$(t))return o;if(o===ug(e.base_,t)){tf(e);const c=e.type_===1?+t:t,l=_v(e.scope_,o,e,c);return e.copy_[c]=l}return o},has(e,t){return t in si(e)},ownKeys(e){return Reflect.ownKeys(si(e))},set(e,t,r){const n=eA(si(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=ug(si(e),t),o=a==null?void 0:a[mr];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(f$(r,a)&&(r!==void 0||Qw(e.base_,t,e.type_)))return!0;tf(e),Ov(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),b$(e,t,r)),!0},deleteProperty(e,t){return tf(e),ug(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ov(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=si(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[ef]:!0,[Sv]:e.type_!==1||t!=="length",[gf]:n[gf],[Pu]:r[t]}},defineProperty(){vn(11)},getPrototypeOf(e){return zs(e.base_)},setPrototypeOf(){vn(12)}},Ou={};for(let e in bf){let t=bf[e];Ou[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Ou.deleteProperty=function(e,t){return Ou.set.call(this,e,t,void 0)};Ou.set=function(e,t,r){return bf.set.call(this,e[0],t,r,e[0])};function ug(e,t){const r=e[mr];return(r?si(r):e)[t]}function k$(e,t,r){var a;const n=eA(t,r);return n?Pu in n?n[Pu]:(a=n.get)==null?void 0:a.call(e.draft_):void 0}function eA(e,t){if(!(t in e))return;let r=zs(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=zs(r)}}function Ov(e){e.modified_||(e.modified_=!0,e.parent_&&Ov(e.parent_))}function tf(e){e.copy_||(e.assigned_=new Map,e.copy_=Ev(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var j$=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,a)=>{if(hs(r)&&!hs(n)){const c=n;n=r;const l=this;return function(h=c,...p){return l.produce(h,g=>n.call(this,g,...p))}}hs(n)||vn(6),a!==void 0&&!hs(a)&&vn(7);let o;if(wn(r)){const c=Jw(this),l=_v(c,r,void 0);let f=!0;try{o=n(l),f=!1}finally{f?Pv(c):Cv(c)}return Zw(c,a),ek(o,c)}else if(!r||!Dy(r)){if(o=n(r),o===void 0&&(o=r),o===VE&&(o=void 0),this.autoFreeze_&&$y(o,!0),a){const c=[],l=[];vo(Av).generateReplacementPatches_(r,o,{patches_:c,inversePatches_:l}),a(c,l)}return o}else vn(1,r)},this.produceWithPatches=(r,n)=>{if(hs(r))return(l,...f)=>this.produceWithPatches(l,h=>r(h,...f));let a,o;return[this.produce(r,n,(l,f)=>{a=l,o=f}),a,o]},lg(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),lg(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),lg(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){wn(t)||vn(8),xi(t)&&(t=Zr(t));const r=Jw(this),n=_v(r,t,void 0);return n[mr].isManual_=!0,Cv(r),n}finishDraft(t,r){const n=t&&t[mr];(!n||!n.isManual_)&&vn(9);const{scope_:a}=n;return Zw(a,r),ek(void 0,a)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const o=r[n];if(o.path.length===0&&o.op==="replace"){t=o.value;break}}n>-1&&(r=r.slice(n+1));const a=vo(Av).applyPatches_;return xi(t)?a(t,r):this.produce(t,o=>a(o,r))}};function _v(e,t,r,n){const[a,o]=bh(t)?vo(yf).proxyMap_(t,r):wh(t)?vo(yf).proxySet_(t,r):w$(t,r);return((r==null?void 0:r.scope_)??YE()).drafts_.push(a),o.callbacks_=(r==null?void 0:r.callbacks_)??[],o.key_=n,r&&n!==void 0?x$(r,o,n):o.callbacks_.push(function(f){var p;(p=f.mapSetPlugin_)==null||p.fixSetContents(o);const{patchPlugin_:h}=f;o.modified_&&h&&h.generatePatches_(o,[],f)}),a}function Zr(e){return xi(e)||vn(10,e),tA(e)}function tA(e){if(!wn(e)||kh(e))return e;const t=e[mr];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ev(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Ev(e,!0);return yh(r,(a,o)=>{vf(r,a,tA(o))},n),t&&(t.finalized_=!1),r}var S$=new j$,rA=S$.produce;function nA(e){return({dispatch:r,getState:n})=>a=>o=>typeof o=="function"?o(r,n,e):a(o)}var N$=nA(),E$=nA,A$=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?pf:pf.apply(null,arguments)};function Lr(e,t){function r(...n){if(t){let a=t(...n);if(!a)throw new Error($r(0));return{type:e,payload:a.payload,..."meta"in a&&{meta:a.meta},..."error"in a&&{error:a.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>GE(n)&&n.type===e,r}var iA=class fu extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,fu.prototype)}static get[Symbol.species](){return fu}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new fu(...t[0].concat(this)):new fu(...t.concat(this))}};function rk(e){return wn(e)?rA(e,()=>{}):e}function Dd(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function P$(e){return typeof e=="boolean"}var C$=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:a=!0,actionCreatorCheck:o=!0}=t??{};let c=new iA;return r&&(P$(r)?c.push(N$):c.push(E$(r.extraArgument))),c},aA="RTK_autoBatch",st=()=>e=>({payload:e,meta:{[aA]:!0}}),nk=e=>t=>{setTimeout(t,e)},O$=(e,t)=>r=>{let n=!1;const a=()=>{n||(n=!0,cancelAnimationFrame(o),clearTimeout(c),r())},o=e(a),c=setTimeout(a,t)},oA=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let a=!0,o=!1,c=!1;const l=new Set,f=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?O$(window.requestAnimationFrame,100):nk(10):e.type==="callback"?e.queueNotification:nk(e.timeout),h=()=>{c=!1,o&&(o=!1,l.forEach(p=>p()))};return Object.assign({},n,{subscribe(p){const g=()=>a&&p(),x=n.subscribe(g);return l.add(p),()=>{x(),l.delete(p)}},dispatch(p){var g;try{return a=!((g=p==null?void 0:p.meta)!=null&&g[aA]),o=!a,o&&(c||(c=!0,f(h))),n.dispatch(p)}finally{a=!0}}})},_$=e=>function(r){const{autoBatch:n=!0}=r??{};let a=new iA(e);return n&&a.push(oA(typeof n=="object"?n:void 0)),a};function M$(e){const t=C$(),{reducer:r=void 0,middleware:n,devTools:a=!0,preloadedState:o=void 0,enhancers:c=void 0}=e||{};let l;if(typeof r=="function")l=r;else if(Ty(r))l=KE(r);else throw new Error($r(1));let f;typeof n=="function"?f=n(t):f=t();let h=pf;a&&(h=A$({trace:!1,...typeof a=="object"&&a}));const p=c$(...f),g=_$(p);let x=typeof c=="function"?c(g):g();const b=h(...x);return HE(l,o,b)}function sA(e){const t={},r=[];let n;const a={addCase(o,c){const l=typeof o=="string"?o:o.type;if(!l)throw new Error($r(28));if(l in t)throw new Error($r(29));return t[l]=c,a},addAsyncThunk(o,c){return c.pending&&(t[o.pending.type]=c.pending),c.rejected&&(t[o.rejected.type]=c.rejected),c.fulfilled&&(t[o.fulfilled.type]=c.fulfilled),c.settled&&r.push({matcher:o.settled,reducer:c.settled}),a},addMatcher(o,c){return r.push({matcher:o,reducer:c}),a},addDefaultCase(o){return n=o,a}};return e(a),[t,r,n]}function I$(e){return typeof e=="function"}function T$(e,t){let[r,n,a]=sA(t),o;if(I$(e))o=()=>rk(e());else{const l=rk(e);o=()=>l}function c(l=o(),f){let h=[r[f.type],...n.filter(({matcher:p})=>p(f)).map(({reducer:p})=>p)];return h.filter(p=>!!p).length===0&&(h=[a]),h.reduce((p,g)=>{if(g)if(xi(p)){const b=g(p,f);return b===void 0?p:b}else{if(wn(p))return rA(p,x=>g(x,f));{const x=g(p,f);if(x===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return p},l)}return c.getInitialState=o,c}var D$="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",R$=(e=21)=>{let t="",r=e;for(;r--;)t+=D$[Math.random()*64|0];return t},$$=Symbol.for("rtk-slice-createasyncthunk");function L$(e,t){return`${e}/${t}`}function z$({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[$$];return function(a){const{name:o,reducerPath:c=o}=a;if(!o)throw new Error($r(11));const l=(typeof a.reducers=="function"?a.reducers(B$()):a.reducers)||{},f=Object.keys(l),h={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},p={addCase(P,_){const C=typeof P=="string"?P:P.type;if(!C)throw new Error($r(12));if(C in h.sliceCaseReducersByType)throw new Error($r(13));return h.sliceCaseReducersByType[C]=_,p},addMatcher(P,_){return h.sliceMatchers.push({matcher:P,reducer:_}),p},exposeAction(P,_){return h.actionCreators[P]=_,p},exposeCaseReducer(P,_){return h.sliceCaseReducersByName[P]=_,p}};f.forEach(P=>{const _=l[P],C={reducerName:P,type:L$(o,P),createNotation:typeof a.reducers=="function"};W$(_)?K$(C,_,p,t):U$(C,_,p)});function g(){const[P={},_=[],C=void 0]=typeof a.extraReducers=="function"?sA(a.extraReducers):[a.extraReducers],I={...P,...h.sliceCaseReducersByType};return T$(a.initialState,B=>{for(let U in I)B.addCase(U,I[U]);for(let U of h.sliceMatchers)B.addMatcher(U.matcher,U.reducer);for(let U of _)B.addMatcher(U.matcher,U.reducer);C&&B.addDefaultCase(C)})}const x=P=>P,b=new Map,j=new WeakMap;let k;function S(P,_){return k||(k=g()),k(P,_)}function N(){return k||(k=g()),k.getInitialState()}function E(P,_=!1){function C(B){let U=B[P];return typeof U>"u"&&_&&(U=Dd(j,C,N)),U}function I(B=x){const U=Dd(b,_,()=>new WeakMap);return Dd(U,B,()=>{const G={};for(const[X,$]of Object.entries(a.selectors??{}))G[X]=F$($,B,()=>Dd(j,B,N),_);return G})}return{reducerPath:P,getSelectors:I,get selectors(){return I(C)},selectSlice:C}}const O={name:o,reducer:S,actions:h.actionCreators,caseReducers:h.sliceCaseReducersByName,getInitialState:N,...E(c),injectInto(P,{reducerPath:_,...C}={}){const I=_??c;return P.inject({reducerPath:I,reducer:S},C),{...O,...E(I,!0)}}};return O}}function F$(e,t,r,n){function a(o,...c){let l=t(o);return typeof l>"u"&&n&&(l=r()),e(l,...c)}return a.unwrapped=e,a}var lr=z$();function B$(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function U$({type:e,reducerName:t,createNotation:r},n,a){let o,c;if("reducer"in n){if(r&&!H$(n))throw new Error($r(17));o=n.reducer,c=n.prepare}else o=n;a.addCase(e,o).exposeCaseReducer(t,o).exposeAction(t,c?Lr(e,c):Lr(e))}function W$(e){return e._reducerDefinitionType==="asyncThunk"}function H$(e){return e._reducerDefinitionType==="reducerWithPrepare"}function K$({type:e,reducerName:t},r,n,a){if(!a)throw new Error($r(18));const{payloadCreator:o,fulfilled:c,pending:l,rejected:f,settled:h,options:p}=r,g=a(e,o,p);n.exposeAction(t,g),c&&n.addCase(g.fulfilled,c),l&&n.addCase(g.pending,l),f&&n.addCase(g.rejected,f),h&&n.addMatcher(g.settled,h),n.exposeCaseReducer(t,{fulfilled:c||Rd,pending:l||Rd,rejected:f||Rd,settled:h||Rd})}function Rd(){}var G$="task",lA="listener",uA="completed",Ly="cancelled",V$=`task-${Ly}`,q$=`task-${uA}`,Mv=`${lA}-${Ly}`,Q$=`${lA}-${uA}`,Sh=class{constructor(e){Ql(this,"code");Ql(this,"name","TaskAbortError");Ql(this,"message");this.code=e,this.message=`${G$} ${Ly} (reason: ${e})`}},zy=(e,t)=>{if(typeof e!="function")throw new TypeError($r(32))},wf=()=>{},cA=(e,t=wf)=>(e.catch(t),e),dA=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),co=e=>{if(e.aborted)throw new Sh(e.reason)};function fA(e,t){let r=wf;return new Promise((n,a)=>{const o=()=>a(new Sh(e.reason));if(e.aborted){o();return}r=dA(e,o),t.finally(()=>r()).then(n,a)}).finally(()=>{r=wf})}var Y$=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof Sh?"cancelled":"rejected",error:r}}finally{t==null||t()}},kf=e=>t=>cA(fA(e,t).then(r=>(co(e),r))),hA=e=>{const t=kf(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:ys}=Object,ik={},Nh="listenerMiddleware",X$=(e,t)=>{const r=n=>dA(e,()=>n.abort(e.reason));return(n,a)=>{zy(n);const o=new AbortController;r(o);const c=Y$(async()=>{co(e),co(o.signal);const l=await n({pause:kf(o.signal),delay:hA(o.signal),signal:o.signal});return co(o.signal),l},()=>o.abort(q$));return a!=null&&a.autoJoin&&t.push(c.catch(wf)),{result:kf(e)(c),cancel(){o.abort(V$)}}}},Z$=(e,t)=>{const r=async(n,a)=>{co(t);let o=()=>{};const l=[new Promise((f,h)=>{let p=e({predicate:n,effect:(g,x)=>{x.unsubscribe(),f([g,x.getState(),x.getOriginalState()])}});o=()=>{p(),h()}})];a!=null&&l.push(new Promise(f=>setTimeout(f,a,null)));try{const f=await fA(t,Promise.race(l));return co(t),f}finally{o()}};return((n,a)=>cA(r(n,a)))},pA=e=>{let{type:t,actionCreator:r,matcher:n,predicate:a,effect:o}=e;if(t)a=Lr(t).match;else if(r)t=r.type,a=r.match;else if(n)a=n;else if(!a)throw new Error($r(21));return zy(o),{predicate:a,type:t,effect:o}},mA=ys(e=>{const{type:t,predicate:r,effect:n}=pA(e);return{id:R$(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error($r(22))}}},{withTypes:()=>mA}),ak=(e,t)=>{const{type:r,effect:n,predicate:a}=pA(t);return Array.from(e.values()).find(o=>(typeof r=="string"?o.type===r:o.predicate===a)&&o.effect===n)},Iv=e=>{e.pending.forEach(t=>{t.abort(Mv)})},J$=(e,t)=>()=>{for(const r of t.keys())Iv(r);e.clear()},ok=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},gA=ys(Lr(`${Nh}/add`),{withTypes:()=>gA}),eL=Lr(`${Nh}/removeAll`),vA=ys(Lr(`${Nh}/remove`),{withTypes:()=>vA}),tL=(...e)=>{console.error(`${Nh}/error`,...e)},Xu=(e={})=>{const t=new Map,r=new Map,n=b=>{const j=r.get(b)??0;r.set(b,j+1)},a=b=>{const j=r.get(b)??1;j===1?r.delete(b):r.set(b,j-1)},{extra:o,onError:c=tL}=e;zy(c);const l=b=>(b.unsubscribe=()=>t.delete(b.id),t.set(b.id,b),j=>{b.unsubscribe(),j!=null&&j.cancelActive&&Iv(b)}),f=(b=>{const j=ak(t,b)??mA(b);return l(j)});ys(f,{withTypes:()=>f});const h=b=>{const j=ak(t,b);return j&&(j.unsubscribe(),b.cancelActive&&Iv(j)),!!j};ys(h,{withTypes:()=>h});const p=async(b,j,k,S)=>{const N=new AbortController,E=Z$(f,N.signal),O=[];try{b.pending.add(N),n(b),await Promise.resolve(b.effect(j,ys({},k,{getOriginalState:S,condition:(P,_)=>E(P,_).then(Boolean),take:E,delay:hA(N.signal),pause:kf(N.signal),extra:o,signal:N.signal,fork:X$(N.signal,O),unsubscribe:b.unsubscribe,subscribe:()=>{t.set(b.id,b)},cancelActiveListeners:()=>{b.pending.forEach((P,_,C)=>{P!==N&&(P.abort(Mv),C.delete(P))})},cancel:()=>{N.abort(Mv),b.pending.delete(N)},throwIfCancelled:()=>{co(N.signal)}})))}catch(P){P instanceof Sh||ok(c,P,{raisedBy:"effect"})}finally{await Promise.all(O),N.abort(Q$),a(b),b.pending.delete(N)}},g=J$(t,r);return{middleware:b=>j=>k=>{if(!GE(k))return j(k);if(gA.match(k))return f(k.payload);if(eL.match(k)){g();return}if(vA.match(k))return h(k.payload);let S=b.getState();const N=()=>{if(S===ik)throw new Error($r(23));return S};let E;try{if(E=j(k),t.size>0){const O=b.getState(),P=Array.from(t.values());for(const _ of P){let C=!1;try{C=_.predicate(k,O,S)}catch(I){C=!1,ok(c,I,{raisedBy:"predicate"})}C&&p(_,k,b,N)}}}finally{S=ik}return E},startListening:f,stopListening:h,clearListeners:g}};function $r(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var rL={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},yA=lr({name:"chartLayout",initialState:rL,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,a,o;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(a=t.payload.bottom)!==null&&a!==void 0?a:0,e.margin.left=(o=t.payload.left)!==null&&o!==void 0?o:0},setScale(e,t){e.scale=t.payload}}}),Eh=yA.actions,nL=Eh.setMargin,iL=Eh.setLayout,aL=Eh.setChartSize,oL=Eh.setScale,sL=yA.reducer;function xA(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function He(e){return Number.isFinite(e)}function Hn(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function sk(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ps(e){for(var t=1;t{if(t&&r){var n=r.width,a=r.height,o=t.align,c=t.verticalAlign,l=t.layout;if((l==="vertical"||l==="horizontal"&&c==="middle")&&o!=="center"&&Ne(e[o]))return ps(ps({},e),{},{[o]:e[o]+(n||0)});if((l==="horizontal"||l==="vertical"&&o==="center")&&c!=="middle"&&Ne(e[c]))return ps(ps({},e),{},{[c]:e[c]+(a||0)})}return e},Vn=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",bA=(e,t,r,n)=>{if(n)return e.map(l=>l.coordinate);var a,o,c=e.map(l=>(l.coordinate===t&&(a=!0),l.coordinate===r&&(o=!0),l.coordinate));return a||c.push(t),o||c.push(r),c},wA=(e,t,r)=>{if(!e)return null;var n=e.duplicateDomain,a=e.type,o=e.range,c=e.scale,l=e.realScaleType,f=e.isCategorical,h=e.categoricalDomain,p=e.tickCount,g=e.ticks,x=e.niceTicks,b=e.axisType;if(!c)return null;var j=l==="scaleBand"&&c.bandwidth?c.bandwidth()/2:2,k=a==="category"&&c.bandwidth?c.bandwidth()/j:0;if(k=b==="angleAxis"&&o&&o.length>=2?Xr(o[0]-o[1])*2*k:k,g||x){var S=(g||x||[]).map((N,E)=>{var O=n?n.indexOf(N):N,P=c.map(O);return He(P)?{coordinate:P+k,value:N,offset:k,index:E}:null}).filter(Nr);return S}return f&&h?h.map((N,E)=>{var O=c.map(N);return He(O)?{coordinate:O+k,value:N,index:E,offset:k}:null}).filter(Nr):c.ticks&&p!=null?c.ticks(p).map((N,E)=>{var O=c.map(N);return He(O)?{coordinate:O+k,value:N,index:E,offset:k}:null}).filter(Nr):c.domain().map((N,E)=>{var O=c.map(N);return He(O)?{coordinate:O+k,value:n?n[N]:N,index:E,offset:k}:null}).filter(Nr)},fL=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var a=0;a=0?(h[0]=o,o+=x,h[1]=o):(h[0]=c,c+=x,h[1]=c)}}}},hL=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var a=0;a=0?(f[0]=o,o+=h,f[1]=o):(f[0]=0,f[1]=0)}}}},pL={sign:fL,expand:OD,none:mo,silhouette:_D,wiggle:MD,positive:hL},mL=(e,t,r)=>{var n,a=(n=pL[r])!==null&&n!==void 0?n:mo,o=CD().keys(t).value((l,f)=>Number(zt(l,f,0))).order(xv).offset(a),c=o(e);return c.forEach((l,f)=>{l.forEach((h,p)=>{var g=zt(e[p],t[f],0);Array.isArray(g)&&g.length===2&&Ne(g[0])&&Ne(g[1])&&(h[0]=g[0],h[1]=g[1])})}),c};function gL(e){return e==null?void 0:String(e)}function lk(e){var t=e.axis,r=e.ticks,n=e.bandSize,a=e.entry,o=e.index,c=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Yt(a[t.dataKey])){var l=AE(r,"value",a[t.dataKey]);if(l)return l.coordinate+n/2}return r!=null&&r[o]?r[o].coordinate+n/2:null}var f=zt(a,Yt(c)?t.dataKey:c),h=t.scale.map(f);return Ne(h)?h:null}var vL=e=>{var t=e.flat(2).filter(Ne);return[Math.min(...t),Math.max(...t)]},yL=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],xL=(e,t,r)=>{if(!(e==null||Object.keys(e).length===0))return yL(Object.keys(e).reduce((n,a)=>{var o=e[a];if(!o)return n;var c=o.stackedData,l=c.reduce((f,h)=>{var p=xA(h,t,r),g=vL(p);return!He(g[0])||!He(g[1])?f:[Math.min(f[0],g[0]),Math.max(f[1],g[1])]},[1/0,-1/0]);return[Math.min(l[0],n[0]),Math.max(l[1],n[1])]},[1/0,-1/0]))},uk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ck=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,jf=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var a=gh(t,p=>p.coordinate),o=1/0,c=1,l=a.length;c{if(t==="horizontal")return e.relativeX;if(t==="vertical")return e.relativeY},wL=(e,t)=>t==="centric"?e.angle:e.radius,ji=e=>e.layout.width,Si=e=>e.layout.height,kL=e=>e.layout.scale,jA=e=>e.layout.margin,Ah=K(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),Ph=K(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),jL="data-recharts-item-index",SL="data-recharts-item-id",Zu=60;function fk(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function $d(e){for(var t=1;te.brush.height;function CL(e){var t=Ph(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var a=typeof n.width=="number"?n.width:Zu;return r+a}return r},0)}function OL(e){var t=Ph(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var a=typeof n.width=="number"?n.width:Zu;return r+a}return r},0)}function _L(e){var t=Ah(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function ML(e){var t=Ah(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var Zt=K([ji,Si,jA,PL,CL,OL,_L,ML,WE,JR],(e,t,r,n,a,o,c,l,f,h)=>{var p={left:(r.left||0)+a,right:(r.right||0)+o},g={top:(r.top||0)+c,bottom:(r.bottom||0)+l},x=$d($d({},g),p),b=x.bottom;x.bottom+=n,x=dL(x,f,h);var j=e-x.left-x.right,k=t-x.top-x.bottom;return $d($d({brushBottom:b},x),{},{width:Math.max(j,0),height:Math.max(k,0)})}),IL=K(Zt,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),SA=K(ji,Si,(e,t)=>({x:0,y:0,width:e,height:t})),TL=v.createContext(null),Ar=()=>v.useContext(TL)!=null,Ch=e=>e.brush,Oh=K([Ch,Zt,jA],(e,t,r)=>({height:e.height,x:Ne(e.x)?e.x:t.left,y:Ne(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:Ne(e.width)?e.width:t.width}));function DL(e,t,{signal:r,edges:n}={}){let a,o=null;const c=n!=null&&n.includes("leading"),l=n==null||n.includes("trailing"),f=()=>{o!==null&&(e.apply(a,o),a=void 0,o=null)},h=()=>{l&&f(),b()};let p=null;const g=()=>{p!=null&&clearTimeout(p),p=setTimeout(()=>{p=null,h()},t)},x=()=>{p!==null&&(clearTimeout(p),p=null)},b=()=>{x(),a=void 0,o=null},j=()=>{f()},k=function(...S){if(r!=null&&r.aborted)return;a=this,o=S;const N=p==null;g(),c&&N&&f()};return k.schedule=g,k.cancel=b,k.flush=j,r==null||r.addEventListener("abort",b,{once:!0}),k}function RL(e,t=0,r={}){typeof r!="object"&&(r={});const{leading:n=!1,trailing:a=!0,maxWait:o}=r,c=Array(2);n&&(c[0]="leading"),a&&(c[1]="trailing");let l,f=null;const h=DL(function(...x){l=e.apply(this,x),f=null},t,{edges:c}),p=function(...x){return o!=null&&(f===null&&(f=Date.now()),Date.now()-f>=o)?(l=e.apply(this,x),f=Date.now(),h.cancel(),h.schedule(),l):(h.apply(this,x),l)},g=()=>(h.flush(),l);return p.cancel=h.cancel,p.flush=g,p}function $L(e,t=0,r={}){const{leading:n=!0,trailing:a=!0}=r;return RL(e,t,{leading:n,maxWait:t,trailing:a})}var Sf=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),o=2;oa[c++]))}},$n={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},NA=(e,t,r)=>{var n=r.width,a=n===void 0?$n.width:n,o=r.height,c=o===void 0?$n.height:o,l=r.aspect,f=r.maxHeight,h=go(a)?e:Number(a),p=go(c)?t:Number(c);return l&&l>0&&(h?p=h/l:p&&(h=p*l),f&&p!=null&&p>f&&(p=f)),{calculatedWidth:h,calculatedHeight:p}},LL={width:0,height:0,overflow:"visible"},zL={width:0,overflowX:"visible"},FL={height:0,overflowY:"visible"},BL={},UL=e=>{var t=e.width,r=e.height,n=go(t),a=go(r);return n&&a?LL:n?zL:a?FL:BL};function WL(e){var t=e.width,r=e.height,n=e.aspect,a=t,o=r;return a===void 0&&o===void 0?(a=$n.width,o=$n.height):a===void 0?a=n&&n>0?void 0:$n.width:o===void 0&&(o=n&&n>0?void 0:$n.height),{width:a,height:o}}var HL=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function Nf(){return Nf=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r({width:r,height:n}),[r,n]);return tz(a)?v.createElement(EA.Provider,{value:a},t):null}var Fy=()=>v.useContext(EA),rz=v.forwardRef((e,t)=>{var r=e.aspect,n=e.initialDimension,a=n===void 0?$n.initialDimension:n,o=e.width,c=e.height,l=e.minWidth,f=l===void 0?$n.minWidth:l,h=e.minHeight,p=e.maxHeight,g=e.children,x=e.debounce,b=x===void 0?$n.debounce:x,j=e.id,k=e.className,S=e.onResize,N=e.style,E=N===void 0?{}:N,O=JL(e,HL),P=v.useRef(null),_=v.useRef();_.current=S,v.useImperativeHandle(t,()=>P.current);var C=v.useState({containerWidth:a.width,containerHeight:a.height}),I=qL(C,2),B=I[0],U=I[1],G=v.useCallback((be,de)=>{U(Y=>{var V=Math.round(be),Q=Math.round(de);return Y.containerWidth===V&&Y.containerHeight===Q?Y:{containerWidth:V,containerHeight:Q}})},[]);v.useEffect(()=>{if(P.current==null||typeof ResizeObserver>"u")return Qs;var be=D=>{var T,Z=D[0];if(Z!=null){var oe=Z.contentRect,re=oe.width,ue=oe.height;G(re,ue),(T=_.current)===null||T===void 0||T.call(_,re,ue)}};b>0&&(be=$L(be,b,{trailing:!0,leading:!1}));var de=new ResizeObserver(be),Y=P.current.getBoundingClientRect(),V=Y.width,Q=Y.height;return G(V,Q),de.observe(P.current),()=>{de.disconnect()}},[G,b]);var X=B.containerWidth,$=B.containerHeight;Sf(!r||r>0,"The aspect(%s) must be greater than zero.",r);var fe=NA(X,$,{width:o,height:c,aspect:r,maxHeight:p}),J=fe.calculatedWidth,pe=fe.calculatedHeight;return Sf(X<0||$<0||J!=null&&J>0||pe!=null&&pe>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,J,pe,o,c,f,h,r),v.createElement("div",Nf({id:j?"".concat(j):void 0,className:nt("recharts-responsive-container",k),style:pk(pk({},E),{},{width:o,height:c,minWidth:f,minHeight:h,maxHeight:p}),ref:P},O),v.createElement("div",{style:UL({width:o,height:c})},v.createElement(AA,{width:J,height:pe},g)))}),nz=v.forwardRef((e,t)=>{var r=Fy();if(Hn(r.width)&&Hn(r.height))return e.children;var n=WL({width:e.width,height:e.height,aspect:e.aspect}),a=n.width,o=n.height,c=NA(void 0,void 0,{width:a,height:o,aspect:e.aspect,maxHeight:e.maxHeight}),l=c.calculatedWidth,f=c.calculatedHeight;return Ne(l)&&Ne(f)?v.createElement(AA,{width:l,height:f},e.children):v.createElement(rz,Nf({},e,{width:a,height:o,ref:t}))});function By(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var _h=()=>{var e,t=Ar(),r=Me(IL),n=Me(Oh),a=(e=Me(Ch))===null||e===void 0?void 0:e.padding;return!t||!n||!a?r:{width:n.width-a.left-a.right,height:n.height-a.top-a.bottom,x:a.left,y:a.top}},iz={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},PA=()=>{var e;return(e=Me(Zt))!==null&&e!==void 0?e:iz},CA=()=>Me(ji),OA=()=>Me(Si),dt=e=>e.layout.layoutType,Ys=()=>Me(dt),Uy=()=>{var e=Ys();if(e==="horizontal"||e==="vertical")return e},_A=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},az=()=>{var e=Ys();return e!==void 0},Ju=e=>{var t=Et(),r=Ar(),n=e.width,a=e.height,o=Fy(),c=n,l=a;return o&&(c=o.width>0?o.width:n,l=o.height>0?o.height:a),v.useEffect(()=>{!r&&Hn(c)&&Hn(l)&&t(aL({width:c,height:l}))},[t,r,c,l]),null},MA=Symbol.for("immer-nothing"),gk=Symbol.for("immer-draftable"),zr=Symbol.for("immer-state");function yn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var _u=Object.getPrototypeOf;function Fs(e){return!!e&&!!e[zr]}function yo(e){var t;return e?IA(e)||Array.isArray(e)||!!e[gk]||!!((t=e.constructor)!=null&&t[gk])||ec(e)||Ih(e):!1}var oz=Object.prototype.constructor.toString(),vk=new WeakMap;function IA(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=vk.get(r);return n===void 0&&(n=Function.toString.call(r),vk.set(r,n)),n===oz}function Ef(e,t,r=!0){Mh(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((n,a)=>t(a,n,e))}function Mh(e){const t=e[zr];return t?t.type_:Array.isArray(e)?1:ec(e)?2:Ih(e)?3:0}function Tv(e,t){return Mh(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function TA(e,t,r){const n=Mh(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function sz(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ec(e){return e instanceof Map}function Ih(e){return e instanceof Set}function Ga(e){return e.copy_||e.base_}function Dv(e,t){if(ec(e))return new Map(e);if(Ih(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=IA(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[zr];let a=Reflect.ownKeys(n);for(let o=0;o1&&Object.defineProperties(e,{set:Ld,add:Ld,clear:Ld,delete:Ld}),Object.freeze(e),t&&Object.values(e).forEach(r=>Wy(r,!0))),e}function lz(){yn(2)}var Ld={value:lz};function Th(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var uz={};function xo(e){const t=uz[e];return t||yn(0,e),t}var Mu;function DA(){return Mu}function cz(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function yk(e,t){t&&(xo("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Rv(e){$v(e),e.drafts_.forEach(dz),e.drafts_=null}function $v(e){e===Mu&&(Mu=e.parent_)}function xk(e){return Mu=cz(Mu,e)}function dz(e){const t=e[zr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function bk(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[zr].modified_&&(Rv(t),yn(4)),yo(e)&&(e=Af(t,e),t.parent_||Pf(t,e)),t.patches_&&xo("Patches").generateReplacementPatches_(r[zr].base_,e,t.patches_,t.inversePatches_)):e=Af(t,r,[]),Rv(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==MA?e:void 0}function Af(e,t,r){if(Th(t))return t;const n=e.immer_.shouldUseStrictIteration(),a=t[zr];if(!a)return Ef(t,(o,c)=>wk(e,a,t,o,c,r),n),t;if(a.scope_!==e)return t;if(!a.modified_)return Pf(e,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const o=a.copy_;let c=o,l=!1;a.type_===3&&(c=new Set(o),o.clear(),l=!0),Ef(c,(f,h)=>wk(e,a,o,f,h,r,l),n),Pf(e,o,!1),r&&e.patches_&&xo("Patches").generatePatches_(a,r,e.patches_,e.inversePatches_)}return a.copy_}function wk(e,t,r,n,a,o,c){if(a==null||typeof a!="object"&&!c)return;const l=Th(a);if(!(l&&!c)){if(Fs(a)){const f=o&&t&&t.type_!==3&&!Tv(t.assigned_,n)?o.concat(n):void 0,h=Af(e,a,f);if(TA(r,n,h),Fs(h))e.canAutoFreeze_=!1;else return}else c&&r.add(a);if(yo(a)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===a&&l)return;Af(e,a),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(ec(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&Pf(e,a)}}}function Pf(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Wy(t,r)}function fz(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:DA(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=n,o=Hy;r&&(a=[n],o=Iu);const{revoke:c,proxy:l}=Proxy.revocable(a,o);return n.draft_=l,n.revoke_=c,l}var Hy={get(e,t){if(t===zr)return e;const r=Ga(e);if(!Tv(r,t))return hz(e,r,t);const n=r[t];return e.finalized_||!yo(n)?n:n===cg(e.base_,t)?(dg(e),e.copy_[t]=zv(n,e)):n},has(e,t){return t in Ga(e)},ownKeys(e){return Reflect.ownKeys(Ga(e))},set(e,t,r){const n=RA(Ga(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=cg(Ga(e),t),o=a==null?void 0:a[zr];if(o&&o.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(sz(r,a)&&(r!==void 0||Tv(e.base_,t)))return!0;dg(e),Lv(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return cg(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,dg(e),Lv(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Ga(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){yn(11)},getPrototypeOf(e){return _u(e.base_)},setPrototypeOf(){yn(12)}},Iu={};Ef(Hy,(e,t)=>{Iu[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Iu.deleteProperty=function(e,t){return Iu.set.call(this,e,t,void 0)};Iu.set=function(e,t,r){return Hy.set.call(this,e[0],t,r,e[0])};function cg(e,t){const r=e[zr];return(r?Ga(r):e)[t]}function hz(e,t,r){var a;const n=RA(t,r);return n?"value"in n?n.value:(a=n.get)==null?void 0:a.call(e.draft_):void 0}function RA(e,t){if(!(t in e))return;let r=_u(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=_u(r)}}function Lv(e){e.modified_||(e.modified_=!0,e.parent_&&Lv(e.parent_))}function dg(e){e.copy_||(e.copy_=Dv(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var pz=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const o=r;r=t;const c=this;return function(f=o,...h){return c.produce(f,p=>r.call(this,p,...h))}}typeof r!="function"&&yn(6),n!==void 0&&typeof n!="function"&&yn(7);let a;if(yo(t)){const o=xk(this),c=zv(t,void 0);let l=!0;try{a=r(c),l=!1}finally{l?Rv(o):$v(o)}return yk(o,n),bk(a,o)}else if(!t||typeof t!="object"){if(a=r(t),a===void 0&&(a=t),a===MA&&(a=void 0),this.autoFreeze_&&Wy(a,!0),n){const o=[],c=[];xo("Patches").generateReplacementPatches_(t,a,o,c),n(o,c)}return a}else yn(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(c,...l)=>this.produceWithPatches(c,f=>t(f,...l));let n,a;return[this.produce(t,r,(c,l)=>{n=c,a=l}),n,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){yo(e)||yn(8),Fs(e)&&(e=mz(e));const t=xk(this),r=zv(e,void 0);return r[zr].isManual_=!0,$v(t),r}finishDraft(e,t){const r=e&&e[zr];(!r||!r.isManual_)&&yn(9);const{scope_:n}=r;return yk(n,t),bk(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const a=t[r];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}r>-1&&(t=t.slice(r+1));const n=xo("Patches").applyPatches_;return Fs(e)?n(e,t):this.produce(e,a=>n(a,t))}};function zv(e,t){const r=ec(e)?xo("MapSet").proxyMap_(e,t):Ih(e)?xo("MapSet").proxySet_(e,t):fz(e,t);return(t?t.scope_:DA()).drafts_.push(r),r}function mz(e){return Fs(e)||yn(10,e),$A(e)}function $A(e){if(!yo(e)||Th(e))return e;const t=e[zr];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Dv(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Dv(e,!0);return Ef(r,(a,o)=>{TA(r,a,$A(o))},n),t&&(t.finalized_=!1),r}var gz=new pz;gz.produce;var vz={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},LA=lr({name:"legend",initialState:vz,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:st()},replaceLegendPayload:{reducer(e,t){var r=t.payload,n=r.prev,a=r.next,o=Zr(e).payload.indexOf(n);o>-1&&(e.payload[o]=a)},prepare:st()},removeLegendPayload:{reducer(e,t){var r=Zr(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:st()}}}),tc=LA.actions;tc.setLegendSize;tc.setLegendSettings;var yz=tc.addLegendPayload,xz=tc.replaceLegendPayload,bz=tc.removeLegendPayload,wz=LA.reducer,fg={exports:{}},hg={};/** - * @license React - * use-sync-external-store-with-selector.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var kk;function kz(){if(kk)return hg;kk=1;var e=Vs();function t(f,h){return f===h&&(f!==0||1/f===1/h)||f!==f&&h!==h}var r=typeof Object.is=="function"?Object.is:t,n=e.useSyncExternalStore,a=e.useRef,o=e.useEffect,c=e.useMemo,l=e.useDebugValue;return hg.useSyncExternalStoreWithSelector=function(f,h,p,g,x){var b=a(null);if(b.current===null){var j={hasValue:!1,value:null};b.current=j}else j=b.current;b=c(function(){function S(_){if(!N){if(N=!0,E=_,_=g(_),x!==void 0&&j.hasValue){var C=j.value;if(x(C,_))return O=C}return O=_}if(C=O,r(E,_))return C;var I=g(_);return x!==void 0&&x(C,I)?(E=_,C):(E=_,O=I)}var N=!1,E,O,P=p===void 0?null:p;return[function(){return S(h())},P===null?void 0:function(){return S(P())}]},[h,p,g,x]);var k=n(f,b[0],b[1]);return o(function(){j.hasValue=!0,j.value=k},[k]),l(k),k},hg}var jk;function jz(){return jk||(jk=1,fg.exports=kz()),fg.exports}jz();function Sz(e){e()}function Nz(){let e=null,t=null;return{clear(){e=null,t=null},notify(){Sz(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const a=t={callback:r,next:null,prev:t};return a.prev?a.prev.next=a:e=a,function(){!n||e===null||(n=!1,a.next?a.next.prev=a.prev:t=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}var Sk={notify(){},get:()=>[]};function Ez(e,t){let r,n=Sk,a=0,o=!1;function c(k){p();const S=n.subscribe(k);let N=!1;return()=>{N||(N=!0,S(),g())}}function l(){n.notify()}function f(){j.onStateChange&&j.onStateChange()}function h(){return o}function p(){a++,r||(r=e.subscribe(f),n=Nz())}function g(){a--,r&&a===0&&(r(),r=void 0,n.clear(),n=Sk)}function x(){o||(o=!0,p())}function b(){o&&(o=!1,g())}const j={addNestedSub:c,notifyNestedSubs:l,handleChangeWrapper:f,isSubscribed:h,trySubscribe:x,tryUnsubscribe:b,getListeners:()=>n};return j}var Az=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Pz=Az(),Cz=()=>typeof navigator<"u"&&navigator.product==="ReactNative",Oz=Cz(),_z=()=>Pz||Oz?v.useLayoutEffect:v.useEffect,Mz=_z();function Nk(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function Iz(e,t){if(Nk(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let a=0;a{const f=Ez(a);return{store:a,subscription:f,getServerState:n?()=>n:void 0}},[a,n]),c=v.useMemo(()=>a.getState(),[a]);Mz(()=>{const{subscription:f}=o;return f.onStateChange=f.notifyNestedSubs,f.trySubscribe(),c!==a.getState()&&f.notifyNestedSubs(),()=>{f.tryUnsubscribe(),f.onStateChange=void 0}},[o,c]);const l=r||Dz;return v.createElement(l.Provider,{value:o},t)}var $z=Rz,Lz=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function zz(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Dh(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(Lz.has(n)){if(e[n]==null&&t[n]==null)continue;if(!Iz(e[n],t[n]))return!1}else if(!zz(e[n],t[n]))return!1;return!0}function Fv(){return Fv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r{var t=e.separator,r=t===void 0?is.separator:t,n=e.contentStyle,a=e.itemStyle,o=e.labelStyle,c=o===void 0?is.labelStyle:o,l=e.payload,f=e.formatter,h=e.itemSorter,p=e.wrapperClassName,g=e.labelClassName,x=e.label,b=e.labelFormatter,j=e.accessibilityLayer,k=j===void 0?is.accessibilityLayer:j,S=()=>{if(l&&l.length){var B={padding:0,margin:0},U=Qz(l,h),G=U.map((X,$)=>{if(!X||X.type==="none")return null;var fe=X.formatter||f||qz,J=X.value,pe=X.name,be=J,de=pe;if(fe){var Y=fe(J,pe,X,$,l);if(Array.isArray(Y)){var V=Wz(Y,2);be=V[0],de=V[1]}else if(Y!=null)be=Y;else return null}var Q=eu(eu({},is.itemStyle),{},{color:X.color||is.itemStyle.color},a);return v.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat($),style:Q},Wn(de)?v.createElement("span",{className:"recharts-tooltip-item-name"},de):null,Wn(de)?v.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,v.createElement("span",{className:"recharts-tooltip-item-value"},be),v.createElement("span",{className:"recharts-tooltip-item-unit"},X.unit||""))});return v.createElement("ul",{className:"recharts-tooltip-item-list",style:B},G)}return null},N=eu(eu({},is.contentStyle),n),E=eu({margin:0},c),O=!Yt(x),P=O?x:"",_=nt("recharts-default-tooltip",p),C=nt("recharts-tooltip-label",g);O&&b&&l!==void 0&&l!==null&&(P=b(x,l));var I=k?{role:"status","aria-live":"assertive"}:{};return v.createElement("div",Fv({className:_,style:N},I),v.createElement("p",{className:C,style:E},v.isValidElement(P)?P:"".concat(P)),S())},tu="recharts-tooltip-wrapper",Xz={visibility:"hidden"};function Zz(e){var t=e.coordinate,r=e.translateX,n=e.translateY;return nt(tu,{["".concat(tu,"-right")]:Ne(r)&&t&&Ne(t.x)&&r>=t.x,["".concat(tu,"-left")]:Ne(r)&&t&&Ne(t.x)&&r=t.y,["".concat(tu,"-top")]:Ne(n)&&t&&Ne(t.y)&&n0?a:0),g=r[n]+a;if(t[n])return c[n]?p:g;var x=f[n];if(x==null)return 0;if(c[n]){var b=p,j=x;return bS?Math.max(p,x):Math.max(g,x)}function Jz(e){var t=e.translateX,r=e.translateY,n=e.useTranslate3d;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function e6(e){var t=e.allowEscapeViewBox,r=e.coordinate,n=e.offsetTop,a=e.offsetLeft,o=e.position,c=e.reverseDirection,l=e.tooltipBox,f=e.useTranslate3d,h=e.viewBox,p,g,x;return l.height>0&&l.width>0&&r?(g=Pk({allowEscapeViewBox:t,coordinate:r,key:"x",offset:a,position:o,reverseDirection:c,tooltipDimension:l.width,viewBox:h,viewBoxDimension:h.width}),x=Pk({allowEscapeViewBox:t,coordinate:r,key:"y",offset:n,position:o,reverseDirection:c,tooltipDimension:l.height,viewBox:h,viewBoxDimension:h.height}),p=Jz({translateX:g,translateY:x,useTranslate3d:f})):p=Xz,{cssProperties:p,cssClasses:Zz({translateX:g,translateY:x,coordinate:r})}}var t6=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),rc={isSsr:t6()};function r6(e,t){return o6(e)||a6(e,t)||i6(e,t)||n6()}function n6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function i6(e,t){if(e){if(typeof e=="string")return Ck(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ck(e,t):void 0}}function Ck(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);rrc.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),t=r6(e,2),r=t[0],n=t[1];return v.useEffect(()=>{if(window.matchMedia){var a=window.matchMedia("(prefers-reduced-motion: reduce)"),o=()=>{n(a.matches)};return a.addEventListener("change",o),()=>{a.removeEventListener("change",o)}}},[]),r}function Ok(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function as(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),h=c6(f,2),p=h[0],g=h[1];v.useEffect(()=>{var N=E=>{if(E.key==="Escape"){var O,P,_,C;g({dismissed:!0,dismissedAtCoordinate:{x:(O=(P=e.coordinate)===null||P===void 0?void 0:P.x)!==null&&O!==void 0?O:0,y:(_=(C=e.coordinate)===null||C===void 0?void 0:C.y)!==null&&_!==void 0?_:0}})}};return document.addEventListener("keydown",N),()=>{document.removeEventListener("keydown",N)}},[(t=e.coordinate)===null||t===void 0?void 0:t.x,(r=e.coordinate)===null||r===void 0?void 0:r.y]),p.dismissed&&(((n=(a=e.coordinate)===null||a===void 0?void 0:a.x)!==null&&n!==void 0?n:0)!==p.dismissedAtCoordinate.x||((o=(c=e.coordinate)===null||c===void 0?void 0:c.y)!==null&&o!==void 0?o:0)!==p.dismissedAtCoordinate.y)&&g(as(as({},p),{},{dismissed:!1}));var x=e6({allowEscapeViewBox:e.allowEscapeViewBox,coordinate:e.coordinate,offsetLeft:typeof e.offset=="number"?e.offset:e.offset.x,offsetTop:typeof e.offset=="number"?e.offset:e.offset.y,position:e.position,reverseDirection:e.reverseDirection,tooltipBox:{height:e.lastBoundingBox.height,width:e.lastBoundingBox.width},useTranslate3d:e.useTranslate3d,viewBox:e.viewBox}),b=x.cssClasses,j=x.cssProperties,k=e.hasPortalFromProps?{}:as(as({transition:m6({prefersReducedMotion:l,isAnimationActive:e.isAnimationActive,active:e.active,animationDuration:e.animationDuration,animationEasing:e.animationEasing})},j),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),S=as(as({},k),{},{visibility:!p.dismissed&&e.active&&e.hasPayload?"visible":"hidden"},e.wrapperStyle);return v.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:b,style:S,ref:e.innerRef},e.children)}var v6=v.memo(g6),FA=()=>{var e;return(e=Me(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function Bv(){return Bv=Object.assign?Object.assign.bind():function(e){for(var t=1;tHe(e.x)&&He(e.y),Dk=e=>e.base!=null&&Cf(e.base)&&Cf(e),ru=e=>e.x,nu=e=>e.y,w6=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(Oy(e));if((r==="curveMonotone"||r==="curveBump")&&t){var n=Tk["".concat(r).concat(t==="vertical"?"Y":"X")];if(n)return n}return Tk[r]||ph},Rk={connectNulls:!1,type:"linear"},k6=e=>{var t=e.type,r=t===void 0?Rk.type:t,n=e.points,a=n===void 0?[]:n,o=e.baseLine,c=e.layout,l=e.connectNulls,f=l===void 0?Rk.connectNulls:l,h=w6(r,c),p=f?a.filter(Cf):a;if(Array.isArray(o)){var g,x=a.map((N,E)=>Ik(Ik({},N),{},{base:o[E]}));c==="vertical"?g=_d().y(nu).x1(ru).x0(N=>N.base.x):g=_d().x(ru).y1(nu).y0(N=>N.base.y);var b=g.defined(Dk).curve(h),j=f?x.filter(Dk):x;return b(j)}var k;c==="vertical"&&Ne(o)?k=_d().y(nu).x1(ru).x0(o):Ne(o)?k=_d().x(ru).y1(nu).y0(o):k=mE().x(ru).y(nu);var S=k.defined(Cf).curve(h);return S(p)},rf=e=>{var t=e.className,r=e.points,n=e.path,a=e.pathRef,o=Ys();if((!r||!r.length)&&!n)return null;var c={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||o,connectNulls:e.connectNulls},l=r&&r.length?k6(c):n;return v.createElement("path",Bv({},bn(e),_y(e),{className:nt("recharts-curve",t),d:l===null?void 0:l,ref:a}))},j6=["x","y","top","left","width","height","className"];function Uv(){return Uv=Object.assign?Object.assign.bind():function(e){for(var t=1;t"M".concat(e,",").concat(a,"v").concat(n,"M").concat(o,",").concat(t,"h").concat(r),_6=e=>{var t=e.x,r=t===void 0?0:t,n=e.y,a=n===void 0?0:n,o=e.top,c=o===void 0?0:o,l=e.left,f=l===void 0?0:l,h=e.width,p=h===void 0?0:h,g=e.height,x=g===void 0?0:g,b=e.className,j=P6(e,j6),k=S6({x:r,y:a,top:c,left:f,width:p,height:x},j);return!Ne(r)||!Ne(a)||!Ne(p)||!Ne(x)||!Ne(c)||!Ne(f)?null:v.createElement("path",Uv({},en(k),{className:nt("recharts-cross",b),d:O6(r,a,p,x,c,f)}))};function M6(e,t,r,n){var a=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-a,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}var Of=1e-4,BA=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],UA=(e,t)=>e.map((r,n)=>r*t**n).reduce((r,n)=>r+n),Lk=(e,t)=>r=>{var n=BA(e,t);return UA(n,r)},I6=(e,t)=>r=>{var n=BA(e,t),a=[...n.map((o,c)=>o*c).slice(1),0];return UA(a,r)},T6=e=>{var t,r=e.split("(");if(r.length!==2||r[0]!=="cubic-bezier")return null;var n=(t=r[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(n==null||n.length!==4)return null;var a=n.map(o=>parseFloat(o));return[a[0],a[1],a[2],a[3]]},D6=function(){for(var t=arguments.length,r=new Array(t),n=0;n{var a=Lk(e,r),o=Lk(t,n),c=I6(e,r),l=h=>h>1?1:h<0?0:h,f=h=>{for(var p=h>1?1:h,g=p,x=0;x<8;++x){var b=a(g)-p,j=c(g);if(Math.abs(b-p)0&&arguments[0]!==void 0?arguments[0]:{},r=t.stiff,n=r===void 0?100:r,a=t.damping,o=a===void 0?8:a,c=t.dt,l=c===void 0?16.67:c,f=1,h=[0],p=0,g=0,x=1e4,b=0;b{var E,O,P;if(N<=0)return 0;if(N>=1)return f;var _=N*S,C=Math.floor(_),I=_-C;return((E=h[C])!==null&&E!==void 0?E:0)+(((O=h[C+1])!==null&&O!==void 0?O:0)-((P=h[C])!==null&&P!==void 0?P:0))*I}},L6=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return zk(e);case"spring":return $6();default:if(e.split("(")[0]==="cubic-bezier")return zk(e)}return typeof e=="function"?e:null},z6=(e,t,r)=>{var n,a=o=>{var c=t.tick(o);if(t.getState()==="active"){if(r(t.getInterpolated()),t.getProgress()===1){t.complete(),n=void 0;return}n=e.setTimeout(a,c);return}n=e.setTimeout(a,c)};return n=e.setTimeout(a,0),()=>{var o;return(o=n)===null||o===void 0?void 0:o()}},WA=v.createContext(z6);WA.Provider;function F6(e){var t=v.useContext(WA);return v.useMemo(()=>e??t,[e,t])}function B6(e,t,r){return(t=U6(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U6(e){var t=W6(e,"string");return typeof t=="symbol"?t:t+""}function W6(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Fk="init",Bk="pending",Uk="active",H6="completed";function gg(e){return Math.max(0,e)}class K6{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(t){var r;B6(this,"state",Fk),this.animationId=t.animationId,this.onAnimationEnd=t.onAnimationEnd,this.animationDuration=gg(t.animationDuration),this.animationBegin=gg(t.animationBegin),this.progress=0,this.from=t.from,this.to=t.to,this.easing=t.easing,(r=t.onAnimationStart)===null||r===void 0||r.call(t)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(t){if(this.getState()===Fk)return this.state=Bk,this.beginStartedTime=t,this.animationBegin;if(this.getState()===Bk){if(this.beginStartedTime==null)throw new Error;var r=t-this.beginStartedTime;return r>=this.animationBegin?(this.state=Uk,this.animationStartedTime=t,this.nextAnimationUpdate(0)):gg(this.animationBegin-r)}if(this.getState()===Uk){if(this.animationStartedTime==null)throw new Error;var n=t-this.animationStartedTime;return this.setProgress(n/this.animationDuration),this.nextAnimationUpdate(n)}return 0}setProgress(t){this.progress=Math.min(1,Math.max(0,t))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var t;(t=this.onAnimationEnd)===null||t===void 0||t.call(this)}this.state=H6}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class G6 extends K6{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(di(this.getFrom(),this.getTo(),this.getProgress()))}}class V6{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),a=null,o=c=>{c-n>=r?t(c):a=requestAnimationFrame(o)};return a=requestAnimationFrame(o),()=>{a!=null&&cancelAnimationFrame(a)}}}function q6(e,t){return Z6(e)||X6(e,t)||Y6(e,t)||Q6()}function Q6(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y6(e,t){if(e){if(typeof e=="string")return Wk(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wk(e,t):void 0}}function Wk(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{},onAnimationStart:()=>{}},Hk=0,vg=1;function HA(e){var t=nn(e,J6),r=t.animationId,n=t.isActive,a=t.canBegin,o=t.duration,c=t.easing,l=t.begin,f=t.onAnimationEnd,h=t.onAnimationStart,p=t.children,g=zA(),x=n==="auto"?!rc.isSsr&&!g:n,b=F6(t.animationController),j=v.useState(x?Hk:vg),k=q6(j,2),S=k[0],N=k[1];return v.useEffect(()=>{x||N(vg)},[x]),v.useEffect(()=>{var E=L6(c);if(!x||!a||E==null)return Qs;var O=new V6,P=new G6({animationId:r,easing:E,animationDuration:o,animationBegin:l,onAnimationStart:h,onAnimationEnd:f,from:Hk,to:vg});return b(O,P,N)},[b,r,x,a,o,c,l,h,f]),p(Number(S))}function KA(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",r=v.useRef(Au(t)),n=v.useRef(e);return n.current!==e&&(r.current=Au(t),n.current=e),r.current}var eF=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),tF=(e,t,r)=>e.map(n=>"".concat(eF(n)," ").concat(t,"ms ").concat(r)).join(","),rF=["radius"],nF=["radius"],Kk,Gk,Vk,qk,Qk,Yk,Xk,Zk,Jk,ej;function tj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function rj(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r{var o=ma(r),c=ma(n),l=Math.min(Math.abs(o)/2,Math.abs(c)/2),f=c>=0?1:-1,h=o>=0?1:-1,p=c>=0&&o>=0||c<0&&o<0?1:0,g;if(l>0&&Array.isArray(a)){for(var x=[0,0,0,0],b=0,j=4;bl?l:S}g=Gt(Kk||(Kk=On(["M",",",""])),e,t+f*x[0]),x[0]>0&&(g+=Gt(Gk||(Gk=On(["A ",",",",0,0,",",",",",""])),x[0],x[0],p,e+h*x[0],t)),g+=Gt(Vk||(Vk=On(["L ",",",""])),e+r-h*x[1],t),x[1]>0&&(g+=Gt(qk||(qk=On(["A ",",",",0,0,",`, - `,",",""])),x[1],x[1],p,e+r,t+f*x[1])),g+=Gt(Qk||(Qk=On(["L ",",",""])),e+r,t+n-f*x[2]),x[2]>0&&(g+=Gt(Yk||(Yk=On(["A ",",",",0,0,",`, - `,",",""])),x[2],x[2],p,e+r-h*x[2],t+n)),g+=Gt(Xk||(Xk=On(["L ",",",""])),e+h*x[3],t+n),x[3]>0&&(g+=Gt(Zk||(Zk=On(["A ",",",",0,0,",`, - `,",",""])),x[3],x[3],p,e,t+n-f*x[3])),g+="Z"}else if(l>0&&a===+a&&a>0){var N=Math.min(l,a);g=Gt(Jk||(Jk=On(["M ",",",` - A `,",",",0,0,",",",",",` - L `,",",` - A `,",",",0,0,",",",",",` - L `,",",` - A `,",",",0,0,",",",",",` - L `,",",` - A `,",",",0,0,",",",","," Z"])),e,t+f*N,N,N,p,e+h*N,t,e+r-h*N,t,N,N,p,e+r,t+f*N,e+r,t+n-f*N,N,N,p,e+r-h*N,t+n,e+h*N,t+n,N,N,p,e,t+n-f*N)}else g=Gt(ej||(ej=On(["M ",","," h "," v "," h "," Z"])),e,t,r,n,-r);return g},oj={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},hF=e=>{var t=nn(e,oj),r=v.useRef(null),n=v.useState(-1),a=lF(n,2),o=a[0],c=a[1];v.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var Y=r.current.getTotalLength();Y&&c(Y)}catch{}},[]);var l=t.x,f=t.y,h=t.width,p=t.height,g=t.radius,x=t.className,b=t.animationEasing,j=t.animationDuration,k=t.animationBegin,S=t.isAnimationActive,N=t.isUpdateAnimationActive,E=v.useRef(h),O=v.useRef(p),P=v.useRef(l),_=v.useRef(f),C=v.useMemo(()=>({x:l,y:f,width:h,height:p,radius:g}),[l,f,h,p,g]),I=KA(C,"rectangle-");if(l!==+l||f!==+f||h!==+h||p!==+p||h===0||p===0)return null;var B=nt("recharts-rectangle",x);if(!N){var U=en(t);U.radius;var G=nj(U,rF);return v.createElement("path",_f({},G,{x:ma(l),y:ma(f),width:ma(h),height:ma(p),radius:typeof g=="number"?g:void 0,className:B,d:aj(l,f,h,p,g)}))}var X=E.current,$=O.current,fe=P.current,J=_.current,pe="0px ".concat(o===-1?1:o,"px"),be="".concat(o,"px ").concat(o,"px"),de=tF(["strokeDasharray"],j,typeof b=="string"?b:oj.animationEasing);return v.createElement(HA,{animationId:I,key:I,canBegin:o>0,duration:j,easing:b,isActive:N,begin:k},Y=>{var V=di(X,h,Y),Q=di($,p,Y),D=di(fe,l,Y),T=di(J,f,Y);r.current&&(E.current=V,O.current=Q,P.current=D,_.current=T);var Z;S?Y>0?Z={transition:de,strokeDasharray:be}:Z={strokeDasharray:pe}:Z={strokeDasharray:be};var oe=en(t);oe.radius;var re=nj(oe,nF);return v.createElement("path",_f({},re,{radius:typeof g=="number"?g:void 0,className:B,d:aj(D,T,V,Q,g),ref:r,style:rj(rj({},Z),t.style)}))})};function sj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function lj(e){for(var t=1;te*180/Math.PI,Qt=(e,t,r,n)=>({x:e+Math.cos(-Mf*n)*r,y:t+Math.sin(-Mf*n)*r}),yF=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},xF=(e,t)=>{var r=e.x,n=e.y,a=t.x,o=t.y;return Math.sqrt((r-a)**2+(n-o)**2)},bF=(e,t)=>{var r=e.x,n=e.y,a=t.cx,o=t.cy,c=xF({x:r,y:n},{x:a,y:o});if(c<=0)return{radius:c,angle:0};var l=(r-a)/c,f=Math.acos(l);return n>o&&(f=2*Math.PI-f),{radius:c,angle:vF(f),angleInRadian:f}},wF=e=>{var t=e.startAngle,r=e.endAngle,n=Math.floor(t/360),a=Math.floor(r/360),o=Math.min(n,a);return{startAngle:t-o*360,endAngle:r-o*360}},kF=(e,t)=>{var r=t.startAngle,n=t.endAngle,a=Math.floor(r/360),o=Math.floor(n/360),c=Math.min(a,o);return e+c*360},jF=(e,t)=>{var r=e.relativeX,n=e.relativeY,a=bF({x:r,y:n},t),o=a.radius,c=a.angle,l=t.innerRadius,f=t.outerRadius;if(of||o===0)return null;var h=wF(t),p=h.startAngle,g=h.endAngle,x=c,b;if(p<=g){for(;x>g;)x-=360;for(;x=p&&x<=g}else{for(;x>p;)x-=360;for(;x=g&&x<=p}return b?lj(lj({},t),{},{radius:o,angle:kF(x,t)}):null};function GA(e){var t=e.cx,r=e.cy,n=e.radius,a=e.startAngle,o=e.endAngle,c=Qt(t,r,n,a),l=Qt(t,r,n,o);return{points:[c,l],cx:t,cy:r,radius:n,startAngle:a,endAngle:o}}var uj,cj,dj,fj,hj,pj,mj;function Wv(){return Wv=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var r=Xr(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},zd=e=>{var t=e.cx,r=e.cy,n=e.radius,a=e.angle,o=e.sign,c=e.isExternal,l=e.cornerRadius,f=e.cornerIsExternal,h=l*(c?1:-1)+n,p=Math.asin(l/h)/Mf,g=f?a:a+o*p,x=Qt(t,r,h,g),b=Qt(t,r,n,g),j=f?a-o*p:a,k=Qt(t,r,h*Math.cos(p*Mf),j);return{center:x,circleTangency:b,lineTangency:k,theta:p}},VA=e=>{var t=e.cx,r=e.cy,n=e.innerRadius,a=e.outerRadius,o=e.startAngle,c=e.endAngle,l=SF(o,c),f=o+l,h=Qt(t,r,a,o),p=Qt(t,r,a,f),g=Gt(uj||(uj=Ya(["M ",",",` - A `,",",`,0, - `,",",`, - `,",",` - `])),h.x,h.y,a,a,+(Math.abs(l)>180),+(o>f),p.x,p.y);if(n>0){var x=Qt(t,r,n,o),b=Qt(t,r,n,f);g+=Gt(cj||(cj=Ya(["L ",",",` - A `,",",`,0, - `,",",`, - `,","," Z"])),b.x,b.y,n,n,+(Math.abs(l)>180),+(o<=f),x.x,x.y)}else g+=Gt(dj||(dj=Ya(["L ",","," Z"])),t,r);return g},NF=e=>{var t=e.cx,r=e.cy,n=e.innerRadius,a=e.outerRadius,o=e.cornerRadius,c=e.forceCornerRadius,l=e.cornerIsExternal,f=e.startAngle,h=e.endAngle,p=Xr(h-f),g=zd({cx:t,cy:r,radius:a,angle:f,sign:p,cornerRadius:o,cornerIsExternal:l}),x=g.circleTangency,b=g.lineTangency,j=g.theta,k=zd({cx:t,cy:r,radius:a,angle:h,sign:-p,cornerRadius:o,cornerIsExternal:l}),S=k.circleTangency,N=k.lineTangency,E=k.theta,O=l?Math.abs(f-h):Math.abs(f-h)-j-E;if(O<0)return c?Gt(fj||(fj=Ya(["M ",",",` - a`,",",",0,0,1,",`,0 - a`,",",",0,0,1,",`,0 - `])),b.x,b.y,o,o,o*2,o,o,-o*2):VA({cx:t,cy:r,innerRadius:n,outerRadius:a,startAngle:f,endAngle:h});var P=Gt(hj||(hj=Ya(["M ",",",` - A`,",",",0,0,",",",",",` - A`,",",",0,",",",",",",",` - A`,",",",0,0,",",",",",` - `])),b.x,b.y,o,o,+(p<0),x.x,x.y,a,a,+(O>180),+(p<0),S.x,S.y,o,o,+(p<0),N.x,N.y);if(n>0){var _=zd({cx:t,cy:r,radius:n,angle:f,sign:p,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),C=_.circleTangency,I=_.lineTangency,B=_.theta,U=zd({cx:t,cy:r,radius:n,angle:h,sign:-p,isExternal:!0,cornerRadius:o,cornerIsExternal:l}),G=U.circleTangency,X=U.lineTangency,$=U.theta,fe=l?Math.abs(f-h):Math.abs(f-h)-B-$;if(fe<0&&o===0)return"".concat(P,"L").concat(t,",").concat(r,"Z");P+=Gt(pj||(pj=Ya(["L",",",` - A`,",",",0,0,",",",",",` - A`,",",",0,",",",",",",",` - A`,",",",0,0,",",",",","Z"])),X.x,X.y,o,o,+(p<0),G.x,G.y,n,n,+(fe>180),+(p>0),C.x,C.y,o,o,+(p<0),I.x,I.y)}else P+=Gt(mj||(mj=Ya(["L",",","Z"])),t,r);return P},EF={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},AF=e=>{var t=nn(e,EF),r=t.cx,n=t.cy,a=t.innerRadius,o=t.outerRadius,c=t.cornerRadius,l=t.forceCornerRadius,f=t.cornerIsExternal,h=t.startAngle,p=t.endAngle,g=t.className;if(o0&&Math.abs(h-p)<360?k=NF({cx:r,cy:n,innerRadius:a,outerRadius:o,cornerRadius:Math.min(j,b/2),forceCornerRadius:l,cornerIsExternal:f,startAngle:h,endAngle:p}):k=VA({cx:r,cy:n,innerRadius:a,outerRadius:o,startAngle:h,endAngle:p}),v.createElement("path",Wv({},en(t),{className:x,d:k}))};function PF(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(PE(t)){if(e==="centric"){var n=t.cx,a=t.cy,o=t.innerRadius,c=t.outerRadius,l=t.angle,f=Qt(n,a,o,l),h=Qt(n,a,c,l);return[{x:f.x,y:f.y},{x:h.x,y:h.y}]}return GA(t)}}function CF(e){return UE(e)?NaN:Number(e)}function yg(e){return e?(e=CF(e),e===1/0||e===-1/0?(e<0?-1:1)*Number.MAX_VALUE:e===e?e:0):e===0?e:0}function qA(e,t,r){r&&typeof r!="number"&&jv(e,t,r)&&(t=r=void 0),e=yg(e),t===void 0?(t=e,e=0):t=yg(t),r=r===void 0?ee.chartData,Ky=K([jn],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),Rh=(e,t,r,n)=>n?Ky(e):jn(e),OF=(e,t,r)=>r?Ky(e):jn(e),_F=K([Rh],e=>{var t=e.chartData,r=e.dataStartIndex,n=e.dataEndIndex;return t!=null?t.slice(r,n+1):[]});K([Ky],e=>{var t=e.chartData,r=e.dataStartIndex,n=e.dataEndIndex;return t!=null?t.slice(r,n+1):[]});var MF=K([jn],e=>{var t=e.chartData,r=e.dataStartIndex,n=e.dataEndIndex;return t!=null?t.slice(r,n+1):[]});function Gy(e,t){return RF(e)||DF(e,t)||TF(e,t)||IF()}function IF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function TF(e,t){if(e){if(typeof e=="string")return gj(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?gj(e,t):void 0}}function gj(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);re.e^o.s<0?1:-1;for(n=o.d.length,a=e.d.length,t=0,r=ne.d[t]^o.s<0?1:-1;return n===a?0:n>a^o.s<0?1:-1};ke.decimalPlaces=ke.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*lt;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};ke.dividedBy=ke.div=function(e){return gi(this,new this.constructor(e))};ke.dividedToIntegerBy=ke.idiv=function(e){var t=this,r=t.constructor;return et(gi(t,new r(e),0,1),r.precision)};ke.equals=ke.eq=function(e){return!this.cmp(e)};ke.exponent=function(){return Nt(this)};ke.greaterThan=ke.gt=function(e){return this.cmp(e)>0};ke.greaterThanOrEqualTo=ke.gte=function(e){return this.cmp(e)>=0};ke.isInteger=ke.isint=function(){return this.e>this.d.length-2};ke.isNegative=ke.isneg=function(){return this.s<0};ke.isPositive=ke.ispos=function(){return this.s>0};ke.isZero=function(){return this.s===0};ke.lessThan=ke.lt=function(e){return this.cmp(e)<0};ke.lessThanOrEqualTo=ke.lte=function(e){return this.cmp(e)<1};ke.logarithm=ke.log=function(e){var t,r=this,n=r.constructor,a=n.precision,o=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(Dr))throw Error(rn+"NaN");if(r.s<1)throw Error(rn+(r.s?"NaN":"-Infinity"));return r.eq(Dr)?new n(0):(ct=!1,t=gi(Tu(r,o),Tu(e,o),o),ct=!0,et(t,a))};ke.minus=ke.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?JA(t,e):XA(t,(e.s=-e.s,e))};ke.modulo=ke.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(rn+"NaN");return r.s?(ct=!1,t=gi(r,e,0,1).times(e),ct=!0,r.minus(t)):et(new n(r),a)};ke.naturalExponential=ke.exp=function(){return ZA(this)};ke.naturalLogarithm=ke.ln=function(){return Tu(this)};ke.negated=ke.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};ke.plus=ke.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?XA(t,e):JA(t,(e.s=-e.s,e))};ke.precision=ke.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(fo+e);if(t=Nt(a)+1,n=a.d.length-1,r=n*lt+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};ke.squareRoot=ke.sqrt=function(){var e,t,r,n,a,o,c,l=this,f=l.constructor;if(l.s<1){if(!l.s)return new f(0);throw Error(rn+"NaN")}for(e=Nt(l),ct=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=Ln(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Zs((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new f(t)):n=new f(a.toString()),r=f.precision,a=c=r+3;;)if(o=n,n=o.plus(gi(l,o,c+2)).times(.5),Ln(o.d).slice(0,c)===(t=Ln(n.d)).slice(0,c)){if(t=t.slice(c-3,c+1),a==c&&t=="4999"){if(et(o,r+1,0),o.times(o).eq(l)){n=o;break}}else if(t!="9999")break;c+=4}return ct=!0,et(n,r)};ke.times=ke.mul=function(e){var t,r,n,a,o,c,l,f,h,p=this,g=p.constructor,x=p.d,b=(e=new g(e)).d;if(!p.s||!e.s)return new g(0);for(e.s*=p.s,r=p.e+e.e,f=x.length,h=b.length,f=0;){for(t=0,a=f+n;a>n;)l=o[a]+b[n]*x[a-n-1]+t,o[a--]=l%Lt|0,t=l/Lt|0;o[a]=(o[a]+t)%Lt|0}for(;!o[--c];)o.pop();return t?++r:o.shift(),e.d=o,e.e=r,ct?et(e,g.precision):e};ke.toDecimalPlaces=ke.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(Kn(e,0,Xs),t===void 0?t=n.rounding:Kn(t,0,8),et(r,e+Nt(r)+1,t))};ke.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=bo(n,!0):(Kn(e,0,Xs),t===void 0?t=a.rounding:Kn(t,0,8),n=et(new a(n),e+1,t),r=bo(n,!0,e+1)),r};ke.toFixed=function(e,t){var r,n,a=this,o=a.constructor;return e===void 0?bo(a):(Kn(e,0,Xs),t===void 0?t=o.rounding:Kn(t,0,8),n=et(new o(a),e+Nt(a)+1,t),r=bo(n.abs(),!1,e+Nt(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};ke.toInteger=ke.toint=function(){var e=this,t=e.constructor;return et(new t(e),Nt(e)+1,t.rounding)};ke.toNumber=function(){return+this};ke.toPower=ke.pow=function(e){var t,r,n,a,o,c,l=this,f=l.constructor,h=12,p=+(e=new f(e));if(!e.s)return new f(Dr);if(l=new f(l),!l.s){if(e.s<1)throw Error(rn+"Infinity");return l}if(l.eq(Dr))return l;if(n=f.precision,e.eq(Dr))return et(l,n);if(t=e.e,r=e.d.length-1,c=t>=r,o=l.s,c){if((r=p<0?-p:p)<=YA){for(a=new f(Dr),t=Math.ceil(n/lt+4),ct=!1;r%2&&(a=a.times(l),xj(a.d,t)),r=Zs(r/2),r!==0;)l=l.times(l),xj(l.d,t);return ct=!0,e.s<0?new f(Dr).div(a):et(a,n)}}else if(o<0)throw Error(rn+"NaN");return o=o<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,ct=!1,a=e.times(Tu(l,n+h)),ct=!0,a=ZA(a),a.s=o,a};ke.toPrecision=function(e,t){var r,n,a=this,o=a.constructor;return e===void 0?(r=Nt(a),n=bo(a,r<=o.toExpNeg||r>=o.toExpPos)):(Kn(e,1,Xs),t===void 0?t=o.rounding:Kn(t,0,8),a=et(new o(a),e,t),r=Nt(a),n=bo(a,e<=r||r<=o.toExpNeg,e)),n};ke.toSignificantDigits=ke.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(Kn(e,1,Xs),t===void 0?t=n.rounding:Kn(t,0,8)),et(new n(r),e,t)};ke.toString=ke.valueOf=ke.val=ke.toJSON=ke[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Nt(e),r=e.constructor;return bo(e,t<=r.toExpNeg||t>=r.toExpPos)};function XA(e,t){var r,n,a,o,c,l,f,h,p=e.constructor,g=p.precision;if(!e.s||!t.s)return t.s||(t=new p(e)),ct?et(t,g):t;if(f=e.d,h=t.d,c=e.e,a=t.e,f=f.slice(),o=c-a,o){for(o<0?(n=f,o=-o,l=h.length):(n=h,a=c,l=f.length),c=Math.ceil(g/lt),l=c>l?c+1:l+1,o>l&&(o=l,n.length=1),n.reverse();o--;)n.push(0);n.reverse()}for(l=f.length,o=h.length,l-o<0&&(o=l,n=h,h=f,f=n),r=0;o;)r=(f[--o]=f[o]+h[o]+r)/Lt|0,f[o]%=Lt;for(r&&(f.unshift(r),++a),l=f.length;f[--l]==0;)f.pop();return t.d=f,t.e=a,ct?et(t,g):t}function Kn(e,t,r){if(e!==~~e||er)throw Error(fo+e)}function Ln(e){var t,r,n,a=e.length-1,o="",c=e[0];if(a>0){for(o+=c,t=1;tc?1:-1;else for(l=f=0;la[l]?1:-1;break}return f}function r(n,a,o){for(var c=0;o--;)n[o]-=c,c=n[o]1;)n.shift()}return function(n,a,o,c){var l,f,h,p,g,x,b,j,k,S,N,E,O,P,_,C,I,B,U=n.constructor,G=n.s==a.s?1:-1,X=n.d,$=a.d;if(!n.s)return new U(n);if(!a.s)throw Error(rn+"Division by zero");for(f=n.e-a.e,I=$.length,_=X.length,b=new U(G),j=b.d=[],h=0;$[h]==(X[h]||0);)++h;if($[h]>(X[h]||0)&&--f,o==null?E=o=U.precision:c?E=o+(Nt(n)-Nt(a))+1:E=o,E<0)return new U(0);if(E=E/lt+2|0,h=0,I==1)for(p=0,$=$[0],E++;(h<_||p)&&E--;h++)O=p*Lt+(X[h]||0),j[h]=O/$|0,p=O%$|0;else{for(p=Lt/($[0]+1)|0,p>1&&($=e($,p),X=e(X,p),I=$.length,_=X.length),P=I,k=X.slice(0,I),S=k.length;S=Lt/2&&++C;do p=0,l=t($,k,I,S),l<0?(N=k[0],I!=S&&(N=N*Lt+(k[1]||0)),p=N/C|0,p>1?(p>=Lt&&(p=Lt-1),g=e($,p),x=g.length,S=k.length,l=t(g,k,x,S),l==1&&(p--,r(g,I16)throw Error(Vy+Nt(e));if(!e.s)return new p(Dr);for(ct=!1,l=g,c=new p(.03125);e.abs().gte(.1);)e=e.times(c),h+=5;for(n=Math.log(Va(2,h))/Math.LN10*2+5|0,l+=n,r=a=o=new p(Dr),p.precision=l;;){if(a=et(a.times(e),l),r=r.times(++f),c=o.plus(gi(a,r,l)),Ln(c.d).slice(0,l)===Ln(o.d).slice(0,l)){for(;h--;)o=et(o.times(o),l);return p.precision=g,t==null?(ct=!0,et(o,g)):o}o=c}}function Nt(e){for(var t=e.e*lt,r=e.d[0];r>=10;r/=10)t++;return t}function xg(e,t,r){if(t>e.LN10.sd())throw ct=!0,r&&(e.precision=r),Error(rn+"LN10 precision limit exceeded");return et(new e(e.LN10),t)}function ia(e){for(var t="";e--;)t+="0";return t}function Tu(e,t){var r,n,a,o,c,l,f,h,p,g=1,x=10,b=e,j=b.d,k=b.constructor,S=k.precision;if(b.s<1)throw Error(rn+(b.s?"NaN":"-Infinity"));if(b.eq(Dr))return new k(0);if(t==null?(ct=!1,h=S):h=t,b.eq(10))return t==null&&(ct=!0),xg(k,h);if(h+=x,k.precision=h,r=Ln(j),n=r.charAt(0),o=Nt(b),Math.abs(o)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)b=b.times(e),r=Ln(b.d),n=r.charAt(0),g++;o=Nt(b),n>1?(b=new k("0."+r),o++):b=new k(n+"."+r.slice(1))}else return f=xg(k,h+2,S).times(o+""),b=Tu(new k(n+"."+r.slice(1)),h-x).plus(f),k.precision=S,t==null?(ct=!0,et(b,S)):b;for(l=c=b=gi(b.minus(Dr),b.plus(Dr),h),p=et(b.times(b),h),a=3;;){if(c=et(c.times(p),h),f=l.plus(gi(c,new k(a),h)),Ln(f.d).slice(0,h)===Ln(l.d).slice(0,h))return l=l.times(2),o!==0&&(l=l.plus(xg(k,h+2,S).times(o+""))),l=gi(l,new k(g),h),k.precision=S,t==null?(ct=!0,et(l,S)):l;l=f,a+=2}}function yj(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=Zs(r/lt),e.d=[],n=(r+1)%lt,r<0&&(n+=lt),nIf||e.e<-If))throw Error(Vy+r)}else e.s=0,e.e=0,e.d=[0];return e}function et(e,t,r){var n,a,o,c,l,f,h,p,g=e.d;for(c=1,o=g[0];o>=10;o/=10)c++;if(n=t-c,n<0)n+=lt,a=t,h=g[p=0];else{if(p=Math.ceil((n+1)/lt),o=g.length,p>=o)return e;for(h=o=g[p],c=1;o>=10;o/=10)c++;n%=lt,a=n-lt+c}if(r!==void 0&&(o=Va(10,c-a-1),l=h/o%10|0,f=t<0||g[p+1]!==void 0||h%o,f=r<4?(l||f)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||f||r==6&&(n>0?a>0?h/Va(10,c-a):0:g[p-1])%10&1||r==(e.s<0?8:7))),t<1||!g[0])return f?(o=Nt(e),g.length=1,t=t-o-1,g[0]=Va(10,(lt-t%lt)%lt),e.e=Zs(-t/lt)||0):(g.length=1,g[0]=e.e=e.s=0),e;if(n==0?(g.length=p,o=1,p--):(g.length=p+1,o=Va(10,lt-n),g[p]=a>0?(h/Va(10,c-a)%Va(10,a)|0)*o:0),f)for(;;)if(p==0){(g[0]+=o)==Lt&&(g[0]=1,++e.e);break}else{if(g[p]+=o,g[p]!=Lt)break;g[p--]=0,o=1}for(n=g.length;g[--n]===0;)g.pop();if(ct&&(e.e>If||e.e<-If))throw Error(Vy+Nt(e));return e}function JA(e,t){var r,n,a,o,c,l,f,h,p,g,x=e.constructor,b=x.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new x(e),ct?et(t,b):t;if(f=e.d,g=t.d,n=t.e,h=e.e,f=f.slice(),c=h-n,c){for(p=c<0,p?(r=f,c=-c,l=g.length):(r=g,n=h,l=f.length),a=Math.max(Math.ceil(b/lt),l)+2,c>a&&(c=a,r.length=1),r.reverse(),a=c;a--;)r.push(0);r.reverse()}else{for(a=f.length,l=g.length,p=a0;--a)f[l++]=0;for(a=g.length;a>c;){if(f[--a]0?o=o.charAt(0)+"."+o.slice(1)+ia(n):c>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+ia(-a-1)+o,r&&(n=r-c)>0&&(o+=ia(n))):a>=c?(o+=ia(a+1-c),r&&(n=r-a-1)>0&&(o=o+"."+ia(n))):((n=a+1)0&&(a+1===c&&(o+="."),o+=ia(n))),e.s<0?"-"+o:o}function xj(e,t){if(e.length>t)return e.length=t,!0}function eP(e){var t,r,n;function a(o){var c=this;if(!(c instanceof a))return new a(o);if(c.constructor=a,o instanceof a){c.s=o.s,c.e=o.e,c.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(fo+o);if(o>0)c.s=1;else if(o<0)o=-o,c.s=-1;else{c.s=0,c.e=0,c.d=[0];return}if(o===~~o&&o<1e7){c.e=0,c.d=[o];return}return yj(c,o.toString())}else if(typeof o!="string")throw Error(fo+o);if(o.charCodeAt(0)===45?(o=o.slice(1),c.s=-1):c.s=1,zF.test(o))yj(c,o);else throw Error(fo+o)}if(a.prototype=ke,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=eP,a.config=a.set=FF,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(fo+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(fo+r+": "+n);return this}var qy=eP(LF);Dr=new qy(1);const Ge=qy;function tP(e){var t;return e===0?t=1:t=Math.floor(new Ge(e).abs().log(10).toNumber())+1,t}function rP(e,t,r){for(var n=new Ge(e),a=0,o=[];n.lt(t)&&a<1e5;)o.push(n.toNumber()),n=n.add(r),a++;return o}function Du(e,t){return HF(e)||WF(e,t)||UF(e,t)||BF()}function BF(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function UF(e,t){if(e){if(typeof e=="string")return bj(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?bj(e,t):void 0}}function bj(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{var t=Du(e,2),r=t[0],n=t[1],a=r,o=n;return r>n&&(a=n,o=r),[a,o]},Qy=(e,t,r)=>{if(e.lte(0))return new Ge(0);var n=tP(e.toNumber()),a=new Ge(10).pow(n),o=e.div(a),c=n!==1?.05:.1,l=new Ge(Math.ceil(o.div(c).toNumber())).add(r).mul(c),f=l.mul(a);return t?new Ge(f.toNumber()):new Ge(Math.ceil(f.toNumber()))},iP=(e,t,r)=>{var n;if(e.lte(0))return new Ge(0);var a=[1,2,2.5,5],o=e.toNumber(),c=Math.floor(new Ge(o).abs().log(10).toNumber()),l=new Ge(10).pow(c),f=e.div(l).toNumber(),h=a.findIndex(b=>b>=f-1e-10);if(h===-1&&(l=l.mul(10),h=0),h+=r,h>=a.length){var p=Math.floor(h/a.length);h%=a.length,l=l.mul(new Ge(10).pow(p))}var g=(n=a[h])!==null&&n!==void 0?n:1,x=new Ge(g).mul(l);return t?x:new Ge(Math.ceil(x.toNumber()))},KF=(e,t,r)=>{var n=new Ge(1),a=new Ge(e);if(!a.isint()&&r){var o=Math.abs(e);o<1?(n=new Ge(10).pow(tP(e)-1),a=new Ge(Math.floor(a.div(n).toNumber())).mul(n)):o>1&&(a=new Ge(Math.floor(e)))}else e===0?a=new Ge(Math.floor((t-1)/2)):r||(a=new Ge(Math.floor(e)));for(var c=Math.floor((t-1)/2),l=[],f=0;f4&&arguments[4]!==void 0?arguments[4]:0,c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:Qy;if(!Number.isFinite((r-t)/(n-1)))return{step:new Ge(0),tickMin:new Ge(0),tickMax:new Ge(0)};var l=c(new Ge(r).sub(t).div(n-1),a,o),f;t<=0&&r>=0?f=new Ge(0):(f=new Ge(t).add(r).div(2),f=f.sub(new Ge(f).mod(l)));var h=Math.ceil(f.sub(t).div(l).toNumber()),p=Math.ceil(new Ge(r).sub(f).div(l).toNumber()),g=h+p+1;return g>n?aP(t,r,n,a,o+1,c):(g0?p+(n-g):p,h=r>0?h:h+(n-g)),{step:l,tickMin:f.sub(new Ge(h).mul(l)),tickMax:f.add(new Ge(p).mul(l))})},wj=function(t){var r=Du(t,2),n=r[0],a=r[1],o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",f=Math.max(o,2),h=nP([n,a]),p=Du(h,2),g=p[0],x=p[1];if(g===-1/0||x===1/0){var b=x===1/0?[g,...Array(o-1).fill(1/0)]:[...Array(o-1).fill(-1/0),x];return n>a?b.reverse():b}if(g===x)return KF(g,o,c);var j=l==="snap125"?iP:Qy,k=aP(g,x,f,c,0,j),S=k.step,N=k.tickMin,E=k.tickMax,O=rP(N,E.add(new Ge(.1).mul(S)),S);return n>a?O.reverse():O},kj=function(t,r){var n=Du(t,2),a=n[0],o=n[1],c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",f=nP([a,o]),h=Du(f,2),p=h[0],g=h[1];if(p===-1/0||g===1/0)return[a,o];if(p===g)return[p];var x=l==="snap125"?iP:Qy,b=Math.max(r,2),j=x(new Ge(g).sub(p).div(b-1),c,0),k=[...rP(new Ge(p),new Ge(g),j),g];return c===!1&&(k=k.map(S=>Math.round(S))),a>o?k.reverse():k},GF=e=>e.rootProps.barCategoryGap,$h=e=>e.rootProps.stackOffset,oP=e=>e.rootProps.reverseStackOrder,Yy=e=>e.options.chartName,Xy=e=>e.rootProps.syncId,sP=e=>e.rootProps.syncMethod,Zy=e=>e.options.eventEmitter,VF=e=>e.rootProps.baseValue,hr={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},za={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},_n={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},Lh=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function zh(e,t,r){if(r!=="auto")return r;if(e!=null)return Vn(e,t)?"category":"number"}function jj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Tf(e){for(var t=1;t{if(t!=null)return e.polarAxis.angleAxis[t]},Jy=K([XF,_A],(e,t)=>{var r;if(e!=null)return e;var n=(r=zh(t,"angleAxis",Sj.type))!==null&&r!==void 0?r:"category";return Tf(Tf({},Sj),{},{type:n})}),ZF=(e,t)=>e.polarAxis.radiusAxis[t],e0=K([ZF,_A],(e,t)=>{var r;if(e!=null)return e;var n=(r=zh(t,"radiusAxis",Nj.type))!==null&&r!==void 0?r:"category";return Tf(Tf({},Nj),{},{type:n})}),Fh=e=>e.polarOptions,t0=K([ji,Si,Zt],yF),lP=K([Fh,t0],(e,t)=>{if(e!=null)return wa(e.innerRadius,t,0)}),uP=K([Fh,t0],(e,t)=>{if(e!=null)return wa(e.outerRadius,t,t*.8)}),JF=e=>{if(e==null)return[0,0];var t=e.startAngle,r=e.endAngle;return[t,r]},cP=K([Fh],JF);K([Jy,cP],Lh);var dP=K([t0,lP,uP],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});K([e0,dP],Lh);var fP=K([dt,Fh,lP,uP,ji,Si],(e,t,r,n,a,o)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var c=t.cx,l=t.cy,f=t.startAngle,h=t.endAngle;return{cx:wa(c,a,a/2),cy:wa(l,o,o/2),innerRadius:r,outerRadius:n,startAngle:f,endAngle:h,clockWise:!1}}}),Ft=(e,t)=>t,Bh=(e,t,r)=>r;function r0(e){return e==null?void 0:e.id}function hP(e,t,r){var n=t.chartData,a=n===void 0?[]:n,o=r.allowDuplicatedCategory,c=r.dataKey,l=new Map;return e.forEach(f=>{var h,p=(h=f.data)!==null&&h!==void 0?h:a;if(!(p==null||p.length===0)){var g=r0(f);p.forEach((x,b)=>{var j=c==null||o?b:String(zt(x,c,null)),k=zt(x,f.dataKey,0),S;l.has(j)?S=l.get(j):S={},Object.assign(S,{[g]:k}),l.set(j,S)})}}),Array.from(l.values())}function n0(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var Uh=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function Wh(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function e8(e,t){if(e.length===t.length){for(var r=0;r{var t=dt(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Js=e=>e.tooltip.settings.axisId;function i0(e){if(e!=null){var t=e.ticks,r=e.bandwidth,n=e.range(),a=[Math.min(...n),Math.max(...n)];return{domain:()=>e.domain(),range:(function(o){function c(){return o.apply(this,arguments)}return c.toString=function(){return o.toString()},c})(()=>a),rangeMin:()=>a[0],rangeMax:()=>a[1],isInRange(o){var c=a[0],l=a[1];return c<=l?o>=c&&o<=l:o>=l&&o<=c},bandwidth:r?()=>r.call(e):void 0,ticks:t?o=>t.call(e,o):void 0,map:(o,c)=>{var l=e(o);if(l!=null){if(e.bandwidth&&c!==null&&c!==void 0&&c.position){var f=e.bandwidth();switch(c.position){case"middle":l+=f/2;break;case"end":l+=f;break}}return l}}}}}var t8=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Fn(t)){for(var r,n,a=0;an)&&(n=o))}return r!==void 0&&n!==void 0?[r,n]:void 0}return t}default:return t}};function ya(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function r8(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function a0(e){let t,r,n;e.length!==2?(t=ya,r=(l,f)=>ya(e(l),f),n=(l,f)=>e(l)-f):(t=e===ya||e===r8?e:n8,r=e,n=e);function a(l,f,h=0,p=l.length){if(h>>1;r(l[g],f)<0?h=g+1:p=g}while(h>>1;r(l[g],f)<=0?h=g+1:p=g}while(hh&&n(l[g-1],f)>-n(l[g],f)?g-1:g}return{left:a,center:c,right:o}}function n8(){return 0}function pP(e){return e===null?NaN:+e}function*i8(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const a8=a0(ya),nc=a8.right;a0(pP).center;class Ej extends Map{constructor(t,r=l8){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(Aj(this,t))}has(t){return super.has(Aj(this,t))}set(t,r){return super.set(o8(this,t),r)}delete(t){return super.delete(s8(this,t))}}function Aj({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function o8({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function s8({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function l8(e){return e!==null&&typeof e=="object"?e.valueOf():e}function u8(e=ya){if(e===ya)return mP;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function mP(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const c8=Math.sqrt(50),d8=Math.sqrt(10),f8=Math.sqrt(2);function Df(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),o=n/Math.pow(10,a),c=o>=c8?10:o>=d8?5:o>=f8?2:1;let l,f,h;return a<0?(h=Math.pow(10,-a)/c,l=Math.round(e*h),f=Math.round(t*h),l/ht&&--f,h=-h):(h=Math.pow(10,a)*c,l=Math.round(e/h),f=Math.round(t/h),l*ht&&--f),f0))return[];if(e===t)return[e];const n=t=a))return[];const l=o-a+1,f=new Array(l);if(n)if(c<0)for(let h=0;h=n)&&(r=n);return r}function Cj(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function gP(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?mP:u8(a);n>r;){if(n-r>600){const f=n-r+1,h=t-r+1,p=Math.log(f),g=.5*Math.exp(2*p/3),x=.5*Math.sqrt(p*g*(f-g)/f)*(h-f/2<0?-1:1),b=Math.max(r,Math.floor(t-h*g/f+x)),j=Math.min(n,Math.floor(t+(f-h)*g/f+x));gP(e,t,b,j,a)}const o=e[t];let c=r,l=n;for(iu(e,r,t),a(e[n],o)>0&&iu(e,r,n);c0;)--l}a(e[r],o)===0?iu(e,r,l):(++l,iu(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function iu(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function h8(e,t,r){if(e=Float64Array.from(i8(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Cj(e);if(t>=1)return Pj(e);var n,a=(n-1)*t,o=Math.floor(a),c=Pj(gP(e,o).subarray(0,o+1)),l=Cj(e.subarray(o+1));return c+(l-c)*(a-o)}}function p8(e,t,r=pP){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,o=Math.floor(a),c=+r(e[o],o,e),l=+r(e[o+1],o+1,e);return c+(l-c)*(a-o)}}function m8(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(a);++n>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Fd(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Fd(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=y8.exec(e))?new Er(t[1],t[2],t[3],1):(t=x8.exec(e))?new Er(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=b8.exec(e))?Fd(t[1],t[2],t[3],t[4]):(t=w8.exec(e))?Fd(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=k8.exec(e))?Rj(t[1],t[2]/100,t[3]/100,1):(t=j8.exec(e))?Rj(t[1],t[2]/100,t[3]/100,t[4]):Oj.hasOwnProperty(e)?Ij(Oj[e]):e==="transparent"?new Er(NaN,NaN,NaN,0):null}function Ij(e){return new Er(e>>16&255,e>>8&255,e&255,1)}function Fd(e,t,r,n){return n<=0&&(e=t=r=NaN),new Er(e,t,r,n)}function E8(e){return e instanceof ic||(e=Lu(e)),e?(e=e.rgb(),new Er(e.r,e.g,e.b,e.opacity)):new Er}function qv(e,t,r,n){return arguments.length===1?E8(e):new Er(e,t,r,n??1)}function Er(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}l0(Er,qv,yP(ic,{brighter(e){return e=e==null?Rf:Math.pow(Rf,e),new Er(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ru:Math.pow(Ru,e),new Er(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Er(ho(this.r),ho(this.g),ho(this.b),$f(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Tj,formatHex:Tj,formatHex8:A8,formatRgb:Dj,toString:Dj}));function Tj(){return`#${Xa(this.r)}${Xa(this.g)}${Xa(this.b)}`}function A8(){return`#${Xa(this.r)}${Xa(this.g)}${Xa(this.b)}${Xa((isNaN(this.opacity)?1:this.opacity)*255)}`}function Dj(){const e=$f(this.opacity);return`${e===1?"rgb(":"rgba("}${ho(this.r)}, ${ho(this.g)}, ${ho(this.b)}${e===1?")":`, ${e})`}`}function $f(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ho(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xa(e){return e=ho(e),(e<16?"0":"")+e.toString(16)}function Rj(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new xn(e,t,r,n)}function xP(e){if(e instanceof xn)return new xn(e.h,e.s,e.l,e.opacity);if(e instanceof ic||(e=Lu(e)),!e)return new xn;if(e instanceof xn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),o=Math.max(t,r,n),c=NaN,l=o-a,f=(o+a)/2;return l?(t===o?c=(r-n)/l+(r0&&f<1?0:c,new xn(c,l,f,e.opacity)}function P8(e,t,r,n){return arguments.length===1?xP(e):new xn(e,t,r,n??1)}function xn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}l0(xn,P8,yP(ic,{brighter(e){return e=e==null?Rf:Math.pow(Rf,e),new xn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ru:Math.pow(Ru,e),new xn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new Er(bg(e>=240?e-240:e+120,a,n),bg(e,a,n),bg(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new xn($j(this.h),Bd(this.s),Bd(this.l),$f(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=$f(this.opacity);return`${e===1?"hsl(":"hsla("}${$j(this.h)}, ${Bd(this.s)*100}%, ${Bd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function $j(e){return e=(e||0)%360,e<0?e+360:e}function Bd(e){return Math.max(0,Math.min(1,e||0))}function bg(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const u0=e=>()=>e;function C8(e,t){return function(r){return e+r*t}}function O8(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function _8(e){return(e=+e)==1?bP:function(t,r){return r-t?O8(t,r,e):u0(isNaN(t)?r:t)}}function bP(e,t){var r=t-e;return r?C8(e,r):u0(isNaN(e)?t:e)}const Lj=(function e(t){var r=_8(t);function n(a,o){var c=r((a=qv(a)).r,(o=qv(o)).r),l=r(a.g,o.g),f=r(a.b,o.b),h=bP(a.opacity,o.opacity);return function(p){return a.r=c(p),a.g=l(p),a.b=f(p),a.opacity=h(p),a+""}}return n.gamma=e,n})(1);function M8(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(o){for(a=0;ar&&(o=t.slice(r,o),l[c]?l[c]+=o:l[++c]=o),(n=n[0])===(a=a[0])?l[c]?l[c]+=a:l[++c]=a:(l[++c]=null,f.push({i:c,x:Lf(n,a)})),r=wg.lastIndex;return rt&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function W8(e,t,r){var n=e[0],a=e[1],o=t[0],c=t[1];return a2?H8:W8,f=h=null,g}function g(x){return x==null||isNaN(x=+x)?o:(f||(f=l(e.map(n),t,r)))(n(c(x)))}return g.invert=function(x){return c(a((h||(h=l(t,e.map(n),Lf)))(x)))},g.domain=function(x){return arguments.length?(e=Array.from(x,zf),p()):e.slice()},g.range=function(x){return arguments.length?(t=Array.from(x),p()):t.slice()},g.rangeRound=function(x){return t=Array.from(x),r=c0,p()},g.clamp=function(x){return arguments.length?(c=x?!0:pr,p()):c!==pr},g.interpolate=function(x){return arguments.length?(r=x,p()):r},g.unknown=function(x){return arguments.length?(o=x,g):o},function(x,b){return n=x,a=b,p()}}function d0(){return Hh()(pr,pr)}function K8(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Ff(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function Bs(e){return e=Ff(Math.abs(e)),e?e[1]:NaN}function G8(e,t){return function(r,n){for(var a=r.length,o=[],c=0,l=e[0],f=0;a>0&&l>0&&(f+l+1>n&&(l=Math.max(1,n-f)),o.push(r.substring(a-=l,a+l)),!((f+=l+1)>n));)l=e[c=(c+1)%e.length];return o.reverse().join(t)}}function V8(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var q8=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zu(e){if(!(t=q8.exec(e)))throw new Error("invalid format: "+e);var t;return new f0({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}zu.prototype=f0.prototype;function f0(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}f0.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Q8(e){e:for(var t=e.length,r=1,n=-1,a;r0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var Bf;function Y8(e,t){var r=Ff(e,t);if(!r)return Bf=void 0,e.toPrecision(t);var n=r[0],a=r[1],o=a-(Bf=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,c=n.length;return o===c?n:o>c?n+new Array(o-c+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+Ff(e,Math.max(0,t+o-1))[0]}function Fj(e,t){var r=Ff(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const Bj={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:K8,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Fj(e*100,t),r:Fj,s:Y8,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Uj(e){return e}var Wj=Array.prototype.map,Hj=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function X8(e){var t=e.grouping===void 0||e.thousands===void 0?Uj:G8(Wj.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?Uj:V8(Wj.call(e.numerals,String)),c=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",f=e.nan===void 0?"NaN":e.nan+"";function h(g,x){g=zu(g);var b=g.fill,j=g.align,k=g.sign,S=g.symbol,N=g.zero,E=g.width,O=g.comma,P=g.precision,_=g.trim,C=g.type;C==="n"?(O=!0,C="g"):Bj[C]||(P===void 0&&(P=12),_=!0,C="g"),(N||b==="0"&&j==="=")&&(N=!0,b="0",j="=");var I=(x&&x.prefix!==void 0?x.prefix:"")+(S==="$"?r:S==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():""),B=(S==="$"?n:/[%p]/.test(C)?c:"")+(x&&x.suffix!==void 0?x.suffix:""),U=Bj[C],G=/[defgprs%]/.test(C);P=P===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,P)):Math.max(0,Math.min(20,P));function X($){var fe=I,J=B,pe,be,de;if(C==="c")J=U($)+J,$="";else{$=+$;var Y=$<0||1/$<0;if($=isNaN($)?f:U(Math.abs($),P),_&&($=Q8($)),Y&&+$==0&&k!=="+"&&(Y=!1),fe=(Y?k==="("?k:l:k==="-"||k==="("?"":k)+fe,J=(C==="s"&&!isNaN($)&&Bf!==void 0?Hj[8+Bf/3]:"")+J+(Y&&k==="("?")":""),G){for(pe=-1,be=$.length;++pede||de>57){J=(de===46?a+$.slice(pe+1):$.slice(pe))+J,$=$.slice(0,pe);break}}}O&&!N&&($=t($,1/0));var V=fe.length+$.length+J.length,Q=V>1)+fe+$+J+Q.slice(V);break;default:$=Q+fe+$+J;break}return o($)}return X.toString=function(){return g+""},X}function p(g,x){var b=Math.max(-8,Math.min(8,Math.floor(Bs(x)/3)))*3,j=Math.pow(10,-b),k=h((g=zu(g),g.type="f",g),{suffix:Hj[8+b/3]});return function(S){return k(j*S)}}return{format:h,formatPrefix:p}}var Ud,h0,wP;Z8({thousands:",",grouping:[3],currency:["$",""]});function Z8(e){return Ud=X8(e),h0=Ud.format,wP=Ud.formatPrefix,Ud}function J8(e){return Math.max(0,-Bs(Math.abs(e)))}function eB(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Bs(t)/3)))*3-Bs(Math.abs(e)))}function tB(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Bs(t)-Bs(e))+1}function kP(e,t,r,n){var a=Gv(e,t,r),o;switch(n=zu(n??",f"),n.type){case"s":{var c=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=eB(a,c))&&(n.precision=o),wP(n,c)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=tB(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=J8(a))&&(n.precision=o-(n.type==="%")*2);break}}return h0(n)}function ka(e){var t=e.domain;return e.ticks=function(r){var n=t();return Hv(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return kP(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,o=n.length-1,c=n[a],l=n[o],f,h,p=10;for(l0;){if(h=Kv(c,l,r),h===f)return n[a]=c,n[o]=l,t(n);if(h>0)c=Math.floor(c/h)*h,l=Math.ceil(l/h)*h;else if(h<0)c=Math.ceil(c*h)/h,l=Math.floor(l*h)/h;else break;f=h}return e},e}function jP(){var e=d0();return e.copy=function(){return ac(e,jP())},an.apply(e,arguments),ka(e)}function SP(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,zf),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return SP(e).unknown(t)},e=arguments.length?Array.from(e,zf):[0,1],ka(r)}function NP(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],o=e[n],c;return oMath.pow(e,t)}function oB(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Vj(e){return(t,r)=>-e(-t,r)}function p0(e){const t=e(Kj,Gj),r=t.domain;let n=10,a,o;function c(){return a=oB(n),o=aB(n),r()[0]<0?(a=Vj(a),o=Vj(o),e(rB,nB)):e(Kj,Gj),t}return t.base=function(l){return arguments.length?(n=+l,c()):n},t.domain=function(l){return arguments.length?(r(l),c()):r()},t.ticks=l=>{const f=r();let h=f[0],p=f[f.length-1];const g=p0){for(;x<=b;++x)for(j=1;jp)break;N.push(k)}}else for(;x<=b;++x)for(j=n-1;j>=1;--j)if(k=x>0?j/o(-x):j*o(x),!(kp)break;N.push(k)}N.length*2{if(l==null&&(l=10),f==null&&(f=n===10?"s":","),typeof f!="function"&&(!(n%1)&&(f=zu(f)).precision==null&&(f.trim=!0),f=h0(f)),l===1/0)return f;const h=Math.max(1,n*l/t.ticks().length);return p=>{let g=p/o(Math.round(a(p)));return g*nr(NP(r(),{floor:l=>o(Math.floor(a(l))),ceil:l=>o(Math.ceil(a(l)))})),t}function EP(){const e=p0(Hh()).domain([1,10]);return e.copy=()=>ac(e,EP()).base(e.base()),an.apply(e,arguments),e}function qj(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Qj(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function m0(e){var t=1,r=e(qj(t),Qj(t));return r.constant=function(n){return arguments.length?e(qj(t=+n),Qj(t)):t},ka(r)}function AP(){var e=m0(Hh());return e.copy=function(){return ac(e,AP()).constant(e.constant())},an.apply(e,arguments)}function Yj(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function sB(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function lB(e){return e<0?-e*e:e*e}function g0(e){var t=e(pr,pr),r=1;function n(){return r===1?e(pr,pr):r===.5?e(sB,lB):e(Yj(r),Yj(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},ka(t)}function v0(){var e=g0(Hh());return e.copy=function(){return ac(e,v0()).exponent(e.exponent())},an.apply(e,arguments),e}function uB(){return v0.apply(null,arguments).exponent(.5)}function Xj(e){return Math.sign(e)*e*e}function cB(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function PP(){var e=d0(),t=[0,1],r=!1,n;function a(o){var c=cB(e(o));return isNaN(c)?n:r?Math.round(c):c}return a.invert=function(o){return e.invert(Xj(o))},a.domain=function(o){return arguments.length?(e.domain(o),a):e.domain()},a.range=function(o){return arguments.length?(e.range((t=Array.from(o,zf)).map(Xj)),a):t.slice()},a.rangeRound=function(o){return a.range(o).round(!0)},a.round=function(o){return arguments.length?(r=!!o,a):r},a.clamp=function(o){return arguments.length?(e.clamp(o),a):e.clamp()},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return PP(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},an.apply(a,arguments),ka(a)}function CP(){var e=[],t=[],r=[],n;function a(){var c=0,l=Math.max(1,t.length);for(r=new Array(l-1);++c0?r[l-1]:e[0],l=r?[n[r-1],t]:[n[h-1],n[h]]},c.unknown=function(f){return arguments.length&&(o=f),c},c.thresholds=function(){return n.slice()},c.copy=function(){return OP().domain([e,t]).range(a).unknown(o)},an.apply(ka(c),arguments)}function _P(){var e=[.5],t=[0,1],r,n=1;function a(o){return o!=null&&o<=o?t[nc(e,o,0,n)]:r}return a.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(o){var c=t.indexOf(o);return[e[c-1],e[c]]},a.unknown=function(o){return arguments.length?(r=o,a):r},a.copy=function(){return _P().domain(e).range(t).unknown(r)},an.apply(a,arguments)}const kg=new Date,jg=new Date;function Mt(e,t,r,n){function a(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return a.floor=o=>(e(o=new Date(+o)),o),a.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),a.round=o=>{const c=a(o),l=a.ceil(o);return o-c(t(o=new Date(+o),c==null?1:Math.floor(c)),o),a.range=(o,c,l)=>{const f=[];if(o=a.ceil(o),l=l==null?1:Math.floor(l),!(o0))return f;let h;do f.push(h=new Date(+o)),t(o,l),e(o);while(hMt(c=>{if(c>=c)for(;e(c),!o(c);)c.setTime(c-1)},(c,l)=>{if(c>=c)if(l<0)for(;++l<=0;)for(;t(c,-1),!o(c););else for(;--l>=0;)for(;t(c,1),!o(c););}),r&&(a.count=(o,c)=>(kg.setTime(+o),jg.setTime(+c),e(kg),e(jg),Math.floor(r(kg,jg))),a.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?a.filter(n?c=>n(c)%o===0:c=>a.count(0,c)%o===0):a)),a}const Uf=Mt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Uf.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Mt(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):Uf);Uf.range;const fi=1e3,Jr=fi*60,hi=Jr*60,bi=hi*24,y0=bi*7,Zj=bi*30,Sg=bi*365,Za=Mt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*fi)},(e,t)=>(t-e)/fi,e=>e.getUTCSeconds());Za.range;const x0=Mt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*fi)},(e,t)=>{e.setTime(+e+t*Jr)},(e,t)=>(t-e)/Jr,e=>e.getMinutes());x0.range;const b0=Mt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Jr)},(e,t)=>(t-e)/Jr,e=>e.getUTCMinutes());b0.range;const w0=Mt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*fi-e.getMinutes()*Jr)},(e,t)=>{e.setTime(+e+t*hi)},(e,t)=>(t-e)/hi,e=>e.getHours());w0.range;const k0=Mt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*hi)},(e,t)=>(t-e)/hi,e=>e.getUTCHours());k0.range;const oc=Mt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Jr)/bi,e=>e.getDate()-1);oc.range;const Kh=Mt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/bi,e=>e.getUTCDate()-1);Kh.range;const MP=Mt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/bi,e=>Math.floor(e/bi));MP.range;function Ao(e){return Mt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*Jr)/y0)}const Gh=Ao(0),Wf=Ao(1),dB=Ao(2),fB=Ao(3),Us=Ao(4),hB=Ao(5),pB=Ao(6);Gh.range;Wf.range;dB.range;fB.range;Us.range;hB.range;pB.range;function Po(e){return Mt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/y0)}const Vh=Po(0),Hf=Po(1),mB=Po(2),gB=Po(3),Ws=Po(4),vB=Po(5),yB=Po(6);Vh.range;Hf.range;mB.range;gB.range;Ws.range;vB.range;yB.range;const j0=Mt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());j0.range;const S0=Mt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());S0.range;const wi=Mt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());wi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Mt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});wi.range;const ki=Mt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ki.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Mt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});ki.range;function IP(e,t,r,n,a,o){const c=[[Za,1,fi],[Za,5,5*fi],[Za,15,15*fi],[Za,30,30*fi],[o,1,Jr],[o,5,5*Jr],[o,15,15*Jr],[o,30,30*Jr],[a,1,hi],[a,3,3*hi],[a,6,6*hi],[a,12,12*hi],[n,1,bi],[n,2,2*bi],[r,1,y0],[t,1,Zj],[t,3,3*Zj],[e,1,Sg]];function l(h,p,g){const x=pS).right(c,x);if(b===c.length)return e.every(Gv(h/Sg,p/Sg,g));if(b===0)return Uf.every(Math.max(Gv(h,p,g),1));const[j,k]=c[x/c[b-1][2]53)return null;"w"in ie||(ie.w=1),"Z"in ie?(Be=Eg(au(ie.y,0,1)),_e=Be.getUTCDay(),Be=_e>4||_e===0?Hf.ceil(Be):Hf(Be),Be=Kh.offset(Be,(ie.V-1)*7),ie.y=Be.getUTCFullYear(),ie.m=Be.getUTCMonth(),ie.d=Be.getUTCDate()+(ie.w+6)%7):(Be=Ng(au(ie.y,0,1)),_e=Be.getDay(),Be=_e>4||_e===0?Wf.ceil(Be):Wf(Be),Be=oc.offset(Be,(ie.V-1)*7),ie.y=Be.getFullYear(),ie.m=Be.getMonth(),ie.d=Be.getDate()+(ie.w+6)%7)}else("W"in ie||"U"in ie)&&("w"in ie||(ie.w="u"in ie?ie.u%7:"W"in ie?1:0),_e="Z"in ie?Eg(au(ie.y,0,1)).getUTCDay():Ng(au(ie.y,0,1)).getDay(),ie.m=0,ie.d="W"in ie?(ie.w+6)%7+ie.W*7-(_e+5)%7:ie.w+ie.U*7-(_e+6)%7);return"Z"in ie?(ie.H+=ie.Z/100|0,ie.M+=ie.Z%100,Eg(ie)):Ng(ie)}}function B(te,ve,Oe,ie){for(var Je=0,Be=ve.length,_e=Oe.length,jt,ur;Je=_e)return-1;if(jt=ve.charCodeAt(Je++),jt===37){if(jt=ve.charAt(Je++),ur=_[jt in Jj?ve.charAt(Je++):jt],!ur||(ie=ur(te,Oe,ie))<0)return-1}else if(jt!=Oe.charCodeAt(ie++))return-1}return ie}function U(te,ve,Oe){var ie=h.exec(ve.slice(Oe));return ie?(te.p=p.get(ie[0].toLowerCase()),Oe+ie[0].length):-1}function G(te,ve,Oe){var ie=b.exec(ve.slice(Oe));return ie?(te.w=j.get(ie[0].toLowerCase()),Oe+ie[0].length):-1}function X(te,ve,Oe){var ie=g.exec(ve.slice(Oe));return ie?(te.w=x.get(ie[0].toLowerCase()),Oe+ie[0].length):-1}function $(te,ve,Oe){var ie=N.exec(ve.slice(Oe));return ie?(te.m=E.get(ie[0].toLowerCase()),Oe+ie[0].length):-1}function fe(te,ve,Oe){var ie=k.exec(ve.slice(Oe));return ie?(te.m=S.get(ie[0].toLowerCase()),Oe+ie[0].length):-1}function J(te,ve,Oe){return B(te,t,ve,Oe)}function pe(te,ve,Oe){return B(te,r,ve,Oe)}function be(te,ve,Oe){return B(te,n,ve,Oe)}function de(te){return c[te.getDay()]}function Y(te){return o[te.getDay()]}function V(te){return f[te.getMonth()]}function Q(te){return l[te.getMonth()]}function D(te){return a[+(te.getHours()>=12)]}function T(te){return 1+~~(te.getMonth()/3)}function Z(te){return c[te.getUTCDay()]}function oe(te){return o[te.getUTCDay()]}function re(te){return f[te.getUTCMonth()]}function ue(te){return l[te.getUTCMonth()]}function me(te){return a[+(te.getUTCHours()>=12)]}function Pe(te){return 1+~~(te.getUTCMonth()/3)}return{format:function(te){var ve=C(te+="",O);return ve.toString=function(){return te},ve},parse:function(te){var ve=I(te+="",!1);return ve.toString=function(){return te},ve},utcFormat:function(te){var ve=C(te+="",P);return ve.toString=function(){return te},ve},utcParse:function(te){var ve=I(te+="",!0);return ve.toString=function(){return te},ve}}}var Jj={"-":"",_:" ",0:"0"},Ut=/^\s*\d+/,SB=/^%/,NB=/[\\^$*+?|[\]().{}]/g;function Qe(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",o=a.length;return n+(o[t.toLowerCase(),r]))}function AB(e,t,r){var n=Ut.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function PB(e,t,r){var n=Ut.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function CB(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function OB(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function _B(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function eS(e,t,r){var n=Ut.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function tS(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function MB(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function IB(e,t,r){var n=Ut.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function TB(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function rS(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function DB(e,t,r){var n=Ut.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function nS(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function RB(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function $B(e,t,r){var n=Ut.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function LB(e,t,r){var n=Ut.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function zB(e,t,r){var n=Ut.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function FB(e,t,r){var n=SB.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function BB(e,t,r){var n=Ut.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function UB(e,t,r){var n=Ut.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function iS(e,t){return Qe(e.getDate(),t,2)}function WB(e,t){return Qe(e.getHours(),t,2)}function HB(e,t){return Qe(e.getHours()%12||12,t,2)}function KB(e,t){return Qe(1+oc.count(wi(e),e),t,3)}function TP(e,t){return Qe(e.getMilliseconds(),t,3)}function GB(e,t){return TP(e,t)+"000"}function VB(e,t){return Qe(e.getMonth()+1,t,2)}function qB(e,t){return Qe(e.getMinutes(),t,2)}function QB(e,t){return Qe(e.getSeconds(),t,2)}function YB(e){var t=e.getDay();return t===0?7:t}function XB(e,t){return Qe(Gh.count(wi(e)-1,e),t,2)}function DP(e){var t=e.getDay();return t>=4||t===0?Us(e):Us.ceil(e)}function ZB(e,t){return e=DP(e),Qe(Us.count(wi(e),e)+(wi(e).getDay()===4),t,2)}function JB(e){return e.getDay()}function e9(e,t){return Qe(Wf.count(wi(e)-1,e),t,2)}function t9(e,t){return Qe(e.getFullYear()%100,t,2)}function r9(e,t){return e=DP(e),Qe(e.getFullYear()%100,t,2)}function n9(e,t){return Qe(e.getFullYear()%1e4,t,4)}function i9(e,t){var r=e.getDay();return e=r>=4||r===0?Us(e):Us.ceil(e),Qe(e.getFullYear()%1e4,t,4)}function a9(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Qe(t/60|0,"0",2)+Qe(t%60,"0",2)}function aS(e,t){return Qe(e.getUTCDate(),t,2)}function o9(e,t){return Qe(e.getUTCHours(),t,2)}function s9(e,t){return Qe(e.getUTCHours()%12||12,t,2)}function l9(e,t){return Qe(1+Kh.count(ki(e),e),t,3)}function RP(e,t){return Qe(e.getUTCMilliseconds(),t,3)}function u9(e,t){return RP(e,t)+"000"}function c9(e,t){return Qe(e.getUTCMonth()+1,t,2)}function d9(e,t){return Qe(e.getUTCMinutes(),t,2)}function f9(e,t){return Qe(e.getUTCSeconds(),t,2)}function h9(e){var t=e.getUTCDay();return t===0?7:t}function p9(e,t){return Qe(Vh.count(ki(e)-1,e),t,2)}function $P(e){var t=e.getUTCDay();return t>=4||t===0?Ws(e):Ws.ceil(e)}function m9(e,t){return e=$P(e),Qe(Ws.count(ki(e),e)+(ki(e).getUTCDay()===4),t,2)}function g9(e){return e.getUTCDay()}function v9(e,t){return Qe(Hf.count(ki(e)-1,e),t,2)}function y9(e,t){return Qe(e.getUTCFullYear()%100,t,2)}function x9(e,t){return e=$P(e),Qe(e.getUTCFullYear()%100,t,2)}function b9(e,t){return Qe(e.getUTCFullYear()%1e4,t,4)}function w9(e,t){var r=e.getUTCDay();return e=r>=4||r===0?Ws(e):Ws.ceil(e),Qe(e.getUTCFullYear()%1e4,t,4)}function k9(){return"+0000"}function oS(){return"%"}function sS(e){return+e}function lS(e){return Math.floor(+e/1e3)}var os,LP,zP;j9({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function j9(e){return os=jB(e),LP=os.format,os.parse,zP=os.utcFormat,os.utcParse,os}function S9(e){return new Date(e)}function N9(e){return e instanceof Date?+e:+new Date(+e)}function N0(e,t,r,n,a,o,c,l,f,h){var p=d0(),g=p.invert,x=p.domain,b=h(".%L"),j=h(":%S"),k=h("%I:%M"),S=h("%I %p"),N=h("%a %d"),E=h("%b %d"),O=h("%B"),P=h("%Y");function _(C){return(f(C)t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,o)=>h8(e,o/n))},r.copy=function(){return WP(t).domain(e)},Ni.apply(r,arguments)}function Qh(){var e=0,t=.5,r=1,n=1,a,o,c,l,f,h=pr,p,g=!1,x;function b(k){return isNaN(k=+k)?x:(k=.5+((k=+p(k))-o)*(n*k{if(e!=null){var n=e.scale,a=e.type;if(n==="auto")return a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!t)?"point":a==="category"?"band":"linear";if(typeof n=="string")return M9(n)?n:"point"}};function I9(e,t){for(var r=0,n=e.length,a=e[0]t)?r=o+1:n=o}return r}function QP(e,t){if(e){var r=t??e.domain(),n=r.map(o=>{var c;return(c=e(o))!==null&&c!==void 0?c:0}),a=e.range();if(!(r.length===0||a.length<2))return o=>{var c,l,f=I9(n,o);if(f<=0)return r[0];if(f>=r.length)return r[r.length-1];var h=(c=n[f-1])!==null&&c!==void 0?c:0,p=(l=n[f])!==null&&l!==void 0?l:0;return Math.abs(o-h)<=Math.abs(o-p)?r[f-1]:r[f]}}}function T9(e){if(e!=null)return"invert"in e&&typeof e.invert=="function"?e.invert.bind(e):QP(e,void 0)}function cS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Kf(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);re.cartesianAxis.xAxis[t],Ei=(e,t)=>{var r=XP(e,t);return r??Ot},_t={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Xv,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:Zu},ZP=(e,t)=>e.cartesianAxis.yAxis[t],Ai=(e,t)=>{var r=ZP(e,t);return r??_t},U9={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},C0=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??U9},gr=(e,t,r)=>{switch(t){case"xAxis":return Ei(e,r);case"yAxis":return Ai(e,r);case"zAxis":return C0(e,r);case"angleAxis":return Jy(e,r);case"radiusAxis":return e0(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},W9=(e,t,r)=>{switch(t){case"xAxis":return Ei(e,r);case"yAxis":return Ai(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},sc=(e,t,r)=>{switch(t){case"xAxis":return Ei(e,r);case"yAxis":return Ai(e,r);case"angleAxis":return Jy(e,r);case"radiusAxis":return e0(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},JP=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function eC(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var tC=e=>e.graphicalItems.cartesianItems,H9=K([Ft,Bh],eC),rC=(e,t,r)=>e.filter(r).filter(n=>(t==null?void 0:t.includeHidden)===!0?!0:!n.hide),tl=K([tC,gr,H9],rC,{memoizeOptions:{resultEqualityCheck:Wh}}),nC=K([tl],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(n0)),iC=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),K9=K([tl],iC),aC=e=>e.map(t=>t.data).filter(Boolean).flat(1),G9=K([tl],e=>e.some(t=>!t.data)),oC=K([tl],aC,{memoizeOptions:{resultEqualityCheck:Wh}}),sC=(e,t)=>{var r=t.chartData,n=r===void 0?[]:r,a=t.dataStartIndex,o=t.dataEndIndex;return e.length>0?e:n.slice(a,o+1)},O0=K([oC,Rh],sC),V9=(e,t,r)=>(t==null?void 0:t.dataKey)!=null?e.map(n=>({value:zt(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(a=>({value:zt(a,n)}))):e.map(n=>({value:n})),lC=(e,t,r,n,a,o)=>{var c=n.chartData,l=c===void 0?[]:c,f=n.dataStartIndex,h=n.dataEndIndex,p=V9(e,t,r);if(a&&(t==null?void 0:t.dataKey)!=null&&o.length>0){var g=l.slice(f,h+1),x=g.map(b=>({value:zt(b,t.dataKey)})).filter(b=>b.value!=null);return[...x,...p]}return p},lc=K([O0,gr,tl,Rh,G9,oC],lC);function bs(e){if(Wn(e)||e instanceof Date){var t=Number(e);if(He(t))return t}}function fS(e){if(Array.isArray(e)){var t=[bs(e[0]),bs(e[1])];return Fn(t)?t:void 0}var r=bs(e);if(r!=null)return[r,r]}function Gn(e){return e.map(bs).filter(Nr)}function q9(e,t){var r=bs(e),n=bs(t);return r==null&&n==null?0:r==null?-1:n==null?1:r-n}var Q9=K([lc],e=>e==null?void 0:e.map(t=>t.value).sort(q9));function uC(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function Y9(e,t,r){if(!r)return[];if(!r.length)return[];var n;if(typeof t=="number"&&!Un(t))n=t;else if(Array.isArray(t)){var a=Gn(t);a.length>0&&(n=Math.max(...a))}return n==null?[]:Gn(r.flatMap(o=>{var c=zt(e,o.dataKey),l,f;if(Array.isArray(c)){var h=YP(c,2);l=h[0],f=h[1]}else l=f=c;if(!(!He(l)||!He(f)))return[n-l,n+f]}))}var It=e=>{var t=Bt(e),r=Js(e);return sc(e,t,r)},Hs=K([It],e=>e==null?void 0:e.dataKey),X9=K([nC,Rh,It],hP),cC=(e,t,r,n)=>{var a={},o=t.reduce((c,l)=>{if(l.stackId==null)return c;var f=c[l.stackId];return f==null&&(f=[]),f.push(l),c[l.stackId]=f,c},a);return Object.fromEntries(Object.entries(o).map(c=>{var l=YP(c,2),f=l[0],h=l[1],p=n?[...h].reverse():h,g=p.map(r0);return[f,{stackedData:mL(e,g,r),graphicalItems:p}]}))},dC=K([X9,nC,$h,oP],cC),fC=(e,t,r,n)=>{var a=t.dataStartIndex,o=t.dataEndIndex;if(n==null&&r!=="zAxis")return xL(e,a,o)},Z9=K([gr],e=>e.allowDataOverflow),_0=e=>{var t;if(e==null||!("domain"in e))return Xv;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var r=Gn(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:Xv},hC=K([gr],_0),pC=K([hC,Z9],QA),J9=K([dC,jn,Ft,pC],fC,{memoizeOptions:{resultEqualityCheck:Uh}}),M0=e=>e.errorBars,e7=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>uC(r,n)),Gf=function(){for(var t=arguments.length,r=new Array(t),n=0;n5&&arguments[5]!==void 0?arguments[5]:[],l,f;if(n.length>0&&n.forEach(h=>{var p,g=h.data!=null?[...h.data]:c,x=(p=a[h.id])===null||p===void 0?void 0:p.filter(b=>uC(o,b));g.forEach(b=>{var j,k=zt(b,(j=r.dataKey)!==null&&j!==void 0?j:h.dataKey),S=Y9(b,k,x);if(S.length>=2){var N=Math.min(...S),E=Math.max(...S);(l==null||Nf)&&(f=E)}var O=fS(k);O!=null&&(l=l==null?O[0]:Math.min(l,O[0]),f=f==null?O[1]:Math.max(f,O[1]))})}),(r==null?void 0:r.dataKey)!=null&&n.length===0&&t.forEach(h=>{var p=fS(zt(h,r.dataKey));p!=null&&(l=l==null?p[0]:Math.min(l,p[0]),f=f==null?p[1]:Math.max(f,p[1]))}),He(l)&&He(f))return[l,f]},t7=K([O0,gr,K9,M0,Ft,_F],mC,{memoizeOptions:{resultEqualityCheck:Uh}});function r7(e){var t=e.value;if(Wn(t)||t instanceof Date)return t}var n7=(e,t,r)=>{var n=e.map(r7).filter(a=>a!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&EE(n))?qA(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},gC=e=>e.referenceElements.dots,rl=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),i7=K([gC,Ft,Bh],rl),vC=e=>e.referenceElements.areas,a7=K([vC,Ft,Bh],rl),yC=e=>e.referenceElements.lines,o7=K([yC,Ft,Bh],rl),xC=(e,t)=>{if(e!=null){var r=Gn(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},s7=K(i7,Ft,xC),bC=(e,t)=>{if(e!=null){var r=Gn(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},l7=K([a7,Ft],bC);function u7(e){var t;if(e.x!=null)return Gn([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:Gn(r)}function c7(e){var t;if(e.y!=null)return Gn([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:Gn(r)}var wC=(e,t)=>{if(e!=null){var r=e.flatMap(n=>t==="xAxis"?u7(n):c7(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},d7=K([o7,Ft],wC),f7=K(s7,d7,l7,(e,t,r)=>Gf(e,r,t)),kC=(e,t,r,n,a,o,c,l)=>{if(r!=null)return r;var f=c==="vertical"&&l==="xAxis"||c==="horizontal"&&l==="yAxis",h=f?Gf(n,o,a):Gf(o,a);return $F(t,h,e.allowDataOverflow)},h7=K([gr,hC,pC,J9,t7,f7,dt,Ft],kC,{memoizeOptions:{resultEqualityCheck:Uh}}),p7=[0,1],jC=(e,t,r,n,a,o,c)=>{if(!((e==null||r==null||r.length===0)&&c===void 0)){var l=e.dataKey,f=e.type,h=Vn(t,o);if(h&&l==null){var p;return qA(0,(p=r==null?void 0:r.length)!==null&&p!==void 0?p:0)}return f==="category"?n7(n,e,h):a==="expand"&&!h?p7:c}},I0=K([gr,dt,O0,lc,$h,Ft,h7],jC),nl=K([gr,JP,Yy],qP),SC=(e,t,r)=>{var n=t.niceTicks;if(n!=="none"){var a=_0(t),o=Array.isArray(a)&&(a[0]==="auto"||a[1]==="auto");if((n==="snap125"||n==="adaptive")&&t!=null&&t.tickCount&&Fn(e)){if(o)return wj(e,t.tickCount,t.allowDecimals,n);if(t.type==="number")return kj(e,t.tickCount,t.allowDecimals,n)}if(n==="auto"&&r==="linear"&&t!=null&&t.tickCount){if(o&&Fn(e))return wj(e,t.tickCount,t.allowDecimals,"adaptive");if(t.type==="number"&&Fn(e))return kj(e,t.tickCount,t.allowDecimals,"adaptive")}}},T0=K([I0,sc,nl],SC),NC=(e,t,r,n)=>{if(n!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Fn(t)&&Array.isArray(r)&&r.length>0){var a,o,c=t[0],l=(a=r[0])!==null&&a!==void 0?a:0,f=t[1],h=(o=r[r.length-1])!==null&&o!==void 0?o:0;return[Math.min(c,l),Math.max(f,h)]}return t},m7=K([gr,I0,T0,Ft],NC),g7=K(lc,gr,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(Gn(e.map(g=>g.value))).sort((g,x)=>g-x),a=n[0],o=n[n.length-1];if(a==null||o==null)return 1/0;var c=o-a;if(c===0)return 1/0;for(var l=0;la,(e,t,r,n,a)=>{if(!He(e))return 0;var o=t==="vertical"?n.height:n.width;if(a==="gap")return e*o/2;if(a==="no-gap"){var c=wa(r,e*o),l=e*o/2;return l-c-(l-c)/o*c}return 0}),v7=(e,t,r)=>{var n=Ei(e,t);return n==null||typeof n.padding!="string"?0:EC(e,"xAxis",t,r,n.padding)},y7=(e,t,r)=>{var n=Ai(e,t);return n==null||typeof n.padding!="string"?0:EC(e,"yAxis",t,r,n.padding)},x7=K(Ei,v7,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var a=e.padding;return typeof a=="string"?{left:t,right:t}:{left:((r=a.left)!==null&&r!==void 0?r:0)+t,right:((n=a.right)!==null&&n!==void 0?n:0)+t}}),b7=K(Ai,y7,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var a=e.padding;return typeof a=="string"?{top:t,bottom:t}:{top:((r=a.top)!==null&&r!==void 0?r:0)+t,bottom:((n=a.bottom)!==null&&n!==void 0?n:0)+t}}),AC=K([Zt,x7,Oh,Ch,(e,t,r)=>r],(e,t,r,n,a)=>{var o=n.padding;return a?[o.left,r.width-o.right]:[e.left+t.left,e.left+e.width-t.right]}),PC=K([Zt,dt,b7,Oh,Ch,(e,t,r)=>r],(e,t,r,n,a,o)=>{var c=a.padding;return o?[n.height-c.bottom,c.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),uc=(e,t,r,n)=>{var a;switch(t){case"xAxis":return AC(e,r,n);case"yAxis":return PC(e,r,n);case"zAxis":return(a=C0(e,r))===null||a===void 0?void 0:a.range;case"angleAxis":return cP(e);case"radiusAxis":return dP(e,r);default:return}},CC=K([gr,uc],Lh),w7=K([nl,m7],t8),D0=K([gr,nl,w7,CC],P0),OC=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var a=r.type,o=r.scale,c=Vn(e,n);if(c&&(a==="number"||o!=="auto"))return t.map(l=>l.value)}},R0=K([dt,lc,sc,Ft],OC),Yh=K([D0],i0);K([D0],T9);K([D0,Q9],QP);K([tl,M0,Ft],e7);function _C(e,t){return e.idt.id?1:0}var Xh=(e,t)=>t,Zh=(e,t,r)=>r,k7=K(Ah,Xh,Zh,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(_C)),j7=K(Ph,Xh,Zh,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(_C)),MC=(e,t)=>({width:e.width,height:t.height}),S7=(e,t)=>{var r=typeof t.width=="number"?t.width:Zu;return{width:r,height:e.height}},N7=K(Zt,Ei,MC),E7=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},A7=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},P7=K(Si,Zt,k7,Xh,Zh,(e,t,r,n,a)=>{var o={},c;return r.forEach(l=>{var f=MC(t,l);c==null&&(c=E7(t,n,e));var h=n==="top"&&!a||n==="bottom"&&a;o[l.id]=c-Number(h)*f.height,c+=(h?-1:1)*f.height}),o}),C7=K(ji,Zt,j7,Xh,Zh,(e,t,r,n,a)=>{var o={},c;return r.forEach(l=>{var f=S7(t,l);c==null&&(c=A7(t,n,e));var h=n==="left"&&!a||n==="right"&&a;o[l.id]=c-Number(h)*f.width,c+=(h?-1:1)*f.width}),o}),O7=(e,t)=>{var r=Ei(e,t);if(r!=null)return P7(e,r.orientation,r.mirror)},_7=K([Zt,Ei,O7,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var a=r==null?void 0:r[n];return a==null?{x:e.left,y:0}:{x:e.left,y:a}}}),M7=(e,t)=>{var r=Ai(e,t);if(r!=null)return C7(e,r.orientation,r.mirror)},I7=K([Zt,Ai,M7,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var a=r==null?void 0:r[n];return a==null?{x:0,y:e.top}:{x:a,y:e.top}}}),T7=K(Zt,Ai,(e,t)=>{var r=typeof t.width=="number"?t.width:Zu;return{width:r,height:e.height}}),IC=(e,t,r,n)=>{if(r!=null){var a=r.allowDuplicatedCategory,o=r.type,c=r.dataKey,l=Vn(e,n),f=t.map(p=>p.value),h=f.filter(p=>p!=null);if(c&&l&&o==="category"&&a&&EE(h))return f}},$0=K([dt,lc,gr,Ft],IC),hS=K([dt,W9,nl,Yh,$0,R0,uc,T0,Ft],(e,t,r,n,a,o,c,l,f)=>{if(t!=null){var h=Vn(e,f);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:f,categoricalDomain:o,duplicateDomain:a,isCategorical:h,niceTicks:l,range:c,realScaleType:r,scale:n}}}),D7=(e,t,r,n,a,o,c,l,f)=>{if(!(t==null||n==null)){var h=Vn(e,f),p=t.type,g=t.ticks,x=t.tickCount,b=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,j=p==="category"&&n.bandwidth?n.bandwidth()/b:0;j=f==="angleAxis"&&o!=null&&o.length>=2?Xr(o[0]-o[1])*2*j:j;var k=g||a;return k?k.map((S,N)=>{var E=c?c.indexOf(S):S,O=n.map(E);return He(O)?{index:N,coordinate:O+j,value:S,offset:j}:null}).filter(Nr):h&&l?l.map((S,N)=>{var E=n.map(S);return He(E)?{coordinate:E+j,value:S,index:N,offset:j}:null}).filter(Nr):n.ticks?n.ticks(x).map((S,N)=>{var E=n.map(S);return He(E)?{coordinate:E+j,value:S,index:N,offset:j}:null}).filter(Nr):n.domain().map((S,N)=>{var E=n.map(S);return He(E)?{coordinate:E+j,value:c?c[S]:S,index:N,offset:j}:null}).filter(Nr)}},TC=K([dt,sc,nl,Yh,T0,uc,$0,R0,Ft],D7),R7=(e,t,r,n,a,o,c)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var l=Vn(e,c),f=t.tickCount,h=0;return h=c==="angleAxis"&&(n==null?void 0:n.length)>=2?Xr(n[0]-n[1])*2*h:h,l&&o?o.map((p,g)=>{var x=r.map(p);return He(x)?{coordinate:x+h,value:p,index:g,offset:h}:null}).filter(Nr):r.ticks?r.ticks(f).map((p,g)=>{var x=r.map(p);return He(x)?{coordinate:x+h,value:p,index:g,offset:h}:null}).filter(Nr):r.domain().map((p,g)=>{var x=r.map(p);return He(x)?{coordinate:x+h,value:a?a[p]:p,index:g,offset:h}:null}).filter(Nr)}},DC=K([dt,sc,Yh,uc,$0,R0,Ft],R7),RC=K(gr,Yh,(e,t)=>{if(!(e==null||t==null))return Kf(Kf({},e),{},{scale:t})}),$7=K([gr,nl,I0,CC],P0),L7=K([$7],i0);K((e,t,r)=>C0(e,r),L7,(e,t)=>{if(!(e==null||t==null))return Kf(Kf({},e),{},{scale:t})});var z7=K([dt,Ah,Ph],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),F7=(e,t,r)=>{var n;return(n=e.renderedTicks[t])===null||n===void 0?void 0:n[r]};K([F7],e=>{if(!(!e||e.length===0))return t=>{var r,n=1/0,a=e[0];for(var o of e){var c=Math.abs(o.coordinate-t);ce.options.defaultTooltipEventType,LC=e=>e.options.validateTooltipEventTypes;function zC(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function cc(e,t){var r=$C(e),n=LC(e);return zC(t,r,n)}function B7(e){return Me(t=>cc(t,e))}var FC=(e,t)=>{var r,n=Number(t);if(!(Un(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},U7=e=>e.tooltip.settings,oa={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},W7={itemInteraction:{click:oa,hover:oa},axisInteraction:{click:oa,hover:oa},keyboardInteraction:oa,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},BC=lr({name:"tooltip",initialState:W7,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:st()},replaceTooltipEntrySettings:{reducer(e,t){var r=t.payload,n=r.prev,a=r.next,o=Zr(e).tooltipItemPayloads.indexOf(n);o>-1&&(e.tooltipItemPayloads[o]=a)},prepare:st()},removeTooltipEntrySettings:{reducer(e,t){var r=Zr(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:st()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.syncInteraction.sourceViewBox=void 0,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),on=BC.actions,H7=on.addTooltipEntrySettings,K7=on.replaceTooltipEntrySettings,G7=on.removeTooltipEntrySettings,V7=on.setTooltipSettingsState,q7=on.setActiveMouseOverItemIndex;on.mouseLeaveItem;var UC=on.mouseLeaveChart;on.setActiveClickItemIndex;var WC=on.setMouseOverAxisIndex,Q7=on.setMouseClickAxisIndex,hu=on.setSyncInteraction,Vf=on.setKeyboardInteraction,Y7=BC.reducer;function pS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Wd(e){for(var t=1;t{if(t==null)return oa;var a=eU(e,t,r);if(a==null)return oa;if(a.active)return a;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var o=e.settings.active===!0;if(tU(a)){if(o)return Wd(Wd({},a),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return Wd(Wd({},oa),{},{coordinate:a.coordinate})};function rU(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}function nU(e,t){var r=rU(e),n=t[0],a=t[1];if(r===void 0)return!1;var o=Math.min(n,a),c=Math.max(n,a);return r>=o&&r<=c}function iU(e,t,r){if(r==null||t==null)return!0;var n=zt(e,t);return n==null||!Fn(r)?!0:nU(n,r)}var gu=(e,t,r,n)=>{var a=e==null?void 0:e.index;if(a==null)return null;var o=Number(a);if(!He(o))return a;var c=0,l=1/0;t.length>0&&(l=t.length-1);var f=Math.max(c,Math.min(o,l)),h=t[f];return h==null||iU(h,r,n)?String(f):null},KC=(e,t,r,n,a,o,c)=>{if(o!=null){var l=c[0],f=l==null?void 0:l.getPosition(o);if(f!=null)return f;var h=a==null?void 0:a[Number(o)];if(h)switch(r){case"horizontal":return{x:h.coordinate,y:(n.top+t)/2};default:return{x:(n.left+e)/2,y:h.coordinate}}}},GC=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var a;if(r==="hover"?a=e.itemInteraction.hover.graphicalItemId:a=e.itemInteraction.click.graphicalItemId,e.syncInteraction.active&&a==null)return e.tooltipItemPayloads;if(a==null&&(n!=null||e.keyboardInteraction.active)){var o=e.tooltipItemPayloads[0];return o!=null?[o]:[]}return e.tooltipItemPayloads.filter(c=>{var l;return((l=c.settings)===null||l===void 0?void 0:l.graphicalItemId)===a})},VC=e=>e.options.tooltipPayloadSearcher,il=e=>e.tooltip;function mS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function gS(e){for(var t=1;te(t)}function vS(e){if(typeof e=="string")return e}function dU(e){if(!(e==null||typeof e!="object")){var t="name"in e?lU(e.name):void 0,r="unit"in e?uU(e.unit):void 0,n="dataKey"in e?cU(e.dataKey):void 0,a="payload"in e?e.payload:void 0,o="color"in e?vS(e.color):void 0,c="fill"in e?vS(e.fill):void 0;return{name:t,unit:r,dataKey:n,payload:a,color:o,fill:c}}}function fU(e,t){return e??t}var qC=(e,t,r,n,a,o,c)=>{if(!(t==null||o==null)){var l=r.chartData,f=r.computedData,h=r.dataStartIndex,p=r.dataEndIndex,g=[];return e.reduce((x,b)=>{var j,k=b.dataDefinedOnItem,S=b.settings,N=fU(k,l),E=Array.isArray(N)?xA(N,h,p):N,O=(j=S==null?void 0:S.dataKey)!==null&&j!==void 0?j:n,P=S==null?void 0:S.nameKey,_;if(n&&Array.isArray(E)&&!Array.isArray(E[0])&&c==="axis"?_=AE(E,n,a):_=o(E,t,f,P),Array.isArray(_))_.forEach(I=>{var B,U,G=dU(I),X=G==null?void 0:G.name,$=G==null?void 0:G.dataKey,fe=G==null?void 0:G.payload,J=gS(gS({},S),{},{name:X,unit:G==null?void 0:G.unit,color:(B=G==null?void 0:G.color)!==null&&B!==void 0?B:S==null?void 0:S.color,fill:(U=G==null?void 0:G.fill)!==null&&U!==void 0?U:S==null?void 0:S.fill});x.push(dk({tooltipEntrySettings:J,dataKey:$,payload:fe,value:zt(fe,$),name:X==null?void 0:String(X)}))});else{var C;x.push(dk({tooltipEntrySettings:S,dataKey:O,payload:_,value:zt(_,O),name:(C=zt(_,P))!==null&&C!==void 0?C:S==null?void 0:S.name}))}return x},g)}},L0=K([It,JP,Yy],qP),hU=K([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),pU=K([Bt,Js],eC),Co=K([hU,It,pU],rC,{memoizeOptions:{resultEqualityCheck:Wh}}),mU=K([Co],e=>e.filter(n0)),QC=K([Co],aC,{memoizeOptions:{resultEqualityCheck:Wh}}),gU=K([Co],e=>e.some(t=>!t.data)),wo=K([QC,jn],sC),vU=K([mU,jn,It],hP),z0=K([wo,It,Co,jn,gU,QC],lC),YC=K([It],_0),yU=K([It],e=>e.allowDataOverflow),XC=K([YC,yU],QA),xU=K([Co],e=>e.filter(n0)),bU=K([vU,xU,$h,oP],cC),wU=K([bU,jn,Bt,XC],fC),kU=K([Co],iC),jU=K([wo,It,kU,M0,Bt,MF],mC,{memoizeOptions:{resultEqualityCheck:Uh}}),SU=K([gC,Bt,Js],rl),NU=K([SU,Bt],xC),EU=K([vC,Bt,Js],rl),AU=K([EU,Bt],bC),PU=K([yC,Bt,Js],rl),CU=K([PU,Bt],wC),OU=K([NU,CU,AU],Gf),_U=K([It,YC,XC,wU,jU,OU,dt,Bt],kC),Ks=K([It,dt,wo,z0,$h,Bt,_U],jC),MU=K([Ks,It,L0],SC),IU=K([It,Ks,MU,Bt],NC),ZC=e=>{var t=Bt(e),r=Js(e),n=!1;return uc(e,t,r,n)},JC=K([It,ZC],Lh),TU=K([It,L0,IU,JC],P0),eO=K([TU],i0),DU=K([dt,z0,It,Bt],IC),RU=K([dt,z0,It,Bt],OC),$U=(e,t,r,n,a,o,c,l)=>{if(t){var f=t.type,h=Vn(e,l);if(n){var p=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,g=f==="category"&&n.bandwidth?n.bandwidth()/p:0;return g=l==="angleAxis"&&a!=null&&(a==null?void 0:a.length)>=2?Xr(a[0]-a[1])*2*g:g,h&&c?c.map((x,b)=>{var j=n.map(x);return He(j)?{coordinate:j+g,value:x,index:b,offset:g}:null}).filter(Nr):n.domain().map((x,b)=>{var j=n.map(x);return He(j)?{coordinate:j+g,value:o?o[x]:x,index:b,offset:g}:null}).filter(Nr)}}},Pi=K([dt,It,L0,eO,ZC,DU,RU,Bt],$U),F0=K([$C,LC,U7],(e,t,r)=>zC(r.shared,e,t)),tO=e=>e.tooltip.settings.trigger,B0=e=>e.tooltip.settings.defaultIndex,dc=K([il,F0,tO,B0],HC),Fu=K([dc,wo,Hs,Ks],gu),rO=K([Pi,Fu],FC),LU=K([dc],e=>{if(e)return e.dataKey}),zU=K([dc],e=>{if(e)return e.graphicalItemId}),nO=K([il,F0,tO,B0],GC),FU=K([ji,Si,dt,Zt,Pi,B0,nO],KC),BU=K([dc,FU],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),UU=K([dc],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),WU=K([nO,Fu,jn,Hs,rO,VC,F0],qC),HU=K([WU],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function yS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function xS(e){for(var t=1;tMe(It),QU=()=>{var e=qU(),t=Me(Pi),r=Me(eO);return jf(!e||!r?void 0:xS(xS({},e),{},{scale:r}),t)};function bS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ss(e){for(var t=1;t{var a=t.find(o=>o&&o.index===r);if(a){if(e==="horizontal")return{x:a.coordinate,y:n.relativeY};if(e==="vertical")return{x:n.relativeX,y:a.coordinate}}return{x:0,y:0}},eW=(e,t,r,n)=>{var a=t.find(h=>h&&h.index===r);if(a){if(e==="centric"){var o=a.coordinate,c=n.radius;return ss(ss(ss({},n),Qt(n.cx,n.cy,c,o)),{},{angle:o,radius:c})}var l=a.coordinate,f=n.angle;return ss(ss(ss({},n),Qt(n.cx,n.cy,l,f)),{},{angle:f,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function tW(e,t){var r=e.relativeX,n=e.relativeY;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var iO=(e,t,r,n,a)=>{var o,c=(o=t==null?void 0:t.length)!==null&&o!==void 0?o:0;if(c<=1||e==null)return 0;if(n==="angleAxis"&&a!=null&&Math.abs(Math.abs(a[1]-a[0])-360)<=1e-6)for(var l=0;l0?(f=r[l-1])===null||f===void 0?void 0:f.coordinate:(h=r[c-1])===null||h===void 0?void 0:h.coordinate,j=(p=r[l])===null||p===void 0?void 0:p.coordinate,k=l>=c-1?(g=r[0])===null||g===void 0?void 0:g.coordinate:(x=r[l+1])===null||x===void 0?void 0:x.coordinate,S=void 0;if(!(b==null||j==null||k==null))if(Xr(j-b)!==Xr(k-j)){var N=[];if(Xr(k-j)===Xr(a[1]-a[0])){S=k;var E=j+a[1]-a[0];N[0]=Math.min(E,(E+b)/2),N[1]=Math.max(E,(E+b)/2)}else{S=b;var O=k+a[1]-a[0];N[0]=Math.min(j,(O+j)/2),N[1]=Math.max(j,(O+j)/2)}var P=[Math.min(j,(S+j)/2),Math.max(j,(S+j)/2)];if(e>P[0]&&e<=P[1]||e>=N[0]&&e<=N[1]){var _;return(_=r[l])===null||_===void 0?void 0:_.index}}else{var C=Math.min(b,k),I=Math.max(b,k);if(e>(C+j)/2&&e<=(I+j)/2){var B;return(B=r[l])===null||B===void 0?void 0:B.index}}}else if(t)for(var U=0;U(G.coordinate+$.coordinate)/2||U>0&&U(G.coordinate+$.coordinate)/2&&e<=(G.coordinate+X.coordinate)/2)return G.index}}return-1},aO=()=>Me(Yy),U0=(e,t)=>t,oO=(e,t,r)=>r,W0=(e,t,r,n)=>n,rW=K(Pi,e=>gh(e,t=>t.coordinate)),H0=K([il,U0,oO,W0],HC),K0=K([H0,wo,Hs,Ks],gu),nW=(e,t,r)=>{if(t!=null){var n=il(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},sO=K([il,U0,oO,W0],GC),qf=K([ji,Si,dt,Zt,Pi,W0,sO],KC),iW=K([H0,qf],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),lO=K([Pi,K0],FC),aW=K([sO,K0,jn,Hs,lO,VC,U0],qC),oW=K([H0,K0],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),sW=(e,t,r,n,a,o,c)=>{if(!(!e||!r||!n||!a)&&tW(e,c)){var l=bL(e,t),f=iO(l,o,a,r,n),h=JU(t,a,f,e);return{activeIndex:String(f),activeCoordinate:h}}},lW=(e,t,r,n,a,o,c)=>{if(!(!e||!n||!a||!o||!r)){var l=jF(e,r);if(l){var f=wL(l,t),h=iO(f,c,o,n,a),p=eW(t,o,h,l);return{activeIndex:String(h),activeCoordinate:p}}}},uW=(e,t,r,n,a,o,c,l)=>{if(!(!e||!t||!n||!a||!o))return t==="horizontal"||t==="vertical"?sW(e,t,n,a,o,c,l):lW(e,t,r,n,a,o,c)},cW=K(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElement:n.element}}),dW=K(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(hr)),r=Array.from(new Set(t));return r.sort((n,a)=>n-a)},{memoizeOptions:{resultEqualityCheck:e8}});function wS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function kS(e){for(var t=1;tkS(kS({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),mW)},vW=new Set(Object.values(hr));function yW(e){return vW.has(e)}var uO=lr({name:"zIndex",initialState:gW,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var r=t.payload.zIndex;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:st()},unregisterZIndexPortal:{reducer:(e,t)=>{var r=t.payload.zIndex;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!yW(r)&&delete e.zIndexMap[r])},prepare:st()},registerZIndexPortalElement:{reducer:(e,t)=>{var r=t.payload,n=r.zIndex,a=r.element,o=r.isPanorama;e.zIndexMap[n]?o?e.zIndexMap[n].panoramaElement=a:e.zIndexMap[n].element=a:e.zIndexMap[n]={consumers:0,element:o?void 0:a,panoramaElement:o?a:void 0}},prepare:st()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var r=t.payload.zIndex;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElement=void 0:e.zIndexMap[r].element=void 0)},prepare:st()}}}),Jh=uO.actions,xW=Jh.registerZIndexPortal,Ag=Jh.unregisterZIndexPortal,bW=Jh.registerZIndexPortalElement,wW=Jh.unregisterZIndexPortalElement,kW=uO.reducer;function Ci(e){var t=e.zIndex,r=e.children,n=az(),a=n&&t!==void 0&&t!==0,o=Ar(),c=v.useRef(void 0),l=v.useRef(new Set),f=Et(),h=Me(g=>cW(g,t,o));if(v.useLayoutEffect(()=>{if(!a){var g=l.current;g.forEach(b=>{f(Ag({zIndex:b}))}),g.clear(),c.current=void 0;return}if(l.current.has(t)||(f(xW({zIndex:t})),l.current.add(t)),h){c.current=h;var x=l.current;x.forEach(b=>{b!==t&&(f(Ag({zIndex:b})),x.delete(b))})}},[f,t,a,h]),v.useLayoutEffect(()=>{var g=l.current;return()=>{g.forEach(x=>{f(Ag({zIndex:x}))}),g.clear()}},[f]),!a)return r;var p=h??c.current;return p?sh.createPortal(r,p):null}function Zv(){return Zv=Object.assign?Object.assign.bind():function(e){for(var t=1;tv.useContext(cO),Pg={exports:{}},SS;function OW(){return SS||(SS=1,(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function a(f,h,p){this.fn=f,this.context=h,this.once=p||!1}function o(f,h,p,g,x){if(typeof p!="function")throw new TypeError("The listener must be a function");var b=new a(p,g||f,x),j=r?r+h:h;return f._events[j]?f._events[j].fn?f._events[j]=[f._events[j],b]:f._events[j].push(b):(f._events[j]=b,f._eventsCount++),f}function c(f,h){--f._eventsCount===0?f._events=new n:delete f._events[h]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var h=[],p,g;if(this._eventsCount===0)return h;for(g in p=this._events)t.call(p,g)&&h.push(r?g.slice(1):g);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(p)):h},l.prototype.listeners=function(h){var p=r?r+h:h,g=this._events[p];if(!g)return[];if(g.fn)return[g.fn];for(var x=0,b=g.length,j=new Array(b);x{if(t&&Array.isArray(e)){var r=Number.parseInt(t,10);if(!Un(r))return e[r]}},TW={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},dO=lr({name:"options",initialState:TW,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),DW=dO.reducer,RW=dO.actions.createEventEmitter;function $W(e){return e.tooltip.syncInteraction}var LW={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},fO=lr({name:"chartData",initialState:LW,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var r=t.payload,n=r.startIndex,a=r.endIndex;n!=null&&(e.dataStartIndex=n),a!=null&&(e.dataEndIndex=a)}}}),G0=fO.actions,ES=G0.setChartData,zW=G0.setDataStartEndIndexes;G0.setComputedData;var FW=fO.reducer,BW=["x","y"];function AS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ls(e){for(var t=1;tf.rootProps.className);v.useEffect(()=>{if(e==null)return Qs;var f=(h,p,g)=>{if(t!==g&&e===h){if(p.payload.active===!1){r(hu({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(n==="index"){var x;if(c&&p!==null&&p!==void 0&&(x=p.payload)!==null&&x!==void 0&&x.coordinate&&p.payload.sourceViewBox){var b=p.payload.coordinate,j=b.x,k=b.y,S=KW(b,BW),N=p.payload.sourceViewBox,E=N.x,O=N.y,P=N.width,_=N.height,C=ls(ls({},S),{},{x:c.x+(P?(j-E)/P:0)*c.width,y:c.y+(_?(k-O)/_:0)*c.height});r(ls(ls({},p),{},{payload:ls(ls({},p.payload),{},{coordinate:C})}))}else r(p);return}if(a!=null){var I;if(typeof n=="function"){var B={activeTooltipIndex:p.payload.index==null?void 0:Number(p.payload.index),isTooltipActive:p.payload.active,activeIndex:p.payload.index==null?void 0:Number(p.payload.index),activeLabel:p.payload.label,activeDataKey:p.payload.dataKey,activeCoordinate:p.payload.coordinate},U=n(a,B);I=a[U]}else n==="value"&&(I=a.find(de=>String(de.value)===p.payload.label));var G=p.payload.coordinate;if(G==null||c==null){r(hu({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(I==null){r(hu({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:p.payload.sourceViewBox,graphicalItemId:void 0}));return}var X=G.x,$=G.y,fe=Math.min(X,c.x+c.width),J=Math.min($,c.y+c.height),pe={x:o==="horizontal"?I.coordinate:fe,y:o==="horizontal"?J:I.coordinate},be=hu({active:p.payload.active,coordinate:pe,dataKey:p.payload.dataKey,index:String(I.index),label:p.payload.label,sourceViewBox:p.payload.sourceViewBox,graphicalItemId:p.payload.graphicalItemId});r(be)}}};return Bu.on(Jv,f),()=>{Bu.off(Jv,f)}},[l,r,t,e,n,a,o,c])}function qW(){var e=Me(Xy),t=Me(Zy),r=Et();v.useEffect(()=>{if(e==null)return Qs;var n=(a,o,c)=>{t!==c&&e===a&&r(zW(o))};return Bu.on(NS,n),()=>{Bu.off(NS,n)}},[r,t,e])}function QW(){var e=Et();v.useEffect(()=>{e(RW())},[e]),VW(),qW()}function YW(e,t,r,n,a,o){var c=Me(j=>nW(j,e,t)),l=Me(zU),f=Me(Zy),h=Me(Xy),p=Me(sP),g=Me($W),x=(g==null?void 0:g.sourceViewBox)!=null,b=_h();v.useEffect(()=>{if(!x&&h!=null&&f!=null){var j=hu({active:o,coordinate:r,dataKey:c,index:a,label:typeof n=="number"?String(n):n,sourceViewBox:b,graphicalItemId:l});Bu.emit(Jv,h,j,f)}},[x,r,c,l,a,n,f,h,p,o,b])}function PS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function CS(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r{I(V7({shared:E,trigger:O,axisId:C,active:a,defaultIndex:B}))},[I,E,O,C,a,B]);var U=_h(),G=FA(),X=B7(E),$=(t=Me(Oe=>oW(Oe,X,O,B)))!==null&&t!==void 0?t:{},fe=$.activeIndex,J=$.isActive,pe=Me(Oe=>aW(Oe,X,O,B)),be=Me(Oe=>lO(Oe,X,O,B)),de=Me(Oe=>iW(Oe,X,O,B)),Y=pe,V=CW(),Q=(r=a??J)!==null&&r!==void 0?r:!1,D=o$([Y,Q]),T=eH(D,2),Z=T[0],oe=T[1],re=X==="axis"?be:void 0;YW(X,O,de,re,fe,Q);var ue=_??V;if(ue==null||U==null||X==null)return null;var me=Y??_S;Q||(me=_S),h&&me.length&&(me=CR(me.filter(Oe=>Oe.value!=null&&(Oe.hide!==!0||n.includeHidden)),x,aH));var Pe=me.length>0,te=CS(CS({},n),{},{payload:me,label:re,active:Q,activeIndex:fe,coordinate:de,accessibilityLayer:G}),ve=v.createElement(v6,{allowEscapeViewBox:o,animationDuration:c,animationEasing:l,isAnimationActive:p,active:Q,coordinate:de,hasPayload:Pe,offset:g,position:b,reverseDirection:j,useTranslate3d:k,viewBox:U,wrapperStyle:S,lastBoundingBox:Z,innerRef:oe,hasPortalFromProps:!!_},oH(f,te));return v.createElement(v.Fragment,null,sh.createPortal(ve,ue),Q&&v.createElement(PW,{cursor:N,tooltipEventType:X,coordinate:de,payload:me,index:fe}))}function uH(e,t,r){return(t=cH(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cH(e){var t=dH(e,"string");return typeof t=="symbol"?t:t+""}function dH(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class fH{constructor(t){uH(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function MS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function hH(e){for(var t=1;t{try{var r=document.getElementById(TS);r||(r=document.createElement("span"),r.setAttribute("id",TS),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,yH,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},vu=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||rc.isSsr)return{width:0,height:0};if(!hO.enableCache)return DS(t,r);var n=xH(t,r),a=IS.get(n);if(a)return a;var o=DS(t,r);return IS.set(n,o),o},pO;function Qf(e,t){return jH(e)||kH(e,t)||wH(e,t)||bH()}function bH(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wH(e,t){if(e){if(typeof e=="string")return RS(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?RS(e,t):void 0}}function RS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);re.length)&&(t=e.length);for(var r=0,n=Array(t);r{var t=e.children,r=e.breakAll,n=e.style;try{var a=[];Yt(t)||(r?a=t.toString().split(""):a=t.toString().split(gO));var o=a.map(l=>({word:l,width:vu(l,n).width})),c=r?0:vu(" ",n).width;return{wordsWithComputedWidth:o,spaceWidth:c}}catch{return null}};function yO(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}function WH(e){return Yt(e)||typeof e=="string"||typeof e=="number"||typeof e=="boolean"}var xO=(e,t,r,n)=>e.reduce((a,o)=>{var c=o.word,l=o.width,f=a[a.length-1];if(f&&l!=null&&(t==null||n||f.width+l+re.reduce((t,r)=>t.width>r.width?t:r),HH="…",WS=(e,t,r,n,a,o,c,l)=>{var f=e.slice(0,t),h=vO({breakAll:r,style:n,children:f+HH});if(!h)return[!1,[]];var p=xO(h.wordsWithComputedWidth,o,c,l),g=p.length>a||bO(p).width>Number(o);return[g,p]},KH=(e,t,r,n,a)=>{var o=e.maxLines,c=e.children,l=e.style,f=e.breakAll,h=Ne(o),p=String(c),g=xO(t,n,r,a);if(!h||a)return g;var x=g.length>o||bO(g).width>Number(n);if(!x)return g;for(var b=0,j=p.length-1,k=0,S;b<=j&&k<=p.length-1;){var N=Math.floor((b+j)/2),E=N-1,O=WS(p,E,f,l,o,n,r,a),P=BS(O,2),_=P[0],C=P[1],I=WS(p,N,f,l,o,n,r,a),B=BS(I,1),U=B[0];if(!_&&!U&&(b=N+1),_&&U&&(j=N-1),!_&&U){S=C;break}k++}return S||g},HS=e=>{var t=Yt(e)?[]:e.toString().split(gO);return[{words:t,width:void 0}]},GH=e=>{var t=e.width,r=e.scaleToFit,n=e.children,a=e.style,o=e.breakAll,c=e.maxLines;if((t||r)&&!rc.isSsr){var l,f,h=vO({breakAll:o,children:n,style:a});if(h){var p=h.wordsWithComputedWidth,g=h.spaceWidth;l=p,f=g}else return HS(n);return KH({breakAll:o,children:n,maxLines:c,style:a},l,f,t,!!r)}return HS(n)},wO="#808080",VH={angle:0,breakAll:!1,capHeight:"0.71em",fill:wO,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},V0=v.forwardRef((e,t)=>{var r=nn(e,VH),n=r.x,a=r.y,o=r.lineHeight,c=r.capHeight,l=r.fill,f=r.scaleToFit,h=r.textAnchor,p=r.verticalAnchor,g=FS(r,RH),x=v.useMemo(()=>GH({breakAll:g.breakAll,children:g.children,maxLines:g.maxLines,scaleToFit:f,style:g.style,width:g.width}),[g.breakAll,g.children,g.maxLines,f,g.style,g.width]),b=g.dx,j=g.dy,k=g.angle,S=g.className,N=g.breakAll,E=FS(g,$H);if(!Wn(n)||!Wn(a)||x.length===0)return null;var O=Number(n)+(Ne(b)?b:0),P=Number(a)+(Ne(j)?j:0);if(!He(O)||!He(P))return null;var _;switch(p){case"start":_=Cg("calc(".concat(c,")"));break;case"middle":_=Cg("calc(".concat((x.length-1)/2," * -").concat(o," + (").concat(c," / 2))"));break;default:_=Cg("calc(".concat(x.length-1," * -").concat(o,")"));break}var C=[],I=x[0];if(f&&I!=null){var B=I.width,U=g.width;C.push("scale(".concat(Ne(U)&&Ne(B)?U/B:1,")"))}return k&&C.push("rotate(".concat(k,", ").concat(O,", ").concat(P,")")),C.length&&(E.transform=C.join(" ")),v.createElement("text",ey({},en(E),{ref:t,x:O,y:P,className:nt("recharts-text",S),textAnchor:h,fill:l.includes("url")?wO:l}),x.map((G,X)=>{var $=G.words.join(N?"":" ");return v.createElement("tspan",{x:O,dy:X===0?_:o,key:"".concat($,"-").concat(X)},$)}))});V0.displayName="Text";function KS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Mn(e){for(var t=1;t{var t=e.viewBox,r=e.position,n=e.offset,a=n===void 0?0:n,o=e.parentViewBox,c=By(t),l=c.x,f=c.y,h=c.height,p=c.upperWidth,g=c.lowerWidth,x=l,b=l+(p-g)/2,j=(x+b)/2,k=(p+g)/2,S=x+p/2,N=h>=0?1:-1,E=N*a,O=N>0?"end":"start",P=N>0?"start":"end",_=p>=0?1:-1,C=_*a,I=_>0?"end":"start",B=_>0?"start":"end",U=o;if(r==="top"){var G={x:x+p/2,y:f-E,horizontalAnchor:"middle",verticalAnchor:O};return U&&(G.height=Math.max(f-U.y,0),G.width=p),G}if(r==="bottom"){var X={x:b+g/2,y:f+h+E,horizontalAnchor:"middle",verticalAnchor:P};return U&&(X.height=Math.max(U.y+U.height-(f+h),0),X.width=g),X}if(r==="left"){var $={x:j-C,y:f+h/2,horizontalAnchor:I,verticalAnchor:"middle"};return U&&($.width=Math.max($.x-U.x,0),$.height=h),$}if(r==="right"){var fe={x:j+k+C,y:f+h/2,horizontalAnchor:B,verticalAnchor:"middle"};return U&&(fe.width=Math.max(U.x+U.width-fe.x,0),fe.height=h),fe}var J=U?{width:k,height:h}:{};return r==="insideLeft"?Mn({x:j+C,y:f+h/2,horizontalAnchor:B,verticalAnchor:"middle"},J):r==="insideRight"?Mn({x:j+k-C,y:f+h/2,horizontalAnchor:I,verticalAnchor:"middle"},J):r==="insideTop"?Mn({x:x+p/2,y:f+E,horizontalAnchor:"middle",verticalAnchor:P},J):r==="insideBottom"?Mn({x:b+g/2,y:f+h-E,horizontalAnchor:"middle",verticalAnchor:O},J):r==="insideTopLeft"?Mn({x:x+C,y:f+E,horizontalAnchor:B,verticalAnchor:P},J):r==="insideTopRight"?Mn({x:x+p-C,y:f+E,horizontalAnchor:I,verticalAnchor:P},J):r==="insideBottomLeft"?Mn({x:b+C,y:f+h-E,horizontalAnchor:B,verticalAnchor:O},J):r==="insideBottomRight"?Mn({x:b+g-C,y:f+h-E,horizontalAnchor:I,verticalAnchor:O},J):r&&typeof r=="object"&&(Ne(r.x)||go(r.x))&&(Ne(r.y)||go(r.y))?Mn({x:l+wa(r.x,k),y:f+wa(r.y,h),horizontalAnchor:"end",verticalAnchor:"end"},J):Mn({x:S,y:f+h/2,horizontalAnchor:"middle",verticalAnchor:"middle"},J)},ZH=["labelRef"],JH=["content"];function GS(e,t){if(e==null)return{};var r,n,a=eK(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n{var t=e.x,r=e.y,n=e.upperWidth,a=e.lowerWidth,o=e.width,c=e.height,l=e.children,f=v.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:a,width:o,height:c}),[t,r,n,a,o,c]);return v.createElement(kO.Provider,{value:f},l)},jO=()=>{var e=v.useContext(kO),t=_h();return e||(t?By(t):void 0)},aK=v.createContext(null),oK=()=>{var e=v.useContext(aK),t=Me(fP);return e||t},sK=e=>{var t=e.value,r=e.formatter,n=Yt(e.children)?t:e.children;return typeof r=="function"?r(n):n},q0=e=>e!=null&&typeof e=="function",lK=(e,t)=>{var r=Xr(t-e),n=Math.min(Math.abs(t-e),360);return r*n},uK=(e,t,r,n,a)=>{var o=e.offset,c=e.className,l=a.cx,f=a.cy,h=a.innerRadius,p=a.outerRadius,g=a.startAngle,x=a.endAngle,b=a.clockWise,j=(h+p)/2,k=lK(g,x),S=k>=0?1:-1,N,E;switch(t){case"insideStart":N=g+S*o,E=b;break;case"insideEnd":N=x-S*o,E=!b;break;case"end":N=x+S*o,E=b;break;default:throw new Error("Unsupported position ".concat(t))}E=k<=0?E:!E;var O=Qt(l,f,j,N),P=Qt(l,f,j,N+(E?1:-1)*359),_="M".concat(O.x,",").concat(O.y,` - A`).concat(j,",").concat(j,",0,1,").concat(E?0:1,`, - `).concat(P.x,",").concat(P.y),C=Yt(e.id)?Au("recharts-radial-line-"):e.id;return v.createElement("text",ci({},n,{dominantBaseline:"central",className:nt("recharts-radial-bar-label",c)}),v.createElement("defs",null,v.createElement("path",{id:C,d:_})),v.createElement("textPath",{xlinkHref:"#".concat(C)},r))},cK=(e,t,r)=>{var n=e.cx,a=e.cy,o=e.innerRadius,c=e.outerRadius,l=e.startAngle,f=e.endAngle,h=(l+f)/2;if(r==="outside"){var p=Qt(n,a,c+t,h),g=p.x,x=p.y;return{x:g,y:x,textAnchor:g>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"end"};var b=(o+c)/2,j=Qt(n,a,b,h),k=j.x,S=j.y;return{x:k,y:S,textAnchor:"middle",verticalAnchor:"middle"}},nf=e=>e!=null&&"cx"in e&&Ne(e.cx),dK={angle:0,offset:5,zIndex:hr.label,position:"middle",textBreakAll:!1};function fK(e){if(!nf(e))return e;var t=e.cx,r=e.cy,n=e.outerRadius,a=n*2;return{x:t-n,y:r-n,width:a,upperWidth:a,lowerWidth:a,height:a}}function aa(e){var t=nn(e,dK),r=t.viewBox,n=t.parentViewBox,a=t.position,o=t.value,c=t.children,l=t.content,f=t.className,h=f===void 0?"":f,p=t.textBreakAll,g=t.labelRef,x=oK(),b=jO(),j=a==="center"?b:x??b,k,S,N;r==null?k=j:nf(r)?k=r:k=By(r);var E=fK(k);if(!k||Yt(o)&&Yt(c)&&!v.isValidElement(l)&&typeof l!="function")return null;var O=pu(pu({},t),{},{viewBox:k});if(v.isValidElement(l)){O.labelRef;var P=GS(O,ZH);return v.cloneElement(l,P)}if(typeof l=="function"){O.content;var _=GS(O,JH);if(S=v.createElement(l,_),v.isValidElement(S))return S}else S=sK(t);var C=en(t);if(nf(k)){if(a==="insideStart"||a==="insideEnd"||a==="end")return uK(t,a,S,C,k);N=cK(k,t.offset,t.position)}else{if(!E)return null;var I=XH({viewBox:E,position:a,offset:t.offset,parentViewBox:nf(n)?void 0:n});N=pu(pu({x:I.x,y:I.y,textAnchor:I.horizontalAnchor,verticalAnchor:I.verticalAnchor},I.width!==void 0?{width:I.width}:{}),I.height!==void 0?{height:I.height}:{})}return v.createElement(Ci,{zIndex:t.zIndex},v.createElement(V0,ci({ref:g,className:nt("recharts-label",h)},C,N,{textAnchor:yO(C.textAnchor)?C.textAnchor:N.textAnchor,breakAll:p}),S))}aa.displayName="Label";var hK=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?v.createElement(aa,ci({key:"label-implicit"},n)):Wn(e)?v.createElement(aa,ci({key:"label-implicit",value:e},n)):v.isValidElement(e)?e.type===aa?v.cloneElement(e,pu({key:"label-implicit"},n)):v.createElement(aa,ci({key:"label-implicit",content:e},n)):q0(e)?v.createElement(aa,ci({key:"label-implicit",content:e},n)):e&&typeof e=="object"?v.createElement(aa,ci({},e,{key:"label-implicit"},n)):null};function pK(e){var t=e.label,r=e.labelRef,n=jO();return hK(t,n,r)||null}var mK=["valueAccessor"],gK=["dataKey","clockWise","id","textBreakAll","zIndex"];function Yf(){return Yf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=Array.isArray(e.value)?e.value[e.value.length-1]:e.value;if(WH(t))return t},SO=v.createContext(void 0),xK=SO.Provider,NO=v.createContext(void 0);NO.Provider;function bK(){return v.useContext(SO)}function wK(){return v.useContext(NO)}function af(e){var t=e.valueAccessor,r=t===void 0?yK:t,n=qS(e,mK),a=n.dataKey;n.clockWise;var o=n.id,c=n.textBreakAll,l=n.zIndex,f=qS(n,gK),h=bK(),p=wK(),g=h||p;return!g||!g.length?null:v.createElement(Ci,{zIndex:l??hr.label},v.createElement(tn,{className:"recharts-label-list"},g.map((x,b)=>{var j,k=Yt(a)?r(x,b):zt(x.payload,a),S=Yt(o)?{}:{id:"".concat(o,"-").concat(b)};return v.createElement(aa,Yf({key:"label-".concat(b)},en(x),f,S,{fill:(j=n.fill)!==null&&j!==void 0?j:x.fill,parentViewBox:x.parentViewBox,value:k,textBreakAll:c,viewBox:x.viewBox,index:b,zIndex:0}))})))}af.displayName="LabelList";function kK(e){var t=e.label;return t?t===!0?v.createElement(af,{key:"labelList-implicit"}):v.isValidElement(t)||q0(t)?v.createElement(af,{key:"labelList-implicit",content:t}):typeof t=="object"?v.createElement(af,Yf({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}function ty(){return ty=Object.assign?Object.assign.bind():function(e){for(var t=1;t{var t=e.cx,r=e.cy,n=e.r,a=e.className,o=nt("recharts-dot",a);return Ne(t)&&Ne(r)&&Ne(n)?v.createElement("circle",ty({},bn(e),_y(e),{className:o,cx:t,cy:r,r:n})):null},jK={radiusAxis:{},angleAxis:{}},AO=lr({name:"polarAxis",initialState:jK,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),ep=AO.actions;ep.addRadiusAxis;ep.removeRadiusAxis;ep.addAngleAxis;ep.removeAngleAxis;var SK=AO.reducer;function NK(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var PO=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0;function QS(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function YS(e){for(var t=1;t{n||(a.current===null?r(H7(t)):a.current!==t&&r(K7({prev:a.current,next:t})),a.current=t)},[t,r,n]),v.useLayoutEffect(()=>()=>{a.current&&(r(G7(a.current)),a.current=null)},[r]),null}function DK(e){var t=e.legendPayload,r=Et(),n=Ar(),a=v.useRef(null);return v.useLayoutEffect(()=>{n||(a.current===null?r(yz(t)):a.current!==t&&r(xz({prev:a.current,next:t})),a.current=t)},[r,n,t]),v.useLayoutEffect(()=>()=>{a.current&&(r(bz(a.current)),a.current=null)},[r]),null}function RK(e,t){return FK(e)||zK(e,t)||LK(e,t)||$K()}function $K(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LK(e,t){if(e){if(typeof e=="string")return XS(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?XS(e,t):void 0}}function XS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r2&&arguments[2]!==void 0?arguments[2]:[],n=[];for(var a of r)n.push({status:"removed",prev:a});for(var o=0;oe[Math.floor(o*r)]);return Y0(n,t)}function WK(e,t){var r=t.map((n,a)=>e[a]);return Y0(r,t)}function HK(e,t){for(var r=new Map,n=0;n{var b=r(g,x);if(b!=null){var j=n.get(b);if(j!==void 0)return a.add(b),j}}),c=[];for(var l of n){var f=RK(l,2),h=f[0],p=f[1];a.has(h)||c.push(p)}return Y0(o,t,c)}function ry(e,t,r){return t==null?null:e==null?t.map(n=>({status:"added",next:n})):r===Q0?UK(e,t):r===BK?WK(e,t):KK(e,t,r)}function OO(e,t){var r=v.useRef(e),n=v.useRef(t.current),a=v.useRef(!0);r.current!==e&&(r.current=e,n.current=t.current,a.current=!1);var o=v.useCallback(function(c,l){var f=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(l===0){a.current=!0;return}l===1&&(n.current=c),l>0&&a.current&&f&&(t.current=c)},[t]);return{startValue:n.current,syncStepValue:o}}function GK(e,t){return YK(e)||QK(e,t)||qK(e,t)||VK()}function VK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qK(e,t){if(e){if(typeof e=="string")return ZS(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ZS(e,t):void 0}}function ZS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{typeof e=="function"&&e(),o(!0)},[e]),l=v.useCallback(()=>{typeof t=="function"&&t(),o(!1)},[t]);return{isAnimating:a,handleAnimationStart:c,handleAnimationEnd:l}}function ZK(e){var t,r=e.animationInput,n=e.animationIdPrefix,a=e.items,o=e.previousItemsRef,c=e.isAnimationActive,l=e.animationBegin,f=e.animationDuration,h=e.animationEasing,p=e.onAnimationStart,g=e.onAnimationEnd,x=e.animationInterpolateFn,b=e.animationMatchBy,j=e.shouldUpdatePreviousRef,k=e.children,S=e.layout,N=KA(r,n),E=OO(N,o),O=(t=E.startValue)!==null&&t!==void 0?t:null,P=ry(O,a,b??Q0);return v.createElement(HA,{animationId:N,begin:l,duration:f,isActive:c,easing:h,onAnimationEnd:g,onAnimationStart:p,key:N},_=>{var C=O==null,I=a==null?a:x(P,_,S),B=j?j(_):_>0;return E.syncStepValue(I,_,B),I==null?null:k(I,_,C)})}var Og;function JK(e,t){return nG(e)||rG(e,t)||tG(e,t)||eG()}function eG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tG(e,t){if(e){if(typeof e=="string")return JS(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?JS(e,t):void 0}}function JS(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{var e=v.useState(()=>Au("uid-")),t=JK(e,1),r=t[0];return r},_O=(Og=ih.useId)!==null&&Og!==void 0?Og:iG;function aG(e,t){var r=_O();return t||(e?"".concat(e,"-").concat(r):r)}var oG=v.createContext(void 0),sG=e=>{var t=e.id,r=e.type,n=e.children,a=aG("recharts-".concat(r),t);return v.createElement(oG.Provider,{value:a},n(a))},lG={cartesianItems:[],polarItems:[]},MO=lr({name:"graphicalItems",initialState:lG,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:st()},replaceCartesianGraphicalItem:{reducer(e,t){var r=t.payload,n=r.prev,a=r.next,o=Zr(e).cartesianItems.indexOf(n);o>-1&&(e.cartesianItems[o]=a)},prepare:st()},removeCartesianGraphicalItem:{reducer(e,t){var r=Zr(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:st()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:st()},removePolarGraphicalItem:{reducer(e,t){var r=Zr(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:st()},replacePolarGraphicalItem:{reducer(e,t){var r=t.payload,n=r.prev,a=r.next,o=Zr(e).polarItems.indexOf(n);o>-1&&(e.polarItems[o]=a)},prepare:st()}}}),al=MO.actions,uG=al.addCartesianGraphicalItem,cG=al.replaceCartesianGraphicalItem,dG=al.removeCartesianGraphicalItem;al.addPolarGraphicalItem;al.removePolarGraphicalItem;al.replacePolarGraphicalItem;var fG=MO.reducer,hG=e=>{var t=Et(),r=v.useRef(null);return v.useLayoutEffect(()=>{r.current===null?t(uG(e)):r.current!==e&&t(cG({prev:r.current,next:e})),r.current=e},[t,e]),v.useLayoutEffect(()=>()=>{r.current&&(t(dG(r.current)),r.current=null)},[t]),null},pG=v.memo(hG),mG=["points"];function e2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function _g(e){for(var t=1;t{var N,E,O=_g(_g(_g({r:3},c),x),{},{index:S,cx:(N=k.x)!==null&&N!==void 0?N:void 0,cy:(E=k.y)!==null&&E!==void 0?E:void 0,dataKey:o,value:k.value,payload:k.payload,points:t});return v.createElement(wG,{key:"dot-".concat(S),option:r,dotProps:O,className:a})}),j={};return l&&f!=null&&(j.clipPath="url(#clipPath-".concat(g?"":"dots-").concat(f,")")),v.createElement(Ci,{zIndex:p},v.createElement(tn,Xf({className:n},j),b))}function t2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function r2(e){for(var t=1;t({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),$G=K([RG,ji,Si],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),X0=()=>Me($G),LG=()=>Me(HU);function n2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Mg(e){for(var t=1;t{var t=e.point,r=e.childIndex,n=e.mainColor,a=e.activeDot,o=e.dataKey,c=e.clipPath;if(a===!1||t.x==null||t.y==null)return null;var l={index:r,dataKey:o,cx:t.x,cy:t.y,r:4,fill:n??"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value},f=Mg(Mg(Mg({},l),hh(a)),_y(a)),h;return v.isValidElement(a)?h=v.cloneElement(a,f):typeof a=="function"?h=a(f):h=v.createElement(EO,f),v.createElement(tn,{className:"recharts-active-dot",clipPath:c},h)};function i2(e){var t=e.points,r=e.mainColor,n=e.activeDot,a=e.itemDataKey,o=e.clipPath,c=e.zIndex,l=c===void 0?hr.activeDot:c,f=Me(Fu),h=LG();if(t==null||h==null)return null;var p=t.find(g=>h.includes(g.payload));return Yt(p)?null:v.createElement(Ci,{zIndex:l},v.createElement(UG,{point:p,childIndex:Number(f),mainColor:r,dataKey:a,activeDot:n,clipPath:o}))}var WG=e=>{var t=e.chartData,r=Et(),n=Ar();return v.useEffect(()=>n?()=>{}:(r(ES(t)),()=>{r(ES(void 0))}),[t,r,n]),null},a2={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},DO=lr({name:"brush",initialState:a2,reducers:{setBrushSettings(e,t){return t.payload==null?a2:t.payload}}});DO.actions.setBrushSettings;var HG=DO.reducer;function KG(e){return(e%180+180)%180}var GG=function(t){var r=t.width,n=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=KG(a),c=o*Math.PI/180,l=Math.atan(n/r),f=c>l&&c{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=Zr(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=Zr(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=Zr(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),ol=RO.actions;ol.addDot;ol.removeDot;ol.addArea;ol.removeArea;ol.addLine;ol.removeLine;var qG=RO.reducer;function QG(e,t){return JG(e)||ZG(e,t)||XG(e,t)||YG()}function YG(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XG(e,t){if(e){if(typeof e=="string")return o2(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o2(e,t):void 0}}function o2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{var t=e.children,r=v.useState("".concat(Au("recharts"),"-clip")),n=QG(r,1),a=n[0],o=X0();if(o==null)return null;var c=o.x,l=o.y,f=o.width,h=o.height;return v.createElement(eV.Provider,{value:a},v.createElement("defs",null,v.createElement("clipPath",{id:a},v.createElement("rect",{x:c,y:l,height:h,width:f}))),t)};function $O(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;ne*a)return!1;var o=r();return e*(t-e*o/2-n)>=0&&e*(t+e*o/2-a)<=0}function iV(e,t){return $O(e,t+1)}function aV(e,t,r,n,a){for(var o=(n||[]).slice(),c=t.start,l=t.end,f=0,h=1,p=c,g=function(){var j=n==null?void 0:n[f];if(j===void 0)return{v:$O(n,h)};var k=f,S,N=()=>(S===void 0&&(S=r(j,k)),S),E=j.coordinate,O=f===0||Uu(e,E,N,p,l);O||(f=0,p=c,h+=1),O&&(p=E+e*(N()/2+a),f+=h)},x;h<=o.length;)if(x=g(),x)return x.v;return[]}function oV(e,t,r,n,a){var o=(n||[]).slice(),c=o.length;if(c===0)return[];for(var l=t.start,f=t.end,h=1;h<=c;h++){for(var p=(c-1)%h,g=l,x=!0,b=function(){var P=n[k];if(P==null)return 0;var _=k,C,I=()=>(C===void 0&&(C=r(P,_)),C),B=P.coordinate,U=k===p||Uu(e,B,I,g,f);if(!U)return x=!1,1;U&&(g=B+e*(I()/2+a))},j,k=p;k(k===void 0&&(k=r(b,x)),k);if(x===c-1){var N=e*(j.coordinate+e*S()/2-f);o[x]=j=ar(ar({},j),{},{tickCoord:N>0?j.coordinate-N*e:j.coordinate})}else o[x]=j=ar(ar({},j),{},{tickCoord:j.coordinate});if(j.tickCoord!=null){var E=Uu(e,j.tickCoord,S,l,f);E&&(f=j.tickCoord-e*(S()/2+a),o[x]=ar(ar({},j),{},{isShow:!0}))}},p=c-1;p>=0;p--)h(p);return o}function dV(e,t,r,n,a,o){var c=(n||[]).slice(),l=c.length,f=t.start,h=t.end;if(o){var p=n[l-1];if(p!=null){var g=r(p,l-1),x=e*(p.coordinate+e*g/2-h);if(c[l-1]=p=ar(ar({},p),{},{tickCoord:x>0?p.coordinate-x*e:p.coordinate}),p.tickCoord!=null){var b=Uu(e,p.tickCoord,()=>g,f,h);b&&(h=p.tickCoord-e*(g/2+a),c[l-1]=ar(ar({},p),{},{isShow:!0}))}}}for(var j=o?l-1:l,k=function(E){var O=c[E];if(O==null)return 1;var P=O,_,C=()=>(_===void 0&&(_=r(O,E)),_);if(E===0){var I=e*(P.coordinate-e*C()/2-f);c[E]=P=ar(ar({},P),{},{tickCoord:I<0?P.coordinate-I*e:P.coordinate})}else c[E]=P=ar(ar({},P),{},{tickCoord:P.coordinate});if(P.tickCoord!=null){var B=Uu(e,P.tickCoord,C,f,h);B&&(f=P.tickCoord+e*(C()/2+a),c[E]=ar(ar({},P),{},{isShow:!0}))}},S=0;S{var I=typeof h=="function"?h(_.value,C):_.value;return j==="width"?rV(vu(I,{fontSize:t,letterSpacing:r}),k,g):vu(I,{fontSize:t,letterSpacing:r})[j]},N=a[0],E=a[1],O=a.length>=2&&N!=null&&E!=null?Xr(E.coordinate-N.coordinate):1,P=nV(o,O,j);return f==="equidistantPreserveStart"?aV(O,P,S,a,c):f==="equidistantPreserveEnd"?oV(O,P,S,a,c):(f==="preserveStart"||f==="preserveStartEnd"?b=dV(O,P,S,a,c,f==="preserveStartEnd"):b=cV(O,P,S,a,c),b.filter(_=>_.isShow))}var fV=e=>{var t=e.ticks,r=e.label,n=e.labelGapWithTick,a=n,o=e.tickSize,c=o===void 0?0:o,l=e.tickMargin,f=l===void 0?0:l,h=0;if(t){Array.from(t).forEach(b=>{if(b){var j=b.getBoundingClientRect();j.width>h&&(h=j.width)}});var p=r?r.getBoundingClientRect().width:0,g=c+f,x=h+g+p+(r?a:0);return Math.round(x)}return 0},hV={xAxis:{},yAxis:{}},LO=lr({name:"renderedTicks",initialState:hV,reducers:{setRenderedTicks:(e,t)=>{var r=t.payload,n=r.axisType,a=r.axisId,o=r.ticks;e[n][a]=o},removeRenderedTicks:(e,t)=>{var r=t.payload,n=r.axisType,a=r.axisId;delete e[n][a]}}}),zO=LO.actions,pV=zO.setRenderedTicks,mV=zO.removeRenderedTicks,gV=LO.reducer,vV=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function l2(e,t){return wV(e)||bV(e,t)||xV(e,t)||yV()}function yV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xV(e,t){if(e){if(typeof e=="string")return u2(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u2(e,t):void 0}}function u2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{if(n==null||r==null)return Qs;var o=t.map(c=>({value:c.value,coordinate:c.coordinate,offset:c.offset,index:c.index}));return a(pV({ticks:o,axisId:n,axisType:r})),()=>{a(mV({axisId:n,axisType:r}))}},[a,t,n,r]),null}var IV=v.forwardRef((e,t)=>{var r=e.ticks,n=r===void 0?[]:r,a=e.tick,o=e.tickLine,c=e.stroke,l=e.tickFormatter,f=e.unit,h=e.padding,p=e.tickTextProps,g=e.orientation,x=e.mirror,b=e.x,j=e.y,k=e.width,S=e.height,N=e.tickSize,E=e.tickMargin,O=e.fontSize,P=e.letterSpacing,_=e.getTicksConfig,C=e.events,I=e.axisType,B=e.axisId,U=Z0(vt(vt({},_),{},{ticks:n}),O,P),G=bn(_),X=hh(a),$=yO(G.textAnchor)?G.textAnchor:CV(g,x),fe=OV(g,x),J={};typeof o=="object"&&(J=o);var pe=vt(vt({},G),{},{fill:"none"},J),be=U.map(V=>vt({entry:V},PV(V,b,j,k,S,g,N,x,E))),de=be.map(V=>{var Q=V.entry,D=V.line;return v.createElement(tn,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Q.value,"-").concat(Q.coordinate,"-").concat(Q.tickCoord)},o&&v.createElement("line",ko({},pe,D,{className:nt("recharts-cartesian-axis-tick-line",Eo(o,"className"))})))}),Y=be.map((V,Q)=>{var D,T,Z=V.entry,oe=V.tick,re=vt(vt(vt(vt({verticalAnchor:fe},G),{},{textAnchor:$,stroke:"none",fill:c},oe),{},{index:Q,payload:Z,visibleTicksCount:U.length,tickFormatter:l,padding:h},p),{},{angle:(D=(T=p==null?void 0:p.angle)!==null&&T!==void 0?T:G.angle)!==null&&D!==void 0?D:0}),ue=vt(vt({},re),X);return v.createElement(tn,ko({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(Z.value,"-").concat(Z.coordinate,"-").concat(Z.tickCoord)},$D(C,Z,Q)),a&&v.createElement(_V,{option:a,tickProps:ue,value:"".concat(typeof l=="function"?l(Z.value,Q):Z.value).concat(f||"")}))});return v.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(I,"-ticks")},v.createElement(MV,{ticks:U,axisId:B,axisType:I}),Y.length>0&&v.createElement(Ci,{zIndex:hr.label},v.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(I,"-tick-labels"),ref:t},Y)),de.length>0&&v.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(I,"-tick-lines")},de))}),TV=v.forwardRef((e,t)=>{var r=e.axisLine,n=e.width,a=e.height,o=e.className,c=e.hide,l=e.ticks,f=e.axisType,h=e.axisId,p=kV(e,vV),g=v.useState(""),x=l2(g,2),b=x[0],j=x[1],k=v.useState(""),S=l2(k,2),N=S[0],E=S[1],O=v.useRef(null);v.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var _;return fV({ticks:O.current,label:(_=e.labelRef)===null||_===void 0?void 0:_.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var P=v.useCallback(_=>{if(_){var C=_.getElementsByClassName("recharts-cartesian-axis-tick-value");O.current=C;var I=C[0];if(I){var B=window.getComputedStyle(I),U=B.fontSize,G=B.letterSpacing;(U!==b||G!==N)&&(j(U),E(G))}}},[b,N]);return c||n!=null&&n<=0||a!=null&&a<=0?null:v.createElement(Ci,{zIndex:e.zIndex},v.createElement(tn,{className:nt("recharts-cartesian-axis",o)},v.createElement(AV,{x:e.x,y:e.y,width:n,height:a,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:bn(e)}),v.createElement(IV,{ref:P,axisType:f,events:p,fontSize:b,getTicksConfig:e,height:e.height,letterSpacing:N,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:h}),v.createElement(iK,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},v.createElement(pK,{label:e.label,labelRef:e.labelRef}),e.children)))}),J0=v.forwardRef((e,t)=>{var r=nn(e,vi);return v.createElement(TV,ko({},r,{ref:t}))});J0.displayName="CartesianAxis";var DV=["x1","y1","x2","y2","key"],RV=["offset"],$V=["xAxisId","yAxisId"],LV=["xAxisId","yAxisId"];function d2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function or(e){for(var t=1;t{var t=e.fill;if(!t||t==="none")return null;var r=e.fillOpacity,n=e.x,a=e.y,o=e.width,c=e.height,l=e.ry;return v.createElement("rect",{x:n,y:a,ry:l,width:o,height:c,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function FO(e){var t=e.option,r=e.lineItemProps,n;if(v.isValidElement(t))n=v.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var a,o=r.x1,c=r.y1,l=r.x2,f=r.y2,h=r.key,p=Zf(r,DV),g=(a=bn(p))!==null&&a!==void 0?a:{};g.offset;var x=Zf(g,RV);n=v.createElement("line",Ja({},x,{x1:o,y1:c,x2:l,y2:f,fill:"none",key:h}))}return n}function HV(e){var t=e.x,r=e.width,n=e.horizontal,a=n===void 0?!0:n,o=e.horizontalPoints;if(!a||!o||!o.length)return null;e.xAxisId,e.yAxisId;var c=Zf(e,$V),l=o.map((f,h)=>{var p=or(or({},c),{},{x1:t,y1:f,x2:t+r,y2:f,key:"line-".concat(h),index:h});return v.createElement(FO,{key:"line-".concat(h),option:a,lineItemProps:p})});return v.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function KV(e){var t=e.y,r=e.height,n=e.vertical,a=n===void 0?!0:n,o=e.verticalPoints;if(!a||!o||!o.length)return null;e.xAxisId,e.yAxisId;var c=Zf(e,LV),l=o.map((f,h)=>{var p=or(or({},c),{},{x1:f,y1:t,x2:f,y2:t+r,key:"line-".concat(h),index:h});return v.createElement(FO,{option:a,lineItemProps:p,key:"line-".concat(h)})});return v.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function GV(e){var t=e.horizontalFill,r=e.fillOpacity,n=e.x,a=e.y,o=e.width,c=e.height,l=e.horizontalPoints,f=e.horizontal,h=f===void 0?!0:f;if(!h||!t||!t.length||l==null)return null;var p=l.map(x=>Math.round(x+a-a)).sort((x,b)=>x-b);a!==p[0]&&p.unshift(0);var g=p.map((x,b)=>{var j=p[b+1],k=j==null,S=k?a+c-x:j-x;if(S<=0)return null;var N=b%t.length;return v.createElement("rect",{key:"react-".concat(b),y:x,x:n,height:S,width:o,stroke:"none",fill:t[N],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return v.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},g)}function VV(e){var t=e.vertical,r=t===void 0?!0:t,n=e.verticalFill,a=e.fillOpacity,o=e.x,c=e.y,l=e.width,f=e.height,h=e.verticalPoints;if(!r||!n||!n.length)return null;var p=h.map(x=>Math.round(x+o-o)).sort((x,b)=>x-b);o!==p[0]&&p.unshift(0);var g=p.map((x,b)=>{var j=p[b+1],k=j==null,S=k?o+l-x:j-x;if(S<=0)return null;var N=b%n.length;return v.createElement("rect",{key:"react-".concat(b),x,y:c,width:S,height:f,stroke:"none",fill:n[N],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return v.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},g)}var qV=(e,t)=>{var r=e.xAxis,n=e.width,a=e.height,o=e.offset;return bA(Z0(or(or(or({},vi),r),{},{ticks:wA(r),viewBox:{x:0,y:0,width:n,height:a}})),o.left,o.left+o.width,t)},QV=(e,t)=>{var r=e.yAxis,n=e.width,a=e.height,o=e.offset;return bA(Z0(or(or(or({},vi),r),{},{ticks:wA(r),viewBox:{x:0,y:0,width:n,height:a}})),o.top,o.top+o.height,t)},YV={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:hr.grid};function BO(e){var t=CA(),r=OA(),n=PA(),a=or(or({},nn(e,YV)),{},{x:Ne(e.x)?e.x:n.left,y:Ne(e.y)?e.y:n.top,width:Ne(e.width)?e.width:n.width,height:Ne(e.height)?e.height:n.height}),o=a.xAxisId,c=a.yAxisId,l=a.x,f=a.y,h=a.width,p=a.height,g=a.syncWithTicks,x=a.horizontalValues,b=a.verticalValues,j=Ar(),k=Me(U=>hS(U,"xAxis",o,j)),S=Me(U=>hS(U,"yAxis",c,j));if(!Hn(h)||!Hn(p)||!Ne(l)||!Ne(f))return null;var N=a.verticalCoordinatesGenerator||qV,E=a.horizontalCoordinatesGenerator||QV,O=a.horizontalPoints,P=a.verticalPoints;if((!O||!O.length)&&typeof E=="function"){var _=x&&x.length,C=E({yAxis:S?or(or({},S),{},{ticks:_?x:S.ticks}):void 0,width:t??h,height:r??p,offset:n},_?!0:g);Sf(Array.isArray(C),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof C,"]")),Array.isArray(C)&&(O=C)}if((!P||!P.length)&&typeof N=="function"){var I=b&&b.length,B=N({xAxis:k?or(or({},k),{},{ticks:I?b:k.ticks}):void 0,width:t??h,height:r??p,offset:n},I?!0:g);Sf(Array.isArray(B),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof B,"]")),Array.isArray(B)&&(P=B)}return v.createElement(Ci,{zIndex:a.zIndex},v.createElement("g",{className:"recharts-cartesian-grid"},v.createElement(WV,{fill:a.fill,fillOpacity:a.fillOpacity,x:a.x,y:a.y,width:a.width,height:a.height,ry:a.ry}),v.createElement(GV,Ja({},a,{horizontalPoints:O})),v.createElement(VV,Ja({},a,{verticalPoints:P})),v.createElement(HV,Ja({},a,{offset:n,horizontalPoints:O,xAxis:k,yAxis:S})),v.createElement(KV,Ja({},a,{offset:n,verticalPoints:P,xAxis:k,yAxis:S}))))}BO.displayName="CartesianGrid";var XV={},UO=lr({name:"errorBars",initialState:XV,reducers:{addErrorBar:(e,t)=>{var r=t.payload,n=r.itemId,a=r.errorBar;e[n]||(e[n]=[]),e[n].push(a)},replaceErrorBar:(e,t)=>{var r=t.payload,n=r.itemId,a=r.prev,o=r.next;e[n]&&(e[n]=e[n].map(c=>c.dataKey===a.dataKey&&c.direction===a.direction?o:c))},removeErrorBar:(e,t)=>{var r=t.payload,n=r.itemId,a=r.errorBar;e[n]&&(e[n]=e[n].filter(o=>o.dataKey!==a.dataKey||o.direction!==a.direction))}}}),ex=UO.actions;ex.addErrorBar;ex.replaceErrorBar;ex.removeErrorBar;var ZV=UO.reducer;function WO(e,t){var r,n,a=Me(h=>Ei(h,e)),o=Me(h=>Ai(h,t)),c=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:Ot.allowDataOverflow,l=(n=o==null?void 0:o.allowDataOverflow)!==null&&n!==void 0?n:_t.allowDataOverflow,f=c||l;return{needClip:f,needClipX:c,needClipY:l}}function JV(e){var t=e.xAxisId,r=e.yAxisId,n=e.clipPathId,a=X0(),o=WO(t,r),c=o.needClipX,l=o.needClipY,f=o.needClip,h=Me(O=>AC(O,t,!1)),p=Me(O=>PC(O,r,!1));if(!f||!a)return null;var g=a.x,x=a.y,b=a.width,j=a.height,k=c&&h?Math.min(h[0],h[1]):g-b/2,S=l&&p?Math.min(p[0],p[1]):x-j/2,N=c&&h?Math.abs(h[1]-h[0]):b*2,E=l&&p?Math.abs(p[1]-p[0]):j*2;return v.createElement("clipPath",{id:"clipPath-".concat(n)},v.createElement("rect",{x:k,y:S,width:N,height:E}))}function eq(e){var t=hh(e),r=3,n=2;if(t!=null){var a=t.r,o=t.strokeWidth,c=Number(a),l=Number(o);return(Number.isNaN(c)||c<0)&&(c=r),(Number.isNaN(l)||l<0)&&(l=n),{r:c,strokeWidth:l}}return{r,strokeWidth:n}}function tx(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(a=>a.id===t))===null||n===void 0?void 0:n.xAxisId)!==null&&r!==void 0?r:IO}function rx(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(a=>a.id===t))===null||n===void 0?void 0:n.yAxisId)!==null&&r!==void 0?r:IO}var HO=(e,t,r)=>RC(e,"xAxis",tx(e,t),r),KO=(e,t,r)=>DC(e,"xAxis",tx(e,t),r),GO=(e,t,r)=>RC(e,"yAxis",rx(e,t),r),VO=(e,t,r)=>DC(e,"yAxis",rx(e,t),r),tq=K([dt,HO,GO,KO,VO],(e,t,r,n,a)=>Vn(e,"xAxis")?jf(t,n,!1):jf(r,a,!1)),rq=(e,t)=>t,qO=K([tC,rq],(e,t)=>e.filter(r=>r.type==="area").find(r=>r.id===t)),QO=e=>{var t=dt(e),r=Vn(t,"xAxis");return r?"yAxis":"xAxis"},nq=(e,t)=>{var r=QO(e);return r==="yAxis"?rx(e,t):tx(e,t)},iq=(e,t,r)=>dC(e,QO(e),nq(e,t),r),aq=K([qO,iq],(e,t)=>{var r;if(!(e==null||t==null)){var n=e.stackId,a=r0(e);if(!(n==null||a==null)){var o=(r=t[n])===null||r===void 0?void 0:r.stackedData,c=o==null?void 0:o.find(l=>l.key===a);if(c!=null)return c.map(l=>[l[0],l[1]])}}}),oq=K([dt,HO,GO,KO,VO,aq,OF,tq,qO,VF],(e,t,r,n,a,o,c,l,f,h)=>{var p=c.chartData,g=c.dataStartIndex,x=c.dataEndIndex;if(!(f==null||e!=="horizontal"&&e!=="vertical"||t==null||r==null||n==null||a==null||n.length===0||a.length===0||l==null)){var b=f.data,j;if(b&&b.length>0?j=b:j=p==null?void 0:p.slice(g,x+1),j!=null)return Mq({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:a,dataStartIndex:g,areaSettings:f,stackedData:o,displayedData:j,chartBaseValue:h,bandSize:l})}}),sq=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],lq=["id","baseLine"];function yu(){return yu=Object.assign?Object.assign.bind():function(e){for(var t=1;tg.y||0));return Ne(a)?p=Math.max(a,p):a&&Array.isArray(a)&&a.length&&(p=Math.max(...a.map(g=>g.y||0),p)),Ne(p)?v.createElement("rect",{x:lg.x||0));return Ne(a)?p=Math.max(a,p):a&&Array.isArray(a)&&a.length&&(p=Math.max(...a.map(g=>g.x||0),p)),Ne(p)?v.createElement("rect",{x:0,y:le==null?[]:t===1?e.flatMap(r=>r.status==="removed"?[]:[r.next]):e.flatMap(r=>r.status==="matched"?[Gs(Gs({},r.next),{},{x:di(r.prev.x,r.next.x,t),y:di(r.prev.y,r.next.y,t)})]:r.status==="added"?[r.next]:[]),XO={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:Q0,animationInterpolateFn:bq,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:hq,xAxisId:0,yAxisId:0,zIndex:hr.area};function eh(e,t){return e&&e!=="none"?e:t}var wq=e=>{var t=e.dataKey,r=e.name,n=e.stroke,a=e.fill,o=e.legendType,c=e.hide;return[{inactive:c,dataKey:t,type:o,color:eh(n,a),value:kA(r,t),payload:e}]},kq=v.memo(e=>{var t=e.dataKey,r=e.data,n=e.stroke,a=e.strokeWidth,o=e.fill,c=e.name,l=e.hide,f=e.unit,h=e.tooltipType,p=e.id,g={dataDefinedOnItem:r,getPosition:Qs,settings:{stroke:n,strokeWidth:a,fill:o,dataKey:t,nameKey:void 0,name:kA(c,t),hide:l,type:h,color:eh(n,o),unit:f,graphicalItemId:p}};return v.createElement(TK,{tooltipEntrySettings:g})});function jq(e){var t=e.clipPathId,r=e.points,n=e.props,a=n.needClip,o=n.dot,c=n.dataKey,l=bn(n);return v.createElement(jG,{points:r,dot:o,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:c,baseProps:l,needClip:a,clipPathId:t})}function Sq(e){var t=e.showLabels,r=e.children,n=e.points,a=n.map(o=>{var c,l,f={x:(c=o.x)!==null&&c!==void 0?c:0,y:(l=o.y)!==null&&l!==void 0?l:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Gs(Gs({},f),{},{value:o.value,payload:o.payload,parentViewBox:void 0,viewBox:f,fill:void 0})});return v.createElement(xK,{value:t?a:void 0},r)}function Nq(e){var t=e.points,r=e.baseLine,n=e.needClip,a=e.clipPathId,o=e.props,c=e.animationElapsedTime,l=e.isAnimating,f=e.isEntrance,h=o.layout,p=o.type,g=o.stroke,x=o.connectNulls,b=o.isRange,j=o.shape,k=o.id,S=YO(o,pq),N=en(S),E=Gs(Gs({},N),{},{id:k,points:t,connectNulls:x,type:p,baseLine:r,layout:h,stroke:g,isRange:b,animationElapsedTime:c,isAnimating:l,isEntrance:f});return v.createElement(v.Fragment,null,(t==null?void 0:t.length)>1&&v.createElement(tn,{clipPath:n?"url(#clipPath-".concat(a,")"):void 0},v.createElement(IK,{option:j,DefaultShape:XO.shape,shapeProps:E})),v.createElement(jq,{points:t,props:S,clipPathId:a}))}function Eq(e,t,r){if(Ne(e)){var n=Ne(t)?t:void 0;return di(n,e,r)}if(Yt(e)||Un(e)){var a=Ne(t)?t:void 0;return di(a,0,r)}return e}function Aq(e){var t=e.needClip,r=e.clipPathId,n=e.props,a=e.previousPointsRef,o=e.previousBaselineRef,c=n.points,l=n.baseLine,f=n.isAnimationActive,h=n.animationBegin,p=n.animationDuration,g=n.animationEasing,x=n.animationMatchBy,b=n.animationInterpolateFn,j=v.useMemo(()=>({points:c,baseLine:l}),[c,l]),k=OO(j,o),S=Uy(),N=XK(n.onAnimationStart,n.onAnimationEnd),E=N.isAnimating,O=N.handleAnimationStart,P=N.handleAnimationEnd,_=k.startValue;if(S==null)return null;var C;return Array.isArray(l)&&Array.isArray(_)?C=ry(_,l,x):Array.isArray(l)?C=ry(null,l,x):C=null,v.createElement(ZK,{animationInput:j,animationIdPrefix:"recharts-area-",items:c,previousItemsRef:a,isAnimationActive:f,animationBegin:h,animationDuration:p,animationEasing:g,onAnimationStart:O,onAnimationEnd:P,animationInterpolateFn:b,animationMatchBy:x,layout:S},(I,B,U)=>{var G;return B===1?G=l:Array.isArray(l)?G=b(C,B,S):G=U?l:Eq(l,_,B),k.syncStepValue(G,B),v.createElement(Sq,{showLabels:!E,points:c},n.children,v.createElement(Nq,{points:I,baseLine:G,needClip:t,clipPathId:r,props:n,animationElapsedTime:B,isAnimating:E||B<1,isEntrance:U}),v.createElement(kK,{label:n.label}))})}function Pq(e){var t=e.needClip,r=e.clipPathId,n=e.props,a=v.useRef(null),o=v.useRef();return v.createElement(Aq,{needClip:t,clipPathId:r,props:n,previousPointsRef:a,previousBaselineRef:o})}class Cq extends v.PureComponent{render(){var t=this.props,r=t.hide,n=t.dot,a=t.points,o=t.className,c=t.top,l=t.left,f=t.needClip,h=t.xAxisId,p=t.yAxisId,g=t.width,x=t.height,b=t.id,j=t.baseLine,k=t.zIndex;if(r)return null;var S=nt("recharts-area",o),N=b,E=eq(n),O=E.r,P=E.strokeWidth,_=PO(n),C=O*2+P,I=f?"url(#clipPath-".concat(_?"":"dots-").concat(N,")"):void 0;return v.createElement(Ci,{zIndex:k},v.createElement(tn,{className:S},f&&v.createElement("defs",null,v.createElement(JV,{clipPathId:N,xAxisId:h,yAxisId:p}),!_&&v.createElement("clipPath",{id:"clipPath-dots-".concat(N)},v.createElement("rect",{x:l-C/2,y:c-C/2,width:g+C,height:x+C}))),v.createElement(Pq,{needClip:f,clipPathId:N,props:this.props})),v.createElement(i2,{points:a,mainColor:eh(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:I}),this.props.isRange&&Array.isArray(j)&&v.createElement(i2,{points:j,mainColor:eh(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:I}))}}function Oq(e){var t,r=e.activeDot,n=e.animationBegin,a=e.animationDuration,o=e.animationEasing,c=e.connectNulls,l=e.dot,f=e.fill,h=e.fillOpacity,p=e.hide,g=e.isAnimationActive,x=e.legendType,b=e.stroke,j=e.xAxisId,k=e.yAxisId,S=YO(e,mq),N=Ys(),E=aO(),O=WO(j,k),P=O.needClip,_=Ar(),C=(t=Me(pe=>oq(pe,e.id,_)))!==null&&t!==void 0?t:{},I=C.points,B=C.isRange,U=C.baseLine,G=X0();if(N!=="horizontal"&&N!=="vertical"||G==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var X=G.height,$=G.width,fe=G.x,J=G.y;return!I||!I.length?null:v.createElement(Cq,Jf({},S,{activeDot:r,animationBegin:n,animationDuration:a,animationEasing:o,baseLine:U,connectNulls:c,dot:l,fill:f,fillOpacity:h,height:X,hide:p,layout:N,isAnimationActive:g,isRange:B,legendType:x,needClip:P,points:I,stroke:b,width:$,left:fe,top:J,xAxisId:j,yAxisId:k}))}var _q=(e,t,r,n,a)=>{var o=r??t;if(Ne(o))return o;var c=e==="horizontal"?a:n,l=c.scale.domain();if(c.type==="number"){var f=Math.max(l[0],l[1]),h=Math.min(l[0],l[1]);return o==="dataMin"?h:o==="dataMax"||f<0?f:Math.max(Math.min(l[0],l[1]),0)}return o==="dataMin"?l[0]:o==="dataMax"?l[1]:l[0]};function Mq(e){var t=e.areaSettings,r=t.connectNulls,n=t.baseValue,a=t.dataKey,o=e.stackedData,c=e.layout,l=e.chartBaseValue,f=e.xAxis,h=e.yAxis,p=e.displayedData,g=e.dataStartIndex,x=e.xAxisTicks,b=e.yAxisTicks,j=e.bandSize,k=o&&o.length,S=_q(c,l,n,f,h),N=c==="horizontal",E=!1,O=p.map((_,C)=>{var I,B,U,G;if(k)G=o[g+C];else{var X=zt(_,a);Array.isArray(X)?(G=X,E=!0):G=[S,X]}var $=(I=(B=G)===null||B===void 0?void 0:B[1])!==null&&I!==void 0?I:null,fe=$==null||k&&!r&&zt(_,a)==null;if(N){var J;return{x:lk({axis:f,ticks:x,bandSize:j,entry:_,index:C}),y:fe?null:(J=h.scale.map($))!==null&&J!==void 0?J:null,value:G,payload:_}}return{x:fe?null:(U=f.scale.map($))!==null&&U!==void 0?U:null,y:lk({axis:h,ticks:b,bandSize:j,entry:_,index:C}),value:G,payload:_}}),P;return k||E?P=O.map(_=>{var C,I=Array.isArray(_.value)?_.value[0]:null;if(N){var B;return{x:_.x,y:I!=null&&_.y!=null&&(B=h.scale.map(I))!==null&&B!==void 0?B:null,payload:_.payload}}return{x:I!=null&&(C=f.scale.map(I))!==null&&C!==void 0?C:null,y:_.y,payload:_.payload}}):P=N?h.scale.map(S):f.scale.map(S),{points:O,baseLine:P??0,isRange:E}}function Iq(e){var t=nn(e,XO),r=Ar();return v.createElement(sG,{id:t.id,type:"area"},n=>v.createElement(v.Fragment,null,v.createElement(DK,{legendPayload:wq(t)}),v.createElement(kq,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:n}),v.createElement(pG,{type:"area",id:n,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:gL(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:r,connectNulls:t.connectNulls}),v.createElement(Oq,Jf({},t,{id:n}))))}var ZO=v.memo(Iq,Dh);ZO.displayName="Area";var Tq=["domain","range"],Dq=["domain","range"];function p2(e,t){if(e==null)return{};var r,n,a=Rq(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n{if(c!=null)return v2(v2({},o),{},{type:c})},[o,c]);return v.useLayoutEffect(()=>{l!=null&&(r.current===null?t(PG(l)):r.current!==l&&t(CG({prev:r.current,next:l})),r.current=l)},[l,t]),v.useLayoutEffect(()=>()=>{r.current&&(t(OG(r.current)),r.current=null)},[t]),null}var Kq=e=>{var t=e.xAxisId,r=e.className,n=Me(SA),a=Ar(),o="xAxis",c=Me(x=>TC(x,o,t,a)),l=Me(x=>N7(x,t)),f=Me(x=>_7(x,t)),h=Me(x=>XP(x,t));if(l==null||f==null||h==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var p=iy(e,Lq);h.id,h.scale;var g=iy(h,zq);return v.createElement(J0,ny({},p,g,{x:f.x,y:f.y,width:l.width,height:l.height,className:nt("recharts-".concat(o," ").concat(o),r),viewBox:n,ticks:c,axisType:o,axisId:t}))},Gq={allowDataOverflow:Ot.allowDataOverflow,allowDecimals:Ot.allowDecimals,allowDuplicatedCategory:Ot.allowDuplicatedCategory,angle:Ot.angle,axisLine:vi.axisLine,height:Ot.height,hide:!1,includeHidden:Ot.includeHidden,interval:Ot.interval,label:!1,minTickGap:Ot.minTickGap,mirror:Ot.mirror,orientation:Ot.orientation,padding:Ot.padding,reversed:Ot.reversed,scale:Ot.scale,tick:Ot.tick,tickCount:Ot.tickCount,tickLine:vi.tickLine,tickSize:vi.tickSize,type:Ot.type,niceTicks:Ot.niceTicks,xAxisId:0},Vq=e=>{var t=nn(e,Gq);return v.createElement(v.Fragment,null,v.createElement(Hq,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),v.createElement(Kq,t))},e_=v.memo(Vq,JO);e_.displayName="XAxis";var qq=["type"],Qq=["dangerouslySetInnerHTML","ticks","scale"],Yq=["id","scale"];function ay(){return ay=Object.assign?Object.assign.bind():function(e){for(var t=1;t{if(c!=null)return x2(x2({},o),{},{type:c})},[c,o]);return v.useLayoutEffect(()=>{l!=null&&(r.current===null?t(_G(l)):r.current!==l&&t(MG({prev:r.current,next:l})),r.current=l)},[l,t]),v.useLayoutEffect(()=>()=>{r.current&&(t(IG(r.current)),r.current=null)},[t]),null}function rQ(e){var t=e.yAxisId,r=e.className,n=e.width,a=e.label,o=v.useRef(null),c=v.useRef(null),l=Me(SA),f=Ar(),h=Et(),p="yAxis",g=Me(N=>T7(N,t)),x=Me(N=>I7(N,t)),b=Me(N=>TC(N,p,t,f)),j=Me(N=>ZP(N,t));if(v.useLayoutEffect(()=>{if(!(n!=="auto"||!g||q0(a)||v.isValidElement(a)||j==null)){var N=o.current;if(N){var E=N.getCalculatedWidth();Math.round(g.width)!==Math.round(E)&&h(TG({id:t,width:E}))}}},[b,g,h,a,t,n,j]),g==null||x==null||j==null)return null;e.dangerouslySetInnerHTML,e.ticks,e.scale;var k=oy(e,Qq);j.id,j.scale;var S=oy(j,Yq);return v.createElement(J0,ay({},k,S,{ref:o,labelRef:c,x:x.x,y:x.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:g.width,height:g.height,className:nt("recharts-".concat(p," ").concat(p),r),viewBox:l,ticks:b,axisType:p,axisId:t}))}var nQ={allowDataOverflow:_t.allowDataOverflow,allowDecimals:_t.allowDecimals,allowDuplicatedCategory:_t.allowDuplicatedCategory,angle:_t.angle,axisLine:vi.axisLine,hide:!1,includeHidden:_t.includeHidden,interval:_t.interval,label:!1,minTickGap:_t.minTickGap,mirror:_t.mirror,orientation:_t.orientation,padding:_t.padding,reversed:_t.reversed,scale:_t.scale,tick:_t.tick,tickCount:_t.tickCount,tickLine:vi.tickLine,tickSize:vi.tickSize,type:_t.type,niceTicks:_t.niceTicks,width:_t.width,yAxisId:0},iQ=e=>{var t=nn(e,nQ);return v.createElement(v.Fragment,null,v.createElement(tQ,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),v.createElement(rQ,t))},t_=v.memo(iQ,JO);t_.displayName="YAxis";var aQ=(e,t)=>t,nx=K([aQ,dt,fP,Bt,JC,Pi,rW,Zt],uW);function oQ(e){return"getBBox"in e.currentTarget&&typeof e.currentTarget.getBBox=="function"}function ix(e){var t=e.currentTarget.getBoundingClientRect(),r,n;if(oQ(e)){var a=e.currentTarget.getBBox();r=a.width>0?t.width/a.width:1,n=a.height>0?t.height/a.height:1}else{var o=e.currentTarget;r=o.offsetWidth>0?t.width/o.offsetWidth:1,n=o.offsetHeight>0?t.height/o.offsetHeight:1}var c=(l,f)=>({relativeX:Math.round((l-t.left)/r),relativeY:Math.round((f-t.top)/n)});return"touches"in e?Array.from(e.touches).map(l=>c(l.clientX,l.clientY)):c(e.clientX,e.clientY)}var r_=Lr("mouseClick"),n_=Xu();n_.startListening({actionCreator:r_,effect:(e,t)=>{var r=e.payload,n=nx(t.getState(),ix(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(Q7({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var sy=Lr("mouseMove"),i_=Xu(),us=null,Fa=null,Ig=null;i_.startListening({actionCreator:sy,effect:(e,t)=>{var r=e.payload,n=t.getState(),a=n.eventSettings,o=a.throttleDelay,c=a.throttledEvents,l=c==="all"||(c==null?void 0:c.includes("mousemove"));us!==null&&(cancelAnimationFrame(us),us=null),Fa!==null&&(typeof o!="number"||!l)&&(clearTimeout(Fa),Fa=null),Ig=ix(r);var f=()=>{var h=t.getState(),p=cc(h,h.tooltip.settings.shared);if(!Ig){us=null,Fa=null;return}if(p==="axis"){var g=nx(h,Ig);(g==null?void 0:g.activeIndex)!=null?t.dispatch(WC({activeIndex:g.activeIndex,activeDataKey:void 0,activeCoordinate:g.activeCoordinate})):t.dispatch(UC())}us=null,Fa=null};if(!l){f();return}o==="raf"?us=requestAnimationFrame(f):typeof o=="number"&&Fa===null&&(Fa=setTimeout(f,o))}});function sQ(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<>":t}var b2={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},a_=lr({name:"rootProps",initialState:b2,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:b2.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),lQ=a_.reducer,uQ=a_.actions.updateOptions,cQ=null,dQ={updatePolarOptions:(e,t)=>e===null?t.payload:(e.startAngle=t.payload.startAngle,e.endAngle=t.payload.endAngle,e.cx=t.payload.cx,e.cy=t.payload.cy,e.innerRadius=t.payload.innerRadius,e.outerRadius=t.payload.outerRadius,e)},o_=lr({name:"polarOptions",initialState:cQ,reducers:dQ});o_.actions.updatePolarOptions;var fQ=o_.reducer,s_=Lr("keyDown"),l_=Lr("focus"),u_=Lr("blur"),tp=Xu(),cs=null,Ba=null,Kd=null;tp.startListening({actionCreator:s_,effect:(e,t)=>{Kd=e.payload,cs!==null&&(cancelAnimationFrame(cs),cs=null);var r=t.getState(),n=r.eventSettings,a=n.throttleDelay,o=n.throttledEvents,c=o==="all"||o.includes("keydown");Ba!==null&&(typeof a!="number"||!c)&&(clearTimeout(Ba),Ba=null);var l=()=>{try{var f=t.getState(),h=f.rootProps.accessibilityLayer!==!1;if(!h)return;var p=f.tooltip.keyboardInteraction,g=Kd;if(g!=="ArrowRight"&&g!=="ArrowLeft"&&g!=="Enter")return;var x=gu(p,wo(f),Hs(f),Ks(f)),b=x==null?-1:Number(x),j=!Number.isFinite(b)||b<0,k=Pi(f),S=wo(f),N=cc(f,f.tooltip.settings.shared);if(g==="Enter"){if(j)return;var E=qf(f,N,"hover",String(p.index));t.dispatch(Vf({active:!p.active,activeIndex:p.index,activeCoordinate:E}));return}var O=z7(f),P=O==="left-to-right"?1:-1,_=g==="ArrowRight"?1:-1,C;if(j){var I=Hs(f),B=Ks(f),U=_*P,G=pe=>({active:!1,index:String(pe),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(C=-1,U>0){for(var X=0;X=0;$--)if(gu(G($),S,I,B)!=null){C=$;break}if(C<0)return}else{C=b+_*P;var fe=(k==null?void 0:k.length)||S.length;if(fe===0||C>=fe||C<0)return}var J=qf(f,N,"hover",String(C));t.dispatch(Vf({active:!0,activeIndex:C.toString(),activeCoordinate:J}))}finally{cs=null,Ba=null}};if(!c){l();return}a==="raf"?cs=requestAnimationFrame(l):typeof a=="number"&&Ba===null&&(l(),Kd=null,Ba=setTimeout(()=>{Kd?l():(Ba=null,cs=null)},a))}});tp.startListening({actionCreator:l_,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var a=r.tooltip.keyboardInteraction;if(!a.active&&a.index==null){var o="0",c=cc(r,r.tooltip.settings.shared),l=qf(r,c,"hover",String(o));t.dispatch(Vf({active:!0,activeIndex:o,activeCoordinate:l}))}}}});tp.startListening({actionCreator:u_,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var a=r.tooltip.keyboardInteraction;a.active&&t.dispatch(Vf({active:!1,activeIndex:a.index,activeCoordinate:a.coordinate}))}}});function c_(e){e.persist();var t=e.currentTarget;return new Proxy(e,{get:(r,n)=>{if(n==="currentTarget")return t;var a=Reflect.get(r,n);return typeof a=="function"?a.bind(r):a}})}var Vr=Lr("externalEvent"),d_=Xu(),Gd=new Map,lu=new Map,Tg=new Map;d_.startListening({actionCreator:Vr,effect:(e,t)=>{var r=e.payload,n=r.handler,a=r.reactEvent;if(n!=null){var o=a.type,c=c_(a);Tg.set(o,{handler:n,reactEvent:c});var l=Gd.get(o);l!==void 0&&(cancelAnimationFrame(l),Gd.delete(o));var f=t.getState(),h=f.eventSettings,p=h.throttleDelay,g=h.throttledEvents,x=g,b=x==="all"||(x==null?void 0:x.includes(o)),j=lu.get(o);j!==void 0&&(typeof p!="number"||!b)&&(clearTimeout(j),lu.delete(o));var k=()=>{var E=Tg.get(o);try{if(!E)return;var O=E.handler,P=E.reactEvent,_=t.getState(),C={activeCoordinate:BU(_),activeDataKey:LU(_),activeIndex:Fu(_),activeLabel:rO(_),activeTooltipIndex:Fu(_),isTooltipActive:UU(_)};O&&O(C,P)}finally{Gd.delete(o),lu.delete(o),Tg.delete(o)}};if(!b){k();return}if(p==="raf"){var S=requestAnimationFrame(k);Gd.set(o,S)}else if(typeof p=="number"){if(!lu.has(o)){k();var N=setTimeout(k,p);lu.set(o,N)}}else k()}}});var hQ=K([il],e=>e.tooltipItemPayloads),pQ=K([hQ,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(o=>o.settings.graphicalItemId===r);if(n!=null){var a=n.getPosition;if(a!=null)return a(t)}}}),f_=Lr("touchMove"),h_=Xu(),Ua=null,ta=null,w2=null,uu=null;h_.startListening({actionCreator:f_,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){uu=c_(r);var n=t.getState(),a=n.eventSettings,o=a.throttleDelay,c=a.throttledEvents,l=c==="all"||c.includes("touchmove");Ua!==null&&(cancelAnimationFrame(Ua),Ua=null),ta!==null&&(typeof o!="number"||!l)&&(clearTimeout(ta),ta=null),w2=Array.from(r.touches).map(h=>ix({clientX:h.clientX,clientY:h.clientY,currentTarget:r.currentTarget}));var f=()=>{if(uu!=null){var h=t.getState(),p=cc(h,h.tooltip.settings.shared);if(p==="axis"){var g,x=(g=w2)===null||g===void 0?void 0:g[0];if(x==null){Ua=null,ta=null;return}var b=nx(h,x);(b==null?void 0:b.activeIndex)!=null&&t.dispatch(WC({activeIndex:b.activeIndex,activeDataKey:void 0,activeCoordinate:b.activeCoordinate}))}else if(p==="item"){var j,k=uu.touches[0];if(document.elementFromPoint==null||k==null)return;var S=document.elementFromPoint(k.clientX,k.clientY);if(!S||!S.getAttribute)return;var N=S.getAttribute(jL),E=(j=S.getAttribute(SL))!==null&&j!==void 0?j:void 0,O=Co(h).find(C=>C.id===E);if(N==null||O==null||E==null)return;var P=O.dataKey,_=pQ(h,N,E);t.dispatch(q7({activeDataKey:P,activeIndex:N,activeCoordinate:_,activeGraphicalItemId:E}))}Ua=null,ta=null}};if(!l){f();return}o==="raf"?Ua=requestAnimationFrame(f):typeof o=="number"&&ta===null&&(f(),uu=null,ta=setTimeout(()=>{uu?f():(ta=null,Ua=null)},o))}}});var p_={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},m_=lr({name:"eventSettings",initialState:p_,reducers:{setEventSettings:(e,t)=>{t.payload.throttleDelay!=null&&(e.throttleDelay=t.payload.throttleDelay),t.payload.throttledEvents!=null&&(e.throttledEvents=t.payload.throttledEvents)}}}),mQ=m_.actions.setEventSettings,gQ=m_.reducer,vQ=KE({brush:HG,cartesianAxis:DG,chartData:FW,errorBars:ZV,eventSettings:gQ,graphicalItems:fG,layout:sL,legend:wz,options:DW,polarAxis:SK,polarOptions:fQ,referenceElements:qG,renderedTicks:gV,rootProps:lQ,tooltip:Y7,zIndex:kW}),yQ=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return M$({reducer:vQ,preloadedState:t,middleware:n=>{var a;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((a="es6")!==null&&a!==void 0?a:"")}).concat([n_.middleware,i_.middleware,tp.middleware,d_.middleware,h_.middleware])},enhancers:n=>{var a=n;return typeof n=="function"&&(a=n()),a.concat(oA({type:"raf"}))},devTools:{serialize:{replacer:sQ},name:"recharts-".concat(r)}})};function xQ(e){var t=e.preloadedState,r=e.children,n=e.reduxStoreName,a=Ar(),o=v.useRef(null);if(a)return r;o.current==null&&(o.current=yQ(t,n));var c=Iy;return v.createElement($z,{context:c,store:o.current},r)}function bQ(e){var t=e.layout,r=e.margin,n=Et(),a=Ar();return v.useEffect(()=>{a||(n(iL(t)),n(nL(r)))},[n,a,t,r]),null}var wQ=v.memo(bQ,Dh);function kQ(e){var t=Et();return v.useEffect(()=>{t(uQ(e))},[t,e]),null}var jQ=e=>{var t=Et();return v.useEffect(()=>{t(mQ(e))},[t,e]),null},SQ=v.memo(jQ,Dh);function k2(e){var t=e.zIndex,r=e.isPanorama,n=v.useRef(null),a=Et();return v.useLayoutEffect(()=>(n.current&&a(bW({zIndex:t,element:n.current,isPanorama:r})),()=>{a(wW({zIndex:t,isPanorama:r}))}),[a,t,r]),v.createElement("g",{tabIndex:-1,ref:n,className:"recharts-zIndex-layer_".concat(t)})}function j2(e){var t=e.children,r=e.isPanorama,n=Me(dW);if(!n||n.length===0)return t;var a=n.filter(c=>c<0),o=n.filter(c=>c>0);return v.createElement(v.Fragment,null,a.map(c=>v.createElement(k2,{key:c,zIndex:c,isPanorama:r})),t,o.map(c=>v.createElement(k2,{key:c,zIndex:c,isPanorama:r})))}var NQ=["children"];function EQ(e,t){if(e==null)return{};var r,n,a=AQ(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n{var r=CA(),n=OA(),a=FA();if(!Hn(r)||!Hn(n))return null;var o=e.children,c=e.otherAttributes,l=e.title,f=e.desc,h,p;return c!=null&&(typeof c.tabIndex=="number"?h=c.tabIndex:h=a?0:void 0,typeof c.role=="string"?p=c.role:p=a?"application":void 0),v.createElement(uE,th({},c,{title:l,desc:f,role:p,tabIndex:h,width:r,height:n,style:PQ,ref:t}),o)}),OQ=e=>{var t=e.children,r=Me(Oh);if(!r)return null;var n=r.width,a=r.height,o=r.y,c=r.x;return v.createElement(uE,{width:n,height:a,x:c,y:o},t)},S2=v.forwardRef((e,t)=>{var r=e.children,n=EQ(e,NQ),a=Ar();return a?v.createElement(OQ,null,v.createElement(j2,{isPanorama:!0},r)):v.createElement(CQ,th({ref:t},n),v.createElement(j2,{isPanorama:!1},r))});function _Q(e,t){return DQ(e)||TQ(e,t)||IQ(e,t)||MQ()}function MQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function IQ(e,t){if(e){if(typeof e=="string")return N2(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N2(e,t):void 0}}function N2(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r{if(n!=null){var c=n.getBoundingClientRect(),l=c.width/n.offsetWidth;He(l)&&l!==o&&e(oL(l))}},[n,e,o]),a}function E2(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function $Q(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,n=Array(t);r(QW(),null);function nh(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var GQ=v.forwardRef((e,t)=>{var r,n,a=v.useRef(null),o=v.useState({containerWidth:nh((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:nh((n=e.style)===null||n===void 0?void 0:n.height)}),c=rh(o,2),l=c[0],f=c[1],h=v.useCallback((g,x)=>{f(b=>{var j=Math.round(g),k=Math.round(x);return b.containerWidth===j&&b.containerHeight===k?b:{containerWidth:j,containerHeight:k}})},[]),p=v.useCallback(g=>{if(typeof t=="function"&&t(g),a.current!=null&&(a.current.disconnect(),a.current=null),g!=null&&typeof ResizeObserver<"u"){var x=g.getBoundingClientRect(),b=x.width,j=x.height;h(b,j);var k=N=>{var E=N[0];if(E!=null){var O=E.contentRect,P=O.width,_=O.height;h(P,_)}},S=new ResizeObserver(k);S.observe(g),a.current=S}},[t,h]);return v.useEffect(()=>()=>{var g=a.current;g!=null&&g.disconnect()},[h]),v.createElement(v.Fragment,null,v.createElement(Ju,{width:l.containerWidth,height:l.containerHeight}),v.createElement("div",xa({ref:p},e)))}),VQ=v.forwardRef((e,t)=>{var r=e.width,n=e.height,a=v.useState({containerWidth:nh(r),containerHeight:nh(n)}),o=rh(a,2),c=o[0],l=o[1],f=v.useCallback((p,g)=>{l(x=>{var b=Math.round(p),j=Math.round(g);return x.containerWidth===b&&x.containerHeight===j?x:{containerWidth:b,containerHeight:j}})},[]),h=v.useCallback(p=>{if(typeof t=="function"&&t(p),p!=null){var g=p.getBoundingClientRect(),x=g.width,b=g.height;f(x,b)}},[t,f]);return v.createElement(v.Fragment,null,v.createElement(Ju,{width:c.containerWidth,height:c.containerHeight}),v.createElement("div",xa({ref:h},e)))}),qQ=v.forwardRef((e,t)=>{var r=e.width,n=e.height;return v.createElement(v.Fragment,null,v.createElement(Ju,{width:r,height:n}),v.createElement("div",xa({ref:t},e)))}),QQ=v.forwardRef((e,t)=>{var r=e.width,n=e.height;return typeof r=="string"||typeof n=="string"?v.createElement(VQ,xa({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?v.createElement(qQ,xa({},e,{width:r,height:n,ref:t})):v.createElement(v.Fragment,null,v.createElement(Ju,{width:r,height:n}),v.createElement("div",xa({ref:t},e)))});function YQ(e){return e?GQ:QQ}var XQ=v.forwardRef((e,t)=>{var r=e.children,n=e.className,a=e.height,o=e.onClick,c=e.onContextMenu,l=e.onDoubleClick,f=e.onMouseDown,h=e.onMouseEnter,p=e.onMouseLeave,g=e.onMouseMove,x=e.onMouseUp,b=e.onTouchEnd,j=e.onTouchMove,k=e.onTouchStart,S=e.style,N=e.width,E=e.responsive,O=e.dispatchTouchEvents,P=O===void 0?!0:O,_=v.useRef(null),C=Et(),I=v.useState(null),B=rh(I,2),U=B[0],G=B[1],X=v.useState(null),$=rh(X,2),fe=$[0],J=$[1],pe=RQ(),be=Fy(),de=(be==null?void 0:be.width)>0?be.width:N,Y=(be==null?void 0:be.height)>0?be.height:a,V=v.useCallback(_e=>{pe(_e),typeof t=="function"&&t(_e),G(_e),J(_e),_e!=null&&(_.current=_e)},[pe,t,G,J]),Q=v.useCallback(_e=>{C(r_(_e)),C(Vr({handler:o,reactEvent:_e}))},[C,o]),D=v.useCallback(_e=>{C(sy(_e)),C(Vr({handler:h,reactEvent:_e}))},[C,h]),T=v.useCallback(_e=>{C(UC()),C(Vr({handler:p,reactEvent:_e}))},[C,p]),Z=v.useCallback(_e=>{C(sy(_e)),C(Vr({handler:g,reactEvent:_e}))},[C,g]),oe=v.useCallback(()=>{C(l_())},[C]),re=v.useCallback(()=>{C(u_())},[C]),ue=v.useCallback(_e=>{C(s_(_e.key))},[C]),me=v.useCallback(_e=>{C(Vr({handler:c,reactEvent:_e}))},[C,c]),Pe=v.useCallback(_e=>{C(Vr({handler:l,reactEvent:_e}))},[C,l]),te=v.useCallback(_e=>{C(Vr({handler:f,reactEvent:_e}))},[C,f]),ve=v.useCallback(_e=>{C(Vr({handler:x,reactEvent:_e}))},[C,x]),Oe=v.useCallback(_e=>{C(Vr({handler:k,reactEvent:_e}))},[C,k]),ie=v.useCallback(_e=>{P&&C(f_(_e)),C(Vr({handler:j,reactEvent:_e}))},[C,P,j]),Je=v.useCallback(_e=>{C(Vr({handler:b,reactEvent:_e}))},[C,b]),Be=YQ(E);return v.createElement(cO.Provider,{value:U},v.createElement(dD.Provider,{value:fe},v.createElement(Be,{width:de??(S==null?void 0:S.width),height:Y??(S==null?void 0:S.height),className:nt("recharts-wrapper",n),style:$Q({position:"relative",cursor:"default",width:de,height:Y},S),onClick:Q,onContextMenu:me,onDoubleClick:Pe,onFocus:oe,onBlur:re,onKeyDown:ue,onMouseDown:te,onMouseEnter:D,onMouseLeave:T,onMouseMove:Z,onMouseUp:ve,onTouchEnd:Je,onTouchMove:ie,onTouchStart:Oe,ref:V},v.createElement(KQ,null),r)))}),ZQ=["width","height","responsive","children","className","style","compact","title","desc"];function JQ(e,t){if(e==null)return{};var r,n,a=eY(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n{var r=e.width,n=e.height,a=e.responsive,o=e.children,c=e.className,l=e.style,f=e.compact,h=e.title,p=e.desc,g=JQ(e,ZQ),x=bn(g);return f?v.createElement(v.Fragment,null,v.createElement(Ju,{width:r,height:n}),v.createElement(S2,{otherAttributes:x,title:h,desc:p},o)):v.createElement(XQ,{className:c,style:l,width:r,height:n,responsive:a??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},v.createElement(S2,{otherAttributes:x,title:h,desc:p,ref:t},v.createElement(tV,null,o)))});function ly(){return ly=Object.assign?Object.assign.bind():function(e){for(var t=1;tv.createElement(lY,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:uY,tooltipPayloadSearcher:IW,categoricalChartProps:e,ref:t}));const dY="rgba(130,130,150,0.14)",C2="rgba(130,130,150,0.85)";function fY(e){if(e<=0)return 10;const t=Math.pow(10,Math.floor(Math.log10(e))),r=e/t;return(r<=1?1:r<=2?2:r<=5?5:10)*t}function g_(e,t){return`${t==="%"?Math.round(e):e>=1e3?`${(e/1e3).toFixed(1)}k`:Math.round(e).toString()}${t}`}function hY({active:e,payload:t,unit:r}){return!e||!(t!=null&&t.length)?null:u.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:u.jsx("div",{className:"space-y-1",children:t.map(n=>u.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[u.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:n.color}}),u.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:n.name}),u.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:g_(n.value,r)})]},n.dataKey))})})}function v_({data:e,series:t,unit:r="%",yMode:n="percent",height:a=176}){const o=e.reduce((l,f)=>t.reduce((h,p)=>Math.max(h,Number(f[p.key])||0),l),0),c=n==="percent"?Math.min(100,Math.max(25,Math.ceil(o*1.2/25)*25)):Math.max(fY(o*1.15),10);return u.jsx("div",{style:{height:a},className:"w-full",children:u.jsx(nz,{width:"100%",height:"100%",children:u.jsxs(cY,{data:e,margin:{top:8,right:6,bottom:0,left:-12},children:[u.jsx("defs",{children:t.map(l=>u.jsxs("linearGradient",{id:`grad-${l.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:l.color,stopOpacity:.22}),u.jsx("stop",{offset:"100%",stopColor:l.color,stopOpacity:0})]},l.key))}),u.jsx(BO,{vertical:!1,stroke:dY}),u.jsx(e_,{dataKey:"t",hide:!0}),u.jsx(t_,{domain:[0,c],ticks:[0,c/2,c],tickFormatter:l=>g_(l,r),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:C2}}),u.jsx(lH,{content:u.jsx(hY,{unit:r}),cursor:{stroke:C2,strokeOpacity:.4,strokeDasharray:"3 3"}}),t.map(l=>u.jsx(ZO,{type:"monotone",dataKey:l.key,name:l.label,stroke:l.color,strokeWidth:2,fill:`url(#grad-${l.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},l.key))]})})})}const pY=[{key:"cpu",label:"CPU",color:"#2dd4bf"},{key:"ram",label:"RAM",color:"#38bdf8"},{key:"gpu",label:"GPU",color:"#a78bfa"},{key:"disk",label:"Disk",color:"#fbbf24"}];function mY(){var c,l,f,h;const{sys:e,hist:t}=eD(),r=!!(e!=null&&e.gpu&&e.gpu.busy_percent!=null&&e.gpu.gtt_used!=null&&e.gpu.gtt_total!=null),n=pY.filter(p=>p.key!=="gpu"||r),a={cpu:(c=e==null?void 0:e.cpu)==null?void 0:c.percent,ram:(l=e==null?void 0:e.ram)==null?void 0:l.percent,gpu:r?e.gpu.busy_percent:null,disk:(f=e==null?void 0:e.disk)==null?void 0:f.percent},o={cpu:(h=e==null?void 0:e.cpu)!=null&&h.cores?`${e.cpu.cores} Cores`:"",ram:e?`${ns(e.ram.used)}/${ns(e.ram.total)} GB`:"",gpu:r?`${ns(e.gpu.gtt_used)}/${ns(e.gpu.gtt_total)} GB`:"",disk:e!=null&&e.disk?`${ns(e.disk.used)}/${ns(e.disk.total)} GB`:""};return u.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[u.jsx(zn,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),u.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),e?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:n.map(p=>u.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[u.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:p.color}}),u.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:p.label}),u.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(a[p.key]??0),"%"]}),o[p.key]&&u.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:o[p.key]})]},p.key))}),u.jsx(v_,{data:t,series:n,unit:"%",yMode:"percent",height:176})]}):u.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(e==null?void 0:e.temp)&&(e.temp.cpu||e.temp.gpu)&&u.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[e.temp.cpu!=null&&u.jsxs("span",{children:["CPU Temp: ",e.temp.cpu," °C"]}),e.temp.gpu!=null&&u.jsxs("span",{children:["GPU Temp: ",e.temp.gpu," °C"]})]})]})}function Vd({label:e,value:t,tone:r}){return u.jsxs("div",{className:ce("flex items-center justify-between rounded-lg border px-3 py-1.5 text-xs",r==="alert"?"border-amber-500/30 bg-amber-500/5 font-semibold text-amber-400":r==="accent"?"border-primary/30 bg-primary/5 font-semibold text-primary":"border-border/30 bg-background/25 text-muted-foreground"),children:[u.jsx("span",{className:"flex items-center gap-1.5",children:e}),u.jsx("span",{className:"font-mono text-[10px]",children:t})]})}function gY(){var r;const{data:e}=jy(3e3),t=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return u.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(VI,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(e==null?void 0:e.last_check)&&u.jsxs("span",{className:"font-mono text-[9px] text-muted-foreground/80",children:["Zuletzt gesucht: ",new Date(e.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),e?u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Vd,{label:"OS-Pakete",tone:e.os>0?"alert":"muted",value:e.os>0?`${e.os} verfügbar`:"aktuell"}),u.jsx(Vd,{label:"Engine (llama.cpp)",tone:e.engine>0?"alert":"muted",value:e.engine>0?"Update verfügbar":"aktuell"}),u.jsx(Vd,{label:"Modell-Upgrades",tone:e.models>0?"accent":"muted",value:e.models>0?`${e.models} verfügbar`:"aktuell"}),(r=e.components)==null?void 0:r.map(n=>u.jsx(Vd,{tone:n.update===!0?"alert":"muted",label:u.jsxs(u.Fragment,{children:[n.name,n.reachable===!1&&u.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),value:n.update===!0?`Update: ${n.latest}`:n.update===!1?"aktuell":n.latest?`neueste: ${n.latest}`:"—"},n.key))]}):u.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),u.jsxs("button",{onClick:t,className:"mt-4 flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow-md shadow-primary/10 transition-all hover:opacity-90 cursor-pointer",children:["Updates verwalten & Pflege ",u.jsx(hN,{className:"h-3.5 w-3.5"})]})]})}function y_({type:e,title:t,message:r,defaultValue:n,autoValue:a,autoLabel:o,onConfirm:c,onCancel:l}){const f=v.useRef(null);return u.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:t}),u.jsx("button",{onClick:l||(()=>c()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:r}),e==="prompt"&&u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{ref:f,type:"text",defaultValue:n,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:h=>{var p;h.key==="Enter"&&c((p=f.current)==null?void 0:p.value)}}),a!==void 0&&u.jsx("button",{type:"button",onClick:()=>{f.current&&(f.current.value=a)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:o||"Auto"})]}),u.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(e==="confirm"||e==="prompt")&&u.jsx("button",{onClick:l,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),u.jsx("button",{onClick:()=>{var p;const h=e==="prompt"?(p=f.current)==null?void 0:p.value:void 0;c(h)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:e==="confirm"?"Ja, fortfahren":e==="prompt"?"Übernehmen":"OK"})]})]})})}function sl(){const[e,t]=v.useState(null),r=v.useCallback(()=>t(null),[]),n=v.useCallback((l,f,h)=>{t({type:"alert",title:l,message:f,onConfirm:()=>{t(null),h==null||h()}})},[]),a=v.useCallback((l,f,h,p)=>{t({type:"confirm",title:l,message:f,onConfirm:()=>{t(null),h()},onCancel:()=>{t(null),p==null||p()}})},[]),o=v.useCallback((l,f,h,p,g,x)=>{t({type:"prompt",title:l,message:f,defaultValue:h,autoValue:x==null?void 0:x.autoValue,autoLabel:x==null?void 0:x.autoLabel,onConfirm:b=>{t(null),p(b)},onCancel:()=>{t(null),g==null||g()}})},[]),c=e?u.jsx(y_,{...e}):null;return{showAlert:n,showConfirm:a,showPrompt:o,close:r,dialogElement:c}}function vY(){const e=jo(),{data:t}=ky(3e3),{data:r}=No(),{showAlert:n,dialogElement:a}=sl(),[o,c]=v.useState(!1),l=(r==null?void 0:r.models)??[];async function f(h){try{await Ce("/api/agent/brain",{method:"POST",body:JSON.stringify({model:h})}),n("Erfolgreich",`Hermes-Gehirn wurde auf '${h}' geändert. Der Gateway-Dienst wurde neu gestartet.`),e.invalidateQueries({queryKey:kt.agentStatus}),c(!1)}catch(p){n("Fehler",`Fehler beim Wechseln des Gehirns: ${p.message}`)}}return u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-4",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(yi,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(t==null?void 0:t.terminal_url)&&u.jsxs("a",{href:Ls(t.terminal_url),target:"_blank",rel:"noopener",className:ce("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",t.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[u.jsx(ju,{className:"h-3 w-3"})," Terminal öffnen"]})]}),t?u.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[u.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[u.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),u.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[u.jsx("span",{className:ce("h-2 w-2 rounded-full",t.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),u.jsx("span",{className:"text-xs font-medium",children:t.gateway_reachable?"Online":"Offline"})]})]}),u.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[u.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),u.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[u.jsx("span",{className:ce("h-2 w-2 rounded-full",t.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),u.jsx("span",{className:"text-xs font-medium",children:t.terminal_reachable?"Online":"Offline"})]})]}),u.jsxs("div",{onClick:()=>c(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),u.jsx(zn,{className:"h-3 w-3 text-primary"})]}),u.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[u.jsx(oh,{className:"h-3 w-3 shrink-0"}),t.brain_model||"auto"]})]}),u.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),u.jsx(lf,{className:"h-3 w-3 text-primary"})]}),u.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[u.jsxs("div",{children:["Config: ",t.has_config?u.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),u.jsxs("div",{children:["Skills: ",t.has_skills?u.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),u.jsxs("div",{children:["Memory: ",t.has_memories?u.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):u.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),t&&u.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[u.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[u.jsx("span",{children:"Telegram"}),u.jsx("span",{className:ce("font-semibold",t.telegram_enabled?"text-emerald-400":""),children:t.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),u.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[u.jsx("span",{children:"MCP-Server"}),u.jsxs("span",{className:"font-semibold text-foreground",children:[t.mcp_server_count??0," verbunden"]})]}),u.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[u.jsx("span",{children:"PC Executor"}),u.jsx("span",{className:ce("font-semibold",t.pc_executor_reachable?"text-emerald-400":""),children:t.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),t&&o&&u.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[u.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[u.jsx(zn,{className:"h-4 w-4"}),u.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),u.jsx("button",{onClick:()=>c(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',u.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",u.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",u.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),u.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...l.map(h=>{var p;return((p=h.name.split("/").pop())==null?void 0:p.replace(".gguf",""))||h.name})].map(h=>{const p=["auto","fast","heavy"].includes(h);return u.jsxs("button",{onClick:()=>f(h),className:ce("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",t.brain_model===h||!t.brain_model&&h==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[u.jsxs("div",{className:"flex flex-col text-left",children:[u.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:h}),u.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:p?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(t.brain_model===h||!t.brain_model&&h==="auto")&&u.jsx(Yr,{className:"h-4 w-4 shrink-0 text-primary"})]},h)})})]})}),a]})}function yY(){const{data:e}=No(3e3),t=(e==null?void 0:e.models)??[],r=(e==null?void 0:e.running)??[];return u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[u.jsx(oh,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),u.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:iE.map(n=>{var c;const a=t.find(l=>l.role===n),o=a?r.includes(a.name):!1;return u.jsxs("div",{className:ce("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",o?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":a?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[u.jsx("div",{className:"min-w-0 flex-1 mr-2",children:u.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[u.jsx("span",{className:ce("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",Ny(n)),children:n}),u.jsxs("div",{className:"flex flex-col min-w-0",children:[u.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:a?(c=a.name.split("/").pop())==null?void 0:c.replace(/\.gguf$/i,""):"nicht zugewiesen"}),a&&u.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[a.prompt_cache&&u.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),a.spec_active&&u.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${a.spec_draft_model})`,children:"SPEC"}),a.parallel_slots>1&&u.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${a.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",a.parallel_slots]}),a.incomplete&&u.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),u.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:a?o?u.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):u.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):u.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},n)})})]}),u.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function xY(){const e=jo(),{data:t=[]}=uv({limit:3}),[r,n]=v.useState(""),[a,o]=v.useState("stable"),[c,l]=v.useState(!1);async function f(){if(!(!r.trim()||c)){l(!0);try{await Ce("/api/memory",{method:"POST",body:JSON.stringify({content:r,category:a,source:"dashboard"})}),n(""),e.invalidateQueries({queryKey:["memory"]})}catch(h){console.error(h)}finally{l(!1)}}}return u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[u.jsx(ah,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("textarea",{value:r,onChange:h=>n(h.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),u.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[u.jsxs("select",{value:a,onChange:h=>o(h.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[u.jsx("option",{value:"stable",children:"🔵 Fakt"}),u.jsx("option",{value:"instruction",children:"📋 Regel"}),u.jsx("option",{value:"user",children:"👤 User"}),u.jsx("option",{value:"versioned",children:"🟡 Version"})]}),u.jsxs("button",{onClick:f,disabled:!r.trim()||c,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[u.jsx(rv,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),u.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[u.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),u.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:t.length===0?u.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):t.map(h=>u.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[u.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:h.category}),u.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:h.content,children:h.content})]},h.id))})]})]}),u.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}const O2=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function bY(){const{data:e}=wy(3e3),t=Z4(),r=t[t.length-1],n=r?Math.round(r.prompt+r.completion):0;return u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[u.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(ku,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),u.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),e&&u.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[u.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:n.toLocaleString("de-DE")}),u.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),e&&u.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[u.jsxs("div",{children:[e.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",u.jsxs("span",{className:"text-emerald-400/90",children:[e.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),u.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",e.prompt_tokens.toLocaleString("de-DE")," · Output ",e.completion_tokens.toLocaleString("de-DE")]})]})]}),u.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:O2.map(a=>u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:a.color}}),u.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:a.label}),u.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((r==null?void 0:r[a.key])??0)})]},a.key))})]}),e?u.jsx(v_,{data:t,series:O2,unit:" tok/s",yMode:"auto",height:150}):u.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),u.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}function wY(){const{data:e}=o4(3e3),{showAlert:t,dialogElement:r}=sl(),[n,a]=v.useState({});async function o(c){a(l=>({...l,[c]:!0}));try{const l=await Ce("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:c})});l.ok||t("Fehler",`Neustart fehlgeschlagen: ${l.err||"Unbekannt"}`)}catch(l){t("Fehler",`Fehler: ${l.message}`)}finally{a(l=>({...l,[c]:!1}))}}return u.jsxs("div",{className:"flex flex-col rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[u.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(gy,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),u.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground transition-colors hover:text-primary cursor-pointer",children:"Logs / Pflege"})]}),e?u.jsxs("div",{className:"flex flex-1 flex-col",children:[u.jsx("div",{className:"space-y-1.5",children:e.services.map(c=>u.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[u.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[u.jsx("span",{className:ce("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",c.ok?"bg-emerald-500":"bg-amber-500")}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:c.name}),u.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:c.url})]})]}),u.jsx("button",{onClick:()=>o(c.name),disabled:n[c.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:u.jsx(mu,{className:ce("h-3.5 w-3.5",n[c.name]&&"animate-spin")})})]},c.name))}),u.jsxs("div",{className:"mt-auto flex flex-wrap gap-3 border-t border-border/20 pt-2.5 text-[10px] font-semibold text-muted-foreground",children:[u.jsxs("a",{href:Ls(e.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[u.jsx(ju,{className:"h-3 w-3"})," Engine"]}),u.jsxs("a",{href:Ls(e.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[u.jsx(ju,{className:"h-3 w-3"})," Gateway"]})]})]}):u.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),r]})}function _2({children:e}){return u.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:e})}function kY(){return u.jsxs("div",{className:"space-y-7",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),u.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[u.jsx(mY,{}),u.jsx(bY,{}),u.jsx(q4,{})]}),u.jsxs("section",{children:[u.jsx(_2,{children:"Stack-Status"}),u.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[u.jsx(yY,{}),u.jsx(wY,{})]})]}),u.jsxs("section",{children:[u.jsx(_2,{children:"Betrieb & Wissen"}),u.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[u.jsx(gY,{}),u.jsx(vY,{}),u.jsx(xY,{})]})]})]})}function jY(){const e=jo(),{data:t=[]}=l4(2e3),{showAlert:r,dialogElement:n}=sl();async function a(l){try{await Ce(`/api/jobs/${l}/cancel`,{method:"POST"}),e.invalidateQueries({queryKey:kt.jobs})}catch(f){r("Fehler",f.message)}}const o=t.filter(l=>l.state==="running"||l.state==="queued"),c=t.filter(l=>l.state!=="running"&&l.state!=="queued").slice(-3);return o.length===0&&c.length===0?null:u.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[u.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),o.map(l=>u.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[u.jsxs("div",{className:"flex justify-between items-center text-xs",children:[u.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:l.label}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("span",{className:"text-muted-foreground font-mono",children:[l.progress??0,"% • ",cv(l.done_bytes),"/",cv(l.total_bytes),l.eta_s?` • ETA ${h4(l.eta_s)}`:""]}),u.jsx("button",{onClick:()=>a(l.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),u.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:u.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${l.progress??0}%`}})})]},l.id)),c.map(l=>u.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[u.jsx("span",{className:"truncate",children:l.label}),u.jsx("span",{className:ce("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",l.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:l.state})]},l.id)),n]})}function Wa({children:e,tone:t="muted"}){const r={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return u.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${r[t]}`,children:e})}function M2({caps:e}){return e?u.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[e.coder&&u.jsx(Wa,{children:"💻 Code"}),e.vision&&u.jsx(Wa,{children:"👁 Bild"}),e.reasoning&&u.jsx(Wa,{children:"🧠 Reason"}),e.moe&&u.jsxs(Wa,{tone:"primary",children:["🧩 MoE",e.active_b?`·${e.active_b}b`:""]}),e.tools==="yes"&&u.jsx(Wa,{tone:"primary",children:"🛠 Tools"}),e.tools==="likely"&&u.jsx(Wa,{tone:"warn",children:"🛠 Tools?"}),e.embedding&&u.jsx(Wa,{children:"🔢 Embed"})]}):null}function SY({model:e,onClose:t,onChanged:r}){var k,S;const{data:n,isLoading:a}=d4(e.gguf_path),[o,c]=v.useState(null),[l,f]=v.useState(""),h=n==null?void 0:n.target_vocab,p=(n==null?void 0:n.drafts)??[],g=p.filter(N=>N.compatible===!0),x=e.spec_draft_model;async function b(N){c(N??"__clear__"),f("");try{await Ce(`/api/models/${encodeURIComponent(e.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:N})}),r(),t()}catch(E){f(String((E==null?void 0:E.message)||E)),c(null)}}const j=N=>{var E;return N?`${N.pre??"?"} · ${((E=N.n_vocab)==null?void 0:E.toLocaleString())??"?"} Tokens`:"—"};return u.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[u.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[u.jsx(uo,{className:"h-4 w-4"})," Speculative Draft"]}),u.jsx("button",{onClick:t,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',u.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),u.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[u.jsx("span",{className:"text-muted-foreground",children:(k=e.name.split("/").pop())==null?void 0:k.replace(/\.gguf$/i,"")}),u.jsxs("span",{className:"text-foreground",children:["Vocab: ",j(h)]})]}),e.spec_active&&x&&u.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[u.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[u.jsx(Yr,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",x]}),u.jsx("button",{onClick:()=>b(null),disabled:o!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(n!=null&&n.target_exists)&&u.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[u.jsx(Ds,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),u.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:a?u.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):p.length===0?u.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",u.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):p.map(N=>{var P,_;const E=N.filename===x,O=N.compatible===!0;return u.jsxs("div",{className:ce("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",O?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",E&&"border-primary/40 bg-primary/10"),children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:N.filename}),u.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[qr(N.size_bytes)," · Vocab: ",j(N.vocab)]})]}),O?E?u.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[u.jsx(Yr,{className:"h-3.5 w-3.5"})," Aktiv"]}):u.jsx("button",{onClick:()=>b(N.path),disabled:o!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):u.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:N.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(P=N.vocab)==null?void 0:P.pre}/${(_=N.vocab)==null?void 0:_.n_vocab} ≠ Modell ${h==null?void 0:h.pre}/${h==null?void 0:h.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[u.jsx(Ds,{className:"h-3.5 w-3.5"})," ",N.compatible===!1?"Vocab ≠":"n/a"]})]},N.path)})}),!a&&(n==null?void 0:n.target_exists)&&p.length>0&&g.length===0&&u.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",u.jsx("span",{className:"font-mono",children:h==null?void 0:h.pre}),", n_vocab=",u.jsx("span",{className:"font-mono",children:(S=h==null?void 0:h.n_vocab)==null?void 0:S.toLocaleString()}),")."]}),l&&u.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:l})]})})}function NY(){var Oo,Sa,ll,Mi,Ii,fc,ul,cl;const e=jo(),{data:t,isLoading:r,error:n}=No(4e3),{data:a}=s4(4e3),{data:o}=XN(),{data:c}=jy(4e3),{data:l}=u4(),{data:f}=fh(),{showAlert:h,showConfirm:p,showPrompt:g,dialogElement:x}=sl(),b=(t==null?void 0:t.models)??[],j=(t==null?void 0:t.running)??[],k=n?String(n):"",S=()=>{e.invalidateQueries({queryKey:kt.models}),e.invalidateQueries({queryKey:kt.routing})},[N,E]=v.useState(null),[O,P]=v.useState(null),[_,C]=v.useState(null),[I,B]=v.useState(null),[U,G]=v.useState(!1),[X,$]=v.useState(!1),[fe,J]=v.useState(null),[pe,be]=v.useState("grid"),[de,Y]=v.useState("all"),V=b.filter(F=>de==="in_use"?!!F.role||j.includes(F.name):!0),[Q,D]=v.useState({width:800,height:360}),T=v.useRef(null),Z=v.useCallback(F=>{if(T.current&&(T.current.disconnect(),T.current=null),F){const he=new ResizeObserver(Ae=>{if(!Ae||Ae.length===0)return;const Ue=Ae[0].contentRect;D({width:Ue.width,height:Ue.height})});he.observe(F),T.current=he}},[]),oe=Q.width,re=Q.height,ue=F=>{const he=oe*.1,Ae=re*F,Ue=oe*.5,Ye=re*.5,Jt=oe*.3,tt=Ae,yt=oe*.3;return`M ${he} ${Ae} C ${Jt} ${tt}, ${yt} ${Ye}, ${Ue} ${Ye}`},me=F=>{const he=oe*.5,Ae=re*.5,Ue=oe*.9,Ye=re*F,Jt=oe*.7,tt=Ae,yt=oe*.7;return`M ${he} ${Ae} C ${Jt} ${tt}, ${yt} ${Ye}, ${Ue} ${Ye}`};async function Pe(F){try{await Ce(`/api/models/${encodeURIComponent(F)}/load`,{method:"POST"}),S()}catch(he){h("Fehler",`Fehler beim Laden des Modells: ${he.message}`)}}async function te(F){try{await Ce(`/api/models/${encodeURIComponent(F)}/unload`,{method:"POST"}),S()}catch(he){h("Fehler",`Fehler beim Entladen des Modells: ${he.message}`)}}async function ve(){try{await Ce("/api/models/unload",{method:"POST"}),S()}catch(F){h("Fehler",`Fehler beim Entladen aller Modelle: ${F.message}`)}}async function Oe(F,he){try{await Ce(`/api/models/${encodeURIComponent(he)}/role`,{method:"POST",body:JSON.stringify({role:F||null})}),S()}catch(Ae){h("Fehler",`Fehler beim Zuweisen der Rolle: ${Ae.message||Ae}`)}}function ie(F){P(F),C(null),Ce(`/api/roles/${encodeURIComponent(F)}/recommend`).then(he=>C(he)).catch(()=>{})}async function Je(F,he){let Ae=null;try{Ae=await Ce(`/api/models/${encodeURIComponent(F)}/ctx/auto`)}catch{}const Ue=Ae?`Optimal für dein Setup: ${(Ae.ctx/1024).toFixed(0)}k (${Ae.ctx}) — GTT ${Ae.gtt_gb} GB − reserviert ${Ae.reserved_gb} GB (${Ae.mode}) → ${Ae.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";g("Kontextlänge anpassen",Ue,String(he||32768),async Ye=>{if(Ye)try{await Ce(`/api/models/${encodeURIComponent(F)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Ye,10)})}),S()}catch(Jt){h("Fehler",`Fehler beim Setzen des Kontexts: ${Jt.message||Jt}`)}},void 0,Ae?{autoValue:String(Ae.ctx),autoLabel:`Auto (${(Ae.ctx/1024).toFixed(0)}k)`}:void 0)}async function Be(F){p("Modell löschen?",`Modell '${F}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await Ce(`/api/models/${encodeURIComponent(F)}`,{method:"DELETE"}),S()}catch(he){h("Fehler",`Fehler beim Löschen: ${he.message||he}`)}})}async function _e(F,he,Ae,Ue){try{await Ce("/api/models/install",{method:"POST",body:JSON.stringify({repo:F,role:he,quant:Ae,jinja:Ue})}),h("Herunterladen gestartet",`Download für '${F}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Ye){h("Fehler",`Fehler beim Starten des Upgrades: ${Ye.message||Ye}`)}}async function jt(F){const he=l==null?void 0:l.budget,Ae=he&&!he.fits?` - -⚠ Speicher-Warnung: Dieses Brain (~${he.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${he.largest_ondemand_gb} GB) sprengt das das Budget (${he.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";p("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${F.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${Ae}`,async()=>{try{await Ce("/api/models/install",{method:"POST",body:JSON.stringify({repo:F,role:"hermes",quant:"Q4_K_M",jinja:!0})}),h("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),S()}catch(Ue){h("Fehler",`Update fehlgeschlagen: ${Ue.message||Ue}`)}})}async function ur(F){p("Agent-Hirn wechseln?",`'${F.split("/").pop()}' als Agent-Hirn (Alias hermes) setzen? Es wird warm gehalten (brains-Gruppe); Hermes nutzt es nach einem kurzen Gateway-Restart.`,async()=>{try{await Ce("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:F})}),h("Erledigt","Agent-Hirn gewechselt. Gateway wurde neugestartet."),G(!1),S()}catch(he){h("Fehler",`Wechsel fehlgeschlagen: ${he.message||he}`)}})}async function Qn(F){F&&(await navigator.clipboard.writeText(F),$(!0),setTimeout(()=>$(!1),1500))}if(r)return u.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(k)return u.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",k,")."]});const Yn=b.filter(F=>j.includes(F.name)),sn=Yn.reduce((F,he)=>F+(he.size_bytes||0),0),Fr=((Oo=f==null?void 0:f.gpu)==null?void 0:Oo.gtt_total)||((Sa=f==null?void 0:f.gpu)==null?void 0:Sa.vram_total)||0,Oi=((ll=f==null?void 0:f.gpu)==null?void 0:ll.gtt_used)||0,_i=16*1024**3,ee=Fr>2*1024**3?Fr:sn>_i?sn*1.2:_i,$e=F=>b.find(he=>he.role===F),At=F=>{const he=$e(F);return he?j.includes(he.name):!1};return u.jsxs("div",{className:"space-y-8",children:[u.jsx("style",{children:` - @keyframes flow-dash { - to { - stroke-dashoffset: -20; - } - } - .svg-flow-path { - stroke-dasharray: 4 6; - animation: flow-dash 1s linear infinite; - } - `}),u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[u.jsxs("div",{className:"flex justify-between items-center",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Km,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",qr(sn)," Gewichte",Oi>0?` · ${qr(Oi)} real belegt (inkl. KV)`:""," / ",qr(ee)]}),j.length>0&&u.jsx("button",{onClick:ve,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),u.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:Yn.length===0?u.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):Yn.map((F,he)=>{var Ye;const Ae=(F.size_bytes||0)/ee*100,Ue=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][he%4];return u.jsxs("div",{style:{width:`${Ae}%`},className:ce("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",Ue),title:`${F.name} (${qr(F.size_bytes)})`,children:[u.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[F.role?`[${F.role}] `:"",(Ye=F.name.split("/").pop())==null?void 0:Ye.replace(".gguf","")]}),u.jsx("span",{className:"text-[8px] font-mono opacity-80",children:qr(F.size_bytes)})]},F.name)})})]}),u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[u.jsxs("div",{children:[u.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),u.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),u.jsxs("div",{ref:Z,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[u.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[u.jsxs("defs",{children:[u.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[u.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),u.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),u.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[u.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),u.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),u.jsx("path",{d:ue(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(fe==="roocode"||N==="roocode")&&u.jsx("path",{d:ue(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:ue(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(fe==="cursor"||N==="cursor")&&u.jsx("path",{d:ue(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:ue(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(fe==="opencode"||N==="opencode")&&u.jsx("path",{d:ue(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:ue(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(fe==="zed"||N==="zed")&&u.jsx("path",{d:ue(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:ue(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(fe==="continue"||N==="continue")&&u.jsx("path",{d:ue(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:me(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),At("fast")&&u.jsx("path",{d:me(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:me(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),At("heavy")&&u.jsx("path",{d:me(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:me(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),At("coder")&&u.jsx("path",{d:me(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:me(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),At("vision")&&u.jsx("path",{d:me(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:me(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),At("scout")&&u.jsx("path",{d:me(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),u.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>J("roocode"),onMouseLeave:()=>J(null),onClick:()=>E(F=>F==="roocode"?null:"roocode"),children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),u.jsx("span",{children:"Roo Code"})]}),u.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>J("cursor"),onMouseLeave:()=>J(null),onClick:()=>E(F=>F==="cursor"?null:"cursor"),children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),u.jsx("span",{children:"Cursor IDE"})]}),u.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>J("opencode"),onMouseLeave:()=>J(null),onClick:()=>E(F=>F==="opencode"?null:"opencode"),children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),u.jsx("span",{children:"OpenCode"})]}),u.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>J("zed"),onMouseLeave:()=>J(null),onClick:()=>E(F=>F==="zed"?null:"zed"),children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),u.jsx("span",{children:"Zed"})]}),u.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>J("continue"),onMouseLeave:()=>J(null),onClick:()=>E(F=>F==="continue"?null:"continue"),children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),u.jsx("span",{children:"Continue"})]}),u.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[u.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),u.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",a!=null&&a.heavy_threshold_chars?a.heavy_threshold_chars/1e3:"4","k Zeichen"]}),u.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),iE.map(F=>{var Jt;const he=["12%","31%","50%","69%","88%"],Ae=$e(F),Ue=Ae?j.includes(Ae.name):!1;if(F==="agent")return null;const Ye={fast:0,heavy:1,coder:2,vision:3,scout:4}[F];return u.jsxs("div",{className:ce("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",Ue?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":Ae?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:he[Ye]},onClick:()=>ie(F),children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:F}),Ue&&u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),u.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:Ae?(Jt=Ae.name.split("/").pop())==null?void 0:Jt.replace(".gguf",""):"Keine Zuweisung"})]},F)}),N&&o&&u.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[u.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[N==="roocode"&&"Roo Code Setup",N==="cursor"&&"Cursor Setup",N==="opencode"&&"OpenCode Setup",N==="zed"&&"Zed Setup",N==="continue"&&"Continue Setup"]}),u.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[N==="roocode"&&u.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[u.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",u.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),u.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",u.jsx("strong",{children:"OpenAI Compatible"}),"."]}),u.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",u.jsx("code",{children:"settings.json"})," ein."]})]}),N==="cursor"&&u.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[u.jsxs("li",{children:["Öffne Cursor Settings ➔ ",u.jsx("strong",{children:"Models"}),"."]}),u.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",u.jsx("strong",{children:"OpenAI API"})," auf."]}),u.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",u.jsx("strong",{children:"auto"}),"."]})]}),N==="opencode"&&u.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[u.jsxs("li",{children:["Öffne die ",u.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),u.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",u.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),N==="zed"&&u.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[u.jsxs("li",{children:["Öffne die Zed Settings (",u.jsx("code",{children:"ctrl+,"}),")."]}),u.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",u.jsx("code",{children:"language_models"})," ein."]})]}),N==="continue"&&u.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[u.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),u.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",u.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),o.tools&&u.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[u.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[u.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),u.jsxs("button",{onClick:()=>{var F,he,Ae,Ue,Ye;return Qn(N==="roocode"?(F=o.tools.cline)==null?void 0:F.snippet:N==="cursor"?(he=o.tools.cursor)==null?void 0:he.snippet:N==="opencode"?(Ae=o.tools.opencode)==null?void 0:Ae.snippet:N==="zed"?(Ue=o.tools.zed)==null?void 0:Ue.snippet:(Ye=o.tools.continue)==null?void 0:Ye.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[X?u.jsx(Yr,{className:"h-3.5 w-3.5 text-emerald-400"}):u.jsx(sf,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:X?"Kopiert":"Kopieren"})]})]}),u.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:u.jsxs("code",{children:[N==="roocode"&&((Mi=o.tools.cline)==null?void 0:Mi.snippet),N==="cursor"&&((Ii=o.tools.cursor)==null?void 0:Ii.snippet),N==="opencode"&&((fc=o.tools.opencode)==null?void 0:fc.snippet),N==="zed"&&((ul=o.tools.zed)==null?void 0:ul.snippet),N==="continue"&&((cl=o.tools.continue)==null?void 0:cl.snippet)]})})]}),u.jsx("button",{onClick:()=>E(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),u.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),u.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),u.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[u.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),u.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(F=>{var Ue;const he=b.find(Ye=>Ye.role===F),Ae=he?j.includes(he.name):!1;return u.jsxs("div",{onClick:()=>ie(F),className:ce("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",Ae?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":he?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:ce("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",Ny(F)),children:F}),Ae&&u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),u.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:he==null?void 0:he.name,children:he?(Ue=he.name.split("/").pop())==null?void 0:Ue.replace(/\.gguf$/i,""):"nicht zugewiesen"}),u.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},F)})})]}),(l==null?void 0:l.current)&&u.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[u.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(yi,{className:"h-4.5 w-4.5 text-indigo-400"}),u.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),l.current.version!=null&&u.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",l.current.version]})]}),u.jsx("button",{onClick:()=>G(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),u.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:l.current.name,children:l.current.name.split("/").pop()}),u.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[u.jsx("span",{children:l.current.params_b?`${l.current.params_b}B`:"—"}),u.jsx("span",{children:"•"}),u.jsx("span",{children:l.current.quant||"GGUF"}),u.jsx("span",{children:"•"}),u.jsx("span",{children:qr(l.current.size_bytes||0)})]})]}),l.update_available&&l.recommended?u.jsxs("button",{onClick:()=>jt(l.recommended.repo),className:ce("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",l.budget&&!l.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[u.jsx(Ts,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):u.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[u.jsx(Yr,{className:"h-4 w-4"})," Neueste Generation"]})]}),l.update_available&&l.recommended&&u.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",u.jsx("span",{className:"font-mono font-bold",children:l.recommended.name.replace(/-GGUF$/i,"")}),"(v",l.recommended.version,", ",l.recommended.params_b,"B) — von NousResearch."]}),l.budget&&u.jsxs("div",{className:ce("text-[10px] flex items-start gap-1.5 leading-relaxed",l.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[u.jsx(Km,{className:"h-3 w-3 shrink-0 mt-0.5"}),u.jsxs("span",{children:["Always-On-Brain ~",l.budget.brain_gb," GB + größtes on-demand (~",l.budget.largest_ondemand_gb," GB) = ",(l.budget.brain_gb+l.budget.largest_ondemand_gb).toFixed(1)," / ",l.budget.gtt_gb," GB",l.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[u.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",V.length," von ",b.length,")"]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[u.jsx("button",{onClick:()=>Y("all"),className:ce("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",de==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),u.jsx("button",{onClick:()=>Y("in_use"),className:ce("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",de==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),u.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[u.jsx("button",{onClick:()=>be("grid"),className:ce("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),u.jsx("button",{onClick:()=>be("list"),className:ce("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",pe==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),pe==="grid"?u.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:V.length===0?u.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:de==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):V.map(F=>{const he=j.includes(F.name),Ae=c==null?void 0:c.model_list.find(Ye=>Ye.role===F.role),Ue=Pw(F.name);return u.jsxs("div",{className:ce("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",he?"border-primary/45 shadow-primary/5":F.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[u.jsxs("div",{className:"space-y-3",children:[u.jsx("div",{className:"flex items-start justify-between gap-3",children:u.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[u.jsx("div",{className:ce("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ue.color),title:Ue.name,children:Ue.initial}),u.jsxs("div",{className:"min-w-0",children:[u.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:F.name,children:F.name.split("/").pop()}),u.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[u.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:F.quant||"GGUF"}),he&&u.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[u.jsx(ku,{className:"h-3 w-3 animate-pulse"})," Warm"]}),F.role&&u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:F.role}),F.prompt_cache&&u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),F.spec_active?u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${F.spec_draft_model})`,children:"SPEC"}):F.spec_draft_model?u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${F.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,F.parallel_slots>1&&u.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${F.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",F.parallel_slots]}),F.incomplete&&u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),u.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:u.jsx(M2,{caps:F.capabilities})})]}),u.jsxs("div",{className:"space-y-3 pt-1",children:[u.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[u.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[u.jsx(Km,{className:"h-3.5 w-3.5 text-primary/80"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),u.jsx("div",{className:"text-foreground font-semibold",children:qr(F.size_bytes)})]})]}),u.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[u.jsx(BI,{className:"h-3.5 w-3.5 text-primary/80"}),u.jsxs("div",{children:[u.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),u.jsx("div",{className:"text-foreground font-semibold",children:Nw(F.ctx)})]})]})]}),Ae&&u.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[u.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),u.jsxs("span",{children:["Upgrade verfügbar: ",Ae.repo.split("/").pop()]})]}),u.jsxs("button",{onClick:()=>_e(Ae.repo,F.role,F.quant||"Q4_K_M",F.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[u.jsx(Ts,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),u.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[u.jsx("button",{onClick:()=>he?te(F.name):Pe(F.name),disabled:F.incomplete&&!he,className:ce("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",F.incomplete&&!he?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":he?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:he?"Entladen":"Laden"}),u.jsx("button",{onClick:()=>Je(F.name,F.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),u.jsxs("button",{onClick:()=>B(F),className:ce("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",F.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":F.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[u.jsx(uo,{className:"h-3 w-3"})," Spec"]}),u.jsx("button",{onClick:()=>Be(F.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:u.jsx(nv,{className:"h-3.5 w-3.5"})})]})]})]},F.name)})}):u.jsx("div",{className:"space-y-2",children:V.length===0?u.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:de==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):V.map(F=>{const he=j.includes(F.name),Ae=Pw(F.name);return u.jsxs("div",{className:ce("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",he?"border-primary/45":F.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[u.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[u.jsx("div",{className:ce("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ae.color),title:Ae.name,children:Ae.initial}),u.jsxs("div",{className:"min-w-0 text-left",children:[u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:F.name,children:F.name.split("/").pop()}),F.role&&u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:F.role}),F.prompt_cache&&u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),F.spec_active?u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${F.spec_draft_model})`,children:"SPEC"}):F.spec_draft_model?u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${F.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,F.parallel_slots>1&&u.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${F.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",F.parallel_slots]}),F.incomplete&&u.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),he&&u.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),u.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[u.jsxs("span",{children:["Größe: ",qr(F.size_bytes)]}),u.jsx("span",{children:"•"}),u.jsxs("span",{children:["Kontext: ",Nw(F.ctx)]}),u.jsx("span",{children:"•"}),u.jsx("span",{className:"font-mono text-[9px]",children:F.quant||"GGUF"})]})]})]}),u.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[u.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:u.jsx(M2,{caps:F.capabilities})}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("button",{onClick:()=>he?te(F.name):Pe(F.name),disabled:F.incomplete&&!he,className:ce("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",F.incomplete&&!he?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":he?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:he?"Entladen":"Laden"}),u.jsx("button",{onClick:()=>Je(F.name,F.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),u.jsxs("button",{onClick:()=>B(F),className:ce("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",F.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":F.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[u.jsx(uo,{className:"h-3 w-3"})," Spec"]}),u.jsx("button",{onClick:()=>Be(F.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:u.jsx(nv,{className:"h-3.5 w-3.5"})})]})]})]},F.name)})})]}),O&&(()=>{var Ye,Jt;const F=_&&_.role===O?_:null,he={};F==null||F.models.forEach(tt=>{he[tt.name]=tt});const Ae=F?F.models.map(tt=>b.find(yt=>yt.name===tt.name)).filter(Boolean):b,Ue=tt=>{Oe(O,tt),P(null)};return u.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[u.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",O,"' konfigurieren"]}),u.jsx("button",{onClick:()=>P(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",u.jsx("strong",{className:"text-foreground",children:O}),":"]}),(F==null?void 0:F.recommended)&&u.jsxs("button",{onClick:()=>Ue(F.recommended),title:(Ye=he[F.recommended])==null?void 0:Ye.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[u.jsx(uo,{className:"h-3 w-3"})," Auto: ",(Jt=F.recommended.split("/").pop())==null?void 0:Jt.replace(/\.gguf$/i,"")]})]}),u.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[u.jsx("button",{onClick:()=>Ue(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:u.jsx("span",{children:"Zuweisung entfernen"})}),Ae.map(tt=>{var fl;const yt=he[tt.name],Na=tt.role===O,dl=!!(yt!=null&&yt.recommended),hc=!!yt&&!yt.suitable;return u.jsxs("button",{onClick:()=>Ue(tt.name),className:ce("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",dl?"border-primary/50 bg-primary/10":Na?"text-primary font-bold bg-primary/5 border-primary/30":hc?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[u.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[u.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(fl=tt.name.split("/").pop())==null?void 0:fl.replace(/\.gguf$/i,""),dl&&u.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),u.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:yt?`${yt.params_b}B · ${tt.quant} · ${yt.reason}`:`${qr(tt.size_bytes)} · ${tt.quant}`})]}),Na&&u.jsx(Yr,{className:"h-4 w-4 shrink-0 text-primary"})]},tt.name)})]})]})})})(),I&&u.jsx(SY,{model:I,onClose:()=>B(null),onChanged:S}),U&&u.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[u.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[u.jsx(yi,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),u.jsx("button",{onClick:()=>G(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",u.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",u.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),u.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:b.map(F=>{var Ae;const he=F.role==="hermes";return u.jsxs("button",{onClick:()=>!he&&ur(F.name),disabled:he||F.incomplete,className:ce("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",he?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":F.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[u.jsxs("div",{className:"flex flex-col min-w-0",children:[u.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(Ae=F.name.split("/").pop())==null?void 0:Ae.replace(/\.gguf$/i,"")}),u.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[F.capabilities.params_b?`${F.capabilities.params_b}B`:"?"," · ",qr(F.size_bytes),F.role&&` · Rolle: ${F.role}`,F.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),he?u.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[u.jsx(Yr,{className:"h-3.5 w-3.5"})," Aktiv"]}):u.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},F.name)})}),u.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[u.jsx("span",{children:"💡"}),u.jsxs("span",{children:["Für einen ",u.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),x]})}function EY(){const[e,t]=v.useState(""),[r,n]=v.useState([]),[a,o]=v.useState("Q4_K_M"),[c,l]=v.useState(""),[f,h]=v.useState(""),[p,g]=v.useState(""),[x,b]=v.useState([]),[j,k]=v.useState(null),[S,N]=v.useState(!1),E=["fast","heavy","coder","vision","scout"],{data:O}=No(),P=f?O==null?void 0:O.models.find($=>($.role||"").toLowerCase()===f):void 0;async function _($,fe,J){if(N(!1),!$.trim()){k(null);return}try{const pe=await Ce(`/api/fit?params_b=0&quant=${encodeURIComponent(fe)}&ctx=8192&name=${encodeURIComponent($)}&role=${encodeURIComponent(J)}`);k(pe)}catch{k(null)}}async function C($){const fe=$??e;if(fe.trim()){l("Analysiere HuggingFace Repository..."),k(null);try{const J=await Ce(`/api/hf/quants?repo=${encodeURIComponent(fe)}`);t(J.repo),n(J.quants);const pe=J.quants.length?J.quants.includes("Q4_K_M")?"Q4_K_M":J.quants[0]:a;J.quants.length&&o(pe),l(J.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),J.quants.length&&_(J.repo,pe,f)}catch(J){l(`Fehler: ${J}`)}}}function I($){o($),_(e,$,f)}function B($){h($),r.length&&_(e,a,$)}async function U(){if(p.trim()){l("Durchsuche HuggingFace...");try{const $=await Ce(`/api/hf/search?q=${encodeURIComponent(p)}`);b($.results),l($.results.length?"":"Keine Ergebnisse gefunden.")}catch($){l(`Suche fehlgeschlagen: ${$}`)}}}async function G(){if(e.trim()){if((j==null?void 0:j.fit.level)==="too_tight"&&!S){N(!0);return}l("Download-Job wird initiiert...");try{await Ce("/api/models/install",{method:"POST",body:JSON.stringify({repo:e,quant:a,role:f||void 0,jinja:!0})}),N(!1),l(`Download gestartet: ${e} (${a})${f?`, Rolle: ${f}`:""}. Fortschritt oben.`+(P?` „${f}" wurde von ${P.name} übernommen.`:"")+(f==="fast"||f==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch($){l(`Download-Fehler: ${$}`)}}}const X=(j==null?void 0:j.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(j==null?void 0:j.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return u.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[u.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),u.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[u.jsx("input",{value:e,onChange:$=>{t($.target.value),k(null),N(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:()=>C(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),r.length>0&&u.jsxs(u.Fragment,{children:[u.jsx("select",{value:a,onChange:$=>I($.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:r.map($=>u.jsx("option",{value:$,className:"bg-popover text-foreground",children:$},$))}),u.jsxs("select",{value:f,onChange:$=>B($.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[u.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),E.map($=>u.jsx("option",{value:$,className:"bg-popover text-foreground",children:$},$))]}),u.jsx("button",{onClick:G,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${S?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:S?u.jsxs(u.Fragment,{children:[u.jsx(Ds,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):u.jsxs(u.Fragment,{children:[u.jsx(Ts,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),j&&u.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${X}`,children:[u.jsx("span",{className:"font-bold uppercase tracking-wide",children:j.fit.text}),u.jsxs("span",{className:"font-mono opacity-90",children:["~",j.params_b,"B · ~",j.fit.req_gb," GB / ",j.sys_ram_gb," GB RAM · ~",j.fit.tps," t/s"]}),j.fit.level!=="too_tight"&&u.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${j.budget.gtt_gb} GB − reserviert ${j.budget.reserved_gb} GB (${j.budget.mode}) → ${j.budget.budget_gb} GB frei`,children:["ctx → ",(j.assigned_ctx/1024).toFixed(0),"k"]}),j.fit.level==="too_tight"&&u.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),P&&u.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] font-medium text-amber-400",children:[u.jsx(Ds,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),u.jsxs("span",{children:["Rolle ",u.jsxs("strong",{children:["„",f,'"']})," ist aktuell ",u.jsx("strong",{children:P.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",P.name," bleibt installiert, verliert sie aber."]})]}),u.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[u.jsxs("div",{className:"relative flex-1",children:[u.jsx("input",{value:p,onChange:$=>g($.target.value),onKeyDown:$=>$.key==="Enter"&&U(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),u.jsx(my,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),u.jsx("button",{onClick:U,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),x.length>0&&u.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:x.map($=>u.jsxs("button",{onClick:()=>{t($.repo),b([]),g(""),C($.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[u.jsx("span",{className:"font-semibold truncate",children:$.repo}),u.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[u.jsx(Ts,{className:"h-3 w-3"})," ",$.downloads.toLocaleString()]})]},$.repo))}),c&&u.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:c})]})}const AY={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:uo},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:ah},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:pN},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:ev},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:Jg}};function PY(){const{data:e,isLoading:t,error:r}=c4(),{data:n}=No(),{data:a}=jy(),o=(n==null?void 0:n.models)??[],c=r?String(r):"",[l,f]=v.useState({}),[h,p]=v.useState({}),[g,x]=v.useState(!1);async function b(j,k,S,N){f(E=>({...E,[j]:"Starte..."}));try{await Ce("/api/models/install",{method:"POST",body:JSON.stringify({repo:j,role:k,quant:S,jinja:N})}),f(E=>({...E,[j]:"Download läuft"}))}catch{f(O=>({...O,[j]:"Fehler"}))}}return t?u.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):c||!e?u.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",c,")."]}):u.jsxs("div",{className:"space-y-8",children:[u.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[u.jsxs("div",{children:["Modell-Registry geladen für ",u.jsxs("span",{className:"text-foreground font-bold",children:[e.sys_ram_gb," GB"]})," System-RAM."]}),u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx(qI,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),u.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),u.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:e.categories.map(j=>{const k=AY[j.role]||{title:j.title||j.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:oh},S=k.icon,N=o.find(I=>I.role===j.role),E=a==null?void 0:a.model_list.find(I=>I.role===j.role),O=j.models.find(I=>I.repo===j.recommended)||j.models[0];if(!O)return null;const P=l[O.repo],_=j.models.filter(I=>I.repo!==j.recommended),C=!!h[j.role];return u.jsxs("div",{className:ce("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",N?"border-border/60":"border-primary/20 shadow-primary/5"),children:[u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:u.jsx(S,{className:"h-5.5 w-5.5"})}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:k.title}),u.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",j.role]})]})]}),N?u.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):u.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),u.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:k.desc}),u.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:N?u.jsxs("div",{className:"space-y-1.5",children:[u.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),u.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:N.name,children:N.name.split("/").pop()}),u.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[u.jsxs("span",{children:["Größe: ",cv(N.size_bytes||0)]}),u.jsx("span",{children:"•"}),u.jsxs("span",{children:["Quant: ",N.quant||"GGUF"]})]})]}):u.jsxs("div",{className:"space-y-1.5",children:[u.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),u.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:O.name,children:O.name}),u.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[u.jsxs("span",{children:["Ersteller: ",O.author]}),u.jsx("span",{children:"•"}),u.jsxs("span",{children:["Quant: ",O.quant]})]}),u.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:u.jsx(V4,{fit:O.fit})})]})}),u.jsx("div",{className:"pt-1",children:N?E?u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[u.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),u.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),u.jsxs("button",{onClick:()=>b(E.repo,j.role,O.quant||"Q4_K_M",O.caps.tools!=="no"),disabled:!!l[E.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[u.jsx(Ts,{className:"h-3.5 w-3.5"}),l[E.repo]||"Auf neue Version aktualisieren"]})]}):u.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[u.jsx(Yr,{className:"h-4 w-4"})," Auf neuestem Stand"]}):u.jsxs("button",{onClick:()=>b(O.repo,j.role,O.quant||"Q4_K_M",O.caps.tools!=="no"),disabled:!!P,className:ce("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",P?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[u.jsx(Ts,{className:"h-3.5 w-3.5"}),P||"Optimales Modell einsetzen"]})})]}),_.length>0&&u.jsxs("div",{className:"border-t border-border/20 pt-3",children:[u.jsxs("button",{onClick:()=>p(I=>({...I,[j.role]:!C})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[C?u.jsx(vI,{className:"h-3 w-3"}):u.jsx(mI,{className:"h-3 w-3"}),u.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",_.length,")"]})]}),C&&u.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:_.map(I=>u.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[u.jsxs("div",{className:"min-w-0",children:[u.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:I.name,children:I.name}),u.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[u.jsxs("span",{children:["Quant: ",I.quant]}),u.jsx("span",{children:"•"}),u.jsx("span",{children:I.fit.text})]})]}),u.jsx("button",{onClick:()=>b(I.repo,j.role,I.quant||"Q4_K_M",I.caps.tools!=="no"),disabled:!!l[I.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:l[I.repo]||"Installieren"})]},I.repo))})]})]},j.role)})}),u.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[u.jsxs("button",{onClick:()=>x(!g),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(my,{className:"h-4 w-4 text-primary"}),u.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),u.jsx("span",{className:"text-[10px] text-primary hover:underline",children:g?"Ausblenden ▲":"Anzeigen ▼"})]}),g&&u.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:u.jsx(EY,{})})]})]})}function CY(){const[e,t]=v.useState("cockpit");return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),u.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(r=>u.jsx("button",{onClick:()=>t(r),className:ce("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",e===r?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:r==="cockpit"?"Cockpit":"Modelle finden"},r))})]}),u.jsx(jY,{}),u.jsx("div",{className:"transition-all duration-300",children:e==="cockpit"?u.jsx(NY,{}):u.jsx(PY,{})})]})}const OY={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function I2({line:e,loading:t}){return t||!e?u.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[u.jsx(DI,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):e.ok?u.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[u.jsx(yI,{className:"h-3 w-3"})," ",e.detail]}):u.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[u.jsx(bI,{className:"h-3 w-3"})," ",e.detail]})}function T2({tool:e,fileName:t,accent:r,copied:n,onCopy:a}){return u.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[u.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),u.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),u.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),u.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:u.jsx("span",{children:t})}),u.jsxs("button",{onClick:a,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[n?u.jsx(Yr,{className:"h-3.5 w-3.5 text-emerald-400"}):u.jsx(sf,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:n?"Kopiert":"Kopieren"})]})]}),u.jsx("pre",{className:ce("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",r==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:u.jsx("code",{children:e.snippet})})]})}function _Y(){const[e,t]=v.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[r,n]=v.useState(localStorage.getItem("mc_mcp_path")||""),[a,o]=v.useState("cline"),[c,l]=v.useState(null),f=new URLSearchParams({host:e});r&&f.set("mcp_path",r);const{data:h,error:p}=XN(f.toString()),{data:g,isLoading:x}=f4(),b=p?String(p):"";function j(E){t(E),E&&localStorage.setItem("mc_host",E)}function k(E){n(E),localStorage.setItem("mc_mcp_path",E)}const S=h==null?void 0:h.tools[a];async function N(E,O){O&&(await navigator.clipboard.writeText(O),l(E),setTimeout(()=>l(null),1500))}return u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",u.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),u.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[u.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[u.jsx(OI,{className:"h-7 w-7 mx-auto text-muted-foreground"}),u.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),u.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),u.jsxs("div",{className:"flex flex-col gap-2.5",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(iw,{className:"h-4 w-4 text-muted-foreground shrink-0"}),u.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[u.jsx(zn,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),u.jsx(I2,{line:g==null?void 0:g.gateway,loading:x})]}),u.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx(iw,{className:"h-4 w-4 text-muted-foreground shrink-0"}),u.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[u.jsxs("div",{className:"flex items-center justify-between gap-2",children:[u.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[u.jsx(ah,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),u.jsx(I2,{line:g==null?void 0:g.memory,loading:x})]}),u.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),u.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",u.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",u.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),u.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[u.jsxs("div",{className:"space-y-1.5",children:[u.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[u.jsx(PI,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),u.jsx("input",{value:e,onChange:E=>j(E.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[u.jsx(EI,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",u.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),u.jsx("input",{value:r,onChange:E=>k(E.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),b&&u.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",b]}),h&&u.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[u.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[u.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),u.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),u.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(h.tools).map(([E,O])=>u.jsx("button",{onClick:()=>o(E),className:ce("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",a===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:O.label},E))}),S&&u.jsxs(u.Fragment,{children:[S.note&&u.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[u.jsx(ow,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),u.jsx("span",{children:S.note})]}),u.jsx(T2,{tool:S,fileName:OY[a]||"config.json",accent:"teal",copied:c==="model",onCopy:()=>N("model",S.snippet)})]})]}),u.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[u.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",u.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),u.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",u.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),u.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[u.jsx(ow,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),u.jsx("span",{children:h.memory.note})]}),u.jsx(T2,{tool:h.memory,fileName:"mcp.json",accent:"violet",copied:c==="memory",onCopy:()=>N("memory",h.memory.snippet)})]})]})]})}const MY="modulepreload",IY=function(e){return"/"+e},D2={},TY=function(t,r,n){let a=Promise.resolve();if(r&&r.length>0){let c=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),f=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=c(r.map(h=>{if(h=IY(h),h in D2)return;D2[h]=!0;const p=h.endsWith(".css"),g=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${g}`))return;const x=document.createElement("link");if(x.rel=p?"stylesheet":MY,p||(x.as="script"),x.crossOrigin="",x.href=h,f&&x.setAttribute("nonce",f),document.head.appendChild(x),p)return new Promise((b,j)=>{x.addEventListener("load",b),x.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(c){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=c,window.dispatchEvent(l),!l.defaultPrevented)throw c}return a.then(c=>{for(const l of c||[])l.status==="rejected"&&o(l.reason);return t().catch(o)})};class DY extends v.Component{constructor(){super(...arguments);Ql(this,"state",{error:null})}static getDerivedStateFromError(r){return{error:r}}render(){return this.state.error?u.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[u.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),u.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const RY=v.lazy(()=>TY(()=>import("./GraphView-DvI7ySJd.js"),[]).then(e=>({default:e.GraphView}))),R2=["identity","knowledge","rules","events"],$2=new Set(["auto","agent","hermes"]),Dg={identity:{label:"Identität",icon:QI,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:Su,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:HI,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:wI,bg:"bg-amber-500/10",text:"text-amber-400"}},L2={label:"Gedächtnis",icon:Xg,bg:"bg-muted/10",text:"text-muted-foreground"},$Y={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},z2=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: -1) wer ich bin und woran ich gerade arbeite, -2) wie ich angesprochen werden möchte, -3) meine bevorzugten Tools, Sprachen und Arbeitsweise, -4) wichtige Regeln/Konventionen, die du beachten sollst, -5) meine Infrastruktur (Server, Dienste – ohne Geheimnisse). -Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function LY(){const[e,t]=v.useState(""),[r,n]=v.useState(""),[a,o]=v.useState(""),[c,l]=v.useState("knowledge"),[f,h]=v.useState(!1),[p,g]=v.useState(!1),[x,b]=v.useState("graph"),[j,k]=v.useState(!1),S=jo(),{showAlert:N,showConfirm:E,dialogElement:O}=sl(),{data:P=[]}=uv({}),{data:_=[],error:C}=uv({q:r,category:e}),{data:I}=i4(x==="graph"),B=C?String(C):"",U=()=>{S.invalidateQueries({queryKey:["memory"]}),S.invalidateQueries({queryKey:["memory-graph"]})},G=v.useMemo(()=>{const V=P.length,Q=P.filter(D=>$2.has(D.source)).length;return{total:V,auto:Q,manual:V-Q,cats:new Set(P.map(D=>D.category)).size}},[P]),X=P.length===0,$=v.useMemo(()=>{const V=I??{nodes:[],edges:[]};if(!r.trim())return V;const Q=r.toLowerCase(),D=V.nodes.filter(Z=>Z.content.toLowerCase().includes(Q)),T=new Set(D.map(Z=>Z.id));return{nodes:D,edges:V.edges.filter(Z=>T.has(Z.source)&&T.has(Z.target))}},[I,r]);async function fe(){a.trim()&&(await Ce("/api/memory",{method:"POST",body:JSON.stringify({content:a,category:c,source:"ui"})}),o(""),k(!1),U())}async function J(V){await Ce(`/api/memory/${V}`,{method:"DELETE"}),U()}async function pe(){try{await navigator.clipboard.writeText(z2),g(!0),setTimeout(()=>g(!1),1800)}catch{N("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function be(){pe(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function de(){h(!0);try{const V=await Ce("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(V.duplicate_count===0){N("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${V.duplicate_count} Dublette(n) in ${V.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await Ce("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),U()}catch(Q){N("Fehler",`Fehler beim Löschen: ${Q.message}`)}})}catch(V){N("Fehler",`Fehler bei der Deduplizierung: ${V.message}`)}finally{h(!1)}}const Y=({value:V,label:Q,accent:D})=>u.jsxs("span",{className:ce("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",D==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[D==="auto"&&u.jsx(du,{className:"h-3 w-3"}),u.jsx("b",{className:ce("font-semibold",D==="auto"?"":"text-foreground"),children:V})," ",Q]});return u.jsxs("div",{className:"space-y-5",children:[u.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),u.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),u.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[u.jsxs("div",{className:"relative",children:[u.jsx("input",{value:r,onChange:V=>n(V.target.value),placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),u.jsx(my,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),u.jsxs("button",{onClick:()=>k(V=>!V),className:"h-9 px-3 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[u.jsx(rv,{className:"h-4 w-4"})," Eintrag"]}),u.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",TI,"Liste"],["graph",GI,"Graph"]].map(([V,Q,D])=>u.jsxs("button",{onClick:()=>b(V),className:ce("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",x===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[u.jsx(Q,{className:"h-3.5 w-3.5"})," ",D]},V))}),u.jsx("button",{onClick:de,disabled:f,className:"flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",title:"Deduplizieren",children:u.jsx(du,{className:"h-4 w-4 text-primary"})})]})]}),!X&&u.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u.jsx(Y,{value:G.total,label:"Fakten"}),u.jsx(Y,{value:G.auto,label:"auto gelernt",accent:"auto"}),u.jsx(Y,{value:G.manual,label:"manuell"}),u.jsx(Y,{value:G.cats,label:"Kategorien"}),u.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[u.jsx(du,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),j&&u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),u.jsx("button",{onClick:()=>k(!1),className:"text-muted-foreground hover:text-foreground",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsx("textarea",{value:a,onChange:V=>o(V.target.value),rows:2,placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),u.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[u.jsx("select",{value:c,onChange:V=>l(V.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:R2.map(V=>{var Q;return u.jsx("option",{value:V,className:"bg-popover text-foreground",children:((Q=Dg[V])==null?void 0:Q.label)||V},V)})}),u.jsxs("button",{onClick:fe,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[u.jsx(rv,{className:"h-4 w-4"})," Speichern"]})]})]}),B&&u.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",B]}),X?u.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[u.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:u.jsx($I,{className:"h-7 w-7 text-primary"})}),u.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[u.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),u.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),u.jsxs("div",{className:"w-full max-w-lg text-left",children:[u.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[u.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),u.jsx("button",{onClick:pe,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:p?u.jsxs(u.Fragment,{children:[u.jsx(Yr,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):u.jsxs(u.Fragment,{children:[u.jsx(sf,{className:"h-3 w-3"})," Kopieren"]})})]}),u.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:z2})]}),u.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[u.jsxs("button",{onClick:be,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[u.jsx(gN,{className:"h-4 w-4"})," Im Terminal starten"]}),u.jsxs("button",{onClick:pe,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[p?u.jsx(Yr,{className:"h-4 w-4 text-emerald-400"}):u.jsx(sf,{className:"h-4 w-4"})," Prompt kopieren"]})]}),u.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[u.jsx(KI,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",u.jsx("button",{onClick:()=>k(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):x==="graph"?u.jsx(DY,{children:u.jsx(v.Suspense,{fallback:u.jsx("div",{className:"h-[480px] rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:u.jsx(RY,{data:$,onDelete:J})})}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl w-fit",children:[u.jsx("button",{onClick:()=>t(""),className:ce("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer",e?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),R2.map(V=>{const Q=Dg[V]||L2,D=Q.icon;return u.jsxs("button",{onClick:()=>t(V),className:ce("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",e===V?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[u.jsx(D,{className:"h-3 w-3"})," ",Q.label]},V)})]}),u.jsx("div",{className:"space-y-3",children:_.length===0?u.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):_.map(V=>{const Q=Dg[V.category]||L2,D=Q.icon,T=$2.has(V.source);return u.jsxs("div",{className:ce("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",$Y[V.category]||"border-l-muted"),children:[u.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[u.jsxs("span",{className:ce("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",Q.bg,Q.text),children:[u.jsx(D,{className:"h-3 w-3"}),u.jsx("span",{className:"hidden sm:inline",children:Q.label})]}),u.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:V.content})]}),u.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[typeof V.score=="number"&&u.jsxs("span",{className:"text-[9px] font-mono text-primary bg-primary/10 px-1.5 py-0.5 rounded uppercase tracking-wider",title:"Relevanz der semantischen Suche",children:[Math.round(V.score*100),"%"]}),u.jsxs("span",{className:ce("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded uppercase tracking-wider",T?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:T?"Automatisch gelernt":"Manuell angelegt",children:[T&&u.jsx(du,{className:"h-2.5 w-2.5"}),V.source]}),u.jsx("button",{onClick:()=>J(V.id),title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:u.jsx(nv,{className:"h-3.5 w-3.5"})})]})]},V.id)})})]}),O]})}function qd({label:e,ok:t,detail:r,icon:n,onClick:a}){return u.jsxs("div",{onClick:a,className:ce("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",t?"border-border/60":"border-amber-500/30",a&&"cursor-pointer hover:bg-card/70"),children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:e}),u.jsx(n,{className:ce("h-4.5 w-4.5",t?"text-primary":"text-amber-500")})]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:ce("h-2 w-2 rounded-full ring-2 ring-black/40",t?"bg-emerald-500 animate-pulse":"bg-amber-500")}),u.jsx("span",{className:"text-xs font-semibold text-foreground",children:t?"Bereit / Online":"Offline / Inaktiv"})]}),r&&u.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:r,children:r})]}),a&&u.jsxs("button",{onClick:o=>{o.stopPropagation(),a()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[u.jsx(zn,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Gehirn wechseln"})]})]})}function zY(){const{data:e,error:t}=ky(5e3),{data:r}=No(),{showAlert:n,dialogElement:a}=sl(),o=jo(),c=t?String(t):"",l=v.useMemo(()=>["auto","fast","heavy",...((r==null?void 0:r.models)??[]).map(_=>{var C;return((C=_.name.split("/").pop())==null?void 0:C.replace(".gguf",""))||_.name})],[r]),[f,h]=v.useState(null),[p,g]=v.useState(!1),[x,b]=v.useState({width:800,height:360}),j=v.useRef(null),k=v.useCallback(P=>{if(j.current&&(j.current.disconnect(),j.current=null),P){const _=new ResizeObserver(C=>{if(!C||C.length===0)return;const I=C[0].contentRect;b({width:I.width,height:I.height})});_.observe(P),j.current=_}},[]),S=x.width,N=x.height,E=(P,_,C,I)=>{const B=(P+C)/2;return`M ${P} ${_} C ${B} ${_}, ${B} ${I}, ${C} ${I}`};async function O(P){try{await Ce("/api/agent/brain",{method:"POST",body:JSON.stringify({model:P})}),n("Erfolgreich",`Hermes-Gehirn wurde auf '${P}' geändert. Der Gateway-Dienst wurde neu gestartet.`),o.invalidateQueries({queryKey:kt.agentStatus}),g(!1)}catch(_){n("Fehler",`Fehler beim Wechseln des Gehirns: ${_.message}`)}}return u.jsxs("div",{className:"space-y-6",children:[u.jsx("style",{children:` - @keyframes flow-dash { - to { - stroke-dashoffset: -20; - } - } - .svg-flow-path { - stroke-dasharray: 4 6; - animation: flow-dash 1s linear infinite; - } - `}),u.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),u.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",u.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(e==null?void 0:e.terminal_url)&&u.jsxs("a",{href:Ls(e.terminal_url),target:"_blank",rel:"noopener",className:ce("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",e.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[u.jsx(ju,{className:"h-4 w-4"}),u.jsx("span",{children:"Terminal öffnen"})]})]}),c&&u.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",c,")."]}),e&&u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[u.jsx(qd,{label:"Agent Gateway",ok:e.gateway_reachable,detail:"Port :8642 (REST API)",icon:yi}),u.jsx(qd,{label:"Terminal",ok:e.terminal_reachable,detail:"Web-Terminal (hermes chat)",icon:ku}),u.jsx(qd,{label:"Aktives Gehirn",ok:e.gateway_reachable,detail:e.brain_model?`Model: ${e.brain_model}`:"Model: auto",icon:zn,onClick:()=>g(!0)}),u.jsx(qd,{label:"Verdrahtung",ok:e.has_config,detail:`Config: ${e.has_config?"✓":"—"} · Skills: ${e.has_skills?"✓":"—"} · Memory: ${e.has_memories?"✓":"—"}`,icon:lf})]}),u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[u.jsxs("div",{children:[u.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),u.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),u.jsxs("div",{ref:k,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[u.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[u.jsxs("defs",{children:[u.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[u.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),u.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),u.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[u.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),u.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),u.jsx("path",{d:E(S*.15,N*.5,S*.5,N*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="terminal"||e.terminal_reachable)&&u.jsx("path",{d:E(S*.15,N*.5,S*.5,N*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:E(S*.5,N*.5,S*.85,N*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="brain"||e.gateway_reachable)&&u.jsx("path",{d:E(S*.5,N*.5,S*.85,N*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),u.jsx("path",{d:E(S*.5,N*.5,S*.85,N*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(f==="gateway"||f==="wiring"||e.gateway_reachable)&&u.jsx("path",{d:E(S*.5,N*.5,S*.85,N*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),u.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>h("terminal"),onMouseLeave:()=>h(null),onClick:()=>e.terminal_reachable&&window.open(Ls(e.terminal_url),"_blank"),title:e.terminal_reachable?"Klicken um das Hermes-Terminal zu öffnen":"Terminal offline",children:[u.jsx(ku,{className:ce("h-3.5 w-3.5",e.terminal_reachable?"text-emerald-400":"text-amber-500")}),u.jsx("span",{children:"Terminal"}),u.jsx("span",{className:ce("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",e.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),u.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>h("gateway"),onMouseLeave:()=>h(null),children:[u.jsxs("div",{className:"flex items-center gap-1",children:[u.jsx(yi,{className:"h-3.5 w-3.5 text-primary"}),u.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),u.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),u.jsx("div",{className:ce("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",e.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:e.gateway_reachable?"Online":"Offline"})]}),u.jsxs("div",{className:ce("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",e.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>h("brain"),onMouseLeave:()=>h(null),onClick:()=>g(!0),children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[u.jsx(zn,{className:"h-3 w-3 text-primary"}),u.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),e.gateway_reachable&&u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),u.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:e.brain_model,children:e.brain_model||"auto"})]}),u.jsxs("div",{className:ce("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",e.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>h("wiring"),onMouseLeave:()=>h(null),children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[u.jsx(lf,{className:"h-3 w-3 text-primary"}),u.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),e.has_config&&u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),u.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[u.jsxs("span",{children:["Config: ",e.has_config?"✓":"—"]}),u.jsxs("span",{children:["Skills: ",e.has_skills?"✓":"—"]}),u.jsxs("span",{children:["Memory: ",e.has_memories?"✓":"—"]})]})]})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),u.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),u.jsxs("span",{className:"flex items-center gap-1.5",children:[u.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),u.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(LI,{className:"h-5 w-5 text-primary"}),u.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("span",{className:ce("h-2 w-2 rounded-full",e.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),u.jsx("span",{className:"text-xs font-semibold text-foreground",children:e.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),u.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[u.jsxs("div",{className:"space-y-3",children:[u.jsxs("p",{children:["Der ",u.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",u.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),u.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",u.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),u.jsx("div",{className:"space-y-3",children:e.pc_executor_reachable?u.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[u.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[u.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),u.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",u.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",u.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",u.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):u.jsxs("div",{className:"space-y-2",children:[u.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),u.jsxs("p",{children:["Starte ",u.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",u.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),u.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!e.gateway_reachable&&u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Su,{className:"h-5 w-5 text-amber-500"}),u.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),u.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[u.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),u.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",u.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),u.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[u.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),u.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),u.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),u.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",u.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),e&&p&&u.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:u.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[u.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[u.jsx(zn,{className:"h-4 w-4"}),u.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),u.jsx("button",{onClick:()=>g(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',u.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",u.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",u.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),u.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:l.map(P=>{const _=["auto","fast","heavy"].includes(P);return u.jsxs("button",{onClick:()=>O(P),className:ce("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",e.brain_model===P||!e.brain_model&&P==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[u.jsxs("div",{className:"flex flex-col text-left",children:[u.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:P}),u.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:_?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(e.brain_model===P||!e.brain_model&&P==="auto")&&u.jsx(Yr,{className:"h-4 w-4 shrink-0 text-primary"})]},P)})})]})}),a]})}function FY(){const{data:e}=ky(5e3),t=e!=null&&e.terminal_url?Ls(e.terminal_url):void 0,r=e==null?void 0:e.terminal_reachable;return u.jsxs("div",{className:"flex h-full flex-col gap-4",children:[u.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Hermes Terminal"}),u.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",u.jsx("code",{className:"rounded bg-background/40 px-1 font-mono text-[11px] text-primary",children:"hermes chat"}),') mit Tools & PC-Steuerung — „mehr als Chatten".']})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[u.jsx("span",{className:`h-2 w-2 rounded-full ${r?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),r?"online":"offline"]}),t&&u.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-background/20 px-3 text-xs font-semibold text-muted-foreground transition-all hover:border-primary/50 hover:text-foreground",children:[u.jsx(ju,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),t?u.jsxs("div",{className:"relative min-h-[68vh] flex-1 overflow-hidden rounded-2xl border border-border/60 bg-black/50 shadow-lg shadow-black/25",children:[r===!1&&u.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[u.jsx(Ds,{className:"h-8 w-8 text-amber-400"}),u.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),u.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",u.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",u.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),u.jsx("iframe",{src:t,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):u.jsxs("div",{className:"flex min-h-[68vh] flex-1 items-center justify-center rounded-2xl border border-border/60 bg-background/20 text-xs text-muted-foreground",children:[u.jsx(mN,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}const F2=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function BY(e){var t;(t=document.getElementById(e))==null||t.scrollIntoView({behavior:"smooth",block:"start"})}function Mr({id:e,icon:t,color:r,title:n,kicker:a,children:o,wide:c}){return u.jsxs("section",{id:e,className:ce("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",c&&"md:col-span-2"),children:[u.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[u.jsx(t,{className:ce("h-5 w-5 shrink-0",r)}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:n}),a&&u.jsx("span",{className:ce("text-[9px] font-mono",r),children:a})]})]}),u.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:o})]})}function Ha({children:e}){return u.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[u.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[u.jsx(du,{className:"h-3 w-3"})," Bei dir konkret"]}),u.jsx("div",{className:"text-muted-foreground space-y-1",children:e})]})}function ze({children:e}){return u.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:e})}function wt({href:e,name:t,note:r}){return u.jsxs("li",{className:"leading-relaxed",children:[u.jsxs("a",{href:e,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[t,u.jsx(fI,{className:"h-3 w-3 opacity-60"})]}),u.jsxs("span",{className:"text-muted-foreground",children:[" — ",r]})]})}function UY(){const[e,t]=v.useState(!1);return u.jsxs("div",{className:"space-y-7",children:[u.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[u.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:u.jsx(Xg,{className:"h-6 w-6 text-primary"})}),u.jsxs("div",{className:"space-y-1",children:[u.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Die AI-Bibel"}),u.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",u.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",u.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),u.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:u.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:u.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[u.jsx(Jg,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(e?F2:F2.slice(0,9)).map(r=>u.jsx("button",{onClick:()=>BY(r.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:r.label},r.id)),u.jsx("button",{onClick:()=>t(r=>!r),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:e?"weniger":"+ mehr"})]})})}),u.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[u.jsxs(Mr,{id:"grundlagen",icon:zn,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[u.jsxs("p",{children:["Ein LLM ist im Kern ein ",u.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),u.jsxs("li",{children:[u.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",u.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),u.jsxs(Mr,{id:"moe",icon:oh,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[u.jsxs("p",{children:[u.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",u.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",u.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),u.jsxs("p",{children:[u.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx(ze,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),u.jsxs("li",{children:[u.jsx(ze,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),u.jsxs("li",{children:[u.jsx(ze,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),u.jsxs(Ha,{children:["VRAM/RAM ist die harte Grenze — ",u.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",u.jsx(ze,{children:"Q4_K_M"}),"/",u.jsx(ze,{children:"Q6_K"}),"."]})]}),u.jsxs(Mr,{id:"lokal",icon:gy,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[u.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{children:[u.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"llama-swap"})," — Proxy, der ",u.jsx("em",{children:"mehrere"})," Modelle hinter ",u.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{children:[u.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),u.jsx("ul",{className:"list-disc pl-4 space-y-1",children:u.jsxs("li",{children:[u.jsx(ze,{children:"CUDA"})," NVIDIA · ",u.jsx(ze,{children:"ROCm"})," AMD · ",u.jsx(ze,{children:"Vulkan"})," herstellerübergreifend · ",u.jsx(ze,{children:"Metal"})," Apple"]})}),u.jsxs("p",{className:"pt-1",children:[u.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",u.jsx(ze,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",u.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),u.jsxs(Ha,{children:["Deine Box hat eine AMD-APU (gfx1151). ",u.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",u.jsx(ze,{children:"Vulkan/RADV"})," das offizielle ",u.jsx(ze,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",u.jsx(ze,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",u.jsx(ze,{children:"coder"})," nutzt Spec-Decoding."]})]}),u.jsxs(Mr,{id:"modelle",icon:Zg,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[u.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx("p",{children:u.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Llama"})," (Meta), ",u.jsx("strong",{children:"Gemma"})," (Google), ",u.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"DeepSeek"}),", ",u.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsx("p",{children:u.jsx("strong",{children:"Frontier (Cloud-API):"})}),u.jsx("ul",{className:"list-disc pl-4 space-y-1",children:u.jsxs("li",{children:[u.jsx("strong",{children:"Claude"})," (Anthropic), ",u.jsx("strong",{children:"GPT"})," (OpenAI), ",u.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),u.jsxs("p",{className:"pt-1",children:[u.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),u.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),u.jsxs(Ha,{children:["Dein Line-up via llama-swap: ",u.jsx(ze,{children:"fast"})," (Alltag/Vision/MoE) · ",u.jsx(ze,{children:"heavy"})," (schwere Logik) ·",u.jsx(ze,{children:"coder"})," · ",u.jsx(ze,{children:"scout"})," · ",u.jsx(ze,{children:"vision"})," · ",u.jsx(ze,{children:"embed"})," (fürs Gedächtnis) ·",u.jsx(ze,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",u.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),u.jsxs(Mr,{id:"gateway",icon:FI,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[u.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",u.jsx("strong",{children:"OpenAI-Format"})," (",u.jsx(ze,{children:"/v1/chat/completions"}),"). Ein",u.jsx("strong",{children:" Gateway"})," davor gibt dir ",u.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",u.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),u.jsxs("p",{children:["Die ",u.jsx(ze,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),u.jsxs(Ha,{children:["Dein Gateway: ",u.jsx(ze,{children:"http://192.168.178.151:9001/v1"}),", Model ",u.jsx(ze,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",u.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),u.jsxs(Mr,{id:"mcp",icon:tv,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[u.jsxs("p",{children:["Das ",u.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",u.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),u.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),u.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[u.jsx(RI,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),u.jsxs("span",{children:[u.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),u.jsxs(Mr,{id:"skills",icon:WI,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[u.jsxs("p",{children:["Ein ",u.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",u.jsx(ze,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),u.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- -name: tdd-pro -description: Treibt Entwicklung mit strikter TDD-Praxis ---- -# Instructions -...`}),u.jsxs("p",{children:["Suchen & installieren über die ",u.jsx("strong",{children:"skills.sh"}),"-Registry: ",u.jsx(ze,{children:"npx skills find"})," /",u.jsx(ze,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),u.jsxs(Mr,{id:"memory",icon:SI,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[u.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{children:["LLMs sind ",u.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",u.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{children:[u.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:["extrahiert Fakten ",u.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),u.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),u.jsxs("li",{children:[u.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",u.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),u.jsxs(Ha,{children:["Dein Gedächtnis (Tab ",u.jsx("strong",{children:"Gedächtnis"}),") ist ",u.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",u.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",u.jsx(ze,{children:"Identität"})," · ",u.jsx(ze,{children:"Wissen"})," · ",u.jsx(ze,{children:"Regeln"})," · ",u.jsx(ze,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",u.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",u.jsx("br",{}),u.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),u.jsxs(Mr,{id:"agents",icon:yi,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[u.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{children:["Ein ",u.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",u.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{children:[u.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),u.jsxs("p",{children:[u.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",u.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),u.jsxs(Ha,{children:[u.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",u.jsx(ze,{children:"fast"}),"). Reden tust du mit ihm im",u.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",u.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",u.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",u.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),u.jsxs(Mr,{id:"ide",icon:pN,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[u.jsxs("p",{children:["Jede ",u.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Cline"})," & ",u.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Continue"}),", ",u.jsx("strong",{children:"aider"})," (CLI), ",u.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),u.jsxs(Ha,{children:["Tipp den Kram nicht ab: der ",u.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",u.jsx(ze,{children:"…:9001/v1"}),", Model ",u.jsx(ze,{children:"auto"}),", Key beliebig."]})]}),u.jsx(Mr,{id:"tricks",icon:II,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:u.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([r,n])=>u.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[u.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[u.jsx(uo,{className:"h-3 w-3 text-amber-400"})," ",r]}),u.jsx("p",{className:"text-[11px]",children:n})]},r))})}),u.jsx(Mr,{id:"wartung",icon:Su,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:u.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[u.jsx(AI,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[u.jsx(lf,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",u.jsx(ze,{children:"restore.sh"})," (Doku in ",u.jsx(ze,{children:"docs/BACKUP.md"}),")."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",u.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",u.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),u.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),u.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[u.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[u.jsx(Jg,{className:"h-5 w-5 text-primary"}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),u.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),u.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[u.jsx(Zg,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[u.jsx(wt,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),u.jsx(wt,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),u.jsx(wt,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),u.jsx(wt,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),u.jsx(wt,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),u.jsx(wt,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[u.jsx(tv,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[u.jsx(wt,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),u.jsx(wt,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),u.jsx(wt,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),u.jsx(wt,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),u.jsx(wt,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[u.jsx(yi,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[u.jsx(wt,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),u.jsx(wt,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),u.jsx(wt,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),u.jsx(wt,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),u.jsx(wt,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[u.jsx(Xg,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),u.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[u.jsx(wt,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),u.jsx(wt,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),u.jsx(wt,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),u.jsx(wt,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),u.jsx(wt,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),u.jsx(Mr,{id:"troubleshooting",icon:MI,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:u.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[u.jsxs("li",{children:[u.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",u.jsx(ze,{children:":9001"}),")? Backend-Status in der ",u.jsx("strong",{children:"Zentrale"})," prüfen."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",u.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",u.jsx(ze,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",u.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),u.jsxs("li",{children:[u.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",u.jsx(ze,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),u.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function WY({title:e,hint:t}){return u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsx("h1",{className:"text-xl font-semibold",children:e}),u.jsx("p",{className:"text-sm text-muted-foreground",children:t})]}),u.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[u.jsx(jI,{className:"h-8 w-8 text-muted-foreground"}),u.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const B2=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function Qd({icon:e,iconClass:t,name:r,status:n,available:a,busy:o,actionLabel:c,onAction:l}){return u.jsxs("div",{className:ce("flex items-center gap-3 rounded-lg border px-3 py-2",a?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[u.jsx(e,{className:ce("h-4 w-4 shrink-0",t)}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-xs text-foreground truncate",children:r}),u.jsx("div",{className:ce("text-[10px] truncate",a?"text-amber-400/90":"text-muted-foreground"),children:n})]}),u.jsx("button",{onClick:l,disabled:!a||o,className:ce("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",a?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:o?"…":c})]})}function HY({label:e,ok:t,system:r,busy:n,onRestart:a,onLogs:o}){return u.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[u.jsx("span",{className:ce("w-1.5 h-1.5 rounded-full shrink-0",t===!0?"bg-emerald-500":t===!1?"bg-red-500":"bg-muted-foreground/40")}),u.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[e,r&&u.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),u.jsx("button",{onClick:a,disabled:n,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:u.jsx(mu,{className:ce("h-3.5 w-3.5",n&&"animate-spin")})}),u.jsx("button",{onClick:o,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:u.jsx(NI,{className:"h-3.5 w-3.5"})})]})}function Rg(e){return e==null?"":e>1024**3?`${(e/1024**3).toFixed(2)} GB`:`${(e/1024**2).toFixed(1)} MB`}function KY({open:e,onClose:t,defaultTab:r="maintenance"}){var _i;const[n,a]=v.useState(null),[o,c]=v.useState([]),[l,f]=v.useState("llama-swap"),[h,p]=v.useState(""),[g,x]=v.useState(!1),[b,j]=v.useState(null),[k,S]=v.useState({}),[N,E]=v.useState("maintenance"),[O,P]=v.useState(!1),[_,C]=v.useState(""),[I,B]=v.useState(!1),[U,G]=v.useState(null),[X,$]=v.useState([]),[fe,J]=v.useState(!1),[pe,be]=v.useState(null);function de(ee,$e,At){be({type:"alert",title:ee,message:$e,onConfirm:()=>{be(null),At&&At()}})}function Y(ee,$e,At){be({type:"confirm",title:ee,message:$e,onConfirm:()=>{be(null),At()},onCancel:()=>be(null)})}function V(ee){return ee?new Date(ee*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[Q,D]=v.useState(""),[T,Z]=v.useState(""),[oe,re]=v.useState(!1),[ue,me]=v.useState(!1);v.useEffect(()=>{e&&(D(localStorage.getItem("mc_sudo_password")||""),Z(localStorage.getItem("mc_hf_token")||""))},[e]),v.useEffect(()=>{e&&r&&E(r)},[e,r]);const Pe=v.useRef(null);function te(){Ce("/api/maintenance/updates").then(a).catch(ee=>console.error("Error loading updates",ee))}function ve(){Ce("/api/jobs").then(ee=>c(ee.jobs||[])).catch(ee=>console.error("Error loading jobs",ee))}function Oe(){Ce("/api/system/services").then(G).catch(()=>{})}function ie(){Ce("/api/system/backups").then(ee=>$(ee.backups||[])).catch(()=>{})}function Je(ee){x(!0),j(null),Ce(`/api/maintenance/logs?service=${ee}&lines=150`).then($e=>{$e.ok?p($e.text):(p(`Fehler beim Laden der Logs: ${$e.err||"Unbekannter Fehler"}`),($e.status==="incorrect_password"||$e.status==="password_required")&&j($e.status))}).catch($e=>p(`Fehler: ${$e.message}`)).finally(()=>{x(!1),setTimeout(()=>{Pe.current&&(Pe.current.scrollTop=Pe.current.scrollHeight)},50)})}v.useEffect(()=>{if(!e)return;te(),ve(),Oe(),ie();const ee=setInterval(()=>{ve(),te(),Oe()},3e3);return()=>clearInterval(ee)},[e]),v.useEffect(()=>{!e||N!=="logs"||Je(l)},[e,N,l]);async function Be(){try{await Ce("/api/maintenance/os-update",{method:"POST"}),ve(),E("maintenance")}catch(ee){de("Fehler",`Fehler beim Starten des OS-Updates: ${ee.message}`)}}async function _e(){try{await Ce("/api/maintenance/engine-update",{method:"POST"}),ve(),E("maintenance")}catch(ee){de("Fehler",`Fehler beim Engine-Update: ${ee.message}`)}}function jt(){Y("Hermes-Agent aktualisieren","Zieht die neuesten Änderungen aus git, installiert Abhängigkeiten neu und startet den Hermes-Gateway neu (vorher automatisches Backup). Fortschritt unter Hintergrund-Aufgaben.",async()=>{J(!0);try{await Ce("/api/maintenance/hermes-update",{method:"POST"}),ve()}catch(ee){de("Fehler",`Hermes-Update fehlgeschlagen: ${ee.message}`)}finally{J(!1)}})}async function ur(){P(!0);try{await Ce("/api/maintenance/check-updates",{method:"POST"}),ve(),E("maintenance")}catch(ee){de("Fehler",`Fehler bei der Update-Suche: ${ee.message}`)}finally{P(!1)}}async function Qn(ee,$e){try{await Ce("/api/models/install",{method:"POST",body:JSON.stringify({repo:ee,role:$e})}),de("Gestartet",`Modell-Upgrade für '${$e}' (${ee}) gestartet.`),ve(),E("maintenance")}catch(At){de("Fehler",`Fehler beim Starten des Modell-Upgrades: ${At.message}`)}}async function Yn(){Y("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await Ce("/api/maintenance/reboot",{method:"POST"}),de("Reboot","Reboot ausgelöst. System startet neu...",()=>{t()})}catch(ee){de("Fehler",`Fehler beim Reboot: ${ee.message}`)}})}async function sn(){B(!0),C("Snapshot wird erzeugt...");try{const ee=await Ce("/api/system/backup",{method:"POST"});C(ee.ok?`Snapshot erzeugt: ${ee.snapshot} (${ee.files.length} Komponenten)`:"Backup fehlgeschlagen."),ie()}catch(ee){C(`Fehler: ${ee.message}`)}finally{B(!1)}}async function Fr(ee){S($e=>({...$e,[ee]:!0}));try{const $e=await Ce("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:ee})});$e.ok?de("Dienst neu gestartet",`Dienst ${ee} wurde erfolgreich neu gestartet.`,()=>{N==="logs"&&l===ee&&Je(ee)}):de("Fehler",`Fehler beim Neustart: ${$e.err||"Unbekannter Fehler"}`)}catch($e){de("Fehler",`Fehler beim Neustart: ${$e.message}`)}finally{S($e=>({...$e,[ee]:!1}))}}async function Oi(ee){try{await Ce(`/api/jobs/${ee}/cancel`,{method:"POST"}),ve()}catch($e){de("Fehler",`Fehler beim Abbrechen: ${$e.message}`)}}return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:ce("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",e?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:t}),u.jsxs("div",{className:ce("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",e?"translate-x-0":"translate-x-full"),children:[u.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(zn,{className:"h-4.5 w-4.5 text-primary"}),u.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),u.jsx("button",{onClick:t,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:u.jsx(pi,{className:"h-4 w-4"})})]}),u.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[u.jsx("button",{onClick:()=>E("maintenance"),className:ce("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",N==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),u.jsx("button",{onClick:()=>E("logs"),className:ce("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",N==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),u.jsx("button",{onClick:()=>E("settings"),className:ce("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",N==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[N==="maintenance"&&u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"space-y-2.5",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),u.jsxs("button",{onClick:ur,disabled:O,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[u.jsx(mu,{className:ce("h-3 w-3",O&&"animate-spin")})," Nach Updates suchen"]})]}),(n==null?void 0:n.last_check)&&u.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",V(n.last_check)]}),u.jsxs("div",{className:"space-y-1.5",children:[u.jsx(Qd,{icon:Su,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(n!=null&&n.os),status:n!=null&&n.os?`${n.os} verfügbar`:"aktuell",actionLabel:"Aktualisieren",onAction:Be}),u.jsx(Qd,{icon:gy,iconClass:"text-violet-400",name:"Engine (llama.cpp)",available:!!(n!=null&&n.engine),status:n!=null&&n.engine?"Update verfügbar":"aktuell",actionLabel:"Aktualisieren",onAction:_e}),(()=>{var $e;const ee=($e=n==null?void 0:n.components)==null?void 0:$e.find(At=>At.key==="hermes_agent");return u.jsx(Qd,{icon:yi,iconClass:"text-amber-400",name:"Hermes-Agent",available:(ee==null?void 0:ee.update)===!0,busy:fe,status:(ee==null?void 0:ee.update)===!0?`Update: ${ee.latest}`:(ee==null?void 0:ee.reachable)===!1?"offline":"aktuell",actionLabel:"Aktualisieren",onAction:jt})})(),(_i=n==null?void 0:n.model_list)==null?void 0:_i.map(ee=>u.jsx(Qd,{icon:hI,iconClass:"text-emerald-400",name:`Modell · ${ee.role}`,available:!0,status:ee.title,actionLabel:"Upgrade",onAction:()=>Qn(ee.repo,ee.role)},ee.role))]})]}),u.jsxs("div",{className:"space-y-2.5",children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),u.jsx("div",{className:"space-y-1.5",children:B2.map(ee=>{var $e;return u.jsx(HY,{label:ee.label,system:ee.type==="system",ok:($e=U==null?void 0:U.services.find(At=>At.name.toLowerCase().includes(ee.reach)))==null?void 0:$e.ok,busy:k[ee.id],onRestart:()=>Fr(ee.id),onLogs:()=>{f(ee.id),E("logs")}},ee.id)})})]}),u.jsxs("div",{className:"space-y-2.5",children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),u.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("div",{className:"text-xs text-foreground truncate",children:X[0]?`Letztes: ${X[0].snapshot}`:"Noch kein Backup"}),u.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[X.length," Snapshots · Restore per CLI (restore.sh)"]})]}),u.jsxs("button",{onClick:sn,disabled:I,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[u.jsx(pI,{className:ce("h-3.5 w-3.5",I&&"animate-pulse")})," Snapshot"]})]}),_&&u.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:_})]}),u.jsxs("div",{className:"space-y-2.5",children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),u.jsxs("button",{onClick:Yn,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[u.jsx(UI,{className:"h-4.5 w-4.5"}),u.jsxs("div",{children:[u.jsx("div",{children:"Host-System neu starten"}),u.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),u.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[o.filter(ee=>ee.state==="running"||ee.state==="queued").length," Aktiv"]})]}),u.jsx("div",{className:"space-y-3",children:o.length===0?u.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):o.map(ee=>{const $e=ee.state==="running"||ee.state==="queued";return u.jsxs("div",{className:ce("p-3 rounded-xl border transition-all duration-300",$e?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[u.jsxs("div",{className:"flex items-start justify-between gap-3",children:[u.jsxs("div",{className:"space-y-1",children:[u.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[$e&&u.jsxs("span",{className:"flex h-2 w-2 relative",children:[u.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),u.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),ee.label]}),u.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[u.jsxs("span",{children:["ID: ",ee.id]}),u.jsx("span",{children:"•"}),u.jsx("span",{className:ce(ee.state==="done"&&"text-emerald-400",ee.state==="failed"&&"text-red-400",ee.state==="running"&&"text-primary",ee.state==="queued"&&"text-amber-400",ee.state==="canceled"&&"text-muted-foreground"),children:ee.state})]})]}),$e&&u.jsx("button",{onClick:()=>Oi(ee.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),ee.state==="running"&&u.jsxs("div",{className:"mt-3 space-y-1",children:[u.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:u.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${ee.progress??0}%`}})}),u.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[u.jsxs("span",{children:[ee.progress??0,"%"]}),ee.done_bytes!=null&&ee.total_bytes!=null&&u.jsxs("span",{children:[Rg(ee.done_bytes)," / ",Rg(ee.total_bytes),ee.rate_bps!=null&&` (${Rg(ee.rate_bps)}/s)`]}),ee.eta_s!=null&&u.jsxs("span",{children:["ETA: ",ee.eta_s,"s"]})]})]})]},ee.id)})})]})]}),N==="logs"&&u.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("select",{value:l,onChange:ee=>f(ee.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:B2.map(ee=>u.jsxs("option",{value:ee.id,children:[ee.label," (",ee.type==="system"?"systemd-root":"user",")"]},ee.id))}),u.jsxs("button",{onClick:()=>Fr(l),disabled:k[l],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[u.jsx(mu,{className:ce("h-3.5 w-3.5",k[l]&&"animate-spin")}),"Restart"]})]}),u.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[u.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[u.jsx(gN,{className:"h-3 w-3 text-primary"}),u.jsxs("span",{children:["stdout/stderr - ",l]})]}),u.jsx("button",{onClick:()=>Je(l),disabled:g,className:"text-muted-foreground hover:text-foreground transition-colors",children:u.jsx(mu,{className:ce("h-3 w-3",g&&"animate-spin")})})]}),u.jsx("pre",{ref:Pe,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:b==="password_required"||b==="incorrect_password"?u.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[u.jsx(Ds,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),u.jsx("div",{className:"text-xs font-semibold text-amber-300",children:b==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),u.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",l," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),u.jsx("button",{onClick:()=>E("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):g&&!h?u.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):h||u.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),N==="settings"&&u.jsxs("div",{className:"space-y-6",children:[u.jsxs("div",{className:"space-y-2",children:[u.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),u.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[u.jsx(Su,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),u.jsxs("div",{className:"relative",children:[u.jsx("input",{type:oe?"text":"password",value:Q,onChange:ee=>D(ee.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),u.jsx("button",{type:"button",onClick:()=>re(!oe),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:oe?u.jsx(aw,{className:"h-4 w-4"}):u.jsx(ev,{className:"h-4 w-4"})})]}),u.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),u.jsxs("div",{className:"space-y-2",children:[u.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[u.jsx(CI,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),u.jsxs("div",{className:"relative",children:[u.jsx("input",{type:ue?"text":"password",value:T,onChange:ee=>Z(ee.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),u.jsx("button",{type:"button",onClick:()=>me(!ue),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:ue?u.jsx(aw,{className:"h-4 w-4"}):u.jsx(ev,{className:"h-4 w-4"})})]}),u.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),u.jsxs("div",{className:"flex gap-3 pt-2",children:[u.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",Q),localStorage.setItem("mc_hf_token",T),de("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),u.jsx("button",{onClick:()=>{D(""),Z(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),de("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),pe&&u.jsx(y_,{type:pe.type,title:pe.title,message:pe.message,onConfirm:pe.onConfirm,onCancel:pe.onCancel})]})}function GY(){var g,x,b,j,k;J4();const[e,t]=v.useState("dashboard"),[r,n]=v.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[a,o]=v.useState(!1),[c,l]=v.useState("maintenance"),{data:f}=a4(),{data:h}=fh(2e4);v.useEffect(()=>{document.documentElement.classList.add("dark")},[]),v.useEffect(()=>{const S=N=>{var O;l(((O=N.detail)==null?void 0:O.tab)||"maintenance"),o(!0)};return window.addEventListener("open-system-drawer",S),()=>window.removeEventListener("open-system-drawer",S)},[]),v.useEffect(()=>{const S=N=>{var O;const E=(O=N.detail)==null?void 0:O.view;E&&t(E)};return window.addEventListener("mc-navigate",S),()=>window.removeEventListener("mc-navigate",S)},[]);const p=iv.find(S=>S.id===e);return u.jsxs("div",{className:"flex h-full relative",children:[u.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[u.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),u.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),u.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),u.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),u.jsx(n4,{onNavigate:t}),u.jsx(KY,{open:a,onClose:()=>o(!1),defaultTab:c}),u.jsxs("aside",{className:ce("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",r?"w-16":"w-60"),children:[u.jsxs("div",{className:ce("flex items-center py-4 border-b border-border/40 shrink-0",r?"flex-col gap-3 px-2":"justify-between px-5"),children:[u.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[u.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!r&&u.jsxs("div",{className:"leading-tight",children:[u.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),u.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),u.jsx("button",{onClick:()=>{n(S=>{const N=!S;return localStorage.setItem("mc_sidebar_collapsed",N.toString()),N})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:r?"Maximieren":"Minimieren",children:r?u.jsx(hN,{className:"h-4 w-4"}):u.jsx(gI,{className:"h-4 w-4"})})]}),u.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:iv.map(S=>u.jsxs("button",{onClick:()=>t(S.id),className:ce("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",r?"justify-center p-2.5":"gap-3 px-3 py-2",e===S.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:r?S.label:void 0,children:[u.jsx(S.icon,{className:"h-4.5 w-4.5 shrink-0"}),!r&&u.jsx("span",{className:"truncate",children:S.label})]},S.id))}),u.jsx("div",{className:ce("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",r?"px-2 text-center":"px-5"),children:r?u.jsx("div",{className:"flex justify-center",children:u.jsx("span",{className:ce("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",f?f.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:f?`Engine ${f.engine_reachable?"online":"offline"}`:"Backend offline"})}):u.jsxs("div",{className:"space-y-2 text-left",children:[f?u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:ce("h-2 w-2 rounded-full animate-pulse",f.engine_reachable?"bg-emerald-500":"bg-amber-500")}),u.jsxs("span",{className:"truncate",children:["Engine ",f.engine_reachable?"online":"offline"]})]}):u.jsxs("span",{className:"flex items-center gap-2",children:[u.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",u.jsx("span",{className:"truncate",children:"Backend offline"})]}),(h==null?void 0:h.versions)&&u.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[u.jsxs("div",{className:"truncate",title:h.versions.mc2?`${h.versions.mc2.branch}-${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""} (${h.versions.mc2.date})`:"nicht gefunden",children:[u.jsx("strong",{children:"MC2:"})," ",h.versions.mc2?`${h.versions.mc2.hash}${h.versions.mc2.dirty?"*":""}`:"—"]}),u.jsxs("div",{className:"truncate",title:((g=h.versions.engine)==null?void 0:g.type)==="git"?`${h.versions.engine.branch}-${h.versions.engine.hash}${h.versions.engine.dirty?"*":""} (${h.versions.engine.date})`:((x=h.versions.engine)==null?void 0:x.version_text)||"unbekannt",children:[u.jsx("strong",{children:"Engine:"})," ",((b=h.versions.engine)==null?void 0:b.type)==="git"?`${h.versions.engine.hash}${h.versions.engine.dirty?"*":""}`:((k=(j=h.versions.engine)==null?void 0:j.version_text)==null?void 0:k.split(" ").pop())||"—"]}),u.jsxs("div",{className:"truncate",title:h.versions.hermes_ui?`${h.versions.hermes_ui.branch}-${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""} (${h.versions.hermes_ui.date})`:"nicht gefunden",children:[u.jsx("strong",{children:"Hermes UI:"})," ",h.versions.hermes_ui?`${h.versions.hermes_ui.hash}${h.versions.hermes_ui.dirty?"*":""}`:"—"]}),u.jsxs("div",{className:"truncate",title:h.versions.hermes_agent?`${h.versions.hermes_agent.branch}-${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""} (${h.versions.hermes_agent.date})`:"nicht gefunden",children:[u.jsx("strong",{children:"Hermes Agent:"})," ",h.versions.hermes_agent?`${h.versions.hermes_agent.hash}${h.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),u.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[u.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[u.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:p.hint}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),u.jsxs("button",{onClick:()=>{const S=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(S)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[u.jsx(kI,{className:"h-3.5 w-3.5"}),u.jsx("span",{children:"Suchen"}),u.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),u.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[e==="dashboard"&&u.jsx(kY,{}),e==="models"&&u.jsx(CY,{}),e==="connect"&&u.jsx(_Y,{}),e==="memory"&&u.jsx(LY,{}),e==="agent"&&u.jsx(zY,{}),e==="terminal"&&u.jsx(FY,{}),e==="guide"&&u.jsx(UY,{}),!["dashboard","models","connect","memory","agent","terminal","guide"].includes(e)&&u.jsx(WY,{title:p.label,hint:p.hint})]})]})]})}const VY=new YM({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});SM.createRoot(document.getElementById("root")).render(u.jsx(Z2.StrictMode,{children:u.jsx(XM,{client:VY,children:u.jsx(GY,{})})}));export{Z2 as R,du as S,nv as T,Vs as a,GI as b,jM as c,cy as g,u as j,jP as l,v as r}; diff --git a/frontend/dist/assets/index-DuS2cUe8.css b/frontend/dist/assets/index-DuS2cUe8.css deleted file mode 100644 index 0fae2ae..0000000 --- a/frontend/dist/assets/index-DuS2cUe8.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-400:oklch(71.2% .194 13.428);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--default-mono-font-family:"JetBrains Mono", ui-monospace, SFMono-Regular, monospace}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}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;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.visible\!{visibility:visible!important}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-\[-10\%\]{top:-10%}.top-\[30\%\]{top:30%}.right-0{right:0}.right-\[-10\%\]{right:-10%}.right-\[20\%\]{right:20%}.bottom-\[-10\%\]{bottom:-10%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-\[-10\%\]{left:-10%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.-z-50{z-index:-50}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[99\]{z-index:99}.col-span-full{grid-column:1/-1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-auto{margin-inline:auto}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-3\.5{margin-top:calc(var(--spacing) * 3.5)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-auto{margin-top:auto}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-5\.5{height:calc(var(--spacing) * 5.5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-44{height:calc(var(--spacing) * 44)}.h-96{height:calc(var(--spacing) * 96)}.h-\[40\%\]{height:40%}.h-\[50\%\]{height:50%}.h-\[150px\]{height:150px}.h-\[480px\]{height:480px}.h-full{height:100%}.max-h-20{max-height:calc(var(--spacing) * 20)}.max-h-36{max-height:calc(var(--spacing) * 36)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-80{max-height:calc(var(--spacing) * 80)}.min-h-\[68vh\]{min-height:68vh}.min-h-\[90px\]{min-height:90px}.min-h-\[300px\]{min-height:300px}.min-h-\[480px\]{min-height:480px}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-4\.5{width:calc(var(--spacing) * 4.5)}.w-5{width:calc(var(--spacing) * 5)}.w-5\.5{width:calc(var(--spacing) * 5.5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-28{width:calc(var(--spacing) * 28)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-52{width:calc(var(--spacing) * 52)}.w-60{width:calc(var(--spacing) * 60)}.w-\[40\%\]{width:40%}.w-\[50\%\]{width:50%}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-fit{max-width:fit-content}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:0;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.resize{resize:both}.resize-none{resize:none}.scroll-mt-20{scroll-margin-top:calc(var(--spacing) * 20)}.scrollbar-thin{scrollbar-width:thin}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-7>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 7) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 7) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500) 25%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500) 40%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500) 30%,transparent)}}.border-border,.border-border\/10{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/10{border-color:color-mix(in oklab,hsl(var(--border)) 10%,transparent)}}.border-border\/20{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/20{border-color:color-mix(in oklab,hsl(var(--border)) 20%,transparent)}}.border-border\/30{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/30{border-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.border-border\/40{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/40{border-color:color-mix(in oklab,hsl(var(--border)) 40%,transparent)}}.border-border\/50{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,hsl(var(--border)) 50%,transparent)}}.border-border\/60{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/60{border-color:color-mix(in oklab,hsl(var(--border)) 60%,transparent)}}.border-border\/70{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/70{border-color:color-mix(in oklab,hsl(var(--border)) 70%,transparent)}}.border-border\/80{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/80{border-color:color-mix(in oklab,hsl(var(--border)) 80%,transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.border-cyan-500\/25{border-color:#00b7d740}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/25{border-color:color-mix(in oklab,var(--color-cyan-500) 25%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500) 30%,transparent)}}.border-emerald-500\/10{border-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/10{border-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.border-emerald-500\/15{border-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/15{border-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500) 40%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500) 50%,transparent)}}.border-indigo-500\/25{border-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/25{border-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.border-indigo-500\/40{border-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/40{border-color:color-mix(in oklab,var(--color-indigo-500) 40%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500) 30%,transparent)}}.border-pink-500\/25{border-color:#f6339a40}@supports (color:color-mix(in lab,red,red)){.border-pink-500\/25{border-color:color-mix(in oklab,var(--color-pink-500) 25%,transparent)}}.border-primary,.border-primary\/20{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.border-primary\/25{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/25{border-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.border-primary\/30{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.border-primary\/40{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/40{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.border-primary\/45{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/45{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500) 30%,transparent)}}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.border-red-500\/25{border-color:#fb2c3640}@supports (color:color-mix(in lab,red,red)){.border-red-500\/25{border-color:color-mix(in oklab,var(--color-red-500) 25%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab,red,red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500) 40%,transparent)}}.border-slate-500\/25{border-color:#62748e40}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/25{border-color:color-mix(in oklab,var(--color-slate-500) 25%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-teal-500\/25{border-color:#00baa740}@supports (color:color-mix(in lab,red,red)){.border-teal-500\/25{border-color:color-mix(in oklab,var(--color-teal-500) 25%,transparent)}}.border-transparent{border-color:#0000}.border-violet-500\/20{border-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/20{border-color:color-mix(in oklab,var(--color-violet-500) 20%,transparent)}}.border-violet-500\/25{border-color:#8d54ff40}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/25{border-color:color-mix(in oklab,var(--color-violet-500) 25%,transparent)}}.border-t-primary\/70{border-top-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-t-primary\/70{border-top-color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.border-t-violet-500\/70{border-top-color:#8d54ffb3}@supports (color:color-mix(in lab,red,red)){.border-t-violet-500\/70{border-top-color:color-mix(in oklab,var(--color-violet-500) 70%,transparent)}}.border-l-amber-500\/80{border-left-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.border-l-amber-500\/80{border-left-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.border-l-cyan-500\/80{border-left-color:#00b7d7cc}@supports (color:color-mix(in lab,red,red)){.border-l-cyan-500\/80{border-left-color:color-mix(in oklab,var(--color-cyan-500) 80%,transparent)}}.border-l-indigo-500\/80{border-left-color:#625fffcc}@supports (color:color-mix(in lab,red,red)){.border-l-indigo-500\/80{border-left-color:color-mix(in oklab,var(--color-indigo-500) 80%,transparent)}}.border-l-muted{border-left-color:hsl(var(--muted))}.border-l-violet-500\/80{border-left-color:#8d54ffcc}@supports (color:color-mix(in lab,red,red)){.border-l-violet-500\/80{border-left-color:color-mix(in oklab,var(--color-violet-500) 80%,transparent)}}.bg-\[\#070a0f\]{background-color:#070a0f}.bg-\[hsl\(224\,30\%\,6\%\)\]{background-color:#0b0d14}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-amber-500\/80{background-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/80{background-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.bg-amber-500\/\[0\.06\]{background-color:#f99c000f}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-amber-500) 6%,transparent)}}.bg-background\/10{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/10{background-color:color-mix(in oklab,hsl(var(--background)) 10%,transparent)}}.bg-background\/20{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/20{background-color:color-mix(in oklab,hsl(var(--background)) 20%,transparent)}}.bg-background\/25{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/25{background-color:color-mix(in oklab,hsl(var(--background)) 25%,transparent)}}.bg-background\/30{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/30{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.bg-background\/35{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/35{background-color:color-mix(in oklab,hsl(var(--background)) 35%,transparent)}}.bg-background\/40{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/40{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.bg-background\/50{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/50{background-color:color-mix(in oklab,hsl(var(--background)) 50%,transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.bg-black\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500) 20%,transparent)}}.bg-card,.bg-card\/10{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/10{background-color:color-mix(in oklab,hsl(var(--card)) 10%,transparent)}}.bg-card\/20{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/20{background-color:color-mix(in oklab,hsl(var(--card)) 20%,transparent)}}.bg-card\/30{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/30{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.bg-card\/40{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/40{background-color:color-mix(in oklab,hsl(var(--card)) 40%,transparent)}}.bg-card\/45{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/45{background-color:color-mix(in oklab,hsl(var(--card)) 45%,transparent)}}.bg-card\/50{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/50{background-color:color-mix(in oklab,hsl(var(--card)) 50%,transparent)}}.bg-card\/70{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/70{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.bg-card\/75{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/75{background-color:color-mix(in oklab,hsl(var(--card)) 75%,transparent)}}.bg-card\/85{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/85{background-color:color-mix(in oklab,hsl(var(--card)) 85%,transparent)}}.bg-card\/90{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,hsl(var(--card)) 90%,transparent)}}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/10{background-color:color-mix(in oklab,var(--color-cyan-500) 10%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/5{background-color:color-mix(in oklab,var(--color-emerald-500) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-500\/80{background-color:#00bb7fcc}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/80{background-color:color-mix(in oklab,var(--color-emerald-500) 80%,transparent)}}.bg-emerald-500\/\[0\.07\]{background-color:#00bb7f12}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/\[0\.07\]{background-color:color-mix(in oklab,var(--color-emerald-500) 7%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/40{background-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.bg-muted-foreground\/40{background-color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.bg-muted\/10{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/10{background-color:color-mix(in oklab,hsl(var(--muted)) 10%,transparent)}}.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,hsl(var(--muted)) 40%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-pink-500\/15{background-color:#f6339a26}@supports (color:color-mix(in lab,red,red)){.bg-pink-500\/15{background-color:color-mix(in oklab,var(--color-pink-500) 15%,transparent)}}.bg-popover,.bg-popover\/95{background-color:hsl(var(--popover))}@supports (color:color-mix(in lab,red,red)){.bg-popover\/95{background-color:color-mix(in oklab,hsl(var(--popover)) 95%,transparent)}}.bg-primary,.bg-primary\/5{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.bg-primary\/10{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.bg-primary\/15{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.bg-primary\/20{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/20{background-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.bg-primary\/\[0\.06\]{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/\[0\.06\]{background-color:color-mix(in oklab,hsl(var(--primary)) 6%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500) 15%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500) 20%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500) 80%,transparent)}}.bg-slate-500\/15{background-color:#62748e26}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/15{background-color:color-mix(in oklab,var(--color-slate-500) 15%,transparent)}}.bg-slate-500\/20{background-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/20{background-color:color-mix(in oklab,var(--color-slate-500) 20%,transparent)}}.bg-teal-500\/15{background-color:#00baa726}@supports (color:color-mix(in lab,red,red)){.bg-teal-500\/15{background-color:color-mix(in oklab,var(--color-teal-500) 15%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/5{background-color:#8d54ff0d}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/5{background-color:color-mix(in oklab,var(--color-violet-500) 5%,transparent)}}.bg-violet-500\/10{background-color:#8d54ff1a}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/10{background-color:color-mix(in oklab,var(--color-violet-500) 10%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-cyan-500{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-foreground{--tw-gradient-from:hsl(var(--foreground));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500\/20{--tw-gradient-from:#00baa733}@supports (color:color-mix(in lab,red,red)){.from-teal-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-teal-500) 20%, transparent)}}.from-teal-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-foreground{--tw-gradient-via:hsl(var(--foreground));--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-indigo-500\/15{--tw-gradient-via:#625fff26}@supports (color:color-mix(in lab,red,red)){.via-indigo-500\/15{--tw-gradient-via:color-mix(in oklab, var(--color-indigo-500) 15%, transparent)}}.via-indigo-500\/15{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary{--tw-gradient-to:hsl(var(--primary));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-500\/20{--tw-gradient-to:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-purple-500) 20%, transparent)}}.to-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.bg-repeat{background-repeat:repeat}.fill-amber-400\/20{fill:#fcbb0033}@supports (color:color-mix(in lab,red,red)){.fill-amber-400\/20{fill:color-mix(in oklab,var(--color-amber-400) 20%,transparent)}}.fill-primary\/20{fill:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.fill-primary\/20{fill:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-12{padding:calc(var(--spacing) * 12)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[12vh\]{padding-top:12vh}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-px{padding-bottom:1px}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-6{padding-left:calc(var(--spacing) * 6)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,monospace}.font-sans{font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif}.font-space{font-family:Space Grotesk,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[7px\]{font-size:7px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400) 80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400) 90%,transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-cyan-200\/90{color:#a2f4fde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-200\/90{color:color-mix(in oklab,var(--color-cyan-200) 90%,transparent)}}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300) 90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400) 90%,transparent)}}.text-foreground,.text-foreground\/90{color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.text-foreground\/90{color:color-mix(in oklab,hsl(var(--foreground)) 90%,transparent)}}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-400{color:var(--color-indigo-400)}.text-muted-foreground,.text-muted-foreground\/40{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.text-muted-foreground\/50{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/50{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.text-muted-foreground\/55{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/55{color:color-mix(in oklab,hsl(var(--muted-foreground)) 55%,transparent)}}.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-muted-foreground\/75{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/75{color:color-mix(in oklab,hsl(var(--muted-foreground)) 75%,transparent)}}.text-muted-foreground\/80{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/80{color:color-mix(in oklab,hsl(var(--muted-foreground)) 80%,transparent)}}.text-orange-300{color:var(--color-orange-300)}.text-pink-400{color:var(--color-pink-400)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/70{color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.text-primary\/80{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/80{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab,red,red)){.text-red-400\/80{color:color-mix(in oklab,var(--color-red-400) 80%,transparent)}}.text-rose-400{color:var(--color-rose-400)}.text-sky-400{color:var(--color-sky-400)}.text-slate-300{color:var(--color-slate-300)}.text-teal-400{color:var(--color-teal-400)}.text-transparent{color:#0000}.text-violet-200\/90{color:#ddd6ffe6}@supports (color:color-mix(in lab,red,red)){.text-violet-200\/90{color:color-mix(in oklab,var(--color-violet-200) 90%,transparent)}}.text-violet-300{color:var(--color-violet-300)}.text-violet-300\/80{color:#c4b4ffcc}@supports (color:color-mix(in lab,red,red)){.text-violet-300\/80{color:color-mix(in oklab,var(--color-violet-300) 80%,transparent)}}.text-violet-400{color:var(--color-violet-400)}.text-violet-400\/70{color:#a685ffb3}@supports (color:color-mix(in lab,red,red)){.text-violet-400\/70{color:color-mix(in oklab,var(--color-violet-400) 70%,transparent)}}.text-white{color:var(--color-white)}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.opacity-0{opacity:0}.opacity-35{opacity:.35}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\!{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-500\/10{--tw-shadow-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.shadow-amber-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/5{--tw-shadow-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.shadow-black\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/10{--tw-shadow-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.shadow-black\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/15{--tw-shadow-color:#00000026}@supports (color:color-mix(in lab,red,red)){.shadow-black\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab,red,red)){.shadow-black\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/25{--tw-shadow-color:#00000040}@supports (color:color-mix(in lab,red,red)){.shadow-black\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/5{--tw-shadow-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/5{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/10{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/20{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/10{--tw-shadow-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-black\/40{--tw-ring-color:#0006}@supports (color:color-mix(in lab,red,red)){.ring-black\/40{--tw-ring-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.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,)}.blur-\[130px\]{--tw-blur:blur(130px);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,)}.blur-\[140px\]{--tw-blur:blur(140px);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,)}.blur-\[160px\]{--tw-blur:blur(160px);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,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);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,)}.grayscale{--tw-grayscale:grayscale(100%);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,)}.invert{--tw-invert:invert(100%);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,)}.sepia{--tw-sepia:sepia(100%);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,)!important}.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,)}.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,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-all{-webkit-user-select:all;user-select:all}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-primary:is(:where(.group):hover *){color:hsl(var(--primary))}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}@media(hover:hover){.hover\:border-primary:hover,.hover\:border-primary\/20:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/20:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:border-primary\/30:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/30:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.hover\:border-primary\/40:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.hover\:border-primary\/45:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/45:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.hover\:bg-amber-500\/15:hover{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/15:hover{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.hover\:bg-background\/30:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/30:hover{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.hover\:bg-background\/40:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/40:hover{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.hover\:bg-background\/60:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/60:hover{background-color:color-mix(in oklab,hsl(var(--background)) 60%,transparent)}}.hover\:bg-background\/80:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/80:hover{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.hover\:bg-card\/30:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/30:hover{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.hover\:bg-card\/70:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/70:hover{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.hover\:bg-emerald-500\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/10:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.hover\:bg-indigo-500\/15:hover{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/15:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.hover\:bg-primary\/5:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/5:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/10:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.hover\:bg-primary\/15:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/15:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.hover\:bg-primary\/20:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/20:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 90%,transparent)}}.hover\:bg-primary\/95:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/95:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 95%,transparent)}}.hover\:bg-red-400:hover{background-color:var(--color-red-400)}.hover\:bg-red-500\/5:hover{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/5:hover{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}}.focus\:border-primary:focus{border-color:hsl(var(--primary))}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-primary:focus,.focus\:ring-primary\/50:focus{--tw-ring-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:ring-primary\/50:focus{--tw-ring-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.focus\:ring-violet-500\/50:focus{--tw-ring-color:#8d54ff80}@supports (color:color-mix(in lab,red,red)){.focus\:ring-violet-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:opacity-50:disabled{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:w-\[640px\]{width:640px}.sm\:max-w-\[400px\]{max-width:400px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:p-10{padding:calc(var(--spacing) * 10)}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[170px_1fr\]{grid-template-columns:170px 1fr}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-\[1fr_280px\]{grid-template-columns:1fr 280px}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}}}:root{--background:224 30% 6%;--foreground:210 20% 92%;--card:224 25% 10%;--card-foreground:210 20% 94%;--popover:224 28% 9%;--popover-foreground:210 20% 94%;--primary:172 72% 50%;--primary-foreground:224 47% 8%;--muted:220 16% 14%;--muted-foreground:215 14% 64%;--accent:220 16% 16%;--accent-foreground:210 20% 94%;--border:222 18% 23%;--input:222 18% 23%;--ring:172 72% 50%;--radius:.75rem}.light{--background:0 0% 100%;--foreground:222 22% 12%;--card:0 0% 100%;--card-foreground:222 22% 12%;--popover:0 0% 100%;--popover-foreground:222 22% 12%;--primary:172 70% 38%;--primary-foreground:0 0% 100%;--muted:220 14% 95%;--muted-foreground:220 9% 42%;--accent:220 14% 94%;--accent-foreground:222 22% 12%;--border:220 13% 88%;--input:220 13% 88%;--ring:172 66% 50%}@keyframes aurora{0%{background-position:0%}50%{background-position:100%}to{background-position:0%}}.animate-aurora{background-size:200% 200%;animation:25s infinite aurora}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:9999px}*{border-color:hsl(var(--border) / .85);outline-color:hsl(var(--primary) / .5)}html,body,#root{height:100%;overflow:hidden}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);-webkit-font-smoothing:antialiased;margin:0}@keyframes flow-cyan{0%{stroke-dasharray:6 3;stroke-dashoffset:18px}to{stroke-dasharray:6 3;stroke-dashoffset:0}}.animate-flow-cyan{animation:1.2s linear infinite flow-cyan}.rounded-2xl.border.bg-card\/45{position:relative;overflow:hidden;background-color:hsl(var(--card) / .85)!important;border-color:hsl(var(--border) / .95)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;box-shadow:0 10px 30px -15px #00000073,inset 0 1px #ffffff0d!important}.rounded-2xl.border.bg-card\/45:before{content:"";background:linear-gradient(90deg,hsl(var(--primary)),#6366f1,#a855f7);opacity:.75;height:3.5px;position:absolute;top:0;left:0;right:0;transition:opacity .3s!important}.rounded-2xl.border.bg-card\/45:hover{transform:translateY(-3px);background-color:hsl(var(--card) / .92)!important;border-color:hsl(var(--primary) / .35)!important;box-shadow:0 20px 40px -20px #000000a6,0 0 18px 2px hsl(var(--primary) / .05)!important}.rounded-2xl.border.bg-card\/45:hover:before{opacity:1}.rounded-xl.border.bg-card\/45{background-color:hsl(var(--card) / .88)!important;border-color:hsl(var(--border) / .9)!important;transition:all .2s!important}.rounded-xl.border.bg-card\/45:hover{background-color:hsl(var(--card) / .95)!important;border-color:hsl(var(--primary) / .3)!important}aside nav button[class*="bg-primary/15"]:not([class*=justify-center]){background:linear-gradient(90deg,hsl(var(--primary) / .18),#6366f11f)!important;color:hsl(var(--primary))!important;border-left:3.5px solid hsl(var(--primary))!important;border-radius:0 var(--radius) var(--radius) 0!important;padding-left:calc(.75rem - 3.5px)!important;box-shadow:inset 0 1px #ffffff05!important}aside nav button[class*="bg-primary/15"][class*=justify-center]{background:hsl(var(--primary) / .18)!important;color:hsl(var(--primary))!important;box-shadow:0 0 12px 1px hsl(var(--primary) / .1)!important;border:1px solid hsl(var(--primary) / .3)!important}::-webkit-scrollbar-thumb{border-radius:9999px;background:hsl(var(--primary) / .25)!important}::-webkit-scrollbar-thumb:hover{background:hsl(var(--primary) / .5)!important}input:focus,textarea:focus,select:focus{outline:none;border-color:hsl(var(--primary))!important;box-shadow:0 0 0 2px hsl(var(--primary) / .15)!important}@media(min-width:1440px){html{font-size:16.5px}}@media(min-width:1920px){html{font-size:17.5px}}@media(min-width:2560px){html{font-size:19px}}@media(min-width:3440px){html{font-size:20px}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}} diff --git a/frontend/dist/assets/index-DueAT_Qc.css b/frontend/dist/assets/index-DueAT_Qc.css new file mode 100644 index 0000000..42d94d0 --- /dev/null +++ b/frontend/dist/assets/index-DueAT_Qc.css @@ -0,0 +1 @@ +@import"https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap";/*! tailwindcss v4.3.1 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-pan-x:initial;--tw-pan-y:initial;--tw-pinch-zoom:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-x-reverse:0;--tw-border-style:solid;--tw-divide-y-reverse:0;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial}}}@layer theme{:root,:host{--font-sans:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-500:oklch(70.5% .213 47.604);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-teal-400:oklch(77.7% .152 181.912);--color-teal-500:oklch(70.4% .14 182.503);--color-cyan-200:oklch(91.7% .08 205.041);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-400:oklch(78.9% .154 211.53);--color-cyan-500:oklch(71.5% .143 215.221);--color-sky-400:oklch(74.6% .16 232.661);--color-sky-500:oklch(68.5% .169 237.323);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-500:oklch(62.3% .214 259.815);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-500:oklch(62.7% .265 303.9);--color-pink-400:oklch(71.8% .202 349.761);--color-pink-500:oklch(65.6% .241 354.308);--color-rose-400:oklch(71.2% .194 13.428);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-500:oklch(55.4% .046 257.417);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-normal:0em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-normal:1.5;--leading-relaxed:1.625;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-ping:ping 1s cubic-bezier(0, 0, .2, 1) infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:"Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;--default-mono-font-family:"JetBrains Mono", ui-monospace, SFMono-Regular, monospace}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}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;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.visible{visibility:visible}.visible\!{visibility:visible!important}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.not-sr-only{clip-path:none;white-space:normal;width:auto;height:auto;margin:0;padding:0;position:static;overflow:visible}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{inset-inline:0}.inset-y-0{inset-block:0}.top-0{top:0}.top-2\.5{top:calc(var(--spacing) * 2.5)}.top-\[-10\%\]{top:-10%}.top-\[30\%\]{top:30%}.right-0{right:0}.right-\[-10\%\]{right:-10%}.right-\[20\%\]{right:20%}.bottom-3{bottom:calc(var(--spacing) * 3)}.bottom-\[-10\%\]{bottom:-10%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.left-\[-10\%\]{left:-10%}.isolate{isolation:isolate}.isolation-auto{isolation:auto}.-z-50{z-index:-50}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.z-\[99\]{z-index:99}.col-span-full{grid-column:1/-1}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing) * -1)}.mx-auto{margin-inline:auto}.-mt-1{margin-top:calc(var(--spacing) * -1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-2\.5{margin-top:calc(var(--spacing) * 2.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-3\.5{margin-top:calc(var(--spacing) * 3.5)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-auto{margin-top:auto}.mr-0\.5{margin-right:calc(var(--spacing) * .5)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-2{margin-right:calc(var(--spacing) * 2)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.ml-0\.5{margin-left:calc(var(--spacing) * .5)}.ml-1{margin-left:var(--spacing)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.flow-root{display:flow-root}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.inline-grid{display:inline-grid}.inline-table{display:inline-table}.list-item{display:list-item}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-column{display:table-column}.table-column-group{display:table-column-group}.table-footer-group{display:table-footer-group}.table-header-group{display:table-header-group}.table-row{display:table-row}.table-row-group{display:table-row-group}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-4\.5{height:calc(var(--spacing) * 4.5)}.h-5{height:calc(var(--spacing) * 5)}.h-5\.5{height:calc(var(--spacing) * 5.5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-11{height:calc(var(--spacing) * 11)}.h-14{height:calc(var(--spacing) * 14)}.h-16{height:calc(var(--spacing) * 16)}.h-20{height:calc(var(--spacing) * 20)}.h-24{height:calc(var(--spacing) * 24)}.h-28{height:calc(var(--spacing) * 28)}.h-44{height:calc(var(--spacing) * 44)}.h-96{height:calc(var(--spacing) * 96)}.h-\[40\%\]{height:40%}.h-\[50\%\]{height:50%}.h-\[150px\]{height:150px}.h-\[480px\]{height:480px}.h-full{height:100%}.max-h-20{max-height:calc(var(--spacing) * 20)}.max-h-36{max-height:calc(var(--spacing) * 36)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-72{max-height:calc(var(--spacing) * 72)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-\[55\%\]{max-height:55%}.min-h-0{min-height:0}.min-h-\[68vh\]{min-height:68vh}.min-h-\[90px\]{min-height:90px}.min-h-\[300px\]{min-height:300px}.min-h-\[480px\]{min-height:480px}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-4\.5{width:calc(var(--spacing) * 4.5)}.w-5{width:calc(var(--spacing) * 5)}.w-5\.5{width:calc(var(--spacing) * 5.5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-11{width:calc(var(--spacing) * 11)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-28{width:calc(var(--spacing) * 28)}.w-36{width:calc(var(--spacing) * 36)}.w-40{width:calc(var(--spacing) * 40)}.w-44{width:calc(var(--spacing) * 44)}.w-52{width:calc(var(--spacing) * 52)}.w-60{width:calc(var(--spacing) * 60)}.w-80{width:calc(var(--spacing) * 80)}.w-\[40\%\]{width:40%}.w-\[50\%\]{width:50%}.w-fit{width:fit-content}.w-full{width:100%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\[120px\]{max-width:120px}.max-w-\[150px\]{max-width:150px}.max-w-\[180px\]{max-width:180px}.max-w-\[200px\]{max-width:200px}.max-w-\[250px\]{max-width:250px}.max-w-\[260px\]{max-width:260px}.max-w-\[280px\]{max-width:280px}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-0{--tw-translate-x:0;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-110{--tw-scale-x:110%;--tw-scale-y:110%;--tw-scale-z:110%;scale:var(--tw-scale-x) var(--tw-scale-y)}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-ping{animation:var(--animate-ping)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-pinch-zoom{--tw-pinch-zoom:pinch-zoom;touch-action:var(--tw-pan-x,) var(--tw-pan-y,) var(--tw-pinch-zoom,)}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.scroll-mt-20{scroll-margin-top:calc(var(--spacing) * 20)}.scrollbar-thin{scrollbar-width:thin}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-5{gap:calc(var(--spacing) * 5)}.gap-6{gap:calc(var(--spacing) * 6)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-7>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 7) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 7) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 8) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 8) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-reverse>:not(:last-child)){--tw-space-y-reverse:1}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}:where(.space-x-reverse>:not(:last-child)){--tw-space-x-reverse:1}.gap-y-1{row-gap:var(--spacing)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}:where(.divide-x>:not(:last-child)){--tw-divide-x-reverse:0;border-inline-style:var(--tw-border-style);border-inline-start-width:calc(1px * var(--tw-divide-x-reverse));border-inline-end-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-y-reverse>:not(:last-child)){--tw-divide-y-reverse:1}.self-end{align-self:flex-end}.self-start{align-self:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-s{border-start-start-radius:.25rem;border-end-start-radius:.25rem}.rounded-ss{border-start-start-radius:.25rem}.rounded-e{border-start-end-radius:.25rem;border-end-end-radius:.25rem}.rounded-se{border-start-end-radius:.25rem}.rounded-ee{border-end-end-radius:.25rem}.rounded-es{border-end-start-radius:.25rem}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-tl{border-top-left-radius:.25rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-tr{border-top-right-radius:.25rem}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.rounded-bl{border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-x{border-inline-style:var(--tw-border-style);border-inline-width:1px}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-s{border-inline-start-style:var(--tw-border-style);border-inline-start-width:1px}.border-e{border-inline-end-style:var(--tw-border-style);border-inline-end-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-amber-500\/20{border-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/20{border-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.border-amber-500\/25{border-color:#f99c0040}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/25{border-color:color-mix(in oklab,var(--color-amber-500) 25%,transparent)}}.border-amber-500\/30{border-color:#f99c004d}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/30{border-color:color-mix(in oklab,var(--color-amber-500) 30%,transparent)}}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab,red,red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500) 40%,transparent)}}.border-blue-500\/30{border-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.border-blue-500\/30{border-color:color-mix(in oklab,var(--color-blue-500) 30%,transparent)}}.border-border,.border-border\/10{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/10{border-color:color-mix(in oklab,hsl(var(--border)) 10%,transparent)}}.border-border\/20{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/20{border-color:color-mix(in oklab,hsl(var(--border)) 20%,transparent)}}.border-border\/30{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/30{border-color:color-mix(in oklab,hsl(var(--border)) 30%,transparent)}}.border-border\/40{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/40{border-color:color-mix(in oklab,hsl(var(--border)) 40%,transparent)}}.border-border\/50{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/50{border-color:color-mix(in oklab,hsl(var(--border)) 50%,transparent)}}.border-border\/60{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/60{border-color:color-mix(in oklab,hsl(var(--border)) 60%,transparent)}}.border-border\/70{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/70{border-color:color-mix(in oklab,hsl(var(--border)) 70%,transparent)}}.border-border\/80{border-color:hsl(var(--border))}@supports (color:color-mix(in lab,red,red)){.border-border\/80{border-color:color-mix(in oklab,hsl(var(--border)) 80%,transparent)}}.border-cyan-500\/20{border-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/20{border-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.border-cyan-500\/25{border-color:#00b7d740}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/25{border-color:color-mix(in oklab,var(--color-cyan-500) 25%,transparent)}}.border-cyan-500\/30{border-color:#00b7d74d}@supports (color:color-mix(in lab,red,red)){.border-cyan-500\/30{border-color:color-mix(in oklab,var(--color-cyan-500) 30%,transparent)}}.border-emerald-500\/10{border-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/10{border-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.border-emerald-500\/15{border-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/15{border-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.border-emerald-500\/20{border-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/20{border-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500) 40%,transparent)}}.border-emerald-500\/50{border-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/50{border-color:color-mix(in oklab,var(--color-emerald-500) 50%,transparent)}}.border-indigo-500\/25{border-color:#625fff40}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/25{border-color:color-mix(in oklab,var(--color-indigo-500) 25%,transparent)}}.border-indigo-500\/30{border-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/30{border-color:color-mix(in oklab,var(--color-indigo-500) 30%,transparent)}}.border-indigo-500\/40{border-color:#625fff66}@supports (color:color-mix(in lab,red,red)){.border-indigo-500\/40{border-color:color-mix(in oklab,var(--color-indigo-500) 40%,transparent)}}.border-orange-500\/30{border-color:#fe6e004d}@supports (color:color-mix(in lab,red,red)){.border-orange-500\/30{border-color:color-mix(in oklab,var(--color-orange-500) 30%,transparent)}}.border-pink-500\/25{border-color:#f6339a40}@supports (color:color-mix(in lab,red,red)){.border-pink-500\/25{border-color:color-mix(in oklab,var(--color-pink-500) 25%,transparent)}}.border-primary,.border-primary\/20{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/20{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.border-primary\/25{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/25{border-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.border-primary\/30{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/30{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.border-primary\/40{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/40{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.border-primary\/45{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/45{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.border-primary\/50{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/50{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.border-primary\/60{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-primary\/60{border-color:color-mix(in oklab,hsl(var(--primary)) 60%,transparent)}}.border-purple-500\/30{border-color:#ac4bff4d}@supports (color:color-mix(in lab,red,red)){.border-purple-500\/30{border-color:color-mix(in oklab,var(--color-purple-500) 30%,transparent)}}.border-red-500{border-color:var(--color-red-500)}.border-red-500\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.border-red-500\/20{border-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.border-red-500\/25{border-color:#fb2c3640}@supports (color:color-mix(in lab,red,red)){.border-red-500\/25{border-color:color-mix(in oklab,var(--color-red-500) 25%,transparent)}}.border-red-500\/30{border-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.border-red-500\/30{border-color:color-mix(in oklab,var(--color-red-500) 30%,transparent)}}.border-red-500\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab,red,red)){.border-red-500\/40{border-color:color-mix(in oklab,var(--color-red-500) 40%,transparent)}}.border-slate-500\/25{border-color:#62748e40}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/25{border-color:color-mix(in oklab,var(--color-slate-500) 25%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-teal-500\/25{border-color:#00baa740}@supports (color:color-mix(in lab,red,red)){.border-teal-500\/25{border-color:color-mix(in oklab,var(--color-teal-500) 25%,transparent)}}.border-transparent{border-color:#0000}.border-violet-500\/20{border-color:#8d54ff33}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/20{border-color:color-mix(in oklab,var(--color-violet-500) 20%,transparent)}}.border-violet-500\/25{border-color:#8d54ff40}@supports (color:color-mix(in lab,red,red)){.border-violet-500\/25{border-color:color-mix(in oklab,var(--color-violet-500) 25%,transparent)}}.border-t-primary\/70{border-top-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.border-t-primary\/70{border-top-color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.border-t-violet-500\/70{border-top-color:#8d54ffb3}@supports (color:color-mix(in lab,red,red)){.border-t-violet-500\/70{border-top-color:color-mix(in oklab,var(--color-violet-500) 70%,transparent)}}.border-l-amber-500\/80{border-left-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.border-l-amber-500\/80{border-left-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.border-l-cyan-500\/80{border-left-color:#00b7d7cc}@supports (color:color-mix(in lab,red,red)){.border-l-cyan-500\/80{border-left-color:color-mix(in oklab,var(--color-cyan-500) 80%,transparent)}}.border-l-indigo-500\/80{border-left-color:#625fffcc}@supports (color:color-mix(in lab,red,red)){.border-l-indigo-500\/80{border-left-color:color-mix(in oklab,var(--color-indigo-500) 80%,transparent)}}.border-l-muted{border-left-color:hsl(var(--muted))}.border-l-violet-500\/80{border-left-color:#8d54ffcc}@supports (color:color-mix(in lab,red,red)){.border-l-violet-500\/80{border-left-color:color-mix(in oklab,var(--color-violet-500) 80%,transparent)}}.bg-\[\#070a0f\]{background-color:#070a0f}.bg-\[hsl\(224\,30\%\,6\%\)\]{background-color:#0b0d14}.bg-amber-400{background-color:var(--color-amber-400)}.bg-amber-500{background-color:var(--color-amber-500)}.bg-amber-500\/5{background-color:#f99c000d}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/5{background-color:color-mix(in oklab,var(--color-amber-500) 5%,transparent)}}.bg-amber-500\/10{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/10{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.bg-amber-500\/15{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-amber-500\/20{background-color:#f99c0033}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/20{background-color:color-mix(in oklab,var(--color-amber-500) 20%,transparent)}}.bg-amber-500\/80{background-color:#f99c00cc}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/80{background-color:color-mix(in oklab,var(--color-amber-500) 80%,transparent)}}.bg-amber-500\/\[0\.06\]{background-color:#f99c000f}@supports (color:color-mix(in lab,red,red)){.bg-amber-500\/\[0\.06\]{background-color:color-mix(in oklab,var(--color-amber-500) 6%,transparent)}}.bg-background\/10{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/10{background-color:color-mix(in oklab,hsl(var(--background)) 10%,transparent)}}.bg-background\/20{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/20{background-color:color-mix(in oklab,hsl(var(--background)) 20%,transparent)}}.bg-background\/25{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/25{background-color:color-mix(in oklab,hsl(var(--background)) 25%,transparent)}}.bg-background\/30{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/30{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.bg-background\/35{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/35{background-color:color-mix(in oklab,hsl(var(--background)) 35%,transparent)}}.bg-background\/40{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/40{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.bg-background\/50{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.bg-background\/50{background-color:color-mix(in oklab,hsl(var(--background)) 50%,transparent)}}.bg-black\/10{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.bg-black\/10{background-color:color-mix(in oklab,var(--color-black) 10%,transparent)}}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/25{background-color:#00000040}@supports (color:color-mix(in lab,red,red)){.bg-black\/25{background-color:color-mix(in oklab,var(--color-black) 25%,transparent)}}.bg-black\/30{background-color:#0000004d}@supports (color:color-mix(in lab,red,red)){.bg-black\/30{background-color:color-mix(in oklab,var(--color-black) 30%,transparent)}}.bg-black\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\/40{background-color:color-mix(in oklab,var(--color-black) 40%,transparent)}}.bg-black\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\/50{background-color:color-mix(in oklab,var(--color-black) 50%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-blue-500\/20{background-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/20{background-color:color-mix(in oklab,var(--color-blue-500) 20%,transparent)}}.bg-card,.bg-card\/10{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/10{background-color:color-mix(in oklab,hsl(var(--card)) 10%,transparent)}}.bg-card\/20{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/20{background-color:color-mix(in oklab,hsl(var(--card)) 20%,transparent)}}.bg-card\/30{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/30{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.bg-card\/40{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/40{background-color:color-mix(in oklab,hsl(var(--card)) 40%,transparent)}}.bg-card\/45{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/45{background-color:color-mix(in oklab,hsl(var(--card)) 45%,transparent)}}.bg-card\/50{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/50{background-color:color-mix(in oklab,hsl(var(--card)) 50%,transparent)}}.bg-card\/70{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/70{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.bg-card\/75{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/75{background-color:color-mix(in oklab,hsl(var(--card)) 75%,transparent)}}.bg-card\/85{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/85{background-color:color-mix(in oklab,hsl(var(--card)) 85%,transparent)}}.bg-card\/90{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.bg-card\/90{background-color:color-mix(in oklab,hsl(var(--card)) 90%,transparent)}}.bg-cyan-400{background-color:var(--color-cyan-400)}.bg-cyan-500\/10{background-color:#00b7d71a}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/10{background-color:color-mix(in oklab,var(--color-cyan-500) 10%,transparent)}}.bg-cyan-500\/15{background-color:#00b7d726}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/15{background-color:color-mix(in oklab,var(--color-cyan-500) 15%,transparent)}}.bg-cyan-500\/20{background-color:#00b7d733}@supports (color:color-mix(in lab,red,red)){.bg-cyan-500\/20{background-color:color-mix(in oklab,var(--color-cyan-500) 20%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-500\/5{background-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/5{background-color:color-mix(in oklab,var(--color-emerald-500) 5%,transparent)}}.bg-emerald-500\/10{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/10{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.bg-emerald-500\/15{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/15{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.bg-emerald-500\/20{background-color:#00bb7f33}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/20{background-color:color-mix(in oklab,var(--color-emerald-500) 20%,transparent)}}.bg-emerald-500\/80{background-color:#00bb7fcc}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/80{background-color:color-mix(in oklab,var(--color-emerald-500) 80%,transparent)}}.bg-emerald-500\/\[0\.07\]{background-color:#00bb7f12}@supports (color:color-mix(in lab,red,red)){.bg-emerald-500\/\[0\.07\]{background-color:color-mix(in oklab,var(--color-emerald-500) 7%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-500\/10{background-color:#625fff1a}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/10{background-color:color-mix(in oklab,var(--color-indigo-500) 10%,transparent)}}.bg-indigo-500\/15{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/15{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.bg-muted{background-color:hsl(var(--muted))}.bg-muted-foreground\/40{background-color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.bg-muted-foreground\/40{background-color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.bg-muted\/10{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/10{background-color:color-mix(in oklab,hsl(var(--muted)) 10%,transparent)}}.bg-muted\/20{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/20{background-color:color-mix(in oklab,hsl(var(--muted)) 20%,transparent)}}.bg-muted\/40{background-color:hsl(var(--muted))}@supports (color:color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,hsl(var(--muted)) 40%,transparent)}}.bg-orange-500\/20{background-color:#fe6e0033}@supports (color:color-mix(in lab,red,red)){.bg-orange-500\/20{background-color:color-mix(in oklab,var(--color-orange-500) 20%,transparent)}}.bg-pink-500\/15{background-color:#f6339a26}@supports (color:color-mix(in lab,red,red)){.bg-pink-500\/15{background-color:color-mix(in oklab,var(--color-pink-500) 15%,transparent)}}.bg-popover,.bg-popover\/95{background-color:hsl(var(--popover))}@supports (color:color-mix(in lab,red,red)){.bg-popover\/95{background-color:color-mix(in oklab,hsl(var(--popover)) 95%,transparent)}}.bg-primary,.bg-primary\/5{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/5{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.bg-primary\/10{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/10{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.bg-primary\/15{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/15{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.bg-primary\/\[0\.06\]{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.bg-primary\/\[0\.06\]{background-color:color-mix(in oklab,hsl(var(--primary)) 6%,transparent)}}.bg-purple-500\/15{background-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/15{background-color:color-mix(in oklab,var(--color-purple-500) 15%,transparent)}}.bg-purple-500\/20{background-color:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.bg-purple-500\/20{background-color:color-mix(in oklab,var(--color-purple-500) 20%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/5{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.bg-red-500\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/10{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.bg-red-500\/15{background-color:#fb2c3626}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-red-500\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/20{background-color:color-mix(in oklab,var(--color-red-500) 20%,transparent)}}.bg-red-500\/80{background-color:#fb2c36cc}@supports (color:color-mix(in lab,red,red)){.bg-red-500\/80{background-color:color-mix(in oklab,var(--color-red-500) 80%,transparent)}}.bg-slate-500\/15{background-color:#62748e26}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/15{background-color:color-mix(in oklab,var(--color-slate-500) 15%,transparent)}}.bg-slate-500\/20{background-color:#62748e33}@supports (color:color-mix(in lab,red,red)){.bg-slate-500\/20{background-color:color-mix(in oklab,var(--color-slate-500) 20%,transparent)}}.bg-teal-500\/15{background-color:#00baa726}@supports (color:color-mix(in lab,red,red)){.bg-teal-500\/15{background-color:color-mix(in oklab,var(--color-teal-500) 15%,transparent)}}.bg-transparent{background-color:#0000}.bg-violet-500\/5{background-color:#8d54ff0d}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/5{background-color:color-mix(in oklab,var(--color-violet-500) 5%,transparent)}}.bg-violet-500\/10{background-color:#8d54ff1a}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/10{background-color:color-mix(in oklab,var(--color-violet-500) 10%,transparent)}}.bg-violet-500\/15{background-color:#8d54ff26}@supports (color:color-mix(in lab,red,red)){.bg-violet-500\/15{background-color:color-mix(in oklab,var(--color-violet-500) 15%,transparent)}}.bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-cyan-500{--tw-gradient-from:var(--color-cyan-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-foreground{--tw-gradient-from:hsl(var(--foreground));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-indigo-500{--tw-gradient-from:var(--color-indigo-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-purple-500{--tw-gradient-from:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500{--tw-gradient-from:var(--color-teal-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-teal-500\/20{--tw-gradient-from:#00baa733}@supports (color:color-mix(in lab,red,red)){.from-teal-500\/20{--tw-gradient-from:color-mix(in oklab, var(--color-teal-500) 20%, transparent)}}.from-teal-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.via-foreground{--tw-gradient-via:hsl(var(--foreground));--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-indigo-500\/15{--tw-gradient-via:#625fff26}@supports (color:color-mix(in lab,red,red)){.via-indigo-500\/15{--tw-gradient-via:color-mix(in oklab, var(--color-indigo-500) 15%, transparent)}}.via-indigo-500\/15{--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-blue-500{--tw-gradient-to:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-500{--tw-gradient-to:var(--color-emerald-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-pink-500{--tw-gradient-to:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-primary{--tw-gradient-to:hsl(var(--primary));--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-purple-500\/20{--tw-gradient-to:#ac4bff33}@supports (color:color-mix(in lab,red,red)){.to-purple-500\/20{--tw-gradient-to:color-mix(in oklab, var(--color-purple-500) 20%, transparent)}}.to-purple-500\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-sky-500{--tw-gradient-to:var(--color-sky-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.bg-repeat{background-repeat:repeat}.fill-primary\/20{fill:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.fill-primary\/20{fill:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-3\.5{padding:calc(var(--spacing) * 3.5)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.p-12{padding:calc(var(--spacing) * 12)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-5{padding-block:calc(var(--spacing) * 5)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-12{padding-block:calc(var(--spacing) * 12)}.py-20{padding-block:calc(var(--spacing) * 20)}.pt-0\.5{padding-top:calc(var(--spacing) * .5)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-2\.5{padding-top:calc(var(--spacing) * 2.5)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pt-24{padding-top:calc(var(--spacing) * 24)}.pt-\[12vh\]{padding-top:12vh}.pr-1{padding-right:var(--spacing)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-4{padding-left:calc(var(--spacing) * 4)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,monospace}.font-sans{font-family:Inter,ui-sans-serif,system-ui,-apple-system,sans-serif}.font-space{font-family:Space Grotesk,sans-serif}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[7px\]{font-size:7px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.leading-normal{--tw-leading:var(--leading-normal);line-height:var(--leading-normal)}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-normal{--tw-tracking:var(--tracking-normal);letter-spacing:var(--tracking-normal)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.text-wrap{text-wrap:wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.text-clip{text-overflow:clip}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-amber-300{color:var(--color-amber-300)}.text-amber-400{color:var(--color-amber-400)}.text-amber-400\/80{color:#fcbb00cc}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/80{color:color-mix(in oklab,var(--color-amber-400) 80%,transparent)}}.text-amber-400\/90{color:#fcbb00e6}@supports (color:color-mix(in lab,red,red)){.text-amber-400\/90{color:color-mix(in oklab,var(--color-amber-400) 90%,transparent)}}.text-amber-500{color:var(--color-amber-500)}.text-black{color:var(--color-black)}.text-blue-300{color:var(--color-blue-300)}.text-cyan-200\/90{color:#a2f4fde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-200\/90{color:color-mix(in oklab,var(--color-cyan-200) 90%,transparent)}}.text-cyan-300{color:var(--color-cyan-300)}.text-cyan-300\/90{color:#53eafde6}@supports (color:color-mix(in lab,red,red)){.text-cyan-300\/90{color:color-mix(in oklab,var(--color-cyan-300) 90%,transparent)}}.text-cyan-400{color:var(--color-cyan-400)}.text-emerald-300{color:var(--color-emerald-300)}.text-emerald-400{color:var(--color-emerald-400)}.text-emerald-400\/90{color:#00d294e6}@supports (color:color-mix(in lab,red,red)){.text-emerald-400\/90{color:color-mix(in oklab,var(--color-emerald-400) 90%,transparent)}}.text-foreground,.text-foreground\/90{color:hsl(var(--foreground))}@supports (color:color-mix(in lab,red,red)){.text-foreground\/90{color:color-mix(in oklab,hsl(var(--foreground)) 90%,transparent)}}.text-indigo-300{color:var(--color-indigo-300)}.text-indigo-400{color:var(--color-indigo-400)}.text-muted-foreground,.text-muted-foreground\/40{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,hsl(var(--muted-foreground)) 40%,transparent)}}.text-muted-foreground\/50{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/50{color:color-mix(in oklab,hsl(var(--muted-foreground)) 50%,transparent)}}.text-muted-foreground\/55{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/55{color:color-mix(in oklab,hsl(var(--muted-foreground)) 55%,transparent)}}.text-muted-foreground\/60{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,hsl(var(--muted-foreground)) 60%,transparent)}}.text-muted-foreground\/70{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,hsl(var(--muted-foreground)) 70%,transparent)}}.text-muted-foreground\/75{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/75{color:color-mix(in oklab,hsl(var(--muted-foreground)) 75%,transparent)}}.text-muted-foreground\/80{color:hsl(var(--muted-foreground))}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/80{color:color-mix(in oklab,hsl(var(--muted-foreground)) 80%,transparent)}}.text-orange-300{color:var(--color-orange-300)}.text-pink-400{color:var(--color-pink-400)}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/70{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/70{color:color-mix(in oklab,hsl(var(--primary)) 70%,transparent)}}.text-primary\/80{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/80{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.text-primary\/90{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.text-primary\/90{color:color-mix(in oklab,hsl(var(--primary)) 90%,transparent)}}.text-purple-300{color:var(--color-purple-300)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-400\/80{color:#ff6568cc}@supports (color:color-mix(in lab,red,red)){.text-red-400\/80{color:color-mix(in oklab,var(--color-red-400) 80%,transparent)}}.text-rose-400{color:var(--color-rose-400)}.text-sky-400{color:var(--color-sky-400)}.text-slate-300{color:var(--color-slate-300)}.text-teal-400{color:var(--color-teal-400)}.text-transparent{color:#0000}.text-violet-200\/90{color:#ddd6ffe6}@supports (color:color-mix(in lab,red,red)){.text-violet-200\/90{color:color-mix(in oklab,var(--color-violet-200) 90%,transparent)}}.text-violet-300{color:var(--color-violet-300)}.text-violet-300\/80{color:#c4b4ffcc}@supports (color:color-mix(in lab,red,red)){.text-violet-300\/80{color:color-mix(in oklab,var(--color-violet-300) 80%,transparent)}}.text-violet-400{color:var(--color-violet-400)}.text-violet-400\/70{color:#a685ffb3}@supports (color:color-mix(in lab,red,red)){.text-violet-400\/70{color:color-mix(in oklab,var(--color-violet-400) 70%,transparent)}}.text-white{color:var(--color-white)}.text-white\/95{color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.text-white\/95{color:color-mix(in oklab,var(--color-white) 95%,transparent)}}.capitalize{text-transform:capitalize}.lowercase{text-transform:lowercase}.normal-case{text-transform:none}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.diagonal-fractions{--tw-numeric-fraction:diagonal-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.lining-nums{--tw-numeric-figure:lining-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.oldstyle-nums{--tw-numeric-figure:oldstyle-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.ordinal{--tw-ordinal:ordinal;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.proportional-nums{--tw-numeric-spacing:proportional-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.slashed-zero{--tw-slashed-zero:slashed-zero;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.stacked-fractions{--tw-numeric-fraction:stacked-fractions;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.normal-nums{font-variant-numeric:normal}.line-through{text-decoration-line:line-through}.no-underline{text-decoration-line:none}.overline{text-decoration-line:overline}.underline{text-decoration-line:underline}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.subpixel-antialiased{-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto}.opacity-0{opacity:0}.opacity-35{opacity:.35}.opacity-60{opacity:.6}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow\!{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-inner{--tw-shadow:inset 0 2px 4px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-amber-500\/10{--tw-shadow-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.shadow-amber-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-amber-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/5{--tw-shadow-color:#0000000d}@supports (color:color-mix(in lab,red,red)){.shadow-black\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/10{--tw-shadow-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.shadow-black\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/15{--tw-shadow-color:#00000026}@supports (color:color-mix(in lab,red,red)){.shadow-black\/15{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 15%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab,red,red)){.shadow-black\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-black\/25{--tw-shadow-color:#00000040}@supports (color:color-mix(in lab,red,red)){.shadow-black\/25{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-black) 25%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-emerald-500\/5{--tw-shadow-color:#00bb7f0d}@supports (color:color-mix(in lab,red,red)){.shadow-emerald-500\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-emerald-500) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/5{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/5{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 5%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/10{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-primary\/20{--tw-shadow-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.shadow-primary\/20{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, hsl(var(--primary)) 20%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/10{--tw-shadow-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/10{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 10%, transparent) var(--tw-shadow-alpha), transparent)}}.shadow-red-500\/30{--tw-shadow-color:#fb2c364d}@supports (color:color-mix(in lab,red,red)){.shadow-red-500\/30{--tw-shadow-color:color-mix(in oklab, color-mix(in oklab, var(--color-red-500) 30%, transparent) var(--tw-shadow-alpha), transparent)}}.ring-black\/40{--tw-ring-color:#0006}@supports (color:color-mix(in lab,red,red)){.ring-black\/40{--tw-ring-color:color-mix(in oklab, var(--color-black) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.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,)}.blur-\[130px\]{--tw-blur:blur(130px);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,)}.blur-\[140px\]{--tw-blur:blur(140px);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,)}.blur-\[160px\]{--tw-blur:blur(160px);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,)}.drop-shadow{--tw-drop-shadow-size:drop-shadow(0 1px 2px var(--tw-drop-shadow-color,#0000001a)) drop-shadow(0 1px 1px var(--tw-drop-shadow-color,#0000000f));--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);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,)}.grayscale{--tw-grayscale:grayscale(100%);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,)}.invert{--tw-invert:invert(100%);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,)}.sepia{--tw-sepia:sepia(100%);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,)!important}.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,)}.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,)!important}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-grayscale{--tw-backdrop-grayscale:grayscale(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-invert{--tw-backdrop-invert:invert(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-sepia{--tw-backdrop-sepia:sepia(100%);-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition\!{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events!important;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function))!important;transition-duration:var(--tw-duration,var(--default-transition-duration))!important}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.duration-500{--tw-duration:.5s;transition-duration:.5s}.ease-in{--tw-ease:var(--ease-in);transition-timing-function:var(--ease-in)}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}:where(.divide-x-reverse>:not(:last-child)){--tw-divide-x-reverse:1}.ring-inset{--tw-ring-inset:inset}@media(hover:hover){.group-hover\:text-primary:is(:where(.group):hover *){color:hsl(var(--primary))}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}@media(hover:hover){.hover\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x) var(--tw-scale-y)}.hover\:border-primary:hover,.hover\:border-primary\/20:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/20:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:border-primary\/30:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/30:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 30%,transparent)}}.hover\:border-primary\/40:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/40:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 40%,transparent)}}.hover\:border-primary\/45:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/45:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 45%,transparent)}}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:border-primary\/50:hover{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-400:hover{background-color:var(--color-amber-400)}.hover\:bg-amber-500\/10:hover{background-color:#f99c001a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/10:hover{background-color:color-mix(in oklab,var(--color-amber-500) 10%,transparent)}}.hover\:bg-amber-500\/15:hover{background-color:#f99c0026}@supports (color:color-mix(in lab,red,red)){.hover\:bg-amber-500\/15:hover{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.hover\:bg-background\/30:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/30:hover{background-color:color-mix(in oklab,hsl(var(--background)) 30%,transparent)}}.hover\:bg-background\/40:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/40:hover{background-color:color-mix(in oklab,hsl(var(--background)) 40%,transparent)}}.hover\:bg-background\/60:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/60:hover{background-color:color-mix(in oklab,hsl(var(--background)) 60%,transparent)}}.hover\:bg-background\/80:hover{background-color:hsl(var(--background))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-background\/80:hover{background-color:color-mix(in oklab,hsl(var(--background)) 80%,transparent)}}.hover\:bg-card\/30:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/30:hover{background-color:color-mix(in oklab,hsl(var(--card)) 30%,transparent)}}.hover\:bg-card\/70:hover{background-color:hsl(var(--card))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-card\/70:hover{background-color:color-mix(in oklab,hsl(var(--card)) 70%,transparent)}}.hover\:bg-emerald-500\/10:hover{background-color:#00bb7f1a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/10:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 10%,transparent)}}.hover\:bg-emerald-500\/15:hover{background-color:#00bb7f26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-emerald-500\/15:hover{background-color:color-mix(in oklab,var(--color-emerald-500) 15%,transparent)}}.hover\:bg-indigo-500\/15:hover{background-color:#625fff26}@supports (color:color-mix(in lab,red,red)){.hover\:bg-indigo-500\/15:hover{background-color:color-mix(in oklab,var(--color-indigo-500) 15%,transparent)}}.hover\:bg-primary\/5:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/5:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 5%,transparent)}}.hover\:bg-primary\/10:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/10:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 10%,transparent)}}.hover\:bg-primary\/15:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/15:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 15%,transparent)}}.hover\:bg-primary\/20:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/20:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 20%,transparent)}}.hover\:bg-primary\/25:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/25:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 25%,transparent)}}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 90%,transparent)}}.hover\:bg-primary\/95:hover{background-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:bg-primary\/95:hover{background-color:color-mix(in oklab,hsl(var(--primary)) 95%,transparent)}}.hover\:bg-red-400:hover{background-color:var(--color-red-400)}.hover\:bg-red-500\/5:hover{background-color:#fb2c360d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/5:hover{background-color:color-mix(in oklab,var(--color-red-500) 5%,transparent)}}.hover\:bg-red-500\/10:hover{background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.hover\:bg-red-500\/10:hover{background-color:color-mix(in oklab,var(--color-red-500) 10%,transparent)}}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-primary\/80:hover{color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.hover\:text-primary\/80:hover{color:color-mix(in oklab,hsl(var(--primary)) 80%,transparent)}}.hover\:text-red-300:hover{color:var(--color-red-300)}.hover\:text-red-400:hover{color:var(--color-red-400)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-90:hover{opacity:.9}}.focus\:border-primary:focus,.focus\:border-primary\/50:focus{border-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:border-primary\/50:focus{border-color:color-mix(in oklab,hsl(var(--primary)) 50%,transparent)}}.focus\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-primary:focus,.focus\:ring-primary\/50:focus{--tw-ring-color:hsl(var(--primary))}@supports (color:color-mix(in lab,red,red)){.focus\:ring-primary\/50:focus{--tw-ring-color:color-mix(in oklab, hsl(var(--primary)) 50%, transparent)}}.focus\:ring-violet-500\/50:focus{--tw-ring-color:#8d54ff80}@supports (color:color-mix(in lab,red,red)){.focus\:ring-violet-500\/50:focus{--tw-ring-color:color-mix(in oklab, var(--color-violet-500) 50%, transparent)}}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.disabled\:opacity-50:disabled{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:w-\[640px\]{width:640px}.sm\:max-w-\[400px\]{max-width:400px}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:self-auto{align-self:auto}.sm\:p-10{padding:calc(var(--spacing) * 10)}}@media(min-width:48rem){.md\:col-span-2{grid-column:span 2/span 2}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[170px_1fr\]{grid-template-columns:170px 1fr}}@media(min-width:64rem){.lg\:flex{display:flex}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-\[1fr_280px\]{grid-template-columns:1fr 280px}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}}}:root{--background:224 30% 6%;--foreground:210 20% 92%;--card:224 25% 10%;--card-foreground:210 20% 94%;--popover:224 28% 9%;--popover-foreground:210 20% 94%;--primary:172 72% 50%;--primary-foreground:224 47% 8%;--muted:220 16% 14%;--muted-foreground:215 14% 64%;--accent:220 16% 16%;--accent-foreground:210 20% 94%;--border:222 18% 23%;--input:222 18% 23%;--ring:172 72% 50%;--radius:.75rem}.light{--background:0 0% 100%;--foreground:222 22% 12%;--card:0 0% 100%;--card-foreground:222 22% 12%;--popover:0 0% 100%;--popover-foreground:222 22% 12%;--primary:172 70% 38%;--primary-foreground:0 0% 100%;--muted:220 14% 95%;--muted-foreground:220 9% 42%;--accent:220 14% 94%;--accent-foreground:222 22% 12%;--border:220 13% 88%;--input:220 13% 88%;--ring:172 66% 50%}@keyframes aurora{0%{background-position:0%}50%{background-position:100%}to{background-position:0%}}.animate-aurora{background-size:200% 200%;animation:25s infinite aurora}::-webkit-scrollbar{width:6px;height:6px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background:hsl(var(--border));border-radius:9999px}*{border-color:hsl(var(--border) / .85);outline-color:hsl(var(--primary) / .5)}html,body,#root{height:100%;overflow:hidden}body{background-color:hsl(var(--background));color:hsl(var(--foreground));font-family:var(--font-sans);-webkit-font-smoothing:antialiased;margin:0}@keyframes flow-cyan{0%{stroke-dasharray:6 3;stroke-dashoffset:18px}to{stroke-dasharray:6 3;stroke-dashoffset:0}}.animate-flow-cyan{animation:1.2s linear infinite flow-cyan}.rounded-2xl.border.bg-card\/45{position:relative;overflow:hidden;background-color:hsl(var(--card) / .85)!important;border-color:hsl(var(--border) / .95)!important;transition:all .3s cubic-bezier(.4,0,.2,1)!important;box-shadow:0 10px 30px -15px #00000073,inset 0 1px #ffffff0d!important}.rounded-2xl.border.bg-card\/45:before{content:"";background:linear-gradient(90deg,hsl(var(--primary)),#6366f1,#a855f7);opacity:.75;height:3.5px;position:absolute;top:0;left:0;right:0;transition:opacity .3s!important}.rounded-2xl.border.bg-card\/45:hover{transform:translateY(-3px);background-color:hsl(var(--card) / .92)!important;border-color:hsl(var(--primary) / .35)!important;box-shadow:0 20px 40px -20px #000000a6,0 0 18px 2px hsl(var(--primary) / .05)!important}.rounded-2xl.border.bg-card\/45:hover:before{opacity:1}.rounded-xl.border.bg-card\/45{background-color:hsl(var(--card) / .88)!important;border-color:hsl(var(--border) / .9)!important;transition:all .2s!important}.rounded-xl.border.bg-card\/45:hover{background-color:hsl(var(--card) / .95)!important;border-color:hsl(var(--primary) / .3)!important}aside nav button[class*="bg-primary/15"]:not([class*=justify-center]){background:linear-gradient(90deg,hsl(var(--primary) / .18),#6366f11f)!important;color:hsl(var(--primary))!important;border-left:3.5px solid hsl(var(--primary))!important;border-radius:0 var(--radius) var(--radius) 0!important;padding-left:calc(.75rem - 3.5px)!important;box-shadow:inset 0 1px #ffffff05!important}aside nav button[class*="bg-primary/15"][class*=justify-center]{background:hsl(var(--primary) / .18)!important;color:hsl(var(--primary))!important;box-shadow:0 0 12px 1px hsl(var(--primary) / .1)!important;border:1px solid hsl(var(--primary) / .3)!important}::-webkit-scrollbar-thumb{border-radius:9999px;background:hsl(var(--primary) / .25)!important}::-webkit-scrollbar-thumb:hover{background:hsl(var(--primary) / .5)!important}input:focus,textarea:focus,select:focus{outline:none;border-color:hsl(var(--primary))!important;box-shadow:0 0 0 2px hsl(var(--primary) / .15)!important}@media(min-width:1440px){html{font-size:16.5px}}@media(min-width:1920px){html{font-size:17.5px}}@media(min-width:2560px){html{font-size:19px}}@media(min-width:3440px){html{font-size:20px}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-pan-x{syntax:"*";inherits:false}@property --tw-pan-y{syntax:"*";inherits:false}@property --tw-pinch-zoom{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@keyframes spin{to{transform:rotate(360deg)}}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}@keyframes pulse{50%{opacity:.5}} diff --git a/frontend/dist/assets/index-eeooup-h.js b/frontend/dist/assets/index-eeooup-h.js new file mode 100644 index 0000000..26d583d --- /dev/null +++ b/frontend/dist/assets/index-eeooup-h.js @@ -0,0 +1,5454 @@ +var _W=Object.defineProperty;var UN=t=>{throw TypeError(t)};var wW=(t,e,n)=>e in t?_W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var fo=(t,e,n)=>wW(t,typeof e!="symbol"?e+"":e,n),YM=(t,e,n)=>e.has(t)||UN("Cannot "+n);var me=(t,e,n)=>(YM(t,e,"read from private field"),n?n.call(t):e.get(t)),Wt=(t,e,n)=>e.has(t)?UN("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),wt=(t,e,n,r)=>(YM(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),_n=(t,e,n)=>(YM(t,e,"access private method"),n);var ub=(t,e,n,r)=>({set _(i){wt(t,e,i,n)},get _(){return me(t,e,r)}});function SW(t,e){for(var n=0;nr[i]})}}}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 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 n(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=n(i);fetch(i.href,s)}})();function B1(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ZM={exports:{}},ey={},QM={exports:{}},gn={};/** + * @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 jN;function MW(){if(jN)return gn;jN=1;var t=Symbol.for("react.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),o=Symbol.for("react.context"),a=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),f=Symbol.iterator;function m($){return $===null||typeof $!="object"?null:($=f&&$[f]||$["@@iterator"],typeof $=="function"?$:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function w($,Z,ge){this.props=$,this.context=Z,this.refs=S,this.updater=ge||y}w.prototype.isReactComponent={},w.prototype.setState=function($,Z){if(typeof $!="object"&&typeof $!="function"&&$!=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,$,Z,"setState")},w.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function b(){}b.prototype=w.prototype;function E($,Z,ge){this.props=$,this.context=Z,this.refs=S,this.updater=ge||y}var T=E.prototype=new b;T.constructor=E,x(T,w.prototype),T.isPureReactComponent=!0;var C=Array.isArray,O=Object.prototype.hasOwnProperty,N={current:null},D={key:!0,ref:!0,__self:!0,__source:!0};function F($,Z,ge){var ae,ce={},we=null,Me=null;if(Z!=null)for(ae in Z.ref!==void 0&&(Me=Z.ref),Z.key!==void 0&&(we=""+Z.key),Z)O.call(Z,ae)&&!D.hasOwnProperty(ae)&&(ce[ae]=Z[ae]);var $e=arguments.length-2;if($e===1)ce.children=ge;else if(1<$e){for(var Se=Array($e),Ve=0;Ve<$e;Ve++)Se[Ve]=arguments[Ve+2];ce.children=Se}if($&&$.defaultProps)for(ae in $e=$.defaultProps,$e)ce[ae]===void 0&&(ce[ae]=$e[ae]);return{$$typeof:t,type:$,key:we,ref:Me,props:ce,_owner:N.current}}function V($,Z){return{$$typeof:t,type:$.type,key:Z,ref:$.ref,props:$.props,_owner:$._owner}}function k($){return typeof $=="object"&&$!==null&&$.$$typeof===t}function j($){var Z={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(ge){return Z[ge]})}var H=/\/+/g;function ne($,Z){return typeof $=="object"&&$!==null&&$.key!=null?j(""+$.key):Z.toString(36)}function J($,Z,ge,ae,ce){var we=typeof $;(we==="undefined"||we==="boolean")&&($=null);var Me=!1;if($===null)Me=!0;else switch(we){case"string":case"number":Me=!0;break;case"object":switch($.$$typeof){case t:case e:Me=!0}}if(Me)return Me=$,ce=ce(Me),$=ae===""?"."+ne(Me,0):ae,C(ce)?(ge="",$!=null&&(ge=$.replace(H,"$&/")+"/"),J(ce,Z,ge,"",function(Ve){return Ve})):ce!=null&&(k(ce)&&(ce=V(ce,ge+(!ce.key||Me&&Me.key===ce.key?"":(""+ce.key).replace(H,"$&/")+"/")+$)),Z.push(ce)),1;if(Me=0,ae=ae===""?".":ae+":",C($))for(var $e=0;$e<$.length;$e++){we=$[$e];var Se=ae+ne(we,$e);Me+=J(we,Z,ge,Se,ce)}else if(Se=m($),typeof Se=="function")for($=Se.call($),$e=0;!(we=$.next()).done;)we=we.value,Se=ae+ne(we,$e++),Me+=J(we,Z,ge,Se,ce);else if(we==="object")throw Z=String($),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return Me}function de($,Z,ge){if($==null)return $;var ae=[],ce=0;return J($,ae,"","",function(we){return Z.call(ge,we,ce++)}),ae}function oe($){if($._status===-1){var Z=$._result;Z=Z(),Z.then(function(ge){($._status===0||$._status===-1)&&($._status=1,$._result=ge)},function(ge){($._status===0||$._status===-1)&&($._status=2,$._result=ge)}),$._status===-1&&($._status=0,$._result=Z)}if($._status===1)return $._result.default;throw $._result}var he={current:null},B={transition:null},K={ReactCurrentDispatcher:he,ReactCurrentBatchConfig:B,ReactCurrentOwner:N};function q(){throw Error("act(...) is not supported in production builds of React.")}return gn.Children={map:de,forEach:function($,Z,ge){de($,function(){Z.apply(this,arguments)},ge)},count:function($){var Z=0;return de($,function(){Z++}),Z},toArray:function($){return de($,function(Z){return Z})||[]},only:function($){if(!k($))throw Error("React.Children.only expected to receive a single React element child.");return $}},gn.Component=w,gn.Fragment=n,gn.Profiler=i,gn.PureComponent=E,gn.StrictMode=r,gn.Suspense=l,gn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K,gn.act=q,gn.cloneElement=function($,Z,ge){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var ae=x({},$.props),ce=$.key,we=$.ref,Me=$._owner;if(Z!=null){if(Z.ref!==void 0&&(we=Z.ref,Me=N.current),Z.key!==void 0&&(ce=""+Z.key),$.type&&$.type.defaultProps)var $e=$.type.defaultProps;for(Se in Z)O.call(Z,Se)&&!D.hasOwnProperty(Se)&&(ae[Se]=Z[Se]===void 0&&$e!==void 0?$e[Se]:Z[Se])}var Se=arguments.length-2;if(Se===1)ae.children=ge;else if(1>>1,Z=B[$];if(0>>1;$i(ce,q))wei(Me,ce)?(B[$]=Me,B[we]=q,$=we):(B[$]=ce,B[ae]=q,$=ae);else if(wei(Me,q))B[$]=Me,B[we]=q,$=we;else break e}}return K}function i(B,K){var q=B.sortIndex-K.sortIndex;return q!==0?q:B.id-K.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,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=B)r(c),K.sortIndex=K.expirationTime,e(l,K);else break;K=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var K=n(c);K!==null&&he(C,K.startTime-B)}}function O(B,K){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var q=m;try{for(T(K),f=n(l);f!==null&&(!(f.expirationTime>K)||B&&!j());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=K);K=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(K)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var ae=n(c);ae!==null&&he(C,ae.startTime-K),ge=!1}return ge}finally{f=null,m=q,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125$?(B.sortIndex=q,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,he(C,q-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var K=m;return function(){var q=m;m=K;try{return B.apply(this,arguments)}finally{m=q}}}})(tE)),tE}var VN;function CW(){return VN||(VN=1,eE.exports=TW()),eE.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 GN;function PW(){if(GN)return Gs;GN=1;var t=Wh(),e=CW();function n(u){for(var h="https://reactjs.org/docs/error-decoder.html?invariant="+u,_=1;_"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),l=Object.prototype.hasOwnProperty,c=/^[: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]*$/,d={},f={};function m(u){return l.call(f,u)?!0:l.call(d,u)?!1:c.test(u)?f[u]=!0:(d[u]=!0,!1)}function y(u,h,_,A){if(_!==null&&_.type===0)return!1;switch(typeof h){case"function":case"symbol":return!0;case"boolean":return A?!1:_!==null?!_.acceptsBooleans:(u=u.toLowerCase().slice(0,5),u!=="data-"&&u!=="aria-");default:return!1}}function x(u,h,_,A){if(h===null||typeof h>"u"||y(u,h,_,A))return!0;if(A)return!1;if(_!==null)switch(_.type){case 3:return!h;case 4:return h===!1;case 5:return isNaN(h);case 6:return isNaN(h)||1>h}return!1}function S(u,h,_,A,I,U,G){this.acceptsBooleans=h===2||h===3||h===4,this.attributeName=A,this.attributeNamespace=I,this.mustUseProperty=_,this.propertyName=u,this.type=h,this.sanitizeURL=U,this.removeEmptyString=G}var w={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(u){w[u]=new S(u,0,!1,u,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(u){var h=u[0];w[h]=new S(h,1,!1,u[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(u){w[u]=new S(u,2,!1,u.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(u){w[u]=new S(u,2,!1,u,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(u){w[u]=new S(u,3,!1,u.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(u){w[u]=new S(u,3,!0,u,null,!1,!1)}),["capture","download"].forEach(function(u){w[u]=new S(u,4,!1,u,null,!1,!1)}),["cols","rows","size","span"].forEach(function(u){w[u]=new S(u,6,!1,u,null,!1,!1)}),["rowSpan","start"].forEach(function(u){w[u]=new S(u,5,!1,u.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function E(u){return u[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(u){var h=u.replace(b,E);w[h]=new S(h,1,!1,u,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(u){var h=u.replace(b,E);w[h]=new S(h,1,!1,u,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(u){var h=u.replace(b,E);w[h]=new S(h,1,!1,u,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(u){w[u]=new S(u,1,!1,u.toLowerCase(),null,!1,!1)}),w.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(u){w[u]=new S(u,1,!1,u.toLowerCase(),null,!0,!0)});function T(u,h,_,A){var I=w.hasOwnProperty(h)?w[h]:null;(I!==null?I.type!==0:A||!(2se||I[G]!==U[se]){var pe=` +`+I[G].replace(" at new "," at ");return u.displayName&&pe.includes("")&&(pe=pe.replace("",u.displayName)),pe}while(1<=G&&0<=se);break}}}finally{ge=!1,Error.prepareStackTrace=_}return(u=u?u.displayName||u.name:"")?Z(u):""}function ce(u){switch(u.tag){case 5:return Z(u.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return u=ae(u.type,!1),u;case 11:return u=ae(u.type.render,!1),u;case 1:return u=ae(u.type,!0),u;default:return""}}function we(u){if(u==null)return null;if(typeof u=="function")return u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case D:return"Fragment";case N:return"Portal";case V:return"Profiler";case F:return"StrictMode";case ne:return"Suspense";case J:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case j:return(u.displayName||"Context")+".Consumer";case k:return(u._context.displayName||"Context")+".Provider";case H:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case de:return h=u.displayName||null,h!==null?h:we(u.type)||"Memo";case oe:h=u._payload,u=u._init;try{return we(u(h))}catch{}}return null}function Me(u){var h=u.type;switch(u.tag){case 24:return"Cache";case 9:return(h.displayName||"Context")+".Consumer";case 10:return(h._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return u=h.render,u=u.displayName||u.name||"",h.displayName||(u!==""?"ForwardRef("+u+")":"ForwardRef");case 7:return"Fragment";case 5:return h;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return we(h);case 8:return h===F?"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 h=="function")return h.displayName||h.name||null;if(typeof h=="string")return h}return null}function $e(u){switch(typeof u){case"boolean":case"number":case"string":case"undefined":return u;case"object":return u;default:return""}}function Se(u){var h=u.type;return(u=u.nodeName)&&u.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function Ve(u){var h=Se(u)?"checked":"value",_=Object.getOwnPropertyDescriptor(u.constructor.prototype,h),A=""+u[h];if(!u.hasOwnProperty(h)&&typeof _<"u"&&typeof _.get=="function"&&typeof _.set=="function"){var I=_.get,U=_.set;return Object.defineProperty(u,h,{configurable:!0,get:function(){return I.call(this)},set:function(G){A=""+G,U.call(this,G)}}),Object.defineProperty(u,h,{enumerable:_.enumerable}),{getValue:function(){return A},setValue:function(G){A=""+G},stopTracking:function(){u._valueTracker=null,delete u[h]}}}}function Xe(u){u._valueTracker||(u._valueTracker=Ve(u))}function fe(u){if(!u)return!1;var h=u._valueTracker;if(!h)return!0;var _=h.getValue(),A="";return u&&(A=Se(u)?u.checked?"true":"false":u.value),u=A,u!==_?(h.setValue(u),!0):!1}function Q(u){if(u=u||(typeof document<"u"?document:void 0),typeof u>"u")return null;try{return u.activeElement||u.body}catch{return u.body}}function Ge(u,h){var _=h.checked;return q({},h,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:_??u._wrapperState.initialChecked})}function Ue(u,h){var _=h.defaultValue==null?"":h.defaultValue,A=h.checked!=null?h.checked:h.defaultChecked;_=$e(h.value!=null?h.value:_),u._wrapperState={initialChecked:A,initialValue:_,controlled:h.type==="checkbox"||h.type==="radio"?h.checked!=null:h.value!=null}}function We(u,h){h=h.checked,h!=null&&T(u,"checked",h,!1)}function Qe(u,h){We(u,h);var _=$e(h.value),A=h.type;if(_!=null)A==="number"?(_===0&&u.value===""||u.value!=_)&&(u.value=""+_):u.value!==""+_&&(u.value=""+_);else if(A==="submit"||A==="reset"){u.removeAttribute("value");return}h.hasOwnProperty("value")?at(u,h.type,_):h.hasOwnProperty("defaultValue")&&at(u,h.type,$e(h.defaultValue)),h.checked==null&&h.defaultChecked!=null&&(u.defaultChecked=!!h.defaultChecked)}function xt(u,h,_){if(h.hasOwnProperty("value")||h.hasOwnProperty("defaultValue")){var A=h.type;if(!(A!=="submit"&&A!=="reset"||h.value!==void 0&&h.value!==null))return;h=""+u._wrapperState.initialValue,_||h===u.value||(u.value=h),u.defaultValue=h}_=u.name,_!==""&&(u.name=""),u.defaultChecked=!!u._wrapperState.initialChecked,_!==""&&(u.name=_)}function at(u,h,_){(h!=="number"||Q(u.ownerDocument)!==u)&&(_==null?u.defaultValue=""+u._wrapperState.initialValue:u.defaultValue!==""+_&&(u.defaultValue=""+_))}var te=Array.isArray;function W(u,h,_,A){if(u=u.options,h){h={};for(var I=0;I<_.length;I++)h["$"+_[I]]=!0;for(_=0;_"+h.valueOf().toString()+"",h=ft.firstChild;u.firstChild;)u.removeChild(u.firstChild);for(;h.firstChild;)u.appendChild(h.firstChild)}});function qe(u,h){if(h){var _=u.firstChild;if(_&&_===u.lastChild&&_.nodeType===3){_.nodeValue=h;return}}u.textContent=h}var dt={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},Dt=["Webkit","ms","Moz","O"];Object.keys(dt).forEach(function(u){Dt.forEach(function(h){h=h+u.charAt(0).toUpperCase()+u.substring(1),dt[h]=dt[u]})});function Ut(u,h,_){return h==null||typeof h=="boolean"||h===""?"":_||typeof h!="number"||h===0||dt.hasOwnProperty(u)&&dt[u]?(""+h).trim():h+"px"}function pt(u,h){u=u.style;for(var _ in h)if(h.hasOwnProperty(_)){var A=_.indexOf("--")===0,I=Ut(_,h[_],A);_==="float"&&(_="cssFloat"),A?u.setProperty(_,I):u[_]=I}}var ue=q({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 ee(u,h){if(h){if(ue[u]&&(h.children!=null||h.dangerouslySetInnerHTML!=null))throw Error(n(137,u));if(h.dangerouslySetInnerHTML!=null){if(h.children!=null)throw Error(n(60));if(typeof h.dangerouslySetInnerHTML!="object"||!("__html"in h.dangerouslySetInnerHTML))throw Error(n(61))}if(h.style!=null&&typeof h.style!="object")throw Error(n(62))}}function Ae(u,h){if(u.indexOf("-")===-1)return typeof h.is=="string";switch(u){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 re=null;function Fe(u){return u=u.target||u.srcElement||window,u.correspondingUseElement&&(u=u.correspondingUseElement),u.nodeType===3?u.parentNode:u}var Te=null,Le=null,Ke=null;function ut(u){if(u=pa(u)){if(typeof Te!="function")throw Error(n(280));var h=u.stateNode;h&&(h=Dp(h),Te(u.stateNode,u.type,h))}}function Kt(u){Le?Ke?Ke.push(u):Ke=[u]:Le=u}function un(){if(Le){var u=Le,h=Ke;if(Ke=Le=null,ut(u),h)for(u=0;u>>=0,u===0?32:31-(xn(u)/en|0)|0}var li=64,kn=4194304;function Is(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 Vn(u,h){var _=u.pendingLanes;if(_===0)return 0;var A=0,I=u.suspendedLanes,U=u.pingedLanes,G=_&268435455;if(G!==0){var se=G&~I;se!==0?A=Is(se):(U&=G,U!==0&&(A=Is(U)))}else G=_&~I,G!==0?A=Is(G):U!==0&&(A=Is(U));if(A===0)return 0;if(h!==0&&h!==A&&(h&I)===0&&(I=A&-A,U=h&-h,I>=U||I===16&&(U&4194240)!==0))return h;if((A&4)!==0&&(A|=_&16),h=u.entangledLanes,h!==0)for(u=u.entanglements,h&=A;0_;_++)h.push(u);return h}function Ya(u,h,_){u.pendingLanes|=h,h!==536870912&&(u.suspendedLanes=0,u.pingedLanes=0),u=u.eventTimes,h=31-mt(h),u[h]=_}function bM(u,h){var _=u.pendingLanes&~h;u.pendingLanes=h,u.suspendedLanes=0,u.pingedLanes=0,u.expiredLanes&=h,u.mutableReadLanes&=h,u.entangledLanes&=h,h=u.entanglements;var A=u.eventTimes;for(u=u.expirationTimes;0<_;){var I=31-mt(_),U=1<=qr),js=" ",mv=!1;function gv(u,h){switch(u){case"keyup":return pv.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xp(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var el=!1;function Ex(u,h){switch(u){case"compositionend":return xp(h);case"keypress":return h.which!==32?null:(mv=!0,js);case"textInput":return u=h.data,u===js&&mv?null:u;default:return null}}function Hd(u,h){if(el)return u==="compositionend"||!Ci&&gv(u,h)?(u=zd(),Wi=lv=to=null,el=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1=h)return{node:_,offset:h-u};u=A}e:{for(;_;){if(_.nextSibling){_=_.nextSibling;break e}_=_.parentNode}_=void 0}_=Vd(_)}}function ec(u,h){return u&&h?u===h?!0:u&&u.nodeType===3?!1:h&&h.nodeType===3?ec(u,h.parentNode):"contains"in u?u.contains(h):u.compareDocumentPosition?!!(u.compareDocumentPosition(h)&16):!1:!1}function nr(){for(var u=window,h=Q();h instanceof u.HTMLIFrameElement;){try{var _=typeof h.contentWindow.location.href=="string"}catch{_=!1}if(_)u=h.contentWindow;else break;h=Q(u.document)}return h}function Dr(u){var h=u&&u.nodeName&&u.nodeName.toLowerCase();return h&&(h==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||h==="textarea"||u.contentEditable==="true")}function Ur(u){var h=nr(),_=u.focusedElem,A=u.selectionRange;if(h!==_&&_&&_.ownerDocument&&ec(_.ownerDocument.documentElement,_)){if(A!==null&&Dr(_)){if(h=A.start,u=A.end,u===void 0&&(u=h),"selectionStart"in _)_.selectionStart=h,_.selectionEnd=Math.min(u,_.value.length);else if(u=(h=_.ownerDocument||document)&&h.defaultView||window,u.getSelection){u=u.getSelection();var I=_.textContent.length,U=Math.min(A.start,I);A=A.end===void 0?U:Math.min(A.end,I),!u.extend&&U>A&&(I=A,A=U,U=I),I=fs(_,U);var G=fs(_,A);I&&G&&(u.rangeCount!==1||u.anchorNode!==I.node||u.anchorOffset!==I.offset||u.focusNode!==G.node||u.focusOffset!==G.offset)&&(h=h.createRange(),h.setStart(I.node,I.offset),u.removeAllRanges(),U>A?(u.addRange(h),u.extend(G.node,G.offset)):(h.setEnd(G.node,G.offset),u.addRange(h)))}}for(h=[],u=_;u=u.parentNode;)u.nodeType===1&&h.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_=document.documentMode,No=null,tc=null,Gd=null,jr=!1;function Mp(u,h,_){var A=_.window===_?_.document:_.nodeType===9?_:_.ownerDocument;jr||No==null||No!==Q(A)||(A=No,"selectionStart"in A&&Dr(A)?A={start:A.selectionStart,end:A.selectionEnd}:(A=(A.ownerDocument&&A.ownerDocument.defaultView||window).getSelection(),A={anchorNode:A.anchorNode,anchorOffset:A.anchorOffset,focusNode:A.focusNode,focusOffset:A.focusOffset}),Gd&&Jl(Gd,A)||(Gd=A,A=Np(tc,"onSelect"),0Fr||(u.current=Cv[Fr],Cv[Fr]=null,Fr--)}function Gn(u,h){Fr++,Cv[Fr]=u.current,u.current=h}var ma={},Kr=ar(ma),Pi=ar(!1),ga=ma;function sc(u,h){var _=u.type.contextTypes;if(!_)return ma;var A=u.stateNode;if(A&&A.__reactInternalMemoizedUnmaskedChildContext===h)return A.__reactInternalMemoizedMaskedChildContext;var I={},U;for(U in _)I[U]=h[U];return A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=h,u.__reactInternalMemoizedMaskedChildContext=I),I}function ui(u){return u=u.childContextTypes,u!=null}function Qd(){$n(Pi),$n(Kr)}function Pv(u,h,_){if(Kr.current!==ma)throw Error(n(168));Gn(Kr,h),Gn(Pi,_)}function Jd(u,h,_){var A=u.stateNode;if(h=h.childContextTypes,typeof A.getChildContext!="function")return _;A=A.getChildContext();for(var I in A)if(!(I in h))throw Error(n(108,Me(u)||"Unknown",I));return q({},_,A)}function oc(u){return u=(u=u.stateNode)&&u.__reactInternalMemoizedMergedChildContext||ma,ga=Kr.current,Gn(Kr,u),Gn(Pi,Pi.current),!0}function Rv(u,h,_){var A=u.stateNode;if(!A)throw Error(n(169));_?(u=Jd(u,h,ga),A.__reactInternalMemoizedMergedChildContext=u,$n(Pi),$n(Kr),Gn(Kr,u)):$n(Pi),Gn(Pi,_)}var so=null,ef=!1,Up=!1;function tf(u){so===null?so=[u]:so.push(u)}function kx(u){ef=!0,tf(u)}function ko(){if(!Up&&so!==null){Up=!0;var u=0,h=Pn;try{var _=so;for(Pn=1;u<_.length;u++){var A=_[u];do A=A(!0);while(A!==null)}so=null,ef=!1}catch(I){throw so!==null&&(so=so.slice(u+1)),ke(Ft,ko),I}finally{Pn=h,Up=!1}}return null}var ac=[],qi=0,jp=null,Fp=0,Ri=[],zr=0,lc=null,ct=1,Fs="";function va(u,h){ac[qi++]=Fp,ac[qi++]=jp,jp=u,Fp=h}function Nv(u,h,_){Ri[zr++]=ct,Ri[zr++]=Fs,Ri[zr++]=lc,lc=u;var A=ct;u=Fs;var I=32-mt(A)-1;A&=~(1<>=G,I-=G,ct=1<<32-mt(h)+I|_<tn?(pi=Gt,Gt=null):pi=Gt.sibling;var Dn=Ye(Pe,Gt,Ne[tn],it);if(Dn===null){Gt===null&&(Gt=pi);break}u&&Gt&&Dn.alternate===null&&h(Pe,Gt),ve=U(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn,Gt=pi}if(tn===Ne.length)return _(Pe,Gt),qn&&va(Pe,tn),Ot;if(Gt===null){for(;tntn?(pi=Gt,Gt=null):pi=Gt.sibling;var Vu=Ye(Pe,Gt,Dn.value,it);if(Vu===null){Gt===null&&(Gt=pi);break}u&&Gt&&Vu.alternate===null&&h(Pe,Gt),ve=U(Vu,ve,tn),Vt===null?Ot=Vu:Vt.sibling=Vu,Vt=Vu,Gt=pi}if(Dn.done)return _(Pe,Gt),qn&&va(Pe,tn),Ot;if(Gt===null){for(;!Dn.done;tn++,Dn=Ne.next())Dn=Je(Pe,Dn.value,it),Dn!==null&&(ve=U(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn);return qn&&va(Pe,tn),Ot}for(Gt=A(Pe,Gt);!Dn.done;tn++,Dn=Ne.next())Dn=_t(Gt,Pe,tn,Dn.value,it),Dn!==null&&(u&&Dn.alternate!==null&&Gt.delete(Dn.key===null?tn:Dn.key),ve=U(Dn,ve,tn),Vt===null?Ot=Dn:Vt.sibling=Dn,Vt=Dn);return u&&Gt.forEach(function(bW){return h(Pe,bW)}),qn&&va(Pe,tn),Ot}function Ir(Pe,ve,Ne,it){if(typeof Ne=="object"&&Ne!==null&&Ne.type===D&&Ne.key===null&&(Ne=Ne.props.children),typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case O:e:{for(var Ot=Ne.key,Vt=ve;Vt!==null;){if(Vt.key===Ot){if(Ot=Ne.type,Ot===D){if(Vt.tag===7){_(Pe,Vt.sibling),ve=I(Vt,Ne.props.children),ve.return=Pe,Pe=ve;break e}}else if(Vt.elementType===Ot||typeof Ot=="object"&&Ot!==null&&Ot.$$typeof===oe&&Dv(Ot)===Vt.type){_(Pe,Vt.sibling),ve=I(Vt,Ne.props),ve.ref=nf(Pe,Vt,Ne),ve.return=Pe,Pe=ve;break e}_(Pe,Vt);break}else h(Pe,Vt);Vt=Vt.sibling}Ne.type===D?(ve=_f(Ne.props.children,Pe.mode,it,Ne.key),ve.return=Pe,Pe=ve):(it=nb(Ne.type,Ne.key,Ne.props,null,Pe.mode,it),it.ref=nf(Pe,ve,Ne),it.return=Pe,Pe=it)}return G(Pe);case N:e:{for(Vt=Ne.key;ve!==null;){if(ve.key===Vt)if(ve.tag===4&&ve.stateNode.containerInfo===Ne.containerInfo&&ve.stateNode.implementation===Ne.implementation){_(Pe,ve.sibling),ve=I(ve,Ne.children||[]),ve.return=Pe,Pe=ve;break e}else{_(Pe,ve);break}else h(Pe,ve);ve=ve.sibling}ve=WM(Ne,Pe.mode,it),ve.return=Pe,Pe=ve}return G(Pe);case oe:return Vt=Ne._init,Ir(Pe,ve,Vt(Ne._payload),it)}if(te(Ne))return Tt(Pe,ve,Ne,it);if(K(Ne))return Rt(Pe,ve,Ne,it);rf(Pe,Ne)}return typeof Ne=="string"&&Ne!==""||typeof Ne=="number"?(Ne=""+Ne,ve!==null&&ve.tag===6?(_(Pe,ve.sibling),ve=I(ve,Ne),ve.return=Pe,Pe=ve):(_(Pe,ve),ve=GM(Ne,Pe.mode,it),ve.return=Pe,Pe=ve),G(Pe)):_(Pe,ve)}return Ir}var cc=Uv(!0),sf=Uv(!1),uc=ar(null),dc=null,xa=null,Iu=null;function fc(){Iu=xa=dc=null}function of(u){var h=uc.current;$n(uc),u._currentValue=h}function af(u,h,_){for(;u!==null;){var A=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,A!==null&&(A.childLanes|=h)):A!==null&&(A.childLanes&h)!==h&&(A.childLanes|=h),u===_)break;u=u.return}}function ol(u,h){dc=u,Iu=xa=null,u=u.dependencies,u!==null&&u.firstContext!==null&&((u.lanes&h)!==0&&(ln=!0),u.firstContext=null)}function ps(u){var h=u._currentValue;if(Iu!==u)if(u={context:u,memoizedValue:h,next:null},xa===null){if(dc===null)throw Error(n(308));xa=u,dc.dependencies={lanes:0,firstContext:u}}else xa=xa.next=u;return h}var ba=null;function jv(u){ba===null?ba=[u]:ba.push(u)}function lf(u,h,_,A){var I=h.interleaved;return I===null?(_.next=_,jv(h)):(_.next=I.next,I.next=_),h.interleaved=_,oo(u,A)}function oo(u,h){u.lanes|=h;var _=u.alternate;for(_!==null&&(_.lanes|=h),_=u,u=u.return;u!==null;)u.childLanes|=h,_=u.alternate,_!==null&&(_.childLanes|=h),_=u,u=u.return;return _.tag===3?_.stateNode:null}var Fn=!1;function an(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mr(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,effects:u.effects})}function zn(u,h){return{eventTime:u,lane:h,tag:0,payload:null,callback:null,next:null}}function Qn(u,h,_){var A=u.updateQueue;if(A===null)return null;if(A=A.shared,(On&2)!==0){var I=A.pending;return I===null?h.next=h:(h.next=I.next,I.next=h),A.pending=h,oo(u,_)}return I=A.interleaved,I===null?(h.next=h,jv(A)):(h.next=I.next,I.next=h),A.interleaved=h,oo(u,_)}function di(u,h,_){if(h=h.updateQueue,h!==null&&(h=h.shared,(_&4194240)!==0)){var A=h.lanes;A&=u.pendingLanes,_|=A,h.lanes=_,fu(u,_)}}function hc(u,h){var _=u.updateQueue,A=u.alternate;if(A!==null&&(A=A.updateQueue,_===A)){var I=null,U=null;if(_=_.firstBaseUpdate,_!==null){do{var G={eventTime:_.eventTime,lane:_.lane,tag:_.tag,payload:_.payload,callback:_.callback,next:null};U===null?I=U=G:U=U.next=G,_=_.next}while(_!==null);U===null?I=U=h:U=U.next=h}else I=U=h;_={baseState:A.baseState,firstBaseUpdate:I,lastBaseUpdate:U,shared:A.shared,effects:A.effects},u.updateQueue=_;return}u=_.lastBaseUpdate,u===null?_.firstBaseUpdate=h:u.next=h,_.lastBaseUpdate=h}function lr(u,h,_,A){var I=u.updateQueue;Fn=!1;var U=I.firstBaseUpdate,G=I.lastBaseUpdate,se=I.shared.pending;if(se!==null){I.shared.pending=null;var pe=se,De=pe.next;pe.next=null,G===null?U=De:G.next=De,G=pe;var Ze=u.alternate;Ze!==null&&(Ze=Ze.updateQueue,se=Ze.lastBaseUpdate,se!==G&&(se===null?Ze.firstBaseUpdate=De:se.next=De,Ze.lastBaseUpdate=pe))}if(U!==null){var Je=I.baseState;G=0,Ze=De=pe=null,se=U;do{var Ye=se.lane,_t=se.eventTime;if((A&Ye)===Ye){Ze!==null&&(Ze=Ze.next={eventTime:_t,lane:0,tag:se.tag,payload:se.payload,callback:se.callback,next:null});e:{var Tt=u,Rt=se;switch(Ye=h,_t=_,Rt.tag){case 1:if(Tt=Rt.payload,typeof Tt=="function"){Je=Tt.call(_t,Je,Ye);break e}Je=Tt;break e;case 3:Tt.flags=Tt.flags&-65537|128;case 0:if(Tt=Rt.payload,Ye=typeof Tt=="function"?Tt.call(_t,Je,Ye):Tt,Ye==null)break e;Je=q({},Je,Ye);break e;case 2:Fn=!0}}se.callback!==null&&se.lane!==0&&(u.flags|=64,Ye=I.effects,Ye===null?I.effects=[se]:Ye.push(se))}else _t={eventTime:_t,lane:Ye,tag:se.tag,payload:se.payload,callback:se.callback,next:null},Ze===null?(De=Ze=_t,pe=Je):Ze=Ze.next=_t,G|=Ye;if(se=se.next,se===null){if(se=I.shared.pending,se===null)break;Ye=se,se=Ye.next,Ye.next=null,I.lastBaseUpdate=Ye,I.shared.pending=null}}while(!0);if(Ze===null&&(pe=Je),I.baseState=pe,I.firstBaseUpdate=De,I.lastBaseUpdate=Ze,h=I.shared.interleaved,h!==null){I=h;do G|=I.lane,I=I.next;while(I!==h)}else U===null&&(I.shared.lanes=0);vf|=G,u.lanes=G,u.memoizedState=Je}}function ku(u,h,_){if(u=h.effects,h.effects=null,u!==null)for(h=0;h_?_:4,u(!0);var A=vc.transition;vc.transition={};try{u(!1),h()}finally{Pn=_,vc.transition=A}}function Ma(){return gs().memoizedState}function $p(u,h,_){var A=zu(u);if(_={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null},mf(u))Xp(h,_);else if(_=lf(u,h,_,A),_!==null){var I=xs();Ca(_,u,A,I),qp(_,h,A)}}function yc(u,h,_){var A=zu(u),I={lane:A,action:_,hasEagerState:!1,eagerState:null,next:null};if(mf(u))Xp(h,I);else{var U=u.alternate;if(u.lanes===0&&(U===null||U.lanes===0)&&(U=h.lastRenderedReducer,U!==null))try{var G=h.lastRenderedState,se=U(G,_);if(I.hasEagerState=!0,I.eagerState=se,ds(se,G)){var pe=h.interleaved;pe===null?(I.next=I,jv(h)):(I.next=pe.next,pe.next=I),h.interleaved=I;return}}catch{}finally{}_=lf(u,h,I,A),_!==null&&(I=xs(),Ca(_,u,A,I),qp(_,h,A))}}function mf(u){var h=u.alternate;return u===Xn||h!==null&&h===Xn}function Xp(u,h){fi=lo=!0;var _=u.pending;_===null?h.next=h:(h.next=_.next,_.next=h),u.pending=h}function qp(u,h,_){if((_&4194240)!==0){var A=h.lanes;A&=u.pendingLanes,_|=A,h.lanes=_,fu(u,_)}}var Kp={readContext:ps,useCallback:Zr,useContext:Zr,useEffect:Zr,useImperativeHandle:Zr,useInsertionEffect:Zr,useLayoutEffect:Zr,useMemo:Zr,useReducer:Zr,useRef:Zr,useState:Zr,useDebugValue:Zr,useDeferredValue:Zr,useTransition:Zr,useMutableSource:Zr,useSyncExternalStore:Zr,useId:Zr,unstable_isNewReconciler:!1},zx={readContext:ps,useCallback:function(u,h){return Qr().memoizedState=[u,h===void 0?null:h],u},useContext:ps,useEffect:Ii,useImperativeHandle:function(u,h,_){return _=_!=null?_.concat([u]):null,Do(4194308,4,jx.bind(null,h,u),_)},useLayoutEffect:function(u,h){return Do(4194308,4,u,h)},useInsertionEffect:function(u,h){return Do(4,2,u,h)},useMemo:function(u,h){var _=Qr();return h=h===void 0?null:h,u=u(),_.memoizedState=[u,h],u},useReducer:function(u,h,_){var A=Qr();return h=_!==void 0?_(h):h,A.memoizedState=A.baseState=h,u={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:h},A.queue=u,u=u.dispatch=$p.bind(null,Xn,u),[A.memoizedState,u]},useRef:function(u){var h=Qr();return u={current:u},h.memoizedState=u},useState:Vv,useDebugValue:Gp,useDeferredValue:function(u){return Qr().memoizedState=u},useTransition:function(){var u=Vv(!1),h=u[0];return u=AM.bind(null,u[1]),Qr().memoizedState=u,[h,u]},useMutableSource:function(){},useSyncExternalStore:function(u,h,_){var A=Xn,I=Qr();if(qn){if(_===void 0)throw Error(n(407));_=_()}else{if(_=h(),hi===null)throw Error(n(349));(wa&30)!==0||Vp(A,h,_)}I.memoizedState=_;var U={value:_,getSnapshot:h};return I.queue=U,Ii(Ox.bind(null,A,U,u),[u]),A.flags|=2048,co(9,hf.bind(null,A,U,_,h),void 0,null),_},useId:function(){var u=Qr(),h=hi.identifierPrefix;if(qn){var _=Fs,A=ct;_=(A&~(1<<32-mt(A)-1)).toString(32)+_,h=":"+h+"R"+_,_=ll++,0<_&&(h+="H"+_.toString(32)),h+=":"}else _=Ki++,h=":"+h+"r"+_.toString(32)+":";return u.memoizedState=h},unstable_isNewReconciler:!1},Bx={readContext:ps,useCallback:Fx,useContext:ps,useEffect:Gv,useImperativeHandle:$v,useInsertionEffect:Wv,useLayoutEffect:Ux,useMemo:vs,useReducer:ff,useRef:Dx,useState:function(){return ff(Du)},useDebugValue:Gp,useDeferredValue:function(u){var h=gs();return Wp(h,cr.memoizedState,u)},useTransition:function(){var u=ff(Du)[0],h=gs().memoizedState;return[u,h]},useMutableSource:zv,useSyncExternalStore:Bv,useId:Ma,unstable_isNewReconciler:!1},Hx={readContext:ps,useCallback:Fx,useContext:ps,useEffect:Gv,useImperativeHandle:$v,useInsertionEffect:Wv,useLayoutEffect:Ux,useMemo:vs,useReducer:Sa,useRef:Dx,useState:function(){return Sa(Du)},useDebugValue:Gp,useDeferredValue:function(u){var h=gs();return cr===null?h.memoizedState=u:Wp(h,cr.memoizedState,u)},useTransition:function(){var u=Sa(Du)[0],h=gs().memoizedState;return[u,h]},useMutableSource:zv,useSyncExternalStore:Bv,useId:Ma,unstable_isNewReconciler:!1};function Bs(u,h){if(u&&u.defaultProps){h=q({},h),u=u.defaultProps;for(var _ in u)h[_]===void 0&&(h[_]=u[_]);return h}return h}function gf(u,h,_,A){h=u.memoizedState,_=_(A,h),_=_==null?h:q({},h,_),u.memoizedState=_,u.lanes===0&&(u.updateQueue.baseState=_)}var Yp={isMounted:function(u){return(u=u._reactInternals)?Co(u)===u:!1},enqueueSetState:function(u,h,_){u=u._reactInternals;var A=xs(),I=zu(u),U=zn(A,I);U.payload=h,_!=null&&(U.callback=_),h=Qn(u,U,I),h!==null&&(Ca(h,u,I,A),di(h,u,I))},enqueueReplaceState:function(u,h,_){u=u._reactInternals;var A=xs(),I=zu(u),U=zn(A,I);U.tag=1,U.payload=h,_!=null&&(U.callback=_),h=Qn(u,U,I),h!==null&&(Ca(h,u,I,A),di(h,u,I))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var _=xs(),A=zu(u),I=zn(_,A);I.tag=2,h!=null&&(I.callback=h),h=Qn(u,I,A),h!==null&&(Ca(h,u,A,_),di(h,u,A))}};function Vx(u,h,_,A,I,U,G){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(A,U,G):h.prototype&&h.prototype.isPureReactComponent?!Jl(_,A)||!Jl(I,U):!0}function p(u,h,_){var A=!1,I=ma,U=h.contextType;return typeof U=="object"&&U!==null?U=ps(U):(I=ui(h)?ga:Kr.current,A=h.contextTypes,U=(A=A!=null)?sc(u,I):ma),h=new h(_,U),u.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=Yp,u.stateNode=h,h._reactInternals=u,A&&(u=u.stateNode,u.__reactInternalMemoizedUnmaskedChildContext=I,u.__reactInternalMemoizedMaskedChildContext=U),h}function g(u,h,_,A){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(_,A),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(_,A),h.state!==u&&Yp.enqueueReplaceState(h,h.state,null)}function M(u,h,_,A){var I=u.stateNode;I.props=_,I.state=u.memoizedState,I.refs={},an(u);var U=h.contextType;typeof U=="object"&&U!==null?I.context=ps(U):(U=ui(h)?ga:Kr.current,I.context=sc(u,U)),I.state=u.memoizedState,U=h.getDerivedStateFromProps,typeof U=="function"&&(gf(u,h,U,_),I.state=u.memoizedState),typeof h.getDerivedStateFromProps=="function"||typeof I.getSnapshotBeforeUpdate=="function"||typeof I.UNSAFE_componentWillMount!="function"&&typeof I.componentWillMount!="function"||(h=I.state,typeof I.componentWillMount=="function"&&I.componentWillMount(),typeof I.UNSAFE_componentWillMount=="function"&&I.UNSAFE_componentWillMount(),h!==I.state&&Yp.enqueueReplaceState(I,I.state,null),lr(u,_,I,A),I.state=u.memoizedState),typeof I.componentDidMount=="function"&&(u.flags|=4194308)}function P(u,h){try{var _="",A=h;do _+=ce(A),A=A.return;while(A);var I=_}catch(U){I=` +Error generating stack: `+U.message+` +`+U.stack}return{value:u,source:h,stack:I,digest:null}}function L(u,h,_){return{value:u,source:null,stack:_??null,digest:h??null}}function z(u,h){try{console.error(h.value)}catch(_){setTimeout(function(){throw _})}}var ie=typeof WeakMap=="function"?WeakMap:Map;function ye(u,h,_){_=zn(-1,_),_.tag=3,_.payload={element:null};var A=h.value;return _.callback=function(){Yx||(Yx=!0,DM=A),z(u,h)},_}function ze(u,h,_){_=zn(-1,_),_.tag=3;var A=u.type.getDerivedStateFromError;if(typeof A=="function"){var I=h.value;_.payload=function(){return A(I)},_.callback=function(){z(u,h)}}var U=u.stateNode;return U!==null&&typeof U.componentDidCatch=="function"&&(_.callback=function(){z(u,h),typeof A!="function"&&(ju===null?ju=new Set([this]):ju.add(this));var G=h.stack;this.componentDidCatch(h.value,{componentStack:G!==null?G:""})}),_}function tt(u,h,_){var A=u.pingCache;if(A===null){A=u.pingCache=new ie;var I=new Set;A.set(h,I)}else I=A.get(h),I===void 0&&(I=new Set,A.set(h,I));I.has(_)||(I.add(_),u=cW.bind(null,u,h,_),h.then(u,u))}function St(u){do{var h;if((h=u.tag===13)&&(h=u.memoizedState,h=h!==null?h.dehydrated!==null:!0),h)return u;u=u.return}while(u!==null);return null}function rn(u,h,_,A,I){return(u.mode&1)===0?(u===h?u.flags|=65536:(u.flags|=128,_.flags|=131072,_.flags&=-52805,_.tag===1&&(_.alternate===null?_.tag=17:(h=zn(-1,1),h.tag=2,Qn(_,h,1))),_.lanes|=1),u):(u.flags|=65536,u.lanes=I,u)}var Bt=C.ReactCurrentOwner,ln=!1;function bt(u,h,_,A){h.child=u===null?sf(h,null,_,A):cc(h,u.child,_,A)}function Jr(u,h,_,A,I){_=_.render;var U=h.ref;return ol(h,I),A=df(u,h,_,A,U,I),_=Fv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,xc(u,h,I)):(qn&&_&&Iv(h),h.flags|=1,bt(u,h,A,I),h.child)}function ys(u,h,_,A,I){if(u===null){var U=_.type;return typeof U=="function"&&!VM(U)&&U.defaultProps===void 0&&_.compare===null&&_.defaultProps===void 0?(h.tag=15,h.type=U,Ie(u,h,U,A,I)):(u=nb(_.type,null,A,h,h.mode,I),u.ref=h.ref,u.return=h,h.child=u)}if(U=u.child,(u.lanes&I)===0){var G=U.memoizedProps;if(_=_.compare,_=_!==null?_:Jl,_(G,A)&&u.ref===h.ref)return xc(u,h,I)}return h.flags|=1,u=Hu(U,A),u.ref=h.ref,u.return=h,h.child=u}function Ie(u,h,_,A,I){if(u!==null){var U=u.memoizedProps;if(Jl(U,A)&&u.ref===h.ref)if(ln=!1,h.pendingProps=A=U,(u.lanes&I)!==0)(u.flags&131072)!==0&&(ln=!0);else return h.lanes=u.lanes,xc(u,h,I)}return gt(u,h,_,A,I)}function be(u,h,_){var A=h.pendingProps,I=A.children,U=u!==null?u.memoizedState:null;if(A.mode==="hidden")if((h.mode&1)===0)h.memoizedState={baseLanes:0,cachePool:null,transitions:null},Gn(Qp,uo),uo|=_;else{if((_&1073741824)===0)return u=U!==null?U.baseLanes|_:_,h.lanes=h.childLanes=1073741824,h.memoizedState={baseLanes:u,cachePool:null,transitions:null},h.updateQueue=null,Gn(Qp,uo),uo|=u,null;h.memoizedState={baseLanes:0,cachePool:null,transitions:null},A=U!==null?U.baseLanes:_,Gn(Qp,uo),uo|=A}else U!==null?(A=U.baseLanes|_,h.memoizedState=null):A=_,Gn(Qp,uo),uo|=A;return bt(u,h,I,_),h.child}function je(u,h){var _=h.ref;(u===null&&_!==null||u!==null&&u.ref!==_)&&(h.flags|=512,h.flags|=2097152)}function gt(u,h,_,A,I){var U=ui(_)?ga:Kr.current;return U=sc(h,U),ol(h,I),_=df(u,h,_,A,U,I),A=Fv(),u!==null&&!ln?(h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~I,xc(u,h,I)):(qn&&A&&Iv(h),h.flags|=1,bt(u,h,_,I),h.child)}function It(u,h,_,A,I){if(ui(_)){var U=!0;oc(h)}else U=!1;if(ol(h,I),h.stateNode===null)Wx(u,h),p(h,_,A),M(h,_,A,I),A=!0;else if(u===null){var G=h.stateNode,se=h.memoizedProps;G.props=se;var pe=G.context,De=_.contextType;typeof De=="object"&&De!==null?De=ps(De):(De=ui(_)?ga:Kr.current,De=sc(h,De));var Ze=_.getDerivedStateFromProps,Je=typeof Ze=="function"||typeof G.getSnapshotBeforeUpdate=="function";Je||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(se!==A||pe!==De)&&g(h,G,A,De),Fn=!1;var Ye=h.memoizedState;G.state=Ye,lr(h,A,G,I),pe=h.memoizedState,se!==A||Ye!==pe||Pi.current||Fn?(typeof Ze=="function"&&(gf(h,_,Ze,A),pe=h.memoizedState),(se=Fn||Vx(h,_,se,A,Ye,pe,De))?(Je||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"&&(h.flags|=4194308)):(typeof G.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=A,h.memoizedState=pe),G.props=A,G.state=pe,G.context=De,A=se):(typeof G.componentDidMount=="function"&&(h.flags|=4194308),A=!1)}else{G=h.stateNode,mr(u,h),se=h.memoizedProps,De=h.type===h.elementType?se:Bs(h.type,se),G.props=De,Je=h.pendingProps,Ye=G.context,pe=_.contextType,typeof pe=="object"&&pe!==null?pe=ps(pe):(pe=ui(_)?ga:Kr.current,pe=sc(h,pe));var _t=_.getDerivedStateFromProps;(Ze=typeof _t=="function"||typeof G.getSnapshotBeforeUpdate=="function")||typeof G.UNSAFE_componentWillReceiveProps!="function"&&typeof G.componentWillReceiveProps!="function"||(se!==Je||Ye!==pe)&&g(h,G,A,pe),Fn=!1,Ye=h.memoizedState,G.state=Ye,lr(h,A,G,I);var Tt=h.memoizedState;se!==Je||Ye!==Tt||Pi.current||Fn?(typeof _t=="function"&&(gf(h,_,_t,A),Tt=h.memoizedState),(De=Fn||Vx(h,_,De,A,Ye,Tt,pe)||!1)?(Ze||typeof G.UNSAFE_componentWillUpdate!="function"&&typeof G.componentWillUpdate!="function"||(typeof G.componentWillUpdate=="function"&&G.componentWillUpdate(A,Tt,pe),typeof G.UNSAFE_componentWillUpdate=="function"&&G.UNSAFE_componentWillUpdate(A,Tt,pe)),typeof G.componentDidUpdate=="function"&&(h.flags|=4),typeof G.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof G.componentDidUpdate!="function"||se===u.memoizedProps&&Ye===u.memoizedState||(h.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||se===u.memoizedProps&&Ye===u.memoizedState||(h.flags|=1024),h.memoizedProps=A,h.memoizedState=Tt),G.props=A,G.state=Tt,G.context=pe,A=De):(typeof G.componentDidUpdate!="function"||se===u.memoizedProps&&Ye===u.memoizedState||(h.flags|=4),typeof G.getSnapshotBeforeUpdate!="function"||se===u.memoizedProps&&Ye===u.memoizedState||(h.flags|=1024),A=!1)}return on(u,h,_,A,U,I)}function on(u,h,_,A,I,U){je(u,h);var G=(h.flags&128)!==0;if(!A&&!G)return I&&Rv(h,_,!1),xc(u,h,U);A=h.stateNode,Bt.current=h;var se=G&&typeof _.getDerivedStateFromError!="function"?null:A.render();return h.flags|=1,u!==null&&G?(h.child=cc(h,u.child,null,U),h.child=cc(h,null,se,U)):bt(u,h,se,U),h.memoizedState=A.state,I&&Rv(h,_,!0),h.child}function sn(u){var h=u.stateNode;h.pendingContext?Pv(u,h.pendingContext,h.pendingContext!==h.context):h.context&&Pv(u,h.context,!1),cf(u,h.containerInfo)}function En(u,h,_,A,I){return sl(),Nu(I),h.flags|=256,bt(u,h,_,A),h.child}var br={dehydrated:null,treeContext:null,retryLane:0};function bn(u){return{baseLanes:u,cachePool:null,transitions:null}}function Ea(u,h,_){var A=h.pendingProps,I=Kn.current,U=!1,G=(h.flags&128)!==0,se;if((se=G)||(se=u!==null&&u.memoizedState===null?!1:(I&2)!==0),se?(U=!0,h.flags&=-129):(u===null||u.memoizedState!==null)&&(I|=1),Gn(Kn,I&1),u===null)return Bp(h),u=h.memoizedState,u!==null&&(u=u.dehydrated,u!==null)?((h.mode&1)===0?h.lanes=1:u.data==="$!"?h.lanes=8:h.lanes=1073741824,null):(G=A.children,u=A.fallback,U?(A=h.mode,U=h.child,G={mode:"hidden",children:G},(A&1)===0&&U!==null?(U.childLanes=0,U.pendingProps=G):U=rb(G,A,0,null),u=_f(u,A,_,null),U.return=h,u.return=h,U.sibling=u,h.child=U,h.child.memoizedState=bn(_),h.memoizedState=br,u):Xv(h,G));if(I=u.memoizedState,I!==null&&(se=I.dehydrated,se!==null))return ZG(u,h,G,A,se,I,_);if(U){U=A.fallback,G=h.mode,I=u.child,se=I.sibling;var pe={mode:"hidden",children:A.children};return(G&1)===0&&h.child!==I?(A=h.child,A.childLanes=0,A.pendingProps=pe,h.deletions=null):(A=Hu(I,pe),A.subtreeFlags=I.subtreeFlags&14680064),se!==null?U=Hu(se,U):(U=_f(U,G,_,null),U.flags|=2),U.return=h,A.return=h,A.sibling=U,h.child=A,A=U,U=h.child,G=u.child.memoizedState,G=G===null?bn(_):{baseLanes:G.baseLanes|_,cachePool:null,transitions:G.transitions},U.memoizedState=G,U.childLanes=u.childLanes&~_,h.memoizedState=br,A}return U=u.child,u=U.sibling,A=Hu(U,{mode:"visible",children:A.children}),(h.mode&1)===0&&(A.lanes=_),A.return=h,A.sibling=null,u!==null&&(_=h.deletions,_===null?(h.deletions=[u],h.flags|=16):_.push(u)),h.child=A,h.memoizedState=null,A}function Xv(u,h){return h=rb({mode:"visible",children:h},u.mode,0,null),h.return=u,u.child=h}function Gx(u,h,_,A){return A!==null&&Nu(A),cc(h,u.child,null,_),u=Xv(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function ZG(u,h,_,A,I,U,G){if(_)return h.flags&256?(h.flags&=-257,A=L(Error(n(422))),Gx(u,h,G,A)):h.memoizedState!==null?(h.child=u.child,h.flags|=128,null):(U=A.fallback,I=h.mode,A=rb({mode:"visible",children:A.children},I,0,null),U=_f(U,I,G,null),U.flags|=2,A.return=h,U.return=h,A.sibling=U,h.child=A,(h.mode&1)!==0&&cc(h,u.child,null,G),h.child.memoizedState=bn(G),h.memoizedState=br,U);if((h.mode&1)===0)return Gx(u,h,G,null);if(I.data==="$!"){if(A=I.nextSibling&&I.nextSibling.dataset,A)var se=A.dgst;return A=se,U=Error(n(419)),A=L(U,A,void 0),Gx(u,h,G,A)}if(se=(G&u.childLanes)!==0,ln||se){if(A=hi,A!==null){switch(G&-G){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}I=(I&(A.suspendedLanes|G))!==0?0:I,I!==0&&I!==U.retryLane&&(U.retryLane=I,oo(u,I),Ca(A,u,I,-1))}return HM(),A=L(Error(n(421))),Gx(u,h,G,A)}return I.data==="$?"?(h.flags|=128,h.child=u.child,h=uW.bind(null,u),I._reactRetry=h,null):(u=U.treeContext,Ni=ha(I.nextSibling),Yr=h,qn=!0,zs=null,u!==null&&(Ri[zr++]=ct,Ri[zr++]=Fs,Ri[zr++]=lc,ct=u.id,Fs=u.overflow,lc=h),h=Xv(h,A.children),h.flags|=4096,h)}function oN(u,h,_){u.lanes|=h;var A=u.alternate;A!==null&&(A.lanes|=h),af(u.return,h,_)}function TM(u,h,_,A,I){var U=u.memoizedState;U===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:A,tail:_,tailMode:I}:(U.isBackwards=h,U.rendering=null,U.renderingStartTime=0,U.last=A,U.tail=_,U.tailMode=I)}function aN(u,h,_){var A=h.pendingProps,I=A.revealOrder,U=A.tail;if(bt(u,h,A.children,_),A=Kn.current,(A&2)!==0)A=A&1|2,h.flags|=128;else{if(u!==null&&(u.flags&128)!==0)e:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&oN(u,_,h);else if(u.tag===19)oN(u,_,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break e;for(;u.sibling===null;){if(u.return===null||u.return===h)break e;u=u.return}u.sibling.return=u.return,u=u.sibling}A&=1}if(Gn(Kn,A),(h.mode&1)===0)h.memoizedState=null;else switch(I){case"forwards":for(_=h.child,I=null;_!==null;)u=_.alternate,u!==null&&ao(u)===null&&(I=_),_=_.sibling;_=I,_===null?(I=h.child,h.child=null):(I=_.sibling,_.sibling=null),TM(h,!1,I,_,U);break;case"backwards":for(_=null,I=h.child,h.child=null;I!==null;){if(u=I.alternate,u!==null&&ao(u)===null){h.child=I;break}u=I.sibling,I.sibling=_,_=I,I=u}TM(h,!0,_,null,U);break;case"together":TM(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Wx(u,h){(h.mode&1)===0&&u!==null&&(u.alternate=null,h.alternate=null,h.flags|=2)}function xc(u,h,_){if(u!==null&&(h.dependencies=u.dependencies),vf|=h.lanes,(_&h.childLanes)===0)return null;if(u!==null&&h.child!==u.child)throw Error(n(153));if(h.child!==null){for(u=h.child,_=Hu(u,u.pendingProps),h.child=_,_.return=h;u.sibling!==null;)u=u.sibling,_=_.sibling=Hu(u,u.pendingProps),_.return=h;_.sibling=null}return h.child}function QG(u,h,_){switch(h.tag){case 3:sn(h),sl();break;case 5:mc(h);break;case 1:ui(h.type)&&oc(h);break;case 4:cf(h,h.stateNode.containerInfo);break;case 10:var A=h.type._context,I=h.memoizedProps.value;Gn(uc,A._currentValue),A._currentValue=I;break;case 13:if(A=h.memoizedState,A!==null)return A.dehydrated!==null?(Gn(Kn,Kn.current&1),h.flags|=128,null):(_&h.child.childLanes)!==0?Ea(u,h,_):(Gn(Kn,Kn.current&1),u=xc(u,h,_),u!==null?u.sibling:null);Gn(Kn,Kn.current&1);break;case 19:if(A=(_&h.childLanes)!==0,(u.flags&128)!==0){if(A)return aN(u,h,_);h.flags|=128}if(I=h.memoizedState,I!==null&&(I.rendering=null,I.tail=null,I.lastEffect=null),Gn(Kn,Kn.current),A)break;return null;case 22:case 23:return h.lanes=0,be(u,h,_)}return xc(u,h,_)}var lN,CM,cN,uN;lN=function(u,h){for(var _=h.child;_!==null;){if(_.tag===5||_.tag===6)u.appendChild(_.stateNode);else if(_.tag!==4&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===h)break;for(;_.sibling===null;){if(_.return===null||_.return===h)return;_=_.return}_.sibling.return=_.return,_=_.sibling}},CM=function(){},cN=function(u,h,_,A){var I=u.memoizedProps;if(I!==A){u=h.stateNode,xr(ms.current);var U=null;switch(_){case"input":I=Ge(u,I),A=Ge(u,A),U=[];break;case"select":I=q({},I,{value:void 0}),A=q({},A,{value:void 0}),U=[];break;case"textarea":I=Ee(u,I),A=Ee(u,A),U=[];break;default:typeof I.onClick!="function"&&typeof A.onClick=="function"&&(u.onclick=Zd)}ee(_,A);var G;_=null;for(De in I)if(!A.hasOwnProperty(De)&&I.hasOwnProperty(De)&&I[De]!=null)if(De==="style"){var se=I[De];for(G in se)se.hasOwnProperty(G)&&(_||(_={}),_[G]="")}else De!=="dangerouslySetInnerHTML"&&De!=="children"&&De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&De!=="autoFocus"&&(i.hasOwnProperty(De)?U||(U=[]):(U=U||[]).push(De,null));for(De in A){var pe=A[De];if(se=I!=null?I[De]:void 0,A.hasOwnProperty(De)&&pe!==se&&(pe!=null||se!=null))if(De==="style")if(se){for(G in se)!se.hasOwnProperty(G)||pe&&pe.hasOwnProperty(G)||(_||(_={}),_[G]="");for(G in pe)pe.hasOwnProperty(G)&&se[G]!==pe[G]&&(_||(_={}),_[G]=pe[G])}else _||(U||(U=[]),U.push(De,_)),_=pe;else De==="dangerouslySetInnerHTML"?(pe=pe?pe.__html:void 0,se=se?se.__html:void 0,pe!=null&&se!==pe&&(U=U||[]).push(De,pe)):De==="children"?typeof pe!="string"&&typeof pe!="number"||(U=U||[]).push(De,""+pe):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(i.hasOwnProperty(De)?(pe!=null&&De==="onScroll"&&Wn("scroll",u),U||se===pe||(U=[])):(U=U||[]).push(De,pe))}_&&(U=U||[]).push("style",_);var De=U;(h.updateQueue=De)&&(h.flags|=4)}},uN=function(u,h,_,A){_!==A&&(h.flags|=4)};function qv(u,h){if(!qn)switch(u.tailMode){case"hidden":h=u.tail;for(var _=null;h!==null;)h.alternate!==null&&(_=h),h=h.sibling;_===null?u.tail=null:_.sibling=null;break;case"collapsed":_=u.tail;for(var A=null;_!==null;)_.alternate!==null&&(A=_),_=_.sibling;A===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:A.sibling=null}}function Yi(u){var h=u.alternate!==null&&u.alternate.child===u.child,_=0,A=0;if(h)for(var I=u.child;I!==null;)_|=I.lanes|I.childLanes,A|=I.subtreeFlags&14680064,A|=I.flags&14680064,I.return=u,I=I.sibling;else for(I=u.child;I!==null;)_|=I.lanes|I.childLanes,A|=I.subtreeFlags,A|=I.flags,I.return=u,I=I.sibling;return u.subtreeFlags|=A,u.childLanes=_,h}function JG(u,h,_){var A=h.pendingProps;switch(ya(h),h.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Yi(h),null;case 1:return ui(h.type)&&Qd(),Yi(h),null;case 3:return A=h.stateNode,al(),$n(Pi),$n(Kr),Lo(),A.pendingContext&&(A.context=A.pendingContext,A.pendingContext=null),(u===null||u.child===null)&&(Ru(h)?h.flags|=4:u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,zs!==null&&(FM(zs),zs=null))),CM(u,h),Yi(h),null;case 5:Ou(h);var I=xr(_a.current);if(_=h.type,u!==null&&h.stateNode!=null)cN(u,h,_,A,I),u.ref!==h.ref&&(h.flags|=512,h.flags|=2097152);else{if(!A){if(h.stateNode===null)throw Error(n(166));return Yi(h),null}if(u=xr(ms.current),Ru(h)){A=h.stateNode,_=h.type;var U=h.memoizedProps;switch(A[Nr]=h,A[Pu]=U,u=(h.mode&1)!==0,_){case"dialog":Wn("cancel",A),Wn("close",A);break;case"iframe":case"object":case"embed":Wn("load",A);break;case"video":case"audio":for(I=0;I<\/script>",u=u.removeChild(u.firstChild)):typeof A.is=="string"?u=G.createElement(_,{is:A.is}):(u=G.createElement(_),_==="select"&&(G=u,A.multiple?G.multiple=!0:A.size&&(G.size=A.size))):u=G.createElementNS(u,_),u[Nr]=h,u[Pu]=A,lN(u,h,!1,!1),h.stateNode=u;e:{switch(G=Ae(_,A),_){case"dialog":Wn("cancel",u),Wn("close",u),I=A;break;case"iframe":case"object":case"embed":Wn("load",u),I=A;break;case"video":case"audio":for(I=0;IJp&&(h.flags|=128,A=!0,qv(U,!1),h.lanes=4194304)}else{if(!A)if(u=ao(G),u!==null){if(h.flags|=128,A=!0,_=u.updateQueue,_!==null&&(h.updateQueue=_,h.flags|=4),qv(U,!0),U.tail===null&&U.tailMode==="hidden"&&!G.alternate&&!qn)return Yi(h),null}else 2*st()-U.renderingStartTime>Jp&&_!==1073741824&&(h.flags|=128,A=!0,qv(U,!1),h.lanes=4194304);U.isBackwards?(G.sibling=h.child,h.child=G):(_=U.last,_!==null?_.sibling=G:h.child=G,U.last=G)}return U.tail!==null?(h=U.tail,U.rendering=h,U.tail=h.sibling,U.renderingStartTime=st(),h.sibling=null,_=Kn.current,Gn(Kn,A?_&1|2:_&1),h):(Yi(h),null);case 22:case 23:return BM(),A=h.memoizedState!==null,u!==null&&u.memoizedState!==null!==A&&(h.flags|=8192),A&&(h.mode&1)!==0?(uo&1073741824)!==0&&(Yi(h),h.subtreeFlags&6&&(h.flags|=8192)):Yi(h),null;case 24:return null;case 25:return null}throw Error(n(156,h.tag))}function eW(u,h){switch(ya(h),h.tag){case 1:return ui(h.type)&&Qd(),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return al(),$n(Pi),$n(Kr),Lo(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 5:return Ou(h),null;case 13:if($n(Kn),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(n(340));sl()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return $n(Kn),null;case 4:return al(),null;case 10:return of(h.type._context),null;case 22:case 23:return BM(),null;case 24:return null;default:return null}}var $x=!1,Zi=!1,tW=typeof WeakSet=="function"?WeakSet:Set,Et=null;function Zp(u,h){var _=u.ref;if(_!==null)if(typeof _=="function")try{_(null)}catch(A){_r(u,h,A)}else _.current=null}function PM(u,h,_){try{_()}catch(A){_r(u,h,A)}}var dN=!1;function nW(u,h){if(Cu=ks,u=nr(),Dr(u)){if("selectionStart"in u)var _={start:u.selectionStart,end:u.selectionEnd};else e:{_=(_=u.ownerDocument)&&_.defaultView||window;var A=_.getSelection&&_.getSelection();if(A&&A.rangeCount!==0){_=A.anchorNode;var I=A.anchorOffset,U=A.focusNode;A=A.focusOffset;try{_.nodeType,U.nodeType}catch{_=null;break e}var G=0,se=-1,pe=-1,De=0,Ze=0,Je=u,Ye=null;t:for(;;){for(var _t;Je!==_||I!==0&&Je.nodeType!==3||(se=G+I),Je!==U||A!==0&&Je.nodeType!==3||(pe=G+A),Je.nodeType===3&&(G+=Je.nodeValue.length),(_t=Je.firstChild)!==null;)Ye=Je,Je=_t;for(;;){if(Je===u)break t;if(Ye===_&&++De===I&&(se=G),Ye===U&&++Ze===A&&(pe=G),(_t=Je.nextSibling)!==null)break;Je=Ye,Ye=Je.parentNode}Je=_t}_=se===-1||pe===-1?null:{start:se,end:pe}}else _=null}_=_||{start:0,end:0}}else _=null;for(Sv={focusedElem:u,selectionRange:_},ks=!1,Et=h;Et!==null;)if(h=Et,u=h.child,(h.subtreeFlags&1028)!==0&&u!==null)u.return=h,Et=u;else for(;Et!==null;){h=Et;try{var Tt=h.alternate;if((h.flags&1024)!==0)switch(h.tag){case 0:case 11:case 15:break;case 1:if(Tt!==null){var Rt=Tt.memoizedProps,Ir=Tt.memoizedState,Pe=h.stateNode,ve=Pe.getSnapshotBeforeUpdate(h.elementType===h.type?Rt:Bs(h.type,Rt),Ir);Pe.__reactInternalSnapshotBeforeUpdate=ve}break;case 3:var Ne=h.stateNode.containerInfo;Ne.nodeType===1?Ne.textContent="":Ne.nodeType===9&&Ne.documentElement&&Ne.removeChild(Ne.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(it){_r(h,h.return,it)}if(u=h.sibling,u!==null){u.return=h.return,Et=u;break}Et=h.return}return Tt=dN,dN=!1,Tt}function Kv(u,h,_){var A=h.updateQueue;if(A=A!==null?A.lastEffect:null,A!==null){var I=A=A.next;do{if((I.tag&u)===u){var U=I.destroy;I.destroy=void 0,U!==void 0&&PM(h,_,U)}I=I.next}while(I!==A)}}function Xx(u,h){if(h=h.updateQueue,h=h!==null?h.lastEffect:null,h!==null){var _=h=h.next;do{if((_.tag&u)===u){var A=_.create;_.destroy=A()}_=_.next}while(_!==h)}}function RM(u){var h=u.ref;if(h!==null){var _=u.stateNode;switch(u.tag){case 5:u=_;break;default:u=_}typeof h=="function"?h(u):h.current=u}}function fN(u){var h=u.alternate;h!==null&&(u.alternate=null,fN(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&(delete h[Nr],delete h[Pu],delete h[ic],delete h[Op],delete h[Lp])),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 hN(u){return u.tag===5||u.tag===3||u.tag===4}function pN(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||hN(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 NM(u,h,_){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?_.nodeType===8?_.parentNode.insertBefore(u,h):_.insertBefore(u,h):(_.nodeType===8?(h=_.parentNode,h.insertBefore(u,_)):(h=_,h.appendChild(u)),_=_._reactRootContainer,_!=null||h.onclick!==null||(h.onclick=Zd));else if(A!==4&&(u=u.child,u!==null))for(NM(u,h,_),u=u.sibling;u!==null;)NM(u,h,_),u=u.sibling}function IM(u,h,_){var A=u.tag;if(A===5||A===6)u=u.stateNode,h?_.insertBefore(u,h):_.appendChild(u);else if(A!==4&&(u=u.child,u!==null))for(IM(u,h,_),u=u.sibling;u!==null;)IM(u,h,_),u=u.sibling}var ki=null,Aa=!1;function Uu(u,h,_){for(_=_.child;_!==null;)mN(u,h,_),_=_.sibling}function mN(u,h,_){if(Yt&&typeof Yt.onCommitFiberUnmount=="function")try{Yt.onCommitFiberUnmount(yn,_)}catch{}switch(_.tag){case 5:Zi||Zp(_,h);case 6:var A=ki,I=Aa;ki=null,Uu(u,h,_),ki=A,Aa=I,ki!==null&&(Aa?(u=ki,_=_.stateNode,u.nodeType===8?u.parentNode.removeChild(_):u.removeChild(_)):ki.removeChild(_.stateNode));break;case 18:ki!==null&&(Aa?(u=ki,_=_.stateNode,u.nodeType===8?kp(u.parentNode,_):u.nodeType===1&&kp(u,_),Fd(u)):kp(ki,_.stateNode));break;case 4:A=ki,I=Aa,ki=_.stateNode.containerInfo,Aa=!0,Uu(u,h,_),ki=A,Aa=I;break;case 0:case 11:case 14:case 15:if(!Zi&&(A=_.updateQueue,A!==null&&(A=A.lastEffect,A!==null))){I=A=A.next;do{var U=I,G=U.destroy;U=U.tag,G!==void 0&&((U&2)!==0||(U&4)!==0)&&PM(_,h,G),I=I.next}while(I!==A)}Uu(u,h,_);break;case 1:if(!Zi&&(Zp(_,h),A=_.stateNode,typeof A.componentWillUnmount=="function"))try{A.props=_.memoizedProps,A.state=_.memoizedState,A.componentWillUnmount()}catch(se){_r(_,h,se)}Uu(u,h,_);break;case 21:Uu(u,h,_);break;case 22:_.mode&1?(Zi=(A=Zi)||_.memoizedState!==null,Uu(u,h,_),Zi=A):Uu(u,h,_);break;default:Uu(u,h,_)}}function gN(u){var h=u.updateQueue;if(h!==null){u.updateQueue=null;var _=u.stateNode;_===null&&(_=u.stateNode=new tW),h.forEach(function(A){var I=dW.bind(null,u,A);_.has(A)||(_.add(A),A.then(I,I))})}}function Ta(u,h){var _=h.deletions;if(_!==null)for(var A=0;A<_.length;A++){var I=_[A];try{var U=u,G=h,se=G;e:for(;se!==null;){switch(se.tag){case 5:ki=se.stateNode,Aa=!1;break e;case 3:ki=se.stateNode.containerInfo,Aa=!0;break e;case 4:ki=se.stateNode.containerInfo,Aa=!0;break e}se=se.return}if(ki===null)throw Error(n(160));mN(U,G,I),ki=null,Aa=!1;var pe=I.alternate;pe!==null&&(pe.return=null),I.return=null}catch(De){_r(I,h,De)}}if(h.subtreeFlags&12854)for(h=h.child;h!==null;)vN(h,u),h=h.sibling}function vN(u,h){var _=u.alternate,A=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:if(Ta(h,u),cl(u),A&4){try{Kv(3,u,u.return),Xx(3,u)}catch(Rt){_r(u,u.return,Rt)}try{Kv(5,u,u.return)}catch(Rt){_r(u,u.return,Rt)}}break;case 1:Ta(h,u),cl(u),A&512&&_!==null&&Zp(_,_.return);break;case 5:if(Ta(h,u),cl(u),A&512&&_!==null&&Zp(_,_.return),u.flags&32){var I=u.stateNode;try{qe(I,"")}catch(Rt){_r(u,u.return,Rt)}}if(A&4&&(I=u.stateNode,I!=null)){var U=u.memoizedProps,G=_!==null?_.memoizedProps:U,se=u.type,pe=u.updateQueue;if(u.updateQueue=null,pe!==null)try{se==="input"&&U.type==="radio"&&U.name!=null&&We(I,U),Ae(se,G);var De=Ae(se,U);for(G=0;GI&&(I=G),A&=~U}if(A=I,A=st()-A,A=(120>A?120:480>A?480:1080>A?1080:1920>A?1920:3e3>A?3e3:4320>A?4320:1960*iW(A/1960))-A,10u?16:u,Fu===null)var A=!1;else{if(u=Fu,Fu=null,Qx=0,(On&6)!==0)throw Error(n(331));var I=On;for(On|=4,Et=u.current;Et!==null;){var U=Et,G=U.child;if((Et.flags&16)!==0){var se=U.deletions;if(se!==null){for(var pe=0;pest()-LM?xf(u,0):OM|=_),Vs(u,h)}function PN(u,h){h===0&&((u.mode&1)===0?h=1:(h=kn,kn<<=1,(kn&130023424)===0&&(kn=4194304)));var _=xs();u=oo(u,h),u!==null&&(Ya(u,h,_),Vs(u,_))}function uW(u){var h=u.memoizedState,_=0;h!==null&&(_=h.retryLane),PN(u,_)}function dW(u,h){var _=0;switch(u.tag){case 13:var A=u.stateNode,I=u.memoizedState;I!==null&&(_=I.retryLane);break;case 19:A=u.stateNode;break;default:throw Error(n(314))}A!==null&&A.delete(h),PN(u,_)}var RN;RN=function(u,h,_){if(u!==null)if(u.memoizedProps!==h.pendingProps||Pi.current)ln=!0;else{if((u.lanes&_)===0&&(h.flags&128)===0)return ln=!1,QG(u,h,_);ln=(u.flags&131072)!==0}else ln=!1,qn&&(h.flags&1048576)!==0&&Nv(h,Fp,h.index);switch(h.lanes=0,h.tag){case 2:var A=h.type;Wx(u,h),u=h.pendingProps;var I=sc(h,Kr.current);ol(h,_),I=df(null,h,A,u,I,_);var U=Fv();return h.flags|=1,typeof I=="object"&&I!==null&&typeof I.render=="function"&&I.$$typeof===void 0?(h.tag=1,h.memoizedState=null,h.updateQueue=null,ui(A)?(U=!0,oc(h)):U=!1,h.memoizedState=I.state!==null&&I.state!==void 0?I.state:null,an(h),I.updater=Yp,h.stateNode=I,I._reactInternals=h,M(h,A,u,_),h=on(null,h,A,!0,U,_)):(h.tag=0,qn&&U&&Iv(h),bt(null,h,I,_),h=h.child),h;case 16:A=h.elementType;e:{switch(Wx(u,h),u=h.pendingProps,I=A._init,A=I(A._payload),h.type=A,I=h.tag=hW(A),u=Bs(A,u),I){case 0:h=gt(null,h,A,u,_);break e;case 1:h=It(null,h,A,u,_);break e;case 11:h=Jr(null,h,A,u,_);break e;case 14:h=ys(null,h,A,Bs(A.type,u),_);break e}throw Error(n(306,A,""))}return h;case 0:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),gt(u,h,A,I,_);case 1:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),It(u,h,A,I,_);case 3:e:{if(sn(h),u===null)throw Error(n(387));A=h.pendingProps,U=h.memoizedState,I=U.element,mr(u,h),lr(h,A,null,_);var G=h.memoizedState;if(A=G.element,U.isDehydrated)if(U={element:A,isDehydrated:!1,cache:G.cache,pendingSuspenseBoundaries:G.pendingSuspenseBoundaries,transitions:G.transitions},h.updateQueue.baseState=U,h.memoizedState=U,h.flags&256){I=P(Error(n(423)),h),h=En(u,h,A,_,I);break e}else if(A!==I){I=P(Error(n(424)),h),h=En(u,h,A,_,I);break e}else for(Ni=ha(h.stateNode.containerInfo.firstChild),Yr=h,qn=!0,zs=null,_=sf(h,null,A,_),h.child=_;_;)_.flags=_.flags&-3|4096,_=_.sibling;else{if(sl(),A===I){h=xc(u,h,_);break e}bt(u,h,A,_)}h=h.child}return h;case 5:return mc(h),u===null&&Bp(h),A=h.type,I=h.pendingProps,U=u!==null?u.memoizedProps:null,G=I.children,Mv(A,I)?G=null:U!==null&&Mv(A,U)&&(h.flags|=32),je(u,h),bt(u,h,G,_),h.child;case 6:return u===null&&Bp(h),null;case 13:return Ea(u,h,_);case 4:return cf(h,h.stateNode.containerInfo),A=h.pendingProps,u===null?h.child=cc(h,null,A,_):bt(u,h,A,_),h.child;case 11:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Jr(u,h,A,I,_);case 7:return bt(u,h,h.pendingProps,_),h.child;case 8:return bt(u,h,h.pendingProps.children,_),h.child;case 12:return bt(u,h,h.pendingProps.children,_),h.child;case 10:e:{if(A=h.type._context,I=h.pendingProps,U=h.memoizedProps,G=I.value,Gn(uc,A._currentValue),A._currentValue=G,U!==null)if(ds(U.value,G)){if(U.children===I.children&&!Pi.current){h=xc(u,h,_);break e}}else for(U=h.child,U!==null&&(U.return=h);U!==null;){var se=U.dependencies;if(se!==null){G=U.child;for(var pe=se.firstContext;pe!==null;){if(pe.context===A){if(U.tag===1){pe=zn(-1,_&-_),pe.tag=2;var De=U.updateQueue;if(De!==null){De=De.shared;var Ze=De.pending;Ze===null?pe.next=pe:(pe.next=Ze.next,Ze.next=pe),De.pending=pe}}U.lanes|=_,pe=U.alternate,pe!==null&&(pe.lanes|=_),af(U.return,_,h),se.lanes|=_;break}pe=pe.next}}else if(U.tag===10)G=U.type===h.type?null:U.child;else if(U.tag===18){if(G=U.return,G===null)throw Error(n(341));G.lanes|=_,se=G.alternate,se!==null&&(se.lanes|=_),af(G,_,h),G=U.sibling}else G=U.child;if(G!==null)G.return=U;else for(G=U;G!==null;){if(G===h){G=null;break}if(U=G.sibling,U!==null){U.return=G.return,G=U;break}G=G.return}U=G}bt(u,h,I.children,_),h=h.child}return h;case 9:return I=h.type,A=h.pendingProps.children,ol(h,_),I=ps(I),A=A(I),h.flags|=1,bt(u,h,A,_),h.child;case 14:return A=h.type,I=Bs(A,h.pendingProps),I=Bs(A.type,I),ys(u,h,A,I,_);case 15:return Ie(u,h,h.type,h.pendingProps,_);case 17:return A=h.type,I=h.pendingProps,I=h.elementType===A?I:Bs(A,I),Wx(u,h),h.tag=1,ui(A)?(u=!0,oc(h)):u=!1,ol(h,_),p(h,A,I),M(h,A,I,_),on(null,h,A,!0,u,_);case 19:return aN(u,h,_);case 22:return be(u,h,_)}throw Error(n(156,h.tag))};function NN(u,h){return ke(u,h)}function fW(u,h,_,A){this.tag=u,this.key=_,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=A,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function jo(u,h,_,A){return new fW(u,h,_,A)}function VM(u){return u=u.prototype,!(!u||!u.isReactComponent)}function hW(u){if(typeof u=="function")return VM(u)?1:0;if(u!=null){if(u=u.$$typeof,u===H)return 11;if(u===de)return 14}return 2}function Hu(u,h){var _=u.alternate;return _===null?(_=jo(u.tag,h,u.key,u.mode),_.elementType=u.elementType,_.type=u.type,_.stateNode=u.stateNode,_.alternate=u,u.alternate=_):(_.pendingProps=h,_.type=u.type,_.flags=0,_.subtreeFlags=0,_.deletions=null),_.flags=u.flags&14680064,_.childLanes=u.childLanes,_.lanes=u.lanes,_.child=u.child,_.memoizedProps=u.memoizedProps,_.memoizedState=u.memoizedState,_.updateQueue=u.updateQueue,h=u.dependencies,_.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},_.sibling=u.sibling,_.index=u.index,_.ref=u.ref,_}function nb(u,h,_,A,I,U){var G=2;if(A=u,typeof u=="function")VM(u)&&(G=1);else if(typeof u=="string")G=5;else e:switch(u){case D:return _f(_.children,I,U,h);case F:G=8,I|=8;break;case V:return u=jo(12,_,h,I|2),u.elementType=V,u.lanes=U,u;case ne:return u=jo(13,_,h,I),u.elementType=ne,u.lanes=U,u;case J:return u=jo(19,_,h,I),u.elementType=J,u.lanes=U,u;case he:return rb(_,I,U,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case k:G=10;break e;case j:G=9;break e;case H:G=11;break e;case de:G=14;break e;case oe:G=16,A=null;break e}throw Error(n(130,u==null?u:typeof u,""))}return h=jo(G,_,h,I),h.elementType=u,h.type=A,h.lanes=U,h}function _f(u,h,_,A){return u=jo(7,u,A,h),u.lanes=_,u}function rb(u,h,_,A){return u=jo(22,u,A,h),u.elementType=he,u.lanes=_,u.stateNode={isHidden:!1},u}function GM(u,h,_){return u=jo(6,u,null,h),u.lanes=_,u}function WM(u,h,_){return h=jo(4,u.children!==null?u.children:[],u.key,h),h.lanes=_,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function pW(u,h,_,A,I){this.tag=h,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Ld(0),this.expirationTimes=Ld(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ld(0),this.identifierPrefix=A,this.onRecoverableError=I,this.mutableSourceEagerHydrationData=null}function $M(u,h,_,A,I,U,G,se,pe){return u=new pW(u,h,_,se,pe),h===1?(h=1,U===!0&&(h|=8)):h=0,U=jo(3,null,null,h),u.current=U,U.stateNode=u,U.memoizedState={element:A,isDehydrated:_,cache:null,transitions:null,pendingSuspenseBoundaries:null},an(U),u}function mW(u,h,_){var A=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),JM.exports=PW(),JM.exports}var $N;function RW(){if($N)return db;$N=1;var t=Vj();return db.createRoot=t.createRoot,db.hydrateRoot=t.hydrateRoot,db}var NW=RW();const IW=B1(NW);var V0=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(){}},uh,dd,ig,Ij,kW=(Ij=class extends V0{constructor(){super();Wt(this,uh);Wt(this,dd);Wt(this,ig);wt(this,ig,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){me(this,dd)||this.setEventListener(me(this,ig))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,dd))==null||e.call(this),wt(this,dd,void 0))}setEventListener(e){var n;wt(this,ig,e),(n=me(this,dd))==null||n.call(this),wt(this,dd,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){me(this,uh)!==e&&(wt(this,uh,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof me(this,uh)=="boolean"?me(this,uh):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},uh=new WeakMap,dd=new WeakMap,ig=new WeakMap,Ij),pP=new kW,OW={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},fd,hP,kj,LW=(kj=class{constructor(){Wt(this,fd,OW);Wt(this,hP,!1)}setTimeoutProvider(t){wt(this,fd,t)}setTimeout(t,e){return me(this,fd).setTimeout(t,e)}clearTimeout(t){me(this,fd).clearTimeout(t)}setInterval(t,e){return me(this,fd).setInterval(t,e)}clearInterval(t){me(this,fd).clearInterval(t)}},fd=new WeakMap,hP=new WeakMap,kj),Qf=new LW;function DW(t){setTimeout(t,0)}var UW=typeof window>"u"||"Deno"in globalThis;function Xs(){}function jW(t,e){return typeof t=="function"?t(e):t}function hT(t){return typeof t=="number"&&t>=0&&t!==1/0}function Gj(t,e){return Math.max(t+(e||0)-Date.now(),0)}function bd(t,e){return typeof t=="function"?t(e):t}function vo(t,e){return typeof t=="function"?t(e):t}function XN(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:o,stale:a}=t;if(o){if(r){if(e.queryHash!==mP(o,e.options))return!1}else if(!n0(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||i&&i!==e.state.fetchStatus||s&&!s(e))}function qN(t,e){const{exact:n,status:r,predicate:i,mutationKey:s}=t;if(s){if(!e.options.mutationKey)return!1;if(n){if(t0(e.options.mutationKey)!==t0(s))return!1}else if(!n0(e.options.mutationKey,s))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function mP(t,e){return((e==null?void 0:e.queryKeyHashFn)||t0)(t)}function t0(t){return JSON.stringify(t,(e,n)=>mT(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function n0(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>n0(t[n],e[n])):!1}var FW=Object.prototype.hasOwnProperty;function Wj(t,e,n=0){if(t===e)return t;if(n>500)return e;const r=KN(t)&&KN(e);if(!r&&!(mT(t)&&mT(e)))return e;const s=(r?t:Object.keys(t)).length,o=r?e:Object.keys(e),a=o.length,l=r?new Array(a):{};let c=0;for(let d=0;d{Qf.setTimeout(e,t)})}function gT(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?Wj(t,e):e}function BW(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function HW(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var gP=Symbol();function $j(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===gP?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Xj(t,e){return typeof t=="function"?t(...e):!!t}function VW(t,e,n){let r=!1,i;return Object.defineProperty(t,"signal",{enumerable:!0,get:()=>(i??(i=e()),r||(r=!0,i.aborted?n():i.addEventListener("abort",n,{once:!0})),i)}),t}var r0=(()=>{let t=()=>UW;return{isServer(){return t()},setIsServer(e){t=e}}})();function vT(){let t,e;const n=new Promise((i,s)=>{t=i,e=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}var GW=DW;function WW(){let t=[],e=0,n=a=>{a()},r=a=>{a()},i=GW;const s=a=>{e?t.push(a):i(()=>{n(a)})},o=()=>{const a=t;t=[],a.length&&i(()=>{r(()=>{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=>{r=a},setScheduler:a=>{i=a}}}var Fi=WW(),sg,hd,og,Oj,$W=(Oj=class extends V0{constructor(){super();Wt(this,sg,!0);Wt(this,hd);Wt(this,og);wt(this,og,e=>{if(typeof window<"u"&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){me(this,hd)||this.setEventListener(me(this,og))}onUnsubscribe(){var e;this.hasListeners()||((e=me(this,hd))==null||e.call(this),wt(this,hd,void 0))}setEventListener(e){var n;wt(this,og,e),(n=me(this,hd))==null||n.call(this),wt(this,hd,e(this.setOnline.bind(this)))}setOnline(e){me(this,sg)!==e&&(wt(this,sg,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return me(this,sg)}},sg=new WeakMap,hd=new WeakMap,og=new WeakMap,Oj),J_=new $W;function XW(t){return Math.min(1e3*2**t,3e4)}function qj(t){return(t??"online")==="online"?J_.isOnline():!0}var yT=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function Kj(t){let e=!1,n=0,r;const i=vT(),s=()=>i.status!=="pending",o=S=>{var w;if(!s()){const b=new yT(S);m(b),(w=t.onCancel)==null||w.call(t,b)}},a=()=>{e=!0},l=()=>{e=!1},c=()=>pP.isFocused()&&(t.networkMode==="always"||J_.isOnline())&&t.canRun(),d=()=>qj(t.networkMode)&&t.canRun(),f=S=>{s()||(r==null||r(),i.resolve(S))},m=S=>{s()||(r==null||r(),i.reject(S))},y=()=>new Promise(S=>{var w;r=b=>{(s()||c())&&S(b)},(w=t.onPause)==null||w.call(t)}).then(()=>{var S;r=void 0,s()||(S=t.onContinue)==null||S.call(t)}),x=()=>{if(s())return;let S;const w=n===0?t.initialPromise:void 0;try{S=w??t.fn()}catch(b){S=Promise.reject(b)}Promise.resolve(S).then(f).catch(b=>{var N;if(s())return;const E=t.retry??(r0.isServer()?0:3),T=t.retryDelay??XW,C=typeof T=="function"?T(n,b):T,O=E===!0||typeof E=="number"&&nc()?void 0:y()).then(()=>{e?m(b):x()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r==null||r(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?x():y().then(x),i)}}var dh,Lj,Yj=(Lj=class{constructor(){Wt(this,dh)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),hT(this.gcTime)&&wt(this,dh,Qf.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(r0.isServer()?1/0:300*1e3))}clearGcTimeout(){me(this,dh)!==void 0&&(Qf.clearTimeout(me(this,dh)),wt(this,dh,void 0))}},dh=new WeakMap,Lj);function qW(t){return{onFetch:(e,n)=>{var d,f,m,y,x;const r=e.options,i=(m=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:m.direction,s=((y=e.state.data)==null?void 0:y.pages)||[],o=((x=e.state.data)==null?void 0:x.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let S=!1;const w=T=>{VW(T,()=>e.signal,()=>S=!0)},b=$j(e.options,e.fetchOptions),E=async(T,C,O)=>{if(S)return Promise.reject(e.signal.reason);if(C==null&&T.pages.length)return Promise.resolve(T);const D=(()=>{const j={client:e.client,queryKey:e.queryKey,pageParam:C,direction:O?"backward":"forward",meta:e.options.meta};return w(j),j})(),F=await b(D),{maxPages:V}=e.options,k=O?HW:BW;return{pages:k(T.pages,F,V),pageParams:k(T.pageParams,C,V)}};if(i&&s.length){const T=i==="backward",C=T?KW:ZN,O={pages:s,pageParams:o},N=C(r,O);a=await E(O,N,T)}else{const T=t??s.length;do{const C=l===0?o[0]??r.initialPageParam:ZN(r,a);if(l>0&&C==null)break;a=await E(a,C),l++}while(l{var S,w;return(w=(S=e.options).persister)==null?void 0:w.call(S,c,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=c}}}function ZN(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function KW(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var ag,fh,lg,Go,hh,gi,j0,ph,go,Zj,Cc,Dj,YW=(Dj=class extends Yj{constructor(e){super();Wt(this,go);Wt(this,ag);Wt(this,fh);Wt(this,lg);Wt(this,Go);Wt(this,hh);Wt(this,gi);Wt(this,j0);Wt(this,ph);wt(this,ph,!1),wt(this,j0,e.defaultOptions),this.setOptions(e.options),this.observers=[],wt(this,hh,e.client),wt(this,Go,me(this,hh).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,wt(this,fh,JN(this.options)),this.state=e.state??me(this,fh),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return me(this,ag)}get promise(){var e;return(e=me(this,gi))==null?void 0:e.promise}setOptions(e){if(this.options={...me(this,j0),...e},e!=null&&e._type&&wt(this,ag,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const n=JN(this.options);n.data!==void 0&&(this.setState(QN(n.data,n.dataUpdatedAt)),wt(this,fh,n))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&me(this,Go).remove(this)}setData(e,n){const r=gT(this.state.data,e,this.options);return _n(this,go,Cc).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e){_n(this,go,Cc).call(this,{type:"setState",state:e})}cancel(e){var r,i;const n=(r=me(this,gi))==null?void 0:r.promise;return(i=me(this,gi))==null||i.cancel(e),n?n.then(Xs).catch(Xs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return me(this,fh)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>vo(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===gP||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>bd(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Gj(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=me(this,gi))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=me(this,gi))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),me(this,Go).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(me(this,gi)&&(me(this,ph)||_n(this,go,Zj).call(this)?me(this,gi).cancel({revert:!0}):me(this,gi).cancelRetry()),this.scheduleGc()),me(this,Go).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||_n(this,go,Cc).call(this,{type:"invalidate"})}async fetch(e,n){var c,d,f,m,y,x,S,w,b,E,T;if(this.state.fetchStatus!=="idle"&&((c=me(this,gi))==null?void 0:c.status())!=="rejected"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(me(this,gi))return me(this,gi).continueRetry(),me(this,gi).promise}if(e&&this.setOptions(e),!this.options.queryFn){const C=this.observers.find(O=>O.options.queryFn);C&&this.setOptions(C.options)}const r=new AbortController,i=C=>{Object.defineProperty(C,"signal",{enumerable:!0,get:()=>(wt(this,ph,!0),r.signal)})},s=()=>{const C=$j(this.options,n),N=(()=>{const D={client:me(this,hh),queryKey:this.queryKey,meta:this.meta};return i(D),D})();return wt(this,ph,!1),this.options.persister?this.options.persister(C,N,this):C(N)},a=(()=>{const C={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:me(this,hh),state:this.state,fetchFn:s};return i(C),C})(),l=me(this,ag)==="infinite"?qW(this.options.pages):this.options.behavior;l==null||l.onFetch(a,this),wt(this,lg,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=a.fetchOptions)==null?void 0:d.meta))&&_n(this,go,Cc).call(this,{type:"fetch",meta:(f=a.fetchOptions)==null?void 0:f.meta}),wt(this,gi,Kj({initialPromise:n==null?void 0:n.initialPromise,fn:a.fetchFn,onCancel:C=>{C instanceof yT&&C.revert&&this.setState({...me(this,lg),fetchStatus:"idle"}),r.abort()},onFail:(C,O)=>{_n(this,go,Cc).call(this,{type:"failed",failureCount:C,error:O})},onPause:()=>{_n(this,go,Cc).call(this,{type:"pause"})},onContinue:()=>{_n(this,go,Cc).call(this,{type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0}));try{const C=await me(this,gi).start();if(C===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(C),(y=(m=me(this,Go).config).onSuccess)==null||y.call(m,C,this),(S=(x=me(this,Go).config).onSettled)==null||S.call(x,C,this.state.error,this),C}catch(C){if(C instanceof yT){if(C.silent)return me(this,gi).promise;if(C.revert){if(this.state.data===void 0)throw C;return this.state.data}}throw _n(this,go,Cc).call(this,{type:"error",error:C}),(b=(w=me(this,Go).config).onError)==null||b.call(w,C,this),(T=(E=me(this,Go).config).onSettled)==null||T.call(E,this.state.data,C,this),C}finally{this.scheduleGc()}}},ag=new WeakMap,fh=new WeakMap,lg=new WeakMap,Go=new WeakMap,hh=new WeakMap,gi=new WeakMap,j0=new WeakMap,ph=new WeakMap,go=new WeakSet,Zj=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Cc=function(e){const n=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,...Qj(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...QN(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return wt(this,lg,e.manual?i:void 0),i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Fi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),me(this,Go).notify({query:this,type:"updated",action:e})})},Dj);function Qj(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qj(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function QN(t,e){return{data:t,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function JN(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var $s,An,F0,ws,mh,cg,Ic,pd,z0,ug,dg,gh,vh,md,fg,Bn,Ly,xT,bT,_T,wT,ST,MT,ET,Jj,Uj,ZW=(Uj=class extends V0{constructor(e,n){super();Wt(this,Bn);Wt(this,$s);Wt(this,An);Wt(this,F0);Wt(this,ws);Wt(this,mh);Wt(this,cg);Wt(this,Ic);Wt(this,pd);Wt(this,z0);Wt(this,ug);Wt(this,dg);Wt(this,gh);Wt(this,vh);Wt(this,md);Wt(this,fg,new Set);this.options=n,wt(this,$s,e),wt(this,pd,null),wt(this,Ic,vT()),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(me(this,An).addObserver(this),eI(me(this,An),this.options)?_n(this,Bn,Ly).call(this):this.updateResult(),_n(this,Bn,wT).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return AT(me(this,An),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return AT(me(this,An),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,_n(this,Bn,ST).call(this),_n(this,Bn,MT).call(this),me(this,An).removeObserver(this)}setOptions(e){const n=this.options,r=me(this,An);if(this.options=me(this,$s).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vo(this.options.enabled,me(this,An))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");_n(this,Bn,ET).call(this),me(this,An).setOptions(this.options),n._defaulted&&!pT(this.options,n)&&me(this,$s).getQueryCache().notify({type:"observerOptionsUpdated",query:me(this,An),observer:this});const i=this.hasListeners();i&&tI(me(this,An),r,this.options,n)&&_n(this,Bn,Ly).call(this),this.updateResult(),i&&(me(this,An)!==r||vo(this.options.enabled,me(this,An))!==vo(n.enabled,me(this,An))||bd(this.options.staleTime,me(this,An))!==bd(n.staleTime,me(this,An)))&&_n(this,Bn,xT).call(this);const s=_n(this,Bn,bT).call(this);i&&(me(this,An)!==r||vo(this.options.enabled,me(this,An))!==vo(n.enabled,me(this,An))||s!==me(this,md))&&_n(this,Bn,_T).call(this,s)}getOptimisticResult(e){const n=me(this,$s).getQueryCache().build(me(this,$s),e),r=this.createResult(n,e);return JW(this,r)&&(wt(this,ws,r),wt(this,cg,this.options),wt(this,mh,me(this,An).state)),r}getCurrentResult(){return me(this,ws)}trackResult(e,n){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),n==null||n(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&me(this,Ic).status==="pending"&&me(this,Ic).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){me(this,fg).add(e)}getCurrentQuery(){return me(this,An)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=me(this,$s).defaultQueryOptions(e),r=me(this,$s).getQueryCache().build(me(this,$s),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return _n(this,Bn,Ly).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),me(this,ws)))}createResult(e,n){var V;const r=me(this,An),i=this.options,s=me(this,ws),o=me(this,mh),a=me(this,cg),c=e!==r?e.state:me(this,F0),{state:d}=e;let f={...d},m=!1,y;if(n._optimisticResults){const k=this.hasListeners(),j=!k&&eI(e,n),H=k&&tI(e,r,n,i);(j||H)&&(f={...f,...Qj(d.data,e.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:x,errorUpdatedAt:S,status:w}=f;y=f.data;let b=!1;if(n.placeholderData!==void 0&&y===void 0&&w==="pending"){let k;s!=null&&s.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData)?(k=s.data,b=!0):k=typeof n.placeholderData=="function"?n.placeholderData((V=me(this,dg))==null?void 0:V.state.data,me(this,dg)):n.placeholderData,k!==void 0&&(w="success",y=gT(s==null?void 0:s.data,k,n),m=!0)}if(n.select&&y!==void 0&&!b)if(s&&y===(o==null?void 0:o.data)&&n.select===me(this,z0))y=me(this,ug);else try{wt(this,z0,n.select),y=n.select(y),y=gT(s==null?void 0:s.data,y,n),wt(this,ug,y),wt(this,pd,null)}catch(k){wt(this,pd,k)}me(this,pd)&&(x=me(this,pd),y=me(this,ug),S=Date.now(),w="error");const E=f.fetchStatus==="fetching",T=w==="pending",C=w==="error",O=T&&E,N=y!==void 0,F={status:w,fetchStatus:f.fetchStatus,isPending:T,isSuccess:w==="success",isError:C,isInitialLoading:O,isLoading:O,data:y,dataUpdatedAt:f.dataUpdatedAt,error:x,errorUpdatedAt:S,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>c.dataUpdateCount||f.errorUpdateCount>c.errorUpdateCount,isFetching:E,isRefetching:E&&!T,isLoadingError:C&&!N,isPaused:f.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:C&&N,isStale:vP(e,n),refetch:this.refetch,promise:me(this,Ic),isEnabled:vo(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=F.data!==void 0,j=F.status==="error"&&!k,H=de=>{j?de.reject(F.error):k&&de.resolve(F.data)},ne=()=>{const de=wt(this,Ic,F.promise=vT());H(de)},J=me(this,Ic);switch(J.status){case"pending":e.queryHash===r.queryHash&&H(J);break;case"fulfilled":(j||F.data!==J.value)&&ne();break;case"rejected":(!j||F.error!==J.reason)&&ne();break}}return F}updateResult(){const e=me(this,ws),n=this.createResult(me(this,An),this.options);if(wt(this,mh,me(this,An).state),wt(this,cg,this.options),me(this,mh).data!==void 0&&wt(this,dg,me(this,An)),pT(n,e))return;wt(this,ws,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!me(this,fg).size)return!0;const o=new Set(s??me(this,fg));return this.options.throwOnError&&o.add("error"),Object.keys(me(this,ws)).some(a=>{const l=a;return me(this,ws)[l]!==e[l]&&o.has(l)})};_n(this,Bn,Jj).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&_n(this,Bn,wT).call(this)}},$s=new WeakMap,An=new WeakMap,F0=new WeakMap,ws=new WeakMap,mh=new WeakMap,cg=new WeakMap,Ic=new WeakMap,pd=new WeakMap,z0=new WeakMap,ug=new WeakMap,dg=new WeakMap,gh=new WeakMap,vh=new WeakMap,md=new WeakMap,fg=new WeakMap,Bn=new WeakSet,Ly=function(e){_n(this,Bn,ET).call(this);let n=me(this,An).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Xs)),n},xT=function(){_n(this,Bn,ST).call(this);const e=bd(this.options.staleTime,me(this,An));if(r0.isServer()||me(this,ws).isStale||!hT(e))return;const r=Gj(me(this,ws).dataUpdatedAt,e)+1;wt(this,gh,Qf.setTimeout(()=>{me(this,ws).isStale||this.updateResult()},r))},bT=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(me(this,An)):this.options.refetchInterval)??!1},_T=function(e){_n(this,Bn,MT).call(this),wt(this,md,e),!(r0.isServer()||vo(this.options.enabled,me(this,An))===!1||!hT(me(this,md))||me(this,md)===0)&&wt(this,vh,Qf.setInterval(()=>{(this.options.refetchIntervalInBackground||pP.isFocused())&&_n(this,Bn,Ly).call(this)},me(this,md)))},wT=function(){_n(this,Bn,xT).call(this),_n(this,Bn,_T).call(this,_n(this,Bn,bT).call(this))},ST=function(){me(this,gh)!==void 0&&(Qf.clearTimeout(me(this,gh)),wt(this,gh,void 0))},MT=function(){me(this,vh)!==void 0&&(Qf.clearInterval(me(this,vh)),wt(this,vh,void 0))},ET=function(){const e=me(this,$s).getQueryCache().build(me(this,$s),this.options);if(e===me(this,An))return;const n=me(this,An);wt(this,An,e),wt(this,F0,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},Jj=function(e){Fi.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(me(this,ws))}),me(this,$s).getQueryCache().notify({query:me(this,An),type:"observerResultsUpdated"})})},Uj);function QW(t,e){return vo(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&vo(e.retryOnMount,t)===!1)}function eI(t,e){return QW(t,e)||t.state.data!==void 0&&AT(t,e,e.refetchOnMount)}function AT(t,e,n){if(vo(e.enabled,t)!==!1&&bd(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&vP(t,e)}return!1}function tI(t,e,n,r){return(t!==e||vo(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&vP(t,n)}function vP(t,e){return vo(e.enabled,t)!==!1&&t.isStaleByTime(bd(e.staleTime,t))}function JW(t,e){return!pT(t.getCurrentResult(),e)}var B0,yl,ts,yh,xl,sd,jj,e8=(jj=class extends Yj{constructor(e){super();Wt(this,xl);Wt(this,B0);Wt(this,yl);Wt(this,ts);Wt(this,yh);wt(this,B0,e.client),this.mutationId=e.mutationId,wt(this,ts,e.mutationCache),wt(this,yl,[]),this.state=e.state||t8(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){me(this,yl).includes(e)||(me(this,yl).push(e),this.clearGcTimeout(),me(this,ts).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){wt(this,yl,me(this,yl).filter(n=>n!==e)),this.scheduleGc(),me(this,ts).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){me(this,yl).length||(this.state.status==="pending"?this.scheduleGc():me(this,ts).remove(this))}continue(){var e;return((e=me(this,yh))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,a,l,c,d,f,m,y,x,S,w,b,E,T,C,O,N,D;const n=()=>{_n(this,xl,sd).call(this,{type:"continue"})},r={client:me(this,B0),meta:this.options.meta,mutationKey:this.options.mutationKey};wt(this,yh,Kj({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(F,V)=>{_n(this,xl,sd).call(this,{type:"failed",failureCount:F,error:V})},onPause:()=>{_n(this,xl,sd).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>me(this,ts).canRun(this)}));const i=this.state.status==="pending",s=!me(this,yh).canStart();try{if(i)n();else{_n(this,xl,sd).call(this,{type:"pending",variables:e,isPaused:s}),me(this,ts).config.onMutate&&await me(this,ts).config.onMutate(e,this,r);const V=await((a=(o=this.options).onMutate)==null?void 0:a.call(o,e,r));V!==this.state.context&&_n(this,xl,sd).call(this,{type:"pending",context:V,variables:e,isPaused:s})}const F=await me(this,yh).start();return await((c=(l=me(this,ts).config).onSuccess)==null?void 0:c.call(l,F,e,this.state.context,this,r)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,F,e,this.state.context,r)),await((y=(m=me(this,ts).config).onSettled)==null?void 0:y.call(m,F,null,this.state.variables,this.state.context,this,r)),await((S=(x=this.options).onSettled)==null?void 0:S.call(x,F,null,e,this.state.context,r)),_n(this,xl,sd).call(this,{type:"success",data:F}),F}catch(F){try{await((b=(w=me(this,ts).config).onError)==null?void 0:b.call(w,F,e,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((T=(E=this.options).onError)==null?void 0:T.call(E,F,e,this.state.context,r))}catch(V){Promise.reject(V)}try{await((O=(C=me(this,ts).config).onSettled)==null?void 0:O.call(C,void 0,F,this.state.variables,this.state.context,this,r))}catch(V){Promise.reject(V)}try{await((D=(N=this.options).onSettled)==null?void 0:D.call(N,void 0,F,e,this.state.context,r))}catch(V){Promise.reject(V)}throw _n(this,xl,sd).call(this,{type:"error",error:F}),F}finally{me(this,ts).runNext(this)}}},B0=new WeakMap,yl=new WeakMap,ts=new WeakMap,yh=new WeakMap,xl=new WeakSet,sd=function(e){const n=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=n(this.state),Fi.batch(()=>{me(this,yl).forEach(r=>{r.onMutationUpdate(e)}),me(this,ts).notify({mutation:this,type:"updated",action:e})})},jj);function t8(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var kc,Oa,H0,Fj,n8=(Fj=class extends V0{constructor(e={}){super();Wt(this,kc);Wt(this,Oa);Wt(this,H0);this.config=e,wt(this,kc,new Set),wt(this,Oa,new Map),wt(this,H0,0)}build(e,n,r){const i=new e8({client:e,mutationCache:this,mutationId:++ub(this,H0)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){me(this,kc).add(e);const n=fb(e);if(typeof n=="string"){const r=me(this,Oa).get(n);r?r.push(e):me(this,Oa).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(me(this,kc).delete(e)){const n=fb(e);if(typeof n=="string"){const r=me(this,Oa).get(n);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&me(this,Oa).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=fb(e);if(typeof n=="string"){const r=me(this,Oa).get(n),i=r==null?void 0:r.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){var r;const n=fb(e);if(typeof n=="string"){const i=(r=me(this,Oa).get(n))==null?void 0:r.find(s=>s!==e&&s.state.isPaused);return(i==null?void 0:i.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Fi.batch(()=>{me(this,kc).forEach(e=>{this.notify({type:"removed",mutation:e})}),me(this,kc).clear(),me(this,Oa).clear()})}getAll(){return Array.from(me(this,kc))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>qN(n,r))}findAll(e={}){return this.getAll().filter(n=>qN(e,n))}notify(e){Fi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Fi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Xs))))}},kc=new WeakMap,Oa=new WeakMap,H0=new WeakMap,Fj);function fb(t){var e;return(e=t.options.scope)==null?void 0:e.id}var bl,zj,r8=(zj=class extends V0{constructor(e={}){super();Wt(this,bl);this.config=e,wt(this,bl,new Map)}build(e,n,r){const i=n.queryKey,s=n.queryHash??mP(i,n);let o=this.get(s);return o||(o=new YW({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){me(this,bl).has(e.queryHash)||(me(this,bl).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=me(this,bl).get(e.queryHash);n&&(e.destroy(),n===e&&me(this,bl).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Fi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return me(this,bl).get(e)}getAll(){return[...me(this,bl).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>XN(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>XN(e,r)):n}notify(e){Fi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Fi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Fi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bl=new WeakMap,zj),Sr,gd,vd,hg,pg,yd,mg,gg,Bj,i8=(Bj=class{constructor(t={}){Wt(this,Sr);Wt(this,gd);Wt(this,vd);Wt(this,hg);Wt(this,pg);Wt(this,yd);Wt(this,mg);Wt(this,gg);wt(this,Sr,t.queryCache||new r8),wt(this,gd,t.mutationCache||new n8),wt(this,vd,t.defaultOptions||{}),wt(this,hg,new Map),wt(this,pg,new Map),wt(this,yd,0)}mount(){ub(this,yd)._++,me(this,yd)===1&&(wt(this,mg,pP.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onFocus())})),wt(this,gg,J_.subscribe(async t=>{t&&(await this.resumePausedMutations(),me(this,Sr).onOnline())})))}unmount(){var t,e;ub(this,yd)._--,me(this,yd)===0&&((t=me(this,mg))==null||t.call(this),wt(this,mg,void 0),(e=me(this,gg))==null||e.call(this),wt(this,gg,void 0))}isFetching(t){return me(this,Sr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return me(this,gd).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=me(this,Sr).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=me(this,Sr).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(bd(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return me(this,Sr).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=me(this,Sr).get(r.queryHash),s=i==null?void 0:i.state.data,o=jW(e,s);if(o!==void 0)return me(this,Sr).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Fi.batch(()=>me(this,Sr).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=me(this,Sr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=me(this,Sr);Fi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=me(this,Sr);return Fi.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Fi.batch(()=>me(this,Sr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Xs).catch(Xs)}invalidateQueries(t,e={}){return Fi.batch(()=>(me(this,Sr).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Fi.batch(()=>me(this,Sr).findAll(t).filter(i=>!i.isDisabled()&&!i.isStatic()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(Xs)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(Xs)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=me(this,Sr).build(this,e);return n.isStaleByTime(bd(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Xs).catch(Xs)}fetchInfiniteQuery(t){return t._type="infinite",this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Xs).catch(Xs)}ensureInfiniteQueryData(t){return t._type="infinite",this.ensureQueryData(t)}resumePausedMutations(){return J_.isOnline()?me(this,gd).resumePausedMutations():Promise.resolve()}getQueryCache(){return me(this,Sr)}getMutationCache(){return me(this,gd)}getDefaultOptions(){return me(this,vd)}setDefaultOptions(t){wt(this,vd,t)}setQueryDefaults(t,e){me(this,hg).set(t0(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...me(this,hg).values()],n={};return e.forEach(r=>{n0(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){me(this,pg).set(t0(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...me(this,pg).values()],n={};return e.forEach(r=>{n0(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...me(this,vd).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=mP(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.queryFn===gP&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...me(this,vd).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){me(this,Sr).clear(),me(this,gd).clear()}},Sr=new WeakMap,gd=new WeakMap,vd=new WeakMap,hg=new WeakMap,pg=new WeakMap,yd=new WeakMap,mg=new WeakMap,gg=new WeakMap,Bj),eF=R.createContext(void 0),$h=t=>{const e=R.useContext(eF);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},s8=({client:t,children:e})=>(R.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),v.jsx(eF.Provider,{value:t,children:e})),tF=R.createContext(!1),o8=()=>R.useContext(tF);tF.Provider;function a8(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var l8=R.createContext(a8()),c8=()=>R.useContext(l8),u8=(t,e,n)=>{const r=n!=null&&n.state.error&&typeof t.throwOnError=="function"?Xj(t.throwOnError,[n.state.error,n]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},d8=t=>{R.useEffect(()=>{t.clearReset()},[t])},f8=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||Xj(n,[t.error,r])),h8=t=>{if(t.suspense){const n=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>n(r(...i)):n(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},p8=(t,e)=>t.isLoading&&t.isFetching&&!e,m8=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,nI=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function g8(t,e,n){var y,x,S,w;const r=o8(),i=c8(),s=$h(),o=s.defaultQueryOptions(t);(x=(y=s.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||x.call(y,o);const a=s.getQueryCache().get(o.queryHash),l=t.subscribed!==!1;o._optimisticResults=r?"isRestoring":l?"optimistic":void 0,h8(o),u8(o,i,a),d8(i);const c=!s.getQueryCache().get(o.queryHash),[d]=R.useState(()=>new e(s,o)),f=d.getOptimisticResult(o),m=!r&&l;if(R.useSyncExternalStore(R.useCallback(b=>{const E=m?d.subscribe(Fi.batchCalls(b)):Xs;return d.updateResult(),E},[d,m]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),R.useEffect(()=>{d.setOptions(o)},[o,d]),m8(o,f))throw nI(o,d,i);if(f8({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:a,suspense:o.suspense}))throw f.error;if((w=(S=s.getDefaultOptions().queries)==null?void 0:S._experimental_afterQuery)==null||w.call(S,o,f),o.experimental_prefetchInRender&&!r0.isServer()&&p8(f,r)){const b=c?nI(o,d,i):a==null?void 0:a.promise;b==null||b.catch(Xs).finally(()=>{d.updateResult()})}return o.notifyOnChangeProps?f:d.trackResult(f)}function ls(t,e){return g8(t,ZW)}/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v8=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nF=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var y8={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.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const x8=R.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:s,iconNode:o,...a},l)=>R.createElement("svg",{ref:l,...y8,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:nF("lucide",i),...a},[...o.map(([c,d])=>R.createElement(c,d)),...Array.isArray(s)?s:[s]]));/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vt=(t,e)=>{const n=R.forwardRef(({className:r,...i},s)=>R.createElement(x8,{ref:s,iconNode:e,className:nF(`lucide-${v8(t)}`,r),...i}));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i0=vt("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rI=vt("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const b8=vt("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TT=vt("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qc=vt("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _8=vt("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.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CT=vt("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.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V1=vt("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w8=vt("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bo=vt("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S8=vt("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M8=vt("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rF=vt("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E8=vt("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A8=vt("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T8=vt("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.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C8=vt("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P8=vt("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iF=vt("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R8=vt("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PT=vt("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const N8=vt("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ew=vt("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const El=vt("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I8=vt("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** + * @license lucide-react v0.460.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=vt("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.460.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=vt("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iI=vt("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RT=vt("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k8=vt("FileText",[["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:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O8=vt("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L8=vt("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D8=vt("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.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nE=vt("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sI=vt("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U8=vt("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j8=vt("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G1=vt("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F8=vt("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z8=vt("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B8=vt("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H8=vt("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V8=vt("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sF=vt("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G8=vt("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W8=vt("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oF=vt("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.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $8=vt("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const X8=vt("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q8=vt("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K8=vt("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const NT=vt("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const IT=vt("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y8=vt("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z8=vt("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hy=vt("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q8=vt("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J8=vt("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yP=vt("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const e9=vt("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xP=vt("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const t9=vt("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const n9=vt("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s0=vt("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vm=vt("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aF=vt("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const r9=vt("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lF=vt("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kT=vt("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.460.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=vt("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i9=vt("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s9=vt("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o9=vt("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tw=vt("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bc=vt("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.460.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xh=vt("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),OT=[{id:"dashboard",label:"Zentrale",hint:"System- & Stack-Status",icon:F8},{id:"models",label:"Modell-Manager",hint:"Verwalten, laden & Gateway-Routing",icon:CT},{id:"memory",label:"Gedächtnis",hint:"Geteiltes Memory verwalten",icon:V1},{id:"connect",label:"Verbinden",hint:"IDE-/Agent-Configs erzeugen",icon:NT},{id:"agent",label:"Hermes",hint:"Agent-Status & Verdrahtung",icon:qc},{id:"terminal",label:"Terminal",hint:"Interaktives Hermes-Agent-Terminal",icon:aF},{id:"voice",label:"Sprechen",hint:"Mit Hermes per Sprache reden (3D-Avatar)",icon:oF},{id:"guide",label:"Anleitung",hint:"Einrichten & Vibe-Coding",icon:T8}];var oI=1,a9=.9,l9=.8,c9=.17,rE=.1,iE=.999,u9=.9999,d9=.99,f9=/[\\\/_+.#"@\[\(\{&]/,h9=/[\\\/_+.#"@\[\(\{&]/g,p9=/[\s-]/,cF=/[\s-]/g;function LT(t,e,n,r,i,s,o){if(s===e.length)return i===t.length?oI:d9;var a=`${i},${s}`;if(o[a]!==void 0)return o[a];for(var l=r.charAt(s),c=n.indexOf(l,i),d=0,f,m,y,x;c>=0;)f=LT(t,e,n,r,c+1,s+1,o),f>d&&(c===i?f*=oI:f9.test(t.charAt(c-1))?(f*=l9,y=t.slice(i,c-1).match(h9),y&&i>0&&(f*=Math.pow(iE,y.length))):p9.test(t.charAt(c-1))?(f*=a9,x=t.slice(i,c-1).match(cF),x&&i>0&&(f*=Math.pow(iE,x.length))):(f*=c9,i>0&&(f*=Math.pow(iE,c-i))),t.charAt(c)!==e.charAt(s)&&(f*=u9)),(ff&&(f=m*rE)),f>d&&(d=f),c=n.indexOf(l,c+1);return o[a]=d,d}function aI(t){return t.toLowerCase().replace(cF," ")}function m9(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,LT(t,e,aI(t),aI(e),0,0,{})}function _d(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function lI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function bg(...t){return e=>{let n=!1;const r=t.map(i=>{const s=lI(i,e);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i{var b;const{scope:m,children:y,...x}=f,S=((b=m==null?void 0:m[t])==null?void 0:b[l])||a,w=R.useMemo(()=>x,Object.values(x));return v.jsx(S.Provider,{value:w,children:y})};c.displayName=s+"Provider";function d(f,m){var S;const y=((S=m==null?void 0:m[t])==null?void 0:S[l])||a,x=R.useContext(y);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${s}\``)}return[c,d]}const i=()=>{const s=n.map(o=>R.createContext(o));return function(a){const l=(a==null?void 0:a[t])||s;return R.useMemo(()=>({[`__scope${t}`]:{...a,[t]:l}}),[a,l])}};return i.scopeName=t,[r,v9(i,...e)]}function v9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(s){const o=r.reduce((a,{useScope:l,scopeName:c})=>{const f=l(s)[`__scope${c}`];return{...a,...f}},{});return R.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}var o0=globalThis!=null&&globalThis.document?R.useLayoutEffect:()=>{},y9=H1[" useId ".trim().toString()]||(()=>{}),x9=0;function Hc(t){const[e,n]=R.useState(y9());return o0(()=>{n(r=>r??String(x9++))},[t]),e?`radix-${e}`:""}var b9=H1[" useInsertionEffect ".trim().toString()]||o0;function _9({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[i,s,o]=w9({defaultProp:e,onChange:n}),a=t!==void 0,l=a?t:i;{const d=R.useRef(t!==void 0);R.useEffect(()=>{const f=d.current;f!==a&&console.warn(`${r} is changing from ${f?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),d.current=a},[a,r])}const c=R.useCallback(d=>{var f;if(a){const m=S9(d)?d(t):d;m!==t&&((f=o.current)==null||f.call(o,m))}else s(d)},[a,t,s,o]);return[l,c]}function w9({defaultProp:t,onChange:e}){const[n,r]=R.useState(t),i=R.useRef(n),s=R.useRef(e);return b9(()=>{s.current=e},[e]),R.useEffect(()=>{var o;i.current!==n&&((o=s.current)==null||o.call(s,n),i.current=n)},[n,i]),[n,r,s]}function S9(t){return typeof t=="function"}var W1=Vj();function uF(t){const e=R.forwardRef((n,r)=>{let{children:i,...s}=n,o=null,a=!1;const l=[];cI(i)&&typeof hb=="function"&&(i=hb(i._payload)),R.Children.forEach(i,m=>{var y;if(C9(m)){a=!0;const x=m;let S="child"in x.props?x.props.child:x.props.children;cI(S)&&typeof hb=="function"&&(S=hb(S._payload)),o=E9(x,S),l.push((y=o==null?void 0:o.props)==null?void 0:y.children)}else l.push(m)}),o?o=R.cloneElement(o,void 0,l):!a&&R.Children.count(i)===1&&R.isValidElement(i)&&(o=i);const c=o?T9(o):void 0,d=Xh(r,c);if(!o){if(i||i===0)throw new Error(a?I9(t):N9(t));return i}const f=A9(s,o.props??{});return o.type!==R.Fragment&&(f.ref=r?d:c),R.cloneElement(o,f)});return e.displayName=`${t}.Slot`,e}var M9=Symbol.for("radix.slottable"),E9=(t,e)=>{if("child"in t.props){const n=t.props.child;return R.isValidElement(n)?R.cloneElement(n,void 0,t.props.children(n.props.children)):null}return R.isValidElement(e)?e:null};function A9(t,e){const n={...e};for(const r in e){const i=t[r],s=e[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...t,...n}}function T9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function C9(t){return R.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===M9}var P9=Symbol.for("react.lazy");function cI(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===P9&&"_payload"in t&&R9(t._payload)}function R9(t){return typeof t=="object"&&t!==null&&"then"in t}var N9=t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,I9=t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,hb=H1[" use ".trim().toString()],k9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vi=k9.reduce((t,e)=>{const n=uF(`Primitive.${e}`),r=R.forwardRef((i,s)=>{const{asChild:o,...a}=i,l=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),v.jsx(l,{...a,ref:s})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function O9(t,e){t&&W1.flushSync(()=>t.dispatchEvent(e))}function a0(t){const e=R.useRef(t);return R.useEffect(()=>{e.current=t}),R.useMemo(()=>((...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)}),[])}function L9(t,e=globalThis==null?void 0:globalThis.document){const n=a0(t);R.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var D9="DismissableLayer",DT="dismissableLayer.update",U9="dismissableLayer.pointerDownOutside",j9="dismissableLayer.focusOutside",uI,bP=R.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),dF=R.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:l,...c}=t,d=R.useContext(bP),[f,m]=R.useState(null),y=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=R.useState({}),S=Xh(e,V=>m(V)),w=Array.from(d.layers),[b]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(b),T=f?w.indexOf(f):-1,C=d.layersWithOutsidePointerEventsDisabled.size>0,O=T>=E,N=R.useRef(!1),D=H9(V=>{const k=V.target;if(!(k instanceof Node))return;const j=[...d.branches].some(H=>H.contains(k));!O||j||(s==null||s(V),a==null||a(V),V.defaultPrevented||l==null||l())},{ownerDocument:y,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:N,dismissableSurfaces:d.dismissableSurfaces}),F=V9(V=>{if(r&&N.current)return;const k=V.target;[...d.branches].some(H=>H.contains(k))||(o==null||o(V),a==null||a(V),V.defaultPrevented||l==null||l())},y);return L9(V=>{T===d.layers.size-1&&(i==null||i(V),!V.defaultPrevented&&l&&(V.preventDefault(),l()))},y),R.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(uI=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),dI(),()=>{n&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(y.body.style.pointerEvents=uI))}},[f,y,n,d]),R.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),dI())},[f,d]),R.useEffect(()=>{const V=()=>x({});return document.addEventListener(DT,V),()=>document.removeEventListener(DT,V)},[]),v.jsx(Vi.div,{...c,ref:S,style:{pointerEvents:C?O?"auto":"none":void 0,...t.style},onFocusCapture:_d(t.onFocusCapture,F.onFocusCapture),onBlurCapture:_d(t.onBlurCapture,F.onBlurCapture),onPointerDownCapture:_d(t.onPointerDownCapture,D.onPointerDownCapture)})});dF.displayName=D9;var F9="DismissableLayerBranch",z9=R.forwardRef((t,e)=>{const n=R.useContext(bP),r=R.useRef(null),i=Xh(e,r);return R.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),v.jsx(Vi.div,{...t,ref:i})});z9.displayName=F9;function B9(){const t=R.useContext(bP),[e,n]=R.useState(null);return R.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}function H9(t,e){const{ownerDocument:n=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:s}=e,o=a0(t),a=R.useRef(!1),l=R.useRef(!1),c=R.useRef(new Map),d=R.useRef(()=>{});return R.useEffect(()=>{function f(){l.current=!1,i.current=!1,c.current.clear()}function m(){return Array.from(c.current.values()).some(Boolean)}function y(E){if(!l.current)return;const T=E.target;T instanceof Node&&[...s].some(O=>O.contains(T))||c.current.set(E.type,!0),E.type==="click"&&window.setTimeout(()=>{l.current&&d.current()},0)}function x(E){l.current&&c.current.set(E.type,!1)}const S=E=>{if(E.target&&!a.current){let T=function(){n.removeEventListener("click",d.current);const O=m();f(),O||fF(U9,o,C,{discrete:!0})};const C={originalEvent:E};l.current=!0,i.current=r&&E.button===0,c.current.clear(),!r||E.button!==0?T():(n.removeEventListener("click",d.current),d.current=T,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},w=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const E of w)n.addEventListener(E,y,!0),n.addEventListener(E,x);const b=window.setTimeout(()=>{n.addEventListener("pointerdown",S)},0);return()=>{window.clearTimeout(b),n.removeEventListener("pointerdown",S),n.removeEventListener("click",d.current);for(const E of w)n.removeEventListener(E,y,!0),n.removeEventListener(E,x)}},[n,o,r,i,s]),{onPointerDownCapture:()=>a.current=!0}}function V9(t,e=globalThis==null?void 0:globalThis.document){const n=a0(t),r=R.useRef(!1);return R.useEffect(()=>{const i=s=>{s.target&&!r.current&&fF(j9,n,{originalEvent:s},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function dI(){const t=new CustomEvent(DT);document.dispatchEvent(t)}function fF(t,e,n,{discrete:r}){const i=n.originalEvent.target,s=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?O9(i,s):i.dispatchEvent(s)}var sE="focusScope.autoFocusOnMount",oE="focusScope.autoFocusOnUnmount",fI={bubbles:!1,cancelable:!0},G9="FocusScope",hF=R.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:s,...o}=t,[a,l]=R.useState(null),c=a0(i),d=a0(s),f=R.useRef(null),m=Xh(e,S=>l(S)),y=R.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;R.useEffect(()=>{if(r){let S=function(T){if(y.paused||!a)return;const C=T.target;a.contains(C)?f.current=C:od(f.current,{select:!0})},w=function(T){if(y.paused||!a)return;const C=T.relatedTarget;C!==null&&(a.contains(C)||od(f.current,{select:!0}))},b=function(T){if(document.activeElement===document.body)for(const O of T)O.removedNodes.length>0&&od(a)};document.addEventListener("focusin",S),document.addEventListener("focusout",w);const E=new MutationObserver(b);return a&&E.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",w),E.disconnect()}}},[r,a,y.paused]),R.useEffect(()=>{if(a){pI.add(y);const S=document.activeElement;if(!a.contains(S)){const b=new CustomEvent(sE,fI);a.addEventListener(sE,c),a.dispatchEvent(b),b.defaultPrevented||(W9(Y9(pF(a)),{select:!0}),document.activeElement===S&&od(a))}return()=>{a.removeEventListener(sE,c),setTimeout(()=>{const b=new CustomEvent(oE,fI);a.addEventListener(oE,d),a.dispatchEvent(b),b.defaultPrevented||od(S??document.body,{select:!0}),a.removeEventListener(oE,d),pI.remove(y)},0)}}},[a,c,d,y]);const x=R.useCallback(S=>{if(!n&&!r||y.paused)return;const w=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,b=document.activeElement;if(w&&b){const E=S.currentTarget,[T,C]=$9(E);T&&C?!S.shiftKey&&b===C?(S.preventDefault(),n&&od(T,{select:!0})):S.shiftKey&&b===T&&(S.preventDefault(),n&&od(C,{select:!0})):b===E&&S.preventDefault()}},[n,r,y.paused]);return v.jsx(Vi.div,{tabIndex:-1,...o,ref:m,onKeyDown:x})});hF.displayName=G9;function W9(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(od(r,{select:e}),document.activeElement!==n)return}function $9(t){const e=pF(t),n=hI(e,t),r=hI(e.reverse(),t);return[n,r]}function pF(t){const e=[],n=document.createTreeWalker(t,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(;n.nextNode();)e.push(n.currentNode);return e}function hI(t,e){for(const n of t)if(!X9(n,{upTo:e}))return n}function X9(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 q9(t){return t instanceof HTMLInputElement&&"select"in t}function od(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&q9(t)&&e&&t.select()}}var pI=K9();function K9(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=mI(t,e),t.unshift(e)},remove(e){var n;t=mI(t,e),(n=t[0])==null||n.resume()}}}function mI(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Y9(t){return t.filter(e=>e.tagName!=="A")}var Z9="Portal",mF=R.forwardRef((t,e)=>{var a;const{container:n,...r}=t,[i,s]=R.useState(!1);o0(()=>s(!0),[]);const o=n||i&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return o?W1.createPortal(v.jsx(Vi.div,{...r,ref:e}),o):null});mF.displayName=Z9;function Q9(t,e){return R.useReducer((n,r)=>e[n][r]??n,t)}var $1=t=>{const{present:e,children:n}=t,r=J9(e),i=typeof n=="function"?n({present:r.isPresent}):R.Children.only(n),s=e$(r.ref,t$(i));return typeof n=="function"||r.isPresent?R.cloneElement(i,{ref:s}):null};$1.displayName="Presence";function J9(t){const[e,n]=R.useState(),r=R.useRef(null),i=R.useRef(t),s=R.useRef("none"),o=t?"mounted":"unmounted",[a,l]=Q9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return R.useEffect(()=>{const c=pb(r.current);s.current=a==="mounted"?c:"none"},[a]),o0(()=>{const c=r.current,d=i.current;if(d!==t){const m=s.current,y=pb(c);t?l("MOUNT"):y==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(d&&m!==y?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),o0(()=>{if(e){let c;const d=e.ownerDocument.defaultView??window,f=y=>{const S=pb(r.current).includes(CSS.escape(y.animationName));if(y.target===e&&S&&(l("ANIMATION_END"),!i.current)){const w=e.style.animationFillMode;e.style.animationFillMode="forwards",c=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=w)})}},m=y=>{y.target===e&&(s.current=pb(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(c),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:R.useCallback(c=>{r.current=c?getComputedStyle(c):null,n(c)},[])}}function gI(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function e$(...t){const e=R.useRef(t);return e.current=t,R.useCallback(n=>{const r=e.current;let i=!1;const s=r.map(o=>{const a=gI(o,n);return!i&&typeof a=="function"&&(i=!0),a});if(i)return()=>{for(let o=0;o{ul||(ul={start:vI(),end:vI()});const{start:t,end:e}=ul;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),mb++,()=>{mb===1&&(ul==null||ul.start.remove(),ul==null||ul.end.remove(),ul=null),mb=Math.max(0,mb-1)}},[])}function vI(){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 _l=function(){return _l=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return x$;var e=b$(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},w$=xF(),Ym="data-scroll-locked",S$=function(t,e,n,r){var i=t.left,s=t.top,o=t.right,a=t.gap;return n===void 0&&(n="margin"),` + .`.concat(i$,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(a,"px ").concat(r,`; + } + body[`).concat(Ym,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([e&&"position: relative ".concat(r,";"),n==="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,`; + `),n==="padding"&&"padding-right: ".concat(a,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(U_,` { + right: `).concat(a,"px ").concat(r,`; + } + + .`).concat(j_,` { + margin-right: `).concat(a,"px ").concat(r,`; + } + + .`).concat(U_," .").concat(U_,` { + right: 0 `).concat(r,`; + } + + .`).concat(j_," .").concat(j_,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Ym,`] { + `).concat(s$,": ").concat(a,`px; + } +`)},xI=function(){var t=parseInt(document.body.getAttribute(Ym)||"0",10);return isFinite(t)?t:0},M$=function(){R.useEffect(function(){return document.body.setAttribute(Ym,(xI()+1).toString()),function(){var t=xI()-1;t<=0?document.body.removeAttribute(Ym):document.body.setAttribute(Ym,t.toString())}},[])},E$=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;M$();var s=R.useMemo(function(){return _$(i)},[i]);return R.createElement(w$,{styles:S$(s,!e,i,n?"":"!important")})},UT=!1;if(typeof window<"u")try{var gb=Object.defineProperty({},"passive",{get:function(){return UT=!0,!0}});window.addEventListener("test",gb,gb),window.removeEventListener("test",gb,gb)}catch{UT=!1}var tm=UT?{passive:!1}:!1,A$=function(t){return t.tagName==="TEXTAREA"},bF=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!A$(t)&&n[e]==="visible")},T$=function(t){return bF(t,"overflowY")},C$=function(t){return bF(t,"overflowX")},bI=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=_F(t,r);if(i){var s=wF(t,r),o=s[1],a=s[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},P$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},R$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},_F=function(t,e){return t==="v"?T$(e):C$(e)},wF=function(t,e){return t==="v"?P$(e):R$(e)},N$=function(t,e){return t==="h"&&e==="rtl"?-1:1},I$=function(t,e,n,r,i){var s=N$(t,window.getComputedStyle(e).direction),o=s*r,a=n.target,l=e.contains(a),c=!1,d=o>0,f=0,m=0;do{if(!a)break;var y=wF(t,a),x=y[0],S=y[1],w=y[2],b=S-w-s*x;(x||b)&&_F(t,a)&&(f+=b,m+=x);var E=a.parentNode;a=E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE?E.host:E}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(d&&Math.abs(f)<1||!d&&Math.abs(m)<1)&&(c=!0),c},vb=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},_I=function(t){return[t.deltaX,t.deltaY]},wI=function(t){return t&&"current"in t?t.current:t},k$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},O$=function(t){return` + .block-interactivity-`.concat(t,` {pointer-events: none;} + .allow-interactivity-`).concat(t,` {pointer-events: all;} +`)},L$=0,nm=[];function D$(t){var e=R.useRef([]),n=R.useRef([0,0]),r=R.useRef(),i=R.useState(L$++)[0],s=R.useState(xF)[0],o=R.useRef(t);R.useEffect(function(){o.current=t},[t]),R.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var S=r$([t.lockRef.current],(t.shards||[]).map(wI),!0).filter(Boolean);return S.forEach(function(w){return w.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),S.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var a=R.useCallback(function(S,w){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!o.current.allowPinchZoom;var b=vb(S),E=n.current,T="deltaX"in S?S.deltaX:E[0]-b[0],C="deltaY"in S?S.deltaY:E[1]-b[1],O,N=S.target,D=Math.abs(T)>Math.abs(C)?"h":"v";if("touches"in S&&D==="h"&&N.type==="range")return!1;var F=window.getSelection(),V=F&&F.anchorNode,k=V?V===N||V.contains(N):!1;if(k)return!1;var j=bI(D,N);if(!j)return!0;if(j?O=D:(O=D==="v"?"h":"v",j=bI(D,N)),!j)return!1;if(!r.current&&"changedTouches"in S&&(T||C)&&(r.current=O),!O)return!0;var H=r.current||O;return I$(H,w,S,H==="h"?T:C)},[]),l=R.useCallback(function(S){var w=S;if(!(!nm.length||nm[nm.length-1]!==s)){var b="deltaY"in w?_I(w):vb(w),E=e.current.filter(function(O){return O.name===w.type&&(O.target===w.target||w.target===O.shadowParent)&&k$(O.delta,b)})[0];if(E&&E.should){w.cancelable&&w.preventDefault();return}if(!E){var T=(o.current.shards||[]).map(wI).filter(Boolean).filter(function(O){return O.contains(w.target)}),C=T.length>0?a(w,T[0]):!o.current.noIsolation;C&&w.cancelable&&w.preventDefault()}}},[]),c=R.useCallback(function(S,w,b,E){var T={name:S,delta:w,target:b,should:E,shadowParent:U$(b)};e.current.push(T),setTimeout(function(){e.current=e.current.filter(function(C){return C!==T})},1)},[]),d=R.useCallback(function(S){n.current=vb(S),r.current=void 0},[]),f=R.useCallback(function(S){c(S.type,_I(S),S.target,a(S,t.lockRef.current))},[]),m=R.useCallback(function(S){c(S.type,vb(S),S.target,a(S,t.lockRef.current))},[]);R.useEffect(function(){return nm.push(s),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:m}),document.addEventListener("wheel",l,tm),document.addEventListener("touchmove",l,tm),document.addEventListener("touchstart",d,tm),function(){nm=nm.filter(function(S){return S!==s}),document.removeEventListener("wheel",l,tm),document.removeEventListener("touchmove",l,tm),document.removeEventListener("touchstart",d,tm)}},[]);var y=t.removeScrollBar,x=t.inert;return R.createElement(R.Fragment,null,x?R.createElement(s,{styles:O$(i)}):null,y?R.createElement(E$,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function U$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const j$=f$(yF,D$);var SF=R.forwardRef(function(t,e){return R.createElement(X1,_l({},t,{ref:e,sideCar:j$}))});SF.classNames=X1.classNames;var F$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},rm=new WeakMap,yb=new WeakMap,xb={},uE=0,MF=function(t){return t&&(t.host||MF(t.parentNode))},z$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=MF(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},B$=function(t,e,n,r){var i=z$(e,Array.isArray(t)?t:[t]);xb[n]||(xb[n]=new WeakMap);var s=xb[n],o=[],a=new Set,l=new Set(i),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};i.forEach(c);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(m){if(a.has(m))d(m);else try{var y=m.getAttribute(r),x=y!==null&&y!=="false",S=(rm.get(m)||0)+1,w=(s.get(m)||0)+1;rm.set(m,S),s.set(m,w),o.push(m),S===1&&x&&yb.set(m,!0),w===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return d(e),a.clear(),uE++,function(){o.forEach(function(f){var m=rm.get(f)-1,y=s.get(f)-1;rm.set(f,m),s.set(f,y),m||(yb.has(f)||f.removeAttribute(r),yb.delete(f)),y||f.removeAttribute(n)}),uE--,uE||(rm=new WeakMap,rm=new WeakMap,yb=new WeakMap,xb={})}},H$=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=F$(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live], script"))),B$(r,i,n,"aria-hidden")):function(){return null}},q1="Dialog",[EF]=g9(q1),[V$,Ga]=EF(q1),AF=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!0}=t,a=R.useRef(null),l=R.useRef(null),[c,d]=_9({prop:r,defaultProp:i??!1,onChange:s,caller:q1});return v.jsx(V$,{scope:e,triggerRef:a,contentRef:l,contentId:Hc(),titleId:Hc(),descriptionId:Hc(),open:c,onOpenChange:d,onOpenToggle:R.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};AF.displayName=q1;var TF="DialogTrigger",G$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(TF,n),s=Xh(e,i.triggerRef);return v.jsx(Vi.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":wP(i.open),...r,ref:s,onClick:_d(t.onClick,i.onOpenToggle)})});G$.displayName=TF;var _P="DialogPortal",[W$,CF]=EF(_P,{forceMount:void 0}),PF=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,s=Ga(_P,e);return v.jsx(W$,{scope:e,forceMount:n,children:R.Children.map(r,o=>v.jsx($1,{present:n||s.open,children:v.jsx(mF,{asChild:!0,container:i,children:o})}))})};PF.displayName=_P;var nw="DialogOverlay",RF=R.forwardRef((t,e)=>{const n=CF(nw,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Ga(nw,t.__scopeDialog);return s.modal?v.jsx($1,{present:r||s.open,children:v.jsx(X$,{...i,ref:e})}):null});RF.displayName=nw;var $$=uF("DialogOverlay.RemoveScroll"),X$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(nw,n),s=B9(),o=Xh(e,s);return v.jsx(SF,{as:$$,allowPinchZoom:!0,shards:[i.contentRef],children:v.jsx(Vi.div,{"data-state":wP(i.open),...r,ref:o,style:{pointerEvents:"auto",...r.style}})})}),_g="DialogContent",NF=R.forwardRef((t,e)=>{const n=CF(_g,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,s=Ga(_g,t.__scopeDialog);return v.jsx($1,{present:r||s.open,children:s.modal?v.jsx(q$,{...i,ref:e}):v.jsx(K$,{...i,ref:e})})});NF.displayName=_g;var q$=R.forwardRef((t,e)=>{const n=Ga(_g,t.__scopeDialog),r=R.useRef(null),i=Xh(e,n.contentRef,r);return R.useEffect(()=>{const s=r.current;if(s)return H$(s)},[]),v.jsx(IF,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:_d(t.onCloseAutoFocus,s=>{var o;s.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:_d(t.onPointerDownOutside,s=>{const o=s.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&s.preventDefault()}),onFocusOutside:_d(t.onFocusOutside,s=>s.preventDefault())})}),K$=R.forwardRef((t,e)=>{const n=Ga(_g,t.__scopeDialog),r=R.useRef(!1),i=R.useRef(!1);return v.jsx(IF,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=t.onCloseAutoFocus)==null||o.call(t,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=t.onInteractOutside)==null||l.call(t,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),IF=R.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,...o}=t,a=Ga(_g,n);return n$(),v.jsx(v.Fragment,{children:v.jsx(hF,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:v.jsx(dF,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":wP(a.open),...o,ref:e,deferPointerDownOutside:!0,onDismiss:()=>a.onOpenChange(!1)})})})}),kF="DialogTitle",Y$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(kF,n);return v.jsx(Vi.h2,{id:i.titleId,...r,ref:e})});Y$.displayName=kF;var OF="DialogDescription",Z$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(OF,n);return v.jsx(Vi.p,{id:i.descriptionId,...r,ref:e})});Z$.displayName=OF;var LF="DialogClose",Q$=R.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Ga(LF,n);return v.jsx(Vi.button,{type:"button",...r,ref:e,onClick:_d(t.onClick,()=>i.onOpenChange(!1))})});Q$.displayName=LF;function wP(t){return t?"open":"closed"}var ty='[cmdk-group=""]',dE='[cmdk-group-items=""]',J$='[cmdk-group-heading=""]',DF='[cmdk-item=""]',SI=`${DF}:not([aria-disabled="true"])`,jT="cmdk-item-select",Dm="data-value",e7=(t,e,n)=>m9(t,e,n),UF=R.createContext(void 0),G0=()=>R.useContext(UF),jF=R.createContext(void 0),SP=()=>R.useContext(jF),FF=R.createContext(void 0),zF=R.forwardRef((t,e)=>{let n=Um(()=>{var Z,ge;return{search:"",value:(ge=(Z=t.value)!=null?Z:t.defaultValue)!=null?ge:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=Um(()=>new Set),i=Um(()=>new Map),s=Um(()=>new Map),o=Um(()=>new Set),a=BF(t),{label:l,children:c,value:d,onValueChange:f,filter:m,shouldFilter:y,loop:x,disablePointerSelection:S=!1,vimBindings:w=!0,...b}=t,E=Hc(),T=Hc(),C=Hc(),O=R.useRef(null),N=d7();Ch(()=>{if(d!==void 0){let Z=d.trim();n.current.value=Z,D.emit()}},[d]),Ch(()=>{N(6,ne)},[]);let D=R.useMemo(()=>({subscribe:Z=>(o.current.add(Z),()=>o.current.delete(Z)),snapshot:()=>n.current,setState:(Z,ge,ae)=>{var ce,we,Me,$e;if(!Object.is(n.current[Z],ge)){if(n.current[Z]=ge,Z==="search")H(),k(),N(1,j);else if(Z==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Se=document.getElementById(C);Se?Se.focus():(ce=document.getElementById(E))==null||ce.focus()}if(N(7,()=>{var Se;n.current.selectedItemId=(Se=J())==null?void 0:Se.id,D.emit()}),ae||N(5,ne),((we=a.current)==null?void 0:we.value)!==void 0){let Se=ge??"";($e=(Me=a.current).onValueChange)==null||$e.call(Me,Se);return}}D.emit()}},emit:()=>{o.current.forEach(Z=>Z())}}),[]),F=R.useMemo(()=>({value:(Z,ge,ae)=>{var ce;ge!==((ce=s.current.get(Z))==null?void 0:ce.value)&&(s.current.set(Z,{value:ge,keywords:ae}),n.current.filtered.items.set(Z,V(ge,ae)),N(2,()=>{k(),D.emit()}))},item:(Z,ge)=>(r.current.add(Z),ge&&(i.current.has(ge)?i.current.get(ge).add(Z):i.current.set(ge,new Set([Z]))),N(3,()=>{H(),k(),n.current.value||j(),D.emit()}),()=>{s.current.delete(Z),r.current.delete(Z),n.current.filtered.items.delete(Z);let ae=J();N(4,()=>{H(),(ae==null?void 0:ae.getAttribute("id"))===Z&&j(),D.emit()})}),group:Z=>(i.current.has(Z)||i.current.set(Z,new Set),()=>{s.current.delete(Z),i.current.delete(Z)}),filter:()=>a.current.shouldFilter,label:l||t["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:E,inputId:C,labelId:T,listInnerRef:O}),[]);function V(Z,ge){var ae,ce;let we=(ce=(ae=a.current)==null?void 0:ae.filter)!=null?ce:e7;return Z?we(Z,n.current.search,ge):0}function k(){if(!n.current.search||a.current.shouldFilter===!1)return;let Z=n.current.filtered.items,ge=[];n.current.filtered.groups.forEach(ce=>{let we=i.current.get(ce),Me=0;we.forEach($e=>{let Se=Z.get($e);Me=Math.max(Se,Me)}),ge.push([ce,Me])});let ae=O.current;de().sort((ce,we)=>{var Me,$e;let Se=ce.getAttribute("id"),Ve=we.getAttribute("id");return((Me=Z.get(Ve))!=null?Me:0)-(($e=Z.get(Se))!=null?$e:0)}).forEach(ce=>{let we=ce.closest(dE);we?we.appendChild(ce.parentElement===we?ce:ce.closest(`${dE} > *`)):ae.appendChild(ce.parentElement===ae?ce:ce.closest(`${dE} > *`))}),ge.sort((ce,we)=>we[1]-ce[1]).forEach(ce=>{var we;let Me=(we=O.current)==null?void 0:we.querySelector(`${ty}[${Dm}="${encodeURIComponent(ce[0])}"]`);Me==null||Me.parentElement.appendChild(Me)})}function j(){let Z=de().find(ae=>ae.getAttribute("aria-disabled")!=="true"),ge=Z==null?void 0:Z.getAttribute(Dm);D.setState("value",ge||void 0)}function H(){var Z,ge,ae,ce;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let we=0;for(let Me of r.current){let $e=(ge=(Z=s.current.get(Me))==null?void 0:Z.value)!=null?ge:"",Se=(ce=(ae=s.current.get(Me))==null?void 0:ae.keywords)!=null?ce:[],Ve=V($e,Se);n.current.filtered.items.set(Me,Ve),Ve>0&&we++}for(let[Me,$e]of i.current)for(let Se of $e)if(n.current.filtered.items.get(Se)>0){n.current.filtered.groups.add(Me);break}n.current.filtered.count=we}function ne(){var Z,ge,ae;let ce=J();ce&&(((Z=ce.parentElement)==null?void 0:Z.firstChild)===ce&&((ae=(ge=ce.closest(ty))==null?void 0:ge.querySelector(J$))==null||ae.scrollIntoView({block:"nearest"})),ce.scrollIntoView({block:"nearest"}))}function J(){var Z;return(Z=O.current)==null?void 0:Z.querySelector(`${DF}[aria-selected="true"]`)}function de(){var Z;return Array.from(((Z=O.current)==null?void 0:Z.querySelectorAll(SI))||[])}function oe(Z){let ge=de()[Z];ge&&D.setState("value",ge.getAttribute(Dm))}function he(Z){var ge;let ae=J(),ce=de(),we=ce.findIndex($e=>$e===ae),Me=ce[we+Z];(ge=a.current)!=null&&ge.loop&&(Me=we+Z<0?ce[ce.length-1]:we+Z===ce.length?ce[0]:ce[we+Z]),Me&&D.setState("value",Me.getAttribute(Dm))}function B(Z){let ge=J(),ae=ge==null?void 0:ge.closest(ty),ce;for(;ae&&!ce;)ae=Z>0?c7(ae,ty):u7(ae,ty),ce=ae==null?void 0:ae.querySelector(SI);ce?D.setState("value",ce.getAttribute(Dm)):he(Z)}let K=()=>oe(de().length-1),q=Z=>{Z.preventDefault(),Z.metaKey?K():Z.altKey?B(1):he(1)},$=Z=>{Z.preventDefault(),Z.metaKey?oe(0):Z.altKey?B(-1):he(-1)};return R.createElement(Vi.div,{ref:e,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:Z=>{var ge;(ge=b.onKeyDown)==null||ge.call(b,Z);let ae=Z.nativeEvent.isComposing||Z.keyCode===229;if(!(Z.defaultPrevented||ae))switch(Z.key){case"n":case"j":{w&&Z.ctrlKey&&q(Z);break}case"ArrowDown":{q(Z);break}case"p":case"k":{w&&Z.ctrlKey&&$(Z);break}case"ArrowUp":{$(Z);break}case"Home":{Z.preventDefault(),oe(0);break}case"End":{Z.preventDefault(),K();break}case"Enter":{Z.preventDefault();let ce=J();if(ce){let we=new Event(jT);ce.dispatchEvent(we)}}}}},R.createElement("label",{"cmdk-label":"",htmlFor:F.inputId,id:F.labelId,style:h7},l),K1(t,Z=>R.createElement(jF.Provider,{value:D},R.createElement(UF.Provider,{value:F},Z))))}),t7=R.forwardRef((t,e)=>{var n,r;let i=Hc(),s=R.useRef(null),o=R.useContext(FF),a=G0(),l=BF(t),c=(r=(n=l.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;Ch(()=>{if(!c)return a.item(i,o==null?void 0:o.id)},[c]);let d=HF(i,s,[t.value,t.children,s],t.keywords),f=SP(),m=Ed(N=>N.value&&N.value===d.current),y=Ed(N=>c||a.filter()===!1?!0:N.search?N.filtered.items.get(i)>0:!0);R.useEffect(()=>{let N=s.current;if(!(!N||t.disabled))return N.addEventListener(jT,x),()=>N.removeEventListener(jT,x)},[y,t.onSelect,t.disabled]);function x(){var N,D;S(),(D=(N=l.current).onSelect)==null||D.call(N,d.current)}function S(){f.setState("value",d.current,!0)}if(!y)return null;let{disabled:w,value:b,onSelect:E,forceMount:T,keywords:C,...O}=t;return R.createElement(Vi.div,{ref:bg(s,e),...O,id:i,"cmdk-item":"",role:"option","aria-disabled":!!w,"aria-selected":!!m,"data-disabled":!!w,"data-selected":!!m,onPointerMove:w||a.getDisablePointerSelection()?void 0:S,onClick:w?void 0:x},t.children)}),n7=R.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:i,...s}=t,o=Hc(),a=R.useRef(null),l=R.useRef(null),c=Hc(),d=G0(),f=Ed(y=>i||d.filter()===!1?!0:y.search?y.filtered.groups.has(o):!0);Ch(()=>d.group(o),[]),HF(o,a,[t.value,t.heading,l]);let m=R.useMemo(()=>({id:o,forceMount:i}),[i]);return R.createElement(Vi.div,{ref:bg(a,e),...s,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&R.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),K1(t,y=>R.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},R.createElement(FF.Provider,{value:m},y))))}),r7=R.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,i=R.useRef(null),s=Ed(o=>!o.search);return!n&&!s?null:R.createElement(Vi.div,{ref:bg(i,e),...r,"cmdk-separator":"",role:"separator"})}),i7=R.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,i=t.value!=null,s=SP(),o=Ed(c=>c.search),a=Ed(c=>c.selectedItemId),l=G0();return R.useEffect(()=>{t.value!=null&&s.setState("search",t.value)},[t.value]),R.createElement(Vi.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":a,id:l.inputId,type:"text",value:i?t.value:o,onChange:c=>{i||s.setState("search",c.target.value),n==null||n(c.target.value)}})}),s7=R.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...i}=t,s=R.useRef(null),o=R.useRef(null),a=Ed(c=>c.selectedItemId),l=G0();return R.useEffect(()=>{if(o.current&&s.current){let c=o.current,d=s.current,f,m=new ResizeObserver(()=>{f=requestAnimationFrame(()=>{let y=c.offsetHeight;d.style.setProperty("--cmdk-list-height",y.toFixed(1)+"px")})});return m.observe(c),()=>{cancelAnimationFrame(f),m.unobserve(c)}}},[]),R.createElement(Vi.div,{ref:bg(s,e),...i,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:l.listId},K1(t,c=>R.createElement("div",{ref:bg(o,l.listInnerRef),"cmdk-list-sizer":""},c)))}),o7=R.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:s,container:o,...a}=t;return R.createElement(AF,{open:n,onOpenChange:r},R.createElement(PF,{container:o},R.createElement(RF,{"cmdk-overlay":"",className:i}),R.createElement(NF,{"aria-label":t.label,"cmdk-dialog":"",className:s},R.createElement(zF,{ref:e,...a}))))}),a7=R.forwardRef((t,e)=>Ed(n=>n.filtered.count===0)?R.createElement(Vi.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),l7=R.forwardRef((t,e)=>{let{progress:n,children:r,label:i="Loading...",...s}=t;return R.createElement(Vi.div,{ref:e,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},K1(t,o=>R.createElement("div",{"aria-hidden":!0},o)))}),im=Object.assign(zF,{List:s7,Item:t7,Input:i7,Group:n7,Separator:r7,Dialog:o7,Empty:a7,Loading:l7});function c7(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function u7(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function BF(t){let e=R.useRef(t);return Ch(()=>{e.current=t}),e}var Ch=typeof window>"u"?R.useEffect:R.useLayoutEffect;function Um(t){let e=R.useRef();return e.current===void 0&&(e.current=t()),e}function Ed(t){let e=SP(),n=()=>t(e.snapshot());return R.useSyncExternalStore(e.subscribe,n,n)}function HF(t,e,n,r=[]){let i=R.useRef(),s=G0();return Ch(()=>{var o;let a=(()=>{var c;for(let d of n){if(typeof d=="string")return d.trim();if(typeof d=="object"&&"current"in d)return d.current?(c=d.current.textContent)==null?void 0:c.trim():i.current}})(),l=r.map(c=>c.trim());s.value(t,a,l),(o=e.current)==null||o.setAttribute(Dm,a),i.current=a}),i}var d7=()=>{let[t,e]=R.useState(),n=Um(()=>new Map);return Ch(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,i)=>{n.current.set(r,i),e({})}};function f7(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function K1({asChild:t,children:e},n){return t&&R.isValidElement(e)?R.cloneElement(f7(e),{ref:e.ref},n(e.props.children)):n(e)}var h7={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function p7({onNavigate:t}){const[e,n]=R.useState(!1);return R.useEffect(()=>{const r=i=>{(i.metaKey||i.ctrlKey)&&i.key.toLowerCase()==="k"&&(i.preventDefault(),n(s=>!s))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),v.jsx(im.Dialog,{open:e,onOpenChange:n,label:"Befehlspalette",className:"fixed inset-0 z-50 flex items-start justify-center bg-black/50 p-4 pt-[12vh]",onClick:()=>n(!1),children:v.jsxs("div",{className:"w-full max-w-lg overflow-hidden rounded-xl border border-border bg-popover text-popover-foreground shadow-2xl",onClick:r=>r.stopPropagation(),children:[v.jsx(im.Input,{autoFocus:!0,placeholder:"Springe zu… (Modelle, Routing, System …)",className:"w-full border-b border-border bg-transparent px-4 py-3 text-sm outline-none placeholder:text-muted-foreground"}),v.jsxs(im.List,{className:"max-h-80 overflow-y-auto p-2",children:[v.jsx(im.Empty,{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"Nichts gefunden."}),v.jsx(im.Group,{heading:"Bereiche",className:"px-1 py-1 text-xs text-muted-foreground",children:OT.map(r=>v.jsxs(im.Item,{value:`${r.label} ${r.hint}`,onSelect:()=>{t(r.id),n(!1)},className:"flex cursor-pointer items-center gap-3 rounded-md px-3 py-2 text-sm text-foreground aria-selected:bg-accent aria-selected:text-accent-foreground",children:[v.jsx(r.icon,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:r.label}),v.jsx("span",{className:"ml-auto truncate text-xs text-muted-foreground",children:r.hint})]},r.id))})]})]})})}async function jt(t,e){var l;const n={"Content-Type":"application/json",...e==null?void 0:e.headers},r=localStorage.getItem("mc_sudo_password"),i=localStorage.getItem("mc_hf_token");r&&(n["X-Sudo-Password"]=r);let s=e==null?void 0:e.body;if((((l=e==null?void 0:e.method)==null?void 0:l.toUpperCase())||"GET")==="POST"){if(typeof s=="string")try{const c=JSON.parse(s);let d=!1;r&&!("sudo_password"in c)&&(c.sudo_password=r,d=!0),i&&!("hf_token"in c)&&(c.hf_token=i,d=!0),d&&(s=JSON.stringify(c))}catch{}else if(!s){const c={};r&&(c.sudo_password=r),i&&(c.hf_token=i),Object.keys(c).length>0&&(s=JSON.stringify(c))}}const a=await fetch(t,{...e,headers:n,body:s});if(!a.ok)throw new Error(`${a.status} ${a.statusText}`);return a.json()}const Lr={health:["health"],systemStatus:["system-status"],services:["services"],models:["models"],routing:["routing"],jobs:["jobs"],tokenStats:["token-stats"],agentStatus:["agent-status"],hermesBrain:["hermes-brain"],updates:["updates"],discover:["discover"],drafts:t=>["drafts",t??""],connect:t=>["connect",t??""],connectHealth:["connect-health"],memory:(t,e)=>["memory",t??"",e??""],memoryGraph:["memory-graph"]},m7=(t=!0)=>ls({queryKey:Lr.memoryGraph,queryFn:()=>jt("/api/memory/graph"),enabled:t}),g7=()=>ls({queryKey:Lr.health,queryFn:()=>jt("/api/health"),refetchInterval:1e4}),Y1=(t=5e3)=>ls({queryKey:Lr.systemStatus,queryFn:()=>jt("/api/system/status"),refetchInterval:t}),v7=(t=3e3)=>ls({queryKey:Lr.services,queryFn:()=>jt("/api/system/services"),refetchInterval:t}),qh=(t=4e3)=>ls({queryKey:Lr.models,queryFn:()=>jt("/api/models"),refetchInterval:t}),y7=(t=4e3)=>ls({queryKey:Lr.routing,queryFn:()=>jt("/api/routing"),refetchInterval:t}),x7=(t=2e3)=>ls({queryKey:Lr.jobs,queryFn:()=>jt("/api/jobs"),refetchInterval:t,select:e=>e.jobs??[]}),MP=(t=3e3)=>ls({queryKey:Lr.tokenStats,queryFn:()=>jt("/api/system/token-stats"),refetchInterval:t}),EP=(t=5e3)=>ls({queryKey:Lr.agentStatus,queryFn:()=>jt("/api/agent/status"),refetchInterval:t}),b7=(t=6e4)=>ls({queryKey:Lr.hermesBrain,queryFn:()=>jt("/api/agent/brain"),refetchInterval:t}),AP=t=>ls({queryKey:Lr.updates,queryFn:()=>jt("/api/maintenance/updates"),refetchInterval:t}),_7=()=>ls({queryKey:Lr.discover,queryFn:()=>jt("/api/discover")}),w7=t=>ls({queryKey:Lr.drafts(t),queryFn:()=>jt(`/api/models/drafts?target=${encodeURIComponent(t??"")}`),enabled:!!t}),VF=t=>ls({queryKey:Lr.connect(t),queryFn:()=>jt(t?`/api/connect?${t}`:"/api/connect")}),S7=()=>ls({queryKey:Lr.connectHealth,queryFn:()=>jt("/api/connect/health"),refetchInterval:15e3}),FT=t=>ls({queryKey:Lr.memory(t==null?void 0:t.q,t==null?void 0:t.category),queryFn:()=>{const e=new URLSearchParams;return t!=null&&t.q&&e.set("q",t.q),t!=null&&t.category&&e.set("category",t.category),jt(`/api/memory?${e}`)},select:e=>t!=null&&t.limit?e.slice(0,t.limit):e});function sm(t){return(t/1024**3).toFixed(1)}function zT(t){return t?t>1024**3?`${(t/1024**3).toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`:""}function Ho(t){if(!t)return"—";const e=t/1024**3;return e>=1?`${e.toFixed(1)} GB`:`${(t/1024**2).toFixed(0)} MB`}function M7(t){if(!t)return"";const e=Math.floor(t/60);return e>0?`${e} min`:`${t} s`}function MI(t){return t?`${Math.round(t/1024)}k`:"—"}function GF(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=T7(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const a=o.split(TP);return a[0]===""&&a.length!==1&&a.shift(),WF(a,e)||A7(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},WF=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?WF(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const s=t.join(TP);return(o=e.validators.find(({validator:a})=>a(s)))==null?void 0:o.classGroupId},EI=/^\[(.+)\]$/,A7=t=>{if(EI.test(t)){const e=EI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},T7=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return P7(Object.entries(t.classGroups),n).forEach(([s,o])=>{BT(o,r,s,e)}),r},BT=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const s=i===""?e:AI(e,i);s.classGroupId=n;return}if(typeof i=="function"){if(C7(i)){BT(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([s,o])=>{BT(o,AI(e,s),n,r)})})},AI=(t,e)=>{let n=t;return e.split(TP).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},C7=t=>t.isThemeGetter,P7=(t,e)=>e?t.map(([n,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[n,i]}):t,R7=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(s,o)=>{n.set(s,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(s){let o=n.get(s);if(o!==void 0)return o;if((o=r.get(s))!==void 0)return i(s,o),o},set(s,o){n.has(s)?n.set(s,o):i(s,o)}}},$F="!",N7=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],s=e.length,o=a=>{const l=[];let c=0,d=0,f;for(let w=0;wd?f-d:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:S}};return n?a=>n({className:a,parseClassName:o}):o},I7=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},k7=t=>({cache:R7(t.cacheSize),parseClassName:N7(t),...E7(t)}),O7=/\s+/,L7=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,s=[],o=t.trim().split(O7);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:y}=n(c);let x=!!y,S=r(x?m.substring(0,y):m);if(!S){if(!x){a=c+(a.length>0?" "+a:a);continue}if(S=r(m),!S){a=c+(a.length>0?" "+a:a);continue}x=!1}const w=I7(d).join(":"),b=f?w+$F:w,E=b+S;if(s.includes(E))continue;s.push(E);const T=i(S,x);for(let C=0;C0?" "+a:a)}return a};function D7(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=k7(c),r=n.cache.get,i=n.cache.set,s=a,a(l)}function a(l){const c=r(l);if(c)return c;const d=L7(l,n);return i(l,d),d}return function(){return s(D7.apply(null,arguments))}}const rr=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},qF=/^\[(?:([a-z-]+):)?(.+)\]$/i,j7=/^\d+\/\d+$/,F7=new Set(["px","full","screen"]),z7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,B7=/\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$/,H7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,V7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_c=t=>Zm(t)||F7.has(t)||j7.test(t),Gu=t=>zg(t,"length",Q7),Zm=t=>!!t&&!Number.isNaN(Number(t)),fE=t=>zg(t,"number",Zm),ny=t=>!!t&&Number.isInteger(Number(t)),W7=t=>t.endsWith("%")&&Zm(t.slice(0,-1)),fn=t=>qF.test(t),Wu=t=>z7.test(t),$7=new Set(["length","size","percentage"]),X7=t=>zg(t,$7,KF),q7=t=>zg(t,"position",KF),K7=new Set(["image","url"]),Y7=t=>zg(t,K7,eX),Z7=t=>zg(t,"",J7),ry=()=>!0,zg=(t,e,n)=>{const r=qF.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},Q7=t=>B7.test(t)&&!H7.test(t),KF=()=>!1,J7=t=>V7.test(t),eX=t=>G7.test(t),tX=()=>{const t=rr("colors"),e=rr("spacing"),n=rr("blur"),r=rr("brightness"),i=rr("borderColor"),s=rr("borderRadius"),o=rr("borderSpacing"),a=rr("borderWidth"),l=rr("contrast"),c=rr("grayscale"),d=rr("hueRotate"),f=rr("invert"),m=rr("gap"),y=rr("gradientColorStops"),x=rr("gradientColorStopPositions"),S=rr("inset"),w=rr("margin"),b=rr("opacity"),E=rr("padding"),T=rr("saturate"),C=rr("scale"),O=rr("sepia"),N=rr("skew"),D=rr("space"),F=rr("translate"),V=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],j=()=>["auto",fn,e],H=()=>[fn,e],ne=()=>["",_c,Gu],J=()=>["auto",Zm,fn],de=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],oe=()=>["solid","dashed","dotted","double","none"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],B=()=>["start","end","center","between","around","evenly","stretch"],K=()=>["","0",fn],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],$=()=>[Zm,fn];return{cacheSize:500,separator:":",theme:{colors:[ry],spacing:[_c,Gu],blur:["none","",Wu,fn],brightness:$(),borderColor:[t],borderRadius:["none","","full",Wu,fn],borderSpacing:H(),borderWidth:ne(),contrast:$(),grayscale:K(),hueRotate:$(),invert:K(),gap:H(),gradientColorStops:[t],gradientColorStopPositions:[W7,Gu],inset:j(),margin:j(),opacity:$(),padding:H(),saturate:$(),scale:$(),sepia:K(),skew:$(),space:H(),translate:H()},classGroups:{aspect:[{aspect:["auto","square","video",fn]}],container:["container"],columns:[{columns:[Wu]}],"break-after":[{"break-after":q()}],"break-before":[{"break-before":q()}],"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:[...de(),fn]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:V()}],"overscroll-x":[{"overscroll-x":V()}],"overscroll-y":[{"overscroll-y":V()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[S]}],"inset-x":[{"inset-x":[S]}],"inset-y":[{"inset-y":[S]}],start:[{start:[S]}],end:[{end:[S]}],top:[{top:[S]}],right:[{right:[S]}],bottom:[{bottom:[S]}],left:[{left:[S]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ny,fn]}],basis:[{basis:j()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",fn]}],grow:[{grow:K()}],shrink:[{shrink:K()}],order:[{order:["first","last","none",ny,fn]}],"grid-cols":[{"grid-cols":[ry]}],"col-start-end":[{col:["auto",{span:["full",ny,fn]},fn]}],"col-start":[{"col-start":J()}],"col-end":[{"col-end":J()}],"grid-rows":[{"grid-rows":[ry]}],"row-start-end":[{row:["auto",{span:[ny,fn]},fn]}],"row-start":[{"row-start":J()}],"row-end":[{"row-end":J()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",fn]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",fn]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...B()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...B(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...B(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",fn,e]}],"min-w":[{"min-w":[fn,e,"min","max","fit"]}],"max-w":[{"max-w":[fn,e,"none","full","min","max","fit","prose",{screen:[Wu]},Wu]}],h:[{h:[fn,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[fn,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[fn,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Wu,Gu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fE]}],"font-family":[{font:[ry]}],"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-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",fn]}],"line-clamp":[{"line-clamp":["none",Zm,fE]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_c,fn]}],"list-image":[{"list-image":["none",fn]}],"list-style-type":[{list:["none","disc","decimal",fn]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_c,Gu]}],"underline-offset":[{"underline-offset":["auto",_c,fn]}],"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:H()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fn]}],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",fn]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...de(),q7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",X7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Y7]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],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":[b]}],"border-style":[{border:[...oe(),"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":[b]}],"divide-style":[{divide:oe()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[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:["",...oe()]}],"outline-offset":[{"outline-offset":[_c,fn]}],"outline-w":[{outline:[_c,Gu]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[_c,Gu]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Wu,Z7]}],"shadow-color":[{shadow:[ry]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...he(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":he()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Wu,fn]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[T]}],sepia:[{sepia:[O]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[T]}],"backdrop-sepia":[{"backdrop-sepia":[O]}],"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",fn]}],duration:[{duration:$()}],ease:[{ease:["linear","in","out","in-out",fn]}],delay:[{delay:$()}],animate:[{animate:["none","spin","ping","pulse","bounce",fn]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[ny,fn]}],"translate-x":[{"translate-x":[F]}],"translate-y":[{"translate-y":[F]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",fn]}],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",fn]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":H()}],"scroll-mx":[{"scroll-mx":H()}],"scroll-my":[{"scroll-my":H()}],"scroll-ms":[{"scroll-ms":H()}],"scroll-me":[{"scroll-me":H()}],"scroll-mt":[{"scroll-mt":H()}],"scroll-mr":[{"scroll-mr":H()}],"scroll-mb":[{"scroll-mb":H()}],"scroll-ml":[{"scroll-ml":H()}],"scroll-p":[{"scroll-p":H()}],"scroll-px":[{"scroll-px":H()}],"scroll-py":[{"scroll-py":H()}],"scroll-ps":[{"scroll-ps":H()}],"scroll-pe":[{"scroll-pe":H()}],"scroll-pt":[{"scroll-pt":H()}],"scroll-pr":[{"scroll-pr":H()}],"scroll-pb":[{"scroll-pb":H()}],"scroll-pl":[{"scroll-pl":H()}],"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",fn]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[_c,Gu,fE]}],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"]}}},nX=U7(tX);function nt(...t){return nX(er(t))}function wg(t){return t?t.replace(/127\.0\.0\.1|localhost/g,"192.168.178.151"):""}const YF=["fast","heavy","coder","vision","scout"],rX={fast:"bg-cyan-500/15 text-cyan-400 border-cyan-500/25",heavy:"bg-amber-500/15 text-amber-400 border-amber-500/25",coder:"bg-violet-500/15 text-violet-400 border-violet-500/25",vision:"bg-pink-500/15 text-pink-400 border-pink-500/25",scout:"bg-teal-500/15 text-teal-400 border-teal-500/25",hermes:"bg-indigo-500/15 text-indigo-400 border-indigo-500/25"},CP=t=>t&&rX[t]||"bg-slate-500/15 text-slate-300 border-slate-500/25";function iX({fit:t}){const e={perfect:"bg-emerald-500/15 text-emerald-400 border border-emerald-500/20",marginal:"bg-amber-500/15 text-amber-400 border border-amber-500/20",too_tight:"bg-red-500/15 text-red-400 border border-red-500/20"}[t.level];return v.jsxs("span",{className:nt("rounded px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wider font-mono",e),children:[t.text," • ",t.req_gb," GB RAM"]})}function TI(t){const e=t.toLowerCase();return e.includes("qwen")?{name:"Qwen",color:"bg-purple-500/20 text-purple-300 border-purple-500/30",initial:"Q"}:e.includes("gemma")?{name:"Gemma",color:"bg-blue-500/20 text-blue-300 border-blue-500/30",initial:"G"}:e.includes("llama")?{name:"Llama",color:"bg-red-500/20 text-red-300 border-red-500/30",initial:"🦙"}:e.includes("mistral")||e.includes("mixtral")?{name:"Mistral",color:"bg-orange-500/20 text-orange-300 border-orange-500/30",initial:"M"}:e.includes("deepseek")?{name:"DeepSeek",color:"bg-cyan-500/20 text-cyan-300 border-cyan-500/30",initial:"D"}:e.includes("hermes")||e.includes("nous")?{name:"Hermes",color:"bg-amber-500/20 text-amber-300 border-amber-500/30",initial:"H"}:e.includes("phi")?{name:"Phi",color:"bg-emerald-500/20 text-emerald-300 border-emerald-500/30",initial:"Φ"}:{name:"Other",color:"bg-slate-500/20 text-slate-300 border-slate-500/30",initial:"AI"}}function sX(){const{data:t}=qh(2e3),{data:e}=MP(2e3),n=(t==null?void 0:t.models)??[],r=(t==null?void 0:t.running)??[],i=n.filter(l=>r.includes(l.name)),s=R.useRef(null),[o,a]=R.useState(!1);return R.useEffect(()=>{if(!e)return;const l=e.total_tokens;if(s.current!==null&&l>s.current){a(!0);const c=setTimeout(()=>a(!1),4e3);return s.current=l,()=>clearTimeout(c)}s.current=l},[e==null?void 0:e.total_tokens]),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(i0,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Aktive Modelle (Live)"})]}),v.jsxs("span",{className:nt("flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-wider font-mono px-2 py-0.5 rounded-full border transition-colors",o?"bg-emerald-500/10 text-emerald-400 border-emerald-500/30":"bg-background/30 text-muted-foreground/70 border-border/40"),children:[o?v.jsx(xh,{className:"h-3 w-3 animate-pulse"}):v.jsx(X8,{className:"h-3 w-3"}),o?"Inferenz aktiv":"Idle"]})]}),i.length===0?v.jsx("div",{className:"flex items-center justify-center gap-2 h-20 text-xs text-muted-foreground/70 italic",children:"Kein Modell geladen — Auto-Swap lädt bei Anfrage."}):v.jsx("div",{className:"grid gap-2",children:i.map(l=>{var c;return v.jsxs("div",{className:"flex items-center justify-between gap-2 p-3 rounded-xl bg-emerald-500/5 border border-emerald-500/20",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[l.role&&v.jsx("span",{className:nt("text-[8px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",CP(l.role)),children:l.role}),v.jsx("span",{className:"text-xs font-semibold font-mono text-foreground truncate",children:(c=l.name.split("/").pop())==null?void 0:c.replace(/\.gguf$/i,"")})]}),v.jsxs("div",{className:"text-[9px] font-mono text-muted-foreground/70 mt-0.5",children:[Ho(l.size_bytes)," im Unified-RAM"]})]}),v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono shrink-0",children:[v.jsx("span",{className:nt("h-1.5 w-1.5 rounded-full bg-emerald-500",o&&"animate-pulse")})," warm"]})]},l.name)})})]})}let HT=[],VT=[];const GT=new Set,ZF=()=>GT.forEach(t=>t());function QF(t){return GT.add(t),()=>{GT.delete(t)}}function oX(t){HT=[...HT,t].slice(-40),ZF()}function aX(t){VT=[...VT,t].slice(-40),ZF()}const lX=()=>R.useSyncExternalStore(QF,()=>HT),cX=()=>R.useSyncExternalStore(QF,()=>VT);function uX(){const{data:t,dataUpdatedAt:e}=Y1(3e3),{data:n,dataUpdatedAt:r}=MP(3e3),i=R.useRef(null);R.useEffect(()=>{var s,o,a,l;t&&oX({t:Date.now(),cpu:((s=t.cpu)==null?void 0:s.percent)??0,ram:((o=t.ram)==null?void 0:o.percent)??0,gpu:((a=t.gpu)==null?void 0:a.busy_percent)??null,disk:((l=t.disk)==null?void 0:l.percent)??null})},[e]),R.useEffect(()=>{if(!n)return;const s=Date.now(),o=n.prompt_tokens,a=n.completion_tokens;if(i.current){const l=Math.max((s-i.current.t)/1e3,.001);aX({t:s,prompt:Math.max(0,(o-i.current.p)/l),completion:Math.max(0,(a-i.current.c)/l)})}i.current={p:o,c:a,t:s}},[r])}function dX(){const{data:t,error:e}=Y1(3e3),n=lX();return{sys:t,hist:n,error:e}}var fX=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function PP(t){if(typeof t!="string")return!1;var e=fX;return e.includes(t)}var hX=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],pX=new Set(hX);function JF(t){return typeof t!="string"?!1:pX.has(t)}function e5(t){return typeof t=="string"&&t.startsWith("data-")}function Fa(t){if(typeof t!="object"||t===null)return{};var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(JF(n)||e5(n))&&(e[n]=t[n]);return e}function Z1(t){if(t==null)return null;if(R.isValidElement(t)&&typeof t.props=="object"&&t.props!==null){var e=t.props;return Fa(e)}return typeof t=="object"&&!Array.isArray(t)?Fa(t):null}function Ko(t){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(JF(n)||e5(n)||PP(n))&&(e[n]=t[n]);return e}function mX(t){return t==null?null:R.isValidElement(t)?Ko(t.props):typeof t=="object"&&!Array.isArray(t)?Ko(t):null}var gX=["children","width","height","viewBox","className","style","title","desc"];function WT(){return WT=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.width,i=t.height,s=t.viewBox,o=t.className,a=t.style,l=t.title,c=t.desc,d=vX(t,gX),f=s||{width:r,height:i,x:0,y:0},m=er("recharts-surface",o);return R.createElement("svg",WT({},Ko(d),{className:m,width:r,height:i,style:a,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:e}),R.createElement("title",null,l),R.createElement("desc",null,c),n)}),xX=["children","className"];function $T(){return $T=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=t.children,r=t.className,i=bX(t,xX),s=er("recharts-layer",r);return R.createElement("g",$T({className:s},Ko(i),{ref:e}),n)}),wX=R.createContext(null);function Mr(t){return function(){return t}}const XT=Math.PI,qT=2*XT,Gf=1e-6,SX=qT-Gf;function n5(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return n5;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iGf)if(!(Math.abs(f*l-c*d)>Gf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let y=r-o,x=i-a,S=l*l+c*c,w=y*y+x*x,b=Math.sqrt(S),E=Math.sqrt(m),T=s*Math.tan((XT-Math.acos((S+m-w)/(2*b*E)))/2),C=T/E,O=T/b;Math.abs(C-1)>Gf&&this._append`L${e+C*d},${n+C*f}`,this._append`A${s},${s},0,0,${+(f*y>d*x)},${this._x1=e+O*l},${this._y1=n+O*c}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),c=e+a,d=n+l,f=1^o,m=o?i-s:s-i;this._x1===null?this._append`M${c},${d}`:(Math.abs(this._x1-c)>Gf||Math.abs(this._y1-d)>Gf)&&this._append`L${c},${d}`,r&&(m<0&&(m=m%qT+qT),m>SX?this._append`A${r},${r},0,1,${f},${e-a},${n-l}A${r},${r},0,1,${f},${this._x1=c},${this._y1=d}`:m>Gf&&this._append`A${r},${r},0,${+(m>=XT)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function r5(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new EX(e)}function RP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function i5(t){this._context=t}i5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Q1(t){return new i5(t)}function s5(t){return t[0]}function o5(t){return t[1]}function a5(t,e){var n=Mr(!0),r=null,i=Q1,s=null,o=r5(a);t=typeof t=="function"?t:t===void 0?s5:Mr(t),e=typeof e=="function"?e:e===void 0?o5:Mr(e);function a(l){var c,d=(l=RP(l)).length,f,m=!1,y;for(r==null&&(s=i(y=o())),c=0;c<=d;++c)!(c=y;--x)a.point(T[x],C[x]);a.lineEnd(),a.areaEnd()}b&&(T[m]=+t(w,m,f),C[m]=+e(w,m,f),a.point(r?+r(w,m,f):T[m],n?+n(w,m,f):C[m]))}if(E)return a=null,E+""||null}function d(){return a5().defined(i).curve(o).context(s)}return c.x=function(f){return arguments.length?(t=typeof f=="function"?f:Mr(+f),r=null,c):t},c.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Mr(+f),c):t},c.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Mr(+f),c):r},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:Mr(+f),n=null,c):e},c.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Mr(+f),c):e},c.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Mr(+f),c):n},c.lineX0=c.lineY0=function(){return d().x(t).y(e)},c.lineY1=function(){return d().x(t).y(n)},c.lineX1=function(){return d().x(r).y(e)},c.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Mr(!!f),c):i},c.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),c):o},c.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),c):s},c}class l5{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function AX(t){return new l5(t,!0)}function TX(t){return new l5(t,!1)}function rw(){}function iw(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function c5(t){this._context=t}c5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:iw(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function CX(t){return new c5(t)}function u5(t){this._context=t}u5.prototype={areaStart:rw,areaEnd:rw,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function PX(t){return new u5(t)}function d5(t){this._context=t}d5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:iw(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function RX(t){return new d5(t)}function f5(t){this._context=t}f5.prototype={areaStart:rw,areaEnd:rw,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function NX(t){return new f5(t)}function CI(t){return t<0?-1:1}function PI(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(CI(s)+CI(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function RI(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function hE(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function sw(t){this._context=t}sw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:hE(this,this._t0,RI(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,hE(this,RI(this,n=PI(this,t,e)),n);break;default:hE(this,this._t0,n=PI(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function h5(t){this._context=new p5(t)}(h5.prototype=Object.create(sw.prototype)).point=function(t,e){sw.prototype.point.call(this,e,t)};function p5(t){this._context=t}p5.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function IX(t){return new sw(t)}function kX(t){return new h5(t)}function m5(t){this._context=t}m5.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=NI(t),i=NI(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function LX(t){return new J1(t,.5)}function DX(t){return new J1(t,0)}function UX(t){return new J1(t,1)}function Ph(t,e){if((o=t.length)>1)for(var n=1,r,i,s=t[e[0]],o,a=s.length;n=0;)n[e]=e;return n}function jX(t,e){return t[e]}function FX(t){const e=[];return e.key=t,e}function zX(){var t=Mr([]),e=KT,n=Ph,r=jX;function i(s){var o=Array.from(t.apply(this,arguments),FX),a,l=o.length,c=-1,d;for(const f of s)for(a=0,++c;a0){for(var n,r,i=0,s=t[0].length,o;i0){for(var n=0,r=t[e[0]],i,s=r.length;n0)||!((s=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,s,o;r1&&arguments[1]!==void 0?arguments[1]:WX,n=10**e,r=Math.round(t*n)/n;return Object.is(r,-0)?0:r}function Di(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r{var a=n[o-1];return typeof a=="string"?i+a+s:a!==void 0?i+xd(a)+s:i+s},"")}var Wo=t=>t===0?0:t>0?1:-1,Nl=t=>typeof t=="number"&&t!=+t,Rh=t=>typeof t=="string"&&t.length>1&&t.indexOf("%")===t.length-1,Nt=t=>(typeof t=="number"||t instanceof Number)&&!Nl(t),Il=t=>Nt(t)||typeof t=="string",$X=0,l0=t=>{var e=++$X;return"".concat(t||"").concat(e)},Ad=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Nt(e)&&typeof e!="string")return r;var s;if(Rh(e)){if(n==null)return r;var o=e.indexOf("%");s=n*parseFloat(e.slice(0,o))/100}else s=+e;return Nl(s)&&(s=r),i&&n!=null&&s>n&&(s=n),s},y5=t=>{if(!Array.isArray(t))return!1;for(var e=t.length,n={},r=0;rr&&(typeof e=="function"?e(r):Kh(r,e))===n)}var Hi=t=>t===null||typeof t>"u",kP=t=>Hi(t)?t:"".concat(t.charAt(0).toUpperCase()).concat(t.slice(1));function Ks(t){return t!=null}function Bg(){}var b5=t=>"radius"in t&&"startAngle"in t&&"endAngle"in t,OP=(t,e)=>{if(!t||typeof t=="function"||typeof t=="boolean")return null;var n=t;if(R.isValidElement(t)&&(n=t.props),typeof n!="object"&&typeof n!="function")return null;var r={};return Object.keys(n).forEach(i=>{PP(i)&&typeof n[i]=="function"&&(r[i]=(s=>n[i](n,s)))}),r},XX=(t,e,n)=>r=>(t(e,n,r),null),qX=(t,e,n)=>{if(t===null||typeof t!="object"&&typeof t!="function")return null;var r=null;return Object.keys(t).forEach(i=>{var s=t[i];PP(i)&&typeof s=="function"&&(r||(r={}),r[i]=XX(s,e,n))}),r};function II(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function KX(t){for(var e=1;e(o[a]===void 0&&r[a]!==void 0&&(o[a]=r[a]),o),n);return s}function JX(t,e){const n=new Map;for(let r=0;rObject.prototype.propertyIsEnumerable.call(t,e))}function LP(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const iq="[object RegExp]",w5="[object String]",S5="[object Number]",M5="[object Boolean]",E5="[object Arguments]",sq="[object Symbol]",oq="[object Date]",aq="[object Map]",lq="[object Set]",cq="[object Array]",uq="[object ArrayBuffer]",dq="[object Object]",fq="[object DataView]",hq="[object Uint8Array]",pq="[object Uint8ClampedArray]",mq="[object Uint16Array]",gq="[object Uint32Array]",vq="[object Int8Array]",yq="[object Int16Array]",xq="[object Int32Array]",bq="[object Float32Array]",_q="[object Float64Array]",kI=typeof globalThis=="object"&&globalThis||typeof window=="object"&&window||typeof self=="object"&&self||typeof global=="object"&&global||(function(){return this})();function wq(t){return typeof kI.Buffer<"u"&&kI.Buffer.isBuffer(t)}function Sq(t,e){return Jf(t,void 0,t,new Map,e)}function Jf(t,e,n,r=new Map,i=void 0){const s=i==null?void 0:i(t,e,n,r);if(s!==void 0)return s;if(ZT(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a{}):QT(t,e,function r(i,s,o,a,l,c){const d=n(i,s,o,a,l,c);return d!==void 0?!!d:QT(i,s,r,c,!1)},new Map,!0)}function QT(t,e,n,r,i=!1){if(e===t)return!0;switch(typeof e){case"object":return Aq(t,e,n,r);case"function":return Object.keys(e).length>0?QT(t,{...e},n,r,i):F_(t,e);default:return A5(t)&&i?typeof e=="string"?e==="":!0:F_(t,e)}}function Aq(t,e,n,r){if(e==null)return!0;if(Array.isArray(e))return C5(t,e,n,r);if(e instanceof Map)return Tq(t,e,n,r);if(e instanceof Set)return Cq(t,e,n,r);const i=Object.keys(e);if(t==null||ZT(t))return i.length===0;if(i.length===0)return!0;if(r!=null&&r.has(e))return r.get(e)===t;r==null||r.set(e,t);try{for(let s=0;s{})}function Pq(t){return t=Eq(t),e=>P5(e,t)}function Rq(t,e){return Sq(t,(n,r,i,s)=>{if(typeof t=="object"){if(LP(t)==="[object Object]"&&typeof t.constructor!="function"){const o={};return s.set(t,o),Ia(o,t,i,s),o}switch(Object.prototype.toString.call(t)){case S5:case w5:case M5:{const o=new t.constructor(t==null?void 0:t.valueOf());return Ia(o,t),o}case E5:{const o={};return Ia(o,t),o.length=t.length,o[Symbol.iterator]=t[Symbol.iterator],o}default:return}}})}function Nq(t){return Rq(t)}const Iq=/^(?:0|[1-9]\d*)$/;function R5(t,e=Number.MAX_SAFE_INTEGER){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t=0}function N5(t){return t!=null&&typeof t!="function"&&Uq(t.length)}function jq(t){return typeof t=="object"&&t!==null}function Fq(t){return jq(t)&&N5(t)}function OI(t,e=_5){return Fq(t)?JX(Array.from(t),eq(Dq(e),1)):[]}function zq(t,e,n){return e===!0?OI(t,n):typeof e=="function"?OI(t,e):t}var pE={exports:{}},mE={},gE={exports:{}},vE={};/** + * @license React + * use-sync-external-store-shim.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var LI;function Bq(){if(LI)return vE;LI=1;var t=Wh();function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(f,m){var y=m(),x=r({inst:{value:y,getSnapshot:m}}),S=x[0].inst,w=x[1];return s(function(){S.value=y,S.getSnapshot=m,l(S)&&w({inst:S})},[f,y,m]),i(function(){return l(S)&&w({inst:S}),f(function(){l(S)&&w({inst:S})})},[f]),o(y),y}function l(f){var m=f.getSnapshot;f=f.value;try{var y=m();return!n(f,y)}catch{return!0}}function c(f,m){return m()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return vE.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:d,vE}var DI;function Hq(){return DI||(DI=1,gE.exports=Bq()),gE.exports}/** + * @license React + * use-sync-external-store-shim/with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var UI;function Vq(){if(UI)return mE;UI=1;var t=Wh(),e=Hq();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,l=t.useDebugValue;return mE.useSyncExternalStoreWithSelector=function(c,d,f,m,y){var x=s(null);if(x.current===null){var S={hasValue:!1,value:null};x.current=S}else S=x.current;x=a(function(){function b(N){if(!E){if(E=!0,T=N,N=m(N),y!==void 0&&S.hasValue){var D=S.value;if(y(D,N))return C=D}return C=N}if(D=C,r(T,N))return D;var F=m(N);return y!==void 0&&y(D,F)?(T=N,D):(T=N,C=F)}var E=!1,T,C,O=f===void 0?null:f;return[function(){return b(d())},O===null?void 0:function(){return b(O())}]},[d,f,m,y]);var w=i(c,x[0],x[1]);return o(function(){S.hasValue=!0,S.value=w},[w]),l(w),w},mE}var jI;function Gq(){return jI||(jI=1,pE.exports=Vq()),pE.exports}var Wq=Gq(),DP=R.createContext(null),$q=t=>t,Wr=()=>{var t=R.useContext(DP);return t?t.store.dispatch:$q},z_=()=>{},Xq=()=>z_,qq=(t,e)=>t===e;function zt(t){var e=R.useContext(DP),n=R.useMemo(()=>e?r=>{if(r!=null)return t(r)}:z_,[e,t]);return Wq.useSyncExternalStoreWithSelector(e?e.subscription.addNestedSub:Xq,e?e.store.getState:z_,e?e.store.getState:z_,n,qq)}function Kq(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Yq(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var FI=t=>Array.isArray(t)?t:[t];function Zq(t){const e=Array.isArray(t[0])?t[0]:t;return Yq(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Qq(t,e){const n=[],{length:r}=t;for(let i=0;itypeof WeakRef>"u"?Jq:WeakRef,I5=eK(),tK=0,zI=1;function _b(){return{s:tK,v:void 0,o:null,p:null}}function nK(t){return t instanceof I5?t.deref():t}function k5(t,e={}){let n=_b();const{resultEqualityCheck:r}=e;let i,s=0;function o(){let a=n;const{length:l}=arguments;for(let f=0,m=l;f{n=_b(),o.resetResultsCount()},o.resultsCount=()=>s,o.resetResultsCount=()=>{s=0},o}function rK(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...i)=>{let s=0,o=0,a,l={},c=i.pop();typeof c=="object"&&(l=c,c=i.pop()),Kq(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const d={...n,...l},{memoize:f,memoizeOptions:m=[],argsMemoize:y=k5,argsMemoizeOptions:x=[]}=d,S=FI(m),w=FI(x),b=Zq(i),E=f(function(){return s++,c.apply(null,arguments)},...S),T=y(function(){o++;const O=Qq(b,arguments);return a=E.apply(null,O),a},...w);return Object.assign(T,{resultFunc:c,memoizedResultFunc:E,dependencies:b,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var Oe=rK(k5);function iK(t,e=1){const n=[],r=Math.floor(e),i=(s,o)=>{for(let a=0;a{if(t!==e){const r=BI(t),i=BI(e);if(r===i&&r===0){if(te)return n==="desc"?-1:1}return n==="desc"?i-r:r-i}return 0};function O5(t){return typeof t=="symbol"||t instanceof Symbol}const oK=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,aK=/^\w*$/;function lK(t,e){return Array.isArray(t)?!1:typeof t=="number"||typeof t=="boolean"||t==null||O5(t)?!0:typeof t=="string"&&(aK.test(t)||!oK.test(t))||e!=null}function cK(t,e,n,r){if(t==null)return[];n=n,Array.isArray(t)||(t=Object.values(t)),Array.isArray(e)||(e=e==null?[null]:[e]),e.length===0&&(e=[null]),Array.isArray(n)||(n=n==null?[]:[n]),n=n.map(a=>String(a));const i=(a,l)=>{let c=a;for(let d=0;dl==null||a==null?l:typeof a=="object"&&"key"in a?Object.hasOwn(l,a.key)?l[a.key]:i(l,a.path):typeof a=="function"?a(l):Array.isArray(a)?i(l,a):typeof l=="object"?l[a]:l,o=e.map(a=>(Array.isArray(a)&&a.length===1&&(a=a[0]),a==null||typeof a=="function"||Array.isArray(a)||lK(a)?a:{key:a,path:IP(a)}));return t.map(a=>({original:a,criteria:o.map(l=>s(l,a))})).slice().sort((a,l)=>{for(let c=0;ca.original)}function eS(t,...e){const n=e.length;return n>1&&JT(t,e[0],e[1])?e=[]:n>2&&JT(e[0],e[1],e[2])&&(e=[e[0]]),cK(t,iK(e),["asc"])}var L5=t=>t.legend.settings,uK=t=>t.legend.size,dK=t=>t.legend.payload;Oe([dK,L5],(t,e)=>{var n=e.itemSorter,r=t.flat(1);return n?eS(r,n):r});function fK(t,e){return gK(t)||mK(t,e)||pK(t,e)||hK()}function hK(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pK(t,e){if(t){if(typeof t=="string")return HI(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?HI(t,e):void 0}}function HI(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nwb||Math.abs(t.left-e.left)>wb||Math.abs(t.top-e.top)>wb||Math.abs(t.width-e.width)>wb}function GI(t){var e=t.getBoundingClientRect();return{height:e.height,left:e.left,top:e.top,width:e.width}}function vK(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=R.useState({height:0,left:0,top:0,width:0}),n=fK(e,2),r=n[0],i=n[1],s=R.useRef(null),o=R.useRef(r);o.current=r;var a=R.useCallback(l=>{if(s.current!=null&&(s.current.disconnect(),s.current=null),l!=null){var c=GI(l);if(VI(c,o.current)&&i(c),typeof ResizeObserver<"u"){var d=new ResizeObserver(()=>{var f=GI(l);VI(f,o.current)&&i(f)});d.observe(l),s.current=d}}},[...t]);return R.useEffect(()=>()=>{var l;(l=s.current)===null||l===void 0||l.disconnect()},[]),[r,a]}function Li(t){return`Minified Redux error #${t}; visit https://redux.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var yK=typeof Symbol=="function"&&Symbol.observable||"@@observable",WI=yK,yE=()=>Math.random().toString(36).substring(7).split("").join("."),xK={INIT:`@@redux/INIT${yE()}`,REPLACE:`@@redux/REPLACE${yE()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yE()}`},ow=xK;function UP(t){if(typeof t!="object"||t===null)return!1;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e||Object.getPrototypeOf(t)===null}function D5(t,e,n){if(typeof t!="function")throw new Error(Li(2));if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(Li(0));if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Li(1));return n(D5)(t,e)}let r=t,i=e,s=new Map,o=s,a=0,l=!1;function c(){o===s&&(o=new Map,s.forEach((w,b)=>{o.set(b,w)}))}function d(){if(l)throw new Error(Li(3));return i}function f(w){if(typeof w!="function")throw new Error(Li(4));if(l)throw new Error(Li(5));let b=!0;c();const E=a++;return o.set(E,w),function(){if(b){if(l)throw new Error(Li(6));b=!1,c(),o.delete(E),s=null}}}function m(w){if(!UP(w))throw new Error(Li(7));if(typeof w.type>"u")throw new Error(Li(8));if(typeof w.type!="string")throw new Error(Li(17));if(l)throw new Error(Li(9));try{l=!0,i=r(i,w)}finally{l=!1}return(s=o).forEach(E=>{E()}),w}function y(w){if(typeof w!="function")throw new Error(Li(10));r=w,m({type:ow.REPLACE})}function x(){const w=f;return{subscribe(b){if(typeof b!="object"||b===null)throw new Error(Li(11));function E(){const C=b;C.next&&C.next(d())}return E(),{unsubscribe:w(E)}},[WI](){return this}}}return m({type:ow.INIT}),{dispatch:m,subscribe:f,getState:d,replaceReducer:y,[WI]:x}}function bK(t){Object.keys(t).forEach(e=>{const n=t[e];if(typeof n(void 0,{type:ow.INIT})>"u")throw new Error(Li(12));if(typeof n(void 0,{type:ow.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Li(13))})}function U5(t){const e=Object.keys(t),n={};for(let s=0;s"u")throw a&&a.type,new Error(Li(14));c[f]=x,l=l||x!==y}return l=l||r.length!==Object.keys(o).length,l?c:o}}function aw(...t){return t.length===0?e=>e:t.length===1?t[0]:t.reduce((e,n)=>(...r)=>e(n(...r)))}function _K(...t){return e=>(n,r)=>{const i=e(n,r);let s=()=>{throw new Error(Li(15))};const o={getState:i.getState,dispatch:(l,...c)=>s(l,...c)},a=t.map(l=>l(o));return s=aw(...a)(i.dispatch),{...i,dispatch:s}}}function j5(t){return UP(t)&&"type"in t&&typeof t.type=="string"}var F5=Symbol.for("immer-nothing"),$I=Symbol.for("immer-draftable"),Cs=Symbol.for("immer-state");function Da(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var _o=Object,Sg=_o.getPrototypeOf,lw="constructor",tS="prototype",eC="configurable",cw="enumerable",B_="writable",c0="value",Kc=t=>!!t&&!!t[Cs];function za(t){var e;return t?z5(t)||rS(t)||!!t[$I]||!!((e=t[lw])!=null&&e[$I])||iS(t)||sS(t):!1}var wK=_o[tS][lw].toString(),XI=new WeakMap;function z5(t){if(!t||!jP(t))return!1;const e=Sg(t);if(e===null||e===_o[tS])return!0;const n=_o.hasOwnProperty.call(e,lw)&&e[lw];if(n===Object)return!0;if(!jm(n))return!1;let r=XI.get(n);return r===void 0&&(r=Function.toString.call(n),XI.set(n,r)),r===wK}function nS(t,e,n=!0){W0(t)===0?(n?Reflect.ownKeys(t):_o.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function W0(t){const e=t[Cs];return e?e.type_:rS(t)?1:iS(t)?2:sS(t)?3:0}var qI=(t,e,n=W0(t))=>n===2?t.has(e):_o[tS].hasOwnProperty.call(t,e),tC=(t,e,n=W0(t))=>n===2?t.get(e):t[e],uw=(t,e,n,r=W0(t))=>{r===2?t.set(e,n):r===3?t.add(n):t[e]=n};function SK(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}var rS=Array.isArray,iS=t=>t instanceof Map,sS=t=>t instanceof Set,jP=t=>typeof t=="object",jm=t=>typeof t=="function",xE=t=>typeof t=="boolean";function MK(t){const e=+t;return Number.isInteger(e)&&String(e)===t}var Rc=t=>t.copy_||t.base_,FP=t=>t.modified_?t.copy_:t.base_;function nC(t,e){if(iS(t))return new Map(t);if(sS(t))return new Set(t);if(rS(t))return Array[tS].slice.call(t);const n=z5(t);if(e===!0||e==="class_only"&&!n){const r=_o.getOwnPropertyDescriptors(t);delete r[Cs];let i=Reflect.ownKeys(r);for(let s=0;s1&&_o.defineProperties(t,{set:Sb,add:Sb,clear:Sb,delete:Sb}),_o.freeze(t),e&&nS(t,(n,r)=>{zP(r,!0)},!1)),t}function EK(){Da(2)}var Sb={[c0]:EK};function oS(t){return t===null||!jP(t)?!0:_o.isFrozen(t)}var dw="MapSet",rC="Patches",KI="ArrayMethods",B5={};function Nh(t){const e=B5[t];return e||Da(0,t),e}var YI=t=>!!B5[t],u0,H5=()=>u0,AK=(t,e)=>({drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:YI(dw)?Nh(dw):void 0,arrayMethodsPlugin_:YI(KI)?Nh(KI):void 0});function ZI(t,e){e&&(t.patchPlugin_=Nh(rC),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function iC(t){sC(t),t.drafts_.forEach(TK),t.drafts_=null}function sC(t){t===u0&&(u0=t.parent_)}var QI=t=>u0=AK(u0,t);function TK(t){const e=t[Cs];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function JI(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];if(t!==void 0&&t!==n){n[Cs].modified_&&(iC(e),Da(4)),za(t)&&(t=ek(e,t));const{patchPlugin_:i}=e;i&&i.generateReplacementPatches_(n[Cs].base_,t,e)}else t=ek(e,n);return CK(e,t,!0),iC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==F5?t:void 0}function ek(t,e){if(oS(e))return e;const n=e[Cs];if(!n)return fw(e,t.handledSet_,t);if(!aS(n,t))return e;if(!n.modified_)return n.base_;if(!n.finalized_){const{callbacks_:r}=n;if(r)for(;r.length>0;)r.pop()(t);W5(n,t)}return n.copy_}function CK(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&zP(e,n)}function V5(t){t.finalized_=!0,t.scope_.unfinalizedDrafts_--}var aS=(t,e)=>t.scope_===e,PK=[];function G5(t,e,n,r){const i=Rc(t),s=t.type_;if(r!==void 0&&tC(i,r,s)===e){uw(i,r,n,s);return}if(!t.draftLocations_){const a=t.draftLocations_=new Map;nS(i,(l,c)=>{if(Kc(c)){const d=a.get(c)||[];d.push(l),a.set(c,d)}})}const o=t.draftLocations_.get(e)??PK;for(const a of o)uw(i,a,n,s)}function RK(t,e,n){t.callbacks_.push(function(i){var a;const s=e;if(!s||!aS(s,i))return;(a=i.mapSetPlugin_)==null||a.fixSetContents(s);const o=FP(s);G5(t,s.draft_??s,o,n),W5(s,i)})}function W5(t,e){var r;if(t.modified_&&!t.finalized_&&(t.type_===3||t.type_===1&&t.allIndicesReassigned_||(((r=t.assigned_)==null?void 0:r.size)??0)>0)){const{patchPlugin_:i}=e;if(i){const s=i.getPath(t);s&&i.generatePatches_(t,s,e)}V5(t)}}function NK(t,e,n){const{scope_:r}=t;if(Kc(n)){const i=n[Cs];aS(i,r)&&i.callbacks_.push(function(){H_(t);const o=FP(i);G5(t,n,o,e)})}else za(n)&&t.callbacks_.push(function(){const s=Rc(t);t.type_===3?s.has(n)&&fw(n,r.handledSet_,r):tC(s,e,t.type_)===n&&r.drafts_.length>1&&(t.assigned_.get(e)??!1)===!0&&t.copy_&&fw(tC(t.copy_,e,t.type_),r.handledSet_,r)})}function fw(t,e,n){return!n.immer_.autoFreeze_&&n.unfinalizedDrafts_<1||Kc(t)||e.has(t)||!za(t)||oS(t)||(e.add(t),nS(t,(r,i)=>{if(Kc(i)){const s=i[Cs];if(aS(s,n)){const o=FP(s);uw(t,r,o,t.type_),V5(s)}}else za(i)&&fw(i,e,n)})),t}function IK(t,e){const n=rS(t),r={type_:n?1:0,scope_:e?e.scope_:H5(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=r,s=hw;n&&(i=[r],s=d0);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,[a,r]}var hw={get(t,e){if(e===Cs)return t;let n=t.scope_.arrayMethodsPlugin_;const r=t.type_===1&&typeof e=="string";if(r&&n!=null&&n.isArrayOperationMethod(e))return n.createMethodInterceptor(t,e);const i=Rc(t);if(!qI(i,e,t.type_))return kK(t,i,e);const s=i[e];if(t.finalized_||!za(s)||r&&t.operationMethod&&(n!=null&&n.isMutatingArrayMethod(t.operationMethod))&&MK(e))return s;if(s===bE(t.base_,e)){H_(t);const o=t.type_===1?+e:e,a=aC(t.scope_,s,t,o);return t.copy_[o]=a}return s},has(t,e){return e in Rc(t)},ownKeys(t){return Reflect.ownKeys(Rc(t))},set(t,e,n){const r=$5(Rc(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=bE(Rc(t),e),s=i==null?void 0:i[Cs];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_.set(e,!1),!0;if(SK(n,i)&&(n!==void 0||qI(t.base_,e,t.type_)))return!0;H_(t),oC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_.set(e,!0),NK(t,e,n)),!0},deleteProperty(t,e){return H_(t),bE(t.base_,e)!==void 0||e in t.base_?(t.assigned_.set(e,!1),oC(t)):t.assigned_.delete(e),t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Rc(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{[B_]:!0,[eC]:t.type_!==1||e!=="length",[cw]:r[cw],[c0]:n[e]}},defineProperty(){Da(11)},getPrototypeOf(t){return Sg(t.base_)},setPrototypeOf(){Da(12)}},d0={};for(let t in hw){let e=hw[t];d0[t]=function(){const n=arguments;return n[0]=n[0][0],e.apply(this,n)}}d0.deleteProperty=function(t,e){return d0.set.call(this,t,e,void 0)};d0.set=function(t,e,n){return hw.set.call(this,t[0],e,n,t[0])};function bE(t,e){const n=t[Cs];return(n?Rc(n):t)[e]}function kK(t,e,n){var i;const r=$5(e,n);return r?c0 in r?r[c0]:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function $5(t,e){if(!(e in t))return;let n=Sg(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Sg(n)}}function oC(t){t.modified_||(t.modified_=!0,t.parent_&&oC(t.parent_))}function H_(t){t.copy_||(t.assigned_=new Map,t.copy_=nC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var OK=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(n,r,i)=>{if(jm(n)&&!jm(r)){const o=r;r=n;const a=this;return function(c=o,...d){return a.produce(c,f=>r.call(this,f,...d))}}jm(r)||Da(6),i!==void 0&&!jm(i)&&Da(7);let s;if(za(n)){const o=QI(this),a=aC(o,n,void 0);let l=!0;try{s=r(a),l=!1}finally{l?iC(o):sC(o)}return ZI(o,i),JI(s,o)}else if(!n||!jP(n)){if(s=r(n),s===void 0&&(s=n),s===F5&&(s=void 0),this.autoFreeze_&&zP(s,!0),i){const o=[],a=[];Nh(rC).generateReplacementPatches_(n,s,{patches_:o,inversePatches_:a}),i(o,a)}return s}else Da(1,n)},this.produceWithPatches=(n,r)=>{if(jm(n))return(a,...l)=>this.produceWithPatches(a,c=>n(c,...l));let i,s;return[this.produce(n,r,(a,l)=>{i=a,s=l}),i,s]},xE(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),xE(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),xE(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){za(e)||Da(8),Kc(e)&&(e=$o(e));const n=QI(this),r=aC(n,e,void 0);return r[Cs].isManual_=!0,sC(n),r}finishDraft(e,n){const r=e&&e[Cs];(!r||!r.isManual_)&&Da(9);const{scope_:i}=r;return ZI(i,n),JI(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let r;for(r=n.length-1;r>=0;r--){const s=n[r];if(s.path.length===0&&s.op==="replace"){e=s.value;break}}r>-1&&(n=n.slice(r+1));const i=Nh(rC).applyPatches_;return Kc(e)?i(e,n):this.produce(e,s=>i(s,n))}};function aC(t,e,n,r){const[i,s]=iS(e)?Nh(dw).proxyMap_(e,n):sS(e)?Nh(dw).proxySet_(e,n):IK(e,n);return((n==null?void 0:n.scope_)??H5()).drafts_.push(i),s.callbacks_=(n==null?void 0:n.callbacks_)??[],s.key_=r,n&&r!==void 0?RK(n,s,r):s.callbacks_.push(function(l){var d;(d=l.mapSetPlugin_)==null||d.fixSetContents(s);const{patchPlugin_:c}=l;s.modified_&&c&&c.generatePatches_(s,[],l)}),i}function $o(t){return Kc(t)||Da(10,t),X5(t)}function X5(t){if(!za(t)||oS(t))return t;const e=t[Cs];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=nC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=nC(t,!0);return nS(n,(i,s)=>{uw(n,i,X5(s))},r),e&&(e.finalized_=!1),n}var LK=new OK,q5=LK.produce;function K5(t){return({dispatch:n,getState:r})=>i=>s=>typeof s=="function"?s(n,r,t):i(s)}var DK=K5(),UK=K5,jK=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?aw:aw.apply(null,arguments)};function Eo(t,e){function n(...r){if(e){let i=e(...r);if(!i)throw new Error(So(0));return{type:t,payload:i.payload,..."meta"in i&&{meta:i.meta},..."error"in i&&{error:i.error}}}return{type:t,payload:r[0]}}return n.toString=()=>`${t}`,n.type=t,n.match=r=>j5(r)&&r.type===t,n}var Y5=class Dy extends Array{constructor(...e){super(...e),Object.setPrototypeOf(this,Dy.prototype)}static get[Symbol.species](){return Dy}concat(...e){return super.concat.apply(this,e)}prepend(...e){return e.length===1&&Array.isArray(e[0])?new Dy(...e[0].concat(this)):new Dy(...e.concat(this))}};function tk(t){return za(t)?q5(t,()=>{}):t}function Mb(t,e,n){return t.has(e)?t.get(e):t.set(e,n(e)).get(e)}function FK(t){return typeof t=="boolean"}var zK=()=>function(e){const{thunk:n=!0,immutableCheck:r=!0,serializableCheck:i=!0,actionCreatorCheck:s=!0}=e??{};let o=new Y5;return n&&(FK(n)?o.push(DK):o.push(UK(n.extraArgument))),o},Z5="RTK_autoBatch",sr=()=>t=>({payload:t,meta:{[Z5]:!0}}),nk=t=>e=>{setTimeout(e,t)},BK=(t,e)=>n=>{let r=!1;const i=()=>{r||(r=!0,cancelAnimationFrame(s),clearTimeout(o),n())},s=t(i),o=setTimeout(i,e)},Q5=(t={type:"raf"})=>e=>(...n)=>{const r=e(...n);let i=!0,s=!1,o=!1;const a=new Set,l=t.type==="tick"?queueMicrotask:t.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?BK(window.requestAnimationFrame,100):nk(10):t.type==="callback"?t.queueNotification:nk(t.timeout),c=()=>{o=!1,s&&(s=!1,a.forEach(d=>d()))};return Object.assign({},r,{subscribe(d){const f=()=>i&&d(),m=r.subscribe(f);return a.add(d),()=>{m(),a.delete(d)}},dispatch(d){var f;try{return i=!((f=d==null?void 0:d.meta)!=null&&f[Z5]),s=!i,s&&(o||(o=!0,l(c))),r.dispatch(d)}finally{i=!0}}})},HK=t=>function(n){const{autoBatch:r=!0}=n??{};let i=new Y5(t);return r&&i.push(Q5(typeof r=="object"?r:void 0)),i};function VK(t){const e=zK(),{reducer:n=void 0,middleware:r,devTools:i=!0,preloadedState:s=void 0,enhancers:o=void 0}=t||{};let a;if(typeof n=="function")a=n;else if(UP(n))a=U5(n);else throw new Error(So(1));let l;typeof r=="function"?l=r(e):l=e();let c=aw;i&&(c=jK({trace:!1,...typeof i=="object"&&i}));const d=_K(...l),f=HK(d);let m=typeof o=="function"?o(f):f();const y=c(...m);return D5(a,s,y)}function J5(t){const e={},n=[];let r;const i={addCase(s,o){const a=typeof s=="string"?s:s.type;if(!a)throw new Error(So(28));if(a in e)throw new Error(So(29));return e[a]=o,i},addAsyncThunk(s,o){return o.pending&&(e[s.pending.type]=o.pending),o.rejected&&(e[s.rejected.type]=o.rejected),o.fulfilled&&(e[s.fulfilled.type]=o.fulfilled),o.settled&&n.push({matcher:s.settled,reducer:o.settled}),i},addMatcher(s,o){return n.push({matcher:s,reducer:o}),i},addDefaultCase(s){return r=s,i}};return t(i),[e,n,r]}function GK(t){return typeof t=="function"}function WK(t,e){let[n,r,i]=J5(e),s;if(GK(t))s=()=>tk(t());else{const a=tk(t);s=()=>a}function o(a=s(),l){let c=[n[l.type],...r.filter(({matcher:d})=>d(l)).map(({reducer:d})=>d)];return c.filter(d=>!!d).length===0&&(c=[i]),c.reduce((d,f)=>{if(f)if(Kc(d)){const y=f(d,l);return y===void 0?d:y}else{if(za(d))return q5(d,m=>f(m,l));{const m=f(d,l);if(m===void 0){if(d===null)return d;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return d},a)}return o.getInitialState=s,o}var $K="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",XK=(t=21)=>{let e="",n=t;for(;n--;)e+=$K[Math.random()*64|0];return e},qK=Symbol.for("rtk-slice-createasyncthunk");function KK(t,e){return`${t}/${e}`}function YK({creators:t}={}){var n;const e=(n=t==null?void 0:t.asyncThunk)==null?void 0:n[qK];return function(i){const{name:s,reducerPath:o=s}=i;if(!s)throw new Error(So(11));const a=(typeof i.reducers=="function"?i.reducers(QK()):i.reducers)||{},l=Object.keys(a),c={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},d={addCase(C,O){const N=typeof C=="string"?C:C.type;if(!N)throw new Error(So(12));if(N in c.sliceCaseReducersByType)throw new Error(So(13));return c.sliceCaseReducersByType[N]=O,d},addMatcher(C,O){return c.sliceMatchers.push({matcher:C,reducer:O}),d},exposeAction(C,O){return c.actionCreators[C]=O,d},exposeCaseReducer(C,O){return c.sliceCaseReducersByName[C]=O,d}};l.forEach(C=>{const O=a[C],N={reducerName:C,type:KK(s,C),createNotation:typeof i.reducers=="function"};eY(O)?nY(N,O,d,e):JK(N,O,d)});function f(){const[C={},O=[],N=void 0]=typeof i.extraReducers=="function"?J5(i.extraReducers):[i.extraReducers],D={...C,...c.sliceCaseReducersByType};return WK(i.initialState,F=>{for(let V in D)F.addCase(V,D[V]);for(let V of c.sliceMatchers)F.addMatcher(V.matcher,V.reducer);for(let V of O)F.addMatcher(V.matcher,V.reducer);N&&F.addDefaultCase(N)})}const m=C=>C,y=new Map,x=new WeakMap;let S;function w(C,O){return S||(S=f()),S(C,O)}function b(){return S||(S=f()),S.getInitialState()}function E(C,O=!1){function N(F){let V=F[C];return typeof V>"u"&&O&&(V=Mb(x,N,b)),V}function D(F=m){const V=Mb(y,O,()=>new WeakMap);return Mb(V,F,()=>{const k={};for(const[j,H]of Object.entries(i.selectors??{}))k[j]=ZK(H,F,()=>Mb(x,F,b),O);return k})}return{reducerPath:C,getSelectors:D,get selectors(){return D(N)},selectSlice:N}}const T={name:s,reducer:w,actions:c.actionCreators,caseReducers:c.sliceCaseReducersByName,getInitialState:b,...E(o),injectInto(C,{reducerPath:O,...N}={}){const D=O??o;return C.inject({reducerPath:D,reducer:w},N),{...T,...E(D,!0)}}};return T}}function ZK(t,e,n,r){function i(s,...o){let a=e(s);return typeof a>"u"&&r&&(a=n()),t(a,...o)}return i.unwrapped=t,i}var cs=YK();function QK(){function t(e,n){return{_reducerDefinitionType:"asyncThunk",payloadCreator:e,...n}}return t.withTypes=()=>t,{reducer(e){return Object.assign({[e.name](...n){return e(...n)}}[e.name],{_reducerDefinitionType:"reducer"})},preparedReducer(e,n){return{_reducerDefinitionType:"reducerWithPrepare",prepare:e,reducer:n}},asyncThunk:t}}function JK({type:t,reducerName:e,createNotation:n},r,i){let s,o;if("reducer"in r){if(n&&!tY(r))throw new Error(So(17));s=r.reducer,o=r.prepare}else s=r;i.addCase(t,s).exposeCaseReducer(e,s).exposeAction(e,o?Eo(t,o):Eo(t))}function eY(t){return t._reducerDefinitionType==="asyncThunk"}function tY(t){return t._reducerDefinitionType==="reducerWithPrepare"}function nY({type:t,reducerName:e},n,r,i){if(!i)throw new Error(So(18));const{payloadCreator:s,fulfilled:o,pending:a,rejected:l,settled:c,options:d}=n,f=i(t,s,d);r.exposeAction(e,f),o&&r.addCase(f.fulfilled,o),a&&r.addCase(f.pending,a),l&&r.addCase(f.rejected,l),c&&r.addMatcher(f.settled,c),r.exposeCaseReducer(e,{fulfilled:o||Eb,pending:a||Eb,rejected:l||Eb,settled:c||Eb})}function Eb(){}var rY="task",e4="listener",t4="completed",BP="cancelled",iY=`task-${BP}`,sY=`task-${t4}`,lC=`${e4}-${BP}`,oY=`${e4}-${t4}`,lS=class{constructor(t){fo(this,"code");fo(this,"name","TaskAbortError");fo(this,"message");this.code=t,this.message=`${rY} ${BP} (reason: ${t})`}},HP=(t,e)=>{if(typeof t!="function")throw new TypeError(So(32))},pw=()=>{},n4=(t,e=pw)=>(t.catch(e),t),r4=(t,e)=>(t.addEventListener("abort",e,{once:!0}),()=>t.removeEventListener("abort",e)),bh=t=>{if(t.aborted)throw new lS(t.reason)};function i4(t,e){let n=pw;return new Promise((r,i)=>{const s=()=>i(new lS(t.reason));if(t.aborted){s();return}n=r4(t,s),e.finally(()=>n()).then(r,i)}).finally(()=>{n=pw})}var aY=async(t,e)=>{try{return await Promise.resolve(),{status:"ok",value:await t()}}catch(n){return{status:n instanceof lS?"cancelled":"rejected",error:n}}finally{e==null||e()}},mw=t=>e=>n4(i4(t,e).then(n=>(bh(t),n))),s4=t=>{const e=mw(t);return n=>e(new Promise(r=>setTimeout(r,n)))},{assign:Qm}=Object,rk={},cS="listenerMiddleware",lY=(t,e)=>{const n=r=>r4(t,()=>r.abort(t.reason));return(r,i)=>{HP(r);const s=new AbortController;n(s);const o=aY(async()=>{bh(t),bh(s.signal);const a=await r({pause:mw(s.signal),delay:s4(s.signal),signal:s.signal});return bh(s.signal),a},()=>s.abort(sY));return i!=null&&i.autoJoin&&e.push(o.catch(pw)),{result:mw(t)(o),cancel(){s.abort(iY)}}}},cY=(t,e)=>{const n=async(r,i)=>{bh(e);let s=()=>{};const a=[new Promise((l,c)=>{let d=t({predicate:r,effect:(f,m)=>{m.unsubscribe(),l([f,m.getState(),m.getOriginalState()])}});s=()=>{d(),c()}})];i!=null&&a.push(new Promise(l=>setTimeout(l,i,null)));try{const l=await i4(e,Promise.race(a));return bh(e),l}finally{s()}};return((r,i)=>n4(n(r,i)))},o4=t=>{let{type:e,actionCreator:n,matcher:r,predicate:i,effect:s}=t;if(e)i=Eo(e).match;else if(n)e=n.type,i=n.match;else if(r)i=r;else if(!i)throw new Error(So(21));return HP(s),{predicate:i,type:e,effect:s}},a4=Qm(t=>{const{type:e,predicate:n,effect:r}=o4(t);return{id:XK(),effect:r,type:e,predicate:n,pending:new Set,unsubscribe:()=>{throw new Error(So(22))}}},{withTypes:()=>a4}),ik=(t,e)=>{const{type:n,effect:r,predicate:i}=o4(e);return Array.from(t.values()).find(s=>(typeof n=="string"?s.type===n:s.predicate===i)&&s.effect===r)},cC=t=>{t.pending.forEach(e=>{e.abort(lC)})},uY=(t,e)=>()=>{for(const n of e.keys())cC(n);t.clear()},sk=(t,e,n)=>{try{t(e,n)}catch(r){setTimeout(()=>{throw r},0)}},l4=Qm(Eo(`${cS}/add`),{withTypes:()=>l4}),dY=Eo(`${cS}/removeAll`),c4=Qm(Eo(`${cS}/remove`),{withTypes:()=>c4}),fY=(...t)=>{console.error(`${cS}/error`,...t)},$0=(t={})=>{const e=new Map,n=new Map,r=y=>{const x=n.get(y)??0;n.set(y,x+1)},i=y=>{const x=n.get(y)??1;x===1?n.delete(y):n.set(y,x-1)},{extra:s,onError:o=fY}=t;HP(o);const a=y=>(y.unsubscribe=()=>e.delete(y.id),e.set(y.id,y),x=>{y.unsubscribe(),x!=null&&x.cancelActive&&cC(y)}),l=(y=>{const x=ik(e,y)??a4(y);return a(x)});Qm(l,{withTypes:()=>l});const c=y=>{const x=ik(e,y);return x&&(x.unsubscribe(),y.cancelActive&&cC(x)),!!x};Qm(c,{withTypes:()=>c});const d=async(y,x,S,w)=>{const b=new AbortController,E=cY(l,b.signal),T=[];try{y.pending.add(b),r(y),await Promise.resolve(y.effect(x,Qm({},S,{getOriginalState:w,condition:(C,O)=>E(C,O).then(Boolean),take:E,delay:s4(b.signal),pause:mw(b.signal),extra:s,signal:b.signal,fork:lY(b.signal,T),unsubscribe:y.unsubscribe,subscribe:()=>{e.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((C,O,N)=>{C!==b&&(C.abort(lC),N.delete(C))})},cancel:()=>{b.abort(lC),y.pending.delete(b)},throwIfCancelled:()=>{bh(b.signal)}})))}catch(C){C instanceof lS||sk(o,C,{raisedBy:"effect"})}finally{await Promise.all(T),b.abort(oY),i(y),y.pending.delete(b)}},f=uY(e,n);return{middleware:y=>x=>S=>{if(!j5(S))return x(S);if(l4.match(S))return l(S.payload);if(dY.match(S)){f();return}if(c4.match(S))return c(S.payload);let w=y.getState();const b=()=>{if(w===rk)throw new Error(So(23));return w};let E;try{if(E=x(S),e.size>0){const T=y.getState(),C=Array.from(e.values());for(const O of C){let N=!1;try{N=O.predicate(S,T,w)}catch(D){N=!1,sk(o,D,{raisedBy:"predicate"})}N&&d(O,S,y,b)}}}finally{w=rk}return E},startListening:l,stopListening:c,clearListeners:f}};function So(t){return`Minified Redux Toolkit error #${t}; visit https://redux-toolkit.js.org/Errors?code=${t} for the full message or use the non-minified dev environment for full errors. `}var hY={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},u4=cs({name:"chartLayout",initialState:hY,reducers:{setLayout(t,e){t.layoutType=e.payload},setChartSize(t,e){t.width=e.payload.width,t.height=e.payload.height},setMargin(t,e){var n,r,i,s;t.margin.top=(n=e.payload.top)!==null&&n!==void 0?n:0,t.margin.right=(r=e.payload.right)!==null&&r!==void 0?r:0,t.margin.bottom=(i=e.payload.bottom)!==null&&i!==void 0?i:0,t.margin.left=(s=e.payload.left)!==null&&s!==void 0?s:0},setScale(t,e){t.scale=e.payload}}}),uS=u4.actions,pY=uS.setMargin,mY=uS.setLayout,gY=uS.setChartSize,vY=uS.setScale,yY=u4.reducer;function d4(t,e,n){return Array.isArray(t)&&t&&e+n!==0?t.slice(e,n+1):t}function wn(t){return Number.isFinite(t)}function kl(t){return typeof t=="number"&&t>0&&Number.isFinite(t)}function ok(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Gm(t){for(var e=1;e{if(e&&n){var r=n.width,i=n.height,s=e.align,o=e.verticalAlign,a=e.layout;if((a==="vertical"||a==="horizontal"&&o==="middle")&&s!=="center"&&Nt(t[s]))return Gm(Gm({},t),{},{[s]:t[s]+(r||0)});if((a==="horizontal"||a==="vertical"&&s==="center")&&o!=="middle"&&Nt(t[o]))return Gm(Gm({},t),{},{[o]:t[o]+(i||0)})}return t},Fl=(t,e)=>t==="horizontal"&&e==="xAxis"||t==="vertical"&&e==="yAxis"||t==="centric"&&e==="angleAxis"||t==="radial"&&e==="radiusAxis",f4=(t,e,n,r)=>{if(r)return t.map(a=>a.coordinate);var i,s,o=t.map(a=>(a.coordinate===e&&(i=!0),a.coordinate===n&&(s=!0),a.coordinate));return i||o.push(e),s||o.push(n),o},h4=(t,e,n)=>{if(!t)return null;var r=t.duplicateDomain,i=t.type,s=t.range,o=t.scale,a=t.realScaleType,l=t.isCategorical,c=t.categoricalDomain,d=t.tickCount,f=t.ticks,m=t.niceTicks,y=t.axisType;if(!o)return null;var x=a==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,S=i==="category"&&o.bandwidth?o.bandwidth()/x:0;if(S=y==="angleAxis"&&s&&s.length>=2?Wo(s[0]-s[1])*2*S:S,f||m){var w=(f||m||[]).map((b,E)=>{var T=r?r.indexOf(b):b,C=o.map(T);return wn(C)?{coordinate:C+S,value:b,offset:S,index:E}:null}).filter(Ks);return w}return l&&c?c.map((b,E)=>{var T=o.map(b);return wn(T)?{coordinate:T+S,value:b,index:E,offset:S}:null}).filter(Ks):o.ticks&&d!=null?o.ticks(d).map((b,E)=>{var T=o.map(b);return wn(T)?{coordinate:T+S,value:b,index:E,offset:S}:null}).filter(Ks):o.domain().map((b,E)=>{var T=o.map(b);return wn(T)?{coordinate:T+S,value:r?r[b]:b,index:E,offset:S}:null}).filter(Ks)},SY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(c[0]=s,s+=m,c[1]=s):(c[0]=o,o+=m,c[1]=o)}}}},MY=t=>{var e,n=t.length;if(!(n<=0)){var r=(e=t[0])===null||e===void 0?void 0:e.length;if(!(r==null||r<=0))for(var i=0;i=0?(l[0]=s,s+=c,l[1]=s):(l[0]=0,l[1]=0)}}}},EY={sign:SY,expand:BX,none:Ph,silhouette:HX,wiggle:VX,positive:MY},AY=(t,e,n)=>{var r,i=(r=EY[n])!==null&&r!==void 0?r:Ph,s=zX().keys(e).value((a,l)=>Number(yi(a,l,0))).order(KT).offset(i),o=s(t);return o.forEach((a,l)=>{a.forEach((c,d)=>{var f=yi(t[d],e[l],0);Array.isArray(f)&&f.length===2&&Nt(f[0])&&Nt(f[1])&&(c[0]=f[0],c[1]=f[1])})}),o};function TY(t){return t==null?void 0:String(t)}function ak(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,s=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Hi(i[e.dataKey])){var a=x5(n,"value",i[e.dataKey]);if(a)return a.coordinate+r/2}return n!=null&&n[s]?n[s].coordinate+r/2:null}var l=yi(i,Hi(o)?e.dataKey:o),c=e.scale.map(l);return Nt(c)?c:null}var CY=t=>{var e=t.flat(2).filter(Nt);return[Math.min(...e),Math.max(...e)]},PY=t=>[t[0]===1/0?0:t[0],t[1]===-1/0?0:t[1]],RY=(t,e,n)=>{if(!(t==null||Object.keys(t).length===0))return PY(Object.keys(t).reduce((r,i)=>{var s=t[i];if(!s)return r;var o=s.stackedData,a=o.reduce((l,c)=>{var d=d4(c,e,n),f=CY(d);return!wn(f[0])||!wn(f[1])?l:[Math.min(l[0],f[0]),Math.max(l[1],f[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]))},lk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ck=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gw=(t,e,n)=>{if(t&&t.scale&&t.scale.bandwidth){var r=t.scale.bandwidth();if(!n||r>0)return r}if(t&&e&&e.length>=2){for(var i=eS(e,d=>d.coordinate),s=1/0,o=1,a=i.length;o{if(e==="horizontal")return t.relativeX;if(e==="vertical")return t.relativeY},IY=(t,e)=>e==="centric"?t.angle:t.radius,tu=t=>t.layout.width,nu=t=>t.layout.height,kY=t=>t.layout.scale,m4=t=>t.layout.margin,dS=Oe(t=>t.cartesianAxis.xAxis,t=>Object.values(t)),fS=Oe(t=>t.cartesianAxis.yAxis,t=>Object.values(t)),OY="data-recharts-item-index",LY="data-recharts-item-id",X0=60;function dk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ab(t){for(var e=1;et.brush.height;function zY(t){var e=fS(t);return e.reduce((n,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:X0;return n+i}return n},0)}function BY(t){var e=fS(t);return e.reduce((n,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var i=typeof r.width=="number"?r.width:X0;return n+i}return n},0)}function HY(t){var e=dS(t);return e.reduce((n,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?n+r.height:n,0)}function VY(t){var e=dS(t);return e.reduce((n,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?n+r.height:n,0)}var Gi=Oe([tu,nu,m4,FY,zY,BY,HY,VY,L5,uK],(t,e,n,r,i,s,o,a,l,c)=>{var d={left:(n.left||0)+i,right:(n.right||0)+s},f={top:(n.top||0)+o,bottom:(n.bottom||0)+a},m=Ab(Ab({},f),d),y=m.bottom;m.bottom+=r,m=wY(m,l,c);var x=t-m.left-m.right,S=e-m.top-m.bottom;return Ab(Ab({brushBottom:y},m),{},{width:Math.max(x,0),height:Math.max(S,0)})}),GY=Oe(Gi,t=>({x:t.left,y:t.top,width:t.width,height:t.height})),g4=Oe(tu,nu,(t,e)=>({x:0,y:0,width:t,height:e})),WY=R.createContext(null),Qs=()=>R.useContext(WY)!=null,hS=t=>t.brush,pS=Oe([hS,Gi,m4],(t,e,n)=>({height:t.height,x:Nt(t.x)?t.x:e.left,y:Nt(t.y)?t.y:e.top+e.height+e.brushBottom-((n==null?void 0:n.bottom)||0),width:Nt(t.width)?t.width:e.width}));function $Y(t,e,{signal:n,edges:r}={}){let i,s=null;const o=r!=null&&r.includes("leading"),a=r==null||r.includes("trailing"),l=()=>{s!==null&&(t.apply(i,s),i=void 0,s=null)},c=()=>{a&&l(),y()};let d=null;const f=()=>{d!=null&&clearTimeout(d),d=setTimeout(()=>{d=null,c()},e)},m=()=>{d!==null&&(clearTimeout(d),d=null)},y=()=>{m(),i=void 0,s=null},x=()=>{l()},S=function(...w){if(n!=null&&n.aborted)return;i=this,s=w;const b=d==null;f(),o&&b&&l()};return S.schedule=f,S.cancel=y,S.flush=x,n==null||n.addEventListener("abort",y,{once:!0}),S}function XY(t,e=0,n={}){typeof n!="object"&&(n={});const{leading:r=!1,trailing:i=!0,maxWait:s}=n,o=Array(2);r&&(o[0]="leading"),i&&(o[1]="trailing");let a,l=null;const c=$Y(function(...m){a=t.apply(this,m),l=null},e,{edges:o}),d=function(...m){return s!=null&&(l===null&&(l=Date.now()),Date.now()-l>=s)?(a=t.apply(this,m),l=Date.now(),c.cancel(),c.schedule(),a):(c.apply(this,m),a)},f=()=>(c.flush(),a);return d.cancel=c.cancel,d.flush=f,d}function qY(t,e=0,n={}){const{leading:r=!0,trailing:i=!0}=n;return XY(t,e,{leading:r,maxWait:e,trailing:i})}var vw=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;si[o++]))}},wl={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},v4=(t,e,n)=>{var r=n.width,i=r===void 0?wl.width:r,s=n.height,o=s===void 0?wl.height:s,a=n.aspect,l=n.maxHeight,c=Rh(i)?t:Number(i),d=Rh(o)?e:Number(o);return a&&a>0&&(c?d=c/a:d&&(c=d*a),l&&d!=null&&d>l&&(d=l)),{calculatedWidth:c,calculatedHeight:d}},KY={width:0,height:0,overflow:"visible"},YY={width:0,overflowX:"visible"},ZY={height:0,overflowY:"visible"},QY={},JY=t=>{var e=t.width,n=t.height,r=Rh(e),i=Rh(n);return r&&i?KY:r?YY:i?ZY:QY};function eZ(t){var e=t.width,n=t.height,r=t.aspect,i=e,s=n;return i===void 0&&s===void 0?(i=wl.width,s=wl.height):i===void 0?i=r&&r>0?void 0:wl.width:s===void 0&&(s=r&&r>0?void 0:wl.height),{width:i,height:s}}var tZ=["aspect","initialDimension","width","height","minWidth","minHeight","maxHeight","children","debounce","id","className","onResize","style"];function yw(){return yw=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n({width:n,height:r}),[n,r]);return fZ(i)?R.createElement(y4.Provider,{value:i},e):null}var VP=()=>R.useContext(y4),hZ=R.forwardRef((t,e)=>{var n=t.aspect,r=t.initialDimension,i=r===void 0?wl.initialDimension:r,s=t.width,o=t.height,a=t.minWidth,l=a===void 0?wl.minWidth:a,c=t.minHeight,d=t.maxHeight,f=t.children,m=t.debounce,y=m===void 0?wl.debounce:m,x=t.id,S=t.className,w=t.onResize,b=t.style,E=b===void 0?{}:b,T=uZ(t,tZ),C=R.useRef(null),O=R.useRef();O.current=w,R.useImperativeHandle(e,()=>C.current);var N=R.useState({containerWidth:i.width,containerHeight:i.height}),D=sZ(N,2),F=D[0],V=D[1],k=R.useCallback((oe,he)=>{V(B=>{var K=Math.round(oe),q=Math.round(he);return B.containerWidth===K&&B.containerHeight===q?B:{containerWidth:K,containerHeight:q}})},[]);R.useEffect(()=>{if(C.current==null||typeof ResizeObserver>"u")return Bg;var oe=$=>{var Z,ge=$[0];if(ge!=null){var ae=ge.contentRect,ce=ae.width,we=ae.height;k(ce,we),(Z=O.current)===null||Z===void 0||Z.call(O,ce,we)}};y>0&&(oe=qY(oe,y,{trailing:!0,leading:!1}));var he=new ResizeObserver(oe),B=C.current.getBoundingClientRect(),K=B.width,q=B.height;return k(K,q),he.observe(C.current),()=>{he.disconnect()}},[k,y]);var j=F.containerWidth,H=F.containerHeight;vw(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ne=v4(j,H,{width:s,height:o,aspect:n,maxHeight:d}),J=ne.calculatedWidth,de=ne.calculatedHeight;return vw(j<0||H<0||J!=null&&J>0||de!=null&&de>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,J,de,s,o,l,c,n),R.createElement("div",yw({id:x?"".concat(x):void 0,className:er("recharts-responsive-container",S),style:hk(hk({},E),{},{width:s,height:o,minWidth:l,minHeight:c,maxHeight:d}),ref:C},T),R.createElement("div",{style:JY({width:s,height:o})},R.createElement(x4,{width:J,height:de},f)))}),pZ=R.forwardRef((t,e)=>{var n=VP();if(kl(n.width)&&kl(n.height))return t.children;var r=eZ({width:t.width,height:t.height,aspect:t.aspect}),i=r.width,s=r.height,o=v4(void 0,void 0,{width:i,height:s,aspect:t.aspect,maxHeight:t.maxHeight}),a=o.calculatedWidth,l=o.calculatedHeight;return Nt(a)&&Nt(l)?R.createElement(x4,{width:a,height:l},t.children):R.createElement(hZ,yw({},t,{width:i,height:s,ref:e}))});function GP(t){if(t)return{x:t.x,y:t.y,upperWidth:"upperWidth"in t?t.upperWidth:t.width,lowerWidth:"lowerWidth"in t?t.lowerWidth:t.width,width:t.width,height:t.height}}var mS=()=>{var t,e=Qs(),n=zt(GY),r=zt(pS),i=(t=zt(hS))===null||t===void 0?void 0:t.padding;return!e||!r||!i?n:{width:r.width-i.left-i.right,height:r.height-i.top-i.bottom,x:i.left,y:i.top}},mZ={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},b4=()=>{var t;return(t=zt(Gi))!==null&&t!==void 0?t:mZ},_4=()=>zt(tu),w4=()=>zt(nu),fr=t=>t.layout.layoutType,Hg=()=>zt(fr),WP=()=>{var t=Hg();if(t==="horizontal"||t==="vertical")return t},S4=t=>{var e=t.layout.layoutType;if(e==="centric"||e==="radial")return e},gZ=()=>{var t=Hg();return t!==void 0},q0=t=>{var e=Wr(),n=Qs(),r=t.width,i=t.height,s=VP(),o=r,a=i;return s&&(o=s.width>0?s.width:r,a=s.height>0?s.height:i),R.useEffect(()=>{!n&&kl(o)&&kl(a)&&e(gY({width:o,height:a}))},[e,n,o,a]),null},M4=Symbol.for("immer-nothing"),mk=Symbol.for("immer-draftable"),Ao=Symbol.for("immer-state");function Ua(t,...e){throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var f0=Object.getPrototypeOf;function Mg(t){return!!t&&!!t[Ao]}function Ih(t){var e;return t?E4(t)||Array.isArray(t)||!!t[mk]||!!((e=t.constructor)!=null&&e[mk])||K0(t)||vS(t):!1}var vZ=Object.prototype.constructor.toString(),gk=new WeakMap;function E4(t){if(!t||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);if(e===null||e===Object.prototype)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;if(n===Object)return!0;if(typeof n!="function")return!1;let r=gk.get(n);return r===void 0&&(r=Function.toString.call(n),gk.set(n,r)),r===vZ}function xw(t,e,n=!0){gS(t)===0?(n?Reflect.ownKeys(t):Object.keys(t)).forEach(i=>{e(i,t[i],t)}):t.forEach((r,i)=>e(i,r,t))}function gS(t){const e=t[Ao];return e?e.type_:Array.isArray(t)?1:K0(t)?2:vS(t)?3:0}function uC(t,e){return gS(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function A4(t,e,n){const r=gS(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function yZ(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function K0(t){return t instanceof Map}function vS(t){return t instanceof Set}function Wf(t){return t.copy_||t.base_}function dC(t,e){if(K0(t))return new Map(t);if(vS(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=E4(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[Ao];let i=Reflect.ownKeys(r);for(let s=0;s1&&Object.defineProperties(t,{set:Tb,add:Tb,clear:Tb,delete:Tb}),Object.freeze(t),e&&Object.values(t).forEach(n=>$P(n,!0))),t}function xZ(){Ua(2)}var Tb={value:xZ};function yS(t){return t===null||typeof t!="object"?!0:Object.isFrozen(t)}var bZ={};function kh(t){const e=bZ[t];return e||Ua(0,t),e}var h0;function T4(){return h0}function _Z(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function vk(t,e){e&&(kh("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function fC(t){hC(t),t.drafts_.forEach(wZ),t.drafts_=null}function hC(t){t===h0&&(h0=t.parent_)}function yk(t){return h0=_Z(h0,t)}function wZ(t){const e=t[Ao];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function xk(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[Ao].modified_&&(fC(e),Ua(4)),Ih(t)&&(t=bw(e,t),e.parent_||_w(e,t)),e.patches_&&kh("Patches").generateReplacementPatches_(n[Ao].base_,t,e.patches_,e.inversePatches_)):t=bw(e,n,[]),fC(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==M4?t:void 0}function bw(t,e,n){if(yS(e))return e;const r=t.immer_.shouldUseStrictIteration(),i=e[Ao];if(!i)return xw(e,(s,o)=>bk(t,i,e,s,o,n),r),e;if(i.scope_!==t)return e;if(!i.modified_)return _w(t,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;const s=i.copy_;let o=s,a=!1;i.type_===3&&(o=new Set(s),s.clear(),a=!0),xw(o,(l,c)=>bk(t,i,s,l,c,n,a),r),_w(t,s,!1),n&&t.patches_&&kh("Patches").generatePatches_(i,n,t.patches_,t.inversePatches_)}return i.copy_}function bk(t,e,n,r,i,s,o){if(i==null||typeof i!="object"&&!o)return;const a=yS(i);if(!(a&&!o)){if(Mg(i)){const l=s&&e&&e.type_!==3&&!uC(e.assigned_,r)?s.concat(r):void 0,c=bw(t,i,l);if(A4(n,r,c),Mg(c))t.canAutoFreeze_=!1;else return}else o&&n.add(i);if(Ih(i)&&!a){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1||e&&e.base_&&e.base_[r]===i&&a)return;bw(t,i),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&(K0(n)?n.has(r):Object.prototype.propertyIsEnumerable.call(n,r))&&_w(t,i)}}}function _w(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&$P(e,n)}function SZ(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:T4(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,s=XP;n&&(i=[r],s=p0);const{revoke:o,proxy:a}=Proxy.revocable(i,s);return r.draft_=a,r.revoke_=o,a}var XP={get(t,e){if(e===Ao)return t;const n=Wf(t);if(!uC(n,e))return MZ(t,n,e);const r=n[e];return t.finalized_||!Ih(r)?r:r===_E(t.base_,e)?(wE(t),t.copy_[e]=mC(r,t)):r},has(t,e){return e in Wf(t)},ownKeys(t){return Reflect.ownKeys(Wf(t))},set(t,e,n){const r=C4(Wf(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const i=_E(Wf(t),e),s=i==null?void 0:i[Ao];if(s&&s.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(yZ(n,i)&&(n!==void 0||uC(t.base_,e)))return!0;wE(t),pC(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return _E(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,wE(t),pC(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Wf(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){Ua(11)},getPrototypeOf(t){return f0(t.base_)},setPrototypeOf(){Ua(12)}},p0={};xw(XP,(t,e)=>{p0[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});p0.deleteProperty=function(t,e){return p0.set.call(this,t,e,void 0)};p0.set=function(t,e,n){return XP.set.call(this,t[0],e,n,t[0])};function _E(t,e){const n=t[Ao];return(n?Wf(n):t)[e]}function MZ(t,e,n){var i;const r=C4(e,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(t.draft_):void 0}function C4(t,e){if(!(e in t))return;let n=f0(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=f0(n)}}function pC(t){t.modified_||(t.modified_=!0,t.parent_&&pC(t.parent_))}function wE(t){t.copy_||(t.copy_=dC(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var EZ=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const s=n;n=e;const o=this;return function(l=s,...c){return o.produce(l,d=>n.call(this,d,...c))}}typeof n!="function"&&Ua(6),r!==void 0&&typeof r!="function"&&Ua(7);let i;if(Ih(e)){const s=yk(this),o=mC(e,void 0);let a=!0;try{i=n(o),a=!1}finally{a?fC(s):hC(s)}return vk(s,r),xk(i,s)}else if(!e||typeof e!="object"){if(i=n(e),i===void 0&&(i=e),i===M4&&(i=void 0),this.autoFreeze_&&$P(i,!0),r){const s=[],o=[];kh("Patches").generateReplacementPatches_(e,i,s,o),r(s,o)}return i}else Ua(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(o,...a)=>this.produceWithPatches(o,l=>e(l,...a));let r,i;return[this.produce(e,n,(o,a)=>{r=o,i=a}),r,i]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Ih(t)||Ua(8),Mg(t)&&(t=AZ(t));const e=yk(this),n=mC(t,void 0);return n[Ao].isManual_=!0,hC(e),n}finishDraft(t,e){const n=t&&t[Ao];(!n||!n.isManual_)&&Ua(9);const{scope_:r}=n;return vk(r,e),xk(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const i=e[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(e=e.slice(n+1));const r=kh("Patches").applyPatches_;return Mg(t)?r(t,e):this.produce(t,i=>r(i,e))}};function mC(t,e){const n=K0(t)?kh("MapSet").proxyMap_(t,e):vS(t)?kh("MapSet").proxySet_(t,e):SZ(t,e);return(e?e.scope_:T4()).drafts_.push(n),n}function AZ(t){return Mg(t)||Ua(10,t),P4(t)}function P4(t){if(!Ih(t)||yS(t))return t;const e=t[Ao];let n,r=!0;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=dC(t,e.scope_.immer_.useStrictShallowCopy_),r=e.scope_.immer_.shouldUseStrictIteration()}else n=dC(t,!0);return xw(n,(i,s)=>{A4(n,i,P4(s))},r),e&&(e.finalized_=!1),n}var TZ=new EZ;TZ.produce;var CZ={settings:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemSorter:"value"},size:{width:0,height:0},payload:[]},R4=cs({name:"legend",initialState:CZ,reducers:{setLegendSize(t,e){t.size.width=e.payload.width,t.size.height=e.payload.height},setLegendSettings(t,e){t.settings.align=e.payload.align,t.settings.layout=e.payload.layout,t.settings.verticalAlign=e.payload.verticalAlign,t.settings.itemSorter=e.payload.itemSorter},addLegendPayload:{reducer(t,e){t.payload.push(e.payload)},prepare:sr()},replaceLegendPayload:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).payload.indexOf(r);s>-1&&(t.payload[s]=i)},prepare:sr()},removeLegendPayload:{reducer(t,e){var n=$o(t).payload.indexOf(e.payload);n>-1&&t.payload.splice(n,1)},prepare:sr()}}}),Y0=R4.actions;Y0.setLegendSize;Y0.setLegendSettings;var PZ=Y0.addLegendPayload,RZ=Y0.replaceLegendPayload,NZ=Y0.removeLegendPayload,IZ=R4.reducer,SE={exports:{}},ME={};/** + * @license React + * use-sync-external-store-with-selector.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var _k;function kZ(){if(_k)return ME;_k=1;var t=Wh();function e(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,i=t.useRef,s=t.useEffect,o=t.useMemo,a=t.useDebugValue;return ME.useSyncExternalStoreWithSelector=function(l,c,d,f,m){var y=i(null);if(y.current===null){var x={hasValue:!1,value:null};y.current=x}else x=y.current;y=o(function(){function w(O){if(!b){if(b=!0,E=O,O=f(O),m!==void 0&&x.hasValue){var N=x.value;if(m(N,O))return T=N}return T=O}if(N=T,n(E,O))return N;var D=f(O);return m!==void 0&&m(N,D)?(E=O,N):(E=O,T=D)}var b=!1,E,T,C=d===void 0?null:d;return[function(){return w(c())},C===null?void 0:function(){return w(C())}]},[c,d,f,m]);var S=r(l,y[0],y[1]);return s(function(){x.hasValue=!0,x.value=S},[S]),a(S),S},ME}var wk;function OZ(){return wk||(wk=1,SE.exports=kZ()),SE.exports}OZ();function LZ(t){t()}function DZ(){let t=null,e=null;return{clear(){t=null,e=null},notify(){LZ(()=>{let n=t;for(;n;)n.callback(),n=n.next})},get(){const n=[];let r=t;for(;r;)n.push(r),r=r.next;return n},subscribe(n){let r=!0;const i=e={callback:n,next:null,prev:e};return i.prev?i.prev.next=i:t=i,function(){!r||t===null||(r=!1,i.next?i.next.prev=i.prev:e=i.prev,i.prev?i.prev.next=i.next:t=i.next)}}}}var Sk={notify(){},get:()=>[]};function UZ(t,e){let n,r=Sk,i=0,s=!1;function o(S){d();const w=r.subscribe(S);let b=!1;return()=>{b||(b=!0,w(),f())}}function a(){r.notify()}function l(){x.onStateChange&&x.onStateChange()}function c(){return s}function d(){i++,n||(n=t.subscribe(l),r=DZ())}function f(){i--,n&&i===0&&(n(),n=void 0,r.clear(),r=Sk)}function m(){s||(s=!0,d())}function y(){s&&(s=!1,f())}const x={addNestedSub:o,notifyNestedSubs:a,handleChangeWrapper:l,isSubscribed:c,trySubscribe:m,tryUnsubscribe:y,getListeners:()=>r};return x}var jZ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",FZ=jZ(),zZ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",BZ=zZ(),HZ=()=>FZ||BZ?R.useLayoutEffect:R.useEffect,VZ=HZ();function Mk(t,e){return t===e?t!==0||e!==0||1/t===1/e:t!==t&&e!==e}function GZ(t,e){if(Mk(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let i=0;i{const l=UZ(i);return{store:i,subscription:l,getServerState:r?()=>r:void 0}},[i,r]),o=R.useMemo(()=>i.getState(),[i]);VZ(()=>{const{subscription:l}=s;return l.onStateChange=l.notifyNestedSubs,l.trySubscribe(),o!==i.getState()&&l.notifyNestedSubs(),()=>{l.tryUnsubscribe(),l.onStateChange=void 0}},[s,o]);const a=n||$Z;return R.createElement(a.Provider,{value:s},e)}var qZ=XZ,KZ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius","throttledEvents"]);function YZ(t,e){return t==null&&e==null?!0:typeof t=="number"&&typeof e=="number"?t===e||t!==t&&e!==e:t===e}function xS(t,e){var n=new Set([...Object.keys(t),...Object.keys(e)]);for(var r of n)if(KZ.has(r)){if(t[r]==null&&e[r]==null)continue;if(!GZ(t[r],e[r]))return!1}else if(!YZ(t[r],e[r]))return!1;return!0}function gC(){return gC=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.separator,n=e===void 0?om.separator:e,r=t.contentStyle,i=t.itemStyle,s=t.labelStyle,o=s===void 0?om.labelStyle:s,a=t.payload,l=t.formatter,c=t.itemSorter,d=t.wrapperClassName,f=t.labelClassName,m=t.label,y=t.labelFormatter,x=t.accessibilityLayer,S=x===void 0?om.accessibilityLayer:x,w=()=>{if(a&&a.length){var F={padding:0,margin:0},V=oQ(a,c),k=V.map((j,H)=>{if(!j||j.type==="none")return null;var ne=j.formatter||l||sQ,J=j.value,de=j.name,oe=J,he=de;if(ne){var B=ne(J,de,j,H,a);if(Array.isArray(B)){var K=eQ(B,2);oe=K[0],he=K[1]}else if(B!=null)oe=B;else return null}var q=iy(iy({},om.itemStyle),{},{color:j.color||om.itemStyle.color},i);return R.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(H),style:q},Il(he)?R.createElement("span",{className:"recharts-tooltip-item-name"},he):null,Il(he)?R.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,R.createElement("span",{className:"recharts-tooltip-item-value"},oe),R.createElement("span",{className:"recharts-tooltip-item-unit"},j.unit||""))});return R.createElement("ul",{className:"recharts-tooltip-item-list",style:F},k)}return null},b=iy(iy({},om.contentStyle),r),E=iy({margin:0},o),T=!Hi(m),C=T?m:"",O=er("recharts-default-tooltip",d),N=er("recharts-tooltip-label",f);T&&y&&a!==void 0&&a!==null&&(C=y(m,a));var D=S?{role:"status","aria-live":"assertive"}:{};return R.createElement("div",gC({className:O,style:b},D),R.createElement("p",{className:N,style:E},R.isValidElement(C)?C:"".concat(C)),w())},sy="recharts-tooltip-wrapper",lQ={visibility:"hidden"};function cQ(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return er(sy,{["".concat(sy,"-right")]:Nt(n)&&e&&Nt(e.x)&&n>=e.x,["".concat(sy,"-left")]:Nt(n)&&e&&Nt(e.x)&&n=e.y,["".concat(sy,"-top")]:Nt(r)&&e&&Nt(e.y)&&r0?i:0),f=n[r]+i;if(e[r])return o[r]?d:f;var m=l[r];if(m==null)return 0;if(o[r]){var y=d,x=m;return yw?Math.max(d,m):Math.max(f,m)}function uQ(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function dQ(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTop,i=t.offsetLeft,s=t.position,o=t.reverseDirection,a=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,f,m;return a.height>0&&a.width>0&&n?(f=Tk({allowEscapeViewBox:e,coordinate:n,key:"x",offset:i,position:s,reverseDirection:o,tooltipDimension:a.width,viewBox:c,viewBoxDimension:c.width}),m=Tk({allowEscapeViewBox:e,coordinate:n,key:"y",offset:r,position:s,reverseDirection:o,tooltipDimension:a.height,viewBox:c,viewBoxDimension:c.height}),d=uQ({translateX:f,translateY:m,useTranslate3d:l})):d=lQ,{cssProperties:d,cssClasses:cQ({translateX:f,translateY:m,coordinate:n})}}var fQ=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Z0={isSsr:fQ()};function hQ(t,e){return vQ(t)||gQ(t,e)||mQ(t,e)||pQ()}function pQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mQ(t,e){if(t){if(typeof t=="string")return Ck(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ck(t,e):void 0}}function Ck(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nZ0.isSsr||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches),e=hQ(t,2),n=e[0],r=e[1];return R.useEffect(()=>{if(window.matchMedia){var i=window.matchMedia("(prefers-reduced-motion: reduce)"),s=()=>{r(i.matches)};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}}},[]),n}function Pk(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function am(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n({dismissed:!1,dismissedAtCoordinate:{x:0,y:0}})),c=_Q(l,2),d=c[0],f=c[1];R.useEffect(()=>{var b=E=>{if(E.key==="Escape"){var T,C,O,N;f({dismissed:!0,dismissedAtCoordinate:{x:(T=(C=t.coordinate)===null||C===void 0?void 0:C.x)!==null&&T!==void 0?T:0,y:(O=(N=t.coordinate)===null||N===void 0?void 0:N.y)!==null&&O!==void 0?O:0}})}};return document.addEventListener("keydown",b),()=>{document.removeEventListener("keydown",b)}},[(e=t.coordinate)===null||e===void 0?void 0:e.x,(n=t.coordinate)===null||n===void 0?void 0:n.y]),d.dismissed&&(((r=(i=t.coordinate)===null||i===void 0?void 0:i.x)!==null&&r!==void 0?r:0)!==d.dismissedAtCoordinate.x||((s=(o=t.coordinate)===null||o===void 0?void 0:o.y)!==null&&s!==void 0?s:0)!==d.dismissedAtCoordinate.y)&&f(am(am({},d),{},{dismissed:!1}));var m=dQ({allowEscapeViewBox:t.allowEscapeViewBox,coordinate:t.coordinate,offsetLeft:typeof t.offset=="number"?t.offset:t.offset.x,offsetTop:typeof t.offset=="number"?t.offset:t.offset.y,position:t.position,reverseDirection:t.reverseDirection,tooltipBox:{height:t.lastBoundingBox.height,width:t.lastBoundingBox.width},useTranslate3d:t.useTranslate3d,viewBox:t.viewBox}),y=m.cssClasses,x=m.cssProperties,S=t.hasPortalFromProps?{}:am(am({transition:AQ({prefersReducedMotion:a,isAnimationActive:t.isAnimationActive,active:t.active,animationDuration:t.animationDuration,animationEasing:t.animationEasing})},x),{},{pointerEvents:"none",position:"absolute",top:0,left:0}),w=am(am({},S),{},{visibility:!d.dismissed&&t.active&&t.hasPayload?"visible":"hidden"},t.wrapperStyle);return R.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:y,style:w,ref:t.innerRef},t.children)}var CQ=R.memo(TQ),I4=()=>{var t;return(t=zt(e=>e.rootProps.accessibilityLayer))!==null&&t!==void 0?t:!0};function vC(){return vC=Object.assign?Object.assign.bind():function(t){for(var e=1;ewn(t.x)&&wn(t.y),Ok=t=>t.base!=null&&ww(t.base)&&ww(t),oy=t=>t.x,ay=t=>t.y,IQ=(t,e)=>{if(typeof t=="function")return t;var n="curve".concat(kP(t));if((n==="curveMonotone"||n==="curveBump")&&e){var r=kk["".concat(n).concat(e==="vertical"?"Y":"X")];if(r)return r}return kk[n]||Q1},Lk={connectNulls:!1,type:"linear"},kQ=t=>{var e=t.type,n=e===void 0?Lk.type:e,r=t.points,i=r===void 0?[]:r,s=t.baseLine,o=t.layout,a=t.connectNulls,l=a===void 0?Lk.connectNulls:a,c=IQ(n,o),d=l?i.filter(ww):i;if(Array.isArray(s)){var f,m=i.map((b,E)=>Ik(Ik({},b),{},{base:s[E]}));o==="vertical"?f=bb().y(ay).x1(oy).x0(b=>b.base.x):f=bb().x(oy).y1(ay).y0(b=>b.base.y);var y=f.defined(Ok).curve(c),x=l?m.filter(Ok):m;return y(x)}var S;o==="vertical"&&Nt(s)?S=bb().y(ay).x1(oy).x0(s):Nt(s)?S=bb().x(oy).y1(ay).y0(s):S=a5().x(oy).y(ay);var w=S.defined(ww).curve(c);return w(d)},V_=t=>{var e=t.className,n=t.points,r=t.path,i=t.pathRef,s=Hg();if((!n||!n.length)&&!r)return null;var o={type:t.type,points:t.points,baseLine:t.baseLine,layout:t.layout||s,connectNulls:t.connectNulls},a=n&&n.length?kQ(o):r;return R.createElement("path",vC({},Fa(t),OP(t),{className:er("recharts-curve",e),d:a===null?void 0:a,ref:i}))},OQ=["x","y","top","left","width","height","className"];function yC(){return yC=Object.assign?Object.assign.bind():function(t){for(var e=1;e"M".concat(t,",").concat(i,"v").concat(r,"M").concat(s,",").concat(e,"h").concat(n),HQ=t=>{var e=t.x,n=e===void 0?0:e,r=t.y,i=r===void 0?0:r,s=t.top,o=s===void 0?0:s,a=t.left,l=a===void 0?0:a,c=t.width,d=c===void 0?0:c,f=t.height,m=f===void 0?0:f,y=t.className,x=FQ(t,OQ),S=LQ({x:n,y:i,top:o,left:l,width:d,height:m},x);return!Nt(n)||!Nt(i)||!Nt(d)||!Nt(m)||!Nt(o)||!Nt(l)?null:R.createElement("path",yC({},Ko(S),{className:er("recharts-cross",y),d:BQ(n,i,d,m,o,l)}))};function VQ(t,e,n,r){var i=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-i:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-i,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}var Sw=1e-4,k4=(t,e)=>[0,3*t,3*e-6*t,3*t-3*e+1],O4=(t,e)=>t.map((n,r)=>n*e**r).reduce((n,r)=>n+r),Uk=(t,e)=>n=>{var r=k4(t,e);return O4(r,n)},GQ=(t,e)=>n=>{var r=k4(t,e),i=[...r.map((s,o)=>s*o).slice(1),0];return O4(i,n)},WQ=t=>{var e,n=t.split("(");if(n.length!==2||n[0]!=="cubic-bezier")return null;var r=(e=n[1])===null||e===void 0||(e=e.split(")")[0])===null||e===void 0?void 0:e.split(",");if(r==null||r.length!==4)return null;var i=r.map(s=>parseFloat(s));return[i[0],i[1],i[2],i[3]]},$Q=function(){for(var e=arguments.length,n=new Array(e),r=0;r{var i=Uk(t,n),s=Uk(e,r),o=GQ(t,n),a=c=>c>1?1:c<0?0:c,l=c=>{for(var d=c>1?1:c,f=d,m=0;m<8;++m){var y=i(f)-d,x=o(f);if(Math.abs(y-d)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,s=i===void 0?8:i,o=e.dt,a=o===void 0?16.67:o,l=1,c=[0],d=0,f=0,m=1e4,y=0;y{var E,T,C;if(b<=0)return 0;if(b>=1)return l;var O=b*w,N=Math.floor(O),D=O-N;return((E=c[N])!==null&&E!==void 0?E:0)+(((T=c[N+1])!==null&&T!==void 0?T:0)-((C=c[N])!==null&&C!==void 0?C:0))*D}},KQ=t=>{if(typeof t=="string")switch(t){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return jk(t);case"spring":return qQ();default:if(t.split("(")[0]==="cubic-bezier")return jk(t)}return typeof t=="function"?t:null},YQ=(t,e,n)=>{var r,i=s=>{var o=e.tick(s);if(e.getState()==="active"){if(n(e.getInterpolated()),e.getProgress()===1){e.complete(),r=void 0;return}r=t.setTimeout(i,o);return}r=t.setTimeout(i,o)};return r=t.setTimeout(i,0),()=>{var s;return(s=r)===null||s===void 0?void 0:s()}},L4=R.createContext(YQ);L4.Provider;function ZQ(t){var e=R.useContext(L4);return R.useMemo(()=>t??e,[t,e])}function QQ(t,e,n){return(e=JQ(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JQ(t){var e=eJ(t,"string");return typeof e=="symbol"?e:e+""}function eJ(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Fk="init",zk="pending",Bk="active",tJ="completed";function TE(t){return Math.max(0,t)}class nJ{getAnimationStartedTime(){return this.animationStartedTime}getBeginStartedTime(){return this.beginStartedTime}constructor(e){var n;QQ(this,"state",Fk),this.animationId=e.animationId,this.onAnimationEnd=e.onAnimationEnd,this.animationDuration=TE(e.animationDuration),this.animationBegin=TE(e.animationBegin),this.progress=0,this.from=e.from,this.to=e.to,this.easing=e.easing,(n=e.onAnimationStart)===null||n===void 0||n.call(e)}getState(){return this.state}getEasing(){return this.easing}getAnimationDuration(){return this.animationDuration}tick(e){if(this.getState()===Fk)return this.state=zk,this.beginStartedTime=e,this.animationBegin;if(this.getState()===zk){if(this.beginStartedTime==null)throw new Error;var n=e-this.beginStartedTime;return n>=this.animationBegin?(this.state=Bk,this.animationStartedTime=e,this.nextAnimationUpdate(0)):TE(this.animationBegin-n)}if(this.getState()===Bk){if(this.animationStartedTime==null)throw new Error;var r=e-this.animationStartedTime;return this.setProgress(r/this.animationDuration),this.nextAnimationUpdate(r)}return 0}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}getProgress(){return this.progress}complete(){if(this.progress=1,this.state==="active"){var e;(e=this.onAnimationEnd)===null||e===void 0||e.call(this)}this.state=tJ}getFrom(){return this.from}getTo(){return this.to}getAnimationId(){return this.animationId}getAnimationBegin(){return this.animationBegin}}class rJ extends nJ{nextAnimationUpdate(){return 0}getInterpolated(){return this.easing(Uc(this.getFrom(),this.getTo(),this.getProgress()))}}class iJ{setTimeout(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),i=null,s=o=>{o-r>=n?e(o):i=requestAnimationFrame(s)};return i=requestAnimationFrame(s),()=>{i!=null&&cancelAnimationFrame(i)}}}function sJ(t,e){return cJ(t)||lJ(t,e)||aJ(t,e)||oJ()}function oJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aJ(t,e){if(t){if(typeof t=="string")return Hk(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hk(t,e):void 0}}function Hk(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{},onAnimationStart:()=>{}},Vk=0,CE=1;function D4(t){var e=Jo(t,uJ),n=e.animationId,r=e.isActive,i=e.canBegin,s=e.duration,o=e.easing,a=e.begin,l=e.onAnimationEnd,c=e.onAnimationStart,d=e.children,f=N4(),m=r==="auto"?!Z0.isSsr&&!f:r,y=ZQ(e.animationController),x=R.useState(m?Vk:CE),S=sJ(x,2),w=S[0],b=S[1];return R.useEffect(()=>{m||b(CE)},[m]),R.useEffect(()=>{var E=KQ(o);if(!m||!i||E==null)return Bg;var T=new iJ,C=new rJ({animationId:n,easing:E,animationDuration:s,animationBegin:a,onAnimationStart:c,onAnimationEnd:l,from:Vk,to:CE});return y(T,C,b)},[y,n,m,i,s,o,a,c,l]),d(Number(w))}function U4(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",n=R.useRef(l0(e)),r=R.useRef(t);return r.current!==t&&(n.current=l0(e),r.current=t),n.current}var dJ=t=>t.replace(/([A-Z])/g,e=>"-".concat(e.toLowerCase())),fJ=(t,e,n)=>t.map(r=>"".concat(dJ(r)," ").concat(e,"ms ").concat(n)).join(","),hJ=["radius"],pJ=["radius"],Gk,Wk,$k,Xk,qk,Kk,Yk,Zk,Qk,Jk;function eO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function tO(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{var s=xd(n),o=xd(r),a=Math.min(Math.abs(s)/2,Math.abs(o)/2),l=o>=0?1:-1,c=s>=0?1:-1,d=o>=0&&s>=0||o<0&&s<0?1:0,f;if(a>0&&Array.isArray(i)){for(var m=[0,0,0,0],y=0,x=4;ya?a:w}f=Di(Gk||(Gk=dl(["M",",",""])),t,e+l*m[0]),m[0]>0&&(f+=Di(Wk||(Wk=dl(["A ",",",",0,0,",",",",",""])),m[0],m[0],d,t+c*m[0],e)),f+=Di($k||($k=dl(["L ",",",""])),t+n-c*m[1],e),m[1]>0&&(f+=Di(Xk||(Xk=dl(["A ",",",",0,0,",`, + `,",",""])),m[1],m[1],d,t+n,e+l*m[1])),f+=Di(qk||(qk=dl(["L ",",",""])),t+n,e+r-l*m[2]),m[2]>0&&(f+=Di(Kk||(Kk=dl(["A ",",",",0,0,",`, + `,",",""])),m[2],m[2],d,t+n-c*m[2],e+r)),f+=Di(Yk||(Yk=dl(["L ",",",""])),t+c*m[3],e+r),m[3]>0&&(f+=Di(Zk||(Zk=dl(["A ",",",",0,0,",`, + `,",",""])),m[3],m[3],d,t,e+r-l*m[3])),f+="Z"}else if(a>0&&i===+i&&i>0){var b=Math.min(a,i);f=Di(Qk||(Qk=dl(["M ",",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",",",` + L `,",",` + A `,",",",0,0,",",",","," Z"])),t,e+l*b,b,b,d,t+c*b,e,t+n-c*b,e,b,b,d,t+n,e+l*b,t+n,e+r-l*b,b,b,d,t+n-c*b,e+r,t+c*b,e+r,b,b,d,t,e+r-l*b)}else f=Di(Jk||(Jk=dl(["M ",","," h "," v "," h "," Z"])),t,e,n,r,-n);return f},sO={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},MJ=t=>{var e=Jo(t,sO),n=R.useRef(null),r=R.useState(-1),i=xJ(r,2),s=i[0],o=i[1];R.useEffect(()=>{if(n.current&&n.current.getTotalLength)try{var B=n.current.getTotalLength();B&&o(B)}catch{}},[]);var a=e.x,l=e.y,c=e.width,d=e.height,f=e.radius,m=e.className,y=e.animationEasing,x=e.animationDuration,S=e.animationBegin,w=e.isAnimationActive,b=e.isUpdateAnimationActive,E=R.useRef(c),T=R.useRef(d),C=R.useRef(a),O=R.useRef(l),N=R.useMemo(()=>({x:a,y:l,width:c,height:d,radius:f}),[a,l,c,d,f]),D=U4(N,"rectangle-");if(a!==+a||l!==+l||c!==+c||d!==+d||c===0||d===0)return null;var F=er("recharts-rectangle",m);if(!b){var V=Ko(e);V.radius;var k=nO(V,hJ);return R.createElement("path",Mw({},k,{x:xd(a),y:xd(l),width:xd(c),height:xd(d),radius:typeof f=="number"?f:void 0,className:F,d:iO(a,l,c,d,f)}))}var j=E.current,H=T.current,ne=C.current,J=O.current,de="0px ".concat(s===-1?1:s,"px"),oe="".concat(s,"px ").concat(s,"px"),he=fJ(["strokeDasharray"],x,typeof y=="string"?y:sO.animationEasing);return R.createElement(D4,{animationId:D,key:D,canBegin:s>0,duration:x,easing:y,isActive:b,begin:S},B=>{var K=Uc(j,c,B),q=Uc(H,d,B),$=Uc(ne,a,B),Z=Uc(J,l,B);n.current&&(E.current=K,T.current=q,C.current=$,O.current=Z);var ge;w?B>0?ge={transition:he,strokeDasharray:oe}:ge={strokeDasharray:de}:ge={strokeDasharray:oe};var ae=Ko(e);ae.radius;var ce=nO(ae,pJ);return R.createElement("path",Mw({},ce,{radius:typeof f=="number"?f:void 0,className:F,d:iO($,Z,K,q,f),ref:n,style:tO(tO({},ge),e.style)}))})};function oO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function aO(t){for(var e=1;et*180/Math.PI,zi=(t,e,n,r)=>({x:t+Math.cos(-Ew*r)*n,y:e+Math.sin(-Ew*r)*n}),PJ=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},RJ=(t,e)=>{var n=t.x,r=t.y,i=e.x,s=e.y;return Math.sqrt((n-i)**2+(r-s)**2)},NJ=(t,e)=>{var n=t.x,r=t.y,i=e.cx,s=e.cy,o=RJ({x:n,y:r},{x:i,y:s});if(o<=0)return{radius:o,angle:0};var a=(n-i)/o,l=Math.acos(a);return r>s&&(l=2*Math.PI-l),{radius:o,angle:CJ(l),angleInRadian:l}},IJ=t=>{var e=t.startAngle,n=t.endAngle,r=Math.floor(e/360),i=Math.floor(n/360),s=Math.min(r,i);return{startAngle:e-s*360,endAngle:n-s*360}},kJ=(t,e)=>{var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),s=Math.floor(r/360),o=Math.min(i,s);return t+o*360},OJ=(t,e)=>{var n=t.relativeX,r=t.relativeY,i=NJ({x:n,y:r},e),s=i.radius,o=i.angle,a=e.innerRadius,l=e.outerRadius;if(sl||s===0)return null;var c=IJ(e),d=c.startAngle,f=c.endAngle,m=o,y;if(d<=f){for(;m>f;)m-=360;for(;m=d&&m<=f}else{for(;m>d;)m-=360;for(;m=f&&m<=d}return y?aO(aO({},e),{},{radius:s,angle:kJ(m,e)}):null};function j4(t){var e=t.cx,n=t.cy,r=t.radius,i=t.startAngle,s=t.endAngle,o=zi(e,n,r,i),a=zi(e,n,r,s);return{points:[o,a],cx:e,cy:n,radius:r,startAngle:i,endAngle:s}}var lO,cO,uO,dO,fO,hO,pO;function xC(){return xC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var n=Wo(e-t),r=Math.min(Math.abs(e-t),359.999);return n*r},Cb=t=>{var e=t.cx,n=t.cy,r=t.radius,i=t.angle,s=t.sign,o=t.isExternal,a=t.cornerRadius,l=t.cornerIsExternal,c=a*(o?1:-1)+r,d=Math.asin(a/c)/Ew,f=l?i:i+s*d,m=zi(e,n,c,f),y=zi(e,n,r,f),x=l?i-s*d:i,S=zi(e,n,c*Math.cos(d*Ew),x);return{center:m,circleTangency:y,lineTangency:S,theta:d}},F4=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.startAngle,o=t.endAngle,a=LJ(s,o),l=s+a,c=zi(e,n,i,s),d=zi(e,n,i,l),f=Di(lO||(lO=eh(["M ",",",` + A `,",",`,0, + `,",",`, + `,",",` + `])),c.x,c.y,i,i,+(Math.abs(a)>180),+(s>l),d.x,d.y);if(r>0){var m=zi(e,n,r,s),y=zi(e,n,r,l);f+=Di(cO||(cO=eh(["L ",",",` + A `,",",`,0, + `,",",`, + `,","," Z"])),y.x,y.y,r,r,+(Math.abs(a)>180),+(s<=l),m.x,m.y)}else f+=Di(uO||(uO=eh(["L ",","," Z"])),e,n);return f},DJ=t=>{var e=t.cx,n=t.cy,r=t.innerRadius,i=t.outerRadius,s=t.cornerRadius,o=t.forceCornerRadius,a=t.cornerIsExternal,l=t.startAngle,c=t.endAngle,d=Wo(c-l),f=Cb({cx:e,cy:n,radius:i,angle:l,sign:d,cornerRadius:s,cornerIsExternal:a}),m=f.circleTangency,y=f.lineTangency,x=f.theta,S=Cb({cx:e,cy:n,radius:i,angle:c,sign:-d,cornerRadius:s,cornerIsExternal:a}),w=S.circleTangency,b=S.lineTangency,E=S.theta,T=a?Math.abs(l-c):Math.abs(l-c)-x-E;if(T<0)return o?Di(dO||(dO=eh(["M ",",",` + a`,",",",0,0,1,",`,0 + a`,",",",0,0,1,",`,0 + `])),y.x,y.y,s,s,s*2,s,s,-s*2):F4({cx:e,cy:n,innerRadius:r,outerRadius:i,startAngle:l,endAngle:c});var C=Di(fO||(fO=eh(["M ",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",",` + `])),y.x,y.y,s,s,+(d<0),m.x,m.y,i,i,+(T>180),+(d<0),w.x,w.y,s,s,+(d<0),b.x,b.y);if(r>0){var O=Cb({cx:e,cy:n,radius:r,angle:l,sign:d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),N=O.circleTangency,D=O.lineTangency,F=O.theta,V=Cb({cx:e,cy:n,radius:r,angle:c,sign:-d,isExternal:!0,cornerRadius:s,cornerIsExternal:a}),k=V.circleTangency,j=V.lineTangency,H=V.theta,ne=a?Math.abs(l-c):Math.abs(l-c)-F-H;if(ne<0&&s===0)return"".concat(C,"L").concat(e,",").concat(n,"Z");C+=Di(hO||(hO=eh(["L",",",` + A`,",",",0,0,",",",",",` + A`,",",",0,",",",",",",",` + A`,",",",0,0,",",",",","Z"])),j.x,j.y,s,s,+(d<0),k.x,k.y,r,r,+(ne>180),+(d>0),N.x,N.y,s,s,+(d<0),D.x,D.y)}else C+=Di(pO||(pO=eh(["L",",","Z"])),e,n);return C},UJ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},jJ=t=>{var e=Jo(t,UJ),n=e.cx,r=e.cy,i=e.innerRadius,s=e.outerRadius,o=e.cornerRadius,a=e.forceCornerRadius,l=e.cornerIsExternal,c=e.startAngle,d=e.endAngle,f=e.className;if(s0&&Math.abs(c-d)<360?S=DJ({cx:n,cy:r,innerRadius:i,outerRadius:s,cornerRadius:Math.min(x,y/2),forceCornerRadius:a,cornerIsExternal:l,startAngle:c,endAngle:d}):S=F4({cx:n,cy:r,innerRadius:i,outerRadius:s,startAngle:c,endAngle:d}),R.createElement("path",xC({},Ko(e),{className:m,d:S}))};function FJ(t,e,n){if(t==="horizontal")return[{x:e.x,y:n.top},{x:e.x,y:n.top+n.height}];if(t==="vertical")return[{x:n.left,y:e.y},{x:n.left+n.width,y:e.y}];if(b5(e)){if(t==="centric"){var r=e.cx,i=e.cy,s=e.innerRadius,o=e.outerRadius,a=e.angle,l=zi(r,i,s,a),c=zi(r,i,o,a);return[{x:l.x,y:l.y},{x:c.x,y:c.y}]}return j4(e)}}function zJ(t){return O5(t)?NaN:Number(t)}function PE(t){return t?(t=zJ(t),t===1/0||t===-1/0?(t<0?-1:1)*Number.MAX_VALUE:t===t?t:0):t===0?t:0}function z4(t,e,n){n&&typeof n!="number"&&JT(t,e,n)&&(e=n=void 0),t=PE(t),e===void 0?(e=t,t=0):e=PE(e),n=n===void 0?tt.chartData,qP=Oe([Wa],t=>{var e=t.chartData!=null?t.chartData.length-1:0;return{chartData:t.chartData,computedData:t.computedData,dataEndIndex:e,dataStartIndex:0}}),bS=(t,e,n,r)=>r?qP(t):Wa(t),BJ=(t,e,n)=>n?qP(t):Wa(t),HJ=Oe([bS],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});Oe([qP],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});var VJ=Oe([Wa],t=>{var e=t.chartData,n=t.dataStartIndex,r=t.dataEndIndex;return e!=null?e.slice(n,r+1):[]});function KP(t,e){return XJ(t)||$J(t,e)||WJ(t,e)||GJ()}function GJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WJ(t,e){if(t){if(typeof t=="string")return mO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mO(t,e):void 0}}function mO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.e^s.s<0?1:-1;for(r=s.d.length,i=t.d.length,e=0,n=rt.d[e]^s.s<0?1:-1;return r===i?0:r>i^s.s<0?1:-1};At.decimalPlaces=At.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*or;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};At.dividedBy=At.div=function(t){return Vc(this,new this.constructor(t))};At.dividedToIntegerBy=At.idiv=function(t){var e=this,n=e.constructor;return Yn(Vc(e,new n(t),0,1),n.precision)};At.equals=At.eq=function(t){return!this.cmp(t)};At.exponent=function(){return Vr(this)};At.greaterThan=At.gt=function(t){return this.cmp(t)>0};At.greaterThanOrEqualTo=At.gte=function(t){return this.cmp(t)>=0};At.isInteger=At.isint=function(){return this.e>this.d.length-2};At.isNegative=At.isneg=function(){return this.s<0};At.isPositive=At.ispos=function(){return this.s>0};At.isZero=function(){return this.s===0};At.lessThan=At.lt=function(t){return this.cmp(t)<0};At.lessThanOrEqualTo=At.lte=function(t){return this.cmp(t)<1};At.logarithm=At.log=function(t){var e,n=this,r=n.constructor,i=r.precision,s=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(yo))throw Error(Zo+"NaN");if(n.s<1)throw Error(Zo+(n.s?"NaN":"-Infinity"));return n.eq(yo)?new r(0):(ur=!1,e=Vc(m0(n,s),m0(t,s),s),ur=!0,Yn(e,i))};At.minus=At.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?W4(e,t):V4(e,(t.s=-t.s,t))};At.modulo=At.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Zo+"NaN");return n.s?(ur=!1,e=Vc(n,t,0,1).times(t),ur=!0,n.minus(e)):Yn(new r(n),i)};At.naturalExponential=At.exp=function(){return G4(this)};At.naturalLogarithm=At.ln=function(){return m0(this)};At.negated=At.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};At.plus=At.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?V4(e,t):W4(e,(t.s=-t.s,t))};At.precision=At.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(_h+t);if(e=Vr(i)+1,r=i.d.length-1,n=r*or+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};At.squareRoot=At.sqrt=function(){var t,e,n,r,i,s,o,a=this,l=a.constructor;if(a.s<1){if(!a.s)return new l(0);throw Error(Zo+"NaN")}for(t=Vr(a),ur=!1,i=Math.sqrt(+a),i==0||i==1/0?(e=Sl(a.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=Gg((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=o=n+3;;)if(s=r,r=s.plus(Vc(a,s,o+2)).times(.5),Sl(s.d).slice(0,o)===(e=Sl(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),i==o&&e=="4999"){if(Yn(s,n+1,0),s.times(s).eq(a)){r=s;break}}else if(e!="9999")break;o+=4}return ur=!0,Yn(r,n)};At.times=At.mul=function(t){var e,n,r,i,s,o,a,l,c,d=this,f=d.constructor,m=d.d,y=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=m.length,c=y.length,l=0;){for(e=0,i=l+r;i>r;)a=s[i]+y[r]*m[i-r-1]+e,s[i--]=a%vi|0,e=a/vi|0;s[i]=(s[i]+e)%vi|0}for(;!s[--o];)s.pop();return e?++n:s.shift(),t.d=s,t.e=n,ur?Yn(t,f.precision):t};At.toDecimalPlaces=At.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Ol(t,0,Vg),e===void 0?e=r.rounding:Ol(e,0,8),Yn(n,t+Vr(n)+1,e))};At.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Oh(r,!0):(Ol(t,0,Vg),e===void 0?e=i.rounding:Ol(e,0,8),r=Yn(new i(r),t+1,e),n=Oh(r,!0,t+1)),n};At.toFixed=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?Oh(i):(Ol(t,0,Vg),e===void 0?e=s.rounding:Ol(e,0,8),r=Yn(new s(i),t+Vr(i)+1,e),n=Oh(r.abs(),!1,t+Vr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};At.toInteger=At.toint=function(){var t=this,e=t.constructor;return Yn(new e(t),Vr(t)+1,e.rounding)};At.toNumber=function(){return+this};At.toPower=At.pow=function(t){var e,n,r,i,s,o,a=this,l=a.constructor,c=12,d=+(t=new l(t));if(!t.s)return new l(yo);if(a=new l(a),!a.s){if(t.s<1)throw Error(Zo+"Infinity");return a}if(a.eq(yo))return a;if(r=l.precision,t.eq(yo))return Yn(a,r);if(e=t.e,n=t.d.length-1,o=e>=n,s=a.s,o){if((n=d<0?-d:d)<=H4){for(i=new l(yo),e=Math.ceil(r/or+4),ur=!1;n%2&&(i=i.times(a),yO(i.d,e)),n=Gg(n/2),n!==0;)a=a.times(a),yO(a.d,e);return ur=!0,t.s<0?new l(yo).div(i):Yn(i,r)}}else if(s<0)throw Error(Zo+"NaN");return s=s<0&&t.d[Math.max(e,n)]&1?-1:1,a.s=1,ur=!1,i=t.times(m0(a,r+c)),ur=!0,i=G4(i),i.s=s,i};At.toPrecision=function(t,e){var n,r,i=this,s=i.constructor;return t===void 0?(n=Vr(i),r=Oh(i,n<=s.toExpNeg||n>=s.toExpPos)):(Ol(t,1,Vg),e===void 0?e=s.rounding:Ol(e,0,8),i=Yn(new s(i),t,e),n=Vr(i),r=Oh(i,t<=n||n<=s.toExpNeg,t)),r};At.toSignificantDigits=At.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Ol(t,1,Vg),e===void 0?e=r.rounding:Ol(e,0,8)),Yn(new r(n),t,e)};At.toString=At.valueOf=At.val=At.toJSON=At[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Vr(t),n=t.constructor;return Oh(t,e<=n.toExpNeg||e>=n.toExpPos)};function V4(t,e){var n,r,i,s,o,a,l,c,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),ur?Yn(e,f):e;if(l=t.d,c=e.d,o=t.e,i=e.e,l=l.slice(),s=o-i,s){for(s<0?(r=l,s=-s,a=c.length):(r=c,i=o,a=l.length),o=Math.ceil(f/or),a=o>a?o+1:a+1,s>a&&(s=a,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(a=l.length,s=c.length,a-s<0&&(s=a,r=c,c=l,l=r),n=0;s;)n=(l[--s]=l[s]+c[s]+n)/vi|0,l[s]%=vi;for(n&&(l.unshift(n),++i),a=l.length;l[--a]==0;)l.pop();return e.d=l,e.e=i,ur?Yn(e,f):e}function Ol(t,e,n){if(t!==~~t||tn)throw Error(_h+t)}function Sl(t){var e,n,r,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;eo?1:-1;else for(a=l=0;ai[a]?1:-1;break}return l}function n(r,i,s){for(var o=0;s--;)r[s]-=o,o=r[s]1;)r.shift()}return function(r,i,s,o){var a,l,c,d,f,m,y,x,S,w,b,E,T,C,O,N,D,F,V=r.constructor,k=r.s==i.s?1:-1,j=r.d,H=i.d;if(!r.s)return new V(r);if(!i.s)throw Error(Zo+"Division by zero");for(l=r.e-i.e,D=H.length,O=j.length,y=new V(k),x=y.d=[],c=0;H[c]==(j[c]||0);)++c;if(H[c]>(j[c]||0)&&--l,s==null?E=s=V.precision:o?E=s+(Vr(r)-Vr(i))+1:E=s,E<0)return new V(0);if(E=E/or+2|0,c=0,D==1)for(d=0,H=H[0],E++;(c1&&(H=t(H,d),j=t(j,d),D=H.length,O=j.length),C=D,S=j.slice(0,D),w=S.length;w=vi/2&&++N;do d=0,a=e(H,S,D,w),a<0?(b=S[0],D!=w&&(b=b*vi+(S[1]||0)),d=b/N|0,d>1?(d>=vi&&(d=vi-1),f=t(H,d),m=f.length,w=S.length,a=e(f,S,m,w),a==1&&(d--,n(f,D16)throw Error(YP+Vr(t));if(!t.s)return new d(yo);for(ur=!1,a=f,o=new d(.03125);t.abs().gte(.1);)t=t.times(o),c+=5;for(r=Math.log($f(2,c))/Math.LN10*2+5|0,a+=r,n=i=s=new d(yo),d.precision=a;;){if(i=Yn(i.times(t),a),n=n.times(++l),o=s.plus(Vc(i,n,a)),Sl(o.d).slice(0,a)===Sl(s.d).slice(0,a)){for(;c--;)s=Yn(s.times(s),a);return d.precision=f,e==null?(ur=!0,Yn(s,f)):s}s=o}}function Vr(t){for(var e=t.e*or,n=t.d[0];n>=10;n/=10)e++;return e}function RE(t,e,n){if(e>t.LN10.sd())throw ur=!0,n&&(t.precision=n),Error(Zo+"LN10 precision limit exceeded");return Yn(new t(t.LN10),e)}function ad(t){for(var e="";t--;)e+="0";return e}function m0(t,e){var n,r,i,s,o,a,l,c,d,f=1,m=10,y=t,x=y.d,S=y.constructor,w=S.precision;if(y.s<1)throw Error(Zo+(y.s?"NaN":"-Infinity"));if(y.eq(yo))return new S(0);if(e==null?(ur=!1,c=w):c=e,y.eq(10))return e==null&&(ur=!0),RE(S,c);if(c+=m,S.precision=c,n=Sl(x),r=n.charAt(0),s=Vr(y),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)y=y.times(t),n=Sl(y.d),r=n.charAt(0),f++;s=Vr(y),r>1?(y=new S("0."+n),s++):y=new S(r+"."+n.slice(1))}else return l=RE(S,c+2,w).times(s+""),y=m0(new S(r+"."+n.slice(1)),c-m).plus(l),S.precision=w,e==null?(ur=!0,Yn(y,w)):y;for(a=o=y=Vc(y.minus(yo),y.plus(yo),c),d=Yn(y.times(y),c),i=3;;){if(o=Yn(o.times(d),c),l=a.plus(Vc(o,new S(i),c)),Sl(l.d).slice(0,c)===Sl(a.d).slice(0,c))return a=a.times(2),s!==0&&(a=a.plus(RE(S,c+2,w).times(s+""))),a=Vc(a,new S(f),c),S.precision=w,e==null?(ur=!0,Yn(a,w)):a;a=l,i+=2}}function vO(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=Gg(n/or),t.d=[],r=(n+1)%or,n<0&&(r+=or),rAw||t.e<-Aw))throw Error(YP+n)}else t.s=0,t.e=0,t.d=[0];return t}function Yn(t,e,n){var r,i,s,o,a,l,c,d,f=t.d;for(o=1,s=f[0];s>=10;s/=10)o++;if(r=e-o,r<0)r+=or,i=e,c=f[d=0];else{if(d=Math.ceil((r+1)/or),s=f.length,d>=s)return t;for(c=s=f[d],o=1;s>=10;s/=10)o++;r%=or,i=r-or+o}if(n!==void 0&&(s=$f(10,o-i-1),a=c/s%10|0,l=e<0||f[d+1]!==void 0||c%s,l=n<4?(a||l)&&(n==0||n==(t.s<0?3:2)):a>5||a==5&&(n==4||l||n==6&&(r>0?i>0?c/$f(10,o-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(s=Vr(t),f.length=1,e=e-s-1,f[0]=$f(10,(or-e%or)%or),t.e=Gg(-e/or)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,s=1,d--):(f.length=d+1,s=$f(10,or-r),f[d]=i>0?(c/$f(10,o-i)%$f(10,i)|0)*s:0),l)for(;;)if(d==0){(f[0]+=s)==vi&&(f[0]=1,++t.e);break}else{if(f[d]+=s,f[d]!=vi)break;f[d--]=0,s=1}for(r=f.length;f[--r]===0;)f.pop();if(ur&&(t.e>Aw||t.e<-Aw))throw Error(YP+Vr(t));return t}function W4(t,e){var n,r,i,s,o,a,l,c,d,f,m=t.constructor,y=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),ur?Yn(e,y):e;if(l=t.d,f=e.d,r=e.e,c=t.e,l=l.slice(),o=c-r,o){for(d=o<0,d?(n=l,o=-o,a=f.length):(n=f,r=c,a=l.length),i=Math.max(Math.ceil(y/or),a)+2,o>i&&(o=i,n.length=1),n.reverse(),i=o;i--;)n.push(0);n.reverse()}else{for(i=l.length,a=f.length,d=i0;--i)l[a++]=0;for(i=f.length;i>o;){if(l[--i]0?s=s.charAt(0)+"."+s.slice(1)+ad(r):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(i<0?"e":"e+")+i):i<0?(s="0."+ad(-i-1)+s,n&&(r=n-o)>0&&(s+=ad(r))):i>=o?(s+=ad(i+1-o),n&&(r=n-i-1)>0&&(s=s+"."+ad(r))):((r=i+1)0&&(i+1===o&&(s+="."),s+=ad(r))),t.s<0?"-"+s:s}function yO(t,e){if(t.length>e)return t.length=e,!0}function $4(t){var e,n,r;function i(s){var o=this;if(!(o instanceof i))return new i(s);if(o.constructor=i,s instanceof i){o.s=s.s,o.e=s.e,o.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(_h+s);if(s>0)o.s=1;else if(s<0)s=-s,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(s===~~s&&s<1e7){o.e=0,o.d=[s];return}return vO(o,s.toString())}else if(typeof s!="string")throw Error(_h+s);if(s.charCodeAt(0)===45?(s=s.slice(1),o.s=-1):o.s=1,YJ.test(s))vO(o,s);else throw Error(_h+s)}if(i.prototype=At,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=$4,i.config=i.set=ZJ,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(_h+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(_h+n+": "+r);return this}var ZP=$4(KJ);yo=new ZP(1);const Tn=ZP;function X4(t){var e;return t===0?e=1:e=Math.floor(new Tn(t).abs().log(10).toNumber())+1,e}function q4(t,e,n){for(var r=new Tn(t),i=0,s=[];r.lt(e)&&i<1e5;)s.push(r.toNumber()),r=r.add(n),i++;return s}function g0(t,e){return tee(t)||eee(t,e)||JJ(t,e)||QJ()}function QJ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JJ(t,e){if(t){if(typeof t=="string")return xO(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xO(t,e):void 0}}function xO(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=g0(t,2),n=e[0],r=e[1],i=n,s=r;return n>r&&(i=r,s=n),[i,s]},QP=(t,e,n)=>{if(t.lte(0))return new Tn(0);var r=X4(t.toNumber()),i=new Tn(10).pow(r),s=t.div(i),o=r!==1?.05:.1,a=new Tn(Math.ceil(s.div(o).toNumber())).add(n).mul(o),l=a.mul(i);return e?new Tn(l.toNumber()):new Tn(Math.ceil(l.toNumber()))},Y4=(t,e,n)=>{var r;if(t.lte(0))return new Tn(0);var i=[1,2,2.5,5],s=t.toNumber(),o=Math.floor(new Tn(s).abs().log(10).toNumber()),a=new Tn(10).pow(o),l=t.div(a).toNumber(),c=i.findIndex(y=>y>=l-1e-10);if(c===-1&&(a=a.mul(10),c=0),c+=n,c>=i.length){var d=Math.floor(c/i.length);c%=i.length,a=a.mul(new Tn(10).pow(d))}var f=(r=i[c])!==null&&r!==void 0?r:1,m=new Tn(f).mul(a);return e?m:new Tn(Math.ceil(m.toNumber()))},nee=(t,e,n)=>{var r=new Tn(1),i=new Tn(t);if(!i.isint()&&n){var s=Math.abs(t);s<1?(r=new Tn(10).pow(X4(t)-1),i=new Tn(Math.floor(i.div(r).toNumber())).mul(r)):s>1&&(i=new Tn(Math.floor(t)))}else t===0?i=new Tn(Math.floor((e-1)/2)):n||(i=new Tn(Math.floor(t)));for(var o=Math.floor((e-1)/2),a=[],l=0;l4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:QP;if(!Number.isFinite((n-e)/(r-1)))return{step:new Tn(0),tickMin:new Tn(0),tickMax:new Tn(0)};var a=o(new Tn(n).sub(e).div(r-1),i,s),l;e<=0&&n>=0?l=new Tn(0):(l=new Tn(e).add(n).div(2),l=l.sub(new Tn(l).mod(a)));var c=Math.ceil(l.sub(e).div(a).toNumber()),d=Math.ceil(new Tn(n).sub(l).div(a).toNumber()),f=c+d+1;return f>r?Z4(e,n,r,i,s+1,o):(f0?d+(r-f):d,c=n>0?c:c+(r-f)),{step:a,tickMin:l.sub(new Tn(c).mul(a)),tickMax:l.add(new Tn(d).mul(a))})},bO=function(e){var n=g0(e,2),r=n[0],i=n[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=Math.max(s,2),c=K4([r,i]),d=g0(c,2),f=d[0],m=d[1];if(f===-1/0||m===1/0){var y=m===1/0?[f,...Array(s-1).fill(1/0)]:[...Array(s-1).fill(-1/0),m];return r>i?y.reverse():y}if(f===m)return nee(f,s,o);var x=a==="snap125"?Y4:QP,S=Z4(f,m,l,o,0,x),w=S.step,b=S.tickMin,E=S.tickMax,T=q4(b,E.add(new Tn(.1).mul(w)),w);return r>i?T.reverse():T},_O=function(e,n){var r=g0(e,2),i=r[0],s=r[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"auto",l=K4([i,s]),c=g0(l,2),d=c[0],f=c[1];if(d===-1/0||f===1/0)return[i,s];if(d===f)return[d];var m=a==="snap125"?Y4:QP,y=Math.max(n,2),x=m(new Tn(f).sub(d).div(y-1),o,0),S=[...q4(new Tn(d),new Tn(f),x),f];return o===!1&&(S=S.map(w=>Math.round(w))),i>s?S.reverse():S},ree=t=>t.rootProps.barCategoryGap,_S=t=>t.rootProps.stackOffset,Q4=t=>t.rootProps.reverseStackOrder,JP=t=>t.options.chartName,e2=t=>t.rootProps.syncId,J4=t=>t.rootProps.syncMethod,t2=t=>t.options.eventEmitter,iee=t=>t.rootProps.baseValue,Ms={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},wf={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},fl={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},wS=(t,e)=>{if(!(!t||!e))return t!=null&&t.reversed?[e[1],e[0]]:e};function SS(t,e,n){if(n!=="auto")return n;if(t!=null)return Fl(t,e)?"category":"number"}function wO(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Tw(t){for(var e=1;e{if(e!=null)return t.polarAxis.angleAxis[e]},n2=Oe([lee,S4],(t,e)=>{var n;if(t!=null)return t;var r=(n=SS(e,"angleAxis",SO.type))!==null&&n!==void 0?n:"category";return Tw(Tw({},SO),{},{type:r})}),cee=(t,e)=>t.polarAxis.radiusAxis[e],r2=Oe([cee,S4],(t,e)=>{var n;if(t!=null)return t;var r=(n=SS(e,"radiusAxis",MO.type))!==null&&n!==void 0?n:"category";return Tw(Tw({},MO),{},{type:r})}),MS=t=>t.polarOptions,i2=Oe([tu,nu,Gi],PJ),ez=Oe([MS,i2],(t,e)=>{if(t!=null)return Ad(t.innerRadius,e,0)}),tz=Oe([MS,i2],(t,e)=>{if(t!=null)return Ad(t.outerRadius,e,e*.8)}),uee=t=>{if(t==null)return[0,0];var e=t.startAngle,n=t.endAngle;return[e,n]},nz=Oe([MS],uee);Oe([n2,nz],wS);var rz=Oe([i2,ez,tz],(t,e,n)=>{if(!(t==null||e==null||n==null))return[e,n]});Oe([r2,rz],wS);var iz=Oe([fr,MS,ez,tz,tu,nu],(t,e,n,r,i,s)=>{if(!(t!=="centric"&&t!=="radial"||e==null||n==null||r==null)){var o=e.cx,a=e.cy,l=e.startAngle,c=e.endAngle;return{cx:Ad(o,i,i/2),cy:Ad(a,s,s/2),innerRadius:n,outerRadius:r,startAngle:l,endAngle:c,clockWise:!1}}}),bi=(t,e)=>e,ES=(t,e,n)=>n;function s2(t){return t==null?void 0:t.id}function sz(t,e,n){var r=e.chartData,i=r===void 0?[]:r,s=n.allowDuplicatedCategory,o=n.dataKey,a=new Map;return t.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:i;if(!(d==null||d.length===0)){var f=s2(l);d.forEach((m,y)=>{var x=o==null||s?y:String(yi(m,o,null)),S=yi(m,l.dataKey,0),w;a.has(x)?w=a.get(x):w={},Object.assign(w,{[f]:S}),a.set(x,w)})}}),Array.from(a.values())}function o2(t){return"stackId"in t&&t.stackId!=null&&t.dataKey!=null}var AS=(t,e)=>t===e?!0:t==null||e==null?!1:t[0]===e[0]&&t[1]===e[1];function TS(t,e){return Array.isArray(t)&&Array.isArray(e)&&t.length===0&&e.length===0?!0:t===e}function dee(t,e){if(t.length===e.length){for(var n=0;n{var e=fr(t);return e==="horizontal"?"xAxis":e==="vertical"?"yAxis":e==="centric"?"angleAxis":"radiusAxis"},Wg=t=>t.tooltip.settings.axisId;function a2(t){if(t!=null){var e=t.ticks,n=t.bandwidth,r=t.range(),i=[Math.min(...r),Math.max(...r)];return{domain:()=>t.domain(),range:(function(s){function o(){return s.apply(this,arguments)}return o.toString=function(){return s.toString()},o})(()=>i),rangeMin:()=>i[0],rangeMax:()=>i[1],isInRange(s){var o=i[0],a=i[1];return o<=a?s>=o&&s<=a:s>=a&&s<=o},bandwidth:n?()=>n.call(t):void 0,ticks:e?s=>e.call(t,s):void 0,map:(s,o)=>{var a=t(s);if(a!=null){if(t.bandwidth&&o!==null&&o!==void 0&&o.position){var l=t.bandwidth();switch(o.position){case"middle":a+=l/2;break;case"end":a+=l;break}}return a}}}}}var fee=(t,e)=>{if(e!=null)switch(t){case"linear":{if(!Al(e)){for(var n,r,i=0;ir)&&(r=s))}return n!==void 0&&r!==void 0?[n,r]:void 0}return e}default:return e}};function wd(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function hee(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function l2(t){let e,n,r;t.length!==2?(e=wd,n=(a,l)=>wd(t(a),l),r=(a,l)=>t(a)-l):(e=t===wd||t===hee?t:pee,n=t,r=t);function i(a,l,c=0,d=a.length){if(c>>1;n(a[f],l)<0?c=f+1:d=f}while(c>>1;n(a[f],l)<=0?c=f+1:d=f}while(cc&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function pee(){return 0}function oz(t){return t===null?NaN:+t}function*mee(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const gee=l2(wd),Q0=gee.right;l2(oz).center;class EO extends Map{constructor(e,n=xee){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(AO(this,e))}has(e){return super.has(AO(this,e))}set(e,n){return super.set(vee(this,e),n)}delete(e){return super.delete(yee(this,e))}}function AO({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function vee({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function yee({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function xee(t){return t!==null&&typeof t=="object"?t.valueOf():t}function bee(t=wd){if(t===wd)return az;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function az(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const _ee=Math.sqrt(50),wee=Math.sqrt(10),See=Math.sqrt(2);function Cw(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=_ee?10:s>=wee?5:s>=See?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(t*c),l=Math.round(e*c),a/ce&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*ce&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let c=0;c=r)&&(n=r);return n}function CO(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function lz(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?az:bee(i);r>n;){if(r-n>600){const l=r-n+1,c=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),m=.5*Math.sqrt(d*f*(l-f)/l)*(c-l/2<0?-1:1),y=Math.max(n,Math.floor(e-c*f/l+m)),x=Math.min(r,Math.floor(e+(l-c)*f/l+m));lz(t,e,y,x,i)}const s=t[e];let o=n,a=r;for(ly(t,n,e),i(t[r],s)>0&&ly(t,n,r);o0;)--a}i(t[n],s)===0?ly(t,n,a):(++a,ly(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function ly(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function Mee(t,e,n){if(t=Float64Array.from(mee(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return CO(t);if(e>=1)return TO(t);var r,i=(r-1)*e,s=Math.floor(i),o=TO(lz(t,s).subarray(0,s+1)),a=CO(t.subarray(s+1));return o+(a-o)*(i-s)}}function Eee(t,e,n=oz){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,s=Math.floor(i),o=+n(t[s],s,t),a=+n(t[s+1],s+1,t);return o+(a-o)*(i-s)}}function Aee(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,s=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Pb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Pb(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=Pee.exec(t))?new Ys(e[1],e[2],e[3],1):(e=Ree.exec(t))?new Ys(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Nee.exec(t))?Pb(e[1],e[2],e[3],e[4]):(e=Iee.exec(t))?Pb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=kee.exec(t))?LO(e[1],e[2]/100,e[3]/100,1):(e=Oee.exec(t))?LO(e[1],e[2]/100,e[3]/100,e[4]):PO.hasOwnProperty(t)?IO(PO[t]):t==="transparent"?new Ys(NaN,NaN,NaN,0):null}function IO(t){return new Ys(t>>16&255,t>>8&255,t&255,1)}function Pb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ys(t,e,n,r)}function Uee(t){return t instanceof J0||(t=x0(t)),t?(t=t.rgb(),new Ys(t.r,t.g,t.b,t.opacity)):new Ys}function MC(t,e,n,r){return arguments.length===1?Uee(t):new Ys(t,e,n,r??1)}function Ys(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}d2(Ys,MC,uz(J0,{brighter(t){return t=t==null?Pw:Math.pow(Pw,t),new Ys(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?v0:Math.pow(v0,t),new Ys(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ys(wh(this.r),wh(this.g),wh(this.b),Rw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:kO,formatHex:kO,formatHex8:jee,formatRgb:OO,toString:OO}));function kO(){return`#${th(this.r)}${th(this.g)}${th(this.b)}`}function jee(){return`#${th(this.r)}${th(this.g)}${th(this.b)}${th((isNaN(this.opacity)?1:this.opacity)*255)}`}function OO(){const t=Rw(this.opacity);return`${t===1?"rgb(":"rgba("}${wh(this.r)}, ${wh(this.g)}, ${wh(this.b)}${t===1?")":`, ${t})`}`}function Rw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function wh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function th(t){return t=wh(t),(t<16?"0":"")+t.toString(16)}function LO(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ja(t,e,n,r)}function dz(t){if(t instanceof ja)return new ja(t.h,t.s,t.l,t.opacity);if(t instanceof J0||(t=x0(t)),!t)return new ja;if(t instanceof ja)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n0&&l<1?0:o,new ja(o,a,l,t.opacity)}function Fee(t,e,n,r){return arguments.length===1?dz(t):new ja(t,e,n,r??1)}function ja(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}d2(ja,Fee,uz(J0,{brighter(t){return t=t==null?Pw:Math.pow(Pw,t),new ja(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?v0:Math.pow(v0,t),new ja(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ys(NE(t>=240?t-240:t+120,i,r),NE(t,i,r),NE(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new ja(DO(this.h),Rb(this.s),Rb(this.l),Rw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Rw(this.opacity);return`${t===1?"hsl(":"hsla("}${DO(this.h)}, ${Rb(this.s)*100}%, ${Rb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function DO(t){return t=(t||0)%360,t<0?t+360:t}function Rb(t){return Math.max(0,Math.min(1,t||0))}function NE(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const f2=t=>()=>t;function zee(t,e){return function(n){return t+n*e}}function Bee(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Hee(t){return(t=+t)==1?fz:function(e,n){return n-e?Bee(e,n,t):f2(isNaN(e)?n:e)}}function fz(t,e){var n=e-t;return n?zee(t,n):f2(isNaN(t)?e:t)}const UO=(function t(e){var n=Hee(e);function r(i,s){var o=n((i=MC(i)).r,(s=MC(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),c=fz(i.opacity,s.opacity);return function(d){return i.r=o(d),i.g=a(d),i.b=l(d),i.opacity=c(d),i+""}}return r.gamma=t,r})(1);function Vee(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(s){for(i=0;in&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:Nw(r,i)})),n=IE.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function ete(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?tte:ete,l=c=null,f}function f(m){return m==null||isNaN(m=+m)?s:(l||(l=a(t.map(r),e,n)))(r(o(m)))}return f.invert=function(m){return o(i((c||(c=a(e,t.map(r),Nw)))(m)))},f.domain=function(m){return arguments.length?(t=Array.from(m,Iw),d()):t.slice()},f.range=function(m){return arguments.length?(e=Array.from(m),d()):e.slice()},f.rangeRound=function(m){return e=Array.from(m),n=h2,d()},f.clamp=function(m){return arguments.length?(o=m?!0:Es,d()):o!==Es},f.interpolate=function(m){return arguments.length?(n=m,d()):n},f.unknown=function(m){return arguments.length?(s=m,f):s},function(m,y){return r=m,i=y,d()}}function p2(){return CS()(Es,Es)}function nte(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function kw(t,e){if(!isFinite(t)||t===0)return null;var n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"),r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Eg(t){return t=kw(Math.abs(t)),t?t[1]:NaN}function rte(t,e){return function(n,r){for(var i=n.length,s=[],o=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[o=(o+1)%t.length];return s.reverse().join(e)}}function ite(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var ste=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function b0(t){if(!(e=ste.exec(t)))throw new Error("invalid format: "+t);var e;return new m2({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}b0.prototype=m2.prototype;function m2(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}m2.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function ote(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var Ow;function ate(t,e){var n=kw(t,e);if(!n)return Ow=void 0,t.toPrecision(e);var r=n[0],i=n[1],s=i-(Ow=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+kw(t,Math.max(0,e+s-1))[0]}function FO(t,e){var n=kw(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const zO={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:nte,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>FO(t*100,e),r:FO,s:ate,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function BO(t){return t}var HO=Array.prototype.map,VO=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function lte(t){var e=t.grouping===void 0||t.thousands===void 0?BO:rte(HO.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?BO:ite(HO.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function c(f,m){f=b0(f);var y=f.fill,x=f.align,S=f.sign,w=f.symbol,b=f.zero,E=f.width,T=f.comma,C=f.precision,O=f.trim,N=f.type;N==="n"?(T=!0,N="g"):zO[N]||(C===void 0&&(C=12),O=!0,N="g"),(b||y==="0"&&x==="=")&&(b=!0,y="0",x="=");var D=(m&&m.prefix!==void 0?m.prefix:"")+(w==="$"?n:w==="#"&&/[boxX]/.test(N)?"0"+N.toLowerCase():""),F=(w==="$"?r:/[%p]/.test(N)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),V=zO[N],k=/[defgprs%]/.test(N);C=C===void 0?6:/[gprs]/.test(N)?Math.max(1,Math.min(21,C)):Math.max(0,Math.min(20,C));function j(H){var ne=D,J=F,de,oe,he;if(N==="c")J=V(H)+J,H="";else{H=+H;var B=H<0||1/H<0;if(H=isNaN(H)?l:V(Math.abs(H),C),O&&(H=ote(H)),B&&+H==0&&S!=="+"&&(B=!1),ne=(B?S==="("?S:a:S==="-"||S==="("?"":S)+ne,J=(N==="s"&&!isNaN(H)&&Ow!==void 0?VO[8+Ow/3]:"")+J+(B&&S==="("?")":""),k){for(de=-1,oe=H.length;++dehe||he>57){J=(he===46?i+H.slice(de+1):H.slice(de))+J,H=H.slice(0,de);break}}}T&&!b&&(H=e(H,1/0));var K=ne.length+H.length+J.length,q=K>1)+ne+H+J+q.slice(K);break;default:H=q+ne+H+J;break}return s(H)}return j.toString=function(){return f+""},j}function d(f,m){var y=Math.max(-8,Math.min(8,Math.floor(Eg(m)/3)))*3,x=Math.pow(10,-y),S=c((f=b0(f),f.type="f",f),{suffix:VO[8+y/3]});return function(w){return S(x*w)}}return{format:c,formatPrefix:d}}var Nb,g2,hz;cte({thousands:",",grouping:[3],currency:["$",""]});function cte(t){return Nb=lte(t),g2=Nb.format,hz=Nb.formatPrefix,Nb}function ute(t){return Math.max(0,-Eg(Math.abs(t)))}function dte(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eg(e)/3)))*3-Eg(Math.abs(t)))}function fte(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Eg(e)-Eg(t))+1}function pz(t,e,n,r){var i=wC(t,e,n),s;switch(r=b0(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=dte(i,o))&&(r.precision=s),hz(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=fte(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=ute(i))&&(r.precision=s-(r.type==="%")*2);break}}return g2(r)}function Rd(t){var e=t.domain;return t.ticks=function(n){var r=e();return bC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return pz(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,o=r[i],a=r[s],l,c,d=10;for(a0;){if(c=_C(o,a,n),c===l)return r[i]=o,r[s]=a,e(r);if(c>0)o=Math.floor(o/c)*c,a=Math.ceil(a/c)*c;else if(c<0)o=Math.ceil(o*c)/c,a=Math.floor(a*c)/c;else break;l=c}return t},t}function mz(){var t=p2();return t.copy=function(){return ex(t,mz())},ea.apply(t,arguments),Rd(t)}function gz(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,Iw),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return gz(t).unknown(e)},t=arguments.length?Array.from(t,Iw):[0,1],Rd(n)}function vz(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function vte(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function $O(t){return(e,n)=>-t(-e,n)}function v2(t){const e=t(GO,WO),n=e.domain;let r=10,i,s;function o(){return i=vte(r),s=gte(r),n()[0]<0?(i=$O(i),s=$O(s),t(hte,pte)):t(GO,WO),e}return e.base=function(a){return arguments.length?(r=+a,o()):r},e.domain=function(a){return arguments.length?(n(a),o()):n()},e.ticks=a=>{const l=n();let c=l[0],d=l[l.length-1];const f=d0){for(;m<=y;++m)for(x=1;xd)break;b.push(S)}}else for(;m<=y;++m)for(x=r-1;x>=1;--x)if(S=m>0?x/s(-m):x*s(m),!(Sd)break;b.push(S)}b.length*2{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=b0(l)).precision==null&&(l.trim=!0),l=g2(l)),a===1/0)return l;const c=Math.max(1,r*a/e.ticks().length);return d=>{let f=d/s(Math.round(i(d)));return f*rn(vz(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function yz(){const t=v2(CS()).domain([1,10]);return t.copy=()=>ex(t,yz()).base(t.base()),ea.apply(t,arguments),t}function XO(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function qO(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function y2(t){var e=1,n=t(XO(e),qO(e));return n.constant=function(r){return arguments.length?t(XO(e=+r),qO(e)):e},Rd(n)}function xz(){var t=y2(CS());return t.copy=function(){return ex(t,xz()).constant(t.constant())},ea.apply(t,arguments)}function KO(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function yte(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function xte(t){return t<0?-t*t:t*t}function x2(t){var e=t(Es,Es),n=1;function r(){return n===1?t(Es,Es):n===.5?t(yte,xte):t(KO(n),KO(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Rd(e)}function b2(){var t=x2(CS());return t.copy=function(){return ex(t,b2()).exponent(t.exponent())},ea.apply(t,arguments),t}function bte(){return b2.apply(null,arguments).exponent(.5)}function YO(t){return Math.sign(t)*t*t}function _te(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function bz(){var t=p2(),e=[0,1],n=!1,r;function i(s){var o=_te(t(s));return isNaN(o)?r:n?Math.round(o):o}return i.invert=function(s){return t.invert(YO(s))},i.domain=function(s){return arguments.length?(t.domain(s),i):t.domain()},i.range=function(s){return arguments.length?(t.range((e=Array.from(s,Iw)).map(YO)),i):e.slice()},i.rangeRound=function(s){return i.range(s).round(!0)},i.round=function(s){return arguments.length?(n=!!s,i):n},i.clamp=function(s){return arguments.length?(t.clamp(s),i):t.clamp()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return bz(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},ea.apply(i,arguments),Rd(i)}function _z(){var t=[],e=[],n=[],r;function i(){var o=0,a=Math.max(1,e.length);for(n=new Array(a-1);++o0?n[a-1]:t[0],a=n?[r[n-1],e]:[r[c-1],r[c]]},o.unknown=function(l){return arguments.length&&(s=l),o},o.thresholds=function(){return r.slice()},o.copy=function(){return wz().domain([t,e]).range(i).unknown(s)},ea.apply(Rd(o),arguments)}function Sz(){var t=[.5],e=[0,1],n,r=1;function i(s){return s!=null&&s<=s?e[Q0(t,s,0,r)]:n}return i.domain=function(s){return arguments.length?(t=Array.from(s),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(s){return arguments.length?(e=Array.from(s),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(s){var o=e.indexOf(s);return[t[o-1],t[o]]},i.unknown=function(s){return arguments.length?(n=s,i):n},i.copy=function(){return Sz().domain(t).range(e).unknown(n)},ea.apply(i,arguments)}const kE=new Date,OE=new Date;function oi(t,e,n,r){function i(s){return t(s=arguments.length===0?new Date:new Date(+s)),s}return i.floor=s=>(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const o=i(s),a=i.ceil(s);return s-o(e(s=new Date(+s),o==null?1:Math.floor(o)),s),i.range=(s,o,a)=>{const l=[];if(s=i.ceil(s),a=a==null?1:Math.floor(a),!(s0))return l;let c;do l.push(c=new Date(+s)),e(s,a),t(s);while(coi(o=>{if(o>=o)for(;t(o),!s(o);)o.setTime(o-1)},(o,a)=>{if(o>=o)if(a<0)for(;++a<=0;)for(;e(o,-1),!s(o););else for(;--a>=0;)for(;e(o,1),!s(o););}),n&&(i.count=(s,o)=>(kE.setTime(+s),OE.setTime(+o),t(kE),t(OE),Math.floor(n(kE,OE))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?o=>r(o)%s===0:o=>i.count(0,o)%s===0):i)),i}const Lw=oi(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Lw.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?oi(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Lw);Lw.range;const jc=1e3,Xo=jc*60,Fc=Xo*60,Yc=Fc*24,_2=Yc*7,ZO=Yc*30,LE=Yc*365,nh=oi(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*jc)},(t,e)=>(e-t)/jc,t=>t.getUTCSeconds());nh.range;const w2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*jc)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getMinutes());w2.range;const S2=oi(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Xo)},(t,e)=>(e-t)/Xo,t=>t.getUTCMinutes());S2.range;const M2=oi(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*jc-t.getMinutes()*Xo)},(t,e)=>{t.setTime(+t+e*Fc)},(t,e)=>(e-t)/Fc,t=>t.getHours());M2.range;const E2=oi(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Fc)},(t,e)=>(e-t)/Fc,t=>t.getUTCHours());E2.range;const tx=oi(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Xo)/Yc,t=>t.getDate()-1);tx.range;const PS=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>t.getUTCDate()-1);PS.range;const Mz=oi(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Yc,t=>Math.floor(t/Yc));Mz.range;function Yh(t){return oi(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Xo)/_2)}const RS=Yh(0),Dw=Yh(1),wte=Yh(2),Ste=Yh(3),Ag=Yh(4),Mte=Yh(5),Ete=Yh(6);RS.range;Dw.range;wte.range;Ste.range;Ag.range;Mte.range;Ete.range;function Zh(t){return oi(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/_2)}const NS=Zh(0),Uw=Zh(1),Ate=Zh(2),Tte=Zh(3),Tg=Zh(4),Cte=Zh(5),Pte=Zh(6);NS.range;Uw.range;Ate.range;Tte.range;Tg.range;Cte.range;Pte.range;const A2=oi(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());A2.range;const T2=oi(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());T2.range;const Zc=oi(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Zc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Zc.range;const Qc=oi(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Qc.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:oi(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Qc.range;function Ez(t,e,n,r,i,s){const o=[[nh,1,jc],[nh,5,5*jc],[nh,15,15*jc],[nh,30,30*jc],[s,1,Xo],[s,5,5*Xo],[s,15,15*Xo],[s,30,30*Xo],[i,1,Fc],[i,3,3*Fc],[i,6,6*Fc],[i,12,12*Fc],[r,1,Yc],[r,2,2*Yc],[n,1,_2],[e,1,ZO],[e,3,3*ZO],[t,1,LE]];function a(c,d,f){const m=dw).right(o,m);if(y===o.length)return t.every(wC(c/LE,d/LE,f));if(y===0)return Lw.every(Math.max(wC(c,d,f),1));const[x,S]=o[m/o[y-1][2]53)return null;"w"in fe||(fe.w=1),"Z"in fe?(Ge=UE(cy(fe.y,0,1)),Ue=Ge.getUTCDay(),Ge=Ue>4||Ue===0?Uw.ceil(Ge):Uw(Ge),Ge=PS.offset(Ge,(fe.V-1)*7),fe.y=Ge.getUTCFullYear(),fe.m=Ge.getUTCMonth(),fe.d=Ge.getUTCDate()+(fe.w+6)%7):(Ge=DE(cy(fe.y,0,1)),Ue=Ge.getDay(),Ge=Ue>4||Ue===0?Dw.ceil(Ge):Dw(Ge),Ge=tx.offset(Ge,(fe.V-1)*7),fe.y=Ge.getFullYear(),fe.m=Ge.getMonth(),fe.d=Ge.getDate()+(fe.w+6)%7)}else("W"in fe||"U"in fe)&&("w"in fe||(fe.w="u"in fe?fe.u%7:"W"in fe?1:0),Ue="Z"in fe?UE(cy(fe.y,0,1)).getUTCDay():DE(cy(fe.y,0,1)).getDay(),fe.m=0,fe.d="W"in fe?(fe.w+6)%7+fe.W*7-(Ue+5)%7:fe.w+fe.U*7-(Ue+6)%7);return"Z"in fe?(fe.H+=fe.Z/100|0,fe.M+=fe.Z%100,UE(fe)):DE(fe)}}function F(Se,Ve,Xe,fe){for(var Q=0,Ge=Ve.length,Ue=Xe.length,We,Qe;Q=Ue)return-1;if(We=Ve.charCodeAt(Q++),We===37){if(We=Ve.charAt(Q++),Qe=O[We in QO?Ve.charAt(Q++):We],!Qe||(fe=Qe(Se,Xe,fe))<0)return-1}else if(We!=Xe.charCodeAt(fe++))return-1}return fe}function V(Se,Ve,Xe){var fe=c.exec(Ve.slice(Xe));return fe?(Se.p=d.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function k(Se,Ve,Xe){var fe=y.exec(Ve.slice(Xe));return fe?(Se.w=x.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function j(Se,Ve,Xe){var fe=f.exec(Ve.slice(Xe));return fe?(Se.w=m.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function H(Se,Ve,Xe){var fe=b.exec(Ve.slice(Xe));return fe?(Se.m=E.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function ne(Se,Ve,Xe){var fe=S.exec(Ve.slice(Xe));return fe?(Se.m=w.get(fe[0].toLowerCase()),Xe+fe[0].length):-1}function J(Se,Ve,Xe){return F(Se,e,Ve,Xe)}function de(Se,Ve,Xe){return F(Se,n,Ve,Xe)}function oe(Se,Ve,Xe){return F(Se,r,Ve,Xe)}function he(Se){return o[Se.getDay()]}function B(Se){return s[Se.getDay()]}function K(Se){return l[Se.getMonth()]}function q(Se){return a[Se.getMonth()]}function $(Se){return i[+(Se.getHours()>=12)]}function Z(Se){return 1+~~(Se.getMonth()/3)}function ge(Se){return o[Se.getUTCDay()]}function ae(Se){return s[Se.getUTCDay()]}function ce(Se){return l[Se.getUTCMonth()]}function we(Se){return a[Se.getUTCMonth()]}function Me(Se){return i[+(Se.getUTCHours()>=12)]}function $e(Se){return 1+~~(Se.getUTCMonth()/3)}return{format:function(Se){var Ve=N(Se+="",T);return Ve.toString=function(){return Se},Ve},parse:function(Se){var Ve=D(Se+="",!1);return Ve.toString=function(){return Se},Ve},utcFormat:function(Se){var Ve=N(Se+="",C);return Ve.toString=function(){return Se},Ve},utcParse:function(Se){var Ve=D(Se+="",!0);return Ve.toString=function(){return Se},Ve}}}var QO={"-":"",_:" ",0:"0"},wi=/^\s*\d+/,Lte=/^%/,Dte=/[\\^$*+?|[\]().{}]/g;function jn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function jte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Fte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function zte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Bte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function JO(t,e,n){var r=wi.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function eL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Vte(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Gte(t,e,n){var r=wi.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Wte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function tL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function $te(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function nL(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Xte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qte(t,e,n){var r=wi.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Kte(t,e,n){var r=wi.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Yte(t,e,n){var r=wi.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Zte(t,e,n){var r=Lte.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Qte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Jte(t,e,n){var r=wi.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function rL(t,e){return jn(t.getDate(),e,2)}function ene(t,e){return jn(t.getHours(),e,2)}function tne(t,e){return jn(t.getHours()%12||12,e,2)}function nne(t,e){return jn(1+tx.count(Zc(t),t),e,3)}function Az(t,e){return jn(t.getMilliseconds(),e,3)}function rne(t,e){return Az(t,e)+"000"}function ine(t,e){return jn(t.getMonth()+1,e,2)}function sne(t,e){return jn(t.getMinutes(),e,2)}function one(t,e){return jn(t.getSeconds(),e,2)}function ane(t){var e=t.getDay();return e===0?7:e}function lne(t,e){return jn(RS.count(Zc(t)-1,t),e,2)}function Tz(t){var e=t.getDay();return e>=4||e===0?Ag(t):Ag.ceil(t)}function cne(t,e){return t=Tz(t),jn(Ag.count(Zc(t),t)+(Zc(t).getDay()===4),e,2)}function une(t){return t.getDay()}function dne(t,e){return jn(Dw.count(Zc(t)-1,t),e,2)}function fne(t,e){return jn(t.getFullYear()%100,e,2)}function hne(t,e){return t=Tz(t),jn(t.getFullYear()%100,e,2)}function pne(t,e){return jn(t.getFullYear()%1e4,e,4)}function mne(t,e){var n=t.getDay();return t=n>=4||n===0?Ag(t):Ag.ceil(t),jn(t.getFullYear()%1e4,e,4)}function gne(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+jn(e/60|0,"0",2)+jn(e%60,"0",2)}function iL(t,e){return jn(t.getUTCDate(),e,2)}function vne(t,e){return jn(t.getUTCHours(),e,2)}function yne(t,e){return jn(t.getUTCHours()%12||12,e,2)}function xne(t,e){return jn(1+PS.count(Qc(t),t),e,3)}function Cz(t,e){return jn(t.getUTCMilliseconds(),e,3)}function bne(t,e){return Cz(t,e)+"000"}function _ne(t,e){return jn(t.getUTCMonth()+1,e,2)}function wne(t,e){return jn(t.getUTCMinutes(),e,2)}function Sne(t,e){return jn(t.getUTCSeconds(),e,2)}function Mne(t){var e=t.getUTCDay();return e===0?7:e}function Ene(t,e){return jn(NS.count(Qc(t)-1,t),e,2)}function Pz(t){var e=t.getUTCDay();return e>=4||e===0?Tg(t):Tg.ceil(t)}function Ane(t,e){return t=Pz(t),jn(Tg.count(Qc(t),t)+(Qc(t).getUTCDay()===4),e,2)}function Tne(t){return t.getUTCDay()}function Cne(t,e){return jn(Uw.count(Qc(t)-1,t),e,2)}function Pne(t,e){return jn(t.getUTCFullYear()%100,e,2)}function Rne(t,e){return t=Pz(t),jn(t.getUTCFullYear()%100,e,2)}function Nne(t,e){return jn(t.getUTCFullYear()%1e4,e,4)}function Ine(t,e){var n=t.getUTCDay();return t=n>=4||n===0?Tg(t):Tg.ceil(t),jn(t.getUTCFullYear()%1e4,e,4)}function kne(){return"+0000"}function sL(){return"%"}function oL(t){return+t}function aL(t){return Math.floor(+t/1e3)}var lm,Rz,Nz;One({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function One(t){return lm=Ote(t),Rz=lm.format,lm.parse,Nz=lm.utcFormat,lm.utcParse,lm}function Lne(t){return new Date(t)}function Dne(t){return t instanceof Date?+t:+new Date(+t)}function C2(t,e,n,r,i,s,o,a,l,c){var d=p2(),f=d.invert,m=d.domain,y=c(".%L"),x=c(":%S"),S=c("%I:%M"),w=c("%I %p"),b=c("%a %d"),E=c("%b %d"),T=c("%B"),C=c("%Y");function O(N){return(l(N)e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,s)=>Mee(t,s/r))},n.copy=function(){return Lz(e).domain(t)},ru.apply(n,arguments)}function kS(){var t=0,e=.5,n=1,r=1,i,s,o,a,l,c=Es,d,f=!1,m;function y(S){return isNaN(S=+S)?m:(S=.5+((S=+d(S))-s)*(r*S{if(t!=null){var r=t.scale,i=t.type;if(r==="auto")return i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!e)?"point":i==="category"?"band":"linear";if(typeof r=="string")return Vne(r)?r:"point"}};function Gne(t,e){for(var n=0,r=t.length,i=t[0]e)?n=s+1:r=s}return n}function Bz(t,e){if(t){var n=e??t.domain(),r=n.map(s=>{var o;return(o=t(s))!==null&&o!==void 0?o:0}),i=t.range();if(!(n.length===0||i.length<2))return s=>{var o,a,l=Gne(r,s);if(l<=0)return n[0];if(l>=n.length)return n[n.length-1];var c=(o=r[l-1])!==null&&o!==void 0?o:0,d=(a=r[l])!==null&&a!==void 0?a:0;return Math.abs(s-c)<=Math.abs(s-d)?n[l-1]:n[l]}}}function Wne(t){if(t!=null)return"invert"in t&&typeof t.invert=="function"?t.invert.bind(t):Bz(t,void 0)}function cL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function jw(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);nt.cartesianAxis.xAxis[e],iu=(t,e)=>{var n=Vz(t,e);return n??ti},ni={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:TC,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,niceTicks:"auto",width:X0},Gz=(t,e)=>t.cartesianAxis.yAxis[e],su=(t,e)=>{var n=Gz(t,e);return n??ni},Jne={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},I2=(t,e)=>{var n=t.cartesianAxis.zAxis[e];return n??Jne},Ps=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"zAxis":return I2(t,n);case"angleAxis":return n2(t,n);case"radiusAxis":return r2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},ere=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},nx=(t,e,n)=>{switch(e){case"xAxis":return iu(t,n);case"yAxis":return su(t,n);case"angleAxis":return n2(t,n);case"radiusAxis":return r2(t,n);default:throw new Error("Unexpected axis type: ".concat(e))}},Wz=t=>t.graphicalItems.cartesianItems.some(e=>e.type==="bar")||t.graphicalItems.polarItems.some(e=>e.type==="radialBar");function $z(t,e){return n=>{switch(t){case"xAxis":return"xAxisId"in n&&n.xAxisId===e;case"yAxis":return"yAxisId"in n&&n.yAxisId===e;case"zAxis":return"zAxisId"in n&&n.zAxisId===e;case"angleAxis":return"angleAxisId"in n&&n.angleAxisId===e;case"radiusAxis":return"radiusAxisId"in n&&n.radiusAxisId===e;default:return!1}}}var Xz=t=>t.graphicalItems.cartesianItems,tre=Oe([bi,ES],$z),qz=(t,e,n)=>t.filter(n).filter(r=>(e==null?void 0:e.includeHidden)===!0?!0:!r.hide),Xg=Oe([Xz,Ps,tre],qz,{memoizeOptions:{resultEqualityCheck:TS}}),Kz=Oe([Xg],t=>t.filter(e=>e.type==="area"||e.type==="bar").filter(o2)),Yz=t=>t.filter(e=>!("stackId"in e)||e.stackId===void 0),nre=Oe([Xg],Yz),Zz=t=>t.map(e=>e.data).filter(Boolean).flat(1),rre=Oe([Xg],t=>t.some(e=>!e.data)),Qz=Oe([Xg],Zz,{memoizeOptions:{resultEqualityCheck:TS}}),Jz=(t,e)=>{var n=e.chartData,r=n===void 0?[]:n,i=e.dataStartIndex,s=e.dataEndIndex;return t.length>0?t:r.slice(i,s+1)},k2=Oe([Qz,bS],Jz),ire=(t,e,n)=>(e==null?void 0:e.dataKey)!=null?t.map(r=>({value:yi(r,e.dataKey)})):n.length>0?n.map(r=>r.dataKey).flatMap(r=>t.map(i=>({value:yi(i,r)}))):t.map(r=>({value:r})),eB=(t,e,n,r,i,s)=>{var o=r.chartData,a=o===void 0?[]:o,l=r.dataStartIndex,c=r.dataEndIndex,d=ire(t,e,n);if(i&&(e==null?void 0:e.dataKey)!=null&&s.length>0){var f=a.slice(l,c+1),m=f.map(y=>({value:yi(y,e.dataKey)})).filter(y=>y.value!=null);return[...m,...d]}return d},rx=Oe([k2,Ps,Xg,bS,rre,Qz],eB);function eg(t){if(Il(t)||t instanceof Date){var e=Number(t);if(wn(e))return e}}function dL(t){if(Array.isArray(t)){var e=[eg(t[0]),eg(t[1])];return Al(e)?e:void 0}var n=eg(t);if(n!=null)return[n,n]}function Ll(t){return t.map(eg).filter(Ks)}function sre(t,e){var n=eg(t),r=eg(e);return n==null&&r==null?0:n==null?-1:r==null?1:n-r}var ore=Oe([rx],t=>t==null?void 0:t.map(e=>e.value).sort(sre));function tB(t,e){switch(t){case"xAxis":return e.direction==="x";case"yAxis":return e.direction==="y";default:return!1}}function are(t,e,n){if(!n)return[];if(!n.length)return[];var r;if(typeof e=="number"&&!Nl(e))r=e;else if(Array.isArray(e)){var i=Ll(e);i.length>0&&(r=Math.max(...i))}return r==null?[]:Ll(n.flatMap(s=>{var o=yi(t,s.dataKey),a,l;if(Array.isArray(o)){var c=Hz(o,2);a=c[0],l=c[1]}else a=l=o;if(!(!wn(a)||!wn(l)))return[r-a,r+l]}))}var ai=t=>{var e=_i(t),n=Wg(t);return nx(t,e,n)},Cg=Oe([ai],t=>t==null?void 0:t.dataKey),lre=Oe([Kz,bS,ai],sz),nB=(t,e,n,r)=>{var i={},s=e.reduce((o,a)=>{if(a.stackId==null)return o;var l=o[a.stackId];return l==null&&(l=[]),l.push(a),o[a.stackId]=l,o},i);return Object.fromEntries(Object.entries(s).map(o=>{var a=Hz(o,2),l=a[0],c=a[1],d=r?[...c].reverse():c,f=d.map(s2);return[l,{stackedData:AY(t,f,n),graphicalItems:d}]}))},rB=Oe([lre,Kz,_S,Q4],nB),iB=(t,e,n,r)=>{var i=e.dataStartIndex,s=e.dataEndIndex;if(r==null&&n!=="zAxis")return RY(t,i,s)},cre=Oe([Ps],t=>t.allowDataOverflow),O2=t=>{var e;if(t==null||!("domain"in t))return TC;if(t.domain!=null)return t.domain;if("ticks"in t&&t.ticks!=null){if(t.type==="number"){var n=Ll(t.ticks);return[Math.min(...n),Math.max(...n)]}if(t.type==="category")return t.ticks.map(String)}return(e=t==null?void 0:t.domain)!==null&&e!==void 0?e:TC},sB=Oe([Ps],O2),oB=Oe([sB,cre],B4),ure=Oe([rB,Wa,bi,oB],iB,{memoizeOptions:{resultEqualityCheck:AS}}),L2=t=>t.errorBars,dre=(t,e,n)=>t.flatMap(r=>e[r.id]).filter(Boolean).filter(r=>tB(n,r)),Fw=function(){for(var e=arguments.length,n=new Array(e),r=0;r5&&arguments[5]!==void 0?arguments[5]:[],a,l;if(r.length>0&&r.forEach(c=>{var d,f=c.data!=null?[...c.data]:o,m=(d=i[c.id])===null||d===void 0?void 0:d.filter(y=>tB(s,y));f.forEach(y=>{var x,S=yi(y,(x=n.dataKey)!==null&&x!==void 0?x:c.dataKey),w=are(y,S,m);if(w.length>=2){var b=Math.min(...w),E=Math.max(...w);(a==null||bl)&&(l=E)}var T=dL(S);T!=null&&(a=a==null?T[0]:Math.min(a,T[0]),l=l==null?T[1]:Math.max(l,T[1]))})}),(n==null?void 0:n.dataKey)!=null&&r.length===0&&e.forEach(c=>{var d=dL(yi(c,n.dataKey));d!=null&&(a=a==null?d[0]:Math.min(a,d[0]),l=l==null?d[1]:Math.max(l,d[1]))}),wn(a)&&wn(l))return[a,l]},fre=Oe([k2,Ps,nre,L2,bi,HJ],aB,{memoizeOptions:{resultEqualityCheck:AS}});function hre(t){var e=t.value;if(Il(e)||e instanceof Date)return e}var pre=(t,e,n)=>{var r=t.map(hre).filter(i=>i!=null);return n&&(e.dataKey==null||e.allowDuplicatedCategory&&y5(r))?z4(0,t.length):e.allowDuplicatedCategory?r:Array.from(new Set(r))},lB=t=>t.referenceElements.dots,qg=(t,e,n)=>t.filter(r=>r.ifOverflow==="extendDomain").filter(r=>e==="xAxis"?r.xAxisId===n:r.yAxisId===n),mre=Oe([lB,bi,ES],qg),cB=t=>t.referenceElements.areas,gre=Oe([cB,bi,ES],qg),uB=t=>t.referenceElements.lines,vre=Oe([uB,bi,ES],qg),dB=(t,e)=>{if(t!=null){var n=Ll(t.map(r=>e==="xAxis"?r.x:r.y));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},yre=Oe(mre,bi,dB),fB=(t,e)=>{if(t!=null){var n=Ll(t.flatMap(r=>[e==="xAxis"?r.x1:r.y1,e==="xAxis"?r.x2:r.y2]));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},xre=Oe([gre,bi],fB);function bre(t){var e;if(t.x!=null)return Ll([t.x]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.x);return n==null||n.length===0?[]:Ll(n)}function _re(t){var e;if(t.y!=null)return Ll([t.y]);var n=(e=t.segment)===null||e===void 0?void 0:e.map(r=>r.y);return n==null||n.length===0?[]:Ll(n)}var hB=(t,e)=>{if(t!=null){var n=t.flatMap(r=>e==="xAxis"?bre(r):_re(r));if(n.length!==0)return[Math.min(...n),Math.max(...n)]}},wre=Oe([vre,bi],hB),Sre=Oe(yre,wre,xre,(t,e,n)=>Fw(t,n,e)),pB=(t,e,n,r,i,s,o,a)=>{if(n!=null)return n;var l=o==="vertical"&&a==="xAxis"||o==="horizontal"&&a==="yAxis",c=l?Fw(r,s,i):Fw(s,i);return qJ(e,c,t.allowDataOverflow)},Mre=Oe([Ps,sB,oB,ure,fre,Sre,fr,bi],pB,{memoizeOptions:{resultEqualityCheck:AS}}),Ere=[0,1],mB=(t,e,n,r,i,s,o)=>{if(!((t==null||n==null||n.length===0)&&o===void 0)){var a=t.dataKey,l=t.type,c=Fl(e,s);if(c&&a==null){var d;return z4(0,(d=n==null?void 0:n.length)!==null&&d!==void 0?d:0)}return l==="category"?pre(r,t,c):i==="expand"&&!c?Ere:o}},D2=Oe([Ps,fr,k2,rx,_S,bi,Mre],mB),Kg=Oe([Ps,Wz,JP],zz),gB=(t,e,n)=>{var r=e.niceTicks;if(r!=="none"){var i=O2(e),s=Array.isArray(i)&&(i[0]==="auto"||i[1]==="auto");if((r==="snap125"||r==="adaptive")&&e!=null&&e.tickCount&&Al(t)){if(s)return bO(t,e.tickCount,e.allowDecimals,r);if(e.type==="number")return _O(t,e.tickCount,e.allowDecimals,r)}if(r==="auto"&&n==="linear"&&e!=null&&e.tickCount){if(s&&Al(t))return bO(t,e.tickCount,e.allowDecimals,"adaptive");if(e.type==="number"&&Al(t))return _O(t,e.tickCount,e.allowDecimals,"adaptive")}}},U2=Oe([D2,nx,Kg],gB),vB=(t,e,n,r)=>{if(r!=="angleAxis"&&(t==null?void 0:t.type)==="number"&&Al(e)&&Array.isArray(n)&&n.length>0){var i,s,o=e[0],a=(i=n[0])!==null&&i!==void 0?i:0,l=e[1],c=(s=n[n.length-1])!==null&&s!==void 0?s:0;return[Math.min(o,a),Math.max(l,c)]}return e},Are=Oe([Ps,D2,U2,bi],vB),Tre=Oe(rx,Ps,(t,e)=>{if(!(!e||e.type!=="number")){var n=1/0,r=Array.from(Ll(t.map(f=>f.value))).sort((f,m)=>f-m),i=r[0],s=r[r.length-1];if(i==null||s==null)return 1/0;var o=s-i;if(o===0)return 1/0;for(var a=0;ai,(t,e,n,r,i)=>{if(!wn(t))return 0;var s=e==="vertical"?r.height:r.width;if(i==="gap")return t*s/2;if(i==="no-gap"){var o=Ad(n,t*s),a=t*s/2;return a-o-(a-o)/s*o}return 0}),Cre=(t,e,n)=>{var r=iu(t,e);return r==null||typeof r.padding!="string"?0:yB(t,"xAxis",e,n,r.padding)},Pre=(t,e,n)=>{var r=su(t,e);return r==null||typeof r.padding!="string"?0:yB(t,"yAxis",e,n,r.padding)},Rre=Oe(iu,Cre,(t,e)=>{var n,r;if(t==null)return{left:0,right:0};var i=t.padding;return typeof i=="string"?{left:e,right:e}:{left:((n=i.left)!==null&&n!==void 0?n:0)+e,right:((r=i.right)!==null&&r!==void 0?r:0)+e}}),Nre=Oe(su,Pre,(t,e)=>{var n,r;if(t==null)return{top:0,bottom:0};var i=t.padding;return typeof i=="string"?{top:e,bottom:e}:{top:((n=i.top)!==null&&n!==void 0?n:0)+e,bottom:((r=i.bottom)!==null&&r!==void 0?r:0)+e}}),xB=Oe([Gi,Rre,pS,hS,(t,e,n)=>n],(t,e,n,r,i)=>{var s=r.padding;return i?[s.left,n.width-s.right]:[t.left+e.left,t.left+t.width-e.right]}),bB=Oe([Gi,fr,Nre,pS,hS,(t,e,n)=>n],(t,e,n,r,i,s)=>{var o=i.padding;return s?[r.height-o.bottom,o.top]:e==="horizontal"?[t.top+t.height-n.bottom,t.top+n.top]:[t.top+n.top,t.top+t.height-n.bottom]}),ix=(t,e,n,r)=>{var i;switch(e){case"xAxis":return xB(t,n,r);case"yAxis":return bB(t,n,r);case"zAxis":return(i=I2(t,n))===null||i===void 0?void 0:i.range;case"angleAxis":return nz(t);case"radiusAxis":return rz(t,n);default:return}},_B=Oe([Ps,ix],wS),Ire=Oe([Kg,Are],fee),j2=Oe([Ps,Kg,Ire,_B],N2),wB=(t,e,n,r)=>{if(!(n==null||n.dataKey==null)){var i=n.type,s=n.scale,o=Fl(t,r);if(o&&(i==="number"||s!=="auto"))return e.map(a=>a.value)}},F2=Oe([fr,rx,nx,bi],wB),OS=Oe([j2],a2);Oe([j2],Wne);Oe([j2,ore],Bz);Oe([Xg,L2,bi],dre);function SB(t,e){return t.ide.id?1:0}var LS=(t,e)=>e,DS=(t,e,n)=>n,kre=Oe(dS,LS,DS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(SB)),Ore=Oe(fS,LS,DS,(t,e,n)=>t.filter(r=>r.orientation===e).filter(r=>r.mirror===n).sort(SB)),MB=(t,e)=>({width:t.width,height:e.height}),Lre=(t,e)=>{var n=typeof e.width=="number"?e.width:X0;return{width:n,height:t.height}},Dre=Oe(Gi,iu,MB),Ure=(t,e,n)=>{switch(e){case"top":return t.top;case"bottom":return n-t.bottom;default:return 0}},jre=(t,e,n)=>{switch(e){case"left":return t.left;case"right":return n-t.right;default:return 0}},Fre=Oe(nu,Gi,kre,LS,DS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=MB(e,a);o==null&&(o=Ure(e,r,t));var c=r==="top"&&!i||r==="bottom"&&i;s[a.id]=o-Number(c)*l.height,o+=(c?-1:1)*l.height}),s}),zre=Oe(tu,Gi,Ore,LS,DS,(t,e,n,r,i)=>{var s={},o;return n.forEach(a=>{var l=Lre(e,a);o==null&&(o=jre(e,r,t));var c=r==="left"&&!i||r==="right"&&i;s[a.id]=o-Number(c)*l.width,o+=(c?-1:1)*l.width}),s}),Bre=(t,e)=>{var n=iu(t,e);if(n!=null)return Fre(t,n.orientation,n.mirror)},Hre=Oe([Gi,iu,Bre,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:t.left,y:0}:{x:t.left,y:i}}}),Vre=(t,e)=>{var n=su(t,e);if(n!=null)return zre(t,n.orientation,n.mirror)},Gre=Oe([Gi,su,Vre,(t,e)=>e],(t,e,n,r)=>{if(e!=null){var i=n==null?void 0:n[r];return i==null?{x:0,y:t.top}:{x:i,y:t.top}}}),Wre=Oe(Gi,su,(t,e)=>{var n=typeof e.width=="number"?e.width:X0;return{width:n,height:t.height}}),EB=(t,e,n,r)=>{if(n!=null){var i=n.allowDuplicatedCategory,s=n.type,o=n.dataKey,a=Fl(t,r),l=e.map(d=>d.value),c=l.filter(d=>d!=null);if(o&&a&&s==="category"&&i&&y5(c))return l}},z2=Oe([fr,rx,Ps,bi],EB),fL=Oe([fr,ere,Kg,OS,z2,F2,ix,U2,bi],(t,e,n,r,i,s,o,a,l)=>{if(e!=null){var c=Fl(t,l);return{angle:e.angle,interval:e.interval,minTickGap:e.minTickGap,orientation:e.orientation,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,axisType:l,categoricalDomain:s,duplicateDomain:i,isCategorical:c,niceTicks:a,range:o,realScaleType:n,scale:r}}}),$re=(t,e,n,r,i,s,o,a,l)=>{if(!(e==null||r==null)){var c=Fl(t,l),d=e.type,f=e.ticks,m=e.tickCount,y=n==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,x=d==="category"&&r.bandwidth?r.bandwidth()/y:0;x=l==="angleAxis"&&s!=null&&s.length>=2?Wo(s[0]-s[1])*2*x:x;var S=f||i;return S?S.map((w,b)=>{var E=o?o.indexOf(w):w,T=r.map(E);return wn(T)?{index:b,coordinate:T+x,value:w,offset:x}:null}).filter(Ks):c&&a?a.map((w,b)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:w,index:b,offset:x}:null}).filter(Ks):r.ticks?r.ticks(m).map((w,b)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:w,index:b,offset:x}:null}).filter(Ks):r.domain().map((w,b)=>{var E=r.map(w);return wn(E)?{coordinate:E+x,value:o?o[w]:w,index:b,offset:x}:null}).filter(Ks)}},AB=Oe([fr,nx,Kg,OS,U2,ix,z2,F2,bi],$re),Xre=(t,e,n,r,i,s,o)=>{if(!(e==null||n==null||r==null||r[0]===r[1])){var a=Fl(t,o),l=e.tickCount,c=0;return c=o==="angleAxis"&&(r==null?void 0:r.length)>=2?Wo(r[0]-r[1])*2*c:c,a&&s?s.map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Ks):n.ticks?n.ticks(l).map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:d,index:f,offset:c}:null}).filter(Ks):n.domain().map((d,f)=>{var m=n.map(d);return wn(m)?{coordinate:m+c,value:i?i[d]:d,index:f,offset:c}:null}).filter(Ks)}},TB=Oe([fr,nx,OS,ix,z2,F2,bi],Xre),CB=Oe(Ps,OS,(t,e)=>{if(!(t==null||e==null))return jw(jw({},t),{},{scale:e})}),qre=Oe([Ps,Kg,D2,_B],N2),Kre=Oe([qre],a2);Oe((t,e,n)=>I2(t,n),Kre,(t,e)=>{if(!(t==null||e==null))return jw(jw({},t),{},{scale:e})});var Yre=Oe([fr,dS,fS],(t,e,n)=>{switch(t){case"horizontal":return e.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return n.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),Zre=(t,e,n)=>{var r;return(r=t.renderedTicks[e])===null||r===void 0?void 0:r[n]};Oe([Zre],t=>{if(!(!t||t.length===0))return e=>{var n,r=1/0,i=t[0];for(var s of t){var o=Math.abs(s.coordinate-e);ot.options.defaultTooltipEventType,RB=t=>t.options.validateTooltipEventTypes;function NB(t,e,n){if(t==null)return e;var r=t?"axis":"item";return n==null?e:n.includes(r)?r:e}function sx(t,e){var n=PB(t),r=RB(t);return NB(e,n,r)}function Qre(t){return zt(e=>sx(e,t))}var IB=(t,e)=>{var n,r=Number(e);if(!(Nl(r)||e==null))return r>=0?t==null||(n=t[r])===null||n===void 0?void 0:n.value:void 0},Jre=t=>t.tooltip.settings,cd={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},eie={itemInteraction:{click:cd,hover:cd},axisInteraction:{click:cd,hover:cd},keyboardInteraction:cd,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},kB=cs({name:"tooltip",initialState:eie,reducers:{addTooltipEntrySettings:{reducer(t,e){t.tooltipItemPayloads.push(e.payload)},prepare:sr()},replaceTooltipEntrySettings:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).tooltipItemPayloads.indexOf(r);s>-1&&(t.tooltipItemPayloads[s]=i)},prepare:sr()},removeTooltipEntrySettings:{reducer(t,e){var n=$o(t).tooltipItemPayloads.indexOf(e.payload);n>-1&&t.tooltipItemPayloads.splice(n,1)},prepare:sr()},setTooltipSettingsState(t,e){t.settings=e.payload},setActiveMouseOverItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.itemInteraction.hover.active=!0,t.itemInteraction.hover.index=e.payload.activeIndex,t.itemInteraction.hover.dataKey=e.payload.activeDataKey,t.itemInteraction.hover.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.hover.coordinate=e.payload.activeCoordinate},mouseLeaveChart(t){t.itemInteraction.hover.active=!1,t.axisInteraction.hover.active=!1},mouseLeaveItem(t){t.itemInteraction.hover.active=!1},setActiveClickItemIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.itemInteraction.click.active=!0,t.keyboardInteraction.active=!1,t.itemInteraction.click.index=e.payload.activeIndex,t.itemInteraction.click.dataKey=e.payload.activeDataKey,t.itemInteraction.click.graphicalItemId=e.payload.activeGraphicalItemId,t.itemInteraction.click.coordinate=e.payload.activeCoordinate},setMouseOverAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.axisInteraction.hover.active=!0,t.keyboardInteraction.active=!1,t.axisInteraction.hover.index=e.payload.activeIndex,t.axisInteraction.hover.dataKey=e.payload.activeDataKey,t.axisInteraction.hover.coordinate=e.payload.activeCoordinate},setMouseClickAxisIndex(t,e){t.syncInteraction.active=!1,t.syncInteraction.sourceViewBox=void 0,t.keyboardInteraction.active=!1,t.axisInteraction.click.active=!0,t.axisInteraction.click.index=e.payload.activeIndex,t.axisInteraction.click.dataKey=e.payload.activeDataKey,t.axisInteraction.click.coordinate=e.payload.activeCoordinate},setSyncInteraction(t,e){t.syncInteraction=e.payload},setKeyboardInteraction(t,e){t.keyboardInteraction.active=e.payload.active,t.keyboardInteraction.index=e.payload.activeIndex,t.keyboardInteraction.coordinate=e.payload.activeCoordinate}}}),ta=kB.actions,tie=ta.addTooltipEntrySettings,nie=ta.replaceTooltipEntrySettings,rie=ta.removeTooltipEntrySettings,iie=ta.setTooltipSettingsState,sie=ta.setActiveMouseOverItemIndex;ta.mouseLeaveItem;var OB=ta.mouseLeaveChart;ta.setActiveClickItemIndex;var LB=ta.setMouseOverAxisIndex,oie=ta.setMouseClickAxisIndex,Uy=ta.setSyncInteraction,zw=ta.setKeyboardInteraction,aie=kB.reducer;function hL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ib(t){for(var e=1;e{if(e==null)return cd;var i=die(t,e,n);if(i==null)return cd;if(i.active)return i;if(t.keyboardInteraction.active)return t.keyboardInteraction;if(t.syncInteraction.active&&t.syncInteraction.index!=null)return t.syncInteraction;var s=t.settings.active===!0;if(fie(i)){if(s)return Ib(Ib({},i),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Ib(Ib({},cd),{},{coordinate:i.coordinate})};function hie(t){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(t instanceof Date){var e=t.valueOf();return Number.isFinite(e)?e:void 0}var n=Number(t);return Number.isFinite(n)?n:void 0}function pie(t,e){var n=hie(t),r=e[0],i=e[1];if(n===void 0)return!1;var s=Math.min(r,i),o=Math.max(r,i);return n>=s&&n<=o}function mie(t,e,n){if(n==null||e==null)return!0;var r=yi(t,e);return r==null||!Al(n)?!0:pie(r,n)}var Vy=(t,e,n,r)=>{var i=t==null?void 0:t.index;if(i==null)return null;var s=Number(i);if(!wn(s))return i;var o=0,a=1/0;e.length>0&&(a=e.length-1);var l=Math.max(o,Math.min(s,a)),c=e[l];return c==null||mie(c,n,r)?String(l):null},UB=(t,e,n,r,i,s,o)=>{if(s!=null){var a=o[0],l=a==null?void 0:a.getPosition(s);if(l!=null)return l;var c=i==null?void 0:i[Number(s)];if(c)switch(n){case"horizontal":return{x:c.coordinate,y:(r.top+e)/2};default:return{x:(r.left+t)/2,y:c.coordinate}}}},jB=(t,e,n,r)=>{if(e==="axis")return t.tooltipItemPayloads;if(t.tooltipItemPayloads.length===0)return[];var i;if(n==="hover"?i=t.itemInteraction.hover.graphicalItemId:i=t.itemInteraction.click.graphicalItemId,t.syncInteraction.active&&i==null)return t.tooltipItemPayloads;if(i==null&&(r!=null||t.keyboardInteraction.active)){var s=t.tooltipItemPayloads[0];return s!=null?[s]:[]}return t.tooltipItemPayloads.filter(o=>{var a;return((a=o.settings)===null||a===void 0?void 0:a.graphicalItemId)===i})},FB=t=>t.options.tooltipPayloadSearcher,Yg=t=>t.tooltip;function pL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mL(t){for(var e=1;et(e)}function gL(t){if(typeof t=="string")return t}function wie(t){if(!(t==null||typeof t!="object")){var e="name"in t?xie(t.name):void 0,n="unit"in t?bie(t.unit):void 0,r="dataKey"in t?_ie(t.dataKey):void 0,i="payload"in t?t.payload:void 0,s="color"in t?gL(t.color):void 0,o="fill"in t?gL(t.fill):void 0;return{name:e,unit:n,dataKey:r,payload:i,color:s,fill:o}}}function Sie(t,e){return t??e}var zB=(t,e,n,r,i,s,o)=>{if(!(e==null||s==null)){var a=n.chartData,l=n.computedData,c=n.dataStartIndex,d=n.dataEndIndex,f=[];return t.reduce((m,y)=>{var x,S=y.dataDefinedOnItem,w=y.settings,b=Sie(S,a),E=Array.isArray(b)?d4(b,c,d):b,T=(x=w==null?void 0:w.dataKey)!==null&&x!==void 0?x:r,C=w==null?void 0:w.nameKey,O;if(r&&Array.isArray(E)&&!Array.isArray(E[0])&&o==="axis"?O=x5(E,r,i):O=s(E,e,l,C),Array.isArray(O))O.forEach(D=>{var F,V,k=wie(D),j=k==null?void 0:k.name,H=k==null?void 0:k.dataKey,ne=k==null?void 0:k.payload,J=mL(mL({},w),{},{name:j,unit:k==null?void 0:k.unit,color:(F=k==null?void 0:k.color)!==null&&F!==void 0?F:w==null?void 0:w.color,fill:(V=k==null?void 0:k.fill)!==null&&V!==void 0?V:w==null?void 0:w.fill});m.push(uk({tooltipEntrySettings:J,dataKey:H,payload:ne,value:yi(ne,H),name:j==null?void 0:String(j)}))});else{var N;m.push(uk({tooltipEntrySettings:w,dataKey:T,payload:O,value:yi(O,T),name:(N=yi(O,C))!==null&&N!==void 0?N:w==null?void 0:w.name}))}return m},f)}},B2=Oe([ai,Wz,JP],zz),Mie=Oe([t=>t.graphicalItems.cartesianItems,t=>t.graphicalItems.polarItems],(t,e)=>[...t,...e]),Eie=Oe([_i,Wg],$z),Qh=Oe([Mie,ai,Eie],qz,{memoizeOptions:{resultEqualityCheck:TS}}),Aie=Oe([Qh],t=>t.filter(o2)),BB=Oe([Qh],Zz,{memoizeOptions:{resultEqualityCheck:TS}}),Tie=Oe([Qh],t=>t.some(e=>!e.data)),Lh=Oe([BB,Wa],Jz),Cie=Oe([Aie,Wa,ai],sz),H2=Oe([Lh,ai,Qh,Wa,Tie,BB],eB),HB=Oe([ai],O2),Pie=Oe([ai],t=>t.allowDataOverflow),VB=Oe([HB,Pie],B4),Rie=Oe([Qh],t=>t.filter(o2)),Nie=Oe([Cie,Rie,_S,Q4],nB),Iie=Oe([Nie,Wa,_i,VB],iB),kie=Oe([Qh],Yz),Oie=Oe([Lh,ai,kie,L2,_i,VJ],aB,{memoizeOptions:{resultEqualityCheck:AS}}),Lie=Oe([lB,_i,Wg],qg),Die=Oe([Lie,_i],dB),Uie=Oe([cB,_i,Wg],qg),jie=Oe([Uie,_i],fB),Fie=Oe([uB,_i,Wg],qg),zie=Oe([Fie,_i],hB),Bie=Oe([Die,zie,jie],Fw),Hie=Oe([ai,HB,VB,Iie,Oie,Bie,fr,_i],pB),Pg=Oe([ai,fr,Lh,H2,_S,_i,Hie],mB),Vie=Oe([Pg,ai,B2],gB),Gie=Oe([ai,Pg,Vie,_i],vB),GB=t=>{var e=_i(t),n=Wg(t),r=!1;return ix(t,e,n,r)},WB=Oe([ai,GB],wS),Wie=Oe([ai,B2,Gie,WB],N2),$B=Oe([Wie],a2),$ie=Oe([fr,H2,ai,_i],EB),Xie=Oe([fr,H2,ai,_i],wB),qie=(t,e,n,r,i,s,o,a)=>{if(e){var l=e.type,c=Fl(t,a);if(r){var d=n==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,f=l==="category"&&r.bandwidth?r.bandwidth()/d:0;return f=a==="angleAxis"&&i!=null&&(i==null?void 0:i.length)>=2?Wo(i[0]-i[1])*2*f:f,c&&o?o.map((m,y)=>{var x=r.map(m);return wn(x)?{coordinate:x+f,value:m,index:y,offset:f}:null}).filter(Ks):r.domain().map((m,y)=>{var x=r.map(m);return wn(x)?{coordinate:x+f,value:s?s[m]:m,index:y,offset:f}:null}).filter(Ks)}}},ou=Oe([fr,ai,B2,$B,GB,$ie,Xie,_i],qie),V2=Oe([PB,RB,Jre],(t,e,n)=>NB(n.shared,t,e)),XB=t=>t.tooltip.settings.trigger,G2=t=>t.tooltip.settings.defaultIndex,ox=Oe([Yg,V2,XB,G2],DB),_0=Oe([ox,Lh,Cg,Pg],Vy),qB=Oe([ou,_0],IB),Kie=Oe([ox],t=>{if(t)return t.dataKey}),Yie=Oe([ox],t=>{if(t)return t.graphicalItemId}),KB=Oe([Yg,V2,XB,G2],jB),Zie=Oe([tu,nu,fr,Gi,ou,G2,KB],UB),Qie=Oe([ox,Zie],(t,e)=>t!=null&&t.coordinate?t.coordinate:e),Jie=Oe([ox],t=>{var e;return(e=t==null?void 0:t.active)!==null&&e!==void 0?e:!1}),ese=Oe([KB,_0,Wa,Cg,qB,FB,V2],zB),tse=Oe([ese],t=>{if(t!=null){var e=t.map(n=>n.payload).filter(n=>n!=null);return Array.from(new Set(e))}});function vL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function yL(t){for(var e=1;ezt(ai),ose=()=>{var t=sse(),e=zt(ou),n=zt($B);return gw(!t||!n?void 0:yL(yL({},t),{},{scale:n}),e)};function xL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function cm(t){for(var e=1;e{var i=e.find(s=>s&&s.index===n);if(i){if(t==="horizontal")return{x:i.coordinate,y:r.relativeY};if(t==="vertical")return{x:r.relativeX,y:i.coordinate}}return{x:0,y:0}},dse=(t,e,n,r)=>{var i=e.find(c=>c&&c.index===n);if(i){if(t==="centric"){var s=i.coordinate,o=r.radius;return cm(cm(cm({},r),zi(r.cx,r.cy,o,s)),{},{angle:s,radius:o})}var a=i.coordinate,l=r.angle;return cm(cm(cm({},r),zi(r.cx,r.cy,a,l)),{},{angle:l,radius:a})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function fse(t,e){var n=t.relativeX,r=t.relativeY;return n>=e.left&&n<=e.left+e.width&&r>=e.top&&r<=e.top+e.height}var YB=(t,e,n,r,i)=>{var s,o=(s=e==null?void 0:e.length)!==null&&s!==void 0?s:0;if(o<=1||t==null)return 0;if(r==="angleAxis"&&i!=null&&Math.abs(Math.abs(i[1]-i[0])-360)<=1e-6)for(var a=0;a0?(l=n[a-1])===null||l===void 0?void 0:l.coordinate:(c=n[o-1])===null||c===void 0?void 0:c.coordinate,x=(d=n[a])===null||d===void 0?void 0:d.coordinate,S=a>=o-1?(f=n[0])===null||f===void 0?void 0:f.coordinate:(m=n[a+1])===null||m===void 0?void 0:m.coordinate,w=void 0;if(!(y==null||x==null||S==null))if(Wo(x-y)!==Wo(S-x)){var b=[];if(Wo(S-x)===Wo(i[1]-i[0])){w=S;var E=x+i[1]-i[0];b[0]=Math.min(E,(E+y)/2),b[1]=Math.max(E,(E+y)/2)}else{w=y;var T=S+i[1]-i[0];b[0]=Math.min(x,(T+x)/2),b[1]=Math.max(x,(T+x)/2)}var C=[Math.min(x,(w+x)/2),Math.max(x,(w+x)/2)];if(t>C[0]&&t<=C[1]||t>=b[0]&&t<=b[1]){var O;return(O=n[a])===null||O===void 0?void 0:O.index}}else{var N=Math.min(y,S),D=Math.max(y,S);if(t>(N+x)/2&&t<=(D+x)/2){var F;return(F=n[a])===null||F===void 0?void 0:F.index}}}else if(e)for(var V=0;V(k.coordinate+H.coordinate)/2||V>0&&V(k.coordinate+H.coordinate)/2&&t<=(k.coordinate+j.coordinate)/2)return k.index}}return-1},ZB=()=>zt(JP),W2=(t,e)=>e,QB=(t,e,n)=>n,$2=(t,e,n,r)=>r,hse=Oe(ou,t=>eS(t,e=>e.coordinate)),X2=Oe([Yg,W2,QB,$2],DB),q2=Oe([X2,Lh,Cg,Pg],Vy),pse=(t,e,n)=>{if(e!=null){var r=Yg(t);return e==="axis"?n==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:n==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},JB=Oe([Yg,W2,QB,$2],jB),Bw=Oe([tu,nu,fr,Gi,ou,$2,JB],UB),mse=Oe([X2,Bw],(t,e)=>{var n;return(n=t.coordinate)!==null&&n!==void 0?n:e}),eH=Oe([ou,q2],IB),gse=Oe([JB,q2,Wa,Cg,eH,FB,W2],zB),vse=Oe([X2,q2],(t,e)=>({isActive:t.active&&e!=null,activeIndex:e})),yse=(t,e,n,r,i,s,o)=>{if(!(!t||!n||!r||!i)&&fse(t,o)){var a=NY(t,e),l=YB(a,s,i,n,r),c=use(e,i,l,t);return{activeIndex:String(l),activeCoordinate:c}}},xse=(t,e,n,r,i,s,o)=>{if(!(!t||!r||!i||!s||!n)){var a=OJ(t,n);if(a){var l=IY(a,e),c=YB(l,o,s,r,i),d=dse(e,s,c,a);return{activeIndex:String(c),activeCoordinate:d}}}},bse=(t,e,n,r,i,s,o,a)=>{if(!(!t||!e||!r||!i||!s))return e==="horizontal"||e==="vertical"?yse(t,e,r,i,s,o,a):xse(t,e,n,r,i,s,o)},_se=Oe(t=>t.zIndex.zIndexMap,(t,e)=>e,(t,e,n)=>n,(t,e,n)=>{if(e!=null){var r=t[e];if(r!=null)return n?r.panoramaElement:r.element}}),wse=Oe(t=>t.zIndex.zIndexMap,t=>{var e=Object.keys(t).map(r=>parseInt(r,10)).concat(Object.values(Ms)),n=Array.from(new Set(e));return n.sort((r,i)=>r-i)},{memoizeOptions:{resultEqualityCheck:dee}});function bL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function _L(t){for(var e=1;e_L(_L({},t),{},{[e]:{element:void 0,panoramaElement:void 0,consumers:0}}),Ase)},Cse=new Set(Object.values(Ms));function Pse(t){return Cse.has(t)}var tH=cs({name:"zIndex",initialState:Tse,reducers:{registerZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]?t.zIndexMap[n].consumers+=1:t.zIndexMap[n]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:sr()},unregisterZIndexPortal:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(t.zIndexMap[n].consumers-=1,t.zIndexMap[n].consumers<=0&&!Pse(n)&&delete t.zIndexMap[n])},prepare:sr()},registerZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload,r=n.zIndex,i=n.element,s=n.isPanorama;t.zIndexMap[r]?s?t.zIndexMap[r].panoramaElement=i:t.zIndexMap[r].element=i:t.zIndexMap[r]={consumers:0,element:s?void 0:i,panoramaElement:s?i:void 0}},prepare:sr()},unregisterZIndexPortalElement:{reducer:(t,e)=>{var n=e.payload.zIndex;t.zIndexMap[n]&&(e.payload.isPanorama?t.zIndexMap[n].panoramaElement=void 0:t.zIndexMap[n].element=void 0)},prepare:sr()}}}),US=tH.actions,Rse=US.registerZIndexPortal,jE=US.unregisterZIndexPortal,Nse=US.registerZIndexPortalElement,Ise=US.unregisterZIndexPortalElement,kse=tH.reducer;function au(t){var e=t.zIndex,n=t.children,r=gZ(),i=r&&e!==void 0&&e!==0,s=Qs(),o=R.useRef(void 0),a=R.useRef(new Set),l=Wr(),c=zt(f=>_se(f,e,s));if(R.useLayoutEffect(()=>{if(!i){var f=a.current;f.forEach(y=>{l(jE({zIndex:y}))}),f.clear(),o.current=void 0;return}if(a.current.has(e)||(l(Rse({zIndex:e})),a.current.add(e)),c){o.current=c;var m=a.current;m.forEach(y=>{y!==e&&(l(jE({zIndex:y})),m.delete(y))})}},[l,e,i,c]),R.useLayoutEffect(()=>{var f=a.current;return()=>{f.forEach(m=>{l(jE({zIndex:m}))}),f.clear()}},[l]),!i)return n;var d=c??o.current;return d?W1.createPortal(n,d):null}function CC(){return CC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.useContext(nH),FE={exports:{}},SL;function Bse(){return SL||(SL=1,(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function i(l,c,d){this.fn=l,this.context=c,this.once=d||!1}function s(l,c,d,f,m){if(typeof d!="function")throw new TypeError("The listener must be a function");var y=new i(d,f||l,m),x=n?n+c:c;return l._events[x]?l._events[x].fn?l._events[x]=[l._events[x],y]:l._events[x].push(y):(l._events[x]=y,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new r:delete l._events[c]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],d,f;if(this._eventsCount===0)return c;for(f in d=this._events)e.call(d,f)&&c.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(c){var d=n?n+c:c,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,y=f.length,x=new Array(y);m{if(e&&Array.isArray(t)){var n=Number.parseInt(e,10);if(!Nl(n))return t[n]}},Wse={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},rH=cs({name:"options",initialState:Wse,reducers:{createEventEmitter:t=>{t.eventEmitter==null&&(t.eventEmitter=Symbol("rechartsEventEmitter"))}}}),$se=rH.reducer,Xse=rH.actions.createEventEmitter;function qse(t){return t.tooltip.syncInteraction}var Kse={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},iH=cs({name:"chartData",initialState:Kse,reducers:{setChartData(t,e){if(t.chartData=e.payload,e.payload==null){t.dataStartIndex=0,t.dataEndIndex=0;return}e.payload.length>0&&t.dataEndIndex!==e.payload.length-1&&(t.dataEndIndex=e.payload.length-1)},setComputedData(t,e){t.computedData=e.payload},setDataStartEndIndexes(t,e){var n=e.payload,r=n.startIndex,i=n.endIndex;r!=null&&(t.dataStartIndex=r),i!=null&&(t.dataEndIndex=i)}}}),K2=iH.actions,EL=K2.setChartData,Yse=K2.setDataStartEndIndexes;K2.setComputedData;var Zse=iH.reducer,Qse=["x","y"];function AL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function um(t){for(var e=1;el.rootProps.className);R.useEffect(()=>{if(t==null)return Bg;var l=(c,d,f)=>{if(e!==f&&t===c){if(d.payload.active===!1){n(Uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(r==="index"){var m;if(o&&d!==null&&d!==void 0&&(m=d.payload)!==null&&m!==void 0&&m.coordinate&&d.payload.sourceViewBox){var y=d.payload.coordinate,x=y.x,S=y.y,w=noe(y,Qse),b=d.payload.sourceViewBox,E=b.x,T=b.y,C=b.width,O=b.height,N=um(um({},w),{},{x:o.x+(C?(x-E)/C:0)*o.width,y:o.y+(O?(S-T)/O:0)*o.height});n(um(um({},d),{},{payload:um(um({},d.payload),{},{coordinate:N})}))}else n(d);return}if(i!=null){var D;if(typeof r=="function"){var F={activeTooltipIndex:d.payload.index==null?void 0:Number(d.payload.index),isTooltipActive:d.payload.active,activeIndex:d.payload.index==null?void 0:Number(d.payload.index),activeLabel:d.payload.label,activeDataKey:d.payload.dataKey,activeCoordinate:d.payload.coordinate},V=r(i,F);D=i[V]}else r==="value"&&(D=i.find(he=>String(he.value)===d.payload.label));var k=d.payload.coordinate;if(k==null||o==null){n(Uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}if(D==null){n(Uy({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:void 0}));return}var j=k.x,H=k.y,ne=Math.min(j,o.x+o.width),J=Math.min(H,o.y+o.height),de={x:s==="horizontal"?D.coordinate:ne,y:s==="horizontal"?J:D.coordinate},oe=Uy({active:d.payload.active,coordinate:de,dataKey:d.payload.dataKey,index:String(D.index),label:d.payload.label,sourceViewBox:d.payload.sourceViewBox,graphicalItemId:d.payload.graphicalItemId});n(oe)}}};return w0.on(PC,l),()=>{w0.off(PC,l)}},[a,n,e,t,r,i,s,o])}function soe(){var t=zt(e2),e=zt(t2),n=Wr();R.useEffect(()=>{if(t==null)return Bg;var r=(i,s,o)=>{e!==o&&t===i&&n(Yse(s))};return w0.on(ML,r),()=>{w0.off(ML,r)}},[n,e,t])}function ooe(){var t=Wr();R.useEffect(()=>{t(Xse())},[t]),ioe(),soe()}function aoe(t,e,n,r,i,s){var o=zt(x=>pse(x,t,e)),a=zt(Yie),l=zt(t2),c=zt(e2),d=zt(J4),f=zt(qse),m=(f==null?void 0:f.sourceViewBox)!=null,y=mS();R.useEffect(()=>{if(!m&&c!=null&&l!=null){var x=Uy({active:s,coordinate:n,dataKey:o,index:i,label:typeof r=="number"?String(r):r,sourceViewBox:y,graphicalItemId:a});w0.emit(PC,c,x,l)}},[m,n,o,a,i,r,l,c,d,s,y])}function TL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function CL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n{D(iie({shared:E,trigger:T,axisId:N,active:i,defaultIndex:F}))},[D,E,T,N,i,F]);var V=mS(),k=I4(),j=Qre(E),H=(e=zt(Xe=>vse(Xe,j,T,F)))!==null&&e!==void 0?e:{},ne=H.activeIndex,J=H.isActive,de=zt(Xe=>gse(Xe,j,T,F)),oe=zt(Xe=>eH(Xe,j,T,F)),he=zt(Xe=>mse(Xe,j,T,F)),B=de,K=zse(),q=(n=i??J)!==null&&n!==void 0?n:!1,$=vK([B,q]),Z=doe($,2),ge=Z[0],ae=Z[1],ce=j==="axis"?oe:void 0;aoe(j,T,he,ce,ne,q);var we=O??K;if(we==null||V==null||j==null)return null;var Me=B??RL;q||(Me=RL),c&&Me.length&&(Me=zq(Me.filter(Xe=>Xe.value!=null&&(Xe.hide!==!0||r.includeHidden)),m,goe));var $e=Me.length>0,Se=CL(CL({},r),{},{payload:Me,label:ce,active:q,activeIndex:ne,coordinate:he,accessibilityLayer:k}),Ve=R.createElement(CQ,{allowEscapeViewBox:s,animationDuration:o,animationEasing:a,isAnimationActive:d,active:q,coordinate:he,hasPayload:$e,offset:f,position:y,reverseDirection:x,useTranslate3d:S,viewBox:V,wrapperStyle:w,lastBoundingBox:ge,innerRef:ae,hasPortalFromProps:!!O},voe(l,Se));return R.createElement(R.Fragment,null,W1.createPortal(Ve,we),q&&R.createElement(Fse,{cursor:b,tooltipEventType:j,coordinate:he,payload:Me,index:ne}))}function boe(t,e,n){return(e=_oe(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _oe(t){var e=woe(t,"string");return typeof e=="symbol"?e:e+""}function woe(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}class Soe{constructor(e){boe(this,"cache",new Map),this.maxSize=e}get(e){var n=this.cache.get(e);return n!==void 0&&(this.cache.delete(e),this.cache.set(e,n)),n}set(e,n){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(e,n)}clear(){this.cache.clear()}size(){return this.cache.size}}function NL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Moe(t){for(var e=1;e{try{var n=document.getElementById(kL);n||(n=document.createElement("span"),n.setAttribute("id",kL),n.setAttribute("aria-hidden","true"),document.body.appendChild(n)),Object.assign(n.style,Poe,e),n.textContent="".concat(t);var r=n.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},Gy=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Z0.isSsr)return{width:0,height:0};if(!sH.enableCache)return OL(e,n);var r=Roe(e,n),i=IL.get(r);if(i)return i;var s=OL(e,n);return IL.set(r,s),s},oH;function Hw(t,e){return Ooe(t)||koe(t,e)||Ioe(t,e)||Noe()}function Noe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ioe(t,e){if(t){if(typeof t=="string")return LL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?LL(t,e):void 0}}function LL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);nt.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=t.breakAll,r=t.style;try{var i=[];Hi(e)||(n?i=e.toString().split(""):i=e.toString().split(lH));var s=i.map(a=>({word:a,width:Gy(a,r).width})),o=n?0:Gy(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:o}}catch{return null}};function uH(t){return t==="start"||t==="middle"||t==="end"||t==="inherit"}function eae(t){return Hi(t)||typeof t=="string"||typeof t=="number"||typeof t=="boolean"}var dH=(t,e,n,r)=>t.reduce((i,s)=>{var o=s.word,a=s.width,l=i[i.length-1];if(l&&a!=null&&(e==null||r||l.width+a+nt.reduce((e,n)=>e.width>n.width?e:n),tae="…",HL=(t,e,n,r,i,s,o,a)=>{var l=t.slice(0,e),c=cH({breakAll:n,style:r,children:l+tae});if(!c)return[!1,[]];var d=dH(c.wordsWithComputedWidth,s,o,a),f=d.length>i||fH(d).width>Number(s);return[f,d]},nae=(t,e,n,r,i)=>{var s=t.maxLines,o=t.children,a=t.style,l=t.breakAll,c=Nt(s),d=String(o),f=dH(e,r,n,i);if(!c||i)return f;var m=f.length>s||fH(f).width>Number(r);if(!m)return f;for(var y=0,x=d.length-1,S=0,w;y<=x&&S<=d.length-1;){var b=Math.floor((y+x)/2),E=b-1,T=HL(d,E,l,a,s,r,n,i),C=zL(T,2),O=C[0],N=C[1],D=HL(d,b,l,a,s,r,n,i),F=zL(D,1),V=F[0];if(!O&&!V&&(y=b+1),O&&V&&(x=b-1),!O&&V){w=N;break}S++}return w||f},VL=t=>{var e=Hi(t)?[]:t.toString().split(lH);return[{words:e,width:void 0}]},rae=t=>{var e=t.width,n=t.scaleToFit,r=t.children,i=t.style,s=t.breakAll,o=t.maxLines;if((e||n)&&!Z0.isSsr){var a,l,c=cH({breakAll:s,children:r,style:i});if(c){var d=c.wordsWithComputedWidth,f=c.spaceWidth;a=d,l=f}else return VL(r);return nae({breakAll:s,children:r,maxLines:o,style:i},a,l,e,!!n)}return VL(r)},hH="#808080",iae={angle:0,breakAll:!1,capHeight:"0.71em",fill:hH,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Y2=R.forwardRef((t,e)=>{var n=Jo(t,iae),r=n.x,i=n.y,s=n.lineHeight,o=n.capHeight,a=n.fill,l=n.scaleToFit,c=n.textAnchor,d=n.verticalAnchor,f=FL(n,Xoe),m=R.useMemo(()=>rae({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:l,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,l,f.style,f.width]),y=f.dx,x=f.dy,S=f.angle,w=f.className,b=f.breakAll,E=FL(f,qoe);if(!Il(r)||!Il(i)||m.length===0)return null;var T=Number(r)+(Nt(y)?y:0),C=Number(i)+(Nt(x)?x:0);if(!wn(T)||!wn(C))return null;var O;switch(d){case"start":O=zE("calc(".concat(o,")"));break;case"middle":O=zE("calc(".concat((m.length-1)/2," * -").concat(s," + (").concat(o," / 2))"));break;default:O=zE("calc(".concat(m.length-1," * -").concat(s,")"));break}var N=[],D=m[0];if(l&&D!=null){var F=D.width,V=f.width;N.push("scale(".concat(Nt(V)&&Nt(F)?V/F:1,")"))}return S&&N.push("rotate(".concat(S,", ").concat(T,", ").concat(C,")")),N.length&&(E.transform=N.join(" ")),R.createElement("text",RC({},Ko(E),{ref:e,x:T,y:C,className:er("recharts-text",w),textAnchor:c,fill:a.includes("url")?hH:a}),m.map((k,j)=>{var H=k.words.join(b?"":" ");return R.createElement("tspan",{x:T,dy:j===0?O:s,key:"".concat(H,"-").concat(j)},H)}))});Y2.displayName="Text";function GL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function hl(t){for(var e=1;e{var e=t.viewBox,n=t.position,r=t.offset,i=r===void 0?0:r,s=t.parentViewBox,o=GP(e),a=o.x,l=o.y,c=o.height,d=o.upperWidth,f=o.lowerWidth,m=a,y=a+(d-f)/2,x=(m+y)/2,S=(d+f)/2,w=m+d/2,b=c>=0?1:-1,E=b*i,T=b>0?"end":"start",C=b>0?"start":"end",O=d>=0?1:-1,N=O*i,D=O>0?"end":"start",F=O>0?"start":"end",V=s;if(n==="top"){var k={x:m+d/2,y:l-E,horizontalAnchor:"middle",verticalAnchor:T};return V&&(k.height=Math.max(l-V.y,0),k.width=d),k}if(n==="bottom"){var j={x:y+f/2,y:l+c+E,horizontalAnchor:"middle",verticalAnchor:C};return V&&(j.height=Math.max(V.y+V.height-(l+c),0),j.width=f),j}if(n==="left"){var H={x:x-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"};return V&&(H.width=Math.max(H.x-V.x,0),H.height=c),H}if(n==="right"){var ne={x:x+S+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"};return V&&(ne.width=Math.max(V.x+V.width-ne.x,0),ne.height=c),ne}var J=V?{width:S,height:c}:{};return n==="insideLeft"?hl({x:x+N,y:l+c/2,horizontalAnchor:F,verticalAnchor:"middle"},J):n==="insideRight"?hl({x:x+S-N,y:l+c/2,horizontalAnchor:D,verticalAnchor:"middle"},J):n==="insideTop"?hl({x:m+d/2,y:l+E,horizontalAnchor:"middle",verticalAnchor:C},J):n==="insideBottom"?hl({x:y+f/2,y:l+c-E,horizontalAnchor:"middle",verticalAnchor:T},J):n==="insideTopLeft"?hl({x:m+N,y:l+E,horizontalAnchor:F,verticalAnchor:C},J):n==="insideTopRight"?hl({x:m+d-N,y:l+E,horizontalAnchor:D,verticalAnchor:C},J):n==="insideBottomLeft"?hl({x:y+N,y:l+c-E,horizontalAnchor:F,verticalAnchor:T},J):n==="insideBottomRight"?hl({x:y+f-N,y:l+c-E,horizontalAnchor:D,verticalAnchor:T},J):n&&typeof n=="object"&&(Nt(n.x)||Rh(n.x))&&(Nt(n.y)||Rh(n.y))?hl({x:a+Ad(n.x,S),y:l+Ad(n.y,c),horizontalAnchor:"end",verticalAnchor:"end"},J):hl({x:w,y:l+c/2,horizontalAnchor:"middle",verticalAnchor:"middle"},J)},cae=["labelRef"],uae=["content"];function WL(t,e){if(t==null)return{};var n,r,i=dae(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var e=t.x,n=t.y,r=t.upperWidth,i=t.lowerWidth,s=t.width,o=t.height,a=t.children,l=R.useMemo(()=>({x:e,y:n,upperWidth:r,lowerWidth:i,width:s,height:o}),[e,n,r,i,s,o]);return R.createElement(pH.Provider,{value:l},a)},mH=()=>{var t=R.useContext(pH),e=mS();return t||(e?GP(e):void 0)},gae=R.createContext(null),vae=()=>{var t=R.useContext(gae),e=zt(iz);return t||e},yae=t=>{var e=t.value,n=t.formatter,r=Hi(t.children)?e:t.children;return typeof n=="function"?n(r):r},Z2=t=>t!=null&&typeof t=="function",xae=(t,e)=>{var n=Wo(e-t),r=Math.min(Math.abs(e-t),360);return n*r},bae=(t,e,n,r,i)=>{var s=t.offset,o=t.className,a=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,f=i.startAngle,m=i.endAngle,y=i.clockWise,x=(c+d)/2,S=xae(f,m),w=S>=0?1:-1,b,E;switch(e){case"insideStart":b=f+w*s,E=y;break;case"insideEnd":b=m-w*s,E=!y;break;case"end":b=m+w*s,E=y;break;default:throw new Error("Unsupported position ".concat(e))}E=S<=0?E:!E;var T=zi(a,l,x,b),C=zi(a,l,x,b+(E?1:-1)*359),O="M".concat(T.x,",").concat(T.y,` + A`).concat(x,",").concat(x,",0,1,").concat(E?0:1,`, + `).concat(C.x,",").concat(C.y),N=Hi(t.id)?l0("recharts-radial-line-"):t.id;return R.createElement("text",Oc({},r,{dominantBaseline:"central",className:er("recharts-radial-bar-label",o)}),R.createElement("defs",null,R.createElement("path",{id:N,d:O})),R.createElement("textPath",{xlinkHref:"#".concat(N)},n))},_ae=(t,e,n)=>{var r=t.cx,i=t.cy,s=t.innerRadius,o=t.outerRadius,a=t.startAngle,l=t.endAngle,c=(a+l)/2;if(n==="outside"){var d=zi(r,i,o+e,c),f=d.x,m=d.y;return{x:f,y:m,textAnchor:f>=r?"start":"end",verticalAnchor:"middle"}}if(n==="center")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(n==="centerTop")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"start"};if(n==="centerBottom")return{x:r,y:i,textAnchor:"middle",verticalAnchor:"end"};var y=(s+o)/2,x=zi(r,i,y,c),S=x.x,w=x.y;return{x:S,y:w,textAnchor:"middle",verticalAnchor:"middle"}},G_=t=>t!=null&&"cx"in t&&Nt(t.cx),wae={angle:0,offset:5,zIndex:Ms.label,position:"middle",textBreakAll:!1};function Sae(t){if(!G_(t))return t;var e=t.cx,n=t.cy,r=t.outerRadius,i=r*2;return{x:e-r,y:n-r,width:i,upperWidth:i,lowerWidth:i,height:i}}function ld(t){var e=Jo(t,wae),n=e.viewBox,r=e.parentViewBox,i=e.position,s=e.value,o=e.children,a=e.content,l=e.className,c=l===void 0?"":l,d=e.textBreakAll,f=e.labelRef,m=vae(),y=mH(),x=i==="center"?y:m??y,S,w,b;n==null?S=x:G_(n)?S=n:S=GP(n);var E=Sae(S);if(!S||Hi(s)&&Hi(o)&&!R.isValidElement(a)&&typeof a!="function")return null;var T=jy(jy({},e),{},{viewBox:S});if(R.isValidElement(a)){T.labelRef;var C=WL(T,cae);return R.cloneElement(a,C)}if(typeof a=="function"){T.content;var O=WL(T,uae);if(w=R.createElement(a,O),R.isValidElement(w))return w}else w=yae(e);var N=Ko(e);if(G_(S)){if(i==="insideStart"||i==="insideEnd"||i==="end")return bae(e,i,w,N,S);b=_ae(S,e.offset,e.position)}else{if(!E)return null;var D=lae({viewBox:E,position:i,offset:e.offset,parentViewBox:G_(r)?void 0:r});b=jy(jy({x:D.x,y:D.y,textAnchor:D.horizontalAnchor,verticalAnchor:D.verticalAnchor},D.width!==void 0?{width:D.width}:{}),D.height!==void 0?{height:D.height}:{})}return R.createElement(au,{zIndex:e.zIndex},R.createElement(Y2,Oc({ref:f,className:er("recharts-label",c)},N,b,{textAnchor:uH(N.textAnchor)?N.textAnchor:b.textAnchor,breakAll:d}),w))}ld.displayName="Label";var Mae=(t,e,n)=>{if(!t)return null;var r={viewBox:e,labelRef:n};return t===!0?R.createElement(ld,Oc({key:"label-implicit"},r)):Il(t)?R.createElement(ld,Oc({key:"label-implicit",value:t},r)):R.isValidElement(t)?t.type===ld?R.cloneElement(t,jy({key:"label-implicit"},r)):R.createElement(ld,Oc({key:"label-implicit",content:t},r)):Z2(t)?R.createElement(ld,Oc({key:"label-implicit",content:t},r)):t&&typeof t=="object"?R.createElement(ld,Oc({},t,{key:"label-implicit"},r)):null};function Eae(t){var e=t.label,n=t.labelRef,r=mH();return Mae(e,r,n)||null}var Aae=["valueAccessor"],Tae=["dataKey","clockWise","id","textBreakAll","zIndex"];function Vw(){return Vw=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=Array.isArray(t.value)?t.value[t.value.length-1]:t.value;if(eae(e))return e},gH=R.createContext(void 0),Rae=gH.Provider,vH=R.createContext(void 0);vH.Provider;function Nae(){return R.useContext(gH)}function Iae(){return R.useContext(vH)}function W_(t){var e=t.valueAccessor,n=e===void 0?Pae:e,r=XL(t,Aae),i=r.dataKey;r.clockWise;var s=r.id,o=r.textBreakAll,a=r.zIndex,l=XL(r,Tae),c=Nae(),d=Iae(),f=c||d;return!f||!f.length?null:R.createElement(au,{zIndex:a??Ms.label},R.createElement(Yo,{className:"recharts-label-list"},f.map((m,y)=>{var x,S=Hi(i)?n(m,y):yi(m.payload,i),w=Hi(s)?{}:{id:"".concat(s,"-").concat(y)};return R.createElement(ld,Vw({key:"label-".concat(y)},Ko(m),l,w,{fill:(x=r.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:S,textBreakAll:o,viewBox:m.viewBox,index:y,zIndex:0}))})))}W_.displayName="LabelList";function kae(t){var e=t.label;return e?e===!0?R.createElement(W_,{key:"labelList-implicit"}):R.isValidElement(e)||Z2(e)?R.createElement(W_,{key:"labelList-implicit",content:e}):typeof e=="object"?R.createElement(W_,Vw({key:"labelList-implicit"},e,{type:String(e.type)})):null:null}function NC(){return NC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{var e=t.cx,n=t.cy,r=t.r,i=t.className,s=er("recharts-dot",i);return Nt(e)&&Nt(n)&&Nt(r)?R.createElement("circle",NC({},Fa(t),OP(t),{className:s,cx:e,cy:n,r})):null},Oae={radiusAxis:{},angleAxis:{}},xH=cs({name:"polarAxis",initialState:Oae,reducers:{addRadiusAxis(t,e){t.radiusAxis[e.payload.id]=e.payload},removeRadiusAxis(t,e){delete t.radiusAxis[e.payload.id]},addAngleAxis(t,e){t.angleAxis[e.payload.id]=e.payload},removeAngleAxis(t,e){delete t.angleAxis[e.payload.id]}}}),jS=xH.actions;jS.addRadiusAxis;jS.removeRadiusAxis;jS.addAngleAxis;jS.removeAngleAxis;var Lae=xH.reducer;function Dae(t){return t&&typeof t=="object"&&"className"in t&&typeof t.className=="string"?t.className:""}var bH=t=>t&&typeof t=="object"&&"clipDot"in t?!!t.clipDot:!0;function qL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function KL(t){for(var e=1;e{r||(i.current===null?n(tie(e)):i.current!==e&&n(nie({prev:i.current,next:e})),i.current=e)},[e,n,r]),R.useLayoutEffect(()=>()=>{i.current&&(n(rie(i.current)),i.current=null)},[n]),null}function $ae(t){var e=t.legendPayload,n=Wr(),r=Qs(),i=R.useRef(null);return R.useLayoutEffect(()=>{r||(i.current===null?n(PZ(e)):i.current!==e&&n(RZ({prev:i.current,next:e})),i.current=e)},[n,r,e]),R.useLayoutEffect(()=>()=>{i.current&&(n(NZ(i.current)),i.current=null)},[n]),null}function Xae(t,e){return Zae(t)||Yae(t,e)||Kae(t,e)||qae()}function qae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kae(t,e){if(t){if(typeof t=="string")return YL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?YL(t,e):void 0}}function YL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n2&&arguments[2]!==void 0?arguments[2]:[],r=[];for(var i of n)r.push({status:"removed",prev:i});for(var s=0;st[Math.floor(s*n)]);return J2(r,e)}function ele(t,e){var n=e.map((r,i)=>t[i]);return J2(n,e)}function tle(t,e){for(var n=new Map,r=0;r{var y=n(f,m);if(y!=null){var x=r.get(y);if(x!==void 0)return i.add(y),x}}),o=[];for(var a of r){var l=Xae(a,2),c=l[0],d=l[1];i.has(c)||o.push(d)}return J2(s,e,o)}function IC(t,e,n){return e==null?null:t==null?e.map(r=>({status:"added",next:r})):n===Q2?Jae(t,e):n===Qae?ele(t,e):nle(t,e,n)}function wH(t,e){var n=R.useRef(t),r=R.useRef(e.current),i=R.useRef(!0);n.current!==t&&(n.current=t,r.current=e.current,i.current=!1);var s=R.useCallback(function(o,a){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(a===0){i.current=!0;return}a===1&&(r.current=o),a>0&&i.current&&l&&(e.current=o)},[e]);return{startValue:r.current,syncStepValue:s}}function rle(t,e){return ale(t)||ole(t,e)||sle(t,e)||ile()}function ile(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sle(t,e){if(t){if(typeof t=="string")return ZL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ZL(t,e):void 0}}function ZL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{typeof t=="function"&&t(),s(!0)},[t]),a=R.useCallback(()=>{typeof e=="function"&&e(),s(!1)},[e]);return{isAnimating:i,handleAnimationStart:o,handleAnimationEnd:a}}function cle(t){var e,n=t.animationInput,r=t.animationIdPrefix,i=t.items,s=t.previousItemsRef,o=t.isAnimationActive,a=t.animationBegin,l=t.animationDuration,c=t.animationEasing,d=t.onAnimationStart,f=t.onAnimationEnd,m=t.animationInterpolateFn,y=t.animationMatchBy,x=t.shouldUpdatePreviousRef,S=t.children,w=t.layout,b=U4(n,r),E=wH(b,s),T=(e=E.startValue)!==null&&e!==void 0?e:null,C=IC(T,i,y??Q2);return R.createElement(D4,{animationId:b,begin:a,duration:l,isActive:o,easing:c,onAnimationEnd:f,onAnimationStart:d,key:b},O=>{var N=T==null,D=i==null?i:m(C,O,w),F=x?x(O):O>0;return E.syncStepValue(D,O,F),D==null?null:S(D,O,N)})}var BE;function ule(t,e){return ple(t)||hle(t,e)||fle(t,e)||dle()}function dle(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function fle(t,e){if(t){if(typeof t=="string")return QL(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?QL(t,e):void 0}}function QL(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var t=R.useState(()=>l0("uid-")),e=ule(t,1),n=e[0];return n},SH=(BE=H1.useId)!==null&&BE!==void 0?BE:mle;function gle(t,e){var n=SH();return e||(t?"".concat(t,"-").concat(n):n)}var vle=R.createContext(void 0),yle=t=>{var e=t.id,n=t.type,r=t.children,i=gle("recharts-".concat(n),e);return R.createElement(vle.Provider,{value:i},r(i))},xle={cartesianItems:[],polarItems:[]},MH=cs({name:"graphicalItems",initialState:xle,reducers:{addCartesianGraphicalItem:{reducer(t,e){t.cartesianItems.push(e.payload)},prepare:sr()},replaceCartesianGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).cartesianItems.indexOf(r);s>-1&&(t.cartesianItems[s]=i)},prepare:sr()},removeCartesianGraphicalItem:{reducer(t,e){var n=$o(t).cartesianItems.indexOf(e.payload);n>-1&&t.cartesianItems.splice(n,1)},prepare:sr()},addPolarGraphicalItem:{reducer(t,e){t.polarItems.push(e.payload)},prepare:sr()},removePolarGraphicalItem:{reducer(t,e){var n=$o(t).polarItems.indexOf(e.payload);n>-1&&t.polarItems.splice(n,1)},prepare:sr()},replacePolarGraphicalItem:{reducer(t,e){var n=e.payload,r=n.prev,i=n.next,s=$o(t).polarItems.indexOf(r);s>-1&&(t.polarItems[s]=i)},prepare:sr()}}}),Zg=MH.actions,ble=Zg.addCartesianGraphicalItem,_le=Zg.replaceCartesianGraphicalItem,wle=Zg.removeCartesianGraphicalItem;Zg.addPolarGraphicalItem;Zg.removePolarGraphicalItem;Zg.replacePolarGraphicalItem;var Sle=MH.reducer,Mle=t=>{var e=Wr(),n=R.useRef(null);return R.useLayoutEffect(()=>{n.current===null?e(ble(t)):n.current!==t&&e(_le({prev:n.current,next:t})),n.current=t},[e,t]),R.useLayoutEffect(()=>()=>{n.current&&(e(wle(n.current)),n.current=null)},[e]),null},Ele=R.memo(Mle),Ale=["points"];function JL(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function HE(t){for(var e=1;e{var b,E,T=HE(HE(HE({r:3},o),m),{},{index:w,cx:(b=S.x)!==null&&b!==void 0?b:void 0,cy:(E=S.y)!==null&&E!==void 0?E:void 0,dataKey:s,value:S.value,payload:S.payload,points:e});return R.createElement(Ile,{key:"dot-".concat(w),option:n,dotProps:T,className:i})}),x={};return a&&l!=null&&(x.clipPath="url(#clipPath-".concat(f?"":"dots-").concat(l,")")),R.createElement(au,{zIndex:d},R.createElement(Yo,Gw({className:r},x),y))}function e3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function t3(t){for(var e=1;e({top:t.top,bottom:t.bottom,left:t.left,right:t.right})),qle=Oe([Xle,tu,nu],(t,e,n)=>{if(!(!t||e==null||n==null))return{x:t.left,y:t.top,width:Math.max(0,e-t.left-t.right),height:Math.max(0,n-t.top-t.bottom)}}),eR=()=>zt(qle),Kle=()=>zt(tse);function n3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function VE(t){for(var e=1;e{var e=t.point,n=t.childIndex,r=t.mainColor,i=t.activeDot,s=t.dataKey,o=t.clipPath;if(i===!1||e.x==null||e.y==null)return null;var a={index:n,dataKey:s,cx:e.x,cy:e.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:e.payload,value:e.value},l=VE(VE(VE({},a),Z1(i)),OP(i)),c;return R.isValidElement(i)?c=R.cloneElement(i,l):typeof i=="function"?c=i(l):c=R.createElement(yH,l),R.createElement(Yo,{className:"recharts-active-dot",clipPath:o},c)};function r3(t){var e=t.points,n=t.mainColor,r=t.activeDot,i=t.itemDataKey,s=t.clipPath,o=t.zIndex,a=o===void 0?Ms.activeDot:o,l=zt(_0),c=Kle();if(e==null||c==null)return null;var d=e.find(f=>c.includes(f.payload));return Hi(d)?null:R.createElement(au,{zIndex:a},R.createElement(Jle,{point:d,childIndex:Number(l),mainColor:n,dataKey:i,activeDot:r,clipPath:s}))}var ece=t=>{var e=t.chartData,n=Wr(),r=Qs();return R.useEffect(()=>r?()=>{}:(n(EL(e)),()=>{n(EL(void 0))}),[e,n,r]),null},i3={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},TH=cs({name:"brush",initialState:i3,reducers:{setBrushSettings(t,e){return e.payload==null?i3:e.payload}}});TH.actions.setBrushSettings;var tce=TH.reducer;function nce(t){return(t%180+180)%180}var rce=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=nce(i),o=s*Math.PI/180,a=Math.atan(r/n),l=o>a&&o{t.dots.push(e.payload)},removeDot:(t,e)=>{var n=$o(t).dots.findIndex(r=>r===e.payload);n!==-1&&t.dots.splice(n,1)},addArea:(t,e)=>{t.areas.push(e.payload)},removeArea:(t,e)=>{var n=$o(t).areas.findIndex(r=>r===e.payload);n!==-1&&t.areas.splice(n,1)},addLine:(t,e)=>{t.lines.push(e.payload)},removeLine:(t,e)=>{var n=$o(t).lines.findIndex(r=>r===e.payload);n!==-1&&t.lines.splice(n,1)}}}),Qg=CH.actions;Qg.addDot;Qg.removeDot;Qg.addArea;Qg.removeArea;Qg.addLine;Qg.removeLine;var sce=CH.reducer;function oce(t,e){return uce(t)||cce(t,e)||lce(t,e)||ace()}function ace(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function lce(t,e){if(t){if(typeof t=="string")return s3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s3(t,e):void 0}}function s3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{var e=t.children,n=R.useState("".concat(l0("recharts"),"-clip")),r=oce(n,1),i=r[0],s=eR();if(s==null)return null;var o=s.x,a=s.y,l=s.width,c=s.height;return R.createElement(dce.Provider,{value:i},R.createElement("defs",null,R.createElement("clipPath",{id:i},R.createElement("rect",{x:o,y:a,height:c,width:l}))),e)};function PH(t,e){if(e<1)return[];if(e===1)return t;for(var n=[],r=0;rt*i)return!1;var s=n();return t*(e-t*s/2-r)>=0&&t*(e+t*s/2-i)<=0}function mce(t,e){return PH(t,e+1)}function gce(t,e,n,r,i){for(var s=(r||[]).slice(),o=e.start,a=e.end,l=0,c=1,d=o,f=function(){var x=r==null?void 0:r[l];if(x===void 0)return{v:PH(r,c)};var S=l,w,b=()=>(w===void 0&&(w=n(x,S)),w),E=x.coordinate,T=l===0||S0(t,E,b,d,a);T||(l=0,d=o,c+=1),T&&(d=E+t*(b()/2+i),l+=c)},m;c<=s.length;)if(m=f(),m)return m.v;return[]}function vce(t,e,n,r,i){var s=(r||[]).slice(),o=s.length;if(o===0)return[];for(var a=e.start,l=e.end,c=1;c<=o;c++){for(var d=(o-1)%c,f=a,m=!0,y=function(){var C=r[S];if(C==null)return 0;var O=S,N,D=()=>(N===void 0&&(N=n(C,O)),N),F=C.coordinate,V=S===d||S0(t,F,D,f,l);if(!V)return m=!1,1;V&&(f=F+t*(D()/2+i))},x,S=d;S(S===void 0&&(S=n(y,m)),S);if(m===o-1){var b=t*(x.coordinate+t*w()/2-l);s[m]=x=ns(ns({},x),{},{tickCoord:b>0?x.coordinate-b*t:x.coordinate})}else s[m]=x=ns(ns({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var E=S0(t,x.tickCoord,w,a,l);E&&(l=x.tickCoord-t*(w()/2+i),s[m]=ns(ns({},x),{},{isShow:!0}))}},d=o-1;d>=0;d--)c(d);return s}function wce(t,e,n,r,i,s){var o=(r||[]).slice(),a=o.length,l=e.start,c=e.end;if(s){var d=r[a-1];if(d!=null){var f=n(d,a-1),m=t*(d.coordinate+t*f/2-c);if(o[a-1]=d=ns(ns({},d),{},{tickCoord:m>0?d.coordinate-m*t:d.coordinate}),d.tickCoord!=null){var y=S0(t,d.tickCoord,()=>f,l,c);y&&(c=d.tickCoord-t*(f/2+i),o[a-1]=ns(ns({},d),{},{isShow:!0}))}}}for(var x=s?a-1:a,S=function(E){var T=o[E];if(T==null)return 1;var C=T,O,N=()=>(O===void 0&&(O=n(T,E)),O);if(E===0){var D=t*(C.coordinate-t*N()/2-l);o[E]=C=ns(ns({},C),{},{tickCoord:D<0?C.coordinate-D*t:C.coordinate})}else o[E]=C=ns(ns({},C),{},{tickCoord:C.coordinate});if(C.tickCoord!=null){var F=S0(t,C.tickCoord,N,l,c);F&&(l=C.tickCoord+t*(N()/2+i),o[E]=ns(ns({},C),{},{isShow:!0}))}},w=0;w{var D=typeof c=="function"?c(O.value,N):O.value;return x==="width"?hce(Gy(D,{fontSize:e,letterSpacing:n}),S,f):Gy(D,{fontSize:e,letterSpacing:n})[x]},b=i[0],E=i[1],T=i.length>=2&&b!=null&&E!=null?Wo(E.coordinate-b.coordinate):1,C=pce(s,T,x);return l==="equidistantPreserveStart"?gce(T,C,w,i,o):l==="equidistantPreserveEnd"?vce(T,C,w,i,o):(l==="preserveStart"||l==="preserveStartEnd"?y=wce(T,C,w,i,o,l==="preserveStartEnd"):y=_ce(T,C,w,i,o),y.filter(O=>O.isShow))}var Sce=t=>{var e=t.ticks,n=t.label,r=t.labelGapWithTick,i=r,s=t.tickSize,o=s===void 0?0:s,a=t.tickMargin,l=a===void 0?0:a,c=0;if(e){Array.from(e).forEach(y=>{if(y){var x=y.getBoundingClientRect();x.width>c&&(c=x.width)}});var d=n?n.getBoundingClientRect().width:0,f=o+l,m=c+f+d+(n?i:0);return Math.round(m)}return 0},Mce={xAxis:{},yAxis:{}},RH=cs({name:"renderedTicks",initialState:Mce,reducers:{setRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId,s=n.ticks;t[r][i]=s},removeRenderedTicks:(t,e)=>{var n=e.payload,r=n.axisType,i=n.axisId;delete t[r][i]}}}),NH=RH.actions,Ece=NH.setRenderedTicks,Ace=NH.removeRenderedTicks,Tce=RH.reducer,Cce=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function a3(t,e){return Ice(t)||Nce(t,e)||Rce(t,e)||Pce()}function Pce(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rce(t,e){if(t){if(typeof t=="string")return l3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l3(t,e):void 0}}function l3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r==null||n==null)return Bg;var s=e.map(o=>({value:o.value,coordinate:o.coordinate,offset:o.offset,index:o.index}));return i(Ece({ticks:s,axisId:r,axisType:n})),()=>{i(Ace({axisId:r,axisType:n}))}},[i,e,r,n]),null}var Gce=R.forwardRef((t,e)=>{var n=t.ticks,r=n===void 0?[]:n,i=t.tick,s=t.tickLine,o=t.stroke,a=t.tickFormatter,l=t.unit,c=t.padding,d=t.tickTextProps,f=t.orientation,m=t.mirror,y=t.x,x=t.y,S=t.width,w=t.height,b=t.tickSize,E=t.tickMargin,T=t.fontSize,C=t.letterSpacing,O=t.getTicksConfig,N=t.events,D=t.axisType,F=t.axisId,V=tR(Er(Er({},O),{},{ticks:r}),T,C),k=Fa(O),j=Z1(i),H=uH(k.textAnchor)?k.textAnchor:zce(f,m),ne=Bce(f,m),J={};typeof s=="object"&&(J=s);var de=Er(Er({},k),{},{fill:"none"},J),oe=V.map(K=>Er({entry:K},Fce(K,y,x,S,w,f,b,m,E))),he=oe.map(K=>{var q=K.entry,$=K.line;return R.createElement(Yo,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(q.value,"-").concat(q.coordinate,"-").concat(q.tickCoord)},s&&R.createElement("line",Dh({},de,$,{className:er("recharts-cartesian-axis-tick-line",Kh(s,"className"))})))}),B=oe.map((K,q)=>{var $,Z,ge=K.entry,ae=K.tick,ce=Er(Er(Er(Er({verticalAnchor:ne},k),{},{textAnchor:H,stroke:"none",fill:o},ae),{},{index:q,payload:ge,visibleTicksCount:V.length,tickFormatter:a,padding:c},d),{},{angle:($=(Z=d==null?void 0:d.angle)!==null&&Z!==void 0?Z:k.angle)!==null&&$!==void 0?$:0}),we=Er(Er({},ce),j);return R.createElement(Yo,Dh({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(ge.value,"-").concat(ge.coordinate,"-").concat(ge.tickCoord)},qX(N,ge,q)),i&&R.createElement(Hce,{option:i,tickProps:we,value:"".concat(typeof a=="function"?a(ge.value,q):ge.value).concat(l||"")}))});return R.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(D,"-ticks")},R.createElement(Vce,{ticks:V,axisId:F,axisType:D}),B.length>0&&R.createElement(au,{zIndex:Ms.label},R.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(D,"-tick-labels"),ref:e},B)),he.length>0&&R.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(D,"-tick-lines")},he))}),Wce=R.forwardRef((t,e)=>{var n=t.axisLine,r=t.width,i=t.height,s=t.className,o=t.hide,a=t.ticks,l=t.axisType,c=t.axisId,d=kce(t,Cce),f=R.useState(""),m=a3(f,2),y=m[0],x=m[1],S=R.useState(""),w=a3(S,2),b=w[0],E=w[1],T=R.useRef(null);R.useImperativeHandle(e,()=>({getCalculatedWidth:()=>{var O;return Sce({ticks:T.current,label:(O=t.labelRef)===null||O===void 0?void 0:O.current,labelGapWithTick:5,tickSize:t.tickSize,tickMargin:t.tickMargin})}}));var C=R.useCallback(O=>{if(O){var N=O.getElementsByClassName("recharts-cartesian-axis-tick-value");T.current=N;var D=N[0];if(D){var F=window.getComputedStyle(D),V=F.fontSize,k=F.letterSpacing;(V!==y||k!==b)&&(x(V),E(k))}}},[y,b]);return o||r!=null&&r<=0||i!=null&&i<=0?null:R.createElement(au,{zIndex:t.zIndex},R.createElement(Yo,{className:er("recharts-cartesian-axis",s)},R.createElement(jce,{x:t.x,y:t.y,width:r,height:i,orientation:t.orientation,mirror:t.mirror,axisLine:n,otherSvgProps:Fa(t)}),R.createElement(Gce,{ref:C,axisType:l,events:d,fontSize:y,getTicksConfig:t,height:t.height,letterSpacing:b,mirror:t.mirror,orientation:t.orientation,padding:t.padding,stroke:t.stroke,tick:t.tick,tickFormatter:t.tickFormatter,tickLine:t.tickLine,tickMargin:t.tickMargin,tickSize:t.tickSize,tickTextProps:t.tickTextProps,ticks:a,unit:t.unit,width:t.width,x:t.x,y:t.y,axisId:c}),R.createElement(mae,{x:t.x,y:t.y,width:t.width,height:t.height,lowerWidth:t.width,upperWidth:t.width},R.createElement(Eae,{label:t.label,labelRef:t.labelRef}),t.children)))}),nR=R.forwardRef((t,e)=>{var n=Jo(t,Gc);return R.createElement(Wce,Dh({},n,{ref:e}))});nR.displayName="CartesianAxis";var $ce=["x1","y1","x2","y2","key"],Xce=["offset"],qce=["xAxisId","yAxisId"],Kce=["xAxisId","yAxisId"];function u3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function rs(t){for(var e=1;e{var e=t.fill;if(!e||e==="none")return null;var n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.ry;return R.createElement("rect",{x:r,y:i,ry:a,width:s,height:o,stroke:"none",fill:e,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function IH(t){var e=t.option,n=t.lineItemProps,r;if(R.isValidElement(e))r=R.cloneElement(e,n);else if(typeof e=="function")r=e(n);else{var i,s=n.x1,o=n.y1,a=n.x2,l=n.y2,c=n.key,d=Ww(n,$ce),f=(i=Fa(d))!==null&&i!==void 0?i:{};f.offset;var m=Ww(f,Xce);r=R.createElement("line",rh({},m,{x1:s,y1:o,x2:a,y2:l,fill:"none",key:c}))}return r}function tue(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,s=t.horizontalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Ww(t,qce),a=s.map((l,c)=>{var d=rs(rs({},o),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return R.createElement(IH,{key:"line-".concat(c),option:i,lineItemProps:d})});return R.createElement("g",{className:"recharts-cartesian-grid-horizontal"},a)}function nue(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,s=t.verticalPoints;if(!i||!s||!s.length)return null;t.xAxisId,t.yAxisId;var o=Ww(t,Kce),a=s.map((l,c)=>{var d=rs(rs({},o),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return R.createElement(IH,{option:i,lineItemProps:d,key:"line-".concat(c)})});return R.createElement("g",{className:"recharts-cartesian-grid-vertical"},a)}function rue(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,s=t.width,o=t.height,a=t.horizontalPoints,l=t.horizontal,c=l===void 0?!0:l;if(!c||!e||!e.length||a==null)return null;var d=a.map(m=>Math.round(m+i-i)).sort((m,y)=>m-y);i!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,w=S?i+o-m:x-m;if(w<=0)return null;var b=y%e.length;return R.createElement("rect",{key:"react-".concat(y),y:m,x:r,height:w,width:s,stroke:"none",fill:e[b],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function iue(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,s=t.x,o=t.y,a=t.width,l=t.height,c=t.verticalPoints;if(!n||!r||!r.length)return null;var d=c.map(m=>Math.round(m+s-s)).sort((m,y)=>m-y);s!==d[0]&&d.unshift(0);var f=d.map((m,y)=>{var x=d[y+1],S=x==null,w=S?s+a-m:x-m;if(w<=0)return null;var b=y%r.length;return R.createElement("rect",{key:"react-".concat(y),x:m,y:o,width:w,height:l,stroke:"none",fill:r[b],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return R.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var sue=(t,e)=>{var n=t.xAxis,r=t.width,i=t.height,s=t.offset;return f4(tR(rs(rs(rs({},Gc),n),{},{ticks:h4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.left,s.left+s.width,e)},oue=(t,e)=>{var n=t.yAxis,r=t.width,i=t.height,s=t.offset;return f4(tR(rs(rs(rs({},Gc),n),{},{ticks:h4(n),viewBox:{x:0,y:0,width:r,height:i}})),s.top,s.top+s.height,e)},aue={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Ms.grid};function kH(t){var e=_4(),n=w4(),r=b4(),i=rs(rs({},Jo(t,aue)),{},{x:Nt(t.x)?t.x:r.left,y:Nt(t.y)?t.y:r.top,width:Nt(t.width)?t.width:r.width,height:Nt(t.height)?t.height:r.height}),s=i.xAxisId,o=i.yAxisId,a=i.x,l=i.y,c=i.width,d=i.height,f=i.syncWithTicks,m=i.horizontalValues,y=i.verticalValues,x=Qs(),S=zt(V=>fL(V,"xAxis",s,x)),w=zt(V=>fL(V,"yAxis",o,x));if(!kl(c)||!kl(d)||!Nt(a)||!Nt(l))return null;var b=i.verticalCoordinatesGenerator||sue,E=i.horizontalCoordinatesGenerator||oue,T=i.horizontalPoints,C=i.verticalPoints;if((!T||!T.length)&&typeof E=="function"){var O=m&&m.length,N=E({yAxis:w?rs(rs({},w),{},{ticks:O?m:w.ticks}):void 0,width:e??c,height:n??d,offset:r},O?!0:f);vw(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof N,"]")),Array.isArray(N)&&(T=N)}if((!C||!C.length)&&typeof b=="function"){var D=y&&y.length,F=b({xAxis:S?rs(rs({},S),{},{ticks:D?y:S.ticks}):void 0,width:e??c,height:n??d,offset:r},D?!0:f);vw(Array.isArray(F),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof F,"]")),Array.isArray(F)&&(C=F)}return R.createElement(au,{zIndex:i.zIndex},R.createElement("g",{className:"recharts-cartesian-grid"},R.createElement(eue,{fill:i.fill,fillOpacity:i.fillOpacity,x:i.x,y:i.y,width:i.width,height:i.height,ry:i.ry}),R.createElement(rue,rh({},i,{horizontalPoints:T})),R.createElement(iue,rh({},i,{verticalPoints:C})),R.createElement(tue,rh({},i,{offset:r,horizontalPoints:T,xAxis:S,yAxis:w})),R.createElement(nue,rh({},i,{offset:r,verticalPoints:C,xAxis:S,yAxis:w}))))}kH.displayName="CartesianGrid";var lue={},OH=cs({name:"errorBars",initialState:lue,reducers:{addErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]||(t[r]=[]),t[r].push(i)},replaceErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.prev,s=n.next;t[r]&&(t[r]=t[r].map(o=>o.dataKey===i.dataKey&&o.direction===i.direction?s:o))},removeErrorBar:(t,e)=>{var n=e.payload,r=n.itemId,i=n.errorBar;t[r]&&(t[r]=t[r].filter(s=>s.dataKey!==i.dataKey||s.direction!==i.direction))}}}),rR=OH.actions;rR.addErrorBar;rR.replaceErrorBar;rR.removeErrorBar;var cue=OH.reducer;function LH(t,e){var n,r,i=zt(c=>iu(c,t)),s=zt(c=>su(c,e)),o=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:ti.allowDataOverflow,a=(r=s==null?void 0:s.allowDataOverflow)!==null&&r!==void 0?r:ni.allowDataOverflow,l=o||a;return{needClip:l,needClipX:o,needClipY:a}}function uue(t){var e=t.xAxisId,n=t.yAxisId,r=t.clipPathId,i=eR(),s=LH(e,n),o=s.needClipX,a=s.needClipY,l=s.needClip,c=zt(T=>xB(T,e,!1)),d=zt(T=>bB(T,n,!1));if(!l||!i)return null;var f=i.x,m=i.y,y=i.width,x=i.height,S=o&&c?Math.min(c[0],c[1]):f-y/2,w=a&&d?Math.min(d[0],d[1]):m-x/2,b=o&&c?Math.abs(c[1]-c[0]):y*2,E=a&&d?Math.abs(d[1]-d[0]):x*2;return R.createElement("clipPath",{id:"clipPath-".concat(r)},R.createElement("rect",{x:S,y:w,width:b,height:E}))}function due(t){var e=Z1(t),n=3,r=2;if(e!=null){var i=e.r,s=e.strokeWidth,o=Number(i),a=Number(s);return(Number.isNaN(o)||o<0)&&(o=n),(Number.isNaN(a)||a<0)&&(a=r),{r:o,strokeWidth:a}}return{r:n,strokeWidth:r}}function iR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.xAxisId)!==null&&n!==void 0?n:EH}function sR(t,e){var n,r;return(n=(r=t.graphicalItems.cartesianItems.find(i=>i.id===e))===null||r===void 0?void 0:r.yAxisId)!==null&&n!==void 0?n:EH}var DH=(t,e,n)=>CB(t,"xAxis",iR(t,e),n),UH=(t,e,n)=>TB(t,"xAxis",iR(t,e),n),jH=(t,e,n)=>CB(t,"yAxis",sR(t,e),n),FH=(t,e,n)=>TB(t,"yAxis",sR(t,e),n),fue=Oe([fr,DH,jH,UH,FH],(t,e,n,r,i)=>Fl(t,"xAxis")?gw(e,r,!1):gw(n,i,!1)),hue=(t,e)=>e,zH=Oe([Xz,hue],(t,e)=>t.filter(n=>n.type==="area").find(n=>n.id===e)),BH=t=>{var e=fr(t),n=Fl(e,"xAxis");return n?"yAxis":"xAxis"},pue=(t,e)=>{var n=BH(t);return n==="yAxis"?sR(t,e):iR(t,e)},mue=(t,e,n)=>rB(t,BH(t),pue(t,e),n),gue=Oe([zH,mue],(t,e)=>{var n;if(!(t==null||e==null)){var r=t.stackId,i=s2(t);if(!(r==null||i==null)){var s=(n=e[r])===null||n===void 0?void 0:n.stackedData,o=s==null?void 0:s.find(a=>a.key===i);if(o!=null)return o.map(a=>[a[0],a[1]])}}}),vue=Oe([fr,DH,jH,UH,FH,gue,BJ,fue,zH,iee],(t,e,n,r,i,s,o,a,l,c)=>{var d=o.chartData,f=o.dataStartIndex,m=o.dataEndIndex;if(!(l==null||t!=="horizontal"&&t!=="vertical"||e==null||n==null||r==null||i==null||r.length===0||i.length===0||a==null)){var y=l.data,x;if(y&&y.length>0?x=y:x=d==null?void 0:d.slice(f,m+1),x!=null)return Vue({layout:t,xAxis:e,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:l,stackedData:s,displayedData:x,chartBaseValue:c,bandSize:a})}}),yue=["animationElapsedTime","isAnimating","isEntrance","layout","isRange","stroke","connectNulls"],xue=["id","baseLine"];function Wy(){return Wy=Object.assign?Object.assign.bind():function(t){for(var e=1;ef.y||0));return Nt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.y||0),d)),Nt(d)?R.createElement("rect",{x:af.x||0));return Nt(i)?d=Math.max(i,d):i&&Array.isArray(i)&&i.length&&(d=Math.max(...i.map(f=>f.x||0),d)),Nt(d)?R.createElement("rect",{x:0,y:at==null?[]:e===1?t.flatMap(n=>n.status==="removed"?[]:[n.next]):t.flatMap(n=>n.status==="matched"?[Rg(Rg({},n.next),{},{x:Uc(n.prev.x,n.next.x,e),y:Uc(n.prev.y,n.next.y,e)})]:n.status==="added"?[n.next]:[]),VH={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",animationMatchBy:Q2,animationInterpolateFn:Nue,connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,shape:Mue,xAxisId:0,yAxisId:0,zIndex:Ms.area};function Xw(t,e){return t&&t!=="none"?t:e}var Iue=t=>{var e=t.dataKey,n=t.name,r=t.stroke,i=t.fill,s=t.legendType,o=t.hide;return[{inactive:o,dataKey:e,type:s,color:Xw(r,i),value:p4(n,e),payload:t}]},kue=R.memo(t=>{var e=t.dataKey,n=t.data,r=t.stroke,i=t.strokeWidth,s=t.fill,o=t.name,a=t.hide,l=t.unit,c=t.tooltipType,d=t.id,f={dataDefinedOnItem:n,getPosition:Bg,settings:{stroke:r,strokeWidth:i,fill:s,dataKey:e,nameKey:void 0,name:p4(o,e),hide:a,type:c,color:Xw(r,s),unit:l,graphicalItemId:d}};return R.createElement(Wae,{tooltipEntrySettings:f})});function Oue(t){var e=t.clipPathId,n=t.points,r=t.props,i=r.needClip,s=r.dot,o=r.dataKey,a=Fa(r);return R.createElement(Ole,{points:n,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:a,needClip:i,clipPathId:e})}function Lue(t){var e=t.showLabels,n=t.children,r=t.points,i=r.map(s=>{var o,a,l={x:(o=s.x)!==null&&o!==void 0?o:0,y:(a=s.y)!==null&&a!==void 0?a:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Rg(Rg({},l),{},{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:l,fill:void 0})});return R.createElement(Rae,{value:e?i:void 0},n)}function Due(t){var e=t.points,n=t.baseLine,r=t.needClip,i=t.clipPathId,s=t.props,o=t.animationElapsedTime,a=t.isAnimating,l=t.isEntrance,c=s.layout,d=s.type,f=s.stroke,m=s.connectNulls,y=s.isRange,x=s.shape,S=s.id,w=HH(s,Eue),b=Ko(w),E=Rg(Rg({},b),{},{id:S,points:e,connectNulls:m,type:d,baseLine:n,layout:c,stroke:f,isRange:y,animationElapsedTime:o,isAnimating:a,isEntrance:l});return R.createElement(R.Fragment,null,(e==null?void 0:e.length)>1&&R.createElement(Yo,{clipPath:r?"url(#clipPath-".concat(i,")"):void 0},R.createElement(Gae,{option:x,DefaultShape:VH.shape,shapeProps:E})),R.createElement(Oue,{points:e,props:w,clipPathId:i}))}function Uue(t,e,n){if(Nt(t)){var r=Nt(e)?e:void 0;return Uc(r,t,n)}if(Hi(t)||Nl(t)){var i=Nt(e)?e:void 0;return Uc(i,0,n)}return t}function jue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=t.previousPointsRef,s=t.previousBaselineRef,o=r.points,a=r.baseLine,l=r.isAnimationActive,c=r.animationBegin,d=r.animationDuration,f=r.animationEasing,m=r.animationMatchBy,y=r.animationInterpolateFn,x=R.useMemo(()=>({points:o,baseLine:a}),[o,a]),S=wH(x,s),w=WP(),b=lle(r.onAnimationStart,r.onAnimationEnd),E=b.isAnimating,T=b.handleAnimationStart,C=b.handleAnimationEnd,O=S.startValue;if(w==null)return null;var N;return Array.isArray(a)&&Array.isArray(O)?N=IC(O,a,m):Array.isArray(a)?N=IC(null,a,m):N=null,R.createElement(cle,{animationInput:x,animationIdPrefix:"recharts-area-",items:o,previousItemsRef:i,isAnimationActive:l,animationBegin:c,animationDuration:d,animationEasing:f,onAnimationStart:T,onAnimationEnd:C,animationInterpolateFn:y,animationMatchBy:m,layout:w},(D,F,V)=>{var k;return F===1?k=a:Array.isArray(a)?k=y(N,F,w):k=V?a:Uue(a,O,F),S.syncStepValue(k,F),R.createElement(Lue,{showLabels:!E,points:o},r.children,R.createElement(Due,{points:D,baseLine:k,needClip:e,clipPathId:n,props:r,animationElapsedTime:F,isAnimating:E||F<1,isEntrance:V}),R.createElement(kae,{label:r.label}))})}function Fue(t){var e=t.needClip,n=t.clipPathId,r=t.props,i=R.useRef(null),s=R.useRef();return R.createElement(jue,{needClip:e,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:s})}class zue extends R.PureComponent{render(){var e=this.props,n=e.hide,r=e.dot,i=e.points,s=e.className,o=e.top,a=e.left,l=e.needClip,c=e.xAxisId,d=e.yAxisId,f=e.width,m=e.height,y=e.id,x=e.baseLine,S=e.zIndex;if(n)return null;var w=er("recharts-area",s),b=y,E=due(r),T=E.r,C=E.strokeWidth,O=bH(r),N=T*2+C,D=l?"url(#clipPath-".concat(O?"":"dots-").concat(b,")"):void 0;return R.createElement(au,{zIndex:S},R.createElement(Yo,{className:w},l&&R.createElement("defs",null,R.createElement(uue,{clipPathId:b,xAxisId:c,yAxisId:d}),!O&&R.createElement("clipPath",{id:"clipPath-dots-".concat(b)},R.createElement("rect",{x:a-N/2,y:o-N/2,width:f+N,height:m+N}))),R.createElement(Fue,{needClip:l,clipPathId:b,props:this.props})),R.createElement(r3,{points:i,mainColor:Xw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}),this.props.isRange&&Array.isArray(x)&&R.createElement(r3,{points:x,mainColor:Xw(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:D}))}}function Bue(t){var e,n=t.activeDot,r=t.animationBegin,i=t.animationDuration,s=t.animationEasing,o=t.connectNulls,a=t.dot,l=t.fill,c=t.fillOpacity,d=t.hide,f=t.isAnimationActive,m=t.legendType,y=t.stroke,x=t.xAxisId,S=t.yAxisId,w=HH(t,Aue),b=Hg(),E=ZB(),T=LH(x,S),C=T.needClip,O=Qs(),N=(e=zt(de=>vue(de,t.id,O)))!==null&&e!==void 0?e:{},D=N.points,F=N.isRange,V=N.baseLine,k=eR();if(b!=="horizontal"&&b!=="vertical"||k==null||E!=="AreaChart"&&E!=="ComposedChart")return null;var j=k.height,H=k.width,ne=k.x,J=k.y;return!D||!D.length?null:R.createElement(zue,$w({},w,{activeDot:n,animationBegin:r,animationDuration:i,animationEasing:s,baseLine:V,connectNulls:o,dot:a,fill:l,fillOpacity:c,height:j,hide:d,layout:b,isAnimationActive:f,isRange:F,legendType:m,needClip:C,points:D,stroke:y,width:H,left:ne,top:J,xAxisId:x,yAxisId:S}))}var Hue=(t,e,n,r,i)=>{var s=n??e;if(Nt(s))return s;var o=t==="horizontal"?i:r,a=o.scale.domain();if(o.type==="number"){var l=Math.max(a[0],a[1]),c=Math.min(a[0],a[1]);return s==="dataMin"?c:s==="dataMax"||l<0?l:Math.max(Math.min(a[0],a[1]),0)}return s==="dataMin"?a[0]:s==="dataMax"?a[1]:a[0]};function Vue(t){var e=t.areaSettings,n=e.connectNulls,r=e.baseValue,i=e.dataKey,s=t.stackedData,o=t.layout,a=t.chartBaseValue,l=t.xAxis,c=t.yAxis,d=t.displayedData,f=t.dataStartIndex,m=t.xAxisTicks,y=t.yAxisTicks,x=t.bandSize,S=s&&s.length,w=Hue(o,a,r,l,c),b=o==="horizontal",E=!1,T=d.map((O,N)=>{var D,F,V,k;if(S)k=s[f+N];else{var j=yi(O,i);Array.isArray(j)?(k=j,E=!0):k=[w,j]}var H=(D=(F=k)===null||F===void 0?void 0:F[1])!==null&&D!==void 0?D:null,ne=H==null||S&&!n&&yi(O,i)==null;if(b){var J;return{x:ak({axis:l,ticks:m,bandSize:x,entry:O,index:N}),y:ne?null:(J=c.scale.map(H))!==null&&J!==void 0?J:null,value:k,payload:O}}return{x:ne?null:(V=l.scale.map(H))!==null&&V!==void 0?V:null,y:ak({axis:c,ticks:y,bandSize:x,entry:O,index:N}),value:k,payload:O}}),C;return S||E?C=T.map(O=>{var N,D=Array.isArray(O.value)?O.value[0]:null;if(b){var F;return{x:O.x,y:D!=null&&O.y!=null&&(F=c.scale.map(D))!==null&&F!==void 0?F:null,payload:O.payload}}return{x:D!=null&&(N=l.scale.map(D))!==null&&N!==void 0?N:null,y:O.y,payload:O.payload}}):C=b?c.scale.map(w):l.scale.map(w),{points:T,baseLine:C??0,isRange:E}}function Gue(t){var e=Jo(t,VH),n=Qs();return R.createElement(yle,{id:e.id,type:"area"},r=>R.createElement(R.Fragment,null,R.createElement($ae,{legendPayload:Iue(e)}),R.createElement(kue,{dataKey:e.dataKey,data:e.data,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,unit:e.unit,tooltipType:e.tooltipType,id:r}),R.createElement(Ele,{type:"area",id:r,data:e.data,dataKey:e.dataKey,xAxisId:e.xAxisId,yAxisId:e.yAxisId,zAxisId:0,stackId:TY(e.stackId),hide:e.hide,barSize:void 0,baseValue:e.baseValue,isPanorama:n,connectNulls:e.connectNulls}),R.createElement(Bue,$w({},e,{id:r}))))}var GH=R.memo(Gue,xS);GH.displayName="Area";var Wue=["domain","range"],$ue=["domain","range"];function h3(t,e){if(t==null)return{};var n,r,i=Xue(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{if(o!=null)return g3(g3({},s),{},{type:o})},[s,o]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Fle(a)):n.current!==a&&e(zle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Ble(n.current)),n.current=null)},[e]),null}var nde=t=>{var e=t.xAxisId,n=t.className,r=zt(g4),i=Qs(),s="xAxis",o=zt(m=>AB(m,s,e,i)),a=zt(m=>Dre(m,e)),l=zt(m=>Hre(m,e)),c=zt(m=>Vz(m,e));if(a==null||l==null||c==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var d=OC(t,Kue);c.id,c.scale;var f=OC(c,Yue);return R.createElement(nR,kC({},d,f,{x:l.x,y:l.y,width:a.width,height:a.height,className:er("recharts-".concat(s," ").concat(s),n),viewBox:r,ticks:o,axisType:s,axisId:e}))},rde={allowDataOverflow:ti.allowDataOverflow,allowDecimals:ti.allowDecimals,allowDuplicatedCategory:ti.allowDuplicatedCategory,angle:ti.angle,axisLine:Gc.axisLine,height:ti.height,hide:!1,includeHidden:ti.includeHidden,interval:ti.interval,label:!1,minTickGap:ti.minTickGap,mirror:ti.mirror,orientation:ti.orientation,padding:ti.padding,reversed:ti.reversed,scale:ti.scale,tick:ti.tick,tickCount:ti.tickCount,tickLine:Gc.tickLine,tickSize:Gc.tickSize,type:ti.type,niceTicks:ti.niceTicks,xAxisId:0},ide=t=>{var e=Jo(t,rde);return R.createElement(R.Fragment,null,R.createElement(tde,{allowDataOverflow:e.allowDataOverflow,allowDecimals:e.allowDecimals,allowDuplicatedCategory:e.allowDuplicatedCategory,angle:e.angle,dataKey:e.dataKey,domain:e.domain,height:e.height,hide:e.hide,id:e.xAxisId,includeHidden:e.includeHidden,interval:e.interval,minTickGap:e.minTickGap,mirror:e.mirror,name:e.name,orientation:e.orientation,padding:e.padding,reversed:e.reversed,scale:e.scale,tick:e.tick,tickCount:e.tickCount,tickFormatter:e.tickFormatter,ticks:e.ticks,type:e.type,unit:e.unit,niceTicks:e.niceTicks}),R.createElement(nde,e))},$H=R.memo(ide,WH);$H.displayName="XAxis";var sde=["type"],ode=["dangerouslySetInnerHTML","ticks","scale"],ade=["id","scale"];function LC(){return LC=Object.assign?Object.assign.bind():function(t){for(var e=1;e{if(o!=null)return y3(y3({},s),{},{type:o})},[o,s]);return R.useLayoutEffect(()=>{a!=null&&(n.current===null?e(Hle(a)):n.current!==a&&e(Vle({prev:n.current,next:a})),n.current=a)},[a,e]),R.useLayoutEffect(()=>()=>{n.current&&(e(Gle(n.current)),n.current=null)},[e]),null}function hde(t){var e=t.yAxisId,n=t.className,r=t.width,i=t.label,s=R.useRef(null),o=R.useRef(null),a=zt(g4),l=Qs(),c=Wr(),d="yAxis",f=zt(b=>Wre(b,e)),m=zt(b=>Gre(b,e)),y=zt(b=>AB(b,d,e,l)),x=zt(b=>Gz(b,e));if(R.useLayoutEffect(()=>{if(!(r!=="auto"||!f||Z2(i)||R.isValidElement(i)||x==null)){var b=s.current;if(b){var E=b.getCalculatedWidth();Math.round(f.width)!==Math.round(E)&&c(Wle({id:e,width:E}))}}},[y,f,c,i,e,r,x]),f==null||m==null||x==null)return null;t.dangerouslySetInnerHTML,t.ticks,t.scale;var S=DC(t,ode);x.id,x.scale;var w=DC(x,ade);return R.createElement(nR,LC({},S,w,{ref:s,labelRef:o,x:m.x,y:m.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:f.width,height:f.height,className:er("recharts-".concat(d," ").concat(d),n),viewBox:a,ticks:y,axisType:d,axisId:e}))}var pde={allowDataOverflow:ni.allowDataOverflow,allowDecimals:ni.allowDecimals,allowDuplicatedCategory:ni.allowDuplicatedCategory,angle:ni.angle,axisLine:Gc.axisLine,hide:!1,includeHidden:ni.includeHidden,interval:ni.interval,label:!1,minTickGap:ni.minTickGap,mirror:ni.mirror,orientation:ni.orientation,padding:ni.padding,reversed:ni.reversed,scale:ni.scale,tick:ni.tick,tickCount:ni.tickCount,tickLine:Gc.tickLine,tickSize:Gc.tickSize,type:ni.type,niceTicks:ni.niceTicks,width:ni.width,yAxisId:0},mde=t=>{var e=Jo(t,pde);return R.createElement(R.Fragment,null,R.createElement(fde,{interval:e.interval,id:e.yAxisId,scale:e.scale,type:e.type,domain:e.domain,allowDataOverflow:e.allowDataOverflow,dataKey:e.dataKey,allowDuplicatedCategory:e.allowDuplicatedCategory,allowDecimals:e.allowDecimals,tickCount:e.tickCount,padding:e.padding,includeHidden:e.includeHidden,reversed:e.reversed,ticks:e.ticks,width:e.width,orientation:e.orientation,mirror:e.mirror,hide:e.hide,unit:e.unit,name:e.name,angle:e.angle,minTickGap:e.minTickGap,tick:e.tick,tickFormatter:e.tickFormatter,niceTicks:e.niceTicks}),R.createElement(hde,e))},XH=R.memo(mde,WH);XH.displayName="YAxis";var gde=(t,e)=>e,oR=Oe([gde,fr,iz,_i,WB,ou,hse,Gi],bse);function vde(t){return"getBBox"in t.currentTarget&&typeof t.currentTarget.getBBox=="function"}function aR(t){var e=t.currentTarget.getBoundingClientRect(),n,r;if(vde(t)){var i=t.currentTarget.getBBox();n=i.width>0?e.width/i.width:1,r=i.height>0?e.height/i.height:1}else{var s=t.currentTarget;n=s.offsetWidth>0?e.width/s.offsetWidth:1,r=s.offsetHeight>0?e.height/s.offsetHeight:1}var o=(a,l)=>({relativeX:Math.round((a-e.left)/n),relativeY:Math.round((l-e.top)/r)});return"touches"in t?Array.from(t.touches).map(a=>o(a.clientX,a.clientY)):o(t.clientX,t.clientY)}var qH=Eo("mouseClick"),KH=$0();KH.startListening({actionCreator:qH,effect:(t,e)=>{var n=t.payload,r=oR(e.getState(),aR(n));(r==null?void 0:r.activeIndex)!=null&&e.dispatch(oie({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var UC=Eo("mouseMove"),YH=$0(),dm=null,Sf=null,GE=null;YH.startListening({actionCreator:UC,effect:(t,e)=>{var n=t.payload,r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||(o==null?void 0:o.includes("mousemove"));dm!==null&&(cancelAnimationFrame(dm),dm=null),Sf!==null&&(typeof s!="number"||!a)&&(clearTimeout(Sf),Sf=null),GE=aR(n);var l=()=>{var c=e.getState(),d=sx(c,c.tooltip.settings.shared);if(!GE){dm=null,Sf=null;return}if(d==="axis"){var f=oR(c,GE);(f==null?void 0:f.activeIndex)!=null?e.dispatch(LB({activeIndex:f.activeIndex,activeDataKey:void 0,activeCoordinate:f.activeCoordinate})):e.dispatch(OB())}dm=null,Sf=null};if(!a){l();return}s==="raf"?dm=requestAnimationFrame(l):typeof s=="number"&&Sf===null&&(Sf=setTimeout(l,s))}});function yde(t,e){return e instanceof HTMLElement?"HTMLElement <".concat(e.tagName,' class="').concat(e.className,'">'):e===window?"global.window":t==="children"&&typeof e=="object"&&e!==null?"<>":e}var x3={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},ZH=cs({name:"rootProps",initialState:x3,reducers:{updateOptions:(t,e)=>{var n;t.accessibilityLayer=e.payload.accessibilityLayer,t.barCategoryGap=e.payload.barCategoryGap,t.barGap=(n=e.payload.barGap)!==null&&n!==void 0?n:x3.barGap,t.barSize=e.payload.barSize,t.maxBarSize=e.payload.maxBarSize,t.stackOffset=e.payload.stackOffset,t.syncId=e.payload.syncId,t.syncMethod=e.payload.syncMethod,t.className=e.payload.className,t.baseValue=e.payload.baseValue,t.reverseStackOrder=e.payload.reverseStackOrder}}}),xde=ZH.reducer,bde=ZH.actions.updateOptions,_de=null,wde={updatePolarOptions:(t,e)=>t===null?e.payload:(t.startAngle=e.payload.startAngle,t.endAngle=e.payload.endAngle,t.cx=e.payload.cx,t.cy=e.payload.cy,t.innerRadius=e.payload.innerRadius,t.outerRadius=e.payload.outerRadius,t)},QH=cs({name:"polarOptions",initialState:_de,reducers:wde});QH.actions.updatePolarOptions;var Sde=QH.reducer,JH=Eo("keyDown"),eV=Eo("focus"),tV=Eo("blur"),FS=$0(),fm=null,Mf=null,Ob=null;FS.startListening({actionCreator:JH,effect:(t,e)=>{Ob=t.payload,fm!==null&&(cancelAnimationFrame(fm),fm=null);var n=e.getState(),r=n.eventSettings,i=r.throttleDelay,s=r.throttledEvents,o=s==="all"||s.includes("keydown");Mf!==null&&(typeof i!="number"||!o)&&(clearTimeout(Mf),Mf=null);var a=()=>{try{var l=e.getState(),c=l.rootProps.accessibilityLayer!==!1;if(!c)return;var d=l.tooltip.keyboardInteraction,f=Ob;if(f!=="ArrowRight"&&f!=="ArrowLeft"&&f!=="Enter")return;var m=Vy(d,Lh(l),Cg(l),Pg(l)),y=m==null?-1:Number(m),x=!Number.isFinite(y)||y<0,S=ou(l),w=Lh(l),b=sx(l,l.tooltip.settings.shared);if(f==="Enter"){if(x)return;var E=Bw(l,b,"hover",String(d.index));e.dispatch(zw({active:!d.active,activeIndex:d.index,activeCoordinate:E}));return}var T=Yre(l),C=T==="left-to-right"?1:-1,O=f==="ArrowRight"?1:-1,N;if(x){var D=Cg(l),F=Pg(l),V=O*C,k=de=>({active:!1,index:String(de),dataKey:void 0,graphicalItemId:void 0,coordinate:void 0});if(N=-1,V>0){for(var j=0;j=0;H--)if(Vy(k(H),w,D,F)!=null){N=H;break}if(N<0)return}else{N=y+O*C;var ne=(S==null?void 0:S.length)||w.length;if(ne===0||N>=ne||N<0)return}var J=Bw(l,b,"hover",String(N));e.dispatch(zw({active:!0,activeIndex:N.toString(),activeCoordinate:J}))}finally{fm=null,Mf=null}};if(!o){a();return}i==="raf"?fm=requestAnimationFrame(a):typeof i=="number"&&Mf===null&&(a(),Ob=null,Mf=setTimeout(()=>{Ob?a():(Mf=null,fm=null)},i))}});FS.startListening({actionCreator:eV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;if(!i.active&&i.index==null){var s="0",o=sx(n,n.tooltip.settings.shared),a=Bw(n,o,"hover",String(s));e.dispatch(zw({active:!0,activeIndex:s,activeCoordinate:a}))}}}});FS.startListening({actionCreator:tV,effect:(t,e)=>{var n=e.getState(),r=n.rootProps.accessibilityLayer!==!1;if(r){var i=n.tooltip.keyboardInteraction;i.active&&e.dispatch(zw({active:!1,activeIndex:i.index,activeCoordinate:i.coordinate}))}}});function nV(t){t.persist();var e=t.currentTarget;return new Proxy(t,{get:(n,r)=>{if(r==="currentTarget")return e;var i=Reflect.get(n,r);return typeof i=="function"?i.bind(n):i}})}var Bo=Eo("externalEvent"),rV=$0(),Lb=new Map,fy=new Map,WE=new Map;rV.startListening({actionCreator:Bo,effect:(t,e)=>{var n=t.payload,r=n.handler,i=n.reactEvent;if(r!=null){var s=i.type,o=nV(i);WE.set(s,{handler:r,reactEvent:o});var a=Lb.get(s);a!==void 0&&(cancelAnimationFrame(a),Lb.delete(s));var l=e.getState(),c=l.eventSettings,d=c.throttleDelay,f=c.throttledEvents,m=f,y=m==="all"||(m==null?void 0:m.includes(s)),x=fy.get(s);x!==void 0&&(typeof d!="number"||!y)&&(clearTimeout(x),fy.delete(s));var S=()=>{var E=WE.get(s);try{if(!E)return;var T=E.handler,C=E.reactEvent,O=e.getState(),N={activeCoordinate:Qie(O),activeDataKey:Kie(O),activeIndex:_0(O),activeLabel:qB(O),activeTooltipIndex:_0(O),isTooltipActive:Jie(O)};T&&T(N,C)}finally{Lb.delete(s),fy.delete(s),WE.delete(s)}};if(!y){S();return}if(d==="raf"){var w=requestAnimationFrame(S);Lb.set(s,w)}else if(typeof d=="number"){if(!fy.has(s)){S();var b=setTimeout(S,d);fy.set(s,b)}}else S()}}});var Mde=Oe([Yg],t=>t.tooltipItemPayloads),Ede=Oe([Mde,(t,e)=>e,(t,e,n)=>n],(t,e,n)=>{if(e!=null){var r=t.find(s=>s.settings.graphicalItemId===n);if(r!=null){var i=r.getPosition;if(i!=null)return i(e)}}}),iV=Eo("touchMove"),sV=$0(),Ef=null,$u=null,b3=null,hy=null;sV.startListening({actionCreator:iV,effect:(t,e)=>{var n=t.payload;if(!(n.touches==null||n.touches.length===0)){hy=nV(n);var r=e.getState(),i=r.eventSettings,s=i.throttleDelay,o=i.throttledEvents,a=o==="all"||o.includes("touchmove");Ef!==null&&(cancelAnimationFrame(Ef),Ef=null),$u!==null&&(typeof s!="number"||!a)&&(clearTimeout($u),$u=null),b3=Array.from(n.touches).map(c=>aR({clientX:c.clientX,clientY:c.clientY,currentTarget:n.currentTarget}));var l=()=>{if(hy!=null){var c=e.getState(),d=sx(c,c.tooltip.settings.shared);if(d==="axis"){var f,m=(f=b3)===null||f===void 0?void 0:f[0];if(m==null){Ef=null,$u=null;return}var y=oR(c,m);(y==null?void 0:y.activeIndex)!=null&&e.dispatch(LB({activeIndex:y.activeIndex,activeDataKey:void 0,activeCoordinate:y.activeCoordinate}))}else if(d==="item"){var x,S=hy.touches[0];if(document.elementFromPoint==null||S==null)return;var w=document.elementFromPoint(S.clientX,S.clientY);if(!w||!w.getAttribute)return;var b=w.getAttribute(OY),E=(x=w.getAttribute(LY))!==null&&x!==void 0?x:void 0,T=Qh(c).find(N=>N.id===E);if(b==null||T==null||E==null)return;var C=T.dataKey,O=Ede(c,b,E);e.dispatch(sie({activeDataKey:C,activeIndex:b,activeCoordinate:O,activeGraphicalItemId:E}))}Ef=null,$u=null}};if(!a){l();return}s==="raf"?Ef=requestAnimationFrame(l):typeof s=="number"&&$u===null&&(l(),hy=null,$u=setTimeout(()=>{hy?l():($u=null,Ef=null)},s))}}});var oV={throttleDelay:"raf",throttledEvents:["mousemove","touchmove","pointermove","scroll","wheel"]},aV=cs({name:"eventSettings",initialState:oV,reducers:{setEventSettings:(t,e)=>{e.payload.throttleDelay!=null&&(t.throttleDelay=e.payload.throttleDelay),e.payload.throttledEvents!=null&&(t.throttledEvents=e.payload.throttledEvents)}}}),Ade=aV.actions.setEventSettings,Tde=aV.reducer,Cde=U5({brush:tce,cartesianAxis:$le,chartData:Zse,errorBars:cue,eventSettings:Tde,graphicalItems:Sle,layout:yY,legend:IZ,options:$se,polarAxis:Lae,polarOptions:Sde,referenceElements:sce,renderedTicks:Tce,rootProps:xde,tooltip:aie,zIndex:kse}),Pde=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return VK({reducer:Cde,preloadedState:e,middleware:r=>{var i;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((i="es6")!==null&&i!==void 0?i:"")}).concat([KH.middleware,YH.middleware,FS.middleware,rV.middleware,sV.middleware])},enhancers:r=>{var i=r;return typeof r=="function"&&(i=r()),i.concat(Q5({type:"raf"}))},devTools:{serialize:{replacer:yde},name:"recharts-".concat(n)}})};function Rde(t){var e=t.preloadedState,n=t.children,r=t.reduxStoreName,i=Qs(),s=R.useRef(null);if(i)return n;s.current==null&&(s.current=Pde(e,r));var o=DP;return R.createElement(qZ,{context:o,store:s.current},n)}function Nde(t){var e=t.layout,n=t.margin,r=Wr(),i=Qs();return R.useEffect(()=>{i||(r(mY(e)),r(pY(n)))},[r,i,e,n]),null}var Ide=R.memo(Nde,xS);function kde(t){var e=Wr();return R.useEffect(()=>{e(bde(t))},[e,t]),null}var Ode=t=>{var e=Wr();return R.useEffect(()=>{e(Ade(t))},[e,t]),null},Lde=R.memo(Ode,xS);function _3(t){var e=t.zIndex,n=t.isPanorama,r=R.useRef(null),i=Wr();return R.useLayoutEffect(()=>(r.current&&i(Nse({zIndex:e,element:r.current,isPanorama:n})),()=>{i(Ise({zIndex:e,isPanorama:n}))}),[i,e,n]),R.createElement("g",{tabIndex:-1,ref:r,className:"recharts-zIndex-layer_".concat(e)})}function w3(t){var e=t.children,n=t.isPanorama,r=zt(wse);if(!r||r.length===0)return e;var i=r.filter(o=>o<0),s=r.filter(o=>o>0);return R.createElement(R.Fragment,null,i.map(o=>R.createElement(_3,{key:o,zIndex:o,isPanorama:n})),e,s.map(o=>R.createElement(_3,{key:o,zIndex:o,isPanorama:n})))}var Dde=["children"];function Ude(t,e){if(t==null)return{};var n,r,i=jde(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=_4(),r=w4(),i=I4();if(!kl(n)||!kl(r))return null;var s=t.children,o=t.otherAttributes,a=t.title,l=t.desc,c,d;return o!=null&&(typeof o.tabIndex=="number"?c=o.tabIndex:c=i?0:void 0,typeof o.role=="string"?d=o.role:d=i?"application":void 0),R.createElement(t5,qw({},o,{title:a,desc:l,role:d,tabIndex:c,width:n,height:r,style:Fde,ref:e}),s)}),Bde=t=>{var e=t.children,n=zt(pS);if(!n)return null;var r=n.width,i=n.height,s=n.y,o=n.x;return R.createElement(t5,{width:r,height:i,x:o,y:s},e)},S3=R.forwardRef((t,e)=>{var n=t.children,r=Ude(t,Dde),i=Qs();return i?R.createElement(Bde,null,R.createElement(w3,{isPanorama:!0},n)):R.createElement(zde,qw({ref:e},r),R.createElement(w3,{isPanorama:!1},n))});function Hde(t,e){return $de(t)||Wde(t,e)||Gde(t,e)||Vde()}function Vde(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gde(t,e){if(t){if(typeof t=="string")return M3(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?M3(t,e):void 0}}function M3(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n{if(r!=null){var o=r.getBoundingClientRect(),a=o.width/r.offsetWidth;wn(a)&&a!==s&&t(vY(a))}},[r,t,s]),i}function E3(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function qde(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=Array(e);n(ooe(),null);function Yw(t){if(typeof t=="number")return t;if(typeof t=="string"){var e=parseFloat(t);if(!Number.isNaN(e))return e}return 0}var rfe=R.forwardRef((t,e)=>{var n,r,i=R.useRef(null),s=R.useState({containerWidth:Yw((n=t.style)===null||n===void 0?void 0:n.width),containerHeight:Yw((r=t.style)===null||r===void 0?void 0:r.height)}),o=Kw(s,2),a=o[0],l=o[1],c=R.useCallback((f,m)=>{l(y=>{var x=Math.round(f),S=Math.round(m);return y.containerWidth===x&&y.containerHeight===S?y:{containerWidth:x,containerHeight:S}})},[]),d=R.useCallback(f=>{if(typeof e=="function"&&e(f),i.current!=null&&(i.current.disconnect(),i.current=null),f!=null&&typeof ResizeObserver<"u"){var m=f.getBoundingClientRect(),y=m.width,x=m.height;c(y,x);var S=b=>{var E=b[0];if(E!=null){var T=E.contentRect,C=T.width,O=T.height;c(C,O)}},w=new ResizeObserver(S);w.observe(f),i.current=w}},[e,c]);return R.useEffect(()=>()=>{var f=i.current;f!=null&&f.disconnect()},[c]),R.createElement(R.Fragment,null,R.createElement(q0,{width:a.containerWidth,height:a.containerHeight}),R.createElement("div",Sd({ref:d},t)))}),ife=R.forwardRef((t,e)=>{var n=t.width,r=t.height,i=R.useState({containerWidth:Yw(n),containerHeight:Yw(r)}),s=Kw(i,2),o=s[0],a=s[1],l=R.useCallback((d,f)=>{a(m=>{var y=Math.round(d),x=Math.round(f);return m.containerWidth===y&&m.containerHeight===x?m:{containerWidth:y,containerHeight:x}})},[]),c=R.useCallback(d=>{if(typeof e=="function"&&e(d),d!=null){var f=d.getBoundingClientRect(),m=f.width,y=f.height;l(m,y)}},[e,l]);return R.createElement(R.Fragment,null,R.createElement(q0,{width:o.containerWidth,height:o.containerHeight}),R.createElement("div",Sd({ref:c},t)))}),sfe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))}),ofe=R.forwardRef((t,e)=>{var n=t.width,r=t.height;return typeof n=="string"||typeof r=="string"?R.createElement(ife,Sd({},t,{ref:e})):typeof n=="number"&&typeof r=="number"?R.createElement(sfe,Sd({},t,{width:n,height:r,ref:e})):R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement("div",Sd({ref:e},t)))});function afe(t){return t?rfe:ofe}var lfe=R.forwardRef((t,e)=>{var n=t.children,r=t.className,i=t.height,s=t.onClick,o=t.onContextMenu,a=t.onDoubleClick,l=t.onMouseDown,c=t.onMouseEnter,d=t.onMouseLeave,f=t.onMouseMove,m=t.onMouseUp,y=t.onTouchEnd,x=t.onTouchMove,S=t.onTouchStart,w=t.style,b=t.width,E=t.responsive,T=t.dispatchTouchEvents,C=T===void 0?!0:T,O=R.useRef(null),N=Wr(),D=R.useState(null),F=Kw(D,2),V=F[0],k=F[1],j=R.useState(null),H=Kw(j,2),ne=H[0],J=H[1],de=Xde(),oe=VP(),he=(oe==null?void 0:oe.width)>0?oe.width:b,B=(oe==null?void 0:oe.height)>0?oe.height:i,K=R.useCallback(Ue=>{de(Ue),typeof e=="function"&&e(Ue),k(Ue),J(Ue),Ue!=null&&(O.current=Ue)},[de,e,k,J]),q=R.useCallback(Ue=>{N(qH(Ue)),N(Bo({handler:s,reactEvent:Ue}))},[N,s]),$=R.useCallback(Ue=>{N(UC(Ue)),N(Bo({handler:c,reactEvent:Ue}))},[N,c]),Z=R.useCallback(Ue=>{N(OB()),N(Bo({handler:d,reactEvent:Ue}))},[N,d]),ge=R.useCallback(Ue=>{N(UC(Ue)),N(Bo({handler:f,reactEvent:Ue}))},[N,f]),ae=R.useCallback(()=>{N(eV())},[N]),ce=R.useCallback(()=>{N(tV())},[N]),we=R.useCallback(Ue=>{N(JH(Ue.key))},[N]),Me=R.useCallback(Ue=>{N(Bo({handler:o,reactEvent:Ue}))},[N,o]),$e=R.useCallback(Ue=>{N(Bo({handler:a,reactEvent:Ue}))},[N,a]),Se=R.useCallback(Ue=>{N(Bo({handler:l,reactEvent:Ue}))},[N,l]),Ve=R.useCallback(Ue=>{N(Bo({handler:m,reactEvent:Ue}))},[N,m]),Xe=R.useCallback(Ue=>{N(Bo({handler:S,reactEvent:Ue}))},[N,S]),fe=R.useCallback(Ue=>{C&&N(iV(Ue)),N(Bo({handler:x,reactEvent:Ue}))},[N,C,x]),Q=R.useCallback(Ue=>{N(Bo({handler:y,reactEvent:Ue}))},[N,y]),Ge=afe(E);return R.createElement(nH.Provider,{value:V},R.createElement(wX.Provider,{value:ne},R.createElement(Ge,{width:he??(w==null?void 0:w.width),height:B??(w==null?void 0:w.height),className:er("recharts-wrapper",r),style:qde({position:"relative",cursor:"default",width:he,height:B},w),onClick:q,onContextMenu:Me,onDoubleClick:$e,onFocus:ae,onBlur:ce,onKeyDown:we,onMouseDown:Se,onMouseEnter:$,onMouseLeave:Z,onMouseMove:ge,onMouseUp:Ve,onTouchEnd:Q,onTouchMove:fe,onTouchStart:Xe,ref:K},R.createElement(nfe,null),n)))}),cfe=["width","height","responsive","children","className","style","compact","title","desc"];function ufe(t,e){if(t==null)return{};var n,r,i=dfe(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r{var n=t.width,r=t.height,i=t.responsive,s=t.children,o=t.className,a=t.style,l=t.compact,c=t.title,d=t.desc,f=ufe(t,cfe),m=Fa(f);return l?R.createElement(R.Fragment,null,R.createElement(q0,{width:n,height:r}),R.createElement(S3,{otherAttributes:m,title:c,desc:d},s)):R.createElement(lfe,{className:o,style:a,width:n,height:r,responsive:i??!1,onClick:t.onClick,onMouseLeave:t.onMouseLeave,onMouseEnter:t.onMouseEnter,onMouseMove:t.onMouseMove,onMouseDown:t.onMouseDown,onMouseUp:t.onMouseUp,onContextMenu:t.onContextMenu,onDoubleClick:t.onDoubleClick,onTouchStart:t.onTouchStart,onTouchMove:t.onTouchMove,onTouchEnd:t.onTouchEnd},R.createElement(S3,{otherAttributes:m,title:c,desc:d,ref:e},R.createElement(fce,null,s)))});function jC(){return jC=Object.assign?Object.assign.bind():function(t){for(var e=1;eR.createElement(xfe,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:bfe,tooltipPayloadSearcher:Gse,categoricalChartProps:t,ref:e}));const wfe="rgba(130,130,150,0.14)",C3="rgba(130,130,150,0.85)";function Sfe(t){if(t<=0)return 10;const e=Math.pow(10,Math.floor(Math.log10(t))),n=t/e;return(n<=1?1:n<=2?2:n<=5?5:10)*e}function lV(t,e){return`${e==="%"?Math.round(t):t>=1e3?`${(t/1e3).toFixed(1)}k`:Math.round(t).toString()}${e}`}function Mfe({active:t,payload:e,unit:n}){return!t||!(e!=null&&e.length)?null:v.jsx("div",{className:"rounded-lg border border-border/70 bg-popover/95 px-3 py-2 shadow-xl backdrop-blur",children:v.jsx("div",{className:"space-y-1",children:e.map(r=>v.jsxs("div",{className:"flex items-center gap-2 text-[11px] font-mono",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),v.jsx("span",{className:"uppercase tracking-wider text-muted-foreground",children:r.name}),v.jsx("span",{className:"ml-auto pl-3 font-bold tabular-nums text-foreground",children:lV(r.value,n)})]},r.dataKey))})})}function cV({data:t,series:e,unit:n="%",yMode:r="percent",height:i=176}){const s=t.reduce((a,l)=>e.reduce((c,d)=>Math.max(c,Number(l[d.key])||0),a),0),o=r==="percent"?Math.min(100,Math.max(25,Math.ceil(s*1.2/25)*25)):Math.max(Sfe(s*1.15),10);return v.jsx("div",{style:{height:i},className:"w-full",children:v.jsx(pZ,{width:"100%",height:"100%",children:v.jsxs(_fe,{data:t,margin:{top:8,right:6,bottom:0,left:-12},children:[v.jsx("defs",{children:e.map(a=>v.jsxs("linearGradient",{id:`grad-${a.key}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[v.jsx("stop",{offset:"0%",stopColor:a.color,stopOpacity:.22}),v.jsx("stop",{offset:"100%",stopColor:a.color,stopOpacity:0})]},a.key))}),v.jsx(kH,{vertical:!1,stroke:wfe}),v.jsx($H,{dataKey:"t",hide:!0}),v.jsx(XH,{domain:[0,o],ticks:[0,o/2,o],tickFormatter:a=>lV(a,n),width:42,axisLine:!1,tickLine:!1,tick:{fontSize:10,fill:C3}}),v.jsx(xoe,{content:v.jsx(Mfe,{unit:n}),cursor:{stroke:C3,strokeOpacity:.4,strokeDasharray:"3 3"}}),e.map(a=>v.jsx(GH,{type:"monotone",dataKey:a.key,name:a.label,stroke:a.color,strokeWidth:2,fill:`url(#grad-${a.key})`,dot:!1,activeDot:{r:3,strokeWidth:0},isAnimationActive:!1,connectNulls:!0},a.key))]})})})}const Efe=[{key:"cpu",label:"CPU",color:"#2dd4bf"},{key:"ram",label:"RAM",color:"#38bdf8"},{key:"gpu",label:"GPU",color:"#a78bfa"},{key:"disk",label:"Disk",color:"#fbbf24"}];function Afe(){var o,a,l,c;const{sys:t,hist:e}=dX(),n=!!(t!=null&&t.gpu&&t.gpu.busy_percent!=null&&t.gpu.gtt_used!=null&&t.gpu.gtt_total!=null),r=Efe.filter(d=>d.key!=="gpu"||n),i={cpu:(o=t==null?void 0:t.cpu)==null?void 0:o.percent,ram:(a=t==null?void 0:t.ram)==null?void 0:a.percent,gpu:n?t.gpu.busy_percent:null,disk:(l=t==null?void 0:t.disk)==null?void 0:l.percent},s={cpu:(c=t==null?void 0:t.cpu)!=null&&c.cores?`${t.cpu.cores} Cores`:"",ram:t?`${sm(t.ram.used)}/${sm(t.ram.total)} GB`:"",gpu:n?`${sm(t.gpu.gtt_used)}/${sm(t.gpu.gtt_total)} GB`:"",disk:t!=null&&t.disk?`${sm(t.disk.used)}/${sm(t.disk.total)} GB`:""};return v.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[v.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"System-Status"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t?v.jsxs(v.Fragment,{children:[v.jsx("div",{className:"mb-2 grid grid-cols-2 gap-x-4 gap-y-1.5",children:r.map(d=>v.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 shrink-0 rounded-full",style:{background:d.color}}),v.jsx("span",{className:"shrink-0 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:d.label}),v.jsxs("span",{className:"shrink-0 font-mono text-xs font-bold tabular-nums text-foreground",children:[Math.round(i[d.key]??0),"%"]}),s[d.key]&&v.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground/60",children:s[d.key]})]},d.key))}),v.jsx(cV,{data:e,series:r,unit:"%",yMode:"percent",height:176})]}):v.jsx("div",{className:"flex h-44 items-center justify-center text-xs text-muted-foreground",children:"Lade Systemdaten…"})]}),(t==null?void 0:t.temp)&&(t.temp.cpu||t.temp.gpu)&&v.jsxs("div",{className:"mt-3 flex gap-4 border-t border-border/30 pt-3 font-mono text-xs text-muted-foreground/80",children:[t.temp.cpu!=null&&v.jsxs("span",{children:["CPU Temp: ",t.temp.cpu," °C"]}),t.temp.gpu!=null&&v.jsxs("span",{children:["GPU Temp: ",t.temp.gpu," °C"]})]})]})}function Db({label:t,value:e,tone:n}){return v.jsxs("div",{className:nt("flex items-center justify-between rounded-lg border px-3 py-1.5 text-xs",n==="alert"?"border-amber-500/30 bg-amber-500/5 font-semibold text-amber-400":n==="accent"?"border-primary/30 bg-primary/5 font-semibold text-primary":"border-border/30 bg-background/25 text-muted-foreground"),children:[v.jsx("span",{className:"flex items-center gap-1.5",children:t}),v.jsx("span",{className:"font-mono text-[10px]",children:e})]})}function Tfe(){var n;const{data:t}=AP(3e3),e=()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"maintenance"}}));return v.jsxs("div",{className:"flex flex-col justify-between rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border/20 pb-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(n9,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Updates & Pflege"})]}),(t==null?void 0:t.last_check)&&v.jsxs("span",{className:"font-mono text-[9px] text-muted-foreground/80",children:["Zuletzt gesucht: ",new Date(t.last_check*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit"})]})]}),t?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(Db,{label:"OS-Pakete",tone:t.os>0?"alert":"muted",value:t.os>0?`${t.os} verfügbar`:"aktuell"}),v.jsx(Db,{label:"Engine (llama.cpp)",tone:t.engine>0?"alert":"muted",value:t.engine>0?"Update verfügbar":"aktuell"}),v.jsx(Db,{label:"Modell-Upgrades",tone:t.models>0?"accent":"muted",value:t.models>0?`${t.models} verfügbar`:"aktuell"}),(n=t.components)==null?void 0:n.map(r=>v.jsx(Db,{tone:r.update===!0?"alert":"muted",label:v.jsxs(v.Fragment,{children:[r.name,r.reachable===!1&&v.jsx("span",{className:"text-[8px] font-bold uppercase text-red-400/80",children:"offline"})]}),value:r.update===!0?`Update: ${r.latest}`:r.update===!1?"aktuell":r.latest?`neueste: ${r.latest}`:"—"},r.key))]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Updates..."})]}),v.jsxs("button",{onClick:e,className:"mt-4 flex h-9 w-full items-center justify-center gap-1.5 rounded-lg bg-primary text-xs font-semibold text-primary-foreground shadow-md shadow-primary/10 transition-all hover:opacity-90 cursor-pointer",children:["Updates verwalten & Pflege ",v.jsx(rF,{className:"h-3.5 w-3.5"})]})]})}function uV({type:t,title:e,message:n,defaultValue:r,autoValue:i,autoLabel:s,onConfirm:o,onCancel:a}){const l=R.useRef(null);return v.jsx("div",{className:"fixed inset-0 z-[99] bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-sm rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:e}),v.jsx("button",{onClick:a||(()=>o()),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:n}),t==="prompt"&&v.jsxs("div",{className:"flex gap-2",children:[v.jsx("input",{ref:l,type:"text",defaultValue:r,className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground",autoFocus:!0,onKeyDown:c=>{var d;c.key==="Enter"&&o((d=l.current)==null?void 0:d.value)}}),i!==void 0&&v.jsx("button",{type:"button",onClick:()=>{l.current&&(l.current.value=i)},title:"Setup-bewussten Optimalwert eintragen",className:"h-9 px-3 shrink-0 text-xs font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg transition-colors cursor-pointer",children:s||"Auto"})]}),v.jsxs("div",{className:"flex justify-end gap-3 pt-2",children:[(t==="confirm"||t==="prompt")&&v.jsx("button",{onClick:a,className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Abbrechen"}),v.jsx("button",{onClick:()=>{var d;const c=t==="prompt"?(d=l.current)==null?void 0:d.value:void 0;o(c)},className:"h-8 px-4 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-lg transition-colors cursor-pointer",children:t==="confirm"?"Ja, fortfahren":t==="prompt"?"Übernehmen":"OK"})]})]})})}function Jg(){const[t,e]=R.useState(null),n=R.useCallback(()=>e(null),[]),r=R.useCallback((a,l,c)=>{e({type:"alert",title:a,message:l,onConfirm:()=>{e(null),c==null||c()}})},[]),i=R.useCallback((a,l,c,d)=>{e({type:"confirm",title:a,message:l,onConfirm:()=>{e(null),c()},onCancel:()=>{e(null),d==null||d()}})},[]),s=R.useCallback((a,l,c,d,f,m)=>{e({type:"prompt",title:a,message:l,defaultValue:c,autoValue:m==null?void 0:m.autoValue,autoLabel:m==null?void 0:m.autoLabel,onConfirm:y=>{e(null),d(y)},onCancel:()=>{e(null),f==null||f()}})},[]),o=t?v.jsx(uV,{...t}):null;return{showAlert:r,showConfirm:i,showPrompt:s,close:n,dialogElement:o}}function Cfe(){const t=$h(),{data:e}=EP(3e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=Jg(),[s,o]=R.useState(!1),a=(n==null?void 0:n.models)??[];async function l(c){try{await jt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:c})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${c}' geändert. Der Gateway-Dienst wurde neu gestartet.`),t.invalidateQueries({queryKey:Lr.agentStatus}),o(!1)}catch(d){r("Fehler",`Fehler beim Wechseln des Gehirns: ${d.message}`)}}return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center justify-between mb-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(qc,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Hermes Agent"})]}),(e==null?void 0:e.terminal_url)&&v.jsxs("a",{href:wg(e.terminal_url),target:"_blank",rel:"noopener",className:nt("flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-medium transition-all",e.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/20":"border border-border text-muted-foreground"),children:[v.jsx(yg,{className:"h-3 w-3"})," Terminal öffnen"]})]}),e?v.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gateway"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",e.gateway_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.gateway_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsx("div",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Terminal"}),v.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",e.terminal_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-medium",children:e.terminal_reachable?"Online":"Offline"})]})]}),v.jsxs("div",{onClick:()=>o(!0),className:"p-3 bg-background/20 rounded-xl border border-border/40 hover:border-primary/45 hover:bg-background/30 transition-all duration-300 cursor-pointer",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Gehirn"}),v.jsx(El,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-xs font-medium mt-1 font-mono text-primary truncate flex items-center gap-1",children:[v.jsx(G1,{className:"h-3 w-3 shrink-0"}),e.brain_model||"auto"]})]}),v.jsxs("div",{className:"p-3 bg-background/20 rounded-xl border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsx("span",{className:"text-[10px] text-muted-foreground uppercase font-semibold",children:"Verdrahtung"}),v.jsx(tw,{className:"h-3 w-3 text-primary"})]}),v.jsxs("div",{className:"text-[10px] font-mono mt-1 space-y-0.5 text-muted-foreground",children:[v.jsxs("div",{children:["Config: ",e.has_config?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Skills: ",e.has_skills?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]}),v.jsxs("div",{children:["Memory: ",e.has_memories?v.jsx("span",{className:"text-emerald-400",children:"✓"}):"—"]})]})]})]}):v.jsx("div",{className:"h-28 flex items-center justify-center text-xs text-muted-foreground",children:"Lade Agenten-Status…"})]}),e&&v.jsxs("div",{className:"mt-3 border-t border-border/30 pt-3 space-y-1.5",children:[v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"Telegram"}),v.jsx("span",{className:nt("font-semibold",e.telegram_enabled?"text-emerald-400":""),children:e.telegram_enabled?"aktiv":"nicht konfiguriert"})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"MCP-Server"}),v.jsxs("span",{className:"font-semibold text-foreground",children:[e.mcp_server_count??0," verbunden"]})]}),v.jsxs("div",{className:"flex items-center justify-between text-[10px] text-muted-foreground",children:[v.jsx("span",{children:"PC Executor"}),v.jsx("span",{className:nt("font-semibold",e.pc_executor_reachable?"text-emerald-400":""),children:e.pc_executor_reachable?"erreichbar":"nicht verbunden"})]})]}),e&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(El,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),v.jsx("button",{onClick:()=>o(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',v.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),v.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:["auto","fast","heavy",...a.map(c=>{var d;return((d=c.name.split("/").pop())==null?void 0:d.replace(".gguf",""))||c.name})].map(c=>{const d=["auto","fast","heavy"].includes(c);return v.jsxs("button",{onClick:()=>l(c),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",e.brain_model===c||!e.brain_model&&c==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[v.jsxs("div",{className:"flex flex-col text-left",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:c}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:d?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(e.brain_model===c||!e.brain_model&&c==="auto")&&v.jsx(bo,{className:"h-4 w-4 shrink-0 text-primary"})]},c)})})]})}),i]})}function Pfe(){const{data:t}=qh(3e3),e=(t==null?void 0:t.models)??[],n=(t==null?void 0:t.running)??[];return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[v.jsx(G1,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Rollen-Belegung"})]}),v.jsx("div",{className:"space-y-2 max-h-48 overflow-y-auto pr-1 scrollbar-thin",children:YF.map(r=>{var o;const i=e.find(a=>a.role===r),s=i?n.includes(i.name):!1;return v.jsxs("div",{className:nt("flex items-center justify-between p-2 rounded-xl border transition-all duration-300",s?"border-emerald-500/30 bg-emerald-500/5 shadow-sm shadow-emerald-500/5":i?"border-primary/20 bg-primary/5":"border-border/30 bg-background/10 opacity-60"),children:[v.jsx("div",{className:"min-w-0 flex-1 mr-2",children:v.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[v.jsx("span",{className:nt("text-[9px] font-semibold uppercase px-1.5 py-0.5 rounded font-mono border tracking-wider shrink-0",CP(r)),children:r}),v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"text-xs font-semibold truncate font-mono text-foreground",children:i?(o=i.name.split("/").pop())==null?void 0:o.replace(/\.gguf$/i,""):"nicht zugewiesen"}),i&&v.jsxs("div",{className:"flex gap-1 items-center mt-0.5 flex-wrap",children:[i.prompt_cache&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-cyan-500/10 text-cyan-400 border border-cyan-500/20 px-1 py-0.5 rounded",title:"Prompt Caching aktiv",children:"PC"}),i.spec_active&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20 px-1 py-0.5 rounded",title:`Speculative Decoding aktiv (Draft: ${i.spec_draft_model})`,children:"SPEC"}),i.parallel_slots>1&&v.jsxs("span",{className:"text-[7px] leading-none font-mono font-bold bg-violet-500/10 text-violet-400 border border-violet-500/20 px-1 py-0.5 rounded",title:`${i.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",i.parallel_slots]}),i.incomplete&&v.jsx("span",{className:"text-[7px] leading-none font-mono font-bold bg-amber-500/10 text-amber-400 border border-amber-500/20 px-1 py-0.5 rounded",title:"GGUF-Datei fehlt",children:"⚠ fehlt"})]})]})]})}),v.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:i?s?v.jsxs("span",{className:"flex items-center gap-1 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider font-mono",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground uppercase tracking-wider font-mono",children:"bereit"}):v.jsx("span",{className:"text-[8px] font-semibold text-muted-foreground/60 uppercase tracking-wider font-mono",children:"—"})})]},r)})})]}),v.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Laden erfolgt automatisch per Auto-Swap."})]})}function Rfe(){const t=$h(),{data:e=[]}=FT({limit:3}),[n,r]=R.useState(""),[i,s]=R.useState("stable"),[o,a]=R.useState(!1);async function l(){if(!(!n.trim()||o)){a(!0);try{await jt("/api/memory",{method:"POST",body:JSON.stringify({content:n,category:i,source:"dashboard"})}),r(""),t.invalidateQueries({queryKey:["memory"]})}catch(c){console.error(c)}finally{a(!1)}}}return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15 flex flex-col justify-between",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[v.jsx(V1,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase text-foreground",children:"Gedächtnis"})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsx("textarea",{value:n,onChange:c=>r(c.target.value),placeholder:"Fakt / Regel im Pool speichern...",rows:2,className:"w-full resize-none rounded-xl border border-border/50 bg-background/30 p-2 text-[10px] outline-none focus:ring-1 focus:ring-primary transition-all leading-normal"}),v.jsxs("div",{className:"flex items-center gap-2 justify-between",children:[v.jsxs("select",{value:i,onChange:c=>s(c.target.value),className:"h-7 rounded-lg border border-border/50 bg-background/50 px-2 text-[10px] outline-none cursor-pointer",children:[v.jsx("option",{value:"stable",children:"🔵 Fakt"}),v.jsx("option",{value:"instruction",children:"📋 Regel"}),v.jsx("option",{value:"user",children:"👤 User"}),v.jsx("option",{value:"versioned",children:"🟡 Version"})]}),v.jsxs("button",{onClick:l,disabled:!n.trim()||o,className:"flex h-7 items-center gap-1 rounded-lg bg-primary px-3 text-[10px] font-semibold text-primary-foreground hover:opacity-90 disabled:opacity-50 transition-all cursor-pointer",children:[v.jsx(IT,{className:"h-3.5 w-3.5"})," Speichern"]})]})]}),v.jsxs("div",{className:"mt-3.5 space-y-1.5",children:[v.jsx("div",{className:"text-[9px] text-muted-foreground uppercase font-bold tracking-wider",children:"Zuletzt gespeichert:"}),v.jsx("div",{className:"max-h-20 overflow-y-auto space-y-1 pr-1 scrollbar-thin",children:e.length===0?v.jsx("div",{className:"text-[10px] text-muted-foreground/75 py-1",children:"Keine Einträge vorhanden."}):e.map(c=>v.jsxs("div",{className:"text-[10px] bg-background/10 border border-border/30 rounded p-1.5 flex items-start gap-1.5",children:[v.jsx("span",{className:"shrink-0 text-[8px] font-mono text-muted-foreground/80 px-1 py-0.5 rounded bg-muted/20",children:c.category}),v.jsx("span",{className:"truncate flex-1 text-muted-foreground hover:text-foreground transition-colors",title:c.content,children:c.content})]},c.id))})]})]}),v.jsx("div",{className:"mt-4 text-[10px] text-muted-foreground/80 border-t border-border/30 pt-3",children:"Steht allen Clients per MCP zur Verfügung."})]})}const P3=[{key:"prompt",label:"Prompt",color:"#f59e0b"},{key:"completion",label:"Antwort",color:"#2dd4bf"}];function Nfe(){const{data:t}=MP(3e3),e=cX(),n=e[e.length-1],r=n?Math.round(n.prompt+n.completion):0;return v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(i0,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Token-Durchsatz"}),v.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 text-[10px] font-medium text-muted-foreground/70",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," live"]})]}),t&&v.jsxs("div",{className:"mt-2 flex items-baseline gap-2",children:[v.jsx("span",{className:"font-space text-3xl font-bold tracking-tight text-foreground tabular-nums",children:r.toLocaleString("de-DE")}),v.jsx("span",{className:"text-xs text-muted-foreground",children:"tok/s aktuell"})]}),t&&v.jsxs("div",{className:"mt-0.5 space-y-0.5 font-mono text-[11px] text-muted-foreground/70",children:[v.jsxs("div",{children:[t.total_tokens.toLocaleString("de-DE")," Tokens gesamt · ",v.jsxs("span",{className:"text-emerald-400/90",children:[t.saved_eur.toLocaleString("de-DE",{minimumFractionDigits:2})," € gespart"]})]}),v.jsxs("div",{className:"text-muted-foreground/55",children:["Input ",t.prompt_tokens.toLocaleString("de-DE")," · Output ",t.completion_tokens.toLocaleString("de-DE")]})]})]}),v.jsx("div",{className:"flex shrink-0 flex-col items-end gap-1.5 pt-1",children:P3.map(i=>v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:i.color}}),v.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i.label}),v.jsx("span",{className:"font-mono text-xs font-bold tabular-nums text-foreground",children:Math.round((n==null?void 0:n[i.key])??0)})]},i.key))})]}),t?v.jsx(cV,{data:e,series:P3,unit:" tok/s",yMode:"auto",height:150}):v.jsx("div",{className:"flex h-[150px] items-center justify-center text-xs text-muted-foreground",children:"Lade Durchsatz…"}),v.jsx("div",{className:"mt-2 border-t border-border/30 pt-2 text-[10px] text-muted-foreground/70",children:"Durchsatz aus dem Gateway abgeleitet (Prefill vs. Generierung). Flach bei Leerlauf."})]})}function Ife(){const{data:t}=v7(3e3),{showAlert:e,dialogElement:n}=Jg(),[r,i]=R.useState({});async function s(o){i(a=>({...a,[o]:!0}));try{const a=await jt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:o})});a.ok||e("Fehler",`Neustart fehlgeschlagen: ${a.err||"Unbekannt"}`)}catch(a){e("Fehler",`Fehler: ${a.message}`)}finally{i(a=>({...a,[o]:!1}))}}return v.jsxs("div",{className:"flex flex-col rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/15",children:[v.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(xP,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold uppercase tracking-wide text-foreground",children:"Dienste"})]}),v.jsx("button",{onClick:()=>window.dispatchEvent(new CustomEvent("open-system-drawer",{detail:{tab:"logs"}})),className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground transition-colors hover:text-primary cursor-pointer",children:"Logs / Pflege"})]}),t?v.jsxs("div",{className:"flex flex-1 flex-col",children:[v.jsx("div",{className:"space-y-1.5",children:t.services.map(o=>v.jsxs("div",{className:"group flex items-center justify-between gap-2 rounded-xl border border-border/30 bg-background/20 p-2.5",children:[v.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[v.jsx("span",{className:nt("h-2.5 w-2.5 shrink-0 rounded-full ring-2 ring-black/40",o.ok?"bg-emerald-500":"bg-amber-500")}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"truncate text-xs font-bold text-foreground",children:o.name}),v.jsx("div",{className:"truncate font-mono text-[9px] text-muted-foreground/60",children:o.url})]})]}),v.jsx("button",{onClick:()=>s(o.name),disabled:r[o.name],className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border border-border/40 text-muted-foreground opacity-0 transition-all hover:bg-primary/5 hover:text-primary group-hover:opacity-100",title:"Dienst neu starten",children:v.jsx(Hy,{className:nt("h-3.5 w-3.5",r[o.name]&&"animate-spin")})})]},o.name))}),v.jsxs("div",{className:"mt-auto flex flex-wrap gap-3 border-t border-border/20 pt-2.5 text-[10px] font-semibold text-muted-foreground",children:[v.jsxs("a",{href:wg(t.links.engine_ui),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[v.jsx(yg,{className:"h-3 w-3"})," Engine"]}),v.jsxs("a",{href:wg(t.links.gateway),target:"_blank",rel:"noopener",className:"flex items-center gap-1 rounded px-1.5 py-0.5 text-primary transition-colors hover:bg-primary/10",children:[v.jsx(yg,{className:"h-3 w-3"})," Gateway"]})]})]}):v.jsx("div",{className:"flex h-24 items-center justify-center text-xs text-muted-foreground",children:"Lade Dienste…"}),n]})}function R3({children:t}){return v.jsx("p",{className:"mb-2 ml-0.5 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground/60",children:t})}function kfe(){return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Zentrale"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Aktueller Status von System, Modellen und Agent."})]}),v.jsxs("div",{className:"grid items-stretch gap-6 lg:grid-cols-3",children:[v.jsx(Afe,{}),v.jsx(Nfe,{}),v.jsx(sX,{})]}),v.jsxs("section",{children:[v.jsx(R3,{children:"Stack-Status"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[v.jsx(Pfe,{}),v.jsx(Ife,{})]})]}),v.jsxs("section",{children:[v.jsx(R3,{children:"Betrieb & Wissen"}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-3",children:[v.jsx(Tfe,{}),v.jsx(Cfe,{}),v.jsx(Rfe,{})]})]})]})}function Ofe(){const t=$h(),{data:e=[]}=x7(2e3),{showAlert:n,dialogElement:r}=Jg();async function i(a){try{await jt(`/api/jobs/${a}/cancel`,{method:"POST"}),t.invalidateQueries({queryKey:Lr.jobs})}catch(l){n("Fehler",l.message)}}const s=e.filter(a=>a.state==="running"||a.state==="queued"),o=e.filter(a=>a.state!=="running"&&a.state!=="queued").slice(-3);return s.length===0&&o.length===0?null:v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 shadow-lg shadow-black/10",children:[v.jsx("div",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:"Aktive Downloads"}),s.map(a=>v.jsxs("div",{className:"space-y-1.5 p-3 rounded-xl bg-background/20 border border-border/40",children:[v.jsxs("div",{className:"flex justify-between items-center text-xs",children:[v.jsx("span",{className:"font-semibold truncate max-w-[250px]",children:a.label}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-muted-foreground font-mono",children:[a.progress??0,"% • ",zT(a.done_bytes),"/",zT(a.total_bytes),a.eta_s?` • ETA ${M7(a.eta_s)}`:""]}),v.jsx("button",{onClick:()=>i(a.id),className:"text-[10px] text-red-400 hover:text-red-300 font-semibold border border-red-500/25 bg-red-500/5 px-2 py-0.5 rounded transition-all cursor-pointer",children:"Abbrechen"})]})]}),v.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:v.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${a.progress??0}%`}})})]},a.id)),o.map(a=>v.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground px-1",children:[v.jsx("span",{className:"truncate",children:a.label}),v.jsx("span",{className:nt("font-semibold text-[10px] px-1.5 py-0.5 rounded uppercase font-mono",a.state==="done"?"bg-emerald-500/10 text-emerald-400":"bg-amber-500/10 text-amber-400"),children:a.state})]},a.id)),r]})}function Af({children:t,tone:e="muted"}){const n={muted:"bg-muted text-muted-foreground",primary:"bg-primary/15 text-primary",warn:"bg-amber-500/15 text-amber-500"};return v.jsx("span",{className:`rounded px-1.5 py-0.5 text-[11px] font-medium ${n[e]}`,children:t})}function N3({caps:t}){return t?v.jsxs("span",{className:"inline-flex flex-wrap gap-1",children:[t.coder&&v.jsx(Af,{children:"💻 Code"}),t.vision&&v.jsx(Af,{children:"👁 Bild"}),t.reasoning&&v.jsx(Af,{children:"🧠 Reason"}),t.moe&&v.jsxs(Af,{tone:"primary",children:["🧩 MoE",t.active_b?`·${t.active_b}b`:""]}),t.tools==="yes"&&v.jsx(Af,{tone:"primary",children:"🛠 Tools"}),t.tools==="likely"&&v.jsx(Af,{tone:"warn",children:"🛠 Tools?"}),t.embedding&&v.jsx(Af,{children:"🔢 Embed"})]}):null}function Lfe({model:t,onClose:e,onChanged:n}){var S,w;const{data:r,isLoading:i}=w7(t.gguf_path),[s,o]=R.useState(null),[a,l]=R.useState(""),c=r==null?void 0:r.target_vocab,d=(r==null?void 0:r.drafts)??[],f=d.filter(b=>b.compatible===!0),m=t.spec_draft_model;async function y(b){o(b??"__clear__"),l("");try{await jt(`/api/models/${encodeURIComponent(t.name)}/draft`,{method:"POST",body:JSON.stringify({draft_path:b})}),n(),e()}catch(E){l(String((E==null?void 0:E.message)||E)),o(null)}}const x=b=>{var E;return b?`${b.pre??"?"} · ${((E=b.n_vocab)==null?void 0:E.toLocaleString())??"?"} Tokens`:"—"};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-lg rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2",children:[v.jsx(xh,{className:"h-4 w-4"})," Speculative Draft"]}),v.jsx("button",{onClick:e,className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed",children:['Beschleunigt die Token-Generierung mit einem kleinen "Draft"-Modell. Voraussetzung: der Draft muss den ',v.jsx("strong",{className:"text-foreground",children:"exakt gleichen Tokenizer (Vocab)"})," haben wie das Modell — sonst lehnt llama.cpp es ab."]}),v.jsxs("div",{className:"rounded-lg border border-border/40 bg-background/30 px-3 py-2 text-[11px] font-mono flex items-center justify-between",children:[v.jsx("span",{className:"text-muted-foreground",children:(S=t.name.split("/").pop())==null?void 0:S.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-foreground",children:["Vocab: ",x(c)]})]}),t.spec_active&&m&&v.jsxs("div",{className:"rounded-lg border border-emerald-500/30 bg-emerald-500/5 px-3 py-2 flex items-center justify-between gap-2",children:[v.jsxs("span",{className:"text-[11px] text-emerald-400 font-mono flex items-center gap-1.5 truncate",children:[v.jsx(bo,{className:"h-3.5 w-3.5 shrink-0"})," Aktiv: ",m]}),v.jsx("button",{onClick:()=>y(null),disabled:s!==null,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Deaktivieren"})]}),!(r!=null&&r.target_exists)&&v.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 flex items-center gap-2",children:[v.jsx(xg,{className:"h-3.5 w-3.5 shrink-0"}),"Modell-GGUF noch nicht vorhanden — Spec-Draft ist nach dem Download konfigurierbar."]}),v.jsx("div",{className:"space-y-1.5 max-h-64 overflow-y-auto pr-1",children:i?v.jsx("div",{className:"text-xs text-muted-foreground py-6 text-center",children:"Prüfe Vocab-Kompatibilität…"}):d.length===0?v.jsxs("div",{className:"text-[11px] text-muted-foreground border border-dashed border-border/50 rounded-lg p-4 text-center",children:["Keine Draft-Modelle in ",v.jsx("code",{className:"font-mono",children:"/srv/models/drafts"}),". Lade ein kleines same-family-Modell (z.B. Qwen3-0.6B) und lege es dort ab."]}):d.map(b=>{var C,O;const E=b.filename===m,T=b.compatible===!0;return v.jsxs("div",{className:nt("rounded-lg border px-3 py-2 flex items-center justify-between gap-2 text-left",T?"border-border/40 bg-background/20":"border-border/20 bg-background/10 opacity-60",E&&"border-primary/40 bg-primary/10"),children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[11px] font-mono font-semibold text-foreground truncate",children:b.filename}),v.jsxs("div",{className:"text-[9px] text-muted-foreground font-mono",children:[Ho(b.size_bytes)," · Vocab: ",x(b.vocab)]})]}),T?E?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-primary flex items-center gap-1 shrink-0",children:[v.jsx(bo,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("button",{onClick:()=>y(b.path),disabled:s!==null,className:"h-7 px-3 rounded-lg border border-emerald-500/30 bg-emerald-500/5 hover:bg-emerald-500/15 text-emerald-400 text-[9px] font-bold uppercase shrink-0 cursor-pointer disabled:opacity-50",children:"Aktivieren"}):v.jsxs("span",{className:"text-[9px] font-bold uppercase text-amber-400/80 flex items-center gap-1 shrink-0",title:b.compatible===!1?`Inkompatibel: Tokenizer/Vocab weicht ab (Draft ${(C=b.vocab)==null?void 0:C.pre}/${(O=b.vocab)==null?void 0:O.n_vocab} ≠ Modell ${c==null?void 0:c.pre}/${c==null?void 0:c.n_vocab}).`:"Kompatibilität nicht prüfbar (Datei fehlt).",children:[v.jsx(xg,{className:"h-3.5 w-3.5"})," ",b.compatible===!1?"Vocab ≠":"n/a"]})]},b.path)})}),!i&&(r==null?void 0:r.target_exists)&&d.length>0&&f.length===0&&v.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-400 leading-relaxed",children:["Kein vocab-kompatibler Draft verfügbar — Speculative Decoding ist für dieses Modell nicht möglich. Es braucht einen Draft mit identischem Tokenizer (pre=",v.jsx("span",{className:"font-mono",children:c==null?void 0:c.pre}),", n_vocab=",v.jsx("span",{className:"font-mono",children:(w=c==null?void 0:c.n_vocab)==null?void 0:w.toLocaleString()}),")."]}),a&&v.jsx("div",{className:"text-[10px] text-red-400 font-mono",children:a})]})})}function Dfe(){var rt,ft,nn,qe,dt,Dt,Ut,pt;const t=$h(),{data:e,isLoading:n,error:r}=qh(4e3),{data:i}=y7(4e3),{data:s}=VF(),{data:o}=AP(4e3),{data:a}=b7(),{data:l}=Y1(),{showAlert:c,showConfirm:d,showPrompt:f,dialogElement:m}=Jg(),y=(e==null?void 0:e.models)??[],x=(e==null?void 0:e.running)??[],S=r?String(r):"",w=()=>{t.invalidateQueries({queryKey:Lr.models}),t.invalidateQueries({queryKey:Lr.routing})},[b,E]=R.useState(null),[T,C]=R.useState(null),[O,N]=R.useState(null),[D,F]=R.useState(null),[V,k]=R.useState(!1),[j,H]=R.useState(!1),[ne,J]=R.useState(null),[de,oe]=R.useState("grid"),[he,B]=R.useState("all"),K=y.filter(ue=>he==="in_use"?!!ue.role||x.includes(ue.name):!0),[q,$]=R.useState({width:800,height:360}),Z=R.useRef(null),ge=R.useCallback(ue=>{if(Z.current&&(Z.current.disconnect(),Z.current=null),ue){const ee=new ResizeObserver(Ae=>{if(!Ae||Ae.length===0)return;const re=Ae[0].contentRect;$({width:re.width,height:re.height})});ee.observe(ue),Z.current=ee}},[]),ae=q.width,ce=q.height,we=ue=>{const ee=ae*.1,Ae=ce*ue,re=ae*.5,Fe=ce*.5,Te=ae*.3,Le=Ae,Ke=ae*.3;return`M ${ee} ${Ae} C ${Te} ${Le}, ${Ke} ${Fe}, ${re} ${Fe}`},Me=ue=>{const ee=ae*.5,Ae=ce*.5,re=ae*.9,Fe=ce*ue,Te=ae*.7,Le=Ae,Ke=ae*.7;return`M ${ee} ${Ae} C ${Te} ${Le}, ${Ke} ${Fe}, ${re} ${Fe}`};async function $e(ue){try{await jt(`/api/models/${encodeURIComponent(ue)}/load`,{method:"POST"}),w()}catch(ee){c("Fehler",`Fehler beim Laden des Modells: ${ee.message}`)}}async function Se(ue){try{await jt(`/api/models/${encodeURIComponent(ue)}/unload`,{method:"POST"}),w()}catch(ee){c("Fehler",`Fehler beim Entladen des Modells: ${ee.message}`)}}async function Ve(){try{await jt("/api/models/unload",{method:"POST"}),w()}catch(ue){c("Fehler",`Fehler beim Entladen aller Modelle: ${ue.message}`)}}async function Xe(ue,ee){try{await jt(`/api/models/${encodeURIComponent(ee)}/role`,{method:"POST",body:JSON.stringify({role:ue||null})}),w()}catch(Ae){c("Fehler",`Fehler beim Zuweisen der Rolle: ${Ae.message||Ae}`)}}function fe(ue){C(ue),N(null),jt(`/api/roles/${encodeURIComponent(ue)}/recommend`).then(ee=>N(ee)).catch(()=>{})}async function Q(ue,ee){let Ae=null;try{Ae=await jt(`/api/models/${encodeURIComponent(ue)}/ctx/auto`)}catch{}const re=Ae?`Optimal für dein Setup: ${(Ae.ctx/1024).toFixed(0)}k (${Ae.ctx}) — GTT ${Ae.gtt_gb} GB − reserviert ${Ae.reserved_gb} GB (${Ae.mode}) → ${Ae.budget_gb} GB frei. »Auto« trägt diesen Wert ein.`:"Gib die gewünschte Kontextlänge in Tokens an:";f("Kontextlänge anpassen",re,String(ee||32768),async Fe=>{if(Fe)try{await jt(`/api/models/${encodeURIComponent(ue)}/ctx`,{method:"POST",body:JSON.stringify({ctx:parseInt(Fe,10)})}),w()}catch(Te){c("Fehler",`Fehler beim Setzen des Kontexts: ${Te.message||Te}`)}},void 0,Ae?{autoValue:String(Ae.ctx),autoLabel:`Auto (${(Ae.ctx/1024).toFixed(0)}k)`}:void 0)}async function Ge(ue){d("Modell löschen?",`Modell '${ue}' und alle zugehörigen GGUF-Dateien unwiderruflich von der Box löschen?`,async()=>{try{await jt(`/api/models/${encodeURIComponent(ue)}`,{method:"DELETE"}),w()}catch(ee){c("Fehler",`Fehler beim Löschen: ${ee.message||ee}`)}})}async function Ue(ue,ee,Ae,re){try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:ue,role:ee,quant:Ae,jinja:re})}),c("Herunterladen gestartet",`Download für '${ue}' gestartet! Der Fortschritt wird oben angezeigt.`)}catch(Fe){c("Fehler",`Fehler beim Starten des Upgrades: ${Fe.message||Fe}`)}}async function We(ue){const ee=a==null?void 0:a.budget,Ae=ee&&!ee.fits?` + +⚠ Speicher-Warnung: Dieses Brain (~${ee.brain_gb} GB) muss immer resident sein. Zusammen mit dem größten on-demand-Modell (~${ee.largest_ondemand_gb} GB) sprengt das das Budget (${ee.gtt_gb} GB) → heavy/coder würden das Brain verdrängen. Erwäge ein kleineres Brain oder weniger Kontext.`:"";d("Agent-Hirn aktualisieren?",`Neues Hermes-Modell '${ue.split("/").pop()}' herunterladen und als Agent-Hirn (Rolle hermes) setzen? Hermes nutzt danach automatisch das neue Modell.${Ae}`,async()=>{try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:ue,role:"hermes",quant:"Q4_K_M",jinja:!0})}),c("Download gestartet","Das neue Agent-Hirn wird geladen. Fortschritt oben."),w()}catch(re){c("Fehler",`Update fehlgeschlagen: ${re.message||re}`)}})}async function Qe(ue){d("Agent-Hirn wechseln?",`'${ue.split("/").pop()}' als Agent-Hirn (Alias hermes) setzen? Es wird warm gehalten (brains-Gruppe); Hermes nutzt es nach einem kurzen Gateway-Restart.`,async()=>{try{await jt("/api/agent/brain/set",{method:"POST",body:JSON.stringify({model_id:ue})}),c("Erledigt","Agent-Hirn gewechselt. Gateway wurde neugestartet."),k(!1),w()}catch(ee){c("Fehler",`Wechsel fehlgeschlagen: ${ee.message||ee}`)}})}async function xt(ue){ue&&(await navigator.clipboard.writeText(ue),H(!0),setTimeout(()=>H(!1),1500))}if(n)return v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Initialisiere HUD Cockpit…"});if(S)return v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Gateway oder Engine nicht erreichbar (",S,")."]});const at=y.filter(ue=>x.includes(ue.name)),te=at.reduce((ue,ee)=>ue+(ee.size_bytes||0),0),W=((rt=l==null?void 0:l.gpu)==null?void 0:rt.gtt_total)||((ft=l==null?void 0:l.gpu)==null?void 0:ft.vram_total)||0,Ee=((nn=l==null?void 0:l.gpu)==null?void 0:nn.gtt_used)||0,Be=16*1024**3,le=W>2*1024**3?W:te>Be?te*1.2:Be,Ce=ue=>y.find(ee=>ee.role===ue),lt=ue=>{const ee=Ce(ue);return ee?x.includes(ee.name):!1};return v.jsxs("div",{className:"space-y-8",children:[v.jsx("style",{children:` + @keyframes flow-dash { + to { + stroke-dashoffset: -20; + } + } + .svg-flow-path { + stroke-dasharray: 4 6; + animation: flow-dash 1s linear infinite; + } + `}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex justify-between items-center",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(nE,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"VRAM / Memory Belegung"})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground",children:["Speicher-Pool: ",Ho(te)," Gewichte",Ee>0?` · ${Ho(Ee)} real belegt (inkl. KV)`:""," / ",Ho(le)]}),x.length>0&&v.jsx("button",{onClick:Ve,className:"h-6 px-2.5 rounded border border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/10 text-amber-400 text-[9px] font-bold uppercase transition-all cursor-pointer",children:"Alle entladen"})]})]}),v.jsx("div",{className:"h-7 w-full rounded-xl bg-background/50 border border-border/40 overflow-hidden flex p-0.5 relative group",children:at.length===0?v.jsx("div",{className:"w-full h-full flex items-center justify-center text-[10px] text-muted-foreground/60 italic font-mono select-none",children:"VRAM Leer — Auto-Swap lädt Modelle bei Anfrage"}):at.map((ue,ee)=>{var Fe;const Ae=(ue.size_bytes||0)/le*100,re=["from-teal-500 to-emerald-500","from-indigo-500 to-blue-500","from-purple-500 to-pink-500","from-cyan-500 to-sky-500"][ee%4];return v.jsxs("div",{style:{width:`${Ae}%`},className:nt("h-full rounded bg-gradient-to-r flex items-center justify-between px-2.5 transition-all text-white/95 shrink-0 shadow-inner select-none",re),title:`${ue.name} (${Ho(ue.size_bytes)})`,children:[v.jsxs("span",{className:"text-[9px] font-bold truncate max-w-[120px] font-space tracking-wide",children:[ue.role?`[${ue.role}] `:"",(Fe=ue.name.split("/").pop())==null?void 0:Fe.replace(".gguf","")]}),v.jsx("span",{className:"text-[8px] font-mono opacity-80",children:Ho(ue.size_bytes)})]},ue.name)})})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Gateway Graph"}),v.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Klicke links auf Editoren, um Configs zu kopieren. Klicke rechts auf Rollen, um GGUF-Zuweisungen live zu ändern."})]}),v.jsxs("div",{ref:ge,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[v.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[v.jsxs("defs",{children:[v.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),v.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),v.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),v.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),v.jsx("path",{d:we(.1),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="roocode"||b==="roocode")&&v.jsx("path",{d:we(.1),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:we(.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="cursor"||b==="cursor")&&v.jsx("path",{d:we(.3),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:we(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="opencode"||b==="opencode")&&v.jsx("path",{d:we(.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:we(.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="zed"||b==="zed")&&v.jsx("path",{d:we(.7),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:we(.9),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(ne==="continue"||b==="continue")&&v.jsx("path",{d:we(.9),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Me(.12),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("fast")&&v.jsx("path",{d:Me(.12),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Me(.31),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("heavy")&&v.jsx("path",{d:Me(.31),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Me(.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("coder")&&v.jsx("path",{d:Me(.5),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Me(.69),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("vision")&&v.jsx("path",{d:Me(.69),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:Me(.88),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),lt("scout")&&v.jsx("path",{d:Me(.88),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"10%"},onMouseEnter:()=>J("roocode"),onMouseLeave:()=>J(null),onClick:()=>E(ue=>ue==="roocode"?null:"roocode"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Roo Code"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"30%"},onMouseEnter:()=>J("cursor"),onMouseLeave:()=>J(null),onClick:()=>E(ue=>ue==="cursor"?null:"cursor"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Cursor IDE"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"50%"},onMouseEnter:()=>J("opencode"),onMouseLeave:()=>J(null),onClick:()=>E(ue=>ue==="opencode"?null:"opencode"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"OpenCode"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"70%"},onMouseEnter:()=>J("zed"),onMouseLeave:()=>J(null),onClick:()=>E(ue=>ue==="zed"?null:"zed"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Zed"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-28 h-8 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"10%",top:"90%"},onMouseEnter:()=>J("continue"),onMouseLeave:()=>J(null),onClick:()=>E(ue=>ue==="continue"?null:"continue"),children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cyan-400 animate-pulse"}),v.jsx("span",{children:"Continue"})]}),v.jsxs("div",{className:"absolute select-none z-10 w-36 py-3 px-4 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5",style:{left:"50%",top:"50%"},children:[v.jsx("div",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Gateway Auto"}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground mt-0.5",children:["Schwelle: > ",i!=null&&i.heavy_threshold_chars?i.heavy_threshold_chars/1e3:"4","k Zeichen"]}),v.jsx("div",{className:"mt-1 px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-semibold text-primary uppercase font-mono",children:"Auto-Swap"})]}),YF.map(ue=>{var Te;const ee=["12%","31%","50%","69%","88%"],Ae=Ce(ue),re=Ae?x.includes(Ae.name):!1;if(ue==="agent")return null;const Fe={fast:0,heavy:1,coder:2,vision:3,scout:4}[ue];return v.jsxs("div",{className:nt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",re?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":Ae?"border-border/60 bg-card/75":"border-dashed border-border/40 bg-background/20"),style:{left:"90%",top:ee[Fe]},onClick:()=>fe(ue),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:ue}),re&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground max-w-[150px]",children:Ae?(Te=Ae.name.split("/").pop())==null?void 0:Te.replace(".gguf",""):"Keine Zuweisung"})]},ue)}),b&&s&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200 flex flex-col justify-between",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("span",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:[b==="roocode"&&"Roo Code Setup",b==="cursor"&&"Cursor Setup",b==="opencode"&&"OpenCode Setup",b==="zed"&&"Zed Setup",b==="continue"&&"Continue Setup"]}),v.jsx("button",{onClick:()=>E(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"text-xs text-muted-foreground leading-relaxed space-y-2",children:[b==="roocode"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Suche in VS Code nach der Erweiterung ",v.jsx("strong",{children:"Roo Code"})," und installiere sie."]}),v.jsxs("li",{children:["Wähle in den Roo Code Einstellungen: Provider: ",v.jsx("strong",{children:"OpenAI Compatible"}),"."]}),v.jsxs("li",{children:["Füge das untenstehende JSON-Snippet in die ",v.jsx("code",{children:"settings.json"})," ein."]})]}),b==="cursor"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne Cursor Settings ➔ ",v.jsx("strong",{children:"Models"}),"."]}),v.jsxs("li",{children:["Deaktiviere Cloud-Modelle, klappe ",v.jsx("strong",{children:"OpenAI API"})," auf."]}),v.jsxs("li",{children:["Trage die Base URL unten ein und aktiviere das Modell ",v.jsx("strong",{children:"auto"}),"."]})]}),b==="opencode"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne die ",v.jsx("code",{children:"opencode.jsonc"})," Konfigurationsdatei."]}),v.jsxs("li",{children:["Ersetze den Provider-Eintrag unter ",v.jsx("code",{children:"provider"})," mit dem Snippet unten."]})]}),b==="zed"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsxs("li",{children:["Öffne die Zed Settings (",v.jsx("code",{children:"ctrl+,"}),")."]}),v.jsxs("li",{children:["Füge das untenstehende JSON-Segment unter ",v.jsx("code",{children:"language_models"})," ein."]})]}),b==="continue"&&v.jsxs("ul",{className:"list-decimal pl-4 space-y-1",children:[v.jsx("li",{children:"Klicke auf das Zahnrad-Symbol in der Continue-Erweiterung."}),v.jsxs("li",{children:["Füge den Gateway-Eintrag zum ",v.jsx("code",{children:"models"}),"-Array hinzu."]})]})]}),s.tools&&v.jsxs("div",{className:"relative rounded-xl border border-border/40 bg-black/40 overflow-hidden mt-1 shrink-0",children:[v.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-border/20 bg-black/20",children:[v.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:"JSON Config"}),v.jsxs("button",{onClick:()=>{var ue,ee,Ae,re,Fe;return xt(b==="roocode"?(ue=s.tools.cline)==null?void 0:ue.snippet:b==="cursor"?(ee=s.tools.cursor)==null?void 0:ee.snippet:b==="opencode"?(Ae=s.tools.opencode)==null?void 0:Ae.snippet:b==="zed"?(re=s.tools.zed)==null?void 0:re.snippet:(Fe=s.tools.continue)==null?void 0:Fe.snippet)},className:"text-xs font-semibold text-primary hover:text-primary-foreground flex items-center gap-1 cursor-pointer",children:[j?v.jsx(bo,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(ew,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:j?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:"p-3 max-h-48 overflow-y-auto text-xs font-mono text-cyan-200/90 whitespace-pre scrollbar-thin select-text",children:v.jsxs("code",{children:[b==="roocode"&&((qe=s.tools.cline)==null?void 0:qe.snippet),b==="cursor"&&((dt=s.tools.cursor)==null?void 0:dt.snippet),b==="opencode"&&((Dt=s.tools.opencode)==null?void 0:Dt.snippet),b==="zed"&&((Ut=s.tools.zed)==null?void 0:Ut.snippet),b==="continue"&&((pt=s.tools.continue)==null?void 0:pt.snippet)]})})]}),v.jsx("button",{onClick:()=>E(null),className:"w-full h-9 rounded-lg bg-primary text-primary-foreground hover:opacity-90 font-semibold text-xs transition-opacity cursor-pointer mt-2",children:"Schließen"})]})})]}),v.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),v.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Gateway"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),v.jsx("span",{children:"Grüner Puls: Aktive Verbindung / Warmes Modell geladen"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded bg-gradient-to-r from-teal-500 to-emerald-500"}),v.jsx("span",{children:"VRAM-Verlauf: Modellspezifischer Speicheranteil"})]})]})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground px-1",children:"Gateway Steckplatz-Belegung (Slot-Zuweisung)"}),v.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-6 gap-3",children:["fast","heavy","coder","vision","scout"].map(ue=>{var re;const ee=y.find(Fe=>Fe.role===ue),Ae=ee?x.includes(ee.name):!1;return v.jsxs("div",{onClick:()=>fe(ue),className:nt("rounded-xl border p-3 flex flex-col justify-between gap-2.5 transition-all cursor-pointer select-none text-left bg-background/25 hover:border-primary/45 hover:bg-background/40 group min-h-[90px]",Ae?"border-emerald-500/40 shadow-sm shadow-emerald-500/5":ee?"border-primary/20 bg-primary/5":"border-border/30 border-dashed opacity-75"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:nt("text-[9px] font-bold uppercase tracking-wider font-mono px-1.5 py-0.5 rounded border",CP(ue)),children:ue}),Ae&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate text-foreground/90 pr-1 font-space",title:ee==null?void 0:ee.name,children:ee?(re=ee.name.split("/").pop())==null?void 0:re.replace(/\.gguf$/i,""):"nicht zugewiesen"}),v.jsx("div",{className:"text-[8px] text-primary/70 group-hover:text-primary font-bold uppercase tracking-wider transition-colors font-space",children:"Ändern ➔"})]},ue)})})]}),(a==null?void 0:a.current)&&v.jsxs("div",{className:"rounded-2xl border border-indigo-500/30 bg-indigo-500/5 backdrop-blur-md p-5 shadow-lg shadow-black/10 space-y-3.5",children:[v.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(qc,{className:"h-4.5 w-4.5 text-indigo-400"}),v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Agent-Hirn (Hermes)"}),a.current.version!=null&&v.jsxs("span",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-indigo-500/15 text-indigo-300 border border-indigo-500/25",children:["v",a.current.version]})]}),v.jsx("button",{onClick:()=>k(!0),className:"h-7 px-3 rounded-lg border border-indigo-500/30 bg-indigo-500/5 text-indigo-300 text-[9px] font-bold uppercase hover:bg-indigo-500/15 transition-all cursor-pointer",children:"Hirn wechseln"})]}),v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 rounded-xl bg-background/30 border border-border/30 p-3.5",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:a.current.name,children:a.current.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsx("span",{children:a.current.params_b?`${a.current.params_b}B`:"—"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:a.current.quant||"GGUF"}),v.jsx("span",{children:"•"}),v.jsx("span",{children:Ho(a.current.size_bytes||0)})]})]}),a.update_available&&a.recommended?v.jsxs("button",{onClick:()=>We(a.recommended.repo),className:nt("h-8 px-3 shrink-0 flex items-center justify-center gap-1.5 rounded-lg text-[10px] font-bold uppercase transition-all cursor-pointer shadow-md",a.budget&&!a.budget.fits?"bg-red-500 text-white hover:bg-red-400 shadow-red-500/10":"bg-amber-500 text-black hover:bg-amber-400 shadow-amber-500/10"),children:[v.jsx(vg,{className:"h-3.5 w-3.5"})," Aktualisieren"]}):v.jsxs("span",{className:"h-8 px-3 shrink-0 flex items-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/15 rounded-lg select-none",children:[v.jsx(bo,{className:"h-4 w-4"})," Neueste Generation"]})]}),a.update_available&&a.recommended&&v.jsxs("div",{className:"text-[10px] text-amber-400/90 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),"Neuere Generation verfügbar: ",v.jsx("span",{className:"font-mono font-bold",children:a.recommended.name.replace(/-GGUF$/i,"")}),"(v",a.recommended.version,", ",a.recommended.params_b,"B) — von NousResearch."]}),a.budget&&v.jsxs("div",{className:nt("text-[10px] flex items-start gap-1.5 leading-relaxed",a.budget.fits?"text-muted-foreground/80":"text-red-400 font-semibold"),children:[v.jsx(nE,{className:"h-3 w-3 shrink-0 mt-0.5"}),v.jsxs("span",{children:["Always-On-Brain ~",a.budget.brain_gb," GB + größtes on-demand (~",a.budget.largest_ondemand_gb," GB) = ",(a.budget.brain_gb+a.budget.largest_ondemand_gb).toFixed(1)," / ",a.budget.gtt_gb," GB",a.budget.fits?" · passt gleichzeitig ✓":" · passt NICHT gleichzeitig ⚠ — heavy/coder würden das Brain verdrängen. Kleineres Brain oder weniger Kontext."]})]})]}),v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3 px-1",children:[v.jsxs("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Installierte Modell-Bibliothek (",K.length," von ",y.length,")"]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>B("all"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="all"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Vorhanden"}),v.jsx("button",{onClick:()=>B("in_use"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",he==="in_use"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"In Benutzung"})]}),v.jsxs("div",{className:"flex rounded-lg border border-border/40 bg-card/45 p-0.5",children:[v.jsx("button",{onClick:()=>oe("grid"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",de==="grid"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Grid"}),v.jsx("button",{onClick:()=>oe("list"),className:nt("px-2.5 py-1 rounded-md text-[9px] font-bold uppercase transition-all cursor-pointer",de==="list"?"bg-primary text-primary-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"List"})]})]})]}),de==="grid"?v.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:K.length===0?v.jsx("div",{className:"col-span-full text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:he==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):K.map(ue=>{const ee=x.includes(ue.name),Ae=o==null?void 0:o.model_list.find(Fe=>Fe.role===ue.role),re=TI(ue.name);return v.jsxs("div",{className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-4 transition-all duration-300 hover:border-primary/40 group relative overflow-hidden",ee?"border-primary/45 shadow-primary/5":ue.role?"border-primary/30 bg-primary/5 shadow-inner":"border-border/60"),children:[v.jsxs("div",{className:"space-y-3",children:[v.jsx("div",{className:"flex items-start justify-between gap-3",children:v.jsxs("div",{className:"flex gap-2.5 min-w-0",children:[v.jsx("div",{className:nt("w-7 h-7 rounded-lg border flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",re.color),title:re.name,children:re.initial}),v.jsxs("div",{className:"min-w-0",children:[v.jsx("h3",{className:"text-xs font-bold tracking-tight text-foreground line-clamp-2 break-all font-mono",title:ue.name,children:ue.name.split("/").pop()}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap mt-1",children:[v.jsx("span",{className:"text-[9px] font-mono text-muted-foreground bg-background/40 px-1.5 py-0.5 rounded border border-border/30",children:ue.quant||"GGUF"}),ee&&v.jsxs("span",{className:"flex items-center gap-1 text-[9px] font-semibold text-emerald-400 uppercase tracking-wider",children:[v.jsx(i0,{className:"h-3 w-3 animate-pulse"})," Warm"]}),ue.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[9px] font-mono text-primary font-bold uppercase",children:ue.role}),ue.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[9px] font-mono text-cyan-400 font-bold uppercase",title:"Prompt Caching aktiv",children:"PC"}),ue.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[9px] font-mono text-emerald-400 font-bold uppercase",title:`Speculative Decoding aktiv (Draft: ${ue.spec_draft_model})`,children:"SPEC"}):ue.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:`Draft gesetzt (${ue.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel. Über 'Spec' neu konfigurieren.`,children:"SPEC?"}):null,ue.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[9px] font-mono text-violet-400 font-bold uppercase",title:`${ue.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ue.parallel_slots]}),ue.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[9px] font-mono text-amber-400 font-bold uppercase",title:"GGUF-Datei fehlt — Modell kann nicht geladen werden",children:"⚠ Datei fehlt"})]})]})]})}),v.jsx("div",{className:"border-t border-border/30 pt-3 flex flex-wrap gap-1",children:v.jsx(N3,{caps:ue.capabilities})})]}),v.jsxs("div",{className:"space-y-3 pt-1",children:[v.jsxs("div",{className:"grid grid-cols-2 gap-2 text-[10px] font-mono text-muted-foreground",children:[v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(nE,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Größe"}),v.jsx("div",{className:"text-foreground font-semibold",children:Ho(ue.size_bytes)})]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 p-2 bg-background/20 rounded-lg border border-border/20",children:[v.jsx(K8,{className:"h-3.5 w-3.5 text-primary/80"}),v.jsxs("div",{children:[v.jsx("div",{className:"text-[8px] uppercase tracking-wider font-semibold text-muted-foreground/60",children:"Kontext"}),v.jsx("div",{className:"text-foreground font-semibold",children:MI(ue.ctx)})]})]})]}),Ae&&v.jsxs("div",{className:"p-3 bg-amber-500/5 border border-amber-500/30 rounded-xl space-y-2 flex flex-col justify-between shrink-0",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping"}),v.jsxs("span",{children:["Upgrade verfügbar: ",Ae.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>Ue(Ae.repo,ue.role,ue.quant||"Q4_K_M",ue.capabilities.tools!=="no"),className:"h-7 w-full flex items-center justify-center gap-1 rounded-lg bg-amber-500 text-black text-[10px] font-bold hover:bg-amber-400 transition-colors cursor-pointer",children:[v.jsx(vg,{className:"h-3 w-3"})," Smart-Swap starten"]})]}),v.jsxs("div",{className:"flex items-center gap-1.5 border-t border-border/20 pt-3 mt-auto",children:[v.jsx("button",{onClick:()=>ee?Se(ue.name):$e(ue.name),disabled:ue.incomplete&&!ee,className:nt("flex-1 h-7 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center justify-center gap-1",ue.incomplete&&!ee?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":ee?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:ee?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>Q(ue.name,ue.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),v.jsxs("button",{onClick:()=>F(ue),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-colors cursor-pointer flex items-center gap-1",ue.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":ue.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(xh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>Ge(ue.name),className:"h-7 w-7 rounded-lg border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 flex items-center justify-center transition-colors cursor-pointer",title:"Modell löschen",children:v.jsx(kT,{className:"h-3.5 w-3.5"})})]})]})]},ue.name)})}):v.jsx("div",{className:"space-y-2",children:K.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center select-none",children:he==="in_use"?"Keine Modelle in Benutzung (keine Zuweisung oder warm geladene Modelle).":'Keine Modelle konfiguriert. Verwende den Tab "Modelle finden" zum Herunterladen.'}):K.map(ue=>{const ee=x.includes(ue.name),Ae=TI(ue.name);return v.jsxs("div",{className:nt("rounded-xl border bg-card/45 backdrop-blur-md p-3.5 shadow-lg shadow-black/5 flex flex-col sm:flex-row sm:items-center justify-between gap-3 hover:border-primary/40 transition-all",ee?"border-primary/45":ue.role?"border-primary/30 bg-primary/5":"border-border/60"),children:[v.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[v.jsx("div",{className:nt("w-8 h-8 rounded-lg border border-border/40 flex items-center justify-center font-bold text-xs shrink-0 shadow-sm",Ae.color),title:Ae.name,children:Ae.initial}),v.jsxs("div",{className:"min-w-0 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground truncate max-w-[250px] sm:max-w-[400px] break-all font-mono",title:ue.name,children:ue.name.split("/").pop()}),ue.role&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-primary/10 border border-primary/20 text-[8px] font-mono text-primary font-bold uppercase shrink-0",children:ue.role}),ue.prompt_cache&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-cyan-500/10 border border-cyan-500/20 text-[8px] font-mono text-cyan-400 font-bold uppercase shrink-0",title:"Prompt Caching aktiv",children:"PC"}),ue.spec_active?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-emerald-500/10 border border-emerald-500/20 text-[8px] font-mono text-emerald-400 font-bold uppercase shrink-0",title:`Speculative Decoding aktiv (Draft: ${ue.spec_draft_model})`,children:"SPEC"}):ue.spec_draft_model?v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:`Draft gesetzt (${ue.spec_draft_model}), aber INAKTIV — --spec-type fehlt oder Vocab inkompatibel.`,children:"SPEC?"}):null,ue.parallel_slots>1&&v.jsxs("span",{className:"px-1.5 py-0.5 rounded bg-violet-500/10 border border-violet-500/20 text-[8px] font-mono text-violet-400 font-bold uppercase shrink-0",title:`${ue.parallel_slots} parallele Slots aktiv`,children:["SLOTS: ",ue.parallel_slots]}),ue.incomplete&&v.jsx("span",{className:"px-1.5 py-0.5 rounded bg-amber-500/10 border border-amber-500/20 text-[8px] font-mono text-amber-400 font-bold uppercase shrink-0",title:"GGUF-Datei fehlt",children:"⚠ Datei fehlt"}),ee&&v.jsxs("span",{className:"flex items-center gap-0.5 text-[8px] font-semibold text-emerald-400 uppercase tracking-wider shrink-0",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"})," warm"]})]}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 mt-0.5",children:[v.jsxs("span",{children:["Größe: ",Ho(ue.size_bytes)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Kontext: ",MI(ue.ctx)]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:"font-mono text-[9px]",children:ue.quant||"GGUF"})]})]})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0 self-end sm:self-auto",children:[v.jsx("div",{className:"hidden lg:flex flex-wrap gap-1",children:v.jsx(N3,{caps:ue.capabilities})}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("button",{onClick:()=>ee?Se(ue.name):$e(ue.name),disabled:ue.incomplete&&!ee,className:nt("h-7 px-3 rounded-lg text-[9px] font-bold uppercase transition-all border flex items-center gap-1",ue.incomplete&&!ee?"border-border/30 bg-background/10 text-muted-foreground/50 cursor-not-allowed":ee?"border-amber-500/30 bg-amber-500/5 hover:bg-amber-500/15 text-amber-400 cursor-pointer":"border-primary/30 bg-primary/5 hover:bg-primary/15 text-primary cursor-pointer"),children:ee?"Entladen":"Laden"}),v.jsx("button",{onClick:()=>Q(ue.name,ue.ctx),className:"h-7 px-2.5 rounded-lg border border-border/40 text-[9px] font-bold uppercase hover:bg-accent text-muted-foreground transition-all cursor-pointer",title:"Kontextlänge anpassen",children:"Ctx"}),v.jsxs("button",{onClick:()=>F(ue),className:nt("h-7 px-2.5 rounded-lg border text-[9px] font-bold uppercase transition-all cursor-pointer flex items-center gap-1",ue.spec_active?"border-emerald-500/30 text-emerald-400 hover:bg-emerald-500/10":ue.spec_draft_model?"border-amber-500/30 text-amber-400 hover:bg-amber-500/10":"border-border/40 text-muted-foreground hover:bg-accent"),title:"Speculative Draft konfigurieren (Vocab-geprüft)",children:[v.jsx(xh,{className:"h-3 w-3"})," Spec"]}),v.jsx("button",{onClick:()=>Ge(ue.name),className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all cursor-pointer",title:"Modell löschen",children:v.jsx(kT,{className:"h-3.5 w-3.5"})})]})]})]},ue.name)})})]}),T&&(()=>{var Fe,Te;const ue=O&&O.role===T?O:null,ee={};ue==null||ue.models.forEach(Le=>{ee[Le.name]=Le});const Ae=ue?ue.models.map(Le=>y.find(Ke=>Ke.name===Le.name)).filter(Boolean):y,re=Le=>{Xe(T,Le),C(null)};return v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary",children:["Rolle '",T,"' konfigurieren"]}),v.jsx("button",{onClick:()=>C(null),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wähle ein Modell für die Rolle ",v.jsx("strong",{className:"text-foreground",children:T}),":"]}),(ue==null?void 0:ue.recommended)&&v.jsxs("button",{onClick:()=>re(ue.recommended),title:(Fe=ee[ue.recommended])==null?void 0:Fe.reason,className:"shrink-0 h-7 px-3 text-[11px] font-semibold text-primary border border-primary/50 bg-primary/10 hover:bg-primary/20 rounded-lg cursor-pointer flex items-center gap-1",children:[v.jsx(xh,{className:"h-3 w-3"})," Auto: ",(Te=ue.recommended.split("/").pop())==null?void 0:Te.replace(/\.gguf$/i,"")]})]}),v.jsxs("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:[v.jsx("button",{onClick:()=>re(""),className:"w-full text-left px-3 py-2 rounded-lg text-xs hover:bg-accent text-red-400 font-semibold cursor-pointer border border-red-500/20 bg-red-500/5 flex items-center justify-between",children:v.jsx("span",{children:"Zuweisung entfernen"})}),Ae.map(Le=>{var Cn;const Ke=ee[Le.name],ut=Le.role===T,Kt=!!(Ke!=null&&Ke.recommended),un=!!Ke&&!Ke.suitable;return v.jsxs("button",{onClick:()=>re(Le.name),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border",Kt?"border-primary/50 bg-primary/10":ut?"text-primary font-bold bg-primary/5 border-primary/30":un?"border-border/20 bg-background/10 opacity-60":"text-foreground bg-background/20 border-border/30"),children:[v.jsxs("div",{className:"flex flex-col text-left min-w-0",children:[v.jsxs("span",{className:"truncate max-w-[260px] font-semibold flex items-center gap-1.5",children:[(Cn=Le.name.split("/").pop())==null?void 0:Cn.replace(/\.gguf$/i,""),Kt&&v.jsx("span",{className:"text-[8px] font-bold uppercase tracking-wide text-primary bg-primary/15 px-1.5 py-0.5 rounded",children:"Empfohlen"})]}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:Ke?`${Ke.params_b}B · ${Le.quant} · ${Ke.reason}`:`${Ho(Le.size_bytes)} · ${Le.quant}`})]}),ut&&v.jsx(bo,{className:"h-4 w-4 shrink-0 text-primary"})]},Le.name)})]})]})})})(),D&&v.jsx(Lfe,{model:D,onClose:()=>F(null),onChanged:w}),V&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(qc,{className:"h-4 w-4"})," Agent-Hirn wechseln"]}),v.jsx("button",{onClick:()=>k(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground leading-relaxed",children:["Wähle ein ",v.jsx("strong",{className:"text-foreground",children:"installiertes"})," Modell als Agent-Hirn. Es bekommt den",v.jsx("code",{className:"text-primary",children:" hermes"}),'-Alias, wird warm gehalten (brains-Gruppe), und Hermes nutzt es nach einem kurzen Gateway-Restart. Neues Modell (z.B. Hermes-4.3 oder Gemma-4)? Erst über „Modelle finden" laden.']}),v.jsx("div",{className:"space-y-1.5 max-h-72 overflow-y-auto pr-1",children:y.map(ue=>{var Ae;const ee=ue.role==="hermes";return v.jsxs("button",{onClick:()=>!ee&&Qe(ue.name),disabled:ee||ue.incomplete,className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs flex items-center justify-between font-mono border transition-all",ee?"border-indigo-500/40 bg-indigo-500/10 text-indigo-300":ue.incomplete?"border-border/20 bg-background/10 text-muted-foreground/50 cursor-not-allowed":"border-border/30 bg-background/20 text-foreground hover:bg-accent cursor-pointer"),children:[v.jsxs("div",{className:"flex flex-col min-w-0",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:(Ae=ue.name.split("/").pop())==null?void 0:Ae.replace(/\.gguf$/i,"")}),v.jsxs("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:[ue.capabilities.params_b?`${ue.capabilities.params_b}B`:"?"," · ",Ho(ue.size_bytes),ue.role&&` · Rolle: ${ue.role}`,ue.capabilities.tools!=="no"?" · Tools ✓":" · ohne Tools"]})]}),ee?v.jsxs("span",{className:"text-[9px] font-bold uppercase text-indigo-300 shrink-0 flex items-center gap-1",children:[v.jsx(bo,{className:"h-3.5 w-3.5"})," Aktiv"]}):v.jsx("span",{className:"text-[9px] font-bold uppercase text-primary/70 shrink-0",children:"Als Hirn setzen →"})]},ue.name)})}),v.jsxs("div",{className:"text-[10px] text-amber-400/80 flex items-start gap-1.5 border-t border-border/20 pt-2.5",children:[v.jsx("span",{children:"💡"}),v.jsxs("span",{children:["Für einen ",v.jsx("strong",{children:"Agenten"})," sind Hermes-Modelle (natives Tool-Calling) meist die robustere Wahl als allgemeine Modelle."]})]})]})}),m]})}function Ufe(){const[t,e]=R.useState(""),[n,r]=R.useState([]),[i,s]=R.useState("Q4_K_M"),[o,a]=R.useState(""),[l,c]=R.useState(""),[d,f]=R.useState(""),[m,y]=R.useState([]),[x,S]=R.useState(null),[w,b]=R.useState(!1),E=["fast","heavy","coder","vision","scout"],{data:T}=qh(),C=l?T==null?void 0:T.models.find(H=>(H.role||"").toLowerCase()===l):void 0;async function O(H,ne,J){if(b(!1),!H.trim()){S(null);return}try{const de=await jt(`/api/fit?params_b=0&quant=${encodeURIComponent(ne)}&ctx=8192&name=${encodeURIComponent(H)}&role=${encodeURIComponent(J)}`);S(de)}catch{S(null)}}async function N(H){const ne=H??t;if(ne.trim()){a("Analysiere HuggingFace Repository..."),S(null);try{const J=await jt(`/api/hf/quants?repo=${encodeURIComponent(ne)}`);e(J.repo),r(J.quants);const de=J.quants.length?J.quants.includes("Q4_K_M")?"Q4_K_M":J.quants[0]:i;J.quants.length&&s(de),a(J.quants.length?"":"Keine GGUF-Dateien in diesem Repository gefunden."),J.quants.length&&O(J.repo,de,l)}catch(J){a(`Fehler: ${J}`)}}}function D(H){s(H),O(t,H,l)}function F(H){c(H),n.length&&O(t,i,H)}async function V(){if(d.trim()){a("Durchsuche HuggingFace...");try{const H=await jt(`/api/hf/search?q=${encodeURIComponent(d)}`);y(H.results),a(H.results.length?"":"Keine Ergebnisse gefunden.")}catch(H){a(`Suche fehlgeschlagen: ${H}`)}}}async function k(){if(t.trim()){if((x==null?void 0:x.fit.level)==="too_tight"&&!w){b(!0);return}a("Download-Job wird initiiert...");try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:t,quant:i,role:l||void 0,jinja:!0})}),b(!1),a(`Download gestartet: ${t} (${i})${l?`, Rolle: ${l}`:""}. Fortschritt oben.`+(C?` „${l}" wurde von ${C.name} übernommen.`:"")+(l==="fast"||l==="coder"?" Speculative Draft (Vocab-geprüft) kannst du nach dem Download an der Modellkarte (»Spec«) setzen.":""))}catch(H){a(`Download-Fehler: ${H}`)}}}const j=(x==null?void 0:x.fit.level)==="perfect"?"text-emerald-400 border-emerald-500/40 bg-emerald-500/10":(x==null?void 0:x.fit.level)==="marginal"?"text-amber-400 border-amber-500/40 bg-amber-500/10":"text-red-400 border-red-500/40 bg-red-500/10";return v.jsxs("div",{className:"space-y-4 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"HF Download & Suche"}),v.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[v.jsx("input",{value:t,onChange:H=>{e(H.target.value),S(null),b(!1)},placeholder:"HF-URL oder org/repo (z.B. unsloth/Qwen2.5-Coder-7B-Instruct-GGUF)",className:"flex-1 h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsxs("div",{className:"flex gap-2",children:[v.jsx("button",{onClick:()=>N(),className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer whitespace-nowrap",children:"Quants laden"}),n.length>0&&v.jsxs(v.Fragment,{children:[v.jsx("select",{value:i,onChange:H=>D(H.target.value),className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:n.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))}),v.jsxs("select",{value:l,onChange:H=>F(H.target.value),title:"Rolle (optional) — bestimmt Auto-Konfiguration + setup-bewussten Kontext",className:"h-9 rounded-lg border border-border/60 bg-background/40 px-3 text-xs outline-none text-foreground font-semibold",children:[v.jsx("option",{value:"",className:"bg-popover text-foreground",children:"Rolle…"}),E.map(H=>v.jsx("option",{value:H,className:"bg-popover text-foreground",children:H},H))]}),v.jsx("button",{onClick:k,className:`h-9 px-4 rounded-lg text-xs font-semibold transition-all cursor-pointer flex items-center gap-1.5 ${w?"bg-red-500 text-white hover:opacity-90":"bg-primary text-primary-foreground hover:opacity-90"}`,children:w?v.jsxs(v.Fragment,{children:[v.jsx(xg,{className:"h-3.5 w-3.5"})," OOM-Risiko — trotzdem laden"]}):v.jsxs(v.Fragment,{children:[v.jsx(vg,{className:"h-3.5 w-3.5"})," Herunterladen"]})})]})]})]}),x&&v.jsxs("div",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-lg border px-3 py-2 text-[11px] font-medium ${j}`,children:[v.jsx("span",{className:"font-bold uppercase tracking-wide",children:x.fit.text}),v.jsxs("span",{className:"font-mono opacity-90",children:["~",x.params_b,"B · ~",x.fit.req_gb," GB / ",x.sys_ram_gb," GB RAM · ~",x.fit.tps," t/s"]}),x.fit.level!=="too_tight"&&v.jsxs("span",{className:"font-mono opacity-80",title:`Setup-bewusst: GTT ${x.budget.gtt_gb} GB − reserviert ${x.budget.reserved_gb} GB (${x.budget.mode}) → ${x.budget.budget_gb} GB frei`,children:["ctx → ",(x.assigned_ctx/1024).toFixed(0),"k"]}),x.fit.level==="too_tight"&&v.jsx("span",{className:"opacity-90",children:"— passt nicht in den Speicher, würde beim Laden abstürzen (OOM)."})]}),C&&v.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-[11px] font-medium text-amber-400",children:[v.jsx(xg,{className:"h-3.5 w-3.5 mt-0.5 shrink-0"}),v.jsxs("span",{children:["Rolle ",v.jsxs("strong",{children:["„",l,'"']})," ist aktuell ",v.jsx("strong",{children:C.name})," zugewiesen. Beim Download übernimmt das neue Modell diese Rolle — ",C.name," bleibt installiert, verliert sie aber."]})]}),v.jsxs("div",{className:"flex gap-2 border-t border-border/20 pt-4",children:[v.jsxs("div",{className:"relative flex-1",children:[v.jsx("input",{value:d,onChange:H=>f(H.target.value),onKeyDown:H=>H.key==="Enter"&&V(),placeholder:"HuggingFace durchsuchen (z.B. Llama-3.1)...",className:"w-full h-9 pl-9 pr-3 rounded-lg border border-border/60 bg-background/40 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsx(yP,{className:"absolute left-3 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsx("button",{onClick:V,className:"h-9 px-4 rounded-lg border border-border/60 bg-background/20 text-xs font-semibold hover:border-primary/50 hover:bg-background/40 transition-all cursor-pointer",children:"Suchen"})]}),m.length>0&&v.jsx("div",{className:"max-h-48 space-y-1.5 overflow-y-auto border border-border/40 bg-background/20 p-2 rounded-xl scrollbar-thin",children:m.map(H=>v.jsxs("button",{onClick:()=>{e(H.repo),y([]),f(""),N(H.repo)},className:"flex w-full items-center justify-between rounded-lg px-3 py-2 text-left text-xs bg-background/10 border border-border/10 hover:border-primary/30 hover:bg-background/30 transition-all",children:[v.jsx("span",{className:"font-semibold truncate",children:H.repo}),v.jsxs("span",{className:"text-[10px] font-mono text-muted-foreground flex items-center gap-1 shrink-0",children:[v.jsx(vg,{className:"h-3 w-3"})," ",H.downloads.toLocaleString()]})]},H.repo))}),o&&v.jsx("div",{className:"text-[10px] font-medium text-primary font-mono",children:o})]})}const jfe={fast:{title:"Schnelles Alltags-Hirn",desc:"Schnelle MoE-Antworten für Chat, Zusammenfassungen und alltägliche Aufgaben.",icon:xh},heavy:{title:"Schweres Reasoning",desc:"Große Modelle für komplexe Logik, Mathematik und tiefgründiges Planen.",icon:V1},coder:{title:"Coden & Entwicklung",desc:"Autovervollständigung, Refactoring und Codegenerierung direkt in deiner IDE.",icon:iF},vision:{title:"Bilder & Vision",desc:"Verarbeitet Bilder, Screenshots und visuelle Diagramme in multimodalen Chats.",icon:RT},scout:{title:"Multimodal-Allrounder",desc:"Multimodaler Allrounder für schnelle Antworten, Übersetzungen und Alltag.",icon:PT}};function Ffe(){const{data:t,isLoading:e,error:n}=_7(),{data:r}=qh(),{data:i}=AP(),s=(r==null?void 0:r.models)??[],o=n?String(n):"",[a,l]=R.useState({}),[c,d]=R.useState({}),[f,m]=R.useState(!1);async function y(x,S,w,b){l(E=>({...E,[x]:"Starte..."}));try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:x,role:S,quant:w,jinja:b})}),l(E=>({...E,[x]:"Download läuft"}))}catch{l(T=>({...T,[x]:"Fehler"}))}}return e?v.jsx("div",{className:"text-xs text-muted-foreground py-12 text-center",children:"Analysiere Hardware und suche passende GGUF-Empfehlungen…"}):o||!t?v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Empfehlungsdienst temporär nicht erreichbar (",o,")."]}):v.jsxs("div",{className:"space-y-8",children:[v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground bg-background/25 border border-border/40 p-4 rounded-xl flex flex-col sm:flex-row sm:items-center justify-between gap-3 shadow-sm",children:[v.jsxs("div",{children:["Modell-Registry geladen für ",v.jsxs("span",{className:"text-foreground font-bold",children:[t.sys_ram_gb," GB"]})," System-RAM."]}),v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx(r9,{className:"h-3.5 w-3.5 text-primary fill-primary/20"}),v.jsx("span",{children:"Empfehlungen sind automatisch auf deine Box-Hardware optimiert."})]})]}),v.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:t.categories.map(x=>{const S=jfe[x.role]||{title:x.title||x.role,desc:"Spezifisches Modell für diese Systemrolle.",icon:G1},w=S.icon,b=s.find(D=>D.role===x.role),E=i==null?void 0:i.model_list.find(D=>D.role===x.role),T=x.models.find(D=>D.repo===x.recommended)||x.models[0];if(!T)return null;const C=a[T.repo],O=x.models.filter(D=>D.repo!==x.recommended),N=!!c[x.role];return v.jsxs("div",{className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-5 transition-all duration-300 hover:border-primary/40",b?"border-border/60":"border-primary/20 shadow-primary/5"),children:[v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx("div",{className:"w-10 h-10 rounded-xl bg-primary/10 border border-primary/20 flex items-center justify-center text-primary shadow-sm shrink-0",children:v.jsx(w,{className:"h-5.5 w-5.5"})}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-sm font-bold tracking-tight text-foreground",children:S.title}),v.jsxs("span",{className:"text-[9px] font-mono text-muted-foreground uppercase bg-background/50 px-1.5 py-0.5 rounded border border-border/30 inline-block mt-0.5",children:["Rolle: ",x.role]})]})]}),b?v.jsxs("span",{className:"flex items-center gap-1.5 text-[9px] font-bold text-emerald-400 uppercase tracking-wider bg-emerald-500/10 border border-emerald-500/20 px-2.5 py-1 rounded-lg",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"Aktiviert"]}):v.jsx("span",{className:"text-[9px] font-bold text-primary/70 uppercase tracking-wider bg-primary/10 border border-primary/20 px-2.5 py-1 rounded-lg",children:"Frei"})]}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:S.desc}),v.jsx("div",{className:"p-3.5 rounded-xl bg-background/35 border border-border/30 space-y-2.5",children:b?v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Aktive GGUF-Belegung"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:b.name,children:b.name.split("/").pop()}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2",children:[v.jsxs("span",{children:["Größe: ",zT(b.size_bytes||0)]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",b.quant||"GGUF"]})]})]}):v.jsxs("div",{className:"space-y-1.5",children:[v.jsx("div",{className:"text-[9px] font-bold uppercase tracking-wider text-primary/80",children:"Empfohlenes Modell"}),v.jsx("div",{className:"text-xs font-mono font-bold text-foreground truncate",title:T.name,children:T.name}),v.jsxs("div",{className:"text-[10px] text-muted-foreground/80 flex items-center gap-2 flex-wrap",children:[v.jsxs("span",{children:["Ersteller: ",T.author]}),v.jsx("span",{children:"•"}),v.jsxs("span",{children:["Quant: ",T.quant]})]}),v.jsx("div",{className:"flex items-center gap-1.5 pt-0.5",children:v.jsx(iX,{fit:T.fit})})]})}),v.jsx("div",{className:"pt-1",children:b?E?v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"text-[9px] font-semibold text-amber-400 flex items-center gap-1.5",children:[v.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-400 animate-ping shrink-0"}),v.jsxs("span",{children:["Bessere Version in der Registry: ",E.repo.split("/").pop()]})]}),v.jsxs("button",{onClick:()=>y(E.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!a[E.repo],className:"h-8 w-full flex items-center justify-center gap-1.5 rounded-lg bg-amber-500 text-black text-xs font-bold hover:bg-amber-400 disabled:opacity-50 transition-all cursor-pointer shadow-md shadow-amber-500/10",children:[v.jsx(vg,{className:"h-3.5 w-3.5"}),a[E.repo]||"Auf neue Version aktualisieren"]})]}):v.jsxs("div",{className:"h-8 flex items-center justify-center gap-1.5 text-[10px] font-bold text-emerald-400 uppercase tracking-wide bg-emerald-500/5 border border-emerald-500/10 rounded-lg select-none",children:[v.jsx(bo,{className:"h-4 w-4"})," Auf neuestem Stand"]}):v.jsxs("button",{onClick:()=>y(T.repo,x.role,T.quant||"Q4_K_M",T.caps.tools!=="no"),disabled:!!C,className:nt("h-8 w-full flex items-center justify-center gap-1.5 rounded-lg text-xs font-bold transition-all cursor-pointer border",C?"border-primary/40 bg-primary/5 text-primary":"bg-primary text-primary-foreground hover:opacity-90 shadow-md shadow-primary/10"),children:[v.jsx(vg,{className:"h-3.5 w-3.5"}),C||"Optimales Modell einsetzen"]})})]}),O.length>0&&v.jsxs("div",{className:"border-t border-border/20 pt-3",children:[v.jsxs("button",{onClick:()=>d(D=>({...D,[x.role]:!N})),className:"flex items-center gap-1.5 text-[10px] text-muted-foreground/80 hover:text-foreground transition-colors cursor-pointer",children:[N?v.jsx(E8,{className:"h-3 w-3"}):v.jsx(S8,{className:"h-3 w-3"}),v.jsxs("span",{children:["Alternative Empfehlungen anzeigen (",O.length,")"]})]}),N&&v.jsx("div",{className:"mt-2.5 space-y-2 max-h-36 overflow-y-auto pr-1 scrollbar-thin",children:O.map(D=>v.jsxs("div",{className:"p-2 rounded-lg bg-background/25 border border-border/20 flex items-center justify-between gap-3",children:[v.jsxs("div",{className:"min-w-0",children:[v.jsx("div",{className:"text-[10px] font-mono font-bold text-foreground truncate",title:D.name,children:D.name}),v.jsxs("div",{className:"text-[9px] text-muted-foreground flex items-center gap-1.5 mt-0.5",children:[v.jsxs("span",{children:["Quant: ",D.quant]}),v.jsx("span",{children:"•"}),v.jsx("span",{children:D.fit.text})]})]}),v.jsx("button",{onClick:()=>y(D.repo,x.role,D.quant||"Q4_K_M",D.caps.tools!=="no"),disabled:!!a[D.repo],className:"h-6 px-2.5 rounded bg-background/40 hover:bg-background/80 border border-border/40 text-[9px] font-bold text-foreground transition-all cursor-pointer shrink-0 disabled:opacity-50",children:a[D.repo]||"Installieren"})]},D.repo))})]})]},x.role)})}),v.jsxs("div",{className:"border border-border/50 bg-card/20 rounded-2xl overflow-hidden shadow-md mt-4",children:[v.jsxs("button",{onClick:()=>m(!f),className:"w-full px-5 py-4 flex items-center justify-between text-xs font-bold uppercase tracking-wider text-muted-foreground hover:bg-card/30 transition-colors cursor-pointer",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(yP,{className:"h-4 w-4 text-primary"}),v.jsx("span",{children:"Eigenes Modell von Hugging Face laden (Erweiterte Ansicht)"})]}),v.jsx("span",{className:"text-[10px] text-primary hover:underline",children:f?"Ausblenden ▲":"Anzeigen ▼"})]}),f&&v.jsx("div",{className:"p-5 border-t border-border/20 bg-card/10",children:v.jsx(Ufe,{})})]})]})}function zfe(){const[t,e]=R.useState("cockpit");return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Modell-Manager"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Verwalte deine Modelle und passe das Gateway-Routing live über das interaktive Cockpit an."})]}),v.jsx("div",{className:"flex rounded-xl border border-border/60 bg-card/45 backdrop-blur-md p-1 self-start",children:["cockpit","discover"].map(n=>v.jsx("button",{onClick:()=>e(n),className:nt("rounded-lg px-4 py-1.5 text-xs font-semibold tracking-wide uppercase transition-all cursor-pointer",t===n?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"text-muted-foreground hover:text-foreground"),children:n==="cockpit"?"Cockpit":"Modelle finden"},n))})]}),v.jsx(Ofe,{}),v.jsx("div",{className:"transition-all duration-300",children:t==="cockpit"?v.jsx(Dfe,{}):v.jsx(Ffe,{})})]})}const Bfe={cline:"cline_settings.json",cursor:"Settings → Models",opencode:"opencode.jsonc",zed:"settings.json",continue:"~/.continue/config.json",claude_code:"~/.zshrc / env"};function I3({line:t,loading:e}){return e||!t?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-muted-foreground",children:[v.jsx(sF,{className:"h-3 w-3 animate-spin"})," prüfe…"]}):t.ok?v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-emerald-400",children:[v.jsx(A8,{className:"h-3 w-3"})," ",t.detail]}):v.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-semibold text-red-400",children:[v.jsx(C8,{className:"h-3 w-3"})," ",t.detail]})}function k3({tool:t,fileName:e,accent:n,copied:r,onCopy:i}){return v.jsxs("div",{className:"flex flex-col border border-border/60 bg-black/60 rounded-2xl overflow-hidden shadow-2xl",children:[v.jsxs("div",{className:"flex h-11 items-center justify-between px-4 border-b border-border/40 bg-black/40 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-3 w-3 rounded-full bg-red-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-amber-500/80"}),v.jsx("span",{className:"h-3 w-3 rounded-full bg-emerald-500/80"})]}),v.jsx("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground/75 bg-background/30 px-3 py-1 rounded-md border border-border/20",children:v.jsx("span",{children:e})}),v.jsxs("button",{onClick:i,className:"flex h-7 px-2.5 items-center gap-1.5 rounded-lg border border-border/40 bg-background/30 text-[10px] font-semibold text-muted-foreground hover:text-foreground hover:bg-background/60 transition-all cursor-pointer",children:[r?v.jsx(bo,{className:"h-3.5 w-3.5 text-emerald-400"}):v.jsx(ew,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:r?"Kopiert":"Kopieren"})]})]}),v.jsx("pre",{className:nt("p-5 overflow-x-auto text-xs font-mono whitespace-pre leading-relaxed scrollbar-thin select-text bg-black/10",n==="teal"?"text-cyan-200/90":"text-violet-200/90"),children:v.jsx("code",{children:t.snippet})})]})}function Hfe(){const[t,e]=R.useState(localStorage.getItem("mc_host")||"192.168.178.151"),[n,r]=R.useState(localStorage.getItem("mc_mcp_path")||""),[i,s]=R.useState("cline"),[o,a]=R.useState(null),l=new URLSearchParams({host:t});n&&l.set("mcp_path",n);const{data:c,error:d}=VF(l.toString()),{data:f,isLoading:m}=S7(),y=d?String(d):"";function x(E){e(E),E&&localStorage.setItem("mc_host",E)}function S(E){r(E),localStorage.setItem("mc_mcp_path",E)}const w=c==null?void 0:c.tools[i];async function b(E,T){T&&(await navigator.clipboard.writeText(T),a(E),setTimeout(()=>a(null),1500))}return v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Verbindung & Integration"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Binde deinen lokalen Agenten an die Box an — über ",v.jsx("span",{className:"text-foreground",children:"zwei getrennte Leitungen"}),": das Modell (Gateway) und das geteilte Gedächtnis (MCP)."]})]}),v.jsxs("div",{className:"p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"grid gap-4 md:grid-cols-[170px_1fr] items-center",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-background/40 p-4 text-center",children:[v.jsx(j8,{className:"h-7 w-7 mx-auto text-muted-foreground"}),v.jsx("div",{className:"mt-2 text-sm font-semibold text-foreground",children:"Dein lokaler Agent"}),v.jsx("div",{className:"text-[11px] text-muted-foreground",children:"Cline · Cursor · Zed …"})]}),v.jsxs("div",{className:"flex flex-col gap-2.5",children:[v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(rI,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-primary/25 bg-primary/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-primary",children:[v.jsx(El,{className:"h-3.5 w-3.5"})," Leitung 1 — Modell"]}),v.jsx(I3,{line:f==null?void 0:f.gateway,loading:m})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-primary/80",children:"Gateway · :9001/v1 · model auto"})]})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsx(rI,{className:"h-4 w-4 text-muted-foreground shrink-0"}),v.jsxs("div",{className:"flex-1 rounded-xl border border-violet-500/25 bg-violet-500/5 px-3.5 py-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between gap-2",children:[v.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold text-violet-300",children:[v.jsx(V1,{className:"h-3.5 w-3.5"})," Leitung 2 — Gedächtnis"]}),v.jsx(I3,{line:f==null?void 0:f.memory,loading:m})]}),v.jsx("div",{className:"mt-1 text-[11px] font-mono text-violet-300/80",children:"MCP · mcp_memory.py · separat"})]})]})]})]}),v.jsxs("p",{className:"mt-3.5 text-[11px] text-muted-foreground leading-relaxed",children:["Der Gateway liefert ",v.jsx("span",{className:"text-foreground",children:"nur das LLM"}),". Das geteilte Gedächtnis läuft über einen",v.jsx("span",{className:"text-foreground",children:" eigenen MCP-Server"})," — beide werden unabhängig eingerichtet."]})]}),v.jsxs("div",{className:"grid gap-4 md:grid-cols-2 p-5 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(D8,{className:"h-3.5 w-3.5 text-primary"})," Box LAN IP-Adresse"]}),v.jsx("input",{value:t,onChange:E=>x(E.target.value),placeholder:"z.B. 192.168.178.151",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("label",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground flex items-center gap-1.5",children:[v.jsx(O8,{className:"h-3.5 w-3.5 text-violet-400"})," Lokaler MCP-Scriptpfad",v.jsx("span",{className:"text-violet-400/70 normal-case font-semibold tracking-normal",children:"(nur Leitung 2)"})]}),v.jsx("input",{value:n,onChange:E=>S(E.target.value),placeholder:"z.B. F:\\Coding Stuff\\mission-control-2\\mcp\\mcp_memory.py",className:"w-full h-9 rounded-lg border border-border/60 bg-background/40 px-3 font-mono text-xs outline-none focus:ring-1 focus:ring-violet-500/50 text-foreground"})]})]}),y&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler beim Generieren der Snippets: ",y]}),c&&v.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-primary/70 bg-card/30 p-4",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/15 text-primary text-[11px]",children:"1"}),"Modell anbinden"]}),v.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"Wähle dein Tool — das Snippet zeigt auf den Gateway."})]}),v.jsx("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(c.tools).map(([E,T])=>v.jsx("button",{onClick:()=>s(E),className:nt("rounded-lg px-3 py-1.5 text-[11px] font-semibold tracking-wide transition-all cursor-pointer",i===E?"bg-primary text-primary-foreground shadow-md shadow-primary/10":"border border-border/50 text-muted-foreground hover:text-foreground"),children:T.label},E))}),w&&v.jsxs(v.Fragment,{children:[w.note&&v.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-primary/5 border border-primary/20 text-[11px] text-muted-foreground leading-relaxed",children:[v.jsx(sI,{className:"h-4 w-4 text-primary shrink-0 mt-0.5"}),v.jsx("span",{children:w.note})]}),v.jsx(k3,{tool:w,fileName:Bfe[i]||"config.json",accent:"teal",copied:o==="model",onCopy:()=>b("model",w.snippet)})]})]}),v.jsxs("div",{className:"space-y-3 rounded-2xl border border-border/60 border-t-2 border-t-violet-500/70 bg-card/30 p-4",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"flex items-center gap-2 text-sm font-space font-bold text-foreground",children:[v.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-violet-500/15 text-violet-300 text-[11px]",children:"2"}),"Gedächtnis anbinden",v.jsx("span",{className:"text-[10px] font-medium text-muted-foreground normal-case",children:"optional"})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:["Ein MCP-Block — gilt zusätzlich für ",v.jsx("em",{children:"jedes"})," Tool aus Schritt 1."]})]}),v.jsxs("div",{className:"flex items-start gap-2.5 p-3 rounded-xl bg-violet-500/5 border border-violet-500/20 text-[11px] text-muted-foreground leading-relaxed",children:[v.jsx(sI,{className:"h-4 w-4 text-violet-400 shrink-0 mt-0.5"}),v.jsx("span",{children:c.memory.note})]}),v.jsx(k3,{tool:c.memory,fileName:"mcp.json",accent:"violet",copied:o==="memory",onCopy:()=>b("memory",c.memory.snippet)})]})]})]})}const Vfe="modulepreload",Gfe=function(t){return"/"+t},O3={},Wfe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));i=o(n.map(c=>{if(c=Gfe(c),c in O3)return;O3[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const m=document.createElement("link");if(m.rel=d?"stylesheet":Vfe,d||(m.as="script"),m.crossOrigin="",m.href=c,l&&m.setAttribute("nonce",l),document.head.appendChild(m),d)return new Promise((y,x)=>{m.addEventListener("load",y),m.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}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)})};class $fe extends R.Component{constructor(){super(...arguments);fo(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?v.jsxs("div",{className:"h-[480px] rounded-2xl border border-red-500/20 bg-red-500/5 p-6 text-xs text-red-400 overflow-auto",children:[v.jsx("div",{className:"font-semibold mb-2",children:"Graph konnte nicht gerendert werden"}),v.jsx("pre",{className:"whitespace-pre-wrap break-words text-[11px] leading-relaxed",children:this.state.error.message})]}):this.props.children}}const Xfe=R.lazy(()=>Wfe(()=>import("./GraphView-UmiKmWIR.js"),[]).then(t=>({default:t.GraphView}))),L3=["identity","knowledge","rules","events"],D3=new Set(["auto","agent","hermes"]),$E={identity:{label:"Identität",icon:s9,bg:"bg-cyan-500/10",text:"text-cyan-400"},knowledge:{label:"Wissen",icon:s0,bg:"bg-indigo-500/10",text:"text-indigo-400"},rules:{label:"Regeln",icon:J8,bg:"bg-violet-500/10",text:"text-violet-400"},events:{label:"Ereignisse",icon:P8,bg:"bg-amber-500/10",text:"text-amber-400"}},U3={label:"Gedächtnis",icon:TT,bg:"bg-muted/10",text:"text-muted-foreground"},qfe={identity:"border-l-cyan-500/80",knowledge:"border-l-indigo-500/80",rules:"border-l-violet-500/80",events:"border-l-amber-500/80"},j3=`Hi Hermes! Lass uns ein kurzes Onboarding machen, damit du dich künftig an mich erinnerst. Stell mir nacheinander ein paar kurze Fragen zu: +1) wer ich bin und woran ich gerade arbeite, +2) wie ich angesprochen werden möchte, +3) meine bevorzugten Tools, Sprachen und Arbeitsweise, +4) wichtige Regeln/Konventionen, die du beachten sollst, +5) meine Infrastruktur (Server, Dienste – ohne Geheimnisse). +Frag immer nur eine Sache auf einmal und fass am Ende zusammen, was du dir gemerkt hast.`;function Kfe(){const[t,e]=R.useState(""),[n,r]=R.useState(""),[i,s]=R.useState(""),[o,a]=R.useState("knowledge"),[l,c]=R.useState(!1),[d,f]=R.useState(!1),[m,y]=R.useState("graph"),[x,S]=R.useState(!1),w=$h(),{showAlert:b,showConfirm:E,dialogElement:T}=Jg(),{data:C=[]}=FT({}),{data:O=[],error:N}=FT({q:n,category:t}),{data:D}=m7(m==="graph"),F=N?String(N):"",V=()=>{w.invalidateQueries({queryKey:["memory"]}),w.invalidateQueries({queryKey:["memory-graph"]})},k=R.useMemo(()=>{const K=C.length,q=C.filter($=>D3.has($.source)).length;return{total:K,auto:q,manual:K-q,cats:new Set(C.map($=>$.category)).size}},[C]),j=C.length===0,H=R.useMemo(()=>{const K=D??{nodes:[],edges:[]};if(!n.trim())return K;const q=n.toLowerCase(),$=K.nodes.filter(ge=>ge.content.toLowerCase().includes(q)),Z=new Set($.map(ge=>ge.id));return{nodes:$,edges:K.edges.filter(ge=>Z.has(ge.source)&&Z.has(ge.target))}},[D,n]);async function ne(){i.trim()&&(await jt("/api/memory",{method:"POST",body:JSON.stringify({content:i,category:o,source:"ui"})}),s(""),S(!1),V())}async function J(K){await jt(`/api/memory/${K}`,{method:"DELETE"}),V()}async function de(){try{await navigator.clipboard.writeText(j3),f(!0),setTimeout(()=>f(!1),1800)}catch{b("Kopieren fehlgeschlagen","Markiere den Prompt und kopiere ihn manuell (Strg+C).")}}function oe(){de(),window.dispatchEvent(new CustomEvent("mc-navigate",{detail:{view:"terminal"}}))}async function he(){c(!0);try{const K=await jt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!1})});if(K.duplicate_count===0){b("Ergebnis","Keine Dubletten gefunden — alles sauber.");return}E("Deduplizierung bestätigen",`${K.duplicate_count} Dublette(n) in ${K.groups.length} Gruppe(n) gefunden. Entfernen?`,async()=>{try{await jt("/api/memory/dedupe",{method:"POST",body:JSON.stringify({apply:!0})}),V()}catch(q){b("Fehler",`Fehler beim Löschen: ${q.message}`)}})}catch(K){b("Fehler",`Fehler bei der Deduplizierung: ${K.message}`)}finally{c(!1)}}const B=({value:K,label:q,accent:$})=>v.jsxs("span",{className:nt("flex items-center gap-1.5 text-[11px] rounded-lg px-2.5 py-1 border",$==="auto"?"text-emerald-400 bg-emerald-500/[0.07] border-emerald-500/20":"text-muted-foreground bg-card/40 border-border/50"),children:[$==="auto"&&v.jsx(Vm,{className:"h-3 w-3"}),v.jsx("b",{className:nt("font-semibold",$==="auto"?"":"text-foreground"),children:K})," ",q]});return v.jsxs("div",{className:"space-y-5",children:[v.jsxs("div",{className:"flex flex-col lg:flex-row lg:items-center justify-between gap-3",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Gedächtnis-Pool"}),v.jsx("p",{className:"text-sm text-muted-foreground",children:"Geteilte Konstitution — Hermes, IDEs & Gateway lesen und lernen hier per MCP."})]}),v.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[v.jsxs("div",{className:"relative",children:[v.jsx("input",{value:n,onChange:K=>r(K.target.value),placeholder:"Semantisch suchen…",className:"w-52 h-9 pl-8 pr-3 rounded-lg border border-border/60 bg-card/45 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground"}),v.jsx(yP,{className:"absolute left-2.5 top-2.5 h-3.5 w-3.5 text-muted-foreground"})]}),v.jsxs("button",{onClick:()=>S(K=>!K),className:"h-9 px-3 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer shadow-md shadow-primary/10",children:[v.jsx(IT,{className:"h-4 w-4"})," Eintrag"]}),v.jsx("div",{className:"flex items-center gap-1 p-1 bg-card/30 border border-border/40 rounded-lg",children:[["liste",V8,"Liste"],["graph",t9,"Graph"]].map(([K,q,$])=>v.jsxs("button",{onClick:()=>y(K),className:nt("flex h-7 px-2.5 items-center gap-1.5 text-[11px] font-semibold rounded-md transition-all cursor-pointer",m===K?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx(q,{className:"h-3.5 w-3.5"})," ",$]},K))}),v.jsx("button",{onClick:he,disabled:l,className:"flex h-9 w-9 items-center justify-center rounded-lg border border-border/60 bg-card hover:border-primary/50 transition-all cursor-pointer shadow-md disabled:opacity-50",title:"Deduplizieren",children:v.jsx(Vm,{className:"h-4 w-4 text-primary"})})]})]}),!j&&v.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[v.jsx(B,{value:k.total,label:"Fakten"}),v.jsx(B,{value:k.auto,label:"auto gelernt",accent:"auto"}),v.jsx(B,{value:k.manual,label:"manuell"}),v.jsx(B,{value:k.cats,label:"Kategorien"}),v.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(Vm,{className:"h-3 w-3 text-emerald-400"})," lernt automatisch aus Hermes-Gesprächen"]})]}),x&&v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-4 space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("div",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Neuen Eintrag anlegen"}),v.jsx("button",{onClick:()=>S(!1),className:"text-muted-foreground hover:text-foreground",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsx("textarea",{value:i,onChange:K=>s(K.target.value),rows:2,placeholder:"Eine Regel, Vorliebe oder einen stabilen Fakt über dich oder das Projekt…",className:"w-full resize-none rounded-xl border border-border/60 bg-background/30 p-3 text-xs outline-none focus:ring-1 focus:ring-primary/50 text-foreground leading-relaxed"}),v.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[v.jsx("select",{value:o,onChange:K=>a(K.target.value),className:"h-8 rounded-lg border border-border/60 bg-background/50 px-2 text-xs outline-none font-semibold text-foreground cursor-pointer",children:L3.map(K=>{var q;return v.jsx("option",{value:K,className:"bg-popover text-foreground",children:((q=$E[K])==null?void 0:q.label)||K},K)})}),v.jsxs("button",{onClick:ne,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[v.jsx(IT,{className:"h-4 w-4"})," Speichern"]})]})]}),F&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400",children:["Fehler: ",F]}),j?v.jsxs("div",{className:"rounded-2xl border border-dashed border-border/60 bg-card/20 p-8 sm:p-10 flex flex-col items-center text-center gap-5",children:[v.jsx("div",{className:"h-14 w-14 rounded-2xl bg-primary/10 flex items-center justify-center",children:v.jsx(W8,{className:"h-7 w-7 text-primary"})}),v.jsxs("div",{className:"space-y-1.5 max-w-lg",children:[v.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Lass Hermes dich kennenlernen"}),v.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Statt Fakten einzutippen: führ ein kurzes Onboarding-Gespräch mit Hermes. Was ihr besprecht, merkt sich das Gedächtnis automatisch — du musst nichts manuell pflegen."})]}),v.jsxs("div",{className:"w-full max-w-lg text-left",children:[v.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground/60",children:"Sende das an Hermes"}),v.jsx("button",{onClick:de,className:"flex items-center gap-1 text-[10px] font-semibold text-muted-foreground hover:text-foreground transition-colors",children:d?v.jsxs(v.Fragment,{children:[v.jsx(bo,{className:"h-3 w-3 text-emerald-400"})," Kopiert"]}):v.jsxs(v.Fragment,{children:[v.jsx(ew,{className:"h-3 w-3"})," Kopieren"]})})]}),v.jsx("pre",{className:"w-full rounded-xl border border-border/60 bg-background/40 p-3.5 text-[11px] leading-relaxed text-foreground/90 whitespace-pre-wrap font-mono",children:j3})]}),v.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[v.jsxs("button",{onClick:oe,className:"h-9 px-4 rounded-lg bg-primary text-primary-foreground text-xs font-semibold hover:opacity-90 transition-all flex items-center gap-1.5 cursor-pointer",children:[v.jsx(lF,{className:"h-4 w-4"})," Im Terminal starten"]}),v.jsxs("button",{onClick:de,className:"h-9 px-4 rounded-lg border border-border/60 bg-card text-xs font-semibold hover:border-primary/50 transition-all flex items-center gap-1.5 cursor-pointer",children:[d?v.jsx(bo,{className:"h-4 w-4 text-emerald-400"}):v.jsx(ew,{className:"h-4 w-4"})," Prompt kopieren"]})]}),v.jsxs("p",{className:"text-[11px] text-muted-foreground/70 flex items-center gap-1.5",children:[v.jsx(e9,{className:"h-3 w-3"})," Funktioniert genauso über Telegram —"," ",v.jsx("button",{onClick:()=>S(!0),className:"underline hover:text-foreground",children:"oder lieber manuell anlegen"}),"."]})]}):m==="graph"?v.jsx($fe,{children:v.jsx(R.Suspense,{fallback:v.jsx("div",{className:"h-[480px] rounded-2xl border border-border/60 bg-card/30 flex items-center justify-center text-xs text-muted-foreground",children:"Graph wird geladen…"}),children:v.jsx(Xfe,{data:H,onDelete:J})})}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-1 bg-card/30 border border-border/40 rounded-xl w-fit",children:[v.jsx("button",{onClick:()=>e(""),className:nt("h-7 px-3 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer",t?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"),children:"Alle"}),L3.map(K=>{const q=$E[K]||U3,$=q.icon;return v.jsxs("button",{onClick:()=>e(K),className:nt("h-7 px-2.5 rounded-lg text-[10px] font-semibold uppercase tracking-wider transition-all cursor-pointer flex items-center gap-1",t===K?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:[v.jsx($,{className:"h-3 w-3"})," ",q.label]},K)})]}),v.jsx("div",{className:"space-y-3",children:O.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-2xl p-12 text-center",children:"Keine Einträge für die aktuellen Filterkriterien gefunden."}):O.map(K=>{const q=$E[K.category]||U3,$=q.icon,Z=D3.has(K.source);return v.jsxs("div",{className:nt("flex items-start justify-between gap-4 p-4 rounded-xl border border-l-4 bg-card/45 backdrop-blur-md border-border/60 shadow-md shadow-black/5 hover:border-primary/20 transition-all group",qfe[K.category]||"border-l-muted"),children:[v.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[v.jsxs("span",{className:nt("flex items-center gap-1 px-2 py-0.5 rounded text-[9px] font-bold uppercase tracking-wider font-mono shrink-0",q.bg,q.text),children:[v.jsx($,{className:"h-3 w-3"}),v.jsx("span",{className:"hidden sm:inline",children:q.label})]}),v.jsx("span",{className:"text-xs text-foreground leading-relaxed break-words whitespace-pre-wrap flex-1",children:K.content})]}),v.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[typeof K.score=="number"&&v.jsxs("span",{className:"text-[9px] font-mono text-primary bg-primary/10 px-1.5 py-0.5 rounded uppercase tracking-wider",title:"Relevanz der semantischen Suche",children:[Math.round(K.score*100),"%"]}),v.jsxs("span",{className:nt("flex items-center gap-1 text-[9px] font-mono px-1.5 py-0.5 rounded uppercase tracking-wider",Z?"text-emerald-400 bg-emerald-500/10":"text-muted-foreground/60 bg-background/20"),title:Z?"Automatisch gelernt":"Manuell angelegt",children:[Z&&v.jsx(Vm,{className:"h-2.5 w-2.5"}),K.source]}),v.jsx("button",{onClick:()=>J(K.id),title:"Eintrag löschen",className:"h-7 w-7 rounded-lg flex items-center justify-center border border-border/40 text-muted-foreground hover:text-red-400 hover:bg-red-500/5 transition-all opacity-0 group-hover:opacity-100",children:v.jsx(kT,{className:"h-3.5 w-3.5"})})]})]},K.id)})})]}),T]})}function Ub({label:t,ok:e,detail:n,icon:r,onClick:i}){return v.jsxs("div",{onClick:i,className:nt("rounded-2xl border bg-card/45 backdrop-blur-md p-5 shadow-lg shadow-black/10 flex flex-col justify-between gap-3 hover:border-primary/40 transition-all duration-300",e?"border-border/60":"border-amber-500/30",i&&"cursor-pointer hover:bg-card/70"),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:t}),v.jsx(r,{className:nt("h-4.5 w-4.5",e?"text-primary":"text-amber-500")})]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full ring-2 ring-black/40",e?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:e?"Bereit / Online":"Offline / Inaktiv"})]}),n&&v.jsx("div",{className:"text-[10px] font-mono text-muted-foreground truncate max-w-[200px]",title:n,children:n})]}),i&&v.jsxs("button",{onClick:s=>{s.stopPropagation(),i()},className:"mt-2 flex items-center justify-center gap-1.5 w-full py-1.5 px-3 rounded-lg border border-primary/30 bg-primary/10 hover:bg-primary/20 text-primary text-[10px] font-bold uppercase tracking-wider transition-all cursor-pointer font-space",children:[v.jsx(El,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Gehirn wechseln"})]})]})}function Yfe(){const{data:t,error:e}=EP(5e3),{data:n}=qh(),{showAlert:r,dialogElement:i}=Jg(),s=$h(),o=e?String(e):"",a=R.useMemo(()=>["auto","fast","heavy",...((n==null?void 0:n.models)??[]).map(O=>{var N;return((N=O.name.split("/").pop())==null?void 0:N.replace(".gguf",""))||O.name})],[n]),[l,c]=R.useState(null),[d,f]=R.useState(!1),[m,y]=R.useState({width:800,height:360}),x=R.useRef(null),S=R.useCallback(C=>{if(x.current&&(x.current.disconnect(),x.current=null),C){const O=new ResizeObserver(N=>{if(!N||N.length===0)return;const D=N[0].contentRect;y({width:D.width,height:D.height})});O.observe(C),x.current=O}},[]),w=m.width,b=m.height,E=(C,O,N,D)=>{const F=(C+N)/2;return`M ${C} ${O} C ${F} ${O}, ${F} ${D}, ${N} ${D}`};async function T(C){try{await jt("/api/agent/brain",{method:"POST",body:JSON.stringify({model:C})}),r("Erfolgreich",`Hermes-Gehirn wurde auf '${C}' geändert. Der Gateway-Dienst wurde neu gestartet.`),s.invalidateQueries({queryKey:Lr.agentStatus}),f(!1)}catch(O){r("Fehler",`Fehler beim Wechseln des Gehirns: ${O.message}`)}}return v.jsxs("div",{className:"space-y-6",children:[v.jsx("style",{children:` + @keyframes flow-dash { + to { + stroke-dashoffset: -20; + } + } + .svg-flow-path { + stroke-dasharray: 4 6; + animation: flow-dash 1s linear infinite; + } + `}),v.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Hermes Agenten-Cockpit"}),v.jsxs("p",{className:"text-sm text-muted-foreground",children:["Hermes ist ein autonomer Agent, der im Hintergrund der Box läuft (Port ",v.jsx("code",{children:":8642"}),") und seine eigene UI besitzt."]})]}),(t==null?void 0:t.terminal_url)&&v.jsxs("a",{href:wg(t.terminal_url),target:"_blank",rel:"noopener",className:nt("flex h-9 px-4 items-center gap-1.5 text-xs font-semibold rounded-lg transition-all cursor-pointer shadow-md shrink-0 self-start",t.terminal_reachable?"bg-primary text-primary-foreground hover:opacity-90 shadow-primary/10":"border border-border/60 text-muted-foreground bg-background/20"),children:[v.jsx(yg,{className:"h-4 w-4"}),v.jsx("span",{children:"Terminal öffnen"})]})]}),o&&v.jsxs("div",{className:"rounded-xl border border-red-500/20 bg-red-500/5 p-4 text-xs text-red-400 font-mono",children:["Status nicht lesbar (",o,")."]}),t&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[v.jsx(Ub,{label:"Agent Gateway",ok:t.gateway_reachable,detail:"Port :8642 (REST API)",icon:qc}),v.jsx(Ub,{label:"Terminal",ok:t.terminal_reachable,detail:"Web-Terminal (hermes chat)",icon:i0}),v.jsx(Ub,{label:"Aktives Gehirn",ok:t.gateway_reachable,detail:t.brain_model?`Model: ${t.brain_model}`:"Model: auto",icon:El,onClick:()=>f(!0)}),v.jsx(Ub,{label:"Verdrahtung",ok:t.has_config,detail:`Config: ${t.has_config?"✓":"—"} · Skills: ${t.has_skills?"✓":"—"} · Memory: ${t.has_memories?"✓":"—"}`,icon:tw})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{children:[v.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"Interactive Agent Flow Graph"}),v.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5 leading-relaxed",children:"Visualisiert das Zusammenspiel und die Verbindungspfade zwischen den Hermes-Systemkomponenten."})]}),v.jsxs("div",{ref:S,className:"relative w-full h-96 border border-border/30 rounded-xl bg-black/25 overflow-hidden flex",children:[v.jsxs("svg",{className:"absolute inset-0 pointer-events-none w-full h-full",children:[v.jsxs("defs",{children:[v.jsxs("linearGradient",{id:"cyan-to-teal",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#06b6d4",stopOpacity:"0.45"}),v.jsx("stop",{offset:"100%",stopColor:"#0d9488",stopOpacity:"0.45"})]}),v.jsxs("linearGradient",{id:"active-glow",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[v.jsx("stop",{offset:"0%",stopColor:"#3b82f6",stopOpacity:"0.8"}),v.jsx("stop",{offset:"100%",stopColor:"#10b981",stopOpacity:"0.8"})]})]}),v.jsx("path",{d:E(w*.15,b*.5,w*.5,b*.5),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="terminal"||t.terminal_reachable)&&v.jsx("path",{d:E(w*.15,b*.5,w*.5,b*.5),stroke:"#06b6d4",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:E(w*.5,b*.5,w*.85,b*.3),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="brain"||t.gateway_reachable)&&v.jsx("path",{d:E(w*.5,b*.5,w*.85,b*.3),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"}),v.jsx("path",{d:E(w*.5,b*.5,w*.85,b*.7),stroke:"url(#cyan-to-teal)",strokeWidth:"1.5",fill:"none"}),(l==="gateway"||l==="wiring"||t.gateway_reachable)&&v.jsx("path",{d:E(w*.5,b*.5,w*.85,b*.7),stroke:"url(#active-glow)",strokeWidth:"2.5",fill:"none",className:"svg-flow-path"})]}),v.jsxs("div",{className:"absolute cursor-pointer select-none z-10 w-36 h-9 -translate-y-1/2 -translate-x-1/2 rounded-xl border border-border/60 bg-card/75 backdrop-blur-md flex items-center justify-center gap-1.5 px-2.5 hover:border-primary transition-all text-[10px] font-semibold text-foreground shadow shadow-black/20",style:{left:"15%",top:"50%"},onMouseEnter:()=>c("terminal"),onMouseLeave:()=>c(null),onClick:()=>t.terminal_reachable&&window.open(wg(t.terminal_url),"_blank"),title:t.terminal_reachable?"Klicken um das Hermes-Terminal zu öffnen":"Terminal offline",children:[v.jsx(i0,{className:nt("h-3.5 w-3.5",t.terminal_reachable?"text-emerald-400":"text-amber-500")}),v.jsx("span",{children:"Terminal"}),v.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full animate-pulse ml-auto",t.terminal_reachable?"bg-emerald-500":"bg-amber-500")})]}),v.jsxs("div",{className:"absolute select-none z-10 w-40 py-2.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-2xl border border-primary/50 bg-card/90 backdrop-blur-md flex flex-col items-center justify-center text-center shadow-lg shadow-primary/5 cursor-pointer",style:{left:"50%",top:"50%"},onMouseEnter:()=>c("gateway"),onMouseLeave:()=>c(null),children:[v.jsxs("div",{className:"flex items-center gap-1",children:[v.jsx(qc,{className:"h-3.5 w-3.5 text-primary"}),v.jsx("span",{className:"text-[10px] uppercase font-bold text-primary font-space tracking-wide",children:"Agent Gateway"})]}),v.jsx("div",{className:"text-[9px] font-mono text-muted-foreground mt-0.5",children:"Port :8642"}),v.jsx("div",{className:nt("mt-1 px-1.5 py-0.5 rounded text-[8px] font-semibold uppercase font-mono border",t.gateway_reachable?"bg-emerald-500/10 border-emerald-500/20 text-emerald-400":"bg-red-500/10 border-red-500/20 text-red-400"),children:t.gateway_reachable?"Online":"Offline"})]}),v.jsxs("div",{className:nt("absolute z-20 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none cursor-pointer",t.gateway_reachable?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"30%"},onMouseEnter:()=>c("brain"),onMouseLeave:()=>c(null),onClick:()=>f(!0),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[v.jsx(El,{className:"h-3 w-3 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Aktives Gehirn"})]}),t.gateway_reachable&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsx("div",{className:"text-[10px] font-mono font-medium truncate mt-0.5 text-foreground font-space",title:t.brain_model,children:t.brain_model||"auto"})]}),v.jsxs("div",{className:nt("absolute z-10 w-44 py-1.5 px-3 -translate-y-1/2 -translate-x-1/2 rounded-xl border flex flex-col justify-center hover:border-primary/50 transition-all text-left shadow select-none",t.has_config?"border-emerald-500/50 bg-emerald-500/5 shadow-emerald-500/5":"border-border/60 bg-card/75"),style:{left:"85%",top:"70%"},onMouseEnter:()=>c("wiring"),onMouseLeave:()=>c(null),children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[v.jsx(tw,{className:"h-3 w-3 text-primary"}),v.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider",children:"Verdrahtung"})]}),t.has_config&&v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-400 animate-pulse"})]}),v.jsxs("div",{className:"text-[9px] font-mono mt-0.5 text-muted-foreground flex gap-1 justify-between",children:[v.jsxs("span",{children:["Config: ",t.has_config?"✓":"—"]}),v.jsxs("span",{children:["Skills: ",t.has_skills?"✓":"—"]}),v.jsxs("span",{children:["Memory: ",t.has_memories?"✓":"—"]})]})]})]}),v.jsxs("div",{className:"flex flex-wrap items-center gap-6 mt-3 text-[10px] text-muted-foreground border-t border-border/20 pt-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-cyan-400"}),v.jsx("span",{children:"Cyan-Fluss: Client-Anfrage an Agenten"})]}),v.jsxs("span",{className:"flex items-center gap-1.5",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),v.jsx("span",{children:"Grüner Puls: Verbindung hergestellt / Modul online"})]})]})]}),v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx($8,{className:"h-5 w-5 text-primary"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"PC Verbindung"})]}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full",t.pc_executor_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500")}),v.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.pc_executor_reachable?"Erreichbar":"Nicht verbunden"})]})]}),v.jsxs("div",{className:"grid gap-6 md:grid-cols-2 text-xs text-muted-foreground leading-relaxed text-left",children:[v.jsxs("div",{className:"space-y-3",children:[v.jsxs("p",{children:["Der ",v.jsx("strong",{className:"text-foreground",children:"Hermes PC Executor"})," läuft auf ",v.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"192.168.178.98:7777"})," und ermöglicht Hermes den direkten Zugriff auf deinen Windows-PC — Shell-Befehle, Screenshots, Tastatureingaben."]}),v.jsxs("p",{children:["Hermes erreicht den PC über den MCP-Server ",v.jsx("code",{className:"text-foreground font-mono px-1 py-0.5 rounded bg-muted/40 border border-border/30",children:"hermes-pc-control"}),", der automatisch beim Gateway-Start verbunden wird."]})]}),v.jsx("div",{className:"space-y-3",children:t.pc_executor_reachable?v.jsxs("div",{className:"p-3.5 bg-emerald-500/5 border border-emerald-500/20 rounded-xl space-y-1",children:[v.jsxs("div",{className:"text-emerald-400 font-semibold text-xs flex items-center gap-1.5",children:[v.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),"PC Executor verbunden"]}),v.jsxs("p",{className:"text-[10px]",children:["Hermes kann jetzt per Telegram oder Terminal Befehle auf TobisNicerPC ausführen. Nutze ",v.jsx("code",{className:"text-foreground",children:"pc_shell"}),", ",v.jsx("code",{className:"text-foreground",children:"pc_screenshot"})," oder ",v.jsx("code",{className:"text-foreground",children:"pc_open"}),"."]})]}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("h4",{className:"text-xs font-bold text-foreground",children:"PC Executor starten"}),v.jsxs("p",{children:["Starte ",v.jsx("code",{className:"text-foreground font-mono",children:"start.bat"})," im Ordner ",v.jsx("code",{className:"text-foreground font-mono",children:"client\\hermes-pc\\"})," auf dem Windows-PC und lasse das Fenster offen."]}),v.jsx("div",{className:"p-3 bg-background/25 rounded-xl border border-border/30 font-mono text-[9px] text-cyan-300",children:"client\\hermes-pc\\start.bat"})]})})]})]}),!t.gateway_reachable&&v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 space-y-4 shadow-lg shadow-black/10 text-left",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(s0,{className:"h-5 w-5 text-amber-500"}),v.jsx("h3",{className:"text-sm font-bold uppercase tracking-wider text-foreground",children:"Hermes-Agent Diagnostics"})]}),v.jsxs("div",{className:"text-xs text-muted-foreground space-y-3 leading-relaxed",children:[v.jsx("p",{children:"Der Hermes-Dienst ist auf der Box derzeit offline oder kann sich nicht mit dem lokalen llama-swap verbinden."}),v.jsxs("p",{children:["Stelle sicher, dass die systemd-Dienste auf der Box laufen. Du kannst den Status im ",v.jsx("strong",{children:"OS & Updates Drawer"})," prüfen und die Dienste bei Bedarf neu starten."]}),v.jsxs("div",{className:"p-3.5 bg-background/25 rounded-xl border border-border/30 font-mono text-[10px] space-y-1",children:[v.jsx("div",{className:"text-muted-foreground/60",children:"# Dienste manuell auf der Box prüfen:"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-gateway"}),v.jsx("div",{className:"text-primary",children:"systemctl --user status hermes-terminal"})]}),v.jsxs("p",{children:["Weitere Einrichtungsdetails (Brain-Konfiguration, MCP-Kopplungen, SSH-Tunneling und Such-Engines) findest du in der Dokumentationsdatei:",v.jsx("code",{className:"ml-1 px-1.5 py-0.5 rounded bg-muted/40 text-foreground border border-border/30",children:"docs/HERMES_SETUP.md"}),"."]})]})]})]}),t&&d&&v.jsx("div",{className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm flex items-center justify-center p-4",children:v.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-2xl space-y-4 animate-in fade-in zoom-in-95 duration-200",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/20 pb-2",children:[v.jsxs("h3",{className:"text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-1.5",children:[v.jsx(El,{className:"h-4 w-4"}),v.jsx("span",{children:"Hermes-Gehirn konfigurieren"})]}),v.jsx("button",{onClick:()=>f(!1),className:"p-1 rounded hover:bg-accent text-muted-foreground hover:text-foreground cursor-pointer",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:['Das „Gehirn" ist das primäre LLM für Hermes. Wähle ein Modell aus deiner Bibliothek oder nutze ein Gateway-Alias (',v.jsx("code",{className:"text-primary font-semibold",children:"auto"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"fast"})," / ",v.jsx("code",{className:"text-primary font-semibold",children:"heavy"}),"):"]}),v.jsx("div",{className:"space-y-1.5 max-h-60 overflow-y-auto pr-1",children:a.map(C=>{const O=["auto","fast","heavy"].includes(C);return v.jsxs("button",{onClick:()=>T(C),className:nt("w-full text-left px-3 py-2.5 rounded-lg text-xs hover:bg-accent flex items-center justify-between font-mono cursor-pointer border border-border/30",t.brain_model===C||!t.brain_model&&C==="auto"?"text-primary font-bold bg-primary/10 border-primary/30":"text-foreground bg-background/20"),children:[v.jsxs("div",{className:"flex flex-col text-left",children:[v.jsx("span",{className:"font-semibold truncate max-w-[280px]",children:C}),v.jsx("span",{className:"text-[9px] text-muted-foreground mt-0.5",children:O?"Gateway Routing Alias":"Installiertes GGUF Modell"})]}),(t.brain_model===C||!t.brain_model&&C==="auto")&&v.jsx(bo,{className:"h-4 w-4 shrink-0 text-primary"})]},C)})})]})}),i]})}function Zfe(){const{data:t}=EP(5e3),e=t!=null&&t.terminal_url?wg(t.terminal_url):void 0,n=t==null?void 0:t.terminal_reachable;return v.jsxs("div",{className:"flex h-full flex-col gap-4",children:[v.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text font-space text-2xl font-bold tracking-tight text-transparent",children:"Hermes Terminal"}),v.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:["Interaktiver Agent (",v.jsx("code",{className:"rounded bg-background/40 px-1 font-mono text-[11px] text-primary",children:"hermes chat"}),') mit Tools & PC-Steuerung — „mehr als Chatten".']})]}),v.jsxs("div",{className:"flex items-center gap-3",children:[v.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[v.jsx("span",{className:`h-2 w-2 rounded-full ${n?"bg-emerald-500 animate-pulse":"bg-amber-500"}`}),n?"online":"offline"]}),e&&v.jsxs("a",{href:e,target:"_blank",rel:"noopener",className:"flex h-8 items-center gap-1.5 rounded-lg border border-border/60 bg-background/20 px-3 text-xs font-semibold text-muted-foreground transition-all hover:border-primary/50 hover:text-foreground",children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," In neuem Tab"]})]})]}),e?v.jsxs("div",{className:"relative min-h-[68vh] flex-1 overflow-hidden rounded-2xl border border-border/60 bg-black/50 shadow-lg shadow-black/25",children:[n===!1&&v.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-3 bg-black/70 text-center",children:[v.jsx(xg,{className:"h-8 w-8 text-amber-400"}),v.jsx("div",{className:"text-sm font-semibold text-amber-300",children:"Terminal nicht erreichbar"}),v.jsxs("p",{className:"max-w-sm text-[11px] leading-normal text-muted-foreground",children:["Der ",v.jsx("code",{className:"font-mono text-primary",children:"hermes-terminal"}),"-Dienst (ttyd) läuft nicht. Auf der Box: ",v.jsx("code",{className:"font-mono",children:"systemctl --user restart hermes-terminal"}),"."]})]}),v.jsx("iframe",{src:e,title:"Hermes Terminal",className:"h-full w-full border-0",style:{minHeight:"68vh"}})]}):v.jsxs("div",{className:"flex min-h-[68vh] flex-1 items-center justify-center rounded-2xl border border-border/60 bg-background/20 text-xs text-muted-foreground",children:[v.jsx(aF,{className:"mr-2 h-4 w-4"})," Lade Terminal…"]})]})}/** + * @license + * Copyright 2010-2024 Three.js Authors + * SPDX-License-Identifier: MIT + */const Td="169",Xf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},qf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},dV=0,FC=1,fV=2,Qfe=3,hV=0,zS=1,$y=2,ka=3,Dl=0,ss=1,xo=2,Wc=0,Sh=1,zC=2,BC=3,HC=4,pV=5,ud=100,mV=101,gV=102,vV=103,yV=104,xV=200,bV=201,_V=202,wV=203,Zw=204,Qw=205,SV=206,MV=207,EV=208,AV=209,TV=210,CV=211,PV=212,RV=213,NV=214,Jw=0,e1=1,t1=2,Uh=3,n1=4,r1=5,i1=6,s1=7,ax=0,IV=1,kV=2,Cl=0,OV=1,LV=2,DV=3,lR=4,UV=5,jV=6,FV=7,VC="attached",zV="detached",BS=300,Jc=301,Cd=302,M0=303,E0=304,ev=306,Pd=1e3,wo=1001,Ng=1002,ri=1003,HS=1004,Jfe=1004,ih=1005,ehe=1005,Cr=1006,tg=1007,the=1007,qo=1008,nhe=1008,Ba=1009,cR=1010,uR=1011,Ig=1012,VS=1013,eu=1014,Zs=1015,tv=1016,GS=1017,WS=1018,jh=1020,dR=35902,fR=1021,hR=1022,is=1023,pR=1024,mR=1025,Mh=1026,Fh=1027,$S=1028,lx=1029,gR=1030,XS=1031,rhe=1032,qS=1033,Xy=33776,qy=33777,Ky=33778,Yy=33779,o1=35840,a1=35841,l1=35842,c1=35843,u1=36196,d1=37492,f1=37496,h1=37808,p1=37809,m1=37810,g1=37811,v1=37812,y1=37813,x1=37814,b1=37815,_1=37816,w1=37817,S1=37818,M1=37819,E1=37820,A1=37821,Zy=36492,T1=36494,C1=36495,vR=36283,P1=36284,R1=36285,N1=36286,BV=2200,HV=2201,VV=2202,kg=2300,Og=2301,$_=2302,sh=2400,oh=2401,A0=2402,KS=2500,yR=2501,GV=0,xR=1,I1=2,WV=3200,$V=3201,ihe=3202,she=3203,lu=0,XV=1,Lc="",ji="srgb",xi="srgb-linear",YS="display-p3",cx="display-p3-linear",T0="linear",Jn="srgb",C0="rec709",P0="p3",ohe=0,Kf=7680,ahe=7681,lhe=7682,che=7683,uhe=34055,dhe=34056,fhe=5386,hhe=512,phe=513,mhe=514,ghe=515,vhe=516,yhe=517,xhe=518,GC=519,qV=512,KV=513,YV=514,bR=515,ZV=516,QV=517,JV=518,e6=519,R0=35044,t6=35048,bhe=35040,_he=35045,whe=35049,She=35041,Mhe=35046,Ehe=35050,Ahe=35042,The="100",WC="300 es",Ml=2e3,N0=2001;let Bl=class{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);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]+Qi[t>>16&255]+Qi[t>>24&255]+"-"+Qi[e&255]+Qi[e>>8&255]+"-"+Qi[e>>16&15|64]+Qi[e>>24&255]+"-"+Qi[n&63|128]+Qi[n>>8&255]+"-"+Qi[n>>16&255]+Qi[n>>24&255]+Qi[r&255]+Qi[r>>8&255]+Qi[r>>16&255]+Qi[r>>24&255]).toLowerCase()}function Ar(t,e,n){return Math.max(e,Math.min(n,t))}function _R(t,e){return(t%e+e)%e}function Che(t,e,n,r,i){return r+(t-e)*(i-r)/(n-e)}function Phe(t,e,n){return t!==e?(n-t)/(e-t):0}function Qy(t,e,n){return(1-n)*t+n*e}function Rhe(t,e,n,r){return Qy(t,e,1-Math.exp(-n*r))}function Nhe(t,e=1){return e-Math.abs(_R(t,e*2)-e)}function Ihe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*(3-2*t))}function khe(t,e,n){return t<=e?0:t>=n?1:(t=(t-e)/(n-e),t*t*t*(t*(t*6-15)+10))}function Ohe(t,e){return t+Math.floor(Math.random()*(e-t+1))}function Lhe(t,e){return t+Math.random()*(e-t)}function Dhe(t){return t*(.5-Math.random())}function Uhe(t){t!==void 0&&(F3=t);let e=F3+=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 jhe(t){return t*Eh}function Fhe(t){return t*Lg}function zhe(t){return(t&t-1)===0&&t!==0}function Bhe(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Hhe(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function Vhe(t,e,n,r,i){const s=Math.cos,o=Math.sin,a=s(n/2),l=o(n/2),c=s((e+r)/2),d=o((e+r)/2),f=s((e-r)/2),m=o((e-r)/2),y=s((r-e)/2),x=o((r-e)/2);switch(i){case"XYX":t.set(a*d,l*f,l*m,a*c);break;case"YZY":t.set(l*m,a*d,l*f,a*c);break;case"ZXZ":t.set(l*f,l*m,a*d,a*c);break;case"XZX":t.set(a*d,l*x,l*y,a*c);break;case"YXY":t.set(l*y,a*d,l*x,a*c);break;case"ZYZ":t.set(l*x,l*y,a*d,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Ss(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 cn(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 gr={DEG2RAD:Eh,RAD2DEG:Lg,generateUUID:Mo,clamp:Ar,euclideanModulo:_R,mapLinear:Che,inverseLerp:Phe,lerp:Qy,damp:Rhe,pingpong:Nhe,smoothstep:Ihe,smootherstep:khe,randInt:Ohe,randFloat:Lhe,randFloatSpread:Dhe,seededRandom:Uhe,degToRad:jhe,radToDeg:Fhe,isPowerOfTwo:zhe,ceilPowerOfTwo:Bhe,floorPowerOfTwo:Hhe,setQuaternionFromProperEuler:Vhe,normalize:cn,denormalize:Ss};class He{constructor(e=0,n=0){He.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,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+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,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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,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 n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Ar(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+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,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,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 r=Math.cos(n),i=Math.sin(n),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 Xt{constructor(e,n,r,i,s,o,a,l,c){Xt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,s,o,a,l,c)}set(e,n,r,i,s,o,a,l,c){const d=this.elements;return d[0]=e,d[1]=i,d[2]=a,d[3]=n,d[4]=s,d[5]=l,d[6]=r,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,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.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 r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],d=r[4],f=r[7],m=r[2],y=r[5],x=r[8],S=i[0],w=i[3],b=i[6],E=i[1],T=i[4],C=i[7],O=i[2],N=i[5],D=i[8];return s[0]=o*S+a*E+l*O,s[3]=o*w+a*T+l*N,s[6]=o*b+a*C+l*D,s[1]=c*S+d*E+f*O,s[4]=c*w+d*T+f*N,s[7]=c*b+d*C+f*D,s[2]=m*S+y*E+x*O,s[5]=m*w+y*T+x*N,s[8]=m*b+y*C+x*D,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],r=e[1],i=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-r*s*d+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=d*o-a*c,m=a*l-d*s,y=c*s-o*l,x=n*f+r*m+i*y;if(x===0)return this.set(0,0,0,0,0,0,0,0,0);const S=1/x;return e[0]=f*S,e[1]=(i*c-d*r)*S,e[2]=(a*r-i*o)*S,e[3]=m*S,e[4]=(d*n-i*l)*S,e[5]=(i*s-a*n)*S,e[6]=y*S,e[7]=(r*l-c*n)*S,e[8]=(o*n-r*s)*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,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+n,0,0,1),this}scale(e,n){return this.premultiply(XE.makeScale(e,n)),this}rotate(e){return this.premultiply(XE.makeRotation(-e)),this}translate(e,n){return this.premultiply(XE.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),r=Math.sin(e);return this.set(n,-r,0,r,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,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const XE=new Xt;function n6(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}const Ghe={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function $m(t,e){return new Ghe[t](e)}function I0(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function r6(){const t=I0("canvas");return t.style.display="block",t}const z3={};function X_(t){t in z3||(z3[t]=!0,console.warn(t))}function Whe(t,e,n){return new Promise(function(r,i){function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(s,n);break;default:r()}}setTimeout(s,n)})}function $he(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function Xhe(t){const e=t.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const B3=new Xt().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),H3=new Xt().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),py={[xi]:{transfer:T0,primaries:C0,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t,fromReference:t=>t},[ji]:{transfer:Jn,primaries:C0,luminanceCoefficients:[.2126,.7152,.0722],toReference:t=>t.convertSRGBToLinear(),fromReference:t=>t.convertLinearToSRGB()},[cx]:{transfer:T0,primaries:P0,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.applyMatrix3(H3),fromReference:t=>t.applyMatrix3(B3)},[YS]:{transfer:Jn,primaries:P0,luminanceCoefficients:[.2289,.6917,.0793],toReference:t=>t.convertSRGBToLinear().applyMatrix3(H3),fromReference:t=>t.applyMatrix3(B3).convertLinearToSRGB()}},qhe=new Set([xi,cx]),In={enabled:!0,_workingColorSpace:xi,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(t){if(!qhe.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 r=py[e].toReference,i=py[n].fromReference;return i(r(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 py[t].primaries},getTransfer:function(t){return t===Lc?T0:py[t].transfer},getLuminanceCoefficients:function(t,e=this._workingColorSpace){return t.fromArray(py[e].luminanceCoefficients)}};function ng(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function qE(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let hm;class i6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{hm===void 0&&(hm=I0("canvas")),hm.width=e.width,hm.height=e.height;const r=hm.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),n=hm}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=I0("canvas");n.width=e.width,n.height=e.height;const r=n.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),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==BS)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Pd:e.x=e.x-Math.floor(e.x);break;case wo:e.x=e.x<0?0:1;break;case Ng: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 Pd:e.y=e.y-Math.floor(e.y);break;case wo:e.y=e.y<0?0:1;break;case Ng: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)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}dr.DEFAULT_IMAGE=null;dr.DEFAULT_MAPPING=BS;dr.DEFAULT_ANISOTROPY=1;class Ln{constructor(e=0,n=0,r=0,i=1){Ln.prototype.isVector4=!0,this.x=e,this.y=n,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,n,r,i){return this.x=e,this.y=n,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,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,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*n+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*n+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*n+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*n+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 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,r,i,s;const l=e.elements,c=l[0],d=l[4],f=l[8],m=l[1],y=l[5],x=l[9],S=l[2],w=l[6],b=l[10];if(Math.abs(d-m)<.01&&Math.abs(f-S)<.01&&Math.abs(x-w)<.01){if(Math.abs(d+m)<.1&&Math.abs(f+S)<.1&&Math.abs(x+w)<.1&&Math.abs(c+y+b-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const T=(c+1)/2,C=(y+1)/2,O=(b+1)/2,N=(d+m)/4,D=(f+S)/4,F=(x+w)/4;return T>C&&T>O?T<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(T),i=N/r,s=D/r):C>O?C<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(C),r=N/i,s=F/i):O<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(O),r=D/s,i=F/s),this.set(r,i,s,n),this}let E=Math.sqrt((w-x)*(w-x)+(f-S)*(f-S)+(m-d)*(m-d));return Math.abs(E)<.001&&(E=1),this.x=(w-x)/E,this.y=(f-S)/E,this.z=(m-d)/E,this.w=Math.acos((c+y+b-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,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,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,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.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,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 s6 extends Bl{constructor(e=1,n=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=1,this.scissor=new Ln(0,0,e,n),this.scissorTest=!1,this.viewport=new Ln(0,0,e,n);const i={width:e,height:n,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Cr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new dr(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,T=1-b*b;if(T>Number.EPSILON){const O=Math.sqrt(T),N=Math.atan2(O,b*E);w=Math.sin(w*N)/O,a=Math.sin(a*N)/O}const C=a*E;if(l=l*w+m*C,c=c*w+y*C,d=d*w+x*C,f=f*w+S*C,w===1-a){const O=1/Math.sqrt(l*l+c*c+d*d+f*f);l*=O,c*=O,d*=O,f*=O}}e[n]=l,e[n+1]=c,e[n+2]=d,e[n+3]=f}static multiplyQuaternionsFlat(e,n,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],d=r[i+3],f=s[o],m=s[o+1],y=s[o+2],x=s[o+3];return e[n]=a*x+d*f+l*y-c*m,e[n+1]=l*x+d*m+c*f-a*y,e[n+2]=c*x+d*y+a*m-l*f,e[n+3]=d*x-a*f-l*m-c*y,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,r,i){return this._x=e,this._y=n,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,n=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),d=a(i/2),f=a(s/2),m=l(r/2),y=l(i/2),x=l(s/2);switch(o){case"XYZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"YXZ":this._x=m*d*f+c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"ZXY":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f-m*y*x;break;case"ZYX":this._x=m*d*f-c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f+m*y*x;break;case"YZX":this._x=m*d*f+c*y*x,this._y=c*y*f+m*d*x,this._z=c*d*x-m*y*f,this._w=c*d*f-m*y*x;break;case"XZY":this._x=m*d*f-c*y*x,this._y=c*y*f-m*d*x,this._z=c*d*x+m*y*f,this._w=c*d*f+m*y*x;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/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 n=e.elements,r=n[0],i=n[4],s=n[8],o=n[1],a=n[5],l=n[9],c=n[2],d=n[6],f=n[10],m=r+a+f;if(m>0){const y=.5/Math.sqrt(m+1);this._w=.25/y,this._x=(d-l)*y,this._y=(s-c)*y,this._z=(o-i)*y}else if(r>a&&r>f){const y=2*Math.sqrt(1+r-a-f);this._w=(d-l)/y,this._x=.25*y,this._y=(i+o)/y,this._z=(s+c)/y}else if(a>f){const y=2*Math.sqrt(1+a-r-f);this._w=(s-c)/y,this._x=(i+o)/y,this._y=.25*y,this._z=(l+d)/y}else{const y=2*Math.sqrt(1+f-r-a);this._w=(o-i)/y,this._x=(s+c)/y,this._y=(l+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+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*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=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ar(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/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,n){const r=e._x,i=e._y,s=e._z,o=e._w,a=n._x,l=n._y,c=n._z,d=n._w;return this._x=r*d+o*a+i*c-s*l,this._y=i*d+o*l+s*a-r*c,this._z=s*d+o*c+r*l-i*a,this._w=o*d-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,n){if(n===0)return this;if(n===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 y=1-n;return this._w=y*o+n*this._w,this._x=y*r+n*this._x,this._y=y*i+n*this._y,this._z=y*s+n*this._z,this.normalize(),this}const c=Math.sqrt(l),d=Math.atan2(c,a),f=Math.sin((1-n)*d)/c,m=Math.sin(n*d)/c;return this._w=o*f+this._w*m,this._x=r*f+this._x*m,this._y=i*f+this._y*m,this._z=s*f+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(n),s*Math.cos(n))}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 X{constructor(e=0,n=0,r=0){X.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,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,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(V3.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(V3.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[3]*r+s[6]*i,this.y=s[1]*n+s[4]*r+s[7]*i,this.z=s[2]*n+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*n+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*n+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*n+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*n+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),d=2*(a*n-s*i),f=2*(s*r-o*n);return this.x=n+l*c+o*f-a*d,this.y=r+l*d+a*c-s*f,this.z=i+l*f+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,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i,this.y=s[1]*n+s[5]*r+s[9]*i,this.z=s[2]*n+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,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 r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(n,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,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,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,s=e.z,o=n.x,a=n.y,l=n.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return YE.copy(this).projectOnVector(e),this.sub(YE)}reflect(e){return this.sub(YE.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 r=this.dot(e)/n;return Math.acos(Ar(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+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,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,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(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,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()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const YE=new X,V3=new qt;class os{constructor(e=new X(1/0,1/0,1/0),n=new X(-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,r=e.length;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Pa),Pa.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(my),Fb.subVectors(this.max,my),pm.subVectors(e.a,my),mm.subVectors(e.b,my),gm.subVectors(e.c,my),Xu.subVectors(mm,pm),qu.subVectors(gm,mm),Tf.subVectors(pm,gm);let n=[0,-Xu.z,Xu.y,0,-qu.z,qu.y,0,-Tf.z,Tf.y,Xu.z,0,-Xu.x,qu.z,0,-qu.x,Tf.z,0,-Tf.x,-Xu.y,Xu.x,0,-qu.y,qu.x,0,-Tf.y,Tf.x,0];return!ZE(n,pm,mm,gm,Fb)||(n=[1,0,0,0,1,0,0,0,1],!ZE(n,pm,mm,gm,Fb))?!1:(zb.crossVectors(Xu,qu),n=[zb.x,zb.y,zb.z],ZE(n,pm,mm,gm,Fb))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Pa).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Pa).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:(wc[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),wc[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),wc[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),wc[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),wc[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),wc[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),wc[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),wc[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(wc),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 wc=[new X,new X,new X,new X,new X,new X,new X,new X],Pa=new X,jb=new os,pm=new X,mm=new X,gm=new X,Xu=new X,qu=new X,Tf=new X,my=new X,Fb=new X,zb=new X,Cf=new X;function ZE(t,e,n,r,i){for(let s=0,o=t.length-3;s<=o;s+=3){Cf.fromArray(t,s);const a=i.x*Math.abs(Cf.x)+i.y*Math.abs(Cf.y)+i.z*Math.abs(Cf.z),l=e.dot(Cf),c=n.dot(Cf),d=r.dot(Cf);if(Math.max(-Math.max(l,c,d),Math.min(l,c,d))>a)return!1}return!0}const Jhe=new os,gy=new X,QE=new X;class Bi{constructor(e=new X,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 r=this.center;n!==void 0?r.copy(n):Jhe.setFromPoints(e).getCenter(r);let i=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;gy.subVectors(e,this.center);const n=gy.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(gy,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):(QE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(gy.copy(e.center).add(QE)),this.expandByPoint(gy.copy(e.center).sub(QE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Sc=new X,JE=new X,Bb=new X,Ku=new X,eA=new X,Hb=new X,tA=new X;class Jh{constructor(e=new X,n=new X(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,Sc)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=Sc.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(Sc.copy(this.origin).addScaledVector(this.direction,n),Sc.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){JE.copy(e).add(n).multiplyScalar(.5),Bb.copy(n).sub(e).normalize(),Ku.copy(this.origin).sub(JE);const s=e.distanceTo(n)*.5,o=-this.direction.dot(Bb),a=Ku.dot(this.direction),l=-Ku.dot(Bb),c=Ku.lengthSq(),d=Math.abs(1-o*o);let f,m,y,x;if(d>0)if(f=o*l-a,m=o*a-l,x=s*d,f>=0)if(m>=-x)if(m<=x){const S=1/d;f*=S,m*=S,y=f*(f+o*m+2*a)+m*(o*f+m+2*l)+c}else m=s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m=-s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;else m<=-x?(f=Math.max(0,-(-o*s+a)),m=f>0?-s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c):m<=x?(f=0,m=Math.min(Math.max(-s,-l),s),y=m*(m+2*l)+c):(f=Math.max(0,-(o*s+a)),m=f>0?s:Math.min(Math.max(-s,-l),s),y=-f*f+m*(m+2*l)+c);else m=o>0?-s:s,f=Math.max(0,-(o*m+a)),y=-f*f+m*(m+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(JE).addScaledVector(Bb,m),y}intersectSphere(e,n){Sc.subVectors(e.center,this.origin);const r=Sc.dot(this.direction),i=Sc.dot(Sc)-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,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 r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,s,o,a,l;const c=1/this.direction.x,d=1/this.direction.y,f=1/this.direction.z,m=this.origin;return c>=0?(r=(e.min.x-m.x)*c,i=(e.max.x-m.x)*c):(r=(e.max.x-m.x)*c,i=(e.min.x-m.x)*c),d>=0?(s=(e.min.y-m.y)*d,o=(e.max.y-m.y)*d):(s=(e.max.y-m.y)*d,o=(e.min.y-m.y)*d),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-m.z)*f,l=(e.max.z-m.z)*f):(a=(e.max.z-m.z)*f,l=(e.min.z-m.z)*f),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,Sc)!==null}intersectTriangle(e,n,r,i,s){eA.subVectors(n,e),Hb.subVectors(r,e),tA.crossVectors(eA,Hb);let o=this.direction.dot(tA),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ku.subVectors(this.origin,e);const l=a*this.direction.dot(Hb.crossVectors(Ku,Hb));if(l<0)return null;const c=a*this.direction.dot(eA.cross(Ku));if(c<0||l+c>o)return null;const d=-a*Ku.dot(tA);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 Ct{constructor(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,w){Ct.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,r,i,s,o,a,l,c,d,f,m,y,x,S,w)}set(e,n,r,i,s,o,a,l,c,d,f,m,y,x,S,w){const b=this.elements;return b[0]=e,b[4]=n,b[8]=r,b[12]=i,b[1]=s,b[5]=o,b[9]=a,b[13]=l,b[2]=c,b[6]=d,b[10]=f,b[14]=m,b[3]=y,b[7]=x,b[11]=S,b[15]=w,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 Ct().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[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,r){return e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){const n=this.elements,r=e.elements,i=1/vm.setFromMatrixColumn(e,0).length(),s=1/vm.setFromMatrixColumn(e,1).length(),o=1/vm.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*s,n[5]=r[5]*s,n[6]=r[6]*s,n[7]=0,n[8]=r[8]*o,n[9]=r[9]*o,n[10]=r[10]*o,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),d=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=-l*f,n[8]=c,n[1]=y+x*c,n[5]=m-S*c,n[9]=-a*l,n[2]=S-m*c,n[6]=x+y*c,n[10]=o*l}else if(e.order==="YXZ"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m+S*a,n[4]=x*a-y,n[8]=o*c,n[1]=o*f,n[5]=o*d,n[9]=-a,n[2]=y*a-x,n[6]=S+m*a,n[10]=o*l}else if(e.order==="ZXY"){const m=l*d,y=l*f,x=c*d,S=c*f;n[0]=m-S*a,n[4]=-o*f,n[8]=x+y*a,n[1]=y+x*a,n[5]=o*d,n[9]=S-m*a,n[2]=-o*c,n[6]=a,n[10]=o*l}else if(e.order==="ZYX"){const m=o*d,y=o*f,x=a*d,S=a*f;n[0]=l*d,n[4]=x*c-y,n[8]=m*c+S,n[1]=l*f,n[5]=S*c+m,n[9]=y*c-x,n[2]=-c,n[6]=a*l,n[10]=o*l}else if(e.order==="YZX"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=S-m*f,n[8]=x*f+y,n[1]=f,n[5]=o*d,n[9]=-a*d,n[2]=-c*d,n[6]=y*f+x,n[10]=m-S*f}else if(e.order==="XZY"){const m=o*l,y=o*c,x=a*l,S=a*c;n[0]=l*d,n[4]=-f,n[8]=c*d,n[1]=m*f+S,n[5]=o*d,n[9]=y*f-x,n[2]=x*f-y,n[6]=a*d,n[10]=S*f+m}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(epe,e,tpe)}lookAt(e,n,r){const i=this.elements;return ho.subVectors(e,n),ho.lengthSq()===0&&(ho.z=1),ho.normalize(),Yu.crossVectors(r,ho),Yu.lengthSq()===0&&(Math.abs(r.z)===1?ho.x+=1e-4:ho.z+=1e-4,ho.normalize(),Yu.crossVectors(r,ho)),Yu.normalize(),Vb.crossVectors(ho,Yu),i[0]=Yu.x,i[4]=Vb.x,i[8]=ho.x,i[1]=Yu.y,i[5]=Vb.y,i[9]=ho.y,i[2]=Yu.z,i[6]=Vb.z,i[10]=ho.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],d=r[1],f=r[5],m=r[9],y=r[13],x=r[2],S=r[6],w=r[10],b=r[14],E=r[3],T=r[7],C=r[11],O=r[15],N=i[0],D=i[4],F=i[8],V=i[12],k=i[1],j=i[5],H=i[9],ne=i[13],J=i[2],de=i[6],oe=i[10],he=i[14],B=i[3],K=i[7],q=i[11],$=i[15];return s[0]=o*N+a*k+l*J+c*B,s[4]=o*D+a*j+l*de+c*K,s[8]=o*F+a*H+l*oe+c*q,s[12]=o*V+a*ne+l*he+c*$,s[1]=d*N+f*k+m*J+y*B,s[5]=d*D+f*j+m*de+y*K,s[9]=d*F+f*H+m*oe+y*q,s[13]=d*V+f*ne+m*he+y*$,s[2]=x*N+S*k+w*J+b*B,s[6]=x*D+S*j+w*de+b*K,s[10]=x*F+S*H+w*oe+b*q,s[14]=x*V+S*ne+w*he+b*$,s[3]=E*N+T*k+C*J+O*B,s[7]=E*D+T*j+C*de+O*K,s[11]=E*F+T*H+C*oe+O*q,s[15]=E*V+T*ne+C*he+O*$,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],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],d=e[2],f=e[6],m=e[10],y=e[14],x=e[3],S=e[7],w=e[11],b=e[15];return x*(+s*l*f-i*c*f-s*a*m+r*c*m+i*a*y-r*l*y)+S*(+n*l*y-n*c*m+s*o*m-i*o*y+i*c*d-s*l*d)+w*(+n*c*f-n*a*y-s*o*f+r*o*y+s*a*d-r*c*d)+b*(-i*a*d-n*l*f+n*a*m+i*o*f-r*o*m+r*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,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]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],d=e[8],f=e[9],m=e[10],y=e[11],x=e[12],S=e[13],w=e[14],b=e[15],E=f*w*c-S*m*c+S*l*y-a*w*y-f*l*b+a*m*b,T=x*m*c-d*w*c-x*l*y+o*w*y+d*l*b-o*m*b,C=d*S*c-x*f*c+x*a*y-o*S*y-d*a*b+o*f*b,O=x*f*l-d*S*l-x*a*m+o*S*m+d*a*w-o*f*w,N=n*E+r*T+i*C+s*O;if(N===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/N;return e[0]=E*D,e[1]=(S*m*s-f*w*s-S*i*y+r*w*y+f*i*b-r*m*b)*D,e[2]=(a*w*s-S*l*s+S*i*c-r*w*c-a*i*b+r*l*b)*D,e[3]=(f*l*s-a*m*s-f*i*c+r*m*c+a*i*y-r*l*y)*D,e[4]=T*D,e[5]=(d*w*s-x*m*s+x*i*y-n*w*y-d*i*b+n*m*b)*D,e[6]=(x*l*s-o*w*s-x*i*c+n*w*c+o*i*b-n*l*b)*D,e[7]=(o*m*s-d*l*s+d*i*c-n*m*c-o*i*y+n*l*y)*D,e[8]=C*D,e[9]=(x*f*s-d*S*s-x*r*y+n*S*y+d*r*b-n*f*b)*D,e[10]=(o*S*s-x*a*s+x*r*c-n*S*c-o*r*b+n*a*b)*D,e[11]=(d*a*s-o*f*s-d*r*c+n*f*c+o*r*y-n*a*y)*D,e[12]=O*D,e[13]=(d*S*i-x*f*i+x*r*m-n*S*m-d*r*w+n*f*w)*D,e[14]=(x*a*i-o*S*i-x*r*l+n*S*l+o*r*w-n*a*w)*D,e[15]=(o*f*i-d*a*i+d*r*l-n*f*l-o*r*m+n*a*m)*D,this}scale(e){const n=this.elements,r=e.x,i=e.y,s=e.z;return n[0]*=r,n[4]*=i,n[8]*=s,n[1]*=r,n[5]*=i,n[9]*=s,n[2]*=r,n[6]*=i,n[10]*=s,n[3]*=r,n[7]*=i,n[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,n=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(n,r,i))}makeTranslation(e,n,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,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,d=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,d*a+r,d*l-i*o,0,c*l-i*a,d*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,s=n._x,o=n._y,a=n._z,l=n._w,c=s+s,d=o+o,f=a+a,m=s*c,y=s*d,x=s*f,S=o*d,w=o*f,b=a*f,E=l*c,T=l*d,C=l*f,O=r.x,N=r.y,D=r.z;return i[0]=(1-(S+b))*O,i[1]=(y+C)*O,i[2]=(x-T)*O,i[3]=0,i[4]=(y-C)*N,i[5]=(1-(m+b))*N,i[6]=(w+E)*N,i[7]=0,i[8]=(x+T)*D,i[9]=(w-E)*D,i[10]=(1-(m+S))*D,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;let s=vm.set(i[0],i[1],i[2]).length();const o=vm.set(i[4],i[5],i[6]).length(),a=vm.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],Ra.copy(this);const c=1/s,d=1/o,f=1/a;return Ra.elements[0]*=c,Ra.elements[1]*=c,Ra.elements[2]*=c,Ra.elements[4]*=d,Ra.elements[5]*=d,Ra.elements[6]*=d,Ra.elements[8]*=f,Ra.elements[9]*=f,Ra.elements[10]*=f,n.setFromRotationMatrix(Ra),r.x=s,r.y=o,r.z=a,this}makePerspective(e,n,r,i,s,o,a=Ml){const l=this.elements,c=2*s/(n-e),d=2*s/(r-i),f=(n+e)/(n-e),m=(r+i)/(r-i);let y,x;if(a===Ml)y=-(o+s)/(o-s),x=-2*o*s/(o-s);else if(a===N0)y=-o/(o-s),x=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=f,l[12]=0,l[1]=0,l[5]=d,l[9]=m,l[13]=0,l[2]=0,l[6]=0,l[10]=y,l[14]=x,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,n,r,i,s,o,a=Ml){const l=this.elements,c=1/(n-e),d=1/(r-i),f=1/(o-s),m=(n+e)*c,y=(r+i)*d;let x,S;if(a===Ml)x=(o+s)*f,S=-2*f;else if(a===N0)x=s*f,S=-1*f;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-m,l[1]=0,l[5]=2*d,l[9]=0,l[13]=-y,l[2]=0,l[6]=0,l[10]=S,l[14]=-x,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const vm=new X,Ra=new Ct,epe=new X(0,0,0),tpe=new X(1,1,1),Yu=new X,Vb=new X,ho=new X,G3=new Ct,W3=new qt;class as{constructor(e=0,n=0,r=0,i=as.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,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,n,r,i=this._order){return this._x=e,this._y=n,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,n=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],d=i[9],f=i[2],m=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Ar(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-d,y),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(m,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Ar(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(a,y),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Ar(m,-1,1)),Math.abs(m)<.9999999?(this._y=Math.atan2(-f,y),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Ar(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(m,y),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Ar(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-d,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,y));break;case"XZY":this._z=Math.asin(-Ar(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(m,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-d,y),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return G3.makeRotationFromQuaternion(e),this.setFromRotationMatrix(G3,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return W3.setFromEuler(this),this.setFromQuaternion(W3,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}}as.DEFAULT_ORDER="XYZ";class Ah{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let n=0;n1){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.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.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 c=0,d=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),d.length>0&&(r.images=d),f.length>0&&(r.shapes=f),m.length>0&&(r.skeletons=m),y.length>0&&(r.animations=y),x.length>0&&(r.nodes=x)}return r.object=i,r;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 r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,n,r,i,s){Na.subVectors(i,n),Ec.subVectors(r,n),rA.subVectors(e,n);const o=Na.dot(Na),a=Na.dot(Ec),l=Na.dot(rA),c=Ec.dot(Ec),d=Ec.dot(rA),f=o*c-a*a;if(f===0)return s.set(0,0,0),null;const m=1/f,y=(c*l-a*d)*m,x=(o*d-a*l)*m;return s.set(1-y-x,x,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,Ac)===null?!1:Ac.x>=0&&Ac.y>=0&&Ac.x+Ac.y<=1}static getInterpolation(e,n,r,i,s,o,a,l){return this.getBarycoord(e,n,r,i,Ac)===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,Ac.x),l.addScaledVector(o,Ac.y),l.addScaledVector(a,Ac.z),l)}static getInterpolatedAttribute(e,n,r,i,s,o){return aA.setScalar(0),lA.setScalar(0),cA.setScalar(0),aA.fromBufferAttribute(e,n),lA.fromBufferAttribute(e,r),cA.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(aA,s.x),o.addScaledVector(lA,s.y),o.addScaledVector(cA,s.z),o}static isFrontFacing(e,n,r,i){return Na.subVectors(r,n),Ec.subVectors(e,n),Na.cross(Ec).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),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 Na.subVectors(this.c,this.b),Ec.subVectors(this.a,this.b),Na.cross(Ec).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return qs.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return qs.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,s){return qs.getInterpolation(e,this.a,this.b,this.c,n,r,i,s)}containsPoint(e){return qs.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return qs.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,s=this.c;let o,a;bm.subVectors(i,r),_m.subVectors(s,r),iA.subVectors(e,r);const l=bm.dot(iA),c=_m.dot(iA);if(l<=0&&c<=0)return n.copy(r);sA.subVectors(e,i);const d=bm.dot(sA),f=_m.dot(sA);if(d>=0&&f<=d)return n.copy(i);const m=l*f-d*c;if(m<=0&&l>=0&&d<=0)return o=l/(l-d),n.copy(r).addScaledVector(bm,o);oA.subVectors(e,s);const y=bm.dot(oA),x=_m.dot(oA);if(x>=0&&y<=x)return n.copy(s);const S=y*c-l*x;if(S<=0&&c>=0&&x<=0)return a=c/(c-x),n.copy(r).addScaledVector(_m,a);const w=d*x-y*f;if(w<=0&&f-d>=0&&y-x>=0)return Z3.subVectors(s,i),a=(f-d)/(f-d+(y-x)),n.copy(i).addScaledVector(Z3,a);const b=1/(w+S+m);return o=S*b,a=m*b,n.copy(r).addScaledVector(bm,o).addScaledVector(_m,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const o6={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},Zu={h:0,s:0,l:0},Wb={h:0,s:0,l:0};function uA(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 ot{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===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,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=ji){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,In.toWorkingColorSpace(this,n),this}setRGB(e,n,r,i=In.workingColorSpace){return this.r=e,this.g=n,this.b=r,In.toWorkingColorSpace(this,i),this}setHSL(e,n,r,i=In.workingColorSpace){if(e=_R(e,1),n=Ar(n,0,1),r=Ar(r,0,1),n===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+n):r+n-r*n,o=2*r-s;this.r=uA(o,s,e+1/3),this.g=uA(o,s,e),this.b=uA(o,s,e-1/3)}return In.toWorkingColorSpace(this,i),this}setStyle(e,n=ji){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,n);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,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 r(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(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,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=ji){const r=o6[e.toLowerCase()];return r!==void 0?this.setHex(r,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=ng(e.r),this.g=ng(e.g),this.b=ng(e.b),this}copyLinearToSRGB(e){return this.r=qE(e.r),this.g=qE(e.g),this.b=qE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=ji){return In.fromWorkingColorSpace(Ji.copy(this),e),Math.round(Ar(Ji.r*255,0,255))*65536+Math.round(Ar(Ji.g*255,0,255))*256+Math.round(Ar(Ji.b*255,0,255))}getHexString(e=ji){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=In.workingColorSpace){In.fromWorkingColorSpace(Ji.copy(this),n);const r=Ji.r,i=Ji.g,s=Ji.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const d=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=d<=.5?f/(o+a):f/(2-o-a),o){case r:l=(i-s)/f+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){console.warn(`THREE.Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){console.warn(`THREE.Material: '${n}' 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[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(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!==void 0&&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.dispersion!==void 0&&(r.dispersion=this.dispersion),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.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),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!==Sh&&(r.blending=this.blending),this.side!==Dl&&(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!==Zw&&(r.blendSrc=this.blendSrc),this.blendDst!==Qw&&(r.blendDst=this.blendDst),this.blendEquation!==ud&&(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!==Uh&&(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!==GC&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Kf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Kf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Kf&&(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(n){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 n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=n[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++}onBuild(){console.warn("Material: onBuild() has been removed.")}}class As extends Gr{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ot(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.envMapRotation=new as,this.combine=ax,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.envMapRotation.copy(e.envMapRotation),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 Dc=ape();function ape(){const t=new ArrayBuffer(4),e=new Float32Array(t),n=new Uint32Array(t),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<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 c=l<<13,d=0;for(;(c&8388608)===0;)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:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function Ws(t){Math.abs(t)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),t=Ar(t,-65504,65504),Dc.floatView[0]=t;const e=Dc.uint32View[0],n=e>>23&511;return Dc.baseTable[n]+((e&8388607)>>Dc.shiftTable[n])}function Fy(t){const e=t>>10;return Dc.uint32View[0]=Dc.mantissaTable[Dc.offsetTable[e]+(t&1023)]+Dc.exponentTable[e],Dc.floatView[0]}const lpe={toHalfFloat:Ws,fromHalfFloat:Fy},Hr=new X,$b=new He;class Qt{constructor(e,n,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=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=R0,this.updateRanges=[],this.gpuType=Zs,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,s=this.itemSize;i0&&(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 r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],d=[];for(let f=0,m=c.length;f0&&(i[l]=d,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 n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(n));const i=e.attributes;for(const c in i){const d=i[c];this.setAttribute(c,d.clone(n))}const s=e.morphAttributes;for(const c in s){const d=[],f=s[c];for(let m=0,y=f.length;m0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(Q3.copy(s).invert(),Pf.copy(e.ray).applyMatrix4(Q3),!(r.boundingBox!==null&&Pf.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,Pf)))}_computeIntersections(e,n,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,d=s.attributes.uv1,f=s.attributes.normal,m=s.groups,y=s.drawRange;if(a!==null)if(Array.isArray(o))for(let x=0,S=m.length;xn.far?null:{distance:c,point:Qb.clone(),object:t}}function Jb(t,e,n,r,i,s,o,a,l,c){t.getVertexPosition(a,qb),t.getVertexPosition(l,Kb),t.getVertexPosition(c,Yb);const d=gpe(t,e,n,r,qb,Kb,Yb,eD);if(d){const f=new X;qs.getBarycoord(eD,qb,Kb,Yb,f),i&&(d.uv=qs.getInterpolatedAttribute(i,a,l,c,f,new He)),s&&(d.uv1=qs.getInterpolatedAttribute(s,a,l,c,f,new He)),o&&(d.normal=qs.getInterpolatedAttribute(o,a,l,c,f,new X),d.normal.dot(r.direction)>0&&d.normal.multiplyScalar(-1));const m={a,b:l,c,normal:new X,materialIndex:0};qs.getNormal(qb,Kb,Yb,m.normal),d.face=m,d.barycoord=f}return d}class ep extends Zt{constructor(e=1,n=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,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=[],c=[],d=[],f=[];let m=0,y=0;x("z","y","x",-1,-1,r,n,e,o,s,0),x("z","y","x",1,-1,r,n,-e,o,s,1),x("x","z","y",1,1,e,r,n,i,o,2),x("x","z","y",1,-1,e,r,-n,i,o,3),x("x","y","z",1,-1,e,n,r,i,s,4),x("x","y","z",-1,-1,e,n,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new kt(c,3)),this.setAttribute("normal",new kt(d,3)),this.setAttribute("uv",new kt(f,2));function x(S,w,b,E,T,C,O,N,D,F,V){const k=C/D,j=O/F,H=C/2,ne=O/2,J=N/2,de=D+1,oe=F+1;let he=0,B=0;const K=new X;for(let q=0;q0?1:-1,d.push(K.x,K.y,K.z),f.push(Z/D),f.push(1-q/F),he+=1}}for(let q=0;q0&&(n.defines=this.defines),n.vertexShader=this.vertexShader,n.fragmentShader=this.fragmentShader,n.lights=this.lights,n.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(n.extensions=r),n}}class ux extends mn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ct,this.projectionMatrix=new Ct,this.projectionMatrixInverse=new Ct,this.coordinateSystem=Ml}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 Qu=new X,tD=new He,nD=new He;class Tr extends ux{constructor(e=50,n=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=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=Lg*2*Math.atan(n),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Eh*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Lg*2*Math.atan(Math.tan(Eh*.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,r){Qu.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z),Qu.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Qu.x,Qu.y).multiplyScalar(-e/Qu.z)}getViewSize(e,n){return this.getViewBounds(e,tD,nD),n.subVectors(nD,tD)}setViewOffset(e,n,r,i,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=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 n=e*Math.tan(Eh*.5*this.fov)/this.zoom,r=2*n,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,n-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,n,n-r,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 Sm=-90,Mm=1;class l6 extends mn{constructor(e,n,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Tr(Sm,Mm,e,n);i.layers=this.layers,this.add(i);const s=new Tr(Sm,Mm,e,n);s.layers=this.layers,this.add(s);const o=new Tr(Sm,Mm,e,n);o.layers=this.layers,this.add(o);const a=new Tr(Sm,Mm,e,n);a.layers=this.layers,this.add(a);const l=new Tr(Sm,Mm,e,n);l.layers=this.layers,this.add(l);const c=new Tr(Sm,Mm,e,n);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,n=this.children.concat(),[r,i,s,o,a,l]=n;for(const c of n)this.remove(c);if(e===Ml)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===N0)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 c of n)this.add(c),c.updateMatrixWorld()}update(e,n){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,c,d]=this.children,f=e.getRenderTarget(),m=e.getActiveCubeFace(),y=e.getActiveMipmapLevel(),x=e.xr.enabled;e.xr.enabled=!1;const S=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(n,s),e.setRenderTarget(r,1,i),e.render(n,o),e.setRenderTarget(r,2,i),e.render(n,a),e.setRenderTarget(r,3,i),e.render(n,l),e.setRenderTarget(r,4,i),e.render(n,c),r.texture.generateMipmaps=S,e.setRenderTarget(r,5,i),e.render(n,d),e.setRenderTarget(f,m,y),e.xr.enabled=x,r.texture.needsPMREMUpdate=!0}}class dx extends dr{constructor(e,n,r,i,s,o,a,l,c,d){e=e!==void 0?e:[],n=n!==void 0?n:Jc,super(e,n,r,i,s,o,a,l,c,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class c6 extends Ha{constructor(e=1,n={}){super(e,e,n),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new dx(i,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:Cr}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 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 ep(5,5,5),s=new Qo({name:"CubemapFromEquirect",uniforms:Dg(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:ss,blending:Wc});s.uniforms.tEquirect.value=n;const o=new yr(i,s),a=n.minFilter;return n.minFilter===qo&&(n.minFilter=Cr),new l6(1,10,this).update(e,o),n.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,n,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(n,r,i);e.setRenderTarget(s)}}const hA=new X,bpe=new X,_pe=new Xt;class Nc{constructor(e=new X(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,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=hA.subVectors(r,n).cross(bpe.subVectors(e,n)).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,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(hA),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:n.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<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 r=n||_pe.getNormalMatrix(e),i=this.coplanarPoint(hA).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 Rf=new Bi,e_=new X;class fx{constructor(e=new Nc,n=new Nc,r=new Nc,i=new Nc,s=new Nc,o=new Nc){this.planes=[e,n,r,i,s,o]}set(e,n,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(n),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ml){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],d=i[5],f=i[6],m=i[7],y=i[8],x=i[9],S=i[10],w=i[11],b=i[12],E=i[13],T=i[14],C=i[15];if(r[0].setComponents(l-s,m-c,w-y,C-b).normalize(),r[1].setComponents(l+s,m+c,w+y,C+b).normalize(),r[2].setComponents(l+o,m+d,w+x,C+E).normalize(),r[3].setComponents(l-o,m-d,w-x,C-E).normalize(),r[4].setComponents(l-a,m-f,w-S,C-T).normalize(),n===Ml)r[5].setComponents(l+a,m+f,w+S,C+T).normalize();else if(n===N0)r[5].setComponents(a,f,S,T).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(),Rf.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),Rf.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Rf)}intersectsSprite(e){return Rf.center.set(0,0,0),Rf.radius=.7071067811865476,Rf.applyMatrix4(e.matrixWorld),this.intersectsSphere(Rf)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(n[s].distanceToPoint(r)0?e.max.x:e.min.x,e_.y=i.normal.y>0?e.max.y:e.min.y,e_.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(e_)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function u6(){let t=null,e=!1,n=null,r=null;function i(s,o){n(s,o),r=t.requestAnimationFrame(i)}return{start:function(){e!==!0&&n!==null&&(r=t.requestAnimationFrame(i),e=!0)},stop:function(){t.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){n=s},setContext:function(s){t=s}}}function wpe(t){const e=new WeakMap;function n(a,l){const c=a.array,d=a.usage,f=c.byteLength,m=t.createBuffer();t.bindBuffer(l,m),t.bufferData(l,c,d),a.onUploadCallback();let y;if(c instanceof Float32Array)y=t.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?y=t.HALF_FLOAT:y=t.UNSIGNED_SHORT;else if(c instanceof Int16Array)y=t.SHORT;else if(c instanceof Uint32Array)y=t.UNSIGNED_INT;else if(c instanceof Int32Array)y=t.INT;else if(c instanceof Int8Array)y=t.BYTE;else if(c instanceof Uint8Array)y=t.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)y=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:m,type:y,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:f}}function r(a,l,c){const d=l.array,f=l.updateRanges;if(t.bindBuffer(c,a),f.length===0)t.bufferSubData(c,0,d);else{f.sort((y,x)=>y.start-x.start);let m=0;for(let y=1;y 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`,Fpe=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,zpe=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,Bpe=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,Hpe=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,Vpe=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,Gpe=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,Wpe=`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,$pe=`#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; +} +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`,Xpe=`#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`,qpe=`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`,Kpe=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,Ype=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,Zpe=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,Qpe=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,Jpe="gl_FragColor = linearToOutputTexel( gl_FragColor );",eme=` +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 ); +}`,tme=`#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, envMapRotation * 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`,nme=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,rme=`#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`,ime=`#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`,sme=`#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`,ome=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,ame=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,lme=`#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`,cme=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,ume=`#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 +}`,dme=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,fme=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,hme=`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`,pme=`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 ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +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`,mme=`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * 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, envMapRotation * 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`,gme=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,vme=`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`,yme=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,xme=`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`,bme=`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_DISPERSION + material.dispersion = dispersion; +#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`,_me=`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #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 ); +}`,wme=` +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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, 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`,Sme=`#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`,Mme=`#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`,Eme=`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,Ame=`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,Tme=`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,Cme=`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,Pme=`#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`,Rme=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,Nme=`#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`,Ime=`#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`,kme=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,Ome=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,Lme=`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,Dme=`#if defined( USE_MORPHCOLORS ) + 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`,Ume=`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,jme=`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + 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 ); + } +#endif`,Fme=`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,zme=`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;`,Bme=`#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`,Hme=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,Vme=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,Gme=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,Wme=`#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`,$me=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,Xme=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,qme=`#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`,Kme=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,Yme=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Zme=`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 float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in 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( const in 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 ); +}`,Qme=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,Jme=`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;`,ege=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,tge=`#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`,nge=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,rge=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,ige=`#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 shadowIntensity; + 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 shadowIntensity; + 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 shadowIntensity; + 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 shadowIntensity, 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 mix( 1.0, shadow, shadowIntensity ); + } + 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 shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + 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 + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,sge=`#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 shadowIntensity; + 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 shadowIntensity; + 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 shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,oge=`#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`,age=`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.shadowIntensity, 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.shadowIntensity, 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.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,lge=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,cge=`#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`,uge=`#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`,dge=`#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`,fge=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,hge=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,pge=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,mge=`#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 CineonToneMapping( 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 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,gge=`#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.dispersion, 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`,vge=`#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 dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], 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 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + + #else + + 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; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + + #endif + 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`,yge=`#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`,xge=`#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`,bge=`#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`,_ge=`#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 wge=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,Sge=`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 +}`,Mge=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,Ege=`#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; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,Age=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,Tge=`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 +}`,Cge=`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,Pge=`#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 ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,Rge=`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,Nge=`#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 ); +}`,Ige=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,kge=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,Oge=`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 + #include +}`,Lge=`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 +}`,Dge=`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #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 +}`,Uge=`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 +}`,jge=`#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 + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Fge=`#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 +}`,zge=`#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 + #include + vViewPosition = - mvPosition.xyz; +}`,Bge=`#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 +}`,Hge=`#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 + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,Vge=`#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 +}`,Gge=`#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 + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,Wge=`#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 +}`,$ge=`#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 + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,Xge=`#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_DISPERSION + uniform float dispersion; +#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 +}`,qge=`#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 + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,Kge=`#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 +}`,Yge=`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 + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,Zge=`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 +}`,Qge=`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,Jge=`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 +}`,eve=`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #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 +}`,tve=`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 +}`,hn={alphahash_fragment:Spe,alphahash_pars_fragment:Mpe,alphamap_fragment:Epe,alphamap_pars_fragment:Ape,alphatest_fragment:Tpe,alphatest_pars_fragment:Cpe,aomap_fragment:Ppe,aomap_pars_fragment:Rpe,batching_pars_vertex:Npe,batching_vertex:Ipe,begin_vertex:kpe,beginnormal_vertex:Ope,bsdfs:Lpe,iridescence_fragment:Dpe,bumpmap_pars_fragment:Upe,clipping_planes_fragment:jpe,clipping_planes_pars_fragment:Fpe,clipping_planes_pars_vertex:zpe,clipping_planes_vertex:Bpe,color_fragment:Hpe,color_pars_fragment:Vpe,color_pars_vertex:Gpe,color_vertex:Wpe,common:$pe,cube_uv_reflection_fragment:Xpe,defaultnormal_vertex:qpe,displacementmap_pars_vertex:Kpe,displacementmap_vertex:Ype,emissivemap_fragment:Zpe,emissivemap_pars_fragment:Qpe,colorspace_fragment:Jpe,colorspace_pars_fragment:eme,envmap_fragment:tme,envmap_common_pars_fragment:nme,envmap_pars_fragment:rme,envmap_pars_vertex:ime,envmap_physical_pars_fragment:mme,envmap_vertex:sme,fog_vertex:ome,fog_pars_vertex:ame,fog_fragment:lme,fog_pars_fragment:cme,gradientmap_pars_fragment:ume,lightmap_pars_fragment:dme,lights_lambert_fragment:fme,lights_lambert_pars_fragment:hme,lights_pars_begin:pme,lights_toon_fragment:gme,lights_toon_pars_fragment:vme,lights_phong_fragment:yme,lights_phong_pars_fragment:xme,lights_physical_fragment:bme,lights_physical_pars_fragment:_me,lights_fragment_begin:wme,lights_fragment_maps:Sme,lights_fragment_end:Mme,logdepthbuf_fragment:Eme,logdepthbuf_pars_fragment:Ame,logdepthbuf_pars_vertex:Tme,logdepthbuf_vertex:Cme,map_fragment:Pme,map_pars_fragment:Rme,map_particle_fragment:Nme,map_particle_pars_fragment:Ime,metalnessmap_fragment:kme,metalnessmap_pars_fragment:Ome,morphinstance_vertex:Lme,morphcolor_vertex:Dme,morphnormal_vertex:Ume,morphtarget_pars_vertex:jme,morphtarget_vertex:Fme,normal_fragment_begin:zme,normal_fragment_maps:Bme,normal_pars_fragment:Hme,normal_pars_vertex:Vme,normal_vertex:Gme,normalmap_pars_fragment:Wme,clearcoat_normal_fragment_begin:$me,clearcoat_normal_fragment_maps:Xme,clearcoat_pars_fragment:qme,iridescence_pars_fragment:Kme,opaque_fragment:Yme,packing:Zme,premultiplied_alpha_fragment:Qme,project_vertex:Jme,dithering_fragment:ege,dithering_pars_fragment:tge,roughnessmap_fragment:nge,roughnessmap_pars_fragment:rge,shadowmap_pars_fragment:ige,shadowmap_pars_vertex:sge,shadowmap_vertex:oge,shadowmask_pars_fragment:age,skinbase_vertex:lge,skinning_pars_vertex:cge,skinning_vertex:uge,skinnormal_vertex:dge,specularmap_fragment:fge,specularmap_pars_fragment:hge,tonemapping_fragment:pge,tonemapping_pars_fragment:mge,transmission_fragment:gge,transmission_pars_fragment:vge,uv_pars_fragment:yge,uv_pars_vertex:xge,uv_vertex:bge,worldpos_vertex:_ge,background_vert:wge,background_frag:Sge,backgroundCube_vert:Mge,backgroundCube_frag:Ege,cube_vert:Age,cube_frag:Tge,depth_vert:Cge,depth_frag:Pge,distanceRGBA_vert:Rge,distanceRGBA_frag:Nge,equirect_vert:Ige,equirect_frag:kge,linedashed_vert:Oge,linedashed_frag:Lge,meshbasic_vert:Dge,meshbasic_frag:Uge,meshlambert_vert:jge,meshlambert_frag:Fge,meshmatcap_vert:zge,meshmatcap_frag:Bge,meshnormal_vert:Hge,meshnormal_frag:Vge,meshphong_vert:Gge,meshphong_frag:Wge,meshphysical_vert:$ge,meshphysical_frag:Xge,meshtoon_vert:qge,meshtoon_frag:Kge,points_vert:Yge,points_frag:Zge,shadow_vert:Qge,shadow_frag:Jge,sprite_vert:eve,sprite_frag:tve},ht={common:{diffuse:{value:new ot(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Xt}},envmap:{envMap:{value:null},envMapRotation:{value:new Xt},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Xt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Xt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Xt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Xt},normalScale:{value:new He(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Xt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Xt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Xt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Xt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ot(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,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 ot(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0},uvTransform:{value:new Xt}},sprite:{diffuse:{value:new ot(16777215)},opacity:{value:1},center:{value:new He(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Xt},alphaMap:{value:null},alphaMapTransform:{value:new Xt},alphaTest:{value:0}}},La={basic:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.fog]),vertexShader:hn.meshbasic_vert,fragmentShader:hn.meshbasic_frag},lambert:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ot(0)}}]),vertexShader:hn.meshlambert_vert,fragmentShader:hn.meshlambert_frag},phong:{uniforms:_s([ht.common,ht.specularmap,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,ht.lights,{emissive:{value:new ot(0)},specular:{value:new ot(1118481)},shininess:{value:30}}]),vertexShader:hn.meshphong_vert,fragmentShader:hn.meshphong_frag},standard:{uniforms:_s([ht.common,ht.envmap,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.roughnessmap,ht.metalnessmap,ht.fog,ht.lights,{emissive:{value:new ot(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag},toon:{uniforms:_s([ht.common,ht.aomap,ht.lightmap,ht.emissivemap,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.gradientmap,ht.fog,ht.lights,{emissive:{value:new ot(0)}}]),vertexShader:hn.meshtoon_vert,fragmentShader:hn.meshtoon_frag},matcap:{uniforms:_s([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,ht.fog,{matcap:{value:null}}]),vertexShader:hn.meshmatcap_vert,fragmentShader:hn.meshmatcap_frag},points:{uniforms:_s([ht.points,ht.fog]),vertexShader:hn.points_vert,fragmentShader:hn.points_frag},dashed:{uniforms:_s([ht.common,ht.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hn.linedashed_vert,fragmentShader:hn.linedashed_frag},depth:{uniforms:_s([ht.common,ht.displacementmap]),vertexShader:hn.depth_vert,fragmentShader:hn.depth_frag},normal:{uniforms:_s([ht.common,ht.bumpmap,ht.normalmap,ht.displacementmap,{opacity:{value:1}}]),vertexShader:hn.meshnormal_vert,fragmentShader:hn.meshnormal_frag},sprite:{uniforms:_s([ht.sprite,ht.fog]),vertexShader:hn.sprite_vert,fragmentShader:hn.sprite_frag},background:{uniforms:{uvTransform:{value:new Xt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hn.background_vert,fragmentShader:hn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Xt}},vertexShader:hn.backgroundCube_vert,fragmentShader:hn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hn.cube_vert,fragmentShader:hn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hn.equirect_vert,fragmentShader:hn.equirect_frag},distanceRGBA:{uniforms:_s([ht.common,ht.displacementmap,{referencePosition:{value:new X},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hn.distanceRGBA_vert,fragmentShader:hn.distanceRGBA_frag},shadow:{uniforms:_s([ht.lights,ht.fog,{color:{value:new ot(0)},opacity:{value:1}}]),vertexShader:hn.shadow_vert,fragmentShader:hn.shadow_frag}};La.physical={uniforms:_s([La.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Xt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Xt},clearcoatNormalScale:{value:new He(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Xt},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Xt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Xt},sheen:{value:0},sheenColor:{value:new ot(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Xt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Xt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Xt},transmissionSamplerSize:{value:new He},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Xt},attenuationDistance:{value:0},attenuationColor:{value:new ot(0)},specularColor:{value:new ot(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Xt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Xt},anisotropyVector:{value:new He},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Xt}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag};const t_={r:0,b:0,g:0},Nf=new as,nve=new Ct;function rve(t,e,n,r,i,s,o){const a=new ot(0);let l=s===!0?0:1,c,d,f=null,m=0,y=null;function x(E){let T=E.isScene===!0?E.background:null;return T&&T.isTexture&&(T=(E.backgroundBlurriness>0?n:e).get(T)),T}function S(E){let T=!1;const C=x(E);C===null?b(a,l):C&&C.isColor&&(b(C,1),T=!0);const O=t.xr.getEnvironmentBlendMode();O==="additive"?r.buffers.color.setClear(0,0,0,1,o):O==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(t.autoClear||T)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function w(E,T){const C=x(T);C&&(C.isCubeTexture||C.mapping===ev)?(d===void 0&&(d=new yr(new ep(1,1,1),new Qo({name:"BackgroundCubeMaterial",uniforms:Dg(La.backgroundCube.uniforms),vertexShader:La.backgroundCube.vertexShader,fragmentShader:La.backgroundCube.fragmentShader,side:ss,depthTest:!1,depthWrite:!1,fog:!1})),d.geometry.deleteAttribute("normal"),d.geometry.deleteAttribute("uv"),d.onBeforeRender=function(O,N,D){this.matrixWorld.copyPosition(D.matrixWorld)},Object.defineProperty(d.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(d)),Nf.copy(T.backgroundRotation),Nf.x*=-1,Nf.y*=-1,Nf.z*=-1,C.isCubeTexture&&C.isRenderTargetTexture===!1&&(Nf.y*=-1,Nf.z*=-1),d.material.uniforms.envMap.value=C,d.material.uniforms.flipEnvMap.value=C.isCubeTexture&&C.isRenderTargetTexture===!1?-1:1,d.material.uniforms.backgroundBlurriness.value=T.backgroundBlurriness,d.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,d.material.uniforms.backgroundRotation.value.setFromMatrix4(nve.makeRotationFromEuler(Nf)),d.material.toneMapped=In.getTransfer(C.colorSpace)!==Jn,(f!==C||m!==C.version||y!==t.toneMapping)&&(d.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),d.layers.enableAll(),E.unshift(d,d.geometry,d.material,0,0,null)):C&&C.isTexture&&(c===void 0&&(c=new yr(new nv(2,2),new Qo({name:"BackgroundMaterial",uniforms:Dg(La.background.uniforms),vertexShader:La.background.vertexShader,fragmentShader:La.background.fragmentShader,side:Dl,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=C,c.material.uniforms.backgroundIntensity.value=T.backgroundIntensity,c.material.toneMapped=In.getTransfer(C.colorSpace)!==Jn,C.matrixAutoUpdate===!0&&C.updateMatrix(),c.material.uniforms.uvTransform.value.copy(C.matrix),(f!==C||m!==C.version||y!==t.toneMapping)&&(c.material.needsUpdate=!0,f=C,m=C.version,y=t.toneMapping),c.layers.enableAll(),E.unshift(c,c.geometry,c.material,0,0,null))}function b(E,T){E.getRGB(t_,a6(t)),r.buffers.color.setClear(t_.r,t_.g,t_.b,T,o)}return{getClearColor:function(){return a},setClearColor:function(E,T=1){a.set(E),l=T,b(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(E){l=E,b(a,l)},render:S,addToRenderList:w}}function ive(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),r={},i=m(null);let s=i,o=!1;function a(k,j,H,ne,J){let de=!1;const oe=f(ne,H,j);s!==oe&&(s=oe,c(s.object)),de=y(k,ne,H,J),de&&x(k,ne,H,J),J!==null&&e.update(J,t.ELEMENT_ARRAY_BUFFER),(de||o)&&(o=!1,C(k,j,H,ne),J!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(J).buffer))}function l(){return t.createVertexArray()}function c(k){return t.bindVertexArray(k)}function d(k){return t.deleteVertexArray(k)}function f(k,j,H){const ne=H.wireframe===!0;let J=r[k.id];J===void 0&&(J={},r[k.id]=J);let de=J[j.id];de===void 0&&(de={},J[j.id]=de);let oe=de[ne];return oe===void 0&&(oe=m(l()),de[ne]=oe),oe}function m(k){const j=[],H=[],ne=[];for(let J=0;J=0){const q=J[B];let $=de[B];if($===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&($=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&($=k.instanceColor)),q===void 0||q.attribute!==$||$&&q.data!==$.data)return!0;oe++}return s.attributesNum!==oe||s.index!==ne}function x(k,j,H,ne){const J={},de=j.attributes;let oe=0;const he=H.getAttributes();for(const B in he)if(he[B].location>=0){let q=de[B];q===void 0&&(B==="instanceMatrix"&&k.instanceMatrix&&(q=k.instanceMatrix),B==="instanceColor"&&k.instanceColor&&(q=k.instanceColor));const $={};$.attribute=q,q&&q.data&&($.data=q.data),J[B]=$,oe++}s.attributes=J,s.attributesNum=oe,s.index=ne}function S(){const k=s.newAttributes;for(let j=0,H=k.length;j=0){let K=J[he];if(K===void 0&&(he==="instanceMatrix"&&k.instanceMatrix&&(K=k.instanceMatrix),he==="instanceColor"&&k.instanceColor&&(K=k.instanceColor)),K!==void 0){const q=K.normalized,$=K.itemSize,Z=e.get(K);if(Z===void 0)continue;const ge=Z.buffer,ae=Z.type,ce=Z.bytesPerElement,we=ae===t.INT||ae===t.UNSIGNED_INT||K.gpuType===VS;if(K.isInterleavedBufferAttribute){const Me=K.data,$e=Me.stride,Se=K.offset;if(Me.isInstancedInterleavedBuffer){for(let Ve=0;Ve0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";D="mediump"}return D==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=n.precision!==void 0?n.precision:"highp";const d=l(c);d!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",d,"instead."),c=d);const f=n.logarithmicDepthBuffer===!0,m=n.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(m===!0){const D=e.get("EXT_clip_control");D.clipControlEXT(D.LOWER_LEFT_EXT,D.ZERO_TO_ONE_EXT)}const y=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),x=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),S=t.getParameter(t.MAX_TEXTURE_SIZE),w=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),b=t.getParameter(t.MAX_VERTEX_ATTRIBS),E=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),T=t.getParameter(t.MAX_VARYING_VECTORS),C=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),O=x>0,N=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:f,reverseDepthBuffer:m,maxTextures:y,maxVertexTextures:x,maxTextureSize:S,maxCubemapSize:w,maxAttributes:b,maxVertexUniforms:E,maxVaryings:T,maxFragmentUniforms:C,vertexTextures:O,maxSamples:N}}function ave(t){const e=this;let n=null,r=0,i=!1,s=!1;const o=new Nc,a=new Xt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,m){const y=f.length!==0||m||r!==0||i;return i=m,r=f.length,y},this.beginShadows=function(){s=!0,d(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,m){n=d(f,m,0)},this.setState=function(f,m,y){const x=f.clippingPlanes,S=f.clipIntersection,w=f.clipShadows,b=t.get(f);if(!i||x===null||x.length===0||s&&!w)s?d(null):c();else{const E=s?0:r,T=E*4;let C=b.clippingState||null;l.value=C,C=d(x,m,T,y);for(let O=0;O!==T;++O)C[O]=n[O];b.clippingState=C,this.numIntersection=S?this.numPlanes:0,this.numPlanes+=E}};function c(){l.value!==n&&(l.value=n,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function d(f,m,y,x){const S=f!==null?f.length:0;let w=null;if(S!==0){if(w=l.value,x!==!0||w===null){const b=y+S*4,E=m.matrixWorldInverse;a.getNormalMatrix(E),(w===null||w.length0){const c=new c6(l.height);return c.fromEquirectangularTexture(t,o),e.set(o,c),o.addEventListener("dispose",i),n(c.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 $c extends ux{constructor(e=-1,n=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=n,this.top=r,this.bottom=i,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,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=n,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),n=(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+n,l=i-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 Xm=4,rD=[.125,.215,.35,.446,.526,.582],Zf=20,pA=new $c,iD=new ot;let mA=null,gA=0,vA=0,yA=!1;const Yf=(1+Math.sqrt(5))/2,Em=1/Yf,sD=[new X(-Yf,Em,0),new X(Yf,Em,0),new X(-Em,0,Yf),new X(Em,0,Yf),new X(0,Yf,-Em),new X(0,Yf,Em),new X(-1,1,-1),new X(1,1,-1),new X(-1,1,1),new X(1,1,1)];class $C{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,r=.1,i=100){mA=this._renderer.getRenderTarget(),gA=this._renderer.getActiveCubeFace(),vA=this._renderer.getActiveMipmapLevel(),yA=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,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=lD(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=aD(),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?T:0,T,T),d.setRenderTarget(i),S&&d.render(x,a),d.render(e,a)}x.geometry.dispose(),x.material.dispose(),d.toneMapping=m,d.autoClear=f,e.background=w}_textureToCubeUV(e,n){const r=this._renderer,i=e.mapping===Jc||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=lD()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=aD());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new yr(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;n_(n,0,0,3*l,2*l),r.setRenderTarget(n),r.render(o,pA)}_applyPMREM(e){const n=this._renderer,r=n.autoClear;n.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sZf&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${w} samples when the maximum is set to ${Zf}`);const b=[];let E=0;for(let D=0;DT-Xm?i-T+Xm:0),N=4*(this._cubeSize-C);n_(n,O,N,3*C,2*C),l.setRenderTarget(n),l.render(f,pA)}}function cve(t){const e=[],n=[],r=[];let i=t;const s=t-Xm+1+rD.length;for(let o=0;ot-Xm?l=rD[o-t+Xm-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),d=-c,f=1+c,m=[d,d,f,d,f,f,d,d,f,f,d,f],y=6,x=6,S=3,w=2,b=1,E=new Float32Array(S*x*y),T=new Float32Array(w*x*y),C=new Float32Array(b*x*y);for(let N=0;N2?0:-1,V=[D,F,0,D+2/3,F,0,D+2/3,F+1,0,D,F,0,D+2/3,F+1,0,D,F+1,0];E.set(V,S*x*N),T.set(m,w*x*N);const k=[N,N,N,N,N,N];C.set(k,b*x*N)}const O=new Zt;O.setAttribute("position",new Qt(E,S)),O.setAttribute("uv",new Qt(T,w)),O.setAttribute("faceIndex",new Qt(C,b)),e.push(O),i>Xm&&i--}return{lodPlanes:e,sizeLods:n,sigmas:r}}function oD(t,e,n){const r=new Ha(t,e,n);return r.texture.mapping=ev,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function n_(t,e,n,r,i){t.viewport.set(e,n,r,i),t.scissor.set(e,n,r,i)}function uve(t,e,n){const r=new Float32Array(Zf),i=new X(0,1,0);return new Qo({name:"SphericalGaussianBlur",defines:{n:Zf,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:AR(),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:Wc,depthTest:!1,depthWrite:!1})}function aD(){return new Qo({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:AR(),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:Wc,depthTest:!1,depthWrite:!1})}function lD(){return new Qo({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:AR(),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:Wc,depthTest:!1,depthWrite:!1})}function AR(){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 dve(t){let e=new WeakMap,n=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===M0||l===E0,d=l===Jc||l===Cd;if(c||d){let f=e.get(a);const m=f!==void 0?f.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==m)return n===null&&(n=new $C(t)),f=c?n.fromEquirectangular(a,f):n.fromCubemap(a,f),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),f.texture;if(f!==void 0)return f.texture;{const y=a.image;return c&&y&&y.height>0||d&&y&&i(y)?(n===null&&(n=new $C(t)),f=c?n.fromEquirectangular(a):n.fromCubemap(a),f.texture.pmremVersion=a.pmremVersion,e.set(a,f),a.addEventListener("dispose",s),f.texture):null}}}return a}function i(a){let l=0;const c=6;for(let d=0;de.maxTextureSize&&(O=Math.ceil(C/e.maxTextureSize),C=e.maxTextureSize);const N=new Float32Array(C*O*4*f),D=new ZS(N,C,O,f);D.type=Zs,D.needsUpdate=!0;const F=T*4;for(let k=0;k0)return t;const i=e*n;let s=uD[i];if(s===void 0&&(s=new Float32Array(i),uD[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=n,t[o].toArray(s,a)}return s}function ii(t,e){if(t.length!==e.length)return!1;for(let n=0,r=t.length;n":" "} ${a}: ${n[o]}`)}return r.join(` +`)}function dye(t){const e=In.getPrimaries(In.workingColorSpace),n=In.getPrimaries(t);let r;switch(e===n?r="":e===P0&&n===C0?r="LinearDisplayP3ToLinearSRGB":e===C0&&n===P0&&(r="LinearSRGBToLinearDisplayP3"),t){case xi:case cx:return[r,"LinearTransferOETF"];case ji:case YS:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[r,"LinearTransferOETF"]}}function vD(t,e,n){const r=t.getShaderParameter(e,t.COMPILE_STATUS),i=t.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return n.toUpperCase()+` + +`+i+` + +`+uye(t.getShaderSource(e),o)}else return i}function fye(t,e){const n=dye(e);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}function hye(t,e){let n;switch(e){case OV:n="Linear";break;case LV:n="Reinhard";break;case DV:n="Cineon";break;case lR:n="ACESFilmic";break;case jV:n="AgX";break;case FV:n="Neutral";break;case UV:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const r_=new X;function pye(){In.getLuminanceCoefficients(r_);const t=r_.x.toFixed(4),e=r_.y.toFixed(4),n=r_.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${t}, ${e}, ${n} );`," return dot( weights, rgb );","}"].join(` +`)}function mye(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(zy).join(` +`)}function gye(t){const e=[];for(const n in t){const r=t[n];r!==!1&&e.push("#define "+n+" "+r)}return e.join(` +`)}function vye(t,e){const n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function XC(t){return t.replace(yye,bye)}const xye=new Map;function bye(t,e){let n=hn[e];if(n===void 0){const r=xye.get(e);if(r!==void 0)n=hn[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 XC(n)}const _ye=/#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 bD(t){return t.replace(_ye,wye)}function wye(t,e,n,r){let i="";for(let s=parseInt(e);s0&&(w+=` +`),b=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x].filter(zy).join(` +`),b.length>0&&(b+=` +`)):(w=[_D(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",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?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#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.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","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","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#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","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(zy).join(` +`),b=[_D(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,x,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 "+f:"",m?"#define CUBEUV_TEXEL_WIDTH "+m.texelWidth:"",m?"#define CUBEUV_TEXEL_HEIGHT "+m.texelHeight:"",m?"#define CUBEUV_MAX_MIP "+m.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.dispersion?"#define USE_DISPERSION":"",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||n.batchingColor?"#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.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==Cl?"#define TONE_MAPPING":"",n.toneMapping!==Cl?hn.tonemapping_pars_fragment:"",n.toneMapping!==Cl?hye("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",hn.colorspace_pars_fragment,fye("linearToOutputTexel",n.outputColorSpace),pye(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"",` +`].filter(zy).join(` +`)),o=XC(o),o=yD(o,n),o=xD(o,n),a=XC(a),a=yD(a,n),a=xD(a,n),o=bD(o),a=bD(a),n.isRawShaderMaterial!==!0&&(E=`#version 300 es +`,w=[y,"#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+w,b=["#define varying in",n.glslVersion===WC?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===WC?"":"#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(` +`)+` +`+b);const T=E+w+o,C=E+b+a,O=gD(i,i.VERTEX_SHADER,T),N=gD(i,i.FRAGMENT_SHADER,C);i.attachShader(S,O),i.attachShader(S,N),n.index0AttributeName!==void 0?i.bindAttribLocation(S,0,n.index0AttributeName):n.morphTargets===!0&&i.bindAttribLocation(S,0,"position"),i.linkProgram(S);function D(j){if(t.debug.checkShaderErrors){const H=i.getProgramInfoLog(S).trim(),ne=i.getShaderInfoLog(O).trim(),J=i.getShaderInfoLog(N).trim();let de=!0,oe=!0;if(i.getProgramParameter(S,i.LINK_STATUS)===!1)if(de=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(i,S,O,N);else{const he=vD(i,O,"vertex"),B=vD(i,N,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(S,i.VALIDATE_STATUS)+` + +Material Name: `+j.name+` +Material Type: `+j.type+` + +Program Info Log: `+H+` +`+he+` +`+B)}else H!==""?console.warn("THREE.WebGLProgram: Program Info Log:",H):(ne===""||J==="")&&(oe=!1);oe&&(j.diagnostics={runnable:de,programLog:H,vertexShader:{log:ne,prefix:w},fragmentShader:{log:J,prefix:b}})}i.deleteShader(O),i.deleteShader(N),F=new q_(i,S),V=vye(i,S)}let F;this.getUniforms=function(){return F===void 0&&D(this),F};let V;this.getAttributes=function(){return V===void 0&&D(this),V};let k=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return k===!1&&(k=i.getProgramParameter(S,lye)),k},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(S),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=cye++,this.cacheKey=e,this.usedTimes=1,this.program=S,this.vertexShader=O,this.fragmentShader=N,this}let Pye=0;class Rye{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const n=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(n),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 n=this.materialCache.get(e);for(const r of n)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 n=this.materialCache;let r=n.get(e);return r===void 0&&(r=new Set,n.set(e,r)),r}_getShaderStage(e){const n=this.shaderCache;let r=n.get(e);return r===void 0&&(r=new Nye(e),n.set(e,r)),r}}class Nye{constructor(e){this.id=Pye++,this.code=e,this.usedTimes=0}}function Iye(t,e,n,r,i,s,o){const a=new Ah,l=new Rye,c=new Set,d=[],f=i.logarithmicDepthBuffer,m=i.reverseDepthBuffer,y=i.vertexTextures;let x=i.precision;const S={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 w(k){return c.add(k),k===0?"uv":`uv${k}`}function b(k,j,H,ne,J){const de=ne.fog,oe=J.geometry,he=k.isMeshStandardMaterial?ne.environment:null,B=(k.isMeshStandardMaterial?n:e).get(k.envMap||he),K=B&&B.mapping===ev?B.image.height:null,q=S[k.type];k.precision!==null&&(x=i.getMaxPrecision(k.precision),x!==k.precision&&console.warn("THREE.WebGLProgram.getParameters:",k.precision,"not supported, using",x,"instead."));const $=oe.morphAttributes.position||oe.morphAttributes.normal||oe.morphAttributes.color,Z=$!==void 0?$.length:0;let ge=0;oe.morphAttributes.position!==void 0&&(ge=1),oe.morphAttributes.normal!==void 0&&(ge=2),oe.morphAttributes.color!==void 0&&(ge=3);let ae,ce,we,Me;if(q){const Hn=La[q];ae=Hn.vertexShader,ce=Hn.fragmentShader}else ae=k.vertexShader,ce=k.fragmentShader,l.update(k),we=l.getVertexShaderID(k),Me=l.getFragmentShaderID(k);const $e=t.getRenderTarget(),Se=J.isInstancedMesh===!0,Ve=J.isBatchedMesh===!0,Xe=!!k.map,fe=!!k.matcap,Q=!!B,Ge=!!k.aoMap,Ue=!!k.lightMap,We=!!k.bumpMap,Qe=!!k.normalMap,xt=!!k.displacementMap,at=!!k.emissiveMap,te=!!k.metalnessMap,W=!!k.roughnessMap,Ee=k.anisotropy>0,Be=k.clearcoat>0,le=k.dispersion>0,Ce=k.iridescence>0,lt=k.sheen>0,rt=k.transmission>0,ft=Ee&&!!k.anisotropyMap,nn=Be&&!!k.clearcoatMap,qe=Be&&!!k.clearcoatNormalMap,dt=Be&&!!k.clearcoatRoughnessMap,Dt=Ce&&!!k.iridescenceMap,Ut=Ce&&!!k.iridescenceThicknessMap,pt=lt&&!!k.sheenColorMap,ue=lt&&!!k.sheenRoughnessMap,ee=!!k.specularMap,Ae=!!k.specularColorMap,re=!!k.specularIntensityMap,Fe=rt&&!!k.transmissionMap,Te=rt&&!!k.thicknessMap,Le=!!k.gradientMap,Ke=!!k.alphaMap,ut=k.alphaTest>0,Kt=!!k.alphaHash,un=!!k.extensions;let Cn=Cl;k.toneMapped&&($e===null||$e.isXRRenderTarget===!0)&&(Cn=t.toneMapping);const Jt={shaderID:q,shaderType:k.type,shaderName:k.name,vertexShader:ae,fragmentShader:ce,defines:k.defines,customVertexShaderID:we,customFragmentShaderID:Me,isRawShaderMaterial:k.isRawShaderMaterial===!0,glslVersion:k.glslVersion,precision:x,batching:Ve,batchingColor:Ve&&J._colorsTexture!==null,instancing:Se,instancingColor:Se&&J.instanceColor!==null,instancingMorph:Se&&J.morphTexture!==null,supportsVertexTextures:y,outputColorSpace:$e===null?t.outputColorSpace:$e.isXRRenderTarget===!0?$e.texture.colorSpace:xi,alphaToCoverage:!!k.alphaToCoverage,map:Xe,matcap:fe,envMap:Q,envMapMode:Q&&B.mapping,envMapCubeUVHeight:K,aoMap:Ge,lightMap:Ue,bumpMap:We,normalMap:Qe,displacementMap:y&&xt,emissiveMap:at,normalMapObjectSpace:Qe&&k.normalMapType===XV,normalMapTangentSpace:Qe&&k.normalMapType===lu,metalnessMap:te,roughnessMap:W,anisotropy:Ee,anisotropyMap:ft,clearcoat:Be,clearcoatMap:nn,clearcoatNormalMap:qe,clearcoatRoughnessMap:dt,dispersion:le,iridescence:Ce,iridescenceMap:Dt,iridescenceThicknessMap:Ut,sheen:lt,sheenColorMap:pt,sheenRoughnessMap:ue,specularMap:ee,specularColorMap:Ae,specularIntensityMap:re,transmission:rt,transmissionMap:Fe,thicknessMap:Te,gradientMap:Le,opaque:k.transparent===!1&&k.blending===Sh&&k.alphaToCoverage===!1,alphaMap:Ke,alphaTest:ut,alphaHash:Kt,combine:k.combine,mapUv:Xe&&w(k.map.channel),aoMapUv:Ge&&w(k.aoMap.channel),lightMapUv:Ue&&w(k.lightMap.channel),bumpMapUv:We&&w(k.bumpMap.channel),normalMapUv:Qe&&w(k.normalMap.channel),displacementMapUv:xt&&w(k.displacementMap.channel),emissiveMapUv:at&&w(k.emissiveMap.channel),metalnessMapUv:te&&w(k.metalnessMap.channel),roughnessMapUv:W&&w(k.roughnessMap.channel),anisotropyMapUv:ft&&w(k.anisotropyMap.channel),clearcoatMapUv:nn&&w(k.clearcoatMap.channel),clearcoatNormalMapUv:qe&&w(k.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:dt&&w(k.clearcoatRoughnessMap.channel),iridescenceMapUv:Dt&&w(k.iridescenceMap.channel),iridescenceThicknessMapUv:Ut&&w(k.iridescenceThicknessMap.channel),sheenColorMapUv:pt&&w(k.sheenColorMap.channel),sheenRoughnessMapUv:ue&&w(k.sheenRoughnessMap.channel),specularMapUv:ee&&w(k.specularMap.channel),specularColorMapUv:Ae&&w(k.specularColorMap.channel),specularIntensityMapUv:re&&w(k.specularIntensityMap.channel),transmissionMapUv:Fe&&w(k.transmissionMap.channel),thicknessMapUv:Te&&w(k.thicknessMap.channel),alphaMapUv:Ke&&w(k.alphaMap.channel),vertexTangents:!!oe.attributes.tangent&&(Qe||Ee),vertexColors:k.vertexColors,vertexAlphas:k.vertexColors===!0&&!!oe.attributes.color&&oe.attributes.color.itemSize===4,pointsUvs:J.isPoints===!0&&!!oe.attributes.uv&&(Xe||Ke),fog:!!de,useFog:k.fog===!0,fogExp2:!!de&&de.isFogExp2,flatShading:k.flatShading===!0,sizeAttenuation:k.sizeAttenuation===!0,logarithmicDepthBuffer:f,reverseDepthBuffer:m,skinning:J.isSkinnedMesh===!0,morphTargets:oe.morphAttributes.position!==void 0,morphNormals:oe.morphAttributes.normal!==void 0,morphColors:oe.morphAttributes.color!==void 0,morphTargetsCount:Z,morphTextureStride:ge,numDirLights:j.directional.length,numPointLights:j.point.length,numSpotLights:j.spot.length,numSpotLightMaps:j.spotLightMap.length,numRectAreaLights:j.rectArea.length,numHemiLights:j.hemi.length,numDirLightShadows:j.directionalShadowMap.length,numPointLightShadows:j.pointShadowMap.length,numSpotLightShadows:j.spotShadowMap.length,numSpotLightShadowsWithMaps:j.numSpotLightShadowsWithMaps,numLightProbes:j.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:k.dithering,shadowMapEnabled:t.shadowMap.enabled&&H.length>0,shadowMapType:t.shadowMap.type,toneMapping:Cn,decodeVideoTexture:Xe&&k.map.isVideoTexture===!0&&In.getTransfer(k.map.colorSpace)===Jn,premultipliedAlpha:k.premultipliedAlpha,doubleSided:k.side===xo,flipSided:k.side===ss,useDepthPacking:k.depthPacking>=0,depthPacking:k.depthPacking||0,index0AttributeName:k.index0AttributeName,extensionClipCullDistance:un&&k.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(un&&k.extensions.multiDraw===!0||Ve)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:k.customProgramCacheKey()};return Jt.vertexUv1s=c.has(1),Jt.vertexUv2s=c.has(2),Jt.vertexUv3s=c.has(3),c.clear(),Jt}function E(k){const j=[];if(k.shaderID?j.push(k.shaderID):(j.push(k.customVertexShaderID),j.push(k.customFragmentShaderID)),k.defines!==void 0)for(const H in k.defines)j.push(H),j.push(k.defines[H]);return k.isRawShaderMaterial===!1&&(T(j,k),C(j,k),j.push(t.outputColorSpace)),j.push(k.customProgramCacheKey),j.join()}function T(k,j){k.push(j.precision),k.push(j.outputColorSpace),k.push(j.envMapMode),k.push(j.envMapCubeUVHeight),k.push(j.mapUv),k.push(j.alphaMapUv),k.push(j.lightMapUv),k.push(j.aoMapUv),k.push(j.bumpMapUv),k.push(j.normalMapUv),k.push(j.displacementMapUv),k.push(j.emissiveMapUv),k.push(j.metalnessMapUv),k.push(j.roughnessMapUv),k.push(j.anisotropyMapUv),k.push(j.clearcoatMapUv),k.push(j.clearcoatNormalMapUv),k.push(j.clearcoatRoughnessMapUv),k.push(j.iridescenceMapUv),k.push(j.iridescenceThicknessMapUv),k.push(j.sheenColorMapUv),k.push(j.sheenRoughnessMapUv),k.push(j.specularMapUv),k.push(j.specularColorMapUv),k.push(j.specularIntensityMapUv),k.push(j.transmissionMapUv),k.push(j.thicknessMapUv),k.push(j.combine),k.push(j.fogExp2),k.push(j.sizeAttenuation),k.push(j.morphTargetsCount),k.push(j.morphAttributeCount),k.push(j.numDirLights),k.push(j.numPointLights),k.push(j.numSpotLights),k.push(j.numSpotLightMaps),k.push(j.numHemiLights),k.push(j.numRectAreaLights),k.push(j.numDirLightShadows),k.push(j.numPointLightShadows),k.push(j.numSpotLightShadows),k.push(j.numSpotLightShadowsWithMaps),k.push(j.numLightProbes),k.push(j.shadowMapType),k.push(j.toneMapping),k.push(j.numClippingPlanes),k.push(j.numClipIntersection),k.push(j.depthPacking)}function C(k,j){a.disableAll(),j.supportsVertexTextures&&a.enable(0),j.instancing&&a.enable(1),j.instancingColor&&a.enable(2),j.instancingMorph&&a.enable(3),j.matcap&&a.enable(4),j.envMap&&a.enable(5),j.normalMapObjectSpace&&a.enable(6),j.normalMapTangentSpace&&a.enable(7),j.clearcoat&&a.enable(8),j.iridescence&&a.enable(9),j.alphaTest&&a.enable(10),j.vertexColors&&a.enable(11),j.vertexAlphas&&a.enable(12),j.vertexUv1s&&a.enable(13),j.vertexUv2s&&a.enable(14),j.vertexUv3s&&a.enable(15),j.vertexTangents&&a.enable(16),j.anisotropy&&a.enable(17),j.alphaHash&&a.enable(18),j.batching&&a.enable(19),j.dispersion&&a.enable(20),j.batchingColor&&a.enable(21),k.push(a.mask),a.disableAll(),j.fog&&a.enable(0),j.useFog&&a.enable(1),j.flatShading&&a.enable(2),j.logarithmicDepthBuffer&&a.enable(3),j.reverseDepthBuffer&&a.enable(4),j.skinning&&a.enable(5),j.morphTargets&&a.enable(6),j.morphNormals&&a.enable(7),j.morphColors&&a.enable(8),j.premultipliedAlpha&&a.enable(9),j.shadowMapEnabled&&a.enable(10),j.doubleSided&&a.enable(11),j.flipSided&&a.enable(12),j.useDepthPacking&&a.enable(13),j.dithering&&a.enable(14),j.transmission&&a.enable(15),j.sheen&&a.enable(16),j.opaque&&a.enable(17),j.pointsUvs&&a.enable(18),j.decodeVideoTexture&&a.enable(19),j.alphaToCoverage&&a.enable(20),k.push(a.mask)}function O(k){const j=S[k.type];let H;if(j){const ne=La[j];H=ER.clone(ne.uniforms)}else H=k.uniforms;return H}function N(k,j){let H;for(let ne=0,J=d.length;ne0?r.push(b):y.transparent===!0?i.push(b):n.push(b)}function l(f,m,y,x,S,w){const b=o(f,m,y,x,S,w);y.transmission>0?r.unshift(b):y.transparent===!0?i.unshift(b):n.unshift(b)}function c(f,m){n.length>1&&n.sort(f||Oye),r.length>1&&r.sort(m||wD),i.length>1&&i.sort(m||wD)}function d(){for(let f=e,m=t.length;f=s.length?(o=new SD,s.push(o)):o=s[i],o}function n(){t=new WeakMap}return{get:e,dispose:n}}function Dye(){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 X,color:new ot};break;case"SpotLight":n={position:new X,direction:new X,color:new ot,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new X,color:new ot,distance:0,decay:0};break;case"HemisphereLight":n={direction:new X,skyColor:new ot,groundColor:new ot};break;case"RectAreaLight":n={color:new ot,position:new X,halfWidth:new X,halfHeight:new X};break}return t[e.id]=n,n}}}function Uye(){const t={};return{get:function(e){if(t[e.id]!==void 0)return t[e.id];let n;switch(e.type){case"DirectionalLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new He,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[e.id]=n,n}}}let jye=0;function Fye(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function zye(t){const e=new Dye,n=Uye(),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 c=0;c<9;c++)r.probe.push(new X);const i=new X,s=new Ct,o=new Ct;function a(c){let d=0,f=0,m=0;for(let V=0;V<9;V++)r.probe[V].set(0,0,0);let y=0,x=0,S=0,w=0,b=0,E=0,T=0,C=0,O=0,N=0,D=0;c.sort(Fye);for(let V=0,k=c.length;V0&&(t.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ht.LTC_FLOAT_1,r.rectAreaLTC2=ht.LTC_FLOAT_2):(r.rectAreaLTC1=ht.LTC_HALF_1,r.rectAreaLTC2=ht.LTC_HALF_2)),r.ambient[0]=d,r.ambient[1]=f,r.ambient[2]=m;const F=r.hash;(F.directionalLength!==y||F.pointLength!==x||F.spotLength!==S||F.rectAreaLength!==w||F.hemiLength!==b||F.numDirectionalShadows!==E||F.numPointShadows!==T||F.numSpotShadows!==C||F.numSpotMaps!==O||F.numLightProbes!==D)&&(r.directional.length=y,r.spot.length=S,r.rectArea.length=w,r.point.length=x,r.hemi.length=b,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=T,r.pointShadowMap.length=T,r.spotShadow.length=C,r.spotShadowMap.length=C,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=T,r.spotLightMatrix.length=C+O-N,r.spotLightMap.length=O,r.numSpotLightShadowsWithMaps=N,r.numLightProbes=D,F.directionalLength=y,F.pointLength=x,F.spotLength=S,F.rectAreaLength=w,F.hemiLength=b,F.numDirectionalShadows=E,F.numPointShadows=T,F.numSpotShadows=C,F.numSpotMaps=O,F.numLightProbes=D,r.version=jye++)}function l(c,d){let f=0,m=0,y=0,x=0,S=0;const w=d.matrixWorldInverse;for(let b=0,E=c.length;b=o.length?(a=new MD(t),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:n,dispose:r}}class CR extends Gr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=WV,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 PR extends Gr{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 Hye=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Vye=`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 Gye(t,e,n){let r=new fx;const i=new He,s=new He,o=new Ln,a=new CR({depthPacking:$V}),l=new PR,c={},d=n.maxTextureSize,f={[Dl]:ss,[ss]:Dl,[xo]:xo},m=new Qo({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new He},radius:{value:4}},vertexShader:Hye,fragmentShader:Vye}),y=m.clone();y.defines.HORIZONTAL_PASS=1;const x=new Zt;x.setAttribute("position",new Qt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const S=new yr(x,m),w=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=zS;let b=this.type;this.render=function(N,D,F){if(w.enabled===!1||w.autoUpdate===!1&&w.needsUpdate===!1||N.length===0)return;const V=t.getRenderTarget(),k=t.getActiveCubeFace(),j=t.getActiveMipmapLevel(),H=t.state;H.setBlending(Wc),H.buffers.color.setClear(1,1,1,1),H.buffers.depth.setTest(!0),H.setScissorTest(!1);const ne=b!==ka&&this.type===ka,J=b===ka&&this.type!==ka;for(let de=0,oe=N.length;ded||i.y>d)&&(i.x>d&&(s.x=Math.floor(d/K.x),i.x=s.x*K.x,B.mapSize.x=s.x),i.y>d&&(s.y=Math.floor(d/K.y),i.y=s.y*K.y,B.mapSize.y=s.y)),B.map===null||ne===!0||J===!0){const $=this.type!==ka?{minFilter:ri,magFilter:ri}:{};B.map!==null&&B.map.dispose(),B.map=new Ha(i.x,i.y,$),B.map.texture.name=he.name+".shadowMap",B.camera.updateProjectionMatrix()}t.setRenderTarget(B.map),t.clear();const q=B.getViewportCount();for(let $=0;$0||D.map&&D.alphaTest>0){const H=k.uuid,ne=D.uuid;let J=c[H];J===void 0&&(J={},c[H]=J);let de=J[ne];de===void 0&&(de=k.clone(),J[ne]=de,D.addEventListener("dispose",O)),k=de}if(k.visible=D.visible,k.wireframe=D.wireframe,V===ka?k.side=D.shadowSide!==null?D.shadowSide:D.side:k.side=D.shadowSide!==null?D.shadowSide:f[D.side],k.alphaMap=D.alphaMap,k.alphaTest=D.alphaTest,k.map=D.map,k.clipShadows=D.clipShadows,k.clippingPlanes=D.clippingPlanes,k.clipIntersection=D.clipIntersection,k.displacementMap=D.displacementMap,k.displacementScale=D.displacementScale,k.displacementBias=D.displacementBias,k.wireframeLinewidth=D.wireframeLinewidth,k.linewidth=D.linewidth,F.isPointLight===!0&&k.isMeshDistanceMaterial===!0){const H=t.properties.get(k);H.light=F}return k}function C(N,D,F,V,k){if(N.visible===!1)return;if(N.layers.test(D.layers)&&(N.isMesh||N.isLine||N.isPoints)&&(N.castShadow||N.receiveShadow&&k===ka)&&(!N.frustumCulled||r.intersectsObject(N))){N.modelViewMatrix.multiplyMatrices(F.matrixWorldInverse,N.matrixWorld);const ne=e.update(N),J=N.material;if(Array.isArray(J)){const de=ne.groups;for(let oe=0,he=de.length;oe=1):he.indexOf("OpenGL ES")!==-1&&(oe=parseFloat(/^OpenGL ES (\d)/.exec(he)[1]),de=oe>=2);let B=null,K={};const q=t.getParameter(t.SCISSOR_BOX),$=t.getParameter(t.VIEWPORT),Z=new Ln().fromArray(q),ge=new Ln().fromArray($);function ae(re,Fe,Te,Le){const Ke=new Uint8Array(4),ut=t.createTexture();t.bindTexture(re,ut),t.texParameteri(re,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(re,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let Kt=0;Kte?(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}function qye(t,e){const n=t.image&&t.image.width?t.image.width/t.image.height:1;return n>e?(t.repeat.x=e/n,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=n/e,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}function Kye(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function qC(t,e,n,r){const i=Yye(r);switch(n){case fR:return t*e;case pR:return t*e;case mR:return t*e*2;case $S:return t*e/i.components*i.byteLength;case lx:return t*e/i.components*i.byteLength;case gR:return t*e*2/i.components*i.byteLength;case XS:return t*e*2/i.components*i.byteLength;case hR:return t*e*3/i.components*i.byteLength;case is:return t*e*4/i.components*i.byteLength;case qS:return t*e*4/i.components*i.byteLength;case Xy:case qy:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ky:case Yy:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case a1:case c1:return Math.max(t,16)*Math.max(e,8)/4;case o1:case l1:return Math.max(t,8)*Math.max(e,8)/2;case u1:case d1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case f1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case h1:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case p1:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case m1:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case g1:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case v1:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case y1:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case x1:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case b1:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case _1:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case w1:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case S1:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case M1:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case E1:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case A1:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Zy:case T1:case C1:return Math.ceil(t/4)*Math.ceil(e/4)*16;case vR:case P1:return Math.ceil(t/4)*Math.ceil(e/4)*8;case R1:case N1:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function Yye(t){switch(t){case Ba:case cR:return{byteLength:1,components:1};case Ig:case uR:case tv:return{byteLength:2,components:1};case GS:case WS:return{byteLength:2,components:4};case eu:case VS:case Zs:return{byteLength:4,components:1};case dR:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}const Zye={contain:Xye,cover:qye,fill:Kye,getByteLength:qC};function Qye(t,e,n,r,i,s,o){const a=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new He,d=new WeakMap;let f;const m=new WeakMap;let y=!1;try{y=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function x(te,W){return y?new OffscreenCanvas(te,W):I0("canvas")}function S(te,W,Ee){let Be=1;const le=at(te);if((le.width>Ee||le.height>Ee)&&(Be=Ee/Math.max(le.width,le.height)),Be<1)if(typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&te instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&te instanceof ImageBitmap||typeof VideoFrame<"u"&&te instanceof VideoFrame){const Ce=Math.floor(Be*le.width),lt=Math.floor(Be*le.height);f===void 0&&(f=x(Ce,lt));const rt=W?x(Ce,lt):f;return rt.width=Ce,rt.height=lt,rt.getContext("2d").drawImage(te,0,0,Ce,lt),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+le.width+"x"+le.height+") to ("+Ce+"x"+lt+")."),rt}else return"data"in te&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+le.width+"x"+le.height+")."),te;return te}function w(te){return te.generateMipmaps&&te.minFilter!==ri&&te.minFilter!==Cr}function b(te){t.generateMipmap(te)}function E(te,W,Ee,Be,le=!1){if(te!==null){if(t[te]!==void 0)return t[te];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+te+"'")}let Ce=W;if(W===t.RED&&(Ee===t.FLOAT&&(Ce=t.R32F),Ee===t.HALF_FLOAT&&(Ce=t.R16F),Ee===t.UNSIGNED_BYTE&&(Ce=t.R8)),W===t.RED_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Ce=t.R8UI),Ee===t.UNSIGNED_SHORT&&(Ce=t.R16UI),Ee===t.UNSIGNED_INT&&(Ce=t.R32UI),Ee===t.BYTE&&(Ce=t.R8I),Ee===t.SHORT&&(Ce=t.R16I),Ee===t.INT&&(Ce=t.R32I)),W===t.RG&&(Ee===t.FLOAT&&(Ce=t.RG32F),Ee===t.HALF_FLOAT&&(Ce=t.RG16F),Ee===t.UNSIGNED_BYTE&&(Ce=t.RG8)),W===t.RG_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Ce=t.RG8UI),Ee===t.UNSIGNED_SHORT&&(Ce=t.RG16UI),Ee===t.UNSIGNED_INT&&(Ce=t.RG32UI),Ee===t.BYTE&&(Ce=t.RG8I),Ee===t.SHORT&&(Ce=t.RG16I),Ee===t.INT&&(Ce=t.RG32I)),W===t.RGB_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Ce=t.RGB8UI),Ee===t.UNSIGNED_SHORT&&(Ce=t.RGB16UI),Ee===t.UNSIGNED_INT&&(Ce=t.RGB32UI),Ee===t.BYTE&&(Ce=t.RGB8I),Ee===t.SHORT&&(Ce=t.RGB16I),Ee===t.INT&&(Ce=t.RGB32I)),W===t.RGBA_INTEGER&&(Ee===t.UNSIGNED_BYTE&&(Ce=t.RGBA8UI),Ee===t.UNSIGNED_SHORT&&(Ce=t.RGBA16UI),Ee===t.UNSIGNED_INT&&(Ce=t.RGBA32UI),Ee===t.BYTE&&(Ce=t.RGBA8I),Ee===t.SHORT&&(Ce=t.RGBA16I),Ee===t.INT&&(Ce=t.RGBA32I)),W===t.RGB&&Ee===t.UNSIGNED_INT_5_9_9_9_REV&&(Ce=t.RGB9_E5),W===t.RGBA){const lt=le?T0:In.getTransfer(Be);Ee===t.FLOAT&&(Ce=t.RGBA32F),Ee===t.HALF_FLOAT&&(Ce=t.RGBA16F),Ee===t.UNSIGNED_BYTE&&(Ce=lt===Jn?t.SRGB8_ALPHA8:t.RGBA8),Ee===t.UNSIGNED_SHORT_4_4_4_4&&(Ce=t.RGBA4),Ee===t.UNSIGNED_SHORT_5_5_5_1&&(Ce=t.RGB5_A1)}return(Ce===t.R16F||Ce===t.R32F||Ce===t.RG16F||Ce===t.RG32F||Ce===t.RGBA16F||Ce===t.RGBA32F)&&e.get("EXT_color_buffer_float"),Ce}function T(te,W){let Ee;return te?W===null||W===eu||W===jh?Ee=t.DEPTH24_STENCIL8:W===Zs?Ee=t.DEPTH32F_STENCIL8:W===Ig&&(Ee=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):W===null||W===eu||W===jh?Ee=t.DEPTH_COMPONENT24:W===Zs?Ee=t.DEPTH_COMPONENT32F:W===Ig&&(Ee=t.DEPTH_COMPONENT16),Ee}function C(te,W){return w(te)===!0||te.isFramebufferTexture&&te.minFilter!==ri&&te.minFilter!==Cr?Math.log2(Math.max(W.width,W.height))+1:te.mipmaps!==void 0&&te.mipmaps.length>0?te.mipmaps.length:te.isCompressedTexture&&Array.isArray(te.image)?W.mipmaps.length:1}function O(te){const W=te.target;W.removeEventListener("dispose",O),D(W),W.isVideoTexture&&d.delete(W)}function N(te){const W=te.target;W.removeEventListener("dispose",N),V(W)}function D(te){const W=r.get(te);if(W.__webglInit===void 0)return;const Ee=te.source,Be=m.get(Ee);if(Be){const le=Be[W.__cacheKey];le.usedTimes--,le.usedTimes===0&&F(te),Object.keys(Be).length===0&&m.delete(Ee)}r.remove(te)}function F(te){const W=r.get(te);t.deleteTexture(W.__webglTexture);const Ee=te.source,Be=m.get(Ee);delete Be[W.__cacheKey],o.memory.textures--}function V(te){const W=r.get(te);if(te.depthTexture&&te.depthTexture.dispose(),te.isWebGLCubeRenderTarget)for(let Be=0;Be<6;Be++){if(Array.isArray(W.__webglFramebuffer[Be]))for(let le=0;le=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+te+" texture units while this GPU supports only "+i.maxTextures),k+=1,te}function ne(te){const W=[];return W.push(te.wrapS),W.push(te.wrapT),W.push(te.wrapR||0),W.push(te.magFilter),W.push(te.minFilter),W.push(te.anisotropy),W.push(te.internalFormat),W.push(te.format),W.push(te.type),W.push(te.generateMipmaps),W.push(te.premultiplyAlpha),W.push(te.flipY),W.push(te.unpackAlignment),W.push(te.colorSpace),W.join()}function J(te,W){const Ee=r.get(te);if(te.isVideoTexture&&Qe(te),te.isRenderTargetTexture===!1&&te.version>0&&Ee.__version!==te.version){const Be=te.image;if(Be===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(Be.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{ge(Ee,te,W);return}}n.bindTexture(t.TEXTURE_2D,Ee.__webglTexture,t.TEXTURE0+W)}function de(te,W){const Ee=r.get(te);if(te.version>0&&Ee.__version!==te.version){ge(Ee,te,W);return}n.bindTexture(t.TEXTURE_2D_ARRAY,Ee.__webglTexture,t.TEXTURE0+W)}function oe(te,W){const Ee=r.get(te);if(te.version>0&&Ee.__version!==te.version){ge(Ee,te,W);return}n.bindTexture(t.TEXTURE_3D,Ee.__webglTexture,t.TEXTURE0+W)}function he(te,W){const Ee=r.get(te);if(te.version>0&&Ee.__version!==te.version){ae(Ee,te,W);return}n.bindTexture(t.TEXTURE_CUBE_MAP,Ee.__webglTexture,t.TEXTURE0+W)}const B={[Pd]:t.REPEAT,[wo]:t.CLAMP_TO_EDGE,[Ng]:t.MIRRORED_REPEAT},K={[ri]:t.NEAREST,[HS]:t.NEAREST_MIPMAP_NEAREST,[ih]:t.NEAREST_MIPMAP_LINEAR,[Cr]:t.LINEAR,[tg]:t.LINEAR_MIPMAP_NEAREST,[qo]:t.LINEAR_MIPMAP_LINEAR},q={[qV]:t.NEVER,[e6]:t.ALWAYS,[KV]:t.LESS,[bR]:t.LEQUAL,[YV]:t.EQUAL,[JV]:t.GEQUAL,[ZV]:t.GREATER,[QV]:t.NOTEQUAL};function $(te,W){if(W.type===Zs&&e.has("OES_texture_float_linear")===!1&&(W.magFilter===Cr||W.magFilter===tg||W.magFilter===ih||W.magFilter===qo||W.minFilter===Cr||W.minFilter===tg||W.minFilter===ih||W.minFilter===qo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(te,t.TEXTURE_WRAP_S,B[W.wrapS]),t.texParameteri(te,t.TEXTURE_WRAP_T,B[W.wrapT]),(te===t.TEXTURE_3D||te===t.TEXTURE_2D_ARRAY)&&t.texParameteri(te,t.TEXTURE_WRAP_R,B[W.wrapR]),t.texParameteri(te,t.TEXTURE_MAG_FILTER,K[W.magFilter]),t.texParameteri(te,t.TEXTURE_MIN_FILTER,K[W.minFilter]),W.compareFunction&&(t.texParameteri(te,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(te,t.TEXTURE_COMPARE_FUNC,q[W.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(W.magFilter===ri||W.minFilter!==ih&&W.minFilter!==qo||W.type===Zs&&e.has("OES_texture_float_linear")===!1)return;if(W.anisotropy>1||r.get(W).__currentAnisotropy){const Ee=e.get("EXT_texture_filter_anisotropic");t.texParameterf(te,Ee.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(W.anisotropy,i.getMaxAnisotropy())),r.get(W).__currentAnisotropy=W.anisotropy}}}function Z(te,W){let Ee=!1;te.__webglInit===void 0&&(te.__webglInit=!0,W.addEventListener("dispose",O));const Be=W.source;let le=m.get(Be);le===void 0&&(le={},m.set(Be,le));const Ce=ne(W);if(Ce!==te.__cacheKey){le[Ce]===void 0&&(le[Ce]={texture:t.createTexture(),usedTimes:0},o.memory.textures++,Ee=!0),le[Ce].usedTimes++;const lt=le[te.__cacheKey];lt!==void 0&&(le[te.__cacheKey].usedTimes--,lt.usedTimes===0&&F(W)),te.__cacheKey=Ce,te.__webglTexture=le[Ce].texture}return Ee}function ge(te,W,Ee){let Be=t.TEXTURE_2D;(W.isDataArrayTexture||W.isCompressedArrayTexture)&&(Be=t.TEXTURE_2D_ARRAY),W.isData3DTexture&&(Be=t.TEXTURE_3D);const le=Z(te,W),Ce=W.source;n.bindTexture(Be,te.__webglTexture,t.TEXTURE0+Ee);const lt=r.get(Ce);if(Ce.version!==lt.__version||le===!0){n.activeTexture(t.TEXTURE0+Ee);const rt=In.getPrimaries(In.workingColorSpace),ft=W.colorSpace===Lc?null:In.getPrimaries(W.colorSpace),nn=W.colorSpace===Lc||rt===ft?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,W.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,W.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,W.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,nn);let qe=S(W.image,!1,i.maxTextureSize);qe=xt(W,qe);const dt=s.convert(W.format,W.colorSpace),Dt=s.convert(W.type);let Ut=E(W.internalFormat,dt,Dt,W.colorSpace,W.isVideoTexture);$(Be,W);let pt;const ue=W.mipmaps,ee=W.isVideoTexture!==!0,Ae=lt.__version===void 0||le===!0,re=Ce.dataReady,Fe=C(W,qe);if(W.isDepthTexture)Ut=T(W.format===Fh,W.type),Ae&&(ee?n.texStorage2D(t.TEXTURE_2D,1,Ut,qe.width,qe.height):n.texImage2D(t.TEXTURE_2D,0,Ut,qe.width,qe.height,0,dt,Dt,null));else if(W.isDataTexture)if(ue.length>0){ee&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,Ut,ue[0].width,ue[0].height);for(let Te=0,Le=ue.length;Te0){const Ke=qC(pt.width,pt.height,W.format,W.type);for(const ut of W.layerUpdates){const Kt=pt.data.subarray(ut*Ke/pt.data.BYTES_PER_ELEMENT,(ut+1)*Ke/pt.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,ut,pt.width,pt.height,1,dt,Kt,0,0)}W.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,pt.width,pt.height,qe.depth,dt,pt.data,0,0)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,Te,Ut,pt.width,pt.height,qe.depth,0,pt.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else ee?re&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,Te,0,0,0,pt.width,pt.height,qe.depth,dt,Dt,pt.data):n.texImage3D(t.TEXTURE_2D_ARRAY,Te,Ut,pt.width,pt.height,qe.depth,0,dt,Dt,pt.data)}else{ee&&Ae&&n.texStorage2D(t.TEXTURE_2D,Fe,Ut,ue[0].width,ue[0].height);for(let Te=0,Le=ue.length;Te0){const Te=qC(qe.width,qe.height,W.format,W.type);for(const Le of W.layerUpdates){const Ke=qe.data.subarray(Le*Te/qe.data.BYTES_PER_ELEMENT,(Le+1)*Te/qe.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,Le,qe.width,qe.height,1,dt,Dt,Ke)}W.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,qe.width,qe.height,qe.depth,dt,Dt,qe.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,Ut,qe.width,qe.height,qe.depth,0,dt,Dt,qe.data);else if(W.isData3DTexture)ee?(Ae&&n.texStorage3D(t.TEXTURE_3D,Fe,Ut,qe.width,qe.height,qe.depth),re&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,qe.width,qe.height,qe.depth,dt,Dt,qe.data)):n.texImage3D(t.TEXTURE_3D,0,Ut,qe.width,qe.height,qe.depth,0,dt,Dt,qe.data);else if(W.isFramebufferTexture){if(Ae)if(ee)n.texStorage2D(t.TEXTURE_2D,Fe,Ut,qe.width,qe.height);else{let Te=qe.width,Le=qe.height;for(let Ke=0;Ke>=1,Le>>=1}}else if(ue.length>0){if(ee&&Ae){const Te=at(ue[0]);n.texStorage2D(t.TEXTURE_2D,Fe,Ut,Te.width,Te.height)}for(let Te=0,Le=ue.length;Te0&&Fe++;const Le=at(dt[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,Fe,ue,Le.width,Le.height)}for(let Le=0;Le<6;Le++)if(qe){ee?re&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,0,0,dt[Le].width,dt[Le].height,Ut,pt,dt[Le].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+Le,0,ue,dt[Le].width,dt[Le].height,0,Ut,pt,dt[Le].data);for(let Ke=0;Ke>Ce),dt=Math.max(1,W.height>>Ce);le===t.TEXTURE_3D||le===t.TEXTURE_2D_ARRAY?n.texImage3D(le,Ce,ft,qe,dt,W.depth,0,lt,rt,null):n.texImage2D(le,Ce,ft,qe,dt,0,lt,rt,null)}n.bindFramebuffer(t.FRAMEBUFFER,te),We(W)?a.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,Be,le,r.get(Ee).__webglTexture,0,Ue(W)):(le===t.TEXTURE_2D||le>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&le<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,Be,le,r.get(Ee).__webglTexture,Ce),n.bindFramebuffer(t.FRAMEBUFFER,null)}function we(te,W,Ee){if(t.bindRenderbuffer(t.RENDERBUFFER,te),W.depthBuffer){const Be=W.depthTexture,le=Be&&Be.isDepthTexture?Be.type:null,Ce=T(W.stencilBuffer,le),lt=W.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,rt=Ue(W);We(W)?a.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,rt,Ce,W.width,W.height):Ee?t.renderbufferStorageMultisample(t.RENDERBUFFER,rt,Ce,W.width,W.height):t.renderbufferStorage(t.RENDERBUFFER,Ce,W.width,W.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,lt,t.RENDERBUFFER,te)}else{const Be=W.textures;for(let le=0;le{delete W.__boundDepthTexture,delete W.__depthDisposeCallback,Be.removeEventListener("dispose",le)};Be.addEventListener("dispose",le),W.__depthDisposeCallback=le}W.__boundDepthTexture=Be}if(te.depthTexture&&!W.__autoAllocateDepthBuffer){if(Ee)throw new Error("target.depthTexture not supported in Cube render targets");Me(W.__webglFramebuffer,te)}else if(Ee){W.__webglDepthbuffer=[];for(let Be=0;Be<6;Be++)if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer[Be]),W.__webglDepthbuffer[Be]===void 0)W.__webglDepthbuffer[Be]=t.createRenderbuffer(),we(W.__webglDepthbuffer[Be],te,!1);else{const le=te.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Ce=W.__webglDepthbuffer[Be];t.bindRenderbuffer(t.RENDERBUFFER,Ce),t.framebufferRenderbuffer(t.FRAMEBUFFER,le,t.RENDERBUFFER,Ce)}}else if(n.bindFramebuffer(t.FRAMEBUFFER,W.__webglFramebuffer),W.__webglDepthbuffer===void 0)W.__webglDepthbuffer=t.createRenderbuffer(),we(W.__webglDepthbuffer,te,!1);else{const Be=te.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,le=W.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,le),t.framebufferRenderbuffer(t.FRAMEBUFFER,Be,t.RENDERBUFFER,le)}n.bindFramebuffer(t.FRAMEBUFFER,null)}function Se(te,W,Ee){const Be=r.get(te);W!==void 0&&ce(Be.__webglFramebuffer,te,te.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),Ee!==void 0&&$e(te)}function Ve(te){const W=te.texture,Ee=r.get(te),Be=r.get(W);te.addEventListener("dispose",N);const le=te.textures,Ce=te.isWebGLCubeRenderTarget===!0,lt=le.length>1;if(lt||(Be.__webglTexture===void 0&&(Be.__webglTexture=t.createTexture()),Be.__version=W.version,o.memory.textures++),Ce){Ee.__webglFramebuffer=[];for(let rt=0;rt<6;rt++)if(W.mipmaps&&W.mipmaps.length>0){Ee.__webglFramebuffer[rt]=[];for(let ft=0;ft0){Ee.__webglFramebuffer=[];for(let rt=0;rt0&&We(te)===!1){Ee.__webglMultisampledFramebuffer=t.createFramebuffer(),Ee.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,Ee.__webglMultisampledFramebuffer);for(let rt=0;rt0)for(let ft=0;ft0)for(let ft=0;ft0){if(We(te)===!1){const W=te.textures,Ee=te.width,Be=te.height;let le=t.COLOR_BUFFER_BIT;const Ce=te.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,lt=r.get(te),rt=W.length>1;if(rt)for(let ft=0;ft0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&W.__useRenderToTexture!==!1}function Qe(te){const W=o.render.frame;d.get(te)!==W&&(d.set(te,W),te.update())}function xt(te,W){const Ee=te.colorSpace,Be=te.format,le=te.type;return te.isCompressedTexture===!0||te.isVideoTexture===!0||Ee!==xi&&Ee!==Lc&&(In.getTransfer(Ee)===Jn?(Be!==is||le!==Ba)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",Ee)),W}function at(te){return typeof HTMLImageElement<"u"&&te instanceof HTMLImageElement?(c.width=te.naturalWidth||te.width,c.height=te.naturalHeight||te.height):typeof VideoFrame<"u"&&te instanceof VideoFrame?(c.width=te.displayWidth,c.height=te.displayHeight):(c.width=te.width,c.height=te.height),c}this.allocateTextureUnit=H,this.resetTextureUnits=j,this.setTexture2D=J,this.setTexture2DArray=de,this.setTexture3D=oe,this.setTextureCube=he,this.rebindTextures=Se,this.setupRenderTarget=Ve,this.updateRenderTargetMipmap=Xe,this.updateMultisampleRenderTarget=Ge,this.setupDepthRenderbuffer=$e,this.setupFrameBufferTexture=ce,this.useMultisampledRTT=We}function m6(t,e){function n(r,i=Lc){let s;const o=In.getTransfer(i);if(r===Ba)return t.UNSIGNED_BYTE;if(r===GS)return t.UNSIGNED_SHORT_4_4_4_4;if(r===WS)return t.UNSIGNED_SHORT_5_5_5_1;if(r===dR)return t.UNSIGNED_INT_5_9_9_9_REV;if(r===cR)return t.BYTE;if(r===uR)return t.SHORT;if(r===Ig)return t.UNSIGNED_SHORT;if(r===VS)return t.INT;if(r===eu)return t.UNSIGNED_INT;if(r===Zs)return t.FLOAT;if(r===tv)return t.HALF_FLOAT;if(r===fR)return t.ALPHA;if(r===hR)return t.RGB;if(r===is)return t.RGBA;if(r===pR)return t.LUMINANCE;if(r===mR)return t.LUMINANCE_ALPHA;if(r===Mh)return t.DEPTH_COMPONENT;if(r===Fh)return t.DEPTH_STENCIL;if(r===$S)return t.RED;if(r===lx)return t.RED_INTEGER;if(r===gR)return t.RG;if(r===XS)return t.RG_INTEGER;if(r===qS)return t.RGBA_INTEGER;if(r===Xy||r===qy||r===Ky||r===Yy)if(o===Jn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===Xy)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===qy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===Ky)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Yy)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===Xy)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===qy)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===Ky)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Yy)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===o1||r===a1||r===l1||r===c1)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===o1)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===a1)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===l1)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===c1)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===u1||r===d1||r===f1)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===u1||r===d1)return o===Jn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===f1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===h1||r===p1||r===m1||r===g1||r===v1||r===y1||r===x1||r===b1||r===_1||r===w1||r===S1||r===M1||r===E1||r===A1)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===h1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===p1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===m1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===g1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===v1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===y1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===x1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===b1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===_1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===w1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===S1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===M1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===E1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===A1)return o===Jn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Zy||r===T1||r===C1)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Zy)return o===Jn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===T1)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===C1)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===vR||r===P1||r===R1||r===N1)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Zy)return s.COMPRESSED_RED_RGTC1_EXT;if(r===P1)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===R1)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===N1)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===jh?t.UNSIGNED_INT_24_8:t[r]!==void 0?t[r]:null}return{convert:n}}class g6 extends Tr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ts extends mn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Jye={type:"move"};class bA{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ts,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 Ts,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new X,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new X),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ts,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new X,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new X),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 r of e.hand.values())this._getHandJoint(n,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,n,r){let i=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 S of e.hand.values()){const w=n.getJointPose(S,r),b=this._getHandJoint(c,S);w!==null&&(b.matrix.fromArray(w.transform.matrix),b.matrix.decompose(b.position,b.rotation,b.scale),b.matrixWorldNeedsUpdate=!0,b.jointRadius=w.radius),b.visible=w!==null}const d=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],m=d.position.distanceTo(f.position),y=.02,x=.005;c.inputState.pinching&&m>y+x?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&m<=y-x&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=n.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=n.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(Jye)))}return a!==null&&(a.visible=i!==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 r=new Ts;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const e0e=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,t0e=` +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_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`;class n0e{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,n,r){if(this.texture===null){const i=new dr,s=e.properties.get(i);s.__webglTexture=n.texture,(n.depthNear!=r.depthNear||n.depthFar!=r.depthFar)&&(this.depthNear=n.depthNear,this.depthFar=n.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const n=e.cameras[0].viewport,r=new Qo({vertexShader:e0e,fragmentShader:t0e,uniforms:{depthColor:{value:this.texture},depthWidth:{value:n.z},depthHeight:{value:n.w}}});this.mesh=new yr(new nv(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class r0e extends Bl{constructor(e,n){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,d=null,f=null,m=null,y=null,x=null;const S=new n0e,w=n.getContextAttributes();let b=null,E=null;const T=[],C=[],O=new He;let N=null;const D=new Tr;D.layers.enable(1),D.viewport=new Ln;const F=new Tr;F.layers.enable(2),F.viewport=new Ln;const V=[D,F],k=new g6;k.layers.enable(1),k.layers.enable(2);let j=null,H=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(ae){let ce=T[ae];return ce===void 0&&(ce=new bA,T[ae]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(ae){let ce=T[ae];return ce===void 0&&(ce=new bA,T[ae]=ce),ce.getGripSpace()},this.getHand=function(ae){let ce=T[ae];return ce===void 0&&(ce=new bA,T[ae]=ce),ce.getHandSpace()};function ne(ae){const ce=C.indexOf(ae.inputSource);if(ce===-1)return;const we=T[ce];we!==void 0&&(we.update(ae.inputSource,ae.frame,c||o),we.dispatchEvent({type:ae.type,data:ae.inputSource}))}function J(){i.removeEventListener("select",ne),i.removeEventListener("selectstart",ne),i.removeEventListener("selectend",ne),i.removeEventListener("squeeze",ne),i.removeEventListener("squeezestart",ne),i.removeEventListener("squeezeend",ne),i.removeEventListener("end",J),i.removeEventListener("inputsourceschange",de);for(let ae=0;ae=0&&(C[Me]=null,T[Me].disconnect(we))}for(let ce=0;ce=C.length){C.push(we),Me=Se;break}else if(C[Se]===null){C[Se]=we,Me=Se;break}if(Me===-1)break}const $e=T[Me];$e&&$e.connect(we)}}const oe=new X,he=new X;function B(ae,ce,we){oe.setFromMatrixPosition(ce.matrixWorld),he.setFromMatrixPosition(we.matrixWorld);const Me=oe.distanceTo(he),$e=ce.projectionMatrix.elements,Se=we.projectionMatrix.elements,Ve=$e[14]/($e[10]-1),Xe=$e[14]/($e[10]+1),fe=($e[9]+1)/$e[5],Q=($e[9]-1)/$e[5],Ge=($e[8]-1)/$e[0],Ue=(Se[8]+1)/Se[0],We=Ve*Ge,Qe=Ve*Ue,xt=Me/(-Ge+Ue),at=xt*-Ge;if(ce.matrixWorld.decompose(ae.position,ae.quaternion,ae.scale),ae.translateX(at),ae.translateZ(xt),ae.matrixWorld.compose(ae.position,ae.quaternion,ae.scale),ae.matrixWorldInverse.copy(ae.matrixWorld).invert(),$e[10]===-1)ae.projectionMatrix.copy(ce.projectionMatrix),ae.projectionMatrixInverse.copy(ce.projectionMatrixInverse);else{const te=Ve+xt,W=Xe+xt,Ee=We-at,Be=Qe+(Me-at),le=fe*Xe/W*te,Ce=Q*Xe/W*te;ae.projectionMatrix.makePerspective(Ee,Be,le,Ce,te,W),ae.projectionMatrixInverse.copy(ae.projectionMatrix).invert()}}function K(ae,ce){ce===null?ae.matrixWorld.copy(ae.matrix):ae.matrixWorld.multiplyMatrices(ce.matrixWorld,ae.matrix),ae.matrixWorldInverse.copy(ae.matrixWorld).invert()}this.updateCamera=function(ae){if(i===null)return;let ce=ae.near,we=ae.far;S.texture!==null&&(S.depthNear>0&&(ce=S.depthNear),S.depthFar>0&&(we=S.depthFar)),k.near=F.near=D.near=ce,k.far=F.far=D.far=we,(j!==k.near||H!==k.far)&&(i.updateRenderState({depthNear:k.near,depthFar:k.far}),j=k.near,H=k.far);const Me=ae.parent,$e=k.cameras;K(k,Me);for(let Se=0;Se<$e.length;Se++)K($e[Se],Me);$e.length===2?B(k,D,F):k.projectionMatrix.copy(D.projectionMatrix),q(ae,k,Me)};function q(ae,ce,we){we===null?ae.matrix.copy(ce.matrixWorld):(ae.matrix.copy(we.matrixWorld),ae.matrix.invert(),ae.matrix.multiply(ce.matrixWorld)),ae.matrix.decompose(ae.position,ae.quaternion,ae.scale),ae.updateMatrixWorld(!0),ae.projectionMatrix.copy(ce.projectionMatrix),ae.projectionMatrixInverse.copy(ce.projectionMatrixInverse),ae.isPerspectiveCamera&&(ae.fov=Lg*2*Math.atan(1/ae.projectionMatrix.elements[5]),ae.zoom=1)}this.getCamera=function(){return k},this.getFoveation=function(){if(!(m===null&&y===null))return l},this.setFoveation=function(ae){l=ae,m!==null&&(m.fixedFoveation=ae),y!==null&&y.fixedFoveation!==void 0&&(y.fixedFoveation=ae)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(k)};let $=null;function Z(ae,ce){if(d=ce.getViewerPose(c||o),x=ce,d!==null){const we=d.views;y!==null&&(e.setRenderTargetFramebuffer(E,y.framebuffer),e.setRenderTarget(E));let Me=!1;we.length!==k.cameras.length&&(k.cameras.length=0,Me=!0);for(let Se=0;Se0&&(w.alphaTest.value=b.alphaTest);const E=e.get(b),T=E.envMap,C=E.envMapRotation;T&&(w.envMap.value=T,If.copy(C),If.x*=-1,If.y*=-1,If.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(If.y*=-1,If.z*=-1),w.envMapRotation.value.setFromMatrix4(i0e.makeRotationFromEuler(If)),w.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,w.reflectivity.value=b.reflectivity,w.ior.value=b.ior,w.refractionRatio.value=b.refractionRatio),b.lightMap&&(w.lightMap.value=b.lightMap,w.lightMapIntensity.value=b.lightMapIntensity,n(b.lightMap,w.lightMapTransform)),b.aoMap&&(w.aoMap.value=b.aoMap,w.aoMapIntensity.value=b.aoMapIntensity,n(b.aoMap,w.aoMapTransform))}function o(w,b){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,b.map&&(w.map.value=b.map,n(b.map,w.mapTransform))}function a(w,b){w.dashSize.value=b.dashSize,w.totalSize.value=b.dashSize+b.gapSize,w.scale.value=b.scale}function l(w,b,E,T){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.size.value=b.size*E,w.scale.value=T*.5,b.map&&(w.map.value=b.map,n(b.map,w.uvTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)}function c(w,b){w.diffuse.value.copy(b.color),w.opacity.value=b.opacity,w.rotation.value=b.rotation,b.map&&(w.map.value=b.map,n(b.map,w.mapTransform)),b.alphaMap&&(w.alphaMap.value=b.alphaMap,n(b.alphaMap,w.alphaMapTransform)),b.alphaTest>0&&(w.alphaTest.value=b.alphaTest)}function d(w,b){w.specular.value.copy(b.specular),w.shininess.value=Math.max(b.shininess,1e-4)}function f(w,b){b.gradientMap&&(w.gradientMap.value=b.gradientMap)}function m(w,b){w.metalness.value=b.metalness,b.metalnessMap&&(w.metalnessMap.value=b.metalnessMap,n(b.metalnessMap,w.metalnessMapTransform)),w.roughness.value=b.roughness,b.roughnessMap&&(w.roughnessMap.value=b.roughnessMap,n(b.roughnessMap,w.roughnessMapTransform)),b.envMap&&(w.envMapIntensity.value=b.envMapIntensity)}function y(w,b,E){w.ior.value=b.ior,b.sheen>0&&(w.sheenColor.value.copy(b.sheenColor).multiplyScalar(b.sheen),w.sheenRoughness.value=b.sheenRoughness,b.sheenColorMap&&(w.sheenColorMap.value=b.sheenColorMap,n(b.sheenColorMap,w.sheenColorMapTransform)),b.sheenRoughnessMap&&(w.sheenRoughnessMap.value=b.sheenRoughnessMap,n(b.sheenRoughnessMap,w.sheenRoughnessMapTransform))),b.clearcoat>0&&(w.clearcoat.value=b.clearcoat,w.clearcoatRoughness.value=b.clearcoatRoughness,b.clearcoatMap&&(w.clearcoatMap.value=b.clearcoatMap,n(b.clearcoatMap,w.clearcoatMapTransform)),b.clearcoatRoughnessMap&&(w.clearcoatRoughnessMap.value=b.clearcoatRoughnessMap,n(b.clearcoatRoughnessMap,w.clearcoatRoughnessMapTransform)),b.clearcoatNormalMap&&(w.clearcoatNormalMap.value=b.clearcoatNormalMap,n(b.clearcoatNormalMap,w.clearcoatNormalMapTransform),w.clearcoatNormalScale.value.copy(b.clearcoatNormalScale),b.side===ss&&w.clearcoatNormalScale.value.negate())),b.dispersion>0&&(w.dispersion.value=b.dispersion),b.iridescence>0&&(w.iridescence.value=b.iridescence,w.iridescenceIOR.value=b.iridescenceIOR,w.iridescenceThicknessMinimum.value=b.iridescenceThicknessRange[0],w.iridescenceThicknessMaximum.value=b.iridescenceThicknessRange[1],b.iridescenceMap&&(w.iridescenceMap.value=b.iridescenceMap,n(b.iridescenceMap,w.iridescenceMapTransform)),b.iridescenceThicknessMap&&(w.iridescenceThicknessMap.value=b.iridescenceThicknessMap,n(b.iridescenceThicknessMap,w.iridescenceThicknessMapTransform))),b.transmission>0&&(w.transmission.value=b.transmission,w.transmissionSamplerMap.value=E.texture,w.transmissionSamplerSize.value.set(E.width,E.height),b.transmissionMap&&(w.transmissionMap.value=b.transmissionMap,n(b.transmissionMap,w.transmissionMapTransform)),w.thickness.value=b.thickness,b.thicknessMap&&(w.thicknessMap.value=b.thicknessMap,n(b.thicknessMap,w.thicknessMapTransform)),w.attenuationDistance.value=b.attenuationDistance,w.attenuationColor.value.copy(b.attenuationColor)),b.anisotropy>0&&(w.anisotropyVector.value.set(b.anisotropy*Math.cos(b.anisotropyRotation),b.anisotropy*Math.sin(b.anisotropyRotation)),b.anisotropyMap&&(w.anisotropyMap.value=b.anisotropyMap,n(b.anisotropyMap,w.anisotropyMapTransform))),w.specularIntensity.value=b.specularIntensity,w.specularColor.value.copy(b.specularColor),b.specularColorMap&&(w.specularColorMap.value=b.specularColorMap,n(b.specularColorMap,w.specularColorMapTransform)),b.specularIntensityMap&&(w.specularIntensityMap.value=b.specularIntensityMap,n(b.specularIntensityMap,w.specularIntensityMapTransform))}function x(w,b){b.matcap&&(w.matcap.value=b.matcap)}function S(w,b){const E=e.get(b).light;w.referencePosition.value.setFromMatrixPosition(E.matrixWorld),w.nearDistance.value=E.shadow.camera.near,w.farDistance.value=E.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function o0e(t,e,n,r){let i={},s={},o=[];const a=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(E,T){const C=T.program;r.uniformBlockBinding(E,C)}function c(E,T){let C=i[E.id];C===void 0&&(x(E),C=d(E),i[E.id]=C,E.addEventListener("dispose",w));const O=T.program;r.updateUBOMapping(E,O);const N=e.render.frame;s[E.id]!==N&&(m(E),s[E.id]=N)}function d(E){const T=f();E.__bindingPointIndex=T;const C=t.createBuffer(),O=E.__size,N=E.usage;return t.bindBuffer(t.UNIFORM_BUFFER,C),t.bufferData(t.UNIFORM_BUFFER,O,N),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,T,C),C}function f(){for(let E=0;E0&&(C+=O-N),E.__size=C,E.__cache={},this}function S(E){const T={boundary:0,storage:0};return typeof E=="number"||typeof E=="boolean"?(T.boundary=4,T.storage=4):E.isVector2?(T.boundary=8,T.storage=8):E.isVector3||E.isColor?(T.boundary=16,T.storage=12):E.isVector4?(T.boundary=16,T.storage=16):E.isMatrix3?(T.boundary=48,T.storage=48):E.isMatrix4?(T.boundary=64,T.storage=64):E.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",E),T}function w(E){const T=E.target;T.removeEventListener("dispose",w);const C=o.indexOf(T.__bindingPointIndex);o.splice(C,1),t.deleteBuffer(i[T.id]),delete i[T.id],delete s[T.id]}function b(){for(const E in i)t.deleteBuffer(i[E]);o=[],i={},s={}}return{bind:l,update:c,dispose:b}}class v6{constructor(e={}){const{canvas:n=r6(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let m;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");m=r.getContextAttributes().alpha}else m=o;const y=new Uint32Array(4),x=new Int32Array(4);let S=null,w=null;const b=[],E=[];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=ji,this.toneMapping=Cl,this.toneMappingExposure=1;const T=this;let C=!1,O=0,N=0,D=null,F=-1,V=null;const k=new Ln,j=new Ln;let H=null;const ne=new ot(0);let J=0,de=n.width,oe=n.height,he=1,B=null,K=null;const q=new Ln(0,0,de,oe),$=new Ln(0,0,de,oe);let Z=!1;const ge=new fx;let ae=!1,ce=!1;const we=new Ct,Me=new Ct,$e=new X,Se=new Ln,Ve={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Xe=!1;function fe(){return D===null?he:1}let Q=r;function Ge(Y,xe){return n.getContext(Y,xe)}try{const Y={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:d,failIfMajorPerformanceCaveat:f};if("setAttribute"in n&&n.setAttribute("data-engine",`three.js r${Td}`),n.addEventListener("webglcontextlost",Le,!1),n.addEventListener("webglcontextrestored",Ke,!1),n.addEventListener("webglcontextcreationerror",ut,!1),Q===null){const xe="webgl2";if(Q=Ge(xe,Y),Q===null)throw Ge(xe)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(Y){throw console.error("THREE.WebGLRenderer: "+Y.message),Y}let Ue,We,Qe,xt,at,te,W,Ee,Be,le,Ce,lt,rt,ft,nn,qe,dt,Dt,Ut,pt,ue,ee,Ae,re;function Fe(){Ue=new fve(Q),Ue.init(),ee=new m6(Q,Ue),We=new ove(Q,Ue,e,ee),Qe=new $ye(Q),We.reverseDepthBuffer&&Qe.buffers.depth.setReversed(!0),xt=new mve(Q),at=new kye,te=new Qye(Q,Ue,Qe,at,We,ee,xt),W=new lve(T),Ee=new dve(T),Be=new wpe(Q),Ae=new ive(Q,Be),le=new hve(Q,Be,xt,Ae),Ce=new vve(Q,le,Be,xt),Ut=new gve(Q,We,te),qe=new ave(at),lt=new Iye(T,W,Ee,Ue,We,Ae,qe),rt=new s0e(T,at),ft=new Lye,nn=new Bye(Ue),Dt=new rve(T,W,Ee,Qe,Ce,m,l),dt=new Gye(T,Ce,We),re=new o0e(Q,xt,We,Qe),pt=new sve(Q,Ue,xt),ue=new pve(Q,Ue,xt),xt.programs=lt.programs,T.capabilities=We,T.extensions=Ue,T.properties=at,T.renderLists=ft,T.shadowMap=dt,T.state=Qe,T.info=xt}Fe();const Te=new r0e(T,Q);this.xr=Te,this.getContext=function(){return Q},this.getContextAttributes=function(){return Q.getContextAttributes()},this.forceContextLoss=function(){const Y=Ue.get("WEBGL_lose_context");Y&&Y.loseContext()},this.forceContextRestore=function(){const Y=Ue.get("WEBGL_lose_context");Y&&Y.restoreContext()},this.getPixelRatio=function(){return he},this.setPixelRatio=function(Y){Y!==void 0&&(he=Y,this.setSize(de,oe,!1))},this.getSize=function(Y){return Y.set(de,oe)},this.setSize=function(Y,xe,Re=!0){if(Te.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}de=Y,oe=xe,n.width=Math.floor(Y*he),n.height=Math.floor(xe*he),Re===!0&&(n.style.width=Y+"px",n.style.height=xe+"px"),this.setViewport(0,0,Y,xe)},this.getDrawingBufferSize=function(Y){return Y.set(de*he,oe*he).floor()},this.setDrawingBufferSize=function(Y,xe,Re){de=Y,oe=xe,he=Re,n.width=Math.floor(Y*Re),n.height=Math.floor(xe*Re),this.setViewport(0,0,Y,xe)},this.getCurrentViewport=function(Y){return Y.copy(k)},this.getViewport=function(Y){return Y.copy(q)},this.setViewport=function(Y,xe,Re,ke){Y.isVector4?q.set(Y.x,Y.y,Y.z,Y.w):q.set(Y,xe,Re,ke),Qe.viewport(k.copy(q).multiplyScalar(he).round())},this.getScissor=function(Y){return Y.copy($)},this.setScissor=function(Y,xe,Re,ke){Y.isVector4?$.set(Y.x,Y.y,Y.z,Y.w):$.set(Y,xe,Re,ke),Qe.scissor(j.copy($).multiplyScalar(he).round())},this.getScissorTest=function(){return Z},this.setScissorTest=function(Y){Qe.setScissorTest(Z=Y)},this.setOpaqueSort=function(Y){B=Y},this.setTransparentSort=function(Y){K=Y},this.getClearColor=function(Y){return Y.copy(Dt.getClearColor())},this.setClearColor=function(){Dt.setClearColor.apply(Dt,arguments)},this.getClearAlpha=function(){return Dt.getClearAlpha()},this.setClearAlpha=function(){Dt.setClearAlpha.apply(Dt,arguments)},this.clear=function(Y=!0,xe=!0,Re=!0){let ke=0;if(Y){let _e=!1;if(D!==null){const et=D.texture.format;_e=et===qS||et===XS||et===lx}if(_e){const et=D.texture.type,yt=et===Ba||et===eu||et===Ig||et===jh||et===GS||et===WS,st=Dt.getClearColor(),Mt=Dt.getClearAlpha(),Ft=st.r,Ht=st.g,Pt=st.b;yt?(y[0]=Ft,y[1]=Ht,y[2]=Pt,y[3]=Mt,Q.clearBufferuiv(Q.COLOR,0,y)):(x[0]=Ft,x[1]=Ht,x[2]=Pt,x[3]=Mt,Q.clearBufferiv(Q.COLOR,0,x))}else ke|=Q.COLOR_BUFFER_BIT}xe&&(ke|=Q.DEPTH_BUFFER_BIT,Q.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Re&&(ke|=Q.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Q.clear(ke)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){n.removeEventListener("webglcontextlost",Le,!1),n.removeEventListener("webglcontextrestored",Ke,!1),n.removeEventListener("webglcontextcreationerror",ut,!1),ft.dispose(),nn.dispose(),at.dispose(),W.dispose(),Ee.dispose(),Ce.dispose(),Ae.dispose(),re.dispose(),lt.dispose(),Te.dispose(),Te.removeEventListener("sessionstart",Si),Te.removeEventListener("sessionend",ra),Mi.stop()};function Le(Y){Y.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),C=!0}function Ke(){console.log("THREE.WebGLRenderer: Context Restored."),C=!1;const Y=xt.autoReset,xe=dt.enabled,Re=dt.autoUpdate,ke=dt.needsUpdate,_e=dt.type;Fe(),xt.autoReset=Y,dt.enabled=xe,dt.autoUpdate=Re,dt.needsUpdate=ke,dt.type=_e}function ut(Y){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Y.statusMessage)}function Kt(Y){const xe=Y.target;xe.removeEventListener("dispose",Kt),un(xe)}function un(Y){Cn(Y),at.remove(Y)}function Cn(Y){const xe=at.get(Y).programs;xe!==void 0&&(xe.forEach(function(Re){lt.releaseProgram(Re)}),Y.isShaderMaterial&<.releaseShaderCache(Y))}this.renderBufferDirect=function(Y,xe,Re,ke,_e,et){xe===null&&(xe=Ve);const yt=_e.isMesh&&_e.matrixWorld.determinant()<0,st=Co(Y,xe,Re,ke,_e);Qe.setMaterial(ke,yt);let Mt=Re.index,Ft=1;if(ke.wireframe===!0){if(Mt=le.getWireframeAttribute(Re),Mt===void 0)return;Ft=2}const Ht=Re.drawRange,Pt=Re.attributes.position;let Sn=Ht.start*Ft,Mn=(Ht.start+Ht.count)*Ft;et!==null&&(Sn=Math.max(Sn,et.start*Ft),Mn=Math.min(Mn,(et.start+et.count)*Ft)),Mt!==null?(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Mt.count)):Pt!=null&&(Sn=Math.max(Sn,0),Mn=Math.min(Mn,Pt.count));const yn=Mn-Sn;if(yn<0||yn===1/0)return;Ae.setup(_e,ke,st,Re,Mt);let Yt,Lt=pt;if(Mt!==null&&(Yt=Be.get(Mt),Lt=ue,Lt.setIndex(Yt)),_e.isMesh)ke.wireframe===!0?(Qe.setLineWidth(ke.wireframeLinewidth*fe()),Lt.setMode(Q.LINES)):Lt.setMode(Q.TRIANGLES);else if(_e.isLine){let mt=ke.linewidth;mt===void 0&&(mt=1),Qe.setLineWidth(mt*fe()),_e.isLineSegments?Lt.setMode(Q.LINES):_e.isLineLoop?Lt.setMode(Q.LINE_LOOP):Lt.setMode(Q.LINE_STRIP)}else _e.isPoints?Lt.setMode(Q.POINTS):_e.isSprite&&Lt.setMode(Q.TRIANGLES);if(_e.isBatchedMesh)if(_e._multiDrawInstances!==null)Lt.renderMultiDrawInstances(_e._multiDrawStarts,_e._multiDrawCounts,_e._multiDrawCount,_e._multiDrawInstances);else if(Ue.get("WEBGL_multi_draw"))Lt.renderMultiDraw(_e._multiDrawStarts,_e._multiDrawCounts,_e._multiDrawCount);else{const mt=_e._multiDrawStarts,xn=_e._multiDrawCounts,en=_e._multiDrawCount,Pr=Mt?Be.get(Mt).bytesPerElement:1,li=at.get(ke).currentProgram.getUniforms();for(let kn=0;kn{function et(){if(ke.forEach(function(yt){at.get(yt).currentProgram.isReady()&&ke.delete(yt)}),ke.size===0){_e(Y);return}setTimeout(et,10)}Ue.get("KHR_parallel_shader_compile")!==null?et():setTimeout(et,10)})};let Hn=null;function hr(Y){Hn&&Hn(Y)}function Si(){Mi.stop()}function ra(){Mi.start()}const Mi=new u6;Mi.setAnimationLoop(hr),typeof self<"u"&&Mi.setContext(self),this.setAnimationLoop=function(Y){Hn=Y,Te.setAnimationLoop(Y),Y===null?Mi.stop():Mi.start()},Te.addEventListener("sessionstart",Si),Te.addEventListener("sessionend",ra),this.render=function(Y,xe){if(xe!==void 0&&xe.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(C===!0)return;if(Y.matrixWorldAutoUpdate===!0&&Y.updateMatrixWorld(),xe.parent===null&&xe.matrixWorldAutoUpdate===!0&&xe.updateMatrixWorld(),Te.enabled===!0&&Te.isPresenting===!0&&(Te.cameraAutoUpdate===!0&&Te.updateCamera(xe),xe=Te.getCamera()),Y.isScene===!0&&Y.onBeforeRender(T,Y,xe,D),w=nn.get(Y,E.length),w.init(xe),E.push(w),Me.multiplyMatrices(xe.projectionMatrix,xe.matrixWorldInverse),ge.setFromProjectionMatrix(Me),ce=this.localClippingEnabled,ae=qe.init(this.clippingPlanes,ce),S=ft.get(Y,b.length),S.init(),b.push(S),Te.enabled===!0&&Te.isPresenting===!0){const et=T.xr.getDepthSensingMesh();et!==null&&qa(et,xe,-1/0,T.sortObjects)}qa(Y,xe,0,T.sortObjects),S.finish(),T.sortObjects===!0&&S.sort(B,K),Xe=Te.enabled===!1||Te.isPresenting===!1||Te.hasDepthSensing()===!1,Xe&&Dt.addToRenderList(S,Y),this.info.render.frame++,ae===!0&&qe.beginShadows();const Re=w.state.shadowsArray;dt.render(Re,Y,xe),ae===!0&&qe.endShadows(),this.info.autoReset===!0&&this.info.reset();const ke=S.opaque,_e=S.transmissive;if(w.setupLights(),xe.isArrayCamera){const et=xe.cameras;if(_e.length>0)for(let yt=0,st=et.length;yt0&&ia(ke,_e,Y,xe),Xe&&Dt.render(Y),Ns(S,Y,xe);D!==null&&(te.updateMultisampleRenderTarget(D),te.updateRenderTargetMipmap(D)),Y.isScene===!0&&Y.onAfterRender(T,Y,xe),Ae.resetDefaultState(),F=-1,V=null,E.pop(),E.length>0?(w=E[E.length-1],ae===!0&&qe.setGlobalState(T.clippingPlanes,w.state.camera)):w=null,b.pop(),b.length>0?S=b[b.length-1]:S=null};function qa(Y,xe,Re,ke){if(Y.visible===!1)return;if(Y.layers.test(xe.layers)){if(Y.isGroup)Re=Y.renderOrder;else if(Y.isLOD)Y.autoUpdate===!0&&Y.update(xe);else if(Y.isLight)w.pushLight(Y),Y.castShadow&&w.pushShadow(Y);else if(Y.isSprite){if(!Y.frustumCulled||ge.intersectsSprite(Y)){ke&&Se.setFromMatrixPosition(Y.matrixWorld).applyMatrix4(Me);const yt=Ce.update(Y),st=Y.material;st.visible&&S.push(Y,yt,st,Re,Se.z,null)}}else if((Y.isMesh||Y.isLine||Y.isPoints)&&(!Y.frustumCulled||ge.intersectsObject(Y))){const yt=Ce.update(Y),st=Y.material;if(ke&&(Y.boundingSphere!==void 0?(Y.boundingSphere===null&&Y.computeBoundingSphere(),Se.copy(Y.boundingSphere.center)):(yt.boundingSphere===null&&yt.computeBoundingSphere(),Se.copy(yt.boundingSphere.center)),Se.applyMatrix4(Y.matrixWorld).applyMatrix4(Me)),Array.isArray(st)){const Mt=yt.groups;for(let Ft=0,Ht=Mt.length;Ft0&&Ei(_e,xe,Re),et.length>0&&Ei(et,xe,Re),yt.length>0&&Ei(yt,xe,Re),Qe.buffers.depth.setTest(!0),Qe.buffers.depth.setMask(!0),Qe.buffers.color.setMask(!0),Qe.setPolygonOffset(!1)}function ia(Y,xe,Re,ke){if((Re.isScene===!0?Re.overrideMaterial:null)!==null)return;w.state.transmissionRenderTarget[ke.id]===void 0&&(w.state.transmissionRenderTarget[ke.id]=new Ha(1,1,{generateMipmaps:!0,type:Ue.has("EXT_color_buffer_half_float")||Ue.has("EXT_color_buffer_float")?tv:Ba,minFilter:qo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:In.workingColorSpace}));const et=w.state.transmissionRenderTarget[ke.id],yt=ke.viewport||k;et.setSize(yt.z,yt.w);const st=T.getRenderTarget();T.setRenderTarget(et),T.getClearColor(ne),J=T.getClearAlpha(),J<1&&T.setClearColor(16777215,.5),T.clear(),Xe&&Dt.render(Re);const Mt=T.toneMapping;T.toneMapping=Cl;const Ft=ke.viewport;if(ke.viewport!==void 0&&(ke.viewport=void 0),w.setupLightsView(ke),ae===!0&&qe.setGlobalState(T.clippingPlanes,ke),Ei(Y,Re,ke),te.updateMultisampleRenderTarget(et),te.updateRenderTargetMipmap(et),Ue.has("WEBGL_multisampled_render_to_texture")===!1){let Ht=!1;for(let Pt=0,Sn=xe.length;Pt0),Pt=!!Re.morphAttributes.position,Sn=!!Re.morphAttributes.normal,Mn=!!Re.morphAttributes.color;let yn=Cl;ke.toneMapped&&(D===null||D.isXRRenderTarget===!0)&&(yn=T.toneMapping);const Yt=Re.morphAttributes.position||Re.morphAttributes.normal||Re.morphAttributes.color,Lt=Yt!==void 0?Yt.length:0,mt=at.get(ke),xn=w.state.lights;if(ae===!0&&(ce===!0||Y!==V)){const Xr=Y===V&&ke.id===F;qe.setState(ke,Y,Xr)}let en=!1;ke.version===mt.__version?(mt.needsLights&&mt.lightsStateVersion!==xn.state.version||mt.outputColorSpace!==st||_e.isBatchedMesh&&mt.batching===!1||!_e.isBatchedMesh&&mt.batching===!0||_e.isBatchedMesh&&mt.batchingColor===!0&&_e.colorTexture===null||_e.isBatchedMesh&&mt.batchingColor===!1&&_e.colorTexture!==null||_e.isInstancedMesh&&mt.instancing===!1||!_e.isInstancedMesh&&mt.instancing===!0||_e.isSkinnedMesh&&mt.skinning===!1||!_e.isSkinnedMesh&&mt.skinning===!0||_e.isInstancedMesh&&mt.instancingColor===!0&&_e.instanceColor===null||_e.isInstancedMesh&&mt.instancingColor===!1&&_e.instanceColor!==null||_e.isInstancedMesh&&mt.instancingMorph===!0&&_e.morphTexture===null||_e.isInstancedMesh&&mt.instancingMorph===!1&&_e.morphTexture!==null||mt.envMap!==Mt||ke.fog===!0&&mt.fog!==et||mt.numClippingPlanes!==void 0&&(mt.numClippingPlanes!==qe.numPlanes||mt.numIntersection!==qe.numIntersection)||mt.vertexAlphas!==Ft||mt.vertexTangents!==Ht||mt.morphTargets!==Pt||mt.morphNormals!==Sn||mt.morphColors!==Mn||mt.toneMapping!==yn||mt.morphTargetsCount!==Lt)&&(en=!0):(en=!0,mt.__version=ke.version);let Pr=mt.currentProgram;en===!0&&(Pr=sa(ke,xe,_e));let li=!1,kn=!1,Is=!1;const Vn=Pr.getUniforms(),eo=mt.uniforms;if(Qe.useProgram(Pr.program)&&(li=!0,kn=!0,Is=!0),ke.id!==F&&(F=ke.id,kn=!0),li||V!==Y){We.reverseDepthBuffer?(we.copy(Y.projectionMatrix),$he(we),Xhe(we),Vn.setValue(Q,"projectionMatrix",we)):Vn.setValue(Q,"projectionMatrix",Y.projectionMatrix),Vn.setValue(Q,"viewMatrix",Y.matrixWorldInverse);const Xr=Vn.map.cameraPosition;Xr!==void 0&&Xr.setValue(Q,$e.setFromMatrixPosition(Y.matrixWorld)),We.logarithmicDepthBuffer&&Vn.setValue(Q,"logDepthBufFC",2/(Math.log(Y.far+1)/Math.LN2)),(ke.isMeshPhongMaterial||ke.isMeshToonMaterial||ke.isMeshLambertMaterial||ke.isMeshBasicMaterial||ke.isMeshStandardMaterial||ke.isShaderMaterial)&&Vn.setValue(Q,"isOrthographic",Y.isOrthographicCamera===!0),V!==Y&&(V=Y,kn=!0,Is=!0)}if(_e.isSkinnedMesh){Vn.setOptional(Q,_e,"bindMatrix"),Vn.setOptional(Q,_e,"bindMatrixInverse");const Xr=_e.skeleton;Xr&&(Xr.boneTexture===null&&Xr.computeBoneTexture(),Vn.setValue(Q,"boneTexture",Xr.boneTexture,te))}_e.isBatchedMesh&&(Vn.setOptional(Q,_e,"batchingTexture"),Vn.setValue(Q,"batchingTexture",_e._matricesTexture,te),Vn.setOptional(Q,_e,"batchingIdTexture"),Vn.setValue(Q,"batchingIdTexture",_e._indirectTexture,te),Vn.setOptional(Q,_e,"batchingColorTexture"),_e._colorsTexture!==null&&Vn.setValue(Q,"batchingColorTexture",_e._colorsTexture,te));const Ka=Re.morphAttributes;if((Ka.position!==void 0||Ka.normal!==void 0||Ka.color!==void 0)&&Ut.update(_e,Re,Pr),(kn||mt.receiveShadow!==_e.receiveShadow)&&(mt.receiveShadow=_e.receiveShadow,Vn.setValue(Q,"receiveShadow",_e.receiveShadow)),ke.isMeshGouraudMaterial&&ke.envMap!==null&&(eo.envMap.value=Mt,eo.flipEnvMap.value=Mt.isCubeTexture&&Mt.isRenderTargetTexture===!1?-1:1),ke.isMeshStandardMaterial&&ke.envMap===null&&xe.environment!==null&&(eo.envMapIntensity.value=xe.environmentIntensity),kn&&(Vn.setValue(Q,"toneMappingExposure",T.toneMappingExposure),mt.needsLights&&du(eo,Is),et&&ke.fog===!0&&rt.refreshFogUniforms(eo,et),rt.refreshMaterialUniforms(eo,ke,he,oe,w.state.transmissionRenderTarget[Y.id]),q_.upload(Q,cu(mt),eo,te)),ke.isShaderMaterial&&ke.uniformsNeedUpdate===!0&&(q_.upload(Q,cu(mt),eo,te),ke.uniformsNeedUpdate=!1),ke.isSpriteMaterial&&Vn.setValue(Q,"center",_e.center),Vn.setValue(Q,"modelViewMatrix",_e.modelViewMatrix),Vn.setValue(Q,"normalMatrix",_e.normalMatrix),Vn.setValue(Q,"modelMatrix",_e.matrixWorld),ke.isShaderMaterial||ke.isRawShaderMaterial){const Xr=ke.uniformsGroups;for(let ci=0,Ld=Xr.length;ci0&&te.useMultisampledRTT(Y)===!1?_e=at.get(Y).__webglMultisampledFramebuffer:Array.isArray(Ht)?_e=Ht[Re]:_e=Ht,k.copy(Y.viewport),j.copy(Y.scissor),H=Y.scissorTest}else k.copy(q).multiplyScalar(he).floor(),j.copy($).multiplyScalar(he).floor(),H=Z;if(Qe.bindFramebuffer(Q.FRAMEBUFFER,_e)&&ke&&Qe.drawBuffers(Y,_e),Qe.viewport(k),Qe.scissor(j),Qe.setScissorTest(H),et){const Mt=at.get(Y.texture);Q.framebufferTexture2D(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Q.TEXTURE_CUBE_MAP_POSITIVE_X+xe,Mt.__webglTexture,Re)}else if(yt){const Mt=at.get(Y.texture),Ft=xe||0;Q.framebufferTextureLayer(Q.FRAMEBUFFER,Q.COLOR_ATTACHMENT0,Mt.__webglTexture,Re||0,Ft)}F=-1},this.readRenderTargetPixels=function(Y,xe,Re,ke,_e,et,yt){if(!(Y&&Y.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let st=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&yt!==void 0&&(st=st[yt]),st){Qe.bindFramebuffer(Q.FRAMEBUFFER,st);try{const Mt=Y.texture,Ft=Mt.format,Ht=Mt.type;if(!We.textureFormatReadable(Ft)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!We.textureTypeReadable(Ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}xe>=0&&xe<=Y.width-ke&&Re>=0&&Re<=Y.height-_e&&Q.readPixels(xe,Re,ke,_e,ee.convert(Ft),ee.convert(Ht),et)}finally{const Mt=D!==null?at.get(D).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Mt)}}},this.readRenderTargetPixelsAsync=async function(Y,xe,Re,ke,_e,et,yt){if(!(Y&&Y.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let st=at.get(Y).__webglFramebuffer;if(Y.isWebGLCubeRenderTarget&&yt!==void 0&&(st=st[yt]),st){const Mt=Y.texture,Ft=Mt.format,Ht=Mt.type;if(!We.textureFormatReadable(Ft))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!We.textureTypeReadable(Ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(xe>=0&&xe<=Y.width-ke&&Re>=0&&Re<=Y.height-_e){Qe.bindFramebuffer(Q.FRAMEBUFFER,st);const Pt=Q.createBuffer();Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Pt),Q.bufferData(Q.PIXEL_PACK_BUFFER,et.byteLength,Q.STREAM_READ),Q.readPixels(xe,Re,ke,_e,ee.convert(Ft),ee.convert(Ht),0);const Sn=D!==null?at.get(D).__webglFramebuffer:null;Qe.bindFramebuffer(Q.FRAMEBUFFER,Sn);const Mn=Q.fenceSync(Q.SYNC_GPU_COMMANDS_COMPLETE,0);return Q.flush(),await Whe(Q,Mn,4),Q.bindBuffer(Q.PIXEL_PACK_BUFFER,Pt),Q.getBufferSubData(Q.PIXEL_PACK_BUFFER,0,et),Q.deleteBuffer(Pt),Q.deleteSync(Mn),et}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(Y,xe=null,Re=0){Y.isTexture!==!0&&(X_("WebGLRenderer: copyFramebufferToTexture function signature has changed."),xe=arguments[0]||null,Y=arguments[1]);const ke=Math.pow(2,-Re),_e=Math.floor(Y.image.width*ke),et=Math.floor(Y.image.height*ke),yt=xe!==null?xe.x:0,st=xe!==null?xe.y:0;te.setTexture2D(Y,0),Q.copyTexSubImage2D(Q.TEXTURE_2D,Re,0,0,yt,st,_e,et),Qe.unbindTexture()},this.copyTextureToTexture=function(Y,xe,Re=null,ke=null,_e=0){Y.isTexture!==!0&&(X_("WebGLRenderer: copyTextureToTexture function signature has changed."),ke=arguments[0]||null,Y=arguments[1],xe=arguments[2],_e=arguments[3]||0,Re=null);let et,yt,st,Mt,Ft,Ht;Re!==null?(et=Re.max.x-Re.min.x,yt=Re.max.y-Re.min.y,st=Re.min.x,Mt=Re.min.y):(et=Y.image.width,yt=Y.image.height,st=0,Mt=0),ke!==null?(Ft=ke.x,Ht=ke.y):(Ft=0,Ht=0);const Pt=ee.convert(xe.format),Sn=ee.convert(xe.type);te.setTexture2D(xe,0),Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,xe.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,xe.unpackAlignment);const Mn=Q.getParameter(Q.UNPACK_ROW_LENGTH),yn=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Yt=Q.getParameter(Q.UNPACK_SKIP_PIXELS),Lt=Q.getParameter(Q.UNPACK_SKIP_ROWS),mt=Q.getParameter(Q.UNPACK_SKIP_IMAGES),xn=Y.isCompressedTexture?Y.mipmaps[_e]:Y.image;Q.pixelStorei(Q.UNPACK_ROW_LENGTH,xn.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,xn.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,st),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Mt),Y.isDataTexture?Q.texSubImage2D(Q.TEXTURE_2D,_e,Ft,Ht,et,yt,Pt,Sn,xn.data):Y.isCompressedTexture?Q.compressedTexSubImage2D(Q.TEXTURE_2D,_e,Ft,Ht,xn.width,xn.height,Pt,xn.data):Q.texSubImage2D(Q.TEXTURE_2D,_e,Ft,Ht,et,yt,Pt,Sn,xn),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,Mn),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,yn),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Yt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Lt),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,mt),_e===0&&xe.generateMipmaps&&Q.generateMipmap(Q.TEXTURE_2D),Qe.unbindTexture()},this.copyTextureToTexture3D=function(Y,xe,Re=null,ke=null,_e=0){Y.isTexture!==!0&&(X_("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Re=arguments[0]||null,ke=arguments[1]||null,Y=arguments[2],xe=arguments[3],_e=arguments[4]||0);let et,yt,st,Mt,Ft,Ht,Pt,Sn,Mn;const yn=Y.isCompressedTexture?Y.mipmaps[_e]:Y.image;Re!==null?(et=Re.max.x-Re.min.x,yt=Re.max.y-Re.min.y,st=Re.max.z-Re.min.z,Mt=Re.min.x,Ft=Re.min.y,Ht=Re.min.z):(et=yn.width,yt=yn.height,st=yn.depth,Mt=0,Ft=0,Ht=0),ke!==null?(Pt=ke.x,Sn=ke.y,Mn=ke.z):(Pt=0,Sn=0,Mn=0);const Yt=ee.convert(xe.format),Lt=ee.convert(xe.type);let mt;if(xe.isData3DTexture)te.setTexture3D(xe,0),mt=Q.TEXTURE_3D;else if(xe.isDataArrayTexture||xe.isCompressedArrayTexture)te.setTexture2DArray(xe,0),mt=Q.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}Q.pixelStorei(Q.UNPACK_FLIP_Y_WEBGL,xe.flipY),Q.pixelStorei(Q.UNPACK_PREMULTIPLY_ALPHA_WEBGL,xe.premultiplyAlpha),Q.pixelStorei(Q.UNPACK_ALIGNMENT,xe.unpackAlignment);const xn=Q.getParameter(Q.UNPACK_ROW_LENGTH),en=Q.getParameter(Q.UNPACK_IMAGE_HEIGHT),Pr=Q.getParameter(Q.UNPACK_SKIP_PIXELS),li=Q.getParameter(Q.UNPACK_SKIP_ROWS),kn=Q.getParameter(Q.UNPACK_SKIP_IMAGES);Q.pixelStorei(Q.UNPACK_ROW_LENGTH,yn.width),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,yn.height),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Mt),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,Ft),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,Ht),Y.isDataTexture||Y.isData3DTexture?Q.texSubImage3D(mt,_e,Pt,Sn,Mn,et,yt,st,Yt,Lt,yn.data):xe.isCompressedArrayTexture?Q.compressedTexSubImage3D(mt,_e,Pt,Sn,Mn,et,yt,st,Yt,yn.data):Q.texSubImage3D(mt,_e,Pt,Sn,Mn,et,yt,st,Yt,Lt,yn),Q.pixelStorei(Q.UNPACK_ROW_LENGTH,xn),Q.pixelStorei(Q.UNPACK_IMAGE_HEIGHT,en),Q.pixelStorei(Q.UNPACK_SKIP_PIXELS,Pr),Q.pixelStorei(Q.UNPACK_SKIP_ROWS,li),Q.pixelStorei(Q.UNPACK_SKIP_IMAGES,kn),_e===0&&xe.generateMipmaps&&Q.generateMipmap(mt),Qe.unbindTexture()},this.initRenderTarget=function(Y){at.get(Y).__webglFramebuffer===void 0&&te.setupRenderTarget(Y)},this.initTexture=function(Y){Y.isCubeTexture?te.setTextureCube(Y,0):Y.isData3DTexture?te.setTexture3D(Y,0):Y.isDataArrayTexture||Y.isCompressedArrayTexture?te.setTexture2DArray(Y,0):te.setTexture2D(Y,0),Qe.unbindTexture()},this.resetState=function(){O=0,N=0,D=null,Qe.reset(),Ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ml}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const n=this.getContext();n.drawingBufferColorSpace=e===YS?"display-p3":"srgb",n.unpackColorSpace=In.workingColorSpace===cx?"display-p3":"srgb"}}class JS{constructor(e,n=25e-5){this.isFogExp2=!0,this.name="",this.color=new ot(e),this.density=n}clone(){return new JS(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class eM{constructor(e,n=1,r=1e3){this.isFog=!0,this.name="",this.color=new ot(e),this.near=n,this.far=r}clone(){return new eM(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class RR extends mn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new as,this.environmentIntensity=1,this.environmentRotation=new as,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,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),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.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}class tp{constructor(e,n){this.isInterleavedBuffer=!0,this.array=e,this.stride=n,this.count=e!==void 0?e.length/n:0,this.usage=R0,this.updateRanges=[],this.version=0,this.uuid=Mo()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}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,r){e*=this.stride,r*=n.stride;for(let i=0,s=this.stride;ie.far||n.push({distance:l,point:xy.clone(),uv:qs.getInterpolation(xy,i_,_y,s_,ED,_A,AD,new He),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 o_(t,e,n,r,i,s){Pm.subVectors(t,n).addScalar(.5).multiply(r),i!==void 0?(by.x=s*Pm.x-i*Pm.y,by.y=i*Pm.x+s*Pm.y):by.copy(Pm),t.copy(e),t.x+=by.x,t.y+=by.y,t.applyMatrix4(y6)}const a_=new X,TD=new X;class b6 extends mn{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 r=0,i=n.length;r0){let r,i;for(r=1,i=n.length;r0){a_.setFromMatrixPosition(this.matrixWorld);const i=e.ray.origin.distanceTo(a_);this.getObjectForDistance(i).raycast(e,n)}}update(e){const n=this.levels;if(n.length>1){a_.setFromMatrixPosition(e.matrixWorld),TD.setFromMatrixPosition(this.matrixWorld);const r=a_.distanceTo(TD)/e.zoom;n[0].object.visible=!0;let i,s;for(i=1,s=n.length;i=o)n[i-1].object.visible=!1,n[i].object.visible=!0;else break}for(this._currentLevel=i-1;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=n,o.index=r}reset(){this.list.length=0,this.index=0}}const Ju=new Ct,MA=new Ct,h0e=new Ct,p0e=new ot(1,1,1),DD=new Ct,EA=new fx,u_=new os,kf=new Bi,My=new X,UD=new X,m0e=new X,AA=new f0e,es=new yr,d_=[];function g0e(t,e,n=0){const r=e.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==e.array.constructor){const i=t.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);n.setIndex(new Qt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const n=this.geometry;if(!!e.getIndex()!=!!n.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in n.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=n.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 os);const e=this.boundingBox,n=this._drawInfo;e.makeEmpty();for(let r=0,i=n.length;r=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,o=s.image.data;h0e.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(p0e.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,n=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item 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]),n===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=n,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),d=c!==null;if(d&&(r===-1?i.indexCount=c.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 f=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:d?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new os,sphereInitialized:!1,sphere:new Bi}),this.setGeometryAt(f,e),f}setGeometryAt(e,n){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(n);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=n.getIndex(),a=this._reservedRanges[e];if(i&&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 y in r.attributes){const x=n.getAttribute(y),S=r.getAttribute(y);g0e(x,S,l);const w=x.itemSize;for(let b=x.count,E=c;b=n.length||n[e].active===!1?this:(n[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,n){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,d=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,u_),u_.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let d=l.start,f=l.start+l.count;d=r.length||r[e].active===!1?this:(n.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,n){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:n.fromArray(i,e*16)}setColorAt(e,n){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(n.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,n){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:n.fromArray(r,e*4)}setVisibleAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===n?this:(r[e].visible=n,this._visibilityChanged=!0,this)}getVisibleAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?!1:n[e].visible}setGeometryIdAt(e,n){const r=this._drawInfo;return e>=r.length||r[e].active===!1||n<0||n>=this._geometryCount?null:(r[e].geometryIndex=n,this)}getGeometryIdAt(e){const n=this._drawInfo;return e>=n.length||n[e].active===!1?-1:n[e].geometryIndex}getGeometryRangeAt(e,n={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return n.start=r.start,n.count=r.count,n}raycast(e,n){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;es.material=this.material,es.geometry.index=o.index,es.geometry.attributes=o.attributes,es.geometry.boundingBox===null&&(es.geometry.boundingBox=new os),es.geometry.boundingSphere===null&&(es.geometry.boundingSphere=new Bi);for(let a=0,l=r.length;a({...n})),this._reservedRanges=e._reservedRanges.map(n=>({...n})),this._drawInfo=e._drawInfo.map(n=>({...n})),this._bounds=e._bounds.map(n=>({boxInitialized:n.boxInitialized,box:n.box.clone(),sphereInitialized:n.sphereInitialized,sphere:n.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,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.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,n,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._drawInfo,c=this._multiDrawStarts,d=this._multiDrawCounts,f=this._drawRanges,m=this.perObjectFrustumCulled,y=this._indirectTexture,x=y.image.data;m&&(DD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),EA.setFromProjectionMatrix(DD,e.coordinateSystem));let S=0;if(this.sortObjects){MA.copy(this.matrixWorld).invert(),My.setFromMatrixPosition(r.matrixWorld).applyMatrix4(MA),UD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(MA);for(let E=0,T=l.length;E0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;TA.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(TA);if(!(le.far))return{distance:l,point:FD.clone().applyMatrix4(t.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:t}}const zD=new X,BD=new X;class Js extends jl{constructor(e,n){super(e,n),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const n=e.attributes.position,r=[];for(let i=0,s=n.count;i0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class v0e extends dr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Cr,this.magFilter=s!==void 0?s:Cr,this.generateMipmaps=!1;const d=this;function f(){d.needsUpdate=!0,e.requestVideoFrameCallback(f)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(f)}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 y0e extends dr{constructor(e,n){super({width:e,height:n}),this.isFramebufferTexture=!0,this.magFilter=ri,this.minFilter=ri,this.generateMipmaps=!1,this.needsUpdate=!0}}class iM extends dr{constructor(e,n,r,i,s,o,a,l,c,d,f,m){super(null,o,a,l,c,d,i,s,f,m),this.isCompressedTexture=!0,this.image={width:n,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class x0e extends iM{constructor(e,n,r,i,s,o){super(e,n,r,s,o),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=wo,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class b0e extends iM{constructor(e,n,r){super(void 0,e[0].width,e[0].height,n,r,Jc),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class _0e extends dr{constructor(e,n,r,i,s,o,a,l,c){super(e,n,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class $a{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,n){const r=this.getUtoTmapping(e);return this.getPoint(r,n)}getPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPoint(r/e));return n}getSpacedPoints(e=5){const n=[];for(let r=0;r<=e;r++)n.push(this.getPointAt(r/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 r,i=this.getPoint(0),s=0;n.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),n.push(s),i=r;return this.cacheArcLengths=n,n}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,n){const r=this.getLengths();let i=0;const s=r.length;let o;n?o=n:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const d=r[i],m=r[i+1]-d,y=(o-d)/m;return(i+y)/(s-1)}getTangent(e,n){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=n||(o.isVector2?new He:new X);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,n){const r=this.getUtoTmapping(e);return this.getTangent(r,n)}computeFrenetFrames(e,n){const r=new X,i=[],s=[],o=[],a=new X,l=new Ct;for(let y=0;y<=e;y++){const x=y/e;i[y]=this.getTangentAt(x,new X)}s[0]=new X,o[0]=new X;let c=Number.MAX_VALUE;const d=Math.abs(i[0].x),f=Math.abs(i[0].y),m=Math.abs(i[0].z);d<=c&&(c=d,r.set(1,0,0)),f<=c&&(c=f,r.set(0,1,0)),m<=c&&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 y=1;y<=e;y++){if(s[y]=s[y-1].clone(),o[y]=o[y-1].clone(),a.crossVectors(i[y-1],i[y]),a.length()>Number.EPSILON){a.normalize();const x=Math.acos(Ar(i[y-1].dot(i[y]),-1,1));s[y].applyMatrix4(l.makeRotationAxis(a,x))}o[y].crossVectors(i[y],s[y])}if(n===!0){let y=Math.acos(Ar(s[0].dot(s[e]),-1,1));y/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(y=-y);for(let x=1;x<=e;x++)s[x].applyMatrix4(l.makeRotationAxis(i[x],y*x)),o[x].crossVectors(i[x],s[x])}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 sM extends $a{constructor(e=0,n=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=n,this.xRadius=r,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,n=new He){const r=n,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 c,d;this.closed||a>0?c=i[(a-1)%s]:(g_.subVectors(i[0],i[1]).add(i[0]),c=g_);const f=i[a%s],m=i[(a+1)%s];if(this.closed||a+2i.length-2?i.length-1:o+1],f=i[o>i.length-3?i.length-1:o+2];return r.set(GD(a,l.x,c.x,d.x,f.x),GD(a,l.y,c.y,d.y,f.y)),r}copy(e){super.copy(e),this.points=[];for(let n=0,r=e.points.length;n=r){const o=i[s]-r,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 r=0,i=this.curves.length;r1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n}copy(e){super.copy(e),this.curves=[];for(let n=0,r=e.curves.length;n0){const f=c.getPoint(0);f.equals(this.currentPoint)||this.lineTo(f.x,f.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 hx extends Zt{constructor(e=[new He(0,-.5),new He(.5,0),new He(0,.5)],n=12,r=0,i=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:n,phiStart:r,phiLength:i},n=Math.floor(n),i=Ar(i,0,Math.PI*2);const s=[],o=[],a=[],l=[],c=[],d=1/n,f=new X,m=new He,y=new X,x=new X,S=new X;let w=0,b=0;for(let E=0;E<=e.length-1;E++)switch(E){case 0:w=e[E+1].x-e[E].x,b=e[E+1].y-e[E].y,y.x=b*1,y.y=-w,y.z=b*0,S.copy(y),y.normalize(),l.push(y.x,y.y,y.z);break;case e.length-1:l.push(S.x,S.y,S.z);break;default:w=e[E+1].x-e[E].x,b=e[E+1].y-e[E].y,y.x=b*1,y.y=-w,y.z=b*0,x.copy(y),y.x+=S.x,y.y+=S.y,y.z+=S.z,y.normalize(),l.push(y.x,y.y,y.z),S.copy(x)}for(let E=0;E<=n;E++){const T=r+E*d*i,C=Math.sin(T),O=Math.cos(T);for(let N=0;N<=e.length-1;N++){f.x=e[N].x*C,f.y=e[N].y,f.z=e[N].x*O,o.push(f.x,f.y,f.z),m.x=E/n,m.y=N/(e.length-1),a.push(m.x,m.y);const D=l[3*N+0]*C,F=l[3*N+1],V=l[3*N+0]*O;c.push(D,F,V)}}for(let E=0;E0&&T(!0),n>0&&T(!1)),this.setIndex(d),this.setAttribute("position",new kt(f,3)),this.setAttribute("normal",new kt(m,3)),this.setAttribute("uv",new kt(y,2));function E(){const C=new X,O=new X;let N=0;const D=(n-e)/r;for(let F=0;F<=s;F++){const V=[],k=F/s,j=k*(n-e)+e;for(let H=0;H<=i;H++){const ne=H/i,J=ne*l+a,de=Math.sin(J),oe=Math.cos(J);O.x=j*de,O.y=-k*r+w,O.z=j*oe,f.push(O.x,O.y,O.z),C.set(de,D,oe).normalize(),m.push(C.x,C.y,C.z),y.push(ne,1-k),V.push(x++)}S.push(V)}for(let F=0;F0&&(d.push(k,j,ne),N+=3),n>0&&(d.push(j,H,ne),N+=3)}c.addGroup(b,N,0),b+=N}function T(C){const O=x,N=new He,D=new X;let F=0;const V=C===!0?e:n,k=C===!0?1:-1;for(let H=1;H<=i;H++)f.push(0,w*k,0),m.push(0,k,0),y.push(.5,.5),x++;const j=x;for(let H=0;H<=i;H++){const J=H/i*l+a,de=Math.cos(J),oe=Math.sin(J);D.x=V*oe,D.y=w*k,D.z=V*de,f.push(D.x,D.y,D.z),m.push(0,k,0),N.x=de*.5+.5,N.y=oe*.5*k+.5,y.push(N.x,N.y),x++}for(let H=0;H.9&&D<.1&&(T<.2&&(o[E+0]+=1),C<.2&&(o[E+2]+=1),O<.2&&(o[E+4]+=1))}}function m(E){s.push(E.x,E.y,E.z)}function y(E,T){const C=E*3;T.x=e[C+0],T.y=e[C+1],T.z=e[C+2]}function x(){const E=new X,T=new X,C=new X,O=new X,N=new He,D=new He,F=new He;for(let V=0,k=0;V80*n){a=c=t[0],l=d=t[1];for(let x=n;xc&&(c=f),m>d&&(d=m);y=Math.max(c-a,d-l),y=y!==0?32767/y:0}return O0(s,o,n,a,l,y,0),o}};function C6(t,e,n,r,i){let s,o;if(i===W0e(t,e,n,r)>0)for(s=e;s=e;s-=r)o=WD(s,t[s],t[s+1],o);return o&&uM(o,o.next)&&(D0(o),o=o.next),o}function Bh(t,e){if(!t)return t;e||(e=t);let n=t,r;do if(r=!1,!n.steiner&&(uM(n,n.next)||vr(n.prev,n,n.next)===0)){if(D0(n),n=e=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==e);return e}function O0(t,e,n,r,i,s,o){if(!t)return;!o&&s&&F0e(t,r,i,s);let a=t,l,c;for(;t.prev!==t.next;){if(l=t.prev,c=t.next,s?N0e(t,r,i,s):R0e(t)){e.push(l.i/n|0),e.push(t.i/n|0),e.push(c.i/n|0),D0(t),t=c.next,a=c.next;continue}if(t=c,t===a){o?o===1?(t=I0e(Bh(t),e,n),O0(t,e,n,r,i,s,2)):o===2&&k0e(t,e,n,r,i,s):O0(Bh(t),e,n,r,i,s,1);break}}}function R0e(t){const e=t.prev,n=t,r=t.next;if(vr(e,n,r)>=0)return!1;const i=e.x,s=n.x,o=r.x,a=e.y,l=n.y,c=r.y,d=is?i>o?i:o:s>o?s:o,y=a>l?a>c?a:c:l>c?l:c;let x=r.next;for(;x!==e;){if(x.x>=d&&x.x<=m&&x.y>=f&&x.y<=y&&qm(i,a,s,l,o,c,x.x,x.y)&&vr(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function N0e(t,e,n,r){const i=t.prev,s=t,o=t.next;if(vr(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,d=i.y,f=s.y,m=o.y,y=al?a>c?a:c:l>c?l:c,w=d>f?d>m?d:m:f>m?f:m,b=YC(y,x,e,n,r),E=YC(S,w,e,n,r);let T=t.prevZ,C=t.nextZ;for(;T&&T.z>=b&&C&&C.z<=E;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&qm(a,d,l,f,c,m,T.x,T.y)&&vr(T.prev,T,T.next)>=0||(T=T.prevZ,C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==o&&qm(a,d,l,f,c,m,C.x,C.y)&&vr(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;T&&T.z>=b;){if(T.x>=y&&T.x<=S&&T.y>=x&&T.y<=w&&T!==i&&T!==o&&qm(a,d,l,f,c,m,T.x,T.y)&&vr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;C&&C.z<=E;){if(C.x>=y&&C.x<=S&&C.y>=x&&C.y<=w&&C!==i&&C!==o&&qm(a,d,l,f,c,m,C.x,C.y)&&vr(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function I0e(t,e,n){let r=t;do{const i=r.prev,s=r.next.next;!uM(i,s)&&P6(i,r,r.next,s)&&L0(i,s)&&L0(s,i)&&(e.push(i.i/n|0),e.push(r.i/n|0),e.push(s.i/n|0),D0(r),D0(r.next),r=t=s),r=r.next}while(r!==t);return Bh(r)}function k0e(t,e,n,r,i,s){let o=t;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&H0e(o,a)){let l=R6(o,a);o=Bh(o,o.next),l=Bh(l,l.next),O0(o,e,n,r,i,s,0),O0(l,e,n,r,i,s,0);return}a=a.next}o=o.next}while(o!==t)}function O0e(t,e,n,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=n.next.y&&n.next.y!==n.y){const m=n.x+(o-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(m<=s&&m>r&&(r=m,i=n.x=n.x&&n.x>=l&&s!==n.x&&qm(oi.x||n.x===i.x&&j0e(i,n)))&&(i=n,d=f)),n=n.next;while(n!==a);return i}function j0e(t,e){return vr(t.prev,t,e.prev)<0&&vr(e.next,t,t.next)<0}function F0e(t,e,n,r){let i=t;do i.z===0&&(i.z=YC(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,z0e(i)}function z0e(t){let e,n,r,i,s,o,a,l,c=1;do{for(n=t,t=null,s=null,o=0;n;){for(o++,r=n,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:t=i,i.prevZ=s,s=i;n=r}s.nextZ=null,c*=2}while(o>1);return t}function YC(t,e,n,r,i){return t=(t-n)*i|0,e=(e-r)*i|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 B0e(t){let e=t,n=t;do(e.x=(t-o)*(s-a)&&(t-o)*(r-a)>=(n-o)*(e-a)&&(n-o)*(s-a)>=(i-o)*(r-a)}function H0e(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!V0e(t,e)&&(L0(t,e)&&L0(e,t)&&G0e(t,e)&&(vr(t.prev,t,e.prev)||vr(t,e.prev,e))||uM(t,e)&&vr(t.prev,t,t.next)>0&&vr(e.prev,e,e.next)>0)}function vr(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function uM(t,e){return t.x===e.x&&t.y===e.y}function P6(t,e,n,r){const i=__(vr(t,e,n)),s=__(vr(t,e,r)),o=__(vr(n,r,t)),a=__(vr(n,r,e));return!!(i!==s&&o!==a||i===0&&b_(t,n,e)||s===0&&b_(t,r,e)||o===0&&b_(n,t,r)||a===0&&b_(n,e,r))}function b_(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 __(t){return t>0?1:t<0?-1:0}function V0e(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&&P6(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}function L0(t,e){return vr(t.prev,t,t.next)<0?vr(t,e,t.next)>=0&&vr(t,t.prev,e)>=0:vr(t,e,t.prev)<0||vr(t,t.next,e)<0}function G0e(t,e){let n=t,r=!1;const i=(t.x+e.x)/2,s=(t.y+e.y)/2;do n.y>s!=n.next.y>s&&n.next.y!==n.y&&i<(n.next.x-n.x)*(s-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==t);return r}function R6(t,e){const n=new ZC(t.i,t.x,t.y),r=new ZC(e.i,e.x,e.y),i=t.next,s=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,s.next=r,r.prev=s,r}function WD(t,e,n,r){const i=new ZC(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function D0(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 ZC(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 W0e(t,e,n,r){let i=0;for(let s=e,o=n-r;s2&&t[e-1].equals(t[0])&&t.pop()}function XD(t,e){for(let n=0;nNumber.EPSILON){const le=Math.sqrt(Ee),Ce=Math.sqrt(te*te+W*W),lt=Q.x-at/le,rt=Q.y+xt/le,ft=Ge.x-W/Ce,nn=Ge.y+te/Ce,qe=((ft-lt)*W-(nn-rt)*te)/(xt*W-at*te);Ue=lt+xt*qe-fe.x,We=rt+at*qe-fe.y;const dt=Ue*Ue+We*We;if(dt<=2)return new He(Ue,We);Qe=Math.sqrt(dt/2)}else{let le=!1;xt>Number.EPSILON?te>Number.EPSILON&&(le=!0):xt<-Number.EPSILON?te<-Number.EPSILON&&(le=!0):Math.sign(at)===Math.sign(W)&&(le=!0),le?(Ue=-at,We=xt,Qe=Math.sqrt(Ee)):(Ue=xt,We=at,Qe=Math.sqrt(Ee/2))}return new He(Ue/Qe,We/Qe)}const K=[];for(let fe=0,Q=J.length,Ge=Q-1,Ue=fe+1;fe=0;fe--){const Q=fe/w,Ge=y*Math.cos(Q*Math.PI/2),Ue=x*Math.sin(Q*Math.PI/2)+S;for(let We=0,Qe=J.length;We=0;){const Ue=Ge;let We=Ge-1;We<0&&(We=fe.length-1);for(let Qe=0,xt=d+w*2;Qe0)&&y.push(T,C,N),(b!==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 dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=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.dispersion=e.dispersion,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 O6 extends Gr{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ot(16777215),this.specular=new ot(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=ax,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.envMapRotation.copy(e.envMapRotation),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 L6 extends Gr{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ot(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(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 D6 extends Gr{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(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 U6 extends Gr{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ot(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ot(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new as,this.combine=ax,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.envMapRotation.copy(e.envMapRotation),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 j6 extends Gr{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ot(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=lu,this.normalScale=new He(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 F6 extends $r{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 lh(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 z6(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function B6(t){function e(i,s){return t[i]-t[s]}const n=t.length,r=new Array(n);for(let i=0;i!==n;++i)r[i]=i;return r.sort(e),r}function QC(t,e,n){const r=t.length,i=new t.constructor(r);for(let s=0,o=0;o!==r;++s){const a=n[s]*e;for(let l=0;l!==e;++l)i[o++]=t[a+l]}return i}function BR(t,e,n,r){let i=1,s=t[0];for(;s!==void 0&&s[r]===void 0;)s=t[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),n.push.apply(n,o)),s=t[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(n,n.length)),s=t[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),n.push(o)),s=t[i++];while(s!==void 0)}function K0e(t,e,n,r,i=30){const s=t.clone();s.name=e;const o=[];for(let l=0;l=r)){f.push(c.times[y]);for(let S=0;Ss.tracks[l].times[0]&&(a=s.tracks[l].times[0]);for(let l=0;l=a.times[x]){const b=x*f+d,E=b+f-d;S=a.values.slice(b,E)}else{const b=a.createInterpolant(),E=d,T=f-d;b.evaluate(s),S=b.resultBuffer.slice(E,T)}l==="quaternion"&&new qt().fromArray(S).normalize().conjugate().toArray(S);const w=c.times.length;for(let b=0;b=s)){const a=n[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;en;)--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 n=this.getValueSize();n-Math.floor(n)!==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&&z6(i))for(let a=0,l=i.length;a!==l;++a){const c=i[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(),r=this.getValueSize(),i=this.getInterpolation()===$_,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)n[l+c]=n[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=n.slice(0,o*r)):(this.times=e,this.values=n),this}clone(){const e=this.times.slice(),n=this.values.slice(),r=this.constructor,i=new r(this.name,e,n);return i.createInterpolant=this.createInterpolant,i}}Xa.prototype.TimeBufferType=Float32Array;Xa.prototype.ValueBufferType=Float32Array;Xa.prototype.DefaultInterpolation=Og;class np extends Xa{constructor(e,n,r){super(e,n,r)}}np.prototype.ValueTypeName="bool";np.prototype.ValueBufferType=Array;np.prototype.DefaultInterpolation=kg;np.prototype.InterpolantFactoryMethodLinear=void 0;np.prototype.InterpolantFactoryMethodSmooth=void 0;class VR extends Xa{}VR.prototype.ValueTypeName="color";class Hh extends Xa{}Hh.prototype.ValueTypeName="number";class G6 extends sv{constructor(e,n,r,i){super(e,n,r,i)}interpolate_(e,n,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-n)/(i-n);let c=e*a;for(let d=c+a;c!==d;c+=4)qt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Vh extends Xa{InterpolantFactoryMethodLinear(e){return new G6(this.times,this.values,this.getValueSize(),e)}}Vh.prototype.ValueTypeName="quaternion";Vh.prototype.InterpolantFactoryMethodSmooth=void 0;class rp extends Xa{constructor(e,n,r){super(e,n,r)}}rp.prototype.ValueTypeName="string";rp.prototype.ValueBufferType=Array;rp.prototype.DefaultInterpolation=kg;rp.prototype.InterpolantFactoryMethodLinear=void 0;rp.prototype.InterpolantFactoryMethodSmooth=void 0;class Gh extends Xa{}Gh.prototype.ValueTypeName="vector";class Ug{constructor(e="",n=-1,r=[],i=KS){this.name=e,this.tracks=r,this.duration=n,this.blendMode=i,this.uuid=Mo(),this.duration<0&&this.resetDuration()}static parse(e){const n=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)n.push(J0e(r[o]).scale(i));const s=new this(e.name,e.duration,n,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const n=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:n,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)n.push(Xa.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,n,r,i){const s=n.length,o=[];for(let a=0;a1){const f=d[1];let m=i[f];m||(i[f]=m=[]),m.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],n,r));return o}static parseAnimation(e,n){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(f,m,y,x,S){if(y.length!==0){const w=[],b=[];BR(y,w,b,x),w.length!==0&&S.push(new f(m,w,b))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let f=0;f{n&&n(s),this.manager.itemEnd(e)},0),s;if(Tc[e]!==void 0){Tc[e].push({onLoad:n,onProgress:r,onError:i});return}Tc[e]=[],Tc[e].push({onLoad:n,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(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=Tc[e],f=c.body.getReader(),m=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),y=m?parseInt(m):0,x=y!==0;let S=0;const w=new ReadableStream({start(b){E();function E(){f.read().then(({done:T,value:C})=>{if(T)b.close();else{S+=C.byteLength;const O=new ProgressEvent("progress",{lengthComputable:x,loaded:S,total:y});for(let N=0,D=d.length;N{b.error(T)})}}});return new Response(w)}else throw new exe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{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 f=/charset="?([^;"\s]*)"?/i.exec(a),m=f&&f[1]?f[1].toLowerCase():void 0,y=new TextDecoder(m);return c.arrayBuffer().then(x=>y.decode(x))}}}).then(c=>{zc.add(e,c);const d=Tc[e];delete Tc[e];for(let f=0,m=d.length;f{const d=Tc[e];if(d===void 0)throw this.manager.itemError(e),c;delete Tc[e];for(let f=0,m=d.length;f{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class txe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Va(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){i?i(l):console.error(l),s.manager.itemError(e)}},r,i)}parse(e){const n=[];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 ot().setHex(o.value);break;case"v2":i.uniforms[s].value=new He().fromArray(o.value);break;case"v3":i.uniforms[s].value=new X().fromArray(o.value);break;case"v4":i.uniforms[s].value=new Ln().fromArray(o.value);break;case"m3":i.uniforms[s].value=new Xt().fromArray(o.value);break;case"m4":i.uniforms[s].value=new Ct().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 He().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.envMapRotation!==void 0&&i.envMapRotation.fromArray(e.envMapRotation),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 He().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}createMaterialFromType(e){return xM.createMaterialFromType(e)}static createMaterialFromType(e){const n={ShadowMaterial:I6,SpriteMaterial:NR,RawShaderMaterial:k6,ShaderMaterial:Qo,PointsMaterial:rM,MeshPhysicalMaterial:na,MeshStandardMaterial:gx,MeshPhongMaterial:O6,MeshToonMaterial:L6,MeshNormalMaterial:D6,MeshLambertMaterial:U6,MeshDepthMaterial:CR,MeshDistanceMaterial:PR,MeshBasicMaterial:As,MeshMatcapMaterial:j6,LineDashedMaterial:F6,LineBasicMaterial:$r,Material:Gr};return new n[e]}}class Md{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let n="";for(let r=0,i=e.length;r0){const l=new GR(n);s=new jg(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,d=e.length;c0){i=new jg(this.manager),i.setCrossOrigin(this.crossOrigin);for(let o=0,a=e.length;o{const w=new os;w.min.fromArray(S.boxMin),w.max.fromArray(S.boxMax);const b=new Bi;return b.radius=S.sphereRadius,b.center.fromArray(S.sphereCenter),{boxInitialized:S.boxInitialized,box:w,sphereInitialized:S.sphereInitialized,sphere:b}}),o._maxInstanceCount=e.maxInstanceCount,o._maxVertexCount=e.maxVertexCount,o._maxIndexCount=e.maxIndexCount,o._geometryInitialized=e.geometryInitialized,o._geometryCount=e.geometryCount,o._matricesTexture=c(e.matricesTexture.uuid),e.colorsTexture!==void 0&&(o._colorsTexture=c(e.colorsTexture.uuid));break;case"LOD":o=new b6;break;case"Line":o=new jl(a(e.geometry),l(e.material));break;case"LineLoop":o=new kR(a(e.geometry),l(e.material));break;case"LineSegments":o=new Js(a(e.geometry),l(e.material));break;case"PointCloud":case"Points":o=new OR(a(e.geometry),l(e.material));break;case"Sprite":o=new x6(l(e.material));break;case"Group":o=new Ts;break;case"Bone":o=new nM;break;default:o=new mn}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.intensity!==void 0&&(o.shadow.intensity=e.shadow.intensity),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 m=e.children;for(let y=0;y"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,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=zc.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=>{i&&i(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 zc.add(e,c),n&&n(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),zc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});zc.add(e,l),s.manager.itemStart(e)}}let w_;class KR{static getContext(){return w_===void 0&&(w_=new(window.AudioContext||window.webkitAudioContext)),w_}static setContext(e){w_=e}}class uxe extends Rs{constructor(e){super(e)}load(e,n,r,i){const s=this,o=new Va(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);KR.getContext().decodeAudioData(c,function(f){n(f)}).catch(a)}catch(c){a(c)}},r,i);function a(l){i?i(l):console.error(l),s.manager.itemError(e)}}}const tU=new Ct,nU=new Ct,Of=new Ct;class dxe{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Tr,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Tr,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,Of.copy(e.projectionMatrix);const i=n.eyeSep/2,s=i*n.near/n.focus,o=n.near*Math.tan(Eh*n.fov*.5)/n.zoom;let a,l;nU.elements[12]=-i,tU.elements[12]=i,a=-o*n.aspect+s,l=o*n.aspect+s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraL.projectionMatrix.copy(Of),a=-o*n.aspect-s,l=o*n.aspect-s,Of.elements[0]=2*n.near/(l-a),Of.elements[8]=(l+a)/(l-a),this.cameraR.projectionMatrix.copy(Of)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(nU),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(tU)}}class YR{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=rU(),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=rU();e=(n-this.oldTime)/1e3,this.oldTime=n,this.elapsedTime+=e}return e}}function rU(){return performance.now()}const Lf=new X,iU=new qt,fxe=new X,Df=new X;class hxe extends mn{constructor(){super(),this.type="AudioListener",this.context=KR.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new YR}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,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Lf,iU,fxe),Df.set(0,0,-1).applyQuaternion(iU),n.positionX){const i=this.context.currentTime+this.timeDelta;n.positionX.linearRampToValueAtTime(Lf.x,i),n.positionY.linearRampToValueAtTime(Lf.y,i),n.positionZ.linearRampToValueAtTime(Lf.z,i),n.forwardX.linearRampToValueAtTime(Df.x,i),n.forwardY.linearRampToValueAtTime(Df.y,i),n.forwardZ.linearRampToValueAtTime(Df.z,i),n.upX.linearRampToValueAtTime(r.x,i),n.upY.linearRampToValueAtTime(r.y,i),n.upZ.linearRampToValueAtTime(r.z,i)}else n.setPosition(Lf.x,Lf.y,Lf.z),n.setOrientation(Df.x,Df.y,Df.z,r.x,r.y,r.z)}}class tG extends mn{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(e=0){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.context.currentTime+e),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(r,i,this._addIndex*n,1,n);for(let l=n,c=n+n;l!==c;++l)if(r[l]!==r[l+n]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,n=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(n,i);for(let s=r,o=i;s!==o;++s)n[s]=n[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,n=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[n+o]=e[r+o]}_slerp(e,n,r,i){qt.slerpFlat(e,n,e,n,e,r,i)}_slerpAdditive(e,n,r,i,s){const o=this._workIndex*s;qt.multiplyQuaternionsFlat(e,o,e,n,e,r),qt.slerpFlat(e,n,e,n,e,o,i)}_lerp(e,n,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=n+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,n,r,i,s){for(let o=0;o!==s;++o){const a=n+o;e[a]=e[a]+e[r+o]*i}}}const ZR="\\[\\]\\.:\\/",vxe=new RegExp("["+ZR+"]","g"),QR="[^"+ZR+"]",yxe="[^"+ZR.replace("\\.","")+"]",xxe=/((?:WC+[\/:])*)/.source.replace("WC",QR),bxe=/(WCOD+)?/.source.replace("WCOD",yxe),_xe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",QR),wxe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",QR),Sxe=new RegExp("^"+xxe+bxe+_xe+wxe+"$"),Mxe=["material","materials","bones","map"];class Exe{constructor(e,n,r){const i=r||Nn.parseTrackName(n);this._targetGroup=e,this._bindings=e.subscribe_(n,i)}getValue(e,n){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,n)}setValue(e,n){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,n)}bind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].bind()}unbind(){const e=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=e.length;n!==r;++n)e[n].unbind()}}class Nn{constructor(e,n,r){this.path=n,this.parsedPath=r||Nn.parseTrackName(n),this.node=Nn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,n,r){return e&&e.isAnimationObjectGroup?new Nn.Composite(e,n,r):new Nn(e,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(vxe,"")}static parseTrackName(e){const n=Sxe.exec(e);if(n===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:n[2],objectName:n[3],objectIndex:n[4],propertyName:n[5],propertyIndex:n[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);Mxe.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,n){if(n===void 0||n===""||n==="."||n===-1||n===e.name||n===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(n);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o=s){const f=s++,m=e[f];n[m.uuid]=d,e[d]=m,n[c]=f,e[f]=l;for(let y=0,x=i;y!==x;++y){const S=r[y],w=S[f],b=S[d];S[d]=w,S[f]=b}}}this.nCachedObjects_=s}uncache(){const e=this._objects,n=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 c=arguments[a],d=c.uuid,f=n[d];if(f!==void 0)if(delete n[d],f0&&(n[y.uuid]=f),e[f]=y,e.pop();for(let x=0,S=i;x!==S;++x){const w=r[x];w[f]=w[m],w.pop()}}}this.nCachedObjects_=s}subscribe_(e,n){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,c=l.length,d=this.nCachedObjects_,f=new Array(c);i=s.length,r[e]=i,o.push(e),a.push(n),s.push(f);for(let m=d,y=l.length;m!==y;++m){const x=l[m];f[m]=new Nn(x,e,n)}return f}unsubscribe_(e){const n=this._bindingsIndicesByPath,r=n[e];if(r!==void 0){const i=this._paths,s=this._parsedPaths,o=this._bindings,a=o.length-1,l=o[a],c=e[a];n[c]=r,o[r]=l,o.pop(),s[r]=s[a],s.pop(),i[r]=i[a],i.pop()}}}class rG{constructor(e,n,r=null,i=n.blendMode){this._mixer=e,this._clip=n,this._localRoot=r,this.blendMode=i;const s=n.tracks,o=s.length,a=new Array(o),l={endingStart:sh,endingEnd:sh};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=HV,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,r){if(e.fadeOut(n),this.fadeIn(n),r){const i=this._clip.duration,s=e._clip.duration,o=s/i,a=i/s;e.warp(1,o,n),this.warp(a,1,n)}return this}crossFadeTo(e,n,r){return e.crossFadeFrom(this,n,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,n,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,c=a.sampleValues;return l[0]=s,l[1]=s+r,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,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?n=0:(this._startTime=null,n=r*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 yR:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulateAdditive(a);break;case KS:default:for(let d=0,f=l.length;d!==f;++d)l[d].evaluate(o),c[d].accumulate(i,a)}}}_updateWeight(e){let n=0;if(this.enabled){n=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=n,n}_updateTimeScale(e){let n=0;if(!this.paused){n=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];n*=i,e>r.parameterPositions[1]&&(this.stopWarping(),n===0?this.paused=!0:this.timeScale=n)}}return this._effectiveTimeScale=n,n}_updateTime(e){const n=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===VV;if(e===0)return s===-1?i:o&&(s&1)===1?n-i:i;if(r===BV){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=n)i=n;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>=n||i<0){const a=Math.floor(i/n);i-=n*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?n:0,this.time=i,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=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return n-i}return i}_setEndings(e,n,r){const i=this._interpolantSettings;r?(i.endingStart=oh,i.endingEnd=oh):(e?i.endingStart=this.zeroSlopeAtStart?oh:sh:i.endingStart=A0,n?i.endingEnd=this.zeroSlopeAtEnd?oh:sh:i.endingEnd=A0)}_scheduleFading(e,n,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]=n,a[1]=s+e,l[1]=r,this}}const Txe=new Float32Array(1);class Cxe extends Bl{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,n){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let d=c[l];d===void 0&&(d={},c[l]=d);for(let f=0;f!==s;++f){const m=i[f],y=m.name;let x=d[y];if(x!==void 0)++x.referenceCount,o[f]=x;else{if(x=o[f],x!==void 0){x._cacheIndex===null&&(++x.referenceCount,this._addInactiveBinding(x,l,y));continue}const S=n&&n._propertyBindings[f].binding.parsedPath;x=new nG(Nn.create(r,y,S),m.ValueTypeName,m.getValueSize()),++x.referenceCount,this._addInactiveBinding(x,l,y),o[f]=x}a[f].resultBuffer=x.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 n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const n=e._propertyBindings;for(let r=0,i=n.length;r!==i;++r){const s=n[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 n=e._cacheIndex;return n!==null&&n=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const n=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)n[c]._update(i,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;n=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.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.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,lU).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 cU=new X,S_=new X;class Oxe{constructor(e=new X,n=new X){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){cU.subVectors(e,this.start),S_.subVectors(this.end,this.start);const r=S_.dot(S_);let s=S_.dot(cU)/r;return n&&(s=Ar(s,0,1)),s}closestPointToPoint(e,n,r){const i=this.closestPointToPointParameter(e,n);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 uU=new X;class Lxe extends mn{constructor(e,n){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=n,this.type="SpotLightHelper";const r=new Zt,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 f=0;f.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{mU.set(e.z,0,-e.x).normalize();const n=Math.acos(e.y);this.quaternion.setFromAxisAngle(mU,n)}}setLength(e,n=e*.2,r=n*.2){this.line.scale.set(1,Math.max(1e-4,e-n),1),this.line.updateMatrix(),this.cone.scale.set(r,n,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 oG extends Js{constructor(e=1){const n=[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 Zt;i.setAttribute("position",new kt(n,3)),i.setAttribute("color",new kt(r,3));const s=new $r({vertexColors:!0,toneMapped:!1});super(i,s),this.type="AxesHelper"}setColors(e,n,r){const i=new ot,s=this.geometry.attributes.color.array;return i.set(e),i.toArray(s,0),i.toArray(s,3),i.set(n),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 qxe{constructor(){this.type="ShapePath",this.color=new ot,this.subPaths=[],this.currentPath=null}moveTo(e,n){return this.currentPath=new k0,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,n),this}lineTo(e,n){return this.currentPath.lineTo(e,n),this}quadraticCurveTo(e,n,r,i){return this.currentPath.quadraticCurveTo(e,n,r,i),this}bezierCurveTo(e,n,r,i,s,o){return this.currentPath.bezierCurveTo(e,n,r,i,s,o),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function n(b){const E=[];for(let T=0,C=b.length;TNumber.EPSILON){if(k<0&&(D=E[N],V=-V,F=E[O],k=-k),b.yF.y)continue;if(b.y===D.y){if(b.x===D.x)return!0}else{const j=k*(b.x-D.x)-V*(b.y-D.y);if(j===0)return!0;if(j<0)continue;C=!C}}else{if(b.y!==D.y)continue;if(F.x<=b.x&&b.x<=D.x||D.x<=b.x&&b.x<=F.x)return!0}}return C}const i=Rl.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 Th,l.curves=a.curves,c.push(l),c;let d=!i(s[0].getPoints());d=e?!d:d;const f=[],m=[];let y=[],x=0,S;m[x]=void 0,y[x]=[];for(let b=0,E=s.length;b1){let b=!1,E=0;for(let T=0,C=m.length;T0&&b===!1&&(y=f)}let w;for(let b=0,E=m.length;b{const f=typeof c=="function"?c(e):c;if(f!==e){const m=e;e=d?f:Object.assign({},e,f),n.forEach(y=>y(e,m))}},i=()=>e,s=(c,d=i,f=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let m=d(e);function y(){const x=d(e);if(!f(m,x)){const S=m;c(m=x,S)}}return n.add(y),()=>n.delete(y)},l={setState:r,getState:i,subscribe:(c,d,f)=>d||f?s(c,d,f):(n.add(c),()=>n.delete(c)),destroy:()=>n.clear()};return e=t(r,i,l),l}const tbe=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),yU=tbe?R.useEffect:R.useLayoutEffect;function nbe(t){const e=typeof t=="function"?ebe(t):t,n=(r=e.getState,i=Object.is)=>{const[,s]=R.useReducer(w=>w+1,0),o=e.getState(),a=R.useRef(o),l=R.useRef(r),c=R.useRef(i),d=R.useRef(!1),f=R.useRef();f.current===void 0&&(f.current=r(o));let m,y=!1;(a.current!==o||l.current!==r||c.current!==i||d.current)&&(m=r(o),y=!i(f.current,m)),yU(()=>{y&&(f.current=m),a.current=o,l.current=r,c.current=i,d.current=!1});const x=R.useRef(o);yU(()=>{const w=()=>{try{const E=e.getState(),T=l.current(E);c.current(f.current,T)||(a.current=E,f.current=T,s())}catch{d.current=!0,s()}},b=e.subscribe(w);return e.getState()!==x.current&&w(),b},[]);const S=y?m:f.current;return R.useDebugValue(S),S};return Object.assign(n,e),n[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const r=[n,e];return{next(){const i=r.length<=0;return{value:r.shift(),done:i}}}},n}var UA={exports:{}},jA={exports:{}},FA={};/** + * @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. + */var xU;function rbe(){return xU||(xU=1,(function(t){function e(B,K){var q=B.length;B.push(K);e:for(;0>>1,Z=B[$];if(0>>1;$i(ce,q))wei(Me,ce)?(B[$]=Me,B[we]=q,$=we):(B[$]=ce,B[ae]=q,$=ae);else if(wei(Me,q))B[$]=Me,B[we]=q,$=we;else break e}}return K}function i(B,K){var q=B.sortIndex-K.sortIndex;return q!==0?q:B.id-K.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,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=B)r(c),K.sortIndex=K.expirationTime,e(l,K);else break;K=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var K=n(c);K!==null&&he(C,K.startTime-B)}}function O(B,K){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var q=m;try{for(T(K),f=n(l);f!==null&&(!(f.expirationTime>K)||B&&!j());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=K);K=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(K)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var ae=n(c);ae!==null&&he(C,ae.startTime-K),ge=!1}return ge}finally{f=null,m=q,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125$?(B.sortIndex=q,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,he(C,q-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var K=m;return function(){var q=m;m=K;try{return B.apply(this,arguments)}finally{m=q}}}})(FA)),FA}var bU;function ibe(){return bU||(bU=1,jA.exports=rbe()),jA.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 zA,_U;function sbe(){return _U||(_U=1,zA=function(e){var n={},r=Wh(),i=ibe(),s=Object.assign;function o(p){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+p,M=1;Mye||L[ie]!==z[ye]){var ze=` +`+L[ie].replace(" at new "," at ");return p.displayName&&ze.includes("")&&(ze=ze.replace("",p.displayName)),ze}while(1<=ie&&0<=ye);break}}}finally{Ft=!1,Error.prepareStackTrace=M}return(p=p?p.displayName||p.name:"")?Mt(p):""}var Pt=Object.prototype.hasOwnProperty,Sn=[],Mn=-1;function yn(p){return{current:p}}function Yt(p){0>Mn||(p.current=Sn[Mn],Sn[Mn]=null,Mn--)}function Lt(p,g){Mn++,Sn[Mn]=p.current,p.current=g}var mt={},xn=yn(mt),en=yn(!1),Pr=mt;function li(p,g){var M=p.type.contextTypes;if(!M)return mt;var P=p.stateNode;if(P&&P.__reactInternalMemoizedUnmaskedChildContext===g)return P.__reactInternalMemoizedMaskedChildContext;var L={},z;for(z in M)L[z]=g[z];return P&&(p=p.stateNode,p.__reactInternalMemoizedUnmaskedChildContext=g,p.__reactInternalMemoizedMaskedChildContext=L),L}function kn(p){return p=p.childContextTypes,p!=null}function Is(){Yt(en),Yt(xn)}function Vn(p,g,M){if(xn.current!==mt)throw Error(o(168));Lt(xn,g),Lt(en,M)}function eo(p,g,M){var P=p.stateNode;if(g=g.childContextTypes,typeof P.getChildContext!="function")return M;P=P.getChildContext();for(var L in P)if(!(L in g))throw Error(o(108,F(p)||"Unknown",L));return s({},M,P)}function Ka(p){return p=(p=p.stateNode)&&p.__reactInternalMemoizedMergedChildContext||mt,Pr=xn.current,Lt(xn,p),Lt(en,en.current),!0}function Xr(p,g,M){var P=p.stateNode;if(!P)throw Error(o(169));M?(p=eo(p,g,Pr),P.__reactInternalMemoizedMergedChildContext=p,Yt(en),Yt(xn),Lt(xn,p)):Yt(en),Lt(en,M)}var ci=Math.clz32?Math.clz32:bM,Ld=Math.log,Ya=Math.LN2;function bM(p){return p>>>=0,p===0?32:31-(Ld(p)/Ya|0)|0}var fu=64,Pn=4194304;function hu(p){switch(p&-p){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 p&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return p&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return p}}function Dd(p,g){var M=p.pendingLanes;if(M===0)return 0;var P=0,L=p.suspendedLanes,z=p.pingedLanes,ie=M&268435455;if(ie!==0){var ye=ie&~L;ye!==0?P=hu(ye):(z&=ie,z!==0&&(P=hu(z)))}else ie=M&~L,ie!==0?P=hu(ie):z!==0&&(P=hu(z));if(P===0)return 0;if(g!==0&&g!==P&&(g&L)===0&&(L=P&-P,z=g&-g,L>=z||L===16&&(z&4194240)!==0))return g;if((P&4)!==0&&(P|=M&16),g=p.entangledLanes,g!==0)for(p=p.entanglements,g&=P;0M;M++)g.push(p);return g}function Vl(p,g,M){p.pendingLanes|=g,g!==536870912&&(p.suspendedLanes=0,p.pingedLanes=0),p=p.eventTimes,g=31-ci(g),p[g]=M}function op(p,g){var M=p.pendingLanes&~g;p.pendingLanes=g,p.suspendedLanes=0,p.pingedLanes=0,p.expiredLanes&=g,p.mutableReadLanes&=g,p.entangledLanes&=g,g=p.entanglements;var P=p.eventTimes;for(p=p.expirationTimes;0>=ie,L-=ie,ca=1<<32-ci(g)+L|M<En?(br=sn,sn=null):br=sn.sibling;var bn=Bt(Ie,sn,je[En],gt);if(bn===null){sn===null&&(sn=br);break}p&&sn&&bn.alternate===null&&g(Ie,sn),be=z(bn,be,En),on===null?It=bn:on.sibling=bn,on=bn,sn=br}if(En===je.length)return M(Ie,sn),Zn&&Yl(Ie,En),It;if(sn===null){for(;EnEn?(br=sn,sn=null):br=sn.sibling;var Ea=Bt(Ie,sn,bn.value,gt);if(Ea===null){sn===null&&(sn=br);break}p&&sn&&Ea.alternate===null&&g(Ie,sn),be=z(Ea,be,En),on===null?It=Ea:on.sibling=Ea,on=Ea,sn=br}if(bn.done)return M(Ie,sn),Zn&&Yl(Ie,En),It;if(sn===null){for(;!bn.done;En++,bn=je.next())bn=rn(Ie,bn.value,gt),bn!==null&&(be=z(bn,be,En),on===null?It=bn:on.sibling=bn,on=bn);return Zn&&Yl(Ie,En),It}for(sn=P(Ie,sn);!bn.done;En++,bn=je.next())bn=ln(sn,Ie,En,bn.value,gt),bn!==null&&(p&&bn.alternate!==null&&sn.delete(bn.key===null?En:bn.key),be=z(bn,be,En),on===null?It=bn:on.sibling=bn,on=bn);return p&&sn.forEach(function(Xv){return g(Ie,Xv)}),Zn&&Yl(Ie,En),It}function ys(Ie,be,je,gt){if(typeof je=="object"&&je!==null&&je.type===d&&je.key===null&&(je=je.props.children),typeof je=="object"&&je!==null){switch(je.$$typeof){case l:e:{for(var It=je.key,on=be;on!==null;){if(on.key===It){if(It=je.type,It===d){if(on.tag===7){M(Ie,on.sibling),be=L(on,je.props.children),be.return=Ie,Ie=be;break e}}else if(on.elementType===It||typeof It=="object"&&It!==null&&It.$$typeof===T&&_u(It)===on.type){M(Ie,on.sibling),be=L(on,je.props),be.ref=bu(Ie,on,je),be.return=Ie,Ie=be;break e}M(Ie,on);break}else g(Ie,on);on=on.sibling}je.type===d?(be=yc(je.props.children,Ie.mode,gt,je.key),be.return=Ie,Ie=be):(gt=$p(je.type,je.key,je.props,null,Ie.mode,gt),gt.ref=bu(Ie,be,je),gt.return=Ie,Ie=gt)}return ie(Ie);case c:e:{for(on=je.key;be!==null;){if(be.key===on)if(be.tag===4&&be.stateNode.containerInfo===je.containerInfo&&be.stateNode.implementation===je.implementation){M(Ie,be.sibling),be=L(be,je.children||[]),be.return=Ie,Ie=be;break e}else{M(Ie,be);break}else g(Ie,be);be=be.sibling}be=qp(je,Ie.mode,gt),be.return=Ie,Ie=be}return ie(Ie);case T:return on=je._init,ys(Ie,be,on(je._payload),gt)}if(de(je))return bt(Ie,be,je,gt);if(N(je))return Jr(Ie,be,je,gt);tl(Ie,je)}return typeof je=="string"&&je!==""||typeof je=="number"?(je=""+je,be!==null&&be.tag===6?(M(Ie,be.sibling),be=L(be,je),be.return=Ie,Ie=be):(M(Ie,be),be=Xp(je,Ie.mode,gt),be.return=Ie,Ie=be),ie(Ie)):M(Ie,be)}return ys}var da=Ax(!0),Tx=Ax(!1),wu={},Xi=yn(wu),Zl=yn(wu),Ql=yn(wu);function no(p){if(p===wu)throw Error(o(174));return p}function _p(p,g){Lt(Ql,g),Lt(Zl,p),Lt(Xi,wu),p=he(g),Yt(Xi),Lt(Xi,p)}function Su(){Yt(Xi),Yt(Zl),Yt(Ql)}function Cx(p){var g=no(Ql.current),M=no(Xi.current);g=B(M,p.type,g),M!==g&&(Lt(Zl,p),Lt(Xi,g))}function vv(p){Zl.current===p&&(Yt(Xi),Yt(Zl))}var tr=yn(0);function wp(p){for(var g=p;g!==null;){if(g.tag===13){var M=g.memoizedState;if(M!==null&&(M=M.dehydrated,M===null||qa(M)||Ns(M)))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if((g.flags&128)!==0)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===p)break;for(;g.sibling===null;){if(g.return===null||g.return===p)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var ds=[];function Jl(){for(var p=0;pM?M:4,p(!0);var P=fs.transition;fs.transition={};try{p(!1),g()}finally{dn=M,fs.transition=P}}function nc(){return io().memoizedState}function Rx(p,g,M){var P=lo(p);M={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null},Nx(p)?wv(g,M):(Yd(p,g,M),M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,g,P))}function SM(p,g,M){var P=lo(p),L={lane:P,action:M,hasEagerState:!1,eagerState:null,next:null};if(Nx(p))wv(g,L);else{Yd(p,g,L);var z=p.alternate;if(p.lanes===0&&(z===null||z.lanes===0)&&(z=g.lastRenderedReducer,z!==null))try{var ie=g.lastRenderedState,ye=z(ie,M);if(L.hasEagerState=!0,L.eagerState=ye,Ai(ye,ie))return}catch{}finally{}M=Rn(),p=fi(p,P,M),p!==null&&Zd(p,g,P)}}function Nx(p){var g=p.alternate;return p===nr||g!==null&&g===nr}function wv(p,g){No=Sp=!0;var M=p.pending;M===null?g.next=g:(g.next=M.next,M.next=g),p.pending=g}function Yd(p,g,M){mr!==null&&(p.mode&1)!==0&&(an&2)===0?(p=g.interleaved,p===null?(M.next=M,Ls===null?Ls=[g]:Ls.push(g)):(M.next=p.next,p.next=M),g.interleaved=M):(p=g.pending,p===null?M.next=M:(M.next=p.next,p.next=M),g.pending=M)}function Zd(p,g,M){if((M&4194240)!==0){var P=g.lanes;P&=p.pendingLanes,M|=P,g.lanes=M,Po(p,M)}}var Cu={readContext:$i,useCallback:jr,useContext:jr,useEffect:jr,useImperativeHandle:jr,useInsertionEffect:jr,useLayoutEffect:jr,useMemo:jr,useReducer:jr,useRef:jr,useState:jr,useDebugValue:jr,useDeferredValue:jr,useTransition:jr,useMutableSource:jr,useSyncExternalStore:jr,useId:jr,unstable_isNewReconciler:!1},Sv={readContext:$i,useCallback:function(p,g){return ro().memoizedState=[p,g===void 0?null:g],p},useContext:$i,useEffect:Tp,useImperativeHandle:function(p,g,M){return M=M!=null?M.concat([p]):null,rl(4194308,4,Kd.bind(null,g,p),M)},useLayoutEffect:function(p,g){return rl(4194308,4,p,g)},useInsertionEffect:function(p,g){return rl(4,2,p,g)},useMemo:function(p,g){var M=ro();return g=g===void 0?null:g,p=p(),M.memoizedState=[p,g],p},useReducer:function(p,g,M){var P=ro();return g=M!==void 0?M(g):g,P.memoizedState=P.baseState=g,p={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:p,lastRenderedState:g},P.queue=p,p=p.dispatch=Rx.bind(null,nr,p),[P.memoizedState,p]},useRef:function(p){var g=ro();return p={current:p},g.memoizedState=p},useState:Xd,useDebugValue:Pp,useDeferredValue:function(p){var g=Xd(p),M=g[0],P=g[1];return Tp(function(){var L=fs.transition;fs.transition={};try{P(p)}finally{fs.transition=L}},[p]),M},useTransition:function(){var p=Xd(!1),g=p[0];return p=Np.bind(null,p[1]),ro().memoizedState=p,[g,p]},useMutableSource:function(){},useSyncExternalStore:function(p,g,M){var P=nr,L=ro();if(Zn){if(M===void 0)throw Error(o(407));M=M()}else{if(M=g(),mr===null)throw Error(o(349));(ec&30)!==0||bv(P,g,M)}L.memoizedState=M;var z={value:M,getSnapshot:g};return L.queue=z,Tp(fa.bind(null,P,z,p),[p]),P.flags|=2048,qd(9,_v.bind(null,P,z,M,g),void 0,null),M},useId:function(){var p=ro(),g=mr.identifierPrefix;if(Zn){var M=ua,P=ca;M=(P&~(1<<32-ci(P)-1)).toString(32)+M,g=":"+g+"R"+M,M=tc++,0al&&(g.flags|=128,P=!0,pa(L,!1),g.lanes=4194304)}else{if(!P)if(p=wp(z),p!==null){if(g.flags|=128,P=!0,p=p.updateQueue,p!==null&&(g.updateQueue=p,g.flags|=4),pa(L,!0),L.tail===null&&L.tailMode==="hidden"&&!z.alternate&&!Zn)return pr(g),null}else 2*Rr()-L.renderingStartTime>al&&M!==1073741824&&(g.flags|=128,P=!0,pa(L,!1),g.lanes=4194304);L.isBackwards?(z.sibling=g.child,g.child=z):(p=L.last,p!==null?p.sibling=z:g.child=z,L.last=z)}return L.tail!==null?(g=L.tail,L.rendering=g,L.tail=g.sibling,L.renderingStartTime=Rr(),g.sibling=null,p=tr.current,Lt(tr,P?p&1|2:p&1),g):(pr(g),null);case 22:case 23:return ff(),P=g.memoizedState!==null,p!==null&&p.memoizedState!==null!==P&&(g.flags|=8192),P&&(g.mode&1)!==0?(di&1073741824)!==0&&(pr(g),Xe&&g.subtreeFlags&6&&(g.flags|=8192)):pr(g),null;case 24:return null;case 25:return null}throw Error(o(156,g.tag))}var Cv=a.ReactCurrentOwner,Fr=!1;function ar(p,g,M,P){g.child=p===null?Tx(g,null,M,P):da(g,p.child,M,P)}function $n(p,g,M,P,L){M=M.render;var z=g.ref;return mu(g,L),P=Mu(p,g,M,P,z,L),M=nl(),p!==null&&!Fr?(g.updateQueue=p.updateQueue,g.flags&=-2053,p.lanes&=~L,qi(p,g,L)):(Zn&&M&&hv(g),g.flags|=1,ar(p,g,P,L),g.child)}function Gn(p,g,M,P,L){if(p===null){var z=M.type;return typeof z=="function"&&!Wp(z)&&z.defaultProps===void 0&&M.compare===null&&M.defaultProps===void 0?(g.tag=15,g.type=z,ma(p,g,z,P,L)):(p=$p(M.type,null,P,g,g.mode,L),p.ref=g.ref,p.return=g,g.child=p)}if(z=p.child,(p.lanes&L)===0){var ie=z.memoizedProps;if(M=M.compare,M=M!==null?M:to,M(ie,P)&&p.ref===g.ref)return qi(p,g,L)}return g.flags|=1,p=Ma(z,P),p.ref=g.ref,p.return=g,g.child=p}function ma(p,g,M,P,L){if(p!==null&&to(p.memoizedProps,P)&&p.ref===g.ref)if(Fr=!1,(p.lanes&L)!==0)(p.flags&131072)!==0&&(Fr=!0);else return g.lanes=p.lanes,qi(p,g,L);return ga(p,g,M,P,L)}function Kr(p,g,M){var P=g.pendingProps,L=P.children,z=p!==null?p.memoizedState:null;if(P.mode==="hidden")if((g.mode&1)===0)g.memoizedState={baseLanes:0,cachePool:null},Lt(hc,di),di|=M;else if((M&1073741824)!==0)g.memoizedState={baseLanes:0,cachePool:null},P=z!==null?z.baseLanes:M,Lt(hc,di),di|=P;else return p=z!==null?z.baseLanes|M:M,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:p,cachePool:null},g.updateQueue=null,Lt(hc,di),di|=p,null;else z!==null?(P=z.baseLanes|M,g.memoizedState=null):P=M,Lt(hc,di),di|=P;return ar(p,g,L,M),g.child}function Pi(p,g){var M=g.ref;(p===null&&M!==null||p!==null&&p.ref!==M)&&(g.flags|=512,g.flags|=2097152)}function ga(p,g,M,P,L){var z=kn(M)?Pr:xn.current;return z=li(g,z),mu(g,L),M=Mu(p,g,M,P,z,L),P=nl(),p!==null&&!Fr?(g.updateQueue=p.updateQueue,g.flags&=-2053,p.lanes&=~L,qi(p,g,L)):(Zn&&P&&hv(g),g.flags|=1,ar(p,g,M,L),g.child)}function sc(p,g,M,P,L){if(kn(M)){var z=!0;Ka(g)}else z=!1;if(mu(g,L),g.stateNode===null)p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),wx(g,M,P),fv(g,M,P,L),P=!0;else if(p===null){var ie=g.stateNode,ye=g.memoizedProps;ie.props=ye;var ze=ie.context,tt=M.contextType;typeof tt=="object"&&tt!==null?tt=$i(tt):(tt=kn(M)?Pr:xn.current,tt=li(g,tt));var St=M.getDerivedStateFromProps,rn=typeof St=="function"||typeof ie.getSnapshotBeforeUpdate=="function";rn||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==P||ze!==tt)&&Sx(g,ie,P,tt),Ds=!1;var Bt=g.memoizedState;ie.state=Bt,mp(g,P,ie,L),ze=g.memoizedState,ye!==P||Bt!==ze||en.current||Ds?(typeof St=="function"&&(uv(g,M,St,P),ze=g.memoizedState),(ye=Ds||dv(g,M,ye,P,Bt,ze,tt))?(rn||typeof ie.UNSAFE_componentWillMount!="function"&&typeof ie.componentWillMount!="function"||(typeof ie.componentWillMount=="function"&&ie.componentWillMount(),typeof ie.UNSAFE_componentWillMount=="function"&&ie.UNSAFE_componentWillMount()),typeof ie.componentDidMount=="function"&&(g.flags|=4194308)):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=P,g.memoizedState=ze),ie.props=P,ie.state=ze,ie.context=tt,P=ye):(typeof ie.componentDidMount=="function"&&(g.flags|=4194308),P=!1)}else{ie=g.stateNode,cv(p,g),ye=g.memoizedProps,tt=g.type===g.elementType?ye:Wi(g.type,ye),ie.props=tt,rn=g.pendingProps,Bt=ie.context,ze=M.contextType,typeof ze=="object"&&ze!==null?ze=$i(ze):(ze=kn(M)?Pr:xn.current,ze=li(g,ze));var ln=M.getDerivedStateFromProps;(St=typeof ln=="function"||typeof ie.getSnapshotBeforeUpdate=="function")||typeof ie.UNSAFE_componentWillReceiveProps!="function"&&typeof ie.componentWillReceiveProps!="function"||(ye!==rn||Bt!==ze)&&Sx(g,ie,P,ze),Ds=!1,Bt=g.memoizedState,ie.state=Bt,mp(g,P,ie,L);var bt=g.memoizedState;ye!==rn||Bt!==bt||en.current||Ds?(typeof ln=="function"&&(uv(g,M,ln,P),bt=g.memoizedState),(tt=Ds||dv(g,M,tt,P,Bt,bt,ze)||!1)?(St||typeof ie.UNSAFE_componentWillUpdate!="function"&&typeof ie.componentWillUpdate!="function"||(typeof ie.componentWillUpdate=="function"&&ie.componentWillUpdate(P,bt,ze),typeof ie.UNSAFE_componentWillUpdate=="function"&&ie.UNSAFE_componentWillUpdate(P,bt,ze)),typeof ie.componentDidUpdate=="function"&&(g.flags|=4),typeof ie.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Bt===p.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Bt===p.memoizedState||(g.flags|=1024),g.memoizedProps=P,g.memoizedState=bt),ie.props=P,ie.state=bt,ie.context=ze,P=tt):(typeof ie.componentDidUpdate!="function"||ye===p.memoizedProps&&Bt===p.memoizedState||(g.flags|=4),typeof ie.getSnapshotBeforeUpdate!="function"||ye===p.memoizedProps&&Bt===p.memoizedState||(g.flags|=1024),P=!1)}return ui(p,g,M,P,z,L)}function ui(p,g,M,P,L,z){Pi(p,g);var ie=(g.flags&128)!==0;if(!P&&!ie)return L&&Xr(g,M,!1),qi(p,g,z);P=g.stateNode,Cv.current=g;var ye=ie&&typeof M.getDerivedStateFromError!="function"?null:P.render();return g.flags|=1,p!==null&&ie?(g.child=da(g,p.child,null,z),g.child=da(g,null,ye,z)):ar(p,g,ye,z),g.memoizedState=P.state,L&&Xr(g,M,!0),g.child}function Qd(p){var g=p.stateNode;g.pendingContext?Vn(p,g.pendingContext,g.pendingContext!==g.context):g.context&&Vn(p,g.context,!1),_p(p,g.containerInfo)}function Pv(p,g,M,P,L){return xu(),bp(L),g.flags|=256,ar(p,g,M,P),g.child}var Jd={dehydrated:null,treeContext:null,retryLane:0};function oc(p){return{baseLanes:p,cachePool:null}}function Rv(p,g,M){var P=g.pendingProps,L=tr.current,z=!1,ie=(g.flags&128)!==0,ye;if((ye=ie)||(ye=p!==null&&p.memoizedState===null?!1:(L&2)!==0),ye?(z=!0,g.flags&=-129):(p===null||p.memoizedState!==null)&&(L|=1),Lt(tr,L&1),p===null)return el(g),p=g.memoizedState,p!==null&&(p=p.dehydrated,p!==null)?((g.mode&1)===0?g.lanes=1:Ns(p)?g.lanes=8:g.lanes=1073741824,null):(L=P.children,p=P.fallback,z?(P=g.mode,z=g.child,L={mode:"hidden",children:L},(P&1)===0&&z!==null?(z.childLanes=0,z.pendingProps=L):z=mf(L,P,0,null),p=yc(p,P,M,null),z.return=g,p.return=g,z.sibling=p,g.child=z,g.child.memoizedState=oc(M),g.memoizedState=Jd,p):so(g,L));if(L=p.memoizedState,L!==null){if(ye=L.dehydrated,ye!==null){if(ie)return g.flags&256?(g.flags&=-257,tf(p,g,M,Error(o(422)))):g.memoizedState!==null?(g.child=p.child,g.flags|=128,null):(z=P.fallback,L=g.mode,P=mf({mode:"visible",children:P.children},L,0,null),z=yc(z,L,M,null),z.flags|=2,P.return=g,z.return=g,P.sibling=z,g.child=P,(g.mode&1)!==0&&da(g,p.child,null,M),g.child.memoizedState=oc(M),g.memoizedState=Jd,z);if((g.mode&1)===0)g=tf(p,g,M,null);else if(Ns(ye))g=tf(p,g,M,Error(o(419)));else if(P=(M&p.childLanes)!==0,Fr||P){if(P=mr,P!==null){switch(M&-M){case 4:z=2;break;case 16:z=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:z=32;break;case 536870912:z=268435456;break;default:z=0}P=(z&(P.suspendedLanes|M))!==0?0:z,P!==0&&P!==L.retryLane&&(L.retryLane=P,fi(p,P,-1))}Vp(),g=tf(p,g,M,Error(o(421)))}else qa(ye)?(g.flags|=128,g.child=p.child,g=Ux.bind(null,p),ia(ye,g),g=null):(M=L.treeContext,Q&&(qr=cu(ye),Ci=g,Zn=!0,js=null,yu=!1,M!==null&&(Us[us++]=ca,Us[us++]=ua,Us[us++]=Kl,ca=M.id,ua=M.overflow,Kl=g)),g=so(g,g.pendingProps.children),g.flags|=4096);return g}return z?(P=Up(p,g,P.children,P.fallback,M),z=g.child,L=p.child.memoizedState,z.memoizedState=L===null?oc(M):{baseLanes:L.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,g.memoizedState=Jd,P):(M=ef(p,g,P.children,M),g.memoizedState=null,M)}return z?(P=Up(p,g,P.children,P.fallback,M),z=g.child,L=p.child.memoizedState,z.memoizedState=L===null?oc(M):{baseLanes:L.baseLanes|M,cachePool:null},z.childLanes=p.childLanes&~M,g.memoizedState=Jd,P):(M=ef(p,g,P.children,M),g.memoizedState=null,M)}function so(p,g){return g=mf({mode:"visible",children:g},p.mode,0,null),g.return=p,p.child=g}function ef(p,g,M,P){var L=p.child;return p=L.sibling,M=Ma(L,{mode:"visible",children:M}),(g.mode&1)===0&&(M.lanes=P),M.return=g,M.sibling=null,p!==null&&(P=g.deletions,P===null?(g.deletions=[p],g.flags|=16):P.push(p)),g.child=M}function Up(p,g,M,P,L){var z=g.mode;p=p.child;var ie=p.sibling,ye={mode:"hidden",children:M};return(z&1)===0&&g.child!==p?(M=g.child,M.childLanes=0,M.pendingProps=ye,g.deletions=null):(M=Ma(p,ye),M.subtreeFlags=p.subtreeFlags&14680064),ie!==null?P=Ma(ie,P):(P=yc(P,z,L,null),P.flags|=2),P.return=g,M.return=g,M.sibling=P,g.child=M,P}function tf(p,g,M,P){return P!==null&&bp(P),da(g,p.child,null,M),p=so(g,g.pendingProps.children),p.flags|=2,g.memoizedState=null,p}function kx(p,g,M){p.lanes|=g;var P=p.alternate;P!==null&&(P.lanes|=g),ql(p.return,g,M)}function ko(p,g,M,P,L){var z=p.memoizedState;z===null?p.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:P,tail:M,tailMode:L}:(z.isBackwards=g,z.rendering=null,z.renderingStartTime=0,z.last=P,z.tail=M,z.tailMode=L)}function ac(p,g,M){var P=g.pendingProps,L=P.revealOrder,z=P.tail;if(ar(p,g,P.children,M),P=tr.current,(P&2)!==0)P=P&1|2,g.flags|=128;else{if(p!==null&&(p.flags&128)!==0)e:for(p=g.child;p!==null;){if(p.tag===13)p.memoizedState!==null&&kx(p,M,g);else if(p.tag===19)kx(p,M,g);else if(p.child!==null){p.child.return=p,p=p.child;continue}if(p===g)break e;for(;p.sibling===null;){if(p.return===null||p.return===g)break e;p=p.return}p.sibling.return=p.return,p=p.sibling}P&=1}if(Lt(tr,P),(g.mode&1)===0)g.memoizedState=null;else switch(L){case"forwards":for(M=g.child,L=null;M!==null;)p=M.alternate,p!==null&&wp(p)===null&&(L=M),M=M.sibling;M=L,M===null?(L=g.child,g.child=null):(L=M.sibling,M.sibling=null),ko(g,!1,L,M,z);break;case"backwards":for(M=null,L=g.child,g.child=null;L!==null;){if(p=L.alternate,p!==null&&wp(p)===null){g.child=L;break}p=L.sibling,L.sibling=M,M=L,L=p}ko(g,!0,M,null,z);break;case"together":ko(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function qi(p,g,M){if(p!==null&&(g.dependencies=p.dependencies),Oo|=g.lanes,(M&g.childLanes)===0)return null;if(p!==null&&g.child!==p.child)throw Error(o(153));if(g.child!==null){for(p=g.child,M=Ma(p,p.pendingProps),g.child=M,M.return=g;p.sibling!==null;)p=p.sibling,M=M.sibling=Ma(p,p.pendingProps),M.return=g;M.sibling=null}return g.child}function jp(p,g,M){switch(g.tag){case 3:Qd(g),xu();break;case 5:Cx(g);break;case 1:kn(g.type)&&Ka(g);break;case 4:_p(g,g.stateNode.containerInfo);break;case 10:Xl(g,g.type._context,g.memoizedProps.value);break;case 13:var P=g.memoizedState;if(P!==null)return P.dehydrated!==null?(Lt(tr,tr.current&1),g.flags|=128,null):(M&g.child.childLanes)!==0?Rv(p,g,M):(Lt(tr,tr.current&1),p=qi(p,g,M),p!==null?p.sibling:null);Lt(tr,tr.current&1);break;case 19:if(P=(M&g.childLanes)!==0,(p.flags&128)!==0){if(P)return ac(p,g,M);g.flags|=128}var L=g.memoizedState;if(L!==null&&(L.rendering=null,L.tail=null,L.lastEffect=null),Lt(tr,tr.current),P)break;return null;case 22:case 23:return g.lanes=0,Kr(p,g,M)}return qi(p,g,M)}function Fp(p,g){switch(pv(g),g.tag){case 1:return kn(g.type)&&Is(),p=g.flags,p&65536?(g.flags=p&-65537|128,g):null;case 3:return Su(),Yt(en),Yt(xn),Jl(),p=g.flags,(p&65536)!==0&&(p&128)===0?(g.flags=p&-65537|128,g):null;case 5:return vv(g),null;case 13:if(Yt(tr),p=g.memoizedState,p!==null&&p.dehydrated!==null){if(g.alternate===null)throw Error(o(340));xu()}return p=g.flags,p&65536?(g.flags=p&-65537|128,g):null;case 19:return Yt(tr),null;case 4:return Su(),null;case 10:return Bd(g.type._context),null;case 22:case 23:return ff(),null;case 24:return null;default:return null}}var Ri=!1,zr=!1,lc=typeof WeakSet=="function"?WeakSet:Set,ct=null;function Fs(p,g){var M=p.ref;if(M!==null)if(typeof M=="function")try{M(null)}catch(P){Ii(p,g,P)}else M.current=null}function va(p,g,M){try{M()}catch(P){Ii(p,g,P)}}var Nv=!1;function Iv(p,g){for(K(p.containerInfo),ct=g;ct!==null;)if(p=ct,g=p.child,(p.subtreeFlags&1028)!==0&&g!==null)g.return=p,ct=g;else for(;ct!==null;){p=ct;try{var M=p.alternate;if((p.flags&1024)!==0)switch(p.tag){case 0:case 11:case 15:break;case 1:if(M!==null){var P=M.memoizedProps,L=M.memoizedState,z=p.stateNode,ie=z.getSnapshotBeforeUpdate(p.elementType===p.type?P:Wi(p.type,P),L);z.__reactInternalSnapshotBeforeUpdate=ie}break;case 3:Xe&&Ke(p.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(o(163))}}catch(ye){Ii(p,p.return,ye)}if(g=p.sibling,g!==null){g.return=p.return,ct=g;break}ct=p.return}return M=Nv,Nv=!1,M}function ya(p,g,M){var P=g.updateQueue;if(P=P!==null?P.lastEffect:null,P!==null){var L=P=P.next;do{if((L.tag&p)===p){var z=L.destroy;L.destroy=void 0,z!==void 0&&va(g,M,z)}L=L.next}while(L!==P)}}function Yr(p,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var M=g=g.next;do{if((M.tag&p)===p){var P=M.create;M.destroy=P()}M=M.next}while(M!==g)}}function Ni(p){var g=p.ref;if(g!==null){var M=p.stateNode;switch(p.tag){case 5:p=oe(M);break;default:p=M}typeof g=="function"?g(p):g.current=p}}function qn(p,g,M){if(Ro&&typeof Ro.onCommitFiberUnmount=="function")try{Ro.onCommitFiberUnmount(Ud,g)}catch{}switch(g.tag){case 0:case 11:case 14:case 15:if(p=g.updateQueue,p!==null&&(p=p.lastEffect,p!==null)){var P=p=p.next;do{var L=P,z=L.destroy;L=L.tag,z!==void 0&&((L&2)!==0||(L&4)!==0)&&va(g,M,z),P=P.next}while(P!==p)}break;case 1:if(Fs(g,M),p=g.stateNode,typeof p.componentWillUnmount=="function")try{p.props=g.memoizedProps,p.state=g.memoizedState,p.componentWillUnmount()}catch(ie){Ii(g,M,ie)}break;case 5:Fs(g,M);break;case 4:Xe?Lv(p,g,M):fe&&fe&&(g=g.stateNode.containerInfo,M=Kt(g),Jt(g,M))}}function zs(p,g,M){for(var P=g;;)if(qn(p,P,M),P.child===null||Xe&&P.tag===4){if(P===g)break;for(;P.sibling===null;){if(P.return===null||P.return===g)return;P=P.return}P.sibling.return=P.return,P=P.sibling}else P.child.return=P,P=P.child}function kv(p){var g=p.alternate;g!==null&&(p.alternate=null,kv(g)),p.child=null,p.deletions=null,p.sibling=null,p.tag===5&&(g=p.stateNode,g!==null&&Qe(g)),p.stateNode=null,p.return=null,p.dependencies=null,p.memoizedProps=null,p.memoizedState=null,p.pendingProps=null,p.stateNode=null,p.updateQueue=null}function Ov(p){return p.tag===5||p.tag===3||p.tag===4}function zp(p){e:for(;;){for(;p.sibling===null;){if(p.return===null||Ov(p.return))return null;p=p.return}for(p.sibling.return=p.return,p=p.sibling;p.tag!==5&&p.tag!==6&&p.tag!==18;){if(p.flags&2||p.child===null||p.tag===4)continue e;p.child.return=p,p=p.child}if(!(p.flags&2))return p.stateNode}}function Bp(p){if(Xe){e:{for(var g=p.return;g!==null;){if(Ov(g))break e;g=g.return}throw Error(o(160))}var M=g;switch(M.tag){case 5:g=M.stateNode,M.flags&32&&(Ae(g),M.flags&=-33),M=zp(p),Ru(p,M,g);break;case 3:case 4:g=M.stateNode.containerInfo,M=zp(p),Hp(p,M,g);break;default:throw Error(o(161))}}}function Hp(p,g,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,g?pt(M,p,g):nn(M,p);else if(P!==4&&(p=p.child,p!==null))for(Hp(p,g,M),p=p.sibling;p!==null;)Hp(p,g,M),p=p.sibling}function Ru(p,g,M){var P=p.tag;if(P===5||P===6)p=p.stateNode,g?Ut(M,p,g):ft(M,p);else if(P!==4&&(p=p.child,p!==null))for(Ru(p,g,M),p=p.sibling;p!==null;)Ru(p,g,M),p=p.sibling}function Lv(p,g,M){for(var P=g,L=!1,z,ie;;){if(!L){L=P.return;e:for(;;){if(L===null)throw Error(o(160));switch(z=L.stateNode,L.tag){case 5:ie=!1;break e;case 3:z=z.containerInfo,ie=!0;break e;case 4:z=z.containerInfo,ie=!0;break e}L=L.return}L=!0}if(P.tag===5||P.tag===6)zs(p,P,M),ie?ee(z,P.stateNode):ue(z,P.stateNode);else if(P.tag===18)ie?ke(z,P.stateNode):Re(z,P.stateNode);else if(P.tag===4){if(P.child!==null){z=P.stateNode.containerInfo,ie=!0,P.child.return=P,P=P.child;continue}}else if(qn(p,P,M),P.child!==null){P.child.return=P,P=P.child;continue}if(P===g)break;for(;P.sibling===null;){if(P.return===null||P.return===g)return;P=P.return,P.tag===4&&(L=!1)}P.sibling.return=P.return,P=P.sibling}}function sl(p,g){if(Xe){switch(g.tag){case 0:case 11:case 14:case 15:ya(3,g,g.return),Yr(3,g),ya(5,g,g.return);return;case 1:return;case 5:var M=g.stateNode;if(M!=null){var P=g.memoizedProps;p=p!==null?p.memoizedProps:P;var L=g.type,z=g.updateQueue;g.updateQueue=null,z!==null&&Dt(M,z,L,p,P,g)}return;case 6:if(g.stateNode===null)throw Error(o(162));M=g.memoizedProps,qe(g.stateNode,p!==null?p.memoizedProps:M,M);return;case 3:Q&&p!==null&&p.memoizedState.isDehydrated&&Y(g.stateNode.containerInfo);return;case 12:return;case 13:Nu(g);return;case 19:Nu(g);return;case 17:return}throw Error(o(163))}switch(g.tag){case 0:case 11:case 14:case 15:ya(3,g,g.return),Yr(3,g),ya(5,g,g.return);return;case 12:return;case 13:Nu(g);return;case 19:Nu(g);return;case 3:Q&&p!==null&&p.memoizedState.isDehydrated&&Y(g.stateNode.containerInfo);break;case 22:case 23:return}e:if(fe){switch(g.tag){case 1:case 5:case 6:break e;case 3:case 4:g=g.stateNode,Jt(g.containerInfo,g.pendingChildren);break e}throw Error(o(163))}}function Nu(p){var g=p.updateQueue;if(g!==null){p.updateQueue=null;var M=p.stateNode;M===null&&(M=p.stateNode=new lc),g.forEach(function(P){var L=jx.bind(null,p,P);M.has(P)||(M.add(P),P.then(L,L))})}}function EM(p,g){for(ct=g;ct!==null;){g=ct;var M=g.deletions;if(M!==null)for(var P=0;P";case uc:return":has("+(ol(p)||"")+")";case dc:return'[role="'+p.value+'"]';case Iu:return'"'+p.value+'"';case xa:return'[data-testname="'+p.value+'"]';default:throw Error(o(365))}}function ps(p,g){var M=[];p=[p,0];for(var P=0;PL&&(L=ie),P&=~z}if(P=L,P=Rr()-P,P=(120>P?120:480>P?480:1080>P?1080:1920>P?1920:3e3>P?3e3:4320>P?4320:1960*jv(P/1960))-P,10p?16:p,Lo===null)var P=!1;else{if(p=Lo,Lo=null,gc=0,(an&6)!==0)throw Error(o(331));var L=an;for(an|=4,ct=p.current;ct!==null;){var z=ct,ie=z.child;if((ct.flags&16)!==0){var ye=z.deletions;if(ye!==null){for(var ze=0;zeRr()-cf?Sa(p,0):pc|=M),Ki(p,g)}function Wv(p,g){g===0&&((p.mode&1)===0?g=1:(g=Pn,Pn<<=1,(Pn&130023424)===0&&(Pn=4194304)));var M=Rn();p=ll(p,g),p!==null&&(Vl(p,g,M),Ki(p,M))}function Ux(p){var g=p.memoizedState,M=0;g!==null&&(M=g.retryLane),Wv(p,M)}function jx(p,g){var M=0;switch(p.tag){case 13:var P=p.stateNode,L=p.memoizedState;L!==null&&(M=L.retryLane);break;case 19:P=p.stateNode;break;default:throw Error(o(314))}P!==null&&P.delete(g),Wv(p,M)}var $v;$v=function(p,g,M){if(p!==null)if(p.memoizedProps!==g.pendingProps||en.current)Fr=!0;else{if((p.lanes&M)===0&&(g.flags&128)===0)return Fr=!1,jp(p,g,M);Fr=(p.flags&131072)!==0}else Fr=!1,Zn&&(g.flags&1048576)!==0&&Mx(g,yp,g.index);switch(g.lanes=0,g.tag){case 2:var P=g.type;p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),p=g.pendingProps;var L=li(g,xn.current);mu(g,M),L=Mu(null,g,P,p,L,M);var z=nl();return g.flags|=1,typeof L=="object"&&L!==null&&typeof L.render=="function"&&L.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,kn(P)?(z=!0,Ka(g)):z=!1,g.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,gu(g),L.updater=gp,g.stateNode=L,L._reactInternals=g,fv(g,P,p,M),g=ui(null,g,P,!0,z,M)):(g.tag=0,Zn&&z&&hv(g),ar(null,g,L,M),g=g.child),g;case 16:P=g.elementType;e:{switch(p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),p=g.pendingProps,L=P._init,P=L(P._payload),g.type=P,L=g.tag=AM(P),p=Wi(P,p),L){case 0:g=ga(null,g,P,p,M);break e;case 1:g=sc(null,g,P,p,M);break e;case 11:g=$n(null,g,P,p,M);break e;case 14:g=Gn(null,g,P,Wi(P.type,p),M);break e}throw Error(o(306,P,""))}return g;case 0:return P=g.type,L=g.pendingProps,L=g.elementType===P?L:Wi(P,L),ga(p,g,P,L,M);case 1:return P=g.type,L=g.pendingProps,L=g.elementType===P?L:Wi(P,L),sc(p,g,P,L,M);case 3:e:{if(Qd(g),p===null)throw Error(o(387));P=g.pendingProps,z=g.memoizedState,L=z.element,cv(p,g),mp(g,P,null,M);var ie=g.memoizedState;if(P=ie.element,Q&&z.isDehydrated)if(z={element:P,isDehydrated:!1,cache:ie.cache,transitions:ie.transitions},g.updateQueue.baseState=z,g.memoizedState=z,g.flags&256){L=Error(o(423)),g=Pv(p,g,P,M,L);break e}else if(P!==L){L=Error(o(424)),g=Pv(p,g,P,M,L);break e}else for(Q&&(qr=sa(g.stateNode.containerInfo),Ci=g,Zn=!0,js=null,yu=!1),M=Tx(g,null,P,M),g.child=M;M;)M.flags=M.flags&-3|4096,M=M.sibling;else{if(xu(),P===L){g=qi(p,g,M);break e}ar(p,g,P,M)}g=g.child}return g;case 5:return Cx(g),p===null&&el(g),P=g.type,L=g.pendingProps,z=p!==null?p.memoizedProps:null,ie=L.children,ce(P,L)?ie=null:z!==null&&ce(P,z)&&(g.flags|=32),Pi(p,g),ar(p,g,ie,M),g.child;case 6:return p===null&&el(g),null;case 13:return Rv(p,g,M);case 4:return _p(g,g.stateNode.containerInfo),P=g.pendingProps,p===null?g.child=da(g,null,P,M):ar(p,g,P,M),g.child;case 11:return P=g.type,L=g.pendingProps,L=g.elementType===P?L:Wi(P,L),$n(p,g,P,L,M);case 7:return ar(p,g,g.pendingProps,M),g.child;case 8:return ar(p,g,g.pendingProps.children,M),g.child;case 12:return ar(p,g,g.pendingProps.children,M),g.child;case 10:e:{if(P=g.type._context,L=g.pendingProps,z=g.memoizedProps,ie=L.value,Xl(g,P,ie),z!==null)if(Ai(z.value,ie)){if(z.children===L.children&&!en.current){g=qi(p,g,M);break e}}else for(z=g.child,z!==null&&(z.return=g);z!==null;){var ye=z.dependencies;if(ye!==null){ie=z.child;for(var ze=ye.firstContext;ze!==null;){if(ze.context===P){if(z.tag===1){ze=la(-1,M&-M),ze.tag=2;var tt=z.updateQueue;if(tt!==null){tt=tt.shared;var St=tt.pending;St===null?ze.next=ze:(ze.next=St.next,St.next=ze),tt.pending=ze}}z.lanes|=M,ze=z.alternate,ze!==null&&(ze.lanes|=M),ql(z.return,M,g),ye.lanes|=M;break}ze=ze.next}}else if(z.tag===10)ie=z.type===g.type?null:z.child;else if(z.tag===18){if(ie=z.return,ie===null)throw Error(o(341));ie.lanes|=M,ye=ie.alternate,ye!==null&&(ye.lanes|=M),ql(ie,M,g),ie=z.sibling}else ie=z.child;if(ie!==null)ie.return=z;else for(ie=z;ie!==null;){if(ie===g){ie=null;break}if(z=ie.sibling,z!==null){z.return=ie.return,ie=z;break}ie=ie.return}z=ie}ar(p,g,L.children,M),g=g.child}return g;case 9:return L=g.type,P=g.pendingProps.children,mu(g,M),L=$i(L),P=P(L),g.flags|=1,ar(p,g,P,M),g.child;case 14:return P=g.type,L=Wi(P,g.pendingProps),L=Wi(P.type,L),Gn(p,g,P,L,M);case 15:return ma(p,g,g.type,g.pendingProps,M);case 17:return P=g.type,L=g.pendingProps,L=g.elementType===P?L:Wi(P,L),p!==null&&(p.alternate=null,g.alternate=null,g.flags|=2),g.tag=1,kn(P)?(p=!0,Ka(g)):p=!1,mu(g,M),wx(g,P,L),fv(g,P,L,M),ui(null,g,P,!0,p,M);case 19:return ac(p,g,M);case 22:return Kr(p,g,M)}throw Error(o(156,g.tag))};function Gp(p,g){return Gl(p,g)}function Fx(p,g,M,P){this.tag=p,this.key=M,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=P,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(p,g,M,P){return new Fx(p,g,M,P)}function Wp(p){return p=p.prototype,!(!p||!p.isReactComponent)}function AM(p){if(typeof p=="function")return Wp(p)?1:0;if(p!=null){if(p=p.$$typeof,p===S)return 11;if(p===E)return 14}return 2}function Ma(p,g){var M=p.alternate;return M===null?(M=vs(p.tag,g,p.key,p.mode),M.elementType=p.elementType,M.type=p.type,M.stateNode=p.stateNode,M.alternate=p,p.alternate=M):(M.pendingProps=g,M.type=p.type,M.flags=0,M.subtreeFlags=0,M.deletions=null),M.flags=p.flags&14680064,M.childLanes=p.childLanes,M.lanes=p.lanes,M.child=p.child,M.memoizedProps=p.memoizedProps,M.memoizedState=p.memoizedState,M.updateQueue=p.updateQueue,g=p.dependencies,M.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},M.sibling=p.sibling,M.index=p.index,M.ref=p.ref,M}function $p(p,g,M,P,L,z){var ie=2;if(P=p,typeof p=="function")Wp(p)&&(ie=1);else if(typeof p=="string")ie=5;else e:switch(p){case d:return yc(M.children,L,z,g);case f:ie=8,L|=8;break;case m:return p=vs(12,M,g,L|2),p.elementType=m,p.lanes=z,p;case w:return p=vs(13,M,g,L),p.elementType=w,p.lanes=z,p;case b:return p=vs(19,M,g,L),p.elementType=b,p.lanes=z,p;case C:return mf(M,L,z,g);default:if(typeof p=="object"&&p!==null)switch(p.$$typeof){case y:ie=10;break e;case x:ie=9;break e;case S:ie=11;break e;case E:ie=14;break e;case T:ie=16,P=null;break e}throw Error(o(130,p==null?p:typeof p,""))}return g=vs(ie,M,g,L),g.elementType=p,g.type=P,g.lanes=z,g}function yc(p,g,M,P){return p=vs(7,p,P,g),p.lanes=M,p}function mf(p,g,M,P){return p=vs(22,p,P,g),p.elementType=C,p.lanes=M,p.stateNode={},p}function Xp(p,g,M){return p=vs(6,p,null,g),p.lanes=M,p}function qp(p,g,M){return g=vs(4,p.children!==null?p.children:[],p.key,g),g.lanes=M,g.stateNode={containerInfo:p.containerInfo,pendingChildren:null,implementation:p.implementation},g}function Kp(p,g,M,P,L){this.tag=g,this.containerInfo=p,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Se,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=sp(0),this.expirationTimes=sp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=sp(0),this.identifierPrefix=P,this.onRecoverableError=L,Q&&(this.mutableSourceEagerHydrationData=null)}function zx(p,g,M,P,L,z,ie,ye,ze){return p=new Kp(p,g,M,ye,ze),g===1?(g=1,z===!0&&(g|=8)):g=0,z=vs(3,null,null,g),p.current=z,z.stateNode=p,z.memoizedState={element:P,isDehydrated:M,cache:null,transitions:null},gu(z),p}function Bx(p){if(!p)return mt;p=p._reactInternals;e:{if(V(p)!==p||p.tag!==1)throw Error(o(170));var g=p;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(kn(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(o(171))}if(p.tag===1){var M=p.type;if(kn(M))return eo(p,M,g)}return g}function Hx(p){var g=p._reactInternals;if(g===void 0)throw typeof p.render=="function"?Error(o(188)):(p=Object.keys(p).join(","),Error(o(268,p)));return p=H(g),p===null?null:p.stateNode}function Bs(p,g){if(p=p.memoizedState,p!==null&&p.dehydrated!==null){var M=p.retryLane;p.retryLane=M!==0&&M=tt&&z>=rn&&L<=St&&ie<=Bt){p.splice(g,1);break}else if(P!==tt||M.width!==ze.width||Btie){if(!(z!==rn||M.height!==ze.height||StL)){tt>P&&(ze.width+=tt-P,ze.x=P),Stz&&(ze.height+=rn-z,ze.y=z),BtM&&(M=ie)),ie ")+` + +No matching component was found for: + `)+p.join(" > ")}return null},n.getPublicRootInstance=function(p){if(p=p.current,!p.child)return null;switch(p.child.tag){case 5:return oe(p.child.stateNode);default:return p.child.stateNode}},n.injectIntoDevTools=function(p){if(p={bundleType:p.bundleType,version:p.version,rendererPackageName:p.rendererPackageName,rendererConfig:p.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:a.ReactCurrentDispatcher,findHostInstanceByFiber:Yp,findFiberByHostInstance:p.findFiberByHostInstance||Vx,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")p=!1;else{var g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)p=!0;else{try{Ud=g.inject(p),Ro=g}catch{}p=!!g.checkDCE}}return p},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(p,g,M,P){if(!te)throw Error(o(363));p=ba(p,g);var L=rt(p,M,P).disconnect;return{disconnect:function(){L()}}},n.registerMutableSourceForHydration=function(p,g){var M=g._getVersion;M=M(g._source),p.mutableSourceEagerHydrationData==null?p.mutableSourceEagerHydrationData=[g,M]:p.mutableSourceEagerHydrationData.push(g,M)},n.runWithPriority=function(p,g){var M=dn;try{return dn=p,g()}finally{dn=M}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(p,g,M,P){var L=g.current,z=Rn(),ie=lo(L);return M=Bx(M),g.context===null?g.context=M:g.pendingContext=M,g=la(z,ie),g.payload={element:p},P=P===void 0?null:P,P!==null&&(g.callback=P),Qa(L,g),p=fi(L,ie,z),p!==null&&hp(p,L,ie),ie},n}),zA}var wU;function obe(){return wU||(wU=1,UA.exports=sbe()),UA.exports}var abe=obe();const lbe=B1(abe);var BA={exports:{}},HA={};/** + * @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. + */var SU;function cbe(){return SU||(SU=1,(function(t){function e(B,K){var q=B.length;B.push(K);e:for(;0>>1,Z=B[$];if(0>>1;$i(ce,q))wei(Me,ce)?(B[$]=Me,B[we]=q,$=we):(B[$]=ce,B[ae]=q,$=ae);else if(wei(Me,q))B[$]=Me,B[we]=q,$=we;else break e}}return K}function i(B,K){var q=B.sortIndex-K.sortIndex;return q!==0?q:B.id-K.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,f=null,m=3,y=!1,x=!1,S=!1,w=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(B){for(var K=n(c);K!==null;){if(K.callback===null)r(c);else if(K.startTime<=B)r(c),K.sortIndex=K.expirationTime,e(l,K);else break;K=n(c)}}function C(B){if(S=!1,T(B),!x)if(n(l)!==null)x=!0,oe(O);else{var K=n(c);K!==null&&he(C,K.startTime-B)}}function O(B,K){x=!1,S&&(S=!1,b(F),F=-1),y=!0;var q=m;try{for(T(K),f=n(l);f!==null&&(!(f.expirationTime>K)||B&&!j());){var $=f.callback;if(typeof $=="function"){f.callback=null,m=f.priorityLevel;var Z=$(f.expirationTime<=K);K=t.unstable_now(),typeof Z=="function"?f.callback=Z:f===n(l)&&r(l),T(K)}else r(l);f=n(l)}if(f!==null)var ge=!0;else{var ae=n(c);ae!==null&&he(C,ae.startTime-K),ge=!1}return ge}finally{f=null,m=q,y=!1}}var N=!1,D=null,F=-1,V=5,k=-1;function j(){return!(t.unstable_now()-kB||125$?(B.sortIndex=q,e(c,B),n(l)===null&&B===n(c)&&(S?(b(F),F=-1):S=!0,he(C,q-$))):(B.sortIndex=Z,e(l,B),x||y||(x=!0,oe(O))),B},t.unstable_shouldYield=j,t.unstable_wrapCallback=function(B){var K=m;return function(){var q=m;m=K;try{return B.apply(this,arguments)}finally{m=q}}}})(HA)),HA}var MU;function ube(){return MU||(MU=1,BA.exports=cbe()),BA.exports}var EU=ube();const tN={},dbe=t=>void Object.assign(tN,t);function fbe(t,e){function n(d,{args:f=[],attach:m,...y},x){let S=`${d[0].toUpperCase()}${d.slice(1)}`,w;if(d==="primitive"){if(y.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const b=y.object;w=Fm(b,{type:d,root:x,attach:m,primitive:!0})}else{const b=tN[S];if(!b)throw new Error(`R3F: ${S} 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(f))throw new Error("R3F: The args prop must be an array!");w=Fm(new b(...f),{type:d,root:x,attach:m,memoizedProps:{args:f}})}return w.__r3f.attach===void 0&&(w.isBufferGeometry?w.__r3f.attach="geometry":w.isMaterial&&(w.__r3f.attach="material")),S!=="inject"&&WA(w,y),w}function r(d,f){let m=!1;if(f){var y,x;(y=f.__r3f)!=null&&y.attach?GA(d,f,f.__r3f.attach):f.isObject3D&&d.isObject3D&&(d.add(f),m=!0),m||(x=d.__r3f)==null||x.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,rP(f),zm(f)}}function i(d,f,m){let y=!1;if(f){var x,S;if((x=f.__r3f)!=null&&x.attach)GA(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){f.parent=d,f.dispatchEvent({type:"added"}),d.dispatchEvent({type:"childadded",child:f});const w=d.children.filter(E=>E!==f),b=w.indexOf(m);d.children=[...w.slice(0,b),f,...w.slice(b)],y=!0}y||(S=d.__r3f)==null||S.objects.push(f),f.__r3f||Fm(f,{}),f.__r3f.parent=d,rP(f),zm(f)}}function s(d,f,m=!1){d&&[...d].forEach(y=>o(f,y,m))}function o(d,f,m){if(f){var y,x,S;if(f.__r3f&&(f.__r3f.parent=null),(y=d.__r3f)!=null&&y.objects&&(d.__r3f.objects=d.__r3f.objects.filter(C=>C!==f)),(x=f.__r3f)!=null&&x.attach)RU(d,f,f.__r3f.attach);else if(f.isObject3D&&d.isObject3D){var w;d.remove(f),(w=f.__r3f)!=null&&w.root&&xbe(K_(f),f)}const E=(S=f.__r3f)==null?void 0:S.primitive,T=!E&&(m===void 0?f.dispose!==null:m);if(!E){var b;s((b=f.__r3f)==null?void 0:b.objects,f,T),s(f.children,f,T)}if(delete f.__r3f,T&&f.dispose&&f.type!=="Scene"){const C=()=>{try{f.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT>"u"?EU.unstable_scheduleCallback(EU.unstable_IdlePriority,C):C()}zm(d)}}function a(d,f,m,y){var x;const S=(x=d.__r3f)==null?void 0:x.parent;if(!S)return;const w=n(f,m,d.__r3f.root);if(d.children){for(const b of d.children)b.__r3f&&r(w,b);d.children=d.children.filter(b=>!b.__r3f)}d.__r3f.objects.forEach(b=>r(w,b)),d.__r3f.objects=[],d.__r3f.autoRemovedBeforeAppend||o(S,d),w.parent&&(w.__r3f.autoRemovedBeforeAppend=!0),r(S,w),w.raycast&&w.__r3f.eventCount&&K_(w).getState().internal.interaction.push(w),[y,y.alternate].forEach(b=>{b!==null&&(b.stateNode=w,b.ref&&(typeof b.ref=="function"?b.ref(w):b.ref.current=w))})}const l=()=>{};return{reconciler:lbe({createInstance:n,removeChild:o,appendChild:r,appendInitialChild:r,insertBefore:i,supportsMutation:!0,isPrimaryRenderer:!1,supportsPersistence:!1,supportsHydration:!1,noTimeout:-1,appendChildToContainer:(d,f)=>{if(!f)return;const m=d.getState().scene;m.__r3f&&(m.__r3f.root=d,r(m,f))},removeChildFromContainer:(d,f)=>{f&&o(d.getState().scene,f)},insertInContainerBefore:(d,f,m)=>{if(!f||!m)return;const y=d.getState().scene;y.__r3f&&i(y,f,m)},getRootHostContext:()=>null,getChildHostContext:d=>d,finalizeInitialChildren(d){var f;return!!((f=d==null?void 0:d.__r3f)!=null?f:{}).handlers},prepareUpdate(d,f,m,y){var x;if(((x=d==null?void 0:d.__r3f)!=null?x:{}).primitive&&y.object&&y.object!==d)return[!0];{const{args:w=[],children:b,...E}=y,{args:T=[],children:C,...O}=m;if(!Array.isArray(w))throw new Error("R3F: the args prop must be an array!");if(w.some((D,F)=>D!==T[F]))return[!0];const N=hG(d,E,O,!0);return N.changes.length?[!1,N]:null}},commitUpdate(d,[f,m],y,x,S,w){f?a(d,y,S,w):WA(d,m)},commitMount(d,f,m,y){var x;const S=(x=d.__r3f)!=null?x:{};d.raycast&&S.handlers&&S.eventCount&&K_(d).getState().internal.interaction.push(d)},getPublicInstance:d=>d,prepareForCommit:()=>null,preparePortalMount:d=>Fm(d.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(d){var f;const{attach:m,parent:y}=(f=d.__r3f)!=null?f:{};m&&y&&RU(y,d,m),d.isObject3D&&(d.visible=!1),zm(d)},unhideInstance(d,f){var m;const{attach:y,parent:x}=(m=d.__r3f)!=null?m:{};y&&x&&GA(x,d,y),(d.isObject3D&&f.visible==null||f.visible)&&(d.visible=!0),zm(d)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Km.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&ir.fun(performance.now)?performance.now:ir.fun(Date.now)?Date.now:()=>0,scheduleTimeout:ir.fun(setTimeout)?setTimeout:void 0,cancelTimeout:ir.fun(clearTimeout)?clearTimeout:void 0}),applyProps:WA}}var AU,TU;const VA=t=>"colorSpace"in t||"outputColorSpace"in t,aG=()=>{var t;return(t=tN.ColorManagement)!=null?t:null},lG=t=>t&&t.isOrthographicCamera,hbe=t=>t&&t.hasOwnProperty("current"),vx=typeof window<"u"&&((AU=window.document)!=null&&AU.createElement||((TU=window.navigator)==null?void 0:TU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function cG(t){const e=R.useRef(t);return vx(()=>void(e.current=t),[t]),e}function pbe({set:t}){return vx(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}class uG extends R.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}uG.getDerivedStateFromError=()=>({error:!0});const dG="__default",CU=new Map,mbe=t=>t&&!!t.memoized&&!!t.changes;function fG(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 Ty=t=>{var e;return(e=t.__r3f)==null?void 0:e.root.getState()};function K_(t){let e=t.__r3f.root;for(;e.getState().previousRoot;)e=e.getState().previousRoot;return e}const ir={obj:t=>t===Object(t)&&!ir.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:r="reference",strict:i=!0}={}){if(typeof t!=typeof e||!!t!=!!e)return!1;if(ir.str(t)||ir.num(t)||ir.boo(t))return t===e;const s=ir.obj(t);if(s&&r==="reference")return t===e;const o=ir.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"&&r==="shallow"){for(a in i?e:t)if(!ir.equ(t[a],e[a],{strict:i,objects:"reference"}))return!1}else for(a in i?e:t)if(t[a]!==e[a])return!1;if(ir.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 gbe(t){t.dispose&&t.type!=="Scene"&&t.dispose();for(const e in t)e.dispose==null||e.dispose(),delete t[e]}function Fm(t,e){const n=t;return n.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},t}function nP(t,e){let n=t;if(e.includes("-")){const r=e.split("-"),i=r.pop();return n=r.reduce((s,o)=>s[o],t),{target:n,key:i}}else return{target:n,key:e}}const PU=/-\d+$/;function GA(t,e,n){if(ir.str(n)){if(PU.test(n)){const s=n.replace(PU,""),{target:o,key:a}=nP(t,s);Array.isArray(o[a])||(o[a]=[])}const{target:r,key:i}=nP(t,n);e.__r3f.previousAttach=r[i],r[i]=e}else e.__r3f.previousAttach=n(t,e)}function RU(t,e,n){var r,i;if(ir.str(n)){const{target:s,key:o}=nP(t,n),a=e.__r3f.previousAttach;a===void 0?delete s[o]:s[o]=a}else(r=e.__r3f)==null||r.previousAttach==null||r.previousAttach(t,e);(i=e.__r3f)==null||delete i.previousAttach}function hG(t,{children:e,key:n,ref:r,...i},{children:s,key:o,ref:a,...l}={},c=!1){const d=t.__r3f,f=Object.entries(i),m=[];if(c){const x=Object.keys(l);for(let S=0;S{var w;if((w=t.__r3f)!=null&&w.primitive&&x==="object"||ir.equ(S,l[x]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(x))return m.push([x,S,!0,[]]);let b=[];x.includes("-")&&(b=x.split("-")),m.push([x,S,!1,b]);for(const E in i){const T=i[E];E.startsWith(`${x}-`)&&m.push([E,T,!1,E.split("-")])}});const y={...i};return d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.args&&(y.args=d.memoizedProps.args),d!=null&&d.memoizedProps&&d!=null&&d.memoizedProps.attach&&(y.attach=d.memoizedProps.attach),{memoized:y,changes:m}}function WA(t,e){var n;const r=t.__r3f,i=r==null?void 0:r.root,s=i==null||i.getState==null?void 0:i.getState(),{memoized:o,changes:a}=mbe(e)?e:hG(t,e),l=r==null?void 0:r.eventCount;t.__r3f&&(t.__r3f.memoizedProps=o);for(let m=0;mT[C],t),!(E&&E.set))){const[T,...C]=w.reverse();b=C.reverse().reduce((O,N)=>O[N],t),y=T}if(x===dG+"remove")if(b.constructor){let T=CU.get(b.constructor);T||(T=new b.constructor,CU.set(b.constructor,T)),x=T[y]}else x=0;if(S&&r)x?r.handlers[y]=x:delete r.handlers[y],r.eventCount=Object.keys(r.handlers).length;else if(E&&E.set&&(E.copy||E instanceof Ah)){if(Array.isArray(x))E.fromArray?E.fromArray(x):E.set(...x);else if(E.copy&&x&&x.constructor&&E.constructor===x.constructor)E.copy(x);else if(x!==void 0){var c;const T=(c=E)==null?void 0:c.isColor;!T&&E.setScalar?E.setScalar(x):E instanceof Ah&&x instanceof Ah?E.mask=x.mask:E.set(x),!aG()&&s&&!s.linear&&T&&E.convertSRGBToLinear()}}else{var d;if(b[y]=x,(d=b[y])!=null&&d.isTexture&&b[y].format===is&&b[y].type===Ba&&s){const T=b[y];VA(T)&&VA(s.gl)?T.colorSpace=s.gl.outputColorSpace:T.encoding=s.gl.outputEncoding}}zm(t)}if(r&&r.parent&&t.raycast&&l!==r.eventCount){const m=K_(t).getState().internal,y=m.interaction.indexOf(t);y>-1&&m.interaction.splice(y,1),r.eventCount&&m.interaction.push(t)}return!(a.length===1&&a[0][0]==="onUpdate")&&a.length&&(n=t.__r3f)!=null&&n.parent&&rP(t),t}function zm(t){var e,n;const r=(e=t.__r3f)==null||(n=e.root)==null||n.getState==null?void 0:n.getState();r&&r.internal.frames===0&&r.invalidate()}function rP(t){t.onUpdate==null||t.onUpdate(t)}function vbe(t,e){t.manual||(lG(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 P_(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function ybe(){var t;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Km.DefaultEventPriority;switch((t=e.event)==null?void 0:t.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Km.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Km.ContinuousEventPriority;default:return Km.DefaultEventPriority}}function pG(t,e,n,r){const i=n.get(e);i&&(n.delete(e),n.size===0&&(t.delete(r),i.target.releasePointerCapture(r)))}function xbe(t,e){const{internal:n}=t.getState();n.interaction=n.interaction.filter(r=>r!==e),n.initialHits=n.initialHits.filter(r=>r!==e),n.hovered.forEach((r,i)=>{(r.eventObject===e||r.object===e)&&n.hovered.delete(i)}),n.capturedMap.forEach((r,i)=>{pG(n.capturedMap,e,r,i)})}function bbe(t){function e(l){const{internal:c}=t.getState(),d=l.offsetX-c.initialClick[0],f=l.offsetY-c.initialClick[1];return Math.round(Math.sqrt(d*d+f*f))}function n(l){return l.filter(c=>["Move","Over","Enter","Out","Leave"].some(d=>{var f;return(f=c.__r3f)==null?void 0:f.handlers["onPointer"+d]}))}function r(l,c){const d=t.getState(),f=new Set,m=[],y=c?c(d.internal.interaction):d.internal.interaction;for(let b=0;b{const T=Ty(b.object),C=Ty(E.object);return!T||!C?b.distance-E.distance:C.events.priority-T.events.priority||b.distance-E.distance}).filter(b=>{const E=P_(b);return f.has(E)?!1:(f.add(E),!0)});d.events.filter&&(S=d.events.filter(S,d));for(const b of S){let E=b.object;for(;E;){var w;(w=E.__r3f)!=null&&w.eventCount&&m.push({...b,eventObject:E}),E=E.parent}}if("pointerId"in l&&d.internal.capturedMap.has(l.pointerId))for(let b of d.internal.capturedMap.get(l.pointerId).values())f.has(P_(b.intersection))||m.push(b.intersection);return m}function i(l,c,d,f){const m=t.getState();if(l.length){const y={stopped:!1};for(const x of l){const S=Ty(x.object)||m,{raycaster:w,pointer:b,camera:E,internal:T}=S,C=new X(b.x,b.y,0).unproject(E),O=k=>{var j,H;return(j=(H=T.capturedMap.get(k))==null?void 0:H.has(x.eventObject))!=null?j:!1},N=k=>{const j={intersection:x,target:c.target};T.capturedMap.has(k)?T.capturedMap.get(k).set(x.eventObject,j):T.capturedMap.set(k,new Map([[x.eventObject,j]])),c.target.setPointerCapture(k)},D=k=>{const j=T.capturedMap.get(k);j&&pG(T.capturedMap,x.eventObject,j,k)};let F={};for(let k in c){let j=c[k];typeof j!="function"&&(F[k]=j)}let V={...x,...F,pointer:b,intersections:l,stopped:y.stopped,delta:d,unprojectedPoint:C,ray:w.ray,camera:E,stopPropagation(){const k="pointerId"in c&&T.capturedMap.get(c.pointerId);if((!k||k.has(x.eventObject))&&(V.stopped=y.stopped=!0,T.hovered.size&&Array.from(T.hovered.values()).find(j=>j.eventObject===x.eventObject))){const j=l.slice(0,l.indexOf(x));s([...j,x])}},target:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},currentTarget:{hasPointerCapture:O,setPointerCapture:N,releasePointerCapture:D},nativeEvent:c};if(f(V),y.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(f=>f.object===d.object&&f.index===d.index&&f.instanceId===d.instanceId)){const m=d.eventObject.__r3f,y=m==null?void 0:m.handlers;if(c.hovered.delete(P_(d)),m!=null&&m.eventCount){const x={...d,intersections:l};y.onPointerOut==null||y.onPointerOut(x),y.onPointerLeave==null||y.onPointerLeave(x)}}}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:f,internal:m}=t.getState();m.lastEvent.current=d;const y=l==="onPointerMove",x=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",w=r(d,y?n:void 0),b=x?e(d):0;l==="onPointerDown"&&(m.initialClick=[d.offsetX,d.offsetY],m.initialHits=w.map(T=>T.eventObject)),x&&!w.length&&b<=2&&(o(d,m.interaction),f&&f(d)),y&&s(w);function E(T){const C=T.eventObject,O=C.__r3f,N=O==null?void 0:O.handlers;if(O!=null&&O.eventCount)if(y){if(N.onPointerOver||N.onPointerEnter||N.onPointerOut||N.onPointerLeave){const D=P_(T),F=m.hovered.get(D);F?F.stopped&&T.stopPropagation():(m.hovered.set(D,T),N.onPointerOver==null||N.onPointerOver(T),N.onPointerEnter==null||N.onPointerEnter(T))}N.onPointerMove==null||N.onPointerMove(T)}else{const D=N[l];D?(!x||m.initialHits.includes(C))&&(o(d,m.interaction.filter(F=>!m.initialHits.includes(F))),D(T)):x&&m.initialHits.includes(C)&&o(d,m.interaction.filter(F=>!m.initialHits.includes(F)))}}i(w,d,b,E)}}return{handlePointer:a}}const mG=t=>!!(t!=null&&t.render),gG=R.createContext(null),_be=(t,e)=>{const n=nbe((a,l)=>{const c=new X,d=new X,f=new X;function m(b=l().camera,E=d,T=l().size){const{width:C,height:O,top:N,left:D}=T,F=C/O;E.isVector3?f.copy(E):f.set(...E);const V=b.getWorldPosition(c).distanceTo(f);if(lG(b))return{width:C/b.zoom,height:O/b.zoom,top:N,left:D,factor:1,distance:V,aspect:F};{const k=b.fov*Math.PI/180,j=2*Math.tan(k/2)*V,H=j*(C/O);return{width:H,height:j,top:N,left:D,factor:C/H,distance:V,aspect:F}}}let y;const x=b=>a(E=>({performance:{...E.performance,current:b}})),S=new He;return{set:a,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(b=1)=>t(l(),b),advance:(b,E)=>e(b,E,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new YR,pointer:S,mouse:S,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const b=l();y&&clearTimeout(y),b.performance.current!==b.performance.min&&x(b.performance.min),y=setTimeout(()=>x(l().performance.max),b.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:m},setEvents:b=>a(E=>({...E,events:{...E.events,...b}})),setSize:(b,E,T,C,O)=>{const N=l().camera,D={width:b,height:E,top:C||0,left:O||0,updateStyle:T};a(F=>({size:D,viewport:{...F.viewport,...m(N,d,D)}}))},setDpr:b=>a(E=>{const T=fG(b);return{viewport:{...E.viewport,dpr:T,initialDpr:E.viewport.initialDpr||T}}}),setFrameloop:(b="always")=>{const E=l().clock;E.stop(),E.elapsedTime=0,b!=="never"&&(E.start(),E.elapsedTime=0),a(()=>({frameloop:b}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:R.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(b,E,T)=>{const C=l().internal;return C.priority=C.priority+(E>0?1:0),C.subscribers.push({ref:b,priority:E,store:T}),C.subscribers=C.subscribers.sort((O,N)=>O.priority-N.priority),()=>{const O=l().internal;O!=null&&O.subscribers&&(O.priority=O.priority-(E>0?1:0),O.subscribers=O.subscribers.filter(N=>N.ref!==b))}}}}}),r=n.getState();let i=r.size,s=r.viewport.dpr,o=r.camera;return n.subscribe(()=>{const{camera:a,size:l,viewport:c,gl:d,set:f}=n.getState();if(l.width!==i.width||l.height!==i.height||c.dpr!==s){var m;i=l,s=c.dpr,vbe(a,l),d.setPixelRatio(c.dpr);const y=(m=l.updateStyle)!=null?m:typeof HTMLCanvasElement<"u"&&d.domElement instanceof HTMLCanvasElement;d.setSize(l.width,l.height,y)}a!==o&&(o=a,f(y=>({viewport:{...y.viewport,...y.viewport.getCurrentViewport(a)}})))}),n.subscribe(a=>t(a)),n};let R_,wbe=new Set,Sbe=new Set,Mbe=new Set;function $A(t,e){if(t.size)for(const{callback:n}of t.values())n(e)}function Cy(t,e){switch(t){case"before":return $A(wbe,e);case"after":return $A(Sbe,e);case"tail":return $A(Mbe,e)}}let XA,qA;function KA(t,e,n){let r=e.clock.getDelta();for(e.frameloop==="never"&&typeof t=="number"&&(r=t-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=t),XA=e.internal.subscribers,R_=0;R_0)&&!((d=s.gl.xr)!=null&&d.isPresenting)&&(r+=KA(c,s))}if(n=!1,Cy("after",c),r===0)return Cy("tail",c),e=!1,cancelAnimationFrame(i)}function a(c,d=1){var f;if(!c)return t.forEach(m=>a(m.store.getState(),d));(f=c.gl.xr)!=null&&f.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,f,m){if(d&&Cy("before",c),f)KA(c,f,m);else for(const y of t.values())KA(c,y.store.getState());d&&Cy("after",c)}return{loop:o,invalidate:a,advance:l}}function vG(){const t=R.useContext(gG);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function nd(t=n=>n,e){return vG()(t,e)}function yG(t,e=0){const n=vG(),r=n.getState().internal.subscribe,i=cG(t);return vx(()=>r(i,e,n),[e,r,n]),null}const Fg=new Map,{invalidate:NU,advance:IU}=Ebe(Fg),{reconciler:D1,applyProps:Nm}=fbe(Fg,ybe),Im={objects:"shallow",strict:!1},Abe=(t,e)=>{const n=typeof t=="function"?t(e):t;return mG(n)?n:new v6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t})};function Tbe(t,e){const n=typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement;if(e){const{width:r,height:i,top:s,left:o,updateStyle:a=n}=e;return{width:r,height:i,top:s,left:o,updateStyle:a}}else if(typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:r,height:i,top:s,left:o}=t.parentElement.getBoundingClientRect();return{width:r,height:i,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 Cbe(t){const e=Fg.get(t),n=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||_be(NU,IU),o=n||D1.createContainer(s,Km.ConcurrentRoot,null,!1,null,"",i,null);e||Fg.set(t,{fiber:o,store:s});let a,l=!1,c;return{configure(d={}){let{gl:f,size:m,scene:y,events:x,onCreated:S,shadows:w=!1,linear:b=!1,flat:E=!1,legacy:T=!1,orthographic:C=!1,frameloop:O="always",dpr:N=[1,2],performance:D,raycaster:F,camera:V,onPointerMissed:k}=d,j=s.getState(),H=j.gl;j.gl||j.set({gl:H=Abe(f,t)});let ne=j.raycaster;ne||j.set({raycaster:ne=new iG});const{params:J,...de}=F||{};if(ir.equ(de,ne,Im)||Nm(ne,{...de}),ir.equ(J,ne.params,Im)||Nm(ne,{params:{...ne.params,...J}}),!j.camera||j.camera===c&&!ir.equ(c,V,Im)){c=V;const q=V instanceof ux,$=q?V:C?new $c(0,0,0,0,.1,1e3):new Tr(75,0,.1,1e3);q||($.position.z=5,V&&(Nm($,V),("aspect"in V||"left"in V||"right"in V||"bottom"in V||"top"in V)&&($.manual=!0,$.updateProjectionMatrix())),!j.camera&&!(V!=null&&V.rotation)&&$.lookAt(0,0,0)),j.set({camera:$}),ne.camera=$}if(!j.scene){let q;y!=null&&y.isScene?q=y:(q=new RR,y&&Nm(q,y)),j.set({scene:Fm(q)})}if(!j.xr){var oe;const q=(ge,ae)=>{const ce=s.getState();ce.frameloop!=="never"&&IU(ge,!0,ce,ae)},$=()=>{const ge=s.getState();ge.gl.xr.enabled=ge.gl.xr.isPresenting,ge.gl.xr.setAnimationLoop(ge.gl.xr.isPresenting?q:null),ge.gl.xr.isPresenting||NU(ge)},Z={connect(){const ge=s.getState().gl;ge.xr.addEventListener("sessionstart",$),ge.xr.addEventListener("sessionend",$)},disconnect(){const ge=s.getState().gl;ge.xr.removeEventListener("sessionstart",$),ge.xr.removeEventListener("sessionend",$)}};typeof((oe=H.xr)==null?void 0:oe.addEventListener)=="function"&&Z.connect(),j.set({xr:Z})}if(H.shadowMap){const q=H.shadowMap.enabled,$=H.shadowMap.type;if(H.shadowMap.enabled=!!w,ir.boo(w))H.shadowMap.type=$y;else if(ir.str(w)){var he;const Z={basic:hV,percentage:zS,soft:$y,variance:ka};H.shadowMap.type=(he=Z[w])!=null?he:$y}else ir.obj(w)&&Object.assign(H.shadowMap,w);(q!==H.shadowMap.enabled||$!==H.shadowMap.type)&&(H.shadowMap.needsUpdate=!0)}const B=aG();B&&("enabled"in B?B.enabled=!T:"legacyMode"in B&&(B.legacyMode=T)),l||Nm(H,{outputEncoding:b?3e3:3001,toneMapping:E?Cl:lR}),j.legacy!==T&&j.set(()=>({legacy:T})),j.linear!==b&&j.set(()=>({linear:b})),j.flat!==E&&j.set(()=>({flat:E})),f&&!ir.fun(f)&&!mG(f)&&!ir.equ(f,H,Im)&&Nm(H,f),x&&!j.events.handlers&&j.set({events:x(s)});const K=Tbe(t,m);return ir.equ(K,j.size,Im)||j.setSize(K.width,K.height,K.updateStyle,K.top,K.left),N&&j.viewport.dpr!==fG(N)&&j.setDpr(N),j.frameloop!==O&&j.setFrameloop(O),j.onPointerMissed||j.set({onPointerMissed:k}),D&&!ir.equ(D,j.performance,Im)&&j.set(q=>({performance:{...q.performance,...D}})),a=S,l=!0,this},render(d){return l||this.configure(),D1.updateContainer(v.jsx(Pbe,{store:s,children:d,onCreated:a,rootElement:t}),o,null,()=>{}),s},unmount(){xG(t)}}}function Pbe({store:t,children:e,onCreated:n,rootElement:r}){return vx(()=>{const i=t.getState();i.set(s=>({internal:{...s.internal,active:!0}})),n&&n(i),t.getState().events.connected||i.events.connect==null||i.events.connect(r)},[]),v.jsx(gG.Provider,{value:t,children:e})}function xG(t,e){const n=Fg.get(t),r=n==null?void 0:n.fiber;if(r){const i=n==null?void 0:n.store.getState();i&&(i.internal.active=!1),D1.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(),gbe(i),Fg.delete(t)}catch{}},500)})}}D1.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:R.version});const YA={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 Rbe(t){const{handlePointer:e}=bbe(t);return{priority:1,enabled:!0,compute(n,r,i){r.pointer.set(n.offsetX/r.size.width*2-1,-(n.offsetY/r.size.height)*2+1),r.raycaster.setFromCamera(r.pointer,r.camera)},connected:void 0,handlers:Object.keys(YA).reduce((n,r)=>({...n,[r]:e(r)}),{}),update:()=>{var n;const{events:r,internal:i}=t.getState();(n=i.lastEvent)!=null&&n.current&&r.handlers&&r.handlers.onPointerMove(i.lastEvent.current)},connect:n=>{var r;const{set:i,events:s}=t.getState();s.disconnect==null||s.disconnect(),i(o=>({events:{...o.events,connected:n}})),Object.entries((r=s.handlers)!=null?r:[]).forEach(([o,a])=>{const[l,c]=YA[o];n.addEventListener(l,a,{passive:c})})},disconnect:()=>{const{set:n,events:r}=t.getState();if(r.connected){var i;Object.entries((i=r.handlers)!=null?i:[]).forEach(([s,o])=>{if(r&&r.connected instanceof HTMLElement){const[a]=YA[s];r.connected.removeEventListener(a,o)}}),n(s=>({events:{...s.events,connected:void 0}}))}}}}function kU(t,e){let n;return(...r)=>{window.clearTimeout(n),n=window.setTimeout(()=>t(...r),e)}}function Nbe({debounce:t,scroll:e,polyfill:n,offsetSize:r}={debounce:0,scroll:!1,offsetSize:!1}){const i=n||(typeof window>"u"?class{}:window.ResizeObserver);if(!i)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[s,o]=R.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),a=R.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=R.useRef(!1);R.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[f,m,y]=R.useMemo(()=>{const b=()=>{if(!a.current.element)return;const{left:E,top:T,width:C,height:O,bottom:N,right:D,x:F,y:V}=a.current.element.getBoundingClientRect(),k={left:E,top:T,width:C,height:O,bottom:N,right:D,x:F,y:V};a.current.element instanceof HTMLElement&&r&&(k.height=a.current.element.offsetHeight,k.width=a.current.element.offsetWidth),Object.freeze(k),d.current&&!Lbe(a.current.lastBounds,k)&&o(a.current.lastBounds=k)};return[b,c?kU(b,c):b,l?kU(b,l):b]},[o,r,l,c]);function x(){a.current.scrollContainers&&(a.current.scrollContainers.forEach(b=>b.removeEventListener("scroll",y,!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 S(){a.current.element&&(a.current.resizeObserver=new i(y),a.current.resizeObserver.observe(a.current.element),e&&a.current.scrollContainers&&a.current.scrollContainers.forEach(b=>b.addEventListener("scroll",y,{capture:!0,passive:!0})),a.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",a.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",a.current.orientationHandler))}const w=b=>{!b||b===a.current.element||(x(),a.current.element=b,a.current.scrollContainers=bG(b),S())};return kbe(y,!!e),Ibe(m),R.useEffect(()=>{x(),S()},[e,y,m]),R.useEffect(()=>x,[]),[w,s,f]}function Ibe(t){R.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function kbe(t,e){R.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function bG(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:r,overflowY:i}=window.getComputedStyle(t);return[n,r,i].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...bG(t.parentElement)]}const Obe=["x","y","top","bottom","left","right","width","height"],Lbe=(t,e)=>Obe.every(n=>t[n]===e[n]);var Dbe=Object.defineProperty,Ube=Object.defineProperties,jbe=Object.getOwnPropertyDescriptors,OU=Object.getOwnPropertySymbols,Fbe=Object.prototype.hasOwnProperty,zbe=Object.prototype.propertyIsEnumerable,LU=(t,e,n)=>e in t?Dbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,DU=(t,e)=>{for(var n in e||(e={}))Fbe.call(e,n)&&LU(t,n,e[n]);if(OU)for(var n of OU(e))zbe.call(e,n)&&LU(t,n,e[n]);return t},Bbe=(t,e)=>Ube(t,jbe(e)),UU,jU;typeof window<"u"&&((UU=window.document)!=null&&UU.createElement||((jU=window.navigator)==null?void 0:jU.product)==="ReactNative")?R.useLayoutEffect:R.useEffect;function _G(t,e,n){if(!t)return;if(n(t)===!0)return t;let r=t.child;for(;r;){const i=_G(r,e,n);if(i)return i;r=r.sibling}}function wG(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const FU=console.error;console.error=function(){const t=[...arguments].join("");if(t!=null&&t.startsWith("Warning:")&&t.includes("useContext")){console.error=FU;return}return FU.apply(this,arguments)};const nN=wG(R.createContext(null));class SG extends R.Component{render(){return R.createElement(nN.Provider,{value:this._reactInternals},this.props.children)}}function Hbe(){const t=R.useContext(nN);if(t===null)throw new Error("its-fine: useFiber must be called within a !");const e=R.useId();return R.useMemo(()=>{for(const r of[t,t==null?void 0:t.alternate]){if(!r)continue;const i=_G(r,!1,s=>{let o=s.memoizedState;for(;o;){if(o.memoizedState===e)return!0;o=o.next}});if(i)return i}},[t,e])}function Vbe(){const t=Hbe(),[e]=R.useState(()=>new Map);e.clear();let n=t;for(;n;){if(n.type&&typeof n.type=="object"){const i=n.type._context===void 0&&n.type.Provider===n.type?n.type:n.type._context;i&&i!==nN&&!e.has(i)&&e.set(i,R.useContext(wG(i)))}n=n.return}return e}function Gbe(){const t=Vbe();return R.useMemo(()=>Array.from(t.keys()).reduce((e,n)=>r=>R.createElement(e,null,R.createElement(n.Provider,Bbe(DU({},r),{value:t.get(n)}))),e=>R.createElement(SG,DU({},e))),[t])}const Wbe=R.forwardRef(function({children:e,fallback:n,resize:r,style:i,gl:s,events:o=Rbe,eventSource:a,eventPrefix:l,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:b,camera:E,scene:T,onPointerMissed:C,onCreated:O,...N},D){R.useMemo(()=>dbe(Zxe),[]);const F=Gbe(),[V,k]=Nbe({scroll:!0,debounce:{scroll:50,resize:0},...r}),j=R.useRef(null),H=R.useRef(null);R.useImperativeHandle(D,()=>j.current);const ne=cG(C),[J,de]=R.useState(!1),[oe,he]=R.useState(!1);if(J)throw J;if(oe)throw oe;const B=R.useRef(null);vx(()=>{const q=j.current;k.width>0&&k.height>0&&q&&(B.current||(B.current=Cbe(q)),B.current.configure({gl:s,events:o,shadows:c,linear:d,flat:f,legacy:m,orthographic:y,frameloop:x,dpr:S,performance:w,raycaster:b,camera:E,scene:T,size:k,onPointerMissed:(...$)=>ne.current==null?void 0:ne.current(...$),onCreated:$=>{$.events.connect==null||$.events.connect(a?hbe(a)?a.current:a:H.current),l&&$.setEvents({compute:(Z,ge)=>{const ae=Z[l+"X"],ce=Z[l+"Y"];ge.pointer.set(ae/ge.size.width*2-1,-(ce/ge.size.height)*2+1),ge.raycaster.setFromCamera(ge.pointer,ge.camera)}}),O==null||O($)}}),B.current.render(v.jsx(F,{children:v.jsx(uG,{set:he,children:v.jsx(R.Suspense,{fallback:v.jsx(pbe,{set:de}),children:e??null})})})))}),R.useEffect(()=>{const q=j.current;if(q)return()=>xG(q)},[]);const K=a?"none":"auto";return v.jsx("div",{ref:H,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:K,...i},...N,children:v.jsx("div",{ref:V,style:{width:"100%",height:"100%"},children:v.jsx("canvas",{ref:j,style:{display:"block"},children:n})})})}),$be=R.forwardRef(function(e,n){return v.jsx(SG,{children:v.jsx(Wbe,{...e,ref:n})})});function iP(){return iP=Object.assign?Object.assign.bind():function(t){for(var e=1;ee in t?Xbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Kbe=(t,e,n)=>(qbe(t,e+"",n),n);class Ybe{constructor(){Kbe(this,"_listeners")}addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(n);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;se in t?Zbe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$t=(t,e,n)=>(Qbe(t,typeof e!="symbol"?e+"":e,n),n);const N_=new Jh,zU=new Nc,Jbe=Math.cos(70*(Math.PI/180)),BU=(t,e)=>(t%e+e)%e;let e_e=class extends Ybe{constructor(e,n){super(),$t(this,"object"),$t(this,"domElement"),$t(this,"enabled",!0),$t(this,"target",new X),$t(this,"minDistance",0),$t(this,"maxDistance",1/0),$t(this,"minZoom",0),$t(this,"maxZoom",1/0),$t(this,"minPolarAngle",0),$t(this,"maxPolarAngle",Math.PI),$t(this,"minAzimuthAngle",-1/0),$t(this,"maxAzimuthAngle",1/0),$t(this,"enableDamping",!1),$t(this,"dampingFactor",.05),$t(this,"enableZoom",!0),$t(this,"zoomSpeed",1),$t(this,"enableRotate",!0),$t(this,"rotateSpeed",1),$t(this,"enablePan",!0),$t(this,"panSpeed",1),$t(this,"screenSpacePanning",!0),$t(this,"keyPanSpeed",7),$t(this,"zoomToCursor",!1),$t(this,"autoRotate",!1),$t(this,"autoRotateSpeed",2),$t(this,"reverseOrbit",!1),$t(this,"reverseHorizontalOrbit",!1),$t(this,"reverseVerticalOrbit",!1),$t(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),$t(this,"mouseButtons",{LEFT:Xf.ROTATE,MIDDLE:Xf.DOLLY,RIGHT:Xf.PAN}),$t(this,"touches",{ONE:qf.ROTATE,TWO:qf.DOLLY_PAN}),$t(this,"target0"),$t(this,"position0"),$t(this,"zoom0"),$t(this,"_domElementKeyEvents",null),$t(this,"getPolarAngle"),$t(this,"getAzimuthalAngle"),$t(this,"setPolarAngle"),$t(this,"setAzimuthalAngle"),$t(this,"getDistance"),$t(this,"getZoomScale"),$t(this,"listenToKeyEvents"),$t(this,"stopListenToKeyEvents"),$t(this,"saveState"),$t(this,"reset"),$t(this,"update"),$t(this,"connect"),$t(this,"dispose"),$t(this,"dollyIn"),$t(this,"dollyOut"),$t(this,"getScale"),$t(this,"setScale"),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=ee=>{let Ae=BU(ee,2*Math.PI),re=d.phi;re<0&&(re+=2*Math.PI),Ae<0&&(Ae+=2*Math.PI);let Fe=Math.abs(Ae-re);2*Math.PI-Fe{let Ae=BU(ee,2*Math.PI),re=d.theta;re<0&&(re+=2*Math.PI),Ae<0&&(Ae+=2*Math.PI);let Fe=Math.abs(Ae-re);2*Math.PI-Fer.object.position.distanceTo(r.target),this.listenToKeyEvents=ee=>{ee.addEventListener("keydown",ft),this._domElementKeyEvents=ee},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ft),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 ee=new X,Ae=new X(0,1,0),re=new qt().setFromUnitVectors(e.up,Ae),Fe=re.clone().invert(),Te=new X,Le=new qt,Ke=2*Math.PI;return function(){const Kt=r.object.position;re.setFromUnitVectors(e.up,Ae),Fe.copy(re).invert(),ee.copy(Kt).sub(r.target),ee.applyQuaternion(re),d.setFromVector3(ee),r.autoRotate&&l===a.NONE&&J(H()),r.enableDamping?(d.theta+=f.theta*r.dampingFactor,d.phi+=f.phi*r.dampingFactor):(d.theta+=f.theta,d.phi+=f.phi);let un=r.minAzimuthAngle,Cn=r.maxAzimuthAngle;isFinite(un)&&isFinite(Cn)&&(un<-Math.PI?un+=Ke:un>Math.PI&&(un-=Ke),Cn<-Math.PI?Cn+=Ke:Cn>Math.PI&&(Cn-=Ke),un<=Cn?d.theta=Math.max(un,Math.min(Cn,d.theta)):d.theta=d.theta>(un+Cn)/2?Math.max(un,d.theta):Math.min(Cn,d.theta)),d.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,d.phi)),d.makeSafe(),r.enableDamping===!0?r.target.addScaledVector(y,r.dampingFactor):r.target.add(y),r.zoomToCursor&&V||r.object.isOrthographicCamera?d.radius=ge(d.radius):d.radius=ge(d.radius*m),ee.setFromSpherical(d),ee.applyQuaternion(Fe),Kt.copy(r.target).add(ee),r.object.matrixAutoUpdate||r.object.updateMatrix(),r.object.lookAt(r.target),r.enableDamping===!0?(f.theta*=1-r.dampingFactor,f.phi*=1-r.dampingFactor,y.multiplyScalar(1-r.dampingFactor)):(f.set(0,0,0),y.set(0,0,0));let Jt=!1;if(r.zoomToCursor&&V){let Hn=null;if(r.object instanceof Tr&&r.object.isPerspectiveCamera){const hr=ee.length();Hn=ge(hr*m);const Si=hr-Hn;r.object.position.addScaledVector(D,Si),r.object.updateMatrixWorld()}else if(r.object.isOrthographicCamera){const hr=new X(F.x,F.y,0);hr.unproject(r.object),r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/m)),r.object.updateProjectionMatrix(),Jt=!0;const Si=new X(F.x,F.y,0);Si.unproject(r.object),r.object.position.sub(Si).add(hr),r.object.updateMatrixWorld(),Hn=ee.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),r.zoomToCursor=!1;Hn!==null&&(r.screenSpacePanning?r.target.set(0,0,-1).transformDirection(r.object.matrix).multiplyScalar(Hn).add(r.object.position):(N_.origin.copy(r.object.position),N_.direction.set(0,0,-1).transformDirection(r.object.matrix),Math.abs(r.object.up.dot(N_.direction))c||8*(1-Le.dot(r.object.quaternion))>c?(r.dispatchEvent(i),Te.copy(r.object.position),Le.copy(r.object.quaternion),Jt=!1,!0):!1}})(),this.connect=ee=>{r.domElement=ee,r.domElement.style.touchAction="none",r.domElement.addEventListener("contextmenu",dt),r.domElement.addEventListener("pointerdown",Ee),r.domElement.addEventListener("pointercancel",le),r.domElement.addEventListener("wheel",rt)},this.dispose=()=>{var ee,Ae,re,Fe,Te,Le;r.domElement&&(r.domElement.style.touchAction="auto"),(ee=r.domElement)==null||ee.removeEventListener("contextmenu",dt),(Ae=r.domElement)==null||Ae.removeEventListener("pointerdown",Ee),(re=r.domElement)==null||re.removeEventListener("pointercancel",le),(Fe=r.domElement)==null||Fe.removeEventListener("wheel",rt),(Te=r.domElement)==null||Te.ownerDocument.removeEventListener("pointermove",Be),(Le=r.domElement)==null||Le.ownerDocument.removeEventListener("pointerup",le),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",ft)};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 c=1e-6,d=new tP,f=new tP;let m=1;const y=new X,x=new He,S=new He,w=new He,b=new He,E=new He,T=new He,C=new He,O=new He,N=new He,D=new X,F=new He;let V=!1;const k=[],j={};function H(){return 2*Math.PI/60/60*r.autoRotateSpeed}function ne(){return Math.pow(.95,r.zoomSpeed)}function J(ee){r.reverseOrbit||r.reverseHorizontalOrbit?f.theta+=ee:f.theta-=ee}function de(ee){r.reverseOrbit||r.reverseVerticalOrbit?f.phi+=ee:f.phi-=ee}const oe=(()=>{const ee=new X;return function(re,Fe){ee.setFromMatrixColumn(Fe,0),ee.multiplyScalar(-re),y.add(ee)}})(),he=(()=>{const ee=new X;return function(re,Fe){r.screenSpacePanning===!0?ee.setFromMatrixColumn(Fe,1):(ee.setFromMatrixColumn(Fe,0),ee.crossVectors(r.object.up,ee)),ee.multiplyScalar(re),y.add(ee)}})(),B=(()=>{const ee=new X;return function(re,Fe){const Te=r.domElement;if(Te&&r.object instanceof Tr&&r.object.isPerspectiveCamera){const Le=r.object.position;ee.copy(Le).sub(r.target);let Ke=ee.length();Ke*=Math.tan(r.object.fov/2*Math.PI/180),oe(2*re*Ke/Te.clientHeight,r.object.matrix),he(2*Fe*Ke/Te.clientHeight,r.object.matrix)}else Te&&r.object instanceof $c&&r.object.isOrthographicCamera?(oe(re*(r.object.right-r.object.left)/r.object.zoom/Te.clientWidth,r.object.matrix),he(Fe*(r.object.top-r.object.bottom)/r.object.zoom/Te.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}})();function K(ee){r.object instanceof Tr&&r.object.isPerspectiveCamera||r.object instanceof $c&&r.object.isOrthographicCamera?m=ee:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function q(ee){K(m/ee)}function $(ee){K(m*ee)}function Z(ee){if(!r.zoomToCursor||!r.domElement)return;V=!0;const Ae=r.domElement.getBoundingClientRect(),re=ee.clientX-Ae.left,Fe=ee.clientY-Ae.top,Te=Ae.width,Le=Ae.height;F.x=re/Te*2-1,F.y=-(Fe/Le)*2+1,D.set(F.x,F.y,1).unproject(r.object).sub(r.object.position).normalize()}function ge(ee){return Math.max(r.minDistance,Math.min(r.maxDistance,ee))}function ae(ee){x.set(ee.clientX,ee.clientY)}function ce(ee){Z(ee),C.set(ee.clientX,ee.clientY)}function we(ee){b.set(ee.clientX,ee.clientY)}function Me(ee){S.set(ee.clientX,ee.clientY),w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ae=r.domElement;Ae&&(J(2*Math.PI*w.x/Ae.clientHeight),de(2*Math.PI*w.y/Ae.clientHeight)),x.copy(S),r.update()}function $e(ee){O.set(ee.clientX,ee.clientY),N.subVectors(O,C),N.y>0?q(ne()):N.y<0&&$(ne()),C.copy(O),r.update()}function Se(ee){E.set(ee.clientX,ee.clientY),T.subVectors(E,b).multiplyScalar(r.panSpeed),B(T.x,T.y),b.copy(E),r.update()}function Ve(ee){Z(ee),ee.deltaY<0?$(ne()):ee.deltaY>0&&q(ne()),r.update()}function Xe(ee){let Ae=!1;switch(ee.code){case r.keys.UP:B(0,r.keyPanSpeed),Ae=!0;break;case r.keys.BOTTOM:B(0,-r.keyPanSpeed),Ae=!0;break;case r.keys.LEFT:B(r.keyPanSpeed,0),Ae=!0;break;case r.keys.RIGHT:B(-r.keyPanSpeed,0),Ae=!0;break}Ae&&(ee.preventDefault(),r.update())}function fe(){if(k.length==1)x.set(k[0].pageX,k[0].pageY);else{const ee=.5*(k[0].pageX+k[1].pageX),Ae=.5*(k[0].pageY+k[1].pageY);x.set(ee,Ae)}}function Q(){if(k.length==1)b.set(k[0].pageX,k[0].pageY);else{const ee=.5*(k[0].pageX+k[1].pageX),Ae=.5*(k[0].pageY+k[1].pageY);b.set(ee,Ae)}}function Ge(){const ee=k[0].pageX-k[1].pageX,Ae=k[0].pageY-k[1].pageY,re=Math.sqrt(ee*ee+Ae*Ae);C.set(0,re)}function Ue(){r.enableZoom&&Ge(),r.enablePan&&Q()}function We(){r.enableZoom&&Ge(),r.enableRotate&&fe()}function Qe(ee){if(k.length==1)S.set(ee.pageX,ee.pageY);else{const re=ue(ee),Fe=.5*(ee.pageX+re.x),Te=.5*(ee.pageY+re.y);S.set(Fe,Te)}w.subVectors(S,x).multiplyScalar(r.rotateSpeed);const Ae=r.domElement;Ae&&(J(2*Math.PI*w.x/Ae.clientHeight),de(2*Math.PI*w.y/Ae.clientHeight)),x.copy(S)}function xt(ee){if(k.length==1)E.set(ee.pageX,ee.pageY);else{const Ae=ue(ee),re=.5*(ee.pageX+Ae.x),Fe=.5*(ee.pageY+Ae.y);E.set(re,Fe)}T.subVectors(E,b).multiplyScalar(r.panSpeed),B(T.x,T.y),b.copy(E)}function at(ee){const Ae=ue(ee),re=ee.pageX-Ae.x,Fe=ee.pageY-Ae.y,Te=Math.sqrt(re*re+Fe*Fe);O.set(0,Te),N.set(0,Math.pow(O.y/C.y,r.zoomSpeed)),q(N.y),C.copy(O)}function te(ee){r.enableZoom&&at(ee),r.enablePan&&xt(ee)}function W(ee){r.enableZoom&&at(ee),r.enableRotate&&Qe(ee)}function Ee(ee){var Ae,re;r.enabled!==!1&&(k.length===0&&((Ae=r.domElement)==null||Ae.ownerDocument.addEventListener("pointermove",Be),(re=r.domElement)==null||re.ownerDocument.addEventListener("pointerup",le)),Dt(ee),ee.pointerType==="touch"?nn(ee):Ce(ee))}function Be(ee){r.enabled!==!1&&(ee.pointerType==="touch"?qe(ee):lt(ee))}function le(ee){var Ae,re,Fe;Ut(ee),k.length===0&&((Ae=r.domElement)==null||Ae.releasePointerCapture(ee.pointerId),(re=r.domElement)==null||re.ownerDocument.removeEventListener("pointermove",Be),(Fe=r.domElement)==null||Fe.ownerDocument.removeEventListener("pointerup",le)),r.dispatchEvent(o),l=a.NONE}function Ce(ee){let Ae;switch(ee.button){case 0:Ae=r.mouseButtons.LEFT;break;case 1:Ae=r.mouseButtons.MIDDLE;break;case 2:Ae=r.mouseButtons.RIGHT;break;default:Ae=-1}switch(Ae){case Xf.DOLLY:if(r.enableZoom===!1)return;ce(ee),l=a.DOLLY;break;case Xf.ROTATE:if(ee.ctrlKey||ee.metaKey||ee.shiftKey){if(r.enablePan===!1)return;we(ee),l=a.PAN}else{if(r.enableRotate===!1)return;ae(ee),l=a.ROTATE}break;case Xf.PAN:if(ee.ctrlKey||ee.metaKey||ee.shiftKey){if(r.enableRotate===!1)return;ae(ee),l=a.ROTATE}else{if(r.enablePan===!1)return;we(ee),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function lt(ee){if(r.enabled!==!1)switch(l){case a.ROTATE:if(r.enableRotate===!1)return;Me(ee);break;case a.DOLLY:if(r.enableZoom===!1)return;$e(ee);break;case a.PAN:if(r.enablePan===!1)return;Se(ee);break}}function rt(ee){r.enabled===!1||r.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(ee.preventDefault(),r.dispatchEvent(s),Ve(ee),r.dispatchEvent(o))}function ft(ee){r.enabled===!1||r.enablePan===!1||Xe(ee)}function nn(ee){switch(pt(ee),k.length){case 1:switch(r.touches.ONE){case qf.ROTATE:if(r.enableRotate===!1)return;fe(),l=a.TOUCH_ROTATE;break;case qf.PAN:if(r.enablePan===!1)return;Q(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(r.touches.TWO){case qf.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;Ue(),l=a.TOUCH_DOLLY_PAN;break;case qf.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;We(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&r.dispatchEvent(s)}function qe(ee){switch(pt(ee),l){case a.TOUCH_ROTATE:if(r.enableRotate===!1)return;Qe(ee),r.update();break;case a.TOUCH_PAN:if(r.enablePan===!1)return;xt(ee),r.update();break;case a.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;te(ee),r.update();break;case a.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;W(ee),r.update();break;default:l=a.NONE}}function dt(ee){r.enabled!==!1&&ee.preventDefault()}function Dt(ee){k.push(ee)}function Ut(ee){delete j[ee.pointerId];for(let Ae=0;Ae{$(ee),r.update()},this.dollyOut=(ee=ne())=>{q(ee),r.update()},this.getScale=()=>m,this.setScale=ee=>{K(ee),r.update()},this.getZoomScale=()=>ne(),n!==void 0&&this.connect(n),this.update()}};const t_e=R.forwardRef(({makeDefault:t,camera:e,regress:n,domElement:r,enableDamping:i=!0,keyEvents:s=!1,onChange:o,onStart:a,onEnd:l,...c},d)=>{const f=nd(N=>N.invalidate),m=nd(N=>N.camera),y=nd(N=>N.gl),x=nd(N=>N.events),S=nd(N=>N.setEvents),w=nd(N=>N.set),b=nd(N=>N.get),E=nd(N=>N.performance),T=e||m,C=r||x.connected||y.domElement,O=R.useMemo(()=>new e_e(T),[T]);return yG(()=>{O.enabled&&O.update()},-1),R.useEffect(()=>(s&&O.connect(s===!0?C:s),O.connect(C),()=>void O.dispose()),[s,C,n,O,f]),R.useEffect(()=>{const N=V=>{f(),n&&E.regress(),o&&o(V)},D=V=>{a&&a(V)},F=V=>{l&&l(V)};return O.addEventListener("change",N),O.addEventListener("start",D),O.addEventListener("end",F),()=>{O.removeEventListener("start",D),O.removeEventListener("end",F),O.removeEventListener("change",N)}},[o,a,l,O,f,S]),R.useEffect(()=>{if(t){const N=b().controls;return w({controls:O}),()=>w({controls:N})}},[t,O]),R.createElement("primitive",iP({ref:d,object:O,enableDamping:i},c))});function HU(t,e){if(e===GV)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(e===I1||e===xR){let n=t.getIndex();if(n===null){const o=[],a=t.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const c=new L_e(s,{path:n||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let d=0;d=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,n){const r=this;return new Promise(function(i,s){r.parse(e,n,i,s)})}}function r_e(){let t={};return{get:function(e){return t[e]},add:function(e,n){t[e]=n},remove:function(e){delete t[e]},removeAll:function(){t={}}}}const vn={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 i_e{constructor(e){this.parser=e,this.name=vn.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,n=this.parser.json.nodes||[];for(let r=0,i=n.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return n.loadTextureImage(e,s.source,o)}}class y_e{constructor(e){this.parser=e,this.name=vn.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class x_e{constructor(e){this.parser=e,this.name=vn.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const n=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[n])return null;const o=s.extensions[n],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(n)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const n=new Image;n.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",n.onload=n.onerror=function(){e(n.height===1)}})),this.isSupported}}class b_e{constructor(e){this.name=vn.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const n=this.parser.json,r=n.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,d=i.count,f=i.byteStride,m=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(d,f,m,i.mode,i.filter).then(function(y){return y.buffer}):o.ready.then(function(){const y=new ArrayBuffer(d*f);return o.decodeGltfBuffer(new Uint8Array(y),d,f,m,i.mode,i.filter),y})})}else return null}}class __e{constructor(e){this.name=vn.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const n=this.parser.json,r=n.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=n.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==Vo.TRIANGLES&&c.mode!==Vo.TRIANGLE_STRIP&&c.mode!==Vo.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(d=>(l[c]=d,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const d=c.pop(),f=d.isGroup?d.children:[d],m=c[0].count,y=[];for(const x of f){const S=new Ct,w=new X,b=new qt,E=new X(1,1,1),T=new IR(x.geometry,x.material,m);for(let C=0;C0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const O_e=new Ct;class L_e{constructor(e={},n={}){this.json=e,this.extensions={},this.plugins={},this.options=n,this.cache=new r_e,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 r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new $6(this.options.manager):this.textureLoader=new eG(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Va(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,n){const r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return Ff(s,a,i),Pc(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(n)}_markDefs(){const e=this.json.nodes||[],n=this.json.skins||[],r=this.json.meshes||[];for(let i=0,s=n.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,d]of o.children.entries())s(d,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[n]++,i}_invokeOne(e){const n=Object.values(this.plugins);n.push(this);for(let r=0;r=2&&w.setY(V,N[D*l+1]),l>=3&&w.setZ(V,N[D*l+2]),l>=4&&w.setW(V,N[D*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}w.normalized=x}return w})}loadTexture(e){const n=this.json,r=this.options,s=n.textures[e].source,o=n.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,n,r){const i=this,s=this.json,o=s.textures[e],a=s.images[n],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(n,r).then(function(d){d.flipY=!1,d.name=o.name||a.name||"",d.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(d.name=a.uri);const m=(s.samplers||{})[o.sampler]||{};return d.magFilter=GU[m.magFilter]||Cr,d.minFilter=GU[m.minFilter]||qo,d.wrapS=WU[m.wrapS]||Pd,d.wrapT=WU[m.wrapT]||Pd,i.associations.set(d,{textures:e}),d}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,n){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(f){c=!0;const m=new Blob([f],{type:o.mimeType});return l=a.createObjectURL(m),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const d=Promise.resolve(l).then(function(f){return new Promise(function(m,y){let x=m;n.isImageBitmapLoader===!0&&(x=function(S){const w=new dr(S);w.needsUpdate=!0,m(w)}),n.load(Md.resolveURL(f,s.path),x,void 0,y)})}).then(function(f){return c===!0&&a.revokeObjectURL(l),Pc(f,o),f.userData.mimeType=o.mimeType||k_e(o.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=d,d}assignTexture(e,n,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[vn.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[vn.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[vn.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[n]=o,o})}assignFinalMaterial(e){const n=e.geometry;let r=e.material;const i=n.attributes.tangent===void 0,s=n.attributes.color!==void 0,o=n.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new rM,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new $r,Gr.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(r))),r=l}e.material=r}getMaterialType(){return gx}loadMaterial(e){const n=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[vn.KHR_MATERIALS_UNLIT]){const f=i[vn.KHR_MATERIALS_UNLIT];o=f.getMaterialType(),c.push(f.extendParams(a,s,n))}else{const f=s.pbrMetallicRoughness||{};if(a.color=new ot(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const m=f.baseColorFactor;a.color.setRGB(m[0],m[1],m[2],xi),a.opacity=m[3]}f.baseColorTexture!==void 0&&c.push(n.assignTexture(a,"map",f.baseColorTexture,ji)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(c.push(n.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),c.push(n.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),o=this._invokeOne(function(m){return m.getMaterialType&&m.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(m){return m.extendMaterialParams&&m.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=xo);const d=s.alphaMode||QA.OPAQUE;if(d===QA.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,d===QA.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new He(1,1),s.normalTexture.scale!==void 0)){const f=s.normalTexture.scale;a.normalScale.set(f,f)}if(s.occlusionTexture!==void 0&&o!==As&&(c.push(n.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==As){const f=s.emissiveFactor;a.emissive=new ot().setRGB(f[0],f[1],f[2],xi)}return s.emissiveTexture!==void 0&&o!==As&&c.push(n.assignTexture(a,"emissiveMap",s.emissiveTexture,ji)),Promise.all(c).then(function(){const f=new o(a);return s.name&&(f.name=s.name),Pc(f,s),n.associations.set(f,{materials:e}),s.extensions&&Ff(i,f,s),f})}createUniqueName(e){const n=Nn.sanitizeNodeName(e||"");return n in this.nodeNamesUsed?n+"_"+ ++this.nodeNamesUsed[n]:(this.nodeNamesUsed[n]=0,n)}loadGeometries(e){const n=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[vn.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,n).then(function(l){return $U(l,a,n)})}const o=[];for(let a=0,l=e.length;a0&&N_e(b,s),b.name=n.createUniqueName(s.name||"mesh_"+e),Pc(b,s),w.extensions&&Ff(i,b,w),n.assignFinalMaterial(b),f.push(b)}for(let y=0,x=f.length;y1?d=new Ts:c.length===1?d=c[0]:d=new mn,d!==c[0])for(let f=0,m=c.length;f{const f=new Map;for(const[m,y]of i.associations)(m instanceof Gr||m instanceof dr)&&f.set(m,y);return d.traverse(m=>{const y=i.associations.get(m);y!=null&&f.set(m,y)}),f};return i.associations=c(s),s})}_createAnimationTracks(e,n,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];rd[s.path]===rd.weights?e.traverse(function(m){m.morphTargetInfluences&&l.push(m.name?m.name:m.uuid)}):l.push(a);let c;switch(rd[s.path]){case rd.weights:c=Hh;break;case rd.rotation:c=Vh;break;case rd.position:case rd.scale:c=Gh;break;default:switch(r.itemSize){case 1:c=Hh;break;case 2:case 3:default:c=Gh;break}break}const d=i.interpolation!==void 0?C_e[i.interpolation]:Og,f=this._getArrayFromAccessor(r);for(let m=0,y=l.length;mnew Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),Un=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),XU=class extends mn{constructor(t){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${t}`,this.expressionName=t,this.type="VRMExpression",this.visible=!1}get binds(){return this._binds}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(t){this._binds.push(t)}deleteBind(t){const e=this._binds.indexOf(t);e>=0&&this._binds.splice(e,1)}applyWeight(t){var e;let n=this.outputWeight;n*=(e=t==null?void 0:t.multiplier)!=null?e:1,this.isBinary&&n<1&&(n=0),this._binds.forEach(r=>r.applyWeight(n))}clearAppliedWeight(){this._binds.forEach(t=>t.clearAppliedWeight())}};function AG(t,e,n){var r,i;const s=t.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,d=[];return n.traverse(f=>{d.length{const s=AG(t,i,r);s!=null&&n.set(i,s)}),n})}var aP={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function TG(t){return Math.max(Math.min(t,1),0)}var YU=class CG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},n=new Set(Object.values(aP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},n=new Set(Object.values(aP));return Object.entries(this._expressionMap).forEach(([r,i])=>{n.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new CG().copy(this)}getExpression(e){var n;return(n=this._expressionMap[e])!=null?n:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const n=this._expressions.indexOf(e);n===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(n,1),delete this._expressionMap[e.expressionName]}getValue(e){var n;const r=this.getExpression(e);return(n=r==null?void 0:r.weight)!=null?n:null}setValue(e,n){const r=this.getExpression(e);r&&(r.weight=TG(n))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const n=this.getExpression(e);return n?`${n.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(n=>{n.clearAppliedWeight()}),this._expressions.forEach(n=>{let r=1;const i=n.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),n.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,n=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,n-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),n=Math.max(0,n),r=Math.max(0,r),{blink:e,lookAt:n,mouth:r}}},Ry={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},U_e={_Color:Ry.Color,_EmissionColor:Ry.EmissionColor,_ShadeColor:Ry.ShadeColor,_RimColor:Ry.RimColor,_OutlineColor:Ry.OutlineColor},j_e=new ot,PG=class RG{constructor({material:e,type:n,targetValue:r,targetAlpha:i}){this.material=e,this.type=n,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:n,alpha:r}=this._state;if(n!=null){const{propertyName:i,deltaValue:s}=n,o=this.material[i];o!=null&&o.add(j_e.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:n}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(n!=null){const{propertyName:r,initialValue:i}=n;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,n,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?n:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const d=i[l].clone(),f=new ot(o.r-d.r,o.g-d.g,o.b-d.b);return{propertyName:l,initialValue:d,deltaValue:f}}_initAlphaBindState(){var e,n,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(n=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?n:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],d=o-c;return{propertyName:l,initialValue:c,deltaValue:d}}_getPropertyNameMap(){var e,n;return(n=(e=Object.entries(RG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?n:null}};PG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var ZU=PG,U1=class{constructor({primitives:t,index:e,weight:n}){this.primitives=t,this.index=e,this.weight=n}applyWeight(t){this.primitives.forEach(e=>{var n;((n=e.morphTargetInfluences)==null?void 0:n[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*t)})}clearAppliedWeight(){this.primitives.forEach(t=>{var e;((e=t.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(t.morphTargetInfluences[this.index]=0)})}},QU=new He,NG=class IG{constructor({material:e,scale:n,offset:r}){var i,s;this.material=e,this.scale=n,this.offset=r;const o=(i=Object.entries(IG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const d=c.offset.clone(),f=c.repeat.clone(),m=r.clone().sub(d),y=n.clone().sub(f);this._properties.push({name:a,initialOffset:d,deltaOffset:m,initialScale:f,deltaScale:y})}))}applyWeight(e){this._properties.forEach(n=>{const r=this.material[n.name];r!==void 0&&(r.offset.add(QU.copy(n.deltaOffset).multiplyScalar(e)),r.repeat.add(QU.copy(n.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const n=this.material[e.name];n!==void 0&&(n.offset.copy(e.initialOffset),n.repeat.copy(e.initialScale))})}};NG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var JU=NG,F_e=new Set(["1.0","1.0-beta"]),kG=class OG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Un(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Un(this,null,function*(){const n=yield this._v1Import(e);if(n)return n;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return Un(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!F_e.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(aP)),d=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([m,y])=>{if(y!=null){if(!c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${m}" detected. Ignoring the expression`);return}d.set(m,y)}}),l.custom!=null&&Object.entries(l.custom).forEach(([m,y])=>{if(c.has(m)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${m}". Ignoring the expression`);return}d.set(m,y)});const f=new YU;return yield Promise.all(Array.from(d.entries()).map(m=>Un(this,[m],function*([y,x]){var S,w,b,E,T,C,O;const N=new XU(y);if(e.scene.add(N),N.isBinary=(S=x.isBinary)!=null?S:!1,N.overrideBlink=(w=x.overrideBlink)!=null?w:"none",N.overrideLookAt=(b=x.overrideLookAt)!=null?b:"none",N.overrideMouth=(E=x.overrideMouth)!=null?E:"none",(T=x.morphTargetBinds)==null||T.forEach(D=>Un(this,null,function*(){var F;if(D.node===void 0||D.index===void 0)return;const V=yield qU(e,D.node),k=D.index;if(!V.every(j=>Array.isArray(j.morphTargetInfluences)&&k{const V=F.material;V&&(Array.isArray(V)?D.push(...V):D.push(V))}),(C=x.materialColorBinds)==null||C.forEach(F=>Un(this,null,function*(){D.filter(k=>{var j;const H=(j=this.parser.associations.get(k))==null?void 0:j.materials;return F.material===H}).forEach(k=>{N.addBind(new ZU({material:k,type:F.type,targetValue:new ot().fromArray(F.targetValue),targetAlpha:F.targetValue[3]}))})})),(O=x.textureTransformBinds)==null||O.forEach(F=>Un(this,null,function*(){D.filter(k=>{var j;const H=(j=this.parser.associations.get(k))==null?void 0:j.materials;return F.material===H}).forEach(k=>{var j,H;N.addBind(new JU({material:k,offset:new He().fromArray((j=F.offset)!=null?j:[0,0]),scale:new He().fromArray((H=F.scale)!=null?H:[1,1])}))})}))}f.registerExpression(N)}))),f})}_v0Import(e){return Un(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new YU,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>Un(this,null,function*(){var d;const f=c.presetName,m=f!=null&&OG.v0v1PresetNameMap[f]||null,y=m??c.name;if(y==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(y)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${f} has duplicated entries. Ignoring the expression`);return}l.add(y);const x=new XU(y);e.scene.add(x),x.isBinary=(d=c.isBinary)!=null?d:!1,c.binds&&c.binds.forEach(w=>Un(this,null,function*(){var b;if(w.mesh===void 0||w.index===void 0)return;const E=[];if((b=r.nodes)==null||b.forEach((C,O)=>{C.mesh===w.mesh&&E.push(O)}),E.length===0){console.warn(`VRMExpressionLoaderPlugin: ${c.name} attempts to bind a morph target to the mesh #${w.mesh} but the mesh is not found or not used in the scene. Ignoring the bind.`);return}const T=w.index;yield Promise.all(E.map(C=>Un(this,null,function*(){var O;const N=yield qU(e,C);if(!N.every(D=>Array.isArray(D.morphTargetInfluences)&&T{if(w.materialName===void 0||w.propertyName===void 0||w.targetValue===void 0)return;const b=[];e.scene.traverse(T=>{if(T.material){const C=T.material;Array.isArray(C)?b.push(...C.filter(O=>(O.name===w.materialName||O.name===w.materialName+" (Outline)")&&b.indexOf(O)===-1)):C.name===w.materialName&&b.indexOf(C)===-1&&b.push(C)}});const E=w.propertyName;b.forEach(T=>{if(E==="_MainTex_ST"){const O=new He(w.targetValue[0],w.targetValue[1]),N=new He(w.targetValue[2],w.targetValue[3]);N.y=1-N.y-O.y,x.addBind(new JU({material:T,scale:O,offset:N}));return}const C=U_e[E];if(C){x.addBind(new ZU({material:T,type:C,targetValue:new ot().fromArray(w.targetValue),targetAlpha:w.targetValue[3]}));return}console.warn(E+" is not supported")})}),o.registerExpression(x)}))),o})}};kG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var z_e=kG,rN=class Bm{constructor(e,n){this._firstPersonOnlyLayer=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Bm.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=n}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(n=>({meshes:n.meshes.concat(),type:n.type})),this}clone(){return new Bm(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Bm.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:n=Bm.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=n,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,n,r,i){let s=0;if(n!=null&&n.length>0)for(let o=0;o0&&i.includes(f[0])||d[1]>0&&i.includes(f[1])||d[2]>0&&i.includes(f[2])||d[3]>0&&i.includes(f[3]))continue;const m=n[l],y=r[l];if(m[0]>0&&i.includes(y[0])||m[1]>0&&i.includes(y[1])||m[2]>0&&i.includes(y[2])||m[3]>0&&i.includes(y[3]))continue;const x=n[c],S=r[c];x[0]>0&&i.includes(S[0])||x[1]>0&&i.includes(S[1])||x[2]>0&&i.includes(S[2])||x[3]>0&&i.includes(S[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,n){const r=new tM(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof JC?[]:s.array,a=[];for(let S=0;S{this._isEraseTarget(s)&&r.push(o)}),!r.length){n.layers.enable(this._thirdPersonOnlyLayer),n.layers.enable(this._firstPersonOnlyLayer);return}n.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(n,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer));else{const n=new Ts;n.name=`_headless_${e.name}`,n.layers.set(this._firstPersonOnlyLayer),e.parent.add(n),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(n,i)})}else if(e.type==="SkinnedMesh"){const n=e;this._createHeadlessModelForSkinnedMesh(e.parent,n)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(n=>n.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};rN.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;rN.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var ej=rN,B_e=new Set(["1.0","1.0-beta"]),H_e=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(t){this.parser=t}afterRoot(t){return Un(this,null,function*(){const e=t.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");t.userData.vrmFirstPerson=yield this._import(t,e)}})}_import(t,e){return Un(this,null,function*(){if(e==null)return null;const n=yield this._v1Import(t,e);if(n)return n;const r=yield this._v0Import(t,e);return r||null})}_v1Import(t,e){return Un(this,null,function*(){var n,r;const i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!B_e.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson,c=[],d=yield KU(t);return Array.from(d.entries()).forEach(([f,m])=>{var y,x;const S=(y=l==null?void 0:l.meshAnnotations)==null?void 0:y.find(w=>w.node===f);c.push({meshes:m,type:(x=S==null?void 0:S.type)!=null?x:"auto"})}),new ej(e,c)})}_v0Import(t,e){return Un(this,null,function*(){var n;const r=this.parser.json,i=(n=r.extensions)==null?void 0:n.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield KU(t);return Array.from(a.entries()).forEach(([l,c])=>{const d=r.nodes[l],f=s.meshAnnotations?s.meshAnnotations.find(m=>m.mesh===d.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new ej(e,o)})}_convertV0FlagToV1Type(t){return t==="FirstPersonOnly"?"firstPersonOnly":t==="ThirdPersonOnly"?"thirdPersonOnly":t==="Both"?"both":"auto"}},tj=new X,nj=new X,V_e=new qt,rj=class extends Ts{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach(e=>{const n=new oG(1);n.matrixAutoUpdate=!1,n.material.depthTest=!1,n.material.depthWrite=!1,this.add(n),this._boneAxesMap.set(e,n)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(t=>{t.geometry.dispose(),t.material.dispose()})}updateMatrixWorld(t){Array.from(this._boneAxesMap.entries()).forEach(([e,n])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(tj,V_e,nj);const r=tj.set(.1,.1,.1).divide(nj);n.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(t)}},eT=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],G_e={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function LG(t){return t.invert?t.invert():t.inverse(),t}var zf=new X,Bf=new qt,lP=class{constructor(t){this.humanBones=t,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);r&&(zf.copy(r.position),Bf.copy(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()})}),t}getPose(){const t={};return Object.keys(this.humanBones).forEach(e=>{const n=e,r=this.getBoneNode(n);if(!r)return;zf.set(0,0,0),Bf.identity();const i=this.restPose[n];i!=null&&i.position&&zf.fromArray(i.position).negate(),i!=null&&i.rotation&&LG(Bf.fromArray(i.rotation)),zf.add(r.position),Bf.premultiply(r.quaternion),t[n]={position:zf.toArray(),rotation:Bf.toArray()}}),t}setPose(t){Object.entries(t).forEach(([e,n])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(n!=null&&n.position&&(i.position.fromArray(n.position),s.position&&i.position.add(zf.fromArray(s.position))),n!=null&&n.rotation&&(i.quaternion.fromArray(n.rotation),s.rotation&&i.quaternion.multiply(Bf.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([t,e])=>{const n=this.getBoneNode(t);n&&(e!=null&&e.position&&n.position.fromArray(e.position),e!=null&&e.rotation&&n.quaternion.fromArray(e.rotation))})}getBone(t){var e;return(e=this.humanBones[t])!=null?e:void 0}getBoneNode(t){var e,n;return(n=(e=this.humanBones[t])==null?void 0:e.node)!=null?n:null}},tT=new X,W_e=new qt,$_e=new X,ij=class DG extends lP{static _setupTransforms(e){const n=new mn;n.name="VRMHumanoidRig";const r={},i={},s={};eT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=new X,f=new qt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(d,f,tT),r[a]=d,i[a]=c.quaternion.clone();const m=new qt;(l=c.parent)==null||l.matrixWorld.decompose(tT,m,tT),s[a]=m}});const o={};return eT.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const d=r[a];let f=a,m;for(;m==null&&(f=G_e[f],f!=null);)m=r[f];const y=new mn;y.name="Normalized_"+c.name,(f?(l=o[f])==null?void 0:l.node:n).add(y),y.position.copy(d),m&&y.position.sub(m),o[a]={node:y}}}),{rigBones:o,root:n,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:n,root:r,parentWorldRotations:i,boneRotations:s}=DG._setupTransforms(e);super(n),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){eT.forEach(e=>{const n=this.original.getBoneNode(e);if(n!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=W_e.copy(i).invert(),o=this._boneRotations[e];if(n.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition($_e);n.parent.updateWorldMatrix(!0,!1);const l=n.parent.matrixWorld,c=a.applyMatrix4(l.invert());n.position.copy(c)}}})}},sj=class UG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,n){var r;this.autoUpdateHumanBones=(r=n==null?void 0:n.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new lP(e),this._normalizedHumanBones=new ij(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new lP(e.humanBones),this._normalizedHumanBones=new ij(this._rawHumanBones),this}clone(){return new UG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},X_e={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},q_e=new Set(["1.0","1.0-beta"]),oj={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},K_e=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(t){return Un(this,null,function*(){t.userData.vrmHumanoid=yield this._import(t)})}_import(t){return Un(this,null,function*(){const e=yield this._v1Import(t);if(e)return e;const n=yield this._v0Import(t);return n||null})}_v1Import(t){return Un(this,null,function*(){var e,n;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(n=r.extensions)==null?void 0:n.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!q_e.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(f=>Un(this,[f],function*([m,y]){let x=m;const S=y.node;if(l){const b=oj[x];b!=null&&(x=b)}const w=yield this.parser.getDependency("node",S);if(w==null){console.warn(`A glTF node bound to the humanoid bone ${x} (index = ${S}) does not exist`);return}c[x]={node:w}}))));const d=new sj(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(d.normalizedHumanBonesRoot),this.helperRoot){const f=new rj(d);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return d})}_v0Import(t){return Un(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>Un(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;if(c<0){console.warn(`A glTF node index for the humanoid bone ${l} is negative (${c}), ignoring this bone.`);return}const d=yield this.parser.getDependency("node",c);if(d==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const f=oj[l],m=f??l;if(s[m]!=null){console.warn(`Multiple bone entries for ${m} detected (index = ${c}), ignoring duplicated entries.`);return}s[m]={node:d}}))));const o=new sj(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(t.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new rj(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(t){const e=Object.values(X_e).filter(n=>t[n]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return t}},aj=class extends Zt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new Qt(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,t=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let t=0;t<64;t++){const e=t/63*this._currentTheta;this._attrPos.setXYZ(t+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<63;t++)this._attrIndex.setXYZ(t*3,0,t+1,t+2);this._attrIndex.needsUpdate=!0}},Y_e=class extends Zt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new X,this._currentTail=new X,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,t=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},k_=new qt,lj=new qt,Ny=new X,cj=new X,uj=Math.sqrt(2)/2,Z_e=new qt(0,0,-uj,uj),Q_e=new X(0,1,0),J_e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const e=new aj;e.radius=.5;const n=new As({color:65280,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshPitch=new yr(e,n),this.add(this._meshPitch)}{const e=new aj;e.radius=.5;const n=new As({color:16711680,transparent:!0,opacity:.5,side:xo,depthTest:!1,depthWrite:!1});this._meshYaw=new yr(e,n),this.add(this._meshYaw)}{const e=new Y_e;e.radius=.1;const n=new $r({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new Js(e,n),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(t){const e=gr.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const n=gr.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=n,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Ny),this.vrmLookAt.getLookAtWorldQuaternion(k_),k_.multiply(this.vrmLookAt.getFaceFrontQuaternion(lj)),this._meshYaw.position.copy(Ny),this._meshYaw.quaternion.copy(k_),this._meshPitch.position.copy(Ny),this._meshPitch.quaternion.copy(k_),this._meshPitch.quaternion.multiply(lj.setFromAxisAngle(Q_e,e)),this._meshPitch.quaternion.multiply(Z_e);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(cj).sub(Ny),this._lineTarget.geometry.tail.copy(cj),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Ny)),super.updateMatrixWorld(t)}},ewe=new X,twe=new X;function cP(t,e){return t.matrixWorld.decompose(ewe,e,twe),e}function Y_(t){return[Math.atan2(-t.z,t.x),Math.atan2(t.y,Math.sqrt(t.x*t.x+t.z*t.z))]}function dj(t){const e=Math.round(t/2/Math.PI);return t-2*Math.PI*e}var fj=new X(0,0,1),nwe=new X,rwe=new X,iwe=new X,swe=new qt,nT=new qt,hj=new qt,owe=new qt,rT=new as,jG=class FG{constructor(e,n){this.offsetFromHeadBone=new X,this.autoUpdate=!0,this.faceFront=new X(0,0,1),this.humanoid=e,this.applier=n,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new qt)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new as)}getEuler(e){return e.set(gr.DEG2RAD*this._pitch,gr.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new FG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const n=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(n.matrixWorld)}getLookAtWorldQuaternion(e){const n=this.humanoid.getRawBoneNode("head");return cP(n,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(fj)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[n,r]=Y_(this.faceFront);return rT.set(0,.5*Math.PI+n,r,"YZX"),e.setFromEuler(rT).premultiply(owe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(nT),this.getFaceFrontQuaternion(hj),e.copy(fj).applyQuaternion(nT).applyQuaternion(hj).applyEuler(this.getEuler(rT))}lookAt(e){const n=swe.copy(this._restHeadWorldQuaternion).multiply(LG(this.getLookAtWorldQuaternion(nT))),r=this.getLookAtWorldPosition(rwe),i=iwe.copy(e).sub(r).applyQuaternion(n).normalize(),[s,o]=Y_(this.faceFront),[a,l]=Y_(i),c=dj(a-s),d=dj(o-l);this._yaw=gr.RAD2DEG*c,this._pitch=gr.RAD2DEG*d,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(nwe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};jG.EULER_ORDER="YXZ";var awe=jG,lwe=new X(0,0,1),pl=new qt,km=new qt,zo=new as(0,0,0,"YXZ"),Z_=class{constructor(t,e,n,r,i){this.humanoid=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new X(0,0,1),this._restQuatLeftEye=new qt,this._restQuatRightEye=new qt,this._restLeftEyeParentWorldQuat=new qt,this._restRightEyeParentWorldQuat=new qt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),cP(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),cP(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,e){const n=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");n&&(e<0?zo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):zo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?zo.y=-gr.DEG2RAD*this.rangeMapHorizontalInner.map(-t):zo.y=gr.DEG2RAD*this.rangeMapHorizontalOuter.map(t),pl.setFromEuler(zo),this._getWorldFaceFrontQuat(km),i.quaternion.copy(km).multiply(pl).multiply(km.invert()),pl.copy(this._restLeftEyeParentWorldQuat),n.quaternion.copy(i.quaternion).multiply(pl).premultiply(pl.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?zo.x=-gr.DEG2RAD*this.rangeMapVerticalDown.map(-e):zo.x=gr.DEG2RAD*this.rangeMapVerticalUp.map(e),t<0?zo.y=-gr.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):zo.y=gr.DEG2RAD*this.rangeMapHorizontalInner.map(t),pl.setFromEuler(zo),this._getWorldFaceFrontQuat(km),s.quaternion.copy(km).multiply(pl).multiply(km.invert()),pl.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(pl).premultiply(pl.invert()).multiply(this._restQuatRightEye))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=gr.RAD2DEG*t.y,n=gr.RAD2DEG*t.x;this.applyYawPitch(e,n)}_getWorldFaceFrontQuat(t){if(this.faceFront.distanceToSquared(lwe)<.01)return t.identity();const[e,n]=Y_(this.faceFront);return zo.set(0,.5*Math.PI+e,n,"YZX"),t.setFromEuler(zo)}};Z_.type="bone";var uP=class{constructor(t,e,n,r,i){this.expressions=t,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=n,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(t,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),t<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-t))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(t)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=gr.RAD2DEG*t.y,n=gr.RAD2DEG*t.x;this.applyYawPitch(e,n)}};uP.type="expression";var pj=class{constructor(t,e){this.inputMaxValue=t,this.outputScale=e}map(t){return this.outputScale*TG(t/this.inputMaxValue)}},cwe=new Set(["1.0","1.0-beta"]),O_=.01,uwe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(t,e){this.parser=t,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(t){return Un(this,null,function*(){const e=t.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const n=t.userData.vrmExpressionManager;if(n!==null){if(n===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");t.userData.vrmLookAt=yield this._import(t,e,n)}})}_import(t,e,n){return Un(this,null,function*(){if(e==null||n==null)return null;const r=yield this._v1Import(t,e,n);if(r)return r;const i=yield this._v0Import(t,e,n);return i||null})}_v1Import(t,e,n){return Un(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!cwe.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const d=l.lookAt;if(!d)return null;const f=d.type==="expression"?1:10,m=this._v1ImportRangeMap(d.rangeMapHorizontalInner,f),y=this._v1ImportRangeMap(d.rangeMapHorizontalOuter,f),x=this._v1ImportRangeMap(d.rangeMapVerticalDown,f),S=this._v1ImportRangeMap(d.rangeMapVerticalUp,f);let w;d.type==="expression"?w=new uP(n,m,y,x,S):w=new Z_(e,m,y,x,S);const b=this._importLookAt(e,w);return b.offsetFromHeadBone.fromArray((s=d.offsetFromHeadBone)!=null?s:[0,.06,0]),b})}_v1ImportRangeMap(t,e){var n,r;let i=(n=t==null?void 0:t.inputMaxValue)!=null?n:90;const s=(r=t==null?void 0:t.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},pwe=class{constructor(t){this.scene=t.scene,this.meta=t.meta,this.humanoid=t.humanoid,this.expressionManager=t.expressionManager,this.firstPerson=t.firstPerson,this.lookAt=t.lookAt}update(t){this.humanoid.update(),this.lookAt&&this.lookAt.update(t),this.expressionManager&&this.expressionManager.update()}},mwe=class extends pwe{constructor(t){super(t),this.materials=t.materials,this.springBoneManager=t.springBoneManager,this.nodeConstraintManager=t.nodeConstraintManager}update(t){super.update(t),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(t),this.materials&&this.materials.forEach(e=>{e.update&&e.update(t)})}},gwe=Object.defineProperty,mj=Object.getOwnPropertySymbols,vwe=Object.prototype.hasOwnProperty,ywe=Object.prototype.propertyIsEnumerable,gj=(t,e,n)=>e in t?gwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,vj=(t,e)=>{for(var n in e||(e={}))vwe.call(e,n)&&gj(t,n,e[n]);if(mj)for(var n of mj(e))ywe.call(e,n)&&gj(t,n,e[n]);return t},ch=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),xwe={"":3e3,srgb:3001};function bwe(t,e){parseInt(Td,10)>=152?t.colorSpace=e:t.encoding=xwe[e]}var _we=class{get pending(){return Promise.all(this._pendings)}constructor(t,e){this._parser=t,this._materialParams=e,this._pendings=[]}assignPrimitive(t,e){e!=null&&(this._materialParams[t]=e)}assignColor(t,e,n){if(e!=null){const r=new ot().fromArray(e);n&&r.convertSRGBToLinear(),this._materialParams[t]=r}}assignTexture(t,e,n){return ch(this,null,function*(){const r=ch(this,null,function*(){if(e!=null){const i=yield this._parser.assignTexture(this._materialParams,t,e);if(i==null){console.warn("GLTFMToonMaterialParamsAssignHelper: Failed to load texture. The rendering result may be wrong");return}n&&bwe(i,"srgb")}});return this._pendings.push(r),r})}assignTextureByIndex(t,e,n){return ch(this,null,function*(){return this.assignTexture(t,e!=null?{index:e}:void 0,n)})}},wwe=`// #define PHONG + +varying vec3 vViewPosition; + +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif + +#include + +// #include +#ifdef MTOON_USE_UV + varying vec2 vUv; + + // COMPAT: pre-r151 uses a common uvTransform + #if THREE_VRM_THREE_REVISION < 151 + uniform mat3 uvTransform; + #endif +#endif + +// #include +// COMAPT: pre-r151 uses uv2 for lightMap and aoMap +#if THREE_VRM_THREE_REVISION < 151 + #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + attribute vec2 uv2; + varying vec2 vUv2; + uniform mat3 uv2Transform; + #endif +#endif + +// #include +// #include +#include +#include +#include +#include +#include +#include +#include + +#ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE + uniform sampler2D outlineWidthMultiplyTexture; + uniform mat3 outlineWidthMultiplyTextureUvTransform; +#endif + +uniform float outlineWidthFactor; + +void main() { + + // #include + #ifdef MTOON_USE_UV + // COMPAT: pre-r151 uses a common uvTransform + #if THREE_VRM_THREE_REVISION >= 151 + vUv = uv; + #else + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #endif + + // #include + // COMAPT: pre-r151 uses uv2 for lightMap and aoMap + #if THREE_VRM_THREE_REVISION < 151 + #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; + #endif + #endif + + #include + + #include + #include + #include + #include + + // we need this to compute the outline properly + objectNormal = normalize( objectNormal ); + + #include + + #ifndef FLAT_SHADED // Normal computed with derivatives when FLAT_SHADED + vNormal = normalize( transformedNormal ); + #endif + + #include + + #include + #include + // #include + #include + #include + #include + + vViewPosition = - mvPosition.xyz; + + #ifdef OUTLINE + float worldNormalLength = length( transformedNormal ); + vec3 outlineOffset = outlineWidthFactor * worldNormalLength * objectNormal; + + #ifdef USE_OUTLINEWIDTHMULTIPLYTEXTURE + vec2 outlineWidthMultiplyTextureUv = ( outlineWidthMultiplyTextureUvTransform * vec3( vUv, 1 ) ).xy; + float outlineTex = texture2D( outlineWidthMultiplyTexture, outlineWidthMultiplyTextureUv ).g; + outlineOffset *= outlineTex; + #endif + + #ifdef OUTLINE_WIDTH_SCREEN + outlineOffset *= vViewPosition.z / projectionMatrix[ 1 ].y; + #endif + + gl_Position = projectionMatrix * modelViewMatrix * vec4( outlineOffset + transformed, 1.0 ); + + gl_Position.z += 1E-6 * gl_Position.w; // anti-artifact magic + #endif + + #include + // #include + #include + #include + +}`,Swe=`// #define PHONG + +uniform vec3 litFactor; + +uniform float opacity; + +uniform vec3 shadeColorFactor; +#ifdef USE_SHADEMULTIPLYTEXTURE + uniform sampler2D shadeMultiplyTexture; + uniform mat3 shadeMultiplyTextureUvTransform; +#endif + +uniform float shadingShiftFactor; +uniform float shadingToonyFactor; + +#ifdef USE_SHADINGSHIFTTEXTURE + uniform sampler2D shadingShiftTexture; + uniform mat3 shadingShiftTextureUvTransform; + uniform float shadingShiftTextureScale; +#endif + +uniform float giEqualizationFactor; + +uniform vec3 parametricRimColorFactor; +#ifdef USE_RIMMULTIPLYTEXTURE + uniform sampler2D rimMultiplyTexture; + uniform mat3 rimMultiplyTextureUvTransform; +#endif +uniform float rimLightingMixFactor; +uniform float parametricRimFresnelPowerFactor; +uniform float parametricRimLiftFactor; + +#ifdef USE_MATCAPTEXTURE + uniform vec3 matcapFactor; + uniform sampler2D matcapTexture; + uniform mat3 matcapTextureUvTransform; +#endif + +uniform vec3 emissive; +uniform float emissiveIntensity; + +uniform vec3 outlineColorFactor; +uniform float outlineLightingMixFactor; + +#ifdef USE_UVANIMATIONMASKTEXTURE + uniform sampler2D uvAnimationMaskTexture; + uniform mat3 uvAnimationMaskTextureUvTransform; +#endif + +uniform float uvAnimationScrollXOffset; +uniform float uvAnimationScrollYOffset; +uniform float uvAnimationRotationPhase; + +#include +#include +#include +#include + +// #include +#if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) ) + varying vec2 vUv; +#endif + +// #include +// COMAPT: pre-r151 uses uv2 for lightMap and aoMap +#if THREE_VRM_THREE_REVISION < 151 + #if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + varying vec2 vUv2; + #endif +#endif + +#include + +#ifdef USE_MAP + uniform mat3 mapUvTransform; +#endif + +// #include + +#include + +#include +// #include +#include + +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapUvTransform; +#endif + +// #include +// #include +// #include +#include + +// #include +// COMPAT: pre-r151 doesn't have BRDF_Lambert in +#if THREE_VRM_THREE_REVISION < 151 + vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; + } +#endif + +#include + +#include + +// #include +varying vec3 vViewPosition; + +struct MToonMaterial { + vec3 diffuseColor; + vec3 shadeColor; + float shadingShift; +}; + +float linearstep( float a, float b, float t ) { + return clamp( ( t - a ) / ( b - a ), 0.0, 1.0 ); +} + +/** + * Convert NdotL into toon shading factor using shadingShift and shadingToony + */ +float getShading( + const in float dotNL, + const in float shadow, + const in float shadingShift +) { + float shading = dotNL; + shading = shading + shadingShift; + shading = linearstep( -1.0 + shadingToonyFactor, 1.0 - shadingToonyFactor, shading ); + shading *= shadow; + return shading; +} + +/** + * Mix diffuseColor and shadeColor using shading factor and light color + */ +vec3 getDiffuse( + const in MToonMaterial material, + const in float shading, + in vec3 lightColor +) { + #ifdef DEBUG_LITSHADERATE + return vec3( BRDF_Lambert( shading * lightColor ) ); + #endif + + vec3 col = lightColor * BRDF_Lambert( mix( material.shadeColor, material.diffuseColor, shading ) ); + + // The "comment out if you want to PBR absolutely" line + #ifdef V0_COMPAT_SHADE + col = min( col, material.diffuseColor ); + #endif + + return col; +} + +// COMPAT: pre-r156 uses a struct GeometricContext +#if THREE_VRM_THREE_REVISION >= 157 + void RE_Direct_MToon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) { + float dotNL = clamp( dot( geometryNormal, directLight.direction ), -1.0, 1.0 ); + vec3 irradiance = directLight.color; + + // directSpecular will be used for rim lighting, not an actual specular + reflectedLight.directSpecular += irradiance; + + irradiance *= dotNL; + + float shading = getShading( dotNL, shadow, material.shadingShift ); + + // toon shaded diffuse + reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color ); + } + + void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in MToonMaterial material, inout ReflectedLight reflectedLight ) { + // indirect diffuse will use diffuseColor, no shadeColor involved + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + + // directSpecular will be used for rim lighting, not an actual specular + reflectedLight.directSpecular += irradiance; + } +#else + void RE_Direct_MToon( const in IncidentLight directLight, const in GeometricContext geometry, const in MToonMaterial material, const in float shadow, inout ReflectedLight reflectedLight ) { + float dotNL = clamp( dot( geometry.normal, directLight.direction ), -1.0, 1.0 ); + vec3 irradiance = directLight.color; + + // directSpecular will be used for rim lighting, not an actual specular + reflectedLight.directSpecular += irradiance; + + irradiance *= dotNL; + + float shading = getShading( dotNL, shadow, material.shadingShift ); + + // toon shaded diffuse + reflectedLight.directDiffuse += getDiffuse( material, shading, directLight.color ); + } + + void RE_IndirectDiffuse_MToon( const in vec3 irradiance, const in GeometricContext geometry, const in MToonMaterial material, inout ReflectedLight reflectedLight ) { + // indirect diffuse will use diffuseColor, no shadeColor involved + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + + // directSpecular will be used for rim lighting, not an actual specular + reflectedLight.directSpecular += irradiance; + } +#endif + +#define RE_Direct RE_Direct_MToon +#define RE_IndirectDiffuse RE_IndirectDiffuse_MToon +#define Material_LightProbeLOD( material ) (0) + +#include +// #include + +// #include +#ifdef USE_NORMALMAP + + uniform sampler2D normalMap; + uniform mat3 normalMapUvTransform; + uniform vec2 normalScale; + +#endif + +// COMPAT: pre-r151 +// USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151 +#if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP ) + + uniform mat3 normalMatrix; + +#endif + +// COMPAT: pre-r151 +// USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151 +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( TANGENTSPACE_NORMALMAP ) ) + + // Per-Pixel Tangent Space Normal Mapping + // http://hacksoflife.blogspot.ch/2009/11/per-pixel-tangent-space-normal-mapping.html + + // three-vrm specific change: it requires \`uv\` as an input in order to support uv scrolls + + // Temporary compat against shader change @ Three.js r126, r151 + #if THREE_VRM_THREE_REVISION >= 151 + + 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 ); + + } + + #else + + vec3 perturbNormal2Arb( vec2 uv, vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { + + vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) ); + vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + + vec3 N = normalize( 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; + + // three-vrm specific change: Workaround for the issue that happens when delta of uv = 0.0 + // TODO: Is this still required? Or shall I make a PR about it? + if ( length( T ) == 0.0 || length( B ) == 0.0 ) { + return surf_norm; + } + + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); + + return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); + + } + + #endif + +#endif + +// #include +#include +#include + +// == post correction ========================================================== +void postCorrection() { + #include + #include + #include + #include + #include +} + +// == main procedure =========================================================== +void main() { + #include + + vec2 uv = vec2(0.5, 0.5); + + #if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) ) + uv = vUv; + + float uvAnimMask = 1.0; + #ifdef USE_UVANIMATIONMASKTEXTURE + vec2 uvAnimationMaskTextureUv = ( uvAnimationMaskTextureUvTransform * vec3( uv, 1 ) ).xy; + uvAnimMask = texture2D( uvAnimationMaskTexture, uvAnimationMaskTextureUv ).b; + #endif + + float uvRotCos = cos( uvAnimationRotationPhase * uvAnimMask ); + float uvRotSin = sin( uvAnimationRotationPhase * uvAnimMask ); + uv = mat2( uvRotCos, -uvRotSin, uvRotSin, uvRotCos ) * ( uv - 0.5 ) + 0.5; + uv = uv + vec2( uvAnimationScrollXOffset, uvAnimationScrollYOffset ) * uvAnimMask; + #endif + + #ifdef DEBUG_UV + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #if ( defined( MTOON_USE_UV ) && !defined( MTOON_UVS_VERTEX_ONLY ) ) + gl_FragColor = vec4( uv, 0.0, 1.0 ); + #endif + return; + #endif + + vec4 diffuseColor = vec4( litFactor, opacity ); + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive * emissiveIntensity; + + #include + + // #include + #ifdef USE_MAP + vec2 mapUv = ( mapUvTransform * vec3( uv, 1 ) ).xy; + vec4 sampledDiffuseColor = texture2D( map, mapUv ); + #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 + + // #include + #if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) ) + diffuseColor.rgb *= vColor; + #endif + + // #include + + #include + + // #include + + // #include + 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 + + #ifdef USE_NORMALMAP + + vec2 normalMapUv = ( normalMapUvTransform * vec3( uv, 1 ) ).xy; + + #endif + + #ifdef USE_NORMALMAP_TANGENTSPACE + + #ifdef USE_TANGENT + + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + + #else + + mat3 tbn = getTangentFrame( - vViewPosition, normal, normalMapUv ); + + #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 + + // non perturbed normal for clearcoat among others + + vec3 nonPerturbedNormal = normal; + + #ifdef OUTLINE + normal *= -1.0; + #endif + + // #include + + // COMPAT: pre-r151 + // USE_NORMALMAP_OBJECTSPACE used to be OBJECTSPACE_NORMALMAP in pre-r151 + #if defined( USE_NORMALMAP_OBJECTSPACE ) || defined( OBJECTSPACE_NORMALMAP ) + + normal = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals + + #ifdef FLIP_SIDED + + normal = - normal; + + #endif + + #ifdef DOUBLE_SIDED + + normal = normal * faceDirection; + + #endif + + normal = normalize( normalMatrix * normal ); + + // COMPAT: pre-r151 + // USE_NORMALMAP_TANGENTSPACE used to be TANGENTSPACE_NORMALMAP in pre-r151 + #elif defined( USE_NORMALMAP_TANGENTSPACE ) || defined( TANGENTSPACE_NORMALMAP ) + + vec3 mapN = texture2D( normalMap, normalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + + // COMPAT: pre-r151 + #if THREE_VRM_THREE_REVISION >= 151 || defined( USE_TANGENT ) + + normal = normalize( tbn * mapN ); + + #else + + normal = perturbNormal2Arb( uv, -vViewPosition, normal, mapN, faceDirection ); + + #endif + + #endif + + // #include + #ifdef USE_EMISSIVEMAP + vec2 emissiveMapUv = ( emissiveMapUvTransform * vec3( uv, 1 ) ).xy; + totalEmissiveRadiance *= texture2D( emissiveMap, emissiveMapUv ).rgb; + #endif + + #ifdef DEBUG_NORMAL + gl_FragColor = vec4( 0.5 + 0.5 * normal, 1.0 ); + return; + #endif + + // -- MToon: lighting -------------------------------------------------------- + // accumulation + // #include + MToonMaterial material; + + material.diffuseColor = diffuseColor.rgb; + + material.shadeColor = shadeColorFactor; + #ifdef USE_SHADEMULTIPLYTEXTURE + vec2 shadeMultiplyTextureUv = ( shadeMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy; + material.shadeColor *= texture2D( shadeMultiplyTexture, shadeMultiplyTextureUv ).rgb; + #endif + + #if ( defined( USE_COLOR ) && !defined( IGNORE_VERTEX_COLOR ) ) + material.shadeColor.rgb *= vColor; + #endif + + material.shadingShift = shadingShiftFactor; + #ifdef USE_SHADINGSHIFTTEXTURE + vec2 shadingShiftTextureUv = ( shadingShiftTextureUvTransform * vec3( uv, 1 ) ).xy; + material.shadingShift += texture2D( shadingShiftTexture, shadingShiftTextureUv ).r * shadingShiftTextureScale; + #endif + + // #include + + // MToon Specific changes: + // Since we want to take shadows into account of shading instead of irradiance, + // we had to modify the codes that multiplies the results of shadowmap into color of direct lights. + + // COMPAT: pre-r156 uses a struct GeometricContext + #if THREE_VRM_THREE_REVISION >= 157 + vec3 geometryPosition = - vViewPosition; + vec3 geometryNormal = normal; + vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); + + vec3 geometryClearcoatNormal; + + #ifdef USE_CLEARCOAT + + geometryClearcoatNormal = clearcoatNormal; + + #endif + #else + GeometricContext geometry; + + geometry.position = - vViewPosition; + geometry.normal = normal; + geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); + + #ifdef USE_CLEARCOAT + + geometry.clearcoatNormal = clearcoatNormal; + + #endif + #endif + + IncidentLight directLight; + + // since these variables will be used in unrolled loop, we have to define in prior + float shadow; + + #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 ]; + + // COMPAT: pre-r156 uses a struct GeometricContext + #if THREE_VRM_THREE_REVISION >= 157 + getPointLightInfo( pointLight, geometryPosition, directLight ); + #else + getPointLightInfo( pointLight, geometry, directLight ); + #endif + + shadow = 1.0; + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + // COMPAT: pre-r166 + // r166 introduced shadowIntensity + #if THREE_VRM_THREE_REVISION >= 166 + shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #else + shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + #endif + + // COMPAT: pre-r156 uses a struct GeometricContext + #if THREE_VRM_THREE_REVISION >= 157 + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight ); + #else + RE_Direct( directLight, geometry, material, shadow, reflectedLight ); + #endif + + } + #pragma unroll_loop_end + + #endif + + #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + + SpotLight spotLight; + // COMPAT: pre-r144 uses NUM_SPOT_LIGHT_SHADOWS, r144+ uses NUM_SPOT_LIGHT_COORDS + #if THREE_VRM_THREE_REVISION >= 144 + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_COORDS > 0 + SpotLightShadow spotLightShadow; + #endif + #elif 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 ]; + + // COMPAT: pre-r156 uses a struct GeometricContext + #if THREE_VRM_THREE_REVISION >= 157 + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #else + getSpotLightInfo( spotLight, geometry, directLight ); + #endif + + shadow = 1.0; + // COMPAT: pre-r144 uses NUM_SPOT_LIGHT_SHADOWS and vSpotShadowCoord, r144+ uses NUM_SPOT_LIGHT_COORDS and vSpotLightCoord + // COMPAT: pre-r166 does not have shadowIntensity, r166+ has shadowIntensity + #if THREE_VRM_THREE_REVISION >= 166 + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_COORDS ) + spotLightShadow = spotLightShadows[ i ]; + shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + #elif THREE_VRM_THREE_REVISION >= 144 + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_COORDS ) + spotLightShadow = spotLightShadows[ i ]; + shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + #elif defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; + #endif + + // COMPAT: pre-r156 uses a struct GeometricContext + #if THREE_VRM_THREE_REVISION >= 157 + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight ); + #else + RE_Direct( directLight, geometry, material, shadow, reflectedLight ); + #endif + + } + #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 ]; + + // COMPAT: pre-r156 uses a struct GeometricContext + #if THREE_VRM_THREE_REVISION >= 157 + getDirectionalLightInfo( directionalLight, directLight ); + #else + getDirectionalLightInfo( directionalLight, geometry, directLight ); + #endif + + shadow = 1.0; + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + // COMPAT: pre-r166 + // r166 introduced shadowIntensity + #if THREE_VRM_THREE_REVISION >= 166 + shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #else + shadow = all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + #endif + + // COMPAT: pre-r156 uses a struct GeometricContext + #if THREE_VRM_THREE_REVISION >= 157 + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, shadow, reflectedLight ); + #else + RE_Direct( directLight, geometry, material, shadow, reflectedLight ); + #endif + + } + #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, geometry, material, reflectedLight ); + + // } + // #pragma unroll_loop_end + + // #endif + + #if defined( RE_IndirectDiffuse ) + + vec3 iblIrradiance = vec3( 0.0 ); + + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + + // COMPAT: pre-r156 uses a struct GeometricContext + // COMPAT: pre-r156 doesn't have a define USE_LIGHT_PROBES + #if THREE_VRM_THREE_REVISION >= 157 + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #else + irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); + #endif + + #if ( NUM_HEMI_LIGHTS > 0 ) + + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + + // COMPAT: pre-r156 uses a struct GeometricContext + #if THREE_VRM_THREE_REVISION >= 157 + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + #else + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); + #endif + + } + #pragma unroll_loop_end + + #endif + + #endif + + // #if defined( RE_IndirectSpecular ) + + // vec3 radiance = vec3( 0.0 ); + // vec3 clearcoatRadiance = vec3( 0.0 ); + + // #endif + + #include + #include + + // modulation + #include + + vec3 col = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + + #ifdef DEBUG_LITSHADERATE + gl_FragColor = vec4( col, diffuseColor.a ); + postCorrection(); + return; + #endif + + // -- MToon: rim lighting ----------------------------------------- + vec3 viewDir = normalize( vViewPosition ); + + #ifndef PHYSICALLY_CORRECT_LIGHTS + reflectedLight.directSpecular /= PI; + #endif + vec3 rimMix = mix( vec3( 1.0 ), reflectedLight.directSpecular, rimLightingMixFactor ); + + vec3 rim = parametricRimColorFactor * pow( saturate( 1.0 - dot( viewDir, normal ) + parametricRimLiftFactor ), parametricRimFresnelPowerFactor ); + + #ifdef USE_MATCAPTEXTURE + { + vec3 x = normalize( vec3( viewDir.z, 0.0, -viewDir.x ) ); + vec3 y = cross( viewDir, x ); // guaranteed to be normalized + vec2 sphereUv = 0.5 + 0.5 * vec2( dot( x, normal ), -dot( y, normal ) ); + sphereUv = ( matcapTextureUvTransform * vec3( sphereUv, 1 ) ).xy; + vec3 matcap = texture2D( matcapTexture, sphereUv ).rgb; + rim += matcapFactor * matcap; + } + #endif + + #ifdef USE_RIMMULTIPLYTEXTURE + vec2 rimMultiplyTextureUv = ( rimMultiplyTextureUvTransform * vec3( uv, 1 ) ).xy; + rim *= texture2D( rimMultiplyTexture, rimMultiplyTextureUv ).rgb; + #endif + + col += rimMix * rim; + + // -- MToon: Emission -------------------------------------------------------- + col += totalEmissiveRadiance; + + // #include + + // -- Almost done! ----------------------------------------------------------- + #if defined( OUTLINE ) + col = outlineColorFactor.rgb * mix( vec3( 1.0 ), col, outlineLightingMixFactor ); + #endif + + #ifdef OPAQUE + diffuseColor.a = 1.0; + #endif + + gl_FragColor = vec4( col, diffuseColor.a ); + postCorrection(); +} +`,Mwe={None:"none"},yj={None:"none",ScreenCoordinates:"screenCoordinates"},Ewe={3e3:"",3001:"srgb"};function iT(t){return parseInt(Td,10)>=152?t.colorSpace:Ewe[t.encoding]}var Awe=class extends Qo{constructor(t={}){var e;super({vertexShader:wwe,fragmentShader:Swe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=lu,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=Mwe.None,this._outlineWidthMode=yj.None,this._isOutline=!1,t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,t.fog=!0,t.lights=!0,t.clipping=!0,this.uniforms=ER.merge([ht.common,ht.normalmap,ht.emissivemap,ht.fog,ht.lights,{litFactor:{value:new ot(1,1,1)},mapUvTransform:{value:new Xt},colorAlpha:{value:1},normalMapUvTransform:{value:new Xt},shadeColorFactor:{value:new ot(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new Xt},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new Xt},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ot(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new Xt},parametricRimColorFactor:{value:new ot(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new Xt},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ot(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new Xt},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new Xt},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ot(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new Xt},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=t.uniforms)!=null?e:{}]),this.setValues(t),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([n,r])=>`${n}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${iT(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${iT(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${iT(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=n=>{const r=parseInt(Td,10),i=Object.entries(vj(vj({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` +`)+` +`;n.vertexShader=i+n.vertexShader,n.fragmentShader=i+n.fragmentShader,r<154&&(n.fragmentShader=n.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(t){this.uniforms.litFactor.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get normalMap(){return this.uniforms.normalMap.value}set normalMap(t){this.uniforms.normalMap.value=t}get normalScale(){return this.uniforms.normalScale.value}set normalScale(t){this.uniforms.normalScale.value=t}get emissive(){return this.uniforms.emissive.value}set emissive(t){this.uniforms.emissive.value=t}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(t){this.uniforms.emissiveIntensity.value=t}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(t){this.uniforms.emissiveMap.value=t}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(t){this.uniforms.shadeColorFactor.value=t}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(t){this.uniforms.shadeMultiplyTexture.value=t}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(t){this.uniforms.shadingShiftFactor.value=t}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(t){this.uniforms.shadingShiftTexture.value=t}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(t){this.uniforms.shadingShiftTextureScale.value=t}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(t){this.uniforms.shadingToonyFactor.value=t}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(t){this.uniforms.giEqualizationFactor.value=t}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(t){this.uniforms.matcapFactor.value=t}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(t){this.uniforms.matcapTexture.value=t}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(t){this.uniforms.parametricRimColorFactor.value=t}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(t){this.uniforms.rimMultiplyTexture.value=t}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(t){this.uniforms.rimLightingMixFactor.value=t}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(t){this.uniforms.parametricRimFresnelPowerFactor.value=t}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(t){this.uniforms.parametricRimLiftFactor.value=t}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(t){this.uniforms.outlineWidthMultiplyTexture.value=t}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(t){this.uniforms.outlineWidthFactor.value=t}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(t){this.uniforms.outlineColorFactor.value=t}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(t){this.uniforms.outlineLightingMixFactor.value=t}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(t){this.uniforms.uvAnimationMaskTexture.value=t}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(t){this.uniforms.uvAnimationScrollXOffset.value=t}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(t){this.uniforms.uvAnimationScrollYOffset.value=t}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(t){this.uniforms.uvAnimationRotationPhase.value=t}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(t){this._ignoreVertexColor=t,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(t){this._v0CompatShade=t,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(t){this._debugMode=t,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(t){this._outlineWidthMode=t,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(t){this._isOutline=t,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(t){this._uploadUniformsWorkaround(),this._updateUVAnimation(t)}copy(t){return super.copy(t),this.map=t.map,this.normalMap=t.normalMap,this.emissiveMap=t.emissiveMap,this.shadeMultiplyTexture=t.shadeMultiplyTexture,this.shadingShiftTexture=t.shadingShiftTexture,this.matcapTexture=t.matcapTexture,this.rimMultiplyTexture=t.rimMultiplyTexture,this.outlineWidthMultiplyTexture=t.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=t.uvAnimationMaskTexture,this.normalMapType=t.normalMapType,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=t.ignoreVertexColor,this.v0CompatShade=t.v0CompatShade,this.debugMode=t.debugMode,this.outlineWidthMode=t.outlineWidthMode,this.isOutline=t.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(t){this.uniforms.uvAnimationScrollXOffset.value+=t*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=t*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=t*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const t=parseInt(Td,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===yj.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Twe=new Set(["1.0","1.0-beta"]),zG=class Q_{get name(){return Q_.EXTENSION_NAME}constructor(e,n={}){var r,i,s,o;this.parser=e,this.materialType=(r=n.materialType)!=null?r:Awe,this.renderOrderOffset=(i=n.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(o=n.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return ch(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return ch(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,n){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,n):null}loadMesh(e){return ch(this,null,function*(){var n;const r=this.parser,s=(n=r.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Q_.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!Twe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Q_.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,n){return ch(this,null,function*(){var r;delete n.metalness,delete n.roughness;const i=new _we(this.parser,n);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,n){const r=this._getMToonExtension(n);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const n=e.material;if(!(n instanceof Gr)||!this._shouldGenerateOutline(n))return;e.material=[n];const r=n.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=ss,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const n=e.material,r=new Set;Array.isArray(n)?n.forEach(i=>r.add(i)):r.add(n);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var n;return(e.transparentWithZWrite?0:19)+((n=e.renderQueueOffsetNumber)!=null?n:0)}};zG.EXTENSION_NAME="VRMC_materials_mtoon";var Cwe=zG,Pwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),BG=class dP{get name(){return dP.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Pwe(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;n.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var n,r;const o=(n=this.parser.json.materials)==null?void 0:n[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[dP.EXTENSION_NAME];if(a!=null)return a}};BG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Rwe=BG,Nwe=Object.defineProperty,Iwe=Object.defineProperties,kwe=Object.getOwnPropertyDescriptors,xj=Object.getOwnPropertySymbols,Owe=Object.prototype.hasOwnProperty,Lwe=Object.prototype.propertyIsEnumerable,bj=(t,e,n)=>e in t?Nwe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ml=(t,e)=>{for(var n in e||(e={}))Owe.call(e,n)&&bj(t,n,e[n]);if(xj)for(var n of xj(e))Lwe.call(e,n)&&bj(t,n,e[n]);return t},_j=(t,e)=>Iwe(t,kwe(e)),Dwe=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())});function Om(t){return Math.pow(t,2.2)}var Uwe=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(t){var e;this.parser=t,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const n=this.parser.json;n.extensionsUsed=(e=n.extensionsUsed)!=null?e:[],n.extensionsUsed.indexOf("KHR_texture_transform")===-1&&n.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return Dwe(this,null,function*(){var t;const e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,r=n==null?void 0:n.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(t,e){var n,r,i,s,o,a,l,c,d,f,m,y,x,S,w,b,E,T,C,O,N,D,F,V,k,j,H,ne,J,de,oe,he,B,K,q,$,Z,ge,ae,ce,we,Me,$e,Se,Ve,Xe,fe,Q,Ge,Ue,We,Qe,xt,at,te;const W=(r=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?r:!1,Be=((i=t.floatProperties)==null?void 0:i._ZWrite)===1&&W,le=this._v0ParseRenderQueue(t),Ce=(o=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,lt=W?"BLEND":Ce?"MASK":"OPAQUE",rt=Ce?(l=(a=t.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,nn=((d=(c=t.floatProperties)==null?void 0:c._CullMode)!=null?d:2)===0,qe=this._portTextureTransform(t),dt=((m=(f=t.vectorProperties)==null?void 0:f._Color)!=null?m:[1,1,1,1]).map((et,yt)=>yt===3?et:Om(et)),Dt=(y=t.textureProperties)==null?void 0:y._MainTex,Ut=Dt!=null?{index:Dt,extensions:ml({},qe)}:void 0,pt=(S=(x=t.floatProperties)==null?void 0:x._BumpScale)!=null?S:1,ue=(w=t.textureProperties)==null?void 0:w._BumpMap,ee=ue!=null?{index:ue,scale:pt,extensions:ml({},qe)}:void 0,Ae=((E=(b=t.vectorProperties)==null?void 0:b._EmissionColor)!=null?E:[0,0,0,1]).map(Om),re=(T=t.textureProperties)==null?void 0:T._EmissionMap,Fe=re!=null?{index:re,extensions:ml({},qe)}:void 0,Te=((O=(C=t.vectorProperties)==null?void 0:C._ShadeColor)!=null?O:[.97,.81,.86,1]).map(Om),Le=(N=t.textureProperties)==null?void 0:N._ShadeTexture,Ke=Le!=null?{index:Le,extensions:ml({},qe)}:void 0;let ut=(F=(D=t.floatProperties)==null?void 0:D._ShadeShift)!=null?F:0,Kt=(k=(V=t.floatProperties)==null?void 0:V._ShadeToony)!=null?k:.9;Kt=gr.lerp(Kt,1,.5+.5*ut),ut=-ut-(1-Kt);const un=(H=(j=t.floatProperties)==null?void 0:j._IndirectLightIntensity)!=null?H:.1,Cn=un?1-un:void 0,Jt=(ne=t.textureProperties)==null?void 0:ne._SphereAdd,Hn=Jt!=null?[1,1,1]:void 0,hr=Jt!=null?{index:Jt}:void 0,Si=(de=(J=t.floatProperties)==null?void 0:J._RimLightingMix)!=null?de:0,ra=(oe=t.textureProperties)==null?void 0:oe._RimTexture,Mi=ra!=null?{index:ra,extensions:ml({},qe)}:void 0,qa=((B=(he=t.vectorProperties)==null?void 0:he._RimColor)!=null?B:[0,0,0,1]).map(Om),Ns=(q=(K=t.floatProperties)==null?void 0:K._RimFresnelPower)!=null?q:1,ia=(Z=($=t.floatProperties)==null?void 0:$._RimLift)!=null?Z:0,Ei=["none","worldCoordinates","screenCoordinates"][(ae=(ge=t.floatProperties)==null?void 0:ge._OutlineWidthMode)!=null?ae:0];let To=(we=(ce=t.floatProperties)==null?void 0:ce._OutlineWidth)!=null?we:0;To=.01*To;const sa=(Me=t.textureProperties)==null?void 0:Me._OutlineWidthTexture,cu=sa!=null?{index:sa,extensions:ml({},qe)}:void 0,uu=((Se=($e=t.vectorProperties)==null?void 0:$e._OutlineColor)!=null?Se:[0,0,0]).map(Om),du=((Xe=(Ve=t.floatProperties)==null?void 0:Ve._OutlineColorMode)!=null?Xe:0)===1?(Q=(fe=t.floatProperties)==null?void 0:fe._OutlineLightingMix)!=null?Q:1:0,Hl=(Ge=t.textureProperties)==null?void 0:Ge._UvAnimMaskTexture,Y=Hl!=null?{index:Hl,extensions:ml({},qe)}:void 0,xe=(We=(Ue=t.floatProperties)==null?void 0:Ue._UvAnimScrollX)!=null?We:0;let Re=(xt=(Qe=t.floatProperties)==null?void 0:Qe._UvAnimScrollY)!=null?xt:0;Re!=null&&(Re=-Re);const ke=(te=(at=t.floatProperties)==null?void 0:at._UvAnimRotation)!=null?te:0,_e={specVersion:"1.0",transparentWithZWrite:Be,renderQueueOffsetNumber:le,shadeColorFactor:Te,shadeMultiplyTexture:Ke,shadingShiftFactor:ut,shadingToonyFactor:Kt,giEqualizationFactor:Cn,matcapFactor:Hn,matcapTexture:hr,rimLightingMixFactor:Si,rimMultiplyTexture:Mi,parametricRimColorFactor:qa,parametricRimFresnelPowerFactor:Ns,parametricRimLiftFactor:ia,outlineWidthMode:Ei,outlineWidthFactor:To,outlineWidthMultiplyTexture:cu,outlineColorFactor:uu,outlineLightingMixFactor:du,uvAnimationMaskTexture:Y,uvAnimationScrollXSpeedFactor:xe,uvAnimationScrollYSpeedFactor:Re,uvAnimationRotationSpeedFactor:ke};return _j(ml({},e),{pbrMetallicRoughness:{baseColorFactor:dt,baseColorTexture:Ut},normalTexture:ee,emissiveTexture:Fe,emissiveFactor:Ae,alphaMode:lt,alphaCutoff:rt,doubleSided:nn,extensions:{VRMC_materials_mtoon:_e}})}_parseV0UnlitProperties(t,e){var n,r,i,s,o;const a=t.shader==="VRM/UnlitTransparentZWrite",l=t.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",f=l?"BLEND":d?"MASK":"OPAQUE",m=d?(r=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?r:.5:void 0,y=this._portTextureTransform(t),x=((s=(i=t.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Om),S=(o=t.textureProperties)==null?void 0:o._MainTex,w=S!=null?{index:S,extensions:ml({},y)}:void 0,b={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:x,shadeMultiplyTexture:w};return _j(ml({},e),{pbrMetallicRoughness:{baseColorFactor:x,baseColorTexture:w},alphaMode:f,alphaCutoff:m,extensions:{VRMC_materials_mtoon:b}})}_portTextureTransform(t){var e,n,r,i,s;const o=(e=t.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(n=o==null?void 0:o[0])!=null?n:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(t){var e,n;const r=t.shader==="VRM/UnlitTransparentZWrite",i=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||r,s=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||r;let o=0;if(i){const a=t.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(t){const e=new Set,n=new Set;t.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?n.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(n).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},wj=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),id=new X,sT=class extends Ts{constructor(t){super(),this._attrPosition=new Qt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(t6);const e=new Zt;e.setAttribute("position",this._attrPosition);const n=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new jl(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){id.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,id.x,id.y,id.z),this.constraint.source&&id.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,id.x,id.y,id.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function Sj(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var jwe=new X,Fwe=new X;function zwe(t,e){return t.decompose(jwe,e,Fwe),e}function j1(t){return t.invert?t.invert():t.inverse(),t}var iN=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Bwe=new X,Hwe=new X,Vwe=new X,Gwe=new qt,Wwe=new qt,$we=new qt,Xwe=class extends iN{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){const t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new X(1,0,0),this._dstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const t=Gwe.identity(),e=Wwe.identity();this.destination.parent&&(zwe(this.destination.parent.matrixWorld,t),j1(e.copy(t)));const n=Bwe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),r=Sj(this.source.matrixWorld,Hwe).sub(Sj(this.destination.matrixWorld,Vwe)).normalize(),i=$we.setFromUnitVectors(n,r).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function qwe(t,e){const n=[t];let r=t.parent;for(;r!==null;)n.unshift(r),r=r.parent;n.forEach(i=>{e(i)})}var Kwe=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(t){this._constraints.add(t);let e=this._objectConstraintsMap.get(t.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(t.destination,e)),e.add(t)}deleteConstraint(t){this._constraints.delete(t),this._objectConstraintsMap.get(t.destination).delete(t)}setInitState(){const t=new Set,e=new Set;for(const n of this._constraints)this._processConstraint(n,t,e,r=>r.setInitState())}update(){const t=new Set,e=new Set;for(const n of this._constraints)this._processConstraint(n,t,e,r=>r.update())}_processConstraint(t,e,n,r){if(n.has(t))return;if(e.has(t))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(t);const i=t.dependencies;for(const s of i)qwe(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,n,r)});r(t),n.add(t)}},Ywe=new qt,Zwe=new qt,Qwe=class extends iN{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new qt,this._invSrcRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),j1(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const t=Ywe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Zwe.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Jwe=new X,e1e=new qt,t1e=new qt,n1e=class extends iN{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new X(1,0,0),this._dstRestQuat=new qt,this._invDstRestQuat=new qt,this._invSrcRestQuatMulDstRestQuat=new qt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),j1(this._invDstRestQuat.copy(this._dstRestQuat)),j1(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const t=e1e.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Jwe.copy(this._v3RollAxis).applyQuaternion(t),r=t1e.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},r1e=new Set(["1.0","1.0-beta"]),HG=class By{get name(){return By.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return wj(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return wj(this,null,function*(){var n;const r=this.parser.json;if(!(((n=r.extensionsUsed)==null?void 0:n.indexOf(By.EXTENSION_NAME))!==-1))return null;const s=new Kwe,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const d=r.nodes[l],f=(c=d==null?void 0:d.extensions)==null?void 0:c[By.EXTENSION_NAME];if(f==null)return;const m=f.specVersion;if(!r1e.has(m)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${By.EXTENSION_NAME} specVersion "${m}"`);return}const y=f.constraint;if(y.roll!=null){const x=this._importRollConstraint(a,o,y.roll);s.addConstraint(x)}else if(y.aim!=null){const x=this._importAimConstraint(a,o,y.aim);s.addConstraint(x)}else if(y.rotation!=null){const x=this._importRotationConstraint(a,o,y.rotation);s.addConstraint(x)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,r){const{source:i,rollAxis:s,weight:o}=r,a=n[i],l=new n1e(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new sT(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,n,r){const{source:i,aimAxis:s,weight:o}=r,a=n[i],l=new Xwe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new sT(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,n,r){const{source:i,weight:s}=r,o=n[i],a=new Qwe(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new sT(a);this.helperRoot.add(l)}return a}};HG.EXTENSION_NAME="VRMC_node_constraint";var i1e=HG,L_=(t,e,n)=>new Promise((r,i)=>{var s=l=>{try{a(n.next(l))}catch(c){i(c)}},o=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((n=n.apply(t,e)).next())}),sN=class{},oT=new X,Hf=new X,VG=class extends sN{get type(){return"capsule"}constructor(t){var e,n,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new X(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,r){oT.setFromMatrixPosition(t),Hf.subVectors(this.tail,this.offset).applyMatrix4(t),Hf.sub(oT);const i=Hf.lengthSq();r.copy(e).sub(oT);const s=Hf.dot(r);s<=0||(i<=s||Hf.multiplyScalar(s/i),r.sub(Hf));const o=r.length(),a=this.inside?this.radius-n-o:o-n-this.radius;return a<0&&(r.multiplyScalar(1/o),this.inside&&r.negate()),a}},aT=new X,Mj=new Xt,GG=class extends sN{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new X(0,0,1)}calculateCollision(t,e,n,r){r.setFromMatrixPosition(t),r.negate().add(e),Mj.getNormalMatrix(t),aT.copy(this.normal).applyNormalMatrix(Mj).normalize();const i=r.dot(aT)-n;return r.copy(aT),i}},s1e=new X,WG=class extends sN{get type(){return"sphere"}constructor(t){var e,n,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new X(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,r){r.subVectors(e,s1e.setFromMatrixPosition(t));const i=r.length(),s=this.inside?this.radius-n-i:i-n-this.radius;return s<0&&(r.multiplyScalar(1/i),this.inside&&r.negate()),s}},gl=new X,o1e=class extends Zt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._currentTail=new X,this._shape=t,this._attrPos=new Qt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);const n=gl.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){gl.copy(this._currentTail).sub(this._currentOffset);const t=gl.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,t+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(gl.y,Math.sqrt(gl.x*gl.x+gl.z*gl.z)),n=-Math.atan2(gl.z,gl.x);this.rotateZ(e),this.rotateY(n),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(68+t*2,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+t*2,68+t,68+e),this._attrIndex.setXY(200+t*2,100+t,100+e)}this._attrIndex.needsUpdate=!0}},a1e=class extends Zt{constructor(t){super(),this.worldScale=1,this._currentOffset=new X,this._currentNormal=new X,this._shape=t,this._attrPos=new Qt(new Float32Array(18),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},l1e=class extends Zt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new X,this._shape=t,this._attrPos=new Qt(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.needsUpdate=!0}},c1e=new X,lT=class extends Ts{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof WG)this._geometry=new l1e(this.collider.shape);else if(this.collider.shape instanceof VG)this._geometry=new o1e(this.collider.shape);else if(this.collider.shape instanceof GG)this._geometry=new a1e(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new $r({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Js(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=c1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},u1e=class extends Zt{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new X,this._springBone=t,this._attrPos=new Qt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Qt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},d1e=new X,f1e=class extends Ts{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new u1e(this.springBone);const e=new $r({color:16776960,depthTest:!1,depthWrite:!1});this._line=new Js(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=d1e.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},cT=class extends mn{constructor(t){super(),this.colliderMatrix=new Ct,this.shape=t}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),h1e(this.colliderMatrix,this.matrixWorld,this.shape.offset)}};function h1e(t,e,n){const r=e.elements;t.copy(e),n&&(t.elements[12]=r[0]*n.x+r[4]*n.y+r[8]*n.z+r[12],t.elements[13]=r[1]*n.x+r[5]*n.y+r[9]*n.z+r[13],t.elements[14]=r[2]*n.x+r[6]*n.y+r[10]*n.z+r[14])}var p1e=new Ct;function m1e(t){return t.invert?t.invert():t.getInverse(p1e.copy(t)),t}var g1e=class{constructor(t){this._inverseCache=new Ct,this._shouldUpdateInverse=!0,this.matrix=t;const e={set:(n,r,i)=>(this._shouldUpdateInverse=!0,n[r]=i,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(m1e(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},uT=new Ct,Lm=new X,Iy=new X,ky=new X,Oy=new X,v1e=new Ct,y1e=class{constructor(t,e,n={},r=[]){this._currentTail=new X,this._prevTail=new X,this._boneAxis=new X,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new Ct,this._initialLocalRotation=new qt,this._initialLocalChildPosition=new X;var i,s,o,a,l,c;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=n.hitRadius)!=null?i:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(o=n.gravityPower)!=null?o:0,gravityDir:(l=(a=n.gravityDir)==null?void 0:a.clone())!=null?l:new X(0,-1,0),dragForce:(c=n.dragForce)!=null?c:.4},this.colliderGroups=r}get dependencies(){const t=new Set,e=this.bone.parent;e&&t.add(e);for(let n=0;n{e(i)})}function fP(t,e){t.children.forEach(n=>{e(n)||fP(n,e)})}function b1e(t){var e;const n=new Map;for(const r of t){let i=r;do{const s=((e=n.get(i))!=null?e:0)+1;if(s===t.size)return i;n.set(i,s),i=i.parent}while(i!==null)}return null}var Ej=class{constructor(){this._joints=new Set,this._sortedJoints=[],this._hasWarnedCircularDependency=!1,this._ancestors=[],this._objectSpringBonesMap=new Map,this._isSortedJointsDirty=!1,this._relevantChildrenUpdated=this._relevantChildrenUpdated.bind(this)}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t),this._isSortedJointsDirty=!0}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t),this._isSortedJointsDirty=!0}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){this._sortJoints();for(let t=0;t{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(this._ancestors.push(s),!1)})),this._isSortedJointsDirty=!1}_insertJointSort(t,e,n,r,i){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected"),this._hasWarnedCircularDependency=!0);return}e.add(t);const s=t.dependencies;for(const o of s){let a=!1,l=null;x1e(o,c=>{const d=this._objectSpringBonesMap.get(c);if(d)for(const f of d)a=!0,this._insertJointSort(f,e,n,r,i);else a||(l=c)}),l&&i.add(l)}r.push(t),n.add(t)}_relevantChildrenUpdated(t){var e,n;return((n=(e=this._objectSpringBonesMap.get(t))==null?void 0:e.size)!=null?n:0)>0?!0:(t.updateWorldMatrix(!1,!1),!1)}},Aj="VRMC_springBone_extended_collider",_1e=new Set(["1.0","1.0-beta"]),w1e=new Set(["1.0"]),$G=class Hm{get name(){return Hm.EXTENSION_NAME}constructor(e,n){var r;this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot,this.useExtendedColliders=(r=n==null?void 0:n.useExtendedColliders)!=null?r:!0}afterRoot(e){return L_(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return L_(this,null,function*(){const n=yield this._v1Import(e);if(n!=null)return n;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return L_(this,null,function*(){var n,r,i,s,o;const a=e.parser.json;if(!(((n=a.extensionsUsed)==null?void 0:n.indexOf(Hm.EXTENSION_NAME))!==-1))return null;const c=new Ej,d=yield e.parser.getDependencies("node"),f=(r=a.extensions)==null?void 0:r[Hm.EXTENSION_NAME];if(!f)return null;const m=f.specVersion;if(!_1e.has(m))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Hm.EXTENSION_NAME} specVersion "${m}"`),null;const y=(i=f.colliders)==null?void 0:i.map((S,w)=>{var b,E,T,C,O,N,D,F,V,k,j,H,ne,J,de;const oe=d[S.node];if(oe==null)return console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} attempted to reference a node #${S.node} but not found. Skipping the collider`),null;const he=S.shape,B=(b=S.extensions)==null?void 0:b[Aj];if(this.useExtendedColliders&&B!=null){const K=B.specVersion;if(!w1e.has(K))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Aj} specVersion "${K}". Fallbacking to the ${Hm.EXTENSION_NAME} definition`);else{const q=B.shape;if(q.sphere)return this._importSphereCollider(oe,{offset:new X().fromArray((E=q.sphere.offset)!=null?E:[0,0,0]),radius:(T=q.sphere.radius)!=null?T:0,inside:(C=q.sphere.inside)!=null?C:!1});if(q.capsule)return this._importCapsuleCollider(oe,{offset:new X().fromArray((O=q.capsule.offset)!=null?O:[0,0,0]),radius:(N=q.capsule.radius)!=null?N:0,tail:new X().fromArray((D=q.capsule.tail)!=null?D:[0,0,0]),inside:(F=q.capsule.inside)!=null?F:!1});if(q.plane)return this._importPlaneCollider(oe,{offset:new X().fromArray((V=q.plane.offset)!=null?V:[0,0,0]),normal:new X().fromArray((k=q.plane.normal)!=null?k:[0,0,1])})}}if(he.sphere)return this._importSphereCollider(oe,{offset:new X().fromArray((j=he.sphere.offset)!=null?j:[0,0,0]),radius:(H=he.sphere.radius)!=null?H:0,inside:!1});if(he.capsule)return this._importCapsuleCollider(oe,{offset:new X().fromArray((ne=he.capsule.offset)!=null?ne:[0,0,0]),radius:(J=he.capsule.radius)!=null?J:0,tail:new X().fromArray((de=he.capsule.tail)!=null?de:[0,0,0]),inside:!1});console.warn(`VRMSpringBoneLoaderPlugin: The collider #${w} has no valid shape. Skipping the collider`)}),x=(s=f.colliderGroups)==null?void 0:s.map((S,w)=>{var b;return{colliders:((b=S.colliders)!=null?b:[]).map(T=>{const C=y==null?void 0:y[T];return C??(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${w} attempted to reference a collider #${T} but not found. Skipping the collider`),null)}).filter(T=>T!=null),name:S.name}});return(o=f.springs)==null||o.forEach((S,w)=>{var b;const E=S.joints,T=(b=S.colliderGroups)==null?void 0:b.map(N=>{const D=x==null?void 0:x[N];return D??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${w} attempted to reference a collider group #${N} but not found. Skipping the collider group`),null)}).filter(N=>N!=null),C=S.center!=null?d[S.center]:void 0;let O;E.forEach(N=>{if(O){const D=O.node,F=d[D],V=N.node,k=d[V],j={hitRadius:O.hitRadius,dragForce:O.dragForce,gravityPower:O.gravityPower,stiffness:O.stiffness,gravityDir:O.gravityDir!=null?new X().fromArray(O.gravityDir):void 0},H=this._importJoint(F,k,j,T);C&&(H.center=C),c.addJoint(H)}O=N})}),c.setInitState(),c})}_v0Import(e){return L_(this,null,function*(){var n,r,i;const s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const d=new Ej,f=yield e.parser.getDependencies("node"),m=(i=l.colliderGroups)==null?void 0:i.map((y,x)=>{var S;const w=f[y.node];return w==null?(console.warn(`VRMSpringBoneLoaderPlugin: The collider group #${x} attempted to reference a node #${y.node} but not found. Skipping the collider group`),null):{colliders:((S=y.colliders)!=null?S:[]).map((E,T)=>{var C,O,N;const D=new X(0,0,0);return E.offset&&D.set((C=E.offset.x)!=null?C:0,(O=E.offset.y)!=null?O:0,E.offset.z?-E.offset.z:0),this._importSphereCollider(w,{offset:D,radius:(N=E.radius)!=null?N:0,inside:!1})})}});return c==null||c.forEach((y,x)=>{const S=y.bones;S&&S.forEach(w=>{var b,E,T,C;const O=f[w];if(O==null){console.warn(`VRMSpringBoneLoaderPlugin: The spring bone group #${x} attempted to reference a node #${w} but not found. Skipping the node`);return}const N=new X;y.gravityDir?N.set((b=y.gravityDir.x)!=null?b:0,(E=y.gravityDir.y)!=null?E:0,(T=y.gravityDir.z)!=null?T:0):N.set(0,-1,0);const D=y.center!=null?f[y.center]:void 0,F={hitRadius:y.hitRadius,dragForce:y.dragForce,gravityPower:y.gravityPower,stiffness:y.stiffiness,gravityDir:N},V=(C=y.colliderGroups)==null?void 0:C.map(k=>{const j=m==null?void 0:m[k];return j??(console.warn(`VRMSpringBoneLoaderPlugin: The spring #${x} attempted to reference a collider group #${k} but not found. Skipping the collider group`),null)}).filter(k=>k!=null);O.traverse(k=>{var j;const H=(j=k.children[0])!=null?j:null,ne=this._importJoint(k,H,F,V);D&&(ne.center=D),d.addJoint(ne)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,r,i){const s=new y1e(e,n,r,i);if(this.jointHelperRoot){const o=new f1e(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){const r=new WG(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,n){const r=new VG(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,n){const r=new GG(n),i=new cT(r);if(e.add(i),this.colliderHelperRoot){const s=new lT(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};$G.EXTENSION_NAME="VRMC_springBone";var S1e=$G,M1e=class{get name(){return"VRMLoaderPlugin"}constructor(t,e){var n,r,i,s,o,a,l,c,d,f;this.parser=t;const m=e==null?void 0:e.helperRoot,y=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(n=e==null?void 0:e.expressionPlugin)!=null?n:new z_e(t),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new H_e(t),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new K_e(t,{helperRoot:m,autoUpdateHumanBones:y}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new uwe(t,{helperRoot:m}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new hwe(t),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new Cwe(t),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new Rwe(t),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Uwe(t),this.springBonePlugin=(d=e==null?void 0:e.springBonePlugin)!=null?d:new S1e(t,{colliderHelperRoot:m,jointHelperRoot:m}),this.nodeConstraintPlugin=(f=e==null?void 0:e.nodeConstraintPlugin)!=null?f:new i1e(t,{helperRoot:m})}beforeRoot(){return I_(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(t){return I_(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(t)})}getMaterialType(t){const e=this.mtoonMaterialPlugin.getMaterialType(t);return e??null}extendMaterialParams(t,e){return I_(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(t,e),yield this.mtoonMaterialPlugin.extendMaterialParams(t,e)})}afterRoot(t){return I_(this,null,function*(){yield this.metaPlugin.afterRoot(t),yield this.humanoidPlugin.afterRoot(t),yield this.expressionPlugin.afterRoot(t),yield this.lookAtPlugin.afterRoot(t),yield this.firstPersonPlugin.afterRoot(t),yield this.springBonePlugin.afterRoot(t),yield this.nodeConstraintPlugin.afterRoot(t),yield this.mtoonMaterialPlugin.afterRoot(t);const e=t.userData.vrmMeta,n=t.userData.vrmHumanoid;if(e&&n){const r=new mwe({scene:t.scene,expressionManager:t.userData.vrmExpressionManager,firstPerson:t.userData.vrmFirstPerson,humanoid:n,lookAt:t.userData.vrmLookAt,meta:e,materials:t.userData.vrmMToonMaterials,springBoneManager:t.userData.vrmSpringBoneManager,nodeConstraintManager:t.userData.vrmNodeConstraintManager});t.userData.vrm=r}})}};function E1e(t){const e=new Set;return t.traverse(n=>{if(!n.isMesh)return;const r=n;e.add(r)}),e}function Tj(t,e,n){if(e.size===1){const o=e.values().next().value;if(o.weight===1)return t[o.index]}const r=new Float32Array(t[0].count*3);let i=0;if(n)i=1;else for(const o of e)i+=o.weight;for(const o of e){const a=t[o.index],l=o.weight/i;for(let c=0;cd.getOrCreate(V)).join(","),D=`${C};${b};${N}`;let F=a.get(D);F==null&&(F=T.clone(),I1e(F,O,x),a.set(D,F)),E.geometry.setAttribute("skinIndex",F)}for(const E of y)E.bind(w,new Ct)}}function C1e(t){const e=new Set;return t.traverse(n=>{if(!n.isSkinnedMesh)return;const r=n;e.add(r)}),e}function P1e(t,e){const n=new Set;for(let r=0;rn)return!1;return!0}var dT=class{constructor(){this._objectIndexMap=new Map,this._index=0}get(t){return this._objectIndexMap.get(t)}getOrCreate(t){let e=this._objectIndexMap.get(t);return e==null&&(e=this._index,this._objectIndexMap.set(t,e),this._index++),e}};function O1e(t){var e,n,r,i;const s=new Zt;s.name=t.name,s.setIndex(t.index);for(const[o,a]of Object.entries(t.attributes))s.setAttribute(o,a);for(const[o,a]of Object.entries(t.morphAttributes)){const l=o;s.morphAttributes[l]=a.concat()}s.morphTargetsRelative=t.morphTargetsRelative,s.groups=[];for(const o of t.groups)s.addGroup(o.start,o.count,o.materialIndex);return s.boundingSphere=(n=(e=t.boundingSphere)==null?void 0:e.clone())!=null?n:null,s.boundingBox=(i=(r=t.boundingBox)==null?void 0:r.clone())!=null?i:null,s.drawRange.start=t.drawRange.start,s.drawRange.count=t.drawRange.count,s.userData=t.userData,s}function Cj(t){if(Object.values(t).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),t.isShaderMaterial){const e=t.uniforms;e&&Object.values(e).forEach(n=>{const r=n.value;r!=null&&r.isTexture&&r.dispose()})}t.dispose()}function L1e(t){const e=t.geometry;e&&e.dispose();const n=t.skeleton;n&&n.dispose();const r=t.material;r&&(Array.isArray(r)?r.forEach(i=>Cj(i)):r&&Cj(r))}function D1e(t){t.traverse(L1e)}function U1e(t,e){var n,r;console.warn("VRMUtils.removeUnnecessaryJoints: removeUnnecessaryJoints is deprecated. Use combineSkeletons instead. combineSkeletons contributes more to the performance improvement. This function will be removed in the next major version.");const i=(n=e==null?void 0:e.experimentalSameBoneCounts)!=null?n:!1,s=[];t.traverse(l=>{l.type==="SkinnedMesh"&&s.push(l)});const o=new Map;let a=0;for(const l of s){const d=l.geometry.getAttribute("skinIndex");if(o.has(d))continue;const f=new Map,m=new Map;for(let y=0;y{e.addGroup(o.start,o.count,o.materialIndex)}),e.boundingBox=(r=(n=t.boundingBox)==null?void 0:n.clone())!=null?r:null,e.boundingSphere=(s=(i=t.boundingSphere)==null?void 0:i.clone())!=null?s:null,e.setDrawRange(t.drawRange.start,t.drawRange.count),e.userData=t.userData}function B1e(t,e,n){const r=e.array,i=new r.constructor(r.length);for(let s=0;s{if(!n.isMesh)return;const r=n,i=r.geometry,s=i.index;if(s==null)return;const o=e.get(i);if(o!=null){r.geometry=o;return}const{isVertexUsed:a,vertexCount:l,verticesUsed:c}=j1e(i.attributes,s);if(c===l)return;const{originalIndexNewIndexMap:d,newIndexOriginalIndexMap:f}=F1e(a),m=new Zt;z1e(i,m),e.set(i,m),B1e(m,s,d),V1e(m,i.attributes,f),W1e(m,i.morphAttributes,f),r.geometry=m}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function X1e(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Xc=class{constructor(){}};Xc.combineMorphs=A1e;Xc.combineSkeletons=T1e;Xc.deepDispose=D1e;Xc.removeUnnecessaryJoints=U1e;Xc.removeUnnecessaryVertices=$1e;Xc.rotateVRM0=X1e;/*! + * @pixiv/three-vrm-core v3.5.4 + * The implementation of core features of VRM, for @pixiv/three-vrm + * + * Copyright (c) 2019-2026 pixiv Inc. + * @pixiv/three-vrm-core is distributed under MIT License + * https://github.com/pixiv/three-vrm/blob/release/LICENSE + *//*! + * @pixiv/three-vrm-materials-mtoon v3.5.4 + * MToon (toon material) module for @pixiv/three-vrm + * + * Copyright (c) 2019-2026 pixiv Inc. + * @pixiv/three-vrm-materials-mtoon is distributed under MIT License + * https://github.com/pixiv/three-vrm/blob/release/LICENSE + *//*! + * @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.5.4 + * Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm + * + * Copyright (c) 2019-2026 pixiv Inc. + * @pixiv/three-vrm-materials-hdr-emissive-multiplier is distributed under MIT License + * https://github.com/pixiv/three-vrm/blob/release/LICENSE + *//*! + * @pixiv/three-vrm-materials-v0compat v3.5.4 + * VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm + * + * Copyright (c) 2019-2026 pixiv Inc. + * @pixiv/three-vrm-materials-v0compat is distributed under MIT License + * https://github.com/pixiv/three-vrm/blob/release/LICENSE + *//*! + * @pixiv/three-vrm-node-constraint v3.5.4 + * Node constraint module for @pixiv/three-vrm + * + * Copyright (c) 2019-2026 pixiv Inc. + * @pixiv/three-vrm-node-constraint is distributed under MIT License + * https://github.com/pixiv/three-vrm/blob/release/LICENSE + *//*! + * @pixiv/three-vrm-springbone v3.5.4 + * Spring bone module for @pixiv/three-vrm + * + * Copyright (c) 2019-2026 pixiv Inc. + * @pixiv/three-vrm-springbone is distributed under MIT License + * https://github.com/pixiv/three-vrm/blob/release/LICENSE + */const q1e={leftUpperArm:[0,0,1.2],rightUpperArm:[0,0,-1.2],leftLowerArm:[0,-.2,0],rightLowerArm:[0,.2,0]};function vl(t,e,n,r,i){var o;const s=(o=t.humanoid)==null?void 0:o.getNormalizedBoneNode(e);s&&s.rotation.set(n,r,i)}function K1e(t){var e;for(const[n,r]of Object.entries(q1e))vl(t,n,r[0],r[1],r[2]);(e=t.humanoid)==null||e.update()}function Y1e(t,e,n){const r=Math.sin(e*1.7),i=Math.sin(e*.5),s=Math.min(1,n*1.4);vl(t,"spine",r*.025,i*.03,Math.sin(e*.43)*.015),vl(t,"chest",r*.02,i*.02,0),vl(t,"hips",0,Math.sin(e*.37)*.02,Math.sin(e*.29)*.01),vl(t,"neck",Math.sin(e*.8)*.03+s*.06,Math.sin(e*.31)*.05,0),vl(t,"head",Math.sin(e*.6)*.025+s*.05,Math.sin(e*.27)*.06,Math.sin(e*.5)*.02);const o=Math.sin(e*.8)*.04;vl(t,"leftUpperArm",0,0,1.2+o),vl(t,"rightUpperArm",0,0,-1.2-o),vl(t,"leftLowerArm",0,-.2-Math.sin(e*.8)*.03,0),vl(t,"rightLowerArm",0,.2+Math.sin(e*.8)*.03,0)}const Z1e=["happy","angry","sad","surprised","relaxed"],Q1e={neutral:null,happy:"happy",angry:"angry",sad:"sad",surprised:"surprised",relaxed:"relaxed"};function J1e({url:t,audioLevel:e,emotion:n,onError:r}){const[i,s]=R.useState(null),o=R.useRef({}),a=R.useRef({t:0,next:3,active:0});return R.useEffect(()=>{let l=!1,c=null;const d=new n_e;return d.register(f=>new M1e(f)),d.load(t,f=>{var y;if(l)return;const m=f.userData.vrm;if(!m){r("Datei enthält kein gültiges VRM-Modell.");return}Xc.removeUnnecessaryVertices(f.scene),((y=m.meta)==null?void 0:y.metaVersion)==="0"&&Xc.rotateVRM0(m),m.scene.rotation.y=Math.PI,K1e(m),c=m,s(m)},void 0,f=>{console.error("VRM-Load-Fehler:",f),r("Avatar konnte nicht geladen werden (CORS/URL?).")}),()=>{l=!0,c&&Xc.deepDispose(c.scene),s(null)}},[t,r]),yG((l,c)=>{var m;if(!i)return;const d=((m=e.current)==null?void 0:m.current)??0;Y1e(i,l.clock.elapsedTime,d);const f=i.expressionManager;if(f){const y=(o.current.aa??0)*.4+d*.6;o.current.aa=y,f.setValue("aa",y);const x=Q1e[n.current];for(const b of Z1e){const E=x===b?.75:0,T=o.current[b]??0,C=T+(E-T)*Math.min(1,c*4);o.current[b]=C,f.setValue(b,C)}const S=a.current;S.t+=c,S.active<=0&&S.t>S.next&&(S.active=.16,S.t=0,S.next=3+Math.random()*4);let w=0;if(S.active>0){S.active-=c;const b=1-S.active/.16;w=1-Math.abs(b-.5)*2}f.setValue("blink",Math.max(0,w))}i.update(c)}),i?v.jsx("primitive",{object:i.scene}):null}function eSe({url:t,audioLevel:e,emotion:n}){const[r,i]=R.useState(null);return v.jsxs("div",{className:"relative h-full w-full",children:[v.jsxs($be,{camera:{position:[0,1.35,1.25],fov:30},gl:{alpha:!0,antialias:!0},style:{background:"transparent"},children:[v.jsx("ambientLight",{intensity:.85}),v.jsx("directionalLight",{position:[1,2,2],intensity:1.1}),v.jsx("directionalLight",{position:[-1,1,-1],intensity:.4}),v.jsx(J1e,{url:t,audioLevel:e,emotion:n,onError:i},t),v.jsx(t_e,{target:[0,1.3,0],enablePan:!1,minDistance:.7,maxDistance:3,minPolarAngle:Math.PI/3,maxPolarAngle:Math.PI/1.8})]}),r&&v.jsx("div",{className:"absolute inset-x-0 bottom-3 mx-auto w-fit rounded-md bg-red-500/15 border border-red-500/30 px-3 py-1.5 text-xs text-red-300",children:r})]})}const tSe="mc2-voice",U0="avatar",qG="uploaded-vrm";function KG(){return new Promise((t,e)=>{const n=indexedDB.open(tSe,1);n.onupgradeneeded=()=>n.result.createObjectStore(U0),n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error)})}async function nSe(t){const e=await KG();await new Promise((n,r)=>{const i=e.transaction(U0,"readwrite");i.objectStore(U0).put(t,qG),i.oncomplete=()=>n(),i.onerror=()=>r(i.error)})}async function rSe(){const t=await KG();return new Promise((e,n)=>{const i=t.transaction(U0,"readonly").objectStore(U0).get(qG);i.onsuccess=()=>e(i.result??null),i.onerror=()=>n(i.error)})}const YG=[{id:"sample-a",label:"VRoid Sample A",url:"https://raw.githubusercontent.com/madjin/vrm-samples/master/vroid/stable/AvatarSample_A.vrm",note:"Anime, weiblich"},{id:"sample-b",label:"VRoid Sample B",url:"https://raw.githubusercontent.com/madjin/vrm-samples/master/vroid/stable/AvatarSample_B.vrm",note:"Anime, männlich"},{id:"pixiv",label:"Pixiv Demo",url:"https://raw.githubusercontent.com/pixiv/three-vrm/dev/packages/three-vrm/examples/models/VRM1_Constraint_Twist_Sample.vrm",note:"VRM1-Testmodell"}],iSe=YG[0].url;function sSe({avatarUrl:t,onAvatarChange:e}){const[n,r]=R.useState(""),[i,s]=R.useState([]),[o,a]=R.useState(localStorage.getItem("mc_voice_engine")||"piper"),[l,c]=R.useState(localStorage.getItem("mc_voice_voice")||""),d=R.useRef(null);R.useEffect(()=>{localStorage.getItem("mc_voice_avatar_uploaded")==="1"&&rSe().then(b=>{b&&e(URL.createObjectURL(new Blob([b],{type:"model/gltf-binary"})))})},[e]),R.useEffect(()=>{fetch("/api/voice/voices").then(b=>b.ok?b.json():Promise.reject()).then(b=>s(b.voices||[])).catch(()=>s([]))},[]);const f=b=>{localStorage.setItem("mc_voice_avatar_url",b),localStorage.removeItem("mc_voice_avatar_uploaded"),e(b)},m=async b=>{const E=await b.arrayBuffer();await nSe(E),localStorage.setItem("mc_voice_avatar_uploaded","1"),localStorage.removeItem("mc_voice_avatar_url"),e(URL.createObjectURL(new Blob([E],{type:"model/gltf-binary"})))},y=()=>{const b=n.trim();b&&f(b)},x=(b,E)=>{a(b),c(E),localStorage.setItem("mc_voice_engine",b),localStorage.setItem("mc_voice_voice",E)},S=Array.from(new Set(i.map(b=>b.engine))),w=i.filter(b=>b.engine===o);return v.jsxs("div",{className:"space-y-5 text-sm",children:[v.jsxs("div",{children:[v.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Avatar"}),v.jsx("div",{className:"space-y-1.5",children:YG.map(b=>{const E=t===b.url;return v.jsxs("button",{onClick:()=>f(b.url),className:`flex w-full items-center justify-between rounded-md border px-3 py-2 text-left transition-colors ${E?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:[v.jsxs("span",{children:[v.jsx("span",{className:"font-medium",children:b.label}),b.note&&v.jsx("span",{className:"ml-2 text-[11px] text-muted-foreground",children:b.note})]}),E&&v.jsx(bo,{className:"h-4 w-4"})]},b.id)})})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("input",{ref:d,type:"file",accept:".vrm,model/gltf-binary",className:"hidden",onChange:b=>{var T;const E=(T=b.target.files)==null?void 0:T[0];E&&m(E)}}),v.jsxs("button",{onClick:()=>{var b;return(b=d.current)==null?void 0:b.click()},className:"flex w-full items-center gap-2 rounded-md border border-border/40 bg-background/40 px-3 py-2 hover:bg-accent transition-colors",children:[v.jsx(i9,{className:"h-4 w-4"})," Eigenes .vrm hochladen"]}),v.jsxs("div",{className:"flex gap-1.5",children:[v.jsx("input",{value:n,onChange:b=>r(b.target.value),onKeyDown:b=>b.key==="Enter"&&y(),placeholder:"…oder VRM-URL einfügen",className:"min-w-0 flex-1 rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50"}),v.jsx("button",{onClick:y,className:"rounded-md border border-border/40 bg-background/40 px-2.5 hover:bg-accent",title:"Laden",children:v.jsx(H8,{className:"h-4 w-4"})})]}),v.jsxs("a",{href:"https://hub.vroid.com/en/characters",target:"_blank",rel:"noopener",className:"flex items-center gap-1.5 text-xs text-primary/80 hover:text-primary",children:[v.jsx(yg,{className:"h-3.5 w-3.5"})," Mehr Avatare auf VRoid Hub (kostenlos) → herunterladen & hochladen"]})]}),v.jsxs("div",{children:[v.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[v.jsx(Vm,{className:"h-3.5 w-3.5"})," Stimme"]}),i.length===0?v.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-300",children:"Voice-Dienst nicht erreichbar — Stimmen werden geladen, sobald der Sidecar läuft."}):v.jsxs("div",{className:"space-y-2",children:[v.jsx("div",{className:"flex gap-1.5",children:S.map(b=>v.jsx("button",{onClick:()=>x(b,""),className:`flex-1 rounded-md border px-2.5 py-1.5 text-xs capitalize transition-colors ${o===b?"border-primary/50 bg-primary/10 text-primary":"border-border/40 hover:bg-accent"}`,children:b==="piper"?"Piper (schnell)":b==="chatterbox"?"Chatterbox (premium)":b},b))}),v.jsxs("select",{value:l,onChange:b=>x(o,b.target.value),className:"w-full rounded-md border border-border/40 bg-background/40 px-2.5 py-2 text-xs outline-none focus:border-primary/50",children:[v.jsx("option",{value:"",children:"Standardstimme"}),w.map(b=>v.jsxs("option",{value:b.id,children:[b.label,b.clonable?" · klonbar":""]},b.id))]}),o==="chatterbox"&&v.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Chatterbox läuft auf CPU → erste Antwort kann ein paar Sekunden dauern. Natürlichste Stimme + Voice-Cloning."})]})]})]})}function oSe(t){const[e,n]=R.useState(!1),r=R.useRef(null),i=R.useRef([]),s=R.useRef(null),o=R.useCallback(async()=>{if(r.current)return;let l;try{l=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(f){console.error("Mikrofon-Zugriff verweigert:",f);return}s.current=l;const c=MediaRecorder.isTypeSupported("audio/webm;codecs=opus")?"audio/webm;codecs=opus":"audio/webm",d=new MediaRecorder(l,{mimeType:c});i.current=[],d.ondataavailable=f=>{f.data.size&&i.current.push(f.data)},d.onstop=()=>{var m;const f=new Blob(i.current,{type:c});(m=s.current)==null||m.getTracks().forEach(y=>y.stop()),s.current=null,r.current=null,n(!1),f.size>1200&&t(f)},d.start(),r.current=d,n(!0)},[t]),a=R.useCallback(()=>{var l;(l=r.current)==null||l.stop()},[]);return R.useEffect(()=>()=>{var l,c;(l=r.current)==null||l.stop(),(c=s.current)==null||c.getTracks().forEach(d=>d.stop())},[]),{recording:e,start:o,stop:a}}class aSe{constructor(){fo(this,"ctx");fo(this,"analyser");fo(this,"queue",[]);fo(this,"playing",!1);fo(this,"raf",0);fo(this,"freq");fo(this,"level",{current:0});fo(this,"onSpeaking");const e=window.AudioContext||window.webkitAudioContext;this.ctx=new e,this.analyser=this.ctx.createAnalyser(),this.analyser.fftSize=256,this.analyser.smoothingTimeConstant=.6,this.analyser.connect(this.ctx.destination),this.freq=new Uint8Array(new ArrayBuffer(this.analyser.frequencyBinCount))}async enqueue(e){this.queue.push(e),this.playing||await this.playNext()}clear(){this.queue=[]}async playNext(){var i,s;const e=this.queue.shift();if(!e){this.playing=!1,this.stopMeter(),(i=this.onSpeaking)==null||i.call(this,!1);return}if(this.playing=!0,(s=this.onSpeaking)==null||s.call(this,!0),this.ctx.state==="suspended")try{await this.ctx.resume()}catch{}let n;try{n=await this.ctx.decodeAudioData(e.slice(0))}catch{return this.playNext()}const r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.analyser),r.onended=()=>{this.playNext()},r.start(),this.startMeter()}startMeter(){cancelAnimationFrame(this.raf);const e=()=>{this.analyser.getByteFrequencyData(this.freq);const n=Math.min(this.freq.length,48);let r=0;for(let s=2;s{if(!l.current){const E=new aSe;E.onSpeaking=T=>e(C=>T?"speaking":C==="speaking"?"idle":C),l.current=E,o.current=E.level}return l.current},[]),f=R.useCallback(async E=>{var k,j,H,ne;s(null);const T=d();T.clear(),e("transcribing");let C="";try{const J=new FormData;J.append("audio",E,"rec.webm");const de=await fetch("/api/voice/stt",{method:"POST",body:J});if(!de.ok)throw new Error(`STT ${de.status}`);C=((k=(await de.json()).text)==null?void 0:k.trim())||""}catch(J){e("error"),s(`Spracherkennung fehlgeschlagen: ${J.message}`);return}if(!C){e("idle");return}r(J=>[...J,{role:"user",text:C}]),e("thinking");const{engine:O,voice:N}=dSe();let D="",F="";r(J=>[...J,{role:"assistant",text:""}]);const V=J=>{J.trim()&&fetch("/api/voice/tts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:J,engine:O,voice:N})}).then(de=>de.ok?de.arrayBuffer():Promise.reject(new Error(`TTS ${de.status}`))).then(de=>T.enqueue(de)).catch(de=>console.error("TTS-Fehler:",de))};try{const J=await fetch("/api/voice/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:C,session_id:c.current,system:uSe})});if(!J.ok||!J.body)throw new Error(`Agent ${J.status}`);const de=J.body.getReader(),oe=new TextDecoder;let he="";for(;;){const{done:B,value:K}=await de.read();if(B)break;he+=oe.decode(K,{stream:!0});const q=he.split(` + +`);he=q.pop()||"";for(const $ of q){const Z=$.split(` +`).find($e=>$e.startsWith("data:"));if(!Z)continue;const ge=Z.slice(5).trim();if(ge==="[DONE]")continue;let ae;try{ae=JSON.parse(ge)}catch{continue}if(ae.error)throw new Error(ae.error);const ce=((ne=(H=(j=ae.choices)==null?void 0:j[0])==null?void 0:H.delta)==null?void 0:ne.content)||"";if(!ce)continue;D+=ce,F+=ce,a.current=cSe(D),r($e=>{const Se=$e.slice();return Se[Se.length-1]={role:"assistant",text:D},Se});const{sentences:we,rest:Me}=fSe(F);F=Me,we.forEach(V)}}F.trim()&&V(F),D.trim()||e("idle")}catch(J){e("error"),s(`Agent-Antwort fehlgeschlagen: ${J.message}`)}},[d]),{recording:m,start:y,stop:x}=oSe(f),S=R.useCallback(()=>{d(),e("listening"),y()},[d,y]),w=R.useCallback(()=>{x()},[x]),b=R.useCallback(()=>{var E;(E=l.current)==null||E.clear(),r([]),s(null),e("idle"),localStorage.removeItem("mc_voice_session"),c.current=Pj()},[]);return R.useEffect(()=>{!m&&t==="listening"&&e("transcribing")},[m,t]),{status:t,messages:n,error:i,recording:m,audioLevel:o,emotion:a,pressStart:S,pressEnd:w,reset:b}}const pSe={idle:"Bereit — halte zum Sprechen",listening:"Höre zu …",transcribing:"Verstehe …",thinking:"Hermes denkt …",speaking:"Hermes spricht …",error:"Fehler"};function mSe(){const[t,e]=R.useState(()=>localStorage.getItem("mc_voice_avatar_url")||iSe),{status:n,messages:r,error:i,recording:s,audioLevel:o,emotion:a,pressStart:l,pressEnd:c,reset:d}=hSe(),f=R.useRef(!1),m=R.useCallback(S=>e(S),[]);R.useEffect(()=>{const S=E=>E instanceof HTMLElement&&/^(INPUT|TEXTAREA|SELECT)$/.test(E.tagName),w=E=>{E.code!=="Space"||E.repeat||f.current||S(E.target)||(E.preventDefault(),f.current=!0,l())},b=E=>{E.code!=="Space"||!f.current||(E.preventDefault(),f.current=!1,c())};return window.addEventListener("keydown",w),window.addEventListener("keyup",b),()=>{window.removeEventListener("keydown",w),window.removeEventListener("keyup",b)}},[l,c]);const y=n==="speaking",x=n==="transcribing"||n==="thinking";return v.jsxs("div",{className:"flex h-full gap-5",children:[v.jsxs("div",{className:"relative flex min-w-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/30 overflow-hidden",children:[v.jsx("div",{className:"flex-1 min-h-0",children:v.jsx(eSe,{url:t,audioLevel:o,emotion:a})}),v.jsxs("div",{className:"shrink-0 flex flex-col items-center gap-3 border-t border-border/40 bg-background/30 py-5 backdrop-blur-sm",children:[v.jsxs("div",{className:nt("flex items-center gap-2 text-sm",n==="error"?"text-red-400":y?"text-primary":"text-muted-foreground"),children:[x&&v.jsx(sF,{className:"h-4 w-4 animate-spin"}),y&&v.jsx(o9,{className:"h-4 w-4 animate-pulse"}),v.jsx("span",{children:i||pSe[n]})]}),v.jsx("button",{onPointerDown:S=>{S.preventDefault(),f.current=!0,l()},onPointerUp:()=>{f.current&&(f.current=!1,c())},onPointerLeave:()=>{f.current&&(f.current=!1,c())},className:nt("flex h-20 w-20 items-center justify-center rounded-full border-2 transition-all select-none touch-none",s?"border-red-500 bg-red-500/20 scale-110 shadow-lg shadow-red-500/30":"border-primary/60 bg-primary/15 hover:bg-primary/25 hover:scale-105"),title:"Gedrückt halten zum Sprechen (oder Leertaste halten)",children:v.jsx(oF,{className:nt("h-8 w-8",s?"text-red-400":"text-primary")})}),v.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Halten zum Sprechen · ",v.jsx("kbd",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"Leertaste"})," geht auch"]})]})]}),v.jsxs("div",{className:"flex w-80 shrink-0 flex-col gap-4",children:[v.jsx("div",{className:"rounded-xl border border-border/40 bg-card/40 p-4 overflow-y-auto scrollbar-thin max-h-[55%]",children:v.jsx(sSe,{avatarUrl:t,onAvatarChange:m})}),v.jsxs("div",{className:"flex min-h-0 flex-1 flex-col rounded-xl border border-border/40 bg-card/40",children:[v.jsxs("div",{className:"flex items-center justify-between border-b border-border/40 px-4 py-2.5",children:[v.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Gespräch"}),v.jsx("button",{onClick:d,className:"text-muted-foreground hover:text-foreground",title:"Neues Gespräch",children:v.jsx(Q8,{className:"h-3.5 w-3.5"})})]}),v.jsxs("div",{className:"flex-1 space-y-2.5 overflow-y-auto p-4 scrollbar-thin",children:[r.length===0&&v.jsx("p",{className:"text-xs text-muted-foreground",children:"Halte den Knopf (oder die Leertaste) und sprich. Hermes hört zu, denkt mit seinem vollen Gedächtnis und seinen Werkzeugen — und antwortet hörbar."}),r.map((S,w)=>v.jsxs("div",{className:nt("text-sm",S.role==="user"?"text-foreground":"text-primary/90"),children:[v.jsx("span",{className:"mr-1.5 text-[10px] font-semibold uppercase text-muted-foreground",children:S.role==="user"?"Du":"Hermes"}),S.text||v.jsx("span",{className:"text-muted-foreground",children:"…"})]},w))]})]})]})]})}const Rj=[{id:"grundlagen",label:"Grundlagen"},{id:"moe",label:"MoE & Quant"},{id:"lokal",label:"Lokal betreiben"},{id:"modelle",label:"Modell-Landschaft"},{id:"gateway",label:"Gateway-Trick"},{id:"mcp",label:"MCP"},{id:"skills",label:"Skills"},{id:"memory",label:"Gedächtnis & RAG"},{id:"agents",label:"Agenten"},{id:"ide",label:"IDE anbinden"},{id:"tricks",label:"Tricks & Kniffe"},{id:"wartung",label:"Sicherheit & Wartung"},{id:"ressourcen",label:"Ressourcen"},{id:"troubleshooting",label:"Troubleshooting"}];function gSe(t){var e;(e=document.getElementById(t))==null||e.scrollIntoView({behavior:"smooth",block:"start"})}function mo({id:t,icon:e,color:n,title:r,kicker:i,children:s,wide:o}){return v.jsxs("section",{id:t,className:nt("scroll-mt-20 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-3",o&&"md:col-span-2"),children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(e,{className:nt("h-5 w-5 shrink-0",n)}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:r}),i&&v.jsx("span",{className:nt("text-[9px] font-mono",n),children:i})]})]}),v.jsx("div",{className:"text-xs text-muted-foreground space-y-2.5 leading-relaxed",children:s})]})}function Vf({children:t}){return v.jsxs("div",{className:"mt-1 rounded-xl border border-primary/25 bg-primary/[0.06] p-3 text-[11px] leading-relaxed",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-primary mb-1",children:[v.jsx(Vm,{className:"h-3 w-3"})," Bei dir konkret"]}),v.jsx("div",{className:"text-muted-foreground space-y-1",children:t})]})}function pn({children:t}){return v.jsx("code",{className:"rounded bg-background/40 border border-border/30 px-1.5 py-0.5 font-mono text-[10px] text-foreground",children:t})}function Or({href:t,name:e,note:n}){return v.jsxs("li",{className:"leading-relaxed",children:[v.jsxs("a",{href:t,target:"_blank",rel:"noopener",className:"text-primary hover:underline font-semibold inline-flex items-center gap-0.5",children:[e,v.jsx(b8,{className:"h-3 w-3 opacity-60"})]}),v.jsxs("span",{className:"text-muted-foreground",children:[" — ",n]})]})}function vSe(){const[t,e]=R.useState(!1);return v.jsxs("div",{className:"space-y-7",children:[v.jsxs("div",{className:"rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 flex items-start gap-4",children:[v.jsx("div",{className:"h-11 w-11 rounded-xl bg-primary/15 flex items-center justify-center shrink-0",children:v.jsx(TT,{className:"h-6 w-6 text-primary"})}),v.jsxs("div",{className:"space-y-1",children:[v.jsx("h1",{className:"text-2xl font-space font-bold tracking-tight bg-gradient-to-r from-foreground via-foreground to-primary bg-clip-text text-transparent",children:"Die AI-Bibel"}),v.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed max-w-2xl",children:["Allgemeines Nachschlagewerk für lokale & agentische AI — Konzepte, Tricks, Kniffe und kuratierte Quellen. ",v.jsx("span",{className:"font-semibold text-foreground",children:"Stand Juni 2026."})," ","Das meiste gilt überall; ",v.jsx("span",{className:"text-primary font-semibold",children:'„Bei dir konkret"'}),"-Kästen zeigen, was dein Stack daraus macht."]})]})]}),v.jsx("div",{className:"sticky top-0 z-10 -mx-1 px-1",children:v.jsx("div",{className:"rounded-xl border border-border/50 bg-card/70 backdrop-blur-xl p-2 shadow-lg shadow-black/20",children:v.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[v.jsx(PT,{className:"h-3.5 w-3.5 text-primary ml-1 mr-0.5 shrink-0"}),(t?Rj:Rj.slice(0,9)).map(n=>v.jsx("button",{onClick:()=>gSe(n.id),className:"rounded-lg px-2.5 py-1 text-[11px] font-semibold text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:n.label},n.id)),v.jsx("button",{onClick:()=>e(n=>!n),className:"rounded-lg px-2 py-1 text-[11px] font-semibold text-primary hover:bg-primary/10 transition-colors cursor-pointer",children:t?"weniger":"+ mehr"})]})})}),v.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[v.jsxs(mo,{id:"grundlagen",icon:El,color:"text-cyan-400",title:"1. Wie LLMs ticken",kicker:"Grundlagen",children:[v.jsxs("p",{children:["Ein LLM ist im Kern ein ",v.jsx("strong",{children:"Wahrscheinlichkeits-Rechner für das nächste Token"}),' (Wortteil). Es „weiß" nichts — es setzt fort, was statistisch am plausibelsten ist. Daraus folgt fast alles andere.']}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Tokens"})," sind die Einheit — ~¾ Wort. Ein- und Ausgabe werden in Tokens gezählt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontextfenster"}),' = wie viele Tokens das Modell gleichzeitig „sehen" kann (Prompt + Antwort). Voll = Anfang fällt raus.']}),v.jsxs("li",{children:[v.jsx("strong",{children:"Parameter"})," = die trainierten Gewichte. Training ist einmalig, ",v.jsx("strong",{children:"Inferenz"})," ist jede Antwort."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Temperatur / Sampling"})," steuert Zufall: niedrig = deterministisch/präzise (Code), hoch = kreativ."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Halluzination"})," ist kein Bug, sondern die Kehrseite des Ratens. Gegenmittel: Grounding via Tools/RAG, Verifikation."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Reasoning-/Thinking-Modelle"}),' „denken" in unsichtbaren Tokens vor der Antwort — besser bei Logik, langsamer/teurer.']})]})]}),v.jsxs(mo,{id:"moe",icon:G1,color:"text-violet-400",title:"2. MoE & Quantisierung",kicker:"Mehr Modell, weniger Last",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Mixture of Experts (MoE):"})," Statt für jedes Token das ganze Netz zu aktivieren, wählt ein",v.jsx("em",{children:" Router"})," nur ein paar spezialisierte ",v.jsx("em",{children:"Experts"}),' aus. So läuft ein 100B-Modell mit der aktiven Rechenlast eines viel kleineren (z.B. „122B total / 10B aktiv").']}),v.jsxs("p",{children:[v.jsx("strong",{children:"Quantisierung:"})," Gewichte von FP16 auf weniger Bits eindampfen — kleiner & schneller bei minimalem Qualitätsverlust. Faustregel:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx(pn,{children:"Q8"})," nahezu verlustfrei, größter Footprint"]}),v.jsxs("li",{children:[v.jsx(pn,{children:"Q6_K"})," sehr gut, guter Mittelweg"]}),v.jsxs("li",{children:[v.jsx(pn,{children:"Q4_K_M"})," der Sweet-Spot für lokal — viel Modell pro GB"]})]}),v.jsxs(Vf,{children:["VRAM/RAM ist die harte Grenze — ",v.jsx("strong",{children:"darum"})," ist beides hier zentral: MoE lässt 100B+ überhaupt laufen, Quant entscheidet, was reinpasst. Dein Line-up fährt durchweg ",v.jsx(pn,{children:"Q4_K_M"}),"/",v.jsx(pn,{children:"Q6_K"}),"."]})]}),v.jsxs(mo,{id:"lokal",icon:xP,color:"text-emerald-400",title:"3. Lokal betreiben: Engines & Backends",kicker:"llama.cpp, vLLM & Co.",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Inference-Engines"})," — was die Modelle ausführt:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"llama.cpp / GGUF"})," — der De-facto-Standard für lokal, CPU+GPU, läuft überall."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Ollama / LM Studio"})," — bequeme Wrapper mit One-Click-Downloads (LM Studio mit GUI)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"vLLM / TGI"})," — Server-Engines für maximalen Durchsatz auf dicken GPUs."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"llama-swap"})," — Proxy, der ",v.jsx("em",{children:"mehrere"})," Modelle hinter ",v.jsx("em",{children:"einem"})," Port hält und je nach Anfrage automatisch ein-/aussattelt."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"GPU-Backends"})," — wie gerechnet wird:"]}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx(pn,{children:"CUDA"})," NVIDIA · ",v.jsx(pn,{children:"ROCm"})," AMD · ",v.jsx(pn,{children:"Vulkan"})," herstellerübergreifend · ",v.jsx(pn,{children:"Metal"})," Apple"]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Begriffe, die immer wiederkommen:"})," Kontext (",v.jsx(pn,{children:"-c"}),"), Slots/Parallel, KV-Cache, Modell-TTL/Swap, ",v.jsx("strong",{children:"Speculative Decoding"})," (kleines Draft-Modell rät voraus → schneller)."]})]})]}),v.jsxs(Vf,{children:["Deine Box hat eine AMD-APU (gfx1151). ",v.jsx("strong",{children:"Einschränkung & Trick:"})," dort schlägt ",v.jsx(pn,{children:"Vulkan/RADV"})," das offizielle ",v.jsx(pn,{children:"ROCm"})," bei Token-Generierung um ~12–22 % — darum läuft die Engine auf Vulkan.",v.jsx(pn,{children:"llama-swap"})," hält die Alltags-Hirne dauerwarm; ",v.jsx(pn,{children:"coder"})," nutzt Spec-Decoding."]})]}),v.jsxs(mo,{id:"modelle",icon:CT,color:"text-sky-400",title:"4. Modell-Landschaft",kicker:"Stand Juni 2026",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Open-Weight (lokal nutzbar):"})}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Qwen"})," (Alibaba) — starke Allrounder + Coder + Vision, viele Größen/MoE."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Llama"})," (Meta), ",v.jsx("strong",{children:"Gemma"})," (Google), ",v.jsx("strong",{children:"Phi"})," (Microsoft) — solide Open-Familien."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"DeepSeek"}),", ",v.jsx("strong",{children:"Mistral/Mixtral"})," — kräftige MoE-/Reasoning-Modelle."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsx("p",{children:v.jsx("strong",{children:"Frontier (Cloud-API):"})}),v.jsx("ul",{className:"list-disc pl-4 space-y-1",children:v.jsxs("li",{children:[v.jsx("strong",{children:"Claude"})," (Anthropic), ",v.jsx("strong",{children:"GPT"})," (OpenAI), ",v.jsx("strong",{children:"Gemini"})," (Google) — die stärksten Allrounder, aber nicht lokal."]})}),v.jsxs("p",{className:"pt-1",children:[v.jsx("strong",{children:"Modellwahl nach Aufgabe:"})," schnelles Alltags-Hirn · großes Logik-Hirn für harte Tasks · dediziertes Code-Modell · multimodal für Bilder · Embedding-Modell fürs Gedächtnis."]})]})]}),v.jsx("p",{className:"text-[11px] italic",children:'Leaderboards (HF, LMArena) sind grobe Orientierung — der einzige Benchmark, der zählt, ist deine eigene Aufgabe. Vorsicht vor „Benchmaxxing".'}),v.jsxs(Vf,{children:["Dein Line-up via llama-swap: ",v.jsx(pn,{children:"fast"})," (Alltag/Vision/MoE) · ",v.jsx(pn,{children:"heavy"})," (schwere Logik) ·",v.jsx(pn,{children:"coder"})," · ",v.jsx(pn,{children:"scout"})," · ",v.jsx(pn,{children:"vision"})," · ",v.jsx(pn,{children:"embed"})," (fürs Gedächtnis) ·",v.jsx(pn,{children:"hermes"})," (Agent-Hirn). Verwalten/tauschen im ",v.jsx("strong",{children:"Modell-Manager"}),"-Tab."]})]}),v.jsxs(mo,{id:"gateway",icon:q8,color:"text-amber-400",title:"5. Der Gateway-Trick",kicker:"OpenAI-kompatibel = überall andocken",children:[v.jsxs("p",{children:["Fast jedes AI-Tool spricht heute das ",v.jsx("strong",{children:"OpenAI-Format"})," (",v.jsx(pn,{children:"/v1/chat/completions"}),"). Ein",v.jsx("strong",{children:" Gateway"})," davor gibt dir ",v.jsx("em",{children:"einen"})," Endpunkt für alles: zentrales Key-Management, Logging und transparentes ",v.jsx("strong",{children:"Routing"})," — der Client merkt nicht, welches Modell tatsächlich antwortet."]}),v.jsxs("p",{children:["Die ",v.jsx(pn,{children:"model:auto"}),'-Idee: du sagst „auto", das Gateway wählt das passende Modell je nach Anfrage und lädt es bei Bedarf.']}),v.jsxs(Vf,{children:["Dein Gateway: ",v.jsx(pn,{children:"http://192.168.178.151:9001/v1"}),", Model ",v.jsx(pn,{children:"auto"}),", API-Key beliebig. Fertige Configs erzeugt dir der ",v.jsx("strong",{children:"Verbinden"}),"-Tab live — eine Wahrheit, kein Abtippen."]})]}),v.jsxs(mo,{id:"mcp",icon:NT,color:"text-violet-400",title:"6. MCP — Werkzeuge für Agenten",kicker:"USB-C für AI-Tools",children:[v.jsxs("p",{children:["Das ",v.jsx("strong",{children:"Model Context Protocol"})," (offen, von Anthropic initiiert) standardisiert, wie ein AI-Client mit externen Tools & Datenquellen spricht. Ein ",v.jsx("strong",{children:"MCP-Server"})," bringt Fähigkeiten: Dateien, Web-Fetch, Git, Datenbanken, eigene APIs."]}),v.jsx("p",{children:"Statt für jeden Editor eigene Tools zu schreiben, bindet jeder MCP-fähige Agent denselben Server an."}),v.jsxs("div",{className:"flex items-start gap-1.5 rounded-xl border border-amber-500/25 bg-amber-500/[0.06] p-2.5 text-[11px]",children:[v.jsx(G8,{className:"h-3.5 w-3.5 text-amber-400 shrink-0 mt-0.5"}),v.jsxs("span",{children:[v.jsx("strong",{children:"Sicherheit:"})," ein MCP-Server hat echten Zugriff (Dateien, Shell). Nur vertrauenswürdige Server laufen lassen, Rechte minimal halten, Quelle prüfen."]})]})]}),v.jsxs(mo,{id:"skills",icon:Z8,color:"text-emerald-400",title:"7. Agent Skills",kicker:"Wiederverwendbare Fähigkeiten",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Skill"})," ist ein Ordner mit einer ",v.jsx(pn,{children:"SKILL.md"})," (YAML-Kopf + Anleitung, optional Skripte/Beispiele), den der Agent für eine bestimmte Aufgabe lädt — z.B. TDD, Code-Vereinfachung, API-Design."]}),v.jsx("pre",{className:"p-2.5 bg-background/25 rounded-lg border border-border/30 font-mono text-[9px] text-foreground overflow-x-auto whitespace-pre",children:`--- +name: tdd-pro +description: Treibt Entwicklung mit strikter TDD-Praxis +--- +# Instructions +...`}),v.jsxs("p",{children:["Suchen & installieren über die ",v.jsx("strong",{children:"skills.sh"}),"-Registry: ",v.jsx(pn,{children:"npx skills find"})," /",v.jsx(pn,{children:"npx skills add owner/repo"}),". Skills liegen projektweit (vom Agent beim Start gelesen) oder global."]})]}),v.jsxs(mo,{id:"memory",icon:I8,color:"text-indigo-400",title:"8. Gedächtnis & RAG",kicker:"Modelle vergessen — du nicht",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["LLMs sind ",v.jsx("strong",{children:"zustandslos"}),": ohne Hilfe weiß das Modell beim nächsten Turn nichts mehr. Gedächtnis lebt extern."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Embeddings"})," wandeln Text in Vektoren; ein ",v.jsx("strong",{children:"Vektor-Store"})," (Chroma, …) findet semantisch Ähnliches."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"RAG"})," = relevante Fakten vor dem Turn heraussuchen und einblenden statt alles im Prompt zu halten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Long-Context vs. RAG:"}),' riesige Fenster sind bequem, aber teuer & „lost in the middle" — gezieltes Abrufen skaliert besser.']})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Auto-lernendes Gedächtnis"})," ist die nächste Stufe:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:["extrahiert Fakten ",v.jsx("em",{children:"selbst"})," aus Gesprächen, statt nur abzuspeichern"]}),v.jsx("li",{children:"dedupliziert semantisch (kein 10× derselbe Fakt)"}),v.jsxs("li",{children:[v.jsx("strong",{children:"Graph-Sicht"})," = Fakten ",v.jsx("em",{children:"plus"})," ihre Beziehungen, nicht nur eine flache Liste"]})]})]})]}),v.jsxs(Vf,{children:["Dein Gedächtnis (Tab ",v.jsx("strong",{children:"Gedächtnis"}),") ist ",v.jsx("strong",{children:"Mem0"}),"-basiert: auto-lernend & semantisch, ",v.jsx("strong",{children:"graph-first"})," dargestellt, mit 4-Typen-Taxonomie (",v.jsx(pn,{children:"Identität"})," · ",v.jsx(pn,{children:"Wissen"})," · ",v.jsx(pn,{children:"Regeln"})," · ",v.jsx(pn,{children:"Ereignisse"}),"). Einstieg über ein kurzes ",v.jsx("strong",{children:"Hermes-Onboarding-Gespräch"})," im Terminal — der Agent lernt im Hintergrund nach jedem Turn.",v.jsx("br",{}),v.jsx("strong",{children:"Gotcha:"})," ein gelöschter Fakt kann wieder auftauchen, solange die Original-Nachricht noch im Verlauf steht (additive Extraktion)."]})]}),v.jsxs(mo,{id:"agents",icon:qc,color:"text-rose-400",title:"9. Autonome Agenten betreiben",kicker:"LLM in der Schleife",wide:!0,children:[v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:["Ein ",v.jsx("strong",{children:"Agent"})," ist ein LLM in einer Schleife mit Tools:",v.jsx("em",{children:" denken → Tool aufrufen → Ergebnis beobachten → weiter"}),", bis das Ziel erreicht ist."]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Guardrails"})," (Hard-Stop, Tool-Limits) verhindern Endlos-Loops, wenn ein Tool fehlt oder hängt."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kontext-Hygiene"})," ist die wichtigste Disziplin: frische Sessions starten — vollgemüllte Historien werden langsam, driften und halluzinieren."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Kanäle:"})," CLI/Terminal, Chat-UI, Messaging (z.B. Telegram), reine API."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{children:[v.jsx("strong",{children:"Least Privilege:"})," gib einem Agenten nur die Tools, die er wirklich braucht. Kritische Aktionen (Shell auf dem Host, Löschen, Geld/Deploys) hinter menschliche Freigabe."]}),v.jsxs("p",{children:[v.jsx("strong",{children:"Was sich vollautomatisch lohnt:"})," Modell-Routing, Hintergrund-Gedächtnis, Recherche. ",v.jsx("strong",{children:"Was Freigabe braucht:"})," Systembefehle, Updates/Reboots, permanentes Löschen."]})]})]}),v.jsxs(Vf,{children:[v.jsx("strong",{children:"Hermes"})," ist dein Box-Agent (Hirn = ",v.jsx(pn,{children:"fast"}),"). Reden tust du mit ihm im",v.jsx("strong",{children:" Terminal"}),"-Tab (Web-Terminal via ttyd) oder per ",v.jsx("strong",{children:"Telegram"}),". Er hat MCP-Server für Gedächtnis, Stack-Steuerung, Web-Fetch und ",v.jsx("strong",{children:"PC-Steuerung"})," (Executor auf deinem Windows-PC). Status & Verdrahtung im ",v.jsx("strong",{children:"Hermes"}),"-Tab."]})]}),v.jsxs(mo,{id:"ide",icon:iF,color:"text-cyan-400",title:"10. IDE / Editor anbinden",kicker:"Vibe-Coding lokal",children:[v.jsxs("p",{children:["Jede ",v.jsx("strong",{children:"OpenAI-kompatible"})," IDE oder Extension lässt sich auf einen lokalen Server umbiegen — Base-URL + Model eintragen, fertig:"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Cline"})," & ",v.jsx("strong",{children:"Roo Code"})," (VS-Code-Extensions, voller Agent + MCP)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Cursor"})," (VS-Code-Fork mit Top-Autocomplete)"]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Continue"}),", ",v.jsx("strong",{children:"aider"})," (CLI), ",v.jsx("strong",{children:"OpenCode"})," (Desktop)"]})]}),v.jsxs(Vf,{children:["Tipp den Kram nicht ab: der ",v.jsx("strong",{children:"Verbinden"}),"-Tab generiert die fertige Config (inkl. MCP-Gedächtnis) pro Tool zum Kopieren. Essenz: Base ",v.jsx(pn,{children:"…:9001/v1"}),", Model ",v.jsx(pn,{children:"auto"}),", Key beliebig."]})]}),v.jsx(mo,{id:"tricks",icon:B8,color:"text-amber-400",title:"11. Tricks & Kniffe",kicker:"Was im Alltag wirklich spart",wide:!0,children:v.jsx("div",{className:"grid md:grid-cols-3 gap-3",children:[["Kontext sauber halten","Neue Session statt Mega-Historie. Drift, Tempo und Halluzination hängen direkt am Kontext-Müll."],["Plan-then-Act","Erst Plan/Vorgehen bestätigen lassen, dann ausführen. Spart teure Holzwege."],["Gezielte Edits","Nie ganze Dateien überschreiben für eine Zeile — Such-/Ersetz-Tools nutzen. Weniger Tokens, weniger Fehler."],["Non-interaktive Befehle","Keine interaktiven Prompts im Agent-Terminal; lange Tasks als Background-Job. Sonst hängt der Loop."],["DevTools koppeln","Browser-/Konsolen-Zugriff geben — der Agent liest echte Fehler statt blind zu raten."],["Richtige Modellwahl","Schnelles Hirn für Alltag, großes für harte Logik, Coder fürs Coden. Nicht alles mit der Kanone."],["Akzeptanzkriterien","Sag konkret, woran „fertig“ erkennbar ist. Vage Prompts → vage Ergebnisse."],["Verifizieren statt vertrauen","Tests/Live-Check fordern. „Sollte funktionieren“ ist kein Beweis."],["Regeln ins Gedächtnis","Wiederkehrende Vorlieben/Konventionen einmal ablegen — der Agent zieht sie selbst."]].map(([n,r])=>v.jsxs("div",{className:"space-y-1 p-3 bg-background/10 rounded-xl border border-border/30",children:[v.jsxs("div",{className:"flex items-center gap-1.5 font-bold text-foreground text-[11px]",children:[v.jsx(xh,{className:"h-3 w-3 text-amber-400"})," ",n]}),v.jsx("p",{className:"text-[11px]",children:r})]},n))})}),v.jsx(mo,{id:"wartung",icon:s0,color:"text-emerald-400",title:"12. Sicherheit & Wartung",kicker:"Damit's auch morgen noch läuft",wide:!0,children:v.jsxs("div",{className:"grid md:grid-cols-2 gap-4",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(L8,{className:"h-3.5 w-3.5 text-emerald-400"})," Goldene Regeln"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Ein ungetesteter Restore ist kein Backup."})," Wiederherstellung mindestens einmal echt durchspielen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates können Dinge still zerschießen"})," — gerade bei AI-Stacks (Embeddings, Provider-Interna). Versionen pinnen, Smoke-Test, Post-Check."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Least Privilege"})," für Agenten, MCP-Server und PC-Zugriff. Kritisches hinter Freigabe."]})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("p",{className:"flex items-center gap-1.5 font-bold text-foreground",children:[v.jsx(tw,{className:"h-3.5 w-3.5 text-emerald-400"})," Bei dir im SystemDrawer"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Backup:"})," tägliches Voll-Zustands-Backup, getesteter ",v.jsx(pn,{children:"restore.sh"})," (Doku in ",v.jsx(pn,{children:"docs/BACKUP.md"}),")."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Updates:"})," git-basierter Update-Check; ",v.jsx("strong",{children:"Hermes-Update-Button"})," mit anschließendem ",v.jsx("strong",{children:"Gehirn-Check"})," (rot, falls das Update das Gedächtnis zerschießt) + Engine-Update."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Dienste & Gefahrenzone:"})," Restart/Logs pro Dienst, kritische Eingriffe getrennt."]})]}),v.jsx("p",{className:"text-[10px] italic",children:'Erreichbar über das System-Icon → Tab „Wartung".'})]})]})}),v.jsxs("section",{id:"ressourcen",className:"scroll-mt-20 md:col-span-2 rounded-2xl border border-border/60 bg-card/45 backdrop-blur-md p-6 shadow-lg shadow-black/10 space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2.5 border-b border-border/20 pb-3",children:[v.jsx(PT,{className:"h-5 w-5 text-primary"}),v.jsxs("div",{children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-foreground",children:"13. Kuratierte Ressourcen & Links"}),v.jsx("span",{className:"text-[9px] font-mono text-primary",children:"Sauber geordnet — die guten Quellen"})]})]}),v.jsxs("div",{className:"grid md:grid-cols-2 gap-5 text-xs",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(CT,{className:"h-3.5 w-3.5 text-sky-400"})," Modelle & Engines"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://huggingface.co/models",name:"Hugging Face",note:"das Repository für offene Modelle (GGUF, Embeddings, Datasets)."}),v.jsx(Or,{href:"https://github.com/ggml-org/llama.cpp",name:"llama.cpp",note:"die Referenz-Engine für lokale Inferenz."}),v.jsx(Or,{href:"https://github.com/mostlygeek/llama-swap",name:"llama-swap",note:"mehrere Modelle hinter einem Port, Auto-Swap."}),v.jsx(Or,{href:"https://ollama.com",name:"Ollama",note:"einfachster Einstieg, One-Command-Modelle."}),v.jsx(Or,{href:"https://lmstudio.ai",name:"LM Studio",note:"lokale GUI zum Stöbern, Laden & Chatten."}),v.jsx(Or,{href:"https://github.com/vllm-project/vllm",name:"vLLM",note:"Hochdurchsatz-Serving auf dicken GPUs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(NT,{className:"h-3.5 w-3.5 text-violet-400"})," MCP & Skills"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://modelcontextprotocol.io",name:"MCP — offizielle Doku",note:"Spezifikation & Einstieg."}),v.jsx(Or,{href:"https://github.com/modelcontextprotocol/servers",name:"Offizielle MCP-Server",note:"filesystem, git, postgres, fetch & mehr."}),v.jsx(Or,{href:"https://smithery.ai",name:"Smithery",note:"Registry zum Suchen & Auto-Installieren von MCP-Servern."}),v.jsx(Or,{href:"https://glama.ai/mcp/servers",name:"Glama MCP Registry",note:"kuratierte Community-Datenbank."}),v.jsx(Or,{href:"https://skills.sh",name:"skills.sh",note:"Registry & CLI für Agent-Skills."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(qc,{className:"h-3.5 w-3.5 text-rose-400"})," Agenten & Frameworks"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://github.com/NousResearch/hermes-agent",name:"Hermes Agent (Nous)",note:"der Agent, der auf deiner Box läuft."}),v.jsx(Or,{href:"https://docs.claude.com",name:"Anthropic / Claude Docs",note:"API, Tool-Use, Agent SDK, MCP."}),v.jsx(Or,{href:"https://github.com/cline/cline",name:"Cline",note:"autonomer Coding-Agent für VS Code."}),v.jsx(Or,{href:"https://aider.chat",name:"aider",note:"AI-Pair-Programming im Terminal, git-nativ."}),v.jsx(Or,{href:"https://continue.dev",name:"Continue",note:"Open-Source-Autopilot für IDEs."})]})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("div",{className:"font-bold text-foreground flex items-center gap-1.5",children:[v.jsx(TT,{className:"h-3.5 w-3.5 text-amber-400"})," Lernen & Community"]}),v.jsxs("ul",{className:"list-disc pl-4 space-y-1.5",children:[v.jsx(Or,{href:"https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview",name:"Prompt-Engineering (Anthropic)",note:"die beste praktische Anleitung."}),v.jsx(Or,{href:"https://github.com/anthropics/anthropic-cookbook",name:"Anthropic Cookbook",note:"lauffähige Rezepte für Tools, RAG, Agenten."}),v.jsx(Or,{href:"https://www.promptingguide.ai",name:"Prompt Engineering Guide",note:"herstellerneutrales Nachschlagewerk."}),v.jsx(Or,{href:"https://github.com/mem0ai/mem0",name:"Mem0",note:"die auto-lernende Memory-Schicht hinter deinem Gedächtnis."}),v.jsx(Or,{href:"https://www.reddit.com/r/LocalLLaMA/",name:"r/LocalLLaMA",note:"der Puls der lokalen-LLM-Szene."})]})]})]})]}),v.jsx(mo,{id:"troubleshooting",icon:z8,color:"text-rose-400",title:"14. Troubleshooting",kicker:"Wenn's hakt",wide:!0,children:v.jsxs("ul",{className:"space-y-2 list-disc pl-4",children:[v.jsxs("li",{children:[v.jsx("strong",{children:"Keine Verbindung?"})," Selbes LAN wie die Box? IP/Port stimmen (",v.jsx(pn,{children:":9001"}),")? Backend-Status in der ",v.jsx("strong",{children:"Zentrale"})," prüfen."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Modell antwortet nicht / langsam?"})," In der ",v.jsx("strong",{children:"Zentrale → Dienste"})," schauen, ob ",v.jsx(pn,{children:"llama-swap"})," grün ist; sonst Restart. Erstes Token nach Swap dauert (Modell lädt)."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Agent dreht durch / halluziniert?"})," Frische Session im ",v.jsx("strong",{children:"Terminal"})," starten — meist ist es vollgemüllter Kontext."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Gedächtnis findet nichts?"})," Embedding-Dienst online? Semantisch suchen (Sinn statt exaktem Wort). Leeres Gedächtnis → Hermes-Onboarding starten."]}),v.jsxs("li",{children:[v.jsx("strong",{children:"Update hat etwas zerschossen?"})," Genau dafür gibt es Backup & ",v.jsx(pn,{children:"restore.sh"})," — den getesteten Restore fahren, dann Ursache suchen."]})]})})]}),v.jsx("p",{className:"text-center text-[10px] text-muted-foreground/50 pt-2",children:"Mission Control 2 · AI-Bibel · Stand Juni 2026 — lebendes Dokument, wächst mit dem Stack."})]})}function ySe({title:t,hint:e}){return v.jsxs("div",{className:"space-y-4",children:[v.jsxs("div",{children:[v.jsx("h1",{className:"text-xl font-semibold",children:t}),v.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),v.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card/50 py-20 text-center",children:[v.jsx(N8,{className:"h-8 w-8 text-muted-foreground"}),v.jsx("div",{className:"text-sm text-muted-foreground",children:"Kommt in einer späteren Phase."})]})]})}const Nj=[{id:"mission-control-2",label:"Mission Control",type:"user",reach:"gateway (integr"},{id:"hermes-gateway",label:"Hermes Gateway",type:"user",reach:"hermes-gateway"},{id:"mem0-service",label:"Mem0 (Gedächtnis)",type:"user",reach:"mem0"},{id:"hermes-terminal",label:"Hermes Terminal",type:"user",reach:"hermes-terminal"},{id:"llama-swap",label:"Llama Swap",type:"system",reach:"llama-swap"}];function D_({icon:t,iconClass:e,name:n,status:r,available:i,busy:s,actionLabel:o,onAction:a}){return v.jsxs("div",{className:nt("flex items-center gap-3 rounded-lg border px-3 py-2",i?"border-amber-500/30 bg-amber-500/5":"border-border/50 bg-background/20"),children:[v.jsx(t,{className:nt("h-4 w-4 shrink-0",e)}),v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:n}),v.jsx("div",{className:nt("text-[10px] truncate",i?"text-amber-400/90":"text-muted-foreground"),children:r})]}),v.jsx("button",{onClick:a,disabled:!i||s,className:nt("text-[11px] font-semibold rounded-lg px-2.5 py-1 transition-colors shrink-0",i?"bg-primary text-primary-foreground hover:opacity-90 cursor-pointer":"border border-border/50 text-muted-foreground/40 cursor-default"),children:s?"…":o})]})}function xSe({label:t,ok:e,system:n,busy:r,onRestart:i,onLogs:s}){return v.jsxs("div",{className:"flex items-center gap-2.5 rounded-lg border border-border/50 bg-background/20 px-3 py-2",children:[v.jsx("span",{className:nt("w-1.5 h-1.5 rounded-full shrink-0",e===!0?"bg-emerald-500":e===!1?"bg-red-500":"bg-muted-foreground/40")}),v.jsxs("span",{className:"flex-1 text-xs text-foreground truncate",children:[t,n&&v.jsx("span",{className:"text-[9px] text-muted-foreground",children:" (root)"})]}),v.jsx("button",{onClick:i,disabled:r,title:"Neu starten",className:"text-muted-foreground hover:text-primary transition-colors disabled:opacity-50",children:v.jsx(Hy,{className:nt("h-3.5 w-3.5",r&&"animate-spin")})}),v.jsx("button",{onClick:s,title:"Logs ansehen",className:"text-muted-foreground hover:text-primary transition-colors",children:v.jsx(k8,{className:"h-3.5 w-3.5"})})]})}function fT(t){return t==null?"":t>1024**3?`${(t/1024**3).toFixed(2)} GB`:`${(t/1024**2).toFixed(1)} MB`}function bSe({open:t,onClose:e,defaultTab:n="maintenance"}){var Be;const[r,i]=R.useState(null),[s,o]=R.useState([]),[a,l]=R.useState("llama-swap"),[c,d]=R.useState(""),[f,m]=R.useState(!1),[y,x]=R.useState(null),[S,w]=R.useState({}),[b,E]=R.useState("maintenance"),[T,C]=R.useState(!1),[O,N]=R.useState(""),[D,F]=R.useState(!1),[V,k]=R.useState(null),[j,H]=R.useState([]),[ne,J]=R.useState(!1),[de,oe]=R.useState(null);function he(le,Ce,lt){oe({type:"alert",title:le,message:Ce,onConfirm:()=>{oe(null),lt&<()}})}function B(le,Ce,lt){oe({type:"confirm",title:le,message:Ce,onConfirm:()=>{oe(null),lt()},onCancel:()=>oe(null)})}function K(le){return le?new Date(le*1e3).toLocaleString("de-DE",{day:"2-digit",month:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):"Nie"}const[q,$]=R.useState(""),[Z,ge]=R.useState(""),[ae,ce]=R.useState(!1),[we,Me]=R.useState(!1);R.useEffect(()=>{t&&($(localStorage.getItem("mc_sudo_password")||""),ge(localStorage.getItem("mc_hf_token")||""))},[t]),R.useEffect(()=>{t&&n&&E(n)},[t,n]);const $e=R.useRef(null);function Se(){jt("/api/maintenance/updates").then(i).catch(le=>console.error("Error loading updates",le))}function Ve(){jt("/api/jobs").then(le=>o(le.jobs||[])).catch(le=>console.error("Error loading jobs",le))}function Xe(){jt("/api/system/services").then(k).catch(()=>{})}function fe(){jt("/api/system/backups").then(le=>H(le.backups||[])).catch(()=>{})}function Q(le){m(!0),x(null),jt(`/api/maintenance/logs?service=${le}&lines=150`).then(Ce=>{Ce.ok?d(Ce.text):(d(`Fehler beim Laden der Logs: ${Ce.err||"Unbekannter Fehler"}`),(Ce.status==="incorrect_password"||Ce.status==="password_required")&&x(Ce.status))}).catch(Ce=>d(`Fehler: ${Ce.message}`)).finally(()=>{m(!1),setTimeout(()=>{$e.current&&($e.current.scrollTop=$e.current.scrollHeight)},50)})}R.useEffect(()=>{if(!t)return;Se(),Ve(),Xe(),fe();const le=setInterval(()=>{Ve(),Se(),Xe()},3e3);return()=>clearInterval(le)},[t]),R.useEffect(()=>{!t||b!=="logs"||Q(a)},[t,b,a]);async function Ge(){try{await jt("/api/maintenance/os-update",{method:"POST"}),Ve(),E("maintenance")}catch(le){he("Fehler",`Fehler beim Starten des OS-Updates: ${le.message}`)}}async function Ue(){try{await jt("/api/maintenance/engine-update",{method:"POST"}),Ve(),E("maintenance")}catch(le){he("Fehler",`Fehler beim Engine-Update: ${le.message}`)}}function We(){B("Hermes-Agent aktualisieren","Zieht die neuesten Änderungen aus git, installiert Abhängigkeiten neu und startet den Hermes-Gateway neu (vorher automatisches Backup). Fortschritt unter Hintergrund-Aufgaben.",async()=>{J(!0);try{await jt("/api/maintenance/hermes-update",{method:"POST"}),Ve()}catch(le){he("Fehler",`Hermes-Update fehlgeschlagen: ${le.message}`)}finally{J(!1)}})}async function Qe(){C(!0);try{await jt("/api/maintenance/check-updates",{method:"POST"}),Ve(),E("maintenance")}catch(le){he("Fehler",`Fehler bei der Update-Suche: ${le.message}`)}finally{C(!1)}}async function xt(le,Ce){try{await jt("/api/models/install",{method:"POST",body:JSON.stringify({repo:le,role:Ce})}),he("Gestartet",`Modell-Upgrade für '${Ce}' (${le}) gestartet.`),Ve(),E("maintenance")}catch(lt){he("Fehler",`Fehler beim Starten des Modell-Upgrades: ${lt.message}`)}}async function at(){B("Reboot bestätigen","Bist du sicher, dass du das gesamte Host-System neu starten willst?",async()=>{try{await jt("/api/maintenance/reboot",{method:"POST"}),he("Reboot","Reboot ausgelöst. System startet neu...",()=>{e()})}catch(le){he("Fehler",`Fehler beim Reboot: ${le.message}`)}})}async function te(){F(!0),N("Snapshot wird erzeugt...");try{const le=await jt("/api/system/backup",{method:"POST"});N(le.ok?`Snapshot erzeugt: ${le.snapshot} (${le.files.length} Komponenten)`:"Backup fehlgeschlagen."),fe()}catch(le){N(`Fehler: ${le.message}`)}finally{F(!1)}}async function W(le){w(Ce=>({...Ce,[le]:!0}));try{const Ce=await jt("/api/maintenance/restart",{method:"POST",body:JSON.stringify({service:le})});Ce.ok?he("Dienst neu gestartet",`Dienst ${le} wurde erfolgreich neu gestartet.`,()=>{b==="logs"&&a===le&&Q(le)}):he("Fehler",`Fehler beim Neustart: ${Ce.err||"Unbekannter Fehler"}`)}catch(Ce){he("Fehler",`Fehler beim Neustart: ${Ce.message}`)}finally{w(Ce=>({...Ce,[le]:!1}))}}async function Ee(le){try{await jt(`/api/jobs/${le}/cancel`,{method:"POST"}),Ve()}catch(Ce){he("Fehler",`Fehler beim Abbrechen: ${Ce.message}`)}}return v.jsxs(v.Fragment,{children:[v.jsx("div",{className:nt("fixed inset-0 bg-black/60 backdrop-blur-sm z-50 transition-opacity duration-300",t?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),onClick:e}),v.jsxs("div",{className:nt("fixed inset-y-0 right-0 w-full sm:w-[640px] bg-card/85 backdrop-blur-xl border-l border-border/60 shadow-2xl z-50 flex flex-col transform transition-transform duration-300 ease-in-out font-sans text-foreground",t?"translate-x-0":"translate-x-full"),children:[v.jsxs("div",{className:"flex h-16 shrink-0 items-center justify-between border-b border-border/40 px-6",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx(El,{className:"h-4.5 w-4.5 text-primary"}),v.jsx("h2",{className:"text-sm font-semibold tracking-wide uppercase font-space",children:"OS-Zentrale & Pflege"})]}),v.jsx("button",{onClick:e,className:"flex h-8 w-8 items-center justify-center rounded-lg border border-border/40 text-muted-foreground hover:bg-accent transition-colors",children:v.jsx(Bc,{className:"h-4 w-4"})})]}),v.jsxs("div",{className:"flex border-b border-border/40 px-6",children:[v.jsx("button",{onClick:()=>E("maintenance"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="maintenance"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Wartung"}),v.jsx("button",{onClick:()=>E("logs"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="logs"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"System-Logs"}),v.jsx("button",{onClick:()=>E("settings"),className:nt("flex-1 py-3 text-xs font-semibold uppercase tracking-wider border-b-2 text-center transition-all",b==="settings"?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:"Einstellungen"})]}),v.jsxs("div",{className:"flex-1 overflow-y-auto p-6 space-y-6",children:[b==="maintenance"&&v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"space-y-2.5",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Updates"}),v.jsxs("button",{onClick:Qe,disabled:T,className:"flex items-center gap-1 text-[10px] font-semibold text-primary hover:text-primary/80 transition-colors disabled:opacity-50",children:[v.jsx(Hy,{className:nt("h-3 w-3",T&&"animate-spin")})," Nach Updates suchen"]})]}),(r==null?void 0:r.last_check)&&v.jsxs("div",{className:"text-[9px] text-muted-foreground -mt-1",children:["Zuletzt gesucht: ",K(r.last_check)]}),v.jsxs("div",{className:"space-y-1.5",children:[v.jsx(D_,{icon:s0,iconClass:"text-cyan-400",name:"OS-Pakete (apt)",available:!!(r!=null&&r.os),status:r!=null&&r.os?`${r.os} verfügbar`:"aktuell",actionLabel:"Aktualisieren",onAction:Ge}),v.jsx(D_,{icon:xP,iconClass:"text-violet-400",name:"Engine (llama.cpp)",available:!!(r!=null&&r.engine),status:r!=null&&r.engine?"Update verfügbar":"aktuell",actionLabel:"Aktualisieren",onAction:Ue}),(()=>{var Ce;const le=(Ce=r==null?void 0:r.components)==null?void 0:Ce.find(lt=>lt.key==="hermes_agent");return v.jsx(D_,{icon:qc,iconClass:"text-amber-400",name:"Hermes-Agent",available:(le==null?void 0:le.update)===!0,busy:ne,status:(le==null?void 0:le.update)===!0?`Update: ${le.latest}`:(le==null?void 0:le.reachable)===!1?"offline":"aktuell",actionLabel:"Aktualisieren",onAction:We})})(),(Be=r==null?void 0:r.model_list)==null?void 0:Be.map(le=>v.jsx(D_,{icon:_8,iconClass:"text-emerald-400",name:`Modell · ${le.role}`,available:!0,status:le.title,actionLabel:"Upgrade",onAction:()=>xt(le.repo,le.role)},le.role))]})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Dienste"}),v.jsx("div",{className:"space-y-1.5",children:Nj.map(le=>{var Ce;return v.jsx(xSe,{label:le.label,system:le.type==="system",ok:(Ce=V==null?void 0:V.services.find(lt=>lt.name.toLowerCase().includes(le.reach)))==null?void 0:Ce.ok,busy:S[le.id],onRestart:()=>W(le.id),onLogs:()=>{l(le.id),E("logs")}},le.id)})})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Backup"}),v.jsxs("div",{className:"rounded-lg border border-border/50 bg-background/20 px-3 py-2.5 flex items-center gap-3",children:[v.jsxs("div",{className:"flex-1 min-w-0",children:[v.jsx("div",{className:"text-xs text-foreground truncate",children:j[0]?`Letztes: ${j[0].snapshot}`:"Noch kein Backup"}),v.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[j.length," Snapshots · Restore per CLI (restore.sh)"]})]}),v.jsxs("button",{onClick:te,disabled:D,className:"flex items-center gap-1.5 text-[11px] font-semibold rounded-lg px-2.5 py-1 bg-primary text-primary-foreground hover:opacity-90 transition-all cursor-pointer disabled:opacity-50 shrink-0",children:[v.jsx(w8,{className:nt("h-3.5 w-3.5",D&&"animate-pulse")})," Snapshot"]})]}),O&&v.jsx("div",{className:"text-[10px] font-mono text-primary bg-primary/5 p-2 rounded-lg border border-primary/20 break-all leading-normal",children:O})]}),v.jsxs("div",{className:"space-y-2.5",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-red-400/80",children:"Gefahrenzone"}),v.jsxs("button",{onClick:at,className:"flex w-full items-center gap-3 p-3 rounded-lg border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 text-red-400 transition-all text-left text-xs font-semibold",children:[v.jsx(Y8,{className:"h-4.5 w-4.5"}),v.jsxs("div",{children:[v.jsx("div",{children:"Host-System neu starten"}),v.jsx("div",{className:"text-[10px] text-red-400/80 font-normal",children:"Startet die ganze Box neu"})]})]})]}),v.jsxs("div",{className:"space-y-3",children:[v.jsxs("div",{className:"flex items-center justify-between",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Hintergrund-Aufgaben"}),v.jsxs("span",{className:"text-[10px] font-mono bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:[s.filter(le=>le.state==="running"||le.state==="queued").length," Aktiv"]})]}),v.jsx("div",{className:"space-y-3",children:s.length===0?v.jsx("div",{className:"text-xs text-muted-foreground border border-dashed border-border/60 rounded-xl p-6 text-center",children:"Aktuell keine aktiven Hintergrund-Jobs."}):s.map(le=>{const Ce=le.state==="running"||le.state==="queued";return v.jsxs("div",{className:nt("p-3 rounded-xl border transition-all duration-300",Ce?"border-primary/40 bg-primary/5 shadow-md shadow-primary/5":"border-border/40 bg-background/20 opacity-80"),children:[v.jsxs("div",{className:"flex items-start justify-between gap-3",children:[v.jsxs("div",{className:"space-y-1",children:[v.jsxs("div",{className:"text-xs font-semibold flex items-center gap-1.5",children:[Ce&&v.jsxs("span",{className:"flex h-2 w-2 relative",children:[v.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),v.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]}),le.label]}),v.jsxs("div",{className:"text-[10px] font-mono text-muted-foreground uppercase flex items-center gap-2",children:[v.jsxs("span",{children:["ID: ",le.id]}),v.jsx("span",{children:"•"}),v.jsx("span",{className:nt(le.state==="done"&&"text-emerald-400",le.state==="failed"&&"text-red-400",le.state==="running"&&"text-primary",le.state==="queued"&&"text-amber-400",le.state==="canceled"&&"text-muted-foreground"),children:le.state})]})]}),Ce&&v.jsx("button",{onClick:()=>Ee(le.id),className:"text-[10px] font-semibold text-red-400 hover:text-red-300 border border-red-500/20 bg-red-500/5 hover:bg-red-500/10 px-2 py-0.5 rounded transition-colors",children:"Abbrechen"})]}),le.state==="running"&&v.jsxs("div",{className:"mt-3 space-y-1",children:[v.jsx("div",{className:"w-full h-1.5 bg-muted rounded-full overflow-hidden",children:v.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${le.progress??0}%`}})}),v.jsxs("div",{className:"flex justify-between items-center text-[9px] font-mono text-muted-foreground",children:[v.jsxs("span",{children:[le.progress??0,"%"]}),le.done_bytes!=null&&le.total_bytes!=null&&v.jsxs("span",{children:[fT(le.done_bytes)," / ",fT(le.total_bytes),le.rate_bps!=null&&` (${fT(le.rate_bps)}/s)`]}),le.eta_s!=null&&v.jsxs("span",{children:["ETA: ",le.eta_s,"s"]})]})]})]},le.id)})})]})]}),b==="logs"&&v.jsxs("div",{className:"flex flex-col h-full space-y-4",children:[v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("select",{value:a,onChange:le=>l(le.target.value),className:"flex-1 h-9 px-3 text-xs bg-background/40 border border-border/60 rounded-lg outline-none text-foreground font-semibold",children:Nj.map(le=>v.jsxs("option",{value:le.id,children:[le.label," (",le.type==="system"?"systemd-root":"user",")"]},le.id))}),v.jsxs("button",{onClick:()=>W(a),disabled:S[a],className:"flex h-9 px-3 items-center gap-1.5 text-xs font-semibold rounded-lg border border-border/60 bg-background/20 hover:border-primary/50 transition-colors disabled:opacity-50",title:"Dienst neu starten",children:[v.jsx(Hy,{className:nt("h-3.5 w-3.5",S[a]&&"animate-spin")}),"Restart"]})]}),v.jsxs("div",{className:"flex-1 flex flex-col min-h-[300px] border border-border/60 bg-black/50 rounded-xl overflow-hidden shadow-inner",children:[v.jsxs("div",{className:"flex h-9 items-center justify-between px-4 border-b border-border/40 bg-black/30 shrink-0",children:[v.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] font-mono text-muted-foreground",children:[v.jsx(lF,{className:"h-3 w-3 text-primary"}),v.jsxs("span",{children:["stdout/stderr - ",a]})]}),v.jsx("button",{onClick:()=>Q(a),disabled:f,className:"text-muted-foreground hover:text-foreground transition-colors",children:v.jsx(Hy,{className:nt("h-3 w-3",f&&"animate-spin")})})]}),v.jsx("pre",{ref:$e,className:"flex-1 p-4 overflow-y-auto text-[10px] font-mono text-cyan-300/90 whitespace-pre-wrap select-text leading-relaxed scrollbar-thin",children:y==="password_required"||y==="incorrect_password"?v.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center h-full space-y-3",children:[v.jsx(xg,{className:"h-8 w-8 text-amber-400 animate-pulse animate-duration-1000"}),v.jsx("div",{className:"text-xs font-semibold text-amber-300",children:y==="incorrect_password"?"Falsches Sudo-Passwort hinterlegt.":"Sudo-Passwort für systemd-Dienste erforderlich."}),v.jsxs("p",{className:"text-[10px] text-muted-foreground max-w-xs leading-normal",children:["Für das Auslesen der systemd-Logs von ",a," werden Root-Rechte benötigt. Hinterlege dein Passwort in den Einstellungen."]}),v.jsx("button",{onClick:()=>E("settings"),className:"px-3 py-1.5 text-[10px] font-semibold text-primary-foreground bg-primary hover:bg-primary/95 rounded-md transition-colors mt-2",children:"Sudo-Passwort eintragen"})]}):f&&!c?v.jsx("span",{className:"text-muted-foreground",children:"Lade Logs..."}):c||v.jsx("span",{className:"text-muted-foreground",children:"Keine Logeinträge vorhanden."})})]})]}),b==="settings"&&v.jsxs("div",{className:"space-y-6",children:[v.jsxs("div",{className:"space-y-2",children:[v.jsx("h3",{className:"text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Zugangsdaten & Schlüssel"}),v.jsx("p",{className:"text-[10px] text-muted-foreground leading-normal",children:"Diese Daten werden ausschließlich lokal in deinem Browser (localStorage) gespeichert und bei Bedarf an das Backend übertragen."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(s0,{className:"h-4 w-4 text-amber-400"}),"Host Sudo-Passwort"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:ae?"text":"password",value:q,onChange:le=>$(le.target.value),placeholder:"Sudo-Passwort für System-Operationen",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>ce(!ae),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:ae?v.jsx(iI,{className:"h-4 w-4"}):v.jsx(RT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Wird benötigt für systemd-Dienste (Llama Swap logs/restart), OS-Update (apt) und Reboot."})]}),v.jsxs("div",{className:"space-y-2",children:[v.jsxs("label",{className:"text-xs font-semibold flex items-center gap-1.5",children:[v.jsx(U8,{className:"h-4 w-4 text-violet-400"}),"HuggingFace API Token"]}),v.jsxs("div",{className:"relative",children:[v.jsx("input",{type:we?"text":"password",value:Z,onChange:le=>ge(le.target.value),placeholder:"hf_...",className:"w-full h-10 pl-3 pr-10 text-xs bg-background/40 border border-border/60 rounded-lg outline-none focus:border-primary transition-colors text-foreground"}),v.jsx("button",{type:"button",onClick:()=>Me(!we),className:"absolute inset-y-0 right-0 flex items-center pr-3 text-muted-foreground hover:text-foreground transition-colors",children:we?v.jsx(iI,{className:"h-4 w-4"}):v.jsx(RT,{className:"h-4 w-4"})})]}),v.jsx("p",{className:"text-[9px] text-muted-foreground leading-normal",children:"Erlaubt das Herunterladen von geschützten oder Gate-restricted Modellen direkt über Mission Control."})]}),v.jsxs("div",{className:"flex gap-3 pt-2",children:[v.jsx("button",{onClick:()=>{localStorage.setItem("mc_sudo_password",q),localStorage.setItem("mc_hf_token",Z),he("Erfolgreich","Einstellungen erfolgreich lokal gespeichert.")},className:"flex-1 h-9 flex items-center justify-center text-xs font-semibold text-primary-foreground bg-primary hover:bg-primary/90 rounded-lg transition-colors shadow shadow-primary/10 cursor-pointer",children:"Speichern"}),v.jsx("button",{onClick:()=>{$(""),ge(""),localStorage.removeItem("mc_sudo_password"),localStorage.removeItem("mc_hf_token"),he("Gelöscht","Zugangsdaten gelöscht.")},className:"h-9 px-4 flex items-center justify-center text-xs font-semibold text-muted-foreground border border-border/60 bg-background/20 hover:bg-accent rounded-lg transition-colors cursor-pointer",children:"Zurücksetzen"})]})]})]})]}),de&&v.jsx(uV,{type:de.type,title:de.title,message:de.message,onConfirm:de.onConfirm,onCancel:de.onCancel})]})}function _Se(){var f,m,y,x,S;uX();const[t,e]=R.useState("dashboard"),[n,r]=R.useState(()=>localStorage.getItem("mc_sidebar_collapsed")==="true"),[i,s]=R.useState(!1),[o,a]=R.useState("maintenance"),{data:l}=g7(),{data:c}=Y1(2e4);R.useEffect(()=>{document.documentElement.classList.add("dark")},[]),R.useEffect(()=>{const w=b=>{var T;a(((T=b.detail)==null?void 0:T.tab)||"maintenance"),s(!0)};return window.addEventListener("open-system-drawer",w),()=>window.removeEventListener("open-system-drawer",w)},[]),R.useEffect(()=>{const w=b=>{var T;const E=(T=b.detail)==null?void 0:T.view;E&&e(E)};return window.addEventListener("mc-navigate",w),()=>window.removeEventListener("mc-navigate",w)},[]);const d=OT.find(w=>w.id===t);return v.jsxs("div",{className:"flex h-full relative",children:[v.jsxs("div",{className:"fixed inset-0 -z-50 pointer-events-none overflow-hidden bg-[hsl(224,30%,6%)]",children:[v.jsx("div",{className:"absolute inset-0 opacity-35 animate-aurora bg-gradient-to-tr from-teal-500/20 via-indigo-500/15 to-purple-500/20 blur-[130px]"}),v.jsx("div",{className:"absolute top-[-10%] left-[-10%] h-[50%] w-[50%] rounded-full bg-teal-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute bottom-[-10%] right-[-10%] h-[50%] w-[50%] rounded-full bg-purple-500/15 blur-[160px]"}),v.jsx("div",{className:"absolute top-[30%] right-[20%] h-[40%] w-[40%] rounded-full bg-indigo-500/10 blur-[140px]"})]}),v.jsx(p7,{onNavigate:e}),v.jsx(bSe,{open:i,onClose:()=>s(!1),defaultTab:o}),v.jsxs("aside",{className:nt("flex shrink-0 flex-col border-r border-border/40 bg-card/45 backdrop-blur-md transition-all duration-300 ease-in-out",n?"w-16":"w-60"),children:[v.jsxs("div",{className:nt("flex items-center py-4 border-b border-border/40 shrink-0",n?"flex-col gap-3 px-2":"justify-between px-5"),children:[v.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[v.jsx("div",{className:"h-7 w-7 rounded-lg bg-primary shadow-md shadow-primary/20 shrink-0"}),!n&&v.jsxs("div",{className:"leading-tight",children:[v.jsx("div",{className:"text-sm font-semibold tracking-wide font-space",children:"Mission Control"}),v.jsx("div",{className:"text-xs text-muted-foreground",children:"2.0"})]})]}),v.jsx("button",{onClick:()=>{r(w=>{const b=!w;return localStorage.setItem("mc_sidebar_collapsed",b.toString()),b})},className:"p-1 rounded-md hover:bg-accent text-muted-foreground transition-colors cursor-pointer",title:n?"Maximieren":"Minimieren",children:n?v.jsx(rF,{className:"h-4 w-4"}):v.jsx(M8,{className:"h-4 w-4"})})]}),v.jsx("nav",{className:"flex-1 space-y-1 px-3 py-4 overflow-y-auto",children:OT.map(w=>v.jsxs("button",{onClick:()=>e(w.id),className:nt("flex w-full items-center rounded-md text-sm transition-all cursor-pointer",n?"justify-center p-2.5":"gap-3 px-3 py-2",t===w.id?"bg-primary/15 text-primary shadow-sm shadow-primary/5":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),title:n?w.label:void 0,children:[v.jsx(w.icon,{className:"h-4.5 w-4.5 shrink-0"}),!n&&v.jsx("span",{className:"truncate",children:w.label})]},w.id))}),v.jsx("div",{className:nt("py-3 text-xs text-muted-foreground border-t border-border/40 shrink-0",n?"px-2 text-center":"px-5"),children:n?v.jsx("div",{className:"flex justify-center",children:v.jsx("span",{className:nt("h-2.5 w-2.5 rounded-full ring-2 ring-black/40",l?l.engine_reachable?"bg-emerald-500 animate-pulse":"bg-amber-500":"bg-red-500"),title:l?`Engine ${l.engine_reachable?"online":"offline"}`:"Backend offline"})}):v.jsxs("div",{className:"space-y-2 text-left",children:[l?v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:nt("h-2 w-2 rounded-full animate-pulse",l.engine_reachable?"bg-emerald-500":"bg-amber-500")}),v.jsxs("span",{className:"truncate",children:["Engine ",l.engine_reachable?"online":"offline"]})]}):v.jsxs("span",{className:"flex items-center gap-2",children:[v.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"})," ",v.jsx("span",{className:"truncate",children:"Backend offline"})]}),(c==null?void 0:c.versions)&&v.jsxs("div",{className:"space-y-1 text-[9px] text-muted-foreground/60 mt-2 pt-2 border-t border-border/30",children:[v.jsxs("div",{className:"truncate",title:c.versions.mc2?`${c.versions.mc2.branch}-${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""} (${c.versions.mc2.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"MC2:"})," ",c.versions.mc2?`${c.versions.mc2.hash}${c.versions.mc2.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:((f=c.versions.engine)==null?void 0:f.type)==="git"?`${c.versions.engine.branch}-${c.versions.engine.hash}${c.versions.engine.dirty?"*":""} (${c.versions.engine.date})`:((m=c.versions.engine)==null?void 0:m.version_text)||"unbekannt",children:[v.jsx("strong",{children:"Engine:"})," ",((y=c.versions.engine)==null?void 0:y.type)==="git"?`${c.versions.engine.hash}${c.versions.engine.dirty?"*":""}`:((S=(x=c.versions.engine)==null?void 0:x.version_text)==null?void 0:S.split(" ").pop())||"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_ui?`${c.versions.hermes_ui.branch}-${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""} (${c.versions.hermes_ui.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes UI:"})," ",c.versions.hermes_ui?`${c.versions.hermes_ui.hash}${c.versions.hermes_ui.dirty?"*":""}`:"—"]}),v.jsxs("div",{className:"truncate",title:c.versions.hermes_agent?`${c.versions.hermes_agent.branch}-${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""} (${c.versions.hermes_agent.date})`:"nicht gefunden",children:[v.jsx("strong",{children:"Hermes Agent:"})," ",c.versions.hermes_agent?`${c.versions.hermes_agent.hash}${c.versions.hermes_agent.dirty?"*":""}`:"—"]})]})]})})]}),v.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[v.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border/40 px-6 bg-card/20 backdrop-blur-sm",children:[v.jsx("div",{className:"text-xs font-medium text-muted-foreground tracking-wide uppercase font-sans",children:d.hint}),v.jsxs("div",{className:"flex items-center gap-2",children:[v.jsx("a",{href:"https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2/src/branch/main/docs/BEDIENUNG.md",target:"_blank",rel:"noopener",className:"flex h-8 items-center rounded-md border border-border/40 bg-background/40 px-2.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer font-semibold",title:"Bedien-Anleitung",children:"Hilfe"}),v.jsxs("button",{onClick:()=>{const w=new KeyboardEvent("keydown",{key:"k",metaKey:!0});document.dispatchEvent(w)},className:"flex items-center gap-2 rounded-md border border-border/40 bg-background/40 px-2.5 py-1.5 text-xs text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all cursor-pointer",children:[v.jsx(R8,{className:"h-3.5 w-3.5"}),v.jsx("span",{children:"Suchen"}),v.jsx("kbd",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-[9px]",children:"⌘K"})]})]})]}),v.jsxs("main",{className:"flex-1 overflow-y-auto p-6 scrollbar-thin",children:[t==="dashboard"&&v.jsx(kfe,{}),t==="models"&&v.jsx(zfe,{}),t==="connect"&&v.jsx(Hfe,{}),t==="memory"&&v.jsx(Kfe,{}),t==="agent"&&v.jsx(Yfe,{}),t==="terminal"&&v.jsx(Zfe,{}),t==="voice"&&v.jsx(mSe,{}),t==="guide"&&v.jsx(vSe,{}),!["dashboard","models","connect","memory","agent","terminal","voice","guide"].includes(t)&&v.jsx(ySe,{title:d.label,hint:d.hint})]})]})]})}const wSe=new i8({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1,staleTime:5e3}}});IW.createRoot(document.getElementById("root")).render(v.jsx(Hj.StrictMode,{children:v.jsx(s8,{client:wSe,children:v.jsx(_Se,{})})}));export{Zt as B,fx as F,Hj as R,Vm as S,kT as T,X as V,iP as _,Qt as a,R as b,Km as c,lbe as d,SG as e,NW as f,B1 as g,v as h,t9 as i,Nbe as j,mz as l,Wh as r,Gbe as u}; diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 8fddf55..7faf223 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -7,8 +7,8 @@ Mission Control 2.0 - - + +
diff --git a/frontend/src/components/voice/Avatar3D.tsx b/frontend/src/components/voice/Avatar3D.tsx index ba9857f..7dced2d 100644 --- a/frontend/src/components/voice/Avatar3D.tsx +++ b/frontend/src/components/voice/Avatar3D.tsx @@ -11,21 +11,49 @@ import type { Emotion } from "@/lib/voice/sentiment" type LevelRef = MutableRefObject<{ current: number }> // audioLevel.current.current = Pegel 0..1 type EmotionRef = MutableRefObject -// VRMs laden in T-Pose (Bindepose, Arme waagerecht). Wir senken Ober-/Unterarme auf den -// normalisierten Humanoid-Knoten zu einer ruhigen A-Pose ab — sieht sofort natürlich aus. -// (Echte Idle-Animation wäre die spätere Stufe.) +// Ruhepose (A-Pose) als Basis — VRMs laden sonst in T-Pose (Arme waagerecht). +const REST: Record = { + leftUpperArm: [0, 0, 1.2], + rightUpperArm: [0, 0, -1.2], + leftLowerArm: [0, -0.2, 0], + rightLowerArm: [0, 0.2, 0], +} + +function setBone(vrm: VRM, name: string, x: number, y: number, z: number) { + const b = vrm.humanoid?.getNormalizedBoneNode(name as any) + if (b) b.rotation.set(x, y, z) +} + function applyRestPose(vrm: VRM) { - const set = (name: any, x: number, y: number, z: number) => { - const b = vrm.humanoid?.getNormalizedBoneNode(name) - if (b) b.rotation.set(x, y, z) - } - set("leftUpperArm", 0, 0, 1.2) // Arm runter an die Seite - set("rightUpperArm", 0, 0, -1.2) - set("leftLowerArm", 0, -0.2, 0) // leichte Beugung - set("rightLowerArm", 0, 0.2, 0) + for (const [name, r] of Object.entries(REST)) setBone(vrm, name, r[0], r[1], r[2]) vrm.humanoid?.update() } +// Lebendige Idle-Animation: prozedural (kein Animations-File). Atmung, langsames Wiegen, +// Kopf-/Blickbewegung und Arm-Pendeln werden überlagert; beim Sprechen (level) nickt der Kopf +// stärker, damit der Avatar „mitgeht". Wird jede Frame über die Ruhepose gelegt. +function applyIdle(vrm: VRM, t: number, level: number) { + const breathe = Math.sin(t * 1.7) // ~0.27 Hz Atmung + const sway = Math.sin(t * 0.5) + const emphasis = Math.min(1, level * 1.4) + + // Rumpf — Atmung + sanftes Wiegen + setBone(vrm, "spine", breathe * 0.025, sway * 0.03, Math.sin(t * 0.43) * 0.015) + setBone(vrm, "chest", breathe * 0.02, sway * 0.02, 0) + setBone(vrm, "hips", 0, Math.sin(t * 0.37) * 0.02, Math.sin(t * 0.29) * 0.01) + + // Kopf/Hals — langsamer Blick + Atmung + Sprech-Nicken + setBone(vrm, "neck", Math.sin(t * 0.8) * 0.03 + emphasis * 0.06, Math.sin(t * 0.31) * 0.05, 0) + setBone(vrm, "head", Math.sin(t * 0.6) * 0.025 + emphasis * 0.05, Math.sin(t * 0.27) * 0.06, Math.sin(t * 0.5) * 0.02) + + // Arme — Ruhepose + leichtes Pendeln + const arm = Math.sin(t * 0.8) * 0.04 + setBone(vrm, "leftUpperArm", 0, 0, 1.2 + arm) + setBone(vrm, "rightUpperArm", 0, 0, -1.2 - arm) + setBone(vrm, "leftLowerArm", 0, -0.2 - Math.sin(t * 0.8) * 0.03, 0) + setBone(vrm, "rightLowerArm", 0, 0.2 + Math.sin(t * 0.8) * 0.03, 0) +} + const EXPRESSIONS = ["happy", "angry", "sad", "surprised", "relaxed"] as const const EMO_TO_EXPR: Record = { neutral: null, happy: "happy", angry: "angry", sad: "sad", surprised: "surprised", relaxed: "relaxed", @@ -66,12 +94,16 @@ function VrmModel({ url, audioLevel, emotion, onError }: { } }, [url, onError]) - useFrame((_, delta) => { + useFrame((state, delta) => { if (!vrm) return + const target = audioLevel.current?.current ?? 0 + + // Lebendige Idle-/Sprech-Bewegung (über die Ruhepose gelegt). + applyIdle(vrm, state.clock.elapsedTime, target) + const em = vrm.expressionManager if (em) { // Lippensync: 'aa' folgt geglättet dem Audiopegel. - const target = audioLevel.current?.current ?? 0 const aa = (smooth.current.aa ?? 0) * 0.4 + target * 0.6 smooth.current.aa = aa em.setValue("aa", aa)