diff --git a/assets/index-1d7f1b78.js b/assets/index-1d7f1b78.js new file mode 100644 index 0000000..c09302f --- /dev/null +++ b/assets/index-1d7f1b78.js @@ -0,0 +1,4910 @@ +import{r as $,g as ps,R as f_,c as nP,j as Ne,B as iP}from"./index-4a90bf6b.js";const rP=new Worker(new URL("/assets/script-8e2076e1.js",self.location),{type:"module"});/** + * @license + * Copyright 2010-2023 Three.js Authors + * SPDX-License-Identifier: MIT + */const Wl="154",iC={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},sP={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},rC=0,O5=1,sC=2,aP=3,aC=0,b2=1,jd=2,sa=3,$a=0,Ki=1,$n=2,oP=2,Kt=0,Ha=1,dp=2,F5=3,k5=4,pp=5,ss=100,oC=101,lC=102,N5=103,G5=104,Hh=200,cC=201,uC=202,hC=203,gp=204,mp=205,I2=206,fC=207,M2=208,dC=209,pC=210,gC=0,mC=1,AC=2,Rm=3,vC=4,yC=5,xC=6,_C=7,a0=0,EC=1,SC=2,os=0,wC=1,CC=2,TC=3,v6=4,bC=5,R2=300,Fl=301,kl=302,Ap=303,vp=304,of=306,Qo=1e3,oi=1001,yp=1002,Rt=1003,Bm=1004,lP=1004,Kd=1005,cP=1005,Tn=1006,y6=1007,uP=1007,Ja=1008,hP=1008,Ri=1009,IC=1010,MC=1011,Au=1012,x6=1013,Oo=1014,br=1015,Ai=1016,_6=1017,E6=1018,ko=1020,RC=1021,li=1023,S6=1024,BC=1025,Bl=1026,Nl=1027,Qc=1028,w6=1029,wh=1030,C6=1031,T6=1033,Ph=33776,lm=33777,cm=33778,Lh=33779,xp=35840,z5=35841,_p=35842,Q5=35843,B2=36196,Ep=37492,Sp=37496,wp=37808,H5=37809,V5=37810,W5=37811,Y5=37812,q5=37813,X5=37814,j5=37815,K5=37816,$5=37817,J5=37818,Z5=37819,ey=37820,ty=37821,Uh=36492,DC=36283,ny=36284,iy=36285,ry=36286,PC=2200,LC=2201,UC=2202,Cp=2300,Tp=2301,um=2302,Hc=2400,Vc=2401,bp=2402,D2=2500,b6=2501,fP=0,dP=1,pP=2,I6=3e3,Dl=3001,OC=3200,P2=3201,Yl=0,FC=1,Pl="",Nt="srgb",fa="srgb-linear",M6="display-p3",gP=0,hm=7680,mP=7681,AP=7682,vP=7683,yP=34055,xP=34056,_P=5386,EP=512,SP=513,wP=514,CP=515,TP=516,bP=517,IP=518,kC=519,NC=512,GC=513,zC=514,QC=515,HC=516,VC=517,WC=518,YC=519,Ip=35044,fm=35048,MP=35040,RP=35045,BP=35049,DP=35041,PP=35046,LP=35050,UP=35042,OP="100",sy="300 es",Dm=1035,za=2e3,Mp=2001;let Yo=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s>8&255]+ar[n>>16&255]+ar[n>>24&255]+"-"+ar[e&255]+ar[e>>8&255]+"-"+ar[e>>16&15|64]+ar[e>>24&255]+"-"+ar[t&63|128]+ar[t>>8&255]+"-"+ar[t>>16&255]+ar[t>>24&255]+ar[i&255]+ar[i>>8&255]+ar[i>>16&255]+ar[i>>24&255]).toLowerCase()}function si(n,e,t){return Math.max(e,Math.min(t,n))}function R6(n,e){return(n%e+e)%e}function FP(n,e,t,i,r){return i+(n-e)*(r-i)/(t-e)}function kP(n,e,t){return n!==e?(t-n)/(e-n):0}function $d(n,e,t){return(1-t)*n+t*e}function NP(n,e,t,i){return $d(n,e,1-Math.exp(-t*i))}function GP(n,e=1){return e-Math.abs(R6(n,e*2)-e)}function zP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function QP(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function HP(n,e){return n+Math.floor(Math.random()*(e-n+1))}function VP(n,e){return n+Math.random()*(e-n)}function WP(n){return n*(.5-Math.random())}function YP(n){n!==void 0&&(d_=n);let e=d_+=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 qP(n){return n*jc}function XP(n){return n*Vh}function ay(n){return(n&n-1)===0&&n!==0}function qC(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Pm(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function jP(n,e,t,i,r){const s=Math.cos,a=Math.sin,o=s(t/2),l=a(t/2),c=s((e+i)/2),u=a((e+i)/2),h=s((e-i)/2),f=a((e-i)/2),p=s((i-e)/2),m=a((i-e)/2);switch(r){case"XYX":n.set(o*u,l*h,l*f,o*c);break;case"YZY":n.set(l*f,o*u,l*h,o*c);break;case"ZXZ":n.set(l*h,l*f,o*u,o*c);break;case"XZX":n.set(o*u,l*m,l*p,o*c);break;case"YXY":n.set(l*p,o*u,l*m,o*c);break;case"ZYZ":n.set(l*m,l*p,o*u,o*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}}function as(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Wt(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Ll={DEG2RAD:jc,RAD2DEG:Vh,generateUUID:ls,clamp:si,euclideanModulo:R6,mapLinear:FP,inverseLerp:kP,lerp:$d,damp:NP,pingpong:GP,smoothstep:zP,smootherstep:QP,randInt:HP,randFloat:VP,randFloatSpread:WP,seededRandom:YP,degToRad:qP,radToDeg:XP,isPowerOfTwo:ay,ceilPowerOfTwo:qC,floorPowerOfTwo:Pm,setQuaternionFromProperEuler:jP,normalize:Wt,denormalize:as};class _e{constructor(e=0,t=0){_e.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,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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 i=this.dot(e)/t;return Math.acos(si(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,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 i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*i-a*r+e.x,this.y=s*r+a*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Qt{constructor(e,t,i,r,s,a,o,l,c){Qt.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,a,o,l,c)}set(e,t,i,r,s,a,o,l,c){const u=this.elements;return u[0]=e,u[1]=r,u[2]=o,u[3]=t,u[4]=s,u[5]=l,u[6]=i,u[7]=a,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.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 i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[3],l=i[6],c=i[1],u=i[4],h=i[7],f=i[2],p=i[5],m=i[8],y=r[0],v=r[3],A=r[6],_=r[1],x=r[4],E=r[7],w=r[2],I=r[5],T=r[8];return s[0]=a*y+o*_+l*w,s[3]=a*v+o*x+l*I,s[6]=a*A+o*E+l*T,s[1]=c*y+u*_+h*w,s[4]=c*v+u*x+h*I,s[7]=c*A+u*E+h*T,s[2]=f*y+p*_+m*w,s[5]=f*v+p*x+m*I,s[8]=f*A+p*E+m*T,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],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8];return t*a*u-t*o*c-i*s*u+i*o*l+r*s*c-r*a*l}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=u*a-o*c,f=o*l-u*s,p=c*s-a*l,m=t*h+i*f+r*p;if(m===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/m;return e[0]=h*y,e[1]=(r*c-u*i)*y,e[2]=(o*i-r*a)*y,e[3]=f*y,e[4]=(u*t-r*l)*y,e[5]=(r*s-o*t)*y,e[6]=p*y,e[7]=(i*l-c*t)*y,e[8]=(a*t-i*s)*y,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,i,r,s,a,o){const l=Math.cos(s),c=Math.sin(s);return this.set(i*l,i*c,-i*(l*a+c*o)+a+e,-r*c,r*l,-r*(-c*a+l*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(qA.makeScale(e,t)),this}rotate(e){return this.premultiply(qA.makeRotation(-e)),this}translate(e,t){return this.premultiply(qA.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),i=Math.sin(e);return this.set(t,-i,0,i,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,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const qA=new Qt;function XC(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}const KP={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function Ch(n,e){return new KP[n](e)}function Rp(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}const p_={};function Jd(n){n in p_||(p_[n]=!0,console.warn(n))}function Oh(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function XA(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const $P=new Qt().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),JP=new Qt().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function ZP(n){return n.convertSRGBToLinear().applyMatrix3(JP)}function eL(n){return n.applyMatrix3($P).convertLinearToSRGB()}const tL={[fa]:n=>n,[Nt]:n=>n.convertSRGBToLinear(),[M6]:ZP},nL={[fa]:n=>n,[Nt]:n=>n.convertLinearToSRGB(),[M6]:eL},Ds={enabled:!0,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(n){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!n},get workingColorSpace(){return fa},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const i=tL[e],r=nL[t];if(i===void 0||r===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}};let Qu;class B6{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Qu===void 0&&(Qu=Rp("canvas")),Qu.width=e.width,Qu.height=e.height;const i=Qu.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=Qu}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=Rp("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let a=0;a0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==R2)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Qo:e.x=e.x-Math.floor(e.x);break;case oi:e.x=e.x<0?0:1;break;case yp: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 Qo:e.y=e.y-Math.floor(e.y);break;case oi:e.y=e.y<0?0:1;break;case yp: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 Jd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===Nt?Dl:I6}set encoding(e){Jd("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=e===Dl?Nt:Pl}}Vn.DEFAULT_IMAGE=null;Vn.DEFAULT_MAPPING=R2;Vn.DEFAULT_ANISOTROPY=1;class jt{constructor(e=0,t=0,i=0,r=1){jt.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,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,i=this.y,r=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*i+a[8]*r+a[12]*s,this.y=a[1]*t+a[5]*i+a[9]*r+a[13]*s,this.z=a[2]*t+a[6]*i+a[10]*r+a[14]*s,this.w=a[3]*t+a[7]*i+a[11]*r+a[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,i,r,s;const l=e.elements,c=l[0],u=l[4],h=l[8],f=l[1],p=l[5],m=l[9],y=l[2],v=l[6],A=l[10];if(Math.abs(u-f)<.01&&Math.abs(h-y)<.01&&Math.abs(m-v)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+y)<.1&&Math.abs(m+v)<.1&&Math.abs(c+p+A-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,E=(p+1)/2,w=(A+1)/2,I=(u+f)/4,T=(h+y)/4,M=(m+v)/4;return x>E&&x>w?x<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(x),r=I/i,s=T/i):E>w?E<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(E),i=I/r,s=M/r):w<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(w),i=T/s,r=M/s),this.set(i,r,s,t),this}let _=Math.sqrt((v-m)*(v-m)+(h-y)*(h-y)+(f-u)*(f-u));return Math.abs(_)<.001&&(_=1),this.x=(v-m)/_,this.y=(h-y)/_,this.z=(f-u)/_,this.w=Math.acos((c+p+A-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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this.w=e.w+(t.w-e.w)*i,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,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 Dn extends Yo{constructor(e=1,t=1,i={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new jt(0,0,e,t),this.scissorTest=!1,this.viewport=new jt(0,0,e,t);const r={width:e,height:t,depth:1};i.encoding!==void 0&&(Jd("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),i.colorSpace=i.encoding===Dl?Nt:Pl),this.texture=new Vn(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=i.generateMipmaps!==void 0?i.generateMipmaps:!1,this.texture.internalFormat=i.internalFormat!==void 0?i.internalFormat:null,this.texture.minFilter=i.minFilter!==void 0?i.minFilter:Tn,this.depthBuffer=i.depthBuffer!==void 0?i.depthBuffer:!0,this.stencilBuffer=i.stencilBuffer!==void 0?i.stencilBuffer:!1,this.depthTexture=i.depthTexture!==void 0?i.depthTexture:null,this.samples=i.samples!==void 0?i.samples:0}setSize(e,t,i=1){(this.width!==e||this.height!==t||this.depth!==i)&&(this.width=e,this.height=t,this.depth=i,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=i,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 Wc(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 L2 extends Vn{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=oi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class sL extends Dn{constructor(e=1,t=1,i=1){super(e,t),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new L2(null,e,t,i),this.texture.isRenderTargetTexture=!0}}let D6=class extends Vn{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Rt,this.minFilter=Rt,this.wrapR=oi,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};class aL extends Dn{constructor(e=1,t=1,i=1){super(e,t),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new D6(null,e,t,i),this.texture.isRenderTargetTexture=!0}}class oL extends Dn{constructor(e=1,t=1,i=1,r={}){super(e,t,r),this.isWebGLMultipleRenderTargets=!0;const s=this.texture;this.texture=[];for(let a=0;a=0?1:-1,x=1-A*A;if(x>Number.EPSILON){const w=Math.sqrt(x),I=Math.atan2(w,A*_);v=Math.sin(v*I)/w,o=Math.sin(o*I)/w}const E=o*_;if(l=l*v+f*E,c=c*v+p*E,u=u*v+m*E,h=h*v+y*E,v===1-o){const w=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=w,c*=w,u*=w,h*=w}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,a){const o=i[r],l=i[r+1],c=i[r+2],u=i[r+3],h=s[a],f=s[a+1],p=s[a+2],m=s[a+3];return e[t]=o*m+u*h+l*p-c*f,e[t+1]=l*m+u*f+c*h-o*p,e[t+2]=c*m+u*p+o*f-l*h,e[t+3]=u*m-o*h-l*f-c*p,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,i,r){return this._x=e,this._y=t,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){const i=e._x,r=e._y,s=e._z,a=e._order,o=Math.cos,l=Math.sin,c=o(i/2),u=o(r/2),h=o(s/2),f=l(i/2),p=l(r/2),m=l(s/2);switch(a){case"XYZ":this._x=f*u*h+c*p*m,this._y=c*p*h-f*u*m,this._z=c*u*m+f*p*h,this._w=c*u*h-f*p*m;break;case"YXZ":this._x=f*u*h+c*p*m,this._y=c*p*h-f*u*m,this._z=c*u*m-f*p*h,this._w=c*u*h+f*p*m;break;case"ZXY":this._x=f*u*h-c*p*m,this._y=c*p*h+f*u*m,this._z=c*u*m+f*p*h,this._w=c*u*h-f*p*m;break;case"ZYX":this._x=f*u*h-c*p*m,this._y=c*p*h+f*u*m,this._z=c*u*m-f*p*h,this._w=c*u*h+f*p*m;break;case"YZX":this._x=f*u*h+c*p*m,this._y=c*p*h+f*u*m,this._z=c*u*m-f*p*h,this._w=c*u*h-f*p*m;break;case"XZY":this._x=f*u*h-c*p*m,this._y=c*p*h-f*u*m,this._z=c*u*m+f*p*h,this._w=c*u*h+f*p*m;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],r=t[4],s=t[8],a=t[1],o=t[5],l=t[9],c=t[2],u=t[6],h=t[10],f=i+o+h;if(f>0){const p=.5/Math.sqrt(f+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(a-r)*p}else if(i>o&&i>h){const p=2*Math.sqrt(1+i-o-h);this._w=(u-l)/p,this._x=.25*p,this._y=(r+a)/p,this._z=(s+c)/p}else if(o>h){const p=2*Math.sqrt(1+o-i-h);this._w=(s-c)/p,this._x=(r+a)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-i-o);this._w=(a-r)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*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=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(si(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const r=Math.min(1,t/i);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,r=e._y,s=e._z,a=e._w,o=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+a*o+r*c-s*l,this._y=r*u+a*l+s*o-i*c,this._z=s*u+a*c+i*l-r*o,this._w=a*u-i*o-r*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,r=this._y,s=this._z,a=this._w;let o=a*e._w+i*e._x+r*e._y+s*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=i,this._y=r,this._z=s,this;const l=1-o*o;if(l<=Number.EPSILON){const p=1-t;return this._w=p*a+t*this._w,this._x=p*i+t*this._x,this._y=p*r+t*this._y,this._z=p*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,f=Math.sin(t*u)/c;return this._w=a*h+this._w*f,this._x=i*h+this._x*f,this._y=r*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),r=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(r),i*Math.sin(s),i*Math.cos(s),t*Math.sin(r))}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 N{constructor(e=0,t=0,i=0){N.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,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(g_.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(g_.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,r=this.z,s=e.elements,a=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*a,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*a,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*a,this}applyQuaternion(e){const t=this.x,i=this.y,r=this.z,s=e.x,a=e.y,o=e.z,l=e.w,c=l*t+a*r-o*i,u=l*i+o*t-s*r,h=l*r+s*i-a*t,f=-s*t-a*i-o*r;return this.x=c*l+f*-s+u*-o-h*-a,this.y=u*l+f*-a+h*-s-c*-o,this.z=h*l+f*-o+c*-a-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,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,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 i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,r=e.y,s=e.z,a=t.x,o=t.y,l=t.z;return this.x=r*l-s*o,this.y=s*a-i*l,this.z=i*o-r*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return KA.copy(this).projectOnVector(e),this.sub(KA)}reflect(e){return this.sub(KA.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 i=this.dot(e)/t;return Math.acos(si(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,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(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,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,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const KA=new N,g_=new $i;class gs{constructor(e=new N(1/0,1/0,1/0),t=new N(-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,i=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,Eo),Eo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(qf),N3.subVectors(this.max,qf),Vu.subVectors(e.a,qf),Wu.subVectors(e.b,qf),Yu.subVectors(e.c,qf),hl.subVectors(Wu,Vu),fl.subVectors(Yu,Wu),vc.subVectors(Vu,Yu);let t=[0,-hl.z,hl.y,0,-fl.z,fl.y,0,-vc.z,vc.y,hl.z,0,-hl.x,fl.z,0,-fl.x,vc.z,0,-vc.x,-hl.y,hl.x,0,-fl.y,fl.x,0,-vc.y,vc.x,0];return!$A(t,Vu,Wu,Yu,N3)||(t=[1,0,0,0,1,0,0,0,1],!$A(t,Vu,Wu,Yu,N3))?!1:(G3.crossVectors(hl,fl),t=[G3.x,G3.y,G3.z],$A(t,Vu,Wu,Yu,N3))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Eo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Eo).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:(_o[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),_o[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),_o[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),_o[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),_o[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),_o[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),_o[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),_o[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(_o),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 _o=[new N,new N,new N,new N,new N,new N,new N,new N],Eo=new N,Hu=new gs,Vu=new N,Wu=new N,Yu=new N,hl=new N,fl=new N,vc=new N,qf=new N,N3=new N,G3=new N,yc=new N;function $A(n,e,t,i,r){for(let s=0,a=n.length-3;s<=a;s+=3){yc.fromArray(n,s);const o=r.x*Math.abs(yc.x)+r.y*Math.abs(yc.y)+r.z*Math.abs(yc.z),l=e.dot(yc),c=t.dot(yc),u=i.dot(yc);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>o)return!1}return!0}const lL=new gs,Xf=new N,JA=new N;let ms=class{constructor(e=new N,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):lL.setFromPoints(e).getCenter(i);let r=0;for(let s=0,a=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;Xf.subVectors(e,this.center);const t=Xf.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(Xf,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(JA.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Xf.copy(e.center).add(JA)),this.expandByPoint(Xf.copy(e.center).sub(JA))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}};const So=new N,ZA=new N,z3=new N,dl=new N,ev=new N,Q3=new N,tv=new N;class lf{constructor(e=new N,t=new N(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,So)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=So.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(So.copy(this.origin).addScaledVector(this.direction,t),So.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){ZA.copy(e).add(t).multiplyScalar(.5),z3.copy(t).sub(e).normalize(),dl.copy(this.origin).sub(ZA);const s=e.distanceTo(t)*.5,a=-this.direction.dot(z3),o=dl.dot(this.direction),l=-dl.dot(z3),c=dl.lengthSq(),u=Math.abs(1-a*a);let h,f,p,m;if(u>0)if(h=a*l-o,f=a*o-l,m=s*u,h>=0)if(f>=-m)if(f<=m){const y=1/u;h*=y,f*=y,p=h*(h+a*f+2*o)+f*(a*h+f+2*l)+c}else f=s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f=-s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;else f<=-m?(h=Math.max(0,-(-a*s+o)),f=h>0?-s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c):f<=m?(h=0,f=Math.min(Math.max(-s,-l),s),p=f*(f+2*l)+c):(h=Math.max(0,-(a*s+o)),f=h>0?s:Math.min(Math.max(-s,-l),s),p=-h*h+f*(f+2*l)+c);else f=a>0?-s:s,h=Math.max(0,-(a*f+o)),p=-h*h+f*(f+2*l)+c;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ZA).addScaledVector(z3,f),p}intersectSphere(e,t){So.subVectors(e.center,this.origin);const i=So.dot(this.direction),r=So.dot(So)-i*i,s=e.radius*e.radius;if(r>s)return null;const a=Math.sqrt(s-r),o=i-a,l=i+a;return l<0?null:o<0?this.at(l,t):this.at(o,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 i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,a,o,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return c>=0?(i=(e.min.x-f.x)*c,r=(e.max.x-f.x)*c):(i=(e.max.x-f.x)*c,r=(e.min.x-f.x)*c),u>=0?(s=(e.min.y-f.y)*u,a=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,a=(e.min.y-f.y)*u),i>a||s>r||((s>i||isNaN(i))&&(i=s),(a=0?(o=(e.min.z-f.z)*h,l=(e.max.z-f.z)*h):(o=(e.max.z-f.z)*h,l=(e.min.z-f.z)*h),i>l||o>r)||((o>i||i!==i)&&(i=o),(l=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,So)!==null}intersectTriangle(e,t,i,r,s){ev.subVectors(t,e),Q3.subVectors(i,e),tv.crossVectors(ev,Q3);let a=this.direction.dot(tv),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;dl.subVectors(this.origin,e);const l=o*this.direction.dot(Q3.crossVectors(dl,Q3));if(l<0)return null;const c=o*this.direction.dot(ev.cross(dl));if(c<0||l+c>a)return null;const u=-o*dl.dot(tv);return u<0?null:this.at(u/a,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,t,i,r,s,a,o,l,c,u,h,f,p,m,y,v){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,t,i,r,s,a,o,l,c,u,h,f,p,m,y,v)}set(e,t,i,r,s,a,o,l,c,u,h,f,p,m,y,v){const A=this.elements;return A[0]=e,A[4]=t,A[8]=i,A[12]=r,A[1]=s,A[5]=a,A[9]=o,A[13]=l,A[2]=c,A[6]=u,A[10]=h,A[14]=f,A[3]=p,A[7]=m,A[11]=y,A[15]=v,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 t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[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,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,r=1/qu.setFromMatrixColumn(e,0).length(),s=1/qu.setFromMatrixColumn(e,1).length(),a=1/qu.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,t[7]=0,t[8]=i[8]*a,t[9]=i[9]*a,t[10]=i[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,r=e.y,s=e.z,a=Math.cos(i),o=Math.sin(i),l=Math.cos(r),c=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){const f=a*u,p=a*h,m=o*u,y=o*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+m*c,t[5]=f-y*c,t[9]=-o*l,t[2]=y-f*c,t[6]=m+p*c,t[10]=a*l}else if(e.order==="YXZ"){const f=l*u,p=l*h,m=c*u,y=c*h;t[0]=f+y*o,t[4]=m*o-p,t[8]=a*c,t[1]=a*h,t[5]=a*u,t[9]=-o,t[2]=p*o-m,t[6]=y+f*o,t[10]=a*l}else if(e.order==="ZXY"){const f=l*u,p=l*h,m=c*u,y=c*h;t[0]=f-y*o,t[4]=-a*h,t[8]=m+p*o,t[1]=p+m*o,t[5]=a*u,t[9]=y-f*o,t[2]=-a*c,t[6]=o,t[10]=a*l}else if(e.order==="ZYX"){const f=a*u,p=a*h,m=o*u,y=o*h;t[0]=l*u,t[4]=m*c-p,t[8]=f*c+y,t[1]=l*h,t[5]=y*c+f,t[9]=p*c-m,t[2]=-c,t[6]=o*l,t[10]=a*l}else if(e.order==="YZX"){const f=a*l,p=a*c,m=o*l,y=o*c;t[0]=l*u,t[4]=y-f*h,t[8]=m*h+p,t[1]=h,t[5]=a*u,t[9]=-o*u,t[2]=-c*u,t[6]=p*h+m,t[10]=f-y*h}else if(e.order==="XZY"){const f=a*l,p=a*c,m=o*l,y=o*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=f*h+y,t[5]=a*u,t[9]=p*h-m,t[2]=m*h-p,t[6]=o*u,t[10]=y*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(cL,e,uL)}lookAt(e,t,i){const r=this.elements;return ns.subVectors(e,t),ns.lengthSq()===0&&(ns.z=1),ns.normalize(),pl.crossVectors(i,ns),pl.lengthSq()===0&&(Math.abs(i.z)===1?ns.x+=1e-4:ns.z+=1e-4,ns.normalize(),pl.crossVectors(i,ns)),pl.normalize(),H3.crossVectors(ns,pl),r[0]=pl.x,r[4]=H3.x,r[8]=ns.x,r[1]=pl.y,r[5]=H3.y,r[9]=ns.y,r[2]=pl.z,r[6]=H3.z,r[10]=ns.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,r=t.elements,s=this.elements,a=i[0],o=i[4],l=i[8],c=i[12],u=i[1],h=i[5],f=i[9],p=i[13],m=i[2],y=i[6],v=i[10],A=i[14],_=i[3],x=i[7],E=i[11],w=i[15],I=r[0],T=r[4],M=r[8],b=r[12],B=r[1],L=r[5],U=r[9],O=r[13],Q=r[2],G=r[6],F=r[10],q=r[14],Y=r[3],H=r[7],V=r[11],D=r[15];return s[0]=a*I+o*B+l*Q+c*Y,s[4]=a*T+o*L+l*G+c*H,s[8]=a*M+o*U+l*F+c*V,s[12]=a*b+o*O+l*q+c*D,s[1]=u*I+h*B+f*Q+p*Y,s[5]=u*T+h*L+f*G+p*H,s[9]=u*M+h*U+f*F+p*V,s[13]=u*b+h*O+f*q+p*D,s[2]=m*I+y*B+v*Q+A*Y,s[6]=m*T+y*L+v*G+A*H,s[10]=m*M+y*U+v*F+A*V,s[14]=m*b+y*O+v*q+A*D,s[3]=_*I+x*B+E*Q+w*Y,s[7]=_*T+x*L+E*G+w*H,s[11]=_*M+x*U+E*F+w*V,s[15]=_*b+x*O+E*q+w*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],i=e[4],r=e[8],s=e[12],a=e[1],o=e[5],l=e[9],c=e[13],u=e[2],h=e[6],f=e[10],p=e[14],m=e[3],y=e[7],v=e[11],A=e[15];return m*(+s*l*h-r*c*h-s*o*f+i*c*f+r*o*p-i*l*p)+y*(+t*l*p-t*c*f+s*a*f-r*a*p+r*c*u-s*l*u)+v*(+t*c*h-t*o*p-s*a*h+i*a*p+s*o*u-i*c*u)+A*(-r*o*u-t*l*h+t*o*f+r*a*h-i*a*f+i*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,i){const r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],a=e[4],o=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],p=e[11],m=e[12],y=e[13],v=e[14],A=e[15],_=h*v*c-y*f*c+y*l*p-o*v*p-h*l*A+o*f*A,x=m*f*c-u*v*c-m*l*p+a*v*p+u*l*A-a*f*A,E=u*y*c-m*h*c+m*o*p-a*y*p-u*o*A+a*h*A,w=m*h*l-u*y*l-m*o*f+a*y*f+u*o*v-a*h*v,I=t*_+i*x+r*E+s*w;if(I===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/I;return e[0]=_*T,e[1]=(y*f*s-h*v*s-y*r*p+i*v*p+h*r*A-i*f*A)*T,e[2]=(o*v*s-y*l*s+y*r*c-i*v*c-o*r*A+i*l*A)*T,e[3]=(h*l*s-o*f*s-h*r*c+i*f*c+o*r*p-i*l*p)*T,e[4]=x*T,e[5]=(u*v*s-m*f*s+m*r*p-t*v*p-u*r*A+t*f*A)*T,e[6]=(m*l*s-a*v*s-m*r*c+t*v*c+a*r*A-t*l*A)*T,e[7]=(a*f*s-u*l*s+u*r*c-t*f*c-a*r*p+t*l*p)*T,e[8]=E*T,e[9]=(m*h*s-u*y*s-m*i*p+t*y*p+u*i*A-t*h*A)*T,e[10]=(a*y*s-m*o*s+m*i*c-t*y*c-a*i*A+t*o*A)*T,e[11]=(u*o*s-a*h*s-u*i*c+t*h*c+a*i*p-t*o*p)*T,e[12]=w*T,e[13]=(u*y*r-m*h*r+m*i*f-t*y*f-u*i*v+t*h*v)*T,e[14]=(m*o*r-a*y*r-m*i*l+t*y*l+a*i*v-t*o*v)*T,e[15]=(a*h*r-u*o*r+u*i*l-t*h*l-a*i*f+t*o*f)*T,this}scale(e){const t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),r=Math.sin(t),s=1-i,a=e.x,o=e.y,l=e.z,c=s*a,u=s*o;return this.set(c*a+i,c*o-r*l,c*l+r*o,0,c*o+r*l,u*o+i,u*l-r*a,0,c*l-r*o,u*l+r*a,s*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,r,s,a){return this.set(1,i,s,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){const r=this.elements,s=t._x,a=t._y,o=t._z,l=t._w,c=s+s,u=a+a,h=o+o,f=s*c,p=s*u,m=s*h,y=a*u,v=a*h,A=o*h,_=l*c,x=l*u,E=l*h,w=i.x,I=i.y,T=i.z;return r[0]=(1-(y+A))*w,r[1]=(p+E)*w,r[2]=(m-x)*w,r[3]=0,r[4]=(p-E)*I,r[5]=(1-(f+A))*I,r[6]=(v+_)*I,r[7]=0,r[8]=(m+x)*T,r[9]=(v-_)*T,r[10]=(1-(f+y))*T,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){const r=this.elements;let s=qu.set(r[0],r[1],r[2]).length();const a=qu.set(r[4],r[5],r[6]).length(),o=qu.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Js.copy(this);const c=1/s,u=1/a,h=1/o;return Js.elements[0]*=c,Js.elements[1]*=c,Js.elements[2]*=c,Js.elements[4]*=u,Js.elements[5]*=u,Js.elements[6]*=u,Js.elements[8]*=h,Js.elements[9]*=h,Js.elements[10]*=h,t.setFromRotationMatrix(Js),i.x=s,i.y=a,i.z=o,this}makePerspective(e,t,i,r,s,a,o=za){const l=this.elements,c=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),f=(i+r)/(i-r);let p,m;if(o===za)p=-(a+s)/(a-s),m=-2*a*s/(a-s);else if(o===Mp)p=-a/(a-s),m=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=c,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,i,r,s,a,o=za){const l=this.elements,c=1/(t-e),u=1/(i-r),h=1/(a-s),f=(t+e)*c,p=(i+r)*u;let m,y;if(o===za)m=(a+s)*h,y=-2*h;else if(o===Mp)m=s*h,y=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*u,l[9]=0,l[13]=-p,l[2]=0,l[6]=0,l[10]=y,l[14]=-m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const qu=new N,Js=new ct,cL=new N(0,0,0),uL=new N(1,1,1),pl=new N,H3=new N,ns=new N,m_=new ct,A_=new $i;class vu{constructor(e=0,t=0,i=0,r=vu.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const r=e.elements,s=r[0],a=r[4],o=r[8],l=r[1],c=r[5],u=r[9],h=r[2],f=r[6],p=r[10];switch(t){case"XYZ":this._y=Math.asin(si(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-si(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(o,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(si(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-si(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-a,c));break;case"YZX":this._z=Math.asin(si(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(o,p));break;case"XZY":this._z=Math.asin(-si(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return m_.makeRotationFromQuaternion(e),this.setFromRotationMatrix(m_,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return A_.setFromEuler(this),this.setFromQuaternion(A_,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}}vu.DEFAULT_ORDER="XYZ";class Kc{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0&&(i=i.concat(a))}return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(jf,e,fL),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(jf,dL,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 i=0,r=t.length;i0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON()));function s(o,l){return o[l.uuid]===void 0&&(o[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const l=o.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){r.children=[];for(let o=0;o0){r.animations=[];for(let o=0;o0&&(i.geometries=o),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),p.length>0&&(i.animations=p),m.length>0&&(i.nodes=m)}return i.object=r,i;function a(o){const l=[];for(const c in o){const u=o[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 i=0;i0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){Zs.subVectors(r,t),Co.subVectors(i,t),nv.subVectors(e,t);const a=Zs.dot(Zs),o=Zs.dot(Co),l=Zs.dot(nv),c=Co.dot(Co),u=Co.dot(nv),h=a*c-o*o;if(h===0)return s.set(-2,-1,-1);const f=1/h,p=(c*l-o*u)*f,m=(a*u-o*l)*f;return s.set(1-p-m,m,p)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,To),To.x>=0&&To.y>=0&&To.x+To.y<=1}static getUV(e,t,i,r,s,a,o,l){return W3===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),W3=!0),this.getInterpolation(e,t,i,r,s,a,o,l)}static getInterpolation(e,t,i,r,s,a,o,l){return this.getBarycoord(e,t,i,r,To),l.setScalar(0),l.addScaledVector(s,To.x),l.addScaledVector(a,To.y),l.addScaledVector(o,To.z),l}static isFrontFacing(e,t,i,r){return Zs.subVectors(i,t),Co.subVectors(e,t),Zs.cross(Co).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Zs.subVectors(this.c,this.b),Co.subVectors(this.a,this.b),Zs.cross(Co).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Qr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Qr.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,r,s){return W3===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),W3=!0),Qr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}getInterpolation(e,t,i,r,s){return Qr.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return Qr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Qr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,r=this.b,s=this.c;let a,o;ju.subVectors(r,i),Ku.subVectors(s,i),iv.subVectors(e,i);const l=ju.dot(iv),c=Ku.dot(iv);if(l<=0&&c<=0)return t.copy(i);rv.subVectors(e,r);const u=ju.dot(rv),h=Ku.dot(rv);if(u>=0&&h<=u)return t.copy(r);const f=l*h-u*c;if(f<=0&&l>=0&&u<=0)return a=l/(l-u),t.copy(i).addScaledVector(ju,a);sv.subVectors(e,s);const p=ju.dot(sv),m=Ku.dot(sv);if(m>=0&&p<=m)return t.copy(s);const y=p*c-l*m;if(y<=0&&c>=0&&m<=0)return o=c/(c-m),t.copy(i).addScaledVector(Ku,o);const v=u*m-p*h;if(v<=0&&h-u>=0&&p-m>=0)return S_.subVectors(s,r),o=(h-u)/(h-u+(p-m)),t.copy(r).addScaledVector(S_,o);const A=1/(v+y+f);return a=y*A,o=f*A,t.copy(i).addScaledVector(ju,a).addScaledVector(Ku,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let gL=0;class Ji extends Yo{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:gL++}),this.uuid=ls(),this.name="",this.type="Material",this.blending=Ha,this.side=$a,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=gp,this.blendDst=mp,this.blendEquation=ss,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=Rm,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=kC,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=hm,this.stencilZFail=hm,this.stencilZPass=hm,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 i=e[t];if(i===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ha&&(i.blending=this.blending),this.side!==$a&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=this.alphaHash),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(i.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){const a=[];for(const o in s){const l=s[o];delete l.metadata,a.push(l)}return a}if(t){const s=r(e.textures),a=r(e.images);s.length>0&&(i.textures=s),a.length>0&&(i.images=a)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.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 i=null;if(t!==null){const r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const jC={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},ea={h:0,s:0,l:0},Y3={h:0,s:0,l:0};function av(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}let He=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){const r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Nt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ds.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Ds.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ds.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Ds.workingColorSpace){if(e=R6(e,1),t=si(t,0,1),i=si(i,0,1),t===0)this.r=this.g=this.b=i;else{const s=i<=.5?i*(1+t):i+t-i*t,a=2*i-s;this.r=av(a,s,e+1/3),this.g=av(a,s,e),this.b=av(a,s,e-1/3)}return Ds.toWorkingColorSpace(this,r),this}setStyle(e,t=Nt){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=r[1],o=r[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,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(o))return i(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(r=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=r[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===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=Nt){const i=jC[e.toLowerCase()];return i!==void 0?this.setHex(i,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=Oh(e.r),this.g=Oh(e.g),this.b=Oh(e.b),this}copyLinearToSRGB(e){return this.r=XA(e.r),this.g=XA(e.g),this.b=XA(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Nt){return Ds.fromWorkingColorSpace(or.copy(this),e),Math.round(si(or.r*255,0,255))*65536+Math.round(si(or.g*255,0,255))*256+Math.round(si(or.b*255,0,255))}getHexString(e=Nt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ds.workingColorSpace){Ds.fromWorkingColorSpace(or.copy(this),t);const i=or.r,r=or.g,s=or.b,a=Math.max(i,r,s),o=Math.min(i,r,s);let l,c;const u=(o+a)/2;if(o===a)l=0,c=0;else{const h=a-o;switch(c=u<=.5?h/(a+o):h/(2-a-o),a){case i:l=(r-s)/h+(r>-c-14,i[l|256]=1024>>-c-14|32768,r[l]=-c-1,r[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,r[l]=13,r[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,r[l]=24,r[l|256]=24):(i[l]=31744,i[l|256]=64512,r[l]=13,r[l|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;!(c&8388608);)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)a[l]=l<<23;a[31]=1199570944,a[32]=2147483648;for(let l=33;l<63;++l)a[l]=2147483648+(l-32<<23);a[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(o[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}function zr(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=si(n,-65504,65504),Uo.floatView[0]=n;const e=Uo.uint32View[0],t=e>>23&511;return Uo.baseTable[t]+((e&8388607)>>Uo.shiftTable[t])}function Nd(n){const e=n>>10;return Uo.uint32View[0]=Uo.mantissaTable[Uo.offsetTable[e]+(n&1023)]+Uo.exponentTable[e],Uo.floatView[0]}const AL={toHalfFloat:zr,fromHalfFloat:Nd},Ei=new N,q3=new _e;class En{constructor(e,t,i=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i,this.usage=Ip,this.updateRange={offset:0,count:-1},this.gpuType=br,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,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const r={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,f=c.length;h0&&(r[l]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere={center:o.center.toArray(),radius:o.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 i=e.index;i!==null&&this.setIndex(i.clone(t));const r=e.attributes;for(const c in r){const u=r[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],h=s[c];for(let f=0,p=h.length;f0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s(e.far-e.near)**2))&&(w_.copy(s).invert(),xc.copy(e.ray).applyMatrix4(w_),!(i.boundingBox!==null&&xc.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,xc)))}_computeIntersections(e,t,i){let r;const s=this.geometry,a=this.material,o=s.index,l=s.attributes.position,c=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,p=s.drawRange;if(o!==null)if(Array.isArray(a))for(let m=0,y=f.length;mt.far?null:{distance:c,point:eg.clone(),object:n}}function tg(n,e,t,i,r,s,a,o,l,c){n.getVertexPosition(o,Ju),n.getVertexPosition(l,Zu),n.getVertexPosition(c,eh);const u=TL(n,e,t,i,Ju,Zu,eh,Z3);if(u){r&&(K3.fromBufferAttribute(r,o),$3.fromBufferAttribute(r,l),J3.fromBufferAttribute(r,c),u.uv=Qr.getInterpolation(Z3,Ju,Zu,eh,K3,$3,J3,new _e)),s&&(K3.fromBufferAttribute(s,o),$3.fromBufferAttribute(s,l),J3.fromBufferAttribute(s,c),u.uv1=Qr.getInterpolation(Z3,Ju,Zu,eh,K3,$3,J3,new _e),u.uv2=u.uv1),a&&(T_.fromBufferAttribute(a,o),b_.fromBufferAttribute(a,l),I_.fromBufferAttribute(a,c),u.normal=Qr.getInterpolation(Z3,Ju,Zu,eh,T_,b_,I_,new N),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const h={a:o,b:l,c,normal:new N,materialIndex:0};Qr.getNormal(Ju,Zu,eh,h.normal),u.face=h}return u}class qo extends Bt{constructor(e=1,t=1,i=1,r=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:a};const o=this;r=Math.floor(r),s=Math.floor(s),a=Math.floor(a);const l=[],c=[],u=[],h=[];let f=0,p=0;m("z","y","x",-1,-1,i,t,e,a,s,0),m("z","y","x",1,-1,i,t,-e,a,s,1),m("x","z","y",1,1,e,i,t,r,a,2),m("x","z","y",1,-1,e,i,-t,r,a,3),m("x","y","z",1,-1,e,t,i,r,s,4),m("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(l),this.setAttribute("position",new ot(c,3)),this.setAttribute("normal",new ot(u,3)),this.setAttribute("uv",new ot(h,2));function m(y,v,A,_,x,E,w,I,T,M,b){const B=E/T,L=w/M,U=E/2,O=w/2,Q=I/2,G=T+1,F=M+1;let q=0,Y=0;const H=new N;for(let V=0;V0?1:-1,u.push(H.x,H.y,H.z),h.push(k/T),h.push(1-V/M),q+=1}}for(let V=0;V0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const i={};for(const r in this.extensions)this.extensions[r]===!0&&(i[r]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class o0 extends fn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ct,this.projectionMatrix=new ct,this.projectionMatrixInverse=new ct,this.coordinateSystem=za}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 Kn extends o0{constructor(e=50,t=1,i=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=r,this.focus=10,this.aspect=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=Vh*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(jc*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Vh*2*Math.atan(Math.tan(jc*.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,i,r,s,a){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=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(jc*.5*this.fov)/this.zoom,i=2*t,r=this.aspect*i,s=-.5*r;const a=this.view;if(this.view!==null&&this.view.enabled){const l=a.fullWidth,c=a.fullHeight;s+=a.offsetX*r/l,t-=a.offsetY*i/c,r*=a.width/l,i*=a.height/c}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+r,t,t-i,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 th=-90,nh=1;class $C extends fn{constructor(e,t,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null;const r=new Kn(th,nh,e,t);r.layers=this.layers,this.add(r);const s=new Kn(th,nh,e,t);s.layers=this.layers,this.add(s);const a=new Kn(th,nh,e,t);a.layers=this.layers,this.add(a);const o=new Kn(th,nh,e,t);o.layers=this.layers,this.add(o);const l=new Kn(th,nh,e,t);l.layers=this.layers,this.add(l);const c=new Kn(th,nh,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[i,r,s,a,o,l]=t;for(const c of t)this.remove(c);if(e===za)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===Mp)i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.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 i=this.renderTarget;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,l,c]=this.children,u=e.getRenderTarget(),h=e.toneMapping,f=e.xr.enabled;e.toneMapping=os,e.xr.enabled=!1;const p=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,s),e.setRenderTarget(i,2),e.render(t,a),e.setRenderTarget(i,3),e.render(t,o),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=p,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=f,i.texture.needsPMREMUpdate=!0}}class l0 extends Vn{constructor(e,t,i,r,s,a,o,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Fl,super(e,t,i,r,s,a,o,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class JC extends Dn{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},r=[i,i,i,i,i,i];t.encoding!==void 0&&(Jd("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=t.encoding===Dl?Nt:Pl),this.texture=new l0(r,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:Tn}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 i={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new qo(5,5,5),s=new sn({name:"CubemapFromEquirect",uniforms:Wh(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ki,blending:Kt});s.uniforms.tEquirect.value=t;const a=new nn(r,s),o=t.minFilter;return t.minFilter===Ja&&(t.minFilter=Tn),new $C(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t,i,r){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,i,r);e.setRenderTarget(s)}}const cv=new N,RL=new N,BL=new Qt;class rs{constructor(e=new N(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,i,r){return this.normal.set(e,t,i),this.constant=r,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const r=cv.subVectors(i,t).cross(RL.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(r,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const i=e.delta(cv),r=this.normal.dot(i);if(r===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/r;return s<0||s>1?null:t.copy(e.start).addScaledVector(i,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<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 i=t||BL.getNormalMatrix(e),r=this.coplanarPoint(cv).applyMatrix4(e),s=this.normal.applyMatrix3(i).normalize();return this.constant=-r.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const _c=new ms,ng=new N;class c0{constructor(e=new rs,t=new rs,i=new rs,r=new rs,s=new rs,a=new rs){this.planes=[e,t,i,r,s,a]}set(e,t,i,r,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(i),o[3].copy(r),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e,t=za){const i=this.planes,r=e.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],u=r[5],h=r[6],f=r[7],p=r[8],m=r[9],y=r[10],v=r[11],A=r[12],_=r[13],x=r[14],E=r[15];if(i[0].setComponents(l-s,f-c,v-p,E-A).normalize(),i[1].setComponents(l+s,f+c,v+p,E+A).normalize(),i[2].setComponents(l+a,f+u,v+m,E+_).normalize(),i[3].setComponents(l-a,f-u,v-m,E-_).normalize(),i[4].setComponents(l-o,f-h,v-y,E-x).normalize(),t===za)i[5].setComponents(l+o,f+h,v+y,E+x).normalize();else if(t===Mp)i[5].setComponents(o,h,y,x).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(),_c.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),_c.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(_c)}intersectsSprite(e){return _c.center.set(0,0,0),_c.radius=.7071067811865476,_c.applyMatrix4(e.matrixWorld),this.intersectsSphere(_c)}intersectsSphere(e){const t=this.planes,i=e.center,r=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(i)0?e.max.x:e.min.x,ng.y=r.normal.y>0?e.max.y:e.min.y,ng.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(ng)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function ZC(){let n=null,e=!1,t=null,i=null;function r(s,a){t(s,a),i=n.requestAnimationFrame(r)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(r),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function DL(n,e){const t=e.isWebGL2,i=new WeakMap;function r(c,u){const h=c.array,f=c.usage,p=n.createBuffer();n.bindBuffer(u,p),n.bufferData(u,h,f),c.onUploadCallback();let m;if(h instanceof Float32Array)m=n.FLOAT;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)m=n.HALF_FLOAT;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else m=n.UNSIGNED_SHORT;else if(h instanceof Int16Array)m=n.SHORT;else if(h instanceof Uint32Array)m=n.UNSIGNED_INT;else if(h instanceof Int32Array)m=n.INT;else if(h instanceof Int8Array)m=n.BYTE;else if(h instanceof Uint8Array)m=n.UNSIGNED_BYTE;else if(h instanceof Uint8ClampedArray)m=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:p,type:m,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,h){const f=u.array,p=u.updateRange;n.bindBuffer(h,c),p.count===-1?n.bufferSubData(h,0,f):(t?n.bufferSubData(h,p.offset*f.BYTES_PER_ELEMENT,f,p.offset,p.count):n.bufferSubData(h,p.offset*f.BYTES_PER_ELEMENT,f.subarray(p.offset,p.offset+p.count)),p.count=-1),u.onUploadCallback()}function a(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function o(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const f=i.get(c);(!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`,qL=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,XL=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,jL=`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,KL=`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,$L=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,JL=`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) + varying vec3 vColor; +#endif`,ZL=`#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`,eU=`#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`,tU=`#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`,nU=`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`,iU=`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,rU=`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,sU=`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,aU=`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,oU="gl_FragColor = linearToOutputTexel( gl_FragColor );",lU=`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 ); +}`,cU=`#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`,uU=`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,hU=`#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`,fU=`#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`,dU=`#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`,pU=`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,gU=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,mU=`#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`,AU=`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,vU=`#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 +}`,yU=`#ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + reflectedLight.indirectDiffuse += lightMapIrradiance; +#endif`,xU=`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,_U=`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,EU=`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`,SU=`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`,wU=`#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`,CU=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,TU=`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`,bU=`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,IU=`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`,MU=`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`,RU=`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 ); +}`,BU=` +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`,DU=`#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`,PU=`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); +#endif`,LU=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,UU=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,OU=`#ifdef USE_LOGDEPTHBUF + #ifdef USE_LOGDEPTHBUF_EXT + varying float vFragDepth; + varying float vIsPerspective; + #else + uniform float logDepthBufFC; + #endif +#endif`,FU=`#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`,kU=`#ifdef USE_MAP + diffuseColor *= texture2D( map, vMapUv ); +#endif`,NU=`#ifdef USE_MAP + uniform sampler2D map; +#endif`,GU=`#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`,zU=`#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`,QU=`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,HU=`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,VU=`#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`,WU=`#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`,YU=`#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`,qU=`#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`,XU=`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;`,jU=`#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`,KU=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,$U=`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,JU=`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,ZU=`#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`,eO=`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = geometryNormal; +#endif`,tO=`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,nO=`#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`,iO=`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,rO=`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,sO=`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 ); +}`,aO=`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,oO=`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,lO=`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,cO=`#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`,uO=`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,hO=`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,fO=`#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`,dO=`#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`,pO=`#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`,gO=`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; +}`,mO=`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,AO=`#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`,vO=`#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`,yO=`#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`,xO=`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,_O=`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,EO=`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,SO=`#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; }`,wO=`#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`,CO=`#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`,TO=`#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`,bO=`#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`,IO=`#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`,MO=`#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 RO=`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,BO=`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,DO=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,PO=`#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 +}`,LO=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,UO=`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 +}`,OO=`#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; +}`,FO=`#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 +}`,kO=`#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; +}`,NO=`#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 ); +}`,GO=`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,zO=`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,QO=`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 +}`,HO=`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 +}`,VO=`#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 +}`,WO=`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 +}`,YO=`#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 +}`,qO=`#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 +}`,XO=`#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; +}`,jO=`#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 +}`,KO=`#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 +}`,$O=`#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 +}`,JO=`#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 +}`,ZO=`#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 +}`,eF=`#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 +}`,tF=`#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 +}`,nF=`#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 +}`,iF=`#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 +}`,rF=`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 +}`,sF=`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 +}`,aF=`#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,oF=`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 +}`,lF=`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 +}`,cF=`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 +}`,kt={alphahash_fragment:PL,alphahash_pars_fragment:LL,alphamap_fragment:UL,alphamap_pars_fragment:OL,alphatest_fragment:FL,alphatest_pars_fragment:kL,aomap_fragment:NL,aomap_pars_fragment:GL,begin_vertex:zL,beginnormal_vertex:QL,bsdfs:HL,iridescence_fragment:VL,bumpmap_pars_fragment:WL,clipping_planes_fragment:YL,clipping_planes_pars_fragment:qL,clipping_planes_pars_vertex:XL,clipping_planes_vertex:jL,color_fragment:KL,color_pars_fragment:$L,color_pars_vertex:JL,color_vertex:ZL,common:eU,cube_uv_reflection_fragment:tU,defaultnormal_vertex:nU,displacementmap_pars_vertex:iU,displacementmap_vertex:rU,emissivemap_fragment:sU,emissivemap_pars_fragment:aU,colorspace_fragment:oU,colorspace_pars_fragment:lU,envmap_fragment:cU,envmap_common_pars_fragment:uU,envmap_pars_fragment:hU,envmap_pars_vertex:fU,envmap_physical_pars_fragment:wU,envmap_vertex:dU,fog_vertex:pU,fog_pars_vertex:gU,fog_fragment:mU,fog_pars_fragment:AU,gradientmap_pars_fragment:vU,lightmap_fragment:yU,lightmap_pars_fragment:xU,lights_lambert_fragment:_U,lights_lambert_pars_fragment:EU,lights_pars_begin:SU,lights_toon_fragment:CU,lights_toon_pars_fragment:TU,lights_phong_fragment:bU,lights_phong_pars_fragment:IU,lights_physical_fragment:MU,lights_physical_pars_fragment:RU,lights_fragment_begin:BU,lights_fragment_maps:DU,lights_fragment_end:PU,logdepthbuf_fragment:LU,logdepthbuf_pars_fragment:UU,logdepthbuf_pars_vertex:OU,logdepthbuf_vertex:FU,map_fragment:kU,map_pars_fragment:NU,map_particle_fragment:GU,map_particle_pars_fragment:zU,metalnessmap_fragment:QU,metalnessmap_pars_fragment:HU,morphcolor_vertex:VU,morphnormal_vertex:WU,morphtarget_pars_vertex:YU,morphtarget_vertex:qU,normal_fragment_begin:XU,normal_fragment_maps:jU,normal_pars_fragment:KU,normal_pars_vertex:$U,normal_vertex:JU,normalmap_pars_fragment:ZU,clearcoat_normal_fragment_begin:eO,clearcoat_normal_fragment_maps:tO,clearcoat_pars_fragment:nO,iridescence_pars_fragment:iO,opaque_fragment:rO,packing:sO,premultiplied_alpha_fragment:aO,project_vertex:oO,dithering_fragment:lO,dithering_pars_fragment:cO,roughnessmap_fragment:uO,roughnessmap_pars_fragment:hO,shadowmap_pars_fragment:fO,shadowmap_pars_vertex:dO,shadowmap_vertex:pO,shadowmask_pars_fragment:gO,skinbase_vertex:mO,skinning_pars_vertex:AO,skinning_vertex:vO,skinnormal_vertex:yO,specularmap_fragment:xO,specularmap_pars_fragment:_O,tonemapping_fragment:EO,tonemapping_pars_fragment:SO,transmission_fragment:wO,transmission_pars_fragment:CO,uv_pars_fragment:TO,uv_pars_vertex:bO,uv_vertex:IO,worldpos_vertex:MO,background_vert:RO,background_frag:BO,backgroundCube_vert:DO,backgroundCube_frag:PO,cube_vert:LO,cube_frag:UO,depth_vert:OO,depth_frag:FO,distanceRGBA_vert:kO,distanceRGBA_frag:NO,equirect_vert:GO,equirect_frag:zO,linedashed_vert:QO,linedashed_frag:HO,meshbasic_vert:VO,meshbasic_frag:WO,meshlambert_vert:YO,meshlambert_frag:qO,meshmatcap_vert:XO,meshmatcap_frag:jO,meshnormal_vert:KO,meshnormal_frag:$O,meshphong_vert:JO,meshphong_frag:ZO,meshphysical_vert:eF,meshphysical_frag:tF,meshtoon_vert:nF,meshtoon_frag:iF,points_vert:rF,points_frag:sF,shadow_vert:aF,shadow_frag:oF,sprite_vert:lF,sprite_frag:cF},Je={common:{diffuse:{value:new He(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qt}},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 Qt}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qt}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qt},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qt},normalScale:{value:new _e(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qt},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qt}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qt}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qt}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new He(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 He(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0},uvTransform:{value:new Qt}},sprite:{diffuse:{value:new He(16777215)},opacity:{value:1},center:{value:new _e(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qt},alphaMap:{value:null},alphaMapTransform:{value:new Qt},alphaTest:{value:0}}},aa={basic:{uniforms:wr([Je.common,Je.specularmap,Je.envmap,Je.aomap,Je.lightmap,Je.fog]),vertexShader:kt.meshbasic_vert,fragmentShader:kt.meshbasic_frag},lambert:{uniforms:wr([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 He(0)}}]),vertexShader:kt.meshlambert_vert,fragmentShader:kt.meshlambert_frag},phong:{uniforms:wr([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 He(0)},specular:{value:new He(1118481)},shininess:{value:30}}]),vertexShader:kt.meshphong_vert,fragmentShader:kt.meshphong_frag},standard:{uniforms:wr([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 He(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:kt.meshphysical_vert,fragmentShader:kt.meshphysical_frag},toon:{uniforms:wr([Je.common,Je.aomap,Je.lightmap,Je.emissivemap,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.gradientmap,Je.fog,Je.lights,{emissive:{value:new He(0)}}]),vertexShader:kt.meshtoon_vert,fragmentShader:kt.meshtoon_frag},matcap:{uniforms:wr([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,Je.fog,{matcap:{value:null}}]),vertexShader:kt.meshmatcap_vert,fragmentShader:kt.meshmatcap_frag},points:{uniforms:wr([Je.points,Je.fog]),vertexShader:kt.points_vert,fragmentShader:kt.points_frag},dashed:{uniforms:wr([Je.common,Je.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:kt.linedashed_vert,fragmentShader:kt.linedashed_frag},depth:{uniforms:wr([Je.common,Je.displacementmap]),vertexShader:kt.depth_vert,fragmentShader:kt.depth_frag},normal:{uniforms:wr([Je.common,Je.bumpmap,Je.normalmap,Je.displacementmap,{opacity:{value:1}}]),vertexShader:kt.meshnormal_vert,fragmentShader:kt.meshnormal_frag},sprite:{uniforms:wr([Je.sprite,Je.fog]),vertexShader:kt.sprite_vert,fragmentShader:kt.sprite_frag},background:{uniforms:{uvTransform:{value:new Qt},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:kt.background_vert,fragmentShader:kt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:kt.backgroundCube_vert,fragmentShader:kt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:kt.cube_vert,fragmentShader:kt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:kt.equirect_vert,fragmentShader:kt.equirect_frag},distanceRGBA:{uniforms:wr([Je.common,Je.displacementmap,{referencePosition:{value:new N},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:kt.distanceRGBA_vert,fragmentShader:kt.distanceRGBA_frag},shadow:{uniforms:wr([Je.lights,Je.fog,{color:{value:new He(0)},opacity:{value:1}}]),vertexShader:kt.shadow_vert,fragmentShader:kt.shadow_frag}};aa.physical={uniforms:wr([aa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qt},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qt},clearcoatNormalScale:{value:new _e(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qt},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qt},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qt},sheen:{value:0},sheenColor:{value:new He(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qt},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qt},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qt},transmissionSamplerSize:{value:new _e},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qt},attenuationDistance:{value:0},attenuationColor:{value:new He(0)},specularColor:{value:new He(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qt},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qt},anisotropyVector:{value:new _e},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qt}}]),vertexShader:kt.meshphysical_vert,fragmentShader:kt.meshphysical_frag};const ig={r:0,b:0,g:0};function uF(n,e,t,i,r,s,a){const o=new He(0);let l=s===!0?0:1,c,u,h=null,f=0,p=null;function m(v,A){let _=!1,x=A.isScene===!0?A.background:null;switch(x&&x.isTexture&&(x=(A.backgroundBlurriness>0?t:e).get(x)),x===null?y(o,l):x&&x.isColor&&(y(x,1),_=!0),n.xr.getEnvironmentBlendMode()){case"opaque":_=!0;break;case"additive":i.buffers.color.setClear(0,0,0,1,a),_=!0;break;case"alpha-blend":i.buffers.color.setClear(0,0,0,0,a),_=!0;break}(n.autoClear||_)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),x&&(x.isCubeTexture||x.mapping===of)?(u===void 0&&(u=new nn(new qo(1,1,1),new sn({name:"BackgroundCubeMaterial",uniforms:Wh(aa.backgroundCube.uniforms),vertexShader:aa.backgroundCube.vertexShader,fragmentShader:aa.backgroundCube.fragmentShader,side:Ki,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(I,T,M){this.matrixWorld.copyPosition(M.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(u)),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=A.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,u.material.toneMapped=x.colorSpace!==Nt,(h!==x||f!==x.version||p!==n.toneMapping)&&(u.material.needsUpdate=!0,h=x,f=x.version,p=n.toneMapping),u.layers.enableAll(),v.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new nn(new Xo(2,2),new sn({name:"BackgroundMaterial",uniforms:Wh(aa.background.uniforms),vertexShader:aa.background.vertexShader,fragmentShader:aa.background.fragmentShader,side:$a,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(c)),c.material.uniforms.t2D.value=x,c.material.uniforms.backgroundIntensity.value=A.backgroundIntensity,c.material.toneMapped=x.colorSpace!==Nt,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(h!==x||f!==x.version||p!==n.toneMapping)&&(c.material.needsUpdate=!0,h=x,f=x.version,p=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function y(v,A){v.getRGB(ig,KC(n)),i.buffers.color.setClear(ig.r,ig.g,ig.b,A,a)}return{getClearColor:function(){return o},setClearColor:function(v,A=1){o.set(v),l=A,y(o,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,y(o,l)},render:m}}function hF(n,e,t,i){const r=n.getParameter(n.MAX_VERTEX_ATTRIBS),s=i.isWebGL2?null:e.get("OES_vertex_array_object"),a=i.isWebGL2||s!==null,o={},l=v(null);let c=l,u=!1;function h(Q,G,F,q,Y){let H=!1;if(a){const V=y(q,F,G);c!==V&&(c=V,p(c.object)),H=A(Q,q,F,Y),H&&_(Q,q,F,Y)}else{const V=G.wireframe===!0;(c.geometry!==q.id||c.program!==F.id||c.wireframe!==V)&&(c.geometry=q.id,c.program=F.id,c.wireframe=V,H=!0)}Y!==null&&t.update(Y,n.ELEMENT_ARRAY_BUFFER),(H||u)&&(u=!1,M(Q,G,F,q),Y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t.get(Y).buffer))}function f(){return i.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function p(Q){return i.isWebGL2?n.bindVertexArray(Q):s.bindVertexArrayOES(Q)}function m(Q){return i.isWebGL2?n.deleteVertexArray(Q):s.deleteVertexArrayOES(Q)}function y(Q,G,F){const q=F.wireframe===!0;let Y=o[Q.id];Y===void 0&&(Y={},o[Q.id]=Y);let H=Y[G.id];H===void 0&&(H={},Y[G.id]=H);let V=H[q];return V===void 0&&(V=v(f()),H[q]=V),V}function v(Q){const G=[],F=[],q=[];for(let Y=0;Y=0){const j=Y[k];let ee=H[k];if(ee===void 0&&(k==="instanceMatrix"&&Q.instanceMatrix&&(ee=Q.instanceMatrix),k==="instanceColor"&&Q.instanceColor&&(ee=Q.instanceColor)),j===void 0||j.attribute!==ee||ee&&j.data!==ee.data)return!0;V++}return c.attributesNum!==V||c.index!==q}function _(Q,G,F,q){const Y={},H=G.attributes;let V=0;const D=F.getAttributes();for(const k in D)if(D[k].location>=0){let j=H[k];j===void 0&&(k==="instanceMatrix"&&Q.instanceMatrix&&(j=Q.instanceMatrix),k==="instanceColor"&&Q.instanceColor&&(j=Q.instanceColor));const ee={};ee.attribute=j,j&&j.data&&(ee.data=j.data),Y[k]=ee,V++}c.attributes=Y,c.attributesNum=V,c.index=q}function x(){const Q=c.newAttributes;for(let G=0,F=Q.length;G=0){let Z=Y[D];if(Z===void 0&&(D==="instanceMatrix"&&Q.instanceMatrix&&(Z=Q.instanceMatrix),D==="instanceColor"&&Q.instanceColor&&(Z=Q.instanceColor)),Z!==void 0){const j=Z.normalized,ee=Z.itemSize,ie=t.get(Z);if(ie===void 0)continue;const te=ie.buffer,re=ie.type,ce=ie.bytesPerElement,ye=i.isWebGL2===!0&&(re===n.INT||re===n.UNSIGNED_INT||Z.gpuType===x6);if(Z.isInterleavedBufferAttribute){const oe=Z.data,W=oe.stride,ge=Z.offset;if(oe.isInstancedInterleavedBuffer){for(let he=0;he0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";T="mediump"}return T==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}const a=typeof WebGL2RenderingContext<"u"&&n.constructor.name==="WebGL2RenderingContext";let o=t.precision!==void 0?t.precision:"highp";const l=s(o);l!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",l,"instead."),o=l);const c=a||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),f=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),p=n.getParameter(n.MAX_TEXTURE_SIZE),m=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),y=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),A=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=f>0,E=a||e.has("OES_texture_float"),w=x&&E,I=a?n.getParameter(n.MAX_SAMPLES):0;return{isWebGL2:a,drawBuffers:c,getMaxAnisotropy:r,getMaxPrecision:s,precision:o,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:f,maxTextureSize:p,maxCubemapSize:m,maxAttributes:y,maxVertexUniforms:v,maxVaryings:A,maxFragmentUniforms:_,vertexTextures:x,floatFragmentTextures:E,floatVertexTextures:w,maxSamples:I}}function pF(n){const e=this;let t=null,i=0,r=!1,s=!1;const a=new rs,o=new Qt,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,f){const p=h.length!==0||f||i!==0||r;return r=f,i=h.length,p},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,p){const m=h.clippingPlanes,y=h.clipIntersection,v=h.clipShadows,A=n.get(h);if(!r||m===null||m.length===0||s&&!v)s?u(null):c();else{const _=s?0:i,x=_*4;let E=A.clippingState||null;l.value=E,E=u(m,f,x,p);for(let w=0;w!==x;++w)E[w]=t[w];A.clippingState=E,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=_}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,f,p,m){const y=h!==null?h.length:0;let v=null;if(y!==0){if(v=l.value,m!==!0||v===null){const A=p+y*4,_=f.matrixWorldInverse;o.getNormalMatrix(_),(v===null||v.length0){const c=new JC(l.height/2);return c.fromEquirectangularTexture(n,a),e.set(a,c),a.addEventListener("dispose",r),t(c.texture,a.mapping)}else return null}}return a}function r(a){const o=a.target;o.removeEventListener("dispose",r);const l=e.get(o);l!==void 0&&(e.delete(o),l.dispose())}function s(){e=new WeakMap}return{get:i,dispose:s}}class ql extends o0{constructor(e=-1,t=1,i=1,r=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=r,this.near=s,this.far=a,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,i,r,s,a){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=i,this.view.offsetY=r,this.view.width=s,this.view.height=a,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),i=(this.right+this.left)/2,r=(this.top+this.bottom)/2;let s=i-e,a=i+e,o=r+t,l=r-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,a=s+c*this.view.width,o-=u*this.view.offsetY,l=o-u*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,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 Th=4,M_=[.125,.215,.35,.446,.526,.582],Nc=20,uv=new ql,R_=new He;let hv=null;const Dc=(1+Math.sqrt(5))/2,ih=1/Dc,B_=[new N(1,1,1),new N(-1,1,1),new N(1,1,-1),new N(-1,1,-1),new N(0,Dc,ih),new N(0,Dc,-ih),new N(ih,0,Dc),new N(-ih,0,Dc),new N(Dc,ih,0),new N(-Dc,ih,0)];class oy{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,i=.1,r=100){hv=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,i,r,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=L_(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=P_(),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?x:0,x,x),u.setRenderTarget(r),y&&u.render(m,o),u.render(e,o)}m.geometry.dispose(),m.material.dispose(),u.toneMapping=f,u.autoClear=h,e.background=v}_textureToCubeUV(e,t){const i=this._renderer,r=e.mapping===Fl||e.mapping===kl;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=L_()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=P_());const s=r?this._cubemapMaterial:this._equirectMaterial,a=new nn(this._lodPlanes[0],s),o=s.uniforms;o.envMap.value=e;const l=this._cubeSize;rg(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(a,uv)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let r=1;rNc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${v} samples when the maximum is set to ${Nc}`);const A=[];let _=0;for(let T=0;Tx-Th?r-x+Th:0),I=4*(this._cubeSize-E);rg(t,w,I,3*E,2*E),l.setRenderTarget(t),l.render(h,uv)}}function mF(n){const e=[],t=[],i=[];let r=n;const s=n-Th+1+M_.length;for(let a=0;an-Th?l=M_[a-n+Th-1]:a===0&&(l=0),i.push(l);const c=1/(o-2),u=-c,h=1+c,f=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,m=6,y=3,v=2,A=1,_=new Float32Array(y*m*p),x=new Float32Array(v*m*p),E=new Float32Array(A*m*p);for(let I=0;I2?0:-1,b=[T,M,0,T+2/3,M,0,T+2/3,M+1,0,T,M,0,T+2/3,M+1,0,T,M+1,0];_.set(b,y*m*I),x.set(f,v*m*I);const B=[I,I,I,I,I,I];E.set(B,A*m*I)}const w=new Bt;w.setAttribute("position",new En(_,y)),w.setAttribute("uv",new En(x,v)),w.setAttribute("faceIndex",new En(E,A)),e.push(w),r>Th&&r--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function D_(n,e,t){const i=new Dn(n,e,t);return i.texture.mapping=of,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function rg(n,e,t,i,r){n.viewport.set(e,t,i,r),n.scissor.set(e,t,i,r)}function AF(n,e,t){const i=new Float32Array(Nc),r=new N(0,1,0);return new sn({name:"SphericalGaussianBlur",defines:{n:Nc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:L6(),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:Kt,depthTest:!1,depthWrite:!1})}function P_(){return new sn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:L6(),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:Kt,depthTest:!1,depthWrite:!1})}function L_(){return new sn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:L6(),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:Kt,depthTest:!1,depthWrite:!1})}function L6(){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 vF(n){let e=new WeakMap,t=null;function i(o){if(o&&o.isTexture){const l=o.mapping,c=l===Ap||l===vp,u=l===Fl||l===kl;if(c||u)if(o.isRenderTargetTexture&&o.needsPMREMUpdate===!0){o.needsPMREMUpdate=!1;let h=e.get(o);return t===null&&(t=new oy(n)),h=c?t.fromEquirectangular(o,h):t.fromCubemap(o,h),e.set(o,h),h.texture}else{if(e.has(o))return e.get(o).texture;{const h=o.image;if(c&&h&&h.height>0||u&&h&&r(h)){t===null&&(t=new oy(n));const f=c?t.fromEquirectangular(o):t.fromCubemap(o);return e.set(o,f),o.addEventListener("dispose",s),f.texture}else return null}}}return o}function r(o){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(B=Math.ceil(b/e.maxTextureSize),b=e.maxTextureSize);const L=new Float32Array(b*B*4*m),U=new L2(L,b,B,m);U.type=br,U.needsUpdate=!0;const O=M*4;for(let G=0;G0)return n;const r=e*t;let s=U_[r];if(s===void 0&&(s=new Float32Array(r),U_[r]=s),e!==0){i.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,n[a].toArray(s,o)}return s}function Di(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${o}: ${t[a]}`)}return i.join(` +`)}function yk(n){switch(n){case fa:return["Linear","( value )"];case Nt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),["Linear","( value )"]}}function Q_(n,e,t){const i=n.getShaderParameter(e,n.COMPILE_STATUS),r=n.getShaderInfoLog(e).trim();if(i&&r==="")return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const a=parseInt(s[1]);return t.toUpperCase()+` + +`+r+` + +`+vk(n.getShaderSource(e),a)}else return r}function xk(n,e){const t=yk(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function _k(n,e){let t;switch(e){case wC:t="Linear";break;case CC:t="Reinhard";break;case TC:t="OptimizedCineon";break;case v6:t="ACESFilmic";break;case bC:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Ek(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.normalMapTangentSpace||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Gd).join(` +`)}function Sk(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` +`)}function wk(n,e){const t={},i=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let r=0;r/gm;function ly(n){return n.replace(Ck,bk)}const Tk=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function bk(n,e){let t=kt[e];if(t===void 0){const i=Tk.get(e);if(i!==void 0)t=kt[i],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,i);else throw new Error("Can not resolve #include <"+e+">")}return ly(t)}const Ik=/#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 W_(n){return n.replace(Ik,Mk)}function Mk(n,e,t,i){let r="";for(let s=parseInt(e);s0&&(v+=` +`),A=[p,"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,m].filter(Gd).join(` +`),A.length>0&&(A+=` +`)):(v=[Y_(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 "+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(Gd).join(` +`),A=[p,Y_(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 "+c:"",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 "+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!==os?"#define TONE_MAPPING":"",t.toneMapping!==os?kt.tonemapping_pars_fragment:"",t.toneMapping!==os?_k("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",kt.colorspace_pars_fragment,xk("linearToOutputTexel",t.outputColorSpace),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Gd).join(` +`)),a=ly(a),a=H_(a,t),a=V_(a,t),o=ly(o),o=H_(o,t),o=V_(o,t),a=W_(a),o=W_(o),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(_=`#version 300 es +`,v=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` +`)+` +`+v,A=["#define varying in",t.glslVersion===sy?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===sy?"":"#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(` +`)+` +`+A);const x=_+v+a,E=_+A+o,w=z_(r,r.VERTEX_SHADER,x),I=z_(r,r.FRAGMENT_SHADER,E);if(r.attachShader(y,w),r.attachShader(y,I),t.index0AttributeName!==void 0?r.bindAttribLocation(y,0,t.index0AttributeName):t.morphTargets===!0&&r.bindAttribLocation(y,0,"position"),r.linkProgram(y),n.debug.checkShaderErrors){const b=r.getProgramInfoLog(y).trim(),B=r.getShaderInfoLog(w).trim(),L=r.getShaderInfoLog(I).trim();let U=!0,O=!0;if(r.getProgramParameter(y,r.LINK_STATUS)===!1)if(U=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(r,y,w,I);else{const Q=Q_(r,w,"vertex"),G=Q_(r,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(y,r.VALIDATE_STATUS)+` + +Program Info Log: `+b+` +`+Q+` +`+G)}else b!==""?console.warn("THREE.WebGLProgram: Program Info Log:",b):(B===""||L==="")&&(O=!1);O&&(this.diagnostics={runnable:U,programLog:b,vertexShader:{log:B,prefix:v},fragmentShader:{log:L,prefix:A}})}r.deleteShader(w),r.deleteShader(I);let T;this.getUniforms=function(){return T===void 0&&(T=new dm(r,y)),T};let M;return this.getAttributes=function(){return M===void 0&&(M=wk(r,y)),M},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(y),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=Ak++,this.cacheKey=e,this.usedTimes=1,this.program=y,this.vertexShader=w,this.fragmentShader=I,this}let Ok=0;class Fk{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,r=this._getShaderStage(t),s=this._getShaderStage(i),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let i=t.get(e);return i===void 0&&(i=new Set,t.set(e,i)),i}_getShaderStage(e){const t=this.shaderCache;let i=t.get(e);return i===void 0&&(i=new kk(e),t.set(e,i)),i}}class kk{constructor(e){this.id=Ok++,this.code=e,this.usedTimes=0}}function Nk(n,e,t,i,r,s,a){const o=new Kc,l=new Fk,c=[],u=r.isWebGL2,h=r.logarithmicDepthBuffer,f=r.vertexTextures;let p=r.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 y(b){return b===0?"uv":`uv${b}`}function v(b,B,L,U,O){const Q=U.fog,G=O.geometry,F=b.isMeshStandardMaterial?U.environment:null,q=(b.isMeshStandardMaterial?t:e).get(b.envMap||F),Y=q&&q.mapping===of?q.image.height:null,H=m[b.type];b.precision!==null&&(p=r.getMaxPrecision(b.precision),p!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",p,"instead."));const V=G.morphAttributes.position||G.morphAttributes.normal||G.morphAttributes.color,D=V!==void 0?V.length:0;let k=0;G.morphAttributes.position!==void 0&&(k=1),G.morphAttributes.normal!==void 0&&(k=2),G.morphAttributes.color!==void 0&&(k=3);let Z,j,ee,ie;if(H){const Jt=aa[H];Z=Jt.vertexShader,j=Jt.fragmentShader}else Z=b.vertexShader,j=b.fragmentShader,l.update(b),ee=l.getVertexShaderID(b),ie=l.getFragmentShaderID(b);const te=n.getRenderTarget(),re=O.isInstancedMesh===!0,ce=!!b.map,ye=!!b.matcap,oe=!!q,W=!!b.aoMap,ge=!!b.lightMap,he=!!b.bumpMap,ue=!!b.normalMap,fe=!!b.displacementMap,Pe=!!b.emissiveMap,pe=!!b.metalnessMap,Re=!!b.roughnessMap,Le=b.anisotropy>0,Se=b.clearcoat>0,$e=b.iridescence>0,X=b.sheen>0,z=b.transmission>0,se=Le&&!!b.anisotropyMap,Be=Se&&!!b.clearcoatMap,Ce=Se&&!!b.clearcoatNormalMap,we=Se&&!!b.clearcoatRoughnessMap,ke=$e&&!!b.iridescenceMap,Ue=$e&&!!b.iridescenceThicknessMap,xe=X&&!!b.sheenColorMap,ze=X&&!!b.sheenRoughnessMap,je=!!b.specularMap,We=!!b.specularColorMap,Oe=!!b.specularIntensityMap,Ve=z&&!!b.transmissionMap,it=z&&!!b.thicknessMap,gt=!!b.gradientMap,ne=!!b.alphaMap,Fe=b.alphaTest>0,me=!!b.alphaHash,Qe=!!b.extensions,Xe=!!G.attributes.uv1,Dt=!!G.attributes.uv2,Yt=!!G.attributes.uv3;return{isWebGL2:u,shaderID:H,shaderType:b.type,shaderName:b.name,vertexShader:Z,fragmentShader:j,defines:b.defines,customVertexShaderID:ee,customFragmentShaderID:ie,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:p,instancing:re,instancingColor:re&&O.instanceColor!==null,supportsVertexTextures:f,outputColorSpace:te===null?n.outputColorSpace:te.isXRRenderTarget===!0?te.texture.colorSpace:fa,map:ce,matcap:ye,envMap:oe,envMapMode:oe&&q.mapping,envMapCubeUVHeight:Y,aoMap:W,lightMap:ge,bumpMap:he,normalMap:ue,displacementMap:f&&fe,emissiveMap:Pe,normalMapObjectSpace:ue&&b.normalMapType===FC,normalMapTangentSpace:ue&&b.normalMapType===Yl,metalnessMap:pe,roughnessMap:Re,anisotropy:Le,anisotropyMap:se,clearcoat:Se,clearcoatMap:Be,clearcoatNormalMap:Ce,clearcoatRoughnessMap:we,iridescence:$e,iridescenceMap:ke,iridescenceThicknessMap:Ue,sheen:X,sheenColorMap:xe,sheenRoughnessMap:ze,specularMap:je,specularColorMap:We,specularIntensityMap:Oe,transmission:z,transmissionMap:Ve,thicknessMap:it,gradientMap:gt,opaque:b.transparent===!1&&b.blending===Ha,alphaMap:ne,alphaTest:Fe,alphaHash:me,combine:b.combine,mapUv:ce&&y(b.map.channel),aoMapUv:W&&y(b.aoMap.channel),lightMapUv:ge&&y(b.lightMap.channel),bumpMapUv:he&&y(b.bumpMap.channel),normalMapUv:ue&&y(b.normalMap.channel),displacementMapUv:fe&&y(b.displacementMap.channel),emissiveMapUv:Pe&&y(b.emissiveMap.channel),metalnessMapUv:pe&&y(b.metalnessMap.channel),roughnessMapUv:Re&&y(b.roughnessMap.channel),anisotropyMapUv:se&&y(b.anisotropyMap.channel),clearcoatMapUv:Be&&y(b.clearcoatMap.channel),clearcoatNormalMapUv:Ce&&y(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:we&&y(b.clearcoatRoughnessMap.channel),iridescenceMapUv:ke&&y(b.iridescenceMap.channel),iridescenceThicknessMapUv:Ue&&y(b.iridescenceThicknessMap.channel),sheenColorMapUv:xe&&y(b.sheenColorMap.channel),sheenRoughnessMapUv:ze&&y(b.sheenRoughnessMap.channel),specularMapUv:je&&y(b.specularMap.channel),specularColorMapUv:We&&y(b.specularColorMap.channel),specularIntensityMapUv:Oe&&y(b.specularIntensityMap.channel),transmissionMapUv:Ve&&y(b.transmissionMap.channel),thicknessMapUv:it&&y(b.thicknessMap.channel),alphaMapUv:ne&&y(b.alphaMap.channel),vertexTangents:!!G.attributes.tangent&&(ue||Le),vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!G.attributes.color&&G.attributes.color.itemSize===4,vertexUv1s:Xe,vertexUv2s:Dt,vertexUv3s:Yt,pointsUvs:O.isPoints===!0&&!!G.attributes.uv&&(ce||ne),fog:!!Q,useFog:b.fog===!0,fogExp2:Q&&Q.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:h,skinning:O.isSkinnedMesh===!0,morphTargets:G.morphAttributes.position!==void 0,morphNormals:G.morphAttributes.normal!==void 0,morphColors:G.morphAttributes.color!==void 0,morphTargetsCount:D,morphTextureStride:k,numDirLights:B.directional.length,numPointLights:B.point.length,numSpotLights:B.spot.length,numSpotLightMaps:B.spotLightMap.length,numRectAreaLights:B.rectArea.length,numHemiLights:B.hemi.length,numDirLightShadows:B.directionalShadowMap.length,numPointLightShadows:B.pointShadowMap.length,numSpotLightShadows:B.spotShadowMap.length,numSpotLightShadowsWithMaps:B.numSpotLightShadowsWithMaps,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&L.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:os,useLegacyLights:n.useLegacyLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===$n,flipSided:b.side===Ki,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:Qe&&b.extensions.derivatives===!0,extensionFragDepth:Qe&&b.extensions.fragDepth===!0,extensionDrawBuffers:Qe&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:Qe&&b.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function A(b){const B=[];if(b.shaderID?B.push(b.shaderID):(B.push(b.customVertexShaderID),B.push(b.customFragmentShaderID)),b.defines!==void 0)for(const L in b.defines)B.push(L),B.push(b.defines[L]);return b.isRawShaderMaterial===!1&&(_(B,b),x(B,b),B.push(n.outputColorSpace)),B.push(b.customProgramCacheKey),B.join()}function _(b,B){b.push(B.precision),b.push(B.outputColorSpace),b.push(B.envMapMode),b.push(B.envMapCubeUVHeight),b.push(B.mapUv),b.push(B.alphaMapUv),b.push(B.lightMapUv),b.push(B.aoMapUv),b.push(B.bumpMapUv),b.push(B.normalMapUv),b.push(B.displacementMapUv),b.push(B.emissiveMapUv),b.push(B.metalnessMapUv),b.push(B.roughnessMapUv),b.push(B.anisotropyMapUv),b.push(B.clearcoatMapUv),b.push(B.clearcoatNormalMapUv),b.push(B.clearcoatRoughnessMapUv),b.push(B.iridescenceMapUv),b.push(B.iridescenceThicknessMapUv),b.push(B.sheenColorMapUv),b.push(B.sheenRoughnessMapUv),b.push(B.specularMapUv),b.push(B.specularColorMapUv),b.push(B.specularIntensityMapUv),b.push(B.transmissionMapUv),b.push(B.thicknessMapUv),b.push(B.combine),b.push(B.fogExp2),b.push(B.sizeAttenuation),b.push(B.morphTargetsCount),b.push(B.morphAttributeCount),b.push(B.numDirLights),b.push(B.numPointLights),b.push(B.numSpotLights),b.push(B.numSpotLightMaps),b.push(B.numHemiLights),b.push(B.numRectAreaLights),b.push(B.numDirLightShadows),b.push(B.numPointLightShadows),b.push(B.numSpotLightShadows),b.push(B.numSpotLightShadowsWithMaps),b.push(B.shadowMapType),b.push(B.toneMapping),b.push(B.numClippingPlanes),b.push(B.numClipIntersection),b.push(B.depthPacking)}function x(b,B){o.disableAll(),B.isWebGL2&&o.enable(0),B.supportsVertexTextures&&o.enable(1),B.instancing&&o.enable(2),B.instancingColor&&o.enable(3),B.matcap&&o.enable(4),B.envMap&&o.enable(5),B.normalMapObjectSpace&&o.enable(6),B.normalMapTangentSpace&&o.enable(7),B.clearcoat&&o.enable(8),B.iridescence&&o.enable(9),B.alphaTest&&o.enable(10),B.vertexColors&&o.enable(11),B.vertexAlphas&&o.enable(12),B.vertexUv1s&&o.enable(13),B.vertexUv2s&&o.enable(14),B.vertexUv3s&&o.enable(15),B.vertexTangents&&o.enable(16),B.anisotropy&&o.enable(17),b.push(o.mask),o.disableAll(),B.fog&&o.enable(0),B.useFog&&o.enable(1),B.flatShading&&o.enable(2),B.logarithmicDepthBuffer&&o.enable(3),B.skinning&&o.enable(4),B.morphTargets&&o.enable(5),B.morphNormals&&o.enable(6),B.morphColors&&o.enable(7),B.premultipliedAlpha&&o.enable(8),B.shadowMapEnabled&&o.enable(9),B.useLegacyLights&&o.enable(10),B.doubleSided&&o.enable(11),B.flipSided&&o.enable(12),B.useDepthPacking&&o.enable(13),B.dithering&&o.enable(14),B.transmission&&o.enable(15),B.sheen&&o.enable(16),B.opaque&&o.enable(17),B.pointsUvs&&o.enable(18),b.push(o.mask)}function E(b){const B=m[b.type];let L;if(B){const U=aa[B];L=Hn.clone(U.uniforms)}else L=b.uniforms;return L}function w(b,B){let L;for(let U=0,O=c.length;U0?i.push(A):p.transparent===!0?r.push(A):t.push(A)}function l(h,f,p,m,y,v){const A=a(h,f,p,m,y,v);p.transmission>0?i.unshift(A):p.transparent===!0?r.unshift(A):t.unshift(A)}function c(h,f){t.length>1&&t.sort(h||zk),i.length>1&&i.sort(f||q_),r.length>1&&r.sort(f||q_)}function u(){for(let h=e,f=n.length;h=s.length?(a=new X_,s.push(a)):a=s[r],a}function t(){n=new WeakMap}return{get:e,dispose:t}}function Hk(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new N,color:new He};break;case"SpotLight":t={position:new N,direction:new N,color:new He,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new N,color:new He,distance:0,decay:0};break;case"HemisphereLight":t={direction:new N,skyColor:new He,groundColor:new He};break;case"RectAreaLight":t={color:new He,position:new N,halfWidth:new N,halfHeight:new N};break}return n[e.id]=t,t}}}function Vk(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new _e,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Wk=0;function Yk(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function qk(n,e){const t=new Hk,i=Vk(),r={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++)r.probe.push(new N);const s=new N,a=new ct,o=new ct;function l(u,h){let f=0,p=0,m=0;for(let L=0;L<9;L++)r.probe[L].set(0,0,0);let y=0,v=0,A=0,_=0,x=0,E=0,w=0,I=0,T=0,M=0;u.sort(Yk);const b=h===!0?Math.PI:1;for(let L=0,U=u.length;L0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=Je.LTC_FLOAT_1,r.rectAreaLTC2=Je.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(r.rectAreaLTC1=Je.LTC_HALF_1,r.rectAreaLTC2=Je.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),r.ambient[0]=f,r.ambient[1]=p,r.ambient[2]=m;const B=r.hash;(B.directionalLength!==y||B.pointLength!==v||B.spotLength!==A||B.rectAreaLength!==_||B.hemiLength!==x||B.numDirectionalShadows!==E||B.numPointShadows!==w||B.numSpotShadows!==I||B.numSpotMaps!==T)&&(r.directional.length=y,r.spot.length=A,r.rectArea.length=_,r.point.length=v,r.hemi.length=x,r.directionalShadow.length=E,r.directionalShadowMap.length=E,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=I,r.spotShadowMap.length=I,r.directionalShadowMatrix.length=E,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=I+T-M,r.spotLightMap.length=T,r.numSpotLightShadowsWithMaps=M,B.directionalLength=y,B.pointLength=v,B.spotLength=A,B.rectAreaLength=_,B.hemiLength=x,B.numDirectionalShadows=E,B.numPointShadows=w,B.numSpotShadows=I,B.numSpotMaps=T,r.version=Wk++)}function c(u,h){let f=0,p=0,m=0,y=0,v=0;const A=h.matrixWorldInverse;for(let _=0,x=u.length;_=o.length?(l=new j_(n,e),o.push(l)):l=o[a],l}function r(){t=new WeakMap}return{get:i,dispose:r}}class u0 extends Ji{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=OC,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 F2 extends Ji{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 jk=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,Kk=`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 $k(n,e,t){let i=new c0;const r=new _e,s=new _e,a=new jt,o=new u0({depthPacking:P2}),l=new F2,c={},u=t.maxTextureSize,h={[$a]:Ki,[Ki]:$a,[$n]:$n},f=new sn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new _e},radius:{value:4}},vertexShader:jk,fragmentShader:Kk}),p=f.clone();p.defines.HORIZONTAL_PASS=1;const m=new Bt;m.setAttribute("position",new En(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new nn(m,f),v=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=b2;let A=this.type;this.render=function(w,I,T){if(v.enabled===!1||v.autoUpdate===!1&&v.needsUpdate===!1||w.length===0)return;const M=n.getRenderTarget(),b=n.getActiveCubeFace(),B=n.getActiveMipmapLevel(),L=n.state;L.setBlending(Kt),L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const U=A!==sa&&this.type===sa,O=A===sa&&this.type!==sa;for(let Q=0,G=w.length;Qu||r.y>u)&&(r.x>u&&(s.x=Math.floor(u/Y.x),r.x=s.x*Y.x,q.mapSize.x=s.x),r.y>u&&(s.y=Math.floor(u/Y.y),r.y=s.y*Y.y,q.mapSize.y=s.y)),q.map===null||U===!0||O===!0){const V=this.type!==sa?{minFilter:Rt,magFilter:Rt}:{};q.map!==null&&q.map.dispose(),q.map=new Dn(r.x,r.y,V),q.map.texture.name=F.name+".shadowMap",q.camera.updateProjectionMatrix()}n.setRenderTarget(q.map),n.clear();const H=q.getViewportCount();for(let V=0;V0||I.map&&I.alphaTest>0){const L=b.uuid,U=I.uuid;let O=c[L];O===void 0&&(O={},c[L]=O);let Q=O[U];Q===void 0&&(Q=b.clone(),O[U]=Q),b=Q}if(b.visible=I.visible,b.wireframe=I.wireframe,M===sa?b.side=I.shadowSide!==null?I.shadowSide:I.side:b.side=I.shadowSide!==null?I.shadowSide:h[I.side],b.alphaMap=I.alphaMap,b.alphaTest=I.alphaTest,b.map=I.map,b.clipShadows=I.clipShadows,b.clippingPlanes=I.clippingPlanes,b.clipIntersection=I.clipIntersection,b.displacementMap=I.displacementMap,b.displacementScale=I.displacementScale,b.displacementBias=I.displacementBias,b.wireframeLinewidth=I.wireframeLinewidth,b.linewidth=I.linewidth,T.isPointLight===!0&&b.isMeshDistanceMaterial===!0){const L=n.properties.get(b);L.light=T}return b}function E(w,I,T,M,b){if(w.visible===!1)return;if(w.layers.test(I.layers)&&(w.isMesh||w.isLine||w.isPoints)&&(w.castShadow||w.receiveShadow&&b===sa)&&(!w.frustumCulled||i.intersectsObject(w))){w.modelViewMatrix.multiplyMatrices(T.matrixWorldInverse,w.matrixWorld);const U=e.update(w),O=w.material;if(Array.isArray(O)){const Q=U.groups;for(let G=0,F=Q.length;G=1):Y.indexOf("OpenGL ES")!==-1&&(q=parseFloat(/^OpenGL ES (\d)/.exec(Y)[1]),F=q>=2);let H=null,V={};const D=n.getParameter(n.SCISSOR_BOX),k=n.getParameter(n.VIEWPORT),Z=new jt().fromArray(D),j=new jt().fromArray(k);function ee(ne,Fe,me,Qe){const Xe=new Uint8Array(4),Dt=n.createTexture();n.bindTexture(ne,Dt),n.texParameteri(ne,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(ne,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let Yt=0;Yt"u"?!1:/OculusBrowser/g.test(navigator.userAgent),m=new WeakMap;let y;const v=new WeakMap;let A=!1;try{A=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function _(X,z){return A?new OffscreenCanvas(X,z):Rp("canvas")}function x(X,z,se,Be){let Ce=1;if((X.width>Be||X.height>Be)&&(Ce=Be/Math.max(X.width,X.height)),Ce<1||z===!0)if(typeof HTMLImageElement<"u"&&X instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&X instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&X instanceof ImageBitmap){const we=z?Pm:Math.floor,ke=we(Ce*X.width),Ue=we(Ce*X.height);y===void 0&&(y=_(ke,Ue));const xe=se?_(ke,Ue):y;return xe.width=ke,xe.height=Ue,xe.getContext("2d").drawImage(X,0,0,ke,Ue),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+X.width+"x"+X.height+") to ("+ke+"x"+Ue+")."),xe}else return"data"in X&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+X.width+"x"+X.height+")."),X;return X}function E(X){return ay(X.width)&&ay(X.height)}function w(X){return o?!1:X.wrapS!==oi||X.wrapT!==oi||X.minFilter!==Rt&&X.minFilter!==Tn}function I(X,z){return X.generateMipmaps&&z&&X.minFilter!==Rt&&X.minFilter!==Tn}function T(X){n.generateMipmap(X)}function M(X,z,se,Be,Ce=!1){if(o===!1)return z;if(X!==null){if(n[X]!==void 0)return n[X];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+X+"'")}let we=z;return z===n.RED&&(se===n.FLOAT&&(we=n.R32F),se===n.HALF_FLOAT&&(we=n.R16F),se===n.UNSIGNED_BYTE&&(we=n.R8)),z===n.RG&&(se===n.FLOAT&&(we=n.RG32F),se===n.HALF_FLOAT&&(we=n.RG16F),se===n.UNSIGNED_BYTE&&(we=n.RG8)),z===n.RGBA&&(se===n.FLOAT&&(we=n.RGBA32F),se===n.HALF_FLOAT&&(we=n.RGBA16F),se===n.UNSIGNED_BYTE&&(we=Be===Nt&&Ce===!1?n.SRGB8_ALPHA8:n.RGBA8),se===n.UNSIGNED_SHORT_4_4_4_4&&(we=n.RGBA4),se===n.UNSIGNED_SHORT_5_5_5_1&&(we=n.RGB5_A1)),(we===n.R16F||we===n.R32F||we===n.RG16F||we===n.RG32F||we===n.RGBA16F||we===n.RGBA32F)&&e.get("EXT_color_buffer_float"),we}function b(X,z,se){return I(X,se)===!0||X.isFramebufferTexture&&X.minFilter!==Rt&&X.minFilter!==Tn?Math.log2(Math.max(z.width,z.height))+1:X.mipmaps!==void 0&&X.mipmaps.length>0?X.mipmaps.length:X.isCompressedTexture&&Array.isArray(X.image)?z.mipmaps.length:1}function B(X){return X===Rt||X===Bm||X===Kd?n.NEAREST:n.LINEAR}function L(X){const z=X.target;z.removeEventListener("dispose",L),O(z),z.isVideoTexture&&m.delete(z)}function U(X){const z=X.target;z.removeEventListener("dispose",U),G(z)}function O(X){const z=i.get(X);if(z.__webglInit===void 0)return;const se=X.source,Be=v.get(se);if(Be){const Ce=Be[z.__cacheKey];Ce.usedTimes--,Ce.usedTimes===0&&Q(X),Object.keys(Be).length===0&&v.delete(se)}i.remove(X)}function Q(X){const z=i.get(X);n.deleteTexture(z.__webglTexture);const se=X.source,Be=v.get(se);delete Be[z.__cacheKey],a.memory.textures--}function G(X){const z=X.texture,se=i.get(X),Be=i.get(z);if(Be.__webglTexture!==void 0&&(n.deleteTexture(Be.__webglTexture),a.memory.textures--),X.depthTexture&&X.depthTexture.dispose(),X.isWebGLCubeRenderTarget)for(let Ce=0;Ce<6;Ce++)n.deleteFramebuffer(se.__webglFramebuffer[Ce]),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer[Ce]);else{if(n.deleteFramebuffer(se.__webglFramebuffer),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer),se.__webglMultisampledFramebuffer&&n.deleteFramebuffer(se.__webglMultisampledFramebuffer),se.__webglColorRenderbuffer)for(let Ce=0;Ce=l&&console.warn("THREE.WebGLTextures: Trying to use "+X+" texture units while this GPU supports only "+l),F+=1,X}function H(X){const z=[];return z.push(X.wrapS),z.push(X.wrapT),z.push(X.wrapR||0),z.push(X.magFilter),z.push(X.minFilter),z.push(X.anisotropy),z.push(X.internalFormat),z.push(X.format),z.push(X.type),z.push(X.generateMipmaps),z.push(X.premultiplyAlpha),z.push(X.flipY),z.push(X.unpackAlignment),z.push(X.colorSpace),z.join()}function V(X,z){const se=i.get(X);if(X.isVideoTexture&&Se(X),X.isRenderTargetTexture===!1&&X.version>0&&se.__version!==X.version){const Be=X.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{ce(se,X,z);return}}t.bindTexture(n.TEXTURE_2D,se.__webglTexture,n.TEXTURE0+z)}function D(X,z){const se=i.get(X);if(X.version>0&&se.__version!==X.version){ce(se,X,z);return}t.bindTexture(n.TEXTURE_2D_ARRAY,se.__webglTexture,n.TEXTURE0+z)}function k(X,z){const se=i.get(X);if(X.version>0&&se.__version!==X.version){ce(se,X,z);return}t.bindTexture(n.TEXTURE_3D,se.__webglTexture,n.TEXTURE0+z)}function Z(X,z){const se=i.get(X);if(X.version>0&&se.__version!==X.version){ye(se,X,z);return}t.bindTexture(n.TEXTURE_CUBE_MAP,se.__webglTexture,n.TEXTURE0+z)}const j={[Qo]:n.REPEAT,[oi]:n.CLAMP_TO_EDGE,[yp]:n.MIRRORED_REPEAT},ee={[Rt]:n.NEAREST,[Bm]:n.NEAREST_MIPMAP_NEAREST,[Kd]:n.NEAREST_MIPMAP_LINEAR,[Tn]:n.LINEAR,[y6]:n.LINEAR_MIPMAP_NEAREST,[Ja]:n.LINEAR_MIPMAP_LINEAR},ie={[NC]:n.NEVER,[YC]:n.ALWAYS,[GC]:n.LESS,[QC]:n.LEQUAL,[zC]:n.EQUAL,[WC]:n.GEQUAL,[HC]:n.GREATER,[VC]:n.NOTEQUAL};function te(X,z,se){if(se?(n.texParameteri(X,n.TEXTURE_WRAP_S,j[z.wrapS]),n.texParameteri(X,n.TEXTURE_WRAP_T,j[z.wrapT]),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,j[z.wrapR]),n.texParameteri(X,n.TEXTURE_MAG_FILTER,ee[z.magFilter]),n.texParameteri(X,n.TEXTURE_MIN_FILTER,ee[z.minFilter])):(n.texParameteri(X,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(X,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),(X===n.TEXTURE_3D||X===n.TEXTURE_2D_ARRAY)&&n.texParameteri(X,n.TEXTURE_WRAP_R,n.CLAMP_TO_EDGE),(z.wrapS!==oi||z.wrapT!==oi)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(X,n.TEXTURE_MAG_FILTER,B(z.magFilter)),n.texParameteri(X,n.TEXTURE_MIN_FILTER,B(z.minFilter)),z.minFilter!==Rt&&z.minFilter!==Tn&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),z.compareFunction&&(n.texParameteri(X,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(X,n.TEXTURE_COMPARE_FUNC,ie[z.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){const Be=e.get("EXT_texture_filter_anisotropic");if(z.magFilter===Rt||z.minFilter!==Kd&&z.minFilter!==Ja||z.type===br&&e.has("OES_texture_float_linear")===!1||o===!1&&z.type===Ai&&e.has("OES_texture_half_float_linear")===!1)return;(z.anisotropy>1||i.get(z).__currentAnisotropy)&&(n.texParameterf(X,Be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(z.anisotropy,r.getMaxAnisotropy())),i.get(z).__currentAnisotropy=z.anisotropy)}}function re(X,z){let se=!1;X.__webglInit===void 0&&(X.__webglInit=!0,z.addEventListener("dispose",L));const Be=z.source;let Ce=v.get(Be);Ce===void 0&&(Ce={},v.set(Be,Ce));const we=H(z);if(we!==X.__cacheKey){Ce[we]===void 0&&(Ce[we]={texture:n.createTexture(),usedTimes:0},a.memory.textures++,se=!0),Ce[we].usedTimes++;const ke=Ce[X.__cacheKey];ke!==void 0&&(Ce[X.__cacheKey].usedTimes--,ke.usedTimes===0&&Q(z)),X.__cacheKey=we,X.__webglTexture=Ce[we].texture}return se}function ce(X,z,se){let Be=n.TEXTURE_2D;(z.isDataArrayTexture||z.isCompressedArrayTexture)&&(Be=n.TEXTURE_2D_ARRAY),z.isData3DTexture&&(Be=n.TEXTURE_3D);const Ce=re(X,z),we=z.source;t.bindTexture(Be,X.__webglTexture,n.TEXTURE0+se);const ke=i.get(we);if(we.version!==ke.__version||Ce===!0){t.activeTexture(n.TEXTURE0+se),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,z.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,z.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,z.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,n.NONE);const Ue=w(z)&&E(z.image)===!1;let xe=x(z.image,Ue,!1,u);xe=$e(z,xe);const ze=E(xe)||o,je=s.convert(z.format,z.colorSpace);let We=s.convert(z.type),Oe=M(z.internalFormat,je,We,z.colorSpace);te(Be,z,ze);let Ve;const it=z.mipmaps,gt=o&&z.isVideoTexture!==!0,ne=ke.__version===void 0||Ce===!0,Fe=b(z,xe,ze);if(z.isDepthTexture)Oe=n.DEPTH_COMPONENT,o?z.type===br?Oe=n.DEPTH_COMPONENT32F:z.type===Oo?Oe=n.DEPTH_COMPONENT24:z.type===ko?Oe=n.DEPTH24_STENCIL8:Oe=n.DEPTH_COMPONENT16:z.type===br&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),z.format===Bl&&Oe===n.DEPTH_COMPONENT&&z.type!==Au&&z.type!==Oo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),z.type=Oo,We=s.convert(z.type)),z.format===Nl&&Oe===n.DEPTH_COMPONENT&&(Oe=n.DEPTH_STENCIL,z.type!==ko&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),z.type=ko,We=s.convert(z.type))),ne&&(gt?t.texStorage2D(n.TEXTURE_2D,1,Oe,xe.width,xe.height):t.texImage2D(n.TEXTURE_2D,0,Oe,xe.width,xe.height,0,je,We,null));else if(z.isDataTexture)if(it.length>0&&ze){gt&&ne&&t.texStorage2D(n.TEXTURE_2D,Fe,Oe,it[0].width,it[0].height);for(let me=0,Qe=it.length;me>=1,Qe>>=1}}else if(it.length>0&&ze){gt&&ne&&t.texStorage2D(n.TEXTURE_2D,Fe,Oe,it[0].width,it[0].height);for(let me=0,Qe=it.length;me0&&ne++,t.texStorage2D(n.TEXTURE_CUBE_MAP,ne,Ve,xe[0].width,xe[0].height));for(let me=0;me<6;me++)if(Ue){it?t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,0,0,xe[me].width,xe[me].height,We,Oe,xe[me].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+me,0,Ve,xe[me].width,xe[me].height,0,We,Oe,xe[me].data);for(let Qe=0;Qe=n.TEXTURE_CUBE_MAP_POSITIVE_X&&Ce<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,Be,Ce,i.get(se).__webglTexture,0),t.bindFramebuffer(n.FRAMEBUFFER,null)}function W(X,z,se){if(n.bindRenderbuffer(n.RENDERBUFFER,X),z.depthBuffer&&!z.stencilBuffer){let Be=n.DEPTH_COMPONENT16;if(se||Le(z)){const Ce=z.depthTexture;Ce&&Ce.isDepthTexture&&(Ce.type===br?Be=n.DEPTH_COMPONENT32F:Ce.type===Oo&&(Be=n.DEPTH_COMPONENT24));const we=Re(z);Le(z)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,we,Be,z.width,z.height):n.renderbufferStorageMultisample(n.RENDERBUFFER,we,Be,z.width,z.height)}else n.renderbufferStorage(n.RENDERBUFFER,Be,z.width,z.height);n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,X)}else if(z.depthBuffer&&z.stencilBuffer){const Be=Re(z);se&&Le(z)===!1?n.renderbufferStorageMultisample(n.RENDERBUFFER,Be,n.DEPTH24_STENCIL8,z.width,z.height):Le(z)?f.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,Be,n.DEPTH24_STENCIL8,z.width,z.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,z.width,z.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,X)}else{const Be=z.isWebGLMultipleRenderTargets===!0?z.texture:[z.texture];for(let Ce=0;Ce0&&Le(X)===!1){const Ue=we?z:[z];se.__webglMultisampledFramebuffer=n.createFramebuffer(),se.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,se.__webglMultisampledFramebuffer);for(let xe=0;xe0&&Le(X)===!1){const z=X.isWebGLMultipleRenderTargets?X.texture:[X.texture],se=X.width,Be=X.height;let Ce=n.COLOR_BUFFER_BIT;const we=[],ke=X.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Ue=i.get(X),xe=X.isWebGLMultipleRenderTargets===!0;if(xe)for(let ze=0;ze0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&z.__useRenderToTexture!==!1}function Se(X){const z=a.render.frame;m.get(X)!==z&&(m.set(X,z),X.update())}function $e(X,z){const se=X.colorSpace,Be=X.format,Ce=X.type;return X.isCompressedTexture===!0||X.format===Dm||se!==fa&&se!==Pl&&(se===Nt?o===!1?e.has("EXT_sRGB")===!0&&Be===li?(X.format=Dm,X.minFilter=Tn,X.generateMipmaps=!1):z=B6.sRGBToLinear(z):(Be!==li||Ce!==Ri)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",se)),z}this.allocateTextureUnit=Y,this.resetTextureUnits=q,this.setTexture2D=V,this.setTexture2DArray=D,this.setTexture3D=k,this.setTextureCube=Z,this.rebindTextures=ue,this.setupRenderTarget=fe,this.updateRenderTargetMipmap=Pe,this.updateMultisampleRenderTarget=pe,this.setupDepthRenderbuffer=he,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Le}function rT(n,e,t){const i=t.isWebGL2;function r(s,a=Pl){let o;if(s===Ri)return n.UNSIGNED_BYTE;if(s===_6)return n.UNSIGNED_SHORT_4_4_4_4;if(s===E6)return n.UNSIGNED_SHORT_5_5_5_1;if(s===IC)return n.BYTE;if(s===MC)return n.SHORT;if(s===Au)return n.UNSIGNED_SHORT;if(s===x6)return n.INT;if(s===Oo)return n.UNSIGNED_INT;if(s===br)return n.FLOAT;if(s===Ai)return i?n.HALF_FLOAT:(o=e.get("OES_texture_half_float"),o!==null?o.HALF_FLOAT_OES:null);if(s===RC)return n.ALPHA;if(s===li)return n.RGBA;if(s===S6)return n.LUMINANCE;if(s===BC)return n.LUMINANCE_ALPHA;if(s===Bl)return n.DEPTH_COMPONENT;if(s===Nl)return n.DEPTH_STENCIL;if(s===Dm)return o=e.get("EXT_sRGB"),o!==null?o.SRGB_ALPHA_EXT:null;if(s===Qc)return n.RED;if(s===w6)return n.RED_INTEGER;if(s===wh)return n.RG;if(s===C6)return n.RG_INTEGER;if(s===T6)return n.RGBA_INTEGER;if(s===Ph||s===lm||s===cm||s===Lh)if(a===Nt)if(o=e.get("WEBGL_compressed_texture_s3tc_srgb"),o!==null){if(s===Ph)return o.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===lm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===cm)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===Lh)return o.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(o=e.get("WEBGL_compressed_texture_s3tc"),o!==null){if(s===Ph)return o.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===lm)return o.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===cm)return o.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===Lh)return o.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===xp||s===z5||s===_p||s===Q5)if(o=e.get("WEBGL_compressed_texture_pvrtc"),o!==null){if(s===xp)return o.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===z5)return o.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===_p)return o.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===Q5)return o.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===B2)return o=e.get("WEBGL_compressed_texture_etc1"),o!==null?o.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===Ep||s===Sp)if(o=e.get("WEBGL_compressed_texture_etc"),o!==null){if(s===Ep)return a===Nt?o.COMPRESSED_SRGB8_ETC2:o.COMPRESSED_RGB8_ETC2;if(s===Sp)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:o.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===wp||s===H5||s===V5||s===W5||s===Y5||s===q5||s===X5||s===j5||s===K5||s===$5||s===J5||s===Z5||s===ey||s===ty)if(o=e.get("WEBGL_compressed_texture_astc"),o!==null){if(s===wp)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:o.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===H5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:o.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===V5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:o.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===W5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:o.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===Y5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:o.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===q5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:o.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===X5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:o.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===j5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:o.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===K5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:o.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===$5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:o.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===J5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:o.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===Z5)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:o.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===ey)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:o.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===ty)return a===Nt?o.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:o.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Uh)if(o=e.get("EXT_texture_compression_bptc"),o!==null){if(s===Uh)return a===Nt?o.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:o.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===DC||s===ny||s===iy||s===ry)if(o=e.get("EXT_texture_compression_rgtc"),o!==null){if(s===Uh)return o.COMPRESSED_RED_RGTC1_EXT;if(s===ny)return o.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===iy)return o.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===ry)return o.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===ko?i?n.UNSIGNED_INT_24_8:(o=e.get("WEBGL_depth_texture"),o!==null?o.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:r}}class sT extends Kn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class bh extends fn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const eN={type:"move"};class dv{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new bh,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 bh,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new N,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new N),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new bh,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new N,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new N),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 i of e.hand.values())this._getHandJoint(t,i)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let r=null,s=null,a=null;const o=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){a=!0;for(const y of e.hand.values()){const v=t.getJointPose(y,i),A=this._getHandJoint(c,y);v!==null&&(A.matrix.fromArray(v.transform.matrix),A.matrix.decompose(A.position,A.rotation,A.scale),A.matrixWorldNeedsUpdate=!0,A.jointRadius=v.radius),A.visible=v!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],f=u.position.distanceTo(h.position),p=.02,m=.005;c.inputState.pinching&&f>p+m?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=p-m&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,i),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,i),r===null&&s!==null&&(r=s),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(eN)))}return o!==null&&(o.visible=r!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const i=new bh;i.matrixAutoUpdate=!1,i.visible=!1,e.joints[t.jointName]=i,e.add(i)}return e.joints[t.jointName]}}class uf extends Vn{constructor(e,t,i,r,s,a,o,l,c,u){if(u=u!==void 0?u:Bl,u!==Bl&&u!==Nl)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===Bl&&(i=Oo),i===void 0&&u===Nl&&(i=ko),super(null,r,s,a,o,l,u,i,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=o!==void 0?o:Rt,this.minFilter=l!==void 0?l:Rt,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 tN extends Yo{constructor(e,t){super();const i=this;let r=null,s=1,a=null,o="local-floor",l=1,c=null,u=null,h=null,f=null,p=null,m=null;const y=t.getContextAttributes();let v=null,A=null;const _=[],x=[],E=new Kn;E.layers.enable(1),E.viewport=new jt;const w=new Kn;w.layers.enable(2),w.viewport=new jt;const I=[E,w],T=new sT;T.layers.enable(1),T.layers.enable(2);let M=null,b=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(D){let k=_[D];return k===void 0&&(k=new dv,_[D]=k),k.getTargetRaySpace()},this.getControllerGrip=function(D){let k=_[D];return k===void 0&&(k=new dv,_[D]=k),k.getGripSpace()},this.getHand=function(D){let k=_[D];return k===void 0&&(k=new dv,_[D]=k),k.getHandSpace()};function B(D){const k=x.indexOf(D.inputSource);if(k===-1)return;const Z=_[k];Z!==void 0&&(Z.update(D.inputSource,D.frame,c||a),Z.dispatchEvent({type:D.type,data:D.inputSource}))}function L(){r.removeEventListener("select",B),r.removeEventListener("selectstart",B),r.removeEventListener("selectend",B),r.removeEventListener("squeeze",B),r.removeEventListener("squeezestart",B),r.removeEventListener("squeezeend",B),r.removeEventListener("end",L),r.removeEventListener("inputsourceschange",U);for(let D=0;D<_.length;D++){const k=x[D];k!==null&&(x[D]=null,_[D].disconnect(k))}M=null,b=null,e.setRenderTarget(v),p=null,f=null,h=null,r=null,A=null,V.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(D){s=D,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(D){o=D,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return c||a},this.setReferenceSpace=function(D){c=D},this.getBaseLayer=function(){return f!==null?f:p},this.getBinding=function(){return h},this.getFrame=function(){return m},this.getSession=function(){return r},this.setSession=async function(D){if(r=D,r!==null){if(v=e.getRenderTarget(),r.addEventListener("select",B),r.addEventListener("selectstart",B),r.addEventListener("selectend",B),r.addEventListener("squeeze",B),r.addEventListener("squeezestart",B),r.addEventListener("squeezeend",B),r.addEventListener("end",L),r.addEventListener("inputsourceschange",U),y.xrCompatible!==!0&&await t.makeXRCompatible(),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const k={antialias:r.renderState.layers===void 0?y.antialias:!0,alpha:!0,depth:y.depth,stencil:y.stencil,framebufferScaleFactor:s};p=new XRWebGLLayer(r,t,k),r.updateRenderState({baseLayer:p}),A=new Dn(p.framebufferWidth,p.framebufferHeight,{format:li,type:Ri,colorSpace:e.outputColorSpace,stencilBuffer:y.stencil})}else{let k=null,Z=null,j=null;y.depth&&(j=y.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,k=y.stencil?Nl:Bl,Z=y.stencil?ko:Oo);const ee={colorFormat:t.RGBA8,depthFormat:j,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(ee),r.updateRenderState({layers:[f]}),A=new Dn(f.textureWidth,f.textureHeight,{format:li,type:Ri,depthTexture:new uf(f.textureWidth,f.textureHeight,Z,void 0,void 0,void 0,void 0,void 0,void 0,k),stencilBuffer:y.stencil,colorSpace:e.outputColorSpace,samples:y.antialias?4:0});const ie=e.properties.get(A);ie.__ignoreDepthValues=f.ignoreDepthValues}A.isXRRenderTarget=!0,this.setFoveation(l),c=null,a=await r.requestReferenceSpace(o),V.setContext(r),V.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function U(D){for(let k=0;k=0&&(x[j]=null,_[j].disconnect(Z))}for(let k=0;k=x.length){x.push(Z),j=ie;break}else if(x[ie]===null){x[ie]=Z,j=ie;break}if(j===-1)break}const ee=_[j];ee&&ee.connect(Z)}}const O=new N,Q=new N;function G(D,k,Z){O.setFromMatrixPosition(k.matrixWorld),Q.setFromMatrixPosition(Z.matrixWorld);const j=O.distanceTo(Q),ee=k.projectionMatrix.elements,ie=Z.projectionMatrix.elements,te=ee[14]/(ee[10]-1),re=ee[14]/(ee[10]+1),ce=(ee[9]+1)/ee[5],ye=(ee[9]-1)/ee[5],oe=(ee[8]-1)/ee[0],W=(ie[8]+1)/ie[0],ge=te*oe,he=te*W,ue=j/(-oe+W),fe=ue*-oe;k.matrixWorld.decompose(D.position,D.quaternion,D.scale),D.translateX(fe),D.translateZ(ue),D.matrixWorld.compose(D.position,D.quaternion,D.scale),D.matrixWorldInverse.copy(D.matrixWorld).invert();const Pe=te+ue,pe=re+ue,Re=ge-fe,Le=he+(j-fe),Se=ce*re/pe*Pe,$e=ye*re/pe*Pe;D.projectionMatrix.makePerspective(Re,Le,Se,$e,Pe,pe),D.projectionMatrixInverse.copy(D.projectionMatrix).invert()}function F(D,k){k===null?D.matrixWorld.copy(D.matrix):D.matrixWorld.multiplyMatrices(k.matrixWorld,D.matrix),D.matrixWorldInverse.copy(D.matrixWorld).invert()}this.updateCamera=function(D){if(r===null)return;T.near=w.near=E.near=D.near,T.far=w.far=E.far=D.far,(M!==T.near||b!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),M=T.near,b=T.far);const k=D.parent,Z=T.cameras;F(T,k);for(let j=0;j0&&(v.alphaTest.value=A.alphaTest);const _=e.get(A).envMap;if(_&&(v.envMap.value=_,v.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,v.reflectivity.value=A.reflectivity,v.ior.value=A.ior,v.refractionRatio.value=A.refractionRatio),A.lightMap){v.lightMap.value=A.lightMap;const x=n.useLegacyLights===!0?Math.PI:1;v.lightMapIntensity.value=A.lightMapIntensity*x,t(A.lightMap,v.lightMapTransform)}A.aoMap&&(v.aoMap.value=A.aoMap,v.aoMapIntensity.value=A.aoMapIntensity,t(A.aoMap,v.aoMapTransform))}function a(v,A){v.diffuse.value.copy(A.color),v.opacity.value=A.opacity,A.map&&(v.map.value=A.map,t(A.map,v.mapTransform))}function o(v,A){v.dashSize.value=A.dashSize,v.totalSize.value=A.dashSize+A.gapSize,v.scale.value=A.scale}function l(v,A,_,x){v.diffuse.value.copy(A.color),v.opacity.value=A.opacity,v.size.value=A.size*_,v.scale.value=x*.5,A.map&&(v.map.value=A.map,t(A.map,v.uvTransform)),A.alphaMap&&(v.alphaMap.value=A.alphaMap,t(A.alphaMap,v.alphaMapTransform)),A.alphaTest>0&&(v.alphaTest.value=A.alphaTest)}function c(v,A){v.diffuse.value.copy(A.color),v.opacity.value=A.opacity,v.rotation.value=A.rotation,A.map&&(v.map.value=A.map,t(A.map,v.mapTransform)),A.alphaMap&&(v.alphaMap.value=A.alphaMap,t(A.alphaMap,v.alphaMapTransform)),A.alphaTest>0&&(v.alphaTest.value=A.alphaTest)}function u(v,A){v.specular.value.copy(A.specular),v.shininess.value=Math.max(A.shininess,1e-4)}function h(v,A){A.gradientMap&&(v.gradientMap.value=A.gradientMap)}function f(v,A){v.metalness.value=A.metalness,A.metalnessMap&&(v.metalnessMap.value=A.metalnessMap,t(A.metalnessMap,v.metalnessMapTransform)),v.roughness.value=A.roughness,A.roughnessMap&&(v.roughnessMap.value=A.roughnessMap,t(A.roughnessMap,v.roughnessMapTransform)),e.get(A).envMap&&(v.envMapIntensity.value=A.envMapIntensity)}function p(v,A,_){v.ior.value=A.ior,A.sheen>0&&(v.sheenColor.value.copy(A.sheenColor).multiplyScalar(A.sheen),v.sheenRoughness.value=A.sheenRoughness,A.sheenColorMap&&(v.sheenColorMap.value=A.sheenColorMap,t(A.sheenColorMap,v.sheenColorMapTransform)),A.sheenRoughnessMap&&(v.sheenRoughnessMap.value=A.sheenRoughnessMap,t(A.sheenRoughnessMap,v.sheenRoughnessMapTransform))),A.clearcoat>0&&(v.clearcoat.value=A.clearcoat,v.clearcoatRoughness.value=A.clearcoatRoughness,A.clearcoatMap&&(v.clearcoatMap.value=A.clearcoatMap,t(A.clearcoatMap,v.clearcoatMapTransform)),A.clearcoatRoughnessMap&&(v.clearcoatRoughnessMap.value=A.clearcoatRoughnessMap,t(A.clearcoatRoughnessMap,v.clearcoatRoughnessMapTransform)),A.clearcoatNormalMap&&(v.clearcoatNormalMap.value=A.clearcoatNormalMap,t(A.clearcoatNormalMap,v.clearcoatNormalMapTransform),v.clearcoatNormalScale.value.copy(A.clearcoatNormalScale),A.side===Ki&&v.clearcoatNormalScale.value.negate())),A.iridescence>0&&(v.iridescence.value=A.iridescence,v.iridescenceIOR.value=A.iridescenceIOR,v.iridescenceThicknessMinimum.value=A.iridescenceThicknessRange[0],v.iridescenceThicknessMaximum.value=A.iridescenceThicknessRange[1],A.iridescenceMap&&(v.iridescenceMap.value=A.iridescenceMap,t(A.iridescenceMap,v.iridescenceMapTransform)),A.iridescenceThicknessMap&&(v.iridescenceThicknessMap.value=A.iridescenceThicknessMap,t(A.iridescenceThicknessMap,v.iridescenceThicknessMapTransform))),A.transmission>0&&(v.transmission.value=A.transmission,v.transmissionSamplerMap.value=_.texture,v.transmissionSamplerSize.value.set(_.width,_.height),A.transmissionMap&&(v.transmissionMap.value=A.transmissionMap,t(A.transmissionMap,v.transmissionMapTransform)),v.thickness.value=A.thickness,A.thicknessMap&&(v.thicknessMap.value=A.thicknessMap,t(A.thicknessMap,v.thicknessMapTransform)),v.attenuationDistance.value=A.attenuationDistance,v.attenuationColor.value.copy(A.attenuationColor)),A.anisotropy>0&&(v.anisotropyVector.value.set(A.anisotropy*Math.cos(A.anisotropyRotation),A.anisotropy*Math.sin(A.anisotropyRotation)),A.anisotropyMap&&(v.anisotropyMap.value=A.anisotropyMap,t(A.anisotropyMap,v.anisotropyMapTransform))),v.specularIntensity.value=A.specularIntensity,v.specularColor.value.copy(A.specularColor),A.specularColorMap&&(v.specularColorMap.value=A.specularColorMap,t(A.specularColorMap,v.specularColorMapTransform)),A.specularIntensityMap&&(v.specularIntensityMap.value=A.specularIntensityMap,t(A.specularIntensityMap,v.specularIntensityMapTransform))}function m(v,A){A.matcap&&(v.matcap.value=A.matcap)}function y(v,A){const _=e.get(A).light;v.referencePosition.value.setFromMatrixPosition(_.matrixWorld),v.nearDistance.value=_.shadow.camera.near,v.farDistance.value=_.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function iN(n,e,t,i){let r={},s={},a=[];const o=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function l(_,x){const E=x.program;i.uniformBlockBinding(_,E)}function c(_,x){let E=r[_.id];E===void 0&&(m(_),E=u(_),r[_.id]=E,_.addEventListener("dispose",v));const w=x.program;i.updateUBOMapping(_,w);const I=e.render.frame;s[_.id]!==I&&(f(_),s[_.id]=I)}function u(_){const x=h();_.__bindingPointIndex=x;const E=n.createBuffer(),w=_.__size,I=_.usage;return n.bindBuffer(n.UNIFORM_BUFFER,E),n.bufferData(n.UNIFORM_BUFFER,w,I),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,x,E),E}function h(){for(let _=0;_0){I=E%w;const U=w-I;I!==0&&U-B.boundary<0&&(E+=w-I,b.__offset=E)}E+=B.storage}return I=E%w,I>0&&(E+=w-I),_.__size=E,_.__cache={},this}function y(_){const x={boundary:0,storage:0};return typeof _=="number"?(x.boundary=4,x.storage=4):_.isVector2?(x.boundary=8,x.storage=8):_.isVector3||_.isColor?(x.boundary=16,x.storage=12):_.isVector4?(x.boundary=16,x.storage=16):_.isMatrix3?(x.boundary=48,x.storage=48):_.isMatrix4?(x.boundary=64,x.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.",_),x}function v(_){const x=_.target;x.removeEventListener("dispose",v);const E=a.indexOf(x.__bindingPointIndex);a.splice(E,1),n.deleteBuffer(r[x.id]),delete r[x.id],delete s[x.id]}function A(){for(const _ in r)n.deleteBuffer(r[_]);a=[],r={},s={}}return{bind:l,update:c,dispose:A}}function rN(){const n=Rp("canvas");return n.style.display="block",n}class U6{constructor(e={}){const{canvas:t=rN(),context:i=null,depth:r=!0,stencil:s=!0,alpha:a=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=a;const p=new Uint32Array(4),m=new Int32Array(4);let y=null,v=null;const A=[],_=[];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=Nt,this.useLegacyLights=!0,this.toneMapping=os,this.toneMappingExposure=1;const x=this;let E=!1,w=0,I=0,T=null,M=-1,b=null;const B=new jt,L=new jt;let U=null;const O=new He(0);let Q=0,G=t.width,F=t.height,q=1,Y=null,H=null;const V=new jt(0,0,G,F),D=new jt(0,0,G,F);let k=!1;const Z=new c0;let j=!1,ee=!1,ie=null;const te=new ct,re=new _e,ce=new N,ye={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function oe(){return T===null?q:1}let W=i;function ge(K,Ae){for(let Ie=0;Ie0?v=_[_.length-1]:v=null,A.pop(),A.length>0?y=A[A.length-1]:y=null};function Zi(K,Ae,Ie,de){if(K.visible===!1)return;if(K.layers.test(Ae.layers)){if(K.isGroup)Ie=K.renderOrder;else if(K.isLOD)K.autoUpdate===!0&&K.update(Ae);else if(K.isLight)v.pushLight(K),K.castShadow&&v.pushShadow(K);else if(K.isSprite){if(!K.frustumCulled||Z.intersectsSprite(K)){de&&ce.setFromMatrixPosition(K.matrixWorld).applyMatrix4(te);const mt=z.update(K),At=K.material;At.visible&&y.push(K,mt,At,Ie,ce.z,null)}}else if((K.isMesh||K.isLine||K.isPoints)&&(!K.frustumCulled||Z.intersectsObject(K))){const mt=z.update(K),At=K.material;if(de&&(K.boundingSphere!==void 0?(K.boundingSphere===null&&K.computeBoundingSphere(),ce.copy(K.boundingSphere.center)):(mt.boundingSphere===null&&mt.computeBoundingSphere(),ce.copy(mt.boundingSphere.center)),ce.applyMatrix4(K.matrixWorld).applyMatrix4(te)),Array.isArray(At)){const Et=mt.groups;for(let Ut=0,Ge=Et.length;Ut0&&on(Me,rt,Ae,Ie),de&&fe.viewport(B.copy(de)),Me.length>0&&Pn(Me,Ae,Ie),rt.length>0&&Pn(rt,Ae,Ie),mt.length>0&&Pn(mt,Ae,Ie),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function on(K,Ae,Ie,de){const Me=ue.isWebGL2;ie===null&&(ie=new Dn(1,1,{generateMipmaps:!0,type:he.has("EXT_color_buffer_half_float")?Ai:Ri,minFilter:Ja,samples:Me?4:0})),x.getDrawingBufferSize(re),Me?ie.setSize(re.x,re.y):ie.setSize(Pm(re.x),Pm(re.y));const rt=x.getRenderTarget();x.setRenderTarget(ie),x.getClearColor(O),Q=x.getClearAlpha(),Q<1&&x.setClearColor(16777215,.5),x.clear();const mt=x.toneMapping;x.toneMapping=os,Pn(K,Ie,de),Re.updateMultisampleRenderTarget(ie),Re.updateRenderTargetMipmap(ie);let At=!1;for(let Et=0,Ut=Ae.length;Et0),vt=!!Ie.morphAttributes.position,wn=!!Ie.morphAttributes.normal,ln=!!Ie.morphAttributes.color,Oi=de.toneMapped?x.toneMapping:os,er=Ie.morphAttributes.position||Ie.morphAttributes.normal||Ie.morphAttributes.color,pn=er!==void 0?er.length:0,Ct=pe.get(de),tn=v.state.lights;if(j===!0&&(ee===!0||K!==b)){const yi=K===b&&de.id===M;ke.setState(de,K,yi)}let Tt=!1;de.version===Ct.__version?(Ct.needsLights&&Ct.lightsStateVersion!==tn.state.version||Ct.outputColorSpace!==At||Me.isInstancedMesh&&Ct.instancing===!1||!Me.isInstancedMesh&&Ct.instancing===!0||Me.isSkinnedMesh&&Ct.skinning===!1||!Me.isSkinnedMesh&&Ct.skinning===!0||Ct.envMap!==Et||de.fog===!0&&Ct.fog!==rt||Ct.numClippingPlanes!==void 0&&(Ct.numClippingPlanes!==ke.numPlanes||Ct.numIntersection!==ke.numIntersection)||Ct.vertexAlphas!==Ut||Ct.vertexTangents!==Ge||Ct.morphTargets!==vt||Ct.morphNormals!==wn||Ct.morphColors!==ln||Ct.toneMapping!==Oi||ue.isWebGL2===!0&&Ct.morphTargetsCount!==pn)&&(Tt=!0):(Tt=!0,Ct.__version=de.version);let hi=Ct.currentProgram;Tt===!0&&(hi=Mn(de,Ae,Me));let ti=!1,Gn=!1,Lr=!1;const Cn=hi.getUniforms(),Ln=Ct.uniforms;if(fe.useProgram(hi.program)&&(ti=!0,Gn=!0,Lr=!0),de.id!==M&&(M=de.id,Gn=!0),ti||b!==K){if(Cn.setValue(W,"projectionMatrix",K.projectionMatrix),ue.logarithmicDepthBuffer&&Cn.setValue(W,"logDepthBufFC",2/(Math.log(K.far+1)/Math.LN2)),b!==K&&(b=K,Gn=!0,Lr=!0),de.isShaderMaterial||de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshStandardMaterial||de.envMap){const yi=Cn.map.cameraPosition;yi!==void 0&&yi.setValue(W,ce.setFromMatrixPosition(K.matrixWorld))}(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial)&&Cn.setValue(W,"isOrthographic",K.isOrthographicCamera===!0),(de.isMeshPhongMaterial||de.isMeshToonMaterial||de.isMeshLambertMaterial||de.isMeshBasicMaterial||de.isMeshStandardMaterial||de.isShaderMaterial||de.isShadowMaterial||Me.isSkinnedMesh)&&Cn.setValue(W,"viewMatrix",K.matrixWorldInverse)}if(Me.isSkinnedMesh){Cn.setOptional(W,Me,"bindMatrix"),Cn.setOptional(W,Me,"bindMatrixInverse");const yi=Me.skeleton;yi&&(ue.floatVertexTextures?(yi.boneTexture===null&&yi.computeBoneTexture(),Cn.setValue(W,"boneTexture",yi.boneTexture,Re),Cn.setValue(W,"boneTextureSize",yi.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 dr=Ie.morphAttributes;if((dr.position!==void 0||dr.normal!==void 0||dr.color!==void 0&&ue.isWebGL2===!0)&&ze.update(Me,Ie,hi),(Gn||Ct.receiveShadow!==Me.receiveShadow)&&(Ct.receiveShadow=Me.receiveShadow,Cn.setValue(W,"receiveShadow",Me.receiveShadow)),de.isMeshGouraudMaterial&&de.envMap!==null&&(Ln.envMap.value=Et,Ln.flipEnvMap.value=Et.isCubeTexture&&Et.isRenderTargetTexture===!1?-1:1),Gn&&(Cn.setValue(W,"toneMappingExposure",x.toneMappingExposure),Ct.needsLights&&ys(Ln,Lr),rt&&de.fog===!0&&Be.refreshFogUniforms(Ln,rt),Be.refreshMaterialUniforms(Ln,de,q,F,ie),dm.upload(W,Ct.uniformsList,Ln,Re)),de.isShaderMaterial&&de.uniformsNeedUpdate===!0&&(dm.upload(W,Ct.uniformsList,Ln,Re),de.uniformsNeedUpdate=!1),de.isSpriteMaterial&&Cn.setValue(W,"center",Me.center),Cn.setValue(W,"modelViewMatrix",Me.modelViewMatrix),Cn.setValue(W,"normalMatrix",Me.normalMatrix),Cn.setValue(W,"modelMatrix",Me.matrixWorld),de.isShaderMaterial||de.isRawShaderMaterial){const yi=de.uniformsGroups;for(let wa=0,Ca=yi.length;wa0&&Re.useMultisampledRTT(K)===!1?Me=pe.get(K).__webglMultisampledFramebuffer:Me=Ge,B.copy(K.viewport),L.copy(K.scissor),U=K.scissorTest}else B.copy(V).multiplyScalar(q).floor(),L.copy(D).multiplyScalar(q).floor(),U=k;if(fe.bindFramebuffer(W.FRAMEBUFFER,Me)&&ue.drawBuffers&&de&&fe.drawBuffers(K,Me),fe.viewport(B),fe.scissor(L),fe.setScissorTest(U),rt){const Et=pe.get(K.texture);W.framebufferTexture2D(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,W.TEXTURE_CUBE_MAP_POSITIVE_X+Ae,Et.__webglTexture,Ie)}else if(mt){const Et=pe.get(K.texture),Ut=Ae||0;W.framebufferTextureLayer(W.FRAMEBUFFER,W.COLOR_ATTACHMENT0,Et.__webglTexture,Ie||0,Ut)}M=-1},this.readRenderTargetPixels=function(K,Ae,Ie,de,Me,rt,mt){if(!(K&&K.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let At=pe.get(K).__webglFramebuffer;if(K.isWebGLCubeRenderTarget&&mt!==void 0&&(At=At[mt]),At){fe.bindFramebuffer(W.FRAMEBUFFER,At);try{const Et=K.texture,Ut=Et.format,Ge=Et.type;if(Ut!==li&&Oe.convert(Ut)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const vt=Ge===Ai&&(he.has("EXT_color_buffer_half_float")||ue.isWebGL2&&he.has("EXT_color_buffer_float"));if(Ge!==Ri&&Oe.convert(Ge)!==W.getParameter(W.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ge===br&&(ue.isWebGL2||he.has("OES_texture_float")||he.has("WEBGL_color_buffer_float")))&&!vt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}Ae>=0&&Ae<=K.width-de&&Ie>=0&&Ie<=K.height-Me&&W.readPixels(Ae,Ie,de,Me,Oe.convert(Ut),Oe.convert(Ge),rt)}finally{const Et=T!==null?pe.get(T).__webglFramebuffer:null;fe.bindFramebuffer(W.FRAMEBUFFER,Et)}}},this.copyFramebufferToTexture=function(K,Ae,Ie=0){const de=Math.pow(2,-Ie),Me=Math.floor(Ae.image.width*de),rt=Math.floor(Ae.image.height*de);Re.setTexture2D(Ae,0),W.copyTexSubImage2D(W.TEXTURE_2D,Ie,0,0,K.x,K.y,Me,rt),fe.unbindTexture()},this.copyTextureToTexture=function(K,Ae,Ie,de=0){const Me=Ae.image.width,rt=Ae.image.height,mt=Oe.convert(Ie.format),At=Oe.convert(Ie.type);Re.setTexture2D(Ie,0),W.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,Ie.flipY),W.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,Ie.premultiplyAlpha),W.pixelStorei(W.UNPACK_ALIGNMENT,Ie.unpackAlignment),Ae.isDataTexture?W.texSubImage2D(W.TEXTURE_2D,de,K.x,K.y,Me,rt,mt,At,Ae.image.data):Ae.isCompressedTexture?W.compressedTexSubImage2D(W.TEXTURE_2D,de,K.x,K.y,Ae.mipmaps[0].width,Ae.mipmaps[0].height,mt,Ae.mipmaps[0].data):W.texSubImage2D(W.TEXTURE_2D,de,K.x,K.y,mt,At,Ae.image),de===0&&Ie.generateMipmaps&&W.generateMipmap(W.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(K,Ae,Ie,de,Me=0){if(x.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const rt=K.max.x-K.min.x+1,mt=K.max.y-K.min.y+1,At=K.max.z-K.min.z+1,Et=Oe.convert(de.format),Ut=Oe.convert(de.type);let Ge;if(de.isData3DTexture)Re.setTexture3D(de,0),Ge=W.TEXTURE_3D;else if(de.isDataArrayTexture)Re.setTexture2DArray(de,0),Ge=W.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}W.pixelStorei(W.UNPACK_FLIP_Y_WEBGL,de.flipY),W.pixelStorei(W.UNPACK_PREMULTIPLY_ALPHA_WEBGL,de.premultiplyAlpha),W.pixelStorei(W.UNPACK_ALIGNMENT,de.unpackAlignment);const vt=W.getParameter(W.UNPACK_ROW_LENGTH),wn=W.getParameter(W.UNPACK_IMAGE_HEIGHT),ln=W.getParameter(W.UNPACK_SKIP_PIXELS),Oi=W.getParameter(W.UNPACK_SKIP_ROWS),er=W.getParameter(W.UNPACK_SKIP_IMAGES),pn=Ie.isCompressedTexture?Ie.mipmaps[0]:Ie.image;W.pixelStorei(W.UNPACK_ROW_LENGTH,pn.width),W.pixelStorei(W.UNPACK_IMAGE_HEIGHT,pn.height),W.pixelStorei(W.UNPACK_SKIP_PIXELS,K.min.x),W.pixelStorei(W.UNPACK_SKIP_ROWS,K.min.y),W.pixelStorei(W.UNPACK_SKIP_IMAGES,K.min.z),Ie.isDataTexture||Ie.isData3DTexture?W.texSubImage3D(Ge,Me,Ae.x,Ae.y,Ae.z,rt,mt,At,Et,Ut,pn.data):Ie.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),W.compressedTexSubImage3D(Ge,Me,Ae.x,Ae.y,Ae.z,rt,mt,At,Et,pn.data)):W.texSubImage3D(Ge,Me,Ae.x,Ae.y,Ae.z,rt,mt,At,Et,Ut,pn),W.pixelStorei(W.UNPACK_ROW_LENGTH,vt),W.pixelStorei(W.UNPACK_IMAGE_HEIGHT,wn),W.pixelStorei(W.UNPACK_SKIP_PIXELS,ln),W.pixelStorei(W.UNPACK_SKIP_ROWS,Oi),W.pixelStorei(W.UNPACK_SKIP_IMAGES,er),Me===0&&de.generateMipmaps&&W.generateMipmap(Ge),fe.unbindTexture()},this.initTexture=function(K){K.isCubeTexture?Re.setTextureCube(K,0):K.isData3DTexture?Re.setTexture3D(K,0):K.isDataArrayTexture||K.isCompressedArrayTexture?Re.setTexture2DArray(K,0):Re.setTexture2D(K,0),fe.unbindTexture()},this.resetState=function(){w=0,I=0,T=null,fe.reset(),Ve.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return za}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===Nt?Dl:I6}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=e===Dl?Nt:fa}}class aT extends U6{}aT.prototype.isWebGL1Renderer=!0;class k2{constructor(e,t=25e-5){this.isFogExp2=!0,this.name="",this.color=new He(e),this.density=t}clone(){return new k2(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}class N2{constructor(e,t=1,i=1e3){this.isFog=!0,this.name="",this.color=new He(e),this.near=t,this.far=i}clone(){return new N2(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}class Bp extends fn{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 G2{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ip,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=ls()}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,i){e*=this.stride,i*=t.stride;for(let r=0,s=this.stride;re.far||t.push({distance:l,point:$f.clone(),uv:Qr.getInterpolation($f,sg,Zf,ag,K_,pv,$_,new _e),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 og(n,e,t,i,r,s){oh.subVectors(n,t).addScalar(.5).multiply(i),r!==void 0?(Jf.x=s*oh.x-r*oh.y,Jf.y=r*oh.x+s*oh.y):Jf.copy(oh),n.copy(e),n.x+=Jf.x,n.y+=Jf.y,n.applyMatrix4(oT)}const lg=new N,J_=new N;class cT extends fn{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 i=0,r=t.length;i0){let i,r;for(i=1,r=t.length;i0){lg.setFromMatrixPosition(this.matrixWorld);const r=e.ray.origin.distanceTo(lg);this.getObjectForDistance(r).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){lg.setFromMatrixPosition(e.matrixWorld),J_.setFromMatrixPosition(this.matrixWorld);const i=lg.distanceTo(J_)/e.zoom;t[0].object.visible=!0;let r,s;for(r=1,s=t.length;r=a)t[r-1].object.visible=!1,t[r].object.visible=!0;else break}for(this._currentLevel=r-1;rl)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:x,face:null,faceIndex:null,object:this})}}else{const A=Math.max(0,a.start),_=Math.min(v.count,a.start+a.count);for(let x=A,E=_-1;xl)continue;f.applyMatrix4(this.matrixWorld);const I=e.ray.origin.distanceTo(f);Ie.far||t.push({distance:I,point:h.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;s0){const r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=r.length;sr.far)return;s.push({distance:c,distanceToRay:Math.sqrt(o),point:l,index:e,face:null,object:a})}}class lN extends Vn{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isVideoTexture=!0,this.minFilter=a!==void 0?a:Tn,this.magFilter=s!==void 0?s:Tn,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 cN extends Vn{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Rt,this.minFilter=Rt,this.generateMipmaps=!1,this.needsUpdate=!0}}class iu extends Vn{constructor(e,t,i,r,s,a,o,l,c,u,h,f){super(null,a,o,l,c,u,r,s,h,f),this.isCompressedTexture=!0,this.image={width:t,height:i},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}let uN=class extends iu{constructor(e,t,i,r,s,a){super(e,t,i,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=oi}};class hN extends Vn{constructor(e,t,i,r,s,a,o,l,c){super(e,t,i,r,s,a,o,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Aa{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/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 i,r=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)i=this.getPoint(a/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let r=0;const s=i.length;let a;t?a=t:a=e*i[s-1];let o=0,l=s-1,c;for(;o<=l;)if(r=Math.floor(o+(l-o)/2),c=i[r]-a,c<0)o=r+1;else if(c>0)l=r-1;else{l=r;break}if(r=l,i[r]===a)return r/(s-1);const u=i[r],f=i[r+1]-u,p=(a-u)/f;return(r+p)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);const a=this.getPoint(r),o=this.getPoint(s),l=t||(a.isVector2?new _e:new N);return l.copy(o).sub(a).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new N,r=[],s=[],a=[],o=new N,l=new ct;for(let p=0;p<=e;p++){const m=p/e;r[p]=this.getTangentAt(m,new N)}s[0]=new N,a[0]=new N;let c=Number.MAX_VALUE;const u=Math.abs(r[0].x),h=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),f<=c&&i.set(0,0,1),o.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],o),a[0].crossVectors(r[0],s[0]);for(let p=1;p<=e;p++){if(s[p]=s[p-1].clone(),a[p]=a[p-1].clone(),o.crossVectors(r[p-1],r[p]),o.length()>Number.EPSILON){o.normalize();const m=Math.acos(si(r[p-1].dot(r[p]),-1,1));s[p].applyMatrix4(l.makeRotationAxis(o,m))}a[p].crossVectors(r[p],s[p])}if(t===!0){let p=Math.acos(si(s[0].dot(s[e]),-1,1));p/=e,r[0].dot(o.crossVectors(s[0],s[e]))>0&&(p=-p);for(let m=1;m<=e;m++)s[m].applyMatrix4(l.makeRotationAxis(r[m],p*m)),a[m].crossVectors(r[m],s[m])}return{tangents:r,normals:s,binormals:a}}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 Q2 extends Aa{constructor(e=0,t=0,i=1,r=1,s=0,a=Math.PI*2,o=!1,l=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=l}getPoint(e,t){const i=t||new _e,r=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)r;)s-=r;s0?0:(Math.floor(Math.abs(o)/s)+1)*s:l===0&&o===s-1&&(o=s-2,l=1);let c,u;this.closed||o>0?c=r[(o-1)%s]:(dg.subVectors(r[0],r[1]).add(r[0]),c=dg);const h=r[o%s],f=r[(o+1)%s];if(this.closed||o+2r.length-2?r.length-1:a+1],h=r[a>r.length-3?r.length-1:a+2];return i.set(pE(o,l.x,c.x,u.x,h.x),pE(o,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const a=r[s]-i,o=this.curves[s],l=o.getLength(),c=l===0?0:1-a/l;return o.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 i=0,r=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=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 h0 extends Bt{constructor(e=[new _e(0,-.5),new _e(.5,0),new _e(0,.5)],t=12,i=0,r=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:i,phiLength:r},t=Math.floor(t),r=si(r,0,Math.PI*2);const s=[],a=[],o=[],l=[],c=[],u=1/t,h=new N,f=new _e,p=new N,m=new N,y=new N;let v=0,A=0;for(let _=0;_<=e.length-1;_++)switch(_){case 0:v=e[_+1].x-e[_].x,A=e[_+1].y-e[_].y,p.x=A*1,p.y=-v,p.z=A*0,y.copy(p),p.normalize(),l.push(p.x,p.y,p.z);break;case e.length-1:l.push(y.x,y.y,y.z);break;default:v=e[_+1].x-e[_].x,A=e[_+1].y-e[_].y,p.x=A*1,p.y=-v,p.z=A*0,m.copy(p),p.x+=y.x,p.y+=y.y,p.z+=y.z,p.normalize(),l.push(p.x,p.y,p.z),y.copy(m)}for(let _=0;_<=t;_++){const x=i+_*u*r,E=Math.sin(x),w=Math.cos(x);for(let I=0;I<=e.length-1;I++){h.x=e[I].x*E,h.y=e[I].y,h.z=e[I].x*w,a.push(h.x,h.y,h.z),f.x=_/t,f.y=I/(e.length-1),o.push(f.x,f.y);const T=l[3*I+0]*E,M=l[3*I+1],b=l[3*I+0]*w;c.push(T,M,b)}}for(let _=0;_0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new ot(h,3)),this.setAttribute("normal",new ot(f,3)),this.setAttribute("uv",new ot(p,2));function _(){const E=new N,w=new N;let I=0;const T=(t-e)/i;for(let M=0;M<=s;M++){const b=[],B=M/s,L=B*(t-e)+e;for(let U=0;U<=r;U++){const O=U/r,Q=O*l+o,G=Math.sin(Q),F=Math.cos(Q);w.x=L*G,w.y=-B*i+v,w.z=L*F,h.push(w.x,w.y,w.z),E.set(G,T,F).normalize(),f.push(E.x,E.y,E.z),p.push(O,1-B),b.push(m++)}y.push(b)}for(let M=0;M.9&&T<.1&&(x<.2&&(a[_+0]+=1),E<.2&&(a[_+2]+=1),w<.2&&(a[_+4]+=1))}}function f(_){s.push(_.x,_.y,_.z)}function p(_,x){const E=_*3;x.x=e[E+0],x.y=e[E+1],x.z=e[E+2]}function m(){const _=new N,x=new N,E=new N,w=new N,I=new _e,T=new _e,M=new _e;for(let b=0,B=0;b80*t){o=c=n[0],l=u=n[1];for(let m=t;mc&&(c=h),f>u&&(u=f);p=Math.max(c-o,u-l),p=p!==0?32767/p:0}return Pp(s,a,t,o,l,p,0),a}};function vT(n,e,t,i,r){let s,a;if(r===UN(n,e,t,i)>0)for(s=e;s=e;s-=i)a=gE(s,n[s],n[s+1],a);return a&&j2(a,a.next)&&(Up(a),a=a.next),a}function ru(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(j2(t,t.next)||Jn(t.prev,t,t.next)===0)){if(Up(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Pp(n,e,t,i,r,s,a){if(!n)return;!a&&s&&MN(n,i,r,s);let o=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?_N(n,i,r,s):xN(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Up(n),n=c.next,o=c.next;continue}if(n=c,n===o){a?a===1?(n=EN(ru(n),e,t),Pp(n,e,t,i,r,s,2)):a===2&&SN(n,e,t,i,r,s):Pp(ru(n),e,t,i,r,s,1);break}}}function xN(n){const e=n.prev,t=n,i=n.next;if(Jn(e,t,i)>=0)return!1;const r=e.x,s=t.x,a=i.x,o=e.y,l=t.y,c=i.y,u=rs?r>a?r:a:s>a?s:a,p=o>l?o>c?o:c:l>c?l:c;let m=i.next;for(;m!==e;){if(m.x>=u&&m.x<=f&&m.y>=h&&m.y<=p&&Ih(r,o,s,l,a,c,m.x,m.y)&&Jn(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function _N(n,e,t,i){const r=n.prev,s=n,a=n.next;if(Jn(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,u=r.y,h=s.y,f=a.y,p=ol?o>c?o:c:l>c?l:c,v=u>h?u>f?u:f:h>f?h:f,A=uy(p,m,e,t,i),_=uy(y,v,e,t,i);let x=n.prevZ,E=n.nextZ;for(;x&&x.z>=A&&E&&E.z<=_;){if(x.x>=p&&x.x<=y&&x.y>=m&&x.y<=v&&x!==r&&x!==a&&Ih(o,u,l,h,c,f,x.x,x.y)&&Jn(x.prev,x,x.next)>=0||(x=x.prevZ,E.x>=p&&E.x<=y&&E.y>=m&&E.y<=v&&E!==r&&E!==a&&Ih(o,u,l,h,c,f,E.x,E.y)&&Jn(E.prev,E,E.next)>=0))return!1;E=E.nextZ}for(;x&&x.z>=A;){if(x.x>=p&&x.x<=y&&x.y>=m&&x.y<=v&&x!==r&&x!==a&&Ih(o,u,l,h,c,f,x.x,x.y)&&Jn(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;E&&E.z<=_;){if(E.x>=p&&E.x<=y&&E.y>=m&&E.y<=v&&E!==r&&E!==a&&Ih(o,u,l,h,c,f,E.x,E.y)&&Jn(E.prev,E,E.next)>=0)return!1;E=E.nextZ}return!0}function EN(n,e,t){let i=n;do{const r=i.prev,s=i.next.next;!j2(r,s)&&yT(r,i,i.next,s)&&Lp(r,s)&&Lp(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),Up(i),Up(i.next),i=n=s),i=i.next}while(i!==n);return ru(i)}function SN(n,e,t,i,r,s){let a=n;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&DN(a,o)){let l=xT(a,o);a=ru(a,a.next),l=ru(l,l.next),Pp(a,e,t,i,r,s,0),Pp(l,e,t,i,r,s,0);return}o=o.next}a=a.next}while(a!==n)}function wN(n,e,t,i){const r=[];let s,a,o,l,c;for(s=0,a=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(a-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x=t.x&&t.x>=l&&s!==t.x&&Ih(ar.x||t.x===r.x&&IN(r,t)))&&(r=t,u=h)),t=t.next;while(t!==o);return r}function IN(n,e){return Jn(n.prev,n,e.prev)<0&&Jn(e.next,n,n.next)<0}function MN(n,e,t,i){let r=n;do r.z===0&&(r.z=uy(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,RN(r)}function RN(n){let e,t,i,r,s,a,o,l,c=1;do{for(t=n,n=null,s=null,a=0;t;){for(a++,i=t,o=0,e=0;e0||l>0&&i;)o!==0&&(l===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,o--):(r=i,i=i.nextZ,l--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,c*=2}while(a>1);return n}function uy(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function BN(n){let e=n,t=n;do(e.x=(n-a)*(s-o)&&(n-a)*(i-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(r-a)*(i-o)}function DN(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!PN(n,e)&&(Lp(n,e)&&Lp(e,n)&&LN(n,e)&&(Jn(n.prev,n,e.prev)||Jn(n,e.prev,e))||j2(n,e)&&Jn(n.prev,n,n.next)>0&&Jn(e.prev,e,e.next)>0)}function Jn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function j2(n,e){return n.x===e.x&&n.y===e.y}function yT(n,e,t,i){const r=vg(Jn(n,e,t)),s=vg(Jn(n,e,i)),a=vg(Jn(t,i,n)),o=vg(Jn(t,i,e));return!!(r!==s&&a!==o||r===0&&Ag(n,t,e)||s===0&&Ag(n,i,e)||a===0&&Ag(t,n,i)||o===0&&Ag(t,e,i))}function Ag(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function vg(n){return n>0?1:n<0?-1:0}function PN(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&yT(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Lp(n,e){return Jn(n.prev,n,n.next)<0?Jn(n,e,n.next)>=0&&Jn(n,n.prev,e)>=0:Jn(n,e,n.prev)<0||Jn(n,n.next,e)<0}function LN(n,e){let t=n,i=!1;const r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function xT(n,e){const t=new hy(n.i,n.x,n.y),i=new hy(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function gE(n,e,t,i){const r=new hy(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Up(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function hy(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function UN(n,e,t,i){let r=0;for(let s=e,a=t-i;s2&&n[e-1].equals(n[0])&&n.pop()}function AE(n,e){for(let t=0;tNumber.EPSILON){const z=Math.sqrt($e),se=Math.sqrt(Le*Le+Se*Se),Be=ge.x-Re/z,Ce=ge.y+pe/z,we=he.x-Se/se,ke=he.y+Le/se,Ue=((we-Be)*Se-(ke-Ce)*Le)/(pe*Se-Re*Le);ue=Be+pe*Ue-W.x,fe=Ce+Re*Ue-W.y;const xe=ue*ue+fe*fe;if(xe<=2)return new _e(ue,fe);Pe=Math.sqrt(xe/2)}else{let z=!1;pe>Number.EPSILON?Le>Number.EPSILON&&(z=!0):pe<-Number.EPSILON?Le<-Number.EPSILON&&(z=!0):Math.sign(Re)===Math.sign(Se)&&(z=!0),z?(ue=-Re,fe=pe,Pe=Math.sqrt($e)):(ue=pe,fe=Re,Pe=Math.sqrt($e/2))}return new _e(ue/Pe,fe/Pe)}const H=[];for(let W=0,ge=Q.length,he=ge-1,ue=W+1;W=0;W--){const ge=W/v,he=p*Math.cos(ge*Math.PI/2),ue=m*Math.sin(ge*Math.PI/2)+y;for(let fe=0,Pe=Q.length;fe=0;){const ue=he;let fe=he-1;fe<0&&(fe=W.length-1);for(let Pe=0,pe=u+v*2;Pe0)&&p.push(x,E,I),(A!==i-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class wT extends Ji{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new He(16777215),this.specular=new He(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a0,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 CT extends Ji{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new He(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(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 p0 extends Ji{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(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 TT extends Ji{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=a0,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 bT extends Ji{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new He(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Yl,this.normalScale=new _e(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 IT extends Rr{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 Ps(n,e,t){return q6(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function Yc(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function q6(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function MT(n){function e(r,s){return n[r]-n[s]}const t=n.length,i=new Array(t);for(let r=0;r!==t;++r)i[r]=r;return i.sort(e),i}function fy(n,e,t){const i=n.length,r=new n.constructor(i);for(let s=0,a=0;a!==i;++s){const o=t[s]*e;for(let l=0;l!==e;++l)r[a++]=n[o+l]}return r}function X6(n,e,t,i){let r=1,s=n[0];for(;s!==void 0&&s[i]===void 0;)s=n[r++];if(s===void 0)return;let a=s[i];if(a!==void 0)if(Array.isArray(a))do a=s[i],a!==void 0&&(e.push(s.time),t.push.apply(t,a)),s=n[r++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[i],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=n[r++];while(s!==void 0);else do a=s[i],a!==void 0&&(e.push(s.time),t.push(a)),s=n[r++];while(s!==void 0)}function NN(n,e,t,i,r=30){const s=n.clone();s.name=e;const a=[];for(let l=0;l=i)){h.push(c.times[p]);for(let y=0;ys.tracks[l].times[0]&&(o=s.tracks[l].times[0]);for(let l=0;l=o.times[m]){const A=m*h+u,_=A+h-u;y=Ps(o.values,A,_)}else{const A=o.createInterpolant(),_=u,x=h-u;A.evaluate(s),y=Ps(A.resultBuffer,_,x)}l==="quaternion"&&new $i().fromArray(y).normalize().conjugate().toArray(y);const v=c.times.length;for(let A=0;A=s)){const o=t[1];e=s)break t}a=i,i=0;break n}break e}for(;i>>1;et;)--a;if(++a,s!==0||a!==r){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=Ps(i,s,a),this.values=Ps(this.values,s*o,a*o)}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 i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const l=i[o];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,l),e=!1;break}if(a!==null&&a>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,l,a),e=!1;break}a=l}if(r!==void 0&&q6(r))for(let o=0,l=r.length;o!==l;++o){const c=r[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e}optimize(){const e=Ps(this.times),t=Ps(this.values),i=this.getValueSize(),r=this.getInterpolation()===um,s=e.length-1;let a=1;for(let o=1;o0){e[a]=e[s];for(let o=s*i,l=a*i,c=0;c!==i;++c)t[l+c]=t[o+c];++a}return a!==e.length?(this.times=Ps(e,0,a),this.values=Ps(t,0,a*i)):(this.times=e,this.values=t),this}clone(){const e=Ps(this.times,0),t=Ps(this.values,0),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}}va.prototype.TimeBufferType=Float32Array;va.prototype.ValueBufferType=Float32Array;va.prototype.DefaultInterpolation=Tp;class xu extends va{}xu.prototype.ValueTypeName="bool";xu.prototype.ValueBufferType=Array;xu.prototype.DefaultInterpolation=Cp;xu.prototype.InterpolantFactoryMethodLinear=void 0;xu.prototype.InterpolantFactoryMethodSmooth=void 0;class K6 extends va{}K6.prototype.ValueTypeName="color";class Op extends va{}Op.prototype.ValueTypeName="number";class DT extends g0{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,l=(i-t)/(r-t);let c=e*o;for(let u=c+o;c!==u;c+=4)$i.slerpFlat(s,0,a,c-o,a,c,l);return s}}class hf extends va{InterpolantFactoryMethodLinear(e){return new DT(this.times,this.values,this.getValueSize(),e)}}hf.prototype.ValueTypeName="quaternion";hf.prototype.DefaultInterpolation=Tp;hf.prototype.InterpolantFactoryMethodSmooth=void 0;class _u extends va{}_u.prototype.ValueTypeName="string";_u.prototype.ValueBufferType=Array;_u.prototype.DefaultInterpolation=Cp;_u.prototype.InterpolantFactoryMethodLinear=void 0;_u.prototype.InterpolantFactoryMethodSmooth=void 0;class Fp extends va{}Fp.prototype.ValueTypeName="vector";class kp{constructor(e,t=-1,i,r=D2){this.name=e,this.tracks=i,this.duration=t,this.blendMode=r,this.uuid=ls(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,r=1/(e.fps||1);for(let a=0,o=i.length;a!==o;++a)t.push(HN(i[a]).scale(r));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],i=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,a=i.length;s!==a;++s)t.push(va.toJSON(i[s]));return r}static CreateFromMorphTargetSequence(e,t,i,r){const s=t.length,a=[];for(let o=0;o1){const h=u[1];let f=r[h];f||(r[h]=f=[]),f.push(c)}}const a=[];for(const o in r)a.push(this.CreateFromMorphTargetSequence(o,r[o],t,i));return a}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,f,p,m,y){if(p.length!==0){const v=[],A=[];X6(p,v,A,m),v.length!==0&&y.push(new h(f,v,A))}},r=[],s=e.name||"default",a=e.fps||30,o=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(bo[e]!==void 0){bo[e].push({onLoad:t,onProgress:i,onError:r});return}bo[e]=[],bo[e].push({onLoad:t,onProgress:i,onError:r});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),o=this.mimeType,l=this.responseType;fetch(a).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=bo[e],h=c.body.getReader(),f=c.headers.get("Content-Length")||c.headers.get("X-File-Size"),p=f?parseInt(f):0,m=p!==0;let y=0;const v=new ReadableStream({start(A){_();function _(){h.read().then(({done:x,value:E})=>{if(x)A.close();else{y+=E.byteLength;const w=new ProgressEvent("progress",{lengthComputable:m,loaded:y,total:p});for(let I=0,T=u.length;I{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,o));case"json":return c.json();default:if(o===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(o),f=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(f);return c.arrayBuffer().then(m=>p.decode(m))}}}).then(c=>{au.add(e,c);const u=bo[e];delete bo[e];for(let h=0,f=u.length;h{const u=bo[e];if(u===void 0)throw this.manager.itemError(e),c;delete bo[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 WN extends ur{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new Ir(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(o){try{t(s.parse(JSON.parse(o)))}catch(l){r?r(l):console.error(l),s.manager.itemError(e)}},i,r)}parse(e){const t=[];for(let i=0;i0:r.vertexColors=e.vertexColors),e.uniforms!==void 0)for(const s in e.uniforms){const a=e.uniforms[s];switch(r.uniforms[s]={},a.type){case"t":r.uniforms[s].value=i(a.value);break;case"c":r.uniforms[s].value=new He().setHex(a.value);break;case"v2":r.uniforms[s].value=new _e().fromArray(a.value);break;case"v3":r.uniforms[s].value=new N().fromArray(a.value);break;case"v4":r.uniforms[s].value=new jt().fromArray(a.value);break;case"m3":r.uniforms[s].value=new Qt().fromArray(a.value);break;case"m4":r.uniforms[s].value=new ct().fromArray(a.value);break;default:r.uniforms[s].value=a.value}}if(e.defines!==void 0&&(r.defines=e.defines),e.vertexShader!==void 0&&(r.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(r.fragmentShader=e.fragmentShader),e.glslVersion!==void 0&&(r.glslVersion=e.glslVersion),e.extensions!==void 0)for(const s in e.extensions)r.extensions[s]=e.extensions[s];if(e.lights!==void 0&&(r.lights=e.lights),e.clipping!==void 0&&(r.clipping=e.clipping),e.size!==void 0&&(r.size=e.size),e.sizeAttenuation!==void 0&&(r.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(r.map=i(e.map)),e.matcap!==void 0&&(r.matcap=i(e.matcap)),e.alphaMap!==void 0&&(r.alphaMap=i(e.alphaMap)),e.bumpMap!==void 0&&(r.bumpMap=i(e.bumpMap)),e.bumpScale!==void 0&&(r.bumpScale=e.bumpScale),e.normalMap!==void 0&&(r.normalMap=i(e.normalMap)),e.normalMapType!==void 0&&(r.normalMapType=e.normalMapType),e.normalScale!==void 0){let s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),r.normalScale=new _e().fromArray(s)}return e.displacementMap!==void 0&&(r.displacementMap=i(e.displacementMap)),e.displacementScale!==void 0&&(r.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(r.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(r.roughnessMap=i(e.roughnessMap)),e.metalnessMap!==void 0&&(r.metalnessMap=i(e.metalnessMap)),e.emissiveMap!==void 0&&(r.emissiveMap=i(e.emissiveMap)),e.emissiveIntensity!==void 0&&(r.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(r.specularMap=i(e.specularMap)),e.specularIntensityMap!==void 0&&(r.specularIntensityMap=i(e.specularIntensityMap)),e.specularColorMap!==void 0&&(r.specularColorMap=i(e.specularColorMap)),e.envMap!==void 0&&(r.envMap=i(e.envMap)),e.envMapIntensity!==void 0&&(r.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(r.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(r.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(r.lightMap=i(e.lightMap)),e.lightMapIntensity!==void 0&&(r.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(r.aoMap=i(e.aoMap)),e.aoMapIntensity!==void 0&&(r.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(r.gradientMap=i(e.gradientMap)),e.clearcoatMap!==void 0&&(r.clearcoatMap=i(e.clearcoatMap)),e.clearcoatRoughnessMap!==void 0&&(r.clearcoatRoughnessMap=i(e.clearcoatRoughnessMap)),e.clearcoatNormalMap!==void 0&&(r.clearcoatNormalMap=i(e.clearcoatNormalMap)),e.clearcoatNormalScale!==void 0&&(r.clearcoatNormalScale=new _e().fromArray(e.clearcoatNormalScale)),e.iridescenceMap!==void 0&&(r.iridescenceMap=i(e.iridescenceMap)),e.iridescenceThicknessMap!==void 0&&(r.iridescenceThicknessMap=i(e.iridescenceThicknessMap)),e.transmissionMap!==void 0&&(r.transmissionMap=i(e.transmissionMap)),e.thicknessMap!==void 0&&(r.thicknessMap=i(e.thicknessMap)),e.anisotropyMap!==void 0&&(r.anisotropyMap=i(e.anisotropyMap)),e.sheenColorMap!==void 0&&(r.sheenColorMap=i(e.sheenColorMap)),e.sheenRoughnessMap!==void 0&&(r.sheenRoughnessMap=i(e.sheenRoughnessMap)),r}setTextures(e){return this.textures=e,this}static createMaterialFromType(e){const t={ShadowMaterial:ET,SpriteMaterial:O6,RawShaderMaterial:tp,ShaderMaterial:sn,PointsMaterial:k6,MeshPhysicalMaterial:ST,MeshStandardMaterial:Y6,MeshPhongMaterial:wT,MeshToonMaterial:CT,MeshNormalMaterial:p0,MeshLambertMaterial:TT,MeshDepthMaterial:u0,MeshDistanceMaterial:F2,MeshBasicMaterial:cs,MeshMatcapMaterial:bT,LineDashedMaterial:IT,LineBasicMaterial:Rr,Material:Ji};return new t[e]}}class dy{static decodeText(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let i=0,r=e.length;i0){const l=new $6(t);s=new Np(l),s.setCrossOrigin(this.crossOrigin);for(let c=0,u=e.length;c0){r=new Np(this.manager),r.setCrossOrigin(this.crossOrigin);for(let a=0,o=e.length;a"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,i,r){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=au.get(e);if(a!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a;const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){au.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){r&&r(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}let yg;class e4{static getContext(){return yg===void 0&&(yg=new(window.AudioContext||window.webkitAudioContext)),yg}static setContext(e){yg=e}}class tG extends ur{constructor(e){super(e)}load(e,t,i,r){const s=this,a=new Ir(this.manager);a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(l){try{const c=l.slice(0);e4.getContext().decodeAudioData(c,function(h){t(h)},o)}catch(c){o(c)}},i,r);function o(l){r?r(l):console.error(l),s.manager.itemError(e)}}}class nG extends i1{constructor(e,t,i=1){super(void 0,i),this.isHemisphereLightProbe=!0;const r=new He().set(e),s=new He().set(t),a=new N(r.r,r.g,r.b),o=new N(s.r,s.g,s.b),l=Math.sqrt(Math.PI),c=l*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(l),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(c)}}class iG extends i1{constructor(e,t=1){super(void 0,t),this.isAmbientLightProbe=!0;const i=new He().set(e);this.sh.coefficients[0].set(i.r,i.g,i.b).multiplyScalar(2*Math.sqrt(Math.PI))}}const CE=new ct,TE=new ct,Ec=new ct;class rG{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Kn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Kn,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,Ec.copy(e.projectionMatrix);const r=t.eyeSep/2,s=r*t.near/t.focus,a=t.near*Math.tan(jc*t.fov*.5)/t.zoom;let o,l;TE.elements[12]=-r,CE.elements[12]=r,o=-a*t.aspect+s,l=a*t.aspect+s,Ec.elements[0]=2*t.near/(l-o),Ec.elements[8]=(l+o)/(l-o),this.cameraL.projectionMatrix.copy(Ec),o=-a*t.aspect-s,l=a*t.aspect-s,Ec.elements[0]=2*t.near/(l-o),Ec.elements[8]=(l+o)/(l-o),this.cameraR.projectionMatrix.copy(Ec)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(TE),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(CE)}}class s1{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=bE(),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=bE();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function bE(){return(typeof performance>"u"?Date:performance).now()}const Sc=new N,IE=new $i,sG=new N,wc=new N;class aG extends fn{constructor(){super(),this.type="AudioListener",this.context=e4.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new s1}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,i=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Sc,IE,sG),wc.set(0,0,-1).applyQuaternion(IE),t.positionX){const r=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(Sc.x,r),t.positionY.linearRampToValueAtTime(Sc.y,r),t.positionZ.linearRampToValueAtTime(Sc.z,r),t.forwardX.linearRampToValueAtTime(wc.x,r),t.forwardY.linearRampToValueAtTime(wc.y,r),t.forwardZ.linearRampToValueAtTime(wc.z,r),t.upX.linearRampToValueAtTime(i.x,r),t.upY.linearRampToValueAtTime(i.y,r),t.upZ.linearRampToValueAtTime(i.z,r)}else t.setPosition(Sc.x,Sc.y,Sc.z),t.setOrientation(wc.x,wc.y,wc.z,i.x,i.y,i.z)}}class HT extends fn{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(i,r,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){o.setValue(i,r);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,r=i*this._origIndex;e.getValue(t,r);for(let s=i,a=r;s!==a;++s)t[s]=t[r+s%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let a=0;a!==s;++a)e[t+a]=e[i+a]}_slerp(e,t,i,r){$i.slerpFlat(e,t,e,t,e,i,r)}_slerpAdditive(e,t,i,r,s){const a=this._workIndex*s;$i.multiplyQuaternionsFlat(e,a,e,t,e,i),$i.slerpFlat(e,t,e,t,e,a,r)}_lerp(e,t,i,r,s){const a=1-r;for(let o=0;o!==s;++o){const l=t+o;e[l]=e[l]*a+e[i+o]*r}}_lerpAdditive(e,t,i,r,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[i+a]*r}}}const t4="\\[\\]\\.:\\/",uG=new RegExp("["+t4+"]","g"),n4="[^"+t4+"]",hG="[^"+t4.replace("\\.","")+"]",fG=/((?:WC+[\/:])*)/.source.replace("WC",n4),dG=/(WCOD+)?/.source.replace("WCOD",hG),pG=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",n4),gG=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",n4),mG=new RegExp("^"+fG+dG+pG+gG+"$"),AG=["material","materials","bones","map"];class vG{constructor(e,t,i){const r=i||rn.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class rn{constructor(e,t,i){this.path=t,this.parsedPath=i||rn.parseTrackName(t),this.node=rn.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new rn.Composite(e,t,i):new rn(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(uG,"")}static parseTrackName(e){const t=mG.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){const s=i.nodeName.substring(r+1);AG.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(s){for(let a=0;a=s){const h=s++,f=e[h];t[f.uuid]=u,e[u]=f,t[c]=h,e[h]=l;for(let p=0,m=r;p!==m;++p){const y=i[p],v=y[h],A=y[u];y[u]=v,y[h]=A}}}this.nCachedObjects_=s}uncache(){const e=this._objects,t=this._indicesByUUID,i=this._bindings,r=i.length;let s=this.nCachedObjects_,a=e.length;for(let o=0,l=arguments.length;o!==l;++o){const c=arguments[o],u=c.uuid,h=t[u];if(h!==void 0)if(delete t[u],h0&&(t[p.uuid]=h),e[h]=p,e.pop();for(let m=0,y=r;m!==y;++m){const v=i[m];v[h]=v[f],v.pop()}}}this.nCachedObjects_=s}subscribe_(e,t){const i=this._bindingsIndicesByPath;let r=i[e];const s=this._bindings;if(r!==void 0)return s[r];const a=this._paths,o=this._parsedPaths,l=this._objects,c=l.length,u=this.nCachedObjects_,h=new Array(c);r=s.length,i[e]=r,a.push(e),o.push(t),s.push(h);for(let f=u,p=l.length;f!==p;++f){const m=l[f];h[f]=new rn(m,e,t)}return h}unsubscribe_(e){const t=this._bindingsIndicesByPath,i=t[e];if(i!==void 0){const r=this._paths,s=this._parsedPaths,a=this._bindings,o=a.length-1,l=a[o],c=e[o];t[c]=i,a[i]=l,a.pop(),s[i]=s[o],s.pop(),r[i]=r[o],r.pop()}}}class WT{constructor(e,t,i=null,r=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=i,this.blendMode=r;const s=t.tracks,a=s.length,o=new Array(a),l={endingStart:Hc,endingEnd:Hc};for(let c=0;c!==a;++c){const u=s[c].createInterpolant(null);o[c]=u,u.settings=l}this._interpolantSettings=l,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=LC,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,i){if(e.fadeOut(t),this.fadeIn(t),i){const r=this._clip.duration,s=e._clip.duration,a=s/r,o=r/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,i){return e.crossFadeFrom(this,t,i)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,i){const r=this._mixer,s=r.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=r._lendControlInterpolant(),this._timeScaleInterpolant=o);const l=o.parameterPositions,c=o.sampleValues;return l[0]=s,l[1]=s+i,c[0]=e/a,c[1]=t/a,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,i,r){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const l=(e-s)*i;l<0||i===0?t=0:(this._startTime=null,t=i*l)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case b6:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(a),c[u].accumulateAdditive(o);break;case D2:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(a),c[u].accumulate(r,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopFading(),r===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const r=i.evaluate(e)[0];t*=r,e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let r=this.time+e,s=this._loopCount;const a=i===UC;if(e===0)return s===-1?r:a&&(s&1)===1?t-r:r;if(i===PC){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(r>=t)r=t;else if(r<0)r=0;else{this.time=r;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),r>=t||r<0){const o=Math.floor(r/t);r-=t*o,s+=Math.abs(o);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,r=e>0?t:0,this.time=r,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=r,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=r;if(a&&(s&1)===1)return t-r}return r}_setEndings(e,t,i){const r=this._interpolantSettings;i?(r.endingStart=Vc,r.endingEnd=Vc):(e?r.endingStart=this.zeroSlopeAtStart?Vc:Hc:r.endingStart=bp,t?r.endingEnd=this.zeroSlopeAtEnd?Vc:Hc:r.endingEnd=bp)}_scheduleFading(e,t,i){const r=this._mixer,s=r.time;let a=this._weightInterpolant;a===null&&(a=r._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=s,l[0]=t,o[1]=s+e,l[1]=i,this}}const xG=new Float32Array(1);class _G extends Yo{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,r=e._clip.tracks,s=r.length,a=e._propertyBindings,o=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==s;++h){const f=r[h],p=f.name;let m=u[p];if(m!==void 0)++m.referenceCount,a[h]=m;else{if(m=a[h],m!==void 0){m._cacheIndex===null&&(++m.referenceCount,this._addInactiveBinding(m,l,p));continue}const y=t&&t._propertyBindings[h].binding.parsedPath;m=new VT(rn.create(i,p,y),f.ValueTypeName,f.getValueSize()),++m.referenceCount,this._addInactiveBinding(m,l,p),a[h]=m}o[h].resultBuffer=m.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,r=e._clip.uuid,s=this._actionsByClip[r];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,r,i)}const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,r=t.length;i!==r;++i){const s=t[i];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,r=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(r,e,s,a);const o=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)o[c].apply(a);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,BE).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 DE=new N,xg=new N;class bG{constructor(e=new N,t=new N){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){DE.subVectors(e,this.start),xg.subVectors(this.end,this.start);const i=xg.dot(xg);let s=xg.dot(DE)/i;return t&&(s=si(s,0,1)),s}closestPointToPoint(e,t,i){const r=this.closestPointToPointParameter(e,t);return this.delta(i).multiplyScalar(r).add(this.start)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const PE=new N;class IG extends fn{constructor(e,t){super(),this.light=e,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const i=new Bt,r=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,o=1,l=32;a1)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{kE.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(kE,t)}}setLength(e,t=e*.2,i=t*.2){this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(i,t,i),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class zG extends to{constructor(e=1){const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],r=new Bt;r.setAttribute("position",new ot(t,3)),r.setAttribute("color",new ot(i,3));const s=new Rr({vertexColors:!0,toneMapped:!1});super(r,s),this.type="AxesHelper"}setColors(e,t,i){const r=new He,s=this.geometry.attributes.color.array;return r.set(e),r.toArray(s,0),r.toArray(s,3),r.set(t),r.toArray(s,6),r.toArray(s,9),r.set(i),r.toArray(s,12),r.toArray(s,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class jT{constructor(){this.type="ShapePath",this.color=new He,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new Dp,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,i,r){return this.currentPath.quadraticCurveTo(e,t,i,r),this}bezierCurveTo(e,t,i,r,s,a){return this.currentPath.bezierCurveTo(e,t,i,r,s,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(A){const _=[];for(let x=0,E=A.length;xNumber.EPSILON){if(B<0&&(T=_[I],b=-b,M=_[w],B=-B),A.yM.y)continue;if(A.y===T.y){if(A.x===T.x)return!0}else{const L=B*(A.x-T.x)-b*(A.y-T.y);if(L===0)return!0;if(L<0)continue;E=!E}}else{if(A.y!==T.y)continue;if(M.x<=A.x&&A.x<=T.x||T.x<=A.x&&A.x<=M.x)return!0}}return E}const r=Wa.isClockWise,s=this.subPaths;if(s.length===0)return[];let a,o,l;const c=[];if(s.length===1)return o=s[0],l=new $c,l.curves=o.curves,c.push(l),c;let u=!r(s[0].getPoints());u=e?!u:u;const h=[],f=[];let p=[],m=0,y;f[m]=void 0,p[m]=[];for(let A=0,_=s.length;A<_;A++)o=s[A],y=o.getPoints(),a=r(y),a=e?!a:a,a?(!u&&f[m]&&m++,f[m]={s:new $c,p:y},f[m].s.curves=o.curves,u&&m++,p[m]=[]):p[m].push({h:o,p:y[0]});if(!f[0])return t(s);if(f.length>1){let A=!1,_=0;for(let x=0,E=f.length;x0&&A===!1&&(p=h)}let v;for(let A=0,_=f.length;A<_;A++){l=f[A].s,c.push(l),v=p[A];for(let x=0,E=v.length;x{const h=typeof c=="function"?c(e):c;if(h!==e){const f=e;e=u?h:Object.assign({},e,h),t.forEach(p=>p(e,f))}},r=()=>e,s=(c,u=r,h=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let f=u(e);function p(){const m=u(e);if(!h(f,m)){const y=f;c(f=m,y)}}return t.add(p),()=>t.delete(p)},l={setState:i,getState:r,subscribe:(c,u,h)=>u||h?s(c,u,h):(t.add(c),()=>t.delete(c)),destroy:()=>t.clear()};return e=n(i,r,l),l}const HG=typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent),NE=HG?$.useEffect:$.useLayoutEffect;function VG(n){const e=typeof n=="function"?QG(n):n,t=(i=e.getState,r=Object.is)=>{const[,s]=$.useReducer(v=>v+1,0),a=e.getState(),o=$.useRef(a),l=$.useRef(i),c=$.useRef(r),u=$.useRef(!1),h=$.useRef();h.current===void 0&&(h.current=i(a));let f,p=!1;(o.current!==a||l.current!==i||c.current!==r||u.current)&&(f=i(a),p=!r(h.current,f)),NE(()=>{p&&(h.current=f),o.current=a,l.current=i,c.current=r,u.current=!1});const m=$.useRef(a);NE(()=>{const v=()=>{try{const _=e.getState(),x=l.current(_);c.current(h.current,x)||(o.current=_,h.current=x,s())}catch{u.current=!0,s()}},A=e.subscribe(v);return e.getState()!==m.current&&v(),A},[]);const y=p?f:h.current;return $.useDebugValue(y),y};return Object.assign(t,e),t[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const i=[t,e];return{next(){const r=i.length<=0;return{value:i.shift(),done:r}}}},t}var JT={exports:{}},ZT={exports:{}},eb={};/** + * @license React + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */(function(n){function e(Y,H){var V=Y.length;Y.push(H);e:for(;0>>1,k=Y[D];if(0>>1;Dr(ee,V))ier(te,ee)?(Y[D]=te,Y[ie]=V,D=ie):(Y[D]=ee,Y[j]=V,D=j);else if(ier(te,V))Y[D]=te,Y[ie]=V,D=ie;else break e}}return H}function r(Y,H){var V=Y.sortIndex-H.sortIndex;return V!==0?V:Y.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var a=Date,o=a.now();n.unstable_now=function(){return a.now()-o}}var l=[],c=[],u=1,h=null,f=3,p=!1,m=!1,y=!1,v=typeof setTimeout=="function"?setTimeout:null,A=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 x(Y){for(var H=t(c);H!==null;){if(H.callback===null)i(c);else if(H.startTime<=Y)i(c),H.sortIndex=H.expirationTime,e(l,H);else break;H=t(c)}}function E(Y){if(y=!1,x(Y),!m)if(t(l)!==null)m=!0,F(w);else{var H=t(c);H!==null&&q(E,H.startTime-Y)}}function w(Y,H){m=!1,y&&(y=!1,A(M),M=-1),p=!0;var V=f;try{for(x(H),h=t(l);h!==null&&(!(h.expirationTime>H)||Y&&!L());){var D=h.callback;if(typeof D=="function"){h.callback=null,f=h.priorityLevel;var k=D(h.expirationTime<=H);H=n.unstable_now(),typeof k=="function"?h.callback=k:h===t(l)&&i(l),x(H)}else i(l);h=t(l)}if(h!==null)var Z=!0;else{var j=t(c);j!==null&&q(E,j.startTime-H),Z=!1}return Z}finally{h=null,f=V,p=!1}}var I=!1,T=null,M=-1,b=5,B=-1;function L(){return!(n.unstable_now()-BY||125D?(Y.sortIndex=V,e(c,Y),t(l)===null&&Y===t(c)&&(y?(A(M),M=-1):y=!0,q(E,V-D))):(Y.sortIndex=k,e(l,Y),m||p||(m=!0,F(w))),Y},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(Y){var H=f;return function(){var V=f;f=H;try{return Y.apply(this,arguments)}finally{f=V}}}})(eb);ZT.exports=eb;var gy=ZT.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 WG=function(e){var t={},i=$,r=gy,s=Object.assign;function a(d){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+d,S=1;Sae||R[J]!==P[ae]){var be=` +`+R[J].replace(" at new "," at ");return d.displayName&&be.includes("")&&(be=be.replace("",d.displayName)),be}while(1<=J&&0<=ae);break}}}finally{wn=!1,Error.prepareStackTrace=S}return(d=d?d.displayName||d.name:"")?vt(d):""}var Oi=Object.prototype.hasOwnProperty,er=[],pn=-1;function Ct(d){return{current:d}}function tn(d){0>pn||(d.current=er[pn],er[pn]=null,pn--)}function Tt(d,g){pn++,er[pn]=d.current,d.current=g}var hi={},ti=Ct(hi),Gn=Ct(!1),Lr=hi;function Cn(d,g){var S=d.type.contextTypes;if(!S)return hi;var C=d.stateNode;if(C&&C.__reactInternalMemoizedUnmaskedChildContext===g)return C.__reactInternalMemoizedMaskedChildContext;var R={},P;for(P in S)R[P]=g[P];return C&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=g,d.__reactInternalMemoizedMaskedChildContext=R),R}function Ln(d){return d=d.childContextTypes,d!=null}function dr(){tn(Gn),tn(ti)}function yi(d,g,S){if(ti.current!==hi)throw Error(a(168));Tt(ti,g),Tt(Gn,S)}function wa(d,g,S){var C=d.stateNode;if(g=g.childContextTypes,typeof C.getChildContext!="function")return S;C=C.getChildContext();for(var R in C)if(!(R in g))throw Error(a(108,M(d)||"Unknown",R));return s({},S,C)}function Ca(d){return d=(d=d.stateNode)&&d.__reactInternalMemoizedMergedChildContext||hi,Lr=ti.current,Tt(ti,d),Tt(Gn,Gn.current),!0}function tr(d,g,S){var C=d.stateNode;if(!C)throw Error(a(169));S?(d=wa(d,g,Lr),C.__reactInternalMemoizedMergedChildContext=d,tn(Gn),tn(ti),Tt(ti,d)):tn(Gn),Tt(Gn,S)}var Xr=Math.clz32?Math.clz32:j0,bu=Math.log,nc=Math.LN2;function j0(d){return d>>>=0,d===0?32:31-(bu(d)/nc|0)|0}var uo=64,ho=4194304;function fo(d){switch(d&-d){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 d&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return d&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return d}}function ic(d,g){var S=d.pendingLanes;if(S===0)return 0;var C=0,R=d.suspendedLanes,P=d.pingedLanes,J=S&268435455;if(J!==0){var ae=J&~R;ae!==0?C=fo(ae):(P&=J,P!==0&&(C=fo(P)))}else J=S&~R,J!==0?C=fo(J):P!==0&&(C=fo(P));if(C===0)return 0;if(g!==0&&g!==C&&!(g&R)&&(R=C&-C,P=g&-g,R>=P||R===16&&(P&4194240)!==0))return g;if(C&4&&(C|=S&16),g=d.entangledLanes,g!==0)for(d=d.entanglements,g&=C;0S;S++)g.push(d);return g}function Ta(d,g,S){d.pendingLanes|=g,g!==536870912&&(d.suspendedLanes=0,d.pingedLanes=0),d=d.eventTimes,g=31-Xr(g),d[g]=S}function tl(d,g){var S=d.pendingLanes&~g;d.pendingLanes=g,d.suspendedLanes=0,d.pingedLanes=0,d.expiredLanes&=g,d.mutableReadLanes&=g,d.entangledLanes&=g,g=d.entanglements;var C=d.eventTimes;for(d=d.expirationTimes;0>=J,R-=J,Ao=1<<32-Xr(g)+R|S<cn?(Gi=Ft,Ft=null):Gi=Ft.sibling;var un=yt(ve,Ft,Ee[cn],tt);if(un===null){Ft===null&&(Ft=Gi);break}d&&Ft&&un.alternate===null&&g(ve,Ft),le=P(un,le,cn),Vt===null?ht=un:Vt.sibling=un,Vt=un,Ft=Gi}if(cn===Ee.length)return S(ve,Ft),zn&&uc(ve,cn),ht;if(Ft===null){for(;cncn?(Gi=Ft,Ft=null):Gi=Ft.sibling;var ul=yt(ve,Ft,un.value,tt);if(ul===null){Ft===null&&(Ft=Gi);break}d&&Ft&&ul.alternate===null&&g(ve,Ft),le=P(ul,le,cn),Vt===null?ht=ul:Vt.sibling=ul,Vt=ul,Ft=Gi}if(un.done)return S(ve,Ft),zn&&uc(ve,cn),ht;if(Ft===null){for(;!un.done;cn++,un=Ee.next())un=Ot(ve,un.value,tt),un!==null&&(le=P(un,le,cn),Vt===null?ht=un:Vt.sibling=un,Vt=un);return zn&&uc(ve,cn),ht}for(Ft=C(ve,Ft);!un.done;cn++,un=Ee.next())un=Rn(Ft,ve,cn,un.value,tt),un!==null&&(d&&un.alternate!==null&&Ft.delete(un.key===null?cn:un.key),le=P(un,le,cn),Vt===null?ht=un:Vt.sibling=un,Vt=un);return d&&Ft.forEach(function(tP){return g(ve,tP)}),zn&&uc(ve,cn),ht}function bs(ve,le,Ee,tt){if(typeof Ee=="object"&&Ee!==null&&Ee.type===u&&Ee.key===null&&(Ee=Ee.props.children),typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case l:e:{for(var ht=Ee.key,Vt=le;Vt!==null;){if(Vt.key===ht){if(ht=Ee.type,ht===u){if(Vt.tag===7){S(ve,Vt.sibling),le=R(Vt,Ee.props.children),le.return=ve,ve=le;break e}}else if(Vt.elementType===ht||typeof ht=="object"&&ht!==null&&ht.$$typeof===x&&K8(ht)===Vt.type){S(ve,Vt.sibling),le=R(Vt,Ee.props),le.ref=Df(ve,Vt,Ee),le.return=ve,ve=le;break e}S(ve,Vt);break}else g(ve,Vt);Vt=Vt.sibling}Ee.type===u?(le=Ac(Ee.props.children,ve.mode,tt,Ee.key),le.return=ve,ve=le):(tt=F3(Ee.type,Ee.key,Ee.props,null,ve.mode,tt),tt.ref=Df(ve,le,Ee),tt.return=ve,ve=tt)}return J(ve);case c:e:{for(Vt=Ee.key;le!==null;){if(le.key===Vt)if(le.tag===4&&le.stateNode.containerInfo===Ee.containerInfo&&le.stateNode.implementation===Ee.implementation){S(ve,le.sibling),le=R(le,Ee.children||[]),le.return=ve,ve=le;break e}else{S(ve,le);break}else g(ve,le);le=le.sibling}le=WA(Ee,ve.mode,tt),le.return=ve,ve=le}return J(ve);case x:return Vt=Ee._init,bs(ve,le,Vt(Ee._payload),tt)}if(G(Ee))return dt(ve,le,Ee,tt);if(I(Ee))return sr(ve,le,Ee,tt);a3(ve,Ee)}return typeof Ee=="string"&&Ee!==""||typeof Ee=="number"?(Ee=""+Ee,le!==null&&le.tag===6?(S(ve,le.sibling),le=R(le,Ee),le.return=ve,ve=le):(S(ve,le),le=VA(Ee,ve.mode,tt),le.return=ve,ve=le),J(ve)):S(ve,le)}return bs}var Uu=$8(!0),J8=$8(!1),Pf={},Ss=Ct(Pf),Lf=Ct(Pf),Ou=Ct(Pf);function Ma(d){if(d===Pf)throw Error(a(174));return d}function lA(d,g){Tt(Ou,g),Tt(Lf,d),Tt(Ss,Pf),d=q(g),tn(Ss),Tt(Ss,d)}function Fu(){tn(Ss),tn(Lf),tn(Ou)}function Z8(d){var g=Ma(Ou.current),S=Ma(Ss.current);g=Y(S,d.type,g),S!==g&&(Tt(Lf,d),Tt(Ss,g))}function cA(d){Lf.current===d&&(tn(Ss),tn(Lf))}var qn=Ct(0);function o3(d){for(var g=d;g!==null;){if(g.tag===13){var S=g.memoizedState;if(S!==null&&(S=S.dehydrated,S===null||on(S)||Pn(S)))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if(g.flags&128)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===d)break;for(;g.sibling===null;){if(g.return===null||g.return===d)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var uA=[];function hA(){for(var d=0;dS?S:4,d(!0);var C=ws.transition;ws.transition={};try{d(!1),g()}finally{Xt=S,ws.transition=C}}function dx(){return Ra().memoizedState}function ID(d,g,S){var C=ol(d);S={lane:C,action:S,hasEagerState:!1,eagerState:null,next:null},px(d)?gx(g,S):(mx(d,g,S),S=yr(),d=Cs(d,C,S),d!==null&&Ax(d,g,C))}function MD(d,g,S){var C=ol(d),R={lane:C,action:S,hasEagerState:!1,eagerState:null,next:null};if(px(d))gx(g,R);else{mx(d,g,R);var P=d.alternate;if(d.lanes===0&&(P===null||P.lanes===0)&&(P=g.lastRenderedReducer,P!==null))try{var J=g.lastRenderedState,ae=P(J,S);if(R.hasEagerState=!0,R.eagerState=ae,Kr(ae,J))return}catch{}finally{}S=yr(),d=Cs(d,C,S),d!==null&&Ax(d,g,C)}}function px(d){var g=d.alternate;return d===ni||g!==null&&g===ni}function gx(d,g){Uf=c3=!0;var S=d.pending;S===null?g.next=g:(g.next=S.next,S.next=g),d.pending=g}function mx(d,g,S){xi!==null&&d.mode&1&&!(qt&2)?(d=g.interleaved,d===null?(S.next=S,$r===null?$r=[g]:$r.push(g)):(S.next=d.next,d.next=S),g.interleaved=S):(d=g.pending,d===null?S.next=S:(S.next=d.next,d.next=S),g.pending=S)}function Ax(d,g,S){if(S&4194240){var C=g.lanes;C&=d.pendingLanes,S|=C,g.lanes=S,ba(d,S)}}var p3={readContext:di,useCallback:ir,useContext:ir,useEffect:ir,useImperativeHandle:ir,useInsertionEffect:ir,useLayoutEffect:ir,useMemo:ir,useReducer:ir,useRef:ir,useState:ir,useDebugValue:ir,useDeferredValue:ir,useTransition:ir,useMutableSource:ir,useSyncExternalStore:ir,useId:ir,unstable_isNewReconciler:!1},RD={readContext:di,useCallback:function(d,g){return yo().memoizedState=[d,g===void 0?null:g],d},useContext:di,useEffect:mA,useImperativeHandle:function(d,g,S){return S=S!=null?S.concat([d]):null,f3(4194308,4,cx.bind(null,g,d),S)},useLayoutEffect:function(d,g){return f3(4194308,4,d,g)},useInsertionEffect:function(d,g){return f3(4,2,d,g)},useMemo:function(d,g){var S=yo();return g=g===void 0?null:g,d=d(),S.memoizedState=[d,g],d},useReducer:function(d,g,S){var C=yo();return g=S!==void 0?S(g):g,C.memoizedState=C.baseState=g,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:g},C.queue=d,d=d.dispatch=ID.bind(null,ni,d),[C.memoizedState,d]},useRef:function(d){var g=yo();return d={current:d},g.memoizedState=d},useState:gA,useDebugValue:AA,useDeferredValue:function(d){var g=gA(d),S=g[0],C=g[1];return mA(function(){var R=ws.transition;ws.transition={};try{C(d)}finally{ws.transition=R}},[d]),S},useTransition:function(){var d=gA(!1),g=d[0];return d=bD.bind(null,d[1]),yo().memoizedState=d,[g,d]},useMutableSource:function(){},useSyncExternalStore:function(d,g,S){var C=ni,R=yo();if(zn){if(S===void 0)throw Error(a(407));S=S()}else{if(S=g(),xi===null)throw Error(a(349));ku&30||nx(C,g,S)}R.memoizedState=S;var P={value:S,getSnapshot:g};return R.queue=P,mA(rx.bind(null,C,P,d),[d]),C.flags|=2048,Ff(9,ix.bind(null,C,P,S,g),void 0,null),S},useId:function(){var d=yo(),g=xi.identifierPrefix;if(zn){var S=vo,C=Ao;S=(C&~(1<<32-Xr(C)-1)).toString(32)+S,g=":"+g+"R"+S,S=Of++,0OA&&(g.flags|=128,C=!0,zf(R,!1),g.lanes=4194304)}else{if(!C)if(d=o3(P),d!==null){if(g.flags|=128,C=!0,d=d.updateQueue,d!==null&&(g.updateQueue=d,g.flags|=4),zf(R,!0),R.tail===null&&R.tailMode==="hidden"&&!P.alternate&&!zn)return rr(g),null}else 2*Yn()-R.renderingStartTime>OA&&S!==1073741824&&(g.flags|=128,C=!0,zf(R,!1),g.lanes=4194304);R.isBackwards?(P.sibling=g.child,g.child=P):(d=R.last,d!==null?d.sibling=P:g.child=P,R.last=P)}return R.tail!==null?(g=R.tail,R.rendering=g,R.tail=g.sibling,R.renderingStartTime=Yn(),g.sibling=null,d=qn.current,Tt(qn,C?d&1|2:d&1),g):(rr(g),null);case 22:case 23:return zA(),C=g.memoizedState!==null,d!==null&&d.memoizedState!==null!==C&&(g.flags|=8192),C&&g.mode&1?ts&1073741824&&(rr(g),oe&&g.subtreeFlags&6&&(g.flags|=8192)):rr(g),null;case 24:return null;case 25:return null}throw Error(a(156,g.tag))}var UD=o.ReactCurrentOwner,es=!1;function vr(d,g,S,C){g.child=d===null?J8(g,null,S,C):Uu(g,d.child,S,C)}function Cx(d,g,S,C,R){S=S.render;var P=g.ref;return fi(g,R),C=dA(d,g,S,C,P,R),S=pA(),d!==null&&!es?(g.updateQueue=d.updateQueue,g.flags&=-2053,d.lanes&=~R,xo(d,g,R)):(zn&&S&&iA(g),g.flags|=1,vr(d,g,C,R),g.child)}function Tx(d,g,S,C,R){if(d===null){var P=S.type;return typeof P=="function"&&!HA(P)&&P.defaultProps===void 0&&S.compare===null&&S.defaultProps===void 0?(g.tag=15,g.type=P,bx(d,g,P,C,R)):(d=F3(S.type,null,C,g,g.mode,R),d.ref=g.ref,d.return=g,g.child=d)}if(P=d.child,!(d.lanes&R)){var J=P.memoizedProps;if(S=S.compare,S=S!==null?S:oc,S(J,C)&&d.ref===g.ref)return xo(d,g,R)}return g.flags|=1,d=cl(P,C),d.ref=g.ref,d.return=g,g.child=d}function bx(d,g,S,C,R){if(d!==null&&oc(d.memoizedProps,C)&&d.ref===g.ref)if(es=!1,(d.lanes&R)!==0)d.flags&131072&&(es=!0);else return g.lanes=d.lanes,xo(d,g,R);return xA(d,g,S,C,R)}function Ix(d,g,S){var C=g.pendingProps,R=C.children,P=d!==null?d.memoizedState:null;if(C.mode==="hidden")if(!(g.mode&1))g.memoizedState={baseLanes:0,cachePool:null},Tt(Nu,ts),ts|=S;else if(S&1073741824)g.memoizedState={baseLanes:0,cachePool:null},C=P!==null?P.baseLanes:S,Tt(Nu,ts),ts|=C;else return d=P!==null?P.baseLanes|S:S,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:d,cachePool:null},g.updateQueue=null,Tt(Nu,ts),ts|=d,null;else P!==null?(C=P.baseLanes|S,g.memoizedState=null):C=S,Tt(Nu,ts),ts|=C;return vr(d,g,R,S),g.child}function Mx(d,g){var S=g.ref;(d===null&&S!==null||d!==null&&d.ref!==S)&&(g.flags|=512,g.flags|=2097152)}function xA(d,g,S,C,R){var P=Ln(S)?Lr:ti.current;return P=Cn(g,P),fi(g,R),S=dA(d,g,S,C,P,R),C=pA(),d!==null&&!es?(g.updateQueue=d.updateQueue,g.flags&=-2053,d.lanes&=~R,xo(d,g,R)):(zn&&C&&iA(g),g.flags|=1,vr(d,g,S,R),g.child)}function Rx(d,g,S,C,R){if(Ln(S)){var P=!0;Ca(g)}else P=!1;if(fi(g,R),g.stateNode===null)d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2),V8(g,S,C),nA(g,S,C,R),C=!0;else if(d===null){var J=g.stateNode,ae=g.memoizedProps;J.props=ae;var be=J.context,Ye=S.contextType;typeof Ye=="object"&&Ye!==null?Ye=di(Ye):(Ye=Ln(S)?Lr:ti.current,Ye=Cn(g,Ye));var st=S.getDerivedStateFromProps,Ot=typeof st=="function"||typeof J.getSnapshotBeforeUpdate=="function";Ot||typeof J.UNSAFE_componentWillReceiveProps!="function"&&typeof J.componentWillReceiveProps!="function"||(ae!==C||be!==Ye)&&W8(g,J,C,Ye),il=!1;var yt=g.memoizedState;J.state=yt,n3(g,C,J,R),be=g.memoizedState,ae!==C||yt!==be||Gn.current||il?(typeof st=="function"&&(tA(g,S,st,C),be=g.memoizedState),(ae=il||H8(g,S,ae,C,yt,be,Ye))?(Ot||typeof J.UNSAFE_componentWillMount!="function"&&typeof J.componentWillMount!="function"||(typeof J.componentWillMount=="function"&&J.componentWillMount(),typeof J.UNSAFE_componentWillMount=="function"&&J.UNSAFE_componentWillMount()),typeof J.componentDidMount=="function"&&(g.flags|=4194308)):(typeof J.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=C,g.memoizedState=be),J.props=C,J.state=be,J.context=Ye,C=ae):(typeof J.componentDidMount=="function"&&(g.flags|=4194308),C=!1)}else{J=g.stateNode,N8(d,g),ae=g.memoizedProps,Ye=g.type===g.elementType?ae:mr(g.type,ae),J.props=Ye,Ot=g.pendingProps,yt=J.context,be=S.contextType,typeof be=="object"&&be!==null?be=di(be):(be=Ln(S)?Lr:ti.current,be=Cn(g,be));var Rn=S.getDerivedStateFromProps;(st=typeof Rn=="function"||typeof J.getSnapshotBeforeUpdate=="function")||typeof J.UNSAFE_componentWillReceiveProps!="function"&&typeof J.componentWillReceiveProps!="function"||(ae!==Ot||yt!==be)&&W8(g,J,C,be),il=!1,yt=g.memoizedState,J.state=yt,n3(g,C,J,R);var dt=g.memoizedState;ae!==Ot||yt!==dt||Gn.current||il?(typeof Rn=="function"&&(tA(g,S,Rn,C),dt=g.memoizedState),(Ye=il||H8(g,S,Ye,C,yt,dt,be)||!1)?(st||typeof J.UNSAFE_componentWillUpdate!="function"&&typeof J.componentWillUpdate!="function"||(typeof J.componentWillUpdate=="function"&&J.componentWillUpdate(C,dt,be),typeof J.UNSAFE_componentWillUpdate=="function"&&J.UNSAFE_componentWillUpdate(C,dt,be)),typeof J.componentDidUpdate=="function"&&(g.flags|=4),typeof J.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof J.componentDidUpdate!="function"||ae===d.memoizedProps&&yt===d.memoizedState||(g.flags|=4),typeof J.getSnapshotBeforeUpdate!="function"||ae===d.memoizedProps&&yt===d.memoizedState||(g.flags|=1024),g.memoizedProps=C,g.memoizedState=dt),J.props=C,J.state=dt,J.context=be,C=Ye):(typeof J.componentDidUpdate!="function"||ae===d.memoizedProps&&yt===d.memoizedState||(g.flags|=4),typeof J.getSnapshotBeforeUpdate!="function"||ae===d.memoizedProps&&yt===d.memoizedState||(g.flags|=1024),C=!1)}return _A(d,g,S,C,P,R)}function _A(d,g,S,C,R,P){Mx(d,g);var J=(g.flags&128)!==0;if(!C&&!J)return R&&tr(g,S,!1),xo(d,g,P);C=g.stateNode,UD.current=g;var ae=J&&typeof S.getDerivedStateFromError!="function"?null:C.render();return g.flags|=1,d!==null&&J?(g.child=Uu(g,d.child,null,P),g.child=Uu(g,null,ae,P)):vr(d,g,ae,P),g.memoizedState=C.state,R&&tr(g,S,!0),g.child}function Bx(d){var g=d.stateNode;g.pendingContext?yi(d,g.pendingContext,g.pendingContext!==g.context):g.context&&yi(d,g.context,!1),lA(d,g.containerInfo)}function Dx(d,g,S,C,R){return Lu(),oA(R),g.flags|=256,vr(d,g,S,C),g.child}var A3={dehydrated:null,treeContext:null,retryLane:0};function v3(d){return{baseLanes:d,cachePool:null}}function Px(d,g,S){var C=g.pendingProps,R=qn.current,P=!1,J=(g.flags&128)!==0,ae;if((ae=J)||(ae=d!==null&&d.memoizedState===null?!1:(R&2)!==0),ae?(P=!0,g.flags&=-129):(d===null||d.memoizedState!==null)&&(R|=1),Tt(qn,R&1),d===null)return aA(g),d=g.memoizedState,d!==null&&(d=d.dehydrated,d!==null)?(g.mode&1?Pn(d)?g.lanes=8:g.lanes=1073741824:g.lanes=1,null):(R=C.children,d=C.fallback,P?(C=g.mode,P=g.child,R={mode:"hidden",children:R},!(C&1)&&P!==null?(P.childLanes=0,P.pendingProps=R):P=k3(R,C,0,null),d=Ac(d,C,S,null),P.return=g,d.return=g,P.sibling=d,g.child=P,g.child.memoizedState=v3(S),g.memoizedState=A3,d):EA(g,R));if(R=d.memoizedState,R!==null){if(ae=R.dehydrated,ae!==null){if(J)return g.flags&256?(g.flags&=-257,y3(d,g,S,Error(a(422)))):g.memoizedState!==null?(g.child=d.child,g.flags|=128,null):(P=C.fallback,R=g.mode,C=k3({mode:"visible",children:C.children},R,0,null),P=Ac(P,R,S,null),P.flags|=2,C.return=g,P.return=g,C.sibling=P,g.child=C,g.mode&1&&Uu(g,d.child,null,S),g.child.memoizedState=v3(S),g.memoizedState=A3,P);if(!(g.mode&1))g=y3(d,g,S,null);else if(Pn(ae))g=y3(d,g,S,Error(a(419)));else if(C=(S&d.childLanes)!==0,es||C){if(C=xi,C!==null){switch(S&-S){case 4:P=2;break;case 16:P=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:P=32;break;case 536870912:P=268435456;break;default:P=0}C=P&(C.suspendedLanes|S)?0:P,C!==0&&C!==R.retryLane&&(R.retryLane=C,Cs(d,C,-1))}QA(),g=y3(d,g,S,Error(a(421)))}else on(ae)?(g.flags|=128,g.child=d.child,g=XD.bind(null,d),Wi(ae,g),g=null):(S=R.treeContext,ge&&(Zr=ys(ae),Jr=g,zn=!0,$s=null,Rf=!1,S!==null&&(_s[Es++]=Ao,_s[Es++]=vo,_s[Es++]=cc,Ao=S.id,vo=S.overflow,cc=g)),g=EA(g,g.pendingProps.children),g.flags|=4096);return g}return P?(C=Ux(d,g,C.children,C.fallback,S),P=g.child,R=d.child.memoizedState,P.memoizedState=R===null?v3(S):{baseLanes:R.baseLanes|S,cachePool:null},P.childLanes=d.childLanes&~S,g.memoizedState=A3,C):(S=Lx(d,g,C.children,S),g.memoizedState=null,S)}return P?(C=Ux(d,g,C.children,C.fallback,S),P=g.child,R=d.child.memoizedState,P.memoizedState=R===null?v3(S):{baseLanes:R.baseLanes|S,cachePool:null},P.childLanes=d.childLanes&~S,g.memoizedState=A3,C):(S=Lx(d,g,C.children,S),g.memoizedState=null,S)}function EA(d,g){return g=k3({mode:"visible",children:g},d.mode,0,null),g.return=d,d.child=g}function Lx(d,g,S,C){var R=d.child;return d=R.sibling,S=cl(R,{mode:"visible",children:S}),!(g.mode&1)&&(S.lanes=C),S.return=g,S.sibling=null,d!==null&&(C=g.deletions,C===null?(g.deletions=[d],g.flags|=16):C.push(d)),g.child=S}function Ux(d,g,S,C,R){var P=g.mode;d=d.child;var J=d.sibling,ae={mode:"hidden",children:S};return!(P&1)&&g.child!==d?(S=g.child,S.childLanes=0,S.pendingProps=ae,g.deletions=null):(S=cl(d,ae),S.subtreeFlags=d.subtreeFlags&14680064),J!==null?C=cl(J,C):(C=Ac(C,P,R,null),C.flags|=2),C.return=g,S.return=g,S.sibling=C,g.child=S,C}function y3(d,g,S,C){return C!==null&&oA(C),Uu(g,d.child,null,S),d=EA(g,g.pendingProps.children),d.flags|=2,g.memoizedState=null,d}function Ox(d,g,S){d.lanes|=g;var C=d.alternate;C!==null&&(C.lanes|=g),Ar(d.return,g,S)}function SA(d,g,S,C,R){var P=d.memoizedState;P===null?d.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:C,tail:S,tailMode:R}:(P.isBackwards=g,P.rendering=null,P.renderingStartTime=0,P.last=C,P.tail=S,P.tailMode=R)}function Fx(d,g,S){var C=g.pendingProps,R=C.revealOrder,P=C.tail;if(vr(d,g,C.children,S),C=qn.current,C&2)C=C&1|2,g.flags|=128;else{if(d!==null&&d.flags&128)e:for(d=g.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&Ox(d,S,g);else if(d.tag===19)Ox(d,S,g);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===g)break e;for(;d.sibling===null;){if(d.return===null||d.return===g)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}C&=1}if(Tt(qn,C),!(g.mode&1))g.memoizedState=null;else switch(R){case"forwards":for(S=g.child,R=null;S!==null;)d=S.alternate,d!==null&&o3(d)===null&&(R=S),S=S.sibling;S=R,S===null?(R=g.child,g.child=null):(R=S.sibling,S.sibling=null),SA(g,!1,R,S,P);break;case"backwards":for(S=null,R=g.child,g.child=null;R!==null;){if(d=R.alternate,d!==null&&o3(d)===null){g.child=R;break}d=R.sibling,R.sibling=S,S=R,R=d}SA(g,!0,S,null,P);break;case"together":SA(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function xo(d,g,S){if(d!==null&&(g.dependencies=d.dependencies),Gu|=g.lanes,!(S&g.childLanes))return null;if(d!==null&&g.child!==d.child)throw Error(a(153));if(g.child!==null){for(d=g.child,S=cl(d,d.pendingProps),g.child=S,S.return=g;d.sibling!==null;)d=d.sibling,S=S.sibling=cl(d,d.pendingProps),S.return=g;S.sibling=null}return g.child}function OD(d,g,S){switch(g.tag){case 3:Bx(g),Lu();break;case 5:Z8(g);break;case 1:Ln(g.type)&&Ca(g);break;case 4:lA(g,g.stateNode.containerInfo);break;case 10:e3(g,g.type._context,g.memoizedProps.value);break;case 13:var C=g.memoizedState;if(C!==null)return C.dehydrated!==null?(Tt(qn,qn.current&1),g.flags|=128,null):S&g.child.childLanes?Px(d,g,S):(Tt(qn,qn.current&1),d=xo(d,g,S),d!==null?d.sibling:null);Tt(qn,qn.current&1);break;case 19:if(C=(S&g.childLanes)!==0,d.flags&128){if(C)return Fx(d,g,S);g.flags|=128}var R=g.memoizedState;if(R!==null&&(R.rendering=null,R.tail=null,R.lastEffect=null),Tt(qn,qn.current),C)break;return null;case 22:case 23:return g.lanes=0,Ix(d,g,S)}return xo(d,g,S)}function FD(d,g){switch(rA(g),g.tag){case 1:return Ln(g.type)&&dr(),d=g.flags,d&65536?(g.flags=d&-65537|128,g):null;case 3:return Fu(),tn(Gn),tn(ti),hA(),d=g.flags,d&65536&&!(d&128)?(g.flags=d&-65537|128,g):null;case 5:return cA(g),null;case 13:if(tn(qn),d=g.memoizedState,d!==null&&d.dehydrated!==null){if(g.alternate===null)throw Error(a(340));Lu()}return d=g.flags,d&65536?(g.flags=d&-65537|128,g):null;case 19:return tn(qn),null;case 4:return Fu(),null;case 10:return ki(g.type._context),null;case 22:case 23:return zA(),null;case 24:return null;default:return null}}var x3=!1,fc=!1,kD=typeof WeakSet=="function"?WeakSet:Set,et=null;function _3(d,g){var S=d.ref;if(S!==null)if(typeof S=="function")try{S(null)}catch(C){kr(d,g,C)}else S.current=null}function wA(d,g,S){try{S()}catch(C){kr(d,g,C)}}var kx=!1;function ND(d,g){for(H(d.containerInfo),et=g;et!==null;)if(d=et,g=d.child,(d.subtreeFlags&1028)!==0&&g!==null)g.return=d,et=g;else for(;et!==null;){d=et;try{var S=d.alternate;if(d.flags&1024)switch(d.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var C=S.memoizedProps,R=S.memoizedState,P=d.stateNode,J=P.getSnapshotBeforeUpdate(d.elementType===d.type?C:mr(d.type,C),R);P.__reactInternalSnapshotBeforeUpdate=J}break;case 3:oe&&Qe(d.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(a(163))}}catch(ae){kr(d,d.return,ae)}if(g=d.sibling,g!==null){g.return=d.return,et=g;break}et=d.return}return S=kx,kx=!1,S}function dc(d,g,S){var C=g.updateQueue;if(C=C!==null?C.lastEffect:null,C!==null){var R=C=C.next;do{if((R.tag&d)===d){var P=R.destroy;R.destroy=void 0,P!==void 0&&wA(g,S,P)}R=R.next}while(R!==C)}}function Qf(d,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var S=g=g.next;do{if((S.tag&d)===d){var C=S.create;S.destroy=C()}S=S.next}while(S!==g)}}function CA(d){var g=d.ref;if(g!==null){var S=d.stateNode;switch(d.tag){case 5:d=F(S);break;default:d=S}typeof g=="function"?g(d):g.current=d}}function Nx(d,g,S){if(jr&&typeof jr.onCommitFiberUnmount=="function")try{jr.onCommitFiberUnmount(sc,g)}catch{}switch(g.tag){case 0:case 11:case 14:case 15:if(d=g.updateQueue,d!==null&&(d=d.lastEffect,d!==null)){var C=d=d.next;do{var R=C,P=R.destroy;R=R.tag,P!==void 0&&(R&2||R&4)&&wA(g,S,P),C=C.next}while(C!==d)}break;case 1:if(_3(g,S),d=g.stateNode,typeof d.componentWillUnmount=="function")try{d.props=g.memoizedProps,d.state=g.memoizedState,d.componentWillUnmount()}catch(J){kr(g,S,J)}break;case 5:_3(g,S);break;case 4:oe?Wx(d,g,S):W&&W&&(g=g.stateNode.containerInfo,S=Dt(g),Jt(g,S))}}function Gx(d,g,S){for(var C=g;;)if(Nx(d,C,S),C.child===null||oe&&C.tag===4){if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return}C.sibling.return=C.return,C=C.sibling}else C.child.return=C,C=C.child}function zx(d){var g=d.alternate;g!==null&&(d.alternate=null,zx(g)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(g=d.stateNode,g!==null&&Pe(g)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}function Qx(d){return d.tag===5||d.tag===3||d.tag===4}function Hx(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||Qx(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function Vx(d){if(oe){e:{for(var g=d.return;g!==null;){if(Qx(g))break e;g=g.return}throw Error(a(160))}var S=g;switch(S.tag){case 5:g=S.stateNode,S.flags&32&&(it(g),S.flags&=-33),S=Hx(d),bA(d,S,g);break;case 3:case 4:g=S.stateNode.containerInfo,S=Hx(d),TA(d,S,g);break;default:throw Error(a(161))}}}function TA(d,g,S){var C=d.tag;if(C===5||C===6)d=d.stateNode,g?We(S,d,g):ke(S,d);else if(C!==4&&(d=d.child,d!==null))for(TA(d,g,S),d=d.sibling;d!==null;)TA(d,g,S),d=d.sibling}function bA(d,g,S){var C=d.tag;if(C===5||C===6)d=d.stateNode,g?je(S,d,g):we(S,d);else if(C!==4&&(d=d.child,d!==null))for(bA(d,g,S),d=d.sibling;d!==null;)bA(d,g,S),d=d.sibling}function Wx(d,g,S){for(var C=g,R=!1,P,J;;){if(!R){R=C.return;e:for(;;){if(R===null)throw Error(a(160));switch(P=R.stateNode,R.tag){case 5:J=!1;break e;case 3:P=P.containerInfo,J=!0;break e;case 4:P=P.containerInfo,J=!0;break e}R=R.return}R=!0}if(C.tag===5||C.tag===6)Gx(d,C,S),J?Ve(P,C.stateNode):Oe(P,C.stateNode);else if(C.tag===18)J?mt(P,C.stateNode):rt(P,C.stateNode);else if(C.tag===4){if(C.child!==null){P=C.stateNode.containerInfo,J=!0,C.child.return=C,C=C.child;continue}}else if(Nx(d,C,S),C.child!==null){C.child.return=C,C=C.child;continue}if(C===g)break;for(;C.sibling===null;){if(C.return===null||C.return===g)return;C=C.return,C.tag===4&&(R=!1)}C.sibling.return=C.return,C=C.sibling}}function IA(d,g){if(oe){switch(g.tag){case 0:case 11:case 14:case 15:dc(3,g,g.return),Qf(3,g),dc(5,g,g.return);return;case 1:return;case 5:var S=g.stateNode;if(S!=null){var C=g.memoizedProps;d=d!==null?d.memoizedProps:C;var R=g.type,P=g.updateQueue;g.updateQueue=null,P!==null&&ze(S,P,R,d,C,g)}return;case 6:if(g.stateNode===null)throw Error(a(162));S=g.memoizedProps,Ue(g.stateNode,d!==null?d.memoizedProps:S,S);return;case 3:ge&&d!==null&&d.memoizedState.isDehydrated&&de(g.stateNode.containerInfo);return;case 12:return;case 13:E3(g);return;case 19:E3(g);return;case 17:return}throw Error(a(163))}switch(g.tag){case 0:case 11:case 14:case 15:dc(3,g,g.return),Qf(3,g),dc(5,g,g.return);return;case 12:return;case 13:E3(g);return;case 19:E3(g);return;case 3:ge&&d!==null&&d.memoizedState.isDehydrated&&de(g.stateNode.containerInfo);break;case 22:case 23:return}e:if(W){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(a(163))}}function E3(d){var g=d.updateQueue;if(g!==null){d.updateQueue=null;var S=d.stateNode;S===null&&(S=d.stateNode=new kD),g.forEach(function(C){var R=jD.bind(null,d,C);S.has(C)||(S.add(C),C.then(R,R))})}}function GD(d,g){for(et=g;et!==null;){g=et;var S=g.deletions;if(S!==null)for(var C=0;C";case w3:return":has("+(BA(d)||"")+")";case C3:return'[role="'+d.value+'"]';case b3:return'"'+d.value+'"';case T3:return'[data-testname="'+d.value+'"]';default:throw Error(a(365))}}function Kx(d,g){var S=[];d=[d,0];for(var C=0;CR&&(R=J),C&=~P}if(C=R,C=Yn()-C,C=(120>C?120:480>C?480:1080>C?1080:1920>C?1920:3e3>C?3e3:4320>C?4320:1960*QD(C/1960))-C,10d?16:d,al===null)var C=!1;else{if(d=al,al=null,D3=0,qt&6)throw Error(a(331));var R=qt;for(qt|=4,et=d.current;et!==null;){var P=et,J=P.child;if(et.flags&16){var ae=P.deletions;if(ae!==null){for(var be=0;beYn()-UA?pc(d,0):LA|=S),Fr(d,g)}function s_(d,g){g===0&&(d.mode&1?(g=ho,ho<<=1,!(ho&130023424)&&(ho=4194304)):g=1);var S=yr();d=U3(d,g),d!==null&&(Ta(d,g,S),Fr(d,S))}function XD(d){var g=d.memoizedState,S=0;g!==null&&(S=g.retryLane),s_(d,S)}function jD(d,g){var S=0;switch(d.tag){case 13:var C=d.stateNode,R=d.memoizedState;R!==null&&(S=R.retryLane);break;case 19:C=d.stateNode;break;default:throw Error(a(314))}C!==null&&C.delete(g),s_(d,S)}var a_;a_=function(d,g,S){if(d!==null)if(d.memoizedProps!==g.pendingProps||Gn.current)es=!0;else{if(!(d.lanes&S)&&!(g.flags&128))return es=!1,OD(d,g,S);es=!!(d.flags&131072)}else es=!1,zn&&g.flags&1048576&&Y8(g,s3,g.index);switch(g.lanes=0,g.tag){case 2:var C=g.type;d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2),d=g.pendingProps;var R=Cn(g,ti.current);fi(g,S),R=dA(null,g,C,d,R,S);var P=pA();return g.flags|=1,typeof R=="object"&&R!==null&&typeof R.render=="function"&&R.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,Ln(C)?(P=!0,Ca(g)):P=!1,g.memoizedState=R.state!==null&&R.state!==void 0?R.state:null,eA(g),R.updater=i3,g.stateNode=R,R._reactInternals=g,nA(g,C,d,S),g=_A(null,g,C,!0,P,S)):(g.tag=0,zn&&P&&iA(g),vr(null,g,R,S),g=g.child),g;case 16:C=g.elementType;e:{switch(d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2),d=g.pendingProps,R=C._init,C=R(C._payload),g.type=C,R=g.tag=$D(C),d=mr(C,d),R){case 0:g=xA(null,g,C,d,S);break e;case 1:g=Rx(null,g,C,d,S);break e;case 11:g=Cx(null,g,C,d,S);break e;case 14:g=Tx(null,g,C,mr(C.type,d),S);break e}throw Error(a(306,C,""))}return g;case 0:return C=g.type,R=g.pendingProps,R=g.elementType===C?R:mr(C,R),xA(d,g,C,R,S);case 1:return C=g.type,R=g.pendingProps,R=g.elementType===C?R:mr(C,R),Rx(d,g,C,R,S);case 3:e:{if(Bx(g),d===null)throw Error(a(387));C=g.pendingProps,P=g.memoizedState,R=P.element,N8(d,g),n3(g,C,null,S);var J=g.memoizedState;if(C=J.element,ge&&P.isDehydrated)if(P={element:C,isDehydrated:!1,cache:J.cache,transitions:J.transitions},g.updateQueue.baseState=P,g.memoizedState=P,g.flags&256){R=Error(a(423)),g=Dx(d,g,C,S,R);break e}else if(C!==R){R=Error(a(424)),g=Dx(d,g,C,S,R);break e}else for(ge&&(Zr=wi(g.stateNode.containerInfo),Jr=g,zn=!0,$s=null,Rf=!1),S=J8(g,null,C,S),g.child=S;S;)S.flags=S.flags&-3|4096,S=S.sibling;else{if(Lu(),C===R){g=xo(d,g,S);break e}vr(d,g,C,S)}g=g.child}return g;case 5:return Z8(g),d===null&&aA(g),C=g.type,R=g.pendingProps,P=d!==null?d.memoizedProps:null,J=R.children,ee(C,R)?J=null:P!==null&&ee(C,P)&&(g.flags|=32),Mx(d,g),vr(d,g,J,S),g.child;case 6:return d===null&&aA(g),null;case 13:return Px(d,g,S);case 4:return lA(g,g.stateNode.containerInfo),C=g.pendingProps,d===null?g.child=Uu(g,null,C,S):vr(d,g,C,S),g.child;case 11:return C=g.type,R=g.pendingProps,R=g.elementType===C?R:mr(C,R),Cx(d,g,C,R,S);case 7:return vr(d,g,g.pendingProps,S),g.child;case 8:return vr(d,g,g.pendingProps.children,S),g.child;case 12:return vr(d,g,g.pendingProps.children,S),g.child;case 10:e:{if(C=g.type._context,R=g.pendingProps,P=g.memoizedProps,J=R.value,e3(g,C,J),P!==null)if(Kr(P.value,J)){if(P.children===R.children&&!Gn.current){g=xo(d,g,S);break e}}else for(P=g.child,P!==null&&(P.return=g);P!==null;){var ae=P.dependencies;if(ae!==null){J=P.child;for(var be=ae.firstContext;be!==null;){if(be.context===C){if(P.tag===1){be=mo(-1,S&-S),be.tag=2;var Ye=P.updateQueue;if(Ye!==null){Ye=Ye.shared;var st=Ye.pending;st===null?be.next=be:(be.next=st.next,st.next=be),Ye.pending=be}}P.lanes|=S,be=P.alternate,be!==null&&(be.lanes|=S),Ar(P.return,S,g),ae.lanes|=S;break}be=be.next}}else if(P.tag===10)J=P.type===g.type?null:P.child;else if(P.tag===18){if(J=P.return,J===null)throw Error(a(341));J.lanes|=S,ae=J.alternate,ae!==null&&(ae.lanes|=S),Ar(J,S,g),J=P.sibling}else J=P.child;if(J!==null)J.return=P;else for(J=P;J!==null;){if(J===g){J=null;break}if(P=J.sibling,P!==null){P.return=J.return,J=P;break}J=J.return}P=J}vr(d,g,R.children,S),g=g.child}return g;case 9:return R=g.type,C=g.pendingProps.children,fi(g,S),R=di(R),C=C(R),g.flags|=1,vr(d,g,C,S),g.child;case 14:return C=g.type,R=mr(C,g.pendingProps),R=mr(C.type,R),Tx(d,g,C,R,S);case 15:return bx(d,g,g.type,g.pendingProps,S);case 17:return C=g.type,R=g.pendingProps,R=g.elementType===C?R:mr(C,R),d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2),g.tag=1,Ln(C)?(d=!0,Ca(g)):d=!1,fi(g,S),V8(g,C,R),nA(g,C,R,S),_A(null,g,C,!0,d,S);case 19:return Fx(d,g,S);case 22:return Ix(d,g,S)}throw Error(a(156,g.tag))};function o_(d,g){return go(d,g)}function KD(d,g,S,C){this.tag=d,this.key=S,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=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ts(d,g,S,C){return new KD(d,g,S,C)}function HA(d){return d=d.prototype,!(!d||!d.isReactComponent)}function $D(d){if(typeof d=="function")return HA(d)?1:0;if(d!=null){if(d=d.$$typeof,d===y)return 11;if(d===_)return 14}return 2}function cl(d,g){var S=d.alternate;return S===null?(S=Ts(d.tag,g,d.key,d.mode),S.elementType=d.elementType,S.type=d.type,S.stateNode=d.stateNode,S.alternate=d,d.alternate=S):(S.pendingProps=g,S.type=d.type,S.flags=0,S.subtreeFlags=0,S.deletions=null),S.flags=d.flags&14680064,S.childLanes=d.childLanes,S.lanes=d.lanes,S.child=d.child,S.memoizedProps=d.memoizedProps,S.memoizedState=d.memoizedState,S.updateQueue=d.updateQueue,g=d.dependencies,S.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},S.sibling=d.sibling,S.index=d.index,S.ref=d.ref,S}function F3(d,g,S,C,R,P){var J=2;if(C=d,typeof d=="function")HA(d)&&(J=1);else if(typeof d=="string")J=5;else e:switch(d){case u:return Ac(S.children,R,P,g);case h:J=8,R|=8;break;case f:return d=Ts(12,S,g,R|2),d.elementType=f,d.lanes=P,d;case v:return d=Ts(13,S,g,R),d.elementType=v,d.lanes=P,d;case A:return d=Ts(19,S,g,R),d.elementType=A,d.lanes=P,d;case E:return k3(S,R,P,g);default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case p:J=10;break e;case m:J=9;break e;case y:J=11;break e;case _:J=14;break e;case x:J=16,C=null;break e}throw Error(a(130,d==null?d:typeof d,""))}return g=Ts(J,S,g,R),g.elementType=d,g.type=C,g.lanes=P,g}function Ac(d,g,S,C){return d=Ts(7,d,C,g),d.lanes=S,d}function k3(d,g,S,C){return d=Ts(22,d,C,g),d.elementType=E,d.lanes=S,d.stateNode={},d}function VA(d,g,S){return d=Ts(6,d,null,g),d.lanes=S,d}function WA(d,g,S){return g=Ts(4,d.children!==null?d.children:[],d.key,g),g.lanes=S,g.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},g}function JD(d,g,S,C,R){this.tag=g,this.containerInfo=d,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ce,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Iu(0),this.expirationTimes=Iu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Iu(0),this.identifierPrefix=C,this.onRecoverableError=R,ge&&(this.mutableSourceEagerHydrationData=null)}function l_(d,g,S,C,R,P,J,ae,be){return d=new JD(d,g,S,ae,be),g===1?(g=1,P===!0&&(g|=8)):g=0,P=Ts(3,null,null,g),d.current=P,P.stateNode=d,P.memoizedState={element:C,isDehydrated:S,cache:null,transitions:null},eA(P),d}function c_(d){if(!d)return hi;d=d._reactInternals;e:{if(b(d)!==d||d.tag!==1)throw Error(a(170));var g=d;do{switch(g.tag){case 3:g=g.stateNode.context;break e;case 1:if(Ln(g.type)){g=g.stateNode.__reactInternalMemoizedMergedChildContext;break e}}g=g.return}while(g!==null);throw Error(a(171))}if(d.tag===1){var S=d.type;if(Ln(S))return wa(d,S,g)}return g}function u_(d){var g=d._reactInternals;if(g===void 0)throw typeof d.render=="function"?Error(a(188)):(d=Object.keys(d).join(","),Error(a(268,d)));return d=U(g),d===null?null:d.stateNode}function h_(d,g){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var S=d.retryLane;d.retryLane=S!==0&&S=Ye&&P>=Ot&&R<=st&&J<=yt){d.splice(g,1);break}else if(C!==Ye||S.width!==be.width||ytJ){if(!(P!==Ot||S.height!==be.height||stR)){Ye>C&&(be.width+=Ye-C,be.x=C),stP&&(be.height+=Ot-P,be.y=P),ytS&&(S=J)),J ")+` + +No matching component was found for: + `)+d.join(" > ")}return null},t.getPublicRootInstance=function(d){if(d=d.current,!d.child)return null;switch(d.child.tag){case 5:return F(d.child.stateNode);default:return d.child.stateNode}},t.injectIntoDevTools=function(d){if(d={bundleType:d.bundleType,version:d.version,rendererPackageName:d.rendererPackageName,rendererConfig:d.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:o.ReactCurrentDispatcher,findHostInstanceByFiber:ZD,findFiberByHostInstance:d.findFiberByHostInstance||eP,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.0.0-fc46dba67-20220329"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")d=!1;else{var g=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(g.isDisabled||!g.supportsFiber)d=!0;else{try{sc=g.inject(d),jr=g}catch{}d=!!g.checkDCE}}return d},t.isAlreadyRendering=function(){return!1},t.observeVisibleRects=function(d,g,S,C){if(!Le)throw Error(a(363));d=DA(d,g);var R=Ce(d,S,C).disconnect;return{disconnect:function(){R()}}},t.registerMutableSourceForHydration=function(d,g){var S=g._getVersion;S=S(g._source),d.mutableSourceEagerHydrationData==null?d.mutableSourceEagerHydrationData=[g,S]:d.mutableSourceEagerHydrationData.push(g,S)},t.runWithPriority=function(d,g){var S=Xt;try{return Xt=d,g()}finally{Xt=S}},t.shouldError=function(){return null},t.shouldSuspend=function(){return!1},t.updateContainer=function(d,g,S,C){var R=g.current,P=yr(),J=ol(R);return S=c_(S),g.context===null?g.context=S:g.pendingContext=S,g=mo(P,J),g.payload={element:d},C=C===void 0?null:C,C!==null&&(g.callback=C),rl(R,g),d=Cs(R,J,P),d!==null&&t3(d,R,J),J},t};JT.exports=WG;var YG=JT.exports;const qG=ps(YG),XG=n=>typeof n=="object"&&typeof n.then=="function",Tg=[];function jG(n,e,t=(i,r)=>i===r){if(n===e)return!0;if(!n||!e)return!1;const i=n.length;if(e.length!==i)return!1;for(let r=0;r0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!t)throw s.promise}const r={keys:e,equal:i.equal,remove:()=>{const s=Tg.indexOf(r);s!==-1&&Tg.splice(s,1)},promise:(XG(n)?n:n(...e)).then(s=>{r.response=s,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(s=>r.error=s)};if(Tg.push(r),!t)throw r.promise}const $G=(n,e,t)=>KG(n,e,!1,t),s4={},tb=n=>void Object.assign(s4,n);function JG(n,e){function t(u,{args:h=[],attach:f,...p},m){let y=`${u[0].toUpperCase()}${u.slice(1)}`,v;if(u==="primitive"){if(p.object===void 0)throw new Error("R3F: Primitives without 'object' are invalid!");const A=p.object;v=Eh(A,{type:u,root:m,attach:f,primitive:!0})}else{const A=s4[y];if(!A)throw new Error(`R3F: ${y} 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!");v=Eh(new A(...h),{type:u,root:m,attach:f,memoizedProps:{args:h}})}return v.__r3f.attach===void 0&&(v instanceof Bt?v.__r3f.attach="geometry":v instanceof Ji&&(v.__r3f.attach="material")),y!=="inject"&&Iv(v,p),v}function i(u,h){let f=!1;if(h){var p,m;(p=h.__r3f)!=null&&p.attach?bv(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||Eh(h,{}),h.__r3f.parent=u,Ay(h),Sh(h)}}function r(u,h,f){let p=!1;if(h){var m,y;if((m=h.__r3f)!=null&&m.attach)bv(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){h.parent=u,h.dispatchEvent({type:"added"});const v=u.children.filter(_=>_!==h),A=v.indexOf(f);u.children=[...v.slice(0,A),h,...v.slice(A)],p=!0}p||(y=u.__r3f)==null||y.objects.push(h),h.__r3f||Eh(h,{}),h.__r3f.parent=u,Ay(h),Sh(h)}}function s(u,h,f=!1){u&&[...u].forEach(p=>a(h,p,f))}function a(u,h,f){if(h){var p,m,y;if(h.__r3f&&(h.__r3f.parent=null),(p=u.__r3f)!=null&&p.objects&&(u.__r3f.objects=u.__r3f.objects.filter(E=>E!==h)),(m=h.__r3f)!=null&&m.attach)VE(u,h,h.__r3f.attach);else if(h.isObject3D&&u.isObject3D){var v;u.remove(h),(v=h.__r3f)!=null&&v.root&&sz(h.__r3f.root,h)}const _=(y=h.__r3f)==null?void 0:y.primitive,x=f===void 0?h.dispose!==null&&!_:f;if(!_){var A;s((A=h.__r3f)==null?void 0:A.objects,h,x),s(h.children,h,x)}delete h.__r3f,x&&h.dispose&&h.type!=="Scene"&&gy.unstable_scheduleCallback(gy.unstable_IdlePriority,()=>{try{h.dispose()}catch{}}),Sh(u)}}function o(u,h,f,p){var m;const y=(m=u.__r3f)==null?void 0:m.parent;if(!y)return;const v=t(h,f,u.__r3f.root);if(u.children){for(const A of u.children)A.__r3f&&i(v,A);u.children=u.children.filter(A=>!A.__r3f)}u.__r3f.objects.forEach(A=>i(v,A)),u.__r3f.objects=[],u.__r3f.autoRemovedBeforeAppend||a(y,u),v.parent&&(v.__r3f.autoRemovedBeforeAppend=!0),i(y,v),v.raycast&&v.__r3f.eventCount&&v.__r3f.root.getState().internal.interaction.push(v),[p,p.alternate].forEach(A=>{A!==null&&(A.stateNode=v,A.ref&&(typeof A.ref=="function"?A.ref(v):A.ref.current=v))})}const l=()=>console.warn("Text is not allowed in the R3F tree! This could be stray whitespace or characters.");return{reconciler:qG({createInstance:t,removeChild:a,appendChild:i,appendInitialChild:i,insertBefore:r,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,i(f,h))},removeChildFromContainer:(u,h)=>{h&&a(u.getState().scene,h)},insertInContainerBefore:(u,h,f)=>{if(!h||!f)return;const p=u.getState().scene;p.__r3f&&r(p,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,p){var m;if(((m=u==null?void 0:u.__r3f)!=null?m:{}).primitive&&p.object&&p.object!==u)return[!0];{const{args:v=[],children:A,..._}=p,{args:x=[],children:E,...w}=f;if(!Array.isArray(v))throw new Error("R3F: the args prop must be an array!");if(v.some((T,M)=>T!==x[M]))return[!0];const I=lb(u,_,w,!0);return I.changes.length?[!1,I]:null}},commitUpdate(u,[h,f],p,m,y,v){h?o(u,p,y,v):Iv(u,f)},commitMount(u,h,f,p){var m;const y=(m=u.__r3f)!=null?m:{};u.raycast&&y.handlers&&y.eventCount&&u.__r3f.root.getState().internal.interaction.push(u)},getPublicInstance:u=>u,prepareForCommit:()=>null,preparePortalMount:u=>Eh(u.getState().scene),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance(u){var h;const{attach:f,parent:p}=(h=u.__r3f)!=null?h:{};f&&p&&VE(p,u,f),u.isObject3D&&(u.visible=!1),Sh(u)},unhideInstance(u,h){var f;const{attach:p,parent:m}=(f=u.__r3f)!=null?f:{};p&&m&&bv(m,u,p),(u.isObject3D&&h.visible==null||h.visible)&&(u.visible=!0),Sh(u)},createTextInstance:l,hideTextInstance:l,unhideTextInstance:l,getCurrentEventPriority:()=>e?e():Mh.DefaultEventPriority,beforeActiveInstanceBlur:()=>{},afterActiveInstanceBlur:()=>{},detachDeletedInstance:()=>{},now:typeof performance<"u"&&Qn.fun(performance.now)?performance.now:Qn.fun(Date.now)?Date.now:()=>0,scheduleTimeout:Qn.fun(setTimeout)?setTimeout:void 0,cancelTimeout:Qn.fun(clearTimeout)?clearTimeout:void 0}),applyProps:Iv}}var GE,zE;const Tv=n=>"colorSpace"in n||"outputColorSpace"in n,nb=()=>{var n;return(n=s4.ColorManagement)!=null?n:null},ib=n=>n&&n.isOrthographicCamera,ZG=n=>n&&n.hasOwnProperty("current"),m0=typeof window<"u"&&((GE=window.document)!=null&&GE.createElement||((zE=window.navigator)==null?void 0:zE.product)==="ReactNative")?$.useLayoutEffect:$.useEffect;function rb(n){const e=$.useRef(n);return m0(()=>void(e.current=n),[n]),e}function ez({set:n}){return m0(()=>(n(new Promise(()=>null)),()=>n(!1)),[n]),null}class sb extends $.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}sb.getDerivedStateFromError=()=>({error:!0});const ab="__default",QE=new Map,tz=n=>n&&!!n.memoized&&!!n.changes;function ob(n){var e;const t=typeof window<"u"?(e=window.devicePixelRatio)!=null?e:2:1;return Array.isArray(n)?Math.min(Math.max(n[0],t),n[1]):n}const id=n=>{var e;return(e=n.__r3f)==null?void 0:e.root.getState()},Qn={obj:n=>n===Object(n)&&!Qn.arr(n)&&typeof n!="function",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",boo:n=>typeof n=="boolean",und:n=>n===void 0,arr:n=>Array.isArray(n),equ(n,e,{arrays:t="shallow",objects:i="reference",strict:r=!0}={}){if(typeof n!=typeof e||!!n!=!!e)return!1;if(Qn.str(n)||Qn.num(n))return n===e;const s=Qn.obj(n);if(s&&i==="reference")return n===e;const a=Qn.arr(n);if(a&&t==="reference")return n===e;if((a||s)&&n===e)return!0;let o;for(o in n)if(!(o in e))return!1;if(s&&t==="shallow"&&i==="shallow"){for(o in r?e:n)if(!Qn.equ(n[o],e[o],{strict:r,objects:"reference"}))return!1}else for(o in r?e:n)if(n[o]!==e[o])return!1;if(Qn.und(o)){if(a&&n.length===0&&e.length===0||s&&Object.keys(n).length===0&&Object.keys(e).length===0)return!0;if(n!==e)return!1}return!0}};function nz(n){n.dispose&&n.type!=="Scene"&&n.dispose();for(const e in n)e.dispose==null||e.dispose(),delete n[e]}function Eh(n,e){const t=n;return t.__r3f={type:"",root:null,previousAttach:null,memoizedProps:{},eventCount:0,handlers:{},objects:[],parent:null,...e},n}function my(n,e){let t=n;if(e.includes("-")){const i=e.split("-"),r=i.pop();return t=i.reduce((s,a)=>s[a],n),{target:t,key:r}}else return{target:t,key:e}}const HE=/-\d+$/;function bv(n,e,t){if(Qn.str(t)){if(HE.test(t)){const s=t.replace(HE,""),{target:a,key:o}=my(n,s);Array.isArray(a[o])||(a[o]=[])}const{target:i,key:r}=my(n,t);e.__r3f.previousAttach=i[r],i[r]=e}else e.__r3f.previousAttach=t(n,e)}function VE(n,e,t){var i,r;if(Qn.str(t)){const{target:s,key:a}=my(n,t),o=e.__r3f.previousAttach;o===void 0?delete s[a]:s[a]=o}else(i=e.__r3f)==null||i.previousAttach==null||i.previousAttach(n,e);(r=e.__r3f)==null||delete r.previousAttach}function lb(n,{children:e,key:t,ref:i,...r},{children:s,key:a,ref:o,...l}={},c=!1){var u;const h=(u=n==null?void 0:n.__r3f)!=null?u:{},f=Object.entries(r),p=[];if(c){const y=Object.keys(l);for(let v=0;v{var A;if((A=n.__r3f)!=null&&A.primitive&&y==="object"||Qn.equ(v,l[y]))return;if(/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/.test(y))return p.push([y,v,!0,[]]);let _=[];y.includes("-")&&(_=y.split("-")),p.push([y,v,!1,_]);for(const x in r){const E=r[x];x.startsWith(`${y}-`)&&p.push([x,E,!1,x.split("-")])}});const m={...r};return h.memoizedProps&&h.memoizedProps.args&&(m.args=h.memoizedProps.args),h.memoizedProps&&h.memoizedProps.attach&&(m.attach=h.memoizedProps.attach),{memoized:m,changes:p}}function Iv(n,e){var t,i,r;const s=(t=n.__r3f)!=null?t:{},a=s.root,o=(i=a==null||a.getState==null?void 0:a.getState())!=null?i:{},{memoized:l,changes:c}=tz(e)?e:lb(n,e),u=s.eventCount;n.__r3f&&(n.__r3f.memoizedProps=l);for(let f=0;fx[E],n),!(_&&_.set))){const[x,...E]=v.reverse();A=E.reverse().reduce((w,I)=>w[I],n),p=x}if(m===ab+"remove")if(A.constructor){let x=QE.get(A.constructor);x||(x=new A.constructor,QE.set(A.constructor,x)),m=x[p]}else m=0;if(y)m?s.handlers[p]=m:delete s.handlers[p],s.eventCount=Object.keys(s.handlers).length;else if(_&&_.set&&(_.copy||_ instanceof Kc)){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 x=_ instanceof He;!x&&_.setScalar?_.setScalar(m):_ instanceof Kc&&m instanceof Kc?_.mask=m.mask:_.set(m),!nb()&&!o.linear&&x&&_.convertSRGBToLinear()}}else if(A[p]=m,A[p]instanceof Vn&&A[p].format===li&&A[p].type===Ri){const x=A[p];Tv(x)&&Tv(o.gl)?x.colorSpace=o.gl.outputColorSpace:x.encoding=o.gl.outputEncoding}Sh(n)}if(s.parent&&o.internal&&n.raycast&&u!==s.eventCount){const f=o.internal.interaction.indexOf(n);f>-1&&o.internal.interaction.splice(f,1),s.eventCount&&o.internal.interaction.push(n)}return!(c.length===1&&c[0][0]==="onUpdate")&&c.length&&(r=n.__r3f)!=null&&r.parent&&Ay(n),n}function Sh(n){var e,t;const i=(e=n.__r3f)==null||(t=e.root)==null||t.getState==null?void 0:t.getState();i&&i.internal.frames===0&&i.invalidate()}function Ay(n){n.onUpdate==null||n.onUpdate(n)}function iz(n,e){n.manual||(ib(n)?(n.left=e.width/-2,n.right=e.width/2,n.top=e.height/2,n.bottom=e.height/-2):n.aspect=e.width/e.height,n.updateProjectionMatrix(),n.updateMatrixWorld())}function bg(n){return(n.eventObject||n.object).uuid+"/"+n.index+n.instanceId}function rz(){var n;const e=typeof self<"u"&&self||typeof window<"u"&&window;if(!e)return Mh.DefaultEventPriority;switch((n=e.event)==null?void 0:n.type){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return Mh.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return Mh.ContinuousEventPriority;default:return Mh.DefaultEventPriority}}function cb(n,e,t,i){const r=t.get(e);r&&(t.delete(e),t.size===0&&(n.delete(i),r.target.releasePointerCapture(i)))}function sz(n,e){const{internal:t}=n.getState();t.interaction=t.interaction.filter(i=>i!==e),t.initialHits=t.initialHits.filter(i=>i!==e),t.hovered.forEach((i,r)=>{(i.eventObject===e||i.object===e)&&t.hovered.delete(r)}),t.capturedMap.forEach((i,r)=>{cb(t.capturedMap,e,i,r)})}function az(n){function e(l){const{internal:c}=n.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 i(l,c){const u=n.getState(),h=new Set,f=[],p=c?c(u.internal.interaction):u.internal.interaction;for(let A=0;A{const x=id(A.object),E=id(_.object);return!x||!E?A.distance-_.distance:E.events.priority-x.events.priority||A.distance-_.distance}).filter(A=>{const _=bg(A);return h.has(_)?!1:(h.add(_),!0)});u.events.filter&&(y=u.events.filter(y,u));for(const A of y){let _=A.object;for(;_;){var v;(v=_.__r3f)!=null&&v.eventCount&&f.push({...A,eventObject:_}),_=_.parent}}if("pointerId"in l&&u.internal.capturedMap.has(l.pointerId))for(let A of u.internal.capturedMap.get(l.pointerId).values())h.has(bg(A.intersection))||f.push(A.intersection);return f}function r(l,c,u,h){const f=n.getState();if(l.length){const p={stopped:!1};for(const m of l){const y=id(m.object)||f,{raycaster:v,pointer:A,camera:_,internal:x}=y,E=new N(A.x,A.y,0).unproject(_),w=B=>{var L,U;return(L=(U=x.capturedMap.get(B))==null?void 0:U.has(m.eventObject))!=null?L:!1},I=B=>{const L={intersection:m,target:c.target};x.capturedMap.has(B)?x.capturedMap.get(B).set(m.eventObject,L):x.capturedMap.set(B,new Map([[m.eventObject,L]])),c.target.setPointerCapture(B)},T=B=>{const L=x.capturedMap.get(B);L&&cb(x.capturedMap,m.eventObject,L,B)};let M={};for(let B in c){let L=c[B];typeof L!="function"&&(M[B]=L)}let b={...m,...M,pointer:A,intersections:l,stopped:p.stopped,delta:u,unprojectedPoint:E,ray:v.ray,camera:_,stopPropagation(){const B="pointerId"in c&&x.capturedMap.get(c.pointerId);if((!B||B.has(m.eventObject))&&(b.stopped=p.stopped=!0,x.hovered.size&&Array.from(x.hovered.values()).find(L=>L.eventObject===m.eventObject))){const L=l.slice(0,l.indexOf(m));s([...L,m])}},target:{hasPointerCapture:w,setPointerCapture:I,releasePointerCapture:T},currentTarget:{hasPointerCapture:w,setPointerCapture:I,releasePointerCapture:T},nativeEvent:c};if(h(b),p.stopped===!0)break}}return l}function s(l){const{internal:c}=n.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 f=u.eventObject.__r3f,p=f==null?void 0:f.handlers;if(c.hovered.delete(bg(u)),f!=null&&f.eventCount){const m={...u,intersections:l};p.onPointerOut==null||p.onPointerOut(m),p.onPointerLeave==null||p.onPointerLeave(m)}}}function a(l,c){for(let u=0;us([]);case"onLostPointerCapture":return c=>{const{internal:u}=n.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:f}=n.getState();f.lastEvent.current=u;const p=l==="onPointerMove",m=l==="onClick"||l==="onContextMenu"||l==="onDoubleClick",v=i(u,p?t:void 0),A=m?e(u):0;l==="onPointerDown"&&(f.initialClick=[u.offsetX,u.offsetY],f.initialHits=v.map(x=>x.eventObject)),m&&!v.length&&A<=2&&(a(u,f.interaction),h&&h(u)),p&&s(v);function _(x){const E=x.eventObject,w=E.__r3f,I=w==null?void 0:w.handlers;if(w!=null&&w.eventCount)if(p){if(I.onPointerOver||I.onPointerEnter||I.onPointerOut||I.onPointerLeave){const T=bg(x),M=f.hovered.get(T);M?M.stopped&&x.stopPropagation():(f.hovered.set(T,x),I.onPointerOver==null||I.onPointerOver(x),I.onPointerEnter==null||I.onPointerEnter(x))}I.onPointerMove==null||I.onPointerMove(x)}else{const T=I[l];T?(!m||f.initialHits.includes(E))&&(a(u,f.interaction.filter(M=>!f.initialHits.includes(M))),T(x)):m&&f.initialHits.includes(E)&&a(u,f.interaction.filter(M=>!f.initialHits.includes(M)))}}r(v,u,A,_)}}return{handlePointer:o}}const ub=n=>!!(n!=null&&n.render),hb=$.createContext(null),oz=(n,e)=>{const t=VG((o,l)=>{const c=new N,u=new N,h=new N;function f(A=l().camera,_=u,x=l().size){const{width:E,height:w,top:I,left:T}=x,M=E/w;_ instanceof N?h.copy(_):h.set(..._);const b=A.getWorldPosition(c).distanceTo(h);if(ib(A))return{width:E/A.zoom,height:w/A.zoom,top:I,left:T,factor:1,distance:b,aspect:M};{const B=A.fov*Math.PI/180,L=2*Math.tan(B/2)*b,U=L*(E/w);return{width:U,height:L,top:I,left:T,factor:E/U,distance:b,aspect:M}}}let p;const m=A=>o(_=>({performance:{..._.performance,current:A}})),y=new _e;return{set:o,get:l,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},xr:null,scene:null,invalidate:(A=1)=>n(l(),A),advance:(A,_)=>e(A,_,l()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new s1,pointer:y,mouse:y,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const A=l();p&&clearTimeout(p),A.performance.current!==A.performance.min&&m(A.performance.min),p=setTimeout(()=>m(l().performance.max),A.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:A=>o(_=>({..._,events:{..._.events,...A}})),setSize:(A,_,x,E,w)=>{const I=l().camera,T={width:A,height:_,top:E||0,left:w||0,updateStyle:x};o(M=>({size:T,viewport:{...M.viewport,...f(I,u,T)}}))},setDpr:A=>o(_=>{const x=ob(A);return{viewport:{..._.viewport,dpr:x,initialDpr:_.viewport.initialDpr||x}}}),setFrameloop:(A="always")=>{const _=l().clock;_.stop(),_.elapsedTime=0,A!=="never"&&(_.start(),_.elapsedTime=0),o(()=>({frameloop:A}))},previousRoot:void 0,internal:{active:!1,priority:0,frames:0,lastEvent:$.createRef(),interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,subscribe:(A,_,x)=>{const E=l().internal;return E.priority=E.priority+(_>0?1:0),E.subscribers.push({ref:A,priority:_,store:x}),E.subscribers=E.subscribers.sort((w,I)=>w.priority-I.priority),()=>{const w=l().internal;w!=null&&w.subscribers&&(w.priority=w.priority-(_>0?1:0),w.subscribers=w.subscribers.filter(I=>I.ref!==A))}}}}}),i=t.getState();let r=i.size,s=i.viewport.dpr,a=i.camera;return t.subscribe(()=>{const{camera:o,size:l,viewport:c,gl:u,set:h}=t.getState();if(l!==r||c.dpr!==s){var f;r=l,s=c.dpr,iz(o,l),u.setPixelRatio(c.dpr);const p=(f=l.updateStyle)!=null?f:typeof HTMLCanvasElement<"u"&&u.domElement instanceof HTMLCanvasElement;u.setSize(l.width,l.height,p)}o!==a&&(a=o,h(p=>({viewport:{...p.viewport,...p.viewport.getCurrentViewport(o)}})))}),t.subscribe(o=>n(o)),t};function lz(n,e){const t={callback:n};return e.add(t),()=>void e.delete(t)}let Ig,fb=new Set,cz=new Set,uz=new Set;const hz=n=>lz(n,fb);function Mv(n,e){if(n.size)for(const{callback:t}of n.values())t(e)}function rd(n,e){switch(n){case"before":return Mv(fb,e);case"after":return Mv(cz,e);case"tail":return Mv(uz,e)}}let Rv,Bv;function Dv(n,e,t){let i=e.clock.getDelta();for(e.frameloop==="never"&&typeof n=="number"&&(i=n-e.clock.elapsedTime,e.clock.oldTime=e.clock.elapsedTime,e.clock.elapsedTime=n),Rv=e.internal.subscribers,Ig=0;Ig0)&&!((c=r.gl.xr)!=null&&c.isPresenting)&&(t+=Dv(l,r))}if(rd("after",l),t===0)return rd("tail",l),e=!1,cancelAnimationFrame(i)}function a(l,c=1){var u;if(!l)return n.forEach(h=>a(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 o(l,c=!0,u,h){if(c&&rd("before",l),u)Dv(l,u,h);else for(const f of n.values())Dv(l,f.store.getState());c&&rd("after",l)}return{loop:s,invalidate:a,advance:o}}function db(){const n=$.useContext(hb);if(!n)throw new Error("R3F: Hooks can only be used within the Canvas component!");return n}function Cr(n=t=>t,e){return db()(n,e)}function a1(n,e=0){const t=db(),i=t.getState().internal.subscribe,r=rb(n);return m0(()=>i(r,e,t),[e,i,t]),null}const Yh=new Map,{invalidate:WE,advance:YE}=fz(Yh),{reconciler:Lm,applyProps:Pc}=JG(Yh,rz),uh={objects:"shallow",strict:!1},dz=(n,e)=>{const t=typeof n=="function"?n(e):n;return ub(t)?t:new U6({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...n})};function pz(n,e){if(e)return e;if(typeof HTMLCanvasElement<"u"&&n instanceof HTMLCanvasElement&&n.parentElement){const{width:t,height:i,top:r,left:s}=n.parentElement.getBoundingClientRect();return{width:t,height:i,top:r,left:s}}else if(typeof OffscreenCanvas<"u"&&n instanceof OffscreenCanvas)return{width:n.width,height:n.height,top:0,left:0};return{width:0,height:0,top:0,left:0}}function gz(n){const e=Yh.get(n),t=e==null?void 0:e.fiber,i=e==null?void 0:e.store;e&&console.warn("R3F.createRoot should only be called once!");const r=typeof reportError=="function"?reportError:console.error,s=i||oz(WE,YE),a=t||Lm.createContainer(s,Mh.ConcurrentRoot,null,!1,null,"",r,null);e||Yh.set(n,{fiber:a,store:s});let o,l=!1,c;return{configure(u={}){let{gl:h,size:f,scene:p,events:m,onCreated:y,shadows:v=!1,linear:A=!1,flat:_=!1,legacy:x=!1,orthographic:E=!1,frameloop:w="always",dpr:I=[1,2],performance:T,raycaster:M,camera:b,onPointerMissed:B}=u,L=s.getState(),U=L.gl;L.gl||L.set({gl:U=dz(h,n)});let O=L.raycaster;O||L.set({raycaster:O=new r4});const{params:Q,...G}=M||{};if(Qn.equ(G,O,uh)||Pc(O,{...G}),Qn.equ(Q,O.params,uh)||Pc(O,{params:{...O.params,...Q}}),!L.camera||L.camera===c&&!Qn.equ(c,b,uh)){c=b;const D=b instanceof o0,k=D?b:E?new ql(0,0,0,0,.1,1e3):new Kn(75,0,.1,1e3);D||(k.position.z=5,b&&Pc(k,b),!L.camera&&!(b!=null&&b.rotation)&&k.lookAt(0,0,0)),L.set({camera:k})}if(!L.scene){let D;p instanceof Bp?D=p:(D=new Bp,p&&Pc(D,p)),L.set({scene:Eh(D)})}if(!L.xr){const D=(j,ee)=>{const ie=s.getState();ie.frameloop!=="never"&&YE(j,!0,ie,ee)},k=()=>{const j=s.getState();j.gl.xr.enabled=j.gl.xr.isPresenting,j.gl.xr.setAnimationLoop(j.gl.xr.isPresenting?D:null),j.gl.xr.isPresenting||WE(j)},Z={connect(){const j=s.getState().gl;j.xr.addEventListener("sessionstart",k),j.xr.addEventListener("sessionend",k)},disconnect(){const j=s.getState().gl;j.xr.removeEventListener("sessionstart",k),j.xr.removeEventListener("sessionend",k)}};U.xr&&Z.connect(),L.set({xr:Z})}if(U.shadowMap){const D=U.shadowMap.enabled,k=U.shadowMap.type;if(U.shadowMap.enabled=!!v,Qn.boo(v))U.shadowMap.type=jd;else if(Qn.str(v)){var F;const Z={basic:aC,percentage:b2,soft:jd,variance:sa};U.shadowMap.type=(F=Z[v])!=null?F:jd}else Qn.obj(v)&&Object.assign(U.shadowMap,v);(D!==U.shadowMap.enabled||k!==U.shadowMap.type)&&(U.shadowMap.needsUpdate=!0)}const q=nb();q&&("enabled"in q?q.enabled=!x:"legacyMode"in q&&(q.legacyMode=x)),Pc(U,{outputEncoding:A?3e3:3001,toneMapping:_?os:v6}),L.legacy!==x&&L.set(()=>({legacy:x})),L.linear!==A&&L.set(()=>({linear:A})),L.flat!==_&&L.set(()=>({flat:_})),h&&!Qn.fun(h)&&!ub(h)&&!Qn.equ(h,U,uh)&&Pc(U,h),m&&!L.events.handlers&&L.set({events:m(s)});const V=pz(n,f);return Qn.equ(V,L.size,uh)||L.setSize(V.width,V.height,V.updateStyle,V.top,V.left),I&&L.viewport.dpr!==ob(I)&&L.setDpr(I),L.frameloop!==w&&L.setFrameloop(w),L.onPointerMissed||L.set({onPointerMissed:B}),T&&!Qn.equ(T,L.performance,uh)&&L.set(D=>({performance:{...D.performance,...T}})),o=y,l=!0,this},render(u){return l||this.configure(),Lm.updateContainer($.createElement(mz,{store:s,children:u,onCreated:o,rootElement:n}),a,null,()=>{}),s},unmount(){pb(n)}}}function mz({store:n,children:e,onCreated:t,rootElement:i}){return m0(()=>{const r=n.getState();r.set(s=>({internal:{...s.internal,active:!0}})),t&&t(r),n.getState().events.connected||r.events.connect==null||r.events.connect(i)},[]),$.createElement(hb.Provider,{value:n},e)}function pb(n,e){const t=Yh.get(n),i=t==null?void 0:t.fiber;if(i){const r=t==null?void 0:t.store.getState();r&&(r.internal.active=!1),Lm.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var s,a,o,l;r.events.disconnect==null||r.events.disconnect(),(s=r.gl)==null||(a=s.renderLists)==null||a.dispose==null||a.dispose(),(o=r.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(l=r.gl)!=null&&l.xr&&r.xr.disconnect(),nz(r),Yh.delete(n),e&&e(n)}catch{}},500)})}}Lm.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:$.version});function ou(){return ou=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0?i=setTimeout(l,e-u):(i=null,t||(o=n.apply(s,r),s=r=null))}var c=function(){s=this,r=arguments,a=Date.now();var u=t&&!i;return i||(i=setTimeout(l,e)),u&&(o=n.apply(s,r),s=r=null),o};return c.clear=function(){i&&(clearTimeout(i),i=null)},c.flush=function(){i&&(o=n.apply(s,r),s=r=null,clearTimeout(i),i=null)},c}vy.debounce=vy;var Az=vy;const qE=ps(Az);function vz(n){let{debounce:e,scroll:t,polyfill:i,offsetSize:r}=n===void 0?{debounce:0,scroll:!1,offsetSize:!1}:n;const s=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)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[a,o]=$.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=$.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:a}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,h=$.useRef(!1);$.useEffect(()=>(h.current=!0,()=>void(h.current=!1)));const[f,p,m]=$.useMemo(()=>{const _=()=>{if(!l.current.element)return;const{left:x,top:E,width:w,height:I,bottom:T,right:M,x:b,y:B}=l.current.element.getBoundingClientRect(),L={left:x,top:E,width:w,height:I,bottom:T,right:M,x:b,y:B};l.current.element instanceof HTMLElement&&r&&(L.height=l.current.element.offsetHeight,L.width=l.current.element.offsetWidth),Object.freeze(L),h.current&&!Ez(l.current.lastBounds,L)&&o(l.current.lastBounds=L)};return[_,u?qE(_,u):_,c?qE(_,c):_]},[o,r,c,u]);function y(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(_=>_.removeEventListener("scroll",m,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function v(){l.current.element&&(l.current.resizeObserver=new s(m),l.current.resizeObserver.observe(l.current.element),t&&l.current.scrollContainers&&l.current.scrollContainers.forEach(_=>_.addEventListener("scroll",m,{capture:!0,passive:!0})))}const A=_=>{!_||_===l.current.element||(y(),l.current.element=_,l.current.scrollContainers=gb(_),v())};return xz(m,!!t),yz(p),$.useEffect(()=>{y(),v()},[t,m,p]),$.useEffect(()=>y,[]),[A,a,f]}function yz(n){$.useEffect(()=>{const e=n;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[n])}function xz(n,e){$.useEffect(()=>{if(e){const t=n;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",t,!0)}},[n,e])}function gb(n){const e=[];if(!n||n===document.body)return e;const{overflow:t,overflowX:i,overflowY:r}=window.getComputedStyle(n);return[t,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(n),[...e,...gb(n.parentElement)]}const _z=["x","y","top","bottom","left","right","width","height"],Ez=(n,e)=>_z.every(t=>n[t]===e[t]);var Sz=Object.defineProperty,wz=Object.defineProperties,Cz=Object.getOwnPropertyDescriptors,XE=Object.getOwnPropertySymbols,Tz=Object.prototype.hasOwnProperty,bz=Object.prototype.propertyIsEnumerable,jE=(n,e,t)=>e in n?Sz(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,KE=(n,e)=>{for(var t in e||(e={}))Tz.call(e,t)&&jE(n,t,e[t]);if(XE)for(var t of XE(e))bz.call(e,t)&&jE(n,t,e[t]);return n},Iz=(n,e)=>wz(n,Cz(e));function mb(n,e,t){if(!n)return;if(t(n)===!0)return n;let i=e?n.return:n.child;for(;i;){const r=mb(i,e,t);if(r)return r;i=e?null:i.sibling}}function Ab(n){try{return Object.defineProperties(n,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return n}}const a4=Ab($.createContext(null));class vb extends $.Component{render(){return $.createElement(a4.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:$E,ReactCurrentDispatcher:JE}=$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Mz(){const n=$.useContext(a4);if(n===null)throw new Error("its-fine: useFiber must be called within a !");const e=$.useId();return $.useMemo(()=>{for(const i of[$E==null?void 0:$E.current,n,n==null?void 0:n.alternate]){if(!i)continue;const r=mb(i,!1,s=>{let a=s.memoizedState;for(;a;){if(a.memoizedState===e)return!0;a=a.next}});if(r)return r}},[n,e])}function Rz(){var n,e;const t=Mz(),[i]=$.useState(()=>new Map);i.clear();let r=t;for(;r;){const s=(n=r.type)==null?void 0:n._context;s&&s!==a4&&!i.has(s)&&i.set(s,(e=JE==null?void 0:JE.current)==null?void 0:e.readContext(Ab(s))),r=r.return}return i}function Bz(){const n=Rz();return $.useMemo(()=>Array.from(n.keys()).reduce((e,t)=>i=>$.createElement(e,null,$.createElement(t.Provider,Iz(KE({},i),{value:n.get(t)}))),e=>$.createElement(vb,KE({},e))),[n])}const Pv={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 Dz(n){const{handlePointer:e}=az(n);return{priority:1,enabled:!0,compute(t,i,r){i.pointer.set(t.offsetX/i.size.width*2-1,-(t.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(Pv).reduce((t,i)=>({...t,[i]:e(i)}),{}),update:()=>{var t;const{events:i,internal:r}=n.getState();(t=r.lastEvent)!=null&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{var i;const{set:r,events:s}=n.getState();s.disconnect==null||s.disconnect(),r(a=>({events:{...a.events,connected:t}})),Object.entries((i=s.handlers)!=null?i:[]).forEach(([a,o])=>{const[l,c]=Pv[a];t.addEventListener(l,o,{passive:c})})},disconnect:()=>{const{set:t,events:i}=n.getState();if(i.connected){var r;Object.entries((r=i.handlers)!=null?r:[]).forEach(([s,a])=>{if(i&&i.connected instanceof HTMLElement){const[o]=Pv[s];i.connected.removeEventListener(o,a)}}),t(s=>({events:{...s.events,connected:void 0}}))}}}}const Pz=$.forwardRef(function({children:e,fallback:t,resize:i,style:r,gl:s,events:a=Dz,eventSource:o,eventPrefix:l,shadows:c,linear:u,flat:h,legacy:f,orthographic:p,frameloop:m,dpr:y,performance:v,raycaster:A,camera:_,onPointerMissed:x,onCreated:E,...w},I){$.useMemo(()=>tb(KT),[]);const T=Bz(),[M,b]=vz({scroll:!0,debounce:{scroll:50,resize:0},...i}),B=$.useRef(null),L=$.useRef(null);$.useImperativeHandle(I,()=>B.current);const U=rb(x),[O,Q]=$.useState(!1),[G,F]=$.useState(!1);if(O)throw O;if(G)throw G;const q=$.useRef(null);m0(()=>{const H=B.current;b.width>0&&b.height>0&&H&&(q.current||(q.current=gz(H)),q.current.configure({gl:s,events:a,shadows:c,linear:u,flat:h,legacy:f,orthographic:p,frameloop:m,dpr:y,performance:v,raycaster:A,camera:_,size:b,onPointerMissed:(...V)=>U.current==null?void 0:U.current(...V),onCreated:V=>{V.events.connect==null||V.events.connect(o?ZG(o)?o.current:o:L.current),l&&V.setEvents({compute:(D,k)=>{const Z=D[l+"X"],j=D[l+"Y"];k.pointer.set(Z/k.size.width*2-1,-(j/k.size.height)*2+1),k.raycaster.setFromCamera(k.pointer,k.camera)}}),E==null||E(V)}}),q.current.render($.createElement(T,null,$.createElement(sb,{set:F},$.createElement($.Suspense,{fallback:$.createElement(ez,{set:Q})},e)))))}),$.useEffect(()=>{const H=B.current;if(H)return()=>pb(H)},[]);const Y=o?"none":"auto";return $.createElement("div",ou({ref:L,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:Y,...r}},w),$.createElement("div",{ref:M,style:{width:"100%",height:"100%"}},$.createElement("canvas",{ref:B,style:{display:"block"}},t)))}),Lz=$.forwardRef(function(e,t){return $.createElement(vb,null,$.createElement(Pz,ou({},e,{ref:t})))});function Uz(n){const e=+this._x.call(null,n);return yb(this.cover(e),e,n)}function yb(n,e,t){if(isNaN(e))return n;var i,r=n._root,s={data:t},a=n._x0,o=n._x1,l,c,u,h,f;if(!r)return n._root=s,n;for(;r.length;)if((u=e>=(l=(a+o)/2))?a=l:o=l,i=r,!(r=r[h=+u]))return i[h]=s,n;if(c=+n._x.call(null,r.data),e===c)return s.next=r,i?i[h]=s:n._root=s,n;do i=i?i[h]=new Array(2):n._root=new Array(2),(u=e>=(l=(a+o)/2))?a=l:o=l;while((h=+u)==(f=+(c>=l)));return i[f]=r,i[h]=s,n}function Oz(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e);let i=1/0,r=-1/0;for(let s=0,a;sr&&(r=a));if(i>r)return this;this.cover(i).cover(r);for(let s=0;sn||n>=t;)switch(a=+(na||(s=c.x1)=h))&&(c=o[o.length-1],o[o.length-1]=o[o.length-1-u],o[o.length-1-u]=c)}else{var f=Math.abs(n-+this._x.call(null,l.data));f=(c=(a+o)/2))?a=c:o=c,e=t,!(t=t[h=+u]))return this;if(!t.length)break;e[h+1&1]&&(i=e,f=h)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[h]=s:delete e[h],(t=e[0]||e[1])&&t===(e[1]||e[0])&&!t.length&&(i?i[f]=t:this._root=t),this):(this._root=s,this)}function Qz(n){for(var e=0,t=n.length;e=(h=(o+c)/2))?o=h:c=h,(v=t>=(f=(l+u)/2))?l=f:u=f,r=s,!(s=s[A=v<<1|y]))return r[A]=a,n;if(p=+n._x.call(null,s.data),m=+n._y.call(null,s.data),e===p&&t===m)return a.next=s,r?r[A]=a:n._root=a,n;do r=r?r[A]=new Array(4):n._root=new Array(4),(y=e>=(h=(o+c)/2))?o=h:c=h,(v=t>=(f=(l+u)/2))?l=f:u=f;while((A=v<<1|y)===(_=(m>=f)<<1|p>=h));return r[_]=s,r[A]=a,n}function Kz(n){var e,t,i=n.length,r,s,a=new Array(i),o=new Array(i),l=1/0,c=1/0,u=-1/0,h=-1/0;for(t=0;tu&&(u=r),sh&&(h=s));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),t=0;tn||n>=r||i>e||e>=s;)switch(c=(eu||(o=m.y0)>h||(l=m.x1)=A)<<1|n>=v)&&(m=f[f.length-1],f[f.length-1]=f[f.length-1-y],f[f.length-1-y]=m)}else{var _=n-+this._x.call(null,p.data),x=e-+this._y.call(null,p.data),E=_*_+x*x;if(E=(f=(a+l)/2))?a=f:l=f,(y=h>=(p=(o+c)/2))?o=p:c=p,e=t,!(t=t[v=y<<1|m]))return this;if(!t.length)break;(e[v+1&3]||e[v+2&3]||e[v+3&3])&&(i=e,A=v)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[v]=s:delete e[v],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(i?i[A]=t:this._root=t),this):(this._root=s,this)}function nQ(n){for(var e=0,t=n.length;e=(m=(l+h)/2))?l=m:h=m,(w=t>=(y=(c+f)/2))?c=y:f=y,(I=i>=(v=(u+p)/2))?u=v:p=v,s=a,!(a=a[T=I<<2|w<<1|E]))return s[T]=o,n;if(A=+n._x.call(null,a.data),_=+n._y.call(null,a.data),x=+n._z.call(null,a.data),e===A&&t===_&&i===x)return o.next=a,s?s[T]=o:n._root=o,n;do s=s?s[T]=new Array(8):n._root=new Array(8),(E=e>=(m=(l+h)/2))?l=m:h=m,(w=t>=(y=(c+f)/2))?c=y:f=y,(I=i>=(v=(u+p)/2))?u=v:p=v;while((T=I<<2|w<<1|E)===(M=(x>=v)<<2|(_>=y)<<1|A>=m));return s[M]=a,s[T]=o,n}function fQ(n){Array.isArray(n)||(n=Array.from(n));const e=n.length,t=new Float64Array(e),i=new Float64Array(e),r=new Float64Array(e);let s=1/0,a=1/0,o=1/0,l=-1/0,c=-1/0,u=-1/0;for(let h=0,f,p,m,y;hl&&(l=p),mc&&(c=m),yu&&(u=y));if(s>l||a>c||o>u)return this;this.cover(s,a,o).cover(l,c,u);for(let h=0;hn||n>=a||r>e||e>=o||s>t||t>=l;)switch(f=(tm||(c=x.y0)>y||(u=x.z0)>v||(h=x.x1)=T)<<2|(e>=I)<<1|n>=w)&&(x=A[A.length-1],A[A.length-1]=A[A.length-1-E],A[A.length-1-E]=x)}else{var M=n-+this._x.call(null,_.data),b=e-+this._y.call(null,_.data),B=t-+this._z.call(null,_.data),L=M*M+b*b+B*B;if(L=(y=(a+c)/2))?a=y:c=y,(x=p>=(v=(o+u)/2))?o=v:u=v,(E=m>=(A=(l+h)/2))?l=A:h=A,e=t,!(t=t[w=E<<2|x<<1|_]))return this;if(!t.length)break;(e[w+1&7]||e[w+2&7]||e[w+3&7]||e[w+4&7]||e[w+5&7]||e[w+6&7]||e[w+7&7])&&(i=e,I=w)}for(;t.data!==n;)if(r=t,!(t=t.next))return this;return(s=t.next)&&delete t.next,r?(s?r.next=s:delete r.next,this):e?(s?e[w]=s:delete e[w],(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&&(i?i[I]=t:this._root=t),this):(this._root=s,this)}function vQ(n){for(var e=0,t=n.length;e1&&(y=p.y+p.vy),t>2&&(v=p.z+p.vz),f.visit(E);function E(w,I,T,M,b,B,L){var U=[I,T,M,b,B,L],O=U[0],Q=U[1],G=U[2],F=U[t],q=U[t+1],Y=U[t+2],H=w.data,V=w.r,D=A+V;if(H){if(H.index>p.index){var k=m-H.x-H.vx,Z=t>1?y-H.y-H.vy:0,j=t>2?v-H.z-H.vz:0,ee=k*k+Z*Z+j*j;ee1&&Z===0&&(Z=Us(r),ee+=Z*Z),t>2&&j===0&&(j=Us(r),ee+=j*j),ee=(D-(ee=Math.sqrt(ee)))/ee*s,p.vx+=(k*=ee)*(D=(V*=V)/(_+V)),t>1&&(p.vy+=(Z*=ee)*D),t>2&&(p.vz+=(j*=ee)*D),H.vx-=k*(D=1-D),t>1&&(H.vy-=Z*D),t>2&&(H.vz-=j*D))}return}return O>m+D||F1&&(Q>y+D||q2&&(G>v+D||Yu.r&&(u.r=u[h].r)}function c(){if(e){var u,h=e.length,f;for(i=new Array(h),u=0;utypeof f=="function")||Math.random,t=h.find(f=>[1,2,3].includes(f))||2,c()},o.iterations=function(u){return arguments.length?(a=+u,o):a},o.strength=function(u){return arguments.length?(s=+u,o):s},o.radius=function(u){return arguments.length?(n=typeof u=="function"?u:Zn(+u),c(),o):n},o}function RQ(n){return n.index}function i7(n,e){var t=n.get(e);if(!t)throw new Error("node not found: "+e);return t}function Sb(n){var e=RQ,t=f,i,r=Zn(30),s,a,o,l,c,u,h=1;n==null&&(n=[]);function f(A){return 1/Math.min(l[A.source.index],l[A.target.index])}function p(A){for(var _=0,x=n.length;_1&&(b=T.y+T.vy-I.y-I.vy||Us(u)),o>2&&(B=T.z+T.vz-I.z-I.vz||Us(u)),L=Math.sqrt(M*M+b*b+B*B),L=(L-s[E])/L*A*i[E],M*=L,b*=L,B*=L,T.vx-=M*(U=c[E]),o>1&&(T.vy-=b*U),o>2&&(T.vz-=B*U),I.vx+=M*(U=1-U),o>1&&(I.vy+=b*U),o>2&&(I.vz+=B*U)}function m(){if(a){var A,_=a.length,x=n.length,E=new Map(a.map((I,T)=>[e(I,T,a),I])),w;for(A=0,l=new Array(_);Atypeof x=="function")||Math.random,o=_.find(x=>[1,2,3].includes(x))||2,m()},p.links=function(A){return arguments.length?(n=A,m(),p):n},p.id=function(A){return arguments.length?(e=A,p):e},p.iterations=function(A){return arguments.length?(h=+A,p):h},p.strength=function(A){return arguments.length?(t=typeof A=="function"?A:Zn(+A),y(),p):t},p.distance=function(A){return arguments.length?(r=typeof A=="function"?A:Zn(+A),v(),p):r},p}var BQ={value:()=>{}};function wb(){for(var n=0,e=arguments.length,t={},i;n=0&&(i=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:i}})}pm.prototype=wb.prototype={constructor:pm,on:function(n,e){var t=this._,i=DQ(n+"",t),r,s=-1,a=i.length;if(arguments.length<2){for(;++s0)for(var t=new Array(r),i=0,r,s;i=0&&n._call.call(void 0,e),n=n._next;--qh}function s7(){lu=(Om=Gp.now())+o1,qh=zd=0;try{UQ()}finally{qh=0,FQ(),lu=0}}function OQ(){var n=Gp.now(),e=n-Om;e>Cb&&(o1-=e,Om=n)}function FQ(){for(var n,e=Um,t,i=1/0;e;)e._call?(i>e._time&&(i=e._time),n=e,e=e._next):(t=e._next,e._next=null,e=n?n._next=t:Um=t);Qd=n,xy(i)}function xy(n){if(!qh){zd&&(zd=clearTimeout(zd));var e=n-lu;e>24?(n<1/0&&(zd=setTimeout(s7,n-Gp.now()-o1)),sd&&(sd=clearInterval(sd))):(sd||(Om=Gp.now(),sd=setInterval(OQ,Cb)),qh=1,Tb(s7))}}const kQ=1664525,NQ=1013904223,a7=4294967296;function GQ(){let n=1;return()=>(n=(kQ*n+NQ)%a7)/a7}var o7=3;function Uv(n){return n.x}function l7(n){return n.y}function zQ(n){return n.z}var QQ=10,HQ=Math.PI*(3-Math.sqrt(5)),VQ=Math.PI*20/(9+Math.sqrt(221));function Mb(n,e){e=e||2;var t=Math.min(o7,Math.max(1,Math.round(e))),i,r=1,s=.001,a=1-Math.pow(s,1/300),o=0,l=.6,c=new Map,u=Ib(p),h=wb("tick","end"),f=GQ();n==null&&(n=[]);function p(){m(),h.call("tick",i),r1&&(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 i}function y(){for(var A=0,_=n.length,x;A<_;++A){if(x=n[A],x.index=A,x.fx!=null&&(x.x=x.fx),x.fy!=null&&(x.y=x.fy),x.fz!=null&&(x.z=x.fz),isNaN(x.x)||t>1&&isNaN(x.y)||t>2&&isNaN(x.z)){var E=QQ*(t>2?Math.cbrt(.5+A):t>1?Math.sqrt(.5+A):A),w=A*HQ,I=A*VQ;t===1?x.x=E:t===2?(x.x=E*Math.cos(w),x.y=E*Math.sin(w)):(x.x=E*Math.sin(w)*Math.cos(I),x.y=E*Math.cos(w),x.z=E*Math.sin(w)*Math.sin(I))}(isNaN(x.vx)||t>1&&isNaN(x.vy)||t>2&&isNaN(x.vz))&&(x.vx=0,t>1&&(x.vy=0),t>2&&(x.vz=0))}}function v(A){return A.initialize&&A.initialize(n,f,t),A}return y(),i={tick:m,restart:function(){return u.restart(p),i},stop:function(){return u.stop(),i},numDimensions:function(A){return arguments.length?(t=Math.min(o7,Math.max(1,Math.round(A))),c.forEach(v),i):t},nodes:function(A){return arguments.length?(n=A,y(),c.forEach(v),i):n},alpha:function(A){return arguments.length?(r=+A,i):r},alphaMin:function(A){return arguments.length?(s=+A,i):s},alphaDecay:function(A){return arguments.length?(a=+A,i):+a},alphaTarget:function(A){return arguments.length?(o=+A,i):o},velocityDecay:function(A){return arguments.length?(l=1-A,i):1-l},randomSource:function(A){return arguments.length?(f=A,c.forEach(v),i):f},force:function(A,_){return arguments.length>1?(_==null?c.delete(A):c.set(A,v(_)),i):c.get(A)},find:function(){var A=Array.prototype.slice.call(arguments),_=A.shift()||0,x=(t>1?A.shift():null)||0,E=(t>2?A.shift():null)||0,w=A.shift()||1/0,I=0,T=n.length,M,b,B,L,U,O;for(w*=w,I=0;I1?(h.on(A,_),i):h.on(A)}}}function Rb(){var n,e,t,i,r,s=Zn(-30),a,o=1,l=1/0,c=.81;function u(m){var y,v=n.length,A=(e===1?o4(n,Uv):e===2?c4(n,Uv,l7):e===3?h4(n,Uv,l7,zQ):null).visitAfter(f);for(r=m,y=0;y1&&(m.y=E/_),e>2&&(m.z=w/_)}else{v=m,v.x=v.data.x,e>1&&(v.y=v.data.y),e>2&&(v.z=v.data.z);do y+=a[v.data.index];while(v=v.next)}m.value=y}function p(m,y,v,A,_){if(!m.value)return!0;var x=[v,A,_][e-1],E=m.x-t.x,w=e>1?m.y-t.y:0,I=e>2?m.z-t.z:0,T=x-y,M=E*E+w*w+I*I;if(T*T/c1&&w===0&&(w=Us(i),M+=w*w),e>2&&I===0&&(I=Us(i),M+=I*I),M1&&(t.vy+=w*m.value*r/M),e>2&&(t.vz+=I*m.value*r/M)),!0;if(m.length||M>=l)return;(m.data!==t||m.next)&&(E===0&&(E=Us(i),M+=E*E),e>1&&w===0&&(w=Us(i),M+=w*w),e>2&&I===0&&(I=Us(i),M+=I*I),M1&&(t.vy+=w*T),e>2&&(t.vz+=I*T));while(m=m.next)}return u.initialize=function(m,...y){n=m,i=y.find(v=>typeof v=="function")||Math.random,e=y.find(v=>[1,2,3].includes(v))||2,h()},u.strength=function(m){return arguments.length?(s=typeof m=="function"?m:Zn(+m),h(),u):s},u.distanceMin=function(m){return arguments.length?(o=m*m,u):Math.sqrt(o)},u.distanceMax=function(m){return arguments.length?(l=m*m,u):Math.sqrt(l)},u.theta=function(m){return arguments.length?(c=m*m,u):Math.sqrt(c)},u}function WQ(n,e,t,i){var r,s,a=Zn(.1),o,l;typeof n!="function"&&(n=Zn(+n)),e==null&&(e=0),t==null&&(t=0),i==null&&(i=0);function c(h){for(var f=0,p=r.length;f1&&(m.vy+=v*x),s>2&&(m.vz+=A*x)}}function u(){if(r){var h,f=r.length;for(o=new Array(f),l=new Array(f),h=0;h[1,2,3].includes(p))||2,u()},c.strength=function(h){return arguments.length?(a=typeof h=="function"?h:Zn(+h),u(),c):a},c.radius=function(h){return arguments.length?(n=typeof h=="function"?h:Zn(+h),u(),c):n},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?(i=+h,c):i},c}function Bb(n){var e=Zn(.1),t,i,r;typeof n!="function"&&(n=Zn(n==null?0:+n));function s(o){for(var l=0,c=t.length,u;l=0;)e+=t[i].value;n.value=e}function XQ(){return this.eachAfter(qQ)}function jQ(n,e){let t=-1;for(const i of this)n.call(e,i,++t,this);return this}function KQ(n,e){for(var t=this,i=[t],r,s,a=-1;t=i.pop();)if(n.call(e,t,++a,this),r=t.children)for(s=r.length-1;s>=0;--s)i.push(r[s]);return this}function $Q(n,e){for(var t=this,i=[t],r=[],s,a,o,l=-1;t=i.pop();)if(r.push(t),s=t.children)for(a=0,o=s.length;a=0;)t+=i[r].value;e.value=t})}function eH(n){return this.eachBefore(function(e){e.children&&e.children.sort(n)})}function tH(n){for(var e=this,t=nH(e,n),i=[e];e!==t;)e=e.parent,i.push(e);for(var r=i.length;n!==t;)i.splice(r,0,n),n=n.parent;return i}function nH(n,e){if(n===e)return n;var t=n.ancestors(),i=e.ancestors(),r=null;for(n=t.pop(),e=i.pop();n===e;)r=n,n=t.pop(),e=i.pop();return r}function iH(){for(var n=this,e=[n];n=n.parent;)e.push(n);return e}function rH(){return Array.from(this)}function sH(){var n=[];return this.eachBefore(function(e){e.children||n.push(e)}),n}function aH(){var n=this,e=[];return n.each(function(t){t!==n&&e.push({source:t.parent,target:t})}),e}function*oH(){var n=this,e,t=[n],i,r,s;do for(e=t.reverse(),t=[];n=e.pop();)if(yield n,i=n.children)for(r=0,s=i.length;r=0;--o)r.push(s=a[o]=new Xh(a[o])),s.parent=i,s.depth=i.depth+1;return t.eachBefore(Pb)}function lH(){return l1(this).eachBefore(hH)}function cH(n){return n.children}function uH(n){return Array.isArray(n)?n[1]:null}function hH(n){n.data.value!==void 0&&(n.value=n.data.value),n.data=n.data.data}function Pb(n){var e=0;do n.height=e;while((n=n.parent)&&n.height<++e)}function Xh(n){this.data=n,this.depth=this.height=0,this.parent=null}Xh.prototype=l1.prototype={constructor:Xh,count:XQ,each:jQ,eachAfter:$Q,eachBefore:KQ,find:JQ,sum:ZQ,sort:eH,path:tH,ancestors:iH,descendants:rH,leaves:sH,links:aH,copy:lH,[Symbol.iterator]:oH};function Ov(n){return n==null?null:Lb(n)}function Lb(n){if(typeof n!="function")throw new Error;return n}function ad(){return 0}function od(n){return function(){return n}}function fH(n){n.x0=Math.round(n.x0),n.y0=Math.round(n.y0),n.x1=Math.round(n.x1),n.y1=Math.round(n.y1)}function dH(n,e,t,i,r){for(var s=n.children,a,o=-1,l=s.length,c=n.value&&(i-e)/n.value;++ovH(t(E,w,r))),_=A.map(u7),x=new Set(A).add("");for(const E of _)x.has(E)||(x.add(E),A.push(E),_.push(u7(E)),s.push(Fv));a=(E,w)=>A[w],o=(E,w)=>_[w]}for(u=0,l=s.length;u=0&&(p=s[A],p.data===Fv);--A)p.data=null}if(h.parent=pH,h.eachBefore(function(A){A.depth=A.parent.depth+1,--l}).eachBefore(Pb),h.parent=null,l>0)throw new Error("cycle");return h}return i.id=function(r){return arguments.length?(n=Ov(r),i):n},i.parentId=function(r){return arguments.length?(e=Ov(r),i):e},i.path=function(r){return arguments.length?(t=Ov(r),i):t},i}function vH(n){n=`${n}`;let e=n.length;return _y(n,e-1)&&!_y(n,e-2)&&(n=n.slice(0,-1)),n[0]==="/"?n:`/${n}`}function u7(n){let e=n.length;if(e<2)return"";for(;--e>1&&!_y(n,e););return n.slice(0,e)}function _y(n,e){if(n[e]==="/"){let t=0;for(;e>0&&n[--e]==="\\";)++t;if(!(t&1))return!0}return!1}function yH(n,e){return n.parent===e.parent?1:2}function kv(n){var e=n.children;return e?e[0]:n.t}function Nv(n){var e=n.children;return e?e[e.length-1]:n.t}function xH(n,e,t){var i=t/(e.i-n.i);e.c-=i,e.s+=t,n.c+=i,e.z+=t,e.m+=t}function _H(n){for(var e=0,t=0,i=n.children,r=i.length,s;--r>=0;)s=i[r],s.z+=e,s.m+=e,e+=s.s+(t+=s.c)}function EH(n,e,t){return n.a.parent===e.parent?n.a:t}function gm(n,e){this._=n,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}gm.prototype=Object.create(Xh.prototype);function SH(n){for(var e=new gm(n,0),t,i=[e],r,s,a,o;t=i.pop();)if(s=t._.children)for(t.children=new Array(o=s.length),a=o-1;a>=0;--a)i.push(r=t.children[a]=new gm(s[a],a)),r.parent=t;return(e.parent=new gm(null,0)).children=[e],e}function wH(){var n=yH,e=1,t=1,i=null;function r(c){var u=SH(c);if(u.eachAfter(s),u.parent.m=-u.z,u.eachBefore(a),i)c.eachBefore(l);else{var h=c,f=c,p=c;c.eachBefore(function(_){_.xf.x&&(f=_),_.depth>p.depth&&(p=_)});var m=h===f?1:n(h,f)/2,y=m-h.x,v=e/(f.x+m+y),A=t/(p.depth||1);c.eachBefore(function(_){_.x=(_.x+y)*v,_.y=_.depth*A})}return c}function s(c){var u=c.children,h=c.parent.children,f=c.i?h[c.i-1]:null;if(u){_H(c);var p=(u[0].z+u[u.length-1].z)/2;f?(c.z=f.z+n(c._,f._),c.m=c.z-p):c.z=p}else f&&(c.z=f.z+n(c._,f._));c.parent.A=o(c,f,c.parent.A||h[0])}function a(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function o(c,u,h){if(u){for(var f=c,p=c,m=u,y=f.parent.children[0],v=f.m,A=p.m,_=m.m,x=y.m,E;m=Nv(m),f=kv(f),m&&f;)y=kv(y),p=Nv(p),p.a=c,E=m.z+_-f.z-v+n(m._,f._),E>0&&(xH(EH(m,c,h),c,E),v+=E,A+=E),_+=m.m,v+=f.m,x+=y.m,A+=p.m;m&&!Nv(p)&&(p.t=m,p.m+=_-A),f&&!kv(y)&&(y.t=f,y.m+=v-x,h=c)}return h}function l(c){c.x*=e,c.y=c.depth*t}return r.separation=function(c){return arguments.length?(n=c,r):n},r.size=function(c){return arguments.length?(i=!1,e=+c[0],t=+c[1],r):i?null:[e,t]},r.nodeSize=function(c){return arguments.length?(i=!0,e=+c[0],t=+c[1],r):i?[e,t]:null},r}function CH(n,e,t,i,r){for(var s=n.children,a,o=-1,l=s.length,c=n.value&&(r-t)/n.value;++o_&&(_=c),I=v*v*w,x=Math.max(_/I,I/A),x>E){v-=c;break}E=x}a.push(l={value:v,dice:p1?i:1)},t}(TH);function MH(){var n=IH,e=!1,t=1,i=1,r=[0],s=ad,a=ad,o=ad,l=ad,c=ad;function u(f){return f.x0=f.y0=0,f.x1=t,f.y1=i,f.eachBefore(h),r=[0],e&&f.eachBefore(fH),f}function h(f){var p=r[f.depth],m=f.x0+p,y=f.y0+p,v=f.x1-p,A=f.y1-p;v1&&ee.has(he))&&(U>1&&ee.add(he),ce=t[te+ld],oe=t[te+cd],ge=t[te+Mg],ue=ce-re,fe=oe-ye,Pe=Math.sqrt(ue*ue+fe*fe),pe=Pe0?(A[te]+=ue/Pe*(1+W),_[te]+=fe/Pe*(1+W)):(A[te]+=T*h7(),_[te]+=M*h7())));for(l=0,c=0;l"u"?e:a};typeof e=="function"&&(i=e);var r=function(a){return i(a[n])},s=function(){return i(void 0)};return typeof n=="string"?(t.fromAttributes=r,t.fromGraph=function(a,o){return r(a.getNodeAttributes(o))},t.fromEntry=function(a,o){return r(o)}):typeof n=="function"?(t.fromAttributes=function(){throw new Error("graphology-utils/getters/createNodeValueGetter: irrelevant usage.")},t.fromGraph=function(a,o){return i(n(o,a.getNodeAttributes(o)))},t.fromEntry=function(a,o){return i(n(a,o))}):(t.fromAttributes=s,t.fromGraph=s,t.fromEntry=s),t}function Gb(n,e){var t={},i=function(a){return typeof a>"u"?e:a};typeof e=="function"&&(i=e);var r=function(a){return i(a[n])},s=function(){return i(void 0)};return typeof n=="string"?(t.fromAttributes=r,t.fromGraph=function(a,o){return r(a.getEdgeAttributes(o))},t.fromEntry=function(a,o){return r(o)},t.fromPartialEntry=t.fromEntry,t.fromMinimalEntry=t.fromEntry):typeof n=="function"?(t.fromAttributes=function(){throw new Error("graphology-utils/getters/createEdgeValueGetter: irrelevant usage.")},t.fromGraph=function(a,o){var l=a.extremities(o);return i(n(o,a.getEdgeAttributes(o),l[0],l[1],a.getNodeAttributes(l[0]),a.getNodeAttributes(l[1]),a.isUndirected(o)))},t.fromEntry=function(a,o,l,c,u,h,f){return i(n(a,o,l,c,u,h,f))},t.fromPartialEntry=function(a,o,l,c){return i(n(a,o,l,c))},t.fromMinimalEntry=function(a,o){return i(n(a,o))}):(t.fromAttributes=s,t.fromGraph=s,t.fromEntry=s,t.fromMinimalEntry=s),t}df.createNodeValueGetter=YH;df.createEdgeValueGetter=Gb;df.createEdgeWeightGetter=function(n){return Gb(n,WH)};var Si=0,Xn=1,gn=2,mn=3,Io=4,Mo=5,vn=6,f7=7,Bg=8,d7=9,qH=0,XH=1,jH=2,Qi=0,Ms=1,_r=2,bc=3,ml=4,ri=5,Nr=6,Da=7,Pa=8,p7=3,ta=10,KH=3,lr=9,Gv=10,$H=function(e,t,i){var r,s,a,o,l,c,u,h,f,p,m=t.length,y=i.length,v=e.adjustSizes,A=e.barnesHutTheta*e.barnesHutTheta,_,x,E,w,I,T,M,b=[];for(a=0;aY?(U-=(q-Y)/2,O=U+q):(B-=(Y-q)/2,L=B+Y),b[0+Qi]=-1,b[0+Ms]=(B+L)/2,b[0+_r]=(U+O)/2,b[0+bc]=Math.max(L-B,O-U),b[0+ml]=-1,b[0+ri]=-1,b[0+Nr]=0,b[0+Da]=0,b[0+Pa]=0,r=1,a=0;a=0){t[a+Si]=0)if(T=Math.pow(t[a+Si]-b[s+Da],2)+Math.pow(t[a+Xn]-b[s+Pa],2),p=b[s+bc],4*p*p/T0?(M=x*t[a+vn]*b[s+Nr]/T,t[a+gn]+=E*M,t[a+mn]+=w*M):T<0&&(M=-x*t[a+vn]*b[s+Nr]/Math.sqrt(T),t[a+gn]+=E*M,t[a+mn]+=w*M):T>0&&(M=x*t[a+vn]*b[s+Nr]/T,t[a+gn]+=E*M,t[a+mn]+=w*M),s=b[s+ml],s<0)break;continue}else{s=b[s+ri];continue}else{if(c=b[s+Qi],c>=0&&c!==a&&(E=t[a+Si]-t[c+Si],w=t[a+Xn]-t[c+Xn],T=E*E+w*w,v===!0?T>0?(M=x*t[a+vn]*t[c+vn]/T,t[a+gn]+=E*M,t[a+mn]+=w*M):T<0&&(M=-x*t[a+vn]*t[c+vn]/Math.sqrt(T),t[a+gn]+=E*M,t[a+mn]+=w*M):T>0&&(M=x*t[a+vn]*t[c+vn]/T,t[a+gn]+=E*M,t[a+mn]+=w*M)),s=b[s+ml],s<0)break;continue}else for(x=e.scalingRatio,o=0;o0?(M=x*t[o+vn]*t[l+vn]/T/T,t[o+gn]+=E*M,t[o+mn]+=w*M,t[l+gn]-=E*M,t[l+mn]-=w*M):T<0&&(M=100*x*t[o+vn]*t[l+vn],t[o+gn]+=E*M,t[o+mn]+=w*M,t[l+gn]-=E*M,t[l+mn]-=w*M)):(T=Math.sqrt(E*E+w*w),T>0&&(M=x*t[o+vn]*t[l+vn]/T/T,t[o+gn]+=E*M,t[o+mn]+=w*M,t[l+gn]-=E*M,t[l+mn]-=w*M));for(f=e.gravity/e.scalingRatio,x=e.scalingRatio,a=0;a0&&(M=x*t[a+vn]*f):T>0&&(M=x*t[a+vn]*f/T),t[a+gn]-=E*M,t[a+mn]-=w*M;for(x=1*(e.outboundAttractionDistribution?_:1),u=0;u0&&(M=-x*I*Math.log(1+T)/T/t[o+vn]):T>0&&(M=-x*I*Math.log(1+T)/T):e.outboundAttractionDistribution?T>0&&(M=-x*I/t[o+vn]):T>0&&(M=-x*I)):(T=Math.sqrt(Math.pow(E,2)+Math.pow(w,2)),e.linLogMode?e.outboundAttractionDistribution?T>0&&(M=-x*I*Math.log(1+T)/T/t[o+vn]):T>0&&(M=-x*I*Math.log(1+T)/T):e.outboundAttractionDistribution?(T=1,M=-x*I/t[o+vn]):(T=1,M=-x*I)),T>0&&(t[o+gn]+=E*M,t[o+mn]+=w*M,t[l+gn]-=E*M,t[l+mn]-=w*M);var H,V,D,k,Z,j;if(v===!0)for(a=0;aGv&&(t[a+gn]=t[a+gn]*Gv/H,t[a+mn]=t[a+mn]*Gv/H),V=t[a+vn]*Math.sqrt((t[a+Io]-t[a+gn])*(t[a+Io]-t[a+gn])+(t[a+Mo]-t[a+mn])*(t[a+Mo]-t[a+mn])),D=Math.sqrt((t[a+Io]+t[a+gn])*(t[a+Io]+t[a+gn])+(t[a+Mo]+t[a+mn])*(t[a+Mo]+t[a+mn]))/2,k=.1*Math.log(1+D)/(1+Math.sqrt(V)),Z=t[a+Si]+t[a+gn]*(k/e.slowDown),t[a+Si]=Z,j=t[a+Xn]+t[a+mn]*(k/e.slowDown),t[a+Xn]=j);else for(a=0;a=0)?{message:"the `scalingRatio` setting should be a number >= 0."}:"strongGravityMode"in n&&typeof n.strongGravityMode!="boolean"?{message:"the `strongGravityMode` setting should be a boolean."}:"gravity"in n&&!(typeof n.gravity=="number"&&n.gravity>=0)?{message:"the `gravity` setting should be a number >= 0."}:"slowDown"in n&&!(typeof n.slowDown=="number"||n.slowDown>=0)?{message:"the `slowDown` setting should be a number >= 0."}:"barnesHutOptimize"in n&&typeof n.barnesHutOptimize!="boolean"?{message:"the `barnesHutOptimize` setting should be a boolean."}:"barnesHutTheta"in n&&!(typeof n.barnesHutTheta=="number"&&n.barnesHutTheta>=0)?{message:"the `barnesHutTheta` setting should be a number >= 0."}:null};$l.graphToByteArrays=function(n,e){var t=n.order,i=n.size,r={},s,a=new Float32Array(t*zp),o=new Float32Array(i*g7);return s=0,n.forEachNode(function(l,c){r[l]=s,a[s]=c.x,a[s+1]=c.y,a[s+2]=0,a[s+3]=0,a[s+4]=0,a[s+5]=0,a[s+6]=1,a[s+7]=1,a[s+8]=c.size||1,a[s+9]=c.fixed?1:0,s+=zp}),s=0,n.forEachEdge(function(l,c,u,h,f,p,m){var y=r[u],v=r[h],A=e(l,c,u,h,f,p,m);a[y+6]+=A,a[v+6]+=A,o[s]=y,o[s+1]=v,o[s+2]=A,s+=g7}),{nodes:a,edges:o}};$l.assignLayoutChanges=function(n,e,t){var i=0;n.updateEachNodeAttributes(function(r,s){return s.x=e[i],s.y=e[i+1],i+=zp,t?t(r,s):s})};$l.readGraphPositions=function(n,e){var t=0;n.forEachNode(function(i,r){e[t]=r.x,e[t+1]=r.y,t+=zp})};$l.collectLayoutChanges=function(n,e,t){for(var i=n.nodes(),r={},s=0,a=0,o=e.length;s2e3,strongGravityMode:!0,gravity:.05,scalingRatio:10,slowDown:1+Math.log(e)}}var p4=zb.bind(null,!1);p4.assign=zb.bind(null,!0);p4.inferSettings=iV;var rV=p4;const sV=ps(rV);var aV=d4,oV=Kl,lV={dimensions:["x","y"],center:.5,rng:Math.random,scale:1};function Qb(n,e,t){if(!oV(e))throw new Error("graphology-layout/random: the given graph is not a valid graphology instance.");t=aV(t,lV);var i=t.dimensions;if(!Array.isArray(i)||i.length<1)throw new Error("graphology-layout/random: given dimensions are invalid.");var r=i.length,s=t.center,a=t.rng,o=t.scale,l=(s-.5)*o;function c(h){for(var f=0;f 4294967295 is not supported.")},n.getSignedPointerArray=function(l){var c=l-1;return c<=r?Int8Array:c<=s?Int16Array:c<=a?Int32Array:Float64Array},n.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 o={Uint8Array:1,Int8Array:2,Uint16Array:3,Int16Array:4,Uint32Array:5,Int32Array:6,Float32Array:7,Float64Array:8};n.getMinimalRepresentation=function(l,c){var u=null,h=0,f,p,m,y,v;for(y=0,v=l.length;yh&&(h=f,u=p);return u},n.isTypedArray=function(l){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView(l)},n.concat=function(){var l=0,c,u,h;for(c=0,h=arguments.length;ce?1:n>=e?0:NaN}function EV(n,e){return n==null||e==null?NaN:en?1:e>=n?0:NaN}function Xb(n){let e,t,i;n.length!==2?(e=mm,t=(o,l)=>mm(n(o),l),i=(o,l)=>n(o)-l):(e=n===mm||n===EV?n:SV,t=n,i=n);function r(o,l,c=0,u=o.length){if(c>>1;t(o[h],l)<0?c=h+1:u=h}while(c>>1;t(o[h],l)<=0?c=h+1:u=h}while(cc&&i(o[h-1],l)>-i(o[h],l)?h-1:h}return{left:r,center:a,right:s}}function SV(){return 0}function wV(n){return n===null?NaN:+n}const CV=Xb(mm),TV=CV.right;Xb(wV).center;const bV=TV,IV=Math.sqrt(50),MV=Math.sqrt(10),RV=Math.sqrt(2);function Nm(n,e,t){const i=(e-n)/Math.max(0,t),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),a=s>=IV?10:s>=MV?5:s>=RV?2:1;let o,l,c;return r<0?(c=Math.pow(10,-r)/a,o=Math.round(n*c),l=Math.round(e*c),o/ce&&--l,c=-c):(c=Math.pow(10,r)*a,o=Math.round(n/c),l=Math.round(e/c),o*ce&&--l),l0))return[];if(n===e)return[n];const i=e=r))return[];const o=s-r+1,l=new Array(o);if(i)if(a<0)for(let c=0;c>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):t===8?Dg(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):t===4?Dg(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=UV.exec(n))?new Hr(e[1],e[2],e[3],1):(e=OV.exec(n))?new Hr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=FV.exec(n))?Dg(e[1],e[2],e[3],e[4]):(e=kV.exec(n))?Dg(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=NV.exec(n))?E7(e[1],e[2]/100,e[3]/100,1):(e=GV.exec(n))?E7(e[1],e[2]/100,e[3]/100,e[4]):m7.hasOwnProperty(n)?y7(m7[n]):n==="transparent"?new Hr(NaN,NaN,NaN,0):null}function y7(n){return new Hr(n>>16&255,n>>8&255,n&255,1)}function Dg(n,e,t,i){return i<=0&&(n=e=t=NaN),new Hr(n,e,t,i)}function HV(n){return n instanceof v0||(n=Vp(n)),n?(n=n.rgb(),new Hr(n.r,n.g,n.b,n.opacity)):new Hr}function Sy(n,e,t,i){return arguments.length===1?HV(n):new Hr(n,e,t,i??1)}function Hr(n,e,t,i){this.r=+n,this.g=+e,this.b=+t,this.opacity=+i}A4(Hr,Sy,jb(v0,{brighter(n){return n=n==null?Gm:Math.pow(Gm,n),new Hr(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?Qp:Math.pow(Qp,n),new Hr(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Hr(Jc(this.r),Jc(this.g),Jc(this.b),zm(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:x7,formatHex:x7,formatHex8:VV,formatRgb:_7,toString:_7}));function x7(){return`#${qc(this.r)}${qc(this.g)}${qc(this.b)}`}function VV(){return`#${qc(this.r)}${qc(this.g)}${qc(this.b)}${qc((isNaN(this.opacity)?1:this.opacity)*255)}`}function _7(){const n=zm(this.opacity);return`${n===1?"rgb(":"rgba("}${Jc(this.r)}, ${Jc(this.g)}, ${Jc(this.b)}${n===1?")":`, ${n})`}`}function zm(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function Jc(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function qc(n){return n=Jc(n),(n<16?"0":"")+n.toString(16)}function E7(n,e,t,i){return i<=0?n=e=t=NaN:t<=0||t>=1?n=e=NaN:e<=0&&(n=NaN),new la(n,e,t,i)}function Kb(n){if(n instanceof la)return new la(n.h,n.s,n.l,n.opacity);if(n instanceof v0||(n=Vp(n)),!n)return new la;if(n instanceof la)return n;n=n.rgb();var e=n.r/255,t=n.g/255,i=n.b/255,r=Math.min(e,t,i),s=Math.max(e,t,i),a=NaN,o=s-r,l=(s+r)/2;return o?(e===s?a=(t-i)/o+(t0&&l<1?0:a,new la(a,o,l,n.opacity)}function WV(n,e,t,i){return arguments.length===1?Kb(n):new la(n,e,t,i??1)}function la(n,e,t,i){this.h=+n,this.s=+e,this.l=+t,this.opacity=+i}A4(la,WV,jb(v0,{brighter(n){return n=n==null?Gm:Math.pow(Gm,n),new la(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?Qp:Math.pow(Qp,n),new la(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,e=isNaN(n)||isNaN(this.s)?0:this.s,t=this.l,i=t+(t<.5?t:1-t)*e,r=2*t-i;return new Hr(zv(n>=240?n-240:n+120,r,i),zv(n,r,i),zv(n<120?n+240:n-120,r,i),this.opacity)},clamp(){return new la(S7(this.h),Pg(this.s),Pg(this.l),zm(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 n=zm(this.opacity);return`${n===1?"hsl(":"hsla("}${S7(this.h)}, ${Pg(this.s)*100}%, ${Pg(this.l)*100}%${n===1?")":`, ${n})`}`}}));function S7(n){return n=(n||0)%360,n<0?n+360:n}function Pg(n){return Math.max(0,Math.min(1,n||0))}function zv(n,e,t){return(n<60?e+(t-e)*n/60:n<180?t:n<240?e+(t-e)*(240-n)/60:e)*255}const v4=n=>()=>n;function YV(n,e){return function(t){return n+t*e}}function qV(n,e,t){return n=Math.pow(n,t),e=Math.pow(e,t)-n,t=1/t,function(i){return Math.pow(n+i*e,t)}}function XV(n){return(n=+n)==1?$b:function(e,t){return t-e?qV(e,t,n):v4(isNaN(e)?t:e)}}function $b(n,e){var t=e-n;return t?YV(n,t):v4(isNaN(n)?e:n)}const w7=function n(e){var t=XV(e);function i(r,s){var a=t((r=Sy(r)).r,(s=Sy(s)).r),o=t(r.g,s.g),l=t(r.b,s.b),c=$b(r.opacity,s.opacity);return function(u){return r.r=a(u),r.g=o(u),r.b=l(u),r.opacity=c(u),r+""}}return i.gamma=n,i}(1);function jV(n,e){e||(e=[]);var t=n?Math.min(e.length,n.length):0,i=e.slice(),r;return function(s){for(r=0;rt&&(s=e.slice(t,s),o[a]?o[a]+=s:o[++a]=s),(i=i[0])===(r=r[0])?o[a]?o[a]+=r:o[++a]=r:(o[++a]=null,l.push({i:a,x:Qm(i,r)})),t=Qv.lastIndex;return te&&(t=n,n=e,e=t),function(i){return Math.max(n,Math.min(e,i))}}function oW(n,e,t){var i=n[0],r=n[1],s=e[0],a=e[1];return r2?lW:oW,l=c=null,h}function h(f){return f==null||isNaN(f=+f)?s:(l||(l=o(n.map(i),e,t)))(i(a(f)))}return h.invert=function(f){return a(r((c||(c=o(e,n.map(i),Qm)))(f)))},h.domain=function(f){return arguments.length?(n=Array.from(f,sW),u()):n.slice()},h.range=function(f){return arguments.length?(e=Array.from(f),u()):e.slice()},h.rangeRound=function(f){return e=Array.from(f),t=iW,u()},h.clamp=function(f){return arguments.length?(a=f?!0:Rh,u()):a!==Rh},h.interpolate=function(f){return arguments.length?(t=f,u()):t},h.unknown=function(f){return arguments.length?(s=f,h):s},function(f,p){return i=f,r=p,u()}}function hW(){return uW()(Rh,Rh)}function fW(n){return Math.abs(n=Math.round(n))>=1e21?n.toLocaleString("en").replace(/,/g,""):n.toString(10)}function Hm(n,e){if((t=(n=e?n.toExponential(e-1):n.toExponential()).indexOf("e"))<0)return null;var t,i=n.slice(0,t);return[i.length>1?i[0]+i.slice(2):i,+n.slice(t+1)]}function jh(n){return n=Hm(Math.abs(n)),n?n[1]:NaN}function dW(n,e){return function(t,i){for(var r=t.length,s=[],a=0,o=n[0],l=0;r>0&&o>0&&(l+o+1>i&&(o=Math.max(1,i-l)),s.push(t.substring(r-=o,r+o)),!((l+=o+1)>i));)o=n[a=(a+1)%n.length];return s.reverse().join(e)}}function pW(n){return function(e){return e.replace(/[0-9]/g,function(t){return n[+t]})}}var gW=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Vm(n){if(!(e=gW.exec(n)))throw new Error("invalid format: "+n);var e;return new x4({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]})}Vm.prototype=x4.prototype;function x4(n){this.fill=n.fill===void 0?" ":n.fill+"",this.align=n.align===void 0?">":n.align+"",this.sign=n.sign===void 0?"-":n.sign+"",this.symbol=n.symbol===void 0?"":n.symbol+"",this.zero=!!n.zero,this.width=n.width===void 0?void 0:+n.width,this.comma=!!n.comma,this.precision=n.precision===void 0?void 0:+n.precision,this.trim=!!n.trim,this.type=n.type===void 0?"":n.type+""}x4.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 mW(n){e:for(var e=n.length,t=1,i=-1,r;t0&&(i=0);break}return i>0?n.slice(0,i)+n.slice(r+1):n}var Jb;function AW(n,e){var t=Hm(n,e);if(!t)return n+"";var i=t[0],r=t[1],s=r-(Jb=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,a=i.length;return s===a?i:s>a?i+new Array(s-a+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+Hm(n,Math.max(0,e+s-1))[0]}function T7(n,e){var t=Hm(n,e);if(!t)return n+"";var i=t[0],r=t[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const b7={"%":(n,e)=>(n*100).toFixed(e),b:n=>Math.round(n).toString(2),c:n=>n+"",d:fW,e:(n,e)=>n.toExponential(e),f:(n,e)=>n.toFixed(e),g:(n,e)=>n.toPrecision(e),o:n=>Math.round(n).toString(8),p:(n,e)=>T7(n*100,e),r:T7,s:AW,X:n=>Math.round(n).toString(16).toUpperCase(),x:n=>Math.round(n).toString(16)};function I7(n){return n}var M7=Array.prototype.map,R7=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function vW(n){var e=n.grouping===void 0||n.thousands===void 0?I7:dW(M7.call(n.grouping,Number),n.thousands+""),t=n.currency===void 0?"":n.currency[0]+"",i=n.currency===void 0?"":n.currency[1]+"",r=n.decimal===void 0?".":n.decimal+"",s=n.numerals===void 0?I7:pW(M7.call(n.numerals,String)),a=n.percent===void 0?"%":n.percent+"",o=n.minus===void 0?"−":n.minus+"",l=n.nan===void 0?"NaN":n.nan+"";function c(h){h=Vm(h);var f=h.fill,p=h.align,m=h.sign,y=h.symbol,v=h.zero,A=h.width,_=h.comma,x=h.precision,E=h.trim,w=h.type;w==="n"?(_=!0,w="g"):b7[w]||(x===void 0&&(x=12),E=!0,w="g"),(v||f==="0"&&p==="=")&&(v=!0,f="0",p="=");var I=y==="$"?t:y==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():"",T=y==="$"?i:/[%p]/.test(w)?a:"",M=b7[w],b=/[defgprs%]/.test(w);x=x===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function B(L){var U=I,O=T,Q,G,F;if(w==="c")O=M(L)+O,L="";else{L=+L;var q=L<0||1/L<0;if(L=isNaN(L)?l:M(Math.abs(L),x),E&&(L=mW(L)),q&&+L==0&&m!=="+"&&(q=!1),U=(q?m==="("?m:o:m==="-"||m==="("?"":m)+U,O=(w==="s"?R7[8+Jb/3]:"")+O+(q&&m==="("?")":""),b){for(Q=-1,G=L.length;++QF||F>57){O=(F===46?r+L.slice(Q+1):L.slice(Q))+O,L=L.slice(0,Q);break}}}_&&!v&&(L=e(L,1/0));var Y=U.length+L.length+O.length,H=Y>1)+U+L+O+H.slice(Y);break;default:L=H+U+L+O;break}return s(L)}return B.toString=function(){return h+""},B}function u(h,f){var p=c((h=Vm(h),h.type="f",h)),m=Math.max(-8,Math.min(8,Math.floor(jh(f)/3)))*3,y=Math.pow(10,-m),v=R7[8+m/3];return function(A){return p(y*A)+v}}return{format:c,formatPrefix:u}}var Lg,Zb,eI;yW({thousands:",",grouping:[3],currency:["$",""]});function yW(n){return Lg=vW(n),Zb=Lg.format,eI=Lg.formatPrefix,Lg}function xW(n){return Math.max(0,-jh(Math.abs(n)))}function _W(n,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(jh(e)/3)))*3-jh(Math.abs(n)))}function EW(n,e){return n=Math.abs(n),e=Math.abs(e)-n,Math.max(0,jh(e)-jh(n))+1}function SW(n,e,t,i){var r=DV(n,e,t),s;switch(i=Vm(i??",f"),i.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(e));return i.precision==null&&!isNaN(s=_W(r,a))&&(i.precision=s),eI(i,a)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=EW(r,Math.max(Math.abs(n),Math.abs(e))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=xW(r))&&(i.precision=s-(i.type==="%")*2);break}}return Zb(i)}function wW(n){var e=n.domain;return n.ticks=function(t){var i=e();return BV(i[0],i[i.length-1],t??10)},n.tickFormat=function(t,i){var r=e();return SW(r[0],r[r.length-1],t??10,i)},n.nice=function(t){t==null&&(t=10);var i=e(),r=0,s=i.length-1,a=i[r],o=i[s],l,c,u=10;for(o0;){if(c=Ey(a,o,t),c===l)return i[r]=a,i[s]=o,e(i);if(c>0)a=Math.floor(a/c)*c,o=Math.ceil(o/c)*c;else if(c<0)a=Math.ceil(a*c)/c,o=Math.floor(o*c)/c;else break;l=c}return n},n}function tI(){var n=hW();return n.copy=function(){return cW(n,tI())},PV.apply(n,arguments),wW(n)}const B7=n=>{let e;const t=new Set,i=(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(f=>f(e,h))}},r=()=>e,o={setState:i,getState:r,subscribe:l=>(t.add(l),()=>t.delete(l)),destroy:()=>{t.clear()}};return e=n(i,r,o),o},CW=n=>n?B7(n):B7;var nI={exports:{}},iI={},rI={exports:{}},sI={};/** + * @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 Kh=$;function TW(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var bW=typeof Object.is=="function"?Object.is:TW,IW=Kh.useState,MW=Kh.useEffect,RW=Kh.useLayoutEffect,BW=Kh.useDebugValue;function DW(n,e){var t=e(),i=IW({inst:{value:t,getSnapshot:e}}),r=i[0].inst,s=i[1];return RW(function(){r.value=t,r.getSnapshot=e,Hv(r)&&s({inst:r})},[n,t,e]),MW(function(){return Hv(r)&&s({inst:r}),n(function(){Hv(r)&&s({inst:r})})},[n]),BW(t),t}function Hv(n){var e=n.getSnapshot;n=n.value;try{var t=e();return!bW(n,t)}catch{return!0}}function PW(n,e){return e()}var LW=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?PW:DW;sI.useSyncExternalStore=Kh.useSyncExternalStore!==void 0?Kh.useSyncExternalStore:LW;rI.exports=sI;var UW=rI.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 c1=$,OW=UW;function FW(n,e){return n===e&&(n!==0||1/n===1/e)||n!==n&&e!==e}var kW=typeof Object.is=="function"?Object.is:FW,NW=OW.useSyncExternalStore,GW=c1.useRef,zW=c1.useEffect,QW=c1.useMemo,HW=c1.useDebugValue;iI.useSyncExternalStoreWithSelector=function(n,e,t,i,r){var s=GW(null);if(s.current===null){var a={hasValue:!1,value:null};s.current=a}else a=s.current;s=QW(function(){function l(p){if(!c){if(c=!0,u=p,p=i(p),r!==void 0&&a.hasValue){var m=a.value;if(r(m,p))return h=m}return h=p}if(m=h,kW(u,p))return m;var y=i(p);return r!==void 0&&r(m,y)?m:(u=p,h=y)}var c=!1,u,h,f=t===void 0?null:t;return[function(){return l(e())},f===null?void 0:function(){return l(f())}]},[e,t,i,r]);var o=NW(n,s[0],s[1]);return zW(function(){a.hasValue=!0,a.value=o},[o]),HW(o),o};nI.exports=iI;var VW=nI.exports;const WW=ps(VW),{useSyncExternalStoreWithSelector:YW}=WW;function aI(n,e=n.getState,t){const i=YW(n.subscribe,n.getState,n.getServerState||n.getState,e,t);return $.useDebugValue(i),i}const D7=n=>{const e=typeof n=="function"?CW(n):n,t=(i,r)=>aI(e,i,r);return Object.assign(t,e),t},qW=n=>n?D7(n):D7;function XW(){const n=$.createContext(void 0);return{Provider:({createStore:r,children:s})=>{const a=$.useRef();return a.current||(a.current=r()),$.createElement(n.Provider,{value:a.current},s)},useStore:(r,s)=>{const a=$.useContext(n);if(!a)throw new Error("Seems like you have not used zustand provider as an ancestor.");return aI(a,r,s)},useStoreApi:()=>{const r=$.useContext(n);if(!r)throw new Error("Seems like you have not used zustand provider as an ancestor.");return $.useMemo(()=>({...r}),[r])}}}function Wm(n,e){return n.map(function(t,i){return t+e[i]})}function u1(n,e){return n.map(function(t,i){return t-e[i]})}function Wp(n){return Math.hypot.apply(Math,n)}function oI(n,e){e===void 0&&(e=n);var t=Wp(e),i=t===0?0:1/t,r=e.map(function(a){return i*a}),s=Wp(n);return{distance:s,direction:r}}function lI(n,e,t){var i=Wp(e),r=i===0?0:1/i,s=t===0?0:1/t,a=s*i,o=e.map(function(u){return s*u}),l=e.map(function(u){return r*u}),c=Wp(n);return{velocities:o,velocity:a,distance:c,direction:l}}function Ym(n){return Math.sign?Math.sign(n):+(n>0)-+(n<0)||+n}function jW(n,e,t){return Math.max(e,Math.min(n,t))}function KW(n,e){return Math.pow(n,e*5)}function P7(n,e,t){return e===0||Math.abs(e)===1/0?KW(n,t):n*e*t/(e+t*n)}function L7(n,e,t,i){return i===void 0&&(i=.15),i===0?jW(n,e,t):nt?+P7(n-t,t-e,i)+t:n}function U7(n,e){for(var t=0;t=0)&&(t[r]=n[r]);return t}function An(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function ZW(n,e){if(n){if(typeof n=="string")return O7(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return O7(n,e)}}function O7(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,i=new Array(e);t"u"||n[Symbol.iterator]==null){if(Array.isArray(n)||(t=ZW(n))||e&&n&&typeof n.length=="number"){t&&(n=t);var i=0;return function(){return i>=n.length?{done:!0}:{done:!1,value:n[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}return t=n[Symbol.iterator](),t.next.bind(t)}function cI(){}function uI(){for(var n=arguments.length,e=new Array(n),t=0;t1?e-1:0),i=1;i2?l-2:0),u=2;u0||l>0,u=$t({},r.controller.state.shared,r.state,r.mapStateValues(r.state),{locked:!!document.pointerLockElement,touches:l,down:c}),h=r.handler(u);return r.state.memo=h!==void 0?h:r.state.memo,u},this.controller=t,this.args=i}var e=n.prototype;return e.updateSharedState=function(i){Object.assign(this.controller.state.shared,i)},e.updateGestureState=function(i){Object.assign(this.state,i)},e.checkIntentionality=function(i,r){return{_intentional:i,_blocked:!1}},e.getMovement=function(i){var r=this.config.rubberband,s=this.state,a=s._bounds,o=s._initial,l=s._active,c=s._intentional,u=s.lastOffset,h=s.movement,f=s._threshold,p=this.getInternalMovement(i,this.state),m=c[0]===!1?Q7(p[0],f[0]):c[0],y=c[1]===!1?Q7(p[1],f[1]):c[1],v=this.checkIntentionality([m,y],p);if(v._blocked)return $t({},v,{_movement:p,delta:[0,0]});var A=v._intentional,_=p,x=[A[0]!==!1?p[0]-A[0]:0,A[1]!==!1?p[1]-A[1]:0],E=Wm(x,u),w=l?r:[0,0];return x=H7(a,Wm(x,o),w),$t({},v,{intentional:A[0]!==!1||A[1]!==!1,_initial:o,_movement:_,movement:x,values:i,offset:H7(a,E,w),delta:u1(x,h)})},e.clean=function(){this.clearTimeout()},$W(n,[{key:"config",get:function(){return this.controller.config[this.stateKey]}},{key:"enabled",get:function(){return this.controller.config.enabled&&this.config.enabled}},{key:"state",get:function(){return this.controller.state[this.stateKey]}},{key:"handler",get:function(){return this.controller.handlers[this.stateKey]}},{key:"transform",get:function(){return this.config.transform||this.controller.config.transform||mY}}]),n}();function Q7(n,e){return Math.abs(n)>=e?Ym(n)*e:!1}function H7(n,e,t){var i=e[0],r=e[1],s=t[0],a=t[1],o=n[0],l=o[0],c=o[1],u=n[1],h=u[0],f=u[1];return[L7(i,l,c,s),L7(r,h,f,a)]}function bi(n,e,t){var i=n.state,r=e.timeStamp,s=e.type,a=i.values,o=t?0:r-i.startTime;return{_lastEventType:s,event:e,timeStamp:r,elapsedTime:o,previous:a}}function Zc(n,e,t,i){var r=n.state,s=n.config,a=n.stateKey,o=n.args,l=n.transform,c=r.offset,u=t.timeStamp,h=s.initial,f=s.bounds,p=s.threshold,m=u1(l(p),l([0,0])).map(Math.abs),y=$t({},gI()[a],{_active:!0,args:o,values:e,initial:i??e,_threshold:m,offset:c,lastOffset:c,startTime:u});return $t({},y,{_initial:qm(h,y),_bounds:qm(f,y)})}var AY=function(e){var t=this;this.classes=e,this.pointerIds=new Set,this.touchIds=new Set,this.supportsTouchEvents=hI(),this.supportsGestureEvents=eY(),this.bind=function(){for(var i=arguments.length,r=new Array(i),s=0;sl?"x":o0?i.setUpDelayedDragTrigger(r):i.startDrag(r,!0))},i.onDragChange=function(r){if(!(i.state.canceled||!i.state._active||!i.isValidEvent(r)||i.state._lastEventType===r.type&&r.timeStamp===i.state.timeStamp)){var s;if(document.pointerLockElement){var a=r.movementX,o=r.movementY;s=Wm(i.transform([a,o]),i.state.values)}else s=Bh(r,i.transform);var l=i.getKinematics(s,r);if(!i.state._dragStarted){if(i.state._dragDelayed){i.startDrag(r);return}if(i.shouldPreventWindowScrollY)if(!i.state._dragPreventScroll&&l.axis)if(l.axis==="x")i.startDrag(r);else{i.state._active=!1;return}else return;else return}var c=Os(r);i.updateSharedState(c);var u=bi(An(i),r),h=Wp(l._movement),f=i.state._dragIsTap;f&&h>=TY&&(f=!1),i.updateGestureState($t({},u,l,{_dragIsTap:f})),i.fireGestureHandler()}},i.onDragEnd=function(r){if(vI(i.controller,r),!!i.isValidEvent(r)&&(i.clean(),!!i.state._active)){i.state._active=!1;var s=i.state._dragIsTap,a=i.state.velocities,o=a[0],l=a[1],c=i.state.movement,u=c[0],h=c[1],f=i.state._intentional,p=f[0],m=f[1],y=i.config.swipeVelocity,v=y[0],A=y[1],_=i.config.swipeDistance,x=_[0],E=_[1],w=i.config.swipeDuration,I=$t({},bi(An(i),r),i.getMovement(i.state.values)),T=[0,0];I.elapsedTimev&&Math.abs(u)>x&&(T[0]=Ym(o)),m!==!1&&Math.abs(l)>A&&Math.abs(h)>E&&(T[1]=Ym(l))),i.updateSharedState({buttons:0}),i.updateGestureState($t({},I,{tap:s,swipe:T})),i.fireGestureHandler(i.config.filterTaps&&s===!0)}},i.clean=function(){n.prototype.clean.call(An(i)),i.state._dragStarted=!1,i.releasePointerCapture(),yY(i.controller,i.stateKey)},i.onCancel=function(){i.state.canceled||(i.updateGestureState({canceled:!0,_active:!1}),i.updateSharedState({buttons:0}),setTimeout(function(){return i.fireGestureHandler()},0))},i.onClick=function(r){i.state._dragIsTap||r.stopPropagation()},i}var t=e.prototype;return t.startDrag=function(r,s){s===void 0&&(s=!1),!(!this.state._active||this.state._dragStarted)&&(s||this.setStartState(r),this.updateGestureState({_dragStarted:!0,_dragPreventScroll:!0,cancel:this.onCancel}),this.clearTimeout(),this.fireGestureHandler())},t.addBindings=function(r){if(this.config.useTouch?(jn(r,"onTouchStart",this.onDragStart),jn(r,"onTouchMove",this.onDragChange),jn(r,"onTouchEnd",this.onDragEnd),jn(r,"onTouchCancel",this.onDragEnd)):(jn(r,"onPointerDown",this.onDragStart),jn(r,"onPointerMove",this.onDragChange),jn(r,"onPointerUp",this.onDragEnd),jn(r,"onPointerCancel",this.onDragEnd)),this.config.filterTaps){var s=this.controller.config.eventOptions.capture?"onClick":"onClickCapture";jn(r,s,this.onClick)}},e}(f1),IY=function(n){Su(e,n);function e(){return n.apply(this,arguments)||this}var t=e.prototype;return t.getInternalMovement=function(r,s){var a=s.values[1],o=r[0],l=r[1],c=l===void 0?a:l,u=c-a,h=s.turns;return Math.abs(u)>270&&(h+=Ym(u)),u1([o,c-360*h],s.initial)},t.getKinematics=function(r,s){var a=this.getMovement(r),o=(r[1]-a._movement[1]-this.state.initial[1])/360,l=s.timeStamp-this.state.timeStamp,c=lI(a.movement,a.delta,l),u=JW(c,["distance","velocity"]);return $t({turns:o},a,u)},t.mapStateValues=function(r){return{da:r.values,vdva:r.velocities}},e}(mI),MY=7,RY=260,BY=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="pinching",i.stateKey="pinch",i.onPinchStart=function(r){AI(i.controller,r);var s=i.controller.touchIds;if(i.enabled&&!(i.state._active&&i.state._pointerIds.every(function(u){return s.has(u)}))&&!(s.size<2)){var a=Array.from(s).slice(0,2),o=k7(r,a,i.transform),l=o.values,c=o.origin;i.updateSharedState(Os(r)),i.updateGestureState($t({},Zc(An(i),l,r),bi(An(i),r,!0),{_pointerIds:a,cancel:i.onCancel,origin:c})),i.updateGestureState(i.getMovement(l)),i.fireGestureHandler()}},i.onPinchChange=function(r){var s=i.state,a=s.canceled,o=s._active;if(!(a||!o||r.timeStamp===i.state.timeStamp)){var l=Os(r);i.updateSharedState(l);try{var c=k7(r,i.state._pointerIds,i.transform),u=c.values,h=c.origin,f=i.getKinematics(u,r);i.updateGestureState($t({},bi(An(i),r),f,{origin:h})),i.fireGestureHandler()}catch{i.onPinchEnd(r)}}},i.onPinchEnd=function(r){vI(i.controller,r);var s=_4(r);i.state._pointerIds.every(function(a){return!s.includes(a)})||(i.clean(),i.state._active&&(i.updateGestureState($t({},bi(An(i),r),i.getMovement(i.state.values),{_active:!1})),i.fireGestureHandler()))},i.onCancel=function(){i.state.canceled||(i.updateGestureState({_active:!1,canceled:!0}),setTimeout(function(){return i.fireGestureHandler()},0))},i.onGestureStart=function(r){if(i.enabled){r.preventDefault();var s=z7(r,i.transform);i.updateSharedState(Os(r)),i.updateGestureState($t({},Zc(An(i),s,r),bi(An(i),r,!0),{origin:[r.clientX,r.clientY],cancel:i.onCancel})),i.updateGestureState(i.getMovement(s)),i.fireGestureHandler()}},i.onGestureChange=function(r){var s=i.state,a=s.canceled,o=s._active;if(!(a||!o)){r.preventDefault();var l=Os(r);i.updateSharedState(l);var c=z7(r,i.transform);c[0]=(c[0]-i.state.event.scale)*RY+i.state.values[0];var u=i.getKinematics(c,r);i.updateGestureState($t({},bi(An(i),r),u,{origin:[r.clientX,r.clientY]})),i.fireGestureHandler()}},i.onGestureEnd=function(r){i.clean(),i.state._active&&(i.updateGestureState($t({},bi(An(i),r),i.getMovement(i.state.values),{_active:!1,origin:[r.clientX,r.clientY]})),i.fireGestureHandler())},i.wheelShouldRun=function(r){return i.enabled&&r.ctrlKey},i.getWheelValuesFromEvent=function(r){var s=dI(r,i.transform),a=s[1],o=i.state.values,l=o[0],c=o[1],u=-a*MY,h=l+u,f=c!==void 0?c:0;return{values:[h,f],origin:[r.clientX,r.clientY],delta:[u,f]}},i.onWheel=function(r){i.wheelShouldRun(r)&&(i.setTimeout(i.onWheelEnd),i.state._active?i.onWheelChange(r):i.onWheelStart(r))},i.onWheelStart=function(r){var s=i.getWheelValuesFromEvent(r),a=s.values,o=s.delta,l=s.origin;r.cancelable&&r.preventDefault(),i.updateSharedState(Os(r)),i.updateGestureState($t({},Zc(An(i),a,r,i.state.values),bi(An(i),r,!0),{offset:a,delta:o,origin:l})),i.updateGestureState(i.getMovement(a)),i.fireGestureHandler()},i.onWheelChange=function(r){r.cancelable&&r.preventDefault(),i.updateSharedState(Os(r));var s=i.getWheelValuesFromEvent(r),a=s.values,o=s.origin,l=s.delta;i.updateGestureState($t({},bi(An(i),r),i.getKinematics(a,r),{origin:o,delta:l})),i.fireGestureHandler()},i.onWheelEnd=function(){i.clean(),i.state._active&&(i.state._active=!1,i.updateGestureState(i.getMovement(i.state.values)),i.fireGestureHandler())},i}var t=e.prototype;return t.addBindings=function(r){this.controller.config.domTarget&&!this.controller.supportsTouchEvents&&this.controller.supportsGestureEvents?(jn(r,"onGestureStart",this.onGestureStart),jn(r,"onGestureChange",this.onGestureChange),jn(r,"onGestureEnd",this.onGestureEnd)):(jn(r,"onTouchStart",this.onPinchStart),jn(r,"onTouchMove",this.onPinchChange),jn(r,"onTouchEnd",this.onPinchEnd),jn(r,"onTouchCancel",this.onPinchEnd),jn(r,"onWheel",this.onWheel))},e}(IY),DY=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="wheeling",i.stateKey="wheel",i.debounced=!0,i.handleEvent=function(r){if(!(r.ctrlKey&&"pinch"in i.controller.handlers)&&i.enabled){i.setTimeout(i.onEnd),i.updateSharedState(Os(r));var s=Wm(dI(r,i.transform),i.state.values);if(i.state._active)i.updateGestureState($t({},bi(An(i),r),i.getKinematics(s,r)));else{i.updateGestureState($t({},Zc(An(i),s,r,i.state.values),bi(An(i),r,!0)));var a=i.getMovement(s),o=oI(a.delta);i.updateGestureState(a),i.updateGestureState(o)}i.fireGestureHandler()}},i.onEnd=function(){if(i.clean(),!!i.state._active){var r=i.getMovement(i.state.values);i.updateGestureState(r),i.updateGestureState({_active:!1,velocities:[0,0],velocity:0}),i.fireGestureHandler()}},i}var t=e.prototype;return t.addBindings=function(r){jn(r,"onWheel",this.handleEvent)},e}(f1),W7=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="moving",i.stateKey="move",i.debounced=!0,i.onMove=function(r){i.enabled&&(i.setTimeout(i.onMoveEnd),i.state._active?i.onMoveChange(r):i.onMoveStart(r))},i.onMoveStart=function(r){i.updateSharedState(Os(r));var s=Bh(r,i.transform);i.updateGestureState($t({},Zc(An(i),s,r),bi(An(i),r,!0))),i.updateGestureState(i.getMovement(s)),i.fireGestureHandler()},i.onMoveChange=function(r){i.updateSharedState(Os(r));var s=Bh(r,i.transform);i.updateGestureState($t({},bi(An(i),r),i.getKinematics(s,r))),i.fireGestureHandler()},i.onMoveEnd=function(){if(i.clean(),!!i.state._active){var r=i.state.values;i.updateGestureState(i.getMovement(r)),i.updateGestureState({velocities:[0,0],velocity:0,_active:!1}),i.fireGestureHandler()}},i.hoverTransform=function(){return i.controller.config.hover.transform||i.controller.config.transform},i.onPointerEnter=function(r){if(i.controller.state.shared.hovering=!0,!!i.controller.config.enabled){if(i.controller.config.hover.enabled){var s=Bh(r,i.hoverTransform()),a=$t({},i.controller.state.shared,i.state,bi(An(i),r,!0),{args:i.args,values:s,active:!0,hovering:!0});i.controller.handlers.hover($t({},a,i.mapStateValues(a)))}"move"in i.controller.handlers&&i.onMoveStart(r)}},i.onPointerLeave=function(r){if(i.controller.state.shared.hovering=!1,"move"in i.controller.handlers&&i.onMoveEnd(),!!i.controller.config.hover.enabled){var s=Bh(r,i.hoverTransform()),a=$t({},i.controller.state.shared,i.state,bi(An(i),r),{args:i.args,values:s,active:!1});i.controller.handlers.hover($t({},a,i.mapStateValues(a)))}},i}var t=e.prototype;return t.addBindings=function(r){"move"in this.controller.handlers&&jn(r,"onPointerMove",this.onMove),"hover"in this.controller.handlers&&(jn(r,"onPointerEnter",this.onPointerEnter),jn(r,"onPointerLeave",this.onPointerLeave))},e}(f1),PY=function(n){Su(e,n);function e(){var i;return i=n.apply(this,arguments)||this,i.ingKey="scrolling",i.stateKey="scroll",i.debounced=!0,i.handleEvent=function(r){if(i.enabled){i.clearTimeout(),i.setTimeout(i.onEnd);var s=nY(r,i.transform);if(i.updateSharedState(Os(r)),i.state._active)i.updateGestureState($t({},bi(An(i),r),i.getKinematics(s,r)));else{i.updateGestureState($t({},Zc(An(i),s,r,i.state.values),bi(An(i),r,!0)));var a=i.getMovement(s),o=oI(a.delta);i.updateGestureState(a),i.updateGestureState(o)}i.fireGestureHandler()}},i.onEnd=function(){i.clean(),i.state._active&&(i.updateGestureState($t({},i.getMovement(i.state.values),{_active:!1,velocities:[0,0],velocity:0})),i.fireGestureHandler())},i}var t=e.prototype;return t.addBindings=function(r){jn(r,"onScroll",this.handleEvent)},e}(f1),LY=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function UY(n){var e={},t={},i=new Set;for(var r in n)LY.test(r)?(i.add(RegExp.lastMatch),t[r]=n[r]):e[r]=n[r];return[t,e,i]}function OY(n,e){e===void 0&&(e={});var t=UY(n),i=t[0],r=t[1],s=t[2];Fs.set("drag",bY),Fs.set("hover",W7),Fs.set("move",W7),Fs.set("pinch",BY),Fs.set("scroll",PY),Fs.set("wheel",DY);var a=gY(e,s),o={};return s.has("onDrag")&&(o.drag=dd(i,"onDrag")),s.has("onWheel")&&(o.wheel=dd(i,"onWheel")),s.has("onScroll")&&(o.scroll=dd(i,"onScroll")),s.has("onMove")&&(o.move=dd(i,"onMove")),s.has("onPinch")&&(o.pinch=dd(i,"onPinch")),s.has("onHover")&&(o.hover=i.onHover),SY(o,a,r)}function dd(n,e){var t=e+"Start",i=e+"End",r=function(a){var o=void 0;return a.first&&t in n&&n[t](a),e in n&&(o=n[e](a)),a.last&&i in n&&n[i](a),o};return r}var gf={};function Za(n){if(typeof n!="function")throw new Error("obliterator/iterator: expecting a function!");this.next=n}typeof Symbol<"u"&&(Za.prototype[Symbol.iterator]=function(){return this});Za.of=function(){var n=arguments,e=n.length,t=0;return new Za(function(){return t>=e?{done:!0}:{done:!1,value:n[t++]}})};Za.empty=function(){var n=new Za(function(){return{done:!0}});return n};Za.fromSequence=function(n){var e=0,t=n.length;return new Za(function(){return e>=t?{done:!0}:{done:!1,value:n[e++]}})};Za.is=function(n){return n instanceof Za?!0:typeof n=="object"&&n!==null&&typeof n.next=="function"};var d1=Za;const Hs=ps(d1);var p1={};p1.ARRAY_BUFFER_SUPPORT=typeof ArrayBuffer<"u";p1.SYMBOL_SUPPORT=typeof Symbol<"u";var EI=p1,FY=EI.ARRAY_BUFFER_SUPPORT,kY=EI.SYMBOL_SUPPORT,S4=function(e,t){var i,r,s,a,o;if(!e)throw new Error("obliterator/forEach: invalid iterable.");if(typeof t!="function")throw new Error("obliterator/forEach: expecting a callback.");if(Array.isArray(e)||FY&&ArrayBuffer.isView(e)||typeof e=="string"||e.toString()==="[object Arguments]"){for(s=0,a=e.length;s=this.items.length&&(this.items=this.items.slice(this.offset),this.offset=0),this.size--,n}};vi.prototype.peek=function(){if(this.size)return this.items[this.offset]};vi.prototype.forEach=function(n,e){e=arguments.length>1?e:this;for(var t=this.offset,i=0,r=this.items.length;t=n.length)return{done:!0};var t=n[e];return e++,{value:t,done:!1}})};vi.prototype.entries=function(){var n=this.items,e=this.offset,t=0;return new SI(function(){if(e>=n.length)return{done:!0};var i=n[e];return e++,{value:[t++,i],done:!1}})};typeof Symbol<"u"&&(vi.prototype[Symbol.iterator]=vi.prototype.values);vi.prototype.toString=function(){return this.toArray().join(",")};vi.prototype.toJSON=function(){return this.toArray()};vi.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:vi,enumerable:!1}),n};typeof Symbol<"u"&&(vi.prototype[Symbol.for("nodejs.util.inspect.custom")]=vi.prototype.inspect);vi.from=function(n){var e=new vi;return NY(n,function(t){e.enqueue(t)}),e};vi.of=function(){return vi.from(arguments)};var GY=vi,zY=function(e,t){var i=t.length;if(i!==0){var r=e.length;e.length+=i;for(var s=0;se?1:0},KY=function(n,e){return ne?-1:0};function $Y(n){return function(e,t){return n(t,e)}}function JY(n){return n===2?function(e,t){return e[0]t[0]?1:e[1]t[1]?1:0}:function(e,t){for(var i=0;it[i])return 1;i++}return 0}}E0.DEFAULT_COMPARATOR=jY;E0.DEFAULT_REVERSE_COMPARATOR=KY;E0.reverseComparator=$Y;E0.createTupleComparator=JY;var S0={},CI=S4,TI=m4;function ZY(n){return Array.isArray(n)||TI.isTypedArray(n)}function T4(n){if(typeof n.length=="number")return n.length;if(typeof n.size=="number")return n.size}function eq(n){var e=T4(n),t=typeof e=="number"?new Array(e):[],i=0;return CI(n,function(r){t[i++]=r}),t}function tq(n){var e=T4(n),t=typeof e=="number"?TI.getPointerArray(e):Array,i=typeof e=="number"?new Array(e):[],r=typeof e=="number"?new t(e):[],s=0;return CI(n,function(a){i[s]=a,r[s]=s++}),[i,r]}S0.isArrayLike=ZY;S0.guessLength=T4;S0.toArray=eq;S0.toArrayWithIndices=tq;var Xm=S4,bI=E0,qa=S0,g1=bI.DEFAULT_COMPARATOR,b4=bI.reverseComparator;function I4(n,e,t,i){for(var r=e[i],s,a;i>t;){if(s=i-1>>1,a=e[s],n(r,a)<0){e[i]=a,i=s;continue}break}e[i]=r}function w0(n,e,t){for(var i=e.length,r=t,s=e[t],a=2*t+1,o;a=0&&(a=o),e[t]=e[a],t=a,a=2*t+1;e[t]=s,I4(n,e,r,t)}function II(n,e,t){e.push(t),I4(n,e,0,e.length-1)}function M4(n,e){var t=e.pop();if(e.length!==0){var i=e[0];return e[0]=t,w0(n,e,0),i}return t}function $h(n,e,t){if(e.length===0)throw new Error("mnemonist/heap.replace: cannot pop an empty heap.");var i=e[0];return e[0]=t,w0(n,e,0),i}function MI(n,e,t){var i;return e.length!==0&&n(e[0],t)<0&&(i=e[0],e[0]=t,t=i,w0(n,e,0)),t}function cu(n,e){for(var t=e.length,i=t>>1,r=i;--r>=0;)w0(n,e,r)}function R4(n,e){for(var t=e.length,i=0,r=new Array(t);i=t.length)return t.slice().sort(n);for(l=t.slice(0,e),cu(i,l),r=e,s=t.length;r0&&$h(i,l,t[r]);return l.sort(n)}var c=qa.guessLength(t);return c!==null&&c0&&$h(i,l,u)),r++}),l.length>r&&(l.length=r),l.sort(n)}function iq(n,e,t){arguments.length===2&&(t=e,e=n,n=g1);var i=b4(n),r,s,a,o=-1/0,l;if(e===1){if(qa.isArrayLike(t)){for(r=0,s=t.length;r0)&&(o=a);return l=new t.constructor(1),l[0]=o,l}return Xm(t,function(u){(o===-1/0||n(u,o)>0)&&(o=u)}),[o]}if(qa.isArrayLike(t)){if(e>=t.length)return t.slice().sort(i);for(l=t.slice(0,e),cu(n,l),r=e,s=t.length;r0&&$h(n,l,t[r]);return l.sort(i)}var c=qa.guessLength(t);return c!==null&&c0&&$h(n,l,u)),r++}),l.length>r&&(l.length=r),l.sort(i)}function Sn(n){if(this.clear(),this.comparator=n||g1,typeof this.comparator!="function")throw new Error("mnemonist/Heap.constructor: given comparator should be a function.")}Sn.prototype.clear=function(){this.items=[],this.size=0};Sn.prototype.push=function(n){return II(this.comparator,this.items,n),++this.size};Sn.prototype.peek=function(){return this.items[0]};Sn.prototype.pop=function(){return this.size!==0&&this.size--,M4(this.comparator,this.items)};Sn.prototype.replace=function(n){return $h(this.comparator,this.items,n)};Sn.prototype.pushpop=function(n){return MI(this.comparator,this.items,n)};Sn.prototype.consume=function(){return this.size=0,R4(this.comparator,this.items)};Sn.prototype.toArray=function(){return R4(this.comparator,this.items.slice())};Sn.prototype.inspect=function(){var n=this.toArray();return Object.defineProperty(n,"constructor",{value:Sn,enumerable:!1}),n};typeof Symbol<"u"&&(Sn.prototype[Symbol.for("nodejs.util.inspect.custom")]=Sn.prototype.inspect);function jm(n){if(this.clear(),this.comparator=n||g1,typeof this.comparator!="function")throw new Error("mnemonist/MaxHeap.constructor: given comparator should be a function.");this.comparator=b4(this.comparator)}jm.prototype=Sn.prototype;Sn.from=function(n,e){var t=new Sn(e),i;return qa.isArrayLike(n)?i=n.slice():i=qa.toArray(n),cu(t.comparator,i),t.items=i,t.size=i.length,t};jm.from=function(n,e){var t=new jm(e),i;return qa.isArrayLike(n)?i=n.slice():i=qa.toArray(n),cu(t.comparator,i),t.items=i,t.size=i.length,t};Sn.siftUp=w0;Sn.siftDown=I4;Sn.push=II;Sn.pop=M4;Sn.replace=$h;Sn.pushpop=MI;Sn.heapify=cu;Sn.consume=R4;Sn.nsmallest=nq;Sn.nlargest=iq;Sn.MinHeap=Sn;Sn.MaxHeap=jm;var rq=Sn,RI=Kl,B4=df.createEdgeWeightGetter,Km=rq,D4="weight";function Ty(n,e){return n[0]>e[0]?1:n[0]e[1]?1:n[1]e[2]?1:n[2]e[0]?1:n[0]e[1]?1:n[1]e[2]?1:n[2]e[3]?1:n[3]y)&&(c=y,l=s[0][A].concat(s[1][A].slice(0,-1).reverse()))))}}return[1/0,null]}function oq(n,e,t,i,r,s){if(!RI(n))throw new Error("graphology-shortest-path/dijkstra: invalid graphology instance.");if(r&&!n.hasNode(r))throw new Error('graphology-shortest-path/dijkstra: the "'+r+'" target node does not exist in the given graph.');t=B4(t||D4).fromMinimalEntry;var a={},o={},l=new Km(Ty),c=0,u,h,f,p,m,y,v,A,_,x,E;for(A=0,x=e.length;Ai)){if(m in a&&f0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")Y7(l,this,t);else for(var c=l.length,u=FI(l,c),i=0;i0&&a.length>r&&!a.warned){a.warned=!0;var o=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");o.name="MaxListenersExceededWarning",o.emitter=n,o.type=e,o.count=a.length,hq(o)}return n}bn.prototype.addListener=function(e,t){return PI(this,e,t,!1)};bn.prototype.on=bn.prototype.addListener;bn.prototype.prependListener=function(e,t){return PI(this,e,t,!0)};function fq(){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 LI(n,e,t){var i={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},r=fq.bind(i);return r.listener=t,i.wrapFn=r,r}bn.prototype.once=function(e,t){return m1(t),this.on(e,LI(this,e,t)),this};bn.prototype.prependOnceListener=function(e,t){return m1(t),this.prependListener(e,LI(this,e,t)),this};bn.prototype.removeListener=function(e,t){var i,r,s,a,o;if(m1(t),r=this._events,r===void 0)return this;if(i=r[e],i===void 0)return this;if(i===t||i.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if(typeof i!="function"){for(s=-1,a=i.length-1;a>=0;a--)if(i[a]===t||i[a].listener===t){o=i[a].listener,s=a;break}if(s<0)return this;s===0?i.shift():dq(i,s),i.length===1&&(r[e]=i[0]),r.removeListener!==void 0&&this.emit("removeListener",e,o||t)}return this};bn.prototype.off=bn.prototype.removeListener;bn.prototype.removeAllListeners=function(e){var t,i,r;if(i=this._events,i===void 0)return this;if(i.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):i[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete i[e]),this;if(arguments.length===0){var s=Object.keys(i),a;for(r=0;r=0;r--)this.removeListener(e,t[r]);return this};function UI(n,e,t){var i=n._events;if(i===void 0)return[];var r=i[e];return r===void 0?[]:typeof r=="function"?t?[r.listener||r]:[r]:t?pq(r):FI(r,r.length)}bn.prototype.listeners=function(e){return UI(this,e,!0)};bn.prototype.rawListeners=function(e){return UI(this,e,!1)};bn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):OI.call(n,e)};bn.prototype.listenerCount=OI;function OI(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}bn.prototype.eventNames=function(){return this._eventsCount>0?Am(this._events):[]};function FI(n,e){for(var t=new Array(e),i=0;i1?t:1/0,r=i!==1/0?new Array(i):[],s,a=0,o=Eq(e);;){if(a===i)return r;if(s=o.next(),s.done)return a!==t&&(r.length=a),r;r[a++]=s.value}};const zI=ps(Sq);var wq=d1,Cq=GI,Tq=function(){var e=arguments,t=null,i=-1;return new wq(function(){var s=null;do{if(t===null){if(i++,i>=e.length)return{done:!0};t=Cq(e[i])}if(s=t.next(),s.done===!0){t=null;continue}break}while(!0);return s})};const Go=ps(Tq);function bq(){const n=arguments[0];for(let e=1,t=arguments.length;en++}class L4 extends Error{constructor(e){super(),this.name="GraphError",this.message=e}}class nt extends L4{constructor(e){super(e),this.name="InvalidArgumentsGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,nt.prototype.constructor)}}class qe extends L4{constructor(e){super(e),this.name="NotFoundGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,qe.prototype.constructor)}}class xt extends L4{constructor(e){super(e),this.name="UsageGraphError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,xt.prototype.constructor)}}function HI(n,e){this.key=n,this.attributes=e,this.clear()}HI.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 VI(n,e){this.key=n,this.attributes=e,this.clear()}VI.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function WI(n,e){this.key=n,this.attributes=e,this.clear()}WI.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function mf(n,e,t,i,r){this.key=e,this.attributes=r,this.undirected=n,this.source=t,this.target=i}mf.prototype.attach=function(){let n="out",e="in";this.undirected&&(n=e="undirected");const t=this.source.key,i=this.target.key;this.source[n][i]=this,!(this.undirected&&t===i)&&(this.target[e][t]=this)};mf.prototype.attachMulti=function(){let n="out",e="in";const t=this.source.key,i=this.target.key;this.undirected&&(n=e="undirected");const r=this.source[n],s=r[i];if(typeof s>"u"){r[i]=this,this.undirected&&t===i||(this.target[e][t]=this);return}s.previous=this,this.next=s,r[i]=this,this.target[e][t]=this};mf.prototype.detach=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),delete this.source[t][e],delete this.target[i][n]};mf.prototype.detachMulti=function(){const n=this.source.key,e=this.target.key;let t="out",i="in";this.undirected&&(t=i="undirected"),this.previous===void 0?this.next===void 0?(delete this.source[t][e],delete this.target[i][n]):(this.next.previous=void 0,this.source[t][e]=this.next,this.target[i][n]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};const YI=0,qI=1,Mq=2,XI=3;function Ko(n,e,t,i,r,s,a){let o,l,c,u;if(i=""+i,t===YI){if(o=n._nodes.get(i),!o)throw new qe(`Graph.${e}: could not find the "${i}" node in the graph.`);c=r,u=s}else if(t===XI){if(r=""+r,l=n._edges.get(r),!l)throw new qe(`Graph.${e}: could not find the "${r}" edge in the graph.`);const h=l.source.key,f=l.target.key;if(i===h)o=l.target;else if(i===f)o=l.source;else throw new qe(`Graph.${e}: the "${i}" node is not attached to the "${r}" edge (${h}, ${f}).`);c=s,u=a}else{if(l=n._edges.get(i),!l)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`);t===qI?o=l.source:o=l.target,c=r,u=s}return[o,c,u]}function Rq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);return a.attributes[o]}}function Bq(n,e,t){n.prototype[e]=function(i,r){const[s]=Ko(this,e,t,i,r);return s.attributes}}function Dq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);return a.attributes.hasOwnProperty(o)}}function Pq(n,e,t){n.prototype[e]=function(i,r,s,a){const[o,l,c]=Ko(this,e,t,i,r,s,a);return o.attributes[l]=c,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:l}),this}}function Lq(n,e,t){n.prototype[e]=function(i,r,s,a){const[o,l,c]=Ko(this,e,t,i,r,s,a);if(typeof c!="function")throw new nt(`Graph.${e}: updater should be a function.`);const u=o.attributes,h=c(u[l]);return u[l]=h,this.emit("nodeAttributesUpdated",{key:o.key,type:"set",attributes:o.attributes,name:l}),this}}function Uq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);return delete a.attributes[o],this.emit("nodeAttributesUpdated",{key:a.key,type:"remove",attributes:a.attributes,name:o}),this}}function Oq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);if(!ji(o))throw new nt(`Graph.${e}: provided attributes are not a plain object.`);return a.attributes=o,this.emit("nodeAttributesUpdated",{key:a.key,type:"replace",attributes:a.attributes}),this}}function Fq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);if(!ji(o))throw new nt(`Graph.${e}: provided attributes are not a plain object.`);return Mi(a.attributes,o),this.emit("nodeAttributesUpdated",{key:a.key,type:"merge",attributes:a.attributes,data:o}),this}}function kq(n,e,t){n.prototype[e]=function(i,r,s){const[a,o]=Ko(this,e,t,i,r,s);if(typeof o!="function")throw new nt(`Graph.${e}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit("nodeAttributesUpdated",{key:a.key,type:"update",attributes:a.attributes}),this}}const Nq=[{name:n=>`get${n}Attribute`,attacher:Rq},{name:n=>`get${n}Attributes`,attacher:Bq},{name:n=>`has${n}Attribute`,attacher:Dq},{name:n=>`set${n}Attribute`,attacher:Pq},{name:n=>`update${n}Attribute`,attacher:Lq},{name:n=>`remove${n}Attribute`,attacher:Uq},{name:n=>`replace${n}Attributes`,attacher:Oq},{name:n=>`merge${n}Attributes`,attacher:Fq},{name:n=>`update${n}Attributes`,attacher:kq}];function Gq(n){Nq.forEach(function({name:e,attacher:t}){t(n,e("Node"),YI),t(n,e("Source"),qI),t(n,e("Target"),Mq),t(n,e("Opposite"),XI)})}function zq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`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=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return s.attributes[r]}}function Qq(n,e,t){n.prototype[e]=function(i){let r;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new xt(`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=""+i,a=""+arguments[1];if(r=Gs(this,s,a,t),!r)throw new qe(`Graph.${e}: could not find an edge for the given path ("${s}" - "${a}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,r=this._edges.get(i),!r)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return r.attributes}}function Hq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`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=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return s.attributes.hasOwnProperty(r)}}function Vq(n,e,t){n.prototype[e]=function(i,r,s){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new xt(`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=""+i,l=""+r;if(r=arguments[2],s=arguments[3],a=Gs(this,o,l,t),!a)throw new qe(`Graph.${e}: could not find an edge for the given path ("${o}" - "${l}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,a=this._edges.get(i),!a)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return a.attributes[r]=s,this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:r}),this}}function Wq(n,e,t){n.prototype[e]=function(i,r,s){let a;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new xt(`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=""+i,l=""+r;if(r=arguments[2],s=arguments[3],a=Gs(this,o,l,t),!a)throw new qe(`Graph.${e}: could not find an edge for the given path ("${o}" - "${l}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,a=this._edges.get(i),!a)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof s!="function")throw new nt(`Graph.${e}: updater should be a function.`);return a.attributes[r]=s(a.attributes[r]),this.emit("edgeAttributesUpdated",{key:a.key,type:"set",attributes:a.attributes,name:r}),this}}function Yq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`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=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}return delete s.attributes[r],this.emit("edgeAttributesUpdated",{key:s.key,type:"remove",attributes:s.attributes,name:r}),this}}function qq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`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=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!ji(r))throw new nt(`Graph.${e}: provided attributes are not a plain object.`);return s.attributes=r,this.emit("edgeAttributesUpdated",{key:s.key,type:"replace",attributes:s.attributes}),this}}function Xq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`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=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(!ji(r))throw new nt(`Graph.${e}: provided attributes are not a plain object.`);return Mi(s.attributes,r),this.emit("edgeAttributesUpdated",{key:s.key,type:"merge",attributes:s.attributes,data:r}),this}}function jq(n,e,t){n.prototype[e]=function(i,r){let s;if(this.type!=="mixed"&&t!=="mixed"&&t!==this.type)throw new xt(`Graph.${e}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new xt(`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=""+i,o=""+r;if(r=arguments[2],s=Gs(this,a,o,t),!s)throw new qe(`Graph.${e}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(t!=="mixed")throw new xt(`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(i=""+i,s=this._edges.get(i),!s)throw new qe(`Graph.${e}: could not find the "${i}" edge in the graph.`)}if(typeof r!="function")throw new nt(`Graph.${e}: provided updater is not a function.`);return s.attributes=r(s.attributes),this.emit("edgeAttributesUpdated",{key:s.key,type:"update",attributes:s.attributes}),this}}const Kq=[{name:n=>`get${n}Attribute`,attacher:zq},{name:n=>`get${n}Attributes`,attacher:Qq},{name:n=>`has${n}Attribute`,attacher:Hq},{name:n=>`set${n}Attribute`,attacher:Vq},{name:n=>`update${n}Attribute`,attacher:Wq},{name:n=>`remove${n}Attribute`,attacher:Yq},{name:n=>`replace${n}Attributes`,attacher:qq},{name:n=>`merge${n}Attributes`,attacher:Xq},{name:n=>`update${n}Attributes`,attacher:jq}];function $q(n){Kq.forEach(function({name:e,attacher:t}){t(n,e("Edge"),"mixed"),t(n,e("DirectedEdge"),"directed"),t(n,e("UndirectedEdge"),"undirected")})}const Jq=[{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 Zq(n,e,t,i){let r=!1;for(const s in e){if(s===i)continue;const a=e[s];if(r=t(a.key,a.attributes,a.source.key,a.target.key,a.source.attributes,a.target.attributes,a.undirected),n&&r)return a.key}}function eX(n,e,t,i){let r,s,a,o=!1;for(const l in e)if(l!==i){r=e[l];do{if(s=r.source,a=r.target,o=t(r.key,r.attributes,s.key,a.key,s.attributes,a.attributes,r.undirected),n&&o)return r.key;r=r.next}while(r!==void 0)}}function Wv(n,e){const t=Object.keys(n),i=t.length;let r,s=0;return new Hs(function(){do if(r)r=r.next;else{if(s>=i)return{done:!0};const o=t[s++];if(o===e){r=void 0;continue}r=n[o]}while(!r);return{done:!1,value:{edge:r.key,attributes:r.attributes,source:r.source.key,target:r.target.key,sourceAttributes:r.source.attributes,targetAttributes:r.target.attributes,undirected:r.undirected}}})}function tX(n,e,t,i){const r=e[t];if(!r)return;const s=r.source,a=r.target;if(i(r.key,r.attributes,s.key,a.key,s.attributes,a.attributes,r.undirected)&&n)return r.key}function nX(n,e,t,i){let r=e[t];if(!r)return;let s=!1;do{if(s=i(r.key,r.attributes,r.source.key,r.target.key,r.source.attributes,r.target.attributes,r.undirected),n&&s)return r.key;r=r.next}while(r!==void 0)}function Yv(n,e){let t=n[e];return t.next!==void 0?new Hs(function(){if(!t)return{done:!0};const i={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:i}}):Hs.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 iX(n,e){if(n.size===0)return[];if(e==="mixed"||e===n.type)return typeof Array.from=="function"?Array.from(n._edges.keys()):zI(n._edges.keys(),n._edges.size);const t=e==="undirected"?n.undirectedSize:n.directedSize,i=new Array(t),r=e==="undirected",s=n._edges.values();let a=0,o,l;for(;o=s.next(),o.done!==!0;)l=o.value,l.undirected===r&&(i[a++]=l.key);return i}function jI(n,e,t,i){if(e.size===0)return;const r=t!=="mixed"&&t!==e.type,s=t==="undirected";let a,o,l=!1;const c=e._edges.values();for(;a=c.next(),a.done!==!0;){if(o=a.value,r&&o.undirected!==s)continue;const{key:u,attributes:h,source:f,target:p}=o;if(l=i(u,h,f.key,p.key,f.attributes,p.attributes,o.undirected),n&&l)return u}}function rX(n,e){if(n.size===0)return Hs.empty();const t=e!=="mixed"&&e!==n.type,i=e==="undirected",r=n._edges.values();return new Hs(function(){let a,o;for(;;){if(a=r.next(),a.done)return a;if(o=a.value,!(t&&o.undirected!==i))break}return{value:{edge:o.key,attributes:o.attributes,source:o.source.key,target:o.target.key,sourceAttributes:o.source.attributes,targetAttributes:o.target.attributes,undirected:o.undirected},done:!1}})}function U4(n,e,t,i,r,s){const a=e?eX:Zq;let o;if(t!=="undirected"&&(i!=="out"&&(o=a(n,r.in,s),n&&o)||i!=="in"&&(o=a(n,r.out,s,i?void 0:r.key),n&&o))||t!=="directed"&&(o=a(n,r.undirected,s),n&&o))return o}function sX(n,e,t,i){const r=[];return U4(!1,n,e,t,i,function(s){r.push(s)}),r}function aX(n,e,t){let i=Hs.empty();return n!=="undirected"&&(e!=="out"&&typeof t.in<"u"&&(i=Go(i,Wv(t.in))),e!=="in"&&typeof t.out<"u"&&(i=Go(i,Wv(t.out,e?void 0:t.key)))),n!=="directed"&&typeof t.undirected<"u"&&(i=Go(i,Wv(t.undirected))),i}function O4(n,e,t,i,r,s,a){const o=t?nX:tX;let l;if(e!=="undirected"&&(typeof r.in<"u"&&i!=="out"&&(l=o(n,r.in,s,a),n&&l)||typeof r.out<"u"&&i!=="in"&&(i||r.key!==s)&&(l=o(n,r.out,s,a),n&&l))||e!=="directed"&&typeof r.undirected<"u"&&(l=o(n,r.undirected,s,a),n&&l))return l}function oX(n,e,t,i,r){const s=[];return O4(!1,n,e,t,i,r,function(a){s.push(a)}),s}function lX(n,e,t,i){let r=Hs.empty();return n!=="undirected"&&(typeof t.in<"u"&&e!=="out"&&i in t.in&&(r=Go(r,Yv(t.in,i))),typeof t.out<"u"&&e!=="in"&&i in t.out&&(e||t.key!==i)&&(r=Go(r,Yv(t.out,i)))),n!=="directed"&&typeof t.undirected<"u"&&i in t.undirected&&(r=Go(r,Yv(t.undirected,i))),r}function cX(n,e){const{name:t,type:i,direction:r}=e;n.prototype[t]=function(s,a){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];if(!arguments.length)return iX(this,i);if(arguments.length===1){s=""+s;const o=this._nodes.get(s);if(typeof o>"u")throw new qe(`Graph.${t}: could not find the "${s}" node in the graph.`);return sX(this.multi,i==="mixed"?this.type:i,r,o)}if(arguments.length===2){s=""+s,a=""+a;const o=this._nodes.get(s);if(!o)throw new qe(`Graph.${t}: could not find the "${s}" source node in the graph.`);if(!this._nodes.has(a))throw new qe(`Graph.${t}: could not find the "${a}" target node in the graph.`);return oX(i,this.multi,r,o,a)}throw new nt(`Graph.${t}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function uX(n,e){const{name:t,type:i,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(c,u,h){if(!(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)){if(arguments.length===1)return h=c,jI(!1,this,i,h);if(arguments.length===2){c=""+c,h=u;const f=this._nodes.get(c);if(typeof f>"u")throw new qe(`Graph.${s}: could not find the "${c}" node in the graph.`);return U4(!1,this.multi,i==="mixed"?this.type:i,r,f,h)}if(arguments.length===3){c=""+c,u=""+u;const f=this._nodes.get(c);if(!f)throw new qe(`Graph.${s}: could not find the "${c}" source node in the graph.`);if(!this._nodes.has(u))throw new qe(`Graph.${s}: could not find the "${u}" target node in the graph.`);return O4(!1,i,this.multi,r,f,u,h)}throw new nt(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};const a="map"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop();let h;if(c.length===0){let f=0;i!=="directed"&&(f+=this.undirectedSize),i!=="undirected"&&(f+=this.directedSize),h=new Array(f);let p=0;c.push((m,y,v,A,_,x,E)=>{h[p++]=u(m,y,v,A,_,x,E)})}else h=[],c.push((f,p,m,y,v,A,_)=>{h.push(u(f,p,m,y,v,A,_))});return this[s].apply(this,c),h};const o="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(){const c=Array.prototype.slice.call(arguments),u=c.pop(),h=[];return c.push((f,p,m,y,v,A,_)=>{u(f,p,m,y,v,A,_)&&h.push(f)}),this[s].apply(this,c),h};const l="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[l]=function(){let c=Array.prototype.slice.call(arguments);if(c.length<2||c.length>4)throw new nt(`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 nt(`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 f=h;return c.push((p,m,y,v,A,_,x)=>{f=u(f,p,m,y,v,A,_,x)}),this[s].apply(this,c),f}}function hX(n,e){const{name:t,type:i,direction:r}=e,s="find"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(l,c,u){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return!1;if(arguments.length===1)return u=l,jI(!0,this,i,u);if(arguments.length===2){l=""+l,u=c;const h=this._nodes.get(l);if(typeof h>"u")throw new qe(`Graph.${s}: could not find the "${l}" node in the graph.`);return U4(!0,this.multi,i==="mixed"?this.type:i,r,h,u)}if(arguments.length===3){l=""+l,c=""+c;const h=this._nodes.get(l);if(!h)throw new qe(`Graph.${s}: could not find the "${l}" source node in the graph.`);if(!this._nodes.has(c))throw new qe(`Graph.${s}: could not find the "${c}" target node in the graph.`);return O4(!0,i,this.multi,r,h,c,u)}throw new nt(`Graph.${s}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};const a="some"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[a]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((h,f,p,m,y,v,A)=>c(h,f,p,m,y,v,A)),!!this[s].apply(this,l)};const o="every"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[o]=function(){const l=Array.prototype.slice.call(arguments),c=l.pop();return l.push((h,f,p,m,y,v,A)=>!c(h,f,p,m,y,v,A)),!this[s].apply(this,l)}}function fX(n,e){const{name:t,type:i,direction:r}=e,s=t.slice(0,-1)+"Entries";n.prototype[s]=function(a,o){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Hs.empty();if(!arguments.length)return rX(this,i);if(arguments.length===1){a=""+a;const l=this._nodes.get(a);if(!l)throw new qe(`Graph.${s}: could not find the "${a}" node in the graph.`);return aX(i,r,l)}if(arguments.length===2){a=""+a,o=""+o;const l=this._nodes.get(a);if(!l)throw new qe(`Graph.${s}: could not find the "${a}" source node in the graph.`);if(!this._nodes.has(o))throw new qe(`Graph.${s}: could not find the "${o}" target node in the graph.`);return lX(i,r,l,o)}throw new nt(`Graph.${s}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function dX(n){Jq.forEach(e=>{cX(n,e),uX(n,e),hX(n,e),fX(n,e)})}const pX=[{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 A1(){this.A=null,this.B=null}A1.prototype.wrap=function(n){this.A===null?this.A=n:this.B===null&&(this.B=n)};A1.prototype.has=function(n){return this.A!==null&&n in this.A||this.B!==null&&n in this.B};function pd(n,e,t,i,r){for(const s in i){const a=i[s],o=a.source,l=a.target,c=o===t?l:o;if(e&&e.has(c.key))continue;const u=r(c.key,c.attributes);if(n&&u)return c.key}}function F4(n,e,t,i,r){if(e!=="mixed"){if(e==="undirected")return pd(n,null,i,i.undirected,r);if(typeof t=="string")return pd(n,null,i,i[t],r)}const s=new A1;let a;if(e!=="undirected"){if(t!=="out"){if(a=pd(n,null,i,i.in,r),n&&a)return a;s.wrap(i.in)}if(t!=="in"){if(a=pd(n,s,i,i.out,r),n&&a)return a;s.wrap(i.out)}}if(e!=="directed"&&(a=pd(n,s,i,i.undirected,r),n&&a))return a}function gX(n,e,t){if(n!=="mixed"){if(n==="undirected")return Object.keys(t.undirected);if(typeof e=="string")return Object.keys(t[e])}const i=[];return F4(!1,n,e,t,function(r){i.push(r)}),i}function gd(n,e,t){const i=Object.keys(t),r=i.length;let s=0;return new Hs(function(){let o=null;do{if(s>=r)return n&&n.wrap(t),{done:!0};const l=t[i[s++]],c=l.source,u=l.target;if(o=c===e?u:c,n&&n.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}})}function mX(n,e,t){if(n!=="mixed"){if(n==="undirected")return gd(null,t,t.undirected);if(typeof e=="string")return gd(null,t,t[e])}let i=Hs.empty();const r=new A1;return n!=="undirected"&&(e!=="out"&&(i=Go(i,gd(r,t,t.in))),e!=="in"&&(i=Go(i,gd(r,t,t.out)))),n!=="directed"&&(i=Go(i,gd(r,t,t.undirected))),i}function AX(n,e){const{name:t,type:i,direction:r}=e;n.prototype[t]=function(s){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return[];s=""+s;const a=this._nodes.get(s);if(typeof a>"u")throw new qe(`Graph.${t}: could not find the "${s}" node in the graph.`);return gX(i==="mixed"?this.type:i,r,a)}}function vX(n,e){const{name:t,type:i,direction:r}=e,s="forEach"+t[0].toUpperCase()+t.slice(1,-1);n.prototype[s]=function(c,u){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;c=""+c;const h=this._nodes.get(c);if(typeof h>"u")throw new qe(`Graph.${s}: could not find the "${c}" node in the graph.`);F4(!1,i==="mixed"?this.type:i,r,h,u)};const a="map"+t[0].toUpperCase()+t.slice(1);n.prototype[a]=function(c,u){const h=[];return this[s](c,(f,p)=>{h.push(u(f,p))}),h};const o="filter"+t[0].toUpperCase()+t.slice(1);n.prototype[o]=function(c,u){const h=[];return this[s](c,(f,p)=>{u(f,p)&&h.push(f)}),h};const l="reduce"+t[0].toUpperCase()+t.slice(1);n.prototype[l]=function(c,u,h){if(arguments.length<3)throw new nt(`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 f=h;return this[s](c,(p,m)=>{f=u(f,p,m)}),f}}function yX(n,e){const{name:t,type:i,direction:r}=e,s=t[0].toUpperCase()+t.slice(1,-1),a="find"+s;n.prototype[a]=function(c,u){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return;c=""+c;const h=this._nodes.get(c);if(typeof h>"u")throw new qe(`Graph.${a}: could not find the "${c}" node in the graph.`);return F4(!0,i==="mixed"?this.type:i,r,h,u)};const o="some"+s;n.prototype[o]=function(c,u){return!!this[a](c,u)};const l="every"+s;n.prototype[l]=function(c,u){return!this[a](c,(f,p)=>!u(f,p))}}function xX(n,e){const{name:t,type:i,direction:r}=e,s=t.slice(0,-1)+"Entries";n.prototype[s]=function(a){if(i!=="mixed"&&this.type!=="mixed"&&i!==this.type)return Hs.empty();a=""+a;const o=this._nodes.get(a);if(typeof o>"u")throw new qe(`Graph.${s}: could not find the "${a}" node in the graph.`);return mX(i==="mixed"?this.type:i,r,o)}}function _X(n){pX.forEach(e=>{AX(n,e),vX(n,e),yX(n,e),xX(n,e)})}function Ug(n,e,t,i,r){const s=i._nodes.values(),a=i.type;let o,l,c,u,h,f,p;for(;o=s.next(),o.done!==!0;){let m=!1;if(l=o.value,a!=="undirected"){u=l.out;for(c in u){h=u[c];do{if(f=h.target,m=!0,p=r(l.key,f.key,l.attributes,f.attributes,h.key,h.attributes,h.undirected),n&&p)return h;h=h.next}while(h)}}if(a!=="directed"){u=l.undirected;for(c in u)if(!(e&&l.key>c)){h=u[c];do{if(f=h.target,f.key!==c&&(f=h.source),m=!0,p=r(l.key,f.key,l.attributes,f.attributes,h.key,h.attributes,h.undirected),n&&p)return h;h=h.next}while(h)}}if(t&&!m&&(p=r(l.key,null,l.attributes,null,null,null,null),n&&p))return null}}function EX(n,e){const t={key:n};return QI(e.attributes)||(t.attributes=Mi({},e.attributes)),t}function SX(n,e,t){const i={key:e,source:t.source.key,target:t.target.key};return QI(t.attributes)||(i.attributes=Mi({},t.attributes)),n==="mixed"&&t.undirected&&(i.undirected=!0),i}function wX(n){if(!ji(n))throw new nt('Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.');if(!("key"in n))throw new nt("Graph.import: serialized node is missing its key.");if("attributes"in n&&(!ji(n.attributes)||n.attributes===null))throw new nt("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.")}function CX(n){if(!ji(n))throw new nt('Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.');if(!("source"in n))throw new nt("Graph.import: serialized edge is missing its source.");if(!("target"in n))throw new nt("Graph.import: serialized edge is missing its target.");if("attributes"in n&&(!ji(n.attributes)||n.attributes===null))throw new nt("Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.");if("undirected"in n&&typeof n.undirected!="boolean")throw new nt("Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.")}const TX=Iq(),bX=new Set(["directed","undirected","mixed"]),j7=new Set(["domain","_events","_eventsCount","_maxListeners"]),IX=[{name:n=>`${n}Edge`,generateKey:!0},{name:n=>`${n}DirectedEdge`,generateKey:!0,type:"directed"},{name:n=>`${n}UndirectedEdge`,generateKey:!0,type:"undirected"},{name:n=>`${n}EdgeWithKey`},{name:n=>`${n}DirectedEdgeWithKey`,type:"directed"},{name:n=>`${n}UndirectedEdgeWithKey`,type:"undirected"}],MX={allowSelfLoops:!0,multi:!1,type:"mixed"};function RX(n,e,t){if(t&&!ji(t))throw new nt(`Graph.addNode: invalid attributes. Expecting an object but got "${t}"`);if(e=""+e,t=t||{},n._nodes.has(e))throw new xt(`Graph.addNode: the "${e}" node already exist in the graph.`);const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function K7(n,e,t){const i=new n.NodeDataClass(e,t);return n._nodes.set(e,i),n.emit("nodeAdded",{key:e,attributes:t}),i}function KI(n,e,t,i,r,s,a,o){if(!i&&n.type==="undirected")throw new xt(`Graph.${e}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new xt(`Graph.${e}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(o&&!ji(o))throw new nt(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`);if(s=""+s,a=""+a,o=o||{},!n.allowSelfLoops&&s===a)throw new xt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);const l=n._nodes.get(s),c=n._nodes.get(a);if(!l)throw new qe(`Graph.${e}: source node "${s}" not found.`);if(!c)throw new qe(`Graph.${e}: target node "${a}" not found.`);const u={key:null,undirected:i,source:s,target:a,attributes:o};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new xt(`Graph.${e}: the "${r}" edge already exists in the graph.`);if(!n.multi&&(i?typeof l.undirected[a]<"u":typeof l.out[a]<"u"))throw new xt(`Graph.${e}: an edge linking "${s}" to "${a}" 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 mf(i,r,l,c,o);n._edges.set(r,h);const f=s===a;return i?(l.undirectedDegree++,c.undirectedDegree++,f&&(l.undirectedLoops++,n._undirectedSelfLoopCount++)):(l.outDegree++,c.inDegree++,f&&(l.directedLoops++,n._directedSelfLoopCount++)),n.multi?h.attachMulti():h.attach(),i?n._undirectedSize++:n._directedSize++,u.key=r,n.emit("edgeAdded",u),r}function BX(n,e,t,i,r,s,a,o,l){if(!i&&n.type==="undirected")throw new xt(`Graph.${e}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(i&&n.type==="directed")throw new xt(`Graph.${e}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(o){if(l){if(typeof o!="function")throw new nt(`Graph.${e}: invalid updater function. Expecting a function but got "${o}"`)}else if(!ji(o))throw new nt(`Graph.${e}: invalid attributes. Expecting an object but got "${o}"`)}s=""+s,a=""+a;let c;if(l&&(c=o,o=void 0),!n.allowSelfLoops&&s===a)throw new xt(`Graph.${e}: source & target are the same ("${s}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=n._nodes.get(s),h=n._nodes.get(a),f,p;if(!t&&(f=n._edges.get(r),f)){if((f.source.key!==s||f.target.key!==a)&&(!i||f.source.key!==a||f.target.key!==s))throw new xt(`Graph.${e}: inconsistency detected when attempting to merge the "${r}" edge with "${s}" source & "${a}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!n.multi&&u&&(p=i?u.undirected[a]:u.out[a]),p){const _=[p.key,!1,!1,!1];if(l?!c:!o)return _;if(l){const x=p.attributes;p.attributes=c(x),n.emit("edgeAttributesUpdated",{type:"replace",key:p.key,attributes:p.attributes})}else Mi(p.attributes,o),n.emit("edgeAttributesUpdated",{type:"merge",key:p.key,attributes:p.attributes,data:o});return _}o=o||{},l&&c&&(o=c(o));const m={key:null,undirected:i,source:s,target:a,attributes:o};if(t)r=n._edgeKeyGenerator();else if(r=""+r,n._edges.has(r))throw new xt(`Graph.${e}: the "${r}" edge already exists in the graph.`);let y=!1,v=!1;u||(u=K7(n,s,{}),y=!0,s===a&&(h=u,v=!0)),h||(h=K7(n,a,{}),v=!0),f=new mf(i,r,u,h,o),n._edges.set(r,f);const A=s===a;return i?(u.undirectedDegree++,h.undirectedDegree++,A&&(u.undirectedLoops++,n._undirectedSelfLoopCount++)):(u.outDegree++,h.inDegree++,A&&(u.directedLoops++,n._directedSelfLoopCount++)),n.multi?f.attachMulti():f.attach(),i?n._undirectedSize++:n._directedSize++,m.key=r,n.emit("edgeAdded",m),[r,!0,y,v]}function hh(n,e){n._edges.delete(e.key);const{source:t,target:i,attributes:r}=e,s=e.undirected,a=t===i;s?(t.undirectedDegree--,i.undirectedDegree--,a&&(t.undirectedLoops--,n._undirectedSelfLoopCount--)):(t.outDegree--,i.inDegree--,a&&(t.directedLoops--,n._directedSelfLoopCount--)),n.multi?e.detachMulti():e.detach(),s?n._undirectedSize--:n._directedSize--,n.emit("edgeDropped",{key:e.key,attributes:r,source:t.key,target:i.key,undirected:s})}class In extends Aq.EventEmitter{constructor(e){if(super(),e=Mi({},MX,e),typeof e.multi!="boolean")throw new nt(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!bX.has(e.type))throw new nt(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!="boolean")throw new nt(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);const t=e.type==="mixed"?HI:e.type==="directed"?VI:WI;Rs(this,"NodeDataClass",t);const i="geid_"+TX()+"_";let r=0;const s=()=>{let a;do a=i+r++;while(this._edges.has(a));return a};Rs(this,"_attributes",{}),Rs(this,"_nodes",new Map),Rs(this,"_edges",new Map),Rs(this,"_directedSize",0),Rs(this,"_undirectedSize",0),Rs(this,"_directedSelfLoopCount",0),Rs(this,"_undirectedSelfLoopCount",0),Rs(this,"_edgeKeyGenerator",s),Rs(this,"_options",e),j7.forEach(a=>Rs(this,a,this[a])),na(this,"order",()=>this._nodes.size),na(this,"size",()=>this._edges.size),na(this,"directedSize",()=>this._directedSize),na(this,"undirectedSize",()=>this._undirectedSize),na(this,"selfLoopCount",()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),na(this,"directedSelfLoopCount",()=>this._directedSelfLoopCount),na(this,"undirectedSelfLoopCount",()=>this._undirectedSelfLoopCount),na(this,"multi",this._options.multi),na(this,"type",this._options.type),na(this,"allowSelfLoops",this._options.allowSelfLoops),na(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 i=""+e,r=this._edges.get(i);return!!r&&!r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.out.hasOwnProperty(t):!1}throw new nt(`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 i=""+e,r=this._edges.get(i);return!!r&&r.undirected}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?i.undirected.hasOwnProperty(t):!1}throw new nt(`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 i=""+e;return this._edges.has(i)}else if(arguments.length===2){e=""+e,t=""+t;const i=this._nodes.get(e);return i?typeof i.out<"u"&&i.out.hasOwnProperty(t)||typeof i.undirected<"u"&&i.undirected.hasOwnProperty(t):!1}throw new nt(`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 xt("Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.");const i=this._nodes.get(e);if(!i)throw new qe(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new qe(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);const r=i.out&&i.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type==="directed")return;if(e=""+e,t=""+t,this.multi)throw new xt("Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.");const i=this._nodes.get(e);if(!i)throw new qe(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new qe(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);const r=i.undirected&&i.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new xt("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 i=this._nodes.get(e);if(!i)throw new qe(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new qe(`Graph.edge: could not find the "${t}" target node in the graph.`);const r=i.out&&i.out[t]||i.undirected&&i.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in||t in i.out}areOutNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.out}areInNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type==="undirected"?!1:t in i.in}areUndirectedNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type==="directed"?!1:t in i.undirected}areNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&(t in i.in||t in i.out)||this.type!=="directed"&&t in i.undirected}areInboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.in||this.type!=="directed"&&t in i.undirected}areOutboundNeighbors(e,t){e=""+e,t=""+t;const i=this._nodes.get(e);if(!i)throw new qe(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!=="undirected"&&t in i.out||this.type!=="directed"&&t in i.undirected}inDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`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 qe(`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 qe(`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 qe(`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 qe(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree),i}outboundDegree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.outDegree),i}degree(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.degree: could not find the "${e}" node in the graph.`);let i=0;return this.type!=="directed"&&(i+=t.undirectedDegree),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree),i}inDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`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 qe(`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 qe(`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 qe(`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 qe(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree,r+=t.directedLoops),i-r}outboundDegreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.outDegree,r+=t.directedLoops),i-r}degreeWithoutSelfLoops(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let i=0,r=0;return this.type!=="directed"&&(i+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!=="undirected"&&(i+=t.inDegree+t.outDegree,r+=t.directedLoops*2),i-r}source(e){e=""+e;const t=this._edges.get(e);if(!t)throw new qe(`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 qe(`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 qe(`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 i=this._edges.get(t);if(!i)throw new qe(`Graph.opposite: could not find the "${t}" edge in the graph.`);const r=i.source.key,s=i.target.key;if(e===r)return s;if(e===s)return r;throw new qe(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${s}).`)}hasExtremity(e,t){e=""+e,t=""+t;const i=this._edges.get(e);if(!i)throw new qe(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return i.source.key===t||i.target.key===t}isUndirected(e){e=""+e;const t=this._edges.get(e);if(!t)throw new qe(`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 qe(`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 qe(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return RX(this,e,t).key}mergeNode(e,t){if(t&&!ji(t))throw new nt(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=""+e,t=t||{};let i=this._nodes.get(e);return i?(t&&(Mi(i.attributes,t),this.emit("nodeAttributesUpdated",{type:"merge",key:e,attributes:i.attributes,data:t})),[e,!1]):(i=new this.NodeDataClass(e,t),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!="function")throw new nt(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=""+e;let i=this._nodes.get(e);if(i){if(t){const s=i.attributes;i.attributes=t(s),this.emit("nodeAttributesUpdated",{type:"replace",key:e,attributes:i.attributes})}return[e,!1]}const r=t?t({}):{};return i=new this.NodeDataClass(e,r),this._nodes.set(e,i),this.emit("nodeAdded",{key:e,attributes:r}),[e,!0]}dropNode(e){e=""+e;const t=this._nodes.get(e);if(!t)throw new qe(`Graph.dropNode: could not find the "${e}" node in the graph.`);let i;if(this.type!=="undirected"){for(const r in t.out){i=t.out[r];do hh(this,i),i=i.next;while(i)}for(const r in t.in){i=t.in[r];do hh(this,i),i=i.next;while(i)}}if(this.type!=="directed")for(const r in t.undirected){i=t.undirected[r];do hh(this,i),i=i.next;while(i)}this._nodes.delete(e),this.emit("nodeDropped",{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){const i=""+arguments[0],r=""+arguments[1];if(t=Gs(this,i,r,this.type),!t)throw new qe(`Graph.dropEdge: could not find the "${i}" -> "${r}" edge in the graph.`)}else if(e=""+e,t=this._edges.get(e),!t)throw new qe(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return hh(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new xt("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 xt("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 i=Gs(this,e,t,"directed");if(!i)throw new qe(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return hh(this,i),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new xt("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 xt("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 i=Gs(this,e,t,"undirected");if(!i)throw new qe(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return hh(this,i),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 nt("Graph.updateAttribute: updater should be a function.");const i=this._attributes[e];return this._attributes[e]=t(i),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(!ji(e))throw new nt("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(!ji(e))throw new nt("Graph.mergeAttributes: provided attributes are not a plain object.");return Mi(this._attributes,e),this.emit("attributesUpdated",{type:"merge",attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!="function")throw new nt("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 nt("Graph.updateEachNodeAttributes: expecting an updater function.");if(t&&!X7(t))throw new nt("Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._nodes.values();let r,s;for(;r=i.next(),r.done!==!0;)s=r.value,s.attributes=e(s.key,s.attributes);this.emit("eachNodeAttributesUpdated",{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!="function")throw new nt("Graph.updateEachEdgeAttributes: expecting an updater function.");if(t&&!X7(t))throw new nt("Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}");const i=this._edges.values();let r,s,a,o;for(;r=i.next(),r.done!==!0;)s=r.value,a=s.source,o=s.target,s.attributes=e(s.key,s.attributes,a.key,o.key,a.attributes,o.attributes,s.undirected);this.emit("eachEdgeAttributesUpdated",{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!="function")throw new nt("Graph.forEachAdjacencyEntry: expecting a callback.");Ug(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new nt("Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.");Ug(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!="function")throw new nt("Graph.forEachAssymetricAdjacencyEntry: expecting a callback.");Ug(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!="function")throw new nt("Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.");Ug(!1,!0,!0,this,e)}nodes(){return typeof Array.from=="function"?Array.from(this._nodes.keys()):zI(this._nodes.keys(),this._nodes.size)}forEachNode(e){if(typeof e!="function")throw new nt("Graph.forEachNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)r=i.value,e(r.key,r.attributes)}findNode(e){if(typeof e!="function")throw new nt("Graph.findNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!="function")throw new nt("Graph.mapNode: expecting a callback.");const t=this._nodes.values();let i,r;const s=new Array(this.order);let a=0;for(;i=t.next(),i.done!==!0;)r=i.value,s[a++]=e(r.key,r.attributes);return s}someNode(e){if(typeof e!="function")throw new nt("Graph.someNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!="function")throw new nt("Graph.everyNode: expecting a callback.");const t=this._nodes.values();let i,r;for(;i=t.next(),i.done!==!0;)if(r=i.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!="function")throw new nt("Graph.filterNodes: expecting a callback.");const t=this._nodes.values();let i,r;const s=[];for(;i=t.next(),i.done!==!0;)r=i.value,e(r.key,r.attributes)&&s.push(r.key);return s}reduceNodes(e,t){if(typeof e!="function")throw new nt("Graph.reduceNodes: expecting a callback.");if(arguments.length<2)throw new nt("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 i=t;const r=this._nodes.values();let s,a;for(;s=r.next(),s.done!==!0;)a=s.value,i=e(i,a.key,a.attributes);return i}nodeEntries(){const e=this._nodes.values();return new Hs(()=>{const t=e.next();if(t.done)return t;const i=t.value;return{value:{node:i.key,attributes:i.attributes},done:!1}})}export(){const e=new Array(this._nodes.size);let t=0;this._nodes.forEach((r,s)=>{e[t++]=EX(s,r)});const i=new Array(this._edges.size);return t=0,this._edges.forEach((r,s)=>{i[t++]=SX(this.type,s,r)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:i}}import(e,t=!1){if(e instanceof In)return e.forEachNode((l,c)=>{t?this.mergeNode(l,c):this.addNode(l,c)}),e.forEachEdge((l,c,u,h,f,p,m)=>{t?m?this.mergeUndirectedEdgeWithKey(l,u,h,c):this.mergeDirectedEdgeWithKey(l,u,h,c):m?this.addUndirectedEdgeWithKey(l,u,h,c):this.addDirectedEdgeWithKey(l,u,h,c)}),this;if(!ji(e))throw new nt("Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.");if(e.attributes){if(!ji(e.attributes))throw new nt("Graph.import: invalid attributes. Expecting a plain object.");t?this.mergeAttributes(e.attributes):this.replaceAttributes(e.attributes)}let i,r,s,a,o;if(e.nodes){if(s=e.nodes,!Array.isArray(s))throw new nt("Graph.import: invalid nodes. Expecting an array.");for(i=0,r=s.length;i{const s=Mi({},i.attributes);i=new t.NodeDataClass(r,s),t._nodes.set(r,i)}),t}copy(e){if(e=e||{},typeof e.type=="string"&&e.type!==this.type&&e.type!=="mixed")throw new xt(`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 xt("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 xt("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),i=this._edges.values();let r,s;for(;r=i.next(),r.done!==!0;)s=r.value,KI(t,"copy",!1,s.undirected,s.key,s.source.key,s.target.key,Mi({},s.attributes));return t}toJSON(){return this.export()}toString(){return"[object Graph]"}inspect(){const e={};this._nodes.forEach((s,a)=>{e[a]=s.attributes});const t={},i={};this._edges.forEach((s,a)=>{const o=s.undirected?"--":"->";let l="",c=s.source.key,u=s.target.key,h;s.undirected&&c>u&&(h=c,c=u,u=h);const f=`(${c})${o}(${u})`;a.startsWith("geid_")?this.multi&&(typeof i[f]>"u"?i[f]=0:i[f]++,l+=`${i[f]}. `):l+=`[${a}]: `,l+=f,t[l]=s.attributes});const r={};for(const s in this)this.hasOwnProperty(s)&&!j7.has(s)&&typeof this[s]!="function"&&typeof s!="symbol"&&(r[s]=this[s]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,Rs(r,"constructor",this.constructor),r}}typeof Symbol<"u"&&(In.prototype[Symbol.for("nodejs.util.inspect.custom")]=In.prototype.inspect);IX.forEach(n=>{["add","merge","update"].forEach(e=>{const t=n.name(e),i=e==="add"?KI:BX;n.generateKey?In.prototype[t]=function(r,s,a){return i(this,t,!0,(n.type||this.type)==="undirected",null,r,s,a,e==="update")}:In.prototype[t]=function(r,s,a,o){return i(this,t,!1,(n.type||this.type)==="undirected",r,s,a,o,e==="update")}})});Gq(In);$q(In);dX(In);_X(In);class $I extends In{constructor(e){const t=Mi({type:"directed"},e);if("multi"in t&&t.multi!==!1)throw new nt("DirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="directed")throw new nt('DirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class JI extends In{constructor(e){const t=Mi({type:"undirected"},e);if("multi"in t&&t.multi!==!1)throw new nt("UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!");if(t.type!=="undirected")throw new nt('UndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class ZI extends In{constructor(e){const t=Mi({multi:!0},e);if("multi"in t&&t.multi!==!0)throw new nt("MultiGraph.from: inconsistent indication that the graph should be simple in given options!");super(t)}}class eM extends In{constructor(e){const t=Mi({type:"directed",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new nt("MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="directed")throw new nt('MultiDirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}class tM extends In{constructor(e){const t=Mi({type:"undirected",multi:!0},e);if("multi"in t&&t.multi!==!0)throw new nt("MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!");if(t.type!=="undirected")throw new nt('MultiUndirectedGraph.from: inconsistent "'+t.type+'" type in given options!');super(t)}}function Af(n){n.from=function(e,t){const i=Mi({},e.options,t),r=new n(i);return r.import(e),r}}Af(In);Af($I);Af(JI);Af(ZI);Af(eM);Af(tM);In.Graph=In;In.DirectedGraph=$I;In.UndirectedGraph=JI;In.MultiGraph=ZI;In.MultiDirectedGraph=eM;In.MultiUndirectedGraph=tM;In.InvalidArgumentsGraphError=nt;In.NotFoundGraphError=qe;In.UsageGraphError=xt;const T0=new N,k4=new N,DX=new N;function PX(n,e,t){const i=T0.setFromMatrixPosition(n.matrixWorld);i.project(e);const r=t.width/2,s=t.height/2;return[i.x*r+r,-(i.y*s)+s]}function LX(n,e){const t=T0.setFromMatrixPosition(n.matrixWorld),i=k4.setFromMatrixPosition(e.matrixWorld),r=t.sub(i),s=e.getWorldDirection(DX);return r.angleTo(s)>Math.PI/2}function UX(n,e,t,i){const r=T0.setFromMatrixPosition(n.matrixWorld),s=r.clone();s.project(e),t.setFromCamera(s,e);const a=t.intersectObjects(i,!0);if(a.length){const o=a[0].distance;return r.distanceTo(t.ray.origin)Math.abs(n)<1e-10?0:n;function nM(n,e,t=""){let i="matrix3d(";for(let r=0;r!==16;r++)i+=by(e[r]*n.elements[r])+(r!==15?",":")");return t+i}const kX=(n=>e=>nM(e,n))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),NX=(n=>(e,t)=>nM(e,n(t),"translate(-50%,-50%)"))(n=>[1/n,1/n,1/n,1,-1/n,-1/n,-1/n,-1,1/n,1/n,1/n,1,1,1,1,1]);function GX(n){return n&&typeof n=="object"&&"current"in n}const N4=$.forwardRef(({children:n,eps:e=.001,style:t,className:i,prepend:r,center:s,fullscreen:a,portal:o,distanceFactor:l,sprite:c=!1,transform:u=!1,occlude:h,onOcclude:f,castShadow:p,receiveShadow:m,material:y,geometry:v,zIndexRange:A=[16777271,0],calculatePosition:_=PX,as:x="div",wrapperClass:E,pointerEvents:w="auto",...I},T)=>{const{gl:M,camera:b,scene:B,size:L,raycaster:U,events:O,viewport:Q}=Cr(),[G]=$.useState(()=>document.createElement(x)),F=$.useRef(),q=$.useRef(null),Y=$.useRef(0),H=$.useRef([0,0]),V=$.useRef(null),D=$.useRef(null),k=(o==null?void 0:o.current)||O.connected||M.domElement.parentNode,Z=$.useRef(null),j=$.useRef(!1),ee=$.useMemo(()=>h&&h!=="blending"||Array.isArray(h)&&h.length&&GX(h[0]),[h]);$.useLayoutEffect(()=>{const ye=M.domElement;h&&h==="blending"?(ye.style.zIndex=`${Math.floor(A[0]/2)}`,ye.style.position="absolute",ye.style.pointerEvents="none"):(ye.style.zIndex=null,ye.style.position=null,ye.style.pointerEvents=null)},[h]),$.useLayoutEffect(()=>{if(q.current){const ye=F.current=nP(G);if(B.updateMatrixWorld(),u)G.style.cssText="position:absolute;top:0;left:0;pointer-events:none;overflow:hidden;";else{const oe=_(q.current,b,L);G.style.cssText=`position:absolute;top:0;left:0;transform:translate3d(${oe[0]}px,${oe[1]}px,0);transform-origin:0 0;`}return k&&(r?k.prepend(G):k.appendChild(G)),()=>{k&&k.removeChild(G),ye.unmount()}}},[k,u]),$.useLayoutEffect(()=>{E&&(G.className=E)},[E]);const ie=$.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",...a&&{top:-L.height/2,left:-L.width/2,width:L.width,height:L.height},...t},[t,s,a,L,u]),te=$.useMemo(()=>({position:"absolute",pointerEvents:w}),[w]);$.useLayoutEffect(()=>{if(j.current=!1,u){var ye;(ye=F.current)==null||ye.render($.createElement("div",{ref:V,style:ie},$.createElement("div",{ref:D,style:te},$.createElement("div",{ref:T,className:i,style:t,children:n}))))}else{var oe;(oe=F.current)==null||oe.render($.createElement("div",{ref:T,style:ie,className:i,children:n}))}});const re=$.useRef(!0);a1(ye=>{if(q.current){b.updateMatrixWorld(),q.current.updateWorldMatrix(!0,!1);const oe=u?H.current:_(q.current,b,L);if(u||Math.abs(Y.current-b.zoom)>e||Math.abs(H.current[0]-oe[0])>e||Math.abs(H.current[1]-oe[1])>e){const W=LX(q.current,b);let ge=!1;ee&&(h!=="blending"?ge=[B]:Array.isArray(h)&&(ge=h.map(Pe=>Pe.current)));const he=re.current;if(ge){const Pe=UX(q.current,b,U,ge);re.current=Pe&&!W}else re.current=!W;he!==re.current&&(f?f(!re.current):G.style.display=re.current?"block":"none");const ue=Math.floor(A[0]/2),fe=h?ee?[A[0],ue]:[ue-1,0]:A;if(G.style.zIndex=`${FX(q.current,b,fe)}`,u){const[Pe,pe]=[L.width/2,L.height/2],Re=b.projectionMatrix.elements[5]*pe,{isOrthographicCamera:Le,top:Se,left:$e,bottom:X,right:z}=b,se=kX(b.matrixWorldInverse),Be=Le?`scale(${Re})translate(${by(-(z+$e)/2)}px,${by((Se+X)/2)}px)`:`translateZ(${Re}px)`;let Ce=q.current.matrixWorld;c&&(Ce=b.matrixWorldInverse.clone().transpose().copyPosition(Ce).scale(q.current.scale),Ce.elements[3]=Ce.elements[7]=Ce.elements[11]=0,Ce.elements[15]=1),G.style.width=L.width+"px",G.style.height=L.height+"px",G.style.perspective=Le?"":`${Re}px`,V.current&&D.current&&(V.current.style.transform=`${Be}${se}translate(${Pe}px,${pe}px)`,D.current.style.transform=NX(Ce,1/((l||10)/400)))}else{const Pe=l===void 0?1:OX(q.current,b)*l;G.style.transform=`translate3d(${oe[0]}px,${oe[1]}px,0) scale(${Pe})`}H.current=oe,Y.current=b.zoom}}if(!ee&&Z.current&&!j.current)if(u){if(V.current){const oe=V.current.children[0];if(oe!=null&&oe.clientWidth&&oe!=null&&oe.clientHeight){const{isOrthographicCamera:W}=b;if(W||v)I.scale&&(Array.isArray(I.scale)?I.scale instanceof N?Z.current.scale.copy(I.scale.clone().divideScalar(1)):Z.current.scale.set(1/I.scale[0],1/I.scale[1],1/I.scale[2]):Z.current.scale.setScalar(1/I.scale));else{const ge=(l||10)/400,he=oe.clientWidth*ge,ue=oe.clientHeight*ge;Z.current.scale.set(he,ue,1)}j.current=!0}}}else{const oe=G.children[0];if(oe!=null&&oe.clientWidth&&oe!=null&&oe.clientHeight){const W=1/Q.factor,ge=oe.clientWidth*W,he=oe.clientHeight*W;Z.current.scale.set(ge,he,1),j.current=!0}Z.current.lookAt(ye.camera.position)}});const ce=$.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 $.createElement("group",ou({},I,{ref:q}),h&&!ee&&$.createElement("mesh",{castShadow:p,receiveShadow:m,ref:Z},v||$.createElement("planeGeometry",null),y||$.createElement("shaderMaterial",{side:$n,vertexShader:ce.vertexShader,fragmentShader:ce.fragmentShader})))});function np(n,e="pointer",t="auto"){$.useEffect(()=>{if(n)return document.body.style.cursor=e,()=>void(document.body.style.cursor=t)},[n])}function zX(n){return function(e){n.forEach(function(t){typeof t=="function"?t(e):t!=null&&(t.current=e)})}}let G4=I0();const Pt=n=>b0(n,G4);let z4=I0();Pt.write=n=>b0(n,z4);let v1=I0();Pt.onStart=n=>b0(n,v1);let Q4=I0();Pt.onFrame=n=>b0(n,Q4);let H4=I0();Pt.onFinish=n=>b0(n,H4);let Nh=[];Pt.setTimeout=(n,e)=>{let t=Pt.now()+e,i=()=>{let s=Nh.findIndex(a=>a.cancel==i);~s&&Nh.splice(s,1),Ml-=~s?1:0},r={time:t,handler:n,cancel:i};return Nh.splice(iM(t),0,r),Ml+=1,rM(),r};let iM=n=>~(~Nh.findIndex(e=>e.time>n)||~Nh.length);Pt.cancel=n=>{v1.delete(n),Q4.delete(n),H4.delete(n),G4.delete(n),z4.delete(n)};Pt.sync=n=>{Iy=!0,Pt.batchedUpdates(n),Iy=!1};Pt.throttle=n=>{let e;function t(){try{n(...e)}finally{e=null}}function i(...r){e=r,Pt.onStart(t)}return i.handler=n,i.cancel=()=>{v1.delete(t),e=null},i};let V4=typeof window<"u"?window.requestAnimationFrame:()=>{};Pt.use=n=>V4=n;Pt.now=typeof performance<"u"?()=>performance.now():Date.now;Pt.batchedUpdates=n=>n();Pt.catch=console.error;Pt.frameLoop="always";Pt.advance=()=>{Pt.frameLoop!=="demand"?console.warn("Cannot call the manual advancement of rafz whilst frameLoop is not set as demand"):aM()};let Il=-1,Ml=0,Iy=!1;function b0(n,e){Iy?(e.delete(n),n(0)):(e.add(n),rM())}function rM(){Il<0&&(Il=0,Pt.frameLoop!=="demand"&&V4(sM))}function QX(){Il=-1}function sM(){~Il&&(V4(sM),Pt.batchedUpdates(aM))}function aM(){let n=Il;Il=Pt.now();let e=iM(Il);if(e&&(oM(Nh.splice(0,e),t=>t.handler()),Ml-=e),!Ml){QX();return}v1.flush(),G4.flush(n?Math.min(64,Il-n):16.667),Q4.flush(),z4.flush(),H4.flush()}function I0(){let n=new Set,e=n;return{add(t){Ml+=e==n&&!n.has(t)?1:0,n.add(t)},delete(t){return Ml-=e==n&&n.has(t)?1:0,n.delete(t)},flush(t){e.size&&(n=new Set,Ml-=e.size,oM(e,i=>i(t)&&n.add(i)),Ml+=n.size,e=n)}}}function oM(n,e){n.forEach(t=>{try{e(t)}catch(i){Pt.catch(i)}})}function My(){}const HX=(n,e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0}),Ke={arr:Array.isArray,obj:n=>!!n&&n.constructor.name==="Object",fun:n=>typeof n=="function",str:n=>typeof n=="string",num:n=>typeof n=="number",und:n=>n===void 0};function Lo(n,e){if(Ke.arr(n)){if(!Ke.arr(e)||n.length!==e.length)return!1;for(let t=0;tn.forEach(e);function Ho(n,e,t){if(Ke.arr(n)){for(let i=0;iKe.und(n)?[]:Ke.arr(n)?n:[n];function ip(n,e){if(n.size){const t=Array.from(n);n.clear(),xn(t,e)}}const Hd=(n,...e)=>ip(n,t=>t(...e)),W4=()=>typeof window>"u"||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent);let Y4,lM,Ul=null,cM=!1,q4=My;const VX=n=>{n.to&&(lM=n.to),n.now&&(Pt.now=n.now),n.colors!==void 0&&(Ul=n.colors),n.skipAnimation!=null&&(cM=n.skipAnimation),n.createStringInterpolator&&(Y4=n.createStringInterpolator),n.requestAnimationFrame&&Pt.use(n.requestAnimationFrame),n.batchedUpdates&&(Pt.batchedUpdates=n.batchedUpdates),n.willAdvance&&(q4=n.willAdvance),n.frameLoop&&(Pt.frameLoop=n.frameLoop)};var eo=Object.freeze({__proto__:null,get createStringInterpolator(){return Y4},get to(){return lM},get colors(){return Ul},get skipAnimation(){return cM},get willAdvance(){return q4},assign:VX});const rp=new Set;let ks=[],qv=[],$m=0;const y1={get idle(){return!rp.size&&!ks.length},start(n){$m>n.priority?(rp.add(n),Pt.onStart(WX)):(uM(n),Pt(Ry))},advance:Ry,sort(n){if($m)Pt.onFrame(()=>y1.sort(n));else{const e=ks.indexOf(n);~e&&(ks.splice(e,1),hM(n))}},clear(){ks=[],rp.clear()}};function WX(){rp.forEach(uM),rp.clear(),Pt(Ry)}function uM(n){ks.includes(n)||hM(n)}function hM(n){ks.splice(YX(ks,e=>e.priority>n.priority),0,n)}function Ry(n){const e=qv;for(let t=0;t0}function YX(n,e){const t=n.findIndex(e);return t<0?n.length:t}const qX=(n,e,t)=>Math.min(Math.max(t,n),e),XX={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},ca="[-+]?\\d*\\.?\\d+",Jm=ca+"%";function x1(...n){return"\\(\\s*("+n.join(")\\s*,\\s*(")+")\\s*\\)"}const jX=new RegExp("rgb"+x1(ca,ca,ca)),KX=new RegExp("rgba"+x1(ca,ca,ca,ca)),$X=new RegExp("hsl"+x1(ca,Jm,Jm)),JX=new RegExp("hsla"+x1(ca,Jm,Jm,ca)),ZX=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ej=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,tj=/^#([0-9a-fA-F]{6})$/,nj=/^#([0-9a-fA-F]{8})$/;function ij(n){let e;return typeof n=="number"?n>>>0===n&&n>=0&&n<=4294967295?n:null:(e=tj.exec(n))?parseInt(e[1]+"ff",16)>>>0:Ul&&Ul[n]!==void 0?Ul[n]:(e=jX.exec(n))?(fh(e[1])<<24|fh(e[2])<<16|fh(e[3])<<8|255)>>>0:(e=KX.exec(n))?(fh(e[1])<<24|fh(e[2])<<16|fh(e[3])<<8|Z7(e[4]))>>>0:(e=ZX.exec(n))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+"ff",16)>>>0:(e=nj.exec(n))?parseInt(e[1],16)>>>0:(e=ej.exec(n))?parseInt(e[1]+e[1]+e[2]+e[2]+e[3]+e[3]+e[4]+e[4],16)>>>0:(e=$X.exec(n))?($7(J7(e[1]),Og(e[2]),Og(e[3]))|255)>>>0:(e=JX.exec(n))?($7(J7(e[1]),Og(e[2]),Og(e[3]))|Z7(e[4]))>>>0:null}function Xv(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function $7(n,e,t){const i=t<.5?t*(1+e):t+e-t*e,r=2*t-i,s=Xv(r,i,n+1/3),a=Xv(r,i,n),o=Xv(r,i,n-1/3);return Math.round(s*255)<<24|Math.round(a*255)<<16|Math.round(o*255)<<8}function fh(n){const e=parseInt(n,10);return e<0?0:e>255?255:e}function J7(n){return(parseFloat(n)%360+360)%360/360}function Z7(n){const e=parseFloat(n);return e<0?0:e>1?255:Math.round(e*255)}function Og(n){const e=parseFloat(n);return e<0?0:e>100?1:e/100}function eS(n){let e=ij(n);if(e===null)return n;e=e||0;let t=(e&4278190080)>>>24,i=(e&16711680)>>>16,r=(e&65280)>>>8,s=(e&255)/255;return`rgba(${t}, ${i}, ${r}, ${s})`}const Yp=(n,e,t)=>{if(Ke.fun(n))return n;if(Ke.arr(n))return Yp({range:n,output:e,extrapolate:t});if(Ke.str(n.output[0]))return Y4(n);const i=n,r=i.output,s=i.range||[0,1],a=i.extrapolateLeft||i.extrapolate||"extend",o=i.extrapolateRight||i.extrapolate||"extend",l=i.easing||(c=>c);return c=>{const u=sj(c,s);return rj(c,s[u],s[u+1],r[u],r[u+1],l,a,o,i.map)}};function rj(n,e,t,i,r,s,a,o,l){let c=l?l(n):n;if(ct){if(o==="identity")return c;o==="clamp"&&(c=t)}return i===r?i:e===t?n<=e?i:r:(e===-1/0?c=-c:t===1/0?c=c-e:c=(c-e)/(t-e),c=s(c),i===-1/0?c=-c:r===1/0?c=c+i:c=c*(r-i)+i,c)}function sj(n,e){for(var t=1;t=n);++t);return t-1}const aj=(n,e="end")=>t=>{t=e==="end"?Math.min(t,.999):Math.max(t,.001);const i=t*n,r=e==="end"?Math.floor(i):Math.ceil(i);return qX(0,1,r/n)},Zm=1.70158,Fg=Zm*1.525,tS=Zm+1,nS=2*Math.PI/3,iS=2*Math.PI/4.5,kg=n=>n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375,oj={linear:n=>n,easeInQuad:n=>n*n,easeOutQuad:n=>1-(1-n)*(1-n),easeInOutQuad:n=>n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2,easeInCubic:n=>n*n*n,easeOutCubic:n=>1-Math.pow(1-n,3),easeInOutCubic:n=>n<.5?4*n*n*n:1-Math.pow(-2*n+2,3)/2,easeInQuart:n=>n*n*n*n,easeOutQuart:n=>1-Math.pow(1-n,4),easeInOutQuart:n=>n<.5?8*n*n*n*n:1-Math.pow(-2*n+2,4)/2,easeInQuint:n=>n*n*n*n*n,easeOutQuint:n=>1-Math.pow(1-n,5),easeInOutQuint:n=>n<.5?16*n*n*n*n*n:1-Math.pow(-2*n+2,5)/2,easeInSine:n=>1-Math.cos(n*Math.PI/2),easeOutSine:n=>Math.sin(n*Math.PI/2),easeInOutSine:n=>-(Math.cos(Math.PI*n)-1)/2,easeInExpo:n=>n===0?0:Math.pow(2,10*n-10),easeOutExpo:n=>n===1?1:1-Math.pow(2,-10*n),easeInOutExpo:n=>n===0?0:n===1?1:n<.5?Math.pow(2,20*n-10)/2:(2-Math.pow(2,-20*n+10))/2,easeInCirc:n=>1-Math.sqrt(1-Math.pow(n,2)),easeOutCirc:n=>Math.sqrt(1-Math.pow(n-1,2)),easeInOutCirc:n=>n<.5?(1-Math.sqrt(1-Math.pow(2*n,2)))/2:(Math.sqrt(1-Math.pow(-2*n+2,2))+1)/2,easeInBack:n=>tS*n*n*n-Zm*n*n,easeOutBack:n=>1+tS*Math.pow(n-1,3)+Zm*Math.pow(n-1,2),easeInOutBack:n=>n<.5?Math.pow(2*n,2)*((Fg+1)*2*n-Fg)/2:(Math.pow(2*n-2,2)*((Fg+1)*(n*2-2)+Fg)+2)/2,easeInElastic:n=>n===0?0:n===1?1:-Math.pow(2,10*n-10)*Math.sin((n*10-10.75)*nS),easeOutElastic:n=>n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n*10-.75)*nS)+1,easeInOutElastic:n=>n===0?0:n===1?1:n<.5?-(Math.pow(2,20*n-10)*Math.sin((20*n-11.125)*iS))/2:Math.pow(2,-20*n+10)*Math.sin((20*n-11.125)*iS)/2+1,easeInBounce:n=>1-kg(1-n),easeOutBounce:kg,easeInOutBounce:n=>n<.5?(1-kg(1-2*n))/2:(1+kg(2*n-1))/2,steps:aj};function By(){return By=Object.assign?Object.assign.bind():function(n){for(var e=1;e!!(n&&n[Jh]),Ls=n=>n&&n[Jh]?n[Jh]():n,rS=n=>n[uu]||null;function lj(n,e){n.eventObserved?n.eventObserved(e):n(e)}function e2(n,e){let t=n[uu];t&&t.forEach(i=>{lj(i,e)})}class cj{constructor(e){if(this[Jh]=void 0,this[uu]=void 0,!e&&!(e=this.get))throw Error("Unknown getter");uj(this,e)}}const uj=(n,e)=>fM(n,Jh,e);function M0(n,e){if(n[Jh]){let t=n[uu];t||fM(n,uu,t=new Set),t.has(e)||(t.add(e),n.observerAdded&&n.observerAdded(t.size,e))}return e}function t2(n,e){let t=n[uu];if(t&&t.has(e)){const i=t.size-1;i?t.delete(e):n[uu]=null,n.observerRemoved&&n.observerRemoved(i,e)}}const fM=(n,e,t)=>Object.defineProperty(n,e,{value:t,writable:!0,configurable:!0}),vm=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,hj=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,sS=new RegExp(`(${vm.source})(%|[a-z]+)`,"i"),fj=/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,_1=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/,dM=n=>{const[e,t]=dj(n);if(!e||W4())return n;const i=window.getComputedStyle(document.documentElement).getPropertyValue(e);if(i)return i.trim();if(t&&t.startsWith("--")){const r=window.getComputedStyle(document.documentElement).getPropertyValue(t);return r||n}else{if(t&&_1.test(t))return dM(t);if(t)return t}return n},dj=n=>{const e=_1.exec(n);if(!e)return[,];const[,t,i]=e;return[t,i]};let jv;const pj=(n,e,t,i,r)=>`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(i)}, ${r})`,pM=n=>{jv||(jv=Ul?new RegExp(`(${Object.keys(Ul).join("|")})(?!\\w)`,"g"):/^\b$/);const e=n.output.map(s=>Ls(s).replace(_1,dM).replace(hj,eS).replace(jv,eS)),t=e.map(s=>s.match(vm).map(Number)),r=t[0].map((s,a)=>t.map(o=>{if(!(a in o))throw Error('The arity of each "output" value must be equal');return o[a]})).map(s=>Yp(By({},n,{output:s})));return s=>{var a;const o=!sS.test(e[0])&&((a=e.find(c=>sS.test(c)))==null?void 0:a.replace(vm,""));let l=0;return e[0].replace(vm,()=>`${r[l++](s)}${o||""}`).replace(fj,pj)}},X4="react-spring: ",gM=n=>{const e=n;let t=!1;if(typeof e!="function")throw new TypeError(`${X4}once requires a function parameter`);return(...i)=>{t||(e(...i),t=!0)}},gj=gM(console.warn);function mj(){gj(`${X4}The "interpolate" function is deprecated in v9 (use "to" instead)`)}const Aj=gM(console.warn);function vj(){Aj(`${X4}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 E1(n){return Ke.str(n)&&(n[0]=="#"||/\d/.test(n)||!W4()&&_1.test(n)||n in(Ul||{}))}const j4=W4()?$.useEffect:$.useLayoutEffect,yj=()=>{const n=$.useRef(!1);return j4(()=>(n.current=!0,()=>{n.current=!1}),[]),n};function mM(){const n=$.useState()[1],e=yj();return()=>{e.current&&n(Math.random())}}function xj(n,e){const[t]=$.useState(()=>({inputs:e,result:n()})),i=$.useRef(),r=i.current;let s=r;return s?e&&s.inputs&&_j(e,s.inputs)||(s={inputs:e,result:n()}):s=t,$.useEffect(()=>{i.current=s,r==t&&(t.inputs=t.result=void 0)},[s]),s.result}function _j(n,e){if(n.length!==e.length)return!1;for(let t=0;t$.useEffect(n,Ej),Ej=[];function aS(n){const e=$.useRef();return $.useEffect(()=>{e.current=n}),e.current}const qp=Symbol.for("Animated:node"),Sj=n=>!!n&&n[qp]===n,ka=n=>n&&n[qp],K4=(n,e)=>HX(n,qp,e),S1=n=>n&&n[qp]&&n[qp].getPayload();class vM{constructor(){this.payload=void 0,K4(this,this)}getPayload(){return this.payload||[]}}class vf extends vM{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,Ke.num(this._value)&&(this.lastPosition=this._value)}static create(e){return new vf(e)}getPayload(){return[this]}getValue(){return this._value}setValue(e,t){return Ke.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,Ke.num(this._value)&&(this.elapsedTime=0,this.durationProgress=0,this.lastPosition=this._value,e&&(this.lastVelocity=null),this.v0=null)}}class Zh extends vf{constructor(e){super(0),this._string=null,this._toString=void 0,this._toString=Yp({output:[e,e]})}static create(e){return new Zh(e)}getValue(){let e=this._string;return e??(this._string=this._toString(this._value))}setValue(e){if(Ke.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=Yp({output:[this.getValue(),e]})),this._value=0,super.reset()}}const n2={dependencies:null};class $4 extends vM{constructor(e){super(),this.source=e,this.setValue(e)}getValue(e){const t={};return Ho(this.source,(i,r)=>{Sj(i)?t[r]=i.getValue(e):Na(i)?t[r]=Ls(i):e||(t[r]=i)}),t}setValue(e){this.source=e,this.payload=this._makePayload(e)}reset(){this.payload&&xn(this.payload,e=>e.reset())}_makePayload(e){if(e){const t=new Set;return Ho(e,this._addToPayload,t),Array.from(t)}}_addToPayload(e){n2.dependencies&&Na(e)&&n2.dependencies.add(e);const t=S1(e);t&&xn(t,i=>this.add(i))}}class J4 extends $4{constructor(e){super(e)}static create(e){return new J4(e)}getValue(){return this.source.map(e=>e.getValue())}setValue(e){const t=this.getPayload();return e.length==t.length?t.map((i,r)=>i.setValue(e[r])).some(Boolean):(super.setValue(e.map(wj)),!0)}}function wj(n){return(E1(n)?Zh:vf).create(n)}function Dy(n){const e=ka(n);return e?e.constructor:Ke.arr(n)?J4:E1(n)?Zh:vf}function i2(){return i2=Object.assign?Object.assign.bind():function(n){for(var e=1;e{const t=!Ke.fun(n)||n.prototype&&n.prototype.isReactComponent;return $.forwardRef((i,r)=>{const s=$.useRef(null),a=t&&$.useCallback(m=>{s.current=bj(r,m)},[r]),[o,l]=Tj(i,e),c=mM(),u=()=>{const m=s.current;if(t&&!m)return;(m?e.applyAnimatedValues(m,o.getValue(!0)):!1)===!1&&c()},h=new Cj(u,l),f=$.useRef();j4(()=>(f.current=h,xn(l,m=>M0(m,h)),()=>{f.current&&(xn(f.current.deps,m=>t2(m,f.current)),Pt.cancel(f.current.update))})),$.useEffect(u,[]),AM(()=>()=>{const m=f.current;xn(m.deps,y=>t2(y,m))});const p=e.getComponentProps(o.getValue());return $.createElement(n,i2({},p,{ref:a}))})};class Cj{constructor(e,t){this.update=e,this.deps=t}eventObserved(e){e.type=="change"&&Pt.write(this.update)}}function Tj(n,e){const t=new Set;return n2.dependencies=t,n.style&&(n=i2({},n,{style:e.createAnimatedStyle(n.style)})),n=new $4(n),n2.dependencies=null,[n,t]}function bj(n,e){return n&&(Ke.fun(n)?n(e):n.current=e),e}const lS=Symbol.for("AnimatedComponent"),Ij=(n,{applyAnimatedValues:e=()=>!1,createAnimatedStyle:t=r=>new $4(r),getComponentProps:i=r=>r}={})=>{const r={applyAnimatedValues:e,createAnimatedStyle:t,getComponentProps:i},s=a=>{const o=cS(a)||"Anonymous";return Ke.str(a)?a=s[a]||(s[a]=oS(a,r)):a=a[lS]||(a[lS]=oS(a,r)),a.displayName=`Animated(${o})`,a};return Ho(n,(a,o)=>{Ke.arr(n)&&(o=cS(a)),s[o]=s(a)}),{animated:s}},cS=n=>Ke.str(n)?n:n&&Ke.str(n.displayName)?n.displayName:Ke.fun(n)&&n.name||null;function Hi(){return Hi=Object.assign?Object.assign.bind():function(n){for(var e=1;en===!0||!!(e&&n&&(Ke.fun(n)?n(e):Ns(n).includes(e))),yM=(n,e)=>Ke.obj(n)?e&&n[e]:n,xM=(n,e)=>n.default===!0?n[e]:n.default?n.default[e]:void 0,Mj=n=>n,Z4=(n,e=Mj)=>{let t=Rj;n.default&&n.default!==!0&&(n=n.default,t=Object.keys(n));const i={};for(const r of t){const s=e(n[r],r);Ke.und(s)||(i[r]=s)}return i},Rj=["config","onProps","onStart","onChange","onPause","onResume","onRest"],Bj={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 Dj(n){const e={};let t=0;if(Ho(n,(i,r)=>{Bj[r]||(e[r]=i,t++)}),t)return e}function _M(n){const e=Dj(n);if(e){const t={to:e};return Ho(n,(i,r)=>r in e||(t[r]=i)),t}return Hi({},n)}function Xp(n){return n=Ls(n),Ke.arr(n)?n.map(Xp):E1(n)?eo.createStringInterpolator({range:[0,1],output:[n,n]})(1):n}function Pj(n){for(const e in n)return!0;return!1}function Py(n){return Ke.fun(n)||Ke.arr(n)&&Ke.obj(n[0])}function Lj(n,e){var t;(t=n.ref)==null||t.delete(n),e==null||e.delete(n)}function Uj(n,e){if(e&&n.ref!==e){var t;(t=n.ref)==null||t.delete(n),e.add(n),n.ref=e}}const Oj={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},Ly=Hi({},Oj.default,{mass:1,damping:1,easing:oj.linear,clamp:!1});class Fj{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,Ly)}}function kj(n,e,t){t&&(t=Hi({},t),uS(t,e),e=Hi({},t,e)),uS(n,e),Object.assign(n,e);for(const a in Ly)n[a]==null&&(n[a]=Ly[a]);let{mass:i,frequency:r,damping:s}=n;return Ke.und(r)||(r<.01&&(r=.01),s<0&&(s=0),n.tension=Math.pow(2*Math.PI/r,2)*i,n.friction=4*Math.PI*s*i/r),n}function uS(n,e){if(!Ke.und(e.decay))n.duration=void 0;else{const t=!Ke.und(e.tension)||!Ke.und(e.friction);(t||!Ke.und(e.frequency)||!Ke.und(e.damping)||!Ke.und(e.mass))&&(n.duration=void 0,n.decay=void 0),t&&(n.frequency=void 0)}}const hS=[];class Nj{constructor(){this.changed=!1,this.values=hS,this.toValues=null,this.fromValues=hS,this.to=void 0,this.from=void 0,this.config=new Fj,this.immediate=!1}}function EM(n,{key:e,props:t,defaultProps:i,state:r,actions:s}){return new Promise((a,o)=>{var l;let c,u,h=sp((l=t.cancel)!=null?l:i==null?void 0:i.cancel,e);if(h)m();else{Ke.und(t.pause)||(r.paused=sp(t.pause,e));let y=i==null?void 0:i.pause;y!==!0&&(y=r.paused||sp(y,e)),c=Gc(t.delay||0,e),y?(r.resumeQueue.add(p),s.pause()):(s.resume(),p())}function f(){r.resumeQueue.add(p),r.timeouts.delete(u),u.cancel(),c=u.time-Pt.now()}function p(){c>0&&!eo.skipAnimation?(r.delayed=!0,u=Pt.setTimeout(m,c),r.pauseQueue.add(f),r.timeouts.add(u)):m()}function m(){r.delayed&&(r.delayed=!1),r.pauseQueue.delete(f),r.timeouts.delete(u),n<=(r.cancelId||0)&&(h=!0);try{s.start(Hi({},t,{callId:n,cancel:h}),a)}catch(y){o(y)}}})}const e8=(n,e)=>e.length==1?e[0]:e.some(t=>t.cancelled)?Gh(n.get()):e.every(t=>t.noop)?SM(n.get()):oa(n.get(),e.every(t=>t.finished)),SM=n=>({value:n,noop:!0,finished:!0,cancelled:!1}),oa=(n,e,t=!1)=>({value:n,finished:e,cancelled:t}),Gh=n=>({value:n,cancelled:!0,finished:!1});function wM(n,e,t,i){const{callId:r,parentId:s,onRest:a}=e,{asyncTo:o,promise:l}=t;return!s&&n===o&&!e.reset?l:t.promise=(async()=>{t.asyncId=r,t.asyncTo=n;const c=Z4(e,(v,A)=>A==="onRest"?void 0:v);let u,h;const f=new Promise((v,A)=>(u=v,h=A)),p=v=>{const A=r<=(t.cancelId||0)&&Gh(i)||r!==t.asyncId&&oa(i,!1);if(A)throw v.result=A,h(v),v},m=(v,A)=>{const _=new fS,x=new dS;return(async()=>{if(eo.skipAnimation)throw jp(t),x.result=oa(i,!1),h(x),x;p(_);const E=Ke.obj(v)?Hi({},v):Hi({},A,{to:v});E.parentId=r,Ho(c,(I,T)=>{Ke.und(E[T])&&(E[T]=I)});const w=await i.start(E);return p(_),t.paused&&await new Promise(I=>{t.resumeQueue.add(I)}),w})()};let y;if(eo.skipAnimation)return jp(t),oa(i,!1);try{let v;Ke.arr(n)?v=(async A=>{for(const _ of A)await m(_)})(n):v=Promise.resolve(n(m,i.stop.bind(i))),await Promise.all([v.then(u),f]),y=oa(i.get(),!0,!1)}catch(v){if(v instanceof fS)y=v.result;else if(v instanceof dS)y=v.result;else throw v}finally{r==t.asyncId&&(t.asyncId=s,t.asyncTo=s?o:void 0,t.promise=s?l:void 0)}return Ke.fun(a)&&Pt.batchedUpdates(()=>{a(y,i,i.item)}),y})()}function jp(n,e){ip(n.timeouts,t=>t.cancel()),n.pauseQueue.clear(),n.resumeQueue.clear(),n.asyncId=n.asyncTo=n.promise=void 0,e&&(n.cancelId=e)}class fS 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 dS extends Error{constructor(){super("SkipAnimationSignal"),this.result=void 0}}const Uy=n=>n instanceof t8;let Gj=1;class t8 extends cj{constructor(...e){super(...e),this.id=Gj++,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=ka(this);return e&&e.getValue()}to(...e){return eo.to(this,e)}interpolate(...e){return mj(),eo.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){e2(this,{type:"change",parent:this,value:e,idle:t})}_onPriorityChange(e){this.idle||y1.sort(this),e2(this,{type:"priority",parent:this,priority:e})}}const hu=Symbol.for("SpringPhase"),CM=1,Oy=2,Fy=4,Kv=n=>(n[hu]&CM)>0,Al=n=>(n[hu]&Oy)>0,md=n=>(n[hu]&Fy)>0,pS=(n,e)=>e?n[hu]|=Oy|CM:n[hu]&=~Oy,gS=(n,e)=>e?n[hu]|=Fy:n[hu]&=~Fy;class zj extends t8{constructor(e,t){if(super(),this.key=void 0,this.animation=new Nj,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,!Ke.und(e)||!Ke.und(t)){const i=Ke.obj(e)?Hi({},e):Hi({},t,{from:e});Ke.und(i.default)&&(i.default=!0),this.start(i)}}get idle(){return!(Al(this)||this._state.asyncTo)||md(this)}get goal(){return Ls(this.animation.to)}get velocity(){const e=ka(this);return e instanceof vf?e.lastVelocity||0:e.getPayload().map(t=>t.lastVelocity||0)}get hasAnimated(){return Kv(this)}get isAnimating(){return Al(this)}get isPaused(){return md(this)}get isDelayed(){return this._state.delayed}advance(e){let t=!0,i=!1;const r=this.animation;let{config:s,toValues:a}=r;const o=S1(r.to);!o&&Na(r.to)&&(a=Ns(Ls(r.to))),r.values.forEach((u,h)=>{if(u.done)return;const f=u.constructor==Zh?1:o?o[h].lastPosition:a[h];let p=r.immediate,m=f;if(!p){if(m=u.lastPosition,s.tension<=0){u.done=!0;return}let y=u.elapsedTime+=e;const v=r.fromValues[h],A=u.v0!=null?u.v0:u.v0=Ke.arr(s.velocity)?s.velocity[h]:s.velocity;let _;const x=s.precision||(v==f?.005:Math.min(1,Math.abs(f-v)*.001));if(Ke.und(s.duration))if(s.decay){const E=s.decay===!0?.998:s.decay,w=Math.exp(-(1-E)*y);m=v+A/(1-E)*(1-w),p=Math.abs(u.lastPosition-m)<=x,_=A*w}else{_=u.lastVelocity==null?A:u.lastVelocity;const E=s.restVelocity||x/10,w=s.clamp?0:s.bounce,I=!Ke.und(w),T=v==f?u.v0>0:vE,!(!M&&(p=Math.abs(f-m)<=x,p)));++U){I&&(b=m==f||m>f==T,b&&(_=-_*w,m=f));const O=-s.tension*1e-6*(m-f),Q=-s.friction*.001*_,G=(O+Q)/s.mass;_=_+G*B,m=m+_*B}}else{let E=1;s.duration>0&&(this._memoizedDuration!==s.duration&&(this._memoizedDuration=s.duration,u.durationProgress>0&&(u.elapsedTime=s.duration*u.durationProgress,y=u.elapsedTime+=e)),E=(s.progress||0)+y/this._memoizedDuration,E=E>1?1:E<0?0:E,u.durationProgress=E),m=v+s.easing(E)*(f-v),_=(m-u.lastPosition)/e,p=E==1}u.lastVelocity=_,Number.isNaN(m)&&(console.warn("Got NaN while animating:",this),p=!0)}o&&!o[h].done&&(p=!1),p?u.done=!0:t=!1,u.setValue(m,s.round)&&(i=!0)});const l=ka(this),c=l.getValue();if(t){const u=Ls(r.to);(c!==u||i)&&!s.decay?(l.setValue(u),this._onChange(u)):i&&s.decay&&this._onChange(c),this._stop()}else i&&this._onChange(c)}set(e){return Pt.batchedUpdates(()=>{this._stop(),this._focus(e),this._set(e)}),this}pause(){this._update({pause:!0})}resume(){this._update({pause:!1})}finish(){if(Al(this)){const{to:e,config:t}=this.animation;Pt.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 i;return Ke.und(e)?(i=this.queue||[],this.queue=[]):i=[Ke.obj(e)?e:Hi({},t,{to:e})],Promise.all(i.map(r=>this._update(r))).then(r=>e8(this,r))}stop(e){const{to:t}=this.animation;return this._focus(this.get()),jp(this._state,e&&this._lastCallId),Pt.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:i,from:r}=e;i=Ke.obj(i)?i[t]:i,(i==null||Py(i))&&(i=void 0),r=Ke.obj(r)?r[t]:r,r==null&&(r=void 0);const s={to:i,from:r};return Kv(this)||(e.reverse&&([i,r]=[r,i]),r=Ls(r),Ke.und(r)?ka(this)||this._set(i):this._set(r)),s}_update(e,t){let i=Hi({},e);const{key:r,defaultProps:s}=this;i.default&&Object.assign(s,Z4(i,(l,c)=>/^on/.test(c)?yM(l,r):l)),AS(this,i,"onProps"),vd(this,"onProps",i,this);const a=this._prepareNode(i);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 o=this._state;return EM(++this._lastCallId,{key:r,props:i,defaultProps:s,state:o,actions:{pause:()=>{md(this)||(gS(this,!0),Hd(o.pauseQueue),vd(this,"onPause",oa(this,Ad(this,this.animation.to)),this))},resume:()=>{md(this)&&(gS(this,!1),Al(this)&&this._resume(),Hd(o.resumeQueue),vd(this,"onResume",oa(this,Ad(this,this.animation.to)),this))},start:this._merge.bind(this,a)}}).then(l=>{if(i.loop&&l.finished&&!(t&&l.noop)){const c=TM(i);if(c)return this._update(c,!0)}return l})}_merge(e,t,i){if(t.cancel)return this.stop(!0),i(Gh(this));const r=!Ke.und(e.to),s=!Ke.und(e.from);if(r||s)if(t.callId>this._lastToId)this._lastToId=t.callId;else return i(Gh(this));const{key:a,defaultProps:o,animation:l}=this,{to:c,from:u}=l;let{to:h=c,from:f=u}=e;s&&!r&&(!t.default||Ke.und(h))&&(h=f),t.reverse&&([h,f]=[f,h]);const p=!Lo(f,u);p&&(l.from=f),f=Ls(f);const m=!Lo(h,c);m&&this._focus(h);const y=Py(t.to),{config:v}=l,{decay:A,velocity:_}=v;(r||s)&&(v.velocity=0),t.config&&!y&&kj(v,Gc(t.config,a),t.config!==o.config?Gc(o.config,a):void 0);let x=ka(this);if(!x||Ke.und(h))return i(oa(this,!0));const E=Ke.und(t.reset)?s&&!t.default:!Ke.und(f)&&sp(t.reset,a),w=E?f:this.get(),I=Xp(h),T=Ke.num(I)||Ke.arr(I)||E1(I),M=!y&&(!T||sp(o.immediate||t.immediate,a));if(m){const U=Dy(h);if(U!==x.constructor)if(M)x=this._set(I);else throw Error(`Cannot animate between ${x.constructor.name} and ${U.name}, as the "to" prop suggests`)}const b=x.constructor;let B=Na(h),L=!1;if(!B){const U=E||!Kv(this)&&p;(m||U)&&(L=Lo(Xp(w),I),B=!L),(!Lo(l.immediate,M)&&!M||!Lo(v.decay,A)||!Lo(v.velocity,_))&&(B=!0)}if(L&&Al(this)&&(l.changed&&!E?B=!0:B||this._stop(c)),!y&&((B||Na(c))&&(l.values=x.getPayload(),l.toValues=Na(h)?null:b==Zh?[1]:Ns(I)),l.immediate!=M&&(l.immediate=M,!M&&!E&&this._set(c)),B)){const{onRest:U}=l;xn(Hj,Q=>AS(this,t,Q));const O=oa(this,Ad(this,c));Hd(this._pendingCalls,O),this._pendingCalls.add(i),l.changed&&Pt.batchedUpdates(()=>{l.changed=!E,U==null||U(O,this),E?Gc(o.onRest,O):l.onStart==null||l.onStart(O,this)})}E&&this._set(w),y?i(wM(t.to,t,this._state,this)):B?this._start():Al(this)&&!m?this._pendingCalls.add(i):i(SM(w))}_focus(e){const t=this.animation;e!==t.to&&(rS(this)&&this._detach(),t.to=e,rS(this)&&this._attach())}_attach(){let e=0;const{to:t}=this.animation;Na(t)&&(M0(t,this),Uy(t)&&(e=t.priority+1)),this.priority=e}_detach(){const{to:e}=this.animation;Na(e)&&t2(e,this)}_set(e,t=!0){const i=Ls(e);if(!Ke.und(i)){const r=ka(this);if(!r||!Lo(i,r.getValue())){const s=Dy(i);!r||r.constructor!=s?K4(this,s.create(i)):r.setValue(i),r&&Pt.batchedUpdates(()=>{this._onChange(i,t)})}}return ka(this)}_onStart(){const e=this.animation;e.changed||(e.changed=!0,vd(this,"onStart",oa(this,Ad(this,e.to)),this))}_onChange(e,t){t||(this._onStart(),Gc(this.animation.onChange,e,this)),Gc(this.defaultProps.onChange,e,this),super._onChange(e,t)}_start(){const e=this.animation;ka(this).reset(Ls(e.to)),e.immediate||(e.fromValues=e.values.map(t=>t.lastPosition)),Al(this)||(pS(this,!0),md(this)||this._resume())}_resume(){eo.skipAnimation?this.finish():y1.start(this)}_stop(e,t){if(Al(this)){pS(this,!1);const i=this.animation;xn(i.values,s=>{s.done=!0}),i.toValues&&(i.onChange=i.onPause=i.onResume=void 0),e2(this,{type:"idle",parent:this});const r=t?Gh(this.get()):oa(this.get(),Ad(this,e??i.to));Hd(this._pendingCalls,r),i.changed&&(i.changed=!1,vd(this,"onRest",r,this))}}}function Ad(n,e){const t=Xp(e),i=Xp(n.get());return Lo(i,t)}function TM(n,e=n.loop,t=n.to){let i=Gc(e);if(i){const r=i!==!0&&_M(i),s=(r||n).reverse,a=!r||r.reset;return Kp(Hi({},n,{loop:e,default:!1,pause:void 0,to:!s||Py(t)?t:void 0,from:a?n.from:void 0,reset:a},r))}}function Kp(n){const{to:e,from:t}=n=_M(n),i=new Set;return Ke.obj(e)&&mS(e,i),Ke.obj(t)&&mS(t,i),n.keys=i.size?Array.from(i):null,n}function Qj(n){const e=Kp(n);return Ke.und(e.default)&&(e.default=Z4(e)),e}function mS(n,e){Ho(n,(t,i)=>t!=null&&e.add(i))}const Hj=["onStart","onRest","onChange","onPause","onResume"];function AS(n,e,t){n.animation[t]=e[t]!==xM(e,t)?yM(e[t],n.key):void 0}function vd(n,e,...t){var i,r,s,a;(i=(r=n.animation)[e])==null||i.call(r,...t),(s=(a=n.defaultProps)[e])==null||s.call(a,...t)}const Vj=["onStart","onChange","onRest"];let Wj=1;class Yj{constructor(e,t){this.id=Wj++,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(Hi({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,i)=>e[i]=t.get()),e}set(e){for(const t in e){const i=e[t];Ke.und(i)||this.springs[t].set(i)}}update(e){return e&&this.queue.push(Kp(e)),this}start(e){let{queue:t}=this;return e?t=Ns(e).map(Kp):this.queue=[],this._flush?this._flush(this,t):(BM(this,t),ky(this,t))}stop(e,t){if(e!==!!e&&(t=e),t){const i=this.springs;xn(Ns(t),r=>i[r].stop(!!e))}else jp(this._state,this._lastAsyncId),this.each(i=>i.stop(!!e));return this}pause(e){if(Ke.und(e))this.start({pause:!0});else{const t=this.springs;xn(Ns(e),i=>t[i].pause())}return this}resume(e){if(Ke.und(e))this.start({pause:!1});else{const t=this.springs;xn(Ns(e),i=>t[i].resume())}return this}each(e){Ho(this.springs,e)}_onFrame(){const{onStart:e,onChange:t,onRest:i}=this._events,r=this._active.size>0,s=this._changed.size>0;(r&&!this._started||s&&!this._started)&&(this._started=!0,ip(e,([l,c])=>{c.value=this.get(),l(c,this,this._item)}));const a=!r&&this._started,o=s||a&&i.size?this.get():null;s&&t.size&&ip(t,([l,c])=>{c.value=o,l(c,this,this._item)}),a&&(this._started=!1,ip(i,([l,c])=>{c.value=o,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;Pt.onFrame(this._onFrame)}}function ky(n,e){return Promise.all(e.map(t=>bM(n,t))).then(t=>e8(n,t))}async function bM(n,e,t){const{keys:i,to:r,from:s,loop:a,onRest:o,onResolve:l}=e,c=Ke.obj(e.default)&&e.default;a&&(e.loop=!1),r===!1&&(e.to=null),s===!1&&(e.from=null);const u=Ke.arr(r)||Ke.fun(r)?r:void 0;u?(e.to=void 0,e.onRest=void 0,c&&(c.onRest=void 0)):xn(Vj,y=>{const v=e[y];if(Ke.fun(v)){const A=n._events[y];e[y]=({finished:_,cancelled:x})=>{const E=A.get(v);E?(_||(E.finished=!1),x&&(E.cancelled=!0)):A.set(v,{value:null,finished:_||!1,cancelled:x||!1})},c&&(c[y]=e[y])}});const h=n._state;e.pause===!h.paused?(h.paused=e.pause,Hd(e.pause?h.pauseQueue:h.resumeQueue)):h.paused&&(e.pause=!0);const f=(i||Object.keys(n.springs)).map(y=>n.springs[y].start(e)),p=e.cancel===!0||xM(e,"cancel")===!0;(u||p&&h.asyncId)&&f.push(EM(++n._lastAsyncId,{props:e,state:h,actions:{pause:My,resume:My,start(y,v){p?(jp(h,n._lastAsyncId),v(Gh(n))):(y.onRest=o,v(wM(u,y,h,n)))}}})),h.paused&&await new Promise(y=>{h.resumeQueue.add(y)});const m=e8(n,await Promise.all(f));if(a&&m.finished&&!(t&&m.noop)){const y=TM(e,a,r);if(y)return BM(n,[y]),bM(n,y,!0)}return l&&Pt.batchedUpdates(()=>l(m,n,n.item)),m}function vS(n,e){const t=Hi({},n.springs);return e&&xn(Ns(e),i=>{Ke.und(i.keys)&&(i=Kp(i)),Ke.obj(i.to)||(i=Hi({},i,{to:void 0})),RM(t,i,r=>MM(r))}),IM(n,t),t}function IM(n,e){Ho(e,(t,i)=>{n.springs[i]||(n.springs[i]=t,M0(t,n))})}function MM(n,e){const t=new zj;return t.key=n,e&&M0(t,e),t}function RM(n,e,t){e.keys&&xn(e.keys,i=>{(n[i]||(n[i]=t(i)))._prepareNode(e)})}function BM(n,e){xn(e,t=>{RM(n.springs,t,i=>MM(i,n))})}function qj(n,e){if(n==null)return{};var t={},i=Object.keys(n),r,s;for(s=0;s=0)&&(t[r]=n[r]);return t}const Xj=["children"],w1=n=>{let{children:e}=n,t=qj(n,Xj);const i=$.useContext(r2),r=t.pause||!!i.pause,s=t.immediate||!!i.immediate;t=xj(()=>({pause:r,immediate:s}),[r,s]);const{Provider:a}=r2;return $.createElement(a,{value:t},e)},r2=jj(w1,{});w1.Provider=r2.Provider;w1.Consumer=r2.Consumer;function jj(n,e){return Object.assign(n,$.createContext(e)),n.Provider._context=n,n.Consumer._context=n,n}const Kj=()=>{const n=[],e=function(r){vj();const s=[];return xn(n,(a,o)=>{if(Ke.und(r))s.push(a.start());else{const l=t(r,a,o);l&&s.push(a.start(l))}}),s};e.current=n,e.add=function(i){n.includes(i)||n.push(i)},e.delete=function(i){const r=n.indexOf(i);~r&&n.splice(r,1)},e.pause=function(){return xn(n,i=>i.pause(...arguments)),this},e.resume=function(){return xn(n,i=>i.resume(...arguments)),this},e.set=function(i){xn(n,r=>r.set(i))},e.start=function(i){const r=[];return xn(n,(s,a)=>{if(Ke.und(i))r.push(s.start());else{const o=this._getProps(i,s,a);o&&r.push(s.start(o))}}),r},e.stop=function(){return xn(n,i=>i.stop(...arguments)),this},e.update=function(i){return xn(n,(r,s)=>r.update(this._getProps(i,r,s))),this};const t=function(r,s,a){return Ke.fun(r)?r(a,s):r};return e._getProps=t,e};function $j(n,e,t){const i=Ke.fun(e)&&e;i&&!t&&(t=[]);const r=$.useMemo(()=>i||arguments.length==3?Kj():void 0,[]),s=$.useRef(0),a=mM(),o=$.useMemo(()=>({ctrls:[],queue:[],flush(A,_){const x=vS(A,_);return s.current>0&&!o.queue.length&&!Object.keys(x).some(w=>!A.springs[w])?ky(A,_):new Promise(w=>{IM(A,x),o.queue.push(()=>{w(ky(A,_))}),a()})}}),[]),l=$.useRef([...o.ctrls]),c=[],u=aS(n)||0;$.useMemo(()=>{xn(l.current.slice(n,u),A=>{Lj(A,r),A.stop(!0)}),l.current.length=n,h(u,n)},[n]),$.useMemo(()=>{h(0,Math.min(u,n))},t);function h(A,_){for(let x=A;x<_;x++){const E=l.current[x]||(l.current[x]=new Yj(null,o.flush)),w=i?i(x,E):e[x];w&&(c[x]=Qj(w))}}const f=l.current.map((A,_)=>vS(A,c[_])),p=$.useContext(w1),m=aS(p),y=p!==m&&Pj(p);j4(()=>{s.current++,o.ctrls=l.current;const{queue:A}=o;A.length&&(o.queue=[],xn(A,_=>_())),xn(l.current,(_,x)=>{r==null||r.add(_),y&&_.start({default:p});const E=c[x];E&&(Uj(_,E.ref),_.ref?_.queue.push(E):_.start(E))})}),AM(()=>()=>{xn(o.ctrls,A=>A.stop(!0))});const v=f.map(A=>Hi({},A));return r?[v,r]:v}function Vs(n,e){const t=Ke.fun(n),[[i],r]=$j(1,t?n:[n],t?e||[]:e);return t||arguments.length==2?[i,r]:i}let yS;(function(n){n.MOUNT="mount",n.ENTER="enter",n.UPDATE="update",n.LEAVE="leave"})(yS||(yS={}));class Jj extends t8{constructor(e,t){super(),this.key=void 0,this.idle=!0,this.calc=void 0,this._active=new Set,this.source=e,this.calc=Yp(...t);const i=this._get(),r=Dy(i);K4(this,r.create(i))}advance(e){const t=this._get(),i=this.get();Lo(t,i)||(ka(this).setValue(t),this._onChange(t,this.idle)),!this.idle&&xS(this._active)&&$v(this)}_get(){const e=Ke.arr(this.source)?this.source.map(Ls):Ns(Ls(this.source));return this.calc(...e)}_start(){this.idle&&!xS(this._active)&&(this.idle=!1,xn(S1(this),e=>{e.done=!1}),eo.skipAnimation?(Pt.batchedUpdates(()=>this.advance()),$v(this)):y1.start(this))}_attach(){let e=1;xn(Ns(this.source),t=>{Na(t)&&M0(t,this),Uy(t)&&(t.idle||this._active.add(t),e=Math.max(e,t.priority+1))}),this.priority=e,this._start()}_detach(){xn(Ns(this.source),e=>{Na(e)&&t2(e,this)}),this._active.clear(),$v(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=Ns(this.source).reduce((t,i)=>Math.max(t,(Uy(i)?i.priority:0)+1),0))}}function Zj(n){return n.idle!==!1}function xS(n){return!n.size||Array.from(n).every(Zj)}function $v(n){n.idle||(n.idle=!0,xn(S1(n),e=>{e.done=!0}),e2(n,{type:"idle",parent:n}))}eo.assign({createStringInterpolator:pM,to:(n,e)=>new Jj(n,e)});const eK=["primitive"].concat(Object.keys(KT).filter(n=>/^[A-Z]/.test(n)).map(n=>n[0].toLowerCase()+n.slice(1)));eo.assign({createStringInterpolator:pM,colors:XX,frameLoop:"demand"});hz(()=>{Pt.advance()});const tK=Ij(eK,{applyAnimatedValues:Pc}),mi=tK.animated;function n8(){}n8.prototype.s2u=function(n){for(var e=this.s2uTable,t="",i=0;i=0&&r<=126||r>=161&&r<=223)&&i0;){var t=this.getUint8();if(n--,t===0)break;e+=String.fromCharCode(t)}for(;n>0;)this.getUint8(),n--;return e},getSjisStringsAsUnicode:function(n){for(var e=[];n>0;){var t=this.getUint8();if(n--,t===0)break;e.push(t)}for(;n>0;)this.getUint8(),n--;return this.encoder.s2u(new Uint8Array(e))},getUnicodeStrings:function(n){for(var e="";n>0;){var t=this.getUint16();if(n-=2,t===0)break;e+=String.fromCharCode(t)}for(;n>0;)this.getUint8(),n--;return e},getTextBuffer:function(){var n=this.getUint32();return this.getUnicodeStrings(n)}};function ES(){}ES.prototype={constructor:ES,leftToRightVector3:function(n){n[2]=-n[2]},leftToRightQuaternion:function(n){n[0]=-n[0],n[1]=-n[1]},leftToRightEuler:function(n){n[0]=-n[0],n[1]=-n[1]},leftToRightIndexOrder:function(n){var e=n[2];n[2]=n[0],n[0]=e},leftToRightVector3Range:function(n,e){var t=-e[2];e[2]=-n[2],n[2]=t},leftToRightEulerRange:function(n,e){var t=-e[0],i=-e[1];e[0]=-n[0],e[1]=-n[1],n[0]=t,n[1]=i}};const DM=0,nK=2,iK=0,rK=0,sK=2,aK=0,oK=0,lK=1,Ny=2,cK=1,uK=64,PM=0,LM=9,i8=15,UM=16,r8=22,OM=37,s8=43,FM=76,kM=83,NM=97,GM=100,zM=103,QM=109;class hK{constructor(){this.vkFormat=PM,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=DM,this.levels=[],this.dataFormatDescriptor=[{vendorId:rK,descriptorType:iK,descriptorBlockSize:0,versionNumber:sK,colorModel:aK,colorPrimaries:cK,transferFunction:Ny,flags:oK,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class yd{constructor(e,t,i,r){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=r,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian),t=this._dataView.getUint32(this._offset+4,this._littleEndian),i=e+2**32*t;return this._offset+=8,i}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const i=this._offset;let r=0;for(;this._dataView.getUint8(this._offset)!==t&&re.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Zv)).then(this._init):WebAssembly.instantiate(Buffer.from(wS,"base64"),Zv).then(this._init),Jv)}_init(e){Po=e.instance,Zv.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Po)throw new Error("ZSTDDecoder: Await .init() before decoding.");const i=e.byteLength,r=Po.exports.malloc(i);Gy.set(e,r),t=t||Number(Po.exports.ZSTD_findDecompressedSize(r,i));const s=Po.exports.malloc(t),a=Po.exports.ZSTD_decompress(s,t,r,i),o=Gy.slice(s,s+a);return Po.exports.free(r),Po.exports.free(s),o}}const wS="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";/*! https://mths.be/codepointat v0.2.0 by @mathias */String.prototype.codePointAt||function(){var n=function(){try{var t={},i=Object.defineProperty,r=i(t,t,t)&&i}catch{}return r}(),e=function(t){if(this==null)throw TypeError();var i=String(this),r=i.length,s=t?Number(t):0;if(s!=s&&(s=0),!(s<0||s>=r)){var a=i.charCodeAt(s),o;return a>=55296&&a<=56319&&r>s+1&&(o=i.charCodeAt(s+1),o>=56320&&o<=57343)?(a-55296)*1024+o-56320+65536:a}};n?n(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}();function HM(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}var pK=new HM,gK=new HM,VM=new Uint8Array(30),WM=new Uint16Array(30),mK=new Uint8Array(30),AK=new Uint16Array(30);function YM(n,e,t,i){var r,s;for(r=0;rthis.x2&&(this.x2=n)),typeof e=="number"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))};Jl.prototype.addX=function(n){this.addPoint(n,null)};Jl.prototype.addY=function(n){this.addPoint(null,n)};Jl.prototype.addBezier=function(n,e,t,i,r,s,a,o){var l=[n,e],c=[t,i],u=[r,s],h=[a,o];this.addPoint(n,e),this.addPoint(a,o);for(var f=0;f<=1;f++){var p=6*l[f]-12*c[f]+6*u[f],m=-3*l[f]+9*c[f]-9*u[f]+3*h[f],y=3*c[f]-3*l[f];if(m===0){if(p===0)continue;var v=-y/p;0=0&&l>0&&(o+=" "),o+=e(c)}return o}for(var i="",r=0;r=0&&n<=255,"Byte value should be between 0 and 255."),[n]};Mt.BYTE=ya(1);Ze.CHAR=function(n){return[n.charCodeAt(0)]};Mt.CHAR=ya(1);Ze.CHARARRAY=function(n){typeof n>"u"&&(n="",console.warn("Undefined CHARARRAY encountered and treated as an empty string. This is probably caused by a missing glyph name."));for(var e=[],t=0;t"u"?0:n.length};Ze.USHORT=function(n){return[n>>8&255,n&255]};Mt.USHORT=ya(2);Ze.SHORT=function(n){return n>=TS&&(n=-(2*TS-n)),[n>>8&255,n&255]};Mt.SHORT=ya(2);Ze.UINT24=function(n){return[n>>16&255,n>>8&255,n&255]};Mt.UINT24=ya(3);Ze.ULONG=function(n){return[n>>24&255,n>>16&255,n>>8&255,n&255]};Mt.ULONG=ya(4);Ze.LONG=function(n){return n>=bS&&(n=-(2*bS-n)),[n>>24&255,n>>16&255,n>>8&255,n&255]};Mt.LONG=ya(4);Ze.FIXED=Ze.ULONG;Mt.FIXED=Mt.ULONG;Ze.FWORD=Ze.SHORT;Mt.FWORD=Mt.SHORT;Ze.UFWORD=Ze.USHORT;Mt.UFWORD=Mt.USHORT;Ze.LONGDATETIME=function(n){return[0,0,0,0,n>>24&255,n>>16&255,n>>8&255,n&255]};Mt.LONGDATETIME=ya(8);Ze.TAG=function(n){return Lt.argument(n.length===4,"Tag should be exactly 4 ASCII characters."),[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]};Mt.TAG=ya(4);Ze.Card8=Ze.BYTE;Mt.Card8=Mt.BYTE;Ze.Card16=Ze.USHORT;Mt.Card16=Mt.USHORT;Ze.OffSize=Ze.BYTE;Mt.OffSize=Mt.BYTE;Ze.SID=Ze.USHORT;Mt.SID=Mt.USHORT;Ze.NUMBER=function(n){return n>=-107&&n<=107?[n+139]:n>=108&&n<=1131?(n=n-108,[(n>>8)+247,n&255]):n>=-1131&&n<=-108?(n=-n-108,[(n>>8)+251,n&255]):n>=-32768&&n<=32767?Ze.NUMBER16(n):Ze.NUMBER32(n)};Mt.NUMBER=function(n){return Ze.NUMBER(n).length};Ze.NUMBER16=function(n){return[28,n>>8&255,n&255]};Mt.NUMBER16=ya(3);Ze.NUMBER32=function(n){return[29,n>>24&255,n>>16&255,n>>8&255,n&255]};Mt.NUMBER32=ya(5);Ze.REAL=function(n){var e=n.toString(),t=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(e);if(t){var i=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(n*i)/i).toString()}for(var r="",s=0,a=e.length;s>8&255,e[e.length]=i&255}return e};Mt.UTF16=function(n){return n.length*2};var zy={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};ef.MACSTRING=function(n,e,t,i){var r=zy[i];if(r!==void 0){for(var s="",a=0;a=128&&(s=t[s],s===void 0))return;i[r]=s}return i}};Mt.MACSTRING=function(n,e){var t=Ze.MACSTRING(n,e);return t!==void 0?t.length:0};function Qy(n){return n>=-128&&n<=127}function xK(n,e,t){for(var i=0,r=n.length;e>8&255,l+256&255)}return s}Ze.VARDELTAS=function(n){for(var e=0,t=[];e=-128&&i<=127?e=_K(n,e,t):e=EK(n,e,t)}return t};Ze.INDEX=function(n){for(var e=1,t=[e],i=[],r=0;r>8,e[h+1]=f&255,e=e.concat(i[u])}return e};Mt.TABLE=function(n){for(var e=0,t=n.fields.length,i=0;i0)return new Te(this.data,this.offset+e).parseStruct(n)};Te.prototype.parsePointer32=function(n){var e=this.parseOffset32();if(e>0)return new Te(this.data,this.offset+e).parseStruct(n)};Te.prototype.parseListOfLists=function(n){for(var e=this.parseOffset16List(),t=e.length,i=this.relativeOffset,r=new Array(t),s=0;s>1,e.skip("uShort",3),n.glyphIndexMap={};for(var a=new Gt.Parser(t,i+r+14),o=new Gt.Parser(t,i+r+16+s*2),l=new Gt.Parser(t,i+r+16+s*4),c=new Gt.Parser(t,i+r+16+s*6),u=i+r+16+s*8,h=0;h=0;r-=1){var s=Gt.getUShort(n,e+4+r*8),a=Gt.getUShort(n,e+4+r*8+2);if(s===3&&(a===0||a===1||a===10)||s===0&&(a===0||a===1||a===2||a===3||a===4)){i=Gt.getULong(n,e+4+r*8+4);break}}if(i===-1)throw new Error("No valid cmap sub-tables found.");var o=new Gt.Parser(n,e+i);if(t.format=o.parseUShort(),t.format===12)MK(t,o);else if(t.format===4)RK(t,o,n,e,i);else throw new Error("Only format 4 and 12 cmap tables are supported (found format "+t.format+").");return t}function DK(n,e,t){n.segments.push({end:e,start:e,delta:-(e-t),offset:0,glyphIndex:t})}function PK(n){n.segments.push({end:65535,start:65535,delta:1,offset:0})}function LK(n){var e=!0,t;for(t=n.length-1;t>0;t-=1){var i=n.get(t);if(i.unicode>65535){console.log("Adding CMAP format 12 (needed!)"),e=!1;break}}var r=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:e?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:e?12:12+8}];e||(r=r.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),r=r.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var s=new lt.Table("cmap",r);for(s.segments=[],t=0;t>4,a=r&15;if(s===t||(e+=i[s],a===t))break;e+=i[a]}return parseFloat(e)}function YK(n,e){var t,i,r,s;if(e===28)return t=n.parseByte(),i=n.parseByte(),t<<8|i;if(e===29)return t=n.parseByte(),i=n.parseByte(),r=n.parseByte(),s=n.parseByte(),t<<24|i<<16|r<<8|s;if(e===30)return WK(n);if(e>=32&&e<=246)return e-139;if(e>=247&&e<=250)return t=n.parseByte(),(e-247)*256+t+108;if(e>=251&&e<=254)return t=n.parseByte(),-(e-251)*256-t-108;throw new Error("Invalid b0 "+e)}function qK(n){for(var e={},t=0;t>1,l.length=0,u=!0}function T(M){for(var b,B,L,U,O,Q,G,F,q,Y,H,V,D=0;D1&&!u&&(E=l.shift()+A,u=!0),p+=l.pop(),w(f,p);break;case 5:for(;l.length>0;)f+=l.shift(),p+=l.shift(),o.lineTo(f,p);break;case 6:for(;l.length>0&&(f+=l.shift(),o.lineTo(f,p),l.length!==0);)p+=l.shift(),o.lineTo(f,p);break;case 7:for(;l.length>0&&(p+=l.shift(),o.lineTo(f,p),l.length!==0);)f+=l.shift(),o.lineTo(f,p);break;case 8:for(;l.length>0;)i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+l.shift(),o.curveTo(i,r,s,a,f,p);break;case 10:O=l.pop()+y,Q=m[O],Q&&T(Q);break;case 11:return;case 12:switch(k=M[D],D+=1,k){case 35:i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),G=s+l.shift(),F=a+l.shift(),q=G+l.shift(),Y=F+l.shift(),H=q+l.shift(),V=Y+l.shift(),f=H+l.shift(),p=V+l.shift(),l.shift(),o.curveTo(i,r,s,a,G,F),o.curveTo(q,Y,H,V,f,p);break;case 34:i=f+l.shift(),r=p,s=i+l.shift(),a=r+l.shift(),G=s+l.shift(),F=a,q=G+l.shift(),Y=a,H=q+l.shift(),V=p,f=H+l.shift(),o.curveTo(i,r,s,a,G,F),o.curveTo(q,Y,H,V,f,p);break;case 36:i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),G=s+l.shift(),F=a,q=G+l.shift(),Y=a,H=q+l.shift(),V=Y+l.shift(),f=H+l.shift(),o.curveTo(i,r,s,a,G,F),o.curveTo(q,Y,H,V,f,p);break;case 37:i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),G=s+l.shift(),F=a+l.shift(),q=G+l.shift(),Y=F+l.shift(),H=q+l.shift(),V=Y+l.shift(),Math.abs(H-f)>Math.abs(V-p)?f=H+l.shift():p=V+l.shift(),o.curveTo(i,r,s,a,G,F),o.curveTo(q,Y,H,V,f,p);break;default:console.log("Glyph "+e.index+": unknown operator 1200"+k),l.length=0}break;case 14:l.length>0&&!u&&(E=l.shift()+A,u=!0),h&&(o.closePath(),h=!1);break;case 18:I();break;case 19:case 20:I(),D+=c+7>>3;break;case 21:l.length>2&&!u&&(E=l.shift()+A,u=!0),p+=l.pop(),f+=l.pop(),w(f,p);break;case 22:l.length>1&&!u&&(E=l.shift()+A,u=!0),f+=l.pop(),w(f,p);break;case 23:I();break;case 24:for(;l.length>2;)i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+l.shift(),o.curveTo(i,r,s,a,f,p);f+=l.shift(),p+=l.shift(),o.lineTo(f,p);break;case 25:for(;l.length>6;)f+=l.shift(),p+=l.shift(),o.lineTo(f,p);i=f+l.shift(),r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+l.shift(),o.curveTo(i,r,s,a,f,p);break;case 26:for(l.length%2&&(f+=l.shift());l.length>0;)i=f,r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s,p=a+l.shift(),o.curveTo(i,r,s,a,f,p);break;case 27:for(l.length%2&&(p+=l.shift());l.length>0;)i=f+l.shift(),r=p,s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a,o.curveTo(i,r,s,a,f,p);break;case 28:b=M[D],B=M[D+1],l.push((b<<24|B<<16)>>16),D+=2;break;case 29:O=l.pop()+n.gsubrsBias,Q=n.gsubrs[O],Q&&T(Q);break;case 30:for(;l.length>0&&(i=f,r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+(l.length===1?l.shift():0),o.curveTo(i,r,s,a,f,p),l.length!==0);)i=f+l.shift(),r=p,s=i+l.shift(),a=r+l.shift(),p=a+l.shift(),f=s+(l.length===1?l.shift():0),o.curveTo(i,r,s,a,f,p);break;case 31:for(;l.length>0&&(i=f+l.shift(),r=p,s=i+l.shift(),a=r+l.shift(),p=a+l.shift(),f=s+(l.length===1?l.shift():0),o.curveTo(i,r,s,a,f,p),l.length!==0);)i=f,r=p+l.shift(),s=i+l.shift(),a=r+l.shift(),f=s+l.shift(),p=a+(l.length===1?l.shift():0),o.curveTo(i,r,s,a,f,p);break;default:k<32?console.log("Glyph "+e.index+": unknown operator "+k):k<247?l.push(k-139):k<251?(b=M[D],D+=1,l.push((k-247)*256+b+108)):k<255?(b=M[D],D+=1,l.push(-(k-251)*256-b-108)):(b=M[D],B=M[D+1],L=M[D+2],U=M[D+3],D+=4,l.push((b<<24|B<<16|L<<8|U)/65536))}}}return T(t),e.advanceWidth=E,o}function JK(n,e,t,i){var r=[],s,a=new Gt.Parser(n,e),o=a.parseCard8();if(o===0)for(var l=0;l=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+i+")");r.push(s)}else if(o===3){var c=a.parseCard16(),u=a.parseCard16();if(u!==0)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+u);for(var h,f=0;f=i)throw new Error("CFF table CID Font FDSelect has bad FD index value "+s+" (FD count "+i+")");if(h>t)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+h);for(;u=0&&(t=i),i=e.indexOf(n),i>=0?t=i+ym.length:(t=ym.length+e.length,e.push(n)),t}function e$(){return new lt.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function t$(n){var e=new lt.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);e.names=[];for(var t=0;t=t.begin&&n=1&&(t.ulCodePageRange1=i.parseULong(),t.ulCodePageRange2=i.parseULong()),t.version>=2&&(t.sxHeight=i.parseShort(),t.sCapHeight=i.parseShort(),t.usDefaultChar=i.parseUShort(),t.usBreakChar=i.parseUShort(),t.usMaxContent=i.parseUShort()),t}function F$(n){return new lt.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],n)}var FS={parse:O$,make:F$,unicodeRanges:Yy,getUnicodeRange:U$};function k$(n,e){var t={},i=new Gt.Parser(n,e);switch(t.version=i.parseVersion(),t.italicAngle=i.parseFixed(),t.underlinePosition=i.parseShort(),t.underlineThickness=i.parseShort(),t.isFixedPitch=i.parseULong(),t.minMemType42=i.parseULong(),t.maxMemType42=i.parseULong(),t.minMemType1=i.parseULong(),t.maxMemType1=i.parseULong(),t.version){case 1:t.names=RS.slice();break;case 2:t.numberOfGlyphs=i.parseUShort(),t.glyphNameIndex=new Array(t.numberOfGlyphs);for(var r=0;r=RS.length){var a=i.parseChar();t.names.push(i.parseString(a))}break;case 2.5:t.numberOfGlyphs=i.parseUShort(),t.offset=new Array(t.numberOfGlyphs);for(var o=0;oh.value.tag?1:-1}),e.fields=e.fields.concat(i),e.fields=e.fields.concat(r),e}function GS(n,e,t){for(var i=0;i0){var s=n.glyphs.get(r);return s.getMetrics()}}return t}function q$(n){for(var e=0,t=0;tv||l===void 0)&&v>0&&(l=v),c 123 are reserved for internal usage");if(y.name!==".notdef"){var _=y.getMetrics();e.push(_.xMin),t.push(_.yMin),i.push(_.xMax),r.push(_.yMax),a.push(_.leftSideBearing),o.push(_.rightSideBearing),s.push(y.advanceWidth)}}var x={xMin:Math.min.apply(null,e),yMin:Math.min.apply(null,t),xMax:Math.max.apply(null,i),yMax:Math.max.apply(null,r),advanceWidthMax:Math.max.apply(null,s),advanceWidthAvg:q$(s),minLeftSideBearing:Math.min.apply(null,a),maxLeftSideBearing:Math.max.apply(null,a),minRightSideBearing:Math.min.apply(null,o)};x.ascender=n.ascender,x.descender=n.descender;var E=f$.make({flags:3,unitsPerEm:n.unitsPerEm,xMin:x.xMin,yMin:x.yMin,xMax:x.xMax,yMax:x.yMax,lowestRecPPEM:3,createdTimestamp:n.createdTimestamp}),w=g$.make({ascender:x.ascender,descender:x.descender,advanceWidthMax:x.advanceWidthMax,minLeftSideBearing:x.minLeftSideBearing,minRightSideBearing:x.minRightSideBearing,xMaxExtent:x.maxLeftSideBearing+(x.xMax-x.xMin),numberOfHMetrics:n.glyphs.length}),I=T$.make(n.glyphs.length),T=FS.make(Object.assign({xAvgCharWidth:Math.round(x.advanceWidthAvg),usFirstCharIndex:l,usLastCharIndex:c,ulUnicodeRange1:u,ulUnicodeRange2:h,ulUnicodeRange3:f,ulUnicodeRange4:p,sTypoAscender:x.ascender,sTypoDescender:x.descender,sTypoLineGap:0,usWinAscent:x.yMax,usWinDescent:Math.abs(x.yMin),ulCodePageRange1:1,sxHeight:GS(n,"xyvw",{yMax:Math.round(x.ascender/2)}).yMax,sCapHeight:GS(n,"HIKLEFJMNTZBDPRAGOQSUVWXY",x).yMax,usDefaultChar:n.hasChar(" ")?32:0,usBreakChar:n.hasChar(" ")?32:0},n.tables.os2)),M=x$.make(n.glyphs),b=UK.make(n.glyphs),B=n.getEnglishName("fontFamily"),L=n.getEnglishName("fontSubfamily"),U=B+" "+L,O=n.getEnglishName("postScriptName");O||(O=B.replace(/\s/g,"")+"-"+L);var Q={};for(var G in n.names)Q[G]=n.names[G];Q.uniqueID||(Q.uniqueID={en:n.getEnglishName("manufacturer")+":"+U}),Q.postScriptName||(Q.postScriptName={en:O}),Q.preferredFamily||(Q.preferredFamily=n.names.fontFamily),Q.preferredSubfamily||(Q.preferredSubfamily=n.names.fontSubfamily);var F=[],q=L$.make(Q,F),Y=F.length>0?S$.make(F):void 0,H=G$.make(),V=c$.make(n.glyphs,{version:n.getEnglishName("version"),fullName:U,familyName:B,weightName:L,postScriptName:O,unitsPerEm:n.unitsPerEm,fontBBox:[0,x.yMin,x.ascender,x.advanceWidthMax]}),D=n.metas&&Object.keys(n.metas).length>0?Y$.make(n.metas):void 0,k=[E,w,I,T,q,b,H,V,M];Y&&k.push(Y),n.tables.gsub&&k.push(H$.make(n.tables.gsub)),D&&k.push(D);for(var Z=lR(k),j=Z.encode(),ee=l8(j),ie=Z.fields,te=!1,re=0;re>>1,s=n[r].tag;if(s===e)return r;s>>1,s=n[r];if(s===e)return r;s>>1;t=n[s];var a=t.start;if(a===e)return t;a0)return t=n[i-1],e>t.end?0:t}function R0(n,e){this.font=n,this.tableName=e}R0.prototype={searchTag:t5,binSearch:zS,getTable:function(n){var e=this.font.tables[this.tableName];return!e&&n&&(e=this.font.tables[this.tableName]=this.createDefaultTable()),e},getScriptNames:function(){var n=this.getTable();return n?n.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var n=this.getTable();if(n){for(var e=!1,t=0;t=0)return i[r].script;if(e){var s={tag:n,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return i.splice(-1-r,0,s),s.script}}},getLangSysTable:function(n,e,t){var i=this.getScriptTable(n,t);if(i){if(!e||e==="dflt"||e==="DFLT")return i.defaultLangSys;var r=t5(i.langSysRecords,e);if(r>=0)return i.langSysRecords[r].langSys;if(t){var s={tag:e,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return i.langSysRecords.splice(-1-r,0,s),s.langSys}}},getFeatureTable:function(n,e,t,i){var r=this.getLangSysTable(n,e,i);if(r){for(var s,a=r.featureIndexes,o=this.font.tables[this.tableName].features,l=0;l=o[c-1].tag,"Features must be added in alphabetical order."),s={tag:t,feature:{params:0,lookupListIndexes:[]}},o.push(s),a.push(c),s.feature}}},getLookupTables:function(n,e,t,i,r){var s=this.getFeatureTable(n,e,t,r),a=[];if(s){for(var o,l=s.lookupListIndexes,c=this.font.tables[this.tableName].lookups,u=0;u=0?t:-1;case 2:var i=QS(n.ranges,e);return i?i.index+e-i.start:-1}},expandCoverage:function(n){if(n.format===1)return n.glyphs;for(var e=[],t=n.ranges,i=0;i1,'Multiple: "by" must be an array of two or more ids');var r=this.getLookupTables(t,i,n,2,!0)[0],s=c8(r,1,{substFormat:1,coverage:{format:1,glyphs:[]},sequences:[]});Lt.assert(s.coverage.format===1,"Multiple: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.sequences.splice(o,0,0)),s.sequences[o]=e.by};As.prototype.addAlternate=function(n,e,t,i){var r=this.getLookupTables(t,i,n,3,!0)[0],s=c8(r,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});Lt.assert(s.coverage.format===1,"Alternate: unable to modify coverage table format "+s.coverage.format);var a=e.sub,o=this.binSearch(s.coverage.glyphs,a);o<0&&(o=-1-o,s.coverage.glyphs.splice(o,0,a),s.alternateSets.splice(o,0,0)),s.alternateSets[o]=e.by};As.prototype.addLigature=function(n,e,t,i){var r=this.getLookupTables(t,i,n,4,!0)[0],s=r.subtables[0];s||(s={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},r.subtables[0]=s),Lt.assert(s.coverage.format===1,"Ligature: unable to modify coverage table format "+s.coverage.format);var a=e.sub[0],o=e.sub.slice(1),l={ligGlyph:e.by,components:o},c=this.binSearch(s.coverage.glyphs,a);if(c>=0){for(var u=s.ligatureSets[c],h=0;h0?(s=n.parseByte(),e&r||(s=-s),s=t+s):(e&r)>0?s=t:s=t+n.parseShort(),s}function cR(n,e,t){var i=new Gt.Parser(e,t);n.numberOfContours=i.parseShort(),n._xMin=i.parseShort(),n._yMin=i.parseShort(),n._xMax=i.parseShort(),n._yMax=i.parseShort();var r,s;if(n.numberOfContours>0){for(var a=n.endPointIndices=[],o=0;o0)for(var h=i.parseByte(),f=0;f0){var p=[],m;if(c>0){for(var y=0;y=0,p.push(m);for(var v=0,A=0;A0?(r&2)>0?(w.dx=i.parseShort(),w.dy=i.parseShort()):w.matchedPoints=[i.parseUShort(),i.parseUShort()]:(r&2)>0?(w.dx=i.parseChar(),w.dy=i.parseChar()):w.matchedPoints=[i.parseByte(),i.parseByte()],(r&8)>0?w.xScale=w.yScale=i.parseF2Dot14():(r&64)>0?(w.xScale=i.parseF2Dot14(),w.yScale=i.parseF2Dot14()):(r&128)>0&&(w.xScale=i.parseF2Dot14(),w.scale01=i.parseF2Dot14(),w.scale10=i.parseF2Dot14(),w.yScale=i.parseF2Dot14()),n.components.push(w),E=!!(r&32)}if(r&256){n.instructionLength=i.parseUShort(),n.instructions=[];for(var I=0;Ie.points.length-1||i.matchedPoints[1]>r.points.length-1)throw Error("Matched points out of range in "+e.name);var a=e.points[i.matchedPoints[0]],o=r.points[i.matchedPoints[1]],l={xScale:i.xScale,scale01:i.scale01,scale10:i.scale10,yScale:i.yScale,dx:0,dy:0};o=n5([o],l)[0],l.dx=a.x-o.x,l.dy=a.y-o.y,s=n5(r.points,l)}e.points=e.points.concat(s)}}return uR(e.points)}function eJ(n,e,t,i){for(var r=new Xa.GlyphSet(i),s=0;s2)){var t=this.font,i=this._prepState;if(!i||i.ppem!==e){var r=this._fpgmState;if(!r){Rl.prototype=cJ,r=this._fpgmState=new Rl("fpgm",t.tables.fpgm),r.funcs=[],r.font=t,exports.DEBUG&&(console.log("---EXEC FPGM---"),r.step=-1);try{fu(r)}catch(c){console.log("Hinting error in FPGM:"+c),this._errorState=3;return}}Rl.prototype=r,i=this._prepState=new Rl("prep",t.tables.prep),i.ppem=e;var s=t.tables.cvt;if(s)for(var a=i.cvt=new Array(s.length),o=e/t.unitsPerEm,l=0;l1))try{return dR(n,i)}catch(c){this._errorState<1&&(console.log("Hinting error:"+c),console.log("Note: further hinting errors are silenced")),this._errorState=1;return}}};dR=function(n,e){var t=e.ppem/e.font.unitsPerEm,i=t,r=n.components,s,a,o;if(Rl.prototype=e,!r)o=new Rl("glyf",n.instructions),exports.DEBUG&&(console.log("---EXEC GLYPH---"),o.step=-1),qy(n,o,t,i),a=o.gZone;else{var l=e.font;a=[],s=[];for(var c=0;c=176&&s<=183)i+=s-176+1;else if(s>=184&&s<=191)i+=(s-184+1)*2;else if(e&&r===1&&s===27)break;while(r>0);n.ip=i}function VS(n,e){exports.DEBUG&&console.log(e.step,"SVTCA["+n.axis+"]"),e.fv=e.pv=e.dpv=n}function WS(n,e){exports.DEBUG&&console.log(e.step,"SPVTCA["+n.axis+"]"),e.pv=e.dpv=n}function YS(n,e){exports.DEBUG&&console.log(e.step,"SFVTCA["+n.axis+"]"),e.fv=n}function qS(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z2[i],a=e.z1[r];exports.DEBUG&&console.log("SPVTL["+n+"]",i,r);var o,l;n?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.pv=e.dpv=P0(o,l)}function XS(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z2[i],a=e.z1[r];exports.DEBUG&&console.log("SFVTL["+n+"]",i,r);var o,l;n?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.fv=P0(o,l)}function uJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"SPVFS[]",t,i),n.pv=n.dpv=P0(i,t)}function hJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"SPVFS[]",t,i),n.fv=P0(i,t)}function fJ(n){var e=n.stack,t=n.pv;exports.DEBUG&&console.log(n.step,"GPV[]"),e.push(t.x*16384),e.push(t.y*16384)}function dJ(n){var e=n.stack,t=n.fv;exports.DEBUG&&console.log(n.step,"GFV[]"),e.push(t.x*16384),e.push(t.y*16384)}function pJ(n){n.fv=n.pv,exports.DEBUG&&console.log(n.step,"SFVTPV[]")}function gJ(n){var e=n.stack,t=e.pop(),i=e.pop(),r=e.pop(),s=e.pop(),a=e.pop(),o=n.z0,l=n.z1,c=o[t],u=o[i],h=l[r],f=l[s],p=n.z2[a];exports.DEBUG&&console.log("ISECT[], ",t,i,r,s,a);var m=c.x,y=c.y,v=u.x,A=u.y,_=h.x,x=h.y,E=f.x,w=f.y,I=(m-v)*(x-w)-(y-A)*(_-E),T=m*A-y*v,M=_*w-x*E;p.x=(T*(_-E)-M*(m-v))/I,p.y=(T*(x-w)-M*(y-A))/I}function mJ(n){n.rp0=n.stack.pop(),exports.DEBUG&&console.log(n.step,"SRP0[]",n.rp0)}function AJ(n){n.rp1=n.stack.pop(),exports.DEBUG&&console.log(n.step,"SRP1[]",n.rp1)}function vJ(n){n.rp2=n.stack.pop(),exports.DEBUG&&console.log(n.step,"SRP2[]",n.rp2)}function yJ(n){var e=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"SZP0[]",e),n.zp0=e,e){case 0:n.tZone||C1(n),n.z0=n.tZone;break;case 1:n.z0=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function xJ(n){var e=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"SZP1[]",e),n.zp1=e,e){case 0:n.tZone||C1(n),n.z1=n.tZone;break;case 1:n.z1=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function _J(n){var e=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"SZP2[]",e),n.zp2=e,e){case 0:n.tZone||C1(n),n.z2=n.tZone;break;case 1:n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function EJ(n){var e=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"SZPS[]",e),n.zp0=n.zp1=n.zp2=e,e){case 0:n.tZone||C1(n),n.z0=n.z1=n.z2=n.tZone;break;case 1:n.z0=n.z1=n.z2=n.gZone;break;default:throw new Error("Invalid zone pointer")}}function SJ(n){n.loop=n.stack.pop(),exports.DEBUG&&console.log(n.step,"SLOOP[]",n.loop)}function wJ(n){exports.DEBUG&&console.log(n.step,"RTG[]"),n.round=gR}function CJ(n){exports.DEBUG&&console.log(n.step,"RTHG[]"),n.round=aJ}function TJ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SMD[]",e),n.minDis=e/64}function bJ(n){exports.DEBUG&&console.log(n.step,"ELSE[]"),AR(n,!1)}function IJ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"JMPR[]",e),n.ip+=e-1}function MJ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SCVTCI[]",e),n.cvCutIn=e/64}function RJ(n){var e=n.stack;exports.DEBUG&&console.log(n.step,"DUP[]"),e.push(e[e.length-1])}function i5(n){exports.DEBUG&&console.log(n.step,"POP[]"),n.stack.pop()}function BJ(n){exports.DEBUG&&console.log(n.step,"CLEAR[]"),n.stack.length=0}function DJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"SWAP[]"),e.push(t),e.push(i)}function PJ(n){var e=n.stack;exports.DEBUG&&console.log(n.step,"DEPTH[]"),e.push(e.length)}function LJ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"LOOPCALL[]",t,i);var r=n.ip,s=n.prog;n.prog=n.funcs[t];for(var a=0;a1?"loop "+(e.loop-o)+": ":"")+"SHP["+(n?"rp1":"rp2")+"]",c)}e.loop=1}function JS(n,e){var t=e.stack,i=n?e.rp1:e.rp2,r=(n?e.z0:e.z1)[i],s=e.fv,a=e.pv,o=t.pop(),l=e.z2[e.contours[o]],c=l;exports.DEBUG&&console.log(e.step,"SHC["+n+"]",o);var u=a.distance(r,r,!1,!0);do c!==r&&s.setRelative(c,c,u,a),c=c.nextPointOnContour;while(c!==l)}function ZS(n,e){var t=e.stack,i=n?e.rp1:e.rp2,r=(n?e.z0:e.z1)[i],s=e.fv,a=e.pv,o=t.pop();exports.DEBUG&&console.log(e.step,"SHZ["+n+"]",o);var l;switch(o){case 0:l=e.tZone;break;case 1:l=e.gZone;break;default:throw new Error("Invalid zone")}for(var c,u=a.distance(r,r,!1,!0),h=l.length-2,f=0;f1?"loop "+(n.loop-t)+": ":"")+"SHPIX[]",a,r),i.setRelative(o,o,r),i.touch(o)}n.loop=1}function GJ(n){for(var e=n.stack,t=n.rp1,i=n.rp2,r=n.loop,s=n.z0[t],a=n.z1[i],o=n.fv,l=n.dpv,c=n.z2;r--;){var u=e.pop(),h=c[u];exports.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-r)+": ":"")+"IP[]",u,t,"<->",i),o.interpolate(h,s,a,l),o.touch(h)}n.loop=1}function e9(n,e){var t=e.stack,i=t.pop()/64,r=t.pop(),s=e.z1[r],a=e.z0[e.rp0],o=e.fv,l=e.pv;o.setRelative(s,a,i,l),o.touch(s),exports.DEBUG&&console.log(e.step,"MSIRP["+n+"]",i,r),e.rp1=e.rp0,e.rp2=r,n&&(e.rp0=r)}function zJ(n){for(var e=n.stack,t=n.rp0,i=n.z0[t],r=n.loop,s=n.fv,a=n.pv,o=n.z1;r--;){var l=e.pop(),c=o[l];exports.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-r)+": ":"")+"ALIGNRP[]",l),s.setRelative(c,i,0,a),s.touch(c)}n.loop=1}function QJ(n){exports.DEBUG&&console.log(n.step,"RTDG[]"),n.round=sJ}function t9(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z0[r],a=e.fv,o=e.pv,l=e.cvt[i];exports.DEBUG&&console.log(e.step,"MIAP["+n+"]",i,"(",l,")",r);var c=o.distance(s,Zp);n&&(Math.abs(c-l)",o),e.stack.push(Math.round(o*64))}function jJ(n){exports.DEBUG&&console.log(n.step,"MPPEM[]"),n.stack.push(n.ppem)}function KJ(n){exports.DEBUG&&console.log(n.step,"FLIPON[]"),n.autoFlip=!0}function $J(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"LT[]",t,i),e.push(it?1:0)}function eZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"GTEQ[]",t,i),e.push(i>=t?1:0)}function tZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"EQ[]",t,i),e.push(t===i?1:0)}function nZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"NEQ[]",t,i),e.push(t!==i?1:0)}function iZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"ODD[]",t),e.push(Math.trunc(t)%2?1:0)}function rZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"EVEN[]",t),e.push(Math.trunc(t)%2?0:1)}function sZ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"IF[]",e),e||(AR(n,!0),exports.DEBUG&&console.log(n.step,"EIF[]"))}function aZ(n){exports.DEBUG&&console.log(n.step,"EIF[]")}function oZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"AND[]",t,i),e.push(t&&i?1:0)}function lZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"OR[]",t,i),e.push(t||i?1:0)}function cZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"NOT[]",t),e.push(t?0:1)}function r5(n,e){var t=e.stack,i=t.pop(),r=e.fv,s=e.pv,a=e.ppem,o=e.deltaBase+(n-1)*16,l=e.deltaShift,c=e.z0;exports.DEBUG&&console.log(e.step,"DELTAP["+n+"]",i,t);for(var u=0;u>4);if(p===a){var m=(f&15)-8;m>=0&&m++,exports.DEBUG&&console.log(e.step,"DELTAPFIX",h,"by",m*l);var y=c[h];r.setRelative(y,y,m*l,s)}}}function uZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"SDB[]",t),n.deltaBase=t}function hZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"SDS[]",t),n.deltaShift=Math.pow(.5,t)}function fZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"ADD[]",t,i),e.push(i+t)}function dZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"SUB[]",t,i),e.push(i-t)}function pZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"DIV[]",t,i),e.push(i*64/t)}function gZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"MUL[]",t,i),e.push(i*t/64)}function mZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"ABS[]",t),e.push(Math.abs(t))}function AZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"NEG[]",t),e.push(-t)}function vZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"FLOOR[]",t),e.push(Math.floor(t/64)*64)}function yZ(n){var e=n.stack,t=e.pop();exports.DEBUG&&console.log(n.step,"CEILING[]",t),e.push(Math.ceil(t/64)*64)}function Hg(n,e){var t=e.stack,i=t.pop();exports.DEBUG&&console.log(e.step,"ROUND[]"),t.push(e.round(i/64)*64)}function xZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"WCVTF[]",t,i),n.cvt[i]=t*n.ppem/n.font.unitsPerEm}function s5(n,e){var t=e.stack,i=t.pop(),r=e.ppem,s=e.deltaBase+(n-1)*16,a=e.deltaShift;exports.DEBUG&&console.log(e.step,"DELTAC["+n+"]",i,t);for(var o=0;o>4);if(u===r){var h=(c&15)-8;h>=0&&h++;var f=h*a;exports.DEBUG&&console.log(e.step,"DELTACFIX",l,"by",f),e.cvt[l]+=f}}}function _Z(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SROUND[]",e),n.round=mR;var t;switch(e&192){case 0:t=.5;break;case 64:t=1;break;case 128:t=2;break;default:throw new Error("invalid SROUND value")}switch(n.srPeriod=t,e&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*t;break;case 32:n.srPhase=.5*t;break;case 48:n.srPhase=.75*t;break;default:throw new Error("invalid SROUND value")}e&=15,e===0?n.srThreshold=0:n.srThreshold=(e/8-.5)*t}function EZ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"S45ROUND[]",e),n.round=mR;var t;switch(e&192){case 0:t=Math.sqrt(2)/2;break;case 64:t=Math.sqrt(2);break;case 128:t=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(n.srPeriod=t,e&48){case 0:n.srPhase=0;break;case 16:n.srPhase=.25*t;break;case 32:n.srPhase=.5*t;break;case 48:n.srPhase=.75*t;break;default:throw new Error("invalid S45ROUND value")}e&=15,e===0?n.srThreshold=0:n.srThreshold=(e/8-.5)*t}function SZ(n){exports.DEBUG&&console.log(n.step,"ROFF[]"),n.round=rJ}function wZ(n){exports.DEBUG&&console.log(n.step,"RUTG[]"),n.round=oJ}function CZ(n){exports.DEBUG&&console.log(n.step,"RDTG[]"),n.round=lJ}function TZ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SCANCTRL[]",e)}function r9(n,e){var t=e.stack,i=t.pop(),r=t.pop(),s=e.z2[i],a=e.z1[r];exports.DEBUG&&console.log(e.step,"SDPVTL["+n+"]",i,r);var o,l;n?(o=s.y-a.y,l=a.x-s.x):(o=a.x-s.x,l=a.y-s.y),e.dpv=P0(o,l)}function bZ(n){var e=n.stack,t=e.pop(),i=0;exports.DEBUG&&console.log(n.step,"GETINFO[]",t),t&1&&(i=35),t&32&&(i|=4096),e.push(i)}function IZ(n){var e=n.stack,t=e.pop(),i=e.pop(),r=e.pop();exports.DEBUG&&console.log(n.step,"ROLL[]"),e.push(i),e.push(t),e.push(r)}function MZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"MAX[]",t,i),e.push(Math.max(i,t))}function RZ(n){var e=n.stack,t=e.pop(),i=e.pop();exports.DEBUG&&console.log(n.step,"MIN[]",t,i),e.push(Math.min(i,t))}function BZ(n){var e=n.stack.pop();exports.DEBUG&&console.log(n.step,"SCANTYPE[]",e)}function DZ(n){var e=n.stack.pop(),t=n.stack.pop();switch(exports.DEBUG&&console.log(n.step,"INSTCTRL[]",e,t),e){case 1:n.inhibitGridFit=!!t;return;case 2:n.ignoreCvt=!!t;return;default:throw new Error("invalid INSTCTRL[] selector")}}function vl(n,e){var t=e.stack,i=e.prog,r=e.ip;exports.DEBUG&&console.log(e.step,"PUSHB["+n+"]");for(var s=0;s=0?1:-1,v=Math.abs(v),n&&(_=s.cvt[o],i&&Math.abs(v-_)":"_")+(i?"R":"_")+(r===0?"Gr":r===1?"Bl":r===2?"Wh":"")+"]",n?o+"("+s.cvt[o]+","+_+")":"",l,"(d =",y,"->",A*v,")"),s.rp1=s.rp0,s.rp2=l,e&&(s.rp0=l)}fR=[VS.bind(void 0,Fo),VS.bind(void 0,Qa),WS.bind(void 0,Fo),WS.bind(void 0,Qa),YS.bind(void 0,Fo),YS.bind(void 0,Qa),qS.bind(void 0,0),qS.bind(void 0,1),XS.bind(void 0,0),XS.bind(void 0,1),uJ,hJ,fJ,dJ,pJ,gJ,mJ,AJ,vJ,yJ,xJ,_J,EJ,SJ,wJ,CJ,TJ,bJ,IJ,MJ,void 0,void 0,RJ,i5,BJ,DJ,PJ,OJ,FJ,void 0,void 0,void 0,LJ,UJ,kJ,void 0,jS.bind(void 0,0),jS.bind(void 0,1),KS.bind(void 0,Fo),KS.bind(void 0,Qa),$S.bind(void 0,0),$S.bind(void 0,1),JS.bind(void 0,0),JS.bind(void 0,1),ZS.bind(void 0,0),ZS.bind(void 0,1),NJ,GJ,e9.bind(void 0,0),e9.bind(void 0,1),zJ,QJ,t9.bind(void 0,0),t9.bind(void 0,1),HJ,VJ,WJ,YJ,qJ,XJ,n9.bind(void 0,0),n9.bind(void 0,1),void 0,i9.bind(void 0,0),i9.bind(void 0,1),jJ,void 0,KJ,void 0,void 0,$J,JJ,ZJ,eZ,tZ,nZ,iZ,rZ,sZ,aZ,oZ,lZ,cZ,r5.bind(void 0,1),uZ,hZ,fZ,dZ,pZ,gZ,mZ,AZ,vZ,yZ,Hg.bind(void 0,0),Hg.bind(void 0,1),Hg.bind(void 0,2),Hg.bind(void 0,3),void 0,void 0,void 0,void 0,xZ,r5.bind(void 0,2),r5.bind(void 0,3),s5.bind(void 0,1),s5.bind(void 0,2),s5.bind(void 0,3),_Z,EZ,void 0,void 0,SZ,void 0,wZ,CZ,i5,i5,void 0,void 0,void 0,void 0,void 0,TZ,r9.bind(void 0,0),r9.bind(void 0,1),bZ,void 0,IZ,MZ,RZ,BZ,DZ,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,vl.bind(void 0,1),vl.bind(void 0,2),vl.bind(void 0,3),vl.bind(void 0,4),vl.bind(void 0,5),vl.bind(void 0,6),vl.bind(void 0,7),vl.bind(void 0,8),yl.bind(void 0,1),yl.bind(void 0,2),yl.bind(void 0,3),yl.bind(void 0,4),yl.bind(void 0,5),yl.bind(void 0,6),yl.bind(void 0,7),yl.bind(void 0,8),at.bind(void 0,0,0,0,0,0),at.bind(void 0,0,0,0,0,1),at.bind(void 0,0,0,0,0,2),at.bind(void 0,0,0,0,0,3),at.bind(void 0,0,0,0,1,0),at.bind(void 0,0,0,0,1,1),at.bind(void 0,0,0,0,1,2),at.bind(void 0,0,0,0,1,3),at.bind(void 0,0,0,1,0,0),at.bind(void 0,0,0,1,0,1),at.bind(void 0,0,0,1,0,2),at.bind(void 0,0,0,1,0,3),at.bind(void 0,0,0,1,1,0),at.bind(void 0,0,0,1,1,1),at.bind(void 0,0,0,1,1,2),at.bind(void 0,0,0,1,1,3),at.bind(void 0,0,1,0,0,0),at.bind(void 0,0,1,0,0,1),at.bind(void 0,0,1,0,0,2),at.bind(void 0,0,1,0,0,3),at.bind(void 0,0,1,0,1,0),at.bind(void 0,0,1,0,1,1),at.bind(void 0,0,1,0,1,2),at.bind(void 0,0,1,0,1,3),at.bind(void 0,0,1,1,0,0),at.bind(void 0,0,1,1,0,1),at.bind(void 0,0,1,1,0,2),at.bind(void 0,0,1,1,0,3),at.bind(void 0,0,1,1,1,0),at.bind(void 0,0,1,1,1,1),at.bind(void 0,0,1,1,1,2),at.bind(void 0,0,1,1,1,3),at.bind(void 0,1,0,0,0,0),at.bind(void 0,1,0,0,0,1),at.bind(void 0,1,0,0,0,2),at.bind(void 0,1,0,0,0,3),at.bind(void 0,1,0,0,1,0),at.bind(void 0,1,0,0,1,1),at.bind(void 0,1,0,0,1,2),at.bind(void 0,1,0,0,1,3),at.bind(void 0,1,0,1,0,0),at.bind(void 0,1,0,1,0,1),at.bind(void 0,1,0,1,0,2),at.bind(void 0,1,0,1,0,3),at.bind(void 0,1,0,1,1,0),at.bind(void 0,1,0,1,1,1),at.bind(void 0,1,0,1,1,2),at.bind(void 0,1,0,1,1,3),at.bind(void 0,1,1,0,0,0),at.bind(void 0,1,1,0,0,1),at.bind(void 0,1,1,0,0,2),at.bind(void 0,1,1,0,0,3),at.bind(void 0,1,1,0,1,0),at.bind(void 0,1,1,0,1,1),at.bind(void 0,1,1,0,1,2),at.bind(void 0,1,1,0,1,3),at.bind(void 0,1,1,1,0,0),at.bind(void 0,1,1,1,0,1),at.bind(void 0,1,1,1,0,2),at.bind(void 0,1,1,1,0,3),at.bind(void 0,1,1,1,1,0),at.bind(void 0,1,1,1,1,1),at.bind(void 0,1,1,1,1,2),at.bind(void 0,1,1,1,1,3)];function xf(n){this.char=n,this.state={},this.activeState=null}function u8(n,e,t){this.contextName=t,this.startIndex=n,this.endOffset=e}function PZ(n,e,t){this.contextName=n,this.openRange=null,this.ranges=[],this.checkStart=e,this.checkEnd=t}function pa(n,e){this.context=n,this.index=e,this.length=n.length,this.current=n[e],this.backtrack=n.slice(0,e),this.lookahead=n.slice(e+1)}function T1(n){this.eventId=n,this.subscribers=[]}function LZ(n){var e=this,t=["start","end","next","newToken","contextStart","contextEnd","insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD","updateContextsRanges"];t.forEach(function(r){Object.defineProperty(e.events,r,{value:new T1(r)})}),n&&t.forEach(function(r){var s=n[r];typeof s=="function"&&e.events[r].subscribe(s)});var i=["insertToken","removeToken","removeRange","replaceToken","replaceRange","composeRUD"];i.forEach(function(r){e.events[r].subscribe(e.updateContextsRanges)})}function ui(n){this.tokens=[],this.registeredContexts={},this.contextCheckers=[],this.events={},this.registeredModifiers=[],LZ.call(this,n)}xf.prototype.setState=function(n,e){return this.state[n]=e,this.activeState={key:n,value:this.state[n]},this.activeState};xf.prototype.getState=function(n){return this.state[n]||null};ui.prototype.inboundIndex=function(n){return n>=0&&n0&&n<=this.lookahead.length):return this.lookahead[n-1];default:return null}};ui.prototype.rangeToText=function(n){if(n instanceof u8)return this.getRangeTokens(n).map(function(e){return e.char}).join("")};ui.prototype.getText=function(){return this.tokens.map(function(n){return n.char}).join("")};ui.prototype.getContext=function(n){var e=this.registeredContexts[n];return e||null};ui.prototype.on=function(n,e){var t=this.events[n];return t?t.subscribe(e):null};ui.prototype.dispatch=function(n,e){var t=this,i=this.events[n];i instanceof T1&&i.subscribers.forEach(function(r){r.apply(t,e||[])})};ui.prototype.registerContextChecker=function(n,e,t){if(this.getContext(n))return{FAIL:"context name '"+n+"' is already registered."};if(typeof e!="function")return{FAIL:"missing context start check."};if(typeof t!="function")return{FAIL:"missing context end check."};var i=new PZ(n,e,t);return this.registeredContexts[n]=i,this.contextCheckers.push(i),i};ui.prototype.getRangeTokens=function(n){var e=n.startIndex+n.endOffset;return[].concat(this.tokens.slice(n.startIndex,e))};ui.prototype.getContextRanges=function(n){var e=this.getContext(n);return e?e.ranges:{FAIL:"context checker '"+n+"' is not registered."}};ui.prototype.resetContextsRanges=function(){var n=this.registeredContexts;for(var e in n)if(n.hasOwnProperty(e)){var t=n[e];t.ranges=[]}};ui.prototype.updateContextsRanges=function(){this.resetContextsRanges();for(var n=this.tokens.map(function(i){return i.char}),e=0;e=r.start&&n<=r.end){var s=n-r.start;return r.index+s}}break;default:return-1}return-1}function OZ(n,e){var t=L0(n,e.coverage);return t===-1?null:n+e.deltaGlyphId}function FZ(n,e){var t=L0(n,e.coverage);return t===-1?null:e.substitute[t]}function a5(n,e){for(var t=[],i=0;i=0;t--){var i=e[t],r=vR(i),s=zl(i);if(!r&&!s)return!0;if(r)return!1}return!1}function JZ(n){if(vR(n.current))return!1;for(var e=0;e0}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm>0};kn.prototype.toTables=function(){return j$.fontToTable(this)};kn.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()};kn.prototype.toArrayBuffer=function(){for(var n=this.toTables(),e=n.encode(),t=new ArrayBuffer(e.length),i=new Uint8Array(t),r=0;re in n?uee(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ut=(n,e,t)=>(hee(n,typeof e!="symbol"?e+"":e,t),t);const Vg=(n,e)=>{const t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),r=new Set(Object.keys(n[0].morphAttributes)),s={},a={},o=n[0].morphTargetsRelative,l=new Bt;let c=0;if(n.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 p in u.attributes){if(!i.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+'. All geometries must have compatible attributes; make sure "'+p+'" attribute exists among all geometries, or in none of them.'),null;s[p]===void 0&&(s[p]=[]),s[p].push(u.attributes[p]),f++}if(f!==i.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(o!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let p in u.morphAttributes){if(!r.has(p))return console.error("THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index "+h+". .morphAttributes must be consistent throughout all geometries."),null;a[p]===void 0&&(a[p]=[]),a[p].push(u.morphAttributes[p])}if(l.userData.mergedUserData=l.userData.mergedUserData||[],l.userData.mergedUserData.push(u.userData),e){let p;if(u.index)p=u.index.count;else if(u.attributes.position!==void 0)p=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,p,h),c+=p}}),t){let u=0;const h=[];n.forEach(f=>{const p=f.index;for(let m=0;m{let e,t,i,r=0;if(n.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(i===void 0&&(i=s.normalized),i!==s.normalized)return console.error("THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;r+=s.array.length}),e&&t){const s=new e(r);let a=0;return n.forEach(o=>{s.set(o.array,a),a+=o.array.length}),new En(s,t,i)}};new He;const yR=class{parse(n,e={decodeSpeed:5,encodeSpeed:5,encoderMethod:yR.MESH_EDGEBREAKER_ENCODING,quantization:[16,8,8,8,8],exportUvs:!0,exportNormals:!0,exportColor:!1}){if(n instanceof Bt&&n.isBufferGeometry)throw new Error("DRACOExporter: The first parameter of parse() is now an instance of Mesh or Points.");if(DracoEncoderModule===void 0)throw new Error("THREE.DRACOExporter: required the draco_encoder to work.");const t=n.geometry,i=DracoEncoderModule(),r=new i.Encoder;let s,a;if(!t.isBufferGeometry)throw new Error("THREE.DRACOExporter.parse(geometry, options): geometry is not a THREE.BufferGeometry instance.");if(n instanceof nn&&n.isMesh){s=new i.MeshBuilder,a=new i.Mesh;const f=t.getAttribute("position");s.AddFloatAttributeToMesh(a,i.POSITION,f.count,f.itemSize,f.array);const p=t.getIndex();if(p!==null)s.AddFacesToMesh(a,p.count/3,p.array);else{const m=new(f.count>65535?Uint32Array:Uint16Array)(f.count);for(let y=0;y0)return;v.reflect(u).negate(),v.add(h),p.extractRotation(b.matrixWorld),m.set(0,0,-1),m.applyMatrix4(p),m.add(f),A.subVectors(h,m),A.reflect(u).negate(),A.add(h),E.position.copy(v),E.up.set(0,1,0),E.up.applyMatrix4(p),E.up.reflect(u),E.lookAt(A),E.far=b.far,E.updateMatrixWorld(),E.projectionMatrix.copy(b.projectionMatrix),x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(E.projectionMatrix),x.multiply(E.matrixWorldInverse),x.multiply(t.matrixWorld),c.setFromNormalAndCoplanarPoint(u,h),c.applyMatrix4(E.matrixWorldInverse),y.set(c.normal.x,c.normal.y,c.normal.z,c.constant);const B=E.projectionMatrix;_.x=(Math.sign(y.x)+B.elements[8])/B.elements[0],_.y=(Math.sign(y.y)+B.elements[9])/B.elements[5],_.z=-1,_.w=(1+B.elements[10])/B.elements[14],y.multiplyScalar(2/y.dot(_)),B.elements[2]=y.x,B.elements[6]=y.y,B.elements[10]=y.z+1-a,B.elements[14]=y.w,t.visible=!1;const L=T.getRenderTarget(),U=T.xr.enabled,O=T.shadowMap.autoUpdate,Q=T.toneMapping;let G=!1;"outputColorSpace"in T?G=T.outputColorSpace==="srgb":G=T.outputEncoding===3001,T.xr.enabled=!1,T.shadowMap.autoUpdate=!1,"outputColorSpace"in T?T.outputColorSpace="linear-srgb":T.outputEncoding=3e3,T.toneMapping=os,T.setRenderTarget(w),T.state.buffers.depth.setMask(!0),T.autoClear===!1&&T.clear(),T.render(M,E),T.xr.enabled=U,T.shadowMap.autoUpdate=O,T.toneMapping=Q,"outputColorSpace"in T?T.outputColorSpace=G?"srgb":"srgb-linear":T.outputEncoding=G?3001:3e3,T.setRenderTarget(L);const F=b.viewport;F!==void 0&&T.state.viewport(F),t.visible=!0},this.getRenderTarget=function(){return w},this.dispose=function(){w.dispose(),t.material.dispose()}}};let Xy=xR;ut(Xy,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:` + uniform mat4 textureMatrix; + varying vec4 vUv; + + #include + #include + + void main() { + + vUv = textureMatrix * vec4( position, 1.0 ); + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + #include + + }`,fragmentShader:` + uniform vec3 color; + uniform sampler2D tDiffuse; + varying vec4 vUv; + + #include + + float blendOverlay( float base, float blend ) { + + return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); + + } + + vec3 blendOverlay( vec3 base, vec3 blend ) { + + return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); + + } + + void main() { + + #include + + vec4 base = texture2DProj( tDiffuse, vUv ); + gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); + + #include + #include <${parseInt(Wl.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});const _R=class extends nn{constructor(n,e={}){super(n),this.isRefractor=!0,this.type="Refractor",this.camera=new Kn;const t=this,i=e.color!==void 0?new He(e.color):new He(8355711),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.shader||_R.RefractorShader,l=e.multisample!==void 0?e.multisample:4,c=this.camera;c.matrixAutoUpdate=!1,c.userData.refractor=!0;const u=new rs,h=new ct,f=new Dn(r,s,{samples:l,type:Ai});this.material=new sn({uniforms:Hn.clone(o.uniforms),vertexShader:o.vertexShader,fragmentShader:o.fragmentShader,transparent:!0}),this.material.uniforms.color.value=i,this.material.uniforms.tDiffuse.value=f.texture,this.material.uniforms.textureMatrix.value=h;const p=function(){const _=new N,x=new N,E=new ct,w=new N,I=new N;return function(M){return _.setFromMatrixPosition(t.matrixWorld),x.setFromMatrixPosition(M.matrixWorld),w.subVectors(_,x),E.extractRotation(t.matrixWorld),I.set(0,0,1),I.applyMatrix4(E),w.dot(I)<0}}(),m=function(){const _=new N,x=new N,E=new $i,w=new N;return function(){t.matrixWorld.decompose(x,E,w),_.set(0,0,1).applyQuaternion(E).normalize(),_.negate(),u.setFromNormalAndCoplanarPoint(_,x)}}(),y=function(){const _=new rs,x=new jt,E=new jt;return function(I){c.matrixWorld.copy(I.matrixWorld),c.matrixWorldInverse.copy(c.matrixWorld).invert(),c.projectionMatrix.copy(I.projectionMatrix),c.far=I.far,_.copy(u),_.applyMatrix4(c.matrixWorldInverse),x.set(_.normal.x,_.normal.y,_.normal.z,_.constant);const T=c.projectionMatrix;E.x=(Math.sign(x.x)+T.elements[8])/T.elements[0],E.y=(Math.sign(x.y)+T.elements[9])/T.elements[5],E.z=-1,E.w=(1+T.elements[10])/T.elements[14],x.multiplyScalar(2/x.dot(E)),T.elements[2]=x.x,T.elements[6]=x.y,T.elements[10]=x.z+1-a,T.elements[14]=x.w}}();function v(_){h.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),h.multiply(_.projectionMatrix),h.multiply(_.matrixWorldInverse),h.multiply(t.matrixWorld)}function A(_,x,E){t.visible=!1;const w=_.getRenderTarget(),I=_.xr.enabled,T=_.shadowMap.autoUpdate,M=_.toneMapping;let b=!1;"outputColorSpace"in _?b=_.outputColorSpace==="srgb":b=_.outputEncoding===3001,_.xr.enabled=!1,_.shadowMap.autoUpdate=!1,"outputColorSpace"in _?_.outputColorSpace="linear-srgb":_.outputEncoding=3e3,_.toneMapping=os,_.setRenderTarget(f),_.autoClear===!1&&_.clear(),_.render(x,c),_.xr.enabled=I,_.shadowMap.autoUpdate=T,_.toneMapping=M,_.setRenderTarget(w),"outputColorSpace"in _?_.outputColorSpace=b?"srgb":"srgb-linear":_.outputEncoding=b?3001:3e3;const B=E.viewport;B!==void 0&&_.state.viewport(B),t.visible=!0}this.onBeforeRender=function(_,x,E){E.userData.refractor!==!0&&p(E)&&(m(),v(E),y(E),A(_,x,E))},this.getRenderTarget=function(){return f},this.dispose=function(){f.dispose(),t.material.dispose()}}};let jy=_R;ut(jy,"RefractorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:` + + uniform mat4 textureMatrix; + + varying vec4 vUv; + + void main() { + + vUv = textureMatrix * vec4( position, 1.0 ); + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + }`,fragmentShader:` + + uniform vec3 color; + uniform sampler2D tDiffuse; + + varying vec4 vUv; + + float blendOverlay( float base, float blend ) { + + return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); + + } + + vec3 blendOverlay( vec3 base, vec3 blend ) { + + return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); + + } + + void main() { + + vec4 base = texture2DProj( tDiffuse, vUv ); + gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); + + #include + #include <${parseInt(Wl.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});const fee=new Bt,Ky=class extends nn{constructor(){super(Ky.Geometry,new cs({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const n=new N,e=new N,t=new Va(new Uint8Array(16*16*3),16,16,li);t.minFilter=Rt,t.magFilter=Rt,t.wrapS=oi,t.wrapT=oi;const i=new Va(new Uint8Array(16*16*3),16,16,li);i.minFilter=Rt,i.magFilter=Rt,i.wrapS=oi,i.wrapT=oi;const r=Ky.Geometry,s=new tp({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + + void main() { + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + void main() { + + gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 ); + + }`,depthTest:!0,depthWrite:!1,transparent:!1}),a=new tp({uniforms:{map:{value:t},scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + attribute vec2 uv; + + varying vec2 vUV; + + void main() { + + vUV = uv; + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + uniform sampler2D map; + + varying vec2 vUV; + + void main() { + + gl_FragColor = texture2D( map, vUV ); + + }`,depthTest:!1,depthWrite:!1,transparent:!1}),o=new nn(r,s),l=[],c=ER.Shader,u=new tp({uniforms:{map:{value:null},occlusionMap:{value:i},color:{value:new He(16777215)},scale:{value:new _e},screenPosition:{value:new N}},vertexShader:c.vertexShader,fragmentShader:c.fragmentShader,blending:dp,transparent:!0,depthWrite:!1}),h=new nn(r,u);this.addElement=function(v){l.push(v)};const f=new _e,p=new _e,m=new qT,y=new jt;this.onBeforeRender=function(v,A,_){v.getCurrentViewport(y);const x=y.w/y.z,E=y.z/2,w=y.w/2;let I=16/y.w;if(f.set(I*x,I),m.min.set(y.x,y.y),m.max.set(y.x+(y.z-16),y.y+(y.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(_.matrixWorldInverse),!(e.z>0)&&(n.copy(e).applyMatrix4(_.projectionMatrix),p.x=y.x+n.x*E+E-8,p.y=y.y+n.y*w+w-8,m.containsPoint(p))){v.copyFramebufferToTexture(p,t);let T=s.uniforms;T.scale.value=f,T.screenPosition.value=n,v.renderBufferDirect(_,null,r,s,o,null),v.copyFramebufferToTexture(p,i),T=a.uniforms,T.scale.value=f,T.screenPosition.value=n,v.renderBufferDirect(_,null,r,a,o,null);const M=-n.x*2,b=-n.y*2;for(let B=0,L=l.length;Bt[0]*i+t[1]*r),ut(this,"dot3",(t,i,r,s)=>t[0]*i+t[1]*r+t[2]*s),ut(this,"dot4",(t,i,r,s,a)=>t[0]*i+t[1]*r+t[2]*s+t[3]*a),ut(this,"noise",(t,i)=>{let r,s,a;const o=.5*(Math.sqrt(3)-1),l=(t+i)*o,c=Math.floor(t+l),u=Math.floor(i+l),h=(3-Math.sqrt(3))/6,f=(c+u)*h,p=c-f,m=u-f,y=t-p,v=i-m;let A=0,_=1;y>v&&(A=1,_=0);const x=y-A+h,E=v-_+h,w=y-1+2*h,I=v-1+2*h,T=c&255,M=u&255,b=this.perm[T+this.perm[M]]%12,B=this.perm[T+A+this.perm[M+_]]%12,L=this.perm[T+1+this.perm[M+1]]%12;let U=.5-y*y-v*v;U<0?r=0:(U*=U,r=U*U*this.dot(this.grad3[b],y,v));let O=.5-x*x-E*E;O<0?s=0:(O*=O,s=O*O*this.dot(this.grad3[B],x,E));let Q=.5-w*w-I*I;return Q<0?a=0:(Q*=Q,a=Q*Q*this.dot(this.grad3[L],w,I)),70*(r+s+a)}),ut(this,"noise3d",(t,i,r)=>{let s,a,o,l;const c=.3333333333333333,u=(t+i+r)*c,h=Math.floor(t+u),f=Math.floor(i+u),p=Math.floor(r+u),m=1/6,y=(h+f+p)*m,v=h-y,A=f-y,_=p-y,x=t-v,E=i-A,w=r-_;let I,T,M,b,B,L;x>=E?E>=w?(I=1,T=0,M=0,b=1,B=1,L=0):x>=w?(I=1,T=0,M=0,b=1,B=0,L=1):(I=0,T=0,M=1,b=1,B=0,L=1):E{const a=this.grad4,o=this.simplex,l=this.perm,c=(Math.sqrt(5)-1)/4,u=(5-Math.sqrt(5))/20;let h,f,p,m,y;const v=(t+i+r+s)*c,A=Math.floor(t+v),_=Math.floor(i+v),x=Math.floor(r+v),E=Math.floor(s+v),w=(A+_+x+E)*u,I=A-w,T=_-w,M=x-w,b=E-w,B=t-I,L=i-T,U=r-M,O=s-b,Q=B>L?32:0,G=B>U?16:0,F=L>U?8:0,q=B>O?4:0,Y=L>O?2:0,H=U>O?1:0,V=Q+G+F+q+Y+H;let D,k,Z,j,ee,ie,te,re,ce,ye,oe,W;D=o[V][0]>=3?1:0,k=o[V][1]>=3?1:0,Z=o[V][2]>=3?1:0,j=o[V][3]>=3?1:0,ee=o[V][0]>=2?1:0,ie=o[V][1]>=2?1:0,te=o[V][2]>=2?1:0,re=o[V][3]>=2?1:0,ce=o[V][0]>=1?1:0,ye=o[V][1]>=1?1:0,oe=o[V][2]>=1?1:0,W=o[V][3]>=1?1:0;const ge=B-D+u,he=L-k+u,ue=U-Z+u,fe=O-j+u,Pe=B-ee+2*u,pe=L-ie+2*u,Re=U-te+2*u,Le=O-re+2*u,Se=B-ce+3*u,$e=L-ye+3*u,X=U-oe+3*u,z=O-W+3*u,se=B-1+4*u,Be=L-1+4*u,Ce=U-1+4*u,we=O-1+4*u,ke=A&255,Ue=_&255,xe=x&255,ze=E&255,je=l[ke+l[Ue+l[xe+l[ze]]]]%32,We=l[ke+D+l[Ue+k+l[xe+Z+l[ze+j]]]]%32,Oe=l[ke+ee+l[Ue+ie+l[xe+te+l[ze+re]]]]%32,Ve=l[ke+ce+l[Ue+ye+l[xe+oe+l[ze+W]]]]%32,it=l[ke+1+l[Ue+1+l[xe+1+l[ze+1]]]]%32;let gt=.6-B*B-L*L-U*U-O*O;gt<0?h=0:(gt*=gt,h=gt*gt*this.dot4(a[je],B,L,U,O));let ne=.6-ge*ge-he*he-ue*ue-fe*fe;ne<0?f=0:(ne*=ne,f=ne*ne*this.dot4(a[We],ge,he,ue,fe));let Fe=.6-Pe*Pe-pe*pe-Re*Re-Le*Le;Fe<0?p=0:(Fe*=Fe,p=Fe*Fe*this.dot4(a[Oe],Pe,pe,Re,Le));let me=.6-Se*Se-$e*$e-X*X-z*z;me<0?m=0:(me*=me,m=me*me*this.dot4(a[Ve],Se,$e,X,z));let Qe=.6-se*se-Be*Be-Ce*Ce-we*we;return Qe<0?y=0:(Qe*=Qe,y=Qe*Qe*this.dot4(a[it],se,Be,Ce,we)),27*(h+f+p+m+y)});for(let t=0;t<256;t++)this.p[t]=Math.floor(e.random()*256);for(let t=0;t<512;t++)this.perm[t]=this.p[t&255]}}const Sr=class extends Bt{constructor(n={}){super(),this.isLightningStrike=!0,this.type="LightningStrike",this.init(Sr.copyParameters(n,n)),this.createMesh()}static createRandomGenerator(){const e=[];for(let i=0;i<2053;i++)e.push(Math.random());const t={currentSeed:0,random:function(){const i=e[t.currentSeed];return t.currentSeed=(t.currentSeed+1)%2053,i},getSeed:function(){return t.currentSeed/2053},setSeed:function(i){t.currentSeed=Math.floor(i*2053)%2053}};return t}static copyParameters(n={},e={}){const t=function(i){return e===n?i:i.clone()};return n.sourceOffset=e.sourceOffset!==void 0?t(e.sourceOffset):new N(0,100,0),n.destOffset=e.destOffset!==void 0?t(e.destOffset):new N(0,0,0),n.timeScale=e.timeScale!==void 0?e.timeScale:1,n.roughness=e.roughness!==void 0?e.roughness:.9,n.straightness=e.straightness!==void 0?e.straightness:.7,n.up0=e.up0!==void 0?t(e.up0):new N(0,0,1),n.up1=e.up1!==void 0?t(e.up1):new N(0,0,1),n.radius0=e.radius0!==void 0?e.radius0:1,n.radius1=e.radius1!==void 0?e.radius1:1,n.radius0Factor=e.radius0Factor!==void 0?e.radius0Factor:.5,n.radius1Factor=e.radius1Factor!==void 0?e.radius1Factor:.2,n.minRadius=e.minRadius!==void 0?e.minRadius:.2,n.isEternal=e.isEternal!==void 0?e.isEternal:e.birthTime===void 0||e.deathTime===void 0,n.birthTime=e.birthTime,n.deathTime=e.deathTime,n.propagationTimeFactor=e.propagationTimeFactor!==void 0?e.propagationTimeFactor:.1,n.vanishingTimeFactor=e.vanishingTimeFactor!==void 0?e.vanishingTimeFactor:.9,n.subrayPeriod=e.subrayPeriod!==void 0?e.subrayPeriod:4,n.subrayDutyCycle=e.subrayDutyCycle!==void 0?e.subrayDutyCycle:.6,n.maxIterations=e.maxIterations!==void 0?e.maxIterations:9,n.isStatic=e.isStatic!==void 0?e.isStatic:!1,n.ramification=e.ramification!==void 0?e.ramification:5,n.maxSubrayRecursion=e.maxSubrayRecursion!==void 0?e.maxSubrayRecursion:3,n.recursionProbability=e.recursionProbability!==void 0?e.recursionProbability:.6,n.generateUVs=e.generateUVs!==void 0?e.generateUVs:!1,n.randomGenerator=e.randomGenerator,n.noiseSeed=e.noiseSeed,n.onDecideSubrayCreation=e.onDecideSubrayCreation,n.onSubrayCreation=e.onSubrayCreation,n}update(n){this.isStatic||(this.rayParameters.isEternal||this.rayParameters.birthTime<=n&&n<=this.rayParameters.deathTime?(this.updateMesh(n),nthis.subrays[0].beginVanishingTime?this.state=Sr.RAY_VANISHING:this.state=Sr.RAY_STEADY,this.visible=!0):(this.visible=!1,n=i.fraction0*r.propagationTimeFactor&&(e.createPrism(i),e.onDecideSubrayCreation(i,e)):n=this.currentSubray.maxIterations){this.currentSegmentCallback(n);return}this.forwards.subVectors(n.pos1,n.pos0);let e=this.forwards.length();e<1e-6&&(this.forwards.set(0,0,.01),e=this.forwards.length());const t=(n.radius0+n.radius1)*.5,i=(n.fraction0+n.fraction1)*.5,r=this.time*this.currentSubray.timeScale*Math.pow(2,n.iteration);this.middlePos.lerpVectors(n.pos0,n.pos1,.5),this.middleLinPos.lerpVectors(n.linPos0,n.linPos1,.5);const s=this.middleLinPos;this.newPos.set(this.simplexX.noise4d(s.x,s.y,s.z,r),this.simplexY.noise4d(s.x,s.y,s.z,r),this.simplexZ.noise4d(s.x,s.y,s.z,r)),this.newPos.multiplyScalar(n.positionVariationFactor*e),this.newPos.add(this.middlePos);const a=this.getNewSegment();a.pos0.copy(n.pos0),a.pos1.copy(this.newPos),a.linPos0.copy(n.linPos0),a.linPos1.copy(this.middleLinPos),a.up0.copy(n.up0),a.up1.copy(n.up1),a.radius0=n.radius0,a.radius1=t,a.fraction0=n.fraction0,a.fraction1=i,a.positionVariationFactor=n.positionVariationFactor*this.currentSubray.roughness,a.iteration=n.iteration+1;const o=this.getNewSegment();o.pos0.copy(this.newPos),o.pos1.copy(n.pos1),o.linPos0.copy(this.middleLinPos),o.linPos1.copy(n.linPos1),this.cross1.crossVectors(n.up0,this.forwards.normalize()),o.up0.crossVectors(this.forwards,this.cross1).normalize(),o.up1.copy(n.up1),o.radius0=t,o.radius1=n.radius1,o.fraction0=i,o.fraction1=n.fraction1,o.positionVariationFactor=n.positionVariationFactor*this.currentSubray.roughness,o.iteration=n.iteration+1,this.fractalRayRecursive(a),this.fractalRayRecursive(o)}createPrism(n){this.forwardsFill.subVectors(n.pos1,n.pos0).normalize(),this.isInitialSegment&&(this.currentCreateTriangleVertices(n.pos0,n.up0,this.forwardsFill,n.radius0,0),this.isInitialSegment=!1),this.currentCreateTriangleVertices(n.pos1,n.up0,this.forwardsFill,n.radius1,n.fraction1),this.createPrismFaces()}createTriangleVerticesWithoutUVs(n,e,t,i){this.side.crossVectors(e,t).multiplyScalar(i*Sr.COS30DEG),this.down.copy(e).multiplyScalar(-i*Sr.SIN30DEG);const r=this.vPos,s=this.vertices;r.copy(n).sub(this.side).add(this.down),s[this.currentCoordinate++]=r.x,s[this.currentCoordinate++]=r.y,s[this.currentCoordinate++]=r.z,r.copy(n).add(this.side).add(this.down),s[this.currentCoordinate++]=r.x,s[this.currentCoordinate++]=r.y,s[this.currentCoordinate++]=r.z,r.copy(e).multiplyScalar(i).add(n),s[this.currentCoordinate++]=r.x,s[this.currentCoordinate++]=r.y,s[this.currentCoordinate++]=r.z,this.currentVertex+=3}createTriangleVerticesWithUVs(n,e,t,i,r){this.side.crossVectors(e,t).multiplyScalar(i*Sr.COS30DEG),this.down.copy(e).multiplyScalar(-i*Sr.SIN30DEG);const s=this.vPos,a=this.vertices,o=this.uvs;s.copy(n).sub(this.side).add(this.down),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=r,o[this.currentUVCoordinate++]=0,s.copy(n).add(this.side).add(this.down),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=r,o[this.currentUVCoordinate++]=.5,s.copy(e).multiplyScalar(i).add(n),a[this.currentCoordinate++]=s.x,a[this.currentCoordinate++]=s.y,a[this.currentCoordinate++]=s.z,o[this.currentUVCoordinate++]=r,o[this.currentUVCoordinate++]=1,this.currentVertex+=3}createPrismFaces(n){const e=this.indices;n=this.currentVertex-6,e[this.currentIndex++]=n+1,e[this.currentIndex++]=n+2,e[this.currentIndex++]=n+5,e[this.currentIndex++]=n+1,e[this.currentIndex++]=n+5,e[this.currentIndex++]=n+4,e[this.currentIndex++]=n+0,e[this.currentIndex++]=n+1,e[this.currentIndex++]=n+4,e[this.currentIndex++]=n+0,e[this.currentIndex++]=n+4,e[this.currentIndex++]=n+3,e[this.currentIndex++]=n+2,e[this.currentIndex++]=n+0,e[this.currentIndex++]=n+3,e[this.currentIndex++]=n+2,e[this.currentIndex++]=n+3,e[this.currentIndex++]=n+5}createDefaultSubrayCreationCallbacks(){const n=this.randomGenerator.random;this.onDecideSubrayCreation=function(s,a){const o=a.currentSubray,l=a.rayParameters.subrayPeriod,c=a.rayParameters.subrayDutyCycle,u=a.rayParameters.isEternal&&o.recursion==0?-n()*l:Ll.lerp(o.birthTime,o.endPropagationTime,s.fraction0)-n()*l,h=a.time-u,f=Math.floor(h/l),p=n()*(f+1),m=h%l<=c*l;let y=0;if(m&&(y=a.subrayProbability),o.recursion0)return;A.reflect(f).negate(),A.add(p),y.extractRotation(O.matrixWorld),v.set(0,0,-1),v.applyMatrix4(y),v.add(m),_.subVectors(p,v),_.reflect(f).negate(),_.add(p),E.position.copy(A),E.up.set(0,1,0),E.up.applyMatrix4(y),E.up.reflect(f),E.lookAt(_),E.far=O.far,E.updateMatrixWorld(),E.projectionMatrix.copy(O.projectionMatrix),M.uniforms.virtualCameraNear.value=O.near,M.uniforms.virtualCameraFar.value=O.far,M.uniforms.virtualCameraMatrixWorld.value=E.matrixWorld,M.uniforms.virtualCameraProjectionMatrix.value=O.projectionMatrix,M.uniforms.virtualCameraProjectionMatrixInverse.value=O.projectionMatrixInverse,M.uniforms.resolution.value=t.resolution,x.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),x.multiply(E.projectionMatrix),x.multiply(E.matrixWorldInverse),x.multiply(t.matrixWorld);const Q=L.getRenderTarget(),G=L.xr.enabled,F=L.shadowMap.autoUpdate,q=L.clippingPlanes;L.xr.enabled=!1,L.shadowMap.autoUpdate=!1,L.clippingPlanes=B,L.setRenderTarget(T),L.state.buffers.depth.setMask(!0),L.autoClear===!1&&L.clear(),L.render(U,E),L.xr.enabled=G,L.shadowMap.autoUpdate=F,L.clippingPlanes=q,L.setRenderTarget(Q);const Y=O.viewport;Y!==void 0&&L.state.viewport(Y)},this.getRenderTarget=function(){return T}}};let pee=Lc;ut(pee,"ReflectorShader",{defines:{DISTANCE_ATTENUATION:!0,FRESNEL:!0},uniforms:{color:{value:null},tDiffuse:{value:null},tDepth:{value:null},textureMatrix:{value:new ct},maxDistance:{value:180},opacity:{value:.5},fresnelCoe:{value:null},virtualCameraNear:{value:null},virtualCameraFar:{value:null},virtualCameraProjectionMatrix:{value:new ct},virtualCameraMatrixWorld:{value:new ct},virtualCameraProjectionMatrixInverse:{value:new ct},resolution:{value:new _e}},vertexShader:` + uniform mat4 textureMatrix; + varying vec4 vUv; + + void main() { + + vUv = textureMatrix * vec4( position, 1.0 ); + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + }`,fragmentShader:` + uniform vec3 color; + uniform sampler2D tDiffuse; + uniform sampler2D tDepth; + uniform float maxDistance; + uniform float opacity; + uniform float fresnelCoe; + uniform float virtualCameraNear; + uniform float virtualCameraFar; + uniform mat4 virtualCameraProjectionMatrix; + uniform mat4 virtualCameraProjectionMatrixInverse; + uniform mat4 virtualCameraMatrixWorld; + uniform vec2 resolution; + varying vec4 vUv; + #include + float blendOverlay( float base, float blend ) { + return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); + } + vec3 blendOverlay( vec3 base, vec3 blend ) { + return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); + } + float getDepth( const in vec2 uv ) { + return texture2D( tDepth, uv ).x; + } + float getViewZ( const in float depth ) { + return perspectiveDepthToViewZ( depth, virtualCameraNear, virtualCameraFar ); + } + vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) { + vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc + clipPosition *= clipW; //clip + return ( virtualCameraProjectionMatrixInverse * clipPosition ).xyz;//view + } + void main() { + vec4 base = texture2DProj( tDiffuse, vUv ); + #ifdef useDepthTexture + vec2 uv=(gl_FragCoord.xy-.5)/resolution.xy; + uv.x=1.-uv.x; + float depth = texture2DProj( tDepth, vUv ).r; + float viewZ = getViewZ( depth ); + float clipW = virtualCameraProjectionMatrix[2][3] * viewZ+virtualCameraProjectionMatrix[3][3]; + vec3 viewPosition=getViewPosition( uv, depth, clipW ); + vec3 worldPosition=(virtualCameraMatrixWorld*vec4(viewPosition,1)).xyz; + if(worldPosition.y>maxDistance) discard; + float op=opacity; + #ifdef DISTANCE_ATTENUATION + float ratio=1.-(worldPosition.y/maxDistance); + float attenuation=ratio*ratio; + op=opacity*attenuation; + #endif + #ifdef FRESNEL + op*=fresnelCoe; + #endif + gl_FragColor = vec4( blendOverlay( base.rgb, color ), op ); + #else + gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); + #endif + } + `});const _m={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new N},up:{value:new N(0,1,0)}},vertexShader:` + uniform vec3 sunPosition; + uniform float rayleigh; + uniform float turbidity; + uniform float mieCoefficient; + uniform vec3 up; + + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + // constants for atmospheric scattering + const float e = 2.71828182845904523536028747135266249775724709369995957; + const float pi = 3.141592653589793238462643383279502884197169; + + // wavelength of used primaries, according to preetham + const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); + // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: + // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) + const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); + + // mie stuff + // K coefficient for the primaries + const float v = 4.0; + const vec3 K = vec3( 0.686, 0.678, 0.666 ); + // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K + const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); + + // earth shadow hack + // cutoffAngle = pi / 1.95; + const float cutoffAngle = 1.6110731556870734; + const float steepness = 1.5; + const float EE = 1000.0; + + float sunIntensity( float zenithAngleCos ) { + zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); + return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); + } + + vec3 totalMie( float T ) { + float c = ( 0.2 * T ) * 10E-18; + return 0.434 * c * MieConst; + } + + void main() { + + vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + gl_Position.z = gl_Position.w; // set z to camera.far + + vSunDirection = normalize( sunPosition ); + + vSunE = sunIntensity( dot( vSunDirection, up ) ); + + vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); + + float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); + + // extinction (absorbtion + out scattering) + // rayleigh coefficients + vBetaR = totalRayleigh * rayleighCoefficient; + + // mie coefficients + vBetaM = totalMie( turbidity ) * mieCoefficient; + + } + `,fragmentShader:` + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + uniform float mieDirectionalG; + uniform vec3 up; + + const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); + + // constants for atmospheric scattering + const float pi = 3.141592653589793238462643383279502884197169; + + const float n = 1.0003; // refractive index of air + const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) + + // optical length at zenith for molecules + const float rayleighZenithLength = 8.4E3; + const float mieZenithLength = 1.25E3; + // 66 arc seconds -> degrees, and the cosine of that + const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; + + // 3.0 / ( 16.0 * pi ) + const float THREE_OVER_SIXTEENPI = 0.05968310365946075; + // 1.0 / ( 4.0 * pi ) + const float ONE_OVER_FOURPI = 0.07957747154594767; + + float rayleighPhase( float cosTheta ) { + return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); + } + + float hgPhase( float cosTheta, float g ) { + float g2 = pow( g, 2.0 ); + float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); + return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); + } + + void main() { + + vec3 direction = normalize( vWorldPosition - cameraPos ); + + // optical length + // cutoff angle at 90 to avoid singularity in next formula. + float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); + float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); + float sR = rayleighZenithLength * inverse; + float sM = mieZenithLength * inverse; + + // combined extinction factor + vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); + + // in scattering + float cosTheta = dot( direction, vSunDirection ); + + float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); + vec3 betaRTheta = vBetaR * rPhase; + + float mPhase = hgPhase( cosTheta, mieDirectionalG ); + vec3 betaMTheta = vBetaM * mPhase; + + vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); + Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); + + // nightsky + float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] + float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] + vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); + vec3 L0 = vec3( 0.1 ) * Fex; + + // composition + solar disc + float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); + L0 += ( vSunE * 19000.0 * Fex ) * sundisk; + + vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); + + vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); + + gl_FragColor = vec4( retColor, 1.0 ); + + #include + #include <${parseInt(Wl.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},SR=new sn({name:"SkyShader",fragmentShader:_m.fragmentShader,vertexShader:_m.vertexShader,uniforms:Hn.clone(_m.uniforms),side:Ki,depthWrite:!1});class wR extends nn{constructor(){super(new qo(1,1,1),SR)}}ut(wR,"SkyShader",_m);ut(wR,"material",SR);const CR=class extends nn{constructor(n,e={}){super(n),this.isWater=!0,this.type="Water";const t=this,i=e.color!==void 0?new He(e.color):new He(16777215),r=e.textureWidth||512,s=e.textureHeight||512,a=e.clipBias||0,o=e.flowDirection||new _e(1,0),l=e.flowSpeed||.03,c=e.reflectivity||.02,u=e.scale||1,h=e.shader||CR.WaterShader,f=e.encoding!==void 0?e.encoding:3e3,p=e.flowMap||void 0,m=e.normalMap0,y=e.normalMap1,v=.15,A=v*.5,_=new ct,x=new s1;if(Xy===void 0){console.error("THREE.Water: Required component Reflector not found.");return}if(jy===void 0){console.error("THREE.Water: Required component Refractor not found.");return}const E=new Xy(n,{textureWidth:r,textureHeight:s,clipBias:a,encoding:f}),w=new jy(n,{textureWidth:r,textureHeight:s,clipBias:a,encoding:f});E.matrixAutoUpdate=!1,w.matrixAutoUpdate=!1,this.material=new sn({uniforms:Hn.merge([Je.fog,h.uniforms]),vertexShader:h.vertexShader,fragmentShader:h.fragmentShader,transparent:!0,fog:!0}),p!==void 0?(this.material.defines.USE_FLOWMAP="",this.material.uniforms.tFlowMap={type:"t",value:p}):this.material.uniforms.flowDirection={type:"v2",value:o},m.wrapS=m.wrapT=Qo,y.wrapS=y.wrapT=Qo,this.material.uniforms.tReflectionMap.value=E.getRenderTarget().texture,this.material.uniforms.tRefractionMap.value=w.getRenderTarget().texture,this.material.uniforms.tNormalMap0.value=m,this.material.uniforms.tNormalMap1.value=y,this.material.uniforms.color.value=i,this.material.uniforms.reflectivity.value=c,this.material.uniforms.textureMatrix.value=_,this.material.uniforms.config.value.x=0,this.material.uniforms.config.value.y=A,this.material.uniforms.config.value.z=A,this.material.uniforms.config.value.w=u;function I(M){_.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),_.multiply(M.projectionMatrix),_.multiply(M.matrixWorldInverse),_.multiply(t.matrixWorld)}function T(){const M=x.getDelta(),b=t.material.uniforms.config;b.value.x+=l*M,b.value.y=b.value.x+A,b.value.x>=v?(b.value.x=0,b.value.y=A):b.value.y>=v&&(b.value.y=b.value.y-v)}this.onBeforeRender=function(M,b,B){I(B),T(),t.visible=!1,E.matrixWorld.copy(t.matrixWorld),w.matrixWorld.copy(t.matrixWorld),E.onBeforeRender(M,b,B),w.onBeforeRender(M,b,B),t.visible=!0}}};let gee=CR;ut(gee,"WaterShader",{uniforms:{color:{value:null},reflectivity:{value:0},tReflectionMap:{value:null},tRefractionMap:{value:null},tNormalMap0:{value:null},tNormalMap1:{value:null},textureMatrix:{value:null},config:{value:new jt}},vertexShader:` + + #include + #include + #include + + uniform mat4 textureMatrix; + + varying vec4 vCoord; + varying vec2 vUv; + varying vec3 vToEye; + + void main() { + + vUv = uv; + vCoord = textureMatrix * vec4( position, 1.0 ); + + vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); + vToEye = cameraPosition - worldPosition.xyz; + + vec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex + gl_Position = projectionMatrix * mvPosition; + + #include + #include + + }`,fragmentShader:` + + #include + #include + #include + + uniform sampler2D tReflectionMap; + uniform sampler2D tRefractionMap; + uniform sampler2D tNormalMap0; + uniform sampler2D tNormalMap1; + + #ifdef USE_FLOWMAP + uniform sampler2D tFlowMap; + #else + uniform vec2 flowDirection; + #endif + + uniform vec3 color; + uniform float reflectivity; + uniform vec4 config; + + varying vec4 vCoord; + varying vec2 vUv; + varying vec3 vToEye; + + void main() { + + #include + + float flowMapOffset0 = config.x; + float flowMapOffset1 = config.y; + float halfCycle = config.z; + float scale = config.w; + + vec3 toEye = normalize( vToEye ); + + // determine flow direction + vec2 flow; + #ifdef USE_FLOWMAP + flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0; + #else + flow = flowDirection; + #endif + flow.x *= - 1.0; + + // sample normal maps (distort uvs with flowdata) + vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 ); + vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 ); + + // linear interpolate to get the final normal color + float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle; + vec4 normalColor = mix( normalColor0, normalColor1, flowLerp ); + + // calculate normal vector + vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) ); + + // calculate the fresnel term to blend reflection and refraction maps + float theta = max( dot( toEye, normal ), 0.0 ); + float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 ); + + // calculate final uv coords + vec3 coord = vCoord.xyz / vCoord.w; + vec2 uv = coord.xy + coord.z * normal.xz * 0.05; + + vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) ); + vec4 refractColor = texture2D( tRefractionMap, uv ); + + // multiply water color with the mix of both textures + gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance ); + + #include + #include <${parseInt(Wl.replace(/\D+/g,""))>=154?"colorspace_fragment":"encodings_fragment"}> + #include + + }`});const l5={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(` +`),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","#include ","void main() {"," float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );"," gl_FragColor = vec4( vec3( depth ), opacity );","}"].join(` +`)};class b1{constructor(){ut(this,"enabled",!0),ut(this,"needsSwap",!0),ut(this,"clear",!1),ut(this,"renderToScreen",!1)}setSize(e,t){}render(e,t,i,r,s){console.error("THREE.Pass: .render() must be implemented in derived pass.")}}class I1{constructor(e){ut(this,"camera",new ql(-1,1,1,-1,0,1)),ut(this,"geometry",new Xo(2,2)),ut(this,"mesh"),this.mesh=new nn(this.geometry,e)}get material(){return this.mesh.material}set material(e){this.mesh.material=e}dispose(){this.mesh.geometry.dispose()}render(e){e.render(this.mesh,this.camera)}}const ja={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(` +`),fragmentShader:["uniform float opacity;","uniform sampler2D tDiffuse;","varying vec2 vUv;","void main() {"," vec4 texel = texture2D( tDiffuse, vUv );"," gl_FragColor = opacity * texel;","}"].join(` +`)},_d={defines:{PERSPECTIVE_CAMERA:1,KERNEL_SIZE:32},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tDepth:{value:null},tNoise:{value:null},kernel:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new _e},cameraProjectionMatrix:{value:new ct},cameraInverseProjectionMatrix:{value:new ct},kernelRadius:{value:8},minDistance:{value:.005},maxDistance:{value:.05}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(` +`),fragmentShader:["uniform sampler2D tDiffuse;","uniform sampler2D tNormal;","uniform sampler2D tDepth;","uniform sampler2D tNoise;","uniform vec3 kernel[ KERNEL_SIZE ];","uniform vec2 resolution;","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float kernelRadius;","uniform float minDistance;","uniform float maxDistance;","varying vec2 vUv;","#include ","float getDepth( const in vec2 screenPosition ) {"," return texture2D( tDepth, screenPosition ).x;","}","float getLinearDepth( const in vec2 screenPosition ) {"," #if PERSPECTIVE_CAMERA == 1"," float fragCoordZ = texture2D( tDepth, screenPosition ).x;"," float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );"," return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {"," float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];"," vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );"," clipPosition *= clipW; // unprojection."," return ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec2 screenPosition ) {"," return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );","}","void main() {"," float depth = getDepth( vUv );"," float viewZ = getViewZ( depth );"," vec3 viewPosition = getViewPosition( vUv, depth, viewZ );"," vec3 viewNormal = getViewNormal( vUv );"," vec2 noiseScale = vec2( resolution.x / 4.0, resolution.y / 4.0 );"," vec3 random = texture2D( tNoise, vUv * noiseScale ).xyz;"," vec3 tangent = normalize( random - viewNormal * dot( random, viewNormal ) );"," vec3 bitangent = cross( viewNormal, tangent );"," mat3 kernelMatrix = mat3( tangent, bitangent, viewNormal );"," float occlusion = 0.0;"," for ( int i = 0; i < KERNEL_SIZE; i ++ ) {"," vec3 sampleVector = kernelMatrix * kernel[ i ];"," vec3 samplePoint = viewPosition + ( sampleVector * kernelRadius );"," vec4 samplePointNDC = cameraProjectionMatrix * vec4( samplePoint, 1.0 );"," samplePointNDC /= samplePointNDC.w;"," vec2 samplePointUv = samplePointNDC.xy * 0.5 + 0.5;"," float realDepth = getLinearDepth( samplePointUv );"," float sampleDepth = viewZToOrthographicDepth( samplePoint.z, cameraNear, cameraFar );"," float delta = sampleDepth - realDepth;"," if ( delta > minDistance && delta < maxDistance ) {"," occlusion += 1.0;"," }"," }"," occlusion = clamp( occlusion / float( KERNEL_SIZE ), 0.0, 1.0 );"," gl_FragColor = vec4( vec3( 1.0 - occlusion ), 1.0 );","}"].join(` +`)},Wg={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(` +`),fragmentShader:["uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","varying vec2 vUv;","#include ","float getLinearDepth( const in vec2 screenPosition ) {"," #if PERSPECTIVE_CAMERA == 1"," float fragCoordZ = texture2D( tDepth, screenPosition ).x;"," float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );"," return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","void main() {"," float depth = getLinearDepth( vUv );"," gl_FragColor = vec4( vec3( 1.0 - depth ), 1.0 );","}"].join(` +`)},Yg={uniforms:{tDiffuse:{value:null},resolution:{value:new _e}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(` +`),fragmentShader:["uniform sampler2D tDiffuse;","uniform vec2 resolution;","varying vec2 vUv;","void main() {"," vec2 texelSize = ( 1.0 / resolution );"," float result = 0.0;"," for ( int i = - 2; i <= 2; i ++ ) {"," for ( int j = - 2; j <= 2; j ++ ) {"," vec2 offset = ( vec2( float( i ), float( j ) ) ) * texelSize;"," result += texture2D( tDiffuse, vUv + offset ).r;"," }"," }"," gl_FragColor = vec4( vec3( result / ( 5.0 * 5.0 ) ), 1.0 );","}"].join(` +`)},Uc=class extends b1{constructor(n,e,t,i){super(),this.width=t!==void 0?t:512,this.height=i!==void 0?i:512,this.clear=!0,this.camera=e,this.scene=n,this.kernelRadius=8,this.kernelSize=32,this.kernel=[],this.noiseTexture=null,this.output=0,this.minDistance=.005,this.maxDistance=.1,this._visibilityCache=new Map,this.generateSampleKernel(),this.generateRandomKernelRotations();const r=new uf;r.format=Nl,r.type=ko,this.beautyRenderTarget=new Dn(this.width,this.height),this.normalRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt,depthTexture:r}),this.ssaoRenderTarget=new Dn(this.width,this.height),this.blurRenderTarget=this.ssaoRenderTarget.clone(),_d===void 0&&console.error("THREE.SSAOPass: The pass relies on SSAOShader."),this.ssaoMaterial=new sn({defines:Object.assign({},_d.defines),uniforms:Hn.clone(_d.uniforms),vertexShader:_d.vertexShader,fragmentShader:_d.fragmentShader,blending:Kt}),this.ssaoMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssaoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssaoMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.ssaoMaterial.uniforms.tNoise.value=this.noiseTexture,this.ssaoMaterial.uniforms.kernel.value=this.kernel,this.ssaoMaterial.uniforms.cameraNear.value=this.camera.near,this.ssaoMaterial.uniforms.cameraFar.value=this.camera.far,this.ssaoMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new p0,this.normalMaterial.blending=Kt,this.blurMaterial=new sn({defines:Object.assign({},Yg.defines),uniforms:Hn.clone(Yg.uniforms),vertexShader:Yg.vertexShader,fragmentShader:Yg.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new sn({defines:Object.assign({},Wg.defines),uniforms:Hn.clone(Wg.uniforms),vertexShader:Wg.vertexShader,fragmentShader:Wg.fragmentShader,blending:Kt}),this.depthRenderMaterial.uniforms.tDepth.value=this.normalRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new sn({uniforms:Hn.clone(ja.uniforms),vertexShader:ja.vertexShader,fragmentShader:ja.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:M2,blendDst:Hh,blendEquation:ss,blendSrcAlpha:I2,blendDstAlpha:Hh,blendEquationAlpha:ss}),this.fsQuad=new I1(null),this.originalClearColor=new He}dispose(){this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.ssaoRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.normalMaterial.dispose(),this.blurMaterial.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(n,e){switch(n.capabilities.isWebGL2===!1&&(this.noiseTexture.format=S6),n.setRenderTarget(this.beautyRenderTarget),n.clear(),n.render(this.scene,this.camera),this.overrideVisibility(),this.renderOverride(n,this.normalMaterial,this.normalRenderTarget,7829503,1),this.restoreVisibility(),this.ssaoMaterial.uniforms.kernelRadius.value=this.kernelRadius,this.ssaoMaterial.uniforms.minDistance.value=this.minDistance,this.ssaoMaterial.uniforms.maxDistance.value=this.maxDistance,this.renderPass(n,this.ssaoMaterial,this.ssaoRenderTarget),this.renderPass(n,this.blurMaterial,this.blurRenderTarget),this.output){case Uc.OUTPUT.SSAO:this.copyMaterial.uniforms.tDiffuse.value=this.ssaoRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Blur:this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Depth:this.renderPass(n,this.depthRenderMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Uc.OUTPUT.Default:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e),this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.copyMaterial.blending=pp,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;default:console.warn("THREE.SSAOPass: Unknown output type.")}}renderPass(n,e,t,i,r){n.getClearColor(this.originalClearColor);const s=n.getClearAlpha(),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.fsQuad.material=e,this.fsQuad.render(n),n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}renderOverride(n,e,t,i,r){n.getClearColor(this.originalClearColor);const s=n.getClearAlpha(),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i=e.clearColor||i,r=e.clearAlpha||r,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.scene.overrideMaterial=e,n.render(this.scene,this.camera),this.scene.overrideMaterial=null,n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}setSize(n,e){this.width=n,this.height=e,this.beautyRenderTarget.setSize(n,e),this.ssaoRenderTarget.setSize(n,e),this.normalRenderTarget.setSize(n,e),this.blurRenderTarget.setSize(n,e),this.ssaoMaterial.uniforms.resolution.value.set(n,e),this.ssaoMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssaoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(n,e)}generateSampleKernel(){const n=this.kernelSize,e=this.kernel;for(let t=0;t + varying vec2 vUv; + uniform sampler2D colorTexture; + uniform vec2 texSize; + uniform vec2 direction; + + float gaussianPdf(in float x, in float sigma) { + return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma; + } + void main() { + vec2 invSize = 1.0 / texSize; + float fSigma = float(SIGMA); + float weightSum = gaussianPdf(0.0, fSigma); + vec3 diffuseSum = texture2D( colorTexture, vUv).rgb * weightSum; + for( int i = 1; i < KERNEL_RADIUS; i ++ ) { + float x = float(i); + float w = gaussianPdf(x, fSigma); + vec2 uvOffset = direction * invSize * x; + vec3 sample1 = texture2D( colorTexture, vUv + uvOffset).rgb; + vec3 sample2 = texture2D( colorTexture, vUv - uvOffset).rgb; + diffuseSum += (sample1 + sample2) * w; + weightSum += 2.0 * w; + } + gl_FragColor = vec4(diffuseSum/weightSum, 1.0); + }`})}getCompositeMaterial(n){return new sn({defines:{NUM_MIPS:n},uniforms:{blurTexture1:{value:null},blurTexture2:{value:null},blurTexture3:{value:null},blurTexture4:{value:null},blurTexture5:{value:null},bloomStrength:{value:1},bloomFactors:{value:null},bloomTintColors:{value:null},bloomRadius:{value:0}},vertexShader:`varying vec2 vUv; + void main() { + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + }`,fragmentShader:`varying vec2 vUv; + uniform sampler2D blurTexture1; + uniform sampler2D blurTexture2; + uniform sampler2D blurTexture3; + uniform sampler2D blurTexture4; + uniform sampler2D blurTexture5; + uniform float bloomStrength; + uniform float bloomRadius; + uniform float bloomFactors[NUM_MIPS]; + uniform vec3 bloomTintColors[NUM_MIPS]; + + float lerpBloomFactor(const in float factor) { + float mirrorFactor = 1.2 - factor; + return mix(factor, mirrorFactor, bloomRadius); + } + + void main() { + gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) + + lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) + + lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) + + lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) + + lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) ); + }`})}};let TR=$y;ut(TR,"BlurDirectionX",new _e(1,0));ut(TR,"BlurDirectionY",new _e(0,1));const qg={defines:{NUM_SAMPLES:7,NUM_RINGS:4,NORMAL_TEXTURE:0,DIFFUSE_TEXTURE:0,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},tNormal:{value:null},size:{value:new _e(512,512)},cameraNear:{value:1},cameraFar:{value:100},cameraProjectionMatrix:{value:new ct},cameraInverseProjectionMatrix:{value:new ct},scale:{value:1},intensity:{value:.1},bias:{value:.5},minResolution:{value:0},kernelRadius:{value:100},randomSeed:{value:0}},vertexShader:["varying vec2 vUv;","void main() {"," vUv = uv;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(` +`),fragmentShader:["#include ","varying vec2 vUv;","#if DIFFUSE_TEXTURE == 1","uniform sampler2D tDiffuse;","#endif","uniform sampler2D tDepth;","#if NORMAL_TEXTURE == 1","uniform sampler2D tNormal;","#endif","uniform float cameraNear;","uniform float cameraFar;","uniform mat4 cameraProjectionMatrix;","uniform mat4 cameraInverseProjectionMatrix;","uniform float scale;","uniform float intensity;","uniform float bias;","uniform float kernelRadius;","uniform float minResolution;","uniform vec2 size;","uniform float randomSeed;","// RGBA depth","#include ","vec4 getDefaultColor( const in vec2 screenPosition ) {"," #if DIFFUSE_TEXTURE == 1"," return texture2D( tDiffuse, vUv );"," #else"," return vec4( 1.0 );"," #endif","}","float getDepth( const in vec2 screenPosition ) {"," #if DEPTH_PACKING == 1"," return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","vec3 getViewPosition( const in vec2 screenPosition, const in float depth, const in float viewZ ) {"," float clipW = cameraProjectionMatrix[2][3] * viewZ + cameraProjectionMatrix[3][3];"," vec4 clipPosition = vec4( ( vec3( screenPosition, depth ) - 0.5 ) * 2.0, 1.0 );"," clipPosition *= clipW; // unprojection."," return ( cameraInverseProjectionMatrix * clipPosition ).xyz;","}","vec3 getViewNormal( const in vec3 viewPosition, const in vec2 screenPosition ) {"," #if NORMAL_TEXTURE == 1"," return unpackRGBToNormal( texture2D( tNormal, screenPosition ).xyz );"," #else"," return normalize( cross( dFdx( viewPosition ), dFdy( viewPosition ) ) );"," #endif","}","float scaleDividedByCameraFar;","float minResolutionMultipliedByCameraFar;","float getOcclusion( const in vec3 centerViewPosition, const in vec3 centerViewNormal, const in vec3 sampleViewPosition ) {"," vec3 viewDelta = sampleViewPosition - centerViewPosition;"," float viewDistance = length( viewDelta );"," float scaledScreenDistance = scaleDividedByCameraFar * viewDistance;"," return max(0.0, (dot(centerViewNormal, viewDelta) - minResolutionMultipliedByCameraFar) / scaledScreenDistance - bias) / (1.0 + pow2( scaledScreenDistance ) );","}","// moving costly divides into consts","const float ANGLE_STEP = PI2 * float( NUM_RINGS ) / float( NUM_SAMPLES );","const float INV_NUM_SAMPLES = 1.0 / float( NUM_SAMPLES );","float getAmbientOcclusion( const in vec3 centerViewPosition ) {"," // precompute some variables require in getOcclusion."," scaleDividedByCameraFar = scale / cameraFar;"," minResolutionMultipliedByCameraFar = minResolution * cameraFar;"," vec3 centerViewNormal = getViewNormal( centerViewPosition, vUv );"," // jsfiddle that shows sample pattern: https://jsfiddle.net/a16ff1p7/"," float angle = rand( vUv + randomSeed ) * PI2;"," vec2 radius = vec2( kernelRadius * INV_NUM_SAMPLES ) / size;"," vec2 radiusStep = radius;"," float occlusionSum = 0.0;"," float weightSum = 0.0;"," for( int i = 0; i < NUM_SAMPLES; i ++ ) {"," vec2 sampleUv = vUv + vec2( cos( angle ), sin( angle ) ) * radius;"," radius += radiusStep;"," angle += ANGLE_STEP;"," float sampleDepth = getDepth( sampleUv );"," if( sampleDepth >= ( 1.0 - EPSILON ) ) {"," continue;"," }"," float sampleViewZ = getViewZ( sampleDepth );"," vec3 sampleViewPosition = getViewPosition( sampleUv, sampleDepth, sampleViewZ );"," occlusionSum += getOcclusion( centerViewPosition, centerViewNormal, sampleViewPosition );"," weightSum += 1.0;"," }"," if( weightSum == 0.0 ) discard;"," return occlusionSum * ( intensity / weightSum );","}","void main() {"," float centerDepth = getDepth( vUv );"," if( centerDepth >= ( 1.0 - EPSILON ) ) {"," discard;"," }"," float centerViewZ = getViewZ( centerDepth );"," vec3 viewPosition = getViewPosition( vUv, centerDepth, centerViewZ );"," float ambientOcclusion = getAmbientOcclusion( viewPosition );"," gl_FragColor = getDefaultColor( vUv );"," gl_FragColor.xyz *= 1.0 - ambientOcclusion;","}"].join(` +`)},xl={defines:{KERNEL_RADIUS:4,DEPTH_PACKING:1,PERSPECTIVE_CAMERA:1},uniforms:{tDiffuse:{value:null},size:{value:new _e(512,512)},sampleUvOffsets:{value:[new _e(0,0)]},sampleWeights:{value:[1]},tDepth:{value:null},cameraNear:{value:10},cameraFar:{value:1e3},depthCutoff:{value:10}},vertexShader:["#include ","uniform vec2 size;","varying vec2 vUv;","varying vec2 vInvSize;","void main() {"," vUv = uv;"," vInvSize = 1.0 / size;"," gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(` +`),fragmentShader:["#include ","#include ","uniform sampler2D tDiffuse;","uniform sampler2D tDepth;","uniform float cameraNear;","uniform float cameraFar;","uniform float depthCutoff;","uniform vec2 sampleUvOffsets[ KERNEL_RADIUS + 1 ];","uniform float sampleWeights[ KERNEL_RADIUS + 1 ];","varying vec2 vUv;","varying vec2 vInvSize;","float getDepth( const in vec2 screenPosition ) {"," #if DEPTH_PACKING == 1"," return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );"," #else"," return texture2D( tDepth, screenPosition ).x;"," #endif","}","float getViewZ( const in float depth ) {"," #if PERSPECTIVE_CAMERA == 1"," return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );"," #else"," return orthographicDepthToViewZ( depth, cameraNear, cameraFar );"," #endif","}","void main() {"," float depth = getDepth( vUv );"," if( depth >= ( 1.0 - EPSILON ) ) {"," discard;"," }"," float centerViewZ = -getViewZ( depth );"," bool rBreak = false, lBreak = false;"," float weightSum = sampleWeights[0];"," vec4 diffuseSum = texture2D( tDiffuse, vUv ) * weightSum;"," for( int i = 1; i <= KERNEL_RADIUS; i ++ ) {"," float sampleWeight = sampleWeights[i];"," vec2 sampleUvOffset = sampleUvOffsets[i] * vInvSize;"," vec2 sampleUv = vUv + sampleUvOffset;"," float viewZ = -getViewZ( getDepth( sampleUv ) );"," if( abs( viewZ - centerViewZ ) > depthCutoff ) rBreak = true;"," if( ! rBreak ) {"," diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;"," weightSum += sampleWeight;"," }"," sampleUv = vUv - sampleUvOffset;"," viewZ = -getViewZ( getDepth( sampleUv ) );"," if( abs( viewZ - centerViewZ ) > depthCutoff ) lBreak = true;"," if( ! lBreak ) {"," diffuseSum += texture2D( tDiffuse, sampleUv ) * sampleWeight;"," weightSum += sampleWeight;"," }"," }"," gl_FragColor = diffuseSum / weightSum;","}"].join(` +`)},h2={createSampleWeights:(n,e)=>{const t=(r,s)=>Math.exp(-(r*r)/(2*(s*s)))/(Math.sqrt(2*Math.PI)*s),i=[];for(let r=0;r<=n;r++)i.push(t(r,e));return i},createSampleOffsets:(n,e)=>{const t=[];for(let i=0;i<=n;i++)t.push(e.clone().multiplyScalar(i));return t},configure:(n,e,t,i)=>{n.defines.KERNEL_RADIUS=e,n.uniforms.sampleUvOffsets.value=h2.createSampleOffsets(e,i),n.uniforms.sampleWeights.value=h2.createSampleWeights(e,t),n.needsUpdate=!0}};class vee extends b1{constructor(e,t,i=!1,r=!1,s=new _e(256,256)){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.supportsDepthTextureExtension=i,this.supportsNormalTexture=r,this.originalClearColor=new He,this._oldClearColor=new He,this.oldClearAlpha=1,this.params={output:0,saoBias:.5,saoIntensity:.18,saoScale:1,saoKernelRadius:100,saoMinResolution:0,saoBlur:!0,saoBlurRadius:8,saoBlurStdDev:4,saoBlurDepthCutoff:.01},this.resolution=new _e(s.x,s.y),this.saoRenderTarget=new Dn(this.resolution.x,this.resolution.y,{type:Ai}),this.blurIntermediateRenderTarget=this.saoRenderTarget.clone(),this.beautyRenderTarget=this.saoRenderTarget.clone(),this.normalRenderTarget=new Dn(this.resolution.x,this.resolution.y,{minFilter:Rt,magFilter:Rt,type:Ai}),this.depthRenderTarget=this.normalRenderTarget.clone();let a;this.supportsDepthTextureExtension&&(a=new uf,a.type=Au,this.beautyRenderTarget.depthTexture=a,this.beautyRenderTarget.depthBuffer=!0),this.depthMaterial=new u0,this.depthMaterial.depthPacking=P2,this.depthMaterial.blending=Kt,this.normalMaterial=new p0,this.normalMaterial.blending=Kt,this.saoMaterial=new sn({defines:Object.assign({},qg.defines),fragmentShader:qg.fragmentShader,vertexShader:qg.vertexShader,uniforms:Hn.clone(qg.uniforms)}),this.saoMaterial.extensions.derivatives=!0,this.saoMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.saoMaterial.defines.NORMAL_TEXTURE=this.supportsNormalTexture?1:0,this.saoMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.saoMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.saoMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.saoMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.blending=Kt,this.vBlurMaterial=new sn({uniforms:Hn.clone(xl.uniforms),defines:Object.assign({},xl.defines),vertexShader:xl.vertexShader,fragmentShader:xl.fragmentShader}),this.vBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.vBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.vBlurMaterial.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.vBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.vBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.vBlurMaterial.blending=Kt,this.hBlurMaterial=new sn({uniforms:Hn.clone(xl.uniforms),defines:Object.assign({},xl.defines),vertexShader:xl.vertexShader,fragmentShader:xl.fragmentShader}),this.hBlurMaterial.defines.DEPTH_PACKING=this.supportsDepthTextureExtension?0:1,this.hBlurMaterial.defines.PERSPECTIVE_CAMERA=this.camera.isPerspectiveCamera?1:0,this.hBlurMaterial.uniforms.tDiffuse.value=this.blurIntermediateRenderTarget.texture,this.hBlurMaterial.uniforms.tDepth.value=this.supportsDepthTextureExtension?a:this.depthRenderTarget.texture,this.hBlurMaterial.uniforms.size.value.set(this.resolution.x,this.resolution.y),this.hBlurMaterial.blending=Kt,this.materialCopy=new sn({uniforms:Hn.clone(ja.uniforms),vertexShader:ja.vertexShader,fragmentShader:ja.fragmentShader,blending:Kt}),this.materialCopy.transparent=!0,this.materialCopy.depthTest=!1,this.materialCopy.depthWrite=!1,this.materialCopy.blending=pp,this.materialCopy.blendSrc=M2,this.materialCopy.blendDst=Hh,this.materialCopy.blendEquation=ss,this.materialCopy.blendSrcAlpha=I2,this.materialCopy.blendDstAlpha=Hh,this.materialCopy.blendEquationAlpha=ss,this.depthCopy=new sn({uniforms:Hn.clone(l5.uniforms),vertexShader:l5.vertexShader,fragmentShader:l5.fragmentShader,blending:Kt}),this.fsQuad=new I1(null)}render(e,t,i){if(this.renderToScreen&&(this.materialCopy.blending=Kt,this.materialCopy.uniforms.tDiffuse.value=i.texture,this.materialCopy.needsUpdate=!0,this.renderPass(e,this.materialCopy,null)),this.params.output===1)return;e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const r=e.autoClear;e.autoClear=!1,e.setRenderTarget(this.depthRenderTarget),e.clear(),this.saoMaterial.uniforms.bias.value=this.params.saoBias,this.saoMaterial.uniforms.intensity.value=this.params.saoIntensity,this.saoMaterial.uniforms.scale.value=this.params.saoScale,this.saoMaterial.uniforms.kernelRadius.value=this.params.saoKernelRadius,this.saoMaterial.uniforms.minResolution.value=this.params.saoMinResolution,this.saoMaterial.uniforms.cameraNear.value=this.camera.near,this.saoMaterial.uniforms.cameraFar.value=this.camera.far;const s=this.params.saoBlurDepthCutoff*(this.camera.far-this.camera.near);this.vBlurMaterial.uniforms.depthCutoff.value=s,this.hBlurMaterial.uniforms.depthCutoff.value=s,this.vBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.vBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.hBlurMaterial.uniforms.cameraNear.value=this.camera.near,this.hBlurMaterial.uniforms.cameraFar.value=this.camera.far,this.params.saoBlurRadius=Math.floor(this.params.saoBlurRadius),(this.prevStdDev!==this.params.saoBlurStdDev||this.prevNumSamples!==this.params.saoBlurRadius)&&(h2.configure(this.vBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new _e(0,1)),h2.configure(this.hBlurMaterial,this.params.saoBlurRadius,this.params.saoBlurStdDev,new _e(1,0)),this.prevStdDev=this.params.saoBlurStdDev,this.prevNumSamples=this.params.saoBlurRadius),e.setClearColor(0),e.setRenderTarget(this.beautyRenderTarget),e.clear(),e.render(this.scene,this.camera),this.supportsDepthTextureExtension||this.renderOverride(e,this.depthMaterial,this.depthRenderTarget,0,1),this.supportsNormalTexture&&this.renderOverride(e,this.normalMaterial,this.normalRenderTarget,7829503,1),this.renderPass(e,this.saoMaterial,this.saoRenderTarget,16777215,1),this.params.saoBlur&&(this.renderPass(e,this.vBlurMaterial,this.blurIntermediateRenderTarget,16777215,1),this.renderPass(e,this.hBlurMaterial,this.saoRenderTarget,16777215,1));let a=this.materialCopy;this.params.output===3?this.supportsDepthTextureExtension?(this.materialCopy.uniforms.tDiffuse.value=this.beautyRenderTarget.depthTexture,this.materialCopy.needsUpdate=!0):(this.depthCopy.uniforms.tDiffuse.value=this.depthRenderTarget.texture,this.depthCopy.needsUpdate=!0,a=this.depthCopy):this.params.output===4?(this.materialCopy.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.materialCopy.needsUpdate=!0):(this.materialCopy.uniforms.tDiffuse.value=this.saoRenderTarget.texture,this.materialCopy.needsUpdate=!0),this.params.output===0?a.blending=pp:a.blending=Kt,this.renderPass(e,a,this.renderToScreen?null:i),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=r}renderPass(e,t,i,r,s){e.getClearColor(this.originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(i),e.autoClear=!1,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.fsQuad.material=t,this.fsQuad.render(e),e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)}renderOverride(e,t,i,r,s){e.getClearColor(this.originalClearColor);const a=e.getClearAlpha(),o=e.autoClear;e.setRenderTarget(i),e.autoClear=!1,r=t.clearColor||r,s=t.clearAlpha||s,r!=null&&(e.setClearColor(r),e.setClearAlpha(s||0),e.clear()),this.scene.overrideMaterial=t,e.render(this.scene,this.camera),this.scene.overrideMaterial=null,e.autoClear=o,e.setClearColor(this.originalClearColor),e.setClearAlpha(a)}setSize(e,t){this.beautyRenderTarget.setSize(e,t),this.saoRenderTarget.setSize(e,t),this.blurIntermediateRenderTarget.setSize(e,t),this.normalRenderTarget.setSize(e,t),this.depthRenderTarget.setSize(e,t),this.saoMaterial.uniforms.size.value.set(e,t),this.saoMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.saoMaterial.uniforms.cameraProjectionMatrix.value=this.camera.projectionMatrix,this.saoMaterial.needsUpdate=!0,this.vBlurMaterial.uniforms.size.value.set(e,t),this.vBlurMaterial.needsUpdate=!0,this.hBlurMaterial.uniforms.size.value.set(e,t),this.hBlurMaterial.needsUpdate=!0}dispose(){this.saoRenderTarget.dispose(),this.blurIntermediateRenderTarget.dispose(),this.beautyRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.depthRenderTarget.dispose(),this.depthMaterial.dispose(),this.normalMaterial.dispose(),this.saoMaterial.dispose(),this.vBlurMaterial.dispose(),this.hBlurMaterial.dispose(),this.materialCopy.dispose(),this.depthCopy.dispose(),this.fsQuad.dispose()}}ut(vee,"OUTPUT",{Beauty:1,Default:0,SAO:2,Depth:3,Normal:4});const La={defines:{MAX_STEP:0,isPerspectiveCamera:!0,isDistanceAttenuation:!0,isFresnel:!0,isInfiniteThick:!1,isSelective:!1},uniforms:{tDiffuse:{value:null},tNormal:{value:null},tMetalness:{value:null},tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null},resolution:{value:new _e},cameraProjectionMatrix:{value:new ct},cameraInverseProjectionMatrix:{value:new ct},opacity:{value:.5},maxDistance:{value:180},cameraRange:{value:0},surfDist:{value:.007},thickTolerance:{value:.03}},vertexShader:` + + varying vec2 vUv; + + void main() { + + vUv = uv; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + } + + `,fragmentShader:` + // precision highp float; + precision highp sampler2D; + varying vec2 vUv; + uniform sampler2D tDepth; + uniform sampler2D tNormal; + uniform sampler2D tMetalness; + uniform sampler2D tDiffuse; + uniform float cameraRange; + uniform vec2 resolution; + uniform float opacity; + uniform float cameraNear; + uniform float cameraFar; + uniform float maxDistance; + uniform float surfDist; + uniform mat4 cameraProjectionMatrix; + uniform mat4 cameraInverseProjectionMatrix; + uniform float thickTolerance; + #include + float pointToLineDistance(vec3 x0, vec3 x1, vec3 x2) { + //x0: point, x1: linePointA, x2: linePointB + //https://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html + return length(cross(x0-x1,x0-x2))/length(x2-x1); + } + float pointPlaneDistance(vec3 point,vec3 planePoint,vec3 planeNormal){ + // https://mathworld.wolfram.com/Point-PlaneDistance.html + //// https://en.wikipedia.org/wiki/Plane_(geometry) + //// http://paulbourke.net/geometry/pointlineplane/ + float a=planeNormal.x,b=planeNormal.y,c=planeNormal.z; + float x0=point.x,y0=point.y,z0=point.z; + float x=planePoint.x,y=planePoint.y,z=planePoint.z; + float d=-(a*x+b*y+c*z); + float distance=(a*x0+b*y0+c*z0+d)/sqrt(a*a+b*b+c*c); + return distance; + } + float getDepth( const in vec2 uv ) { + return texture2D( tDepth, uv ).x; + } + float getViewZ( const in float depth ) { + #ifdef isPerspectiveCamera + return perspectiveDepthToViewZ( depth, cameraNear, cameraFar ); + #else + return orthographicDepthToViewZ( depth, cameraNear, cameraFar ); + #endif + } + vec3 getViewPosition( const in vec2 uv, const in float depth/*clip space*/, const in float clipW ) { + vec4 clipPosition = vec4( ( vec3( uv, depth ) - 0.5 ) * 2.0, 1.0 );//ndc + clipPosition *= clipW; //clip + return ( cameraInverseProjectionMatrix * clipPosition ).xyz;//view + } + vec3 getViewNormal( const in vec2 uv ) { + return unpackRGBToNormal( texture2D( tNormal, uv ).xyz ); + } + vec2 viewPositionToXY(vec3 viewPosition){ + vec2 xy; + vec4 clip=cameraProjectionMatrix*vec4(viewPosition,1); + xy=clip.xy;//clip + float clipW=clip.w; + xy/=clipW;//NDC + xy=(xy+1.)/2.;//uv + xy*=resolution;//screen + return xy; + } + void main(){ + #ifdef isSelective + float metalness=texture2D(tMetalness,vUv).r; + if(metalness==0.) return; + #endif + + float depth = getDepth( vUv ); + float viewZ = getViewZ( depth ); + if(-viewZ>=cameraFar) return; + + float clipW = cameraProjectionMatrix[2][3] * viewZ+cameraProjectionMatrix[3][3]; + vec3 viewPosition=getViewPosition( vUv, depth, clipW ); + + vec2 d0=gl_FragCoord.xy; + vec2 d1; + + vec3 viewNormal=getViewNormal( vUv ); + + #ifdef isPerspectiveCamera + vec3 viewIncidenceDir=normalize(viewPosition); + vec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal); + #else + vec3 viewIncidenceDir=vec3(0,0,-1); + vec3 viewReflectDir=reflect(viewIncidenceDir,viewNormal); + #endif + + float maxReflectRayLen=maxDistance/dot(-viewIncidenceDir,viewNormal); + // dot(a,b)==length(a)*length(b)*cos(theta) // https://www.mathsisfun.com/algebra/vectors-dot-product.html + // if(a.isNormalized&&b.isNormalized) dot(a,b)==cos(theta) + // maxDistance/maxReflectRayLen=cos(theta) + // maxDistance/maxReflectRayLen==dot(a,b) + // maxReflectRayLen==maxDistance/dot(a,b) + + vec3 d1viewPosition=viewPosition+viewReflectDir*maxReflectRayLen; + #ifdef isPerspectiveCamera + if(d1viewPosition.z>-cameraNear){ + //https://tutorial.math.lamar.edu/Classes/CalcIII/EqnsOfLines.aspx + float t=(-cameraNear-viewPosition.z)/viewReflectDir.z; + d1viewPosition=viewPosition+viewReflectDir*t; + } + #endif + d1=viewPositionToXY(d1viewPosition); + + float totalLen=length(d1-d0); + float xLen=d1.x-d0.x; + float yLen=d1.y-d0.y; + float totalStep=max(abs(xLen),abs(yLen)); + float xSpan=xLen/totalStep; + float ySpan=yLen/totalStep; + for(float i=0.;i=totalStep) break; + vec2 xy=vec2(d0.x+i*xSpan,d0.y+i*ySpan); + if(xy.x<0.||xy.x>resolution.x||xy.y<0.||xy.y>resolution.y) break; + float s=length(xy-d0)/totalLen; + vec2 uv=xy/resolution; + + float d = getDepth(uv); + float vZ = getViewZ( d ); + if(-vZ>=cameraFar) continue; + float cW = cameraProjectionMatrix[2][3] * vZ+cameraProjectionMatrix[3][3]; + vec3 vP=getViewPosition( uv, d, cW ); + + #ifdef isPerspectiveCamera + // https://www.comp.nus.edu.sg/~lowkl/publications/lowk_persp_interp_techrep.pdf + float recipVPZ=1./viewPosition.z; + float viewReflectRayZ=1./(recipVPZ+s*(1./d1viewPosition.z-recipVPZ)); + float sD=surfDist*cW; + #else + float viewReflectRayZ=viewPosition.z+s*(d1viewPosition.z-viewPosition.z); + float sD=surfDist; + #endif + if(viewReflectRayZ-sD>vZ) continue; + + #ifdef isInfiniteThick + if(viewReflectRayZ+thickTolerance*clipW=0.) continue; + float distance=pointPlaneDistance(vP,viewPosition,viewNormal); + if(distance>maxDistance) break; + #ifdef isDistanceAttenuation + float ratio=1.-(distance/maxDistance); + float attenuation=ratio*ratio; + op=opacity*attenuation; + #endif + #ifdef isFresnel + float fresnel=(dot(viewIncidenceDir,viewReflectDir)+1.)/2.; + op*=fresnel; + #endif + vec4 reflectColor=texture2D(tDiffuse,uv); + gl_FragColor.xyz=reflectColor.xyz; + gl_FragColor.a=op; + break; + } + } + } + `},Xg={defines:{PERSPECTIVE_CAMERA:1},uniforms:{tDepth:{value:null},cameraNear:{value:null},cameraFar:{value:null}},vertexShader:` + + varying vec2 vUv; + + void main() { + + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + } + + `,fragmentShader:` + + uniform sampler2D tDepth; + + uniform float cameraNear; + uniform float cameraFar; + + varying vec2 vUv; + + #include + + float getLinearDepth( const in vec2 uv ) { + + #if PERSPECTIVE_CAMERA == 1 + + float fragCoordZ = texture2D( tDepth, uv ).x; + float viewZ = perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar ); + return viewZToOrthographicDepth( viewZ, cameraNear, cameraFar ); + + #else + + return texture2D( tDepth, uv ).x; + + #endif + + } + + void main() { + + float depth = getLinearDepth( vUv ); + float d = 1.0 - depth; + // d=(d-.999)*1000.; + gl_FragColor = vec4( vec3( d ), 1.0 ); + + } + + `},_l={uniforms:{tDiffuse:{value:null},resolution:{value:new _e},opacity:{value:.5}},vertexShader:` + + varying vec2 vUv; + + void main() { + + vUv = uv; + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + } + + `,fragmentShader:` + + uniform sampler2D tDiffuse; + uniform vec2 resolution; + varying vec2 vUv; + void main() { + //reverse engineering from PhotoShop blur filter, then change coefficient + + vec2 texelSize = ( 1.0 / resolution ); + + vec4 c=texture2D(tDiffuse,vUv); + + vec2 offset; + + offset=(vec2(-1,0))*texelSize; + vec4 cl=texture2D(tDiffuse,vUv+offset); + + offset=(vec2(1,0))*texelSize; + vec4 cr=texture2D(tDiffuse,vUv+offset); + + offset=(vec2(0,-1))*texelSize; + vec4 cb=texture2D(tDiffuse,vUv+offset); + + offset=(vec2(0,1))*texelSize; + vec4 ct=texture2D(tDiffuse,vUv+offset); + + // float coeCenter=.5; + // float coeSide=.125; + float coeCenter=.2; + float coeSide=.2; + float a=c.a*coeCenter+cl.a*coeSide+cr.a*coeSide+cb.a*coeSide+ct.a*coeSide; + vec3 rgb=(c.rgb*c.a*coeCenter+cl.rgb*cl.a*coeSide+cr.rgb*cr.a*coeSide+cb.rgb*cb.a*coeSide+ct.rgb*ct.a*coeSide)/a; + gl_FragColor=vec4(rgb,a); + + } + `},Oc=class extends b1{constructor({renderer:n,scene:e,camera:t,width:i,height:r,selects:s,bouncing:a=!1,groundReflector:o}){super(),this.width=i!==void 0?i:512,this.height=r!==void 0?r:512,this.clear=!0,this.renderer=n,this.scene=e,this.camera=t,this.groundReflector=o,this.opacity=La.uniforms.opacity.value,this.output=0,this.maxDistance=La.uniforms.maxDistance.value,this.thickness=La.uniforms.thickness.value,this.tempColor=new He,this._selects=s,this.selective=Array.isArray(this._selects),Object.defineProperty(this,"selects",{get(){return this._selects},set(c){this._selects!==c&&(this._selects=c,Array.isArray(c)?(this.selective=!0,this.ssrMaterial.defines.SELECTIVE=!0,this.ssrMaterial.needsUpdate=!0):(this.selective=!1,this.ssrMaterial.defines.SELECTIVE=!1,this.ssrMaterial.needsUpdate=!0))}}),this._bouncing=a,Object.defineProperty(this,"bouncing",{get(){return this._bouncing},set(c){this._bouncing!==c&&(this._bouncing=c,c?this.ssrMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture:this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture)}}),this.blur=!0,this._distanceAttenuation=La.defines.DISTANCE_ATTENUATION,Object.defineProperty(this,"distanceAttenuation",{get(){return this._distanceAttenuation},set(c){this._distanceAttenuation!==c&&(this._distanceAttenuation=c,this.ssrMaterial.defines.DISTANCE_ATTENUATION=c,this.ssrMaterial.needsUpdate=!0)}}),this._fresnel=La.defines.FRESNEL,Object.defineProperty(this,"fresnel",{get(){return this._fresnel},set(c){this._fresnel!==c&&(this._fresnel=c,this.ssrMaterial.defines.FRESNEL=c,this.ssrMaterial.needsUpdate=!0)}}),this._infiniteThick=La.defines.INFINITE_THICK,Object.defineProperty(this,"infiniteThick",{get(){return this._infiniteThick},set(c){this._infiniteThick!==c&&(this._infiniteThick=c,this.ssrMaterial.defines.INFINITE_THICK=c,this.ssrMaterial.needsUpdate=!0)}});const l=new uf;l.type=Au,l.minFilter=Rt,l.magFilter=Rt,this.beautyRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt,type:Ai,depthTexture:l,depthBuffer:!0}),this.prevRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt}),this.normalRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt,type:Ai}),this.metalnessRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt,type:Ai}),this.ssrRenderTarget=new Dn(this.width,this.height,{minFilter:Rt,magFilter:Rt}),this.blurRenderTarget=this.ssrRenderTarget.clone(),this.blurRenderTarget2=this.ssrRenderTarget.clone(),this.ssrMaterial=new sn({defines:Object.assign({},La.defines,{MAX_STEP:Math.sqrt(this.width*this.width+this.height*this.height)}),uniforms:Hn.clone(La.uniforms),vertexShader:La.vertexShader,fragmentShader:La.fragmentShader,blending:Kt}),this.ssrMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.ssrMaterial.uniforms.tNormal.value=this.normalRenderTarget.texture,this.ssrMaterial.defines.SELECTIVE=this.selective,this.ssrMaterial.needsUpdate=!0,this.ssrMaterial.uniforms.tMetalness.value=this.metalnessRenderTarget.texture,this.ssrMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.ssrMaterial.uniforms.cameraNear.value=this.camera.near,this.ssrMaterial.uniforms.cameraFar.value=this.camera.far,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.ssrMaterial.uniforms.resolution.value.set(this.width,this.height),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.normalMaterial=new p0,this.normalMaterial.blending=Kt,this.metalnessOnMaterial=new cs({color:"white"}),this.metalnessOffMaterial=new cs({color:"black"}),this.blurMaterial=new sn({defines:Object.assign({},_l.defines),uniforms:Hn.clone(_l.uniforms),vertexShader:_l.vertexShader,fragmentShader:_l.fragmentShader}),this.blurMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.blurMaterial.uniforms.resolution.value.set(this.width,this.height),this.blurMaterial2=new sn({defines:Object.assign({},_l.defines),uniforms:Hn.clone(_l.uniforms),vertexShader:_l.vertexShader,fragmentShader:_l.fragmentShader}),this.blurMaterial2.uniforms.tDiffuse.value=this.blurRenderTarget.texture,this.blurMaterial2.uniforms.resolution.value.set(this.width,this.height),this.depthRenderMaterial=new sn({defines:Object.assign({},Xg.defines),uniforms:Hn.clone(Xg.uniforms),vertexShader:Xg.vertexShader,fragmentShader:Xg.fragmentShader,blending:Kt}),this.depthRenderMaterial.uniforms.tDepth.value=this.beautyRenderTarget.depthTexture,this.depthRenderMaterial.uniforms.cameraNear.value=this.camera.near,this.depthRenderMaterial.uniforms.cameraFar.value=this.camera.far,this.copyMaterial=new sn({uniforms:Hn.clone(ja.uniforms),vertexShader:ja.vertexShader,fragmentShader:ja.fragmentShader,transparent:!0,depthTest:!1,depthWrite:!1,blendSrc:gp,blendDst:mp,blendEquation:ss,blendSrcAlpha:gp,blendDstAlpha:mp,blendEquationAlpha:ss}),this.fsQuad=new I1(null),this.originalClearColor=new He}dispose(){this.beautyRenderTarget.dispose(),this.prevRenderTarget.dispose(),this.normalRenderTarget.dispose(),this.metalnessRenderTarget.dispose(),this.ssrRenderTarget.dispose(),this.blurRenderTarget.dispose(),this.blurRenderTarget2.dispose(),this.normalMaterial.dispose(),this.metalnessOnMaterial.dispose(),this.metalnessOffMaterial.dispose(),this.blurMaterial.dispose(),this.blurMaterial2.dispose(),this.copyMaterial.dispose(),this.depthRenderMaterial.dispose(),this.fsQuad.dispose()}render(n,e){switch(n.setRenderTarget(this.beautyRenderTarget),n.clear(),this.groundReflector&&(this.groundReflector.visible=!1,this.groundReflector.doRender(this.renderer,this.scene,this.camera),this.groundReflector.visible=!0),n.render(this.scene,this.camera),this.groundReflector&&(this.groundReflector.visible=!1),this.renderOverride(n,this.normalMaterial,this.normalRenderTarget,0,0),this.selective&&this.renderMetalness(n,this.metalnessOnMaterial,this.metalnessRenderTarget,0,0),this.ssrMaterial.uniforms.opacity.value=this.opacity,this.ssrMaterial.uniforms.maxDistance.value=this.maxDistance,this.ssrMaterial.uniforms.thickness.value=this.thickness,this.renderPass(n,this.ssrMaterial,this.ssrRenderTarget),this.blur&&(this.renderPass(n,this.blurMaterial,this.blurRenderTarget),this.renderPass(n,this.blurMaterial2,this.blurRenderTarget2)),this.output){case Oc.OUTPUT.Default:this.bouncing?(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.prevRenderTarget),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=Ha,this.renderPass(n,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.prevRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e)):(this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e),this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=Ha,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e));break;case Oc.OUTPUT.SSR:this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e),this.bouncing&&(this.blur?this.copyMaterial.uniforms.tDiffuse.value=this.blurRenderTarget2.texture:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.prevRenderTarget),this.copyMaterial.uniforms.tDiffuse.value=this.ssrRenderTarget.texture,this.copyMaterial.blending=Ha,this.renderPass(n,this.copyMaterial,this.prevRenderTarget));break;case Oc.OUTPUT.Beauty:this.copyMaterial.uniforms.tDiffuse.value=this.beautyRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Oc.OUTPUT.Depth:this.renderPass(n,this.depthRenderMaterial,this.renderToScreen?null:e);break;case Oc.OUTPUT.Normal:this.copyMaterial.uniforms.tDiffuse.value=this.normalRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;case Oc.OUTPUT.Metalness:this.copyMaterial.uniforms.tDiffuse.value=this.metalnessRenderTarget.texture,this.copyMaterial.blending=Kt,this.renderPass(n,this.copyMaterial,this.renderToScreen?null:e);break;default:console.warn("THREE.SSRPass: Unknown output type.")}}renderPass(n,e,t,i,r){this.originalClearColor.copy(n.getClearColor(this.tempColor));const s=n.getClearAlpha(this.tempColor),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.fsQuad.material=e,this.fsQuad.render(n),n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}renderOverride(n,e,t,i,r){this.originalClearColor.copy(n.getClearColor(this.tempColor));const s=n.getClearAlpha(this.tempColor),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i=e.clearColor||i,r=e.clearAlpha||r,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.scene.overrideMaterial=e,n.render(this.scene,this.camera),this.scene.overrideMaterial=null,n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}renderMetalness(n,e,t,i,r){this.originalClearColor.copy(n.getClearColor(this.tempColor));const s=n.getClearAlpha(this.tempColor),a=n.autoClear;n.setRenderTarget(t),n.autoClear=!1,i=e.clearColor||i,r=e.clearAlpha||r,i!=null&&(n.setClearColor(i),n.setClearAlpha(r||0),n.clear()),this.scene.traverseVisible(o=>{o._SSRPassBackupMaterial=o.material,this._selects.includes(o)?o.material=this.metalnessOnMaterial:o.material=this.metalnessOffMaterial}),n.render(this.scene,this.camera),this.scene.traverseVisible(o=>{o.material=o._SSRPassBackupMaterial}),n.autoClear=a,n.setClearColor(this.originalClearColor),n.setClearAlpha(s)}setSize(n,e){this.width=n,this.height=e,this.ssrMaterial.defines.MAX_STEP=Math.sqrt(n*n+e*e),this.ssrMaterial.needsUpdate=!0,this.beautyRenderTarget.setSize(n,e),this.prevRenderTarget.setSize(n,e),this.ssrRenderTarget.setSize(n,e),this.normalRenderTarget.setSize(n,e),this.metalnessRenderTarget.setSize(n,e),this.blurRenderTarget.setSize(n,e),this.blurRenderTarget2.setSize(n,e),this.ssrMaterial.uniforms.resolution.value.set(n,e),this.ssrMaterial.uniforms.cameraProjectionMatrix.value.copy(this.camera.projectionMatrix),this.ssrMaterial.uniforms.cameraInverseProjectionMatrix.value.copy(this.camera.projectionMatrixInverse),this.blurMaterial.uniforms.resolution.value.set(n,e),this.blurMaterial2.uniforms.resolution.value.set(n,e)}};let yee=Oc;ut(yee,"OUTPUT",{Default:0,SSR:1,Beauty:3,Depth:4,Normal:5,Metalness:7});const Jy=class{static createButton(n,e={}){const t=document.createElement("button");function i(){let o=null;async function l(u){u.addEventListener("end",c),await n.xr.setSession(u),t.textContent="EXIT VR",o=u}function c(){o.removeEventListener("end",c),t.textContent="ENTER VR",o=null}t.style.display="",t.style.cursor="pointer",t.style.left="calc(50% - 50px)",t.style.width="100px",t.textContent="ENTER VR",t.onmouseenter=()=>{t.style.opacity="1.0"},t.onmouseleave=()=>{t.style.opacity="0.5"},t.onclick=()=>{var u;if(o===null){const h=[e.optionalFeatures,"local-floor","bounded-floor","hand-tracking"].flat().filter(Boolean);(u=navigator.xr)==null||u.requestSession("immersive-vr",{...e,optionalFeatures:h}).then(l)}else o.end()}}function r(){t.style.display="",t.style.cursor="auto",t.style.left="calc(50% - 75px)",t.style.width="150px",t.onmouseenter=null,t.onmouseleave=null,t.onclick=null}function s(){r(),t.textContent="VR NOT SUPPORTED"}function a(o){o.style.position="absolute",o.style.bottom="20px",o.style.padding="12px 6px",o.style.border="1px solid #fff",o.style.borderRadius="4px",o.style.background="rgba(0,0,0,0.1)",o.style.color="#fff",o.style.font="normal 13px sans-serif",o.style.textAlign="center",o.style.opacity="0.5",o.style.outline="none",o.style.zIndex="999"}if("xr"in navigator)return a(t),t.id="VRButton",t.style.display="none",navigator.xr.isSessionSupported("immersive-vr").then(o=>{o?i():s(),o&&Jy.xrSessionIsGranted&&t.click()}),t;{const o=document.createElement("a");return window.isSecureContext===!1?(o.href=document.location.href.replace(/^http:/,"https:"),o.innerHTML="WEBXR NEEDS HTTPS"):(o.href="https://immersiveweb.dev/",o.innerHTML="WEBXR NOT AVAILABLE"),o.style.left="calc(50% - 90px)",o.style.width="180px",o.style.textDecoration="none",a(o),o}}static registerSessionGrantedListener(){"xr"in navigator&&navigator.xr.addEventListener("sessiongranted",()=>{Jy.xrSessionIsGranted=!0})}};let xee=Jy;ut(xee,"xrSessionIsGranted",!1);const c5=new c0,u5=new N,ph=new N,ia=new N,Ro=new N,Ua=new N,Bo=new N,Do=new N,Ed=new N,Sd=new N,wd=new N,jg=new N,Cd=new N,Td=new N,bd=new N;class c9{constructor(e,t,i){this.camera=e,this.scene=t,this.startPoint=new N,this.endPoint=new N,this.collection=[],this.deep=i||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(c5,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){ph.copy(e),ph.x=Math.min(e.x,t.x),ph.y=Math.max(e.y,t.y),t.x=Math.max(e.x,t.x),t.y=Math.min(e.y,t.y),ia.setFromMatrixPosition(this.camera.matrixWorld),Ro.copy(ph),Ua.set(t.x,ph.y,0),Bo.copy(t),Do.set(ph.x,t.y,0),Ro.unproject(this.camera),Ua.unproject(this.camera),Bo.unproject(this.camera),Do.unproject(this.camera),Cd.copy(Ro).sub(ia),Td.copy(Ua).sub(ia),bd.copy(Bo).sub(ia),Cd.normalize(),Td.normalize(),bd.normalize(),Cd.multiplyScalar(this.deep),Td.multiplyScalar(this.deep),bd.multiplyScalar(this.deep),Cd.add(ia),Td.add(ia),bd.add(ia);var i=c5.planes;i[0].setFromCoplanarPoints(ia,Ro,Ua),i[1].setFromCoplanarPoints(ia,Ua,Bo),i[2].setFromCoplanarPoints(Bo,Do,ia),i[3].setFromCoplanarPoints(Do,Ro,ia),i[4].setFromCoplanarPoints(Ua,Bo,Do),i[5].setFromCoplanarPoints(bd,Td,Cd),i[5].normal.multiplyScalar(-1)}else if(this.camera.isOrthographicCamera){const r=Math.min(e.x,t.x),s=Math.max(e.y,t.y),a=Math.max(e.x,t.x),o=Math.min(e.y,t.y);Ro.set(r,s,-1),Ua.set(a,s,-1),Bo.set(a,o,-1),Do.set(r,o,-1),Ed.set(r,s,1),Sd.set(a,s,1),wd.set(a,o,1),jg.set(r,o,1),Ro.unproject(this.camera),Ua.unproject(this.camera),Bo.unproject(this.camera),Do.unproject(this.camera),Ed.unproject(this.camera),Sd.unproject(this.camera),wd.unproject(this.camera),jg.unproject(this.camera);var i=c5.planes;i[0].setFromCoplanarPoints(Ro,Ed,Sd),i[1].setFromCoplanarPoints(Ua,Sd,wd),i[2].setFromCoplanarPoints(wd,jg,Do),i[3].setFromCoplanarPoints(jg,Ed,Ro),i[4].setFromCoplanarPoints(Ua,Bo,Do),i[5].setFromCoplanarPoints(wd,Sd,Ed),i[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(),u5.copy(t.geometry.boundingSphere.center),u5.applyMatrix4(t.matrixWorld),e.containsPoint(u5)&&this.collection.push(t)),t.children.length>0)for(let i=0;i0){if(++e>=vte)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}function Ete(n){return function(){return n}}var Ste=function(){try{var n=Cu(Object,"defineProperty");return n({},"",{}),n}catch{}}();const f2=Ste;var wte=f2?function(n,e){return f2(n,"toString",{configurable:!0,enumerable:!1,value:Ete(e),writable:!0})}:tf;const Cte=wte;var Tte=_te(Cte);const bte=Tte;function BR(n,e){for(var t=-1,i=n==null?0:n.length;++t-1}var Rte=9007199254740991,Bte=/^(?:0|[1-9]\d*)$/;function R1(n,e){var t=typeof n;return e=e??Rte,!!e&&(t=="number"||t!="symbol"&&Bte.test(n))&&n>-1&&n%1==0&&n-1&&n%1==0&&n<=Ute}function ro(n){return n!=null&&m8(n.length)&&!Jo(n)}function D1(n,e,t){if(!Ys(t))return!1;var i=typeof e;return(i=="number"?ro(t)&&R1(e,t.length):i=="string"&&e in t)?F0(t[e],n):!1}function Ote(n){return g8(function(e,t){var i=-1,r=t.length,s=r>1?t[r-1]:void 0,a=r>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(r--,s):void 0,a&&D1(t[0],t[1],a)&&(s=r<3?void 0:s,r=1),e=Object(e);++i-1}function eie(n,e){var t=this.__data__,i=U1(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function Zo(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e0&&t(o)?e>1?k1(o,e-1,t,i,r):_8(r,o):i||(r[r.length]=o)}return r}function ua(n){var e=n==null?0:n.length;return e?k1(n,1):[]}var yie=kR(Object.getPrototypeOf,Object);const GR=yie;function zR(n,e,t){var i=-1,r=n.length;e<0&&(e=-e>r?0:r+e),t=t>r?r:t,t<0&&(t+=r),r=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(r);++io))return!1;var c=s.get(n),u=s.get(e);if(c&&u)return c==e&&u==n;var h=-1,f=!0,p=t&lse?new rf:void 0;for(s.set(n,e),s.set(e,n);++h2?e[2]:void 0;for(r&&D1(e[0],e[1],r)&&(i=1);++t=tae&&(s=C8,a=!1,e=new rf(e));e:for(;++r-1?r[s?e[a]:a]:void 0}}var lae=Math.max;function cae(n,e,t){var i=n==null?0:n.length;if(!i)return-1;var r=t==null?0:O0(t);return r<0&&(r=lae(i+r,0)),DR(n,so(e),r)}var uae=oae(cae);const af=uae;function ma(n){return n&&n.length?n[0]:void 0}function hae(n,e){var t=-1,i=ro(n)?Array(n.length):[];return Tu(n,function(r,s,a){i[++t]=e(r,s,a)}),i}function pt(n,e){var t=an(n)?U0:hae;return t(n,so(e))}function zs(n,e){return k1(pt(n,e),1)}var fae=Object.prototype,dae=fae.hasOwnProperty,pae=Jse(function(n,e,t){dae.call(n,t)?n[t].push(e):p8(n,t,[e])});const gae=pae;var mae=Object.prototype,Aae=mae.hasOwnProperty;function vae(n,e){return n!=null&&Aae.call(n,e)}function _t(n,e){return n!=null&&eB(n,e,vae)}var yae="[object String]";function Wr(n){return typeof n=="string"||!an(n)&&ga(n)&&ec(n)==yae}function xae(n,e){return U0(e,function(t){return n[t]})}function Ii(n){return n==null?[]:xae(n,us(n))}var _ae=Math.max;function Dr(n,e,t,i){n=ro(n)?n:Ii(n),t=t&&!i?O0(t):0;var r=n.length;return t<0&&(t=_ae(r+t,0)),Wr(n)?t<=r&&n.indexOf(e,t)>-1:!!r&&d8(n,e,t)>-1}var Eae=Math.max;function z9(n,e,t){var i=n==null?0:n.length;if(!i)return-1;var r=t==null?0:O0(t);return r<0&&(r=Eae(i+r,0)),d8(n,e,r)}var Sae="[object Map]",wae="[object Set]",Cae=Object.prototype,Tae=Cae.hasOwnProperty;function Fn(n){if(n==null)return!0;if(ro(n)&&(an(n)||typeof n=="string"||typeof n.splice=="function"||e0(n)||A8(n)||P1(n)))return!n.length;var e=nf(n);if(e==Sae||e==wae)return!n.size;if(N0(n))return!NR(n).length;for(var t in n)if(Tae.call(n,t))return!1;return!0}var bae="[object RegExp]";function Iae(n){return ga(n)&&ec(n)==bae}var Q9=Ql&&Ql.isRegExp,Mae=Q9?G0(Q9):Iae;const Vo=Mae;function Wo(n){return n===void 0}var Rae="Expected a function";function Bae(n){if(typeof n!="function")throw new TypeError(Rae);return function(){var e=arguments;switch(e.length){case 0:return!n.call(this);case 1:return!n.call(this,e[0]);case 2:return!n.call(this,e[0],e[1]);case 3:return!n.call(this,e[0],e[1],e[2])}return!n.apply(this,e)}}function Dae(n,e,t,i){if(!Ys(n))return n;e=F1(e,n);for(var r=-1,s=e.length,a=s-1,o=n;o!=null&&++r=Nae){var c=e?null:kae(n);if(c)return T8(c);a=!1,r=C8,l=new rf}else l=e?[]:o;e:for(;++i{t.accept(e)})}}class ds extends ao{constructor(e){super([]),this.idx=1,hs(this,_a(e,t=>t!==void 0))}set definition(e){}get definition(){return this.referencedRule!==void 0?this.referencedRule.definition:[]}accept(e){e.visit(this)}}class _f extends ao{constructor(e){super(e.definition),this.orgText="",hs(this,_a(e,t=>t!==void 0))}}class Yr extends ao{constructor(e){super(e.definition),this.ignoreAmbiguities=!1,hs(this,_a(e,t=>t!==void 0))}}class Vr extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class oo extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class lo extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class Bi extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class Ea extends ao{constructor(e){super(e.definition),this.idx=1,hs(this,_a(e,t=>t!==void 0))}}class Sa extends ao{get definition(){return this._definition}set definition(e){this._definition=e}constructor(e){super(e.definition),this.idx=1,this.ignoreAmbiguities=!1,this.hasPredicates=!1,hs(this,_a(e,t=>t!==void 0))}}class ei{constructor(e){this.idx=1,hs(this,_a(e,t=>t!==void 0))}accept(e){e.visit(this)}}function Hae(n){return pt(n,Sm)}function Sm(n){function e(t){return pt(t,Sm)}if(n instanceof ds){const t={type:"NonTerminal",name:n.nonTerminalName,idx:n.idx};return Wr(n.label)&&(t.label=n.label),t}else{if(n instanceof Yr)return{type:"Alternative",definition:e(n.definition)};if(n instanceof Vr)return{type:"Option",idx:n.idx,definition:e(n.definition)};if(n instanceof oo)return{type:"RepetitionMandatory",idx:n.idx,definition:e(n.definition)};if(n instanceof lo)return{type:"RepetitionMandatoryWithSeparator",idx:n.idx,separator:Sm(new ei({terminalType:n.separator})),definition:e(n.definition)};if(n instanceof Ea)return{type:"RepetitionWithSeparator",idx:n.idx,separator:Sm(new ei({terminalType:n.separator})),definition:e(n.definition)};if(n instanceof Bi)return{type:"Repetition",idx:n.idx,definition:e(n.definition)};if(n instanceof Sa)return{type:"Alternation",idx:n.idx,definition:e(n.definition)};if(n instanceof ei){const t={type:"Terminal",name:n.terminalType.name,label:zae(n.terminalType),idx:n.idx};Wr(n.label)&&(t.terminalLabel=n.label);const i=n.terminalType.PATTERN;return n.terminalType.PATTERN&&(t.pattern=Vo(i)?i.source:i),t}else{if(n instanceof _f)return{type:"Rule",name:n.name,orgText:n.orgText,definition:e(n.definition)};throw Error("non exhaustive match")}}}class Ef{visit(e){const t=e;switch(t.constructor){case ds:return this.visitNonTerminal(t);case Yr:return this.visitAlternative(t);case Vr:return this.visitOption(t);case oo:return this.visitRepetitionMandatory(t);case lo:return this.visitRepetitionMandatoryWithSeparator(t);case Ea:return this.visitRepetitionWithSeparator(t);case Bi:return this.visitRepetition(t);case Sa:return this.visitAlternation(t);case ei:return this.visitTerminal(t);case _f:return this.visitRule(t);default:throw Error("non exhaustive match")}}visitNonTerminal(e){}visitAlternative(e){}visitOption(e){}visitRepetition(e){}visitRepetitionMandatory(e){}visitRepetitionMandatoryWithSeparator(e){}visitRepetitionWithSeparator(e){}visitAlternation(e){}visitTerminal(e){}visitRule(e){}}function Vae(n){return n instanceof Yr||n instanceof Vr||n instanceof Bi||n instanceof oo||n instanceof lo||n instanceof Ea||n instanceof ei||n instanceof _f}function p2(n,e=[]){return n instanceof Vr||n instanceof Bi||n instanceof Ea?!0:n instanceof Sa?rB(n.definition,i=>p2(i,e)):n instanceof ds&&Dr(e,n)?!1:n instanceof ao?(n instanceof ds&&e.push(n),ha(n.definition,i=>p2(i,e))):!1}function Wae(n){return n instanceof Sa}function Ga(n){if(n instanceof ds)return"SUBRULE";if(n instanceof Vr)return"OPTION";if(n instanceof Sa)return"OR";if(n instanceof oo)return"AT_LEAST_ONE";if(n instanceof lo)return"AT_LEAST_ONE_SEP";if(n instanceof Ea)return"MANY_SEP";if(n instanceof Bi)return"MANY";if(n instanceof ei)return"CONSUME";throw Error("non exhaustive match")}class z1{walk(e,t=[]){wt(e.definition,(i,r)=>{const s=Xi(e.definition,r+1);if(i instanceof ds)this.walkProdRef(i,s,t);else if(i instanceof ei)this.walkTerminal(i,s,t);else if(i instanceof Yr)this.walkFlat(i,s,t);else if(i instanceof Vr)this.walkOption(i,s,t);else if(i instanceof oo)this.walkAtLeastOne(i,s,t);else if(i instanceof lo)this.walkAtLeastOneSep(i,s,t);else if(i instanceof Ea)this.walkManySep(i,s,t);else if(i instanceof Bi)this.walkMany(i,s,t);else if(i instanceof Sa)this.walkOr(i,s,t);else throw Error("non exhaustive match")})}walkTerminal(e,t,i){}walkProdRef(e,t,i){}walkFlat(e,t,i){const r=t.concat(i);this.walk(e,r)}walkOption(e,t,i){const r=t.concat(i);this.walk(e,r)}walkAtLeastOne(e,t,i){const r=[new Vr({definition:e.definition})].concat(t,i);this.walk(e,r)}walkAtLeastOneSep(e,t,i){const r=H9(e,t,i);this.walk(e,r)}walkMany(e,t,i){const r=[new Vr({definition:e.definition})].concat(t,i);this.walk(e,r)}walkManySep(e,t,i){const r=H9(e,t,i);this.walk(e,r)}walkOr(e,t,i){const r=t.concat(i);wt(e.definition,s=>{const a=new Yr({definition:[s]});this.walk(a,r)})}}function H9(n,e,t){return[new Vr({definition:[new ei({terminalType:n.separator})].concat(n.definition)})].concat(e,t)}function H0(n){if(n instanceof ds)return H0(n.referencedRule);if(n instanceof ei)return Xae(n);if(Vae(n))return Yae(n);if(Wae(n))return qae(n);throw Error("non exhaustive match")}function Yae(n){let e=[];const t=n.definition;let i=0,r=t.length>i,s,a=!0;for(;r&&a;)s=t[i],a=p2(s),e=e.concat(H0(s)),i=i+1,r=t.length>i;return M8(e)}function qae(n){const e=pt(n.definition,t=>H0(t));return M8(ua(e))}function Xae(n){return[n.terminalType]}const lB="_~IN~_";class jae extends z1{constructor(e){super(),this.topProd=e,this.follows={}}startWalking(){return this.walk(this.topProd),this.follows}walkTerminal(e,t,i){}walkProdRef(e,t,i){const r=$ae(e.referencedRule,e.idx)+this.topProd.name,s=t.concat(i),a=new Yr({definition:s}),o=H0(a);this.follows[r]=o}}function Kae(n){const e={};return wt(n,t=>{const i=new jae(t).startWalking();hs(e,i)}),e}function $ae(n,e){return n.name+e+lB}function bt(n){return n.charCodeAt(0)}function p5(n,e){Array.isArray(n)?n.forEach(function(t){e.push(t)}):e.push(n)}function Md(n,e){if(n[e]===!0)throw"duplicate flag "+e;n[e],n[e]=!0}function gh(n){if(n===void 0)throw Error("Internal Error - Should never get here!");return!0}function Jae(){throw Error("Internal Error - Should never get here!")}function V9(n){return n.type==="Character"}const g2=[];for(let n=bt("0");n<=bt("9");n++)g2.push(n);const m2=[bt("_")].concat(g2);for(let n=bt("a");n<=bt("z");n++)m2.push(n);for(let n=bt("A");n<=bt("Z");n++)m2.push(n);const W9=[bt(" "),bt("\f"),bt(` +`),bt("\r"),bt(" "),bt("\v"),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt(" "),bt("\u2028"),bt("\u2029"),bt(" "),bt(" "),bt(" "),bt("\uFEFF")],Zae=/[0-9a-fA-F]/,$g=/[0-9]/,eoe=/[1-9]/;class toe{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const t=this.disjunction();this.consumeChar("/");const i={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":Md(i,"global");break;case"i":Md(i,"ignoreCase");break;case"m":Md(i,"multiLine");break;case"u":Md(i,"unicode");break;case"y":Md(i,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:i,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break}gh(t);const i=this.disjunction();return this.consumeChar(")"),{type:t,value:i,loc:this.loc(e)}}return Jae()}quantifier(e=!1){let t;const i=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const r=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:r,atMost:r};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),t={atLeast:r,atMost:s}):t={atLeast:r,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;gh(t);break}if(!(e===!0&&t===void 0)&&gh(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(i),t}atom(){let e;const t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),gh(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[bt(` +`),bt("\r"),bt("\u2028"),bt("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=g2;break;case"D":e=g2,t=!0;break;case"s":e=W9;break;case"S":e=W9,t=!0;break;case"w":e=m2;break;case"W":e=m2,t=!0;break}if(gh(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=bt("\f");break;case"n":e=bt(` +`);break;case"r":e=bt("\r");break;case"t":e=bt(" ");break;case"v":e=bt("\v");break}if(gh(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:bt("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:bt(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case` +`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:const e=this.popChar();return{type:"Character",value:bt(e)}}}characterClass(){const e=[];let t=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),t=!0);this.isClassAtom();){const i=this.classAtom();if(i.type,V9(i)&&this.isRangeDash()){this.consumeChar("-");const r=this.classAtom();if(r.type,V9(r)){if(r.value=this.input.length)throw Error("Unexpected end of input");this.idx++}loc(e){return{begin:e,end:this.idx}}}class R8{visitChildren(e){for(const t in e){const i=e[t];e.hasOwnProperty(t)&&(i.type!==void 0?this.visit(i):Array.isArray(i)&&i.forEach(r=>{this.visit(r)},this))}}visit(e){switch(e.type){case"Pattern":this.visitPattern(e);break;case"Flags":this.visitFlags(e);break;case"Disjunction":this.visitDisjunction(e);break;case"Alternative":this.visitAlternative(e);break;case"StartAnchor":this.visitStartAnchor(e);break;case"EndAnchor":this.visitEndAnchor(e);break;case"WordBoundary":this.visitWordBoundary(e);break;case"NonWordBoundary":this.visitNonWordBoundary(e);break;case"Lookahead":this.visitLookahead(e);break;case"NegativeLookahead":this.visitNegativeLookahead(e);break;case"Character":this.visitCharacter(e);break;case"Set":this.visitSet(e);break;case"Group":this.visitGroup(e);break;case"GroupBackReference":this.visitGroupBackReference(e);break;case"Quantifier":this.visitQuantifier(e);break}this.visitChildren(e)}visitPattern(e){}visitFlags(e){}visitDisjunction(e){}visitAlternative(e){}visitStartAnchor(e){}visitEndAnchor(e){}visitWordBoundary(e){}visitNonWordBoundary(e){}visitLookahead(e){}visitNegativeLookahead(e){}visitCharacter(e){}visitSet(e){}visitGroup(e){}visitGroupBackReference(e){}visitQuantifier(e){}}let wm={};const noe=new toe;function Q1(n){const e=n.toString();if(wm.hasOwnProperty(e))return wm[e];{const t=noe.pattern(e);return wm[e]=t,t}}function ioe(){wm={}}const cB="Complement Sets are not supported for first char optimization",A2=`Unable to use "first char" lexer optimizations: +`;function roe(n,e=!1){try{const t=Q1(n);return r6(t.value,{},t.flags.ignoreCase)}catch(t){if(t.message===cB)e&&sB(`${A2} Unable to optimize: < ${n.toString()} > + Complement Sets cannot be automatically optimized. + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{let i="";e&&(i=` + This will disable the lexer's first char optimizations. + See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),i6(`${A2} + Failed parsing: < ${n.toString()} > + Using the @chevrotain/regexp-to-ast library + Please open an issue at: https://github.com/chevrotain/chevrotain/issues`+i)}}return[]}function r6(n,e,t){switch(n.type){case"Disjunction":for(let r=0;r{if(typeof l=="number")Jg(l,e,t);else{const c=l;if(t===!0)for(let u=c.from;u<=c.to;u++)Jg(u,e,t);else{for(let u=c.from;u<=c.to&&u=Wd){const u=c.from>=Wd?c.from:Wd,h=c.to,f=Hl(u),p=Hl(h);for(let m=f;m<=p;m++)e[m]=m}}}});break;case"Group":r6(a.value,e,t);break;default:throw Error("Non Exhaustive Match")}const o=a.quantifier!==void 0&&a.quantifier.atLeast===0;if(a.type==="Group"&&s6(a)===!1||a.type!=="Group"&&o===!1)break}break;default:throw Error("non exhaustive match!")}return Ii(e)}function Jg(n,e,t){const i=Hl(n);e[i]=i,t===!0&&soe(n,e)}function soe(n,e){const t=String.fromCharCode(n),i=t.toUpperCase();if(i!==t){const r=Hl(i.charCodeAt(0));e[r]=r}else{const r=t.toLowerCase();if(r!==t){const s=Hl(r.charCodeAt(0));e[s]=s}}}function Y9(n,e){return af(n.value,t=>{if(typeof t=="number")return Dr(e,t);{const i=t;return af(e,r=>i.from<=r&&r<=i.to)!==void 0}})}function s6(n){const e=n.quantifier;return e&&e.atLeast===0?!0:n.value?an(n.value)?ha(n.value,s6):s6(n.value):!1}class aoe extends R8{constructor(e){super(),this.targetCharCodes=e,this.found=!1}visitChildren(e){if(this.found!==!0){switch(e.type){case"Lookahead":this.visitLookahead(e);return;case"NegativeLookahead":this.visitNegativeLookahead(e);return}super.visitChildren(e)}}visitCharacter(e){Dr(this.targetCharCodes,e.value)&&(this.found=!0)}visitSet(e){e.complement?Y9(e,this.targetCharCodes)===void 0&&(this.found=!0):Y9(e,this.targetCharCodes)!==void 0&&(this.found=!0)}}function B8(n,e){if(e instanceof RegExp){const t=Q1(e),i=new aoe(n);return i.visit(t),i.found}else return af(e,t=>Dr(n,t.charCodeAt(0)))!==void 0}const pu="PATTERN",Vd="defaultMode",Zg="modes";let uB=typeof new RegExp("(?:)").sticky=="boolean";function ooe(n,e){e=I8(e,{useSticky:uB,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` +`],tracer:(_,x)=>x()});const t=e.tracer;t("initCharCodeToOptimizedIndexMap",()=>{Roe()});let i;t("Reject Lexer.NA",()=>{i=G1(n,_=>_[pu]===Qs.NA)});let r=!1,s;t("Transform Patterns",()=>{r=!1,s=pt(i,_=>{const x=_[pu];if(Vo(x)){const E=x.source;return E.length===1&&E!=="^"&&E!=="$"&&E!=="."&&!x.ignoreCase?E:E.length===2&&E[0]==="\\"&&!Dr(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],E[1])?E[1]:e.useSticky?X9(x):q9(x)}else{if(Jo(x))return r=!0,{exec:x};if(typeof x=="object")return r=!0,x;if(typeof x=="string"){if(x.length===1)return x;{const E=x.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),w=new RegExp(E);return e.useSticky?X9(w):q9(w)}}else throw Error("non exhaustive match")}})});let a,o,l,c,u;t("misc mapping",()=>{a=pt(i,_=>_.tokenTypeIdx),o=pt(i,_=>{const x=_.GROUP;if(x!==Qs.SKIPPED){if(Wr(x))return x;if(Wo(x))return!1;throw Error("non exhaustive match")}}),l=pt(i,_=>{const x=_.LONGER_ALT;if(x)return an(x)?pt(x,w=>z9(i,w)):[z9(i,x)]}),c=pt(i,_=>_.PUSH_MODE),u=pt(i,_=>_t(_,"POP_MODE"))});let h;t("Line Terminator Handling",()=>{const _=dB(e.lineTerminatorCharacters);h=pt(i,x=>!1),e.positionTracking!=="onlyOffset"&&(h=pt(i,x=>_t(x,"LINE_BREAKS")?!!x.LINE_BREAKS:fB(x,_)===!1&&B8(_,x.PATTERN)))});let f,p,m,y;t("Misc Mapping #2",()=>{f=pt(i,hB),p=pt(s,boe),m=fs(i,(_,x)=>{const E=x.GROUP;return Wr(E)&&E!==Qs.SKIPPED&&(_[E]=[]),_},{}),y=pt(s,(_,x)=>({pattern:s[x],longerAlt:l[x],canLineTerminator:h[x],isCustom:f[x],short:p[x],group:o[x],push:c[x],pop:u[x],tokenTypeIdx:a[x],tokenType:i[x]}))});let v=!0,A=[];return e.safeMode||t("First Char Optimization",()=>{A=fs(i,(_,x,E)=>{if(typeof x.PATTERN=="string"){const w=x.PATTERN.charCodeAt(0),I=Hl(w);g5(_,I,y[E])}else if(an(x.START_CHARS_HINT)){let w;wt(x.START_CHARS_HINT,I=>{const T=typeof I=="string"?I.charCodeAt(0):I,M=Hl(T);w!==M&&(w=M,g5(_,M,y[E]))})}else if(Vo(x.PATTERN))if(x.PATTERN.unicode)v=!1,e.ensureOptimizations&&i6(`${A2} Unable to analyze < ${x.PATTERN.toString()} > pattern. + The regexp unicode flag is not currently supported by the regexp-to-ast library. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{const w=roe(x.PATTERN,e.ensureOptimizations);Fn(w)&&(v=!1),wt(w,I=>{g5(_,I,y[E])})}else e.ensureOptimizations&&i6(`${A2} TokenType: <${x.name}> is using a custom token pattern without providing parameter. + This will disable the lexer's first char optimizations. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),v=!1;return _},[])}),{emptyGroups:m,patternIdxToConfig:y,charCodeToPatternIdxToConfig:A,hasCustom:r,canBeOptimized:v}}function loe(n,e){let t=[];const i=uoe(n);t=t.concat(i.errors);const r=hoe(i.valid),s=r.valid;return t=t.concat(r.errors),t=t.concat(coe(s)),t=t.concat(yoe(s)),t=t.concat(xoe(s,e)),t=t.concat(_oe(s)),t}function coe(n){let e=[];const t=js(n,i=>Vo(i[pu]));return e=e.concat(doe(t)),e=e.concat(moe(t)),e=e.concat(Aoe(t)),e=e.concat(voe(t)),e=e.concat(poe(t)),e}function uoe(n){const e=js(n,r=>!_t(r,pu)),t=pt(e,r=>({message:"Token Type: ->"+r.name+"<- missing static 'PATTERN' property",type:ci.MISSING_PATTERN,tokenTypes:[r]})),i=N1(n,e);return{errors:t,valid:i}}function hoe(n){const e=js(n,r=>{const s=r[pu];return!Vo(s)&&!Jo(s)&&!_t(s,"exec")&&!Wr(s)}),t=pt(e,r=>({message:"Token Type: ->"+r.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:ci.INVALID_PATTERN,tokenTypes:[r]})),i=N1(n,e);return{errors:t,valid:i}}const foe=/[^\\][$]/;function doe(n){class e extends R8{constructor(){super(...arguments),this.found=!1}visitEndAnchor(s){this.found=!0}}const t=js(n,r=>{const s=r.PATTERN;try{const a=Q1(s),o=new e;return o.visit(a),o.found}catch{return foe.test(s.source)}});return pt(t,r=>({message:`Unexpected RegExp Anchor Error: + Token Type: ->`+r.name+`<- static 'PATTERN' cannot contain end of input anchor '$' + See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ci.EOI_ANCHOR_FOUND,tokenTypes:[r]}))}function poe(n){const e=js(n,i=>i.PATTERN.test(""));return pt(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' must not match an empty string",type:ci.EMPTY_MATCH_PATTERN,tokenTypes:[i]}))}const goe=/[^\\[][\^]|^\^/;function moe(n){class e extends R8{constructor(){super(...arguments),this.found=!1}visitStartAnchor(s){this.found=!0}}const t=js(n,r=>{const s=r.PATTERN;try{const a=Q1(s),o=new e;return o.visit(a),o.found}catch{return goe.test(s.source)}});return pt(t,r=>({message:`Unexpected RegExp Anchor Error: + Token Type: ->`+r.name+`<- static 'PATTERN' cannot contain start of input anchor '^' + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ci.SOI_ANCHOR_FOUND,tokenTypes:[r]}))}function Aoe(n){const e=js(n,i=>{const r=i[pu];return r instanceof RegExp&&(r.multiline||r.global)});return pt(e,i=>({message:"Token Type: ->"+i.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ci.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[i]}))}function voe(n){const e=[];let t=pt(n,s=>fs(n,(a,o)=>(s.PATTERN.source===o.PATTERN.source&&!Dr(e,o)&&o.PATTERN!==Qs.NA&&(e.push(o),a.push(o)),a),[]));t=Q0(t);const i=js(t,s=>s.length>1);return pt(i,s=>{const a=pt(s,l=>l.name);return{message:`The same RegExp pattern ->${ma(s).PATTERN}<-has been used in all of the following Token Types: ${a.join(", ")} <-`,type:ci.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}})}function yoe(n){const e=js(n,i=>{if(!_t(i,"GROUP"))return!1;const r=i.GROUP;return r!==Qs.SKIPPED&&r!==Qs.NA&&!Wr(r)});return pt(e,i=>({message:"Token Type: ->"+i.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ci.INVALID_GROUP_TYPE_FOUND,tokenTypes:[i]}))}function xoe(n,e){const t=js(n,r=>r.PUSH_MODE!==void 0&&!Dr(e,r.PUSH_MODE));return pt(t,r=>({message:`Token Type: ->${r.name}<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->${r.PUSH_MODE}<-which does not exist`,type:ci.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[r]}))}function _oe(n){const e=[],t=fs(n,(i,r,s)=>{const a=r.PATTERN;return a===Qs.NA||(Wr(a)?i.push({str:a,idx:s,tokenType:r}):Vo(a)&&Soe(a)&&i.push({str:a.source,idx:s,tokenType:r})),i},[]);return wt(n,(i,r)=>{wt(t,({str:s,idx:a,tokenType:o})=>{if(r${o.name}<- can never be matched. +Because it appears AFTER the Token Type ->${i.name}<-in the lexer's definition. +See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:l,type:ci.UNREACHABLE_PATTERN,tokenTypes:[i,o]})}})}),e}function Eoe(n,e){if(Vo(e)){const t=e.exec(n);return t!==null&&t.index===0}else{if(Jo(e))return e(n,0,[],{});if(_t(e,"exec"))return e.exec(n,0,[],{});if(typeof e=="string")return e===n;throw Error("non exhaustive match")}}function Soe(n){return af([".","\\","[","]","|","^","$","(",")","?","*","+","{"],t=>n.source.indexOf(t)!==-1)===void 0}function q9(n){const e=n.ignoreCase?"i":"";return new RegExp(`^(?:${n.source})`,e)}function X9(n){const e=n.ignoreCase?"iy":"y";return new RegExp(`${n.source}`,e)}function woe(n,e,t){const i=[];return _t(n,Vd)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Vd+`> property in its definition +`,type:ci.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),_t(n,Zg)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Zg+`> property in its definition +`,type:ci.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),_t(n,Zg)&&_t(n,Vd)&&!_t(n.modes,n.defaultMode)&&i.push({message:`A MultiMode Lexer cannot be initialized with a ${Vd}: <${n.defaultMode}>which does not exist +`,type:ci.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),_t(n,Zg)&&wt(n.modes,(r,s)=>{wt(r,(a,o)=>{if(Wo(a))i.push({message:`A Lexer cannot be initialized using an undefined Token Type. Mode:<${s}> at index: <${o}> +`,type:ci.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if(_t(a,"LONGER_ALT")){const l=an(a.LONGER_ALT)?a.LONGER_ALT:[a.LONGER_ALT];wt(l,c=>{!Wo(c)&&!Dr(r,c)&&i.push({message:`A MultiMode Lexer cannot be initialized with a longer_alt <${c.name}> on token <${a.name}> outside of mode <${s}> +`,type:ci.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})})}})}),i}function Coe(n,e,t){const i=[];let r=!1;const s=Q0(ua(Ii(n.modes))),a=G1(s,l=>l[pu]===Qs.NA),o=dB(t);return e&&wt(a,l=>{const c=fB(l,o);if(c!==!1){const h={message:Moe(l,c),type:c.issue,tokenType:l};i.push(h)}else _t(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(r=!0):B8(o,l.PATTERN)&&(r=!0)}),e&&!r&&i.push({message:`Warning: No LINE_BREAKS Found. + This Lexer has been defined to track line and column information, + But none of the Token Types can be identified as matching a line terminator. + See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS + for details.`,type:ci.NO_LINE_BREAKS_FLAGS}),i}function Toe(n){const e={},t=us(n);return wt(t,i=>{const r=n[i];if(an(r))e[i]=[];else throw Error("non exhaustive match")}),e}function hB(n){const e=n.PATTERN;if(Vo(e))return!1;if(Jo(e))return!0;if(_t(e,"exec"))return!0;if(Wr(e))return!1;throw Error("non exhaustive match")}function boe(n){return Wr(n)&&n.length===1?n.charCodeAt(0):!1}const Ioe={test:function(n){const e=n.length;for(let t=this.lastIndex;t Token Type + Root cause: ${e.errMsg}. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR`;if(e.issue===ci.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option. + The problem is in the <${n.name}> Token Type + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK`;throw Error("non exhaustive match")}function dB(n){return pt(n,t=>Wr(t)?t.charCodeAt(0):t)}function g5(n,e,t){n[e]===void 0?n[e]=[t]:n[e].push(t)}const Wd=256;let Cm=[];function Hl(n){return n255?255+~~(n/255):n}}function V0(n,e){const t=n.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}function v2(n,e){return n.tokenTypeIdx===e.tokenTypeIdx}let j9=1;const pB={};function W0(n){const e=Boe(n);Doe(e),Loe(e),Poe(e),wt(e,t=>{t.isParent=t.categoryMatches.length>0})}function Boe(n){let e=cr(n),t=n,i=!0;for(;i;){t=Q0(ua(pt(t,s=>s.CATEGORIES)));const r=N1(t,e);e=e.concat(r),Fn(r)?i=!1:t=r}return e}function Doe(n){wt(n,e=>{mB(e)||(pB[j9]=e,e.tokenTypeIdx=j9++),K9(e)&&!an(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),K9(e)||(e.CATEGORIES=[]),Uoe(e)||(e.categoryMatches=[]),Ooe(e)||(e.categoryMatchesMap={})})}function Poe(n){wt(n,e=>{e.categoryMatches=[],wt(e.categoryMatchesMap,(t,i)=>{e.categoryMatches.push(pB[i].tokenTypeIdx)})})}function Loe(n){wt(n,e=>{gB([],e)})}function gB(n,e){wt(n,t=>{e.categoryMatchesMap[t.tokenTypeIdx]=!0}),wt(e.CATEGORIES,t=>{const i=n.concat(e);Dr(i,t)||gB(i,t)})}function mB(n){return _t(n,"tokenTypeIdx")}function K9(n){return _t(n,"CATEGORIES")}function Uoe(n){return _t(n,"categoryMatches")}function Ooe(n){return _t(n,"categoryMatchesMap")}function Foe(n){return _t(n,"tokenTypeIdx")}const koe={buildUnableToPopLexerModeMessage(n){return`Unable to pop Lexer Mode after encountering Token ->${n.image}<- The Mode Stack is empty`},buildUnexpectedCharactersMessage(n,e,t,i,r){return`unexpected character: ->${n.charAt(e)}<- at offset: ${e}, skipped ${t} characters.`}};var ci;(function(n){n[n.MISSING_PATTERN=0]="MISSING_PATTERN",n[n.INVALID_PATTERN=1]="INVALID_PATTERN",n[n.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",n[n.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",n[n.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",n[n.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",n[n.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",n[n.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",n[n.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",n[n.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",n[n.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",n[n.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",n[n.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",n[n.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",n[n.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",n[n.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",n[n.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",n[n.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE"})(ci||(ci={}));const Yd={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` +`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:koe,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Yd);class Qs{constructor(e,t=Yd){if(this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=(r,s)=>{if(this.traceInitPerf===!0){this.traceInitIndent++;const a=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${r}>`);const{time:o,value:l}=aB(s),c=o>10?console.warn:console.log;return this.traceInitIndent time: ${o}ms`),this.traceInitIndent--,l}else return s()},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. +a boolean 2nd argument is no longer supported`);this.config=hs({},Yd,t);const i=this.config.traceInitPerf;i===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof i=="number"&&(this.traceInitMaxIdent=i,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",()=>{let r,s=!0;this.TRACE_INIT("Lexer Config handling",()=>{if(this.config.lineTerminatorsPattern===Yd.lineTerminatorsPattern)this.config.lineTerminatorsPattern=Ioe;else if(this.config.lineTerminatorCharacters===Yd.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. + For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');this.trackStartLines=/full|onlyStart/i.test(this.config.positionTracking),this.trackEndLines=/full/i.test(this.config.positionTracking),an(e)?r={modes:{defaultMode:cr(e)},defaultMode:Vd}:(s=!1,r=cr(e))}),this.config.skipValidations===!1&&(this.TRACE_INIT("performRuntimeChecks",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(woe(r,this.trackStartLines,this.config.lineTerminatorCharacters))}),this.TRACE_INIT("performWarningRuntimeChecks",()=>{this.lexerDefinitionWarning=this.lexerDefinitionWarning.concat(Coe(r,this.trackStartLines,this.config.lineTerminatorCharacters))})),r.modes=r.modes?r.modes:{},wt(r.modes,(o,l)=>{r.modes[l]=G1(o,c=>Wo(c))});const a=us(r.modes);if(wt(r.modes,(o,l)=>{this.TRACE_INIT(`Mode: <${l}> processing`,()=>{if(this.modes.push(l),this.config.skipValidations===!1&&this.TRACE_INIT("validatePatterns",()=>{this.lexerDefinitionErrors=this.lexerDefinitionErrors.concat(loe(o,a))}),Fn(this.lexerDefinitionErrors)){W0(o);let c;this.TRACE_INIT("analyzeTokenTypes",()=>{c=ooe(o,{lineTerminatorCharacters:this.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:this.TRACE_INIT})}),this.patternIdxToConfig[l]=c.patternIdxToConfig,this.charCodeToPatternIdxToConfig[l]=c.charCodeToPatternIdxToConfig,this.emptyGroups=hs({},this.emptyGroups,c.emptyGroups),this.hasCustom=c.hasCustom||this.hasCustom,this.canModeBeOptimized[l]=c.canBeOptimized}})}),this.defaultMode=r.defaultMode,!Fn(this.lexerDefinitionErrors)&&!this.config.deferDefinitionErrorsHandling){const l=pt(this.lexerDefinitionErrors,c=>c.message).join(`----------------------- +`);throw new Error(`Errors detected in definition of Lexer: +`+l)}wt(this.lexerDefinitionWarning,o=>{sB(o.message)}),this.TRACE_INIT("Choosing sub-methods implementations",()=>{if(uB?(this.chopInput=tf,this.match=this.matchWithTest):(this.updateLastIndex=Ti,this.match=this.matchWithExec),s&&(this.handleModes=Ti),this.trackStartLines===!1&&(this.computeNewColumn=tf),this.trackEndLines===!1&&(this.updateTokenEndLineColumnLocation=Ti),/full/i.test(this.config.positionTracking))this.createTokenInstance=this.createFullToken;else if(/onlyStart/i.test(this.config.positionTracking))this.createTokenInstance=this.createStartOnlyToken;else if(/onlyOffset/i.test(this.config.positionTracking))this.createTokenInstance=this.createOffsetOnlyToken;else throw Error(`Invalid config option: "${this.config.positionTracking}"`);this.hasCustom?(this.addToken=this.addTokenUsingPush,this.handlePayload=this.handlePayloadWithCustom):(this.addToken=this.addTokenUsingMemberAccess,this.handlePayload=this.handlePayloadNoCustom)}),this.TRACE_INIT("Failed Optimization Warnings",()=>{const o=fs(this.canModeBeOptimized,(l,c,u)=>(c===!1&&l.push(u),l),[]);if(t.ensureOptimizations&&!Fn(o))throw Error(`Lexer Modes: < ${o.join(", ")} > cannot be optimized. + Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. + Or inspect the console log for details on how to resolve these issues.`)}),this.TRACE_INIT("clearRegExpParserCache",()=>{ioe()}),this.TRACE_INIT("toFastProperties",()=>{oB(this)})})}tokenize(e,t=this.defaultMode){if(!Fn(this.lexerDefinitionErrors)){const r=pt(this.lexerDefinitionErrors,s=>s.message).join(`----------------------- +`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer: +`+r)}return this.tokenizeInternal(e,t)}tokenizeInternal(e,t){let i,r,s,a,o,l,c,u,h,f,p,m,y,v,A;const _=e,x=_.length;let E=0,w=0;const I=this.hasCustom?0:Math.floor(e.length/10),T=new Array(I),M=[];let b=this.trackStartLines?1:void 0,B=this.trackStartLines?1:void 0;const L=Toe(this.emptyGroups),U=this.trackStartLines,O=this.config.lineTerminatorsPattern;let Q=0,G=[],F=[];const q=[],Y=[];Object.freeze(Y);let H;function V(){return G}function D(ie){const te=Hl(ie),re=F[te];return re===void 0?Y:re}const k=ie=>{if(q.length===1&&ie.tokenType.PUSH_MODE===void 0){const te=this.config.errorMessageProvider.buildUnableToPopLexerModeMessage(ie);M.push({offset:ie.startOffset,line:ie.startLine,column:ie.startColumn,length:ie.image.length,message:te})}else{q.pop();const te=sf(q);G=this.patternIdxToConfig[te],F=this.charCodeToPatternIdxToConfig[te],Q=G.length;const re=this.canModeBeOptimized[te]&&this.config.safeMode===!1;F&&re?H=D:H=V}};function Z(ie){q.push(ie),F=this.charCodeToPatternIdxToConfig[ie],G=this.patternIdxToConfig[ie],Q=G.length,Q=G.length;const te=this.canModeBeOptimized[ie]&&this.config.safeMode===!1;F&&te?H=D:H=V}Z.call(this,t);let j;const ee=this.config.recoveryEnabled;for(;El.length){l=a,c=u,j=W;break}}}break}}if(l!==null){if(h=l.length,f=j.group,f!==void 0&&(p=j.tokenTypeIdx,m=this.createTokenInstance(l,E,p,j.tokenType,b,B,h),this.handlePayload(m,c),f===!1?w=this.addToken(T,w,m):L[f].push(m)),e=this.chopInput(e,h),E=E+h,B=this.computeNewColumn(B,h),U===!0&&j.canLineTerminator===!0){let ce=0,ye,oe;O.lastIndex=0;do ye=O.test(l),ye===!0&&(oe=O.lastIndex-1,ce++);while(ye===!0);ce!==0&&(b=b+ce,B=h-oe,this.updateTokenEndLineColumnLocation(m,f,oe,ce,b,B,h))}this.handleModes(j,k,Z,m)}else{const ce=E,ye=b,oe=B;let W=ee===!1;for(;W===!1&&E ${cp(n)} <--`:`token of type --> ${n.name} <--`} but found --> '${e.image}' <--`},buildNotAllInputParsedMessage({firstRedundant:n,ruleName:e}){return"Redundant input, expecting EOF but found: "+n.image},buildNoViableAltMessage({expectedPathsPerAlt:n,actual:e,previous:t,customUserDescription:i,ruleName:r}){const s="Expecting: ",o=` +but found: '`+ma(e).image+"'";if(i)return s+i+o;{const l=fs(n,(f,p)=>f.concat(p),[]),c=pt(l,f=>`[${pt(f,p=>cp(p)).join(", ")}]`),h=`one of these possible Token sequences: +${pt(c,(f,p)=>` ${p+1}. ${f}`).join(` +`)}`;return s+h+o}},buildEarlyExitMessage({expectedIterationPaths:n,actual:e,customUserDescription:t,ruleName:i}){const r="Expecting: ",a=` +but found: '`+ma(e).image+"'";if(t)return r+t+a;{const l=`expecting at least one iteration which starts with one of these possible Token sequences:: + <${pt(n,c=>`[${pt(c,u=>cp(u)).join(",")}]`).join(" ,")}>`;return r+l+a}}};Object.freeze(yB);const Qoe={buildRuleNotFoundError(n,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<- +inside top level rule: ->`+n.name+"<-"}},Xc={buildDuplicateFoundError(n,e){function t(u){return u instanceof ei?u.terminalType.name:u instanceof ds?u.nonTerminalName:""}const i=n.name,r=ma(e),s=r.idx,a=Ga(r),o=t(r),l=s>0;let c=`->${a}${l?s:""}<- ${o?`with argument: ->${o}<-`:""} + appears more than once (${e.length} times) in the top level rule: ->${i}<-. + For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES + `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,` +`),c},buildNamespaceConflictError(n){return`Namespace conflict found in grammar. +The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <${n.name}>. +To resolve this make sure each Terminal and Non-Terminal names are unique +This is easy to accomplish by using the convention that Terminal names start with an uppercase letter +and Non-Terminal names start with a lower case letter.`},buildAlternationPrefixAmbiguityError(n){const e=pt(n.prefixPath,r=>cp(r)).join(", "),t=n.alternation.idx===0?"":n.alternation.idx;return`Ambiguous alternatives: <${n.ambiguityIndices.join(" ,")}> due to common lookahead prefix +in inside <${n.topLevelRule.name}> Rule, +<${e}> may appears as a prefix path in all these alternatives. +See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX +For Further details.`},buildAlternationAmbiguityError(n){const e=pt(n.prefixPath,r=>cp(r)).join(", "),t=n.alternation.idx===0?"":n.alternation.idx;let i=`Ambiguous Alternatives Detected: <${n.ambiguityIndices.join(" ,")}> in inside <${n.topLevelRule.name}> Rule, +<${e}> may appears as a prefix path in all these alternatives. +`;return i=i+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES +For Further details.`,i},buildEmptyRepetitionError(n){let e=Ga(n.repetition);return n.repetition.idx!==0&&(e+=n.repetition.idx),`The repetition <${e}> within Rule <${n.topLevelRule.name}> can never consume any tokens. +This could lead to an infinite loop.`},buildTokenNameError(n){return"deprecated"},buildEmptyAlternationError(n){return`Ambiguous empty alternative: <${n.emptyChoiceIdx+1}> in inside <${n.topLevelRule.name}> Rule. +Only the last alternative may be an empty alternative.`},buildTooManyAlternativesError(n){return`An Alternation cannot have more than 256 alternatives: + inside <${n.topLevelRule.name}> Rule. + has ${n.alternation.definition.length+1} alternatives.`},buildLeftRecursionError(n){const e=n.topLevelRule.name,t=pt(n.leftRecursionPath,s=>s.name),i=`${e} --> ${t.concat([e]).join(" --> ")}`;return`Left Recursion found in grammar. +rule: <${e}> can be invoked from itself (directly or indirectly) +without consuming any Tokens. The grammar path that causes this is: + ${i} + To fix this refactor your grammar to remove the left recursion. +see: https://en.wikipedia.org/wiki/LL_parser#Left_factoring.`},buildInvalidRuleNameError(n){return"deprecated"},buildDuplicateRuleNameError(n){let e;return n.topLevelRule instanceof _f?e=n.topLevelRule.name:e=n.topLevelRule,`Duplicate definition, rule: ->${e}<- is already defined in the grammar: ->${n.grammarName}<-`}};function Hoe(n,e){const t=new Voe(n,e);return t.resolveRefs(),t.errors}class Voe extends Ef{constructor(e,t){super(),this.nameToTopRule=e,this.errMsgProvider=t,this.errors=[]}resolveRefs(){wt(Ii(this.nameToTopRule),e=>{this.currTopLevel=e,e.accept(this)})}visitNonTerminal(e){const t=this.nameToTopRule[e.nonTerminalName];if(t)e.referencedRule=t;else{const i=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,e);this.errors.push({message:i,type:Mr.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:e.nonTerminalName})}}}class Woe extends z1{constructor(e,t){super(),this.topProd=e,this.path=t,this.possibleTokTypes=[],this.nextProductionName="",this.nextProductionOccurrence=0,this.found=!1,this.isAtEndOfPath=!1}startWalking(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=cr(this.path.ruleStack).reverse(),this.occurrenceStack=cr(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes}walk(e,t=[]){this.found||super.walk(e,t)}walkProdRef(e,t,i){if(e.referencedRule.name===this.nextProductionName&&e.idx===this.nextProductionOccurrence){const r=t.concat(i);this.updateExpectedNext(),this.walk(e.referencedRule,r)}}updateExpectedNext(){Fn(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())}}class Yoe extends Woe{constructor(e,t){super(e,t),this.path=t,this.nextTerminalName="",this.nextTerminalOccurrence=0,this.nextTerminalName=this.path.lastTok.name,this.nextTerminalOccurrence=this.path.lastTokOccurrence}walkTerminal(e,t,i){if(this.isAtEndOfPath&&e.terminalType.name===this.nextTerminalName&&e.idx===this.nextTerminalOccurrence&&!this.found){const r=t.concat(i),s=new Yr({definition:r});this.possibleTokTypes=H0(s),this.found=!0}}}class H1 extends z1{constructor(e,t){super(),this.topRule=e,this.occurrence=t,this.result={token:void 0,occurrence:void 0,isEndOfRule:void 0}}startWalking(){return this.walk(this.topRule),this.result}}class qoe extends H1{walkMany(e,t,i){if(e.idx===this.occurrence){const r=ma(t.concat(i));this.result.isEndOfRule=r===void 0,r instanceof ei&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkMany(e,t,i)}}class sw extends H1{walkManySep(e,t,i){if(e.idx===this.occurrence){const r=ma(t.concat(i));this.result.isEndOfRule=r===void 0,r instanceof ei&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkManySep(e,t,i)}}class Xoe extends H1{walkAtLeastOne(e,t,i){if(e.idx===this.occurrence){const r=ma(t.concat(i));this.result.isEndOfRule=r===void 0,r instanceof ei&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkAtLeastOne(e,t,i)}}class aw extends H1{walkAtLeastOneSep(e,t,i){if(e.idx===this.occurrence){const r=ma(t.concat(i));this.result.isEndOfRule=r===void 0,r instanceof ei&&(this.result.token=r.terminalType,this.result.occurrence=r.idx)}else super.walkAtLeastOneSep(e,t,i)}}function a6(n,e,t=[]){t=cr(t);let i=[],r=0;function s(o){return o.concat(Xi(n,r+1))}function a(o){const l=a6(s(o),e,t);return i.concat(l)}for(;t.length{Fn(l.definition)===!1&&(i=a(l.definition))}),i;if(o instanceof ei)t.push(o.terminalType);else throw Error("non exhaustive match")}r++}return i.push({partialPath:t,suffixDef:Xi(n,r)}),i}function xB(n,e,t,i){const r="EXIT_NONE_TERMINAL",s=[r],a="EXIT_ALTERNATIVE";let o=!1;const l=e.length,c=l-i-1,u=[],h=[];for(h.push({idx:-1,def:n,ruleStack:[],occurrenceStack:[]});!Fn(h);){const f=h.pop();if(f===a){o&&sf(h).idx<=c&&h.pop();continue}const p=f.def,m=f.idx,y=f.ruleStack,v=f.occurrenceStack;if(Fn(p))continue;const A=p[0];if(A===r){const _={idx:m,def:Xi(p),ruleStack:i0(y),occurrenceStack:i0(v)};h.push(_)}else if(A instanceof ei)if(m=0;_--){const x=A.definition[_],E={idx:m,def:x.definition.concat(Xi(p)),ruleStack:y,occurrenceStack:v};h.push(E),h.push(a)}else if(A instanceof Yr)h.push({idx:m,def:A.definition.concat(Xi(p)),ruleStack:y,occurrenceStack:v});else if(A instanceof _f)h.push(joe(A,m,y,v));else throw Error("non exhaustive match")}return u}function joe(n,e,t,i){const r=cr(t);r.push(n.name);const s=cr(i);return s.push(1),{idx:e,def:n.definition,ruleStack:r,occurrenceStack:s}}var ai;(function(n){n[n.OPTION=0]="OPTION",n[n.REPETITION=1]="REPETITION",n[n.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",n[n.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",n[n.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",n[n.ALTERNATION=5]="ALTERNATION"})(ai||(ai={}));function _B(n){if(n instanceof Vr||n==="Option")return ai.OPTION;if(n instanceof Bi||n==="Repetition")return ai.REPETITION;if(n instanceof oo||n==="RepetitionMandatory")return ai.REPETITION_MANDATORY;if(n instanceof lo||n==="RepetitionMandatoryWithSeparator")return ai.REPETITION_MANDATORY_WITH_SEPARATOR;if(n instanceof Ea||n==="RepetitionWithSeparator")return ai.REPETITION_WITH_SEPARATOR;if(n instanceof Sa||n==="Alternation")return ai.ALTERNATION;throw Error("non exhaustive match")}function Koe(n,e,t,i,r,s){const a=P8(n,e,t),o=wB(a)?v2:V0;return s(a,i,o,r)}function $oe(n,e,t,i,r,s){const a=L8(n,e,r,t),o=wB(a)?v2:V0;return s(a[0],o,i)}function Joe(n,e,t,i){const r=n.length,s=ha(n,a=>ha(a,o=>o.length===1));if(e)return function(a){const o=pt(a,l=>l.GATE);for(let l=0;lua(l)),o=fs(a,(l,c,u)=>(wt(c,h=>{_t(l,h.tokenTypeIdx)||(l[h.tokenTypeIdx]=u),wt(h.categoryMatches,f=>{_t(l,f)||(l[f]=u)})}),l),{});return function(){const l=this.LA(1);return o[l.tokenTypeIdx]}}else return function(){for(let a=0;as.length===1),r=n.length;if(i&&!t){const s=ua(n);if(s.length===1&&Fn(s[0].categoryMatches)){const o=s[0].tokenTypeIdx;return function(){return this.LA(1).tokenTypeIdx===o}}else{const a=fs(s,(o,l,c)=>(o[l.tokenTypeIdx]=!0,wt(l.categoryMatches,u=>{o[u]=!0}),o),[]);return function(){const o=this.LA(1);return a[o.tokenTypeIdx]===!0}}}else return function(){e:for(let s=0;sa6([a],1)),i=ow(t.length),r=pt(t,a=>{const o={};return wt(a,l=>{const c=m5(l.partialPath);wt(c,u=>{o[u]=!0})}),o});let s=t;for(let a=1;a<=e;a++){const o=s;s=ow(o.length);for(let l=0;l{const A=m5(v.partialPath);wt(A,_=>{r[l][_]=!0})})}}}}return i}function P8(n,e,t,i){const r=new EB(n,ai.ALTERNATION,i);return e.accept(r),SB(r.result,t)}function L8(n,e,t,i){const r=new EB(n,t);e.accept(r);const s=r.result,o=new ele(e,n,t).startWalking(),l=new Yr({definition:s}),c=new Yr({definition:o});return SB([l,c],i)}function o6(n,e){e:for(let t=0;t{const r=e[i];return t===r||r.categoryMatchesMap[t.tokenTypeIdx]})}function wB(n){return ha(n,e=>ha(e,t=>ha(t,i=>Fn(i.categoryMatches))))}function ile(n){const e=n.lookaheadStrategy.validate({rules:n.rules,tokenTypes:n.tokenTypes,grammarName:n.grammarName});return pt(e,t=>Object.assign({type:Mr.CUSTOM_LOOKAHEAD_VALIDATION},t))}function rle(n,e,t,i){const r=zs(n,l=>sle(l,t)),s=Ale(n,e,t),a=zs(n,l=>dle(l,t)),o=zs(n,l=>lle(l,n,i,t));return r.concat(s,a,o)}function sle(n,e){const t=new ole;n.accept(t);const i=t.allProductions,r=gae(i,ale),s=_a(r,o=>o.length>1);return pt(Ii(s),o=>{const l=ma(o),c=e.buildDuplicateFoundError(n,o),u=Ga(l),h={message:c,type:Mr.DUPLICATE_PRODUCTIONS,ruleName:n.name,dslName:u,occurrence:l.idx},f=CB(l);return f&&(h.parameter=f),h})}function ale(n){return`${Ga(n)}_#_${n.idx}_#_${CB(n)}`}function CB(n){return n instanceof ei?n.terminalType.name:n instanceof ds?n.nonTerminalName:""}class ole extends Ef{constructor(){super(...arguments),this.allProductions=[]}visitNonTerminal(e){this.allProductions.push(e)}visitOption(e){this.allProductions.push(e)}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}visitAlternation(e){this.allProductions.push(e)}visitTerminal(e){this.allProductions.push(e)}}function lle(n,e,t,i){const r=[];if(fs(e,(a,o)=>o.name===n.name?a+1:a,0)>1){const a=i.buildDuplicateRuleNameError({topLevelRule:n,grammarName:t});r.push({message:a,type:Mr.DUPLICATE_RULE_NAME,ruleName:n.name})}return r}function cle(n,e,t){const i=[];let r;return Dr(e,n)||(r=`Invalid rule override, rule: ->${n}<- cannot be overridden in the grammar: ->${t}<-as it is not defined in any of the super grammars `,i.push({message:r,type:Mr.INVALID_RULE_OVERRIDE,ruleName:n})),i}function TB(n,e,t,i=[]){const r=[],s=Tm(e.definition);if(Fn(s))return[];{const a=n.name;Dr(s,n)&&r.push({message:t.buildLeftRecursionError({topLevelRule:n,leftRecursionPath:i}),type:Mr.LEFT_RECURSION,ruleName:a});const l=N1(s,i.concat([n])),c=zs(l,u=>{const h=cr(i);return h.push(u),TB(n,u,t,h)});return r.concat(c)}}function Tm(n){let e=[];if(Fn(n))return e;const t=ma(n);if(t instanceof ds)e.push(t.referencedRule);else if(t instanceof Yr||t instanceof Vr||t instanceof oo||t instanceof lo||t instanceof Ea||t instanceof Bi)e=e.concat(Tm(t.definition));else if(t instanceof Sa)e=ua(pt(t.definition,s=>Tm(s.definition)));else if(!(t instanceof ei))throw Error("non exhaustive match");const i=p2(t),r=n.length>1;if(i&&r){const s=Xi(n);return e.concat(Tm(s))}else return e}class U8 extends Ef{constructor(){super(...arguments),this.alternations=[]}visitAlternation(e){this.alternations.push(e)}}function ule(n,e){const t=new U8;n.accept(t);const i=t.alternations;return zs(i,s=>{const a=i0(s.definition);return zs(a,(o,l)=>{const c=xB([o],[],V0,1);return Fn(c)?[{message:e.buildEmptyAlternationError({topLevelRule:n,alternation:s,emptyChoiceIdx:l}),type:Mr.NONE_LAST_EMPTY_ALT,ruleName:n.name,occurrence:s.idx,alternative:l+1}]:[]})})}function hle(n,e,t){const i=new U8;n.accept(i);let r=i.alternations;return r=G1(r,a=>a.ignoreAmbiguities===!0),zs(r,a=>{const o=a.idx,l=a.maxLookahead||e,c=P8(o,n,l,a),u=gle(c,a,n,t),h=mle(c,a,n,t);return u.concat(h)})}class fle extends Ef{constructor(){super(...arguments),this.allProductions=[]}visitRepetitionWithSeparator(e){this.allProductions.push(e)}visitRepetitionMandatory(e){this.allProductions.push(e)}visitRepetitionMandatoryWithSeparator(e){this.allProductions.push(e)}visitRepetition(e){this.allProductions.push(e)}}function dle(n,e){const t=new U8;n.accept(t);const i=t.alternations;return zs(i,s=>s.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:n,alternation:s}),type:Mr.TOO_MANY_ALTS,ruleName:n.name,occurrence:s.idx}]:[])}function ple(n,e,t){const i=[];return wt(n,r=>{const s=new fle;r.accept(s);const a=s.allProductions;wt(a,o=>{const l=_B(o),c=o.maxLookahead||e,u=o.idx,f=L8(u,r,l,c)[0];if(Fn(ua(f))){const p=t.buildEmptyRepetitionError({topLevelRule:r,repetition:o});i.push({message:p,type:Mr.NO_NON_EMPTY_LOOKAHEAD,ruleName:r.name})}})}),i}function gle(n,e,t,i){const r=[],s=fs(n,(o,l,c)=>(e.definition[c].ignoreAmbiguities===!0||wt(l,u=>{const h=[c];wt(n,(f,p)=>{c!==p&&o6(f,u)&&e.definition[p].ignoreAmbiguities!==!0&&h.push(p)}),h.length>1&&!o6(r,u)&&(r.push(u),o.push({alts:h,path:u}))}),o),[]);return pt(s,o=>{const l=pt(o.alts,u=>u+1);return{message:i.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:l,prefixPath:o.path}),type:Mr.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:o.alts}})}function mle(n,e,t,i){const r=fs(n,(a,o,l)=>{const c=pt(o,u=>({idx:l,path:u}));return a.concat(c)},[]);return Q0(zs(r,a=>{if(e.definition[a.idx].ignoreAmbiguities===!0)return[];const l=a.idx,c=a.path,u=js(r,f=>e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx{const p=[f.idx+1,l+1],m=e.idx===0?"":e.idx;return{message:i.buildAlternationPrefixAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:p,prefixPath:f.path}),type:Mr.AMBIGUOUS_PREFIX_ALTS,ruleName:t.name,occurrence:m,alternatives:p}})}))}function Ale(n,e,t){const i=[],r=pt(e,s=>s.name);return wt(n,s=>{const a=s.name;if(Dr(r,a)){const o=t.buildNamespaceConflictError(s);i.push({message:o,type:Mr.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:a})}}),i}function vle(n){const e=I8(n,{errMsgProvider:Qoe}),t={};return wt(n.rules,i=>{t[i.name]=i}),Hoe(t,e.errMsgProvider)}function yle(n){return n=I8(n,{errMsgProvider:Xc}),rle(n.rules,n.tokenTypes,n.errMsgProvider,n.grammarName)}const bB="MismatchedTokenException",IB="NoViableAltException",MB="EarlyExitException",RB="NotAllInputParsedException",BB=[bB,IB,MB,RB];Object.freeze(BB);function y2(n){return Dr(BB,n.name)}class V1 extends Error{constructor(e,t){super(e),this.token=t,this.resyncedTokens=[],Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class DB extends V1{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=bB}}class xle extends V1{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=IB}}class _le extends V1{constructor(e,t){super(e,t),this.name=RB}}class Ele extends V1{constructor(e,t,i){super(e,t),this.previousToken=i,this.name=MB}}const A5={},PB="InRuleRecoveryException";class Sle extends Error{constructor(e){super(e),this.name=PB}}class wle{initRecoverable(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=_t(e,"recoveryEnabled")?e.recoveryEnabled:Vl.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=Cle)}getTokenToInsert(e){const t=D8(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t}canTokenTypeBeInsertedInRecovery(e){return!0}canTokenTypeBeDeletedInRecovery(e){return!0}tryInRepetitionRecovery(e,t,i,r){const s=this.findReSyncTokenType(),a=this.exportLexerState(),o=[];let l=!1;const c=this.LA(1);let u=this.LA(1);const h=()=>{const f=this.LA(0),p=this.errorMessageProvider.buildMismatchTokenMessage({expected:r,actual:c,previous:f,ruleName:this.getCurrRuleFullName()}),m=new DB(p,c,this.LA(0));m.resyncedTokens=i0(o),this.SAVE_ERROR(m)};for(;!l;)if(this.tokenMatcher(u,r)){h();return}else if(i.call(this)){h(),e.apply(this,t);return}else this.tokenMatcher(u,s)?l=!0:(u=this.SKIP_TOKEN(),this.addToResyncTokens(u,o));this.importLexerState(a)}shouldInRepetitionRecoveryBeTried(e,t,i){return!(i===!1||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))}getFollowsForInRuleRecovery(e,t){const i=this.getCurrentGrammarPath(e,t);return this.getNextPossibleTokenTypes(i)}tryInRuleRecovery(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t))return this.getTokenToInsert(e);if(this.canRecoverWithSingleTokenDeletion(e)){const i=this.SKIP_TOKEN();return this.consumeToken(),i}throw new Sle("sad sad panda")}canPerformInRuleRecovery(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)}canRecoverWithSingleTokenInsertion(e,t){if(!this.canTokenTypeBeInsertedInRecovery(e)||Fn(t))return!1;const i=this.LA(1);return af(t,s=>this.tokenMatcher(i,s))!==void 0}canRecoverWithSingleTokenDeletion(e){return this.canTokenTypeBeDeletedInRecovery(e)?this.tokenMatcher(this.LA(2),e):!1}isInCurrentRuleReSyncSet(e){const t=this.getCurrFollowKey(),i=this.getFollowSetFromFollowKey(t);return Dr(i,e)}findReSyncTokenType(){const e=this.flattenFollowSet();let t=this.LA(1),i=2;for(;;){const r=af(e,s=>zoe(t,s));if(r!==void 0)return r;t=this.LA(i),i++}}getCurrFollowKey(){if(this.RULE_STACK.length===1)return A5;const e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),i=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(i)}}buildFullFollowKeyStack(){const e=this.RULE_STACK,t=this.RULE_OCCURRENCE_STACK;return pt(e,(i,r)=>r===0?A5:{ruleName:this.shortRuleNameToFullName(i),idxInCallingRule:t[r],inRule:this.shortRuleNameToFullName(e[r-1])})}flattenFollowSet(){const e=pt(this.buildFullFollowKeyStack(),t=>this.getFollowSetFromFollowKey(t));return ua(e)}getFollowSetFromFollowKey(e){if(e===A5)return[gu];const t=e.ruleName+e.idxInCallingRule+lB+e.inRule;return this.resyncFollows[t]}addToResyncTokens(e,t){return this.tokenMatcher(e,gu)||t.push(e),t}reSyncTo(e){const t=[];let i=this.LA(1);for(;this.tokenMatcher(i,e)===!1;)i=this.SKIP_TOKEN(),this.addToResyncTokens(i,t);return i0(t)}attemptInRepetitionRecovery(e,t,i,r,s,a,o){}getCurrentGrammarPath(e,t){const i=this.getHumanReadableRuleStack(),r=cr(this.RULE_OCCURRENCE_STACK);return{ruleStack:i,occurrenceStack:r,lastTok:e,lastTokOccurrence:t}}getHumanReadableRuleStack(){return pt(this.RULE_STACK,e=>this.shortRuleNameToFullName(e))}}function Cle(n,e,t,i,r,s,a){const o=this.getKeyForAutomaticLookahead(i,r);let l=this.firstAfterRepMap[o];if(l===void 0){const f=this.getCurrRuleFullName(),p=this.getGAstProductions()[f];l=new s(p,r).startWalking(),this.firstAfterRepMap[o]=l}let c=l.token,u=l.occurrence;const h=l.isEndOfRule;this.RULE_STACK.length===1&&h&&c===void 0&&(c=gu,u=1),!(c===void 0||u===void 0)&&this.shouldInRepetitionRecoveryBeTried(c,u,a)&&this.tryInRepetitionRecovery(n,e,t,c)}const Tle=4,tc=8,LB=1<TB(t,t,Xc))}validateEmptyOrAlternatives(e){return zs(e,t=>ule(t,Xc))}validateAmbiguousAlternationAlternatives(e,t){return zs(e,i=>hle(i,t,Xc))}validateSomeNonEmptyLookaheadPath(e,t){return ple(e,t,Xc)}buildLookaheadForAlternation(e){return Koe(e.prodOccurrence,e.rule,e.maxLookahead,e.hasPredicates,e.dynamicTokensEnabled,Joe)}buildLookaheadForOptional(e){return $oe(e.prodOccurrence,e.rule,e.maxLookahead,e.dynamicTokensEnabled,_B(e.prodType),Zoe)}}class Ile{initLooksAhead(e){this.dynamicTokensEnabled=_t(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Vl.dynamicTokensEnabled,this.maxLookahead=_t(e,"maxLookahead")?e.maxLookahead:Vl.maxLookahead,this.lookaheadStrategy=_t(e,"lookaheadStrategy")?e.lookaheadStrategy:new ble({maxLookahead:this.maxLookahead}),this.lookAheadFuncsCache=new Map}preComputeLookaheadFunctions(e){wt(e,t=>{this.TRACE_INIT(`${t.name} Rule Lookahead`,()=>{const{alternation:i,repetition:r,option:s,repetitionMandatory:a,repetitionMandatoryWithSeparator:o,repetitionWithSeparator:l}=Rle(t);wt(i,c=>{const u=c.idx===0?"":c.idx;this.TRACE_INIT(`${Ga(c)}${u}`,()=>{const h=this.lookaheadStrategy.buildLookaheadForAlternation({prodOccurrence:c.idx,rule:t,maxLookahead:c.maxLookahead||this.maxLookahead,hasPredicates:c.hasPredicates,dynamicTokensEnabled:this.dynamicTokensEnabled}),f=v5(this.fullRuleNameToShort[t.name],LB,c.idx);this.setLaFuncCache(f,h)})}),wt(r,c=>{this.computeLookaheadFunc(t,c.idx,l6,"Repetition",c.maxLookahead,Ga(c))}),wt(s,c=>{this.computeLookaheadFunc(t,c.idx,UB,"Option",c.maxLookahead,Ga(c))}),wt(a,c=>{this.computeLookaheadFunc(t,c.idx,c6,"RepetitionMandatory",c.maxLookahead,Ga(c))}),wt(o,c=>{this.computeLookaheadFunc(t,c.idx,bm,"RepetitionMandatoryWithSeparator",c.maxLookahead,Ga(c))}),wt(l,c=>{this.computeLookaheadFunc(t,c.idx,u6,"RepetitionWithSeparator",c.maxLookahead,Ga(c))})})})}computeLookaheadFunc(e,t,i,r,s,a){this.TRACE_INIT(`${a}${t===0?"":t}`,()=>{const o=this.lookaheadStrategy.buildLookaheadForOptional({prodOccurrence:t,rule:e,maxLookahead:s||this.maxLookahead,dynamicTokensEnabled:this.dynamicTokensEnabled,prodType:r}),l=v5(this.fullRuleNameToShort[e.name],i,t);this.setLaFuncCache(l,o)})}getKeyForAutomaticLookahead(e,t){const i=this.getLastExplicitRuleShortName();return v5(i,e,t)}getLaFuncFromCache(e){return this.lookAheadFuncsCache.get(e)}setLaFuncCache(e,t){this.lookAheadFuncsCache.set(e,t)}}class Mle extends Ef{constructor(){super(...arguments),this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}reset(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}}visitOption(e){this.dslMethods.option.push(e)}visitRepetitionWithSeparator(e){this.dslMethods.repetitionWithSeparator.push(e)}visitRepetitionMandatory(e){this.dslMethods.repetitionMandatory.push(e)}visitRepetitionMandatoryWithSeparator(e){this.dslMethods.repetitionMandatoryWithSeparator.push(e)}visitRepetition(e){this.dslMethods.repetition.push(e)}visitAlternation(e){this.dslMethods.alternation.push(e)}}const em=new Mle;function Rle(n){em.reset(),n.accept(em);const e=em.dslMethods;return em.reset(),e}function lw(n,e){isNaN(n.startOffset)===!0?(n.startOffset=e.startOffset,n.endOffset=e.endOffset):n.endOffseta.msg);throw Error(`Errors Detected in CST Visitor <${this.constructor.name}>: + ${s.join(` + +`).replace(/\n/g,` + `)}`)}}};return t.prototype=i,t.prototype.constructor=t,t._RULE_NAMES=e,t}function Ole(n,e,t){const i=function(){};OB(i,n+"BaseSemanticsWithDefaults");const r=Object.create(t.prototype);return wt(e,s=>{r[s]=Lle}),i.prototype=r,i.prototype.constructor=i,i}var h6;(function(n){n[n.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",n[n.MISSING_METHOD=1]="MISSING_METHOD"})(h6||(h6={}));function Fle(n,e){return kle(n,e)}function kle(n,e){const t=js(e,r=>Jo(n[r])===!1),i=pt(t,r=>({msg:`Missing visitor method: <${r}> on ${n.constructor.name} CST Visitor.`,type:h6.MISSING_METHOD,methodName:r}));return Q0(i)}class Nle{initTreeBuilder(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=_t(e,"nodeLocationTracking")?e.nodeLocationTracking:Vl.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Ti,this.cstFinallyStateUpdate=Ti,this.cstPostTerminal=Ti,this.cstPostNonTerminal=Ti,this.cstPostRule=Ti;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=cw,this.setNodeLocationFromNode=cw,this.cstPostRule=Ti,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Ti,this.setNodeLocationFromNode=Ti,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=lw,this.setNodeLocationFromNode=lw,this.cstPostRule=Ti,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Ti,this.setNodeLocationFromNode=Ti,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Ti,this.setNodeLocationFromNode=Ti,this.cstPostRule=Ti,this.setInitialNodeLocation=Ti;else throw Error(`Invalid config option: "${e.nodeLocationTracking}"`)}setInitialNodeLocationOnlyOffsetRecovery(e){e.location={startOffset:NaN,endOffset:NaN}}setInitialNodeLocationOnlyOffsetRegular(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}}setInitialNodeLocationFullRecovery(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}}setInitialNodeLocationFullRegular(e){const t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}}cstInvocationStateUpdate(e){const t={name:e,children:Object.create(null)};this.setInitialNodeLocation(t),this.CST_STACK.push(t)}cstFinallyStateUpdate(){this.CST_STACK.pop()}cstPostRuleFull(e){const t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?(i.endOffset=t.endOffset,i.endLine=t.endLine,i.endColumn=t.endColumn):(i.startOffset=NaN,i.startLine=NaN,i.startColumn=NaN)}cstPostRuleOnlyOffset(e){const t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?i.endOffset=t.endOffset:i.startOffset=NaN}cstPostTerminal(e,t){const i=this.CST_STACK[this.CST_STACK.length-1];Ble(i,t,e),this.setNodeLocationFromToken(i.location,t)}cstPostNonTerminal(e,t){const i=this.CST_STACK[this.CST_STACK.length-1];Dle(i,t,e),this.setNodeLocationFromNode(i.location,e.location)}getBaseCstVisitorConstructor(){if(Wo(this.baseCstVisitorConstructor)){const e=Ule(this.className,us(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor}getBaseCstVisitorConstructorWithDefaults(){if(Wo(this.baseCstVisitorWithDefaultsConstructor)){const e=Ole(this.className,us(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor}getLastExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-1]}getPreviousExplicitRuleShortName(){const e=this.RULE_STACK;return e[e.length-2]}getLastExplicitRuleOccurrenceIndex(){const e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]}}class Gle{initLexerAdapter(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1}set input(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length}get input(){return this.tokVector}SKIP_TOKEN(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):_2}LA(e){const t=this.currIdx+e;return t<0||this.tokVectorLength<=t?_2:this.tokVector[t]}consumeToken(){this.currIdx++}exportLexerState(){return this.currIdx}importLexerState(e){this.currIdx=e}resetLexerState(){this.currIdx=-1}moveToTerminatedState(){this.currIdx=this.tokVector.length-1}getLexerPosition(){return this.exportLexerState()}}class zle{ACTION(e){return e.call(this)}consume(e,t,i){return this.consumeInternal(t,e,i)}subrule(e,t,i){return this.subruleInternal(t,e,i)}option(e,t){return this.optionInternal(t,e)}or(e,t){return this.orInternal(t,e)}many(e,t){return this.manyInternal(e,t)}atLeastOne(e,t){return this.atLeastOneInternal(e,t)}CONSUME(e,t){return this.consumeInternal(e,0,t)}CONSUME1(e,t){return this.consumeInternal(e,1,t)}CONSUME2(e,t){return this.consumeInternal(e,2,t)}CONSUME3(e,t){return this.consumeInternal(e,3,t)}CONSUME4(e,t){return this.consumeInternal(e,4,t)}CONSUME5(e,t){return this.consumeInternal(e,5,t)}CONSUME6(e,t){return this.consumeInternal(e,6,t)}CONSUME7(e,t){return this.consumeInternal(e,7,t)}CONSUME8(e,t){return this.consumeInternal(e,8,t)}CONSUME9(e,t){return this.consumeInternal(e,9,t)}SUBRULE(e,t){return this.subruleInternal(e,0,t)}SUBRULE1(e,t){return this.subruleInternal(e,1,t)}SUBRULE2(e,t){return this.subruleInternal(e,2,t)}SUBRULE3(e,t){return this.subruleInternal(e,3,t)}SUBRULE4(e,t){return this.subruleInternal(e,4,t)}SUBRULE5(e,t){return this.subruleInternal(e,5,t)}SUBRULE6(e,t){return this.subruleInternal(e,6,t)}SUBRULE7(e,t){return this.subruleInternal(e,7,t)}SUBRULE8(e,t){return this.subruleInternal(e,8,t)}SUBRULE9(e,t){return this.subruleInternal(e,9,t)}OPTION(e){return this.optionInternal(e,0)}OPTION1(e){return this.optionInternal(e,1)}OPTION2(e){return this.optionInternal(e,2)}OPTION3(e){return this.optionInternal(e,3)}OPTION4(e){return this.optionInternal(e,4)}OPTION5(e){return this.optionInternal(e,5)}OPTION6(e){return this.optionInternal(e,6)}OPTION7(e){return this.optionInternal(e,7)}OPTION8(e){return this.optionInternal(e,8)}OPTION9(e){return this.optionInternal(e,9)}OR(e){return this.orInternal(e,0)}OR1(e){return this.orInternal(e,1)}OR2(e){return this.orInternal(e,2)}OR3(e){return this.orInternal(e,3)}OR4(e){return this.orInternal(e,4)}OR5(e){return this.orInternal(e,5)}OR6(e){return this.orInternal(e,6)}OR7(e){return this.orInternal(e,7)}OR8(e){return this.orInternal(e,8)}OR9(e){return this.orInternal(e,9)}MANY(e){this.manyInternal(0,e)}MANY1(e){this.manyInternal(1,e)}MANY2(e){this.manyInternal(2,e)}MANY3(e){this.manyInternal(3,e)}MANY4(e){this.manyInternal(4,e)}MANY5(e){this.manyInternal(5,e)}MANY6(e){this.manyInternal(6,e)}MANY7(e){this.manyInternal(7,e)}MANY8(e){this.manyInternal(8,e)}MANY9(e){this.manyInternal(9,e)}MANY_SEP(e){this.manySepFirstInternal(0,e)}MANY_SEP1(e){this.manySepFirstInternal(1,e)}MANY_SEP2(e){this.manySepFirstInternal(2,e)}MANY_SEP3(e){this.manySepFirstInternal(3,e)}MANY_SEP4(e){this.manySepFirstInternal(4,e)}MANY_SEP5(e){this.manySepFirstInternal(5,e)}MANY_SEP6(e){this.manySepFirstInternal(6,e)}MANY_SEP7(e){this.manySepFirstInternal(7,e)}MANY_SEP8(e){this.manySepFirstInternal(8,e)}MANY_SEP9(e){this.manySepFirstInternal(9,e)}AT_LEAST_ONE(e){this.atLeastOneInternal(0,e)}AT_LEAST_ONE1(e){return this.atLeastOneInternal(1,e)}AT_LEAST_ONE2(e){this.atLeastOneInternal(2,e)}AT_LEAST_ONE3(e){this.atLeastOneInternal(3,e)}AT_LEAST_ONE4(e){this.atLeastOneInternal(4,e)}AT_LEAST_ONE5(e){this.atLeastOneInternal(5,e)}AT_LEAST_ONE6(e){this.atLeastOneInternal(6,e)}AT_LEAST_ONE7(e){this.atLeastOneInternal(7,e)}AT_LEAST_ONE8(e){this.atLeastOneInternal(8,e)}AT_LEAST_ONE9(e){this.atLeastOneInternal(9,e)}AT_LEAST_ONE_SEP(e){this.atLeastOneSepFirstInternal(0,e)}AT_LEAST_ONE_SEP1(e){this.atLeastOneSepFirstInternal(1,e)}AT_LEAST_ONE_SEP2(e){this.atLeastOneSepFirstInternal(2,e)}AT_LEAST_ONE_SEP3(e){this.atLeastOneSepFirstInternal(3,e)}AT_LEAST_ONE_SEP4(e){this.atLeastOneSepFirstInternal(4,e)}AT_LEAST_ONE_SEP5(e){this.atLeastOneSepFirstInternal(5,e)}AT_LEAST_ONE_SEP6(e){this.atLeastOneSepFirstInternal(6,e)}AT_LEAST_ONE_SEP7(e){this.atLeastOneSepFirstInternal(7,e)}AT_LEAST_ONE_SEP8(e){this.atLeastOneSepFirstInternal(8,e)}AT_LEAST_ONE_SEP9(e){this.atLeastOneSepFirstInternal(9,e)}RULE(e,t,i=E2){if(Dr(this.definedRulesNames,e)){const a={message:Xc.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),type:Mr.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(a)}this.definedRulesNames.push(e);const r=this.defineRule(e,t,i);return this[e]=r,r}OVERRIDE_RULE(e,t,i=E2){const r=cle(e,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(r);const s=this.defineRule(e,t,i);return this[e]=s,s}BACKTRACK(e,t){return function(){this.isBackTrackingStack.push(1);const i=this.saveRecogState();try{return e.apply(this,t),!0}catch(r){if(y2(r))return!1;throw r}finally{this.reloadRecogState(i),this.isBackTrackingStack.pop()}}}getGAstProductions(){return this.gastProductionsCache}getSerializedGastProductions(){return Hae(Ii(this.gastProductionsCache))}}class Qle{initRecognizerEngine(e,t){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=v2,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},_t(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. + See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 + For Further details.`);if(an(e)){if(Fn(e))throw Error(`A Token Vocabulary cannot be empty. + Note that the first argument for the parser constructor + is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument. + See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0 + For Further details.`)}if(an(e))this.tokensMap=fs(e,(s,a)=>(s[a.name]=a,s),{});else if(_t(e,"modes")&&ha(ua(Ii(e.modes)),Foe)){const s=ua(Ii(e.modes)),a=M8(s);this.tokensMap=fs(a,(o,l)=>(o[l.name]=l,o),{})}else if(Ys(e))this.tokensMap=cr(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=gu;const i=_t(e,"modes")?ua(Ii(e.modes)):Ii(e),r=ha(i,s=>Fn(s.categoryMatches));this.tokenMatcher=r?v2:V0,W0(Ii(this.tokensMap))}defineRule(e,t,i){if(this.selfAnalysisDone)throw Error(`Grammar rule <${e}> may not be defined after the 'performSelfAnalysis' method has been called' +Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);const r=_t(i,"resyncEnabled")?i.resyncEnabled:E2.resyncEnabled,s=_t(i,"recoveryValueFunc")?i.recoveryValueFunc:E2.recoveryValueFunc,a=this.ruleShortNameIdx<a.call(this)&&o.call(this)}}else s=e;if(r.call(this)===!0)return s.call(this)}atLeastOneInternal(e,t){const i=this.getKeyForAutomaticLookahead(c6,e);return this.atLeastOneInternalLogic(e,t,i)}atLeastOneInternalLogic(e,t,i){let r=this.getLaFuncFromCache(i),s;if(typeof t!="function"){s=t.DEF;const a=t.GATE;if(a!==void 0){const o=r;r=()=>a.call(this)&&o.call(this)}}else s=t;if(r.call(this)===!0){let a=this.doSingleRepetition(s);for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s)}else throw this.raiseEarlyExitException(e,ai.REPETITION_MANDATORY,t.ERR_MSG);this.attemptInRepetitionRecovery(this.atLeastOneInternal,[e,t],r,c6,e,Xoe)}atLeastOneSepFirstInternal(e,t){const i=this.getKeyForAutomaticLookahead(bm,e);this.atLeastOneSepFirstInternalLogic(e,t,i)}atLeastOneSepFirstInternalLogic(e,t,i){const r=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(i).call(this)===!0){r.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,r,aw],o,bm,e,aw)}else throw this.raiseEarlyExitException(e,ai.REPETITION_MANDATORY_WITH_SEPARATOR,t.ERR_MSG)}manyInternal(e,t){const i=this.getKeyForAutomaticLookahead(l6,e);return this.manyInternalLogic(e,t,i)}manyInternalLogic(e,t,i){let r=this.getLaFuncFromCache(i),s;if(typeof t!="function"){s=t.DEF;const o=t.GATE;if(o!==void 0){const l=r;r=()=>o.call(this)&&l.call(this)}}else s=t;let a=!0;for(;r.call(this)===!0&&a===!0;)a=this.doSingleRepetition(s);this.attemptInRepetitionRecovery(this.manyInternal,[e,t],r,l6,e,qoe,a)}manySepFirstInternal(e,t){const i=this.getKeyForAutomaticLookahead(u6,e);this.manySepFirstInternalLogic(e,t,i)}manySepFirstInternalLogic(e,t,i){const r=t.DEF,s=t.SEP;if(this.getLaFuncFromCache(i).call(this)===!0){r.call(this);const o=()=>this.tokenMatcher(this.LA(1),s);for(;this.tokenMatcher(this.LA(1),s)===!0;)this.CONSUME(s),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,s,o,r,sw],o,u6,e,sw)}}repetitionSepSecondInternal(e,t,i,r,s){for(;i();)this.CONSUME(t),r.call(this);this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,t,i,r,s],i,bm,e,s)}doSingleRepetition(e){const t=this.getLexerPosition();return e.call(this),this.getLexerPosition()>t}orInternal(e,t){const i=this.getKeyForAutomaticLookahead(LB,t),r=an(e)?e:e.DEF,a=this.getLaFuncFromCache(i).call(this,r);if(a!==void 0)return r[a].ALT.call(this);this.raiseNoAltException(t,e.ERR_MSG)}ruleFinallyStateUpdate(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){const e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new _le(t,e))}}subruleInternal(e,t,i){let r;try{const s=i!==void 0?i.ARGS:void 0;return this.subruleIdx=t,r=e.apply(this,s),this.cstPostNonTerminal(r,i!==void 0&&i.LABEL!==void 0?i.LABEL:e.ruleName),r}catch(s){throw this.subruleInternalError(s,i,e.ruleName)}}subruleInternalError(e,t,i){throw y2(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:i),delete e.partialCstResult),e}consumeInternal(e,t,i){let r;try{const s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),r=s):this.consumeInternalError(e,s,i)}catch(s){r=this.consumeInternalRecovery(e,t,s)}return this.cstPostTerminal(i!==void 0&&i.LABEL!==void 0?i.LABEL:e.name,r),r}consumeInternalError(e,t,i){let r;const s=this.LA(0);throw i!==void 0&&i.ERR_MSG?r=i.ERR_MSG:r=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new DB(r,t,s))}consumeInternalRecovery(e,t,i){if(this.recoveryEnabled&&i.name==="MismatchedTokenException"&&!this.isBackTracking()){const r=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,r)}catch(s){throw s.name===PB?i:s}}else throw i}saveRecogState(){const e=this.errors,t=cr(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}}reloadRecogState(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK}ruleInvocationStateUpdate(e,t,i){this.RULE_OCCURRENCE_STACK.push(i),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t)}isBackTracking(){return this.isBackTrackingStack.length!==0}getCurrRuleFullName(){const e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]}shortRuleNameToFullName(e){return this.shortRuleNameToFull[e]}isAtEndOfInput(){return this.tokenMatcher(this.LA(1),gu)}reset(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]}}class Hle{initErrorHandler(e){this._errors=[],this.errorMessageProvider=_t(e,"errorMessageProvider")?e.errorMessageProvider:Vl.errorMessageProvider}SAVE_ERROR(e){if(y2(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:cr(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")}get errors(){return cr(this._errors)}set errors(e){this._errors=e}raiseEarlyExitException(e,t,i){const r=this.getCurrRuleFullName(),s=this.getGAstProductions()[r],o=L8(e,s,t,this.maxLookahead)[0],l=[];for(let u=1;u<=this.maxLookahead;u++)l.push(this.LA(u));const c=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:o,actual:l,previous:this.LA(0),customUserDescription:i,ruleName:r});throw this.SAVE_ERROR(new Ele(c,this.LA(1),this.LA(0)))}raiseNoAltException(e,t){const i=this.getCurrRuleFullName(),r=this.getGAstProductions()[i],s=P8(e,r,this.maxLookahead),a=[];for(let c=1;c<=this.maxLookahead;c++)a.push(this.LA(c));const o=this.LA(0),l=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:a,previous:o,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new xle(l,this.LA(1),o))}}class Vle{initContentAssist(){}computeContentAssist(e,t){const i=this.gastProductionsCache[e];if(Wo(i))throw Error(`Rule ->${e}<- does not exist in this grammar.`);return xB([i],t,this.tokenMatcher,this.maxLookahead)}getNextPossibleTokenTypes(e){const t=ma(e.ruleStack),r=this.getGAstProductions()[t];return new Yoe(r,e).startWalking()}}const W1={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(W1);const uw=!0,hw=Math.pow(2,tc)-1,FB=vB({name:"RECORDING_PHASE_TOKEN",pattern:Qs.NA});W0([FB]);const kB=D8(FB,`This IToken indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(kB);const Wle={name:`This CSTNode indicates the Parser is in Recording Phase + See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}};class Yle{initGastRecorder(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1}enableRecording(){this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",()=>{for(let e=0;e<10;e++){const t=e>0?e:"";this[`CONSUME${t}`]=function(i,r){return this.consumeInternalRecord(i,e,r)},this[`SUBRULE${t}`]=function(i,r){return this.subruleInternalRecord(i,e,r)},this[`OPTION${t}`]=function(i){return this.optionInternalRecord(i,e)},this[`OR${t}`]=function(i){return this.orInternalRecord(i,e)},this[`MANY${t}`]=function(i){this.manyInternalRecord(e,i)},this[`MANY_SEP${t}`]=function(i){this.manySepFirstInternalRecord(e,i)},this[`AT_LEAST_ONE${t}`]=function(i){this.atLeastOneInternalRecord(e,i)},this[`AT_LEAST_ONE_SEP${t}`]=function(i){this.atLeastOneSepFirstInternalRecord(e,i)}}this.consume=function(e,t,i){return this.consumeInternalRecord(t,e,i)},this.subrule=function(e,t,i){return this.subruleInternalRecord(t,e,i)},this.option=function(e,t){return this.optionInternalRecord(t,e)},this.or=function(e,t){return this.orInternalRecord(t,e)},this.many=function(e,t){this.manyInternalRecord(e,t)},this.atLeastOne=function(e,t){this.atLeastOneInternalRecord(e,t)},this.ACTION=this.ACTION_RECORD,this.BACKTRACK=this.BACKTRACK_RECORD,this.LA=this.LA_RECORD})}disableRecording(){this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",()=>{const e=this;for(let t=0;t<10;t++){const i=t>0?t:"";delete e[`CONSUME${i}`],delete e[`SUBRULE${i}`],delete e[`OPTION${i}`],delete e[`OR${i}`],delete e[`MANY${i}`],delete e[`MANY_SEP${i}`],delete e[`AT_LEAST_ONE${i}`],delete e[`AT_LEAST_ONE_SEP${i}`]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})}ACTION_RECORD(e){}BACKTRACK_RECORD(e,t){return()=>!0}LA_RECORD(e){return _2}topLevelRuleRecord(e,t){try{const i=new _f({definition:[],name:e});return i.name=e,this.recordingProdStack.push(i),t.call(this),this.recordingProdStack.pop(),i}catch(i){if(i.KNOWN_RECORDER_ERROR!==!0)try{i.message=i.message+` + This error was thrown during the "grammar recording phase" For more info see: + https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw i}throw i}}optionInternalRecord(e,t){return Rd.call(this,Vr,e,t)}atLeastOneInternalRecord(e,t){Rd.call(this,oo,t,e)}atLeastOneSepFirstInternalRecord(e,t){Rd.call(this,lo,t,e,uw)}manyInternalRecord(e,t){Rd.call(this,Bi,t,e)}manySepFirstInternalRecord(e,t){Rd.call(this,Ea,t,e,uw)}orInternalRecord(e,t){return qle.call(this,e,t)}subruleInternalRecord(e,t,i){if(x2(t),!e||_t(e,"ruleName")===!1){const o=new Error(` argument is invalid expecting a Parser method reference but got: <${JSON.stringify(e)}> + inside top level rule: <${this.recordingProdStack[0].name}>`);throw o.KNOWN_RECORDER_ERROR=!0,o}const r=sf(this.recordingProdStack),s=e.ruleName,a=new ds({idx:t,nonTerminalName:s,label:i==null?void 0:i.LABEL,referencedRule:void 0});return r.definition.push(a),this.outputCst?Wle:W1}consumeInternalRecord(e,t,i){if(x2(t),!mB(e)){const a=new Error(` argument is invalid expecting a TokenType reference but got: <${JSON.stringify(e)}> + inside top level rule: <${this.recordingProdStack[0].name}>`);throw a.KNOWN_RECORDER_ERROR=!0,a}const r=sf(this.recordingProdStack),s=new ei({idx:t,terminalType:e,label:i==null?void 0:i.LABEL});return r.definition.push(s),kB}}function Rd(n,e,t,i=!1){x2(t);const r=sf(this.recordingProdStack),s=Jo(e)?e:e.DEF,a=new n({definition:[],idx:t});return i&&(a.separator=e.SEP),_t(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),s.call(this),r.definition.push(a),this.recordingProdStack.pop(),W1}function qle(n,e){x2(e);const t=sf(this.recordingProdStack),i=an(n)===!1,r=i===!1?n:n.DEF,s=new Sa({definition:[],idx:e,ignoreAmbiguities:i&&n.IGNORE_AMBIGUITIES===!0});_t(n,"MAX_LOOKAHEAD")&&(s.maxLookahead=n.MAX_LOOKAHEAD);const a=rB(r,o=>Jo(o.GATE));return s.hasPredicates=a,t.definition.push(s),wt(r,o=>{const l=new Yr({definition:[]});s.definition.push(l),_t(o,"IGNORE_AMBIGUITIES")?l.ignoreAmbiguities=o.IGNORE_AMBIGUITIES:_t(o,"GATE")&&(l.ignoreAmbiguities=!0),this.recordingProdStack.push(l),o.ALT.call(this),this.recordingProdStack.pop()}),W1}function fw(n){return n===0?"":`${n}`}function x2(n){if(n<0||n>hw){const e=new Error(`Invalid DSL Method idx value: <${n}> + Idx value must be a none negative value smaller than ${hw+1}`);throw e.KNOWN_RECORDER_ERROR=!0,e}}class Xle{initPerformanceTracer(e){if(_t(e,"traceInitPerf")){const t=e.traceInitPerf,i=typeof t=="number";this.traceInitMaxIdent=i?t:1/0,this.traceInitPerf=i?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=Vl.traceInitPerf;this.traceInitIndent=-1}TRACE_INIT(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;const i=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <${e}>`);const{time:r,value:s}=aB(t),a=r>10?console.warn:console.log;return this.traceInitIndent time: ${r}ms`),this.traceInitIndent--,s}else return t()}}function jle(n,e){e.forEach(t=>{const i=t.prototype;Object.getOwnPropertyNames(i).forEach(r=>{if(r==="constructor")return;const s=Object.getOwnPropertyDescriptor(i,r);s&&(s.get||s.set)?Object.defineProperty(n.prototype,r,s):n.prototype[r]=t.prototype[r]})})}const _2=D8(gu,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(_2);const Vl=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:yB,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),E2=Object.freeze({recoveryValueFunc:()=>{},resyncEnabled:!0});var Mr;(function(n){n[n.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",n[n.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",n[n.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",n[n.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",n[n.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",n[n.LEFT_RECURSION=5]="LEFT_RECURSION",n[n.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",n[n.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",n[n.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",n[n.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",n[n.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",n[n.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",n[n.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",n[n.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION"})(Mr||(Mr={}));class Y1{static performSelfAnalysis(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")}performSelfAnalysis(){this.TRACE_INIT("performSelfAnalysis",()=>{let e;this.selfAnalysisDone=!0;const t=this.className;this.TRACE_INIT("toFastProps",()=>{oB(this)}),this.TRACE_INIT("Grammar Recording",()=>{try{this.enableRecording(),wt(this.definedRulesNames,r=>{const a=this[r].originalGrammarAction;let o;this.TRACE_INIT(`${r} Rule`,()=>{o=this.topLevelRuleRecord(r,a)}),this.gastProductionsCache[r]=o})}finally{this.disableRecording()}});let i=[];if(this.TRACE_INIT("Grammar Resolving",()=>{i=vle({rules:Ii(this.gastProductionsCache)}),this.definitionErrors=this.definitionErrors.concat(i)}),this.TRACE_INIT("Grammar Validations",()=>{if(Fn(i)&&this.skipValidations===!1){const r=yle({rules:Ii(this.gastProductionsCache),tokenTypes:Ii(this.tokensMap),errMsgProvider:Xc,grammarName:t}),s=ile({lookaheadStrategy:this.lookaheadStrategy,rules:Ii(this.gastProductionsCache),tokenTypes:Ii(this.tokensMap),grammarName:t});this.definitionErrors=this.definitionErrors.concat(r,s)}}),Fn(this.definitionErrors)&&(this.recoveryEnabled&&this.TRACE_INIT("computeAllProdsFollows",()=>{const r=Kae(Ii(this.gastProductionsCache));this.resyncFollows=r}),this.TRACE_INIT("ComputeLookaheadFunctions",()=>{var r,s;(s=(r=this.lookaheadStrategy).initialize)===null||s===void 0||s.call(r,{rules:Ii(this.gastProductionsCache)}),this.preComputeLookaheadFunctions(Ii(this.gastProductionsCache))})),!Y1.DEFER_DEFINITION_ERRORS_HANDLING&&!Fn(this.definitionErrors))throw e=pt(this.definitionErrors,r=>r.message),new Error(`Parser Definition Errors detected: + ${e.join(` +------------------------------- +`)}`)})}constructor(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;const i=this;if(i.initErrorHandler(t),i.initLexerAdapter(),i.initLooksAhead(t),i.initRecognizerEngine(e,t),i.initRecoverable(t),i.initTreeBuilder(t),i.initContentAssist(),i.initGastRecorder(t),i.initPerformanceTracer(t),_t(t,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. + Please use the flag on the relevant DSL method instead. + See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES + For further details.`);this.skipValidations=_t(t,"skipValidations")?t.skipValidations:Vl.skipValidations}}Y1.DEFER_DEFINITION_ERRORS_HANDLING=!1;jle(Y1,[wle,Ile,Nle,Gle,Qle,zle,Hle,Vle,Yle,Xle]);class Kle{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e{const r=this._getIdleWorker();r!==-1?(this._initWorker(r),this.workerStatus|=1<e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}class $le extends iu{constructor(e,t,i,r,s,a){super(e,t,i,s,a),this.isCompressedArrayTexture=!0,this.image.depth=r,this.wrapR=oi}}const y5=new WeakMap;let x5=0,_5;const qd=class extends ur{constructor(n){super(n),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new Kle,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(n){return this.transcoderPath=n,this}setWorkerLimit(n){return this.workerPool.setWorkerLimit(n),this}detectSupport(n){return this.workerConfig={astcSupported:n.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:n.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:n.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:n.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:n.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:n.extensions.has("WEBGL_compressed_texture_pvrtc")||n.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},n.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1),this}init(){if(!this.transcoderPending){const n=new Ir(this.manager);n.setPath(this.transcoderPath),n.setWithCredentials(this.withCredentials);const e=n.loadAsync("basis_transcoder.js"),t=new Ir(this.manager);t.setPath(this.transcoderPath),t.setResponseType("arraybuffer"),t.setWithCredentials(this.withCredentials);const i=t.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,i]).then(([r,s])=>{const a=qd.BasisWorker.toString(),o=["/* constants */","let _EngineFormat = "+JSON.stringify(qd.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(qd.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(qd.BasisFormat),"/* basis_transcoder.js */",r,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(` +`);this.workerSourceURL=URL.createObjectURL(new Blob([o])),this.transcoderBinary=s,this.workerPool.setWorkerCreator(()=>{const l=new Worker(this.workerSourceURL),c=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:c},[c]),l})}),x5>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),x5++}return this.transcoderPending}load(n,e,t,i){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new Ir(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials),r.load(n,s=>{if(y5.has(s))return y5.get(s).promise.then(e).catch(i);this._createTexture(s).then(a=>e?e(a):null).catch(i)},t,i)}_createTextureFrom(n,e){const{mipmaps:t,width:i,height:r,format:s,type:a,error:o,dfdTransferFn:l,dfdFlags:c}=n;if(a==="error")return Promise.reject(o);const u=e.layerCount>1?new $le(t,i,r,e.layerCount,s,Ri):new iu(t,i,r,s,Ri);return u.minFilter=t.length===1?Tn:Ja,u.magFilter=Tn,u.generateMipmaps=!1,u.needsUpdate=!0,"colorSpace"in u?u.colorSpace=l===Ny?"srgb":"srgb-linear":u.encoding=l===Ny?3001:3e3,u.premultiplyAlpha=!!(c&lK),u}async _createTexture(n,e={}){const t=fK(new Uint8Array(n));if(t.vkFormat!==PM)return Zle(t);const i=e,r=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:n,taskConfig:i},[n])).then(s=>this._createTextureFrom(s.data,t));return y5.set(n,{promise:r}),r}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),x5--,this}};let q1=qd;ut(q1,"BasisFormat",{ETC1S:0,UASTC_4x4:1});ut(q1,"TranscoderFormat",{ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16});ut(q1,"EngineFormat",{RGBAFormat:li,RGBA_ASTC_4x4_Format:wp,RGBA_BPTC_Format:Uh,RGBA_ETC2_EAC_Format:Sp,RGBA_PVRTC_4BPPV1_Format:_p,RGBA_S3TC_DXT5_Format:Lh,RGB_ETC1_Format:B2,RGB_ETC2_Format:Ep,RGB_PVRTC_4BPPV1_Format:xp,RGB_S3TC_DXT1_Format:Ph});ut(q1,"BasisWorker",function(){let n,e,t;const i=_EngineFormat,r=_TranscoderFormat,s=_BasisFormat;self.addEventListener("message",function(m){const y=m.data;switch(y.type){case"init":n=y.config,a(y.transcoderBinary);break;case"transcode":e.then(()=>{try{const{width:v,height:A,hasAlpha:_,mipmaps:x,format:E,dfdTransferFn:w,dfdFlags:I}=o(y.buffer),T=[];for(let M=0;M{t={wasmBinary:m,onRuntimeInitialized:y},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}function o(m){const y=new t.KTX2File(new Uint8Array(m));function v(){y.close(),y.delete()}if(!y.isValid())throw v(),new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");const A=y.isUASTC()?s.UASTC_4x4:s.ETC1S,_=y.getWidth(),x=y.getHeight(),E=y.getLayers()||1,w=y.getLevels(),I=y.getHasAlpha(),T=y.getDFDTransferFunc(),M=y.getDFDFlags(),{transcoderFormat:b,engineFormat:B}=h(A,_,x,I);if(!_||!x||!w)throw v(),new Error("THREE.KTX2Loader: Invalid texture");if(!y.startTranscoding())throw v(),new Error("THREE.KTX2Loader: .startTranscoding failed");const L=[];for(let U=0;U{const u=new dK;await u.init(),c(u)})),a=(await _5).decode(s.levelData,s.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");E5[e]===br?o=new Float32Array(a.buffer,a.byteOffset,a.byteLength/Float32Array.BYTES_PER_ELEMENT):E5[e]===Ai?o=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/Uint16Array.BYTES_PER_ELEMENT):o=a;const l=r===0?new Va(o,t,i):new See(o,t,i,r);return l.type=E5[e],l.format=dw[e],l.encoding=Jle[e]||3e3,l.needsUpdate=!0,Promise.resolve(l)}const S5=new WeakMap,Xd=class extends ur{constructor(n){super(n),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.workerConfig=null}setTranscoderPath(n){return this.transcoderPath=n,this}setWorkerLimit(n){return this.workerLimit=n,this}detectSupport(n){return this.workerConfig={astcSupported:n.extensions.has("WEBGL_compressed_texture_astc"),etc1Supported:n.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:n.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:n.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:n.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:n.extensions.has("WEBGL_compressed_texture_pvrtc")||n.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}load(n,e,t,i){const r=new Ir(this.manager);r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const s=new iu;return r.load(n,a=>{if(S5.has(a))return S5.get(a).promise.then(e).catch(i);this._createTexture([a]).then(function(o){s.copy(o),s.needsUpdate=!0,e&&e(s)}).catch(i)},t,i),s}parseInternalAsync(n){const{levels:e}=n,t=new Set;for(let i=0;i(t=o,i=this.workerNextTaskID++,new Promise((l,c)=>{t._callbacks[i]={resolve:l,reject:c},t.postMessage({type:"transcode",id:i,buffers:n,taskConfig:r},n)}))).then(o=>{const{mipmaps:l,width:c,height:u,format:h}=o,f=new iu(l,c,u,h,Ri);return f.minFilter=l.length===1?Tn:Ja,f.magFilter=Tn,f.generateMipmaps=!1,f.needsUpdate=!0,f});return a.catch(()=>!0).then(()=>{t&&i&&(t._taskLoad-=s,delete t._callbacks[i])}),S5.set(n[0],{promise:a}),a}_initTranscoder(){if(!this.transcoderPending){const n=new Ir(this.manager);n.setPath(this.transcoderPath),n.setWithCredentials(this.withCredentials);const e=new Promise((r,s)=>{n.load("basis_transcoder.js",r,void 0,s)}),t=new Ir(this.manager);t.setPath(this.transcoderPath),t.setResponseType("arraybuffer"),t.setWithCredentials(this.withCredentials);const i=new Promise((r,s)=>{t.load("basis_transcoder.wasm",r,void 0,s)});this.transcoderPending=Promise.all([e,i]).then(([r,s])=>{const a=Xd.BasisWorker.toString(),o=["/* constants */","let _EngineFormat = "+JSON.stringify(Xd.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(Xd.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Xd.BasisFormat),"/* basis_transcoder.js */",r,"/* worker */",a.substring(a.indexOf("{")+1,a.lastIndexOf("}"))].join(` +`);this.workerSourceURL=URL.createObjectURL(new Blob([o])),this.transcoderBinary=s})}return this.transcoderPending}_allocateWorker(n){return this._initTranscoder().then(()=>{if(this.workerPool.lengthi._taskLoad?-1:1});const e=this.workerPool[this.workerPool.length-1];return e._taskLoad+=n,e})}dispose(){for(let n=0;n{try{const{width:E,height:w,hasAlpha:I,mipmaps:T,format:M}=x.taskConfig.lowLevel?o(x.taskConfig):l(x.buffers[0]),b=[];for(let B=0;B{t={wasmBinary:_,onRuntimeInitialized:x},BASIS(t)}).then(()=>{t.initializeBasis()})}function o(_){const{basisFormat:x,width:E,height:w,hasAlpha:I}=_,{transcoderFormat:T,engineFormat:M}=f(x,E,w,I),b=t.getBytesPerBlockOrPixel(T);p(t.isFormatSupported(T),"THREE.BasisTextureLoader: Unsupported format.");const B=[];if(x===s.ETC1S){const L=new t.LowLevelETC1SImageTranscoder,{endpointCount:U,endpointsData:O,selectorCount:Q,selectorsData:G,tablesData:F}=_.globalData;try{let q;q=L.decodePalettes(U,O,Q,G),p(q,"THREE.BasisTextureLoader: decodePalettes() failed."),q=L.decodeTables(F),p(q,"THREE.BasisTextureLoader: decodeTables() failed.");for(let Y=0;Y<_.levels.length;Y++){const H=_.levels[Y],V=_.globalData.imageDescs[Y],D=v(T,H.width,H.height),k=new Uint8Array(D);q=L.transcodeImage(T,k,D/b,H.data,m(T,H.width),y(T,H.height),H.width,H.height,H.index,V.rgbSliceByteOffset,V.rgbSliceByteLength,V.alphaSliceByteOffset,V.alphaSliceByteLength,V.imageFlags,I,!1,0,0),p(q,"THREE.BasisTextureLoader: transcodeImage() failed for level "+H.index+"."),B.push({data:k,width:H.width,height:H.height})}}finally{L.delete()}}else for(let L=0;L<_.levels.length;L++){const U=_.levels[L],O=v(T,U.width,U.height),Q=new Uint8Array(O),G=t.transcodeUASTCImage(T,Q,O/b,U.data,m(T,U.width),y(T,U.height),U.width,U.height,U.index,0,U.data.byteLength,0,I,!1,0,0,-1,-1);p(G,"THREE.BasisTextureLoader: transcodeUASTCImage() failed for level "+U.index+"."),B.push({data:Q,width:U.width,height:U.height})}return{width:E,height:w,hasAlpha:I,mipmaps:B,format:M}}function l(_){const x=new t.BasisFile(new Uint8Array(_)),E=x.isUASTC()?s.UASTC_4x4:s.ETC1S,w=x.getImageWidth(0,0),I=x.getImageHeight(0,0),T=x.getNumLevels(0),M=x.getHasAlpha();function b(){x.close(),x.delete()}const{transcoderFormat:B,engineFormat:L}=f(E,w,I,M);if(!w||!I||!T)throw b(),new Error("THREE.BasisTextureLoader: Invalid texture");if(!x.startTranscoding())throw b(),new Error("THREE.BasisTextureLoader: .startTranscoding failed");const U=[];for(let O=0;O{if(!e||!o.current)return;const c=o.current.rotation.clone();l.getWorldQuaternion(o.current.quaternion),t&&(o.current.rotation.x=c.x),i&&(o.current.rotation.y=c.y),r&&(o.current.rotation.z=c.z)}),$.createElement("group",ou({ref:zX([o,a])},s))});function ece(){var n=Object.create(null);function e(r,s){var a=r.id,o=r.name,l=r.dependencies;l===void 0&&(l=[]);var c=r.init;c===void 0&&(c=function(){});var u=r.getTransferables;if(u===void 0&&(u=null),!n[a])try{l=l.map(function(f){return f&&f.isWorkerModule&&(e(f,function(p){if(p instanceof Error)throw p}),f=n[f.id].value),f}),c=i("<"+o+">.init",c),u&&(u=i("<"+o+">.getTransferables",u));var h=null;typeof c=="function"?h=c.apply(void 0,l):console.error("worker module init function failed to rehydrate"),n[a]={id:a,value:h,getTransferables:u},s(h)}catch(f){f&&f.noLog||console.error(f),s(f)}}function t(r,s){var a,o=r.id,l=r.args;(!n[o]||typeof n[o].value!="function")&&s(new Error("Worker module "+o+": not found or its 'init' did not return a function"));try{var c=(a=n[o]).value.apply(a,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 f=n[o].getTransferables&&n[o].getTransferables(h);(!f||!Array.isArray(f)||!f.length)&&(f=void 0),s(h,f)}catch(p){console.error(p),s(p)}}}function i(r,s){var a=void 0;self.troikaDefine=function(l){return a=l};var o=URL.createObjectURL(new Blob(["/** "+r.replace(/\*/g,"")+` **/ + +troikaDefine( +`+s+` +)`],{type:"application/javascript"}));try{importScripts(o)}catch(l){console.error(l)}return URL.revokeObjectURL(o),delete self.troikaDefine,a}self.addEventListener("message",function(r){var s=r.data,a=s.messageId,o=s.action,l=s.data;try{o==="registerModule"&&e(l,function(c){c instanceof Error?postMessage({messageId:a,success:!1,error:c.message}):postMessage({messageId:a,success:!0,result:{isCallable:typeof c=="function"}})}),o==="callModule"&&t(l,function(c,u){c instanceof Error?postMessage({messageId:a,success:!1,error:c.message}):postMessage({messageId:a,success:!0,result:c},u||void 0)})}catch(c){postMessage({messageId:a,success:!1,error:c.stack})}})}function tce(n){var e=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];return e._getInitResult().then(function(r){if(typeof r=="function")return r.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=n.dependencies,i=n.init;t=Array.isArray(t)?t.map(function(s){return s&&s._getInitResult?s._getInitResult():s}):[];var r=Promise.all(t).then(function(s){return i.apply(null,s)});return e._getInitResult=function(){return r},r},e}var GB=function(){var n=!1;if(typeof window<"u"&&typeof window.document<"u")try{var e=new Worker(URL.createObjectURL(new Blob([""],{type:"application/javascript"})));e.terminate(),n=!0}catch(t){typeof process<"u",console.log("Troika createWorkerModule: web workers not allowed; falling back to main thread execution. Cause: ["+t.message+"]")}return GB=function(){return n},n},nce=0,ice=0,w5=!1,up=Object.create(null),hp=Object.create(null),f6=Object.create(null);function Y0(n){if((!n||typeof n.init!="function")&&!w5)throw new Error("requires `options.init` function");var e=n.dependencies,t=n.init,i=n.getTransferables,r=n.workerId;if(!GB())return tce(n);r==null&&(r="#default");var s="workerModule"+ ++nce,a=n.name||s,o=null;e=e&&e.map(function(c){return typeof c=="function"&&!c.workerModuleData&&(w5=!0,c=Y0({workerId:r,name:"<"+a+"> function dependency: "+c.name,init:`function(){return ( +`+Im(c)+` +)}`}),w5=!1),c&&c.workerModuleData&&(c=c.workerModuleData),c});function l(){for(var c=[],u=arguments.length;u--;)c[u]=arguments[u];if(!o){o=pw(r,"registerModule",l.workerModuleData);var h=function(){o=null,hp[r].delete(h)};(hp[r]||(hp[r]=new Set)).add(h)}return o.then(function(f){var p=f.isCallable;if(p)return pw(r,"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:a,dependencies:e,init:Im(t),getTransferables:i&&Im(i)},l}function rce(n){hp[n]&&hp[n].forEach(function(e){e()}),up[n]&&(up[n].terminate(),delete up[n])}function Im(n){var e=n.toString();return!/^function/.test(e)&&/^\w+\s*\(/.test(e)&&(e="function "+e),e}function sce(n){var e=up[n];if(!e){var t=Im(ece);e=up[n]=new Worker(URL.createObjectURL(new Blob(["/** Worker Module Bootstrap: "+n.replace(/\*/g,"")+` **/ + +;(`+t+")()"],{type:"application/javascript"}))),e.onmessage=function(i){var r=i.data,s=r.messageId,a=f6[s];if(!a)throw new Error("WorkerModule response with empty or unknown messageId");delete f6[s],a(r)}}return e}function pw(n,e,t){return new Promise(function(i,r){var s=++ice;f6[s]=function(a){a.success?i(a.result):r(new Error("Error in worker "+e+" call: "+a.error))},sce(n).postMessage({messageId:s,action:e,data:t})})}function zB(){var n=function(e){function t(H,V,D,k,Z,j,ee,ie){var te=1-ee;ie.x=te*te*H+2*te*ee*D+ee*ee*Z,ie.y=te*te*V+2*te*ee*k+ee*ee*j}function i(H,V,D,k,Z,j,ee,ie,te,re){var ce=1-te;re.x=ce*ce*ce*H+3*ce*ce*te*D+3*ce*te*te*Z+te*te*te*ee,re.y=ce*ce*ce*V+3*ce*ce*te*k+3*ce*te*te*j+te*te*te*ie}function r(H,V){for(var D=/([MLQCZ])([^MLQCZ]*)/g,k,Z,j,ee,ie;k=D.exec(H);){var te=k[2].replace(/^\s*|\s*$/g,"").split(/[,\s]+/).map(function(re){return parseFloat(re)});switch(k[1]){case"M":ee=Z=te[0],ie=j=te[1];break;case"L":(te[0]!==ee||te[1]!==ie)&&V("L",ee,ie,ee=te[0],ie=te[1]);break;case"Q":{V("Q",ee,ie,ee=te[2],ie=te[3],te[0],te[1]);break}case"C":{V("C",ee,ie,ee=te[4],ie=te[5],te[0],te[1],te[2],te[3]);break}case"Z":(ee!==Z||ie!==j)&&V("L",ee,ie,Z,j);break}}}function s(H,V,D){D===void 0&&(D=16);var k={x:0,y:0};r(H,function(Z,j,ee,ie,te,re,ce,ye,oe){switch(Z){case"L":V(j,ee,ie,te);break;case"Q":{for(var W=j,ge=ee,he=1;he0;)Ce[we]=arguments[we+2];var ke=Le[Be]||(Le[Be]=D.getUniformLocation(Se,Be));D["uniform"+se].apply(D,[ke].concat(Ce))},setAttribute:function(se,Be,Ce,we,ke){var Ue=Re[se];Ue||(Ue=Re[se]={buf:D.createBuffer(),loc:D.getAttribLocation(Se,se),data:null}),D.bindBuffer(D.ARRAY_BUFFER,Ue.buf),D.vertexAttribPointer(Ue.loc,Be,D.FLOAT,!1,0,0),D.enableVertexAttribArray(Ue.loc),Z?D.vertexAttribDivisor(Ue.loc,we):ce("ANGLE_instanced_arrays").vertexAttribDivisorANGLE(Ue.loc,we),ke!==Ue.data&&(D.bufferData(D.ARRAY_BUFFER,ke,Ce),Ue.data=ke)}})}}}ee[ue].transaction(pe)},W=function(ue,fe){te++;try{D.activeTexture(D.TEXTURE0+te);var Pe=ie[ue];Pe||(Pe=ie[ue]=D.createTexture(),D.bindTexture(D.TEXTURE_2D,Pe),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,Pe),fe(Pe,te)}finally{te--}},ge=function(ue,fe,Pe){var pe=D.createFramebuffer();re.push(pe),D.bindFramebuffer(D.FRAMEBUFFER,pe),D.activeTexture(D.TEXTURE0+fe),D.bindTexture(D.TEXTURE_2D,ue),D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_2D,ue,0);try{Pe(pe)}finally{D.deleteFramebuffer(pe),D.bindFramebuffer(D.FRAMEBUFFER,re[--re.length-1]||null)}},he=function(){j={},ee={},ie={},te=-1,re.length=0};var Z=typeof WebGL2RenderingContext<"u"&&D instanceof WebGL2RenderingContext,j={},ee={},ie={},te=-1,re=[];D.canvas.addEventListener("webglcontextlost",function(ue){he(),ue.preventDefault()},!1),l.set(D,k={gl:D,isWebGL2:Z,getExtension:ce,withProgram:oe,withTexture:W,withTextureFramebuffer:ge,handleContextLoss:he})}V(k)}function h(H,V,D,k,Z,j,ee,ie){ee===void 0&&(ee=15),ie===void 0&&(ie=null),u(H,function(te){var re=te.gl,ce=te.withProgram,ye=te.withTexture;ye("copy",function(oe,W){re.texImage2D(re.TEXTURE_2D,0,re.RGBA,Z,j,0,re.RGBA,re.UNSIGNED_BYTE,V),ce("copy",a,o,function(ge){var he=ge.setUniform,ue=ge.setAttribute;ue("aUV",2,re.STATIC_DRAW,0,new Float32Array([0,0,2,0,0,2])),he("1i","image",W),re.bindFramebuffer(re.FRAMEBUFFER,ie||null),re.disable(re.BLEND),re.colorMask(ee&8,ee&4,ee&2,ee&1),re.viewport(D,k,Z,j),re.scissor(D,k,Z,j),re.drawArrays(re.TRIANGLES,0,3)})})})}function f(H,V,D){var k=H.width,Z=H.height;u(H,function(j){var ee=j.gl,ie=new Uint8Array(k*Z*4);ee.readPixels(0,0,k,Z,ee.RGBA,ee.UNSIGNED_BYTE,ie),H.width=V,H.height=D,h(ee,ie,0,0,k,Z)})}var p=Object.freeze({__proto__:null,withWebGLContext:u,renderImageData:h,resizeWebGLCanvasWithoutClearing:f});function m(H,V,D,k,Z,j){j===void 0&&(j=1);var ee=new Uint8Array(H*V),ie=k[2]-k[0],te=k[3]-k[1],re=[];s(D,function(ue,fe,Pe,pe){re.push({x1:ue,y1:fe,x2:Pe,y2:pe,minX:Math.min(ue,Pe),minY:Math.min(fe,pe),maxX:Math.max(ue,Pe),maxY:Math.max(fe,pe)})}),re.sort(function(ue,fe){return ue.maxX-fe.maxX});for(var ce=0;ceLe.minX&&fe-peLe.minY){var Se=A(ue,fe,Le.x1,Le.y1,Le.x2,Le.y2);Sefe!=Re.y2>fe&&ue<(Re.x2-Re.x1)*(fe-Re.y1)/(Re.y2-Re.y1)+Re.x1;Le&&(Pe+=Re.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 y(pe,Re){var Le=36,Se=0,$e=new Map,X=Re&&new Map,z;return pe.split(",").forEach(function se(Be){if(Be.indexOf("+")!==-1)for(var Ce=+Be;Ce--;)se(z);else{z=Be;var we=Be.split(">"),ke=we[0],Ue=we[1];ke=String.fromCodePoint(Se+=parseInt(ke,Le)),Ue=String.fromCodePoint(Se+=parseInt(Ue,Le)),$e.set(ke,Ue),Re&&X.set(Ue,ke)}}),{map:$e,reverseMap:X}}var v,A,_;function x(){if(!v){var pe=y(m.pairs,!0),Re=pe.map,Le=pe.reverseMap;v=Re,A=Le,_=y(m.canonical,!1).map}}function E(pe){return x(),v.get(pe)||null}function w(pe){return x(),A.get(pe)||null}function I(pe){return x(),_.get(pe)||null}var T=i.L,M=i.R,b=i.EN,B=i.ES,L=i.ET,U=i.AN,O=i.CS,Q=i.B,G=i.S,F=i.ON,q=i.BN,Y=i.NSM,H=i.AL,V=i.LRO,D=i.RLO,k=i.LRE,Z=i.RLE,j=i.PDF,ee=i.LRI,ie=i.RLI,te=i.FSI,re=i.PDI;function ce(pe,Re){for(var Le=125,Se=new Uint32Array(pe.length),$e=0;$e0)Ve--;else if(gt>0){for(it=0;!We[We.length-1]._isolate;)We.pop();var Dt=We[We.length-1]._isolInitIndex;Dt!=null&&(Be.set(Dt,ne),Be.set(ne,Dt)),We.pop(),gt--}Oe=We[We.length-1],se[ne]=Oe._level,Oe._override&&z(ne,Oe._override)}else Fe&j?(Ve===0&&(it>0?it--:!Oe._isolate&&We.length>1&&(We.pop(),Oe=We[We.length-1])),se[ne]=Oe._level):Fe&Q&&(se[ne]=we.level);else se[ne]=Oe._level,Oe._override&&Fe!==q&&z(ne,Oe._override)}for(var Yt=[],en=null,Jt=we.start;Jt<=we.end;Jt++){var dn=Se[Jt];if(!(dn&l)){var Zt=se[Jt],Ht=dn&s,Zi=dn===re;en&&Zt===en._level?(en._end=Jt,en._endsWithIsolInit=Ht):Yt.push(en={_start:Jt,_end:Jt,_level:Zt,_startsWithPDI:Zi,_endsWithIsolInit:Ht})}}for(var Ui=[],on=0;on=0;de--)if(!(Se[de]&l)){Ie=se[de];break}var Me=wi[wi.length-1],rt=se[Me],mt=we.level;if(!(Se[Me]&s)){for(var At=Me+1;At<=we.end;At++)if(!(Se[At]&l)){mt=se[At];break}}Ui.push({_seqIndices:wi,_sosType:Math.max(Ie,Ae)%2?M:T,_eosType:Math.max(mt,rt)%2?M:T})}}for(var Et=0;Et=0;Ct--)if(!(Se[Ge[Ct]]&l)){pn=Se[Ge[Ct]];break}z(er,pn&(s|re)?F:pn)}}if(X.get(b))for(var tn=0;tn=-1;hi--){var ti=hi===-1?vt:Se[Ge[hi]];if(ti&a){ti===H&&z(Tt,U);break}}}if(X.get(H))for(var Gn=0;Gn=0&&(dr=Se[Ge[wa]],!!(dr&l));wa--);for(var Ca=Cn+1;Ca=0&&Se[Ge[bu]]&(L|l);bu--)z(Ge[bu],b);for(tr++;tr=0&&Se[Ge[uo]]&l;uo--)z(Ge[uo],F);for(var ho=nc+1;ho=0;go--){var Mu=tl[go].char;if(Mu===wf||Mu===w(I(Xt))||E(I(Mu))===Xt){Ta.push([tl[go].seqIndex,ba]),tl.length=go;break}}}Ta.sort(function(ki,Ar){return ki[0]-Ar[0]})}for(var Cf=0;Cf=0;bf--){var Z0=Ge[bf];if(Se[Z0]&Iu){var Kr=Se[Z0]&po?M:T;Kr!==ln?pr=Kr:pr=ln;break}}}if(pr){if(Se[Ge[Yn]]=Se[Ge[rc]]=pr,pr!==ln){for(var gr=Yn+1;gr=0;ac--)if(Se[Ge[ac]]&l)If=ac;else{Ur=Se[Ge[ac]]&po?M:T;break}for(var oc=wn,lc=xs+1;lc=0&&f(pe[nl])&c;nl--)se[nl]=we.level}}return{levels:se,paragraphs:Ce};function Bu(ki,Ar){for(var fi=ki;fi=se&&f(pe[we])&c;we--)Ce[we]=z.level;for(var ke=z.level,Ue=1/0,xe=0;xeke&&(ke=ze),ze=Ue;je--)for(var We=0;We=je){for(var Oe=We;We+1=je;)We++;We>Oe&&X.push([Oe+se,We+se])}}}),X}function fe(pe,Re,Le,Se){var $e=Pe(pe,Re,Le,Se),X=[].concat(pe);return $e.forEach(function(z,se){X[se]=(Re.levels[z]&1?ge(pe[z]):null)||pe[z]}),X.join("")}function Pe(pe,Re,Le,Se){for(var $e=ue(pe,Re,Le,Se),X=[],z=0;z/gm;function t(i,r){let s=kt[r];return s?d6(s):i}return n.replace(e,t)}const qi=[];for(let n=0;n<256;n++)qi[n]=(n<16?"0":"")+n.toString(16);function oce(){const n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(qi[n&255]+qi[n>>8&255]+qi[n>>16&255]+qi[n>>24&255]+"-"+qi[e&255]+qi[e>>8&255]+"-"+qi[e>>16&15|64]+qi[e>>24&255]+"-"+qi[t&63|128]+qi[t>>8&255]+"-"+qi[t>>16&255]+qi[t>>24&255]+qi[i&255]+qi[i>>8&255]+qi[i>>16&255]+qi[i>>24&255]).toUpperCase()}const Mc=Object.assign||function(){let n=arguments[0];for(let e=1,t=arguments.length;e/gm,` +//!BEGIN_POST_CHUNK $1 +$& +//!END_POST_CHUNK +`),t=d6(t)),p){let y=p({vertexShader:e,fragmentShader:t});e=y.vertexShader,t=y.fragmentShader}if(f){let y=[];t=t.replace(/^\/\/!BEGIN_POST_CHUNK[^]+?^\/\/!END_POST_CHUNK/gm,v=>(y.push(v),"")),h=`${f} +${y.join(` +`)} +${h}`}if(m){const y=` +uniform float ${m}; +`;s=y+s,c=y+c}return l&&(e=`vec3 troika_position_${r}; +vec3 troika_normal_${r}; +vec2 troika_uv_${r}; +${e} +`,s=`${s} +void troikaVertexTransform${r}(inout vec3 position, inout vec3 normal, inout vec2 uv) { + ${l} +} +`,a=` +troika_position_${r} = vec3(position); +troika_normal_${r} = vec3(normal); +troika_uv_${r} = vec2(uv); +troikaVertexTransform${r}(troika_position_${r}, troika_normal_${r}, troika_uv_${r}); +${a} +`,e=e.replace(/\b(position|normal|uv)\b/g,(y,v,A,_)=>/\battribute\s+vec[23]\s+$/.test(_.substr(0,A))?v:`troika_${v}_${r}`),n.map&&n.map.channel>0||(e=e.replace(/\bMAP_UV\b/g,`troika_uv_${r}`))),e=Aw(e,r,s,a,o),t=Aw(t,r,c,u,h),{vertexShader:e,fragmentShader:t}}function Aw(n,e,t,i,r){return(i||r||t)&&(n=n.replace(QB,` +${t} +void troikaOrigMain${e}() {`),n+=` +void main() { + ${i} + troikaOrigMain${e}(); + ${r} +}`),n}function hce(n,e){return n==="uniforms"?void 0:typeof e=="function"?e.toString():e}let fce=0;const vw=new Map;function dce(n){const e=JSON.stringify(n,hce);let t=vw.get(e);return t==null&&vw.set(e,t=++fce),t}function pce(n,e,t){const{defaultFontURL:i}=t,r=Object.create(null),s=1/0,a=/[\u00AD\u034F\u061C\u115F-\u1160\u17B4-\u17B5\u180B-\u180E\u200B-\u200F\u202A-\u202E\u2060-\u206F\u3164\uFE00-\uFE0F\uFEFF\uFFA0\uFFF0-\uFFF8]/,o="[^\\S\\u00A0]",l=new RegExp(`${o}|[\\-\\u007C\\u00AD\\u2010\\u2012-\\u2014\\u2027\\u2056\\u2E17\\u2E40]`);function c(_,x){function E(){const w=I=>{console.error(`Failure loading font ${_}${_===i?"":"; trying fallback"}`,I),_!==i&&(_=i,E())};try{const I=new XMLHttpRequest;I.open("get",_,!0),I.responseType="arraybuffer",I.onload=function(){if(I.status>=400)w(new Error(I.statusText));else if(I.status>0)try{const T=n(I.response);x(T)}catch(T){w(T)}},I.onerror=w,I.send()}catch(I){w(I)}}E()}function u(_,x){_||(_=i);let E=r[_];E?E.pending?E.pending.push(x):x(E):(r[_]={pending:[x]},c(_,w=>{let I=r[_].pending;r[_]=w,I.forEach(T=>T(w))}))}function h({text:_="",font:x=i,sdfGlyphSize:E=64,fontSize:w=1,letterSpacing:I=0,lineHeight:T="normal",maxWidth:M=s,direction:b,textAlign:B="left",textIndent:L=0,whiteSpace:U="normal",overflowWrap:O="normal",anchorX:Q=0,anchorY:G=0,includeCaretPositions:F=!1,chunkedBoundsSize:q=8192,colorRanges:Y=null},H,V=!1){const D=y(),k={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,` +`)),w=+w,I=+I,M=+M,T=T||"normal",L=+L,u(x,Z=>{const j=isFinite(M);let ee=null,ie=null,te=null,re=null,ce=null,ye=null,oe=null,W=0,ge=0,he=U!=="nowrap";const{ascender:ue,descender:fe,unitsPerEm:Pe,lineGap:pe,capHeight:Re,xHeight:Le}=Z;k.fontLoad=y()-D;const Se=y(),$e=w/Pe;T==="normal"&&(T=(ue-fe+pe)/Pe),T=T*w;const X=(T-(ue-fe)*$e)/2,z=-(ue*$e+X),se=Math.min(T,(ue-fe)*$e),Be=(ue+fe)/2*$e-se/2;let Ce=L,we=new v;const ke=[we];Z.forEachGlyph(_,w,I,(ze,je,We)=>{const Oe=_.charAt(We),Ve=ze.advanceWidth*$e,it=we.count;let gt;if("isEmpty"in ze||(ze.isWhitespace=!!Oe&&new RegExp(o).test(Oe),ze.canBreakAfter=!!Oe&&l.test(Oe),ze.isEmpty=ze.xMin===ze.xMax||ze.yMin===ze.yMax||a.test(Oe)),!ze.isWhitespace&&!ze.isEmpty&&ge++,he&&j&&!ze.isWhitespace&&je+Ve+Ce>M&&it){if(we.glyphAt(it-1).glyphObj.canBreakAfter)gt=new v,Ce=-je;else for(let Fe=it;Fe--;)if(Fe===0&&O==="break-word"){gt=new v,Ce=-je;break}else if(we.glyphAt(Fe).glyphObj.canBreakAfter){gt=we.splitAt(Fe+1);const me=gt.glyphAt(0).x;Ce-=me;for(let Qe=gt.count;Qe--;)gt.glyphAt(Qe).x-=me;break}gt&&(we.isSoftWrapped=!0,we=gt,ke.push(we),W=M)}let ne=we.glyphAt(we.count);ne.glyphObj=ze,ne.x=je+Ce,ne.width=Ve,ne.charIndex=We,Oe===` +`&&(we=new v,ke.push(we),Ce=-(je+Ve+I*w)+L)}),ke.forEach(ze=>{for(let je=ze.count;je--;){let{glyphObj:We,x:Oe,width:Ve}=ze.glyphAt(je);if(!We.isWhitespace){ze.width=Oe+Ve,ze.width>W&&(W=ze.width);return}}});let Ue=0,xe=0;if(Q&&(typeof Q=="number"?Ue=-Q:typeof Q=="string"&&(Ue=-W*(Q==="left"?0:Q==="center"?.5:Q==="right"?1:p(Q)))),G){if(typeof G=="number")xe=-G;else if(typeof G=="string"){let ze=ke.length*T;xe=G==="top"?0:G==="top-baseline"?-z:G==="top-cap"?-z-Re*$e:G==="top-ex"?-z-Le*$e:G==="middle"?ze/2:G==="bottom"?ze:G==="bottom-baseline"?ze-X+fe*$e:p(G)*ze}}if(!V){const ze=e.getEmbeddingLevels(_,b);ee=new Uint16Array(ge),ie=new Float32Array(ge*2),te={},ye=[s,s,-s,-s],oe=[];let je=z;F&&(ce=new Float32Array(_.length*3)),Y&&(re=new Uint8Array(ge*3));let We=0,Oe=-1,Ve=-1,it,gt;if(ke.forEach((ne,Fe)=>{let{count:me,width:Qe}=ne;if(me>0){let Xe=0;for(let Zt=me;Zt--&&ne.glyphAt(Zt).glyphObj.isWhitespace;)Xe++;let Dt=0,Yt=0;if(B==="center")Dt=(W-Qe)/2;else if(B==="right")Dt=W-Qe;else if(B==="justify"&&ne.isSoftWrapped){let Zt=0;for(let Ht=me-Xe;Ht--;)ne.glyphAt(Ht).glyphObj.isWhitespace&&Zt++;Yt=(W-Qe)/Zt}if(Yt||Dt){let Zt=0;for(let Ht=0;Ht=Ht){let Wi=Pn,Mn=Pn;for(;MnZi)break;MnJt=Zt;for(let Zt=0;Zt1&&m(ce,Oe,Mn),Oe=on}if(Y){const{charIndex:on}=Ht;for(;on>Ve;)Ve++,Y.hasOwnProperty(Ve)&&(gt=Y[Ve])}if(!Jt.isWhitespace&&!Jt.isEmpty){const on=We++;te[Zi]||(te[Zi]={path:Jt.path,pathBounds:[Jt.xMin,Jt.yMin,Jt.xMax,Jt.yMax]});const Pn=Ht.x+Ue,Wi=je+xe;ie[on*2]=Pn,ie[on*2+1]=Wi;const Mn=Pn+Jt.xMin*$e,Wn=Wi+Jt.yMin*$e,wi=Pn+Jt.xMax*$e,ys=Wi+Jt.yMax*$e;Mnye[2]&&(ye[2]=wi),ys>ye[3]&&(ye[3]=ys),on%q===0&&(it={start:on,end:on,rect:[s,s,-s,-s]},oe.push(it)),it.end++;const fr=it.rect;if(Mnfr[2]&&(fr[2]=wi),ys>fr[3]&&(fr[3]=ys),ee[on]=Zi,Y){const K=on*3;re[K]=gt>>16&255,re[K+1]=gt>>8&255,re[K+2]=gt&255}}}}je-=T}),ce){const ne=_.length-Oe;ne>1&&m(ce,Oe,ne)}}k.typesetting=y()-Se,H({glyphIds:ee,glyphPositions:ie,glyphData:te,caretPositions:ce,caretHeight:se,glyphColors:re,chunkedBounds:oe,fontSize:w,unitsPerEm:Pe,ascender:ue*$e,descender:fe*$e,capHeight:Re*$e,xHeight:Le*$e,lineHeight:T,topBaseline:z,blockBounds:[Ue,xe-ke.length*T,Ue+W,xe],visibleBounds:ye,timings:k})})}function f(_,x){h(_,E=>{const[w,I,T,M]=E.blockBounds;x({width:T-w,height:M-I})},{metricsOnly:!0})}function p(_){let x=_.match(/^([\d.]+)%$/),E=x?parseFloat(x[1]):NaN;return isNaN(E)?0:E/100}function m(_,x,E){const w=_[x*3],I=_[x*3+1],T=_[x*3+2],M=(I-w)/E;for(let b=0;b(Object.defineProperty(_,x,{get(){return this.data[this.index*A.length+E]},set(I){this.data[this.index*A.length+E]=I}}),_),{data:null,index:0}),{typeset:h,measure:f,loadFont:u}}const eu=()=>(self.performance||Date).now(),j1=zB();let yw;function gce(n,e,t,i,r,s,a,o,l,c,u=!0){return u?Ace(n,e,t,i,r,s,a,o,l,c).then(null,h=>(yw||(console.warn("WebGL SDF generation failed, falling back to JS",h),yw=!0),_w(n,e,t,i,r,s,a,o,l,c))):_w(n,e,t,i,r,s,a,o,l,c)}const Mm=[],mce=5;let g6=0;function HB(){const n=eu();for(;Mm.length&&eu()-nnew Promise((e,t)=>{Mm.push(()=>{const i=eu();try{j1.webgl.generateIntoCanvas(...n),e({timing:eu()-i})}catch(r){t(r)}}),g6||(g6=setTimeout(HB,0))}),vce=4,yce=2e3,xw={};let xce=0;function _w(n,e,t,i,r,s,a,o,l,c){const u="TroikaTextSDFGenerator_JS_"+xce++%vce;let h=xw[u];return h||(h=xw[u]={workerModule:Y0({name:u,workerId:u,dependencies:[zB,eu],init(f,p){const m=f().javascript.generate;return function(...y){const v=p();return{textureData:m(...y),timing:p()-v}}},getTransferables(f){return[f.textureData.buffer]}}),requests:0,idleTimer:null}),h.requests++,clearTimeout(h.idleTimer),h.workerModule(n,e,t,i,r,s).then(({textureData:f,timing:p})=>{const m=eu(),y=new Uint8Array(f.length*4);for(let v=0;v{rce(u)},yce)),{timing:p}})}function _ce(n){n._warm||(j1.webgl.isSupported(n),n._warm=!0)}const Ece=j1.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 Sce(){return typeof window>"u"&&(self.window=self),function(n){var e={parse:function(r){var s=e._bin,a=new Uint8Array(r);if(s.readASCII(a,0,4)=="ttcf"){var o=4;s.readUshort(a,o),o+=2,s.readUshort(a,o),o+=2;var l=s.readUint(a,o);o+=4;for(var c=[],u=0;u>>a&1&&s++;return s},e._lctf.readClassDef=function(r,s){var a=e._bin,o=[],l=a.readUshort(r,s);if(s+=2,l==1){var c=a.readUshort(r,s);s+=2;var u=a.readUshort(r,s);s+=2;for(var h=0;h0&&(l.featureParams=o+c);var u=a.readUshort(r,s);s+=2,l.tab=[];for(var h=0;h255?-1:e.CFF.glyphByUnicode(r,e.CFF.tableSE[s])},e.CFF.readEncoding=function(r,s,a){e._bin;var o=[".notdef"],l=r[s];if(s++,l!=0)throw"error: unknown encoding format: "+l;var c=r[s];s++;for(var u=0;u>4,_=15&v;if(A!=15&&y.push(A),_!=15&&y.push(_),_==15)break}for(var x="",E=[0,1,2,3,4,5,6,7,8,9,".","e","e-","reserved","-","endOfNumber"],w=0;w=c.xMax||c.yMin>=c.yMax)return null;if(c.noc>0){c.endPts=[];for(var u=0;u=1&&u.fmt<=2){f=l.readUshort(r,a),a+=2;var m=l.readUshort(r,a);a+=2,p=e._lctf.numOfOnes(f);var y=e._lctf.numOfOnes(m);if(u.fmt==1){u.pairsets=[];var v=l.readUshort(r,a);a+=2;for(var A=0;A=1&&u.fmt<=2){if(u.fmt==1)u.delta=l.readShort(r,a),a+=2;else if(u.fmt==2){var f=l.readUshort(r,a);a+=2,u.newg=l.readUshorts(r,a,f),a+=2*u.newg.length}}else if(s==4){u.vals=[],f=l.readUshort(r,a),a+=2;for(var p=0;p>>8;if((m&=15)!=0)throw"unknown kern table format: "+m;s=e.kern.readFormat0(r,s,h)}return h},e.kern.parseV1=function(r,s,a,o){var l=e._bin;l.readFixed(r,s),s+=4;var c=l.readUint(r,s);s+=4;for(var u={glyph1:[],rval:[]},h=0;h>>8;if((p&=15)!=0)throw"unknown kern table format: "+p;s=e.kern.readFormat0(r,s,u)}return u},e.kern.readFormat0=function(r,s,a){var o=e._bin,l=-1,c=o.readUshort(r,s);s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,s),s+=2,o.readUshort(r,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(o,a):e.U._compoGlyph(o,s,a))},e.U._simpleGlyph=function(r,s){for(var a=0;al)){for(var v=!0,A=0,_=0;_l)){for(v=!0,_=0;_>1,c.length=0,h=!0;else if(U=="o3"||U=="o23")c.length%2!=0&&!h&&(f=c.shift()+o.nominalWidthX),u+=c.length>>1,c.length=0,h=!0;else if(U=="o4")c.length>1&&!h&&(f=c.shift()+o.nominalWidthX,h=!0),p&&e.U.P.closePath(l),v+=c.pop(),e.U.P.moveTo(l,y,v),p=!0;else if(U=="o5")for(;c.length>0;)y+=c.shift(),v+=c.shift(),e.U.P.lineTo(l,y,v);else if(U=="o6"||U=="o7")for(var O=c.length,Q=U=="o6",G=0;GMath.abs(M-v)?y=T+c.shift():v=M+c.shift(),e.U.P.curveTo(l,A,_,x,E,b,B),e.U.P.curveTo(l,w,I,T,M,y,v));else if(U=="o14"){if(c.length>0&&!h&&(f=c.shift()+a.nominalWidthX,h=!0),c.length==4){var Y=c.shift(),H=c.shift(),V=c.shift(),D=c.shift(),k=e.CFF.glyphBySE(a,V),Z=e.CFF.glyphBySE(a,D);e.U._drawCFF(a.CharStrings[k],s,a,o,l),s.x=Y,s.y=H,e.U._drawCFF(a.CharStrings[Z],s,a,o,l)}p&&(e.U.P.closePath(l),p=!1)}else if(U=="o19"||U=="o20")c.length%2!=0&&!h&&(f=c.shift()+o.nominalWidthX),u+=c.length>>1,c.length=0,h=!0,m+=u+7>>3;else if(U=="o21")c.length>2&&!h&&(f=c.shift()+o.nominalWidthX,h=!0),v+=c.pop(),y+=c.pop(),p&&e.U.P.closePath(l),e.U.P.moveTo(l,y,v),p=!0;else if(U=="o22")c.length>1&&!h&&(f=c.shift()+o.nominalWidthX,h=!0),y+=c.pop(),p&&e.U.P.closePath(l),e.U.P.moveTo(l,y,v),p=!0;else if(U=="o25"){for(;c.length>6;)y+=c.shift(),v+=c.shift(),e.U.P.lineTo(l,y,v);A=y+c.shift(),_=v+c.shift(),x=A+c.shift(),E=_+c.shift(),y=x+c.shift(),v=E+c.shift(),e.U.P.curveTo(l,A,_,x,E,y,v)}else if(U=="o26")for(c.length%2&&(y+=c.shift());c.length>0;)A=y,_=v+c.shift(),y=x=A+c.shift(),v=(E=_+c.shift())+c.shift(),e.U.P.curveTo(l,A,_,x,E,y,v);else if(U=="o27")for(c.length%2&&(v+=c.shift());c.length>0;)_=v,x=(A=y+c.shift())+c.shift(),E=_+c.shift(),y=x+c.shift(),v=E,e.U.P.curveTo(l,A,_,x,E,y,v);else if(U=="o10"||U=="o29"){var j=U=="o10"?o:a;if(c.length==0)console.debug("error: empty stack");else{var ee=c.pop(),ie=j.Subrs[ee+j.Bias];s.x=y,s.y=v,s.nStems=u,s.haveWidth=h,s.width=f,s.open=p,e.U._drawCFF(ie,s,a,o,l),y=s.x,v=s.y,u=s.nStems,h=s.haveWidth,f=s.width,p=s.open}}else if(U=="o30"||U=="o31"){var te=c.length,re=(q=0,U=="o31");for(q+=te-(O=-3&te);q>>1|(21845&p)<<1;m=(61680&(m=(52428&m)>>>2|(13107&m)<<2))>>>4|(3855&m)<<4,f[p]=((65280&m)>>>8|(255&m)<<8)>>>1}var y=function(U,O,Q){for(var G=U.length,F=0,q=new t(O);F>>V]=D}else for(Y=new t(G),F=0;F>>15-U[F]);return Y},v=new e(288);for(p=0;p<144;++p)v[p]=8;for(p=144;p<256;++p)v[p]=9;for(p=256;p<280;++p)v[p]=7;for(p=280;p<288;++p)v[p]=8;var A=new e(32);for(p=0;p<32;++p)A[p]=5;var _=y(v,9,1),x=y(A,5,1),E=function(U){for(var O=U[0],Q=1;QO&&(O=U[Q]);return O},w=function(U,O,Q){var G=O/8|0;return(U[G]|U[G+1]<<8)>>(7&O)&Q},I=function(U,O){var Q=O/8|0;return(U[Q]|U[Q+1]<<8|U[Q+2]<<16)>>(7&O)},T=["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(U,O,Q){var G=new Error(O||T[U]);if(G.code=U,Error.captureStackTrace&&Error.captureStackTrace(G,M),!Q)throw G;return G},b=function(U,O,Q){var G=U.length;if(!G||Q&&!Q.l&&G<5)return O||new e(0);var F=!O||Q,q=!Q||Q.i;Q||(Q={}),O||(O=new e(3*G));var Y,H=function(Oe){var Ve=O.length;if(Oe>Ve){var it=new e(Math.max(2*Ve,Oe));it.set(O),O=it}},V=Q.f||0,D=Q.p||0,k=Q.b||0,Z=Q.l,j=Q.d,ee=Q.m,ie=Q.n,te=8*G;do{if(!Z){Q.f=V=w(U,D,1);var re=w(U,D+1,3);if(D+=3,!re){var ce=U[(Le=((Y=D)/8|0)+(7&Y&&1)+4)-4]|U[Le-3]<<8,ye=Le+ce;if(ye>G){q&&M(0);break}F&&H(k+ce),O.set(U.subarray(Le,ye),k),Q.b=k+=ce,Q.p=D=8*ye;continue}if(re==1)Z=_,j=x,ee=9,ie=5;else if(re==2){var oe=w(U,D,31)+257,W=w(U,D+10,15)+4,ge=oe+w(U,D+5,31)+1;D+=14;for(var he=new e(ge),ue=new e(19),fe=0;fe>>4)<16)he[fe++]=Le;else{var $e=0,X=0;for(Le==16?(X=3+w(U,D,3),D+=2,$e=he[fe-1]):Le==17?(X=3+w(U,D,7),D+=3):Le==18&&(X=11+w(U,D,127),D+=7);X--;)he[fe++]=$e}}var z=he.subarray(0,oe),se=he.subarray(oe);ee=E(z),ie=E(se),Z=y(z,ee,1),j=y(se,ie,1)}else M(1);if(D>te){q&&M(0);break}}F&&H(k+131072);for(var Be=(1<>>4;if((D+=15&$e)>te){q&&M(0);break}if($e||M(2),ke<256)O[k++]=ke;else{if(ke==256){we=D,Z=null;break}var Ue=ke-254;if(ke>264){var xe=r[fe=ke-257];Ue=w(U,D,(1<>>4;if(ze||M(3),D+=15&ze,se=h[je],je>3&&(xe=s[je],se+=I(U,D)&(1<te){q&&M(0);break}F&&H(k+131072);for(var We=k+Ue;kOe.length)&&(it=Oe.length);var gt=new(Oe instanceof t?t:Oe instanceof i?i:e)(it-Ve);return gt.set(Oe.subarray(Ve,it)),gt}(O,0,k)},B=new e(0),L=typeof TextDecoder<"u"&&new TextDecoder;try{L.decode(B,{stream:!0})}catch{}return n.convert_streams=function(U){var O=new DataView(U),Q=0;function G(){var oe=O.getUint16(Q);return Q+=2,oe}function F(){var oe=O.getUint32(Q);return Q+=4,oe}function q(oe){ce.setUint16(ye,oe),ye+=2}function Y(oe){ce.setUint32(ye,oe),ye+=4}for(var H={signature:F(),flavor:F(),length:F(),numTables:G(),reserved:G(),totalSfntSize:F(),majorVersion:G(),minorVersion:G(),metaOffset:F(),metaLength:F(),metaOrigLength:F(),privOffset:F(),privLength:F()},V=0;Math.pow(2,V)<=H.numTables;)V++;V--;for(var D=16*Math.pow(2,V),k=16*H.numTables-D,Z=12,j=[],ee=0;ee{let[B,L]=b.split("+");B=parseInt(B,36),L=L?parseInt(L,36):0,u.set(M+=B,I[T]);for(let U=L;U--;)u.set(++M,I[T])})}}return u.get(w)||c}const f=1,p=2,m=3,y=4,v=[null,"isol","init","fina","medi"];function A(w){const I=new Uint8Array(w.length);let T=c,M=f,b=-1;for(let B=0;B65535&&B++)}return I}function _(w,I){const T=[];for(let b=0;b65535&&b++,T.push(n.U.codeToGlyph(w,B))}const M=w.GSUB;if(M){const{lookupList:b,featureList:B}=M;let L;const U=/^(rlig|liga|mset|isol|init|fina|medi|half|pres|blws)$/,O=[];B.forEach(Q=>{if(U.test(Q.tag))for(let G=0;G{if(D!==-1){let Z=I[D];if(!Z){const{cmds:j,crds:ee}=n.U.glyphToPath(w,D);let ie="",te=0;for(let W=0,ge=j.length;W1?",":"")+ee[te++]}let re,ce,ye,oe;if(ee.length){re=ce=1/0,ye=oe=-1/0;for(let W=0,ge=ee.length;Wye&&(ye=he),ue>oe&&(oe=ue)}}else re=ye=ce=oe=0;Z=I[D]={index:D,advanceWidth:w.hmtx.aWidth[D],xMin:re,yMin:ce,xMax:ye,yMax:oe,path:ie,pathCommandCount:j.length}}V!==-1&&(F+=n.U.getPairAdjustment(w,V,D)*q),G.call(null,Z,F,H),Z.advanceWidth&&(F+=Z.advanceWidth*q),Q&&(F+=Q*O),V=D}H+=U.codePointAt(H)>65535?2:1}),F}};return L}return function(I){const T=new Uint8Array(I,0,4),M=n._bin.readASCII(T,0,4);if(M==="wOFF")I=e(I);else if(M==="wOF2")throw new Error("woff2 fonts not supported");return E(n.parse(I)[0])}}const Tce=Y0({name:"Typr Font Parser",dependencies:[Sce,wce,Cce],init(n,e,t){const i=n(),r=e();return t(i,r)}}),Dh={defaultFontURL:"https://fonts.gstatic.com/s/roboto/v18/KFOmCnqEu92Fr1Mu4mxM.woff",sdfGlyphSize:64,sdfMargin:1/16,sdfExponent:9,textureWidth:2048},bce=new He;function mh(){return(self.performance||Date).now()}const Ew=Object.create(null);function VB(n,e){n=Rce({},n);const t=mh();if(n.font=Bce(n.font||Dh.defaultFontURL),n.text=""+n.text,n.sdfGlyphSize=n.sdfGlyphSize||Dh.sdfGlyphSize,n.colorRanges!=null){let h={};for(let f in n.colorRanges)if(n.colorRanges.hasOwnProperty(f)){let p=n.colorRanges[f];typeof p!="number"&&(p=bce.set(p).getHex()),h[f]=p}n.colorRanges=h}Object.freeze(n);const{textureWidth:i,sdfExponent:r}=Dh,{sdfGlyphSize:s}=n,a=i/s*4;let o=Ew[s];if(!o){const h=document.createElement("canvas");h.width=i,h.height=s*256/a,o=Ew[s]={glyphCount:0,sdfGlyphSize:s,sdfCanvas:h,sdfTexture:new Vn(h,void 0,void 0,void 0,Tn,Tn),contextLost:!1,glyphsByFont:new Map},o.sdfTexture.generateMipmaps=!1,Ice(o)}const{sdfTexture:l,sdfCanvas:c}=o;let u=o.glyphsByFont.get(n.font);u||o.glyphsByFont.set(n.font,u=new Map),Pce(n).then(h=>{const{glyphIds:f,glyphPositions:p,fontSize:m,unitsPerEm:y,timings:v}=h,A=[],_=new Float32Array(f.length*4),x=m/y;let E=0,w=0;const I=mh();f.forEach((L,U)=>{let O=u.get(L);if(!O){const{path:q,pathBounds:Y}=h.glyphData[L],H=Math.max(Y[2]-Y[0],Y[3]-Y[1])/s*(Dh.sdfMargin*s+.5),V=o.glyphCount++,D=[Y[0]-H,Y[1]-H,Y[2]+H,Y[3]+H];u.set(L,O={path:q,atlasIndex:V,sdfViewBox:D}),A.push(O)}const{sdfViewBox:Q}=O,G=p[w++],F=p[w++];_[E++]=G+Q[0]*x,_[E++]=F+Q[1]*x,_[E++]=G+Q[2]*x,_[E++]=F+Q[3]*x,f[U]=O.atlasIndex}),v.quads=(v.quads||0)+(mh()-I);const T=mh();v.sdf={};const M=c.height,b=Math.ceil(o.glyphCount/a),B=Math.pow(2,Math.ceil(Math.log2(b*s)));B>M&&(console.info(`Increasing SDF texture size ${M}->${B}`),Ece(c,i,B),l.dispose()),Promise.all(A.map(L=>WB(L,o,n.gpuAccelerateSDF).then(({timing:U})=>{v.sdf[L.atlasIndex]=U}))).then(()=>{A.length&&!o.contextLost&&(YB(o),l.needsUpdate=!0),v.sdfTotal=mh()-T,v.total=mh()-t,e(Object.freeze({parameters:n,sdfTexture:l,sdfGlyphSize:s,sdfExponent:r,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(()=>{o.contextLost||_ce(c)})}function WB({path:n,atlasIndex:e,sdfViewBox:t},{sdfGlyphSize:i,sdfCanvas:r,contextLost:s},a){if(s)return Promise.resolve({timing:-1});const{textureWidth:o,sdfExponent:l}=Dh,c=Math.max(t[2]-t[0],t[3]-t[1]),u=Math.floor(e/4),h=u%(o/i)*i,f=Math.floor(u/(o/i))*i,p=e%4;return gce(i,i,n,t,c,l,r,h,f,p,a)}function Ice(n){const e=n.sdfCanvas;e.addEventListener("webglcontextlost",t=>{console.log("Context Lost",t),t.preventDefault(),n.contextLost=!0}),e.addEventListener("webglcontextrestored",t=>{console.log("Context Restored",t),n.contextLost=!1;const i=[];n.glyphsByFont.forEach(r=>{r.forEach(s=>{i.push(WB(s,n,!0))})}),Promise.all(i).then(()=>{YB(n),n.sdfTexture.needsUpdate=!0})})}function Mce({font:n,characters:e,sdfGlyphSize:t},i){let r=Array.isArray(e)?e.join(` +`):""+e;VB({font:n,sdfGlyphSize:t,text:r},i)}function Rce(n,e){for(let t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n}let tm;function Bce(n){return tm||(tm=typeof document>"u"?{}:document.createElement("a")),tm.href=n,tm.href}function YB(n){if(typeof createImageBitmap!="function"){console.info("Safari<15: applying SDF canvas workaround");const{sdfCanvas:e,sdfTexture:t}=n,{width:i,height:r}=e,s=n.sdfCanvas.getContext("webgl");let a=t.image.data;(!a||a.length!==i*r*4)&&(a=new Uint8Array(i*r*4),t.image={width:i,height:r,data:a},t.flipY=!1,t.isDataTexture=!0),s.readPixels(0,0,i,r,s.RGBA,s.UNSIGNED_BYTE,a)}}const Dce=Y0({name:"Typesetter",dependencies:[Dh,Tce,pce,ace],init(n,e,t,i){const{defaultFontURL:r}=n;return t(e,i(),{defaultFontURL:r})}}),Pce=Y0({name:"Typesetter",dependencies:[Dce],init(n){return function(e){return new Promise(t=>{n.typeset(e,t)})}},getTransferables(n){const e=[n.glyphPositions.buffer,n.glyphIds.buffer];return n.caretPositions&&e.push(n.caretPositions.buffer),n.glyphColors&&e.push(n.glyphColors.buffer),e}}),Sw={};function Lce(n){let e=Sw[n];if(!e){const t=new Xo(1,1,n,n),i=t.clone(),r=t.attributes,s=i.attributes,a=new Bt,o=r.uv.count;for(let l=0;l{a.setAttribute(l,new ot([...r[l].array,...s[l].array],r[l].itemSize))}),a.setIndex([...t.index.array,...i.index.array.map(l=>l+o)]),a.translate(.5,.5,0),e=Sw[n]=a}return e}const Uce="aTroikaGlyphBounds",ww="aTroikaGlyphIndex",Oce="aTroikaGlyphColor";class Fce extends Z6{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 ms,this.boundingBox=new gs}computeBoundingSphere(){}computeBoundingBox(){}setSide(e){const t=this.getIndex().count;this.setDrawRange(e===Ki?t/2:0,e===$n?t:t/2)}set detail(e){if(e!==this._detail){this._detail=e,(typeof e!="number"||e<1)&&(e=1);let t=Lce(e);["position","normal","uv"].forEach(i=>{this.attributes[i]=t.attributes[i].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,i,r,s){C5(this,Uce,e,4),C5(this,ww,t,1),C5(this,Oce,s,3),this._blockBounds=i,this._chunkedBounds=r,this.instanceCount=t.length,this._updateBounds()}_updateBounds(){const e=this._blockBounds;if(e){const{curveRadius:t,boundingBox:i}=this;if(t){const{PI:r,floor:s,min:a,max:o,sin:l,cos:c}=Math,u=r/2,h=r*2,f=Math.abs(t),p=e[0]/f,m=e[2]/f,y=s((p+u)/h)!==s((m+u)/h)?-f:a(l(p)*f,l(m)*f),v=s((p-u)/h)!==s((m-u)/h)?f:o(l(p)*f,l(m)*f),A=s((p+r)/h)!==s((m+r)/h)?f*2:o(f-c(p)*f,f-c(m)*f);i.min.set(y,e[1],t<0?-A:0),i.max.set(v,e[3],t<0?0:A)}else i.min.set(e[0],e[1],0),i.max.set(e[2],e[3],0);i.getBoundingSphere(this.boundingSphere)}}applyClipRect(e){let t=this.getAttribute(ww).count,i=this._chunkedBounds;if(i)for(let r=i.length;r--;){t=i[r].end;let s=i[r].rect;if(s[1]e.y&&s[0]e.x)break}this.instanceCount=t}}function C5(n,e,t,i){const r=n.getAttribute(e);t?r&&r.array.length===t.length?(r.array.set(t),r.needsUpdate=!0):(n.setAttribute(e,new nu(t,i)),delete n._maxInstanceCount,n.dispose()):r&&n.deleteAttribute(e)}const kce=` +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; +`,Nce=` +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); +`,Gce=` +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; +} +`,zce=` +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 Qce(n){const e=p6(n,{chained:!0,extensions:{derivatives:!0},uniforms:{uTroikaSDFTexture:{value:null},uTroikaSDFTextureSize:{value:new _e},uTroikaSDFGlyphSize:{value:0},uTroikaSDFExponent:{value:0},uTroikaTotalBounds:{value:new jt(0,0,0,0)},uTroikaClipRect:{value:new jt(0,0,0,0)},uTroikaDistanceOffset:{value:0},uTroikaOutlineOpacity:{value:0},uTroikaFillOpacity:{value:1},uTroikaPositionOffset:{value:new _e},uTroikaCurveRadius:{value:0},uTroikaBlurRadius:{value:0},uTroikaStrokeWidth:{value:0},uTroikaStrokeColor:{value:new He},uTroikaStrokeOpacity:{value:1},uTroikaOrient:{value:new Qt},uTroikaUseGlyphColors:{value:!0},uTroikaSDFDebug:{value:!1}},vertexDefs:kce,vertexTransform:Nce,fragmentDefs:Gce,fragmentColorTransform:zce,customRewriter({vertexShader:t,fragmentShader:i}){let r=/\buniform\s+vec3\s+diffuse\b/;return r.test(i)&&(i=i.replace(r,"varying vec3 vTroikaGlyphColor").replace(/\bdiffuse\b/g,"vTroikaGlyphColor"),r.test(t)||(t=t.replace(QB,`uniform vec3 diffuse; +$& +vTroikaGlyphColor = uTroikaUseGlyphColors ? aTroikaGlyphColor / 255.0 : diffuse; +`))),{vertexShader:t,fragmentShader:i}}});return e.transparent=!0,Object.defineProperties(e,{isTroikaTextMaterial:{value:!0},shadowSide:{get(){return this.side},set(){}}}),e}const O8=new cs({color:16777215,side:$n,transparent:!0}),Cw=8421504,Tw=new ct,nm=new N,T5=new N,Bd=[],Hce=new N,b5="+x+y";function bw(n){return Array.isArray(n)?n[0]:n}let qB=()=>{const n=new nn(new Xo(1,1),O8);return qB=()=>n,n},XB=()=>{const n=new nn(new Xo(1,1,32,1),O8);return XB=()=>n,n};const Vce={type:"syncstart"},Wce={type:"synccomplete"},jB=["font","fontSize","letterSpacing","lineHeight","maxWidth","overflowWrap","text","direction","textAlign","textIndent","whiteSpace","anchorX","anchorY","colorRanges","sdfGlyphSize"],Yce=jB.concat("material","color","depthOffset","clipRect","curveRadius","orientation","glyphGeometryDetail");let KB=class extends nn{constructor(){const e=new Fce;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=Cw,this.strokeOpacity=1,this.fillOpacity=1,this.depthOffset=0,this.clipRect=null,this.orientation=b5,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(Vce),VB({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 i=this._queuedSyncs;i&&(this._queuedSyncs=null,this._needsSync=!0,this.sync(()=>{i.forEach(r=>r&&r())})),this.dispatchEvent(Wce),e&&e()})))}onBeforeRender(e,t,i,r,s,a){this.sync(),s.isTroikaTextMaterial&&this._prepareForRender(s),s._hadOwnSide=s.hasOwnProperty("side"),this.geometry.setSide(s._actualSide=s.side),s.side=$a}onAfterRender(e,t,i,r,s,a){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=O8.clone());if((!e||e.baseMaterial!==t)&&(e=this._derivedMaterial=Qce(t),t.addEventListener("dispose",function i(){t.removeEventListener("dispose",i),e.dispose()})),this.outlineWidth||this.outlineBlur||this.outlineOffsetX||this.outlineOffsetY){let i=e._outlineMtl;return i||(i=e._outlineMtl=Object.create(e,{id:{value:e.id+.1}}),i.isTextOutlineMaterial=!0,i.depthWrite=!1,i.map=null,e.addEventListener("dispose",function r(){e.removeEventListener("dispose",r),i.dispose()})),[i,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 bw(this.material).getDepthMaterial()}get customDistanceMaterial(){return bw(this.material).getDistanceMaterial()}_prepareForRender(e){const t=e.isTextOutlineMaterial,i=e.uniforms,r=this.textRenderInfo;if(r){const{sdfTexture:o,blockBounds:l}=r;i.uTroikaSDFTexture.value=o,i.uTroikaSDFTextureSize.value.set(o.image.width,o.image.height),i.uTroikaSDFGlyphSize.value=r.sdfGlyphSize,i.uTroikaSDFExponent.value=r.sdfExponent,i.uTroikaTotalBounds.value.fromArray(l),i.uTroikaUseGlyphColors.value=!t&&!!r.glyphColors;let c=0,u=0,h=0,f,p,m,y=0,v=0;if(t){let{outlineWidth:_,outlineOffsetX:x,outlineOffsetY:E,outlineBlur:w,outlineOpacity:I}=this;c=this._parsePercent(_)||0,u=Math.max(0,this._parsePercent(w)||0),f=I,y=this._parsePercent(x)||0,v=this._parsePercent(E)||0}else h=Math.max(0,this._parsePercent(this.strokeWidth)||0),h&&(m=this.strokeColor,i.uTroikaStrokeColor.value.set(m??Cw),p=this.strokeOpacity,p==null&&(p=1)),f=this.fillOpacity;i.uTroikaDistanceOffset.value=c,i.uTroikaPositionOffset.value.set(y,v),i.uTroikaBlurRadius.value=u,i.uTroikaStrokeWidth.value=h,i.uTroikaStrokeOpacity.value=p,i.uTroikaFillOpacity.value=f??1,i.uTroikaCurveRadius.value=this.curveRadius||0;let A=this.clipRect;if(A&&Array.isArray(A)&&A.length===4)i.uTroikaClipRect.value.fromArray(A);else{const _=(this.fontSize||.1)*100;i.uTroikaClipRect.value.set(l[0]-_,l[1]-_,l[2]+_,l[3]+_)}this.geometry.applyClipRect(i.uTroikaClipRect.value)}i.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 o=e.hasOwnProperty("color")?e.color:e.color=new He;(s!==o._input||typeof s=="object")&&o.set(o._input=s)}let a=this.orientation||b5;if(a!==e._orientation){let o=i.uTroikaOrient.value;a=a.replace(/[^-+xyz]/g,"");let l=a!==b5&&a.match(/^([-+])([xyz])([-+])([xyz])$/);if(l){let[,c,u,h,f]=l;nm.set(0,0,0)[u]=c==="-"?1:-1,T5.set(0,0,0)[f]=h==="-"?-1:1,Tw.lookAt(Hce,nm.cross(T5),T5),o.setFromMatrix4(Tw)}else o.identity();e._orientation=a}}_parsePercent(e){if(typeof e=="string"){let t=e.match(/^(-?[\d.]+)%$/),i=t?parseFloat(t[1]):NaN;e=(isNaN(i)?0:i/100)*this.fontSize}return e}localPositionToTextCoords(e,t=new _e){t.copy(e);const i=this.curveRadius;return i&&(t.x=Math.atan2(e.x,Math.abs(i)-Math.abs(e.z))*Math.abs(i)),t}worldPositionToTextCoords(e,t=new _e){return nm.copy(e),this.localPositionToTextCoords(this.worldToLocal(nm),t)}raycast(e,t){const{textRenderInfo:i,curveRadius:r}=this;if(i){const s=i.blockBounds,a=r?XB():qB(),o=a.geometry,{position:l,uv:c}=o.attributes;for(let u=0;u{this[i]=e[i]}),this}clone(){return new this.constructor().copy(this)}};jB.forEach(n=>{const e="_private_"+n;Object.defineProperty(KB.prototype,n,{get(){return this[e]},set(t){t!==this[e]&&(this[e]=t,this._needsSync=!0)}})});const qce=$.forwardRef(({sdfGlyphSize:n=64,anchorX:e="center",anchorY:t="middle",font:i,fontSize:r=1,children:s,characters:a,onSync:o,...l},c)=>{const u=Cr(({invalidate:m})=>m),[h]=$.useState(()=>new KB),[f,p]=$.useMemo(()=>{const m=[];let y="";return $.Children.forEach(s,v=>{typeof v=="string"||typeof v=="number"?y+=v:m.push(v)}),[m,y]},[s]);return $G(()=>new Promise(m=>Mce({font:i,characters:a},m)),["troika-text",i,a]),$.useLayoutEffect(()=>void h.sync(()=>{u(),o&&o(h)})),$.useEffect(()=>()=>h.dispose(),[h]),$.createElement("primitive",ou({object:h,ref:c,font:i,text:p,anchorX:e,anchorY:t,fontSize:r,sdfGlyphSize:n},l),f)});/*! + * camera-controls + * https://github.com/yomotsu/camera-controls + * (c) 2017 @yomotsu + * Released under the MIT License. + */const It={LEFT:1,RIGHT:2,MIDDLE:4},De=Object.freeze({NONE:0,ROTATE:1,TRUCK:2,OFFSET:4,DOLLY:8,ZOOM:16,TOUCH_ROTATE:32,TOUCH_TRUCK:64,TOUCH_OFFSET:128,TOUCH_DOLLY:256,TOUCH_ZOOM:512,TOUCH_DOLLY_TRUCK:1024,TOUCH_DOLLY_OFFSET:2048,TOUCH_DOLLY_ROTATE:4096,TOUCH_ZOOM_TRUCK:8192,TOUCH_ZOOM_OFFSET:16384,TOUCH_ZOOM_ROTATE:32768}),Ah={NONE:0,IN:1,OUT:-1};function Rc(n){return n.isPerspectiveCamera}function Cl(n){return n.isOrthographicCamera}const vh=Math.PI*2,Iw=Math.PI/2,$B=1e-5,Dd=Math.PI/180;function ra(n,e,t){return Math.max(e,Math.min(t,n))}function Un(n,e=$B){return Math.abs(n)0==p>u&&(p=u,t.value=(p-u)/s),p}function Rw(n,e,t,i,r=1/0,s,a){i=Math.max(1e-4,i);const o=2/i,l=o*s,c=1/(1+l+.48*l*l+.235*l*l*l);let u=e.x,h=e.y,f=e.z,p=n.x-u,m=n.y-h,y=n.z-f;const v=u,A=h,_=f,x=r*i,E=x*x,w=p*p+m*m+y*y;if(w>E){const G=Math.sqrt(w);p=p/G*x,m=m/G*x,y=y/G*x}u=n.x-p,h=n.y-m,f=n.z-y;const I=(t.x+o*p)*s,T=(t.y+o*m)*s,M=(t.z+o*y)*s;t.x=(t.x-o*I)*c,t.y=(t.y-o*T)*c,t.z=(t.z-o*M)*c,a.x=u+(p+I)*c,a.y=h+(m+T)*c,a.z=f+(y+M)*c;const b=v-n.x,B=A-n.y,L=_-n.z,U=a.x-v,O=a.y-A,Q=a.z-_;return b*U+B*O+L*Q>0&&(a.x=v,a.y=A,a.z=_,t.x=(a.x-v)/s,t.y=(a.y-A)/s,t.z=(a.z-_)/s),a}function I5(n,e){e.set(0,0),n.forEach(t=>{e.x+=t.clientX,e.y+=t.clientY}),e.x/=n.length,e.y/=n.length}function M5(n,e){return Cl(n)?(console.warn(`${e} is not supported in OrthographicCamera`),!0):!1}let Xce=class{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}removeAllEventListeners(e){if(!e){this._listeners={};return}Array.isArray(this._listeners[e])&&(this._listeners[e].length=0)}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s{},this._enabled=!0,this._state=De.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._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=Ah.NONE,this._thetaVelocity={value:0},this._phiVelocity={value:0},this._radiusVelocity={value:0},this._targetVelocity=new St.Vector3,this._focalOffsetVelocity=new St.Vector3,this._zoomVelocity={value:0},this._truckInternal=(E,w,I)=>{let T,M;if(Rc(this._camera)){const b=zt.copy(this._camera.position).sub(this._target),B=this._camera.getEffectiveFOV()*Dd,L=b.length()*Math.tan(B*.5);T=this.truckSpeed*E*L/this._elementRect.height,M=this.truckSpeed*w*L/this._elementRect.height}else if(Cl(this._camera)){const b=this._camera;T=E*(b.right-b.left)/b.zoom/this._elementRect.width,M=w*(b.top-b.bottom)/b.zoom/this._elementRect.height}else return;this.verticalDragToForward?(I?this.setFocalOffset(this._focalOffsetEnd.x+T,this._focalOffsetEnd.y,this._focalOffsetEnd.z,!0):this.truck(T,0,!0),this.forward(-M,!0)):I?this.setFocalOffset(this._focalOffsetEnd.x+T,this._focalOffsetEnd.y+M,this._focalOffsetEnd.z,!0):this.truck(T,M,!0)},this._rotateInternal=(E,w)=>{const I=vh*this.azimuthRotateSpeed*E/this._elementRect.height,T=vh*this.polarRotateSpeed*w/this._elementRect.height;this.rotate(I,T,!0)},this._dollyInternal=(E,w,I)=>{const T=Math.pow(.95,-E*this.dollySpeed),M=this._sphericalEnd.radius,b=this._sphericalEnd.radius*T,B=ra(b,this.minDistance,this.maxDistance),L=B-b;this.infinityDolly&&this.dollyToCursor?this._dollyToNoClamp(b,!0):this.infinityDolly&&!this.dollyToCursor?(this.dollyInFixed(L,!0),this._dollyToNoClamp(B,!0)):this._dollyToNoClamp(B,!0),this.dollyToCursor&&(this._changedDolly+=(this.infinityDolly?b:B)-M,this._dollyControlCoord.set(w,I)),this._lastDollyDirection=Math.sign(-E)},this._zoomInternal=(E,w,I)=>{const T=Math.pow(.95,E*this.dollySpeed),M=this._zoom,b=this._zoom*T;this.zoomTo(b,!0),this.dollyToCursor&&(this._changedZoom+=b-M,this._dollyControlCoord.set(w,I))},typeof St>"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 St.Quaternion().setFromUnitVectors(this._camera.up,sm),this._yAxisUpSpaceInverse=this._yAxisUpSpace.clone().invert(),this._state=De.NONE,this._target=new St.Vector3,this._targetEnd=this._target.clone(),this._focalOffset=new St.Vector3,this._focalOffsetEnd=this._focalOffset.clone(),this._spherical=new St.Spherical().setFromVector3(zt.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 St.Vector3,new St.Vector3,new St.Vector3,new St.Vector3],this._updateNearPlaneCorners(),this._boundary=new St.Box3(new St.Vector3(-1/0,-1/0,-1/0),new St.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 St.Vector2,this.mouseButtons={left:De.ROTATE,middle:De.DOLLY,right:De.TRUCK,wheel:Rc(this._camera)?De.DOLLY:Cl(this._camera)?De.ZOOM:De.NONE},this.touches={one:De.TOUCH_ROTATE,two:Rc(this._camera)?De.TOUCH_DOLLY_TRUCK:Cl(this._camera)?De.TOUCH_ZOOM_TRUCK:De.NONE,three:De.TOUCH_TRUCK};const i=new St.Vector2,r=new St.Vector2,s=new St.Vector2,a=E=>{if(!this._enabled||!this._domElement)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const T=this._domElement.getBoundingClientRect(),M=E.clientX/T.width,b=E.clientY/T.height;if(Mthis._interactiveArea.right||bthis._interactiveArea.bottom)return}const w=E.pointerType!=="mouse"?null:(E.buttons&It.LEFT)===It.LEFT?It.LEFT:(E.buttons&It.MIDDLE)===It.MIDDLE?It.MIDDLE:(E.buttons&It.RIGHT)===It.RIGHT?It.RIGHT:null;if(w!==null){const T=this._findPointerByMouseButton(w);T&&this._disposePointer(T)}if((E.buttons&It.LEFT)===It.LEFT&&this._lockedPointer)return;const I={pointerId:E.pointerId,clientX:E.clientX,clientY:E.clientY,deltaX:0,deltaY:0,mouseButton:w};this._activePointers.push(I),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),this._isDragging=!0,y(E)},o=E=>{if(!this._enabled||!this._domElement||this._lockedPointer)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const T=this._domElement.getBoundingClientRect(),M=E.clientX/T.width,b=E.clientY/T.height;if(Mthis._interactiveArea.right||bthis._interactiveArea.bottom)return}const w=(E.buttons&It.LEFT)===It.LEFT?It.LEFT:(E.buttons&It.MIDDLE)===It.MIDDLE?It.MIDDLE:(E.buttons&It.RIGHT)===It.RIGHT?It.RIGHT:null;if(w!==null){const T=this._findPointerByMouseButton(w);T&&this._disposePointer(T)}const I={pointerId:1,clientX:E.clientX,clientY:E.clientY,deltaX:0,deltaY:0,mouseButton:(E.buttons&It.LEFT)===It.LEFT?It.LEFT:(E.buttons&It.MIDDLE)===It.LEFT?It.MIDDLE:(E.buttons&It.RIGHT)===It.LEFT?It.RIGHT:null};this._activePointers.push(I),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.addEventListener("mousemove",c),this._domElement.ownerDocument.addEventListener("mouseup",h),this._isDragging=!0,y(E)},l=E=>{E.cancelable&&E.preventDefault();const w=E.pointerId,I=this._lockedPointer||this._findPointerById(w);if(I){if(I.clientX=E.clientX,I.clientY=E.clientY,I.deltaX=E.movementX,I.deltaY=E.movementY,this._state=0,E.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&&(E.buttons&It.LEFT)===It.LEFT)&&(this._state=this._state|this.mouseButtons.left),this._isDragging&&(E.buttons&It.MIDDLE)===It.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),this._isDragging&&(E.buttons&It.RIGHT)===It.RIGHT&&(this._state=this._state|this.mouseButtons.right);v()}},c=E=>{const w=this._lockedPointer||this._findPointerById(1);w&&(w.clientX=E.clientX,w.clientY=E.clientY,w.deltaX=E.movementX,w.deltaY=E.movementY,this._state=0,(this._lockedPointer||(E.buttons&It.LEFT)===It.LEFT)&&(this._state=this._state|this.mouseButtons.left),(E.buttons&It.MIDDLE)===It.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(E.buttons&It.RIGHT)===It.RIGHT&&(this._state=this._state|this.mouseButtons.right),v())},u=E=>{const w=this._findPointerById(E.pointerId);if(!(w&&w===this._lockedPointer)){if(w&&this._disposePointer(w),E.pointerType==="touch")switch(this._activePointers.length){case 0:this._state=De.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=De.NONE;A()}},h=()=>{const E=this._findPointerById(1);E&&E===this._lockedPointer||(E&&this._disposePointer(E),this._state=De.NONE,A())};let f=-1;const p=E=>{if(!this._domElement||!this._enabled||this.mouseButtons.wheel===De.NONE)return;if(this._interactiveArea.left!==0||this._interactiveArea.top!==0||this._interactiveArea.width!==1||this._interactiveArea.height!==1){const b=this._domElement.getBoundingClientRect(),B=E.clientX/b.width,L=E.clientY/b.height;if(Bthis._interactiveArea.right||Lthis._interactiveArea.bottom)return}if(E.preventDefault(),this.dollyToCursor||this.mouseButtons.wheel===De.ROTATE||this.mouseButtons.wheel===De.TRUCK){const b=performance.now();f-b<1e3&&this._getClientRect(this._elementRect),f=b}const w=Kce?-1:-3,I=E.deltaMode===1?E.deltaY/w:E.deltaY/(w*10),T=this.dollyToCursor?(E.clientX-this._elementRect.x)/this._elementRect.width*2-1:0,M=this.dollyToCursor?(E.clientY-this._elementRect.y)/this._elementRect.height*-2+1:0;switch(this.mouseButtons.wheel){case De.ROTATE:{this._rotateInternal(E.deltaX,E.deltaY),this._isUserControllingRotate=!0;break}case De.TRUCK:{this._truckInternal(E.deltaX,E.deltaY,!1),this._isUserControllingTruck=!0;break}case De.OFFSET:{this._truckInternal(E.deltaX,E.deltaY,!0),this._isUserControllingOffset=!0;break}case De.DOLLY:{this._dollyInternal(-I,T,M),this._isUserControllingDolly=!0;break}case De.ZOOM:{this._zoomInternal(-I,T,M),this._isUserControllingZoom=!0;break}}this.dispatchEvent({type:"control"})},m=E=>{if(!(!this._domElement||!this._enabled)){if(this.mouseButtons.right===m6.ACTION.NONE){const w=E instanceof PointerEvent?E.pointerId:(E instanceof MouseEvent,0),I=this._findPointerById(w);I&&this._disposePointer(I),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("mouseup",h);return}E.preventDefault()}},y=E=>{if(!this._enabled)return;if(I5(this._activePointers,Gr),this._getClientRect(this._elementRect),i.copy(Gr),r.copy(Gr),this._activePointers.length>=2){const I=Gr.x-this._activePointers[1].clientX,T=Gr.y-this._activePointers[1].clientY,M=Math.sqrt(I*I+T*T);s.set(0,M);const b=(this._activePointers[0].clientX+this._activePointers[1].clientX)*.5,B=(this._activePointers[0].clientY+this._activePointers[1].clientY)*.5;r.set(b,B)}if(this._state=0,!E)this._lockedPointer&&(this._state=this._state|this.mouseButtons.left);else if("pointerType"in E&&E.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&&(E.buttons&It.LEFT)===It.LEFT&&(this._state=this._state|this.mouseButtons.left),(E.buttons&It.MIDDLE)===It.MIDDLE&&(this._state=this._state|this.mouseButtons.middle),(E.buttons&It.RIGHT)===It.RIGHT&&(this._state=this._state|this.mouseButtons.right);((this._state&De.ROTATE)===De.ROTATE||(this._state&De.TOUCH_ROTATE)===De.TOUCH_ROTATE||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE||(this._state&De.TOUCH_ZOOM_ROTATE)===De.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&De.TRUCK)===De.TRUCK||(this._state&De.TOUCH_TRUCK)===De.TOUCH_TRUCK||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_ZOOM_TRUCK)===De.TOUCH_ZOOM_TRUCK)&&(this._targetEnd.copy(this._target),this._targetVelocity.set(0,0,0)),((this._state&De.DOLLY)===De.DOLLY||(this._state&De.TOUCH_DOLLY)===De.TOUCH_DOLLY||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE)&&(this._sphericalEnd.radius=this._spherical.radius,this._radiusVelocity.value=0),((this._state&De.ZOOM)===De.ZOOM||(this._state&De.TOUCH_ZOOM)===De.TOUCH_ZOOM||(this._state&De.TOUCH_ZOOM_TRUCK)===De.TOUCH_ZOOM_TRUCK||(this._state&De.TOUCH_ZOOM_OFFSET)===De.TOUCH_ZOOM_OFFSET||(this._state&De.TOUCH_ZOOM_ROTATE)===De.TOUCH_ZOOM_ROTATE)&&(this._zoomEnd=this._zoom,this._zoomVelocity.value=0),((this._state&De.OFFSET)===De.OFFSET||(this._state&De.TOUCH_OFFSET)===De.TOUCH_OFFSET||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET||(this._state&De.TOUCH_ZOOM_OFFSET)===De.TOUCH_ZOOM_OFFSET)&&(this._focalOffsetEnd.copy(this._focalOffset),this._focalOffsetVelocity.set(0,0,0)),this.dispatchEvent({type:"controlstart"})},v=()=>{if(!this._enabled)return;I5(this._activePointers,Gr);const w=this._domElement&&document.pointerLockElement===this._domElement?this._lockedPointer||this._activePointers[0]:null,I=w?-w.deltaX:r.x-Gr.x,T=w?-w.deltaY:r.y-Gr.y;if(r.copy(Gr),((this._state&De.ROTATE)===De.ROTATE||(this._state&De.TOUCH_ROTATE)===De.TOUCH_ROTATE||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE||(this._state&De.TOUCH_ZOOM_ROTATE)===De.TOUCH_ZOOM_ROTATE)&&(this._rotateInternal(I,T),this._isUserControllingRotate=!0),(this._state&De.DOLLY)===De.DOLLY||(this._state&De.ZOOM)===De.ZOOM){const M=this.dollyToCursor?(i.x-this._elementRect.x)/this._elementRect.width*2-1:0,b=this.dollyToCursor?(i.y-this._elementRect.y)/this._elementRect.height*-2+1:0,B=this.dollyDragInverted?-1:1;(this._state&De.DOLLY)===De.DOLLY?(this._dollyInternal(B*T*rm,M,b),this._isUserControllingDolly=!0):(this._zoomInternal(B*T*rm,M,b),this._isUserControllingZoom=!0)}if((this._state&De.TOUCH_DOLLY)===De.TOUCH_DOLLY||(this._state&De.TOUCH_ZOOM)===De.TOUCH_ZOOM||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_ZOOM_TRUCK)===De.TOUCH_ZOOM_TRUCK||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET||(this._state&De.TOUCH_ZOOM_OFFSET)===De.TOUCH_ZOOM_OFFSET||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE||(this._state&De.TOUCH_ZOOM_ROTATE)===De.TOUCH_ZOOM_ROTATE){const M=Gr.x-this._activePointers[1].clientX,b=Gr.y-this._activePointers[1].clientY,B=Math.sqrt(M*M+b*b),L=s.y-B;s.set(0,B);const U=this.dollyToCursor?(r.x-this._elementRect.x)/this._elementRect.width*2-1:0,O=this.dollyToCursor?(r.y-this._elementRect.y)/this._elementRect.height*-2+1:0;(this._state&De.TOUCH_DOLLY)===De.TOUCH_DOLLY||(this._state&De.TOUCH_DOLLY_ROTATE)===De.TOUCH_DOLLY_ROTATE||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET?(this._dollyInternal(L*rm,U,O),this._isUserControllingDolly=!0):(this._zoomInternal(L*rm,U,O),this._isUserControllingZoom=!0)}((this._state&De.TRUCK)===De.TRUCK||(this._state&De.TOUCH_TRUCK)===De.TOUCH_TRUCK||(this._state&De.TOUCH_DOLLY_TRUCK)===De.TOUCH_DOLLY_TRUCK||(this._state&De.TOUCH_ZOOM_TRUCK)===De.TOUCH_ZOOM_TRUCK)&&(this._truckInternal(I,T,!1),this._isUserControllingTruck=!0),((this._state&De.OFFSET)===De.OFFSET||(this._state&De.TOUCH_OFFSET)===De.TOUCH_OFFSET||(this._state&De.TOUCH_DOLLY_OFFSET)===De.TOUCH_DOLLY_OFFSET||(this._state&De.TOUCH_ZOOM_OFFSET)===De.TOUCH_ZOOM_OFFSET)&&(this._truckInternal(I,T,!0),this._isUserControllingOffset=!0),this.dispatchEvent({type:"control"})},A=()=>{I5(this._activePointers,Gr),r.copy(Gr),(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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",h),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",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.requestPointerLock(),this._domElement.ownerDocument.addEventListener("pointerlockchange",_),this._domElement.ownerDocument.addEventListener("pointerlockerror",x),this._domElement.ownerDocument.addEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.addEventListener("pointerup",u),y())},this.unlockPointer=()=>{this._lockedPointer!==null&&(this._disposePointer(this._lockedPointer),this._lockedPointer=null),document.exitPointerLock(),this.cancel(),this._domElement&&(this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",x))};const _=()=>{this._domElement&&this._domElement.ownerDocument.pointerLockElement===this._domElement||this.unlockPointer()},x=()=>{this.unlockPointer()};this._addAllEventListeners=E=>{this._domElement=E,this._domElement.style.touchAction="none",this._domElement.style.userSelect="none",this._domElement.style.webkitUserSelect="none",this._domElement.addEventListener("pointerdown",a),$ce&&this._domElement.addEventListener("mousedown",o),this._domElement.addEventListener("pointercancel",u),this._domElement.addEventListener("wheel",p,{passive:!1}),this._domElement.addEventListener("contextmenu",m)},this._removeAllEventListeners=()=>{this._domElement&&(this._domElement.style.touchAction="",this._domElement.style.userSelect="",this._domElement.style.webkitUserSelect="",this._domElement.removeEventListener("pointerdown",a),this._domElement.removeEventListener("mousedown",o),this._domElement.removeEventListener("pointercancel",u),this._domElement.removeEventListener("wheel",p,{passive:!1}),this._domElement.removeEventListener("contextmenu",m),this._domElement.ownerDocument.removeEventListener("pointermove",l,{passive:!1}),this._domElement.ownerDocument.removeEventListener("mousemove",c),this._domElement.ownerDocument.removeEventListener("pointerup",u),this._domElement.ownerDocument.removeEventListener("mouseup",h),this._domElement.ownerDocument.removeEventListener("pointerlockchange",_),this._domElement.ownerDocument.removeEventListener("pointerlockerror",x))},this.cancel=()=>{this._state!==De.NONE&&(this._state=De.NONE,this._activePointers.length=0,A())},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=ra(e.width,0,1),this._interactiveArea.height=ra(e.height,0,1),this._interactiveArea.x=ra(e.x,0,1-this._interactiveArea.width),this._interactiveArea.y=ra(e.x,0,1-this._interactiveArea.height)}addEventListener(e,t){super.addEventListener(e,t)}removeEventListener(e,t){super.removeEventListener(e,t)}rotate(e,t,i=!1){return this.rotateTo(this._sphericalEnd.theta+e,this._sphericalEnd.phi+t,i)}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,i=!1){this._isUserControllingRotate=!1;const r=ra(e,this.minAzimuthAngle,this.maxAzimuthAngle),s=ra(t,this.minPolarAngle,this.maxPolarAngle);this._sphericalEnd.theta=r,this._sphericalEnd.phi=s,this._sphericalEnd.makeSafe(),this._needsUpdate=!0,i||(this._spherical.theta=this._sphericalEnd.theta,this._spherical.phi=this._sphericalEnd.phi);const a=!i||yn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&yn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold);return this._createOnRestPromise(a)}dolly(e,t=!1){return this.dollyTo(this._sphericalEnd.radius-e,t)}dollyTo(e,t=!1){return this._isUserControllingDolly=!1,this._lastDollyDirection=Ah.NONE,this._changedDolly=0,this._dollyToNoClamp(ra(e,this.minDistance,this.maxDistance),t)}_dollyToNoClamp(e,t=!1){const i=this._sphericalEnd.radius;if(this.colliderMeshes.length>=1){const a=this._collisionTest(),o=yn(a,this._spherical.radius);if(!(i>e)&&o)return Promise.resolve();this._sphericalEnd.radius=Math.min(e,a)}else this._sphericalEnd.radius=e;this._needsUpdate=!0,t||(this._spherical.radius=this._sphericalEnd.radius);const s=!t||yn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(s)}dollyInFixed(e,t=!1){this._targetEnd.add(this._getCameraDirection(Ud).multiplyScalar(e)),t||this._target.copy(this._targetEnd);const i=!t||yn(this._target.x,this._targetEnd.x,this.restThreshold)&&yn(this._target.y,this._targetEnd.y,this.restThreshold)&&yn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(i)}zoom(e,t=!1){return this.zoomTo(this._zoomEnd+e,t)}zoomTo(e,t=!1){this._isUserControllingZoom=!1,this._zoomEnd=ra(e,this.minZoom,this.maxZoom),this._needsUpdate=!0,t||(this._zoom=this._zoomEnd);const i=!t||yn(this._zoom,this._zoomEnd,this.restThreshold);return this._changedZoom=0,this._createOnRestPromise(i)}pan(e,t,i=!1){return console.warn("`pan` has been renamed to `truck`"),this.truck(e,t,i)}truck(e,t,i=!1){this._camera.updateMatrix(),Oa.setFromMatrixColumn(this._camera.matrix,0),Fa.setFromMatrixColumn(this._camera.matrix,1),Oa.multiplyScalar(e),Fa.multiplyScalar(-t);const r=zt.copy(Oa).add(Fa),s=hn.copy(this._targetEnd).add(r);return this.moveTo(s.x,s.y,s.z,i)}forward(e,t=!1){zt.setFromMatrixColumn(this._camera.matrix,0),zt.crossVectors(this._camera.up,zt),zt.multiplyScalar(e);const i=hn.copy(this._targetEnd).add(zt);return this.moveTo(i.x,i.y,i.z,t)}elevate(e,t=!1){return zt.copy(this._camera.up).multiplyScalar(e),this.moveTo(this._targetEnd.x+zt.x,this._targetEnd.y+zt.y,this._targetEnd.z+zt.z,t)}moveTo(e,t,i,r=!1){this._isUserControllingTruck=!1;const s=zt.set(e,t,i).sub(this._targetEnd);this._encloseToBoundary(this._targetEnd,s,this.boundaryFriction),this._needsUpdate=!0,r||this._target.copy(this._targetEnd);const a=!r||yn(this._target.x,this._targetEnd.x,this.restThreshold)&&yn(this._target.y,this._targetEnd.y,this.restThreshold)&&yn(this._target.z,this._targetEnd.z,this.restThreshold);return this._createOnRestPromise(a)}lookInDirectionOf(e,t,i,r=!1){const o=zt.set(e,t,i).sub(this._targetEnd).normalize().multiplyScalar(-this._sphericalEnd.radius);return this.setPosition(o.x,o.y,o.z,r)}fitToBox(e,t,{cover:i=!1,paddingLeft:r=0,paddingRight:s=0,paddingBottom:a=0,paddingTop:o=0}={}){const l=[],c=e.isBox3?xh.copy(e):xh.setFromObject(e);c.isEmpty()&&(console.warn("camera-controls: fitTo() cannot be used with an empty box. Aborting"),Promise.resolve());const u=Mw(this._sphericalEnd.theta,Iw),h=Mw(this._sphericalEnd.phi,Iw);l.push(this.rotateTo(u,h,t));const f=zt.setFromSpherical(this._sphericalEnd).normalize(),p=Uw.setFromUnitVectors(f,R5),m=yn(Math.abs(f.y),1);m&&p.multiply(D5.setFromAxisAngle(sm,u)),p.multiply(this._yAxisUpSpaceInverse);const y=Lw.makeEmpty();hn.copy(c.min).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.min).setX(c.max.x).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.min).setY(c.max.y).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.max).setZ(c.min.z).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.min).setZ(c.max.z).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.max).setY(c.min.y).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.max).setX(c.min.x).applyQuaternion(p),y.expandByPoint(hn),hn.copy(c.max).applyQuaternion(p),y.expandByPoint(hn),y.min.x-=r,y.min.y-=a,y.max.x+=s,y.max.y+=o,p.setFromUnitVectors(R5,f),m&&p.premultiply(D5.invert()),p.premultiply(this._yAxisUpSpace);const v=y.getSize(zt),A=y.getCenter(hn).applyQuaternion(p);if(Rc(this._camera)){const _=this.getDistanceToFitBox(v.x,v.y,v.z,i);l.push(this.moveTo(A.x,A.y,A.z,t)),l.push(this.dollyTo(_,t)),l.push(this.setFocalOffset(0,0,0,t))}else if(Cl(this._camera)){const _=this._camera,x=_.right-_.left,E=_.top-_.bottom,w=i?Math.max(x/v.x,E/v.y):Math.min(x/v.x,E/v.y);l.push(this.moveTo(A.x,A.y,A.z,t)),l.push(this.zoomTo(w,t)),l.push(this.setFocalOffset(0,0,0,t))}return Promise.all(l)}fitToSphere(e,t){const i=[],s=e instanceof St.Sphere?B5.copy(e):m6.createBoundingSphere(e,B5);if(i.push(this.moveTo(s.center.x,s.center.y,s.center.z,t)),Rc(this._camera)){const a=this.getDistanceToFitSphere(s.radius);i.push(this.dollyTo(a,t))}else if(Cl(this._camera)){const a=this._camera.right-this._camera.left,o=this._camera.top-this._camera.bottom,l=2*s.radius,c=Math.min(a/l,o/l);i.push(this.zoomTo(c,t))}return i.push(this.setFocalOffset(0,0,0,t)),Promise.all(i)}setLookAt(e,t,i,r,s,a,o=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ah.NONE,this._changedDolly=0;const l=hn.set(r,s,a),c=zt.set(e,t,i);this._targetEnd.copy(l),this._sphericalEnd.setFromVector3(c.sub(l).applyQuaternion(this._yAxisUpSpace)),this.normalizeRotations(),this._needsUpdate=!0,o||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const u=!o||yn(this._target.x,this._targetEnd.x,this.restThreshold)&&yn(this._target.y,this._targetEnd.y,this.restThreshold)&&yn(this._target.z,this._targetEnd.z,this.restThreshold)&&yn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&yn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&yn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(u)}lerpLookAt(e,t,i,r,s,a,o,l,c,u,h,f,p,m=!1){this._isUserControllingRotate=!1,this._isUserControllingDolly=!1,this._isUserControllingTruck=!1,this._lastDollyDirection=Ah.NONE,this._changedDolly=0;const y=zt.set(r,s,a),v=hn.set(e,t,i);Bs.setFromVector3(v.sub(y).applyQuaternion(this._yAxisUpSpace));const A=yh.set(u,h,f),_=hn.set(o,l,c);Od.setFromVector3(_.sub(A).applyQuaternion(this._yAxisUpSpace)),this._targetEnd.copy(y.lerp(A,p));const x=Od.theta-Bs.theta,E=Od.phi-Bs.phi,w=Od.radius-Bs.radius;this._sphericalEnd.set(Bs.radius+w*p,Bs.phi+E*p,Bs.theta+x*p),this.normalizeRotations(),this._needsUpdate=!0,m||(this._target.copy(this._targetEnd),this._spherical.copy(this._sphericalEnd));const I=!m||yn(this._target.x,this._targetEnd.x,this.restThreshold)&&yn(this._target.y,this._targetEnd.y,this.restThreshold)&&yn(this._target.z,this._targetEnd.z,this.restThreshold)&&yn(this._spherical.theta,this._sphericalEnd.theta,this.restThreshold)&&yn(this._spherical.phi,this._sphericalEnd.phi,this.restThreshold)&&yn(this._spherical.radius,this._sphericalEnd.radius,this.restThreshold);return this._createOnRestPromise(I)}setPosition(e,t,i,r=!1){return this.setLookAt(e,t,i,this._targetEnd.x,this._targetEnd.y,this._targetEnd.z,r)}setTarget(e,t,i,r=!1){const s=this.getPosition(zt),a=this.setLookAt(s.x,s.y,s.z,e,t,i,r);return this._sphericalEnd.phi=ra(this._sphericalEnd.phi,this.minPolarAngle,this.maxPolarAngle),a}setFocalOffset(e,t,i,r=!1){this._isUserControllingOffset=!1,this._focalOffsetEnd.set(e,t,i),this._needsUpdate=!0,r||this._focalOffset.copy(this._focalOffsetEnd);const s=!r||yn(this._focalOffset.x,this._focalOffsetEnd.x,this.restThreshold)&&yn(this._focalOffset.y,this._focalOffsetEnd.y,this.restThreshold)&&yn(this._focalOffset.z,this._focalOffsetEnd.z,this.restThreshold);return this._createOnRestPromise(s)}setOrbitPoint(e,t,i){this._camera.updateMatrixWorld(),Oa.setFromMatrixColumn(this._camera.matrixWorldInverse,0),Fa.setFromMatrixColumn(this._camera.matrixWorldInverse,1),Bc.setFromMatrixColumn(this._camera.matrixWorldInverse,2);const r=zt.set(e,t,i),s=r.distanceTo(this._camera.position),a=r.sub(this._camera.position);Oa.multiplyScalar(a.x),Fa.multiplyScalar(a.y),Bc.multiplyScalar(a.z),zt.copy(Oa).add(Fa).add(Bc),zt.z=zt.z+s,this.dollyTo(s,!1),this.setFocalOffset(-zt.x,zt.y,-zt.z,!1),this.moveTo(e,t,i,!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,i,r){if(e===null){this._viewport=null;return}this._viewport=this._viewport||new St.Vector4,typeof e=="number"?this._viewport.set(e,t,i,r):this._viewport.copy(e)}getDistanceToFitBox(e,t,i,r=!1){if(M5(this._camera,"getDistanceToFitBox"))return this._spherical.radius;const s=e/t,a=this._camera.getEffectiveFOV()*Dd,o=this._camera.aspect;return((r?s>o: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,i){const r=t.lengthSq();if(r===0)return e;const s=hn.copy(t).add(e),o=this._boundary.clampPoint(s,yh).sub(s),l=o.lengthSq();if(l===0)return e.add(t);if(l===r)return e;if(i===0)return e.add(t).add(o);{const c=1+i*l/t.dot(o);return e.add(hn.copy(t).multiplyScalar(c)).add(o.multiplyScalar(1-i))}}_updateNearPlaneCorners(){if(Rc(this._camera)){const e=this._camera,t=e.near,i=e.getEffectiveFOV()*Dd,r=Math.tan(i*.5)*t,s=r*e.aspect;this._nearPlaneCorners[0].set(-s,-r,0),this._nearPlaneCorners[1].set(s,-r,0),this._nearPlaneCorners[2].set(s,r,0),this._nearPlaneCorners[3].set(-s,r,0)}else if(Cl(this._camera)){const e=this._camera,t=1/e.zoom,i=e.left*t,r=e.right*t,s=e.top*t,a=e.bottom*t;this._nearPlaneCorners[0].set(i,s,0),this._nearPlaneCorners[1].set(r,s,0),this._nearPlaneCorners[2].set(r,a,0),this._nearPlaneCorners[3].set(i,a,0)}}_collisionTest(){let e=1/0;if(!(this.colliderMeshes.length>=1)||M5(this._camera,"_collisionTest"))return e;const i=this._getTargetDirection(Ud);P5.lookAt(Bw,i,this._camera.up);for(let r=0;r<4;r++){const s=hn.copy(this._nearPlaneCorners[r]);s.applyMatrix4(P5);const a=yh.addVectors(this._target,s);am.set(a,i),am.far=this._spherical.radius+1;const o=am.intersectObjects(this.colliderMeshes);o.length!==0&&o[0].distance{const i=()=>{this.removeEventListener("rest",i),t()};this.addEventListener("rest",i)}))}_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 St.Sphere){const i=t,r=i.center;xh.makeEmpty(),e.traverseVisible(a=>{a.isMesh&&xh.expandByObject(a)}),xh.getCenter(r);let s=0;return e.traverseVisible(a=>{if(!a.isMesh)return;const o=a,l=o.geometry.clone();l.applyMatrix4(o.matrixWorld);const u=l.attributes.position;for(let h=0,f=u.count;h"u")&&(t[i]=Ow[i]);return t.max=e||t.max,t.truncate=="middle"?ZB(n,t.max,t.ellipse,t.chars):eD(n,t.max,t.ellipse,t.chars,t.truncate)};K1.exports.ellipsizeMiddle=ZB;K1.exports.ellipsize=eD;var Jce=K1.exports;const Zce=ps(Jce);var tD={exports:{}};(function(n){(function(e,t,i){if(!e)return;for(var r={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},s={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},o={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l,c=1;c<20;++c)r[111+c]="f"+c;for(c=0;c<=9;++c)r[c+96]=c.toString();function u(T,M,b){if(T.addEventListener){T.addEventListener(M,b,!1);return}T.attachEvent("on"+M,b)}function h(T){if(T.type=="keypress"){var M=String.fromCharCode(T.which);return T.shiftKey||(M=M.toLowerCase()),M}return r[T.which]?r[T.which]:s[T.which]?s[T.which]:String.fromCharCode(T.which).toLowerCase()}function f(T,M){return T.sort().join(",")===M.sort().join(",")}function p(T){var M=[];return T.shiftKey&&M.push("shift"),T.altKey&&M.push("alt"),T.ctrlKey&&M.push("ctrl"),T.metaKey&&M.push("meta"),M}function m(T){if(T.preventDefault){T.preventDefault();return}T.returnValue=!1}function y(T){if(T.stopPropagation){T.stopPropagation();return}T.cancelBubble=!0}function v(T){return T=="shift"||T=="ctrl"||T=="alt"||T=="meta"}function A(){if(!l){l={};for(var T in r)T>95&&T<112||r.hasOwnProperty(T)&&(l[r[T]]=T)}return l}function _(T,M,b){return b||(b=A()[T]?"keydown":"keypress"),b=="keypress"&&M.length&&(b="keydown"),b}function x(T){return T==="+"?["+"]:(T=T.replace(/\+{2}/g,"+plus"),T.split("+"))}function E(T,M){var b,B,L,U=[];for(b=x(T),L=0;L1){H(D,ie,k,Z);return}te=E(D,Z),M._callbacks[te.key]=M._callbacks[te.key]||[],G(te.key,te.modifiers,{type:te.action},j,D,ee),M._callbacks[te.key][j?"unshift":"push"]({callback:k,modifiers:te.modifiers,action:te.action,seq:j,level:ee,combo:D})}M._bindMultiple=function(D,k,Z){for(var j=0;j-1||w(M,b.target))return!1;if("composedPath"in T&&typeof T.composedPath=="function"){var B=T.composedPath()[0];B!==T.target&&(M=B)}return M.tagName=="INPUT"||M.tagName=="SELECT"||M.tagName=="TEXTAREA"||M.isContentEditable},I.prototype.handleKey=function(){var T=this;return T._handleKey.apply(T,arguments)},I.addKeycodes=function(T){for(var M in T)T.hasOwnProperty(M)&&(r[M]=T[M]);l=null},I.init=function(){var T=I(t);for(var M in T)M.charAt(0)!=="_"&&(I[M]=function(b){return function(){return T[b].apply(T,arguments)}}(M))},I.init(),e.Mousetrap=I,n.exports&&(n.exports=I),typeof i=="function"&&i.amd&&i(function(){return I})})(typeof window<"u"?window:null,typeof window<"u"?document:null)})(tD);var eue=tD.exports;const Fw=ps(eue),tue=()=>{const n=new Map;let e=[];const t=s=>{s.forEach(a=>{if(!a.disabled)if(a.ref){if(!a.ref.current)return;const o=a.ref.current;n.has(o)||n.set(o,new Fw(o)),n.get(o).bind(a.keys,a.callback,a.action)}else n.get(void 0)||n.set(void 0,Fw),n.get(void 0).bind(a.keys,a.callback,a.action)})},i=s=>{e=[...e,...s],t(s)},r=s=>{e=e.filter(a=>!s.includes(a)),s.forEach(a=>{var o,l;if(a.ref){if(!a.ref.current)return;(o=n.get(a.ref.current))==null||o.unbind(a.keys,a.action)}else(l=n.get(void 0))==null||l.unbind(a.keys,a.action)});for(const[a]of n){if(a===void 0){if(e.some(o=>o.ref===void 0))continue}else if(e.some(o=>{var l;return((l=o.ref)==null?void 0:l.current)===a}))continue;n.delete(a)}t(e)};return()=>{const[s,a]=$.useState([]);return $.useEffect(()=>{a(e)},[]),[s,i,r]}},nue=tue(),nD=n=>{const[e,t,i]=nue();return $.useLayoutEffect(()=>(n&&t(n),()=>{n&&i(n)}),[t,i,n]),$.useMemo(()=>e.reduce((r,s)=>(r.find(a=>a.keys===s.keys&&a.ref&&s.ref)||r.push(s),r),[]),[e])};let iue=!1;try{navigator&&(iue=navigator.platform.toUpperCase().indexOf("MAC")>=0)}catch(n){console.warn(n)}/*! + * hold-event + * https://github.com/yomotsu/hold-event + * (c) 2020 @yomotsu + * Released under the MIT License. + */var fp;(function(n){n.HOLD_START="holdStart",n.HOLD_END="holdEnd",n.HOLDING="holding"})(fp||(fp={}));class rue{constructor(){this._listeners={}}addEventListener(e,t){const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}removeEventListener(e,t){const r=this._listeners[e];if(r!==void 0){const s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){const i=this._listeners[e.type];if(i!==void 0){e.target=this;const r=i.slice(0);for(let s=0,a=r.length;s{if(!this._enabled||this._holding)return;this._deltaTime=0,this._elapsedTime=0,this._lastTime=performance.now(),this.dispatchEvent({type:fp.HOLD_START,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t}),this._holding=!0;const i=()=>{this._intervalId=this.holdIntervalDelay?window.setTimeout(i,this.holdIntervalDelay):window.requestAnimationFrame(i);const r=performance.now();this._deltaTime=r-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:fp.HOLDING,deltaTime:this._deltaTime,elapsedTime:this._elapsedTime,originalEvent:t})};this._intervalId=this.holdIntervalDelay?window.setTimeout(i,this.holdIntervalDelay):window.requestAnimationFrame(i)},this._holdEnd=t=>{if(!this._enabled||!this._holding)return;const i=performance.now();this._deltaTime=i-this._lastTime,this._elapsedTime+=this._deltaTime,this._lastTime=performance.now(),this.dispatchEvent({type:fp.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 $1 extends sue{constructor(e,t){super(t),this._holdStart=this._holdStart.bind(this),this._holdEnd=this._holdEnd.bind(this);const i=s=>{aue(s)||s.keyCode===e&&this._holdStart(s)},r=s=>{s.keyCode===e&&this._holdEnd(s)};document.addEventListener("keydown",i),document.addEventListener("keyup",r),window.addEventListener("blur",this._holdEnd)}}function aue(n){const e=n.target;return e.tagName==="INPUT"||e.tagName==="SELECT"||e.tagName==="TEXTAREA"||e.isContentEditable}var oue={exports:{}};/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var i=[],r=0;r-1){const s=[...e.slice(r),i].map(a=>a.data.id);throw new Error(`Invalid Graph: Circular node path detected: ${s.join(" -> ")}.`)}t>i.depth&&(i.depth=t,iD(i.out,[...e,i]))}}function rD(n,e){let t=!1;const i=n.reduce((a,o)=>({...a,[o.id]:{data:o,out:[],depth:-1,ins:[]}}),{});try{for(const a of e){const o=a.source,l=a.target;if(!i.hasOwnProperty(o))throw new Error(`Missing source Node ${o}`);if(!i.hasOwnProperty(l))throw new Error(`Missing target Node ${l}`);const c=i[o],u=i[l];u.ins.push(c),c.out.push(u)}iD(Object.values(i))}catch{t=!0}const r=Object.keys(i).map(a=>i[a].depth),s=Math.max(...r);return{invalid:t,depths:i,maxDepth:s||1}}const Gw=["radialin","radialout"];function lue({nodes:n,edges:e,mode:t="lr",nodeLevelRatio:i=2}){const{depths:r,maxDepth:s,invalid:a}=rD(n,e);if(a)return null;const o=Gw.includes(t)?1:5,l=n.length/s*i*o;if(t){const c=(p,m)=>y=>p?(r[y.id].depth-s/2)*l*(m?-1:1):void 0,u=c(["lr","rl"].includes(t),t==="rl"),h=c(["td","bu"].includes(t),t==="td"),f=c(["zin","zout"].includes(t),t==="zout");n.forEach(p=>{p.fx=u(p),p.fy=h(p),p.fz=f(p)})}return Gw.includes(t)?WQ(c=>{const u=r[c.id];return(t==="radialin"?s-u.depth:u.depth)*l}).strength(1):null}function cue(n,e){let t;function i(){t?e(t):(t=n.step(),i())}i()}function q0(n){const e=[],t=[];return n.forEachNode((i,r)=>{e.push({...r,id:i,radius:r.size||1})}),n.forEachEdge((i,r)=>{t.push({...r,id:i})}),{nodes:e,edges:t}}function uue(){function n(F){return()=>F}function e(F){return F.index}let t=e,i=[],r=[],s,a=[100,100],o=n(1),l=n(-1),c=n(100),u=n(.1),h={},f=.1,p=.001,m=[],y=[0,0],v,A=F=>F.cluster,_="treemap",x=!0,E=.1;function w(F){if(!x)return w;_==="force"&&(v.tick(),U());for(let q=0,Y=i.length,H,V=F*E;qq.radius).sort(function(q,Y){return Y.height-q.height||Y.value-q.value}),m=F(s).leaves(),U()}function Q(){let F=0;i.length!==0&&r.forEach(function(q){let Y,H;if(i){if(Y=q.source,H=q.target,typeof q.source!="object"&&(Y=i.find(V=>V.id===q.source)),typeof q.target!="object"&&(H=i.find(V=>V.id===q.target)),Y===void 0||H===void 0)throw Error("Error setting links, couldnt find nodes for a link (see it on the console)");q.source=Y,q.target=H,q.index=F++}})}function G(){let F;if(!(!i||!i.length)){if(i&&i.length>0&&A(i[0])===void 0)throw Error('Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy("clusterAttr") before calling .links()');Q(),F=B(),v=Mb(F.nodes).force("x",Bb(a[0]/2).strength(.1)).force("y",Db(a[1]/2).strength(.1)).force("collide",Eb(q=>q.r).iterations(4)).force("charge",Rb().strength(l)).force("links",Sb(F.nodes.length?F.links:[]).distance(c).strength(u)),m=v.nodes(),U()}}return w.template=function(F){return arguments.length?(_=F,I(),w):_},w.groupBy=function(F){return arguments.length?typeof F=="string"?(A=function(q){return q[F]},w):(A=F,w):A},w.enableGrouping=function(F){return arguments.length?(x=F,w):x},w.strength=function(F){return arguments.length?(E=F,w):E},w.getLinkStrength=function(F){return x?A(F.source)===A(F.target)?typeof f=="function"?f(F):f:typeof p=="function"?p(F):p:typeof f=="function"?f(F):f},w.id=function(F){return arguments.length?(t=F,w):t},w.size=function(F){return arguments.length?(a=F,w):a},w.linkStrengthInterCluster=function(F){return arguments.length?(p=F,w):p},w.linkStrengthIntraCluster=function(F){return arguments.length?(f=F,w):f},w.nodes=function(F){return arguments.length?(i=F,w):i},w.links=function(F){return arguments.length?(F===null?r=[]:r=F,I(),w):r},w.template=function(F){return arguments.length?(_=F,I(),w):_},w.forceNodeSize=function(F){return arguments.length?(o=typeof F=="function"?F:n(+F),I(),w):o},w.nodeSize=w.forceNodeSize,w.forceCharge=function(F){return arguments.length?(l=typeof F=="function"?F:n(+F),I(),w):l},w.forceLinkDistance=function(F){return arguments.length?(c=typeof F=="function"?F:n(+F),I(),w):c},w.forceLinkStrength=function(F){return arguments.length?(u=typeof F=="function"?F:n(+F),I(),w):u},w.offset=function(F){return arguments.length?(y=typeof F=="function"?F:n(+F),w):y},w.getFocis=U,w}const hue=100;function El({graph:n,nodeLevelRatio:e=2,mode:t=null,dimensions:i=2,nodeStrength:r=-250,linkDistance:s=50,clusterStrength:a=.5,linkStrengthInterCluster:o=.01,linkStrengthIntraCluster:l=.5,forceLinkDistance:c=100,forceLinkStrength:u=.1,clusterType:h="force",forceCharge:f=-700,getNodePosition:p,drags:m,clusterAttribute:y}){const{nodes:v,edges:A}=q0(n),x=i===2&&A.length>25?r*2:r,E=Mb().force("link",Sb()).force("charge",Rb().strength(x)).force("x",Bb(1200/2).strength(.05)).force("y",Db(1200/2).strength(.05)).force("z",YQ()).force("collide",Eb(M=>M.radius)).force("dagRadial",lue({nodes:v,edges:A,mode:t,nodeLevelRatio:e})).stop();let w;y&&(w=uue().strength(a).template(h).groupBy(M=>M.data[y]).links(A).size([100,100]).linkStrengthInterCluster(o).linkStrengthIntraCluster(l).forceLinkDistance(c).forceLinkStrength(u).forceCharge(f).forceNodeSize(M=>M.radius));let I=E.numDimensions(i).nodes(v);if(w&&(I=I.force("group",w)),s){let M=I.force("link");M&&(M.id(b=>b.id).links(A).distance(s),w&&(M=M.strength((w==null?void 0:w.getLinkStrength)??.1)))}const T=new Map(v.map(M=>[M.id,M]));return{step(){return E.tick(hue),!0},getNodePosition(M){var b,B;if(p){const L=p(M,{graph:n,drags:m,nodes:v,edges:A});if(L)return L}return(b=m==null?void 0:m[M])!=null&&b.position?(B=m==null?void 0:m[M])==null?void 0:B.position:T.get(M)}}}function fue({graph:n,radius:e,drags:t,getNodePosition:i}){const r=UH(n,{scale:e}),{nodes:s,edges:a}=q0(n);return{step(){return!0},getNodePosition(o){var l,c;if(i){const u=i(o,{graph:n,drags:t,nodes:s,edges:a});if(u)return u}return(l=t==null?void 0:t[o])!=null&&l.position?(c=t==null?void 0:t[o])==null?void 0:c.position:r==null?void 0:r[o]}}}const due={td:{x:"x",y:"y",factor:-1},lr:{x:"y",y:"x",factor:1}};function zw({graph:n,drags:e,mode:t="td",getNodePosition:i}){const{nodes:r,edges:s}=q0(n),{depths:a}=rD(r,s),o=Object.keys(a).map(p=>a[p]),l=AH().id(p=>p.data.id).parentId(p=>{var m,y,v;return(v=(y=(m=p.ins)==null?void 0:m[0])==null?void 0:y.data)==null?void 0:v.id})(o),u=wH().separation(()=>1).nodeSize([50,50])(l1(l)).descendants(),h=due[t],f=new Map(r.map(p=>{const{x:m,y}=u.find(v=>v.data.id===p.id);return[p.id,{...p,[h.x]:m*h.factor,[h.y]:y*h.factor,z:0}]}));return{step(){return!0},getNodePosition(p){var m,y;if(i){const v=i(p,{graph:n,drags:e,nodes:r,edges:s});if(v)return v}return(m=e==null?void 0:e[p])!=null&&m.position?(y=e==null?void 0:e[p])==null?void 0:y.position:f.get(p)}}}function pue({graph:n,margin:e,drags:t,getNodePosition:i,ratio:r,gridSize:s,maxIterations:a}){const{nodes:o,edges:l}=q0(n),c=VH(n,{maxIterations:a,inputReducer:(u,h)=>({...h,x:h.x||0,y:h.y||0}),settings:{ratio:r,margin:e,gridSize:s}});return{step(){return!0},getNodePosition(u){var h,f;if(i){const p=i(u,{graph:n,drags:t,nodes:o,edges:l});if(p)return p}return(h=t==null?void 0:t[u])!=null&&h.position?(f=t==null?void 0:t[u])==null?void 0:f.position:c==null?void 0:c[u]}}}function gue({graph:n,drags:e,iterations:t,...i}){uV.assign(n);const r=sV(n,{iterations:t,settings:i});return{step(){return!0},getNodePosition(s){var a;return((a=e==null?void 0:e[s])==null?void 0:a.position)||(r==null?void 0:r[s])}}}function mue({graph:n,drags:e,getNodePosition:t}){const{nodes:i,edges:r}=q0(n);return{step(){return!0},getNodePosition(s){return t(s,{graph:n,drags:e,nodes:i,edges:r})}}}const Aue=["forceDirected2d","treeTd2d","treeLr2d","radialOut2d","treeTd3d","treeLr3d","radialOut3d","forceDirected3d"];function vue({type:n,...e}){if(Aue.includes(n)){const{nodeStrength:t,linkDistance:i,nodeLevelRatio:r}=e;if(n==="forceDirected2d")return El({...e,dimensions:2,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:i});if(n==="treeTd2d")return El({...e,mode:"td",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:i||50});if(n==="treeLr2d")return El({...e,mode:"lr",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-250,linkDistance:i||50});if(n==="radialOut2d")return El({...e,mode:"radialout",dimensions:2,nodeLevelRatio:r||5,nodeStrength:t||-500,linkDistance:i||100});if(n==="treeTd3d")return El({...e,mode:"td",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||50});if(n==="treeLr3d")return El({...e,mode:"lr",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||50});if(n==="radialOut3d")return El({...e,mode:"radialout",dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-500,linkDistance:i||100});if(n==="forceDirected3d")return El({...e,dimensions:3,nodeLevelRatio:r||2,nodeStrength:t||-250,linkDistance:i})}else if(n==="circular2d"){const{radius:t}=e;return fue({...e,radius:t||300})}else{if(n==="hierarchicalTd")return zw({...e,mode:"td"});if(n==="hierarchicalLr")return zw({...e,mode:"lr"});if(n==="nooverlap"){const{graph:t,maxIterations:i,ratio:r,margin:s,gridSize:a,...o}=e;return pue({type:"nooverlap",graph:t,margin:s||10,maxIterations:i||50,ratio:r||10,gridSize:a||20,...o})}else if(n==="forceatlas2"){const{graph:t,iterations:i,gravity:r,scalingRatio:s,...a}=e;return gue({type:"forceatlas2",graph:t,...a,scalingRatio:s||100,gravity:r||10,iterations:i||50})}else if(n==="custom")return mue({type:"custom",...e})}throw new Error(`Layout ${n} not found.`)}function yue({graph:n}){const e=AV(n);return{ranks:e,getSizeForNode:t=>e[t]*80}}function xue({graph:n}){const e=_V(n);return{ranks:e,getSizeForNode:t=>e[t]*20}}function _ue({graph:n,attribute:e,defaultSize:t}){const i=new Map;return e?n.forEachNode((r,s)=>{var a;const o=(a=s.data)==null?void 0:a[e];isNaN(o)&&console.warn(`Attribute ${o} is not a number for node ${s.id}`),i.set(r,o||0)}):console.warn("Attribute sizing configured but no attribute provided"),{getSizeForNode:r=>!e||!i?t:i.get(r)}}const Qw={pagerank:yue,centrality:xue,attribute:_ue,none:({defaultSize:n})=>({getSizeForNode:e=>n})};function Eue({type:n,...e}){var t;const i=(t=Qw[n])==null?void 0:t.call(Qw,e);if(!i&&n!=="default")throw new Error(`Unknown sizing strategy: ${n}`);const{graph:r,minSize:s,maxSize:a}=e,o=new Map;let l,c;if(r.forEachNode((u,h)=>{let f;n==="default"?f=h.size||e.defaultSize:f=i.getSizeForNode(u),(l===void 0||fc)&&(c=f),o.set(u,f)}),n!=="none"){const u=tI().domain([l,c]).rangeRound([s,a]);for(const[h,f]of o)o.set(h,u(f))}return o}const Sue=20;function wue(n,e){return(t,i)=>e==="all"||e==="nodes"&&t==="node"||e==="edges"&&t==="edge"?!0:e==="auto"&&t==="node"?n<=Sue?!0:i>7:!1}function sD(n,e){switch(e){case"above":return n;case"below":return-n;case"inline":case"natural":default:return 0}}function Cue(n,e,t){n.clear();for(const i of e)try{n.addNode(i.id,i)}catch({message:r}){console.error(`[Graph] ${r}`)}for(const i of t)try{n.addEdge(i.source,i.target,i)}catch({message:r}){console.error(`[Graph] ${r}`)}return n}function Tue({graph:n,layout:e,sizingType:t,labelType:i,sizingAttribute:r,defaultNodeSize:s,minNodeSize:a,maxNodeSize:o}){const l=[],c=[],u=new Map,h=Eue({graph:n,type:t,attribute:r,minSize:a,maxSize:o,defaultSize:s}),f=n.nodes.length,p=wue(f,i);return n.forEachNode((m,y)=>{const v=e.getNodePosition(m),{data:A,fill:_,icon:x,label:E,size:w,...I}=y,T=h.get(y.id),M=p("node",T),B=(n.inboundNeighbors(y.id)||[]).map(U=>n.getNodeAttributes(U)),L={...y,size:T,labelVisible:M,label:E,icon:x,fill:_,parents:B,data:{...I,...A??{}},position:{...v,x:v.x||0,y:v.y||0,z:v.z||1}};u.set(y.id,L),l.push(L)}),n.forEachEdge((m,y)=>{const v=u.get(y.source),A=u.get(y.target);if(v&&A){const{data:_,id:x,label:E,size:w,...I}=y,T=p("edge",w);c.push({...y,id:x,label:E,labelVisible:T,size:w,data:{...I,id:x,..._||{}}})}}),{nodes:l,edges:c}}const qs={mass:10,tension:1e3,friction:300,precision:.1};function aD(n,e,t){const i=e.getLength(),r=n==="end"?i:i/2,s=n==="end"?t/2:0,a=(r-s)/i,o=e.getPointAt(a),l=e.getTangentAt(a);return[o,l]}function oD(n){return[n+6,2+n/1.5]}function lD(n,e,t=0){const i=new N(n.x,n.y||0,n.z||0),r=new N(e.x,e.y||0,e.z||0),s=new N().addVectors(i,r).divideScalar(2);return s.setLength(s.length()+t)}function bue(n,e,t=-1){const i=n.clone(),r=e.clone(),s=new N().subVectors(r,i),a=s.length(),o=s.clone().normalize(),l=new N().subVectors(r,i).divideScalar(2),c=Math.abs(o.x)%1,u=new N(-o.y,o.x-c*o.z,c*o.y).normalize(),h=new N().add(i).add(l).add(u.multiplyScalar(a/4).multiplyScalar(t));return[n,h,e]}function r0(n,e,t,i,r){const s=Hw(n,t,e),a=Hw(t,n,i);return r?new V2(...bue(s,a)):new Q6(s,a)}function s0(n){return new N(n.position.x,n.position.y,n.position.z||0)}function Hw(n,e,t){const i=n.distanceTo(e);return n.clone().add(e.clone().sub(n).multiplyScalar(t/i))}function Vw(n,e){return{...n,position:{...n.position,x:n.position.x+e.x,y:n.position.y+e.y,z:n.position.z+e.z}}}function A6(n){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.NEGATIVE_INFINITY;for(let o of n)e=Math.min(e,o.position.x),t=Math.max(t,o.position.x),i=Math.min(i,o.position.y),r=Math.max(r,o.position.y),s=Math.min(s,o.position.z),a=Math.max(a,o.position.z);return{height:r-i,width:t-e,minX:e,maxX:t,minY:i,maxY:r,minZ:s,maxZ:a,x:(t+e)/2,y:(r+i)/2,z:(a+s)/2}}function Iue(n,e){return e?n.reduce((t,i)=>{const r=i.data[e];return t.set(r,[...t.get(r)||[],i]),t},new Map):new Map}function Mue({nodes:n,clusterAttribute:e}){const t=new Map;if(e){const i=Iue(n,e);for(const[r,s]of i){const a=A6(s);t.set(r,{label:r,nodes:s,position:a})}}return t}const F8=({sensitivity:n=7,interval:e=50,timeout:t=0,disabled:i,onPointerOver:r,onPointerOut:s})=>{const a=$.useRef(!1),o=$.useRef(null),l=$.useRef(0),c=$.useRef({x:null,y:null,px:null,py:null}),u=$.useCallback(v=>{c.current.x=v.clientX,c.current.y=v.clientY},[]),h=$.useCallback(v=>{o.current=clearTimeout(o.current);const{px:A,x:_,py:x,y:E}=c.current;Math.abs(A-_)+Math.abs(x-E)h(v),e))},[e,r,n]),f=$.useCallback(()=>{clearTimeout(o.current),document.removeEventListener("mousemove",u,!1)},[u]),p=$.useCallback(v=>{i||(a.current=!0,f(),l.current!==1&&(c.current.px=v.pointer.x,c.current.py=v.pointer.y,document.addEventListener("mousemove",u,!1),o.current=setTimeout(()=>h(v),t)))},[f,h,i,u,t]),m=$.useCallback(v=>{o.current=clearTimeout(o.current),l.current=0,s(v)},[s]),y=$.useCallback(v=>{a.current=!1,f(),l.current===1&&(o.current=setTimeout(()=>m(v),t))},[f,m,t]);return{pointerOver:p,pointerOut:y}},Rue=({draggable:n,set:e,position:t,onDragStart:i,onDragEnd:r})=>{const s=Cr(y=>y.camera),a=Cr(y=>y.raycaster),o=Cr(y=>y.size),l=Cr(y=>y.gl),{mouse2D:c,mouse3D:u,offset:h,normal:f,plane:p}=$.useMemo(()=>({mouse2D:new _e,mouse3D:new N,offset:new N,normal:new N,plane:new rs}),[]),m=$.useMemo(()=>l.domElement.getBoundingClientRect(),[l.domElement]);return OY({onDragStart:({event:y})=>{const{eventObject:v,point:A}=y;v.getWorldPosition(h).sub(A),u.copy(A),i()},onDrag:({event:y})=>{const v=(y.clientX-((m==null?void 0:m.left)??0))/o.width*2-1,A=-((y.clientY-((m==null?void 0:m.top)??0))/o.height)*2+1;c.set(v,A),a.setFromCamera(c,s),s.getWorldDirection(f).negate(),p.setFromNormalAndCoplanarPoint(f,u),a.ray.intersectPlane(p,u);const _=new N(t.x,t.y,t.z).copy(u).add(h);return e(_)},onDragEnd:r},{drag:{enabled:n,threshold:10}})},{Provider:Bue,useStore:ft}=XW(),Due=({actives:n=[],selections:e=[],collapsedNodeIds:t=[],theme:i})=>qW(r=>({theme:i,edges:[],nodes:[],collapsedNodeIds:t,clusters:new Map,panning:!1,draggingId:null,actives:n,edgeContextMenus:new Set,edgeMeshes:[],selections:e,drags:{},graph:new In,setTheme:s=>r(a=>({...a,theme:s})),setClusters:s=>r(a=>({...a,clusters:s})),setEdgeContextMenus:s=>r(a=>({...a,edgeContextMenus:s})),setEdgeMeshes:s=>r(a=>({...a,edgeMeshes:s})),setPanning:s=>r(a=>({...a,panning:s})),setDrags:s=>r(a=>({...a,drags:s})),setDraggingId:s=>r(a=>({...a,draggingId:s})),setActives:s=>r(a=>({...a,actives:s})),setSelections:s=>r(a=>({...a,selections:s})),setNodes:s=>r(a=>({...a,nodes:s})),setEdges:s=>r(a=>({...a,edges:s})),setNodePosition:(s,a)=>r(o=>{var l,c;const u=o.nodes.find(y=>y.id===s),h=s0(u),p=new N(a.x,a.y,a.z).sub(h),m=[...o.nodes];if((l=o.selections)!=null&&l.includes(s))(c=o.selections)==null||c.forEach(y=>{const v=o.nodes.find(A=>A.id===y);if(v){const A=o.nodes.indexOf(v);m[A]=Vw(v,p)}});else{const y=o.nodes.indexOf(u);m[y]=Vw(u,p)}return{...o,drags:{...o.drags,[s]:u},nodes:m}}),setCollapsedNodeIds:(s=[])=>r(a=>({...a,collapsedNodeIds:s}))}));function cD({nodeId:n,nodes:e,edges:t,currentHiddenNodes:i,currentHiddenEdges:r}){const s=[],a=[],o=i.map(p=>p.id),l=r.map(p=>p.id),c=t.filter(p=>p.source===n),u=c.map(p=>p.target);a.push(...c);for(const p of u){const m=t.filter(v=>v.target===p&&v.source!==n);let y=!1;if((m.length===0||m.length>0&&!o.includes(p)&&m.map(A=>A.id).every(A=>l.includes(A)))&&(y=!0),y){const v=e.find(_=>_.id===p);v&&s.push(v);const A=cD({nodeId:p,nodes:e,edges:t,currentHiddenEdges:a,currentHiddenNodes:s});a.push(...A.hiddenEdges),s.push(...A.hiddenNodes)}}const h=Object.values(a.reduce((p,m)=>({...p,[m.id]:m}),{})),f=Object.values(s.reduce((p,m)=>({...p,[m.id]:m}),{}));return{hiddenEdges:h,hiddenNodes:f}}const Pue=({collapsedIds:n,nodes:e,edges:t})=>{const i=[],r=[];for(const c of n){const{hiddenEdges:u,hiddenNodes:h}=cD({nodeId:c,nodes:e,edges:t,currentHiddenEdges:r,currentHiddenNodes:i});i.push(...h),r.push(...u)}const s=i.map(c=>c.id),a=r.map(c=>c.id),o=e.filter(c=>!s.includes(c.id)),l=t.filter(c=>!a.includes(c.id));return{visibleNodes:o,visibleEdges:l}},Lue=({layoutType:n,sizingType:e,labelType:t,sizingAttribute:i,clusterAttribute:r,selections:s,nodes:a,edges:o,actives:l,collapsedNodeIds:c,defaultNodeSize:u,maxNodeSize:h,minNodeSize:f,layoutOverrides:p})=>{const m=ft(F=>F.graph),y=ft(F=>F.setClusters),v=ft(F=>F.collapsedNodeIds),A=ft(F=>F.setEdges),_=ft(F=>F.setNodes),x=ft(F=>F.setSelections),E=ft(F=>F.setActives),w=ft(F=>F.drags),I=ft(F=>F.setDrags),T=ft(F=>F.setCollapsedNodeIds),[M,b]=$.useState(!1),B=$.useRef(!1),L=$.useRef(null),{visibleEdges:U,visibleNodes:O}=$.useMemo(()=>{const{visibleEdges:F,visibleNodes:q}=Pue({collapsedIds:v,nodes:a,edges:o});return{visibleEdges:F,visibleNodes:q}},[v,a,o]),Q=$.useRef(w);$.useEffect(()=>{Q.current=w},[w]);const G=$.useCallback(F=>{L.current=F||vue({...p,type:n,graph:m,drags:Q.current,clusterAttribute:r}),cue(L.current,()=>{const q=Tue({graph:m,layout:L.current,sizingType:e,labelType:t,sizingAttribute:i,maxNodeSize:h,minNodeSize:f,defaultNodeSize:u}),Y=Mue({nodes:q.nodes,clusterAttribute:r});A(q.edges),_(q.nodes),y(Y)})},[p,y,n,m,r,e,t,i,h,f,u,A,_]);return $.useEffect(()=>{x(s)},[s,x]),$.useEffect(()=>{E(l)},[l,E]),$.useLayoutEffect(()=>{B.current=!1,Cue(m,O,U),G(),requestAnimationFrame(()=>{B.current=!0,b(!0)})},[O,U,m]),$.useEffect(()=>{T(c)},[c,T]),$.useEffect(()=>{B.current&&(Q.current={},I({}),G())},[m,n,G,I]),$.useEffect(()=>{B.current&&G(L.current)},[m,e,i,t,G]),{mounted:M}},X0=({text:n,fontSize:e,fontUrl:t,color:i,opacity:r,stroke:s,active:a,ellipsis:o})=>{const l=o&&!a?Zce(n,o):n,c=$.useMemo(()=>new He(i),[i]),u=$.useMemo(()=>s?new He(s):void 0,[s]);return Ne.jsx(NB,{position:[0,0,1],children:Ne.jsx(qce,{font:t,fontSize:e,color:c,fillOpacity:r,textAlign:"center",outlineWidth:s?1:0,outlineColor:u,depthOffset:0,maxWidth:100,overflowWrap:"break-word",children:l})})};X0.defaultProps={opacity:1,fontSize:7,color:"#2A6475",ellipsis:75};const uD=({color:n,id:e,size:t,opacity:i,animated:r})=>{const{scale:s,nodeOpacity:a}=Vs({from:{scale:[1e-5,1e-5,1e-5],nodeOpacity:0},to:{scale:[t,t,t],nodeOpacity:i},config:{...qs,duration:r?void 0:0}}),o=$.useMemo(()=>new He(n),[n]);return Ne.jsxs(mi.mesh,{userData:{id:e,type:"node"},scale:s,children:[Ne.jsx("sphereGeometry",{attach:"geometry",args:[1,25,25]}),Ne.jsx(mi.meshPhongMaterial,{attach:"material",side:$n,transparent:!0,fog:!0,opacity:a,color:o})]})};uD.defaultProps={opacity:1,active:!1};const hD=({color:n,size:e,opacity:t,animated:i})=>{const r=$.useMemo(()=>new He(n),[n]),{ringSize:s,ringOpacity:a}=Vs({from:{ringOpacity:0,ringSize:[1e-5,1e-5,1e-5]},to:{ringOpacity:t,ringSize:[e/2,e/2,1]},config:{...qs,duration:i?void 0:0}});return Ne.jsx(NB,{position:[0,0,1],children:Ne.jsxs(mi.mesh,{scale:s,children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[4,4.5,25]}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",color:r,transparent:!0,depthTest:!1,opacity:a,side:$n,fog:!0})]})})};hD.defaultProps={color:"#D8E6EA",size:1,opacity:.5};const fD=$.createContext({controls:null,resetControls:()=>{},zoomIn:()=>{},zoomOut:()=>{},panLeft:()=>{},panRight:()=>{},panUp:()=>{},panDown:()=>{}}),k8=()=>{const n=$.useContext(fD);if(n===void 0)throw new Error("`useCameraControls` hook must be used within a `ControlsProvider` component");return n};Tl.install({THREE:{MOUSE:iC,Vector2:_e,Vector3:N,Vector4:jt,Quaternion:$i,Matrix4:ct,Spherical:YT,Box3:gs,Sphere:ms,Raycaster:r4,MathUtils:{DEG2RAD:(kw=Ll)==null?void 0:kw.DEG2RAD,clamp:(Nw=Ll)==null?void 0:Nw.clamp}}});tb({ThreeCameraControls:Tl});const J1={ARROW_LEFT:37,ARROW_UP:38,ARROW_RIGHT:39,ARROW_DOWN:40},Ww=new $1(J1.ARROW_LEFT,100),Yw=new $1(J1.ARROW_RIGHT,100),qw=new $1(J1.ARROW_UP,100),Xw=new $1(J1.ARROW_DOWN,100),dD=$.forwardRef(({mode:n,children:e,animated:t,disabled:i},r)=>{const s=$.useRef(null),a=Cr(x=>x.camera),o=Cr(x=>x.gl),l=n==="orbit",c=ft(x=>x.setPanning);a1((x,E)=>{var w,I;(w=s.current)!=null&&w.enabled&&((I=s.current)==null||I.update(E)),l&&(s.current.azimuthAngle+=20*E*Ll.DEG2RAD)},-1),$.useEffect(()=>()=>{var x;return(x=s.current)==null?void 0:x.dispose()},[]);const u=$.useCallback(()=>{var x;(x=s.current)==null||x.zoom(a.zoom/2,t)},[t,a.zoom]),h=$.useCallback(()=>{var x;(x=s.current)==null||x.zoom(-a.zoom/2,t)},[t,a.zoom]),f=$.useCallback(x=>{var E;l||(E=s.current)==null||E.truck(-.03*x.deltaTime,0,t)},[t,l]),p=$.useCallback(x=>{var E;l||(E=s.current)==null||E.truck(.03*x.deltaTime,0,t)},[t,l]),m=$.useCallback(x=>{var E;l||(E=s.current)==null||E.truck(0,.03*x.deltaTime,t)},[t,l]),y=$.useCallback(x=>{var E;l||(E=s.current)==null||E.truck(0,-.03*x.deltaTime,t)},[t,l]),v=$.useCallback(x=>{x.code==="Space"&&(n==="rotate"?s.current.mouseButtons.left=Tl.ACTION.TRUCK:s.current.mouseButtons.left=Tl.ACTION.ROTATE)},[n]),A=$.useCallback(x=>{x.code==="Space"&&(n==="rotate"?s.current.mouseButtons.left=Tl.ACTION.ROTATE:s.current.mouseButtons.left=Tl.ACTION.TRUCK)},[n]);$.useEffect(()=>(Ww.addEventListener("holding",p),Yw.addEventListener("holding",f),qw.addEventListener("holding",m),Xw.addEventListener("holding",y),window.addEventListener("keydown",v),window.addEventListener("keyup",A),()=>{Ww.removeEventListener("holding",p),Yw.removeEventListener("holding",f),qw.removeEventListener("holding",m),Xw.removeEventListener("holding",y),window.removeEventListener("keydown",v),window.removeEventListener("keyup",A)}),[v,A,y,p,f,m]),$.useEffect(()=>{const x=()=>c(!0),E=()=>c(!1),w=s.current;return w&&(w.addEventListener("control",x),w.addEventListener("controlend",E)),()=>{w&&(w.removeEventListener("control",x),w.removeEventListener("controlend",E))}},[s,c]),$.useEffect(()=>{n==="rotate"?s.current.mouseButtons.left=Tl.ACTION.ROTATE:s.current.mouseButtons.left=Tl.ACTION.TRUCK},[n]),nD([{name:"Zoom In",category:"Graph",keys:"command+shift+i",callback:x=>{x.preventDefault(),u()}},{name:"Zoom Out",category:"Graph",keys:"command+shift+o",callback:x=>{x.preventDefault(),h()}}]);const _=$.useMemo(()=>({controls:s.current,zoomIn:()=>u(),zoomOut:()=>h(),panLeft:()=>p({deltaTime:1}),panRight:()=>f({deltaTime:1}),panDown:()=>y({deltaTime:1}),panUp:()=>m({deltaTime:1}),resetControls:x=>{var E;return(E=s.current)==null?void 0:E.reset(x)}}),[u,h,p,f,y,m,s.current]);return $.useImperativeHandle(r,()=>_),Ne.jsxs(fD.Provider,{value:_,children:[Ne.jsx("threeCameraControls",{ref:s,args:[a,o.domElement],enabled:!i,smoothTime:.1,minDistance:1e3,maxDistance:5e4}),e]})});dD.defaultProps={mode:"rotate"};const L5=50,Uue=({animated:n})=>{const e=ft(l=>l.nodes),t=Cr(l=>l.invalidate),{controls:i}=k8(),r=$.useMemo(()=>{const{maxX:l,maxY:c}=A6(e);return Math.max(l,c)},[e]),s=$.useCallback((l,c=L5,u=!1)=>{const{minX:h,maxX:f,minY:p,maxY:m,minZ:y,maxZ:v}=A6(l);i==null||i.fitToBox(new gs(new N(h,p,y),new N(f,m,v)),n,{cover:u,paddingLeft:c,paddingRight:c,paddingBottom:c,paddingTop:c}),t()},[t,i,n]),a=$.useCallback(l=>{let c=null,u=L5;l!=null&&l.length&&(u=r+L5,c=l.reduce((h,f)=>{const p=e.find(m=>m.id===f);if(p)h.push(p);else throw new Error(`Attempted to center ${f} but it was not found in the nodes`);return h},[])),s(c||e,u,!!c)},[s,e,r]),o=$.useRef(!1);return $.useLayoutEffect(()=>{i&&(e!=null&&e.length)&&!o.current&&(s(e),o.current=!0)},[i,s,e]),nD([{name:"Center",category:"Graph",keys:["command+shift+c"],callback:()=>s(e)}]),{centerNodes:s,centerNodesById:a}},pD=({image:n,id:e,size:t,opacity:i,animated:r})=>{const s=$.useMemo(()=>new LT().load(n),[n]),{scale:a,spriteOpacity:o}=Vs({from:{scale:[1e-5,1e-5,1e-5],spriteOpacity:0},to:{scale:[t,t,t],spriteOpacity:i},config:{...qs,duration:r?void 0:0}});return Ne.jsx(mi.sprite,{userData:{id:e,type:"node"},scale:a,children:Ne.jsx(mi.spriteMaterial,{attach:"material",opacity:o,fog:!0,depthTest:!1,transparent:!0,side:$n,children:Ne.jsx("primitive",{attach:"map",object:s,minFilter:Tn})})})};pD.defaultProps={opacity:1};const gD=({animated:n,disabled:e,id:t,draggable:i,labelFontUrl:r,contextMenu:s,onClick:a,onPointerOver:o,onDragged:l,onPointerOut:c,onContextMenu:u,renderNode:h})=>{const f=k8(),p=ft(ce=>ce.theme),m=ft(ce=>ce.nodes.find(ye=>ye.id===t)),y=ft(ce=>ce.edges),v=ft(ce=>ce.draggingId),A=ft(ce=>ce.collapsedNodeIds),_=ft(ce=>ce.setDraggingId),x=ft(ce=>ce.setNodePosition),E=ft(ce=>ce.setCollapsedNodeIds),w=ft(ce=>ce.collapsedNodeIds.includes(t)),I=ft(ce=>{var ye;return(ye=ce.actives)==null?void 0:ye.includes(t)}),T=ft(ce=>{var ye;return(ye=ce.selections)==null?void 0:ye.includes(t)}),M=ft(ce=>{var ye;return((ye=ce.selections)==null?void 0:ye.length)>0}),b=v===t,{position:B,label:L,size:U=7,labelVisible:O=!0}=m,Q=$.useRef(null),[G,F]=$.useState(!1),[q,Y]=$.useState(!1),H=M?T||G||I?p.node.selectedOpacity:p.node.inactiveOpacity:p.node.opacity,V=$.useMemo(()=>y.filter(ye=>ye.source===t).length>0||w,[y,t,w]),D=$.useCallback(()=>{V&&E(w?A.filter(ce=>ce!==t):[...A,t])},[V,A,t,w,E]),[{nodePosition:k,labelPosition:Z}]=Vs(()=>({from:{nodePosition:[0,0,0],labelPosition:[0,-(U+7),2]},to:{nodePosition:B?[B.x,B.y,B.z]:[0,0,0],labelPosition:[0,-(U+7),2]},config:{...qs,duration:n&&!v?void 0:0}}),[b,B,n,U]),j=Rue({draggable:i,position:B,set:ce=>x(t,ce),onDragStart:()=>{_(t),F(!0),f.controls.enabled=!1},onDragEnd:()=>{_(null),F(!1),f.controls.enabled=!0,l==null||l(m)}});np(G&&!v&&a!==void 0,"pointer"),np(G&&i&&!b&&a===void 0,"grab"),np(b,"grabbing");const ee=T||G||b||I,ie=ee?p.node.activeFill:m.fill||p.node.fill,{pointerOver:te,pointerOut:re}=F8({disabled:e||b,onPointerOver:()=>{F(!0),o==null||o(m)},onPointerOut:()=>{F(!1),c==null||c(m)}});return Ne.jsxs(mi.group,{userData:{id:t,type:"node"},ref:Q,position:k,onPointerOver:te,onPointerOut:re,onClick:()=>{!e&&!b&&(a==null||a(m,{canCollapse:V,isCollapsed:w}))},onContextMenu:()=>{e||(Y(!0),u==null||u(m,{canCollapse:V,isCollapsed:w,onCollapse:D}))},...j(),children:[h?h({id:t,color:ie,size:U,active:ee,opacity:H,animated:n,node:m}):Ne.jsx(Ne.Fragment,{children:m.icon?Ne.jsx(pD,{id:t,image:m.icon||"",size:U+8,opacity:H,animated:n,color:ie,node:m,active:ee}):Ne.jsx(uD,{id:t,size:U,opacity:H,animated:n,color:ie,node:m,active:ee})}),Ne.jsx(hD,{opacity:T?.5:0,size:U,animated:n,color:T||G?p.ring.activeFill:p.ring.fill}),q&&s&&Ne.jsx(N4,{prepend:!0,center:!0,children:s({data:m,canCollapse:V,isCollapsed:w,onCollapse:D,onClose:()=>Y(!1)})}),(O||T||G)&&L&&Ne.jsx(mi.group,{position:Z,children:Ne.jsx(X0,{text:L,fontUrl:r,opacity:H,stroke:p.node.label.stroke,active:T||G||b||I,color:T||G||b||I?p.node.label.activeColor:p.node.label.color})})]})};gD.defaultProps={draggable:!1};const mD=({animated:n,color:e,length:t,opacity:i,position:r,rotation:s,size:a,onActive:o,onContextMenu:l})=>{const c=$.useMemo(()=>new He(e),[e]),u=$.useRef(null),h=ft(y=>y.draggingId),[{pos:f,arrowOpacity:p}]=Vs(()=>({from:{pos:[0,0,0],arrowOpacity:0},to:{pos:[r.x,r.y,r.z],arrowOpacity:i},config:{...qs,duration:n&&!h?void 0:0}}),[n,h,i,r]),m=$.useCallback(()=>{var y;const v=new N(0,1,0);(y=u.current)==null||y.quaternion.setFromUnitVectors(v,s)},[s,u]);return $.useEffect(()=>m(),[m]),Ne.jsxs(mi.mesh,{position:f,ref:u,scale:[1,1,1],onPointerOver:()=>o(!0),onPointerOut:()=>o(!1),onPointerDown:y=>{y.nativeEvent.buttons===2&&(y.stopPropagation(),l())},children:[Ne.jsx("cylinderGeometry",{args:[0,a,t,20,1,!0],attach:"geometry"}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",color:c,depthTest:!1,opacity:p,transparent:!0,side:$n,fog:!0})]})};mD.defaultProps={size:1,opacity:.5,color:"#D8E6EA"};const AD=({animated:n,color:e,curve:t,curved:i=!1,id:r,opacity:s,size:a,onContextMenu:o,onClick:l,onPointerOver:c,onPointerOut:u})=>{const h=$.useRef(null),f=ft(y=>y.draggingId),p=$.useMemo(()=>new He(e),[e]),{lineOpacity:m}=Vs({from:{lineOpacity:0},to:{lineOpacity:s},config:{...qs,duration:n?void 0:0}});return Vs(()=>{const y=t.getPoint(0),v=t.getPoint(1);return{from:{fromVertices:[0,0,0],toVertices:[0,0,0]},to:{fromVertices:[y==null?void 0:y.x,y==null?void 0:y.y,(y==null?void 0:y.z)||0],toVertices:[v==null?void 0:v.x,v==null?void 0:v.y,(v==null?void 0:v.z)||0]},onChange:A=>{const{fromVertices:_,toVertices:x}=A.value,E=new N(..._),w=new N(...x),I=r0(E,0,w,0,i);h.current.copy(new su(I,20,a/2,5,!1))},config:{...qs,duration:n&&!f?void 0:0}}},[n,f,t,a]),Ne.jsxs("mesh",{userData:{id:r,type:"edge"},onPointerOver:c,onPointerOut:u,onClick:l,onPointerDown:y=>{y.nativeEvent.buttons===2&&(y.stopPropagation(),o())},children:[Ne.jsx("tubeGeometry",{attach:"geometry",ref:h}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",opacity:m,fog:!0,transparent:!0,depthTest:!1,color:p})]})};AD.defaultProps={color:"#000",size:1,opacity:1};const S2=6,vD=({animated:n,arrowPlacement:e,contextMenu:t,disabled:i,labelPlacement:r,id:s,interpolation:a,labelFontUrl:o,onContextMenu:l,onClick:c,onPointerOver:u,onPointerOut:h})=>{const f=ft(ie=>ie.theme),p=ft(ie=>ie.edges.find(te=>te.id===s)),{target:m,source:y,label:v,labelVisible:A=!1,size:_=1}=p,x=a==="curved",E=ft(ie=>ie.nodes.find(te=>te.id===y)),w=ft(ie=>ie.nodes.find(te=>te.id===m)),I=ft(ie=>ie.draggingId),[T,M]=$.useState(!1),[b,B]=$.useState(!1),L=(_+S2)/2,[U,O]=$.useMemo(()=>oD(_),[_]),[Q,G,F]=$.useMemo(()=>{const ie=s0(E),te=E.size,re=s0(w),ce=w.size;let ye=r0(ie,te,re,ce,x);const[oe,W]=aD(e,ye,U);return e==="end"&&(ye=r0(ie,te,oe,0,x)),[ye,oe,W]},[x,E,w,e,U]),q=$.useMemo(()=>lD(E.position,w.position,sD(L,r)),[E.position,w.position,L,r]),Y=ft(ie=>{var te;return(te=ie.selections)==null?void 0:te.includes(s)}),H=ft(ie=>{var te;return(te=ie.selections)==null?void 0:te.length}),V=ft(ie=>{var te;return(te=ie.actives)==null?void 0:te.includes(s)}),D=H?Y||V?f.edge.selectedOpacity:f.edge.inactiveOpacity:f.edge.opacity,[{labelPosition:k}]=Vs(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[q.x,q.y,q.z]},config:{...qs,duration:n&&!I?void 0:0}}),[q,n,I]),Z=$.useMemo(()=>new vu(0,0,r==="natural"?0:Math.atan((w.position.y-E.position.y)/(w.position.x-E.position.x))),[w.position.x,w.position.y,E.position.x,E.position.y,r]);np(T&&!I&&c!==void 0,"pointer");const{pointerOver:j,pointerOut:ee}=F8({disabled:i,onPointerOver:()=>{M(!0),u==null||u(p)},onPointerOut:()=>{M(!1),h==null||h(p)}});return Ne.jsxs("group",{children:[Ne.jsx(AD,{animated:n,color:Y||T||V?f.edge.activeFill:f.edge.fill,curve:Q,curved:x,id:s,opacity:D,size:_,onClick:()=>{i||c==null||c(p)},onPointerOver:j,onPointerOut:ee,onContextMenu:()=>{i||(B(!0),l==null||l(p))}}),e!=="none"&&Ne.jsx(mD,{animated:n,color:Y||T||V?f.arrow.activeFill:f.arrow.fill,length:U,opacity:D,position:G,rotation:F,size:O,onActive:M,onContextMenu:()=>{i||(B(!0),l==null||l(p))}}),A&&v&&Ne.jsx(mi.group,{position:k,rotation:Z,children:Ne.jsx(X0,{text:v,ellipsis:15,fontUrl:o,stroke:f.edge.label.stroke,color:Y||T||V?f.edge.label.activeColor:f.edge.label.color,opacity:D,fontSize:S2})}),b&&t&&Ne.jsx(N4,{prepend:!0,center:!0,children:t({data:p,onClose:()=>B(!1)})})]})};vD.defaultProps={labelPlacement:"inline",arrowPlacement:"end"};const jw=new qo(0,0,0);function Oue(n,e){const t=$.useRef();ft(o=>{t.current=o});const i=$.useRef(new Map),r=e==="curved",s=$.useCallback(o=>{const l=[],c=i.current,{nodes:u}=t.current;return o.forEach(h=>{const{target:f,source:p,size:m=1}=h,y=u.find(G=>G.id===p),v=u.find(G=>G.id===f);if(!y||!v)return;const A=`fromX:${y.position.x},fromY:${y.position.y},toX:${v.position.x}},toY:${v.position.y}`;if(c.has(A)){const G=c.get(A);l.push(G);return}const _=s0(y),x=y.size+S2,E=s0(v),w=v.size+S2;let I=r0(_,x,E,w,r),T=new su(I,20,m/2,5,!1);if(n==="none"){l.push(T),c.set(A,T);return}const[M,b]=oD(m),[B,L]=aD(n,I,M),U=new $i;U.setFromUnitVectors(new N(0,1,0),L);const O=new yu(0,b,M,20,1,!0);if(O.applyQuaternion(U),O.translate(B.x,B.y,B.z),n&&n==="end"){const G=r0(_,x,B,0,r);T=new su(G,20,m/2,5,!1)}const Q=Vg([T,O]);l.push(Q),c.set(A,Q)}),l},[n,r]),a=$.useCallback((o,l)=>{const c=s(o),u=s(l);return Vg([u.length?Vg(u):jw,c.length?Vg(c):jw],!0)},[s]);return{getGeometries:s,getGeometry:a}}function Fue(n,e,t){const{onClick:i,onContextMenu:r,onPointerOut:s,onPointerOver:a}=n,o=ft(m=>m.edgeContextMenus),l=ft(m=>m.setEdgeContextMenus),c=$.useRef(!1),u=$.useCallback(()=>{c.current=!0},[]),h=$.useRef(!1),f=$.useCallback(()=>{h.current=!0},[]),p=$.useCallback((m,y)=>{i&&c.current&&(c.current=!1,t||y.forEach(v=>{i(v)})),(e||r)&&h.current&&(h.current=!1,t||y.forEach(v=>{o.has(v.id)||(l(new Set([...o,v.id])),r==null||r(v))})),a&&y.filter(A=>!m.includes(A)).forEach(A=>{a(A)}),s&&m.filter(A=>!y.includes(A)).forEach(A=>{s(A)})},[e,t,o,l,i,r,a,s]);return{handleClick:u,handleContextMenu:f,handleIntersections:p}}function kue(n,e){const t=$.useRef(n);$.useEffect(()=>{t.current=n},[n]);const i=$.useCallback(()=>{const s=t.current.getAttribute("position"),a=Array.from({length:s.array.length}).fill(0),o=Array.from(s.array);return{from:a,to:o}},[]),r=$.useCallback(s=>{const a=new Float32Array(s),o=new En(a,3,!1);t.current.setAttribute("position",o),o.needsUpdate=!0},[]);Vs(()=>{if(!e)return null;const s=i();return{from:{positions:s.from},to:{positions:s.to},onChange:a=>{r(a.value.positions)},config:{...qs,duration:e?void 0:0}}},[e])}function Nue(n,e,t){const[{activeOpacity:i,inactiveOpacity:r}]=Vs(()=>({from:{activeOpacity:0,inactiveOpacity:0},to:{activeOpacity:e?t.edge.selectedOpacity:t.edge.opacity,inactiveOpacity:e?t.edge.inactiveOpacity:t.edge.opacity},config:{...qs,duration:n?void 0:0}}),[n,e,t]);return{activeOpacity:i,inactiveOpacity:r}}const Kw=6,yD=({animated:n,color:e,contextMenu:t,edge:i,labelFontUrl:r,labelPlacement:s,opacity:a,theme:o})=>{const{target:l,source:c,label:u,labelVisible:h=!1,size:f=1}=i,p=ft(M=>M.nodes),m=p.find(M=>M.id===c),y=p.find(M=>M.id===l),v=ft(M=>M.draggingId),A=(f+Kw)/2,_=$.useMemo(()=>lD(m.position,y.position,sD(A,s)),[m.position,y.position,A,s]),x=ft(M=>M.edgeContextMenus),E=ft(M=>M.setEdgeContextMenus),[{labelPosition:w}]=Vs(()=>({from:{labelPosition:[0,0,0]},to:{labelPosition:[_.x,_.y,_.z]},config:{...qs,duration:n&&!v?void 0:0}}),[_,n,v]),I=$.useCallback(M=>{x.delete(M.id),E(new Set(x.values()))},[x,E]),T=$.useMemo(()=>new vu(0,0,s==="natural"?0:Math.atan((y.position.y-m.position.y)/(y.position.x-m.position.x))),[y.position.x,y.position.y,m.position.x,m.position.y,s]);return Ne.jsxs("group",{children:[h&&u&&Ne.jsx(mi.group,{position:w,rotation:T,children:Ne.jsx(X0,{text:u,ellipsis:15,fontUrl:r,stroke:o.edge.label.stroke,color:e,opacity:a,fontSize:Kw})}),t&&x.has(i.id)&&Ne.jsx(N4,{prepend:!0,center:!0,position:_,children:t({data:i,onClose:()=>I(i)})})]})};yD.defaultProps={labelPlacement:"inline"};const Gue=({animated:n,arrowPlacement:e="end",contextMenu:t,disabled:i,edges:r,interpolation:s="linear",labelFontUrl:a,labelPlacement:o="inline",theme:l,onClick:c,onContextMenu:u,onPointerOut:h,onPointerOver:f})=>{const{getGeometries:p,getGeometry:m}=Oue(e,s),y=ft(V=>V.draggingId),v=ft(V=>V.edgeMeshes),A=ft(V=>V.setEdgeMeshes),_=ft(V=>V.actives||[]),x=ft(V=>V.selections||[]),[E,w,I,T]=$.useMemo(()=>{const V=[],D=[],k=[],Z=[];return r.forEach(j=>{if(y===j.source||y===j.target){x.includes(j.id)||_.includes(j.id)?k.push(j):Z.push(j);return}x.includes(j.id)||_.includes(j.id)?V.push(j):D.push(j)}),[V,D,k,Z]},[r,_,x,y]),M=!!x.length,b=$.useMemo(()=>m(E,w),[m,E,w]),{activeOpacity:B,inactiveOpacity:L}=Nue(n,M,l);kue(b,n),$.useEffect(()=>{if(y===null){const D=p(r).map(k=>new nn(k));A(D)}},[p,A,r,y]);const U=$.useRef(new nn),O=$.useRef(new nn),Q=$.useCallback(V=>{if(!V.camera)return[];const D=V.intersectObjects(v);return D.length?D.map(k=>r[v.indexOf(k.object)]):[]},[v,r]),{handleClick:G,handleContextMenu:F,handleIntersections:q}=Fue({onClick:c,onContextMenu:u,onPointerOut:h,onPointerOver:f},t,i),Y=$.useRef(null),H=$.useRef([]);return a1(V=>{if(U.current.geometry=b,i)return;const D=Y.current;if((y||y===null&&D!==null)&&(O.current.geometry=m(I,T)),Y.current=y,y)return;const k=H.current,Z=Q(V.raycaster);q(k,Z),Z.join()!==k.join()&&(O.current.geometry=m(Z,[])),H.current=Z}),Ne.jsxs("group",{onClick:G,onContextMenu:F,children:[Ne.jsxs("mesh",{ref:U,children:[Ne.jsx(mi.meshBasicMaterial,{attach:"material-0",color:l.edge.fill,depthTest:!1,fog:!0,opacity:L,side:$n,transparent:!0}),Ne.jsx(mi.meshBasicMaterial,{attach:"material-1",color:l.edge.activeFill,depthTest:!1,fog:!0,opacity:B,side:$n,transparent:!0})]}),Ne.jsxs("mesh",{ref:O,children:[Ne.jsx(mi.meshBasicMaterial,{attach:"material-0",color:l.edge.fill,depthTest:!1,fog:!0,opacity:L,side:$n,transparent:!0}),Ne.jsx(mi.meshBasicMaterial,{attach:"material-1",color:l.edge.activeFill,depthTest:!1,fog:!0,opacity:B,side:$n,transparent:!0})]}),r.map(V=>Ne.jsx(yD,{animated:n,contextMenu:t,color:l.edge.label.color,disabled:i,edge:V,labelFontUrl:a,labelPlacement:o,theme:l},V.id))]})},xD=({animated:n,position:e,padding:t,labelFontUrl:i,disabled:r,radius:s,nodes:a,label:o,onClick:l,onPointerOver:c,onPointerOut:u})=>{var h,f,p,m;const y=ft(G=>G.theme),v=Math.max(e.width,e.height)/2,A=v-s+t,[_,x]=$.useState(!1),E=ft(G=>{var F;return(F=G.actives)==null?void 0:F.some(q=>a.some(Y=>Y.id===q))}),w=ft(G=>{var F;return(F=G.selections)==null?void 0:F.some(q=>a.some(Y=>Y.id===q))}),T=ft(G=>{var F;return((F=G.selections)==null?void 0:F.length)>0})?w||_||E?y.cluster.selectedOpacity:y.cluster.inactiveOpacity:y.cluster.opacity,{circleOpacity:M,circlePosition:b,labelPosition:B}=Vs({from:{circlePosition:[0,0,-1],circleOpacity:0,labelPosition:[0,0,2]},to:{labelPosition:[0,-A,2],circlePosition:e?[e.x,e.y,-1]:[0,0,-1],circleOpacity:T},config:{...qs,duration:n?void 0:0}}),L=$.useMemo(()=>{var G;return new He((G=y.cluster)==null?void 0:G.stroke)},[(h=y.cluster)==null?void 0:h.stroke]),U=$.useMemo(()=>{var G;return new He((G=y.cluster)==null?void 0:G.fill)},[(f=y.cluster)==null?void 0:f.fill]);np(_&&l!==void 0,"pointer");const{pointerOver:O,pointerOut:Q}=F8({disabled:r,onPointerOver:()=>{x(!0),c==null||c({nodes:a,label:o})},onPointerOut:()=>{x(!1),u==null||u({nodes:a,label:o})}});return Ne.jsx(Ne.Fragment,{children:y.cluster&&Ne.jsxs(mi.group,{position:b,onPointerOver:O,onPointerOut:Q,onClick:()=>{r||l==null||l({nodes:a,label:o})},children:[Ne.jsxs("mesh",{children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[A,0,128]}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",color:U,transparent:!0,depthTest:!1,opacity:(p=y.cluster)!=null&&p.fill?M:0,side:$n,fog:!0})]}),Ne.jsxs("mesh",{children:[Ne.jsx("ringGeometry",{attach:"geometry",args:[A,v+t,128]}),Ne.jsx(mi.meshBasicMaterial,{attach:"material",color:L,transparent:!0,depthTest:!1,opacity:M,side:$n,fog:!0})]}),((m=y.cluster)==null?void 0:m.label)&&Ne.jsx(mi.group,{position:B,children:Ne.jsx(X0,{text:o,opacity:T,labelFontUrl:i,stroke:y.cluster.label.stroke,active:!1,color:y.cluster.label.color,fontSize:12})})]})})};xD.defaultProps={opacity:1,radius:2,padding:40};const _D=$.forwardRef(({onNodeClick:n,onNodeContextMenu:e,onEdgeContextMenu:t,onEdgeClick:i,onEdgePointerOver:r,onEdgePointerOut:s,onNodePointerOver:a,onNodePointerOut:o,onClusterClick:l,onNodeDragged:c,onClusterPointerOver:u,onClusterPointerOut:h,contextMenu:f,theme:p,animated:m,disabled:y,draggable:v,edgeLabelPosition:A,edgeArrowPosition:_,edgeInterpolation:x,labelFontUrl:E,renderNode:w,...I},T)=>{const{mounted:M}=Lue(I),b=ft(F=>F.graph),B=ft(F=>F.nodes),L=ft(F=>F.edges),U=ft(F=>[...F.clusters.values()]),O=$.useMemo(()=>B.map(F=>F.id),[B]),Q=$.useMemo(()=>L.map(F=>F.id),[L]),{centerNodesById:G}=Uue({animated:m});return $.useImperativeHandle(T,()=>({centerGraph:G,graph:b}),[G,b]),Ne.jsx($.Fragment,{children:M&&Ne.jsxs($.Fragment,{children:[O.map(F=>Ne.jsx(gD,{id:F,labelFontUrl:E,draggable:v,disabled:y,animated:m,contextMenu:f,renderNode:w,onClick:n,onContextMenu:e,onPointerOver:a,onPointerOut:o,onDragged:c},F)),m?Q.map(F=>Ne.jsx(vD,{id:F,disabled:y,animated:m,labelFontUrl:E,labelPlacement:A,arrowPlacement:_,interpolation:x,contextMenu:f,onClick:i,onContextMenu:t,onPointerOver:r,onPointerOut:s},F)):Ne.jsx(Gue,{theme:p,edges:L,disabled:y,animated:m,labelFontUrl:E,labelPlacement:A,arrowPlacement:_,interpolation:x,contextMenu:f,onClick:i,onContextMenu:t,onPointerOver:r,onPointerOut:s}),U.map(F=>Ne.jsx(xD,{animated:m,disabled:y,labelFontUrl:E,onClick:l,onPointerOver:u,onPointerOut:h,...F},F.label))]})})});_D.defaultProps={edgeInterpolation:"linear"};const zue={canvas:{background:"#fff"},node:{fill:"#7CA0AB",activeFill:"#1DE9AC",opacity:1,selectedOpacity:1,inactiveOpacity:.2,label:{color:"#2A6475",stroke:"#fff",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"}},arrow:{fill:"#D8E6EA",activeFill:"#1DE9AC"},cluster:{stroke:"#D8E6EA",opacity:1,selectedOpacity:1,inactiveOpacity:.1,label:{stroke:"#fff",color:"#2A6475"}}};function om(n,e,t){const{offsetX:i,offsetY:r}=n,{width:s,height:a}=t;e.set(i/s*2-1,-(r/a)*2+1)}function Que(n){const e=document.createElement("div");return e.style.pointerEvents="none",e.style.border=n.lasso.border,e.style.backgroundColor=n.lasso.background,e.style.position="fixed",e}const Hue=({children:n,theme:e,type:t="none",onLasso:i,onLassoEnd:r,disabled:s})=>{var a;const o=Cr(O=>O.camera),l=Cr(O=>O.gl),c=Cr(O=>O.setEvents),u=Cr(O=>O.size),h=Cr(O=>O.get),f=Cr(O=>O.scene),p=k8(),m=ft(O=>O.actives),y=ft(O=>O.setActives),v=ft(O=>O.edges),A=ft(O=>O.edgeMeshes),_=$.useRef(!1),x=$.useRef(null),E=$.useRef(null),w=$.useRef(Que(e)),I=$.useRef(null),T=$.useRef(!1),M=$.useRef(h().events.enabled),b=$.useRef((a=p.controls)==null?void 0:a.enabled);$.useEffect(()=>{_.current&&(i==null||i(m)),_.current=!0},[m,i]);const B=$.useCallback(O=>{if(T.current){const[Q,G,F]=I.current;F.x=Math.max(Q.x,O.clientX),F.y=Math.max(Q.y,O.clientY),G.x=Math.min(Q.x,O.clientX),G.y=Math.min(Q.y,O.clientY),w.current.style.left=`${G.x}px`,w.current.style.top=`${G.y}px`,w.current.style.width=`${F.x-G.x}px`,w.current.style.height=`${F.y-G.y}px`,om(O,x.current.endPoint,u),om(O,E.current.endPoint,u);const q=[],Y=E.current.select().sort(V=>V.uuid).map(V=>v[A.indexOf(V)].id);q.push(...Y);const H=x.current.select().sort(V=>V.uuid).filter(V=>{var D,k;return V.isMesh&&((D=V.userData)==null?void 0:D.id)&&(((k=V.userData)==null?void 0:k.type)===t||t==="all")}).map(V=>V.userData.id);q.push(...H),requestAnimationFrame(()=>{y(q)}),document.addEventListener("pointermove",B,{passive:!0,capture:!0,once:!0})}},[v,A,y,u,t]),L=$.useCallback(()=>{var O;T.current&&(c({enabled:M.current}),T.current=!1,(O=w.current.parentElement)==null||O.removeChild(w.current),p.controls.enabled=b.current,r==null||r(m),document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",L))},[c,p.controls,r,m,B]),U=$.useCallback(O=>{var Q,G;if(O.shiftKey){M.current=h().events.enabled,b.current=(Q=p.controls)==null?void 0:Q.enabled,x.current=new c9(o,f);const F=new Bp;A.length&&F.add(...A),E.current=new c9(o,F),I.current=[new _e,new _e,new _e];const[q]=I.current;p.controls.enabled=!1,c({enabled:!1}),T.current=!0,(G=l.domElement.parentElement)==null||G.appendChild(w.current),w.current.style.left=`${O.clientX}px`,w.current.style.top=`${O.clientY}px`,w.current.style.width="0px",w.current.style.height="0px",q.x=O.clientX,q.y=O.clientY,om(O,x.current.startPoint,u),om(O,E.current.startPoint,u),document.addEventListener("pointermove",B,{passive:!0,capture:!0,once:!0}),document.addEventListener("pointerup",L,{passive:!0})}},[o,p.controls,A,h,l.domElement.parentElement,B,L,f,c,u]);return $.useEffect(()=>{if(!(s||t==="none"))return document.addEventListener("pointerdown",U,{passive:!0}),document.addEventListener("pointermove",B,{passive:!0}),document.addEventListener("pointerup",L,{passive:!0}),()=>{document.removeEventListener("pointerdown",U),document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",L)}},[t,s,U,B,L]),Ne.jsx("group",{children:n})},Vue="_canvas_670zp_1",Wue={canvas:Vue},Yue={alpha:!0,antialias:!0},que={position:[0,0,1e3],near:5,far:5e4,fov:10},ED=$.forwardRef(({cameraMode:n,edges:e,children:t,nodes:i,theme:r,onCanvasClick:s,animated:a,disabled:o,lassoType:l,onLasso:c,onLassoEnd:u,...h},f)=>{const p=$.useRef(null),m=$.useRef(null);$.useImperativeHandle(f,()=>({centerGraph:x=>{var E;return(E=p.current)==null?void 0:E.centerGraph(x)},zoomIn:()=>{var x;return(x=m.current)==null?void 0:x.zoomIn()},zoomOut:()=>{var x;return(x=m.current)==null?void 0:x.zoomOut()},panLeft:()=>{var x;return(x=m.current)==null?void 0:x.panLeft()},panRight:()=>{var x;return(x=m.current)==null?void 0:x.panRight()},panDown:()=>{var x;return(x=m.current)==null?void 0:x.panDown()},panUp:()=>{var x;return(x=m.current)==null?void 0:x.panUp()},resetControls:x=>{var E;return(E=m.current)==null?void 0:E.resetControls(x)},getControls:()=>{var x;return(x=m.current)==null?void 0:x.controls},getGraph:()=>{var x;return(x=p.current)==null?void 0:x.graph}}));const{selections:y,actives:v,collapsedNodeIds:A}=h,_=e.length+i.length>400?!1:a;return Ne.jsx("div",{className:Wue.canvas,children:Ne.jsx(Lz,{legacy:!0,linear:!0,flat:!0,gl:Yue,camera:que,onPointerMissed:s,children:Ne.jsxs(Bue,{createStore:()=>Due({selections:y,actives:v,theme:r,collapsedNodeIds:A}),children:[Ne.jsx("color",{attach:"background",args:[r.canvas.background]}),Ne.jsx("ambientLight",{intensity:1}),t,r.canvas.fog&&Ne.jsx("fog",{attach:"fog",args:[r.canvas.fog,4e3,9e3]}),Ne.jsx(dD,{mode:n,ref:m,animated:a,disabled:o,children:Ne.jsx(Hue,{theme:r,disabled:o,type:l,onLasso:c,onLassoEnd:u,children:Ne.jsx($.Suspense,{children:Ne.jsx(_D,{ref:p,theme:r,disabled:o,animated:_,edges:e,nodes:i,...h})})})})]})})})});ED.defaultProps={cameraMode:"pan",layoutType:"forceDirected2d",sizingType:"default",labelType:"auto",theme:zue,animated:!0,defaultNodeSize:7,minNodeSize:5,maxNodeSize:15,lassoType:"none"};function w2(n){"@babel/helpers - typeof";return w2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w2(n)}function mu(n){if(n===null||n===!0||n===!1)return NaN;var e=Number(n);return isNaN(e)?e:e<0?Math.ceil(e):Math.floor(e)}function Pr(n,e){if(e.length1?"s":"")+" required, but only "+e.length+" present")}function co(n){Pr(1,arguments);var e=Object.prototype.toString.call(n);return n instanceof Date||w2(n)==="object"&&e==="[object Date]"?new Date(n.getTime()):typeof n=="number"||e==="[object Number]"?new Date(n):((typeof n=="string"||e==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function Xue(n,e){Pr(2,arguments);var t=co(n).getTime(),i=mu(e);return new Date(t+i)}var jue={};function Z1(){return jue}function Kue(n){var e=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()));return e.setUTCFullYear(n.getFullYear()),n.getTime()-e.getTime()}function $ue(n){return Pr(1,arguments),n instanceof Date||w2(n)==="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Jue(n){if(Pr(1,arguments),!$ue(n)&&typeof n!="number")return!1;var e=co(n);return!isNaN(Number(e))}function Zue(n,e){Pr(2,arguments);var t=mu(e);return Xue(n,-t)}var ehe=864e5;function the(n){Pr(1,arguments);var e=co(n),t=e.getTime();e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0);var i=e.getTime(),r=t-i;return Math.floor(r/ehe)+1}function C2(n){Pr(1,arguments);var e=1,t=co(n),i=t.getUTCDay(),r=(i=r.getTime()?t+1:e.getTime()>=a.getTime()?t:t-1}function nhe(n){Pr(1,arguments);var e=SD(n),t=new Date(0);t.setUTCFullYear(e,0,4),t.setUTCHours(0,0,0,0);var i=C2(t);return i}var ihe=6048e5;function rhe(n){Pr(1,arguments);var e=co(n),t=C2(e).getTime()-nhe(e).getTime();return Math.round(t/ihe)+1}function T2(n,e){var t,i,r,s,a,o,l,c;Pr(1,arguments);var u=Z1(),h=mu((t=(i=(r=(s=e==null?void 0:e.weekStartsOn)!==null&&s!==void 0?s:e==null||(a=e.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.weekStartsOn)!==null&&r!==void 0?r:u.weekStartsOn)!==null&&i!==void 0?i:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&t!==void 0?t:0);if(!(h>=0&&h<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var f=co(n),p=f.getUTCDay(),m=(p=1&&p<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var m=new Date(0);m.setUTCFullYear(h+1,0,p),m.setUTCHours(0,0,0,0);var y=T2(m,e),v=new Date(0);v.setUTCFullYear(h,0,p),v.setUTCHours(0,0,0,0);var A=T2(v,e);return u.getTime()>=y.getTime()?h+1:u.getTime()>=A.getTime()?h:h-1}function she(n,e){var t,i,r,s,a,o,l,c;Pr(1,arguments);var u=Z1(),h=mu((t=(i=(r=(s=e==null?void 0:e.firstWeekContainsDate)!==null&&s!==void 0?s:e==null||(a=e.locale)===null||a===void 0||(o=a.options)===null||o===void 0?void 0:o.firstWeekContainsDate)!==null&&r!==void 0?r:u.firstWeekContainsDate)!==null&&i!==void 0?i:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&t!==void 0?t:1),f=wD(n,e),p=new Date(0);p.setUTCFullYear(f,0,h),p.setUTCHours(0,0,0,0);var m=T2(p,e);return m}var ahe=6048e5;function ohe(n,e){Pr(1,arguments);var t=co(n),i=T2(t,e).getTime()-she(t,e).getTime();return Math.round(i/ahe)+1}function _n(n,e){for(var t=n<0?"-":"",i=Math.abs(n).toString();i.length0?i:1-i;return _n(t==="yy"?r%100:r,t.length)},M:function(e,t){var i=e.getUTCMonth();return t==="M"?String(i+1):_n(i+1,2)},d:function(e,t){return _n(e.getUTCDate(),t.length)},a:function(e,t){var i=e.getUTCHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return i.toUpperCase();case"aaa":return i;case"aaaaa":return i[0];case"aaaa":default:return i==="am"?"a.m.":"p.m."}},h:function(e,t){return _n(e.getUTCHours()%12||12,t.length)},H:function(e,t){return _n(e.getUTCHours(),t.length)},m:function(e,t){return _n(e.getUTCMinutes(),t.length)},s:function(e,t){return _n(e.getUTCSeconds(),t.length)},S:function(e,t){var i=t.length,r=e.getUTCMilliseconds(),s=Math.floor(r*Math.pow(10,i-3));return _n(s,t.length)}};const Sl=lhe;var _h={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},che={G:function(e,t,i){var r=e.getUTCFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return i.era(r,{width:"abbreviated"});case"GGGGG":return i.era(r,{width:"narrow"});case"GGGG":default:return i.era(r,{width:"wide"})}},y:function(e,t,i){if(t==="yo"){var r=e.getUTCFullYear(),s=r>0?r:1-r;return i.ordinalNumber(s,{unit:"year"})}return Sl.y(e,t)},Y:function(e,t,i,r){var s=wD(e,r),a=s>0?s:1-s;if(t==="YY"){var o=a%100;return _n(o,2)}return t==="Yo"?i.ordinalNumber(a,{unit:"year"}):_n(a,t.length)},R:function(e,t){var i=SD(e);return _n(i,t.length)},u:function(e,t){var i=e.getUTCFullYear();return _n(i,t.length)},Q:function(e,t,i){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return _n(r,2);case"Qo":return i.ordinalNumber(r,{unit:"quarter"});case"QQQ":return i.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return i.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return i.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,i){var r=Math.ceil((e.getUTCMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return _n(r,2);case"qo":return i.ordinalNumber(r,{unit:"quarter"});case"qqq":return i.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return i.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return i.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,i){var r=e.getUTCMonth();switch(t){case"M":case"MM":return Sl.M(e,t);case"Mo":return i.ordinalNumber(r+1,{unit:"month"});case"MMM":return i.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return i.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return i.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,i){var r=e.getUTCMonth();switch(t){case"L":return String(r+1);case"LL":return _n(r+1,2);case"Lo":return i.ordinalNumber(r+1,{unit:"month"});case"LLL":return i.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return i.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return i.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,i,r){var s=ohe(e,r);return t==="wo"?i.ordinalNumber(s,{unit:"week"}):_n(s,t.length)},I:function(e,t,i){var r=rhe(e);return t==="Io"?i.ordinalNumber(r,{unit:"week"}):_n(r,t.length)},d:function(e,t,i){return t==="do"?i.ordinalNumber(e.getUTCDate(),{unit:"date"}):Sl.d(e,t)},D:function(e,t,i){var r=the(e);return t==="Do"?i.ordinalNumber(r,{unit:"dayOfYear"}):_n(r,t.length)},E:function(e,t,i){var r=e.getUTCDay();switch(t){case"E":case"EE":case"EEE":return i.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return i.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return i.day(r,{width:"short",context:"formatting"});case"EEEE":default:return i.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,i,r){var s=e.getUTCDay(),a=(s-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return _n(a,2);case"eo":return i.ordinalNumber(a,{unit:"day"});case"eee":return i.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return i.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return i.day(s,{width:"short",context:"formatting"});case"eeee":default:return i.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,i,r){var s=e.getUTCDay(),a=(s-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return _n(a,t.length);case"co":return i.ordinalNumber(a,{unit:"day"});case"ccc":return i.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return i.day(s,{width:"narrow",context:"standalone"});case"cccccc":return i.day(s,{width:"short",context:"standalone"});case"cccc":default:return i.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,i){var r=e.getUTCDay(),s=r===0?7:r;switch(t){case"i":return String(s);case"ii":return _n(s,t.length);case"io":return i.ordinalNumber(s,{unit:"day"});case"iii":return i.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return i.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return i.day(r,{width:"short",context:"formatting"});case"iiii":default:return i.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,i){var r=e.getUTCHours(),s=r/12>=1?"pm":"am";switch(t){case"a":case"aa":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return i.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,i){var r=e.getUTCHours(),s;switch(r===12?s=_h.noon:r===0?s=_h.midnight:s=r/12>=1?"pm":"am",t){case"b":case"bb":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return i.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,i){var r=e.getUTCHours(),s;switch(r>=17?s=_h.evening:r>=12?s=_h.afternoon:r>=4?s=_h.morning:s=_h.night,t){case"B":case"BB":case"BBB":return i.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return i.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return i.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,i){if(t==="ho"){var r=e.getUTCHours()%12;return r===0&&(r=12),i.ordinalNumber(r,{unit:"hour"})}return Sl.h(e,t)},H:function(e,t,i){return t==="Ho"?i.ordinalNumber(e.getUTCHours(),{unit:"hour"}):Sl.H(e,t)},K:function(e,t,i){var r=e.getUTCHours()%12;return t==="Ko"?i.ordinalNumber(r,{unit:"hour"}):_n(r,t.length)},k:function(e,t,i){var r=e.getUTCHours();return r===0&&(r=24),t==="ko"?i.ordinalNumber(r,{unit:"hour"}):_n(r,t.length)},m:function(e,t,i){return t==="mo"?i.ordinalNumber(e.getUTCMinutes(),{unit:"minute"}):Sl.m(e,t)},s:function(e,t,i){return t==="so"?i.ordinalNumber(e.getUTCSeconds(),{unit:"second"}):Sl.s(e,t)},S:function(e,t){return Sl.S(e,t)},X:function(e,t,i,r){var s=r._originalDate||e,a=s.getTimezoneOffset();if(a===0)return"Z";switch(t){case"X":return Jw(a);case"XXXX":case"XX":return kc(a);case"XXXXX":case"XXX":default:return kc(a,":")}},x:function(e,t,i,r){var s=r._originalDate||e,a=s.getTimezoneOffset();switch(t){case"x":return Jw(a);case"xxxx":case"xx":return kc(a);case"xxxxx":case"xxx":default:return kc(a,":")}},O:function(e,t,i,r){var s=r._originalDate||e,a=s.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+$w(a,":");case"OOOO":default:return"GMT"+kc(a,":")}},z:function(e,t,i,r){var s=r._originalDate||e,a=s.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+$w(a,":");case"zzzz":default:return"GMT"+kc(a,":")}},t:function(e,t,i,r){var s=r._originalDate||e,a=Math.floor(s.getTime()/1e3);return _n(a,t.length)},T:function(e,t,i,r){var s=r._originalDate||e,a=s.getTime();return _n(a,t.length)}};function $w(n,e){var t=n>0?"-":"+",i=Math.abs(n),r=Math.floor(i/60),s=i%60;if(s===0)return t+String(r);var a=e||"";return t+String(r)+a+_n(s,2)}function Jw(n,e){if(n%60===0){var t=n>0?"-":"+";return t+_n(Math.abs(n)/60,2)}return kc(n,e)}function kc(n,e){var t=e||"",i=n>0?"-":"+",r=Math.abs(n),s=_n(Math.floor(r/60),2),a=_n(r%60,2);return i+s+t+a}const uhe=che;var Zw=function(e,t){switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},CD=function(e,t){switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},hhe=function(e,t){var i=e.match(/(P+)(p+)?/)||[],r=i[1],s=i[2];if(!s)return Zw(e,t);var a;switch(r){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;case"PPPP":default:a=t.dateTime({width:"full"});break}return a.replace("{{date}}",Zw(r,t)).replace("{{time}}",CD(s,t))},fhe={p:CD,P:hhe};const dhe=fhe;var phe=["D","DD"],ghe=["YY","YYYY"];function mhe(n){return phe.indexOf(n)!==-1}function Ahe(n){return ghe.indexOf(n)!==-1}function eC(n,e,t){if(n==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(e,"`) for formatting years to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(n==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(e,"`) for formatting days of the month to the input `").concat(t,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var vhe={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},yhe=function(e,t,i){var r,s=vhe[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),i!=null&&i.addSuffix?i.comparison&&i.comparison>0?"in "+r:r+" ago":r};const xhe=yhe;function U5(n){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.width?String(e.width):n.defaultWidth,i=n.formats[t]||n.formats[n.defaultWidth];return i}}var _he={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Ehe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},She={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},whe={date:U5({formats:_he,defaultWidth:"full"}),time:U5({formats:Ehe,defaultWidth:"full"}),dateTime:U5({formats:She,defaultWidth:"full"})};const Che=whe;var The={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},bhe=function(e,t,i,r){return The[e]};const Ihe=bhe;function Fd(n){return function(e,t){var i=t!=null&&t.context?String(t.context):"standalone",r;if(i==="formatting"&&n.formattingValues){var s=n.defaultFormattingWidth||n.defaultWidth,a=t!=null&&t.width?String(t.width):s;r=n.formattingValues[a]||n.formattingValues[s]}else{var o=n.defaultWidth,l=t!=null&&t.width?String(t.width):n.defaultWidth;r=n.values[l]||n.values[o]}var c=n.argumentCallback?n.argumentCallback(e):e;return r[c]}}var Mhe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Rhe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Bhe={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Dhe={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Phe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Lhe={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Uhe=function(e,t){var i=Number(e),r=i%100;if(r>20||r<10)switch(r%10){case 1:return i+"st";case 2:return i+"nd";case 3:return i+"rd"}return i+"th"},Ohe={ordinalNumber:Uhe,era:Fd({values:Mhe,defaultWidth:"wide"}),quarter:Fd({values:Rhe,defaultWidth:"wide",argumentCallback:function(e){return e-1}}),month:Fd({values:Bhe,defaultWidth:"wide"}),day:Fd({values:Dhe,defaultWidth:"wide"}),dayPeriod:Fd({values:Phe,defaultWidth:"wide",formattingValues:Lhe,defaultFormattingWidth:"wide"})};const Fhe=Ohe;function kd(n){return function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=t.width,r=i&&n.matchPatterns[i]||n.matchPatterns[n.defaultMatchWidth],s=e.match(r);if(!s)return null;var a=s[0],o=i&&n.parsePatterns[i]||n.parsePatterns[n.defaultParseWidth],l=Array.isArray(o)?Nhe(o,function(h){return h.test(a)}):khe(o,function(h){return h.test(a)}),c;c=n.valueCallback?n.valueCallback(l):l,c=t.valueCallback?t.valueCallback(c):c;var u=e.slice(a.length);return{value:c,rest:u}}}function khe(n,e){for(var t in n)if(n.hasOwnProperty(t)&&e(n[t]))return t}function Nhe(n,e){for(var t=0;t1&&arguments[1]!==void 0?arguments[1]:{},i=e.match(n.matchPattern);if(!i)return null;var r=i[0],s=e.match(n.parsePattern);if(!s)return null;var a=n.valueCallback?n.valueCallback(s[0]):s[0];a=t.valueCallback?t.valueCallback(a):a;var o=e.slice(r.length);return{value:a,rest:o}}}var zhe=/^(\d+)(th|st|nd|rd)?/i,Qhe=/\d+/i,Hhe={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Vhe={any:[/^b/i,/^(a|c)/i]},Whe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Yhe={any:[/1/i,/2/i,/3/i,/4/i]},qhe={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Xhe={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},jhe={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Khe={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},$he={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Jhe={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Zhe={ordinalNumber:Ghe({matchPattern:zhe,parsePattern:Qhe,valueCallback:function(e){return parseInt(e,10)}}),era:kd({matchPatterns:Hhe,defaultMatchWidth:"wide",parsePatterns:Vhe,defaultParseWidth:"any"}),quarter:kd({matchPatterns:Whe,defaultMatchWidth:"wide",parsePatterns:Yhe,defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:kd({matchPatterns:qhe,defaultMatchWidth:"wide",parsePatterns:Xhe,defaultParseWidth:"any"}),day:kd({matchPatterns:jhe,defaultMatchWidth:"wide",parsePatterns:Khe,defaultParseWidth:"any"}),dayPeriod:kd({matchPatterns:$he,defaultMatchWidth:"any",parsePatterns:Jhe,defaultParseWidth:"any"})};const efe=Zhe;var tfe={code:"en-US",formatDistance:xhe,formatLong:Che,formatRelative:Ihe,localize:Fhe,match:efe,options:{weekStartsOn:0,firstWeekContainsDate:1}};const nfe=tfe;var ife=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,rfe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,sfe=/^'([^]*?)'?$/,afe=/''/g,ofe=/[a-zA-Z]/;function tC(n,e,t){var i,r,s,a,o,l,c,u,h,f,p,m,y,v,A,_,x,E;Pr(2,arguments);var w=String(e),I=Z1(),T=(i=(r=t==null?void 0:t.locale)!==null&&r!==void 0?r:I.locale)!==null&&i!==void 0?i:nfe,M=mu((s=(a=(o=(l=t==null?void 0:t.firstWeekContainsDate)!==null&&l!==void 0?l:t==null||(c=t.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&o!==void 0?o:I.firstWeekContainsDate)!==null&&a!==void 0?a:(h=I.locale)===null||h===void 0||(f=h.options)===null||f===void 0?void 0:f.firstWeekContainsDate)!==null&&s!==void 0?s:1);if(!(M>=1&&M<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var b=mu((p=(m=(y=(v=t==null?void 0:t.weekStartsOn)!==null&&v!==void 0?v:t==null||(A=t.locale)===null||A===void 0||(_=A.options)===null||_===void 0?void 0:_.weekStartsOn)!==null&&y!==void 0?y:I.weekStartsOn)!==null&&m!==void 0?m:(x=I.locale)===null||x===void 0||(E=x.options)===null||E===void 0?void 0:E.weekStartsOn)!==null&&p!==void 0?p:0);if(!(b>=0&&b<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!T.localize)throw new RangeError("locale must contain localize property");if(!T.formatLong)throw new RangeError("locale must contain formatLong property");var B=co(n);if(!Jue(B))throw new RangeError("Invalid time value");var L=Kue(B),U=Zue(B,L),O={firstWeekContainsDate:M,weekStartsOn:b,locale:T,_originalDate:B},Q=w.match(rfe).map(function(G){var F=G[0];if(F==="p"||F==="P"){var q=dhe[F];return q(G,T.formatLong)}return G}).join("").match(ife).map(function(G){if(G==="''")return"'";var F=G[0];if(F==="'")return lfe(G);var q=uhe[F];if(q)return!(t!=null&&t.useAdditionalWeekYearTokens)&&Ahe(G)&&eC(G,e,String(n)),!(t!=null&&t.useAdditionalDayOfYearTokens)&&mhe(G)&&eC(G,e,String(n)),q(U,G,T.localize,O);if(F.match(ofe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+F+"`");return G}).join("");return Q}function lfe(n){var e=n.match(sfe);return e?e[1].replace(afe,"'"):n}const cfe=({node:n,output:e})=>{const t=$.useMemo(()=>n.planable?e.result.planables.find(r=>r.id===n.planable):null,[n,e]),i=$.useMemo(()=>{const r=new Date(n.time),s=new Date(r.getTime()+n.duration);return Ne.jsxs("span",{children:[tC(r,"HH:mm")," - ",tC(s,"HH:mm")]})},[n.duration,n.time]);return t?Ne.jsxs("div",{children:[i," Planable: ",t.id]}):n.type==="travel"?Ne.jsxs("div",{children:[i," Travel: ",n.location]}):null},ufe=({id:n,output:e})=>{const t=$.useMemo(()=>{const i=[];let r=e.result.nodes.find(s=>s.id===n);for(;r&&(i.push(r),!!r.parent);)r=e.result.nodes.find(s=>s.id===(r==null?void 0:r.parent));return i},[n,e]);return Ne.jsx(Ne.Fragment,{children:t.map(i=>Ne.jsx(cfe,{node:i,output:e},i.id))})},hfe=({output:n})=>{var h;const[e,t]=$.useState(0),[i,r]=$.useState(!1),[s,a]=$.useState(void 0),o=$.useMemo(()=>{if(!s)return[];const f=[];let p=n.result.nodes.find(m=>m.id===s);for(;p&&(f.push(p.id),!!p.parent);)p=n.result.nodes.find(m=>m.id===(p==null?void 0:p.parent));return f},[s,n]),l=$.useMemo(()=>{var f;return((f=n==null?void 0:n.result)==null?void 0:f.completed.map(p=>({id:p.id,score:p.score})).sort((p,m)=>m.score-p.score).slice(0,10))||[]},[(h=n==null?void 0:n.result)==null?void 0:h.completed]),c=$.useMemo(()=>{var f;return Math.max(...((f=n==null?void 0:n.nodes)==null?void 0:f.map(p=>{var m;return(m=p.data)==null?void 0:m.exploreId}))||[])},[n]),u=$.useMemo(()=>{var f;return(f=n==null?void 0:n.nodes)==null?void 0:f.filter(p=>{var m;return((m=p.data)==null?void 0:m.exploreId)>e}).map(p=>p.id)},[n,e]);return n?Ne.jsxs(Ne.Fragment,{children:["Nodes count: ",n.nodes.length,Ne.jsxs("button",{onClick:()=>r(!i),children:[i?"Hide":"Show"," Visualize"]}),i&&Ne.jsxs(Ne.Fragment,{children:[Ne.jsx("button",{onClick:()=>t(e-1),children:"Prev"}),Ne.jsx("input",{type:"range",min:0,max:c,value:e,onChange:f=>t(parseInt(f.target.value))}),Ne.jsx("button",{onClick:()=>t(e+1),children:"Next"})]}),l.map(f=>Ne.jsxs("div",{onClick:()=>a(f.id),children:[f.id," - ",f.score]},f.id)),s&&Ne.jsx(ufe,{id:s,output:n}),i&&Ne.jsx("div",{style:{position:"relative",height:"70vh"},children:Ne.jsx(ED,{...n,collapsedNodeIds:u,labelType:"all",onNodeClick:f=>{if(f.id===s){a(void 0);return}a(f.id)},selections:o,renderNode:({size:f,opacity:p,node:m})=>{var v,A,_,x,E,w;let y="gray";return((v=m.data)==null?void 0:v.exploreId)0&&(y="yellow"),((_=m.data)==null?void 0:_.exploreId)===e&&(y="blue"),(x=m.data)!=null&&x.deadEnd&&(y="red"),(E=m.data)!=null&&E.completed&&(y="green"),((w=m.data)==null?void 0:w.type)==="root"&&(y="black"),Ne.jsx("group",{children:Ne.jsxs("mesh",{children:[Ne.jsx("circleGeometry",{attach:"geometry",args:[f]}),Ne.jsx("meshBasicMaterial",{attach:"material",color:y,opacity:p,transparent:!0})]})})}})})]}):null};function nC(n){const e=Object.assign({h1:"h1"},n.components);return Ne.jsxs(Ne.Fragment,{children:[Ne.jsx(e.h1,{children:"Hello World"}),` +`,Ne.jsx(iP,{worker:rP,action:"realistic",presenter:hfe})]})}function Sfe(n={}){const{wrapper:e}=n.components||{};return e?Ne.jsx(e,Object.assign({},n,{children:Ne.jsx(nC,n)})):nC(n)}export{Sfe as default}; diff --git a/assets/index-4a90bf6b.js b/assets/index-4a90bf6b.js new file mode 100644 index 0000000..88913c6 --- /dev/null +++ b/assets/index-4a90bf6b.js @@ -0,0 +1,40 @@ +(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function t(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=t(l);fetch(l.href,o)}})();function oc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wi={exports:{}},el={},Qi={exports:{}},L={};/** + * @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 Xt=Symbol.for("react.element"),uc=Symbol.for("react.portal"),ic=Symbol.for("react.fragment"),sc=Symbol.for("react.strict_mode"),ac=Symbol.for("react.profiler"),cc=Symbol.for("react.provider"),fc=Symbol.for("react.context"),dc=Symbol.for("react.forward_ref"),pc=Symbol.for("react.suspense"),mc=Symbol.for("react.memo"),vc=Symbol.for("react.lazy"),Du=Symbol.iterator;function hc(e){return e===null||typeof e!="object"?null:(e=Du&&e[Du]||e["@@iterator"],typeof e=="function"?e:null)}var Ki={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Yi=Object.assign,Xi={};function ot(e,n,t){this.props=e,this.context=n,this.refs=Xi,this.updater=t||Ki}ot.prototype.isReactComponent={};ot.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,n,"setState")};ot.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Gi(){}Gi.prototype=ot.prototype;function $o(e,n,t){this.props=e,this.context=n,this.refs=Xi,this.updater=t||Ki}var Vo=$o.prototype=new Gi;Vo.constructor=$o;Yi(Vo,ot.prototype);Vo.isPureReactComponent=!0;var Iu=Array.isArray,Zi=Object.prototype.hasOwnProperty,Ao={current:null},Ji={key:!0,ref:!0,__self:!0,__source:!0};function qi(e,n,t){var r,l={},o=null,u=null;if(n!=null)for(r in n.ref!==void 0&&(u=n.ref),n.key!==void 0&&(o=""+n.key),n)Zi.call(n,r)&&!Ji.hasOwnProperty(r)&&(l[r]=n[r]);var i=arguments.length-2;if(i===1)l.children=t;else if(1>>1,G=C[H];if(0>>1;Hl(gl,z))gnl(er,gl)?(C[H]=er,C[gn]=z,H=gn):(C[H]=gl,C[yn]=z,H=yn);else if(gnl(er,z))C[H]=er,C[gn]=z,H=gn;else break e}}return N}function l(C,N){var z=C.sortIndex-N.sortIndex;return z!==0?z:C.id-N.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,i=u.now();e.unstable_now=function(){return u.now()-i}}var s=[],c=[],v=1,m=null,p=3,g=!1,w=!1,S=!1,M=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,a=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(C){for(var N=t(c);N!==null;){if(N.callback===null)r(c);else if(N.startTime<=C)r(c),N.sortIndex=N.expirationTime,n(s,N);else break;N=t(c)}}function h(C){if(S=!1,d(C),!w)if(t(s)!==null)w=!0,hl(E);else{var N=t(c);N!==null&&yl(h,N.startTime-C)}}function E(C,N){w=!1,S&&(S=!1,f(P),P=-1),g=!0;var z=p;try{for(d(N),m=t(s);m!==null&&(!(m.expirationTime>N)||C&&!Ne());){var H=m.callback;if(typeof H=="function"){m.callback=null,p=m.priorityLevel;var G=H(m.expirationTime<=N);N=e.unstable_now(),typeof G=="function"?m.callback=G:m===t(s)&&r(s),d(N)}else r(s);m=t(s)}if(m!==null)var bt=!0;else{var yn=t(c);yn!==null&&yl(h,yn.startTime-N),bt=!1}return bt}finally{m=null,p=z,g=!1}}var _=!1,x=null,P=-1,B=5,T=-1;function Ne(){return!(e.unstable_now()-TC||125H?(C.sortIndex=z,n(c,C),t(s)===null&&C===t(c)&&(S?(f(P),P=-1):S=!0,yl(h,z-H))):(C.sortIndex=G,n(s,C),w||g||(w=!0,hl(E))),C},e.unstable_shouldYield=Ne,e.unstable_wrapCallback=function(C){var N=p;return function(){var z=p;p=N;try{return C.apply(this,arguments)}finally{p=z}}}})(ts);ns.exports=ts;var zc=ns.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 rs=K,ge=zc;function y(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Kl=Object.prototype.hasOwnProperty,Lc=/^[: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]*$/,Fu={},Uu={};function Tc(e){return Kl.call(Uu,e)?!0:Kl.call(Fu,e)?!1:Lc.test(e)?Uu[e]=!0:(Fu[e]=!0,!1)}function Rc(e,n,t,r){if(t!==null&&t.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Oc(e,n,t,r){if(n===null||typeof n>"u"||Rc(e,n,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function se(e,n,t,r,l,o,u){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=t,this.propertyName=e,this.type=n,this.sanitizeURL=o,this.removeEmptyString=u}var ee={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ee[e]=new se(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];ee[n]=new se(n,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ee[e]=new se(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ee[e]=new se(e,2,!1,e,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(e){ee[e]=new se(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ee[e]=new se(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ee[e]=new se(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ee[e]=new se(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ee[e]=new se(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ho=/[\-:]([a-z])/g;function Wo(e){return e[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(e){var n=e.replace(Ho,Wo);ee[n]=new se(n,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(Ho,Wo);ee[n]=new se(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(Ho,Wo);ee[n]=new se(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ee[e]=new se(e,1,!1,e.toLowerCase(),null,!1,!1)});ee.xlinkHref=new se("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ee[e]=new se(e,1,!1,e.toLowerCase(),null,!0,!0)});function Qo(e,n,t,r){var l=ee.hasOwnProperty(n)?ee[n]:null;(l!==null?l.type!==0:r||!(2i||l[u]!==o[i]){var s=` +`+l[u].replace(" at new "," at ");return e.displayName&&s.includes("")&&(s=s.replace("",e.displayName)),s}while(1<=u&&0<=i);break}}}finally{kl=!1,Error.prepareStackTrace=t}return(e=e?e.displayName||e.name:"")?gt(e):""}function Mc(e){switch(e.tag){case 5:return gt(e.type);case 16:return gt("Lazy");case 13:return gt("Suspense");case 19:return gt("SuspenseList");case 0:case 2:case 15:return e=El(e.type,!1),e;case 11:return e=El(e.type.render,!1),e;case 1:return e=El(e.type,!0),e;default:return""}}function Zl(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case In:return"Fragment";case Dn:return"Portal";case Yl:return"Profiler";case Ko:return"StrictMode";case Xl:return"Suspense";case Gl:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case us:return(e.displayName||"Context")+".Consumer";case os:return(e._context.displayName||"Context")+".Provider";case Yo:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Xo:return n=e.displayName||null,n!==null?n:Zl(e.type)||"Memo";case Je:n=e._payload,e=e._init;try{return Zl(e(n))}catch{}}return null}function Dc(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Zl(n);case 8:return n===Ko?"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 n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function dn(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ss(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ic(e){var n=ss(e)?"checked":"value",t=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),r=""+e[n];if(!e.hasOwnProperty(n)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var l=t.get,o=t.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return l.call(this)},set:function(u){r=""+u,o.call(this,u)}}),Object.defineProperty(e,n,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(u){r=""+u},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function rr(e){e._valueTracker||(e._valueTracker=Ic(e))}function as(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var t=n.getValue(),r="";return e&&(r=ss(e)?e.checked?"true":"false":e.value),e=r,e!==t?(n.setValue(e),!0):!1}function Tr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Jl(e,n){var t=n.checked;return V({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??e._wrapperState.initialChecked})}function Vu(e,n){var t=n.defaultValue==null?"":n.defaultValue,r=n.checked!=null?n.checked:n.defaultChecked;t=dn(n.value!=null?n.value:t),e._wrapperState={initialChecked:r,initialValue:t,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function cs(e,n){n=n.checked,n!=null&&Qo(e,"checked",n,!1)}function ql(e,n){cs(e,n);var t=dn(n.value),r=n.type;if(t!=null)r==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+t):e.value!==""+t&&(e.value=""+t);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?bl(e,n.type,t):n.hasOwnProperty("defaultValue")&&bl(e,n.type,dn(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function Au(e,n,t){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var r=n.type;if(!(r!=="submit"&&r!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,t||n===e.value||(e.value=n),e.defaultValue=n}t=e.name,t!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,t!==""&&(e.name=t)}function bl(e,n,t){(n!=="number"||Tr(e.ownerDocument)!==e)&&(t==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+t&&(e.defaultValue=""+t))}var wt=Array.isArray;function Kn(e,n,t,r){if(e=e.options,n){n={};for(var l=0;l"+n.valueOf().toString()+"",n=lr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;n.firstChild;)e.appendChild(n.firstChild)}});function Ot(e,n){if(n){var t=e.firstChild;if(t&&t===e.lastChild&&t.nodeType===3){t.nodeValue=n;return}}e.textContent=n}var Et={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},jc=["Webkit","ms","Moz","O"];Object.keys(Et).forEach(function(e){jc.forEach(function(n){n=n+e.charAt(0).toUpperCase()+e.substring(1),Et[n]=Et[e]})});function ms(e,n,t){return n==null||typeof n=="boolean"||n===""?"":t||typeof n!="number"||n===0||Et.hasOwnProperty(e)&&Et[e]?(""+n).trim():n+"px"}function vs(e,n){e=e.style;for(var t in n)if(n.hasOwnProperty(t)){var r=t.indexOf("--")===0,l=ms(t,n[t],r);t==="float"&&(t="cssFloat"),r?e.setProperty(t,l):e[t]=l}}var Fc=V({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 to(e,n){if(n){if(Fc[e]&&(n.children!=null||n.dangerouslySetInnerHTML!=null))throw Error(y(137,e));if(n.dangerouslySetInnerHTML!=null){if(n.children!=null)throw Error(y(60));if(typeof n.dangerouslySetInnerHTML!="object"||!("__html"in n.dangerouslySetInnerHTML))throw Error(y(61))}if(n.style!=null&&typeof n.style!="object")throw Error(y(62))}}function ro(e,n){if(e.indexOf("-")===-1)return typeof n.is=="string";switch(e){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 lo=null;function Go(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var oo=null,Yn=null,Xn=null;function Wu(e){if(e=Jt(e)){if(typeof oo!="function")throw Error(y(280));var n=e.stateNode;n&&(n=ol(n),oo(e.stateNode,e.type,n))}}function hs(e){Yn?Xn?Xn.push(e):Xn=[e]:Yn=e}function ys(){if(Yn){var e=Yn,n=Xn;if(Xn=Yn=null,Wu(e),n)for(e=0;e>>=0,e===0?32:31-(Xc(e)/Gc|0)|0}var or=64,ur=4194304;function St(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Dr(e,n){var t=e.pendingLanes;if(t===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,u=t&268435455;if(u!==0){var i=u&~l;i!==0?r=St(i):(o&=u,o!==0&&(r=St(o)))}else u=t&~l,u!==0?r=St(u):o!==0&&(r=St(o));if(r===0)return 0;if(n!==0&&n!==r&&!(n&l)&&(l=r&-r,o=n&-n,l>=o||l===16&&(o&4194240)!==0))return n;if(r&4&&(r|=t&16),n=e.entangledLanes,n!==0)for(e=e.entanglements,n&=r;0t;t++)n.push(e);return n}function Gt(e,n,t){e.pendingLanes|=n,n!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,n=31-Oe(n),e[n]=t}function bc(e,n){var t=e.pendingLanes&~n;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=n,e.mutableReadLanes&=n,e.entangledLanes&=n,n=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=_t),bu=String.fromCharCode(32),ei=!1;function Fs(e,n){switch(e){case"keyup":return zf.indexOf(n.keyCode)!==-1;case"keydown":return n.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Us(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var jn=!1;function Tf(e,n){switch(e){case"compositionend":return Us(n);case"keypress":return n.which!==32?null:(ei=!0,bu);case"textInput":return e=n.data,e===bu&&ei?null:e;default:return null}}function Rf(e,n){if(jn)return e==="compositionend"||!ru&&Fs(e,n)?(e=Is(),kr=eu=nn=null,jn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(n.ctrlKey||n.altKey||n.metaKey)||n.ctrlKey&&n.altKey){if(n.char&&1=n)return{node:t,offset:n-e};e=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=li(t)}}function Bs(e,n){return e&&n?e===n?!0:e&&e.nodeType===3?!1:n&&n.nodeType===3?Bs(e,n.parentNode):"contains"in e?e.contains(n):e.compareDocumentPosition?!!(e.compareDocumentPosition(n)&16):!1:!1}function Hs(){for(var e=window,n=Tr();n instanceof e.HTMLIFrameElement;){try{var t=typeof n.contentWindow.location.href=="string"}catch{t=!1}if(t)e=n.contentWindow;else break;n=Tr(e.document)}return n}function lu(e){var n=e&&e.nodeName&&e.nodeName.toLowerCase();return n&&(n==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||n==="textarea"||e.contentEditable==="true")}function Vf(e){var n=Hs(),t=e.focusedElem,r=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&Bs(t.ownerDocument.documentElement,t)){if(r!==null&&lu(t)){if(n=r.start,e=r.end,e===void 0&&(e=n),"selectionStart"in t)t.selectionStart=n,t.selectionEnd=Math.min(e,t.value.length);else if(e=(n=t.ownerDocument||document)&&n.defaultView||window,e.getSelection){e=e.getSelection();var l=t.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=oi(t,o);var u=oi(t,r);l&&u&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(n=n.createRange(),n.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(n),e.extend(u.node,u.offset)):(n.setEnd(u.node,u.offset),e.addRange(n)))}}for(n=[],e=t;e=e.parentNode;)e.nodeType===1&&n.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,Fn=null,fo=null,Pt=null,po=!1;function ui(e,n,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;po||Fn==null||Fn!==Tr(r)||(r=Fn,"selectionStart"in r&&lu(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Pt&&Ut(Pt,r)||(Pt=r,r=Fr(fo,"onSelect"),0Vn||(e.current=wo[Vn],wo[Vn]=null,Vn--)}function D(e,n){Vn++,wo[Vn]=e.current,e.current=n}var pn={},le=vn(pn),fe=vn(!1),Pn=pn;function bn(e,n){var t=e.type.contextTypes;if(!t)return pn;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===n)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in t)l[o]=n[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=l),l}function de(e){return e=e.childContextTypes,e!=null}function $r(){j(fe),j(le)}function pi(e,n,t){if(le.current!==pn)throw Error(y(168));D(le,n),D(fe,t)}function qs(e,n,t){var r=e.stateNode;if(n=n.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var l in r)if(!(l in n))throw Error(y(108,Dc(e)||"Unknown",l));return V({},t,r)}function Vr(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pn,Pn=le.current,D(le,e),D(fe,fe.current),!0}function mi(e,n,t){var r=e.stateNode;if(!r)throw Error(y(169));t?(e=qs(e,n,Pn),r.__reactInternalMemoizedMergedChildContext=e,j(fe),j(le),D(le,e)):j(fe),D(fe,t)}var Ae=null,ul=!1,jl=!1;function bs(e){Ae===null?Ae=[e]:Ae.push(e)}function qf(e){ul=!0,bs(e)}function hn(){if(!jl&&Ae!==null){jl=!0;var e=0,n=O;try{var t=Ae;for(O=1;e>=u,l-=u,Be=1<<32-Oe(n)+l|t<P?(B=x,x=null):B=x.sibling;var T=p(f,x,d[P],h);if(T===null){x===null&&(x=B);break}e&&x&&T.alternate===null&&n(f,x),a=o(T,a,P),_===null?E=T:_.sibling=T,_=T,x=B}if(P===d.length)return t(f,x),F&&wn(f,P),E;if(x===null){for(;PP?(B=x,x=null):B=x.sibling;var Ne=p(f,x,T.value,h);if(Ne===null){x===null&&(x=B);break}e&&x&&Ne.alternate===null&&n(f,x),a=o(Ne,a,P),_===null?E=Ne:_.sibling=Ne,_=Ne,x=B}if(T.done)return t(f,x),F&&wn(f,P),E;if(x===null){for(;!T.done;P++,T=d.next())T=m(f,T.value,h),T!==null&&(a=o(T,a,P),_===null?E=T:_.sibling=T,_=T);return F&&wn(f,P),E}for(x=r(f,x);!T.done;P++,T=d.next())T=g(x,f,P,T.value,h),T!==null&&(e&&T.alternate!==null&&x.delete(T.key===null?P:T.key),a=o(T,a,P),_===null?E=T:_.sibling=T,_=T);return e&&x.forEach(function(st){return n(f,st)}),F&&wn(f,P),E}function M(f,a,d,h){if(typeof d=="object"&&d!==null&&d.type===In&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case tr:e:{for(var E=d.key,_=a;_!==null;){if(_.key===E){if(E=d.type,E===In){if(_.tag===7){t(f,_.sibling),a=l(_,d.props.children),a.return=f,f=a;break e}}else if(_.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===Je&&ki(E)===_.type){t(f,_.sibling),a=l(_,d.props),a.ref=vt(f,_,d),a.return=f,f=a;break e}t(f,_);break}else n(f,_);_=_.sibling}d.type===In?(a=xn(d.props.children,f.mode,h,d.key),a.return=f,f=a):(h=Lr(d.type,d.key,d.props,null,f.mode,h),h.ref=vt(f,a,d),h.return=f,f=h)}return u(f);case Dn:e:{for(_=d.key;a!==null;){if(a.key===_)if(a.tag===4&&a.stateNode.containerInfo===d.containerInfo&&a.stateNode.implementation===d.implementation){t(f,a.sibling),a=l(a,d.children||[]),a.return=f,f=a;break e}else{t(f,a);break}else n(f,a);a=a.sibling}a=Wl(d,f.mode,h),a.return=f,f=a}return u(f);case Je:return _=d._init,M(f,a,_(d._payload),h)}if(wt(d))return w(f,a,d,h);if(ct(d))return S(f,a,d,h);pr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,a!==null&&a.tag===6?(t(f,a.sibling),a=l(a,d),a.return=f,f=a):(t(f,a),a=Hl(d,f.mode,h),a.return=f,f=a),u(f)):t(f,a)}return M}var nt=ia(!0),sa=ia(!1),qt={},$e=vn(qt),Bt=vn(qt),Ht=vn(qt);function Cn(e){if(e===qt)throw Error(y(174));return e}function pu(e,n){switch(D(Ht,n),D(Bt,e),D($e,qt),e=n.nodeType,e){case 9:case 11:n=(n=n.documentElement)?n.namespaceURI:no(null,"");break;default:e=e===8?n.parentNode:n,n=e.namespaceURI||null,e=e.tagName,n=no(n,e)}j($e),D($e,n)}function tt(){j($e),j(Bt),j(Ht)}function aa(e){Cn(Ht.current);var n=Cn($e.current),t=no(n,e.type);n!==t&&(D(Bt,e),D($e,t))}function mu(e){Bt.current===e&&(j($e),j(Bt))}var U=vn(0);function Kr(e){for(var n=e;n!==null;){if(n.tag===13){var t=n.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return n}else if(n.tag===19&&n.memoizedProps.revealOrder!==void 0){if(n.flags&128)return n}else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return null;n=n.return}n.sibling.return=n.return,n=n.sibling}return null}var Fl=[];function vu(){for(var e=0;et?t:4,e(!0);var r=Ul.transition;Ul.transition={};try{e(!1),n()}finally{O=t,Ul.transition=r}}function xa(){return Pe().memoizedState}function td(e,n,t){var r=cn(e);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},Pa(e))Na(n,t);else if(t=ra(e,n,t,r),t!==null){var l=ue();Me(t,e,r,l),za(t,n,r)}}function rd(e,n,t){var r=cn(e),l={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(Pa(e))Na(n,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=n.lastRenderedReducer,o!==null))try{var u=n.lastRenderedState,i=o(u,t);if(l.hasEagerState=!0,l.eagerState=i,De(i,u)){var s=n.interleaved;s===null?(l.next=l,fu(n)):(l.next=s.next,s.next=l),n.interleaved=l;return}}catch{}finally{}t=ra(e,n,l,r),t!==null&&(l=ue(),Me(t,e,r,l),za(t,n,r))}}function Pa(e){var n=e.alternate;return e===$||n!==null&&n===$}function Na(e,n){Nt=Yr=!0;var t=e.pending;t===null?n.next=n:(n.next=t.next,t.next=n),e.pending=n}function za(e,n,t){if(t&4194240){var r=n.lanes;r&=e.pendingLanes,t|=r,n.lanes=t,Jo(e,t)}}var Xr={readContext:xe,useCallback:ne,useContext:ne,useEffect:ne,useImperativeHandle:ne,useInsertionEffect:ne,useLayoutEffect:ne,useMemo:ne,useReducer:ne,useRef:ne,useState:ne,useDebugValue:ne,useDeferredValue:ne,useTransition:ne,useMutableSource:ne,useSyncExternalStore:ne,useId:ne,unstable_isNewReconciler:!1},ld={readContext:xe,useCallback:function(e,n){return je().memoizedState=[e,n===void 0?null:n],e},useContext:xe,useEffect:Ci,useImperativeHandle:function(e,n,t){return t=t!=null?t.concat([e]):null,xr(4194308,4,Sa.bind(null,n,e),t)},useLayoutEffect:function(e,n){return xr(4194308,4,e,n)},useInsertionEffect:function(e,n){return xr(4,2,e,n)},useMemo:function(e,n){var t=je();return n=n===void 0?null:n,e=e(),t.memoizedState=[e,n],e},useReducer:function(e,n,t){var r=je();return n=t!==void 0?t(n):n,r.memoizedState=r.baseState=n,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:n},r.queue=e,e=e.dispatch=td.bind(null,$,e),[r.memoizedState,e]},useRef:function(e){var n=je();return e={current:e},n.memoizedState=e},useState:Ei,useDebugValue:Su,useDeferredValue:function(e){return je().memoizedState=e},useTransition:function(){var e=Ei(!1),n=e[0];return e=nd.bind(null,e[1]),je().memoizedState=e,[n,e]},useMutableSource:function(){},useSyncExternalStore:function(e,n,t){var r=$,l=je();if(F){if(t===void 0)throw Error(y(407));t=t()}else{if(t=n(),J===null)throw Error(y(349));zn&30||da(r,n,t)}l.memoizedState=t;var o={value:t,getSnapshot:n};return l.queue=o,Ci(ma.bind(null,r,o,e),[e]),r.flags|=2048,Kt(9,pa.bind(null,r,o,t,n),void 0,null),t},useId:function(){var e=je(),n=J.identifierPrefix;if(F){var t=He,r=Be;t=(r&~(1<<32-Oe(r)-1)).toString(32)+t,n=":"+n+"R"+t,t=Wt++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=u.createElement(t,{is:r.is}):(e=u.createElement(t),t==="select"&&(u=e,r.multiple?u.multiple=!0:r.size&&(u.size=r.size))):e=u.createElementNS(e,t),e[Fe]=n,e[At]=r,Fa(e,n,!1,!1),n.stateNode=e;e:{switch(u=ro(t,r),t){case"dialog":I("cancel",e),I("close",e),l=r;break;case"iframe":case"object":case"embed":I("load",e),l=r;break;case"video":case"audio":for(l=0;llt&&(n.flags|=128,r=!0,ht(o,!1),n.lanes=4194304)}else{if(!r)if(e=Kr(u),e!==null){if(n.flags|=128,r=!0,t=e.updateQueue,t!==null&&(n.updateQueue=t,n.flags|=4),ht(o,!0),o.tail===null&&o.tailMode==="hidden"&&!u.alternate&&!F)return te(n),null}else 2*W()-o.renderingStartTime>lt&&t!==1073741824&&(n.flags|=128,r=!0,ht(o,!1),n.lanes=4194304);o.isBackwards?(u.sibling=n.child,n.child=u):(t=o.last,t!==null?t.sibling=u:n.child=u,o.last=u)}return o.tail!==null?(n=o.tail,o.rendering=n,o.tail=n.sibling,o.renderingStartTime=W(),n.sibling=null,t=U.current,D(U,r?t&1|2:t&1),n):(te(n),null);case 22:case 23:return Pu(),r=n.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(n.flags|=8192),r&&n.mode&1?me&1073741824&&(te(n),n.subtreeFlags&6&&(n.flags|=8192)):te(n),null;case 24:return null;case 25:return null}throw Error(y(156,n.tag))}function dd(e,n){switch(uu(n),n.tag){case 1:return de(n.type)&&$r(),e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 3:return tt(),j(fe),j(le),vu(),e=n.flags,e&65536&&!(e&128)?(n.flags=e&-65537|128,n):null;case 5:return mu(n),null;case 13:if(j(U),e=n.memoizedState,e!==null&&e.dehydrated!==null){if(n.alternate===null)throw Error(y(340));et()}return e=n.flags,e&65536?(n.flags=e&-65537|128,n):null;case 19:return j(U),null;case 4:return tt(),null;case 10:return cu(n.type._context),null;case 22:case 23:return Pu(),null;case 24:return null;default:return null}}var vr=!1,re=!1,pd=typeof WeakSet=="function"?WeakSet:Set,k=null;function Wn(e,n){var t=e.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){A(e,n,r)}else t.current=null}function Ro(e,n,t){try{t()}catch(r){A(e,n,r)}}var Oi=!1;function md(e,n){if(mo=Ir,e=Hs(),lu(e)){if("selectionStart"in e)var t={start:e.selectionStart,end:e.selectionEnd};else e:{t=(t=e.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{t.nodeType,o.nodeType}catch{t=null;break e}var u=0,i=-1,s=-1,c=0,v=0,m=e,p=null;n:for(;;){for(var g;m!==t||l!==0&&m.nodeType!==3||(i=u+l),m!==o||r!==0&&m.nodeType!==3||(s=u+r),m.nodeType===3&&(u+=m.nodeValue.length),(g=m.firstChild)!==null;)p=m,m=g;for(;;){if(m===e)break n;if(p===t&&++c===l&&(i=u),p===o&&++v===r&&(s=u),(g=m.nextSibling)!==null)break;m=p,p=m.parentNode}m=g}t=i===-1||s===-1?null:{start:i,end:s}}else t=null}t=t||{start:0,end:0}}else t=null;for(vo={focusedElem:e,selectionRange:t},Ir=!1,k=n;k!==null;)if(n=k,e=n.child,(n.subtreeFlags&1028)!==0&&e!==null)e.return=n,k=e;else for(;k!==null;){n=k;try{var w=n.alternate;if(n.flags&1024)switch(n.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var S=w.memoizedProps,M=w.memoizedState,f=n.stateNode,a=f.getSnapshotBeforeUpdate(n.elementType===n.type?S:Le(n.type,S),M);f.__reactInternalSnapshotBeforeUpdate=a}break;case 3:var d=n.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(y(163))}}catch(h){A(n,n.return,h)}if(e=n.sibling,e!==null){e.return=n.return,k=e;break}k=n.return}return w=Oi,Oi=!1,w}function zt(e,n,t){var r=n.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&Ro(n,t,o)}l=l.next}while(l!==r)}}function al(e,n){if(n=n.updateQueue,n=n!==null?n.lastEffect:null,n!==null){var t=n=n.next;do{if((t.tag&e)===e){var r=t.create;t.destroy=r()}t=t.next}while(t!==n)}}function Oo(e){var n=e.ref;if(n!==null){var t=e.stateNode;switch(e.tag){case 5:e=t;break;default:e=t}typeof n=="function"?n(e):n.current=e}}function Va(e){var n=e.alternate;n!==null&&(e.alternate=null,Va(n)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(n=e.stateNode,n!==null&&(delete n[Fe],delete n[At],delete n[go],delete n[Zf],delete n[Jf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Aa(e){return e.tag===5||e.tag===3||e.tag===4}function Mi(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Aa(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Mo(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.nodeType===8?t.parentNode.insertBefore(e,n):t.insertBefore(e,n):(t.nodeType===8?(n=t.parentNode,n.insertBefore(e,t)):(n=t,n.appendChild(e)),t=t._reactRootContainer,t!=null||n.onclick!==null||(n.onclick=Ur));else if(r!==4&&(e=e.child,e!==null))for(Mo(e,n,t),e=e.sibling;e!==null;)Mo(e,n,t),e=e.sibling}function Do(e,n,t){var r=e.tag;if(r===5||r===6)e=e.stateNode,n?t.insertBefore(e,n):t.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Do(e,n,t),e=e.sibling;e!==null;)Do(e,n,t),e=e.sibling}var q=null,Te=!1;function Ze(e,n,t){for(t=t.child;t!==null;)Ba(e,n,t),t=t.sibling}function Ba(e,n,t){if(Ue&&typeof Ue.onCommitFiberUnmount=="function")try{Ue.onCommitFiberUnmount(nl,t)}catch{}switch(t.tag){case 5:re||Wn(t,n);case 6:var r=q,l=Te;q=null,Ze(e,n,t),q=r,Te=l,q!==null&&(Te?(e=q,t=t.stateNode,e.nodeType===8?e.parentNode.removeChild(t):e.removeChild(t)):q.removeChild(t.stateNode));break;case 18:q!==null&&(Te?(e=q,t=t.stateNode,e.nodeType===8?Il(e.parentNode,t):e.nodeType===1&&Il(e,t),jt(e)):Il(q,t.stateNode));break;case 4:r=q,l=Te,q=t.stateNode.containerInfo,Te=!0,Ze(e,n,t),q=r,Te=l;break;case 0:case 11:case 14:case 15:if(!re&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,u=o.destroy;o=o.tag,u!==void 0&&(o&2||o&4)&&Ro(t,n,u),l=l.next}while(l!==r)}Ze(e,n,t);break;case 1:if(!re&&(Wn(t,n),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(i){A(t,n,i)}Ze(e,n,t);break;case 21:Ze(e,n,t);break;case 22:t.mode&1?(re=(r=re)||t.memoizedState!==null,Ze(e,n,t),re=r):Ze(e,n,t);break;default:Ze(e,n,t)}}function Di(e){var n=e.updateQueue;if(n!==null){e.updateQueue=null;var t=e.stateNode;t===null&&(t=e.stateNode=new pd),n.forEach(function(r){var l=Cd.bind(null,e,r);t.has(r)||(t.add(r),r.then(l,l))})}}function ze(e,n){var t=n.deletions;if(t!==null)for(var r=0;rl&&(l=u),r&=~o}if(r=l,r=W()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*hd(r/1960))-r,10e?16:e,tn===null)var r=!1;else{if(e=tn,tn=null,Jr=0,R&6)throw Error(y(331));var l=R;for(R|=4,k=e.current;k!==null;){var o=k,u=o.child;if(k.flags&16){var i=o.deletions;if(i!==null){for(var s=0;sW()-_u?_n(e,0):Cu|=t),pe(e,n)}function Za(e,n){n===0&&(e.mode&1?(n=ur,ur<<=1,!(ur&130023424)&&(ur=4194304)):n=1);var t=ue();e=Ye(e,n),e!==null&&(Gt(e,n,t),pe(e,t))}function Ed(e){var n=e.memoizedState,t=0;n!==null&&(t=n.retryLane),Za(e,t)}function Cd(e,n){var t=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(t=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(y(314))}r!==null&&r.delete(n),Za(e,t)}var Ja;Ja=function(e,n,t){if(e!==null)if(e.memoizedProps!==n.pendingProps||fe.current)ce=!0;else{if(!(e.lanes&t)&&!(n.flags&128))return ce=!1,cd(e,n,t);ce=!!(e.flags&131072)}else ce=!1,F&&n.flags&1048576&&ea(n,Br,n.index);switch(n.lanes=0,n.tag){case 2:var r=n.type;Pr(e,n),e=n.pendingProps;var l=bn(n,le.current);Zn(n,t),l=yu(null,n,r,e,l,t);var o=gu();return n.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(n.tag=1,n.memoizedState=null,n.updateQueue=null,de(r)?(o=!0,Vr(n)):o=!1,n.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,du(n),l.updater=il,n.stateNode=l,l._reactInternals=n,_o(n,r,e,t),n=No(null,n,r,!0,o,t)):(n.tag=0,F&&o&&ou(n),oe(null,n,l,t),n=n.child),n;case 16:r=n.elementType;e:{switch(Pr(e,n),e=n.pendingProps,l=r._init,r=l(r._payload),n.type=r,l=n.tag=xd(r),e=Le(r,e),l){case 0:n=Po(null,n,r,e,t);break e;case 1:n=Li(null,n,r,e,t);break e;case 11:n=Ni(null,n,r,e,t);break e;case 14:n=zi(null,n,r,Le(r.type,e),t);break e}throw Error(y(306,r,""))}return n;case 0:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:Le(r,l),Po(e,n,r,l,t);case 1:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:Le(r,l),Li(e,n,r,l,t);case 3:e:{if(Da(n),e===null)throw Error(y(387));r=n.pendingProps,o=n.memoizedState,l=o.element,la(e,n),Qr(n,r,null,t);var u=n.memoizedState;if(r=u.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},n.updateQueue.baseState=o,n.memoizedState=o,n.flags&256){l=rt(Error(y(423)),n),n=Ti(e,n,r,t,l);break e}else if(r!==l){l=rt(Error(y(424)),n),n=Ti(e,n,r,t,l);break e}else for(he=un(n.stateNode.containerInfo.firstChild),ye=n,F=!0,Re=null,t=sa(n,null,r,t),n.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(et(),r===l){n=Xe(e,n,t);break e}oe(e,n,r,t)}n=n.child}return n;case 5:return aa(n),e===null&&ko(n),r=n.type,l=n.pendingProps,o=e!==null?e.memoizedProps:null,u=l.children,ho(r,l)?u=null:o!==null&&ho(r,o)&&(n.flags|=32),Ma(e,n),oe(e,n,u,t),n.child;case 6:return e===null&&ko(n),null;case 13:return Ia(e,n,t);case 4:return pu(n,n.stateNode.containerInfo),r=n.pendingProps,e===null?n.child=nt(n,null,r,t):oe(e,n,r,t),n.child;case 11:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:Le(r,l),Ni(e,n,r,l,t);case 7:return oe(e,n,n.pendingProps,t),n.child;case 8:return oe(e,n,n.pendingProps.children,t),n.child;case 12:return oe(e,n,n.pendingProps.children,t),n.child;case 10:e:{if(r=n.type._context,l=n.pendingProps,o=n.memoizedProps,u=l.value,D(Hr,r._currentValue),r._currentValue=u,o!==null)if(De(o.value,u)){if(o.children===l.children&&!fe.current){n=Xe(e,n,t);break e}}else for(o=n.child,o!==null&&(o.return=n);o!==null;){var i=o.dependencies;if(i!==null){u=o.child;for(var s=i.firstContext;s!==null;){if(s.context===r){if(o.tag===1){s=We(-1,t&-t),s.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var v=c.pending;v===null?s.next=s:(s.next=v.next,v.next=s),c.pending=s}}o.lanes|=t,s=o.alternate,s!==null&&(s.lanes|=t),Eo(o.return,t,n),i.lanes|=t;break}s=s.next}}else if(o.tag===10)u=o.type===n.type?null:o.child;else if(o.tag===18){if(u=o.return,u===null)throw Error(y(341));u.lanes|=t,i=u.alternate,i!==null&&(i.lanes|=t),Eo(u,t,n),u=o.sibling}else u=o.child;if(u!==null)u.return=o;else for(u=o;u!==null;){if(u===n){u=null;break}if(o=u.sibling,o!==null){o.return=u.return,u=o;break}u=u.return}o=u}oe(e,n,l.children,t),n=n.child}return n;case 9:return l=n.type,r=n.pendingProps.children,Zn(n,t),l=xe(l),r=r(l),n.flags|=1,oe(e,n,r,t),n.child;case 14:return r=n.type,l=Le(r,n.pendingProps),l=Le(r.type,l),zi(e,n,r,l,t);case 15:return Ra(e,n,n.type,n.pendingProps,t);case 17:return r=n.type,l=n.pendingProps,l=n.elementType===r?l:Le(r,l),Pr(e,n),n.tag=1,de(r)?(e=!0,Vr(n)):e=!1,Zn(n,t),ua(n,r,l),_o(n,r,l,t),No(null,n,r,!0,e,t);case 19:return ja(e,n,t);case 22:return Oa(e,n,t)}throw Error(y(156,n.tag))};function qa(e,n){return _s(e,n)}function _d(e,n,t,r){this.tag=e,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=n,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ce(e,n,t,r){return new _d(e,n,t,r)}function zu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xd(e){if(typeof e=="function")return zu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Yo)return 11;if(e===Xo)return 14}return 2}function fn(e,n){var t=e.alternate;return t===null?(t=Ce(e.tag,n,e.key,e.mode),t.elementType=e.elementType,t.type=e.type,t.stateNode=e.stateNode,t.alternate=e,e.alternate=t):(t.pendingProps=n,t.type=e.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=e.flags&14680064,t.childLanes=e.childLanes,t.lanes=e.lanes,t.child=e.child,t.memoizedProps=e.memoizedProps,t.memoizedState=e.memoizedState,t.updateQueue=e.updateQueue,n=e.dependencies,t.dependencies=n===null?null:{lanes:n.lanes,firstContext:n.firstContext},t.sibling=e.sibling,t.index=e.index,t.ref=e.ref,t}function Lr(e,n,t,r,l,o){var u=2;if(r=e,typeof e=="function")zu(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case In:return xn(t.children,l,o,n);case Ko:u=8,l|=8;break;case Yl:return e=Ce(12,t,n,l|2),e.elementType=Yl,e.lanes=o,e;case Xl:return e=Ce(13,t,n,l),e.elementType=Xl,e.lanes=o,e;case Gl:return e=Ce(19,t,n,l),e.elementType=Gl,e.lanes=o,e;case is:return fl(t,l,o,n);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case os:u=10;break e;case us:u=9;break e;case Yo:u=11;break e;case Xo:u=14;break e;case Je:u=16,r=null;break e}throw Error(y(130,e==null?e:typeof e,""))}return n=Ce(u,t,n,l),n.elementType=e,n.type=r,n.lanes=o,n}function xn(e,n,t,r){return e=Ce(7,e,r,n),e.lanes=t,e}function fl(e,n,t,r){return e=Ce(22,e,r,n),e.elementType=is,e.lanes=t,e.stateNode={isHidden:!1},e}function Hl(e,n,t){return e=Ce(6,e,null,n),e.lanes=t,e}function Wl(e,n,t){return n=Ce(4,e.children!==null?e.children:[],e.key,n),n.lanes=t,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function Pd(e,n,t,r,l){this.tag=n,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=_l(0),this.expirationTimes=_l(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_l(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Lu(e,n,t,r,l,o,u,i,s){return e=new Pd(e,n,t,i,s),n===1?(n=1,o===!0&&(n|=8)):n=0,o=Ce(3,null,null,n),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},du(o),e}function Nd(e,n,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(tc)}catch(e){console.error(e)}}tc(),es.exports=we;var Od=es.exports,Md,Bi=Od;Md=Ql.createRoot=Bi.createRoot,Ql.hydrateRoot=Bi.hydrateRoot;const Dd="modulepreload",Id=function(e){return"/"+e},Hi={},jd=function(n,t,r){if(!t||t.length===0)return n();const l=document.getElementsByTagName("link");return Promise.all(t.map(o=>{if(o=Id(o),o in Hi)return;Hi[o]=!0;const u=o.endsWith(".css"),i=u?'[rel="stylesheet"]':"";if(!!r)for(let v=l.length-1;v>=0;v--){const m=l[v];if(m.href===o&&(!u||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${i}`))return;const c=document.createElement("link");if(c.rel=u?"stylesheet":Dd,u||(c.as="script",c.crossOrigin=""),c.href=o,document.head.appendChild(c),u)return new Promise((v,m)=>{c.addEventListener("load",v),c.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>n()).catch(o=>{const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=o,window.dispatchEvent(u),!u.defaultPrevented)throw o})},Fd=Object.assign({"../pages/hello/index.mdx":()=>jd(()=>import("./index-1d7f1b78.js"),[])}),Ud=Object.entries(Fd).map(([e,n])=>({slug:e.replace("./pages/","").replace("/index.mdx",""),loader:n})),rc=K.createContext({vars:{},run:async()=>{}}),$d=({vars:e={},children:n})=>{const t=K.useMemo(()=>e,[e]),r=K.useCallback(async l=>await l(t),[t]);return ve.jsx(rc.Provider,{value:{vars:e,run:r},children:n})},Vd=function*(){let e=0;for(;;)yield e++}(),Hd=({worker:e,action:n,presenter:t})=>{const r=K.useRef(Vd.next().value),{vars:l}=K.useContext(rc),[o,u]=K.useState(),[i,s]=K.useState(),[c,v]=K.useState(),[m,p]=K.useState(),g=K.useMemo(()=>i?i.toString():t?ve.jsx(t,{output:o}):JSON.stringify(o,null,2),[o,i,t]),w=K.useCallback(async()=>{v(!0),s(void 0),u(void 0);try{e.postMessage({type:"run",action:n,vars:l,id:r.current})}catch(S){s(S)}v(!1)},[e,l,n]);return K.useEffect(()=>{const S=M=>{const{type:f,payload:a,id:d,duration:h}=M.data;d===r.current&&(p(h),v(!1),f==="output"&&u(a),f==="error"&&s(a))};return e.addEventListener("message",S),()=>{e.removeEventListener("message",S)}},[e]),ve.jsxs("div",{children:[ve.jsx("button",{onClick:w,disabled:c,children:"Run"}),m&&ve.jsxs("div",{children:["Duration: ",m.toFixed(2),"ms"]}),c&&ve.jsx("div",{children:"Running..."}),g]})},Ad=({slug:e})=>{const[n,t]=K.useState(),[r,l]=K.useState(!0),[o,u]=K.useState();return K.useEffect(()=>{l(!0),u(void 0),(async()=>{try{const s=Ud.find(v=>v.slug===e);if(!s)throw new Error(`Page not found: ${e}`);const{default:c}=await s.loader();t(()=>c)}catch(s){u(s)}finally{l(!1)}})()},[e]),o?ve.jsxs("div",{children:["Error: ",o.toString()]}):r||!n?ve.jsx("div",{children:"Loading..."}):ve.jsx($d,{children:ve.jsx(n,{})})},Bd=()=>ve.jsx(Ad,{slug:".hello"});Ql.createRoot(document.getElementById("root")).render(ve.jsx(kc.StrictMode,{children:ve.jsx(Bd,{})}));export{Hd as B,kc as R,Md as c,oc as g,ve as j,K as r}; diff --git a/assets/script-8e2076e1.js b/assets/script-8e2076e1.js new file mode 100644 index 0000000..fd41cdc --- /dev/null +++ b/assets/script-8e2076e1.js @@ -0,0 +1 @@ +(function(){"use strict";const x=({node:t})=>!!t.remaining.find(o=>o.start?o.start.max{if(x({node:t}))return t.deadEnd=!0,[];const s=await Promise.all(o.map(async i=>i.getMetaNodes?(await i.getMetaNodes(t)).map(n=>({...n,parent:t.id,exploreId:0,id:e()})):[]));return[...t.remaining.filter(i=>!o.some(n=>n.isPlanable&&!n.isPlanable(t,i))).map(i=>{var m;const n=t.remaining.map(d=>d===i?{...d,count:(d.count||1)-1}:d).filter(d=>d.count!==0),u=Math.max(t.time+t.duration,((m=i.start)==null?void 0:m.min)||0);return{...t,type:"planable",exploreId:0,id:e(),score:t.score+i.score,planable:i.id,time:u,duration:i.duration,remaining:n,completed:n.length===0,parent:t.id}}),...s.flat()]},w=()=>{let t=0;return()=>(t+=1,t.toString())},N=async({location:t,time:e,planables:o,plugins:r,heuristic:s,onUpdated:c})=>{const g=w();let i=1;const l={id:g(),type:"root",score:0,parent:null,duration:0,time:e,location:t,exploreId:0,remaining:o},n=[l],u=[l],m=[],d=()=>{const b=Math.max(...u.map(f=>f.score)),p=u.find(f=>f.score===b);if(!p)throw new Error("No highest score node");return u.splice(u.indexOf(p),1),p};for(;u.length>0;){const b=d();b.exploreId=i++;const p=await y({node:b,generateId:g,plugins:r});if(n.push(...p),m.push(...p.filter(f=>f.remaining.length===0)),u.push(...p.filter(f=>f.remaining.length>0)),s&&s({root:l,nodes:n,completed:m,planables:o}))break;c&&c({root:l,nodes:n,completed:m,planables:o})}return{root:l,nodes:n,completed:m,planables:o}},k={transport:({getTravelTime:t})=>({getMetaNodes:async e=>{const o=e.type!=="travel"&&[...new Set(e.remaining.map(s=>{var c;return(c=s.attributes)==null?void 0:c.locations}).flat())].filter(s=>s!==e.location).filter(Boolean).map(s=>s)||[];return await Promise.all(o.map(async s=>{const c=await t(e.location,s);return{...e,type:"travel",planable:void 0,location:s,exploreId:0,score:e.score-20,time:e.time+e.duration,duration:c,parent:e.id}}))},isPlanable:(e,o)=>{var r,s;return!((r=o.attributes)!=null&&r.locations&&!((s=o.attributes)!=null&&s.locations.includes(e.location)))}})},I=t=>{self.addEventListener("message",e=>{const{action:o,vars:r={},id:s}=e.data;(async()=>{const g=performance.now();try{const i=await t[o](r),n=performance.now()-g;self.postMessage({type:"output",payload:i,id:s,duration:n})}catch(i){self.postMessage({type:"error",payload:i,id:s})}})()})};function M(t){let e=t/1e3;const o=e/3600;e=e%3600;const r=e/60;return e=e%60,o+":"+r+":"+e}const v=t=>{const e=t.nodes.map(r=>{let s=`root (${r.location})`;return r.type==="planable"?s=`task: ${r.planable.toString()}`:r.type==="travel"&&(s=`travel->${r.location}`),{id:r.id,label:`${M(r.time)}: ${s}`,data:{type:r.type,exploreId:r.exploreId,completed:r.completed,deadEnd:r.deadEnd}}}),o=t.nodes.filter(r=>r.parent).map(r=>({id:`${r.id}->${r.parent}`,source:r.parent,target:r.id,label:r.score.toFixed(2)}));return{nodes:e,edges:o,result:t}},h=1e3*60,a=1e3*60*60,T=async()=>30*h;I({realistic:async()=>{const t=await N({location:"home",time:0,heuristic:({completed:e})=>e.length>=3,plugins:[k.transport({getTravelTime:T})],planables:[{id:"Brush teeth",duration:2*h,start:{min:7*a,max:8*a},attributes:{locations:["home"]},score:1},{id:"Drop off kids",duration:30*h,attributes:{locations:["daycare"]},score:1,start:{min:7*a,max:9*a}},{id:"Pickup the kids",duration:30*h,attributes:{locations:["daycare"]},score:1,start:{min:15*a,max:15.5*a}},{id:"Eat breakfast",duration:15*h,start:{min:7*a,max:9*a},attributes:{locations:["home"]},score:1},{id:"Do work",duration:1*a,count:5,attributes:{locations:["work"]},score:10,start:{min:8*a,max:18*a}},{id:"Read book",duration:.5*a,attributes:{locations:["home","work"]},score:3,count:2,start:{min:8*a,max:22*a}},{id:"Meditate",duration:10*h,score:1,attributes:{},start:{min:8*a,max:22*a}},{id:"Meeting 1",duration:1*a,attributes:{locations:["work","work"]},score:10,start:{min:10*a,max:10*a}},{id:"Meeting 2",duration:1*a,attributes:{locations:["work","work"]},score:10,start:{min:12*a,max:12*a}},{id:"Play playstation",duration:1*a,attributes:{locations:["home"]},score:10,start:{min:16*a,max:24*a}}]});return v(t)}})})(); diff --git a/index.html b/index.html new file mode 100644 index 0000000..8679706 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + Vite + React + TS + + + +
+ + +